diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-11 22:20:50 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-11 22:20:50 +0800 |
commit | e0610b2e0cea191f631dc825cdc8023cdcd9433d (patch) | |
tree | 239b20ce4632d6538b9c664ddec883b6e19c11b5 /e-util | |
parent | 59d1f3405c653eb45ca462508d5e6ed968513e42 (diff) | |
download | gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.tar.gz gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.tar.zst gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.zip |
Continue chipping away at EMFolderView and EMFolderBrowser.
Migrate from gnome_url_show() to e_show_uri().
svn path=/branches/kill-bonobo/; revision=37038
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-error.c | 10 | ||||
-rw-r--r-- | e-util/e-util.c | 44 | ||||
-rw-r--r-- | e-util/e-util.h | 2 |
3 files changed, 48 insertions, 8 deletions
diff --git a/e-util/e-error.c b/e-util/e-error.c index 763a9ca540..da4d034606 100644 --- a/e-util/e-error.c +++ b/e-util/e-error.c @@ -30,10 +30,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <libgnome/gnome-url.h> #include <libedataserver/e-xml-utils.h> +#include "e-util.h" #include "e-util-private.h" #include "e-error.h" @@ -395,15 +395,9 @@ ee_build_label(GString *out, const char *fmt, GPtrArray *args, static void ee_response(GtkWidget *w, guint button, struct _e_error *e) { - GError *err = NULL; - if (button == GTK_RESPONSE_HELP) { g_signal_stop_emission_by_name(w, "response"); - gnome_url_show(e->help_uri, &err); - if (err) { - g_warning("Unable to run help uri: %s", err->message); - g_error_free(err); - } + e_display_help (GTK_WINDOW (w), e->help_uri); } } diff --git a/e-util/e-util.c b/e-util/e-util.c index 148d89a414..a5e6c6b548 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -92,6 +92,50 @@ e_get_accels_filename (void) } /** + * e_show_uri: + * @parent: a parent #GtkWindow or %NULL + * @uri: the URI to show + * + * Launches the default application to show the given URI. The URI must + * be of a form understood by GIO. If the URI cannot be shown, it presents + * a dialog describing the error. The dialog is set as transient to @parent + * if @parent is non-%NULL. + **/ +void +e_show_uri (GtkWindow *parent, + const gchar *uri) +{ + GtkWidget *dialog; + GdkScreen *screen = NULL; + GError *error = NULL; + guint32 timestamp; + + g_return_if_fail (uri != NULL); + + timestamp = gtk_get_current_event_time (); + + if (parent != NULL) + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + + if (gtk_show_uri (screen, uri, timestamp, &error)) + return; + + dialog = gtk_message_dialog_new_with_markup ( + parent, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "<big><b>%s</b></big>", + _("Could not open the link.")); + + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), "%s", error->message); + + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + g_error_free (error); +} + +/** * e_display_help: * @parent: a parent #GtkWindow or %NULL * @link_id: help section to present or %NULL diff --git a/e-util/e-util.h b/e-util/e-util.h index 0d2628bbf0..28d7a50a39 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -42,6 +42,8 @@ typedef enum { const gchar * e_get_user_data_dir (void); const gchar * e_get_accels_filename (void); +void e_show_uri (GtkWindow *parent, + const gchar *uri); void e_display_help (GtkWindow *parent, const gchar *link_id); guint e_load_ui_definition (GtkUIManager *ui_manager, |