evolution r37037 - in trunk: addressbook addressbook/gui/widgets calendar calendar/gui calendar/gui/dialogs composer e-util mail plugins/mailing-list-actions shell widgets/misc



Author: mbarnes
Date: Sun Jan 11 13:55:04 2009
New Revision: 37037
URL: http://svn.gnome.org/viewvc/evolution?rev=37037&view=rev

Log:
2009-01-11  Matthew Barnes  <mbarnes redhat com>

	* e-util/e-util.c (e_show_uri):
	New convenience function calls gtk_show_uri() and displays an
	error dialog if the URI cannot be shown.

	* addressbook/gui/widgets/eab-contact-display.c
	(eab_uri_popup_link_open), (on_link_clicked):
	* calendar/gui/e-cal-component-preview (on_link_clicked):
	* calendar/gui/e-cal-component-memo-preview (on_link_clicked):
	* calendar/gui/e-memo-table.c (open_url_cb):
	* calendar/gui/dialogs/comp-editor.c (open_attachment):
	* composer/e-msg-composer.c (msg_composer_link_clicked):
	* mail/em-folder-view.c (emfv_format_link_clicked):
	* mail/em-popup.c (emp_uri_popup_link_open):
	* plugins/mailing-list-actions/mailing-list-actions.c
	(emla_list_action_do):
	* shell/e-shell-window-commands.c (command_open_faq):
	* widgets/misc/e-attachment-bar.c (eab_icon_clicked_cb):
	* widgets/misc/e-url-entry.c (button_clicked_cb):
	Call e_show_uri() instead of gnome_url_show().

	* e-util/e-error.c (ee_response):
	Call e_display_help() instead of gnome_url_show().

	* mail/em-config.c:
	* mail/em-menu.c:
	Remove unneeded #include <libgnome/gnome-url.h>



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/widgets/eab-contact-display.c
   trunk/calendar/ChangeLog
   trunk/calendar/gui/dialogs/comp-editor.c
   trunk/calendar/gui/e-cal-component-memo-preview.c
   trunk/calendar/gui/e-cal-component-preview.c
   trunk/calendar/gui/e-calendar-table.c
   trunk/calendar/gui/e-memo-table.c
   trunk/composer/ChangeLog
   trunk/composer/e-msg-composer.c
   trunk/e-util/ChangeLog
   trunk/e-util/e-error.c
   trunk/e-util/e-util.c
   trunk/e-util/e-util.h
   trunk/mail/ChangeLog
   trunk/mail/em-config.c
   trunk/mail/em-folder-view.c
   trunk/mail/em-menu.c
   trunk/mail/em-popup.c
   trunk/plugins/mailing-list-actions/ChangeLog
   trunk/plugins/mailing-list-actions/mailing-list-actions.c
   trunk/shell/ChangeLog
   trunk/shell/e-shell-window-commands.c
   trunk/widgets/misc/ChangeLog
   trunk/widgets/misc/e-attachment-bar.c
   trunk/widgets/misc/e-url-entry.c

Modified: trunk/addressbook/gui/widgets/eab-contact-display.c
==============================================================================
--- trunk/addressbook/gui/widgets/eab-contact-display.c	(original)
+++ trunk/addressbook/gui/widgets/eab-contact-display.c	Sun Jan 11 13:55:04 2009
@@ -28,12 +28,12 @@
 #include "eab-popup.h"
 
 #include "eab-gui-util.h"
+#include "e-util/e-util.h"
 #include "e-util/e-html-utils.h"
 #include "e-util/e-icon-factory.h"
 
 #include <string.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-url.h>
 #include <gtkhtml/gtkhtml.h>
 #include <gtkhtml/gtkhtml-stream.h>
 
@@ -81,13 +81,9 @@
 eab_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
 {
 	EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
-	GError *err = NULL;
 
-	gnome_url_show(t->uri, &err);
-	if (err) {
-		g_warning("gnome_url_show: %s", err->message);
-		g_error_free(err);
-	}
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, t->uri);
 }
 
 static void
@@ -258,13 +254,11 @@
 }
 
 static void
-on_link_clicked (GtkHTML *html, const char *url, EABContactDisplay *display)
+on_link_clicked (GtkHTML *html, const char *uri, EABContactDisplay *display)
 {
-	GError *err = NULL;
-
 #ifdef HANDLE_MAILTO_INTERNALLY
-	if (!strncmp (url, "internal-mailto:";, strlen ("internal-mailto:";))) {
-		int mail_num = atoi (url + strlen ("internal-mailto:";));
+	if (!strncmp (uri, "internal-mailto:";, strlen ("internal-mailto:";))) {
+		int mail_num = atoi (uri + strlen ("internal-mailto:";));
 
 		if (mail_num == -1)
 			return;
@@ -275,12 +269,8 @@
 	}
 #endif
 
-	gnome_url_show (url, &err);
-
-	if (err) {
-		g_warning ("gnome_url_show: %s", err->message);
-		g_error_free (err);
-	}
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, uri);
 }
 
 #if 0

Modified: trunk/calendar/gui/dialogs/comp-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/comp-editor.c	(original)
+++ trunk/calendar/gui/dialogs/comp-editor.c	Sun Jan 11 13:55:04 2009
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -34,7 +35,6 @@
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnome/libgnome.h>
 #include <e-util/e-util.h>
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-util-private.h>
@@ -1975,7 +1975,6 @@
 	GList *p;
 	int num;
 	char *attach_file_url;
-	GError *error = NULL;
 
 	if (E_IS_ATTACHMENT_BAR (bar)) {
 		icon_list = GNOME_ICON_LIST (bar);
@@ -2000,11 +1999,7 @@
 			attach_file_url = g_build_path ("/", local_store, filename, NULL);
 
 			/* launch the url now */
-			/* TODO should send GError and handle error conditions
-			 * here */
-			gnome_url_show (attach_file_url, &error);
-			if (error)
-				g_message ("DEBUG: gnome_url_show(%s) failed\n", attach_file_url);
+			e_show_uri (GTK_WINDOW (editor), attach_file_url);
 
 			g_free (filename);
 			g_free (attach_file_url); }

Modified: trunk/calendar/gui/e-cal-component-memo-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-memo-preview.c	(original)
+++ trunk/calendar/gui/e-cal-component-memo-preview.c	Sun Jan 11 13:55:04 2009
@@ -30,12 +30,12 @@
 #include <string.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-url.h>
 #include <libecal/e-cal-time-util.h>
 #include <libedataserver/e-categories.h>
 #include <gtkhtml/gtkhtml.h>
 #include <gtkhtml/gtkhtml-stream.h>
 #include <libedataserver/e-time-utils.h>
+#include <e-util/e-util.h>
 #include <e-util/e-categories-config.h>
 #include "calendar-config.h"
 #include "e-cal-component-memo-preview.h"
@@ -54,14 +54,8 @@
 static void
 on_link_clicked (GtkHTML *html, const char *url, gpointer data)
 {
-        GError *err = NULL;
-
-        gnome_url_show (url, &err);
-
-	if (err) {
-		g_warning ("gnome_url_show: %s", err->message);
-                g_error_free (err);
-        }
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, url);
 }
 
 static void

Modified: trunk/calendar/gui/e-cal-component-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-preview.c	(original)
+++ trunk/calendar/gui/e-cal-component-preview.c	Sun Jan 11 13:55:04 2009
@@ -30,12 +30,12 @@
 #include <gio/gio.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-url.h>
 #include <libedataserver/e-categories.h>
 #include <libecal/e-cal-time-util.h>
 #include <gtkhtml/gtkhtml.h>
 #include <gtkhtml/gtkhtml-stream.h>
 #include <libedataserver/e-time-utils.h>
+#include <e-util/e-util.h>
 #include <e-util/e-categories-config.h>
 #include "calendar-config.h"
 #include "e-cal-component-preview.h"
@@ -52,14 +52,8 @@
 static void
 on_link_clicked (GtkHTML *html, const char *url, gpointer data)
 {
-        GError *err = NULL;
-
-        gnome_url_show (url, &err);
-
-	if (err) {
-		g_warning ("gnome_url_show: %s", err->message);
-                g_error_free (err);
-        }
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, url);
 }
 
 static void

Modified: trunk/calendar/gui/e-calendar-table.c
==============================================================================
--- trunk/calendar/gui/e-calendar-table.c	(original)
+++ trunk/calendar/gui/e-calendar-table.c	Sun Jan 11 13:55:04 2009
@@ -1554,7 +1554,8 @@
 	if (!prop)
 		return;
 
-	gnome_url_show (icalproperty_get_url (prop), NULL);
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, icalproperty_get_url (prop));
 }
 
 /* Opens a new task editor */

Modified: trunk/calendar/gui/e-memo-table.c
==============================================================================
--- trunk/calendar/gui/e-memo-table.c	(original)
+++ trunk/calendar/gui/e-memo-table.c	Sun Jan 11 13:55:04 2009
@@ -36,7 +36,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-url.h>
 #include <widgets/misc/e-gui-utils.h>
 #include <table/e-cell-checkbox.h>
 #include <table/e-cell-toggle.h>
@@ -907,7 +906,8 @@
 	if (!prop)
 		return;
 
-	gnome_url_show (icalproperty_get_url (prop), NULL);
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, icalproperty_get_url (prop));
 }
 
 /* Callback for the "delete tasks" menu item */

Modified: trunk/composer/e-msg-composer.c
==============================================================================
--- trunk/composer/e-msg-composer.c	(original)
+++ trunk/composer/e-msg-composer.c	Sun Jan 11 13:55:04 2009
@@ -56,8 +56,6 @@
 #include <gconf/gconf.h>
 #include <gconf/gconf-client.h>
 
-#include <libgnome/gnome-url.h>
-
 #include <glade/glade.h>
 
 #include "e-util/e-dialog-utils.h"
@@ -2628,8 +2626,6 @@
 msg_composer_link_clicked (GtkhtmlEditor *editor,
                            const gchar *uri)
 {
-	GError *error = NULL;
-
 	if (uri == NULL || *uri == '\0')
 		return;
 
@@ -2642,12 +2638,7 @@
 	if (g_ascii_strncasecmp (uri, "cid:", 4) == 0)
 		return;
 
-	gnome_url_show (uri, &error);
-
-	if (error) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	e_show_uri (GTK_WINDOW (editor), uri);
 }
 
 static void

Modified: trunk/e-util/e-error.c
==============================================================================
--- trunk/e-util/e-error.c	(original)
+++ trunk/e-util/e-error.c	Sun Jan 11 13:55:04 2009
@@ -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 @@
 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);
 	}
 }
 

Modified: trunk/e-util/e-util.c
==============================================================================
--- trunk/e-util/e-util.c	(original)
+++ trunk/e-util/e-util.c	Sun Jan 11 13:55:04 2009
@@ -92,6 +92,50 @@
 }
 
 /**
+ * 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

Modified: trunk/e-util/e-util.h
==============================================================================
--- trunk/e-util/e-util.h	(original)
+++ trunk/e-util/e-util.h	Sun Jan 11 13:55:04 2009
@@ -42,6 +42,8 @@
 
 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);
 

Modified: trunk/mail/em-config.c
==============================================================================
--- trunk/mail/em-config.c	(original)
+++ trunk/mail/em-config.c	Sun Jan 11 13:55:04 2009
@@ -29,8 +29,6 @@
 
 #include <gtk/gtk.h>
 
-#include <libgnome/gnome-url.h>
-
 #include "em-config.h"
 #include "libedataserver/e-msgport.h"
 #include "em-utils.h"

Modified: trunk/mail/em-folder-view.c
==============================================================================
--- trunk/mail/em-folder-view.c	(original)
+++ trunk/mail/em-folder-view.c	Sun Jan 11 13:55:04 2009
@@ -38,8 +38,6 @@
 #undef interface
 #endif
 
-#include <libgnome/gnome-url.h>
-
 #include <gconf/gconf-client.h>
 
 #include <camel/camel-mime-message.h>
@@ -2731,14 +2729,8 @@
 	} else if (!g_ascii_strncasecmp (uri, "cid:", 4)) {
 		/* ignore */
 	} else {
-		GError *err = NULL;
-
-		gnome_url_show (uri, &err);
-
-		if (err) {
-			g_warning ("gnome_url_show: %s", err->message);
-			g_error_free (err);
-		}
+		/* FIXME Pass a parent window. */
+		e_show_uri (NULL, uri);
 	}
 }
 

Modified: trunk/mail/em-menu.c
==============================================================================
--- trunk/mail/em-menu.c	(original)
+++ trunk/mail/em-menu.c	Sun Jan 11 13:55:04 2009
@@ -29,8 +29,6 @@
 
 #include <gtk/gtk.h>
 
-#include <libgnome/gnome-url.h>
-
 #include "em-menu.h"
 #include "libedataserver/e-msgport.h"
 #include "em-utils.h"

Modified: trunk/mail/em-popup.c
==============================================================================
--- trunk/mail/em-popup.c	(original)
+++ trunk/mail/em-popup.c	Sun Jan 11 13:55:04 2009
@@ -31,8 +31,6 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include <libgnome/gnome-url.h>
-
 #include "em-popup.h"
 #include "libedataserver/e-msgport.h"
 #include "em-utils.h"
@@ -587,13 +585,9 @@
 emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
 {
 	EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
-	GError *err = NULL;
 
-	gnome_url_show(t->uri, &err);
-	if (err) {
-		g_warning("gnome_url_show: %s", err->message);
-		g_error_free(err);
-	}
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, t->uri);
 }
 
 static void

Modified: trunk/plugins/mailing-list-actions/mailing-list-actions.c
==============================================================================
--- trunk/plugins/mailing-list-actions/mailing-list-actions.c	(original)
+++ trunk/plugins/mailing-list-actions/mailing-list-actions.c	Sun Jan 11 13:55:04 2009
@@ -29,7 +29,6 @@
 #include <string.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
-#include <libgnome/gnome-url.h>
 
 #include "camel/camel-multipart.h"
 #include "camel/camel-mime-part.h"
@@ -44,6 +43,7 @@
 #include "mail/mail-ops.h"
 #include "mail/mail-mt.h"
 #include "mail/mail-config.h"
+#include "e-util/e-util.h"
 #include "e-util/e-error.h"
 
 typedef enum {
@@ -170,11 +170,9 @@
 
 			goto exit;
 		} else {
-			GError *err = NULL;
-			gnome_url_show (url, &err);
-			if (!err)
-				goto exit;
-			g_error_free (err);
+			/* FIXME Pass a parent window. */
+			e_show_uri (NULL, url);
+			goto exit;
 		}
 		g_free (url);
 		url = NULL;

Modified: trunk/shell/e-shell-window-commands.c
==============================================================================
--- trunk/shell/e-shell-window-commands.c	(original)
+++ trunk/shell/e-shell-window-commands.c	Sun Jan 11 13:55:04 2009
@@ -29,7 +29,6 @@
 
 #include <libgnome/gnome-exec.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-url.h>
 
 #include <gio/gio.h>
 
@@ -43,6 +42,7 @@
 #include "e-util/e-error.h"
 #include "e-util/e-icon-factory.h"
 #include "e-util/e-print.h"
+#include "e-util/e-util.h"
 #include "e-util/e-util-private.h"
 
 #include "e-shell-window-commands.h"
@@ -963,15 +963,11 @@
 		  EShellWindow *window,
  		  const char *path)
 {
- 	GError *error = NULL;
+	const gchar *uri;
 
-	gnome_url_show ("http://www.go-evolution.org/FAQ";, &error);
-	if (error != NULL) {
-		e_notice (NULL, GTK_MESSAGE_ERROR,
-				_("Error opening the FAQ webpage."));
- 		g_error_free (error);
- 	}
- }
+	uri = "http://www.go-evolution.org/FAQ";;
+	e_show_uri (GTK_WINDOW (window), uri);
+}
 
 static void
 command_quick_reference (BonoboUIComponent *uih,

Modified: trunk/widgets/misc/e-attachment-bar.c
==============================================================================
--- trunk/widgets/misc/e-attachment-bar.c	(original)
+++ trunk/widgets/misc/e-attachment-bar.c	Sun Jan 11 13:55:04 2009
@@ -993,7 +993,6 @@
 eab_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, gpointer *dummy)
 {
 	EAttachment *attachment;
-	GError *error = NULL;
 	gboolean ret = FALSE;
 	CamelURL *url;
 	char *path;
@@ -1015,13 +1014,8 @@
 				g_free (path);
 			}
 
-			/* launch the url now */
-			gnome_url_show (attachment->store_uri, &error);
-			if (error) {
-				g_message ("DEBUG: Launch failed: %s\n", error->message);
-				g_error_free (error);
-				error = NULL;
-			}
+			/* FIXME Pass a parent window. */
+			e_show_uri (NULL, attachment->store_uri);
 
 			ret = TRUE;
 		}

Modified: trunk/widgets/misc/e-url-entry.c
==============================================================================
--- trunk/widgets/misc/e-url-entry.c	(original)
+++ trunk/widgets/misc/e-url-entry.c	Sun Jan 11 13:55:04 2009
@@ -25,9 +25,9 @@
 #endif
 
 #include <gtk/gtk.h>
-#include <libgnome/gnome-url.h>
 #include <glib/gi18n.h>
 #include "e-url-entry.h"
+#include "e-util/e-util.h"
 
 struct _EUrlEntryPrivate {
 	GtkWidget *entry;
@@ -170,11 +170,15 @@
 {
 	EUrlEntry *url_entry;
 	EUrlEntryPrivate *priv;
+	const gchar *uri;
 
 	url_entry = E_URL_ENTRY (data);
 	priv = url_entry->priv;
 
-	gnome_url_show (gtk_entry_get_text (GTK_ENTRY (priv->entry)), NULL);
+	uri = gtk_entry_get_text (GTK_ENTRY (priv->entry));
+
+	/* FIXME Pass a parent window. */
+	e_show_uri (NULL, uri);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]