[Xfce4-commits] <ristretto:master> Use xfce_dialog_show_help to launch online documentation

Stephan Arts noreply at xfce.org
Sun Jan 22 10:12:04 CET 2012


Updating branch refs/heads/master
         to 1a5f36a04f73c3cb5d8a5cbe921eea02a9cb6dca (commit)
       from 4f15111215abfd5cf2d085568f94a0bc9d915127 (commit)

commit 1a5f36a04f73c3cb5d8a5cbe921eea02a9cb6dca
Author: Stephan Arts <stephan at xfce.org>
Date:   Sun Jan 22 10:08:54 2012 +0100

    Use xfce_dialog_show_help to launch online documentation

 configure.in.in   |    2 +-
 src/main.c        |    6 +++-
 src/main_window.c |    6 +++-
 src/util.c        |   84 -----------------------------------------------------
 src/util.h        |    3 --
 5 files changed, 11 insertions(+), 90 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 0db5fe6..8b90e51 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -59,7 +59,7 @@ XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.24.0])
 XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.18.0])
 XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.34])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.9.0])
 
 XDT_CHECK_PACKAGE([EXO], [exo-1], [0.4.0])
 
diff --git a/src/main.c b/src/main.c
index 6489ed7..43906de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -162,7 +162,11 @@ main(int argc, char **argv)
         window = rstto_preferences_dialog_new (NULL);
         while (gtk_dialog_run (GTK_DIALOG(window)) == GTK_RESPONSE_HELP)
         {
-            rstto_launch_help ();
+            xfce_dialog_show_help (
+                    GTK_WINDOW (window),
+                    "ristretto",
+                    "preferences",
+                    NULL);
         }
     }
 
diff --git a/src/main_window.c b/src/main_window.c
index 2e26e14..baf6f7d 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -2515,7 +2515,11 @@ cb_rstto_main_window_about (GtkWidget *widget, RsttoMainWindow *window)
 static void
 cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window)
 {
-    rstto_launch_help ();
+    xfce_dialog_show_help (
+            GTK_WINDOW (window),
+            "ristretto",
+            "start",
+            "");
 }
 
 
diff --git a/src/util.c b/src/util.c
index d4916ff..9150762 100644
--- a/src/util.c
+++ b/src/util.c
@@ -22,87 +22,3 @@
 #include <exo/exo.h>
 
 #include "util.h"
-
-gboolean
-rstto_launch_help (void)
-{
-    gchar *locale = NULL;
-    gchar *offset;
-    gchar *docpath = NULL;
-    gchar *cur_dir = g_get_current_dir();
-  
-    /* Find localized documentation path on disk */
-#ifdef ENABLE_NLS
-#ifdef HAVE_LOCALE_H
-    locale = g_strdup (setlocale (LC_MESSAGES, ""));
-    if (locale != NULL)
-    {
-        offset = g_strrstr (locale, ".");
-        if (offset != NULL)
-        {
-            *offset = '\0';
-        }
-    }
-    else
-    {
-        locale = g_strdup ("C");
-    }
-#else
-    locale = g_strdup ("C");
-#endif
-
-    docpath = g_strdup_printf (DOCDIR"/html/%s/index.html", locale);
-    if (!g_file_test (docpath, G_FILE_TEST_EXISTS))
-    {
-        offset = g_strrstr (locale, "_");
-        if (offset == NULL)
-        {
-            g_free (docpath);
-            docpath = g_strdup (DOCDIR"/html/C/index.html");
-        }
-        else
-        {
-            *offset = '\0';
-            g_free (docpath);
-            docpath = g_strdup_printf (DOCDIR"/html/%s/index.html", locale);
-            if (!g_file_test (docpath, G_FILE_TEST_EXISTS))
-            {
-                g_free (docpath);
-                docpath = g_strdup (DOCDIR"/html/C/index.html");
-            }
-        }
-    }
-
-    g_free (locale);
-#else
-    docpath = g_strdup (DOCDIR"/html/C/index.html");
-#endif
-
-    /* Revert to online documentation if not available on disk */
-    if (g_file_test (docpath, G_FILE_TEST_EXISTS))
-    {
-        gchar *tmp = docpath;
-        docpath = g_strdup_printf ("file://%s", docpath);
-        g_free (tmp);
-    }
-    else
-    {
-        g_free (docpath);
-        docpath = g_strdup("http://docs.xfce.org/apps/ristretto/start");
-    }
-
-    if (FALSE == exo_execute_preferred_application (
-            "WebBrowser",
-            docpath,
-            cur_dir,
-            NULL,
-            NULL))
-    {
-
-    }
-
-    g_free (docpath);
-    g_free (cur_dir);
-
-    return TRUE;
-}
diff --git a/src/util.h b/src/util.h
index c8d76f9..cbea6bc 100644
--- a/src/util.h
+++ b/src/util.h
@@ -47,7 +47,4 @@ typedef enum {
     SORT_TYPE_COUNT,
 } RsttoSortType;
 
-gboolean
-rstto_launch_help (void);
-
 #endif /* __RSTTO_UTIL_H__ */


More information about the Xfce4-commits mailing list