[Xfce4-commits] <midori:master> Simplify midori_browser_get_docs, fix URI in error:nodocs

Christian Dywan noreply at xfce.org
Tue Dec 4 02:18:01 CET 2012


Updating branch refs/heads/master
         to 02d6b89b8738e86277b1bd7303f2478fc6e909b1 (commit)
       from b4aca14a6a24b8bd28eebf32035c6c2bac6d1bf1 (commit)

commit 02d6b89b8738e86277b1bd7303f2478fc6e909b1
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Dec 4 02:16:48 2012 +0100

    Simplify midori_browser_get_docs, fix URI in error:nodocs

 midori/midori-browser.c |   19 +++++--------------
 midori/midori-view.c    |    1 -
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 26e8ff4..f7e8fa0 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -4668,26 +4668,17 @@ midori_browser_get_docs (gboolean error)
 {
     #ifdef G_OS_WIN32
     gchar* path = midori_paths_get_data_filename ("doc/midori/faq.html", FALSE);
-    if (g_access (path, F_OK) == 0)
-        return g_filename_to_uri (path, NULL, NULL);
-    else
-    {
-        #ifdef DOCDIR
-        if (g_access (DOCDIR "/faq.html", F_OK) == 0)
-            return g_strdup ("file://" DOCDIR "/faq.html");
-        else
-        #endif
-            return error ? g_strdup ("error:nodocs share/doc/midori/faq.html") : NULL;
-    }
+    gboolean found = (g_access (path, F_OK) == 0);
     g_free (path);
-    #else
+    if (found)
+        return g_filename_to_uri (path, NULL, NULL);
+    #endif
     #ifdef DOCDIR
     if (g_access (DOCDIR "/faq.html", F_OK) == 0)
         return g_strdup ("file://" DOCDIR "/faq.html");
     else
     #endif
-        return error ? g_strdup ("error:nodocs " DOCDIR "/faq.html") : NULL;
-    #endif
+        return error ? g_strdup_printf ("error:nodocs %s/faq.html", DOCDIR) : NULL;
 }
 
 static void
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 77fca72..cf3dfe7 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3852,7 +3852,6 @@ midori_view_set_uri (MidoriView*  view,
             if (!strncmp (uri, "error:nodocs ", 13))
             {
                 gchar* title = g_strdup_printf (_("No documentation installed"));
-                uri = &uri[13];
                 data = g_strdup_printf (
                     "<html><head><title>%s</title></head>"
                     "<body><h1>%s</h1>"


More information about the Xfce4-commits mailing list