Allow to override documentation paths through options:
authorLaurent Monin <geeqie@norz.org>
Sat, 30 Aug 2008 10:39:35 +0000 (10:39 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 30 Aug 2008 10:39:35 +0000 (10:39 +0000)
- documentation.helpdir
- documentation.htmldir
Default values are set at configure time.

src/options.c
src/options.h
src/rcfile.c
src/window.c

index bda41aa..3296b32 100644 (file)
@@ -37,6 +37,8 @@ ConfOptions *init_options(ConfOptions *options)
        options->color_profile.use_image = TRUE;
 
        options->dnd_icon_size = 48;
+       options->documentation.htmldir = NULL;
+       options->documentation.helpdir = NULL;
        options->duplicates_similarity_threshold = 99;
        options->enable_metadata_dirs = FALSE;
        
@@ -199,6 +201,9 @@ void setup_default_options(ConfOptions *options)
 
        options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH);
        options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
+       
+       options->documentation.htmldir = g_strdup(GQ_HTMLDIR);
+       options->documentation.helpdir = g_strdup(GQ_HELPDIR);
 
        for (i = 0; ExifUIList[i].key; i++)
                ExifUIList[i].current = ExifUIList[i].default_value;
index 3aa3f5d..3a6a717 100644 (file)
@@ -246,6 +246,12 @@ struct _ConfOptions
                        gchar *command_line;
                } html_browser;
        } helpers;
+
+       /* Various paths and links to documentation */
+       struct {
+               gchar *helpdir;
+               gchar *htmldir;
+       } documentation;
 };
 
 ConfOptions *options;
index d292e16..6d921d0 100644 (file)
@@ -617,6 +617,10 @@ static gboolean save_options_to(const gchar *utf8_path, ConfOptions *options)
                write_int_option(ssi, (gchar *)ExifUIList[i].key, ExifUIList[i].current);
                }
 
+       WRITE_SUBTITLE("Documentation Options");
+       WRITE_CHAR(documentation.helpdir);
+       WRITE_CHAR(documentation.htmldir);
+
        WRITE_SEPARATOR();
        WRITE_SEPARATOR();
 
@@ -980,6 +984,11 @@ static gboolean load_options_from(const gchar *utf8_path, ConfOptions *options)
                                        ExifUIList[i].current = strtol(value, NULL, 10);
                        continue;
                        }
+               
+               /* Documentation */
+               READ_CHAR(documentation.helpdir);
+               READ_CHAR(documentation.htmldir);
+               
                }
 
        fclose(f);
index decbe41..18da4ff 100644 (file)
@@ -177,6 +177,7 @@ static gchar *html_browsers[] =
 
 static void help_browser_run(void)
 {
+       gchar *path;
        gchar *result;
        gint i;
 
@@ -195,7 +196,9 @@ static void help_browser_run(void)
                return;
                }
 
-       help_browser_command(result, GQ_HTMLDIR G_DIR_SEPARATOR_S "index.html");
+       path = g_build_filename(options->documentation.htmldir, "index.html", NULL);
+       help_browser_command(result, path);
+       g_free(path);
 
        g_free(result);
 }
@@ -215,6 +218,8 @@ static void help_window_destroy_cb(GtkWidget *window, gpointer data)
 
 void help_window_show(const gchar *key)
 {
+       gchar *path;
+
        if (key && strcmp(key, "html_contents") == 0)
                {
                help_browser_run();
@@ -228,8 +233,9 @@ void help_window_show(const gchar *key)
                return;
                }
 
-       help_window = help_window_new(_("Help"), GQ_WMCLASS, "help",
-                                     GQ_HELPDIR G_DIR_SEPARATOR_S "README", key);
+       path = g_build_filename(options->documentation.helpdir, "README", NULL);
+       help_window = help_window_new(_("Help"), GQ_WMCLASS, "help", path, key);
+       g_free(path);
 
        g_signal_connect(G_OBJECT(help_window), "destroy",
                         G_CALLBACK(help_window_destroy_cb), NULL);