Use gtk_show_uri, GIO or Exo to open email adresses

This commit is contained in:
Christian Dywan 2009-03-16 01:21:59 +01:00
parent 5d41589437
commit 13dc1502c8
3 changed files with 37 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -31,6 +31,21 @@ g_strcmp0 (const gchar* string1,
#endif
#if !GTK_CHECK_VERSION (2, 14, 0)
gboolean
gtk_show_uri (GdkScreen* screen,
const gchar* uri,
guint32 timestamp,
GError** error)
{
g_return_val_if_fail (uri != NULL, FALSE);
return g_app_info_launch_default_for_uri (uri, NULL, NULL);
}
#endif
#if !GTK_CHECK_VERSION(2, 12, 0)
void

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -16,20 +16,15 @@
#include <config.h>
#endif
#include <glib.h>
#include <webkit/webkit.h>
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION (2, 14, 0)
#define G_PARAM_STATIC_STRINGS \
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
#endif
#if GLIB_CHECK_VERSION (2, 16, 0)
#include <gio/gio.h>
#endif
#include <webkit/webkit.h>
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION (2, 16, 0)
gint
@ -38,6 +33,16 @@ g_strcmp0 (const gchar* string1,
#endif
#if !GTK_CHECK_VERSION (2, 14, 0)
gboolean
gtk_show_uri (GdkScreen* screen,
const gchar* uri,
guint32 timestamp,
GError** error);
#endif
#if !GTK_CHECK_VERSION(2, 12, 0)
void

View file

@ -2777,9 +2777,13 @@ _action_about_activate_email (GtkAboutDialog* about,
const gchar* uri,
gpointer user_data)
{
gchar* command = g_strconcat ("xdg-open ", uri, NULL);
g_spawn_command_line_async (command, NULL);
g_free (command);
if (!gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL))
{
/* Fallback to Exo for example if GConf isn't setup */
gchar* command = g_strconcat ("exo-open ", uri, NULL);
g_spawn_command_line_async (command, NULL);
g_free (command);
}
}
static void