changeset 1013:88ebc61e33ae

Allow to override documentation paths through options: - documentation.helpdir - documentation.htmldir Default values are set at configure time.
author zas_
date Sat, 30 Aug 2008 10:39:35 +0000
parents fe82830ab8fd
children 4d3c98219246
files src/options.c src/options.h src/rcfile.c src/window.c
diffstat 4 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/options.c	Fri Aug 29 20:53:53 2008 +0000
+++ b/src/options.c	Sat Aug 30 10:39:35 2008 +0000
@@ -37,6 +37,8 @@
 	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 @@
 
 	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;
--- a/src/options.h	Fri Aug 29 20:53:53 2008 +0000
+++ b/src/options.h	Sat Aug 30 10:39:35 2008 +0000
@@ -246,6 +246,12 @@
 			gchar *command_line;
 		} html_browser;
 	} helpers;
+
+	/* Various paths and links to documentation */
+	struct {
+		gchar *helpdir;
+		gchar *htmldir;
+	} documentation;
 };
 
 ConfOptions *options;
--- a/src/rcfile.c	Fri Aug 29 20:53:53 2008 +0000
+++ b/src/rcfile.c	Sat Aug 30 10:39:35 2008 +0000
@@ -617,6 +617,10 @@
 		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 @@
 					ExifUIList[i].current = strtol(value, NULL, 10);
 			continue;
 			}
+		
+		/* Documentation */
+		READ_CHAR(documentation.helpdir);
+		READ_CHAR(documentation.htmldir);
+		
 		}
 
 	fclose(f);
--- a/src/window.c	Fri Aug 29 20:53:53 2008 +0000
+++ b/src/window.c	Sat Aug 30 10:39:35 2008 +0000
@@ -177,6 +177,7 @@
 
 static void help_browser_run(void)
 {
+	gchar *path;
 	gchar *result;
 	gint i;
 
@@ -195,7 +196,9 @@
 		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 @@
 
 void help_window_show(const gchar *key)
 {
+	gchar *path;
+
 	if (key && strcmp(key, "html_contents") == 0)
 		{
 		help_browser_run();
@@ -228,8 +233,9 @@
 		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);