aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-08-15 03:21:10 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-08-15 03:21:10 +0800
commit09cfe5d5690a75e8f79c94b052980dd191965054 (patch)
treebbac8fbf0e5d44cbf96c3cff50ccfa9cd4411e84 /e-util
parentd5258efe7aed378df171fecc3055b065e1403c0e (diff)
downloadgsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar.gz
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar.bz2
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar.lz
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar.xz
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.tar.zst
gsoc2013-evolution-09cfe5d5690a75e8f79c94b052980dd191965054.zip
New convenience function for launching help from Evolution. Displays an
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. svn path=/trunk/; revision=35991
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog7
-rw-r--r--e-util/e-util.c42
-rw-r--r--e-util/e-util.h4
3 files changed, 49 insertions, 4 deletions
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 <mbarnes@redhat.com>
+
+ * 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 <mbarnes@redhat.com>
* 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 <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_get_user_data_dir (void)
}
/**
+ * 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.
*
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 <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 @@ 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,