diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-20 07:01:05 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-20 07:01:05 +0800 |
commit | 53aa1e8e60b7c9a48348caddccebefe81249d28f (patch) | |
tree | 2218a2aca6def87cb79f358e22c3f88d284f12f7 /libempathy-gtk | |
parent | 1b6eb54659ae0baaded2df37b0ebbbaa86fff97c (diff) | |
download | gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar.gz gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar.bz2 gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar.lz gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar.xz gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.tar.zst gsoc2013-empathy-53aa1e8e60b7c9a48348caddccebefe81249d28f.zip |
Make possible to show "ghelp:" URIs and display a dialog in case of error in empathy_url_show. Use that to show empathy's doc.
svn path=/trunk/; revision=996
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 6aa800bb0..e1a0188dd 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1295,7 +1295,7 @@ empathy_get_toplevel_window (GtkWidget *widget) static gchar * fixup_url (const gchar *url) { - if (!g_str_has_prefix (url, "http://") && + if (!g_str_has_prefix (url, "ghelp:") && !strstr (url, ":/") && !strstr (url, "@")) { return g_strdup_printf ("http://%s", url); @@ -1307,21 +1307,32 @@ fixup_url (const gchar *url) void empathy_url_show (const char *url) { - gchar *real_url; - gboolean res; - GError *error = NULL; + gchar *real_url; + GError *error = NULL; real_url = fixup_url (url); if (real_url) { url = real_url; } + /* FIXME: this does not work for multihead, we should use - * GdkAppLaunchContext for that, when we can depend on GTK+ trunk + * GdkAppLaunchContext or gtk_show_url, see bug #514396. */ - res = g_app_info_launch_default_for_uri (url, NULL, &error); - if (!res) { - empathy_debug (DEBUG_DOMAIN, "Couldn't show URL %s: %s", - url, error->message); + g_app_info_launch_default_for_uri (url, NULL, &error); + if (error) { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("Unable to open uri")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + error->message); + + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); + gtk_window_present (GTK_WINDOW (dialog)); + g_clear_error (&error); } |