[evolution] Show online help when the local is not installed
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Show online help when the local is not installed
- Date: Fri, 13 Mar 2015 08:26:22 +0000 (UTC)
commit f3a6159ca75f896dba6425830d3d55eb18b77641
Author: Milan Crha <mcrha redhat com>
Date: Fri Mar 13 09:24:55 2015 +0100
Show online help when the local is not installed
Also fix reference to sections, thus the yelp opens the right
section, instead of the main window.
e-util/e-misc-utils.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index 173b3f2..c36a965 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -256,6 +256,23 @@ e_show_uri (GtkWindow *parent,
g_error_free (error);
}
+static gboolean
+e_misc_utils_is_help_package_installed (void)
+{
+ gboolean is_installed;
+ gchar *path;
+
+ /* Viewing user documentation requires the evolution help
+ * files. Look for one of the files it installs. */
+ path = g_build_filename (EVOLUTION_DATADIR, "help", "C", PACKAGE, "index.page", NULL);
+
+ is_installed = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+
+ g_free (path);
+
+ return is_installed;
+}
+
/**
* e_display_help:
* @parent: a parent #GtkWindow or %NULL
@@ -276,14 +293,22 @@ e_display_help (GtkWindow *parent,
GError *error = NULL;
guint32 timestamp;
- uri = g_string_new ("help:" PACKAGE);
+ if (e_misc_utils_is_help_package_installed ()) {
+ uri = g_string_new ("help:" PACKAGE);
+ } else {
+ uri = g_string_new ("https://help.gnome.org/users/" PACKAGE "/");
+ g_string_append_printf (uri, "%d.%d", EDS_MAJOR_VERSION, EDS_MINOR_VERSION);
+ }
+
timestamp = gtk_get_current_event_time ();
if (parent != NULL)
screen = gtk_widget_get_screen (GTK_WIDGET (parent));
+ g_string_append (uri, "/");
+
if (link_id != NULL)
- g_string_append_printf (uri, "?%s", link_id);
+ g_string_append (uri, link_id);
if (gtk_show_uri (screen, uri->str, timestamp, &error))
goto exit;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]