From 4774e35932f94e6787c1b37dc56e83950d63e876 Mon Sep 17 00:00:00 2001 From: Peter de Ridder Date: Tue, 16 Feb 2010 00:47:11 +0100 Subject: [PATCH] Look for user documentation dynamically on win32 --- midori/midori-browser.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 6dd0d7bd..1bbd49fe 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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 -- 2.39.5