evolution r35991 - in trunk: addressbook addressbook/gui/contact-editor calendar calendar/gui/dialogs e-util plugins/email-custom-header plugins/exchange-operations widgets/misc



Author: mbarnes
Date: Thu Aug 14 19:21:10 2008
New Revision: 35991
URL: http://svn.gnome.org/viewvc/evolution?rev=35991&view=rev

Log:
2008-08-14  Matthew Barnes  <mbarnes redhat com>

	* e-util/e-util.c (e_display_help):
	New convenience function for launching help from Evolution.
	Displays an error dialog over the given parent window if an
	error occurs.

	* addressbook/gui/contact-editor/e-contact-editor.c:
	* calendar/gui/dialogs/comp-editor.c:
	* plugins/email-custom-header/gui/contact-editor/e-contact-editor.c:
	* plugins/exchange-operations/exchange-send-options.c:
	* widgets/misc/e-multi-config-dialog.c:
	* widgets/misc/e-send-options.c:
	Use e_display_help() for displaying help.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/contact-editor/e-contact-editor.c
   trunk/calendar/ChangeLog
   trunk/calendar/gui/dialogs/comp-editor.c
   trunk/e-util/ChangeLog
   trunk/e-util/e-util.c
   trunk/e-util/e-util.h
   trunk/plugins/email-custom-header/ChangeLog
   trunk/plugins/email-custom-header/email-custom-header.c
   trunk/plugins/exchange-operations/ChangeLog
   trunk/plugins/exchange-operations/exchange-send-options.c
   trunk/widgets/misc/ChangeLog
   trunk/widgets/misc/e-multi-config-dialog.c
   trunk/widgets/misc/e-send-options.c

Modified: trunk/addressbook/gui/contact-editor/e-contact-editor.c
==============================================================================
--- trunk/addressbook/gui/contact-editor/e-contact-editor.c	(original)
+++ trunk/addressbook/gui/contact-editor/e-contact-editor.c	Thu Aug 14 19:21:10 2008
@@ -28,10 +28,7 @@
 #include <time.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-window-icon.h>
-#include <libgnome/gnome-util.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-help.h>
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libedataserverui/e-categories-dialog.h>
@@ -45,6 +42,7 @@
 #include "addressbook/gui/component/addressbook.h"
 #include "addressbook/printing/e-contact-print.h"
 #include "addressbook/gui/widgets/eab-gui-util.h"
+#include "e-util/e-util.h"
 #include "e-util/e-gui-utils.h"
 #include "e-util/e-error.h"
 #include "misc/e-dateedit.h"
@@ -3210,14 +3208,8 @@
 static void
 show_help_cb (GtkWidget *widget, gpointer data)
 {
-	GError *error = NULL;
-
-	gnome_help_display (
-		"evolution.xml", "usage-contact-cards", &error);
-	if (error != NULL) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	/* FIXME Pass a proper parent window. */
+	e_display_help (NULL, "usage-contact-cards");
 }
 
 static GList *

Modified: trunk/calendar/gui/dialogs/comp-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/comp-editor.c	(original)
+++ trunk/calendar/gui/dialogs/comp-editor.c	Thu Aug 14 19:21:10 2008
@@ -31,6 +31,7 @@
 #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>
 #include <e-util/gconf-bridge.h>
@@ -2257,16 +2258,11 @@
 comp_editor_show_help (CompEditor *editor)
 {
 	CompEditorClass *class;
-	GError *error = NULL;
 
 	class = COMP_EDITOR_GET_CLASS (editor);
 	g_return_if_fail (class->help_section != NULL);
 
-	gnome_help_display ("evolution.xml", class->help_section, &error);
-	if (error != NULL) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	e_display_help (GTK_WINDOW (editor), class->help_section);
 }
 
 

Modified: trunk/e-util/e-util.c
==============================================================================
--- trunk/e-util/e-util.c	(original)
+++ trunk/e-util/e-util.c	Thu Aug 14 19:21:10 2008
@@ -35,10 +35,11 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
 #include <gio/gio.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <libgnome/gnome-help.h>
 #include <libgnome/gnome-util.h>
 
 #ifdef G_OS_WIN32
@@ -70,6 +71,41 @@
 }
 
 /**
+ * e_display_help:
+ * @parent: a parent #GtkWindow or %NULL
+ * @link_id: help section to present or %NULL
+ *
+ * Opens the user documentation to the section given by @link_id, or to the
+ * table of contents if @link_id is %NULL.  If the user documentation cannot
+ * be opened, it presents a dialog describing the error.  The dialog is set
+ * as transient to @parent if @parent is non-%NULL.
+ **/
+void
+e_display_help (GtkWindow *parent,
+                const gchar *link_id)
+{
+	GtkWidget *dialog;
+	GError *error = NULL;
+
+	if (gnome_help_display ("evolution.xml", link_id, &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 display help for Evolution."));
+
+	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_str_without_underscores:
  * @s: the string to strip underscores from.
  *

Modified: trunk/e-util/e-util.h
==============================================================================
--- trunk/e-util/e-util.h	(original)
+++ trunk/e-util/e-util.h	Thu Aug 14 19:21:10 2008
@@ -25,7 +25,7 @@
 #define _E_UTIL_H_
 
 #include <sys/types.h>
-#include <glib-object.h>
+#include <gtk/gtk.h>
 #include <limits.h>
 #include <gconf/gconf-client.h>
 #include <cairo.h>
@@ -42,6 +42,8 @@
 } EFocus;
 
 const gchar *	e_get_user_data_dir		(void);
+void		e_display_help			(GtkWindow *parent,
+						 const gchar *link_id);
 
 char *		e_str_without_underscores	(const char *s);
 gint		e_str_compare			(gconstpointer x,

Modified: trunk/plugins/email-custom-header/email-custom-header.c
==============================================================================
--- trunk/plugins/email-custom-header/email-custom-header.c	(original)
+++ trunk/plugins/email-custom-header/email-custom-header.c	Thu Aug 14 19:21:10 2008
@@ -26,7 +26,6 @@
 #include <glib/gi18n.h>
 #include <gconf/gconf-client.h>
 #include <e-util/e-error.h>
-#include <libgnome/libgnome.h>
 #include <glade/glade.h>
 #include "mail/em-menu.h"
 #include "mail/em-utils.h"
@@ -34,6 +33,7 @@
 #include "composer/e-msg-composer.h"
 #include "libedataserver/e-account.h"
 #include "e-util/e-config.h"
+#include "e-util/e-util.h"
 #include "email-custom-header.h"
 
 
@@ -197,7 +197,6 @@
 {
 	EmailCustomHeaderOptionsDialogPrivate *priv;
 	CustomHeaderOptionsDialog *mch;
-	GError *error = NULL;     
 
 	mch = func_data;
 	priv = mch->priv;
@@ -211,12 +210,9 @@
 			g_object_unref (priv->xml);
 			break;	     
 		case GTK_RESPONSE_HELP:
-			gnome_help_display (
-					"evolution.xml", priv->help_section, &error);
-			if (error) {
-				g_warning ("%s", error->message);
-				g_error_free (error);
-			}
+			e_display_help (
+				GTK_WINDOW (priv->main),
+				priv->help_section);
 			break;
 	}
 

Modified: trunk/plugins/exchange-operations/exchange-send-options.c
==============================================================================
--- trunk/plugins/exchange-operations/exchange-send-options.c	(original)
+++ trunk/plugins/exchange-operations/exchange-send-options.c	Thu Aug 14 19:21:10 2008
@@ -26,9 +26,8 @@
 #include <libedataserverui/e-name-selector.h>
 #include <libedataserverui/e-contact-store.h>
 #include "exchange-operations.h"
+#include <e-util/e-util.h>
 #include <e-util/e-error.h>
-#include <libgnome/libgnome.h>
-#include <libgnome/gnome-i18n.h>
 #include <glade/glade.h>
 
 #include "e-util/e-util-private.h"
@@ -280,7 +279,6 @@
 {
    	ExchangeSendOptionsDialogPrivate *priv;
    	ExchangeSendOptionsDialog *sod;
-        GError *error = NULL;
 
 	sod = func_data;
         priv = sod->priv;
@@ -295,12 +293,9 @@
 	           	g_object_unref (priv->xml);
 	             	break;
 		case GTK_RESPONSE_HELP:
-		     	gnome_help_display (
-				"evolution.xml", priv->help_section, &error);
-			if (error != NULL) {
-				g_warning ("%s", error->message);
-				g_error_free (error);
-			}
+			e_display_help (
+				GTK_WINDOW (priv->main),
+				priv->help_section);
 	    	    	break;
 	}
 	g_signal_emit (G_OBJECT (func_data), signals[SOD_RESPONSE], 0, state);

Modified: trunk/widgets/misc/e-multi-config-dialog.c
==============================================================================
--- trunk/widgets/misc/e-multi-config-dialog.c	(original)
+++ trunk/widgets/misc/e-multi-config-dialog.c	Thu Aug 14 19:21:10 2008
@@ -26,14 +26,13 @@
 
 #include "e-multi-config-dialog.h"
 
+#include <e-util/e-util.h>
 #include <table/e-table-scrolled.h>
 #include <table/e-table-memory-store.h>
 #include <table/e-cell-pixbuf.h>
 #include <table/e-cell-vbox.h>
 #include <table/e-cell-text.h>
 
-#include <libgnome/gnome-help.h>
-
 #define SWITCH_PAGE_INTERVAL 250
 
 struct _EMultiConfigDialogPrivate {
@@ -172,18 +171,12 @@
 impl_response (GtkDialog *dialog, int response_id)
 {
 	EMultiConfigDialog *multi_config_dialog;
-	GError *error = NULL;
 
 	multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog);
 
 	switch (response_id) {
 	case GTK_RESPONSE_HELP:
-		gnome_help_display (
-			"evolution.xml", "config-prefs", &error);
-		if (error != NULL) {
-			g_warning ("%s", error->message);
-			g_error_free (error);
-		}
+		e_display_help (GTK_WINDOW (dialog), "config-prefs");
 		break;
 	case GTK_RESPONSE_CLOSE:
 	default:

Modified: trunk/widgets/misc/e-send-options.c
==============================================================================
--- trunk/widgets/misc/e-send-options.c	(original)
+++ trunk/widgets/misc/e-send-options.c	Thu Aug 14 19:21:10 2008
@@ -23,11 +23,11 @@
 #endif
 
 #include <string.h>
-#include <libgnome/libgnome.h>
 #include <glib/gi18n.h>
 #include <glade/glade.h>
 #include <time.h>
 
+#include "e-util/e-util.h"
 #include "e-util/e-util-private.h"
 
 #include "e-dateedit.h"
@@ -586,7 +586,6 @@
 {
 	ESendOptionsDialogPrivate *priv;
 	ESendOptionsDialog *sod;
-	GError *error = NULL;
 
 	sod = func_data;
 	priv = sod->priv;
@@ -600,12 +599,9 @@
 			g_object_unref (priv->xml);
 			break;
 		case GTK_RESPONSE_HELP:
-			gnome_help_display (
-				"evolution.xml", priv->help_section, &error);
-			if (error != NULL) {
-				g_warning ("%s", error->message);
-				g_error_free (error);
-			}
+			e_display_help (
+				GTK_WINDOW (priv->main),
+				priv->help_section);
     			break;
 	}
 



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