From 09cfe5d5690a75e8f79c94b052980dd191965054 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 14 Aug 2008 19:21:10 +0000 Subject: New convenience function for launching help from Evolution. Displays an 2008-08-14 Matthew Barnes * 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. svn path=/trunk/; revision=35991 --- addressbook/ChangeLog | 5 +++ addressbook/gui/contact-editor/e-contact-editor.c | 14 ++------ calendar/ChangeLog | 5 +++ calendar/gui/dialogs/comp-editor.c | 8 ++--- e-util/ChangeLog | 7 ++++ e-util/e-util.c | 42 ++++++++++++++++++++-- e-util/e-util.h | 4 ++- plugins/email-custom-header/ChangeLog | 5 +++ plugins/email-custom-header/email-custom-header.c | 12 +++---- plugins/exchange-operations/ChangeLog | 5 +++ .../exchange-operations/exchange-send-options.c | 13 +++---- widgets/misc/ChangeLog | 6 ++++ widgets/misc/e-multi-config-dialog.c | 11 ++---- widgets/misc/e-send-options.c | 12 +++---- 14 files changed, 94 insertions(+), 55 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 892a7bce87..f634649050 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,8 @@ +2008-08-14 Matthew Barnes + + * gui/contact-editor/e-contact-editor.c: + Use e_display_help() for displaying help. + 2008-08-12 Matthew Barnes * gui/component/GNOME_Evolution_Addressbook.server.in.in: diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index ebdc6bf22f..a226cfe132 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -28,10 +28,7 @@ #include #include #include -#include -#include #include -#include #include #include @@ -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 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) 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 * diff --git a/calendar/ChangeLog b/calendar/ChangeLog index cca6e6a6ca..a98600a82b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2008-08-14 Matthew Barnes + + * gui/dialogs/comp-editor.c: + Use e_display_help() for displaying help. + 2008-08-17 Chenthill Palanisamy * gui/dialogs/event-page.c: (source_changed_cb): diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index fa7054d942..18d2431d2b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -2257,16 +2258,11 @@ static void 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); } diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 50d649d4d0..0c80024a22 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,10 @@ +2008-08-14 Matthew Barnes + + * 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. + 2008-08-13 Matthew Barnes * e-gui-utils.c (e_create_image_widget): diff --git a/e-util/e-util.c b/e-util/e-util.c index 116ebd3f55..815f75e033 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -35,10 +35,11 @@ #include #include -#include -#include -#include #include +#include +#include +#include +#include #include #ifdef G_OS_WIN32 @@ -69,6 +70,41 @@ e_get_user_data_dir (void) return dirname; } +/** + * 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, + "%s", + _("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. diff --git a/e-util/e-util.h b/e-util/e-util.h index 63cb6f4a5c..484ab59702 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -25,7 +25,7 @@ #define _E_UTIL_H_ #include -#include +#include #include #include #include @@ -42,6 +42,8 @@ typedef enum { } 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, diff --git a/plugins/email-custom-header/ChangeLog b/plugins/email-custom-header/ChangeLog index f3c5c58464..2c992a4fac 100644 --- a/plugins/email-custom-header/ChangeLog +++ b/plugins/email-custom-header/ChangeLog @@ -1,3 +1,8 @@ +2008-08-14 Matthew Barnes + + * gui/contact-editor/e-contact-editor.c: + Use e_display_help() for displaying help. + 2008-08-12 Bharath Acharya * Makefile.am: Have a check for OS_WIN32 and handle the schema data diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 6918a9b43c..ab882cc197 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #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 @@ epech_header_options_cb (GtkDialog *dialog, gint state, gpointer func_data) { EmailCustomHeaderOptionsDialogPrivate *priv; CustomHeaderOptionsDialog *mch; - GError *error = NULL; mch = func_data; priv = mch->priv; @@ -211,12 +210,9 @@ epech_header_options_cb (GtkDialog *dialog, gint state, gpointer func_data) 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; } diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index f16f1301cf..09fb3274af 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,8 @@ +2008-08-14 Matthew Barnes + + * exchange-send-options.c: + Use e_display_help() for displaying help. + 2008-08-06 Milan Crha ** Fix for bug #435969 diff --git a/plugins/exchange-operations/exchange-send-options.c b/plugins/exchange-operations/exchange-send-options.c index 02c50e78e0..ef7687df93 100644 --- a/plugins/exchange-operations/exchange-send-options.c +++ b/plugins/exchange-operations/exchange-send-options.c @@ -26,9 +26,8 @@ #include #include #include "exchange-operations.h" +#include #include -#include -#include #include #include "e-util/e-util-private.h" @@ -280,7 +279,6 @@ static void exchange_send_options_cb (GtkDialog *dialog, gint state, gpointer fu { ExchangeSendOptionsDialogPrivate *priv; ExchangeSendOptionsDialog *sod; - GError *error = NULL; sod = func_data; priv = sod->priv; @@ -295,12 +293,9 @@ static void exchange_send_options_cb (GtkDialog *dialog, gint state, gpointer fu 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); diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 5f7fd73f51..15f82821c4 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-14 Matthew Barnes + + * e-multi-config-dialog.c: + * e-send-options.c: + Use e_display_help() for displaying help. + 2008-08-11 Matthew Barnes ** Fixes part of bug #546892 diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c index 159b14561c..780a33baaa 100644 --- a/widgets/misc/e-multi-config-dialog.c +++ b/widgets/misc/e-multi-config-dialog.c @@ -26,14 +26,13 @@ #include "e-multi-config-dialog.h" +#include #include #include
#include
#include
#include
-#include - #define SWITCH_PAGE_INTERVAL 250 struct _EMultiConfigDialogPrivate { @@ -172,18 +171,12 @@ static void 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: diff --git a/widgets/misc/e-send-options.c b/widgets/misc/e-send-options.c index 32eb33b484..33c80d6917 100644 --- a/widgets/misc/e-send-options.c +++ b/widgets/misc/e-send-options.c @@ -23,11 +23,11 @@ #endif #include -#include #include #include #include +#include "e-util/e-util.h" #include "e-util/e-util-private.h" #include "e-dateedit.h" @@ -586,7 +586,6 @@ static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data { ESendOptionsDialogPrivate *priv; ESendOptionsDialog *sod; - GError *error = NULL; sod = func_data; priv = sod->priv; @@ -600,12 +599,9 @@ static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data 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; } -- cgit v1.2.3