diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 294b08a85f..f465cd0ded 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -58,6 +58,8 @@ # include #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 @@ gnc_print_unstable_message(void) 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 @@ environment_override() 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 @@ gnucash_command_line(int *argc, char **argv) /* 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 @@ gnucash_command_line(int *argc, char **argv) } gnc_set_extra(extra); - + gnc_set_gconf_path(gconf_path); gnc_set_debugging(debugging); if (namespace_regexp) diff --git a/src/core-utils/gnc-gconf-utils.c b/src/core-utils/gnc-gconf-utils.c index 24d9a92e0f..ac81b9de85 100644 --- a/src/core-utils/gnc-gconf-utils.c +++ b/src/core-utils/gnc-gconf-utils.c @@ -26,9 +26,9 @@ #include #include +#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 @@ gnc_gconf_section_name (const char *name) { 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 @@ gnc_gconf_section_name (const char *name) * 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 @@ gnc_gconf_schema_section_name (const char *name) * 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 * diff --git a/src/core-utils/gnc-main.c b/src/core-utils/gnc-main.c index 559ebf4e96..ff9b6b4a02 100644 --- a/src/core-utils/gnc-main.c +++ b/src/core-utils/gnc-main.c @@ -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 @@ gnc_set_extra(gboolean enabled) { extras_enabled = enabled; } + +void +gnc_set_gconf_path (const gchar *path) +{ + gconf_path = path; +} + +const gchar * +gnc_get_gconf_path (void) +{ + return gconf_path; +} diff --git a/src/core-utils/gnc-main.h b/src/core-utils/gnc-main.h index a913ce6365..2f3b0c75a0 100644 --- a/src/core-utils/gnc-main.h +++ b/src/core-utils/gnc-main.h @@ -35,4 +35,7 @@ void gnc_set_debugging(gboolean d); 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 */