r15760 - gnucash/trunk/src - Allow the base gconf path to be specified at run time, either via an

David Hampton hampton at cvs.gnucash.org
Mon Mar 26 23:06:09 EDT 2007


Author: hampton
Date: 2007-03-26 23:06:09 -0400 (Mon, 26 Mar 2007)
New Revision: 15760
Trac: http://svn.gnucash.org/trac/changeset/15760

Modified:
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
   gnucash/trunk/src/core-utils/gnc-main.c
   gnucash/trunk/src/core-utils/gnc-main.h
Log:
Allow the base gconf path to be specified at run time, either via an
environment variable or via a command line option.  Based on a patch
from James Radley.  Implements #328762.


Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2007-03-27 01:55:38 UTC (rev 15759)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2007-03-27 03:06:09 UTC (rev 15760)
@@ -58,6 +58,8 @@
 #  include <locale.h>
 #endif
 
+#define APP_GNUCASH "/apps/gnucash"
+
 /* GNUCASH_SVN is defined whenever we're building from an SVN tree */
 #ifdef GNUCASH_SVN
 static int is_development_version = TRUE;
@@ -92,6 +94,7 @@
 static char *config_path = PKGSYSCONFDIR;
 static char *share_path = PKGDATADIR;
 static char *help_path = GNC_HELPDIR;
+static char *gconf_path = APP_GNUCASH;
 
 static void
 environment_override()
@@ -104,6 +107,8 @@
         share_path = g_strdup(path);
     if ((path = g_getenv("GNC_DOC_PATH")))
         help_path = g_strdup(path);
+    if ((path = g_getenv("GNC_GCONF_PATH")))
+        gconf_path = g_strdup(path);
 }
 
 static gboolean
@@ -245,6 +250,11 @@
 	 /* Translators: Argument description for autohelp; see
 	    http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
 	 _("DOCPATH")},
+        {"gconf-path", '\0', 0, G_OPTION_ARG_STRING, &gconf_path,
+         _("Set the prefix path for gconf queries"),
+	 /* Translators: Argument description for autohelp; see
+	    http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
+	 _("GCONFPATH")},
         {"add-price-quotes", '\0', 0, G_OPTION_ARG_STRING, &add_quotes_file,
          _("Add price quotes to given GnuCash datafile"),
 	 /* Translators: Argument description for autohelp; see
@@ -295,7 +305,7 @@
     }
 
     gnc_set_extra(extra);
-
+    gnc_set_gconf_path(gconf_path);
     gnc_set_debugging(debugging);
 
     if (namespace_regexp)

Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2007-03-27 01:55:38 UTC (rev 15759)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2007-03-27 03:06:09 UTC (rev 15760)
@@ -26,9 +26,9 @@
 
 #include <stdio.h>
 #include <string.h>
+#include "gnc-main.h"
 #include "gnc-gconf-utils.h"
 
-#define APP_GNUCASH "/apps/gnucash"
 #define CLIENT_TAG  "%s-%s-client"
 #define NOTIFY_TAG  "%s-%s-notify_id"
 
@@ -255,7 +255,7 @@
 {
   if (name == NULL) {
     /* Need to return a newly allocated string */
-    return g_strdup(APP_GNUCASH);
+    return g_strdup(gnc_get_gconf_path());
   }
   if (*name == '/') {
     /* Need to return a newly allocated string */
@@ -268,7 +268,7 @@
    * order to keep this file completely "gnome-free" this approach was
    * used.
    */
-  return g_strjoin("/", APP_GNUCASH, name, NULL);
+  return g_strjoin("/", gnc_get_gconf_path(), name, NULL);
 }
 
 char *
@@ -285,7 +285,7 @@
    * order to keep this file completely "gnome-free" this approach was
    * used.
    */
-  return g_strconcat("/schemas", APP_GNUCASH, "/", name, NULL);
+  return g_strconcat("/schemas", gnc_get_gconf_path(), "/", name, NULL);
 }
 
 static gchar *

Modified: gnucash/trunk/src/core-utils/gnc-main.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-main.c	2007-03-27 01:55:38 UTC (rev 15759)
+++ gnucash/trunk/src/core-utils/gnc-main.c	2007-03-27 03:06:09 UTC (rev 15760)
@@ -27,6 +27,7 @@
 static gchar *namespace_regexp = NULL;
 static gboolean is_debugging = 0;
 static gboolean extras_enabled = 0;
+static const gchar *gconf_path;
 
 void 
 gnc_main_set_namespace_regexp(const gchar *str)
@@ -67,3 +68,15 @@
 {
     extras_enabled = enabled;
 }
+
+void
+gnc_set_gconf_path (const gchar *path)
+{
+    gconf_path = path;
+}
+
+const gchar *
+gnc_get_gconf_path (void)
+{
+    return gconf_path;
+}

Modified: gnucash/trunk/src/core-utils/gnc-main.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-main.h	2007-03-27 01:55:38 UTC (rev 15759)
+++ gnucash/trunk/src/core-utils/gnc-main.h	2007-03-27 03:06:09 UTC (rev 15760)
@@ -35,4 +35,7 @@
 gboolean gnc_is_extra_enabled(void);
 void gnc_set_extra(gboolean enabled);
 
+void gnc_set_gconf_path(const gchar *prefix);
+const gchar *gnc_get_gconf_path(void);
+
 #endif /* GNC_MAIN_H */



More information about the gnucash-changes mailing list