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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15760 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2007-03-27 03:06:09 +00:00
parent 5edeb504e2
commit e6e85a13ec
4 changed files with 31 additions and 5 deletions

View File

@ -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 @@ 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)

View File

@ -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 @@ 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 *

View File

@ -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;
}

View File

@ -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 */