]> spindle.queued.net Git - midori/commitdiff
Look for user documentation dynamically on win32
authorPeter de Ridder <peter@xfce.org>
Mon, 15 Feb 2010 23:47:11 +0000 (00:47 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 15 Feb 2010 23:59:43 +0000 (00:59 +0100)
midori/midori-browser.c

index 6dd0d7bdde13e4f420f1e3351d2de7ad85c732e3..1bbd49fe1b56039fe8c3049b919a4d23ce0609d5 100644 (file)
@@ -4857,15 +4857,37 @@ _action_help_link_activate (GtkAction*     action,
     const gchar* action_name;
     const gchar* uri;
     gint n;
+    #if defined (G_OS_WIN32) && defined (DOCDIR)
+    gchar* free_uri = NULL;
+    #endif
 
     action_name = gtk_action_get_name (action);
     if  (!strncmp ("HelpContents", action_name, 12))
     {
+        #ifdef G_OS_WIN32
+        {
+            #ifdef DOCDIR
+            gchar* path = sokoke_find_data_filename ("doc/midori/user/midori.html");
+            uri = free_uri = g_filename_to_uri (path, NULL, NULL);
+            if (g_access (path, F_OK) != 0)
+            {
+                if (g_access (DOCDIR "/midori/user/midori.html", F_OK) == 0)
+                    uri = "file://" DOCDIR "/midori/user/midori.html";
+                else
+            #endif
+                    uri = "error:nodocs share/doc/midori/user/midori.html";
+            #ifdef DOCDIR
+            }
+            g_free (path);
+            #endif
+        }
+        #else
         #ifdef DOCDIR
         uri = "file://" DOCDIR "/midori/user/midori.html";
         if (g_access (DOCDIR "/midori/user/midori.html", F_OK) != 0)
         #endif
             uri = "error:nodocs " DOCDIR "/midori/user/midori.html";
+        #endif
     }
     else if  (!strncmp ("HelpFAQ", action_name, 7))
         uri = "http://wiki.xfce.org/_export/xhtml/midori_faq";
@@ -4878,8 +4900,11 @@ _action_help_link_activate (GtkAction*     action,
     {
         n = midori_browser_add_uri (browser, uri);
         midori_browser_set_current_page (browser, n);
-    }
 
+        #if defined (G_OS_WIN32) && defined (DOCDIR)
+        g_free (free_uri);
+        #endif
+    }
 }
 
 static void