Use gtk_show_uri, GIO or Exo to open email adresses
This commit is contained in:
parent
5d41589437
commit
13dc1502c8
3 changed files with 37 additions and 13 deletions
|
@ -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
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -31,6 +31,21 @@ g_strcmp0 (const gchar* string1,
|
||||||
|
|
||||||
#endif
|
#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)
|
#if !GTK_CHECK_VERSION(2, 12, 0)
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -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
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -16,20 +16,15 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <glib.h>
|
#include <webkit/webkit.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 14, 0)
|
#if !GLIB_CHECK_VERSION (2, 14, 0)
|
||||||
#define G_PARAM_STATIC_STRINGS \
|
#define G_PARAM_STATIC_STRINGS \
|
||||||
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
||||||
#endif
|
#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)
|
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
@ -38,6 +33,16 @@ g_strcmp0 (const gchar* string1,
|
||||||
|
|
||||||
#endif
|
#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)
|
#if !GTK_CHECK_VERSION(2, 12, 0)
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -2777,9 +2777,13 @@ _action_about_activate_email (GtkAboutDialog* about,
|
||||||
const gchar* uri,
|
const gchar* uri,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gchar* command = g_strconcat ("xdg-open ", uri, NULL);
|
if (!gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL))
|
||||||
g_spawn_command_line_async (command, NULL);
|
{
|
||||||
g_free (command);
|
/* 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
|
static void
|
||||||
|
|
Loading…
Reference in a new issue