r22941 - gnucash/trunk/src - Move gnc-gconf-utils to app-utils

Geert Janssens gjanssens at code.gnucash.org
Fri May 3 08:03:23 EDT 2013


Author: gjanssens
Date: 2013-05-03 08:03:23 -0400 (Fri, 03 May 2013)
New Revision: 22941
Trac: http://svn.gnucash.org/trac/changeset/22941

Added:
   gnucash/trunk/src/app-utils/gnc-gconf-utils.c
   gnucash/trunk/src/app-utils/gnc-gconf-utils.h
Removed:
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
   gnucash/trunk/src/core-utils/gnc-gconf-utils.h
Modified:
   gnucash/trunk/src/app-utils/Makefile.am
   gnucash/trunk/src/core-utils/Makefile.am
Log:
Move gnc-gconf-utils to app-utils

This breaks the build, but this makes it easier to read the
commit history. The build will be fixed in the next commit.

Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am	2013-05-03 12:03:12 UTC (rev 22940)
+++ gnucash/trunk/src/app-utils/Makefile.am	2013-05-03 12:03:23 UTC (rev 22941)
@@ -51,6 +51,7 @@
   gnc-entry-quickfill.c \
   gnc-euro.c \
   gnc-exp-parser.c \
+  gnc-gconf-utils.c \
   gnc-gettext-util.c \
   gnc-helpers.c \
   gnc-sx-instance-model.c \
@@ -75,6 +76,7 @@
   gnc-entry-quickfill.h \
   gnc-euro.h \
   gnc-exp-parser.h \
+  gnc-gconf-utils.h \
   gnc-gettext-util.h \
   gnc-help-utils.h \
   gnc-helpers.h \

Copied: gnucash/trunk/src/app-utils/gnc-gconf-utils.c (from rev 22940, gnucash/trunk/src/core-utils/gnc-gconf-utils.c)
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gconf-utils.c	                        (rev 0)
+++ gnucash/trunk/src/app-utils/gnc-gconf-utils.c	2013-05-03 12:03:23 UTC (rev 22941)
@@ -0,0 +1,989 @@
+/********************************************************************\
+ * gnc-gconf-utils.c -- utility functions for storing/retrieving    *
+ *              data in the GConf database for GnuCash              *
+ * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include "gnc-core-prefs.h"
+#include "gnc-gconf-utils.h"
+
+#define CLIENT_TAG  "%s-%s-client"
+#define NOTIFY_TAG  "%s-%s-notify_id"
+
+static GConfClient *our_client = NULL;
+static guint gconf_general_cb_id = 0;
+
+/************************************************************/
+/*                      Enum Utilities                      */
+/************************************************************/
+
+const gchar *
+gnc_enum_to_nick(GType type,
+                 gint value)
+{
+    GEnumClass   	    *enum_class;
+    GEnumValue   	    *enum_value;
+
+    /* Lookup the enum in the glib type system */
+    enum_class = g_type_class_ref (type);
+    if (!enum_class)
+    {
+        /* g_type_class_ref has already printed a warning. */
+        return NULL;
+    }
+
+    enum_value = g_enum_get_value (enum_class, value);
+    if (!enum_value)
+    {
+        /* Use the first item in the enum */
+        enum_value = g_enum_get_value (enum_class, 0);
+    }
+    return enum_value->value_nick;
+}
+
+gint
+gnc_enum_from_nick(GType type,
+                   const gchar *name,
+                   gint default_value)
+{
+    GEnumClass   *enum_class;
+    GEnumValue   *enum_value;
+    gchar        *alt_name, *ptr;
+
+    if (name == NULL)
+        return default_value;
+
+    /* Lookup the enum class in the glib type system */
+    enum_class = g_type_class_ref (type);
+    if (!enum_class)
+    {
+        /* g_type_class_ref has already printed a warning. */
+        return default_value;
+    }
+
+    /* Lookup the specified enum in the class */
+    enum_value = g_enum_get_value_by_nick(enum_class, name);
+    if (enum_value)
+        return enum_value->value;
+
+    /* Flip '-' and '_' and try again */
+    alt_name = g_strdup(name);
+    if ((ptr = strchr(alt_name, '-')) != NULL)
+    {
+        do
+        {
+            *ptr++ = '_';
+        }
+        while ((ptr = strchr(ptr, '-')) != NULL);
+    }
+    else  if ((ptr = strchr(alt_name, '_')) != NULL)
+    {
+        do
+        {
+            *ptr++ = '-';
+        }
+        while ((ptr = strchr(ptr, '_')) != NULL);
+    }
+    else
+    {
+        g_free(alt_name);
+        return default_value;
+    }
+
+    /* Lookup the specified enum in the class */
+    enum_value = g_enum_get_value_by_nick(enum_class, alt_name);
+    g_free(alt_name);
+    if (enum_value)
+        return enum_value->value;
+    return default_value;
+}
+
+/************************************************************/
+/*        Notification of "General" Section Changes         */
+/************************************************************/
+
+static GOnce gcb_init_once = G_ONCE_INIT;
+static GHashTable *gcb_callback_hash = NULL;
+static GHookList *gcb_final_hook_list = NULL;
+
+static gpointer
+gcb_init (gpointer unused)
+{
+    gcb_callback_hash = g_hash_table_new(g_str_hash, g_str_equal);
+
+    gcb_final_hook_list = g_malloc(sizeof(GHookList));
+    g_hook_list_init(gcb_final_hook_list, sizeof(GHook));
+    return NULL;
+}
+
+static void
+gcb_call_hook (GHook *hook, gpointer data)
+{
+    ((GFunc)hook->func)(data, hook->data);
+}
+
+static void
+gnc_gconf_general_changed (GConfClient *client,
+                           guint cnxn_id,
+                           GConfEntry *entry,
+                           gpointer data)
+{
+    const gchar *key, *key_tail;
+    GHookList *hook_list;
+
+    g_once(&gcb_init_once, gcb_init, NULL);
+
+    key = gconf_entry_get_key(entry);
+    key_tail = strrchr(key, '/');
+    if (key_tail != NULL)
+    {
+        key_tail++;
+    }
+    if (key_tail == NULL)
+    {
+        /* Should never happen. */
+        g_warning("Malformed key %s:", key);
+        return;
+    }
+
+    hook_list = g_hash_table_lookup(gcb_callback_hash, key_tail);
+    if (hook_list != NULL)
+        g_hook_list_marshal(hook_list, TRUE, gcb_call_hook, entry);
+    g_hook_list_invoke(gcb_final_hook_list, TRUE);
+}
+
+
+void
+gnc_gconf_general_register_cb (const gchar *key,
+                               GncGconfGeneralCb func,
+                               gpointer user_data)
+{
+    GHookList *hook_list;
+    GHook *hook;
+
+    g_once(&gcb_init_once, gcb_init, NULL);
+    hook_list = g_hash_table_lookup(gcb_callback_hash, key);
+    if (hook_list == NULL)
+    {
+        hook_list = g_malloc(sizeof(GHookList));
+        g_hook_list_init(hook_list, sizeof(GHook));
+        g_hash_table_insert(gcb_callback_hash, (gpointer)key, hook_list);
+    }
+
+    hook = g_hook_find_func_data(hook_list, TRUE, func, user_data);
+    if (hook != NULL)
+    {
+        return;
+    }
+
+    hook = g_hook_alloc(hook_list);
+    hook->func = func;
+    hook->data = user_data;
+    g_hook_append(hook_list, hook);
+}
+
+
+void
+gnc_gconf_general_remove_cb (const gchar *key,
+                             GncGconfGeneralCb func,
+                             gpointer user_data)
+{
+    GHookList *hook_list;
+    GHook *hook;
+
+    g_once(&gcb_init_once, gcb_init, NULL);
+    hook_list = g_hash_table_lookup(gcb_callback_hash, key);
+    if (hook_list == NULL)
+        return;
+    hook = g_hook_find_func_data(hook_list, TRUE, func, user_data);
+    if (hook == NULL)
+        return;
+
+    g_hook_destroy_link(hook_list, hook);
+    if (hook_list->hooks == NULL)
+    {
+        g_hash_table_remove(gcb_callback_hash, key);
+        g_free(hook_list);
+    }
+}
+
+
+void
+gnc_gconf_general_register_any_cb (GncGconfGeneralAnyCb func,
+                                   gpointer user_data)
+{
+    GHook *hook;
+
+    g_once(&gcb_init_once, gcb_init, NULL);
+    hook = g_hook_find_func_data(gcb_final_hook_list, TRUE, func, user_data);
+    if (hook != NULL)
+        return;
+
+    hook = g_hook_alloc(gcb_final_hook_list);
+    hook->func = func;
+    hook->data = user_data;
+    g_hook_append(gcb_final_hook_list, hook);
+}
+
+
+void
+gnc_gconf_general_remove_any_cb (GncGconfGeneralAnyCb func,
+                                 gpointer user_data)
+{
+    GHook *hook;
+
+    g_once(&gcb_init_once, gcb_init, NULL);
+    hook = g_hook_find_func_data(gcb_final_hook_list, TRUE, func, user_data);
+    if (hook == NULL)
+        return;
+
+    g_hook_unref(gcb_final_hook_list, hook);
+}
+
+
+/************************************************************/
+/*                      Gconf Utilities                     */
+/************************************************************/
+
+char *
+gnc_gconf_section_name (const char *name)
+{
+    if (name == NULL)
+    {
+        /* Need to return a newly allocated string */
+        return g_strdup(gnc_gconf_get_path_prefix());
+    }
+    if (*name == '/')
+    {
+        /* Need to return a newly allocated string */
+        return g_strdup(name);
+    }
+
+    /* This could (should?) be accomplished with a call to
+     * gnome_gconf_get_app_settings_relative(), but that would introduce
+     * a new library dependancy, even though its not a gui library.  In
+     * order to keep this file completely "gnome-free" this approach was
+     * used.
+     */
+    return g_strjoin("/", gnc_gconf_get_path_prefix(), name, NULL);
+}
+
+char *
+gnc_gconf_schema_section_name (const char *name)
+{
+    if (strncmp(name, "/schemas", sizeof("/schemas")) == 0)
+    {
+        /* Need to return a newly allocated string */
+        return g_strdup(name);
+    }
+
+    /* This could (should?) be accomplished with a call to
+     * gnome_gconf_get_app_settings_relative(), but that would introduce
+     * a new library dependancy, even though its not a gui library.  In
+     * order to keep this file completely "gnome-free" this approach was
+     * used.
+     */
+    return g_strconcat("/schemas", gnc_gconf_get_path_prefix(), "/", name, NULL);
+}
+
+static gchar *
+gnc_gconf_make_key (const gchar *section, const gchar *name)
+{
+    gchar *section_path, *key;
+
+    g_assert ((section != NULL) || (name != NULL));
+
+    if (section == NULL)
+    {
+        if (*name == '/')
+            return g_strdup(name);
+        return gnc_gconf_section_name(name);
+    }
+
+    if (name == NULL)
+    {
+        if (*section == '/')
+            return g_strdup(section);
+        return gnc_gconf_section_name(section);
+    }
+
+    if (*section == '/')
+    {
+        if (*name == '/')
+            return g_strjoin(NULL, section, name, NULL);
+        return g_strjoin("/", section, name, NULL);
+    }
+
+    section_path = gnc_gconf_section_name(section);
+    key = g_strjoin("/", section_path, name, NULL);
+    g_free(section_path);
+    return key;
+}
+
+
+static gchar *
+gnc_gconf_make_schema_key (const gchar *section, const gchar *name)
+{
+    gchar *intermediate, *key;
+
+    g_assert ((section != NULL) || (name != NULL));
+
+    intermediate = gnc_gconf_make_key(section, name);
+    key = g_strconcat("/schemas", intermediate, NULL);
+    g_free(intermediate);
+    return key;
+}
+
+
+/** Either propagate an error between data structures, or display the
+ *  error to the user.  This is a helper function called by all of the
+ *  load functions in this file.  It checks to see if the function
+ *  that called in to this file wants to handle the error, or if this
+ *  function should display a default error message.
+ *
+ *  @internal
+ *
+ *  @param key The name of the key that failed to load.
+ *
+ *  @param caller_error A pointer to where the caller of this file
+ *  would like the error stored.  If NULL, then the caller doesn't
+ *  want to handle the error.
+ *
+ *  @param error A pointer to the error that this file received from
+ *  gconf.
+ */
+static void
+gnc_gconf_load_error (const gchar *key,
+                      GError **caller_error,
+                      GError *error)
+{
+    if (caller_error)
+    {
+        g_propagate_error(caller_error, error);
+    }
+    else
+    {
+        printf("Failed to load key %s: %s", key, error->message);
+        g_error_free(error);
+    }
+}
+
+
+/** Either propagate an error between data structures, or display the
+ *  error to the user.  This is a helper function called by all of the
+ *  save functions in this file.  It checks to see if the function
+ *  that called in to this file wants to handle the error, or if this
+ *  function should display a default error message.
+ *
+ *  @internal
+ *
+ *  @param key The name of the key that failed to load.
+ *
+ *  @param caller_error A pointer to where the caller of this file
+ *  would like the error stored.  If NULL, then the caller doesn't
+ *  want to handle the error.
+ *
+ *  @param error A pointer to the error that this file received from
+ *  gconf.
+ */
+static void
+gnc_gconf_save_error (const gchar *key,
+                      GError **caller_error,
+                      GError *error)
+{
+    if (caller_error)
+    {
+        g_propagate_error(caller_error, error);
+    }
+    else if (error)
+    {
+        printf("Failed to save key %s: %s", key, error->message);
+        g_error_free(error);
+    }
+    else
+    {
+        printf("Failed to save key %s: %s", key, "Unknown error");
+    }
+}
+
+
+gboolean
+gnc_gconf_get_bool (const gchar *section,
+                    const gchar *name,
+                    GError **caller_error)
+{
+    GError *error = NULL;
+    gboolean value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_bool(our_client, key, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+    return value;
+}
+
+gboolean
+gnc_gconf_get_bool_no_error (const gchar *section,
+                             const gchar *name)
+{
+    return gnc_gconf_get_bool(section, name, NULL);
+}
+
+void
+gnc_gconf_set_bool (const gchar *section,
+                    const gchar *name,
+                    const gboolean value,
+                    GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    /* Remember whether the column width */
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_set_bool(our_client, key, value, &error))
+    {
+        gnc_gconf_save_error(key, caller_error, error);
+    }
+    g_free(key);
+}
+
+gint
+gnc_gconf_get_int (const gchar *section,
+                   const gchar *name,
+                   GError **caller_error)
+{
+    GError *error = NULL;
+    gint value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_int(our_client, key, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+    return value;
+}
+
+void
+gnc_gconf_set_int (const gchar *section,
+                   const gchar *name,
+                   const gint value,
+                   GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    /* Remember whether the column width */
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_set_int(our_client, key, value, &error))
+    {
+        gnc_gconf_save_error(key, caller_error, error);
+    }
+    g_free(key);
+}
+
+gdouble
+gnc_gconf_get_float (const gchar *section,
+                     const gchar *name,
+                     GError **caller_error)
+{
+    GError *error = NULL;
+    gdouble value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_float(our_client, key, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+    return value;
+}
+
+void
+gnc_gconf_set_float (const gchar *section,
+                     const gchar *name,
+                     const gdouble value,
+                     GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    /* Remember whether the column width */
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_set_float(our_client, key, value, &error))
+    {
+        gnc_gconf_save_error(key, caller_error, error);
+    }
+    g_free(key);
+}
+
+gchar *
+gnc_gconf_get_string (const gchar *section,
+                      const gchar *name,
+                      GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_string(our_client, key, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+
+    if (value && strlen(value) == 0)
+    {
+        g_free(value);
+        return NULL;
+    }
+    return value;
+}
+
+void
+gnc_gconf_set_string (const gchar *section,
+                      const gchar *name,
+                      const gchar *value,
+                      GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_set_string(our_client, key, value, &error))
+    {
+        gnc_gconf_save_error(key, caller_error, error);
+    }
+    g_free(key);
+}
+
+GSList *
+gnc_gconf_get_list (const gchar *section,
+                    const gchar *name,
+                    GConfValueType list_type,
+                    GError **caller_error)
+{
+    GError *error = NULL;
+    GSList *value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_list(our_client, key, list_type, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+    return value;
+}
+
+void
+gnc_gconf_set_list (const gchar *section,
+                    const gchar *name,
+                    GConfValueType list_type,
+                    GSList *value,
+                    GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_set_list(our_client, key, list_type, value, &error))
+    {
+        gnc_gconf_save_error(key, caller_error, error);
+    }
+    g_free(key);
+}
+
+GConfSchema *
+gnc_gconf_get_schema (const gchar *section,
+                      const gchar *name,
+                      GError **caller_error)
+{
+    GError *error = NULL;
+    GConfSchema *value;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    value = gconf_client_get_schema(our_client, key, &error);
+    if (error)
+    {
+        gnc_gconf_load_error(key, caller_error, error);
+    }
+    g_free(key);
+    return value;
+}
+
+GSList *
+gnc_gconf_client_all_entries (const gchar *name)
+{
+    GError *error = NULL;
+    GSList *value;
+    gchar *section;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    section = gnc_gconf_section_name(name);
+    value = gconf_client_all_entries(our_client, section, &error);
+    g_free(section);
+    if (error != NULL)
+    {
+        printf("Failed to get list of all gconf keys: %s", error->message);
+        g_error_free(error);
+    }
+
+    return value;
+}
+
+void
+gnc_gconf_unset (const gchar *section,
+                 const gchar *name,
+                 GError **caller_error)
+{
+    GError *error = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_key(section, name);
+    if (!gconf_client_unset(our_client, key, &error))
+    {
+        if (caller_error)
+        {
+            g_propagate_error(caller_error, error);
+        }
+        else
+        {
+            printf("Failed to unset key %s: %s", key, error->message);
+            g_error_free(error);
+        }
+    }
+    g_free(key);
+}
+
+
+void
+gnc_gconf_unset_dir (const gchar *section,
+                     GError **caller_error)
+{
+    GError *error = NULL;
+    GSList *entries, *tmp;
+    const gchar *key;
+    gchar *dir_key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    dir_key = gnc_gconf_make_key(section, NULL);
+    entries = gconf_client_all_entries(our_client, dir_key, &error);
+    g_free(dir_key);
+    if (error)
+    {
+        if (caller_error)
+        {
+            g_propagate_error(caller_error, error);
+        }
+        else
+        {
+            printf("Failed to get directory entries for key %s: %s",
+                   dir_key, error->message);
+            g_error_free(error);
+        }
+        return;
+    }
+
+    for (tmp = entries; tmp; tmp = g_slist_next(tmp))
+    {
+        key = gconf_entry_get_key(tmp->data);
+        if (!gconf_client_unset(our_client, key, &error))
+        {
+            if (caller_error)
+            {
+                g_propagate_error(caller_error, error);
+            }
+            else
+            {
+                printf("Failed to unset key %s: %s", key, error->message);
+                g_error_free(error);
+            }
+            break;
+        }
+    }
+
+    g_slist_foreach(entries, (GFunc)gconf_entry_free, NULL);
+    g_slist_free(entries);
+}
+
+
+void
+gnc_gconf_suggest_sync (void)
+{
+    GError *error = NULL;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    gconf_client_suggest_sync(our_client, &error);
+    if (error != NULL)
+    {
+        printf("Failed to sync gconf: %s", error->message);
+        g_error_free(error);
+    }
+}
+
+
+void
+gnc_gconf_add_notification (GObject *object,
+                            const gchar *section,
+                            GConfClientNotifyFunc callback,
+                            const gchar *whoami)
+{
+    GConfClient *client;
+    GError *error = NULL;
+    gchar *path, *client_tag, *notify_tag;
+    guint id;
+
+    g_return_if_fail(G_IS_OBJECT(object));
+    g_return_if_fail(callback != NULL);
+    g_return_if_fail(whoami != NULL);
+
+    client = gconf_client_get_default();
+    path = gnc_gconf_section_name(section);
+
+    /*
+     * First we have to add the directory...
+     */
+    gconf_client_add_dir(client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
+    if (error != NULL)
+    {
+        printf("Failed to add history section to watched directories in gconf: %s", error->message);
+        g_error_free(error);
+        g_object_unref(client);
+        g_free(path);
+        return;
+    }
+
+    /*
+     * Then we can add the notification callback.
+     */
+    id = gconf_client_notify_add(client, path, callback,
+                                 object, NULL, &error);
+    if (error != NULL)
+    {
+        printf("Failed to set gconf notify for history section: %s", error->message);
+        gconf_client_remove_dir(client, path, NULL);
+        g_error_free(error);
+        g_object_unref(client);
+        g_free(path);
+        return;
+    }
+
+    /*
+     * Save the values needed to undo this later.
+     */
+    client_tag = g_strdup_printf(CLIENT_TAG, section ? section : "", whoami);
+    notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section : "", whoami);
+    g_object_set_data(object, client_tag, client);
+    g_object_set_data(object, notify_tag, GUINT_TO_POINTER(id));
+    g_free(notify_tag);
+    g_free(client_tag);
+    g_free(path);
+}
+
+
+guint
+gnc_gconf_add_anon_notification (const gchar *section,
+                                 GConfClientNotifyFunc callback,
+                                 gpointer data)
+{
+    GConfClient *client;
+    GError *error = NULL;
+    gchar *path;
+    guint id;
+
+    g_return_val_if_fail(callback != NULL, 0);
+
+    client = gconf_client_get_default();
+    path = gnc_gconf_section_name(section);
+
+
+    /*
+     * First we have to add the directory...
+     */
+    gconf_client_add_dir(client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
+    if (error != NULL)
+    {
+        printf("Failed to add history section to watched directories in gconf: %s", error->message);
+        g_error_free(error);
+        g_object_unref(client);
+        g_free(path);
+        return 0;
+    }
+
+    /*
+     * Then we can add the notification callback.
+     */
+    id = gconf_client_notify_add(client, path, callback,
+                                 data, NULL, &error);
+    if (error != NULL)
+    {
+        printf("Failed to set gconf notify for history section: %s", error->message);
+        gconf_client_remove_dir(client, path, NULL);
+        g_error_free(error);
+        g_object_unref(client);
+        g_free(path);
+        return 0;
+    }
+    g_free(path);
+    return id;
+}
+
+
+void
+gnc_gconf_remove_notification (GObject *object,
+                               const gchar *section,
+                               const gchar *whoami)
+{
+    GConfClient *client;
+    gchar *path, *client_tag, *notify_tag;
+    guint id;
+
+    g_return_if_fail(G_IS_OBJECT(object));
+    g_return_if_fail(whoami != NULL);
+
+    /*
+     * Remove any gconf notifications
+     */
+    client_tag = g_strdup_printf(CLIENT_TAG, section ? section : "", whoami);
+    client = g_object_get_data(object, client_tag);
+    path = gnc_gconf_section_name(section);
+    if (client)
+    {
+        notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section : "", whoami);
+        id = GPOINTER_TO_UINT(g_object_get_data(object, notify_tag));
+        gconf_client_notify_remove(client, id);
+        gconf_client_remove_dir(client, path, NULL);
+        g_object_unref(client);
+        g_free(notify_tag);
+    }
+    g_free(path);
+    g_free(client_tag);
+}
+
+
+void
+gnc_gconf_remove_anon_notification (const gchar *section,
+                                    guint cnxn_id)
+{
+    GConfClient *client;
+    gchar *path;
+
+    /*
+     * Remove any gconf notifications
+     */
+    path = gnc_gconf_section_name(section);
+    client = gconf_client_get_default();
+    if (client)
+    {
+        gconf_client_notify_remove(client, cnxn_id);
+        gconf_client_remove_dir(client, path, NULL);
+        g_object_unref(client);
+    }
+    g_free(path);
+}
+
+/* ============================================================== */
+
+gboolean
+gnc_gconf_schemas_found (void)
+{
+    GConfSchema* schema;
+    GError *err = NULL;
+    gchar *key;
+
+    if (our_client == NULL)
+        our_client = gconf_client_get_default();
+
+    key = gnc_gconf_make_schema_key(GCONF_GENERAL_REGISTER, "use_theme_colors");
+    schema = gconf_client_get_schema(our_client, key, &err);
+    g_free(key);
+    if (schema == NULL)
+    {
+        return FALSE;
+    }
+    gconf_schema_free(schema);
+
+    /* Set up convenience callback for general section */
+
+    gconf_general_cb_id =
+        gnc_gconf_add_anon_notification(GCONF_GENERAL, gnc_gconf_general_changed,
+                                        NULL);
+    return TRUE;
+}

Copied: gnucash/trunk/src/app-utils/gnc-gconf-utils.h (from rev 22940, gnucash/trunk/src/core-utils/gnc-gconf-utils.h)
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gconf-utils.h	                        (rev 0)
+++ gnucash/trunk/src/app-utils/gnc-gconf-utils.h	2013-05-03 12:03:23 UTC (rev 22941)
@@ -0,0 +1,923 @@
+/********************************************************************\
+ * gnc-gconf-utils.h -- utility functions for storing/retrieving    *
+ *              data in the GConf database for GnuCash              *
+ * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+/** @addtogroup GLib
+    @{ */
+/** @addtogroup GConf GConf Utilities
+
+    The API in this file is designed to make it easy to use the GConf
+    system from within Gnucash.  GConf is a shared key/value storage
+    system.
+
+    The main benefits of these routines are that they
+    -# maintain a GConfClient object,
+    -# convert gnucash internal section names into full gconf pathnames, and
+    -# optionally take care of error checking on return values.
+
+    @{ */
+/** @file gnc-gconf-utils.h
+ *  @brief GConf helper routines.
+ *  @author Copyright (C) 2005,2006 David Hampton <hampton at employees.org>
+ */
+
+
+#ifndef GNC_GCONF_UTILS_H
+#define GNC_GCONF_UTILS_H
+
+#include <gconf/gconf-client.h>
+
+/* Section names used across multiple modules */
+#define GCONF_GENERAL		"general"
+#define GCONF_GENERAL_REGISTER	"general/register"
+#define GCONF_GENERAL_REPORT	"general/report"
+#define GCONF_WARNINGS		"general/warnings"
+#define GCONF_WARNINGS_TEMP	"general/warnings/temporary"
+#define GCONF_WARNINGS_PERM	"general/warnings/permanent"
+
+/* Keys used across multiple modules */
+#define DESKTOP_GNOME_INTERFACE "/desktop/gnome/interface"
+#define KEY_TOOLBAR_STYLE	"toolbar_style"
+#define KEY_SAVE_GEOMETRY	"save_window_geometry"
+#define KEY_LAST_PATH		"last_path"
+#define KEY_USE_NEW   		"use_new_window"
+#define KEY_ACCOUNTING_LABELS	"use_accounting_labels"
+#define KEY_ACCOUNT_SEPARATOR	"account_separator"
+#define KEY_NEGATIVE_IN_RED	"negative_in_red"
+#define KEY_NUM_SOURCE      "num_source"
+#define KEY_ENABLE_EURO		"enable_euro"
+#define KEY_DATE_FORMAT 	"date_format"
+#define KEY_DATE_COMPLETION 	"date_completion"
+#define KEY_DATE_BACKMONTHS 	"date_backmonths"
+#define KEY_SHOW_LEAF_ACCOUNT_NAMES "show_leaf_account_names"
+
+typedef void (*GncGconfGeneralCb)    (GConfEntry *entry, gpointer user_data);
+typedef void (*GncGconfGeneralAnyCb) (gpointer user_data);
+
+
+/** @name GConf Miscellaneous Functions
+ @{
+*/
+
+/** This function takes an enum value and returns its nickname.
+ *
+ *  @param type The value defining the enum class.  For example,
+ *  GTK_TYPE_SORT_TYPE.
+ *
+ *  @param value A value contained in the enum.  For example,
+ *  GTK_SORT_ASCENDING.
+ *
+ *  @return A pointer to the textual "nickname" for this enum.  Tor
+ *  example, "ascending".
+ */
+const gchar * gnc_enum_to_nick(GType type, gint value);
+
+/** This function takes an enum nickname and returns its value.
+ *
+ *  @param type The value defining the enum class.  For example,
+ *  GTK_TYPE_SORT_TYPE or GTK_TYPE_ARROW_TYPE.
+ *
+ *  @param name The textual name for one of the items in the enum.
+ *  For example, "ascending".
+ *
+ *  @param default_value A value contained in the enum.  This value
+ *  will be returned if the supplied nickname is invalid.  For
+ *  example, GTK_SORT_ASCENDING.
+ *
+ *  @return A pointer to the textual "nickname" for this enum.
+ */
+gint gnc_enum_from_nick(GType type,
+                        const gchar *name,
+                        gint default_value);
+
+/** Convert a local key name to a full gconf path name.
+ *
+ *  This function takes a gconf key name and converts it into a fully
+ *  qualified gconf path name.  It does this by prepending the
+ *  standard path for all gnucash keys.  It the key is already fully
+ *  qualified (i.e. begins with a '/' character), this routine does
+ *  not change the key.
+ *
+ *  @param name A partial gconf key or section name.  This name is
+ *  added to the standard prefix to produce a fully qualified key
+ *  name.
+ *
+ *  @return This function returns a string pointer to the fully
+ *  qualified path name of the gconf key.  It is the caller's
+ *  responsibility to free this string.
+ */
+char *gnc_gconf_section_name (const char *name);
+
+
+/** Convert a local schema key name to a full gconf schemapath name.
+ *
+ *  This function takes a gconf schema key name and converts it into a
+ *  fully qualified gconf schema path name.  It does this by
+ *  prepending the standard path for all gnucash schema keys.  It the
+ *  key is already fully qualified (i.e. begins with the string
+ *  "/schemas), this routine does not change the key.
+ *
+ *  @param name A partial gconf schema key or section name.  This name
+ *  is added to the standard schema prefix to produce a fully
+ *  qualified schema key name.
+ *
+ *  @return This function returns a string pointer to the fully
+ *  qualified path name of the gconf schema key.  It is the caller's
+ *  responsibility to free this string.
+ */
+char *gnc_gconf_schema_section_name (const char *name);
+
+
+/** Tell GConf to propagate changes.
+ *
+ *  This function tells gconf that changes have been made and that is
+ *  should propagate its internal state to permanent storage and any
+ *  other clients.  This function is a suggestion to gconf, not a
+ *  directive, and is therefore should be considered optional.  Doesn't
+ *  hurt to call it though if you've made numerous changes to gconf in
+ *  a short period of time.
+ */
+void gnc_gconf_suggest_sync (void);
+
+/** @} */
+
+
+
+/** @name GConf "General" Section Convenience Functions
+ @{
+*/
+
+
+/** Register a callback for when a specific key in the general section
+ *  of Gnucash's gconf data is changed.  Any time the key's value
+ *  changes, the routine will be invoked and will be passed both the
+ *  changes gconf entry and the user data passed to this function.
+ *
+ *  @param key This value contains the name of the key within the
+ *  "general" section to watch.
+ *
+ *  @param func This is a pointer to the function to call when the key
+ *  changes.
+ *
+ *  @param user_data This pointer will be passed to the callback
+ *  function.
+ */
+void gnc_gconf_general_register_cb (const gchar *key,
+                                    GncGconfGeneralCb func,
+                                    gpointer user_data);
+
+
+/** Remove a function that was registered for a callback when a
+ *  specific key in the general section of Gnucash's gconf data
+ *  changed.  Both the func and user_data arguments are used to match
+ *  up the callback to remove.
+ *
+ *  @param key This value contains the name of the key within the
+ *  "general" section to watch.
+ *
+ *  @param func This is a pointer to the function to call when the key
+ *  changes.
+ *
+ *  @param user_data This pointer will be passed to the callback
+ *  function.
+ */
+void gnc_gconf_general_remove_cb (const gchar *key,
+                                  GncGconfGeneralCb func,
+                                  gpointer user_data);
+
+
+/** Register a callback for when any key in the general section of
+ *  Gnucash's gconf data is changed.  Any time the value of a key in
+ *  this section chagnes, the routine will be invoked and will be
+ *  passed the specified user data.
+ *
+ *  @param func This is a pointer to the function to call when the key
+ *  changes.
+ *
+ *  @param user_data This pointer will be passed to the callback
+ *  function.
+ */
+void gnc_gconf_general_register_any_cb (GncGconfGeneralAnyCb func,
+                                        gpointer user_data);
+
+
+/** Remove a function that was registered for a callback when any key
+ *  in the general section of Gnucash's gconf data changed.  Both the
+ *  func and user_data arguments are used to match up the callback to
+ *  remove.
+ *
+ *  @param func This is a pointer to the function to call when a key
+ *  changes.
+ *
+ *  @param user_data This pointer will be passed to the callback
+ *  function.
+ */
+void gnc_gconf_general_remove_any_cb (GncGconfGeneralAnyCb func,
+                                      gpointer user_data);
+
+/** @} */
+
+
+
+/** @name GConf Get Functions
+ @{
+*/
+
+/** Get a boolean value from GConf.
+ *
+ *  Retrieve a TRUE/FALSE value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ *
+ *  @return This function returns the TRUE or FALSE value stored at
+ *  the requested key in the gconf database.  If the key has never
+ *  been set, this function passes on the default value returned by
+ *  GConf as specified in the schema for this key.  If there is an
+ *  error in processing, this function passed on the value of FALSE as
+ *  returned by GConf.
+ */
+gboolean gnc_gconf_get_bool (const gchar *section,
+                             /*@ null @*/ const gchar *name,
+                             /*@ null @*/ GError **error);
+
+/** Get a boolean value from GConf with no error argument.
+ *
+ *  Retrieve a TRUE/FALSE value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @return This function returns the TRUE or FALSE value stored at
+ *  the requested key in the gconf database.  If the key has never
+ *  been set, this function passes on the default value returned by
+ *  GConf as specified in the schema for this key.  If there is an
+ *  error in processing, this function passed on the value of FALSE as
+ *  returned by GConf.
+ *
+ * @note This function was intended for use only by the guile wrapper
+ * functions.  It should not be called from C code.
+ */
+gboolean gnc_gconf_get_bool_no_error (const gchar *section,
+                                      const gchar *name);
+
+/** Get an integer value from GConf.
+ *
+ *  Retrieve an integer value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ *
+ *  @return This function returns the integer value stored at the
+ *  requested key in the gconf database.  If the key has never been
+ *  set, this function passes on the default value returned by GConf
+ *  as specified in the schema for this key.  If there is an error in
+ *  processing, this function passed on the value of zero as returned
+ *  by GConf.
+ */
+gint gnc_gconf_get_int (const gchar *section,
+                        const gchar *name,
+                        GError **error);
+
+/** Get an float value from GConf.
+ *
+ *  Retrieve an float value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ *
+ *  @return This function returns the float value stored at the
+ *  requested key in the gconf database.  If the key has never been
+ *  set, this function passes on the default value returned by GConf
+ *  as specified in the schema for this key.  If there is an error in
+ *  processing, this function passed on the value of zero as returned
+ *  by GConf.
+ */
+gdouble gnc_gconf_get_float (const gchar *section,
+                             const gchar *name,
+                             GError **error);
+
+/** Get a string value from GConf.
+ *
+ *  Retrieve an string value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ *
+ *  @return This function returns the string value stored at the
+ *  requested key in the gconf database.  If the key has never been
+ *  set, this function passes on the default value returned by GConf
+ *  as specified in the schema for this key.  If there is an error in
+ *  processing, this function passed on the NULL value as returned by
+ *  GConf.  It is the callers responsibility to free any string
+ *  returned by this function.
+ */
+char *gnc_gconf_get_string (const gchar *section,
+                            const gchar *name,
+                            GError **error);
+
+/** Get a list of values from GConf.
+ *
+ *  Retrieve a list of values from GConf.  This list may be of any
+ *  kind of value understood by GConf, but all values in the list will
+ *  be of the same type.  The section and key names provided as
+ *  arguments are combined with the standard gnucash key prefix to
+ *  produce a fully qualified key name.  Either name (but not both)
+ *  may be a fully qualified key path name, in which case it is used
+ *  as is, without the standard gnucash prefix.  This allows the
+ *  program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param list_type This enum indicates the type of each item in the
+ *  returned list.  This type must match the type off the stored
+ *  items.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ *
+ *  @return This function returns a list of value stored at the
+ *  requested key in the gconf database.  If the key has never been
+ *  set, this function passes on the default value returned by GConf
+ *  as specified in the schema for this key.  If there is an error in
+ *  processing, this function passed on the NULL value as returned by
+ *  GConf.  It is the callers responsibility to free any memory
+ *  returned by this function.  This include the list itself, and any
+ *  list data that are string values.
+ */
+GSList *gnc_gconf_get_list (const gchar *section,
+                            const gchar *name,
+                            GConfValueType list_type,
+                            GError **error);
+
+
+/** Get a schema value from GConf.
+ *
+ *  Retrieve a schema value from GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param caller_error An optional pointer to a GError structure.  If
+ *  NULL, this function will check for any errors returned by GConf
+ *  and will display an error message via stdout.  If present, this
+ *  function will pass any error back to the calling function for it
+ *  to handle.
+ *
+ *  @return This function returns the schema stored at the requested
+ *  key in the gconf database.  If there is an error in processing,
+ *  this function passed on the NULL value as returned by GConf.  It
+ *  is the callers responsibility to free any returned schema by
+ *  calling the gconf_schema_free() function.
+ */
+GConfSchema *gnc_gconf_get_schema (const gchar *section,
+                                   const gchar *name,
+                                   GError **caller_error);
+
+/** @} */
+
+/** @name GConf Set/Unset Functions
+ @{
+*/
+
+
+/** Store a boolean value into GConf.
+ *
+ *  Store a boolean value into GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param value The TRUE/FALSE value to be stored.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_set_bool (const gchar *section,
+                         const gchar *name,
+                         const gboolean value,
+                         GError **error);
+
+/** Store an integer value into GConf.
+ *
+ *  Store an integer into GConf.  The section and key names provided
+ *  as arguments are combined with the standard gnucash key prefix to
+ *  produce a fully qualified key name.  Either name (but not both)
+ *  may be a fully qualified key path name, in which case it is used
+ *  as is, without the standard gnucash prefix.  This allows the
+ *  program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param value The number to be stored.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_set_int (const gchar *section,
+                        const gchar *name,
+                        const gint value,
+                        GError **error);
+
+/** Store an float value into GConf.
+ *
+ *  Store an float into GConf.  The section and key names provided
+ *  as arguments are combined with the standard gnucash key prefix to
+ *  produce a fully qualified key name.  Either name (but not both)
+ *  may be a fully qualified key path name, in which case it is used
+ *  as is, without the standard gnucash prefix.  This allows the
+ *  program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param value The number to be stored.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_set_float (const gchar *section,
+                          const gchar *name,
+                          const gdouble value,
+                          GError **error);
+
+/** Store a string into GConf.
+ *
+ *  Store a single string into GConf.  The section and key names
+ *  provided as arguments are combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  Either name (but
+ *  not both) may be a fully qualified key path name, in which case it
+ *  is used as is, without the standard gnucash prefix.  This allows
+ *  the program to access keys like standard desktop settings.  Either
+ *  name (but not both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param value The string to be stored.  GConf will make a copy of this
+ *  string, so it is the callers responsibility to free the space used
+ *  by this string (if necessary).
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_set_string (const gchar *section,
+                           const gchar *name,
+                           const gchar *value,
+                           GError **error);
+
+/** Store a list of values into GConf.
+ *
+ *  Store a list of values into GConf.  This list may be of any kind
+ *  of value understood by GConf, but all values in the list must be
+ *  of the same type.  The section and key names provided as arguments
+ *  are combined with the standard gnucash key prefix to produce a
+ *  fully qualified key name.  Either name (but not both) may be a
+ *  fully qualified key path name, in which case it is used as is,
+ *  without the standard gnucash prefix.  This allows the program to
+ *  access keys like standard desktop settings.  Either name (but not
+ *  both) may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param list_type This enum indicates the type of each item in the
+ *  list to be stored.
+ *
+ *  @param value The list of items to be stored.  Each item in the list must
+ *  be of the type specified.  E.G. If the list_type is
+ *  GCONF_VALUE_STRING, then the data field of each element in the
+ *  list must be a string pointer.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_set_list (const gchar *section,
+                         const gchar *name,
+                         GConfValueType list_type,
+                         GSList *value,
+                         GError **error);
+
+/** Delete a value from GConf.
+ *
+ *  Completely remove a value from GConf.  The next attempt to read this
+ *  value will return the default as specified in the GConf schema for
+ *  this key.  The section and key names provided as arguments are
+ *  combined with the standard gnucash key prefix to produce a fully
+ *  qualified key name.  Either name (but not both) may be a fully
+ *  qualified key path name, in which case it is used as is, without
+ *  the standard gnucash prefix.  This allows the program to access
+ *  keys like standard desktop settings.  Either name (but not both)
+ *  may be NULL.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param name This string is the name of the particular key within
+ *  the named section of gconf.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_unset (const gchar *section,
+                      const gchar *name,
+                      GError **error);
+
+
+/** Delete a directory of values from GConf.
+ *
+ *  Completely remove a directory of values from GConf.  The next
+ *  attempt to read any of these values will return the default as
+ *  specified in the GConf schema for the key.  The section names
+ *  provided as an arguments is combined with the standard gnucash key
+ *  prefix to produce a fully qualified directory name.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @param error An optional pointer to a GError structure.  If NULL,
+ *  this function will check for any errors returned by GConf and will
+ *  display an error message via stdout.  If present, this function
+ *  will pass any error back to the calling function for it to handle.
+ */
+void gnc_gconf_unset_dir (const gchar *section,
+                          GError **error);
+
+/** @} */
+
+/** @name GConf Notification Functions
+ @{
+*/
+
+/** Add a notification callback to GConf.
+ *
+ *  Add a function that will be called whenever a value within the
+ *  specified section of the GConf tree changes.  The section name
+ *  provided as an argument is combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  This name may be a
+ *  fully qualified key path name, in which case it is used as is,
+ *  without the standard gnucash prefix.  This allows the object to
+ *  respond to keys like standard desktop settings.
+ *
+ *  @param object This is a pointer to a GObject derivative.  This
+ *  object will be provided to the callback function when it is
+ *  invoked.  Several values will also be attached to this object that
+ *  are used by the gnc_gconf_remove_notification() function.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.  Any key changes within this section
+ *  will invoke the notification function.
+ *
+ *  @param callback The function to call when a value changes.  This
+ *  function will receive the key/value pair as one argument, and the
+ *  'object' argument to this function as another of its arguments.
+ *
+ *  @param whoami A magic value that must match up this call to the
+ *  corresponding call to gnc_gconf_remove_notification().  The pair of
+ *  section and whoami should be unique across all callers.
+ */
+void gnc_gconf_add_notification (GObject *object,
+                                 const gchar *section,
+                                 GConfClientNotifyFunc callback,
+                                 const gchar *whoami);
+
+
+/** An alternative function for adding a notification callback to
+ *  GConf.
+ *
+ *  Add a function that will be called whenever a value within the
+ *  specified section of the GConf tree changes.  The section name
+ *  provided as an argument is combined with the standard gnucash key
+ *  prefix to produce a fully qualified key name.  This name may be a
+ *  fully qualified key path name, in which case it is used as is,
+ *  without the standard gnucash prefix.  This allows the object to
+ *  respond to keys like standard desktop settings.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.  Any key changes within this section
+ *  will invoke the notification function.
+ *
+ *  @param callback The function to call when a value changes.  This
+ *  function will receive the key/value pair as one argument, and the
+ *  'object' argument to this function as another of its arguments.
+ *
+ *  @param data This pointer will be provided to the callback function
+ *  when it is invoked.
+ *
+ *  @return This function returns an identification number that must
+ *  be passed to the gnc_gconf_remove_anon_notification() function to
+ *  reverse the actions of this function.
+ */
+guint gnc_gconf_add_anon_notification (const gchar *section,
+                                       GConfClientNotifyFunc callback,
+                                       gpointer data);
+
+
+/** Remove a callback from GConf.
+ *
+ *  Remove a GConf callback function previously added with the
+ *  gnc_gconf_add_notification function.  The section name must be the
+ *  same string provided when the callback function was added.  This
+ *  name is used to find/remove the callback.
+ *
+ *  @param object This is a pointer to a GObject derivative.  This
+ *  must be the same object originally passed to the
+ *  gnc_gconf_add_notification() function, as that function attached
+ *  several values to the object that are needed by this function.
+ *
+ *  @param section This string is used to find the correct
+ *  notification function to remove from GConf.
+ *
+ *  @param whoami A magic value that must match up this call to the
+ *  corresponding call to gnc_gconf_add_notification().  The pair of
+ *  section and whoami should be unique across all callers.
+ */
+void gnc_gconf_remove_notification (GObject *object,
+                                    const gchar *section,
+                                    const gchar *whoami);
+
+
+
+/** An alternative method for remove a callback from GConf; paired
+ *  with gnc_gconf_add_anon_notification().
+ *
+ *  Remove a GConf callback function previously added with the
+ *  gnc_gconf_add_notification function.  The section name must be the
+ *  same string provided when the callback function was added.  This
+ *  name is used to find/remove the callback.
+ *
+ *  @param section This string is used to find the correct
+ *  notification function to remove from GConf.
+ *
+ *  @param cnxn_id An identification number returned by the
+ *  gnc_gconf_add_anon_notification() function.
+ */
+void gnc_gconf_remove_anon_notification (const gchar *section,
+        guint cnxn_id);
+
+
+/** Retrieve a list of all key/value pairs in the specified GConf
+ *  section.  The section name provided as an argument is combined
+ *  with the standard gnucash key prefix to produce a fully qualified
+ *  section name.
+ *
+ *  @param section This string provides a grouping of keys within the
+ *  GnuCash section of the gconf database.  It can be a simple string
+ *  as in "history" for settings that are common to many areas of
+ *  gnucash, or it can be a partial path name as in
+ *  "dialogs/business/invoice" for setting that only apply to one
+ *  specific area of the program.
+ *
+ *  @return This function returns a list of all key/value pairs stored
+ *  in this section of the gconf database.  These are GConfEntry
+ *  objects.  It is the callers responsibility to free any memory
+ *  returned by this function.  This include the list itself, and any
+ *  entries contained in the list.  See gconf_client_all_entries in
+ *  the gconf documentation.
+ */
+GSList *gnc_gconf_client_all_entries (const gchar *section);
+
+
+/** Check gconf to see if the schema for one of the gnucash keys can
+ *  be found.  This function is called to determine whether or not to
+ *  launch an assistant to help the user properly set up GConf for Gnucash.
+ *
+ *  @return This function returns TRUE if it was able to find a
+ *  schema.
+ */
+gboolean gnc_gconf_schemas_found (void);
+
+/** @} */
+
+/** @name GConf One Liners
+ @{
+*/
+
+#define DESTKOP_TEAROFF_MENUS "/desktop/gnome/interface/menus_have_tearoff"
+#define DESTKOP_MENUBAR_DETACHABLE "/desktop/gnome/interface/menubar_detachable"
+#define DESTKOP_TOOLBAR_DETACHABLE "/desktop/gnome/interface/toolbar_detachable"
+
+static inline gboolean
+gnc_gconf_menus_have_tearoff (void)
+{
+    return gnc_gconf_get_bool(DESTKOP_TEAROFF_MENUS, NULL, NULL);
+}
+
+static inline gboolean
+gnc_gconf_menubar_detachable (void)
+{
+    return gnc_gconf_get_bool(DESTKOP_MENUBAR_DETACHABLE, NULL, NULL);
+}
+
+static inline gboolean
+gnc_gconf_toolbar_detachable (void)
+{
+    return gnc_gconf_get_bool(DESTKOP_TOOLBAR_DETACHABLE, NULL, NULL);
+}
+
+/** @} */
+
+#endif /* GNC_GCONF_UTILS_H */
+/** @} */
+/** @} */

Modified: gnucash/trunk/src/core-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/Makefile.am	2013-05-03 12:03:12 UTC (rev 22940)
+++ gnucash/trunk/src/core-utils/Makefile.am	2013-05-03 12:03:23 UTC (rev 22941)
@@ -7,7 +7,6 @@
   gnc-core-prefs.c \
   gnc-features.c \
   gnc-filepath-utils.c \
-  gnc-gconf-utils.c \
   gnc-gdate-utils.c \
   gnc-gkeyfile-utils.c \
   gnc-glib-utils.c \
@@ -23,7 +22,6 @@
   ${GLIB_LIBS} \
   ${BINRELOC_LIBS} \
   ${GTK_MAC_LIBS} \
-  ${GCONF_LIBS} \
   ${QOF_LIBS}
 
 
@@ -32,7 +30,6 @@
   gnc-core-prefs.h \
   gnc-features.h \
   gnc-filepath-utils.h \
-  gnc-gconf-utils.h \
   gnc-gdate-utils.h \
   gnc-gkeyfile-utils.h \
   gnc-glib-utils.h \
@@ -54,7 +51,6 @@
 AM_CPPFLAGS = \
   ${GUILE_INCS} \
   ${GLIB_CFLAGS} \
-  ${GCONF_CFLAGS} \
   ${GTK_MAC_CFLAGS} \
   ${QOF_CFLAGS} \
   -I${top_srcdir}/src/libqof/qof \

Deleted: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2013-05-03 12:03:12 UTC (rev 22940)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2013-05-03 12:03:23 UTC (rev 22941)
@@ -1,989 +0,0 @@
-/********************************************************************\
- * gnc-gconf-utils.c -- utility functions for storing/retrieving    *
- *              data in the GConf database for GnuCash              *
- * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>    *
- *                                                                  *
- * This program is free software; you can redistribute it and/or    *
- * modify it under the terms of the GNU General Public License as   *
- * published by the Free Software Foundation; either version 2 of   *
- * the License, or (at your option) any later version.              *
- *                                                                  *
- * This program is distributed in the hope that it will be useful,  *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
- * GNU General Public License for more details.                     *
- *                                                                  *
- * You should have received a copy of the GNU General Public License*
- * along with this program; if not, contact:                        *
- *                                                                  *
- * Free Software Foundation           Voice:  +1-617-542-5942       *
- * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
- * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "gnc-core-prefs.h"
-#include "gnc-gconf-utils.h"
-
-#define CLIENT_TAG  "%s-%s-client"
-#define NOTIFY_TAG  "%s-%s-notify_id"
-
-static GConfClient *our_client = NULL;
-static guint gconf_general_cb_id = 0;
-
-/************************************************************/
-/*                      Enum Utilities                      */
-/************************************************************/
-
-const gchar *
-gnc_enum_to_nick(GType type,
-                 gint value)
-{
-    GEnumClass   	    *enum_class;
-    GEnumValue   	    *enum_value;
-
-    /* Lookup the enum in the glib type system */
-    enum_class = g_type_class_ref (type);
-    if (!enum_class)
-    {
-        /* g_type_class_ref has already printed a warning. */
-        return NULL;
-    }
-
-    enum_value = g_enum_get_value (enum_class, value);
-    if (!enum_value)
-    {
-        /* Use the first item in the enum */
-        enum_value = g_enum_get_value (enum_class, 0);
-    }
-    return enum_value->value_nick;
-}
-
-gint
-gnc_enum_from_nick(GType type,
-                   const gchar *name,
-                   gint default_value)
-{
-    GEnumClass   *enum_class;
-    GEnumValue   *enum_value;
-    gchar        *alt_name, *ptr;
-
-    if (name == NULL)
-        return default_value;
-
-    /* Lookup the enum class in the glib type system */
-    enum_class = g_type_class_ref (type);
-    if (!enum_class)
-    {
-        /* g_type_class_ref has already printed a warning. */
-        return default_value;
-    }
-
-    /* Lookup the specified enum in the class */
-    enum_value = g_enum_get_value_by_nick(enum_class, name);
-    if (enum_value)
-        return enum_value->value;
-
-    /* Flip '-' and '_' and try again */
-    alt_name = g_strdup(name);
-    if ((ptr = strchr(alt_name, '-')) != NULL)
-    {
-        do
-        {
-            *ptr++ = '_';
-        }
-        while ((ptr = strchr(ptr, '-')) != NULL);
-    }
-    else  if ((ptr = strchr(alt_name, '_')) != NULL)
-    {
-        do
-        {
-            *ptr++ = '-';
-        }
-        while ((ptr = strchr(ptr, '_')) != NULL);
-    }
-    else
-    {
-        g_free(alt_name);
-        return default_value;
-    }
-
-    /* Lookup the specified enum in the class */
-    enum_value = g_enum_get_value_by_nick(enum_class, alt_name);
-    g_free(alt_name);
-    if (enum_value)
-        return enum_value->value;
-    return default_value;
-}
-
-/************************************************************/
-/*        Notification of "General" Section Changes         */
-/************************************************************/
-
-static GOnce gcb_init_once = G_ONCE_INIT;
-static GHashTable *gcb_callback_hash = NULL;
-static GHookList *gcb_final_hook_list = NULL;
-
-static gpointer
-gcb_init (gpointer unused)
-{
-    gcb_callback_hash = g_hash_table_new(g_str_hash, g_str_equal);
-
-    gcb_final_hook_list = g_malloc(sizeof(GHookList));
-    g_hook_list_init(gcb_final_hook_list, sizeof(GHook));
-    return NULL;
-}
-
-static void
-gcb_call_hook (GHook *hook, gpointer data)
-{
-    ((GFunc)hook->func)(data, hook->data);
-}
-
-static void
-gnc_gconf_general_changed (GConfClient *client,
-                           guint cnxn_id,
-                           GConfEntry *entry,
-                           gpointer data)
-{
-    const gchar *key, *key_tail;
-    GHookList *hook_list;
-
-    g_once(&gcb_init_once, gcb_init, NULL);
-
-    key = gconf_entry_get_key(entry);
-    key_tail = strrchr(key, '/');
-    if (key_tail != NULL)
-    {
-        key_tail++;
-    }
-    if (key_tail == NULL)
-    {
-        /* Should never happen. */
-        g_warning("Malformed key %s:", key);
-        return;
-    }
-
-    hook_list = g_hash_table_lookup(gcb_callback_hash, key_tail);
-    if (hook_list != NULL)
-        g_hook_list_marshal(hook_list, TRUE, gcb_call_hook, entry);
-    g_hook_list_invoke(gcb_final_hook_list, TRUE);
-}
-
-
-void
-gnc_gconf_general_register_cb (const gchar *key,
-                               GncGconfGeneralCb func,
-                               gpointer user_data)
-{
-    GHookList *hook_list;
-    GHook *hook;
-
-    g_once(&gcb_init_once, gcb_init, NULL);
-    hook_list = g_hash_table_lookup(gcb_callback_hash, key);
-    if (hook_list == NULL)
-    {
-        hook_list = g_malloc(sizeof(GHookList));
-        g_hook_list_init(hook_list, sizeof(GHook));
-        g_hash_table_insert(gcb_callback_hash, (gpointer)key, hook_list);
-    }
-
-    hook = g_hook_find_func_data(hook_list, TRUE, func, user_data);
-    if (hook != NULL)
-    {
-        return;
-    }
-
-    hook = g_hook_alloc(hook_list);
-    hook->func = func;
-    hook->data = user_data;
-    g_hook_append(hook_list, hook);
-}
-
-
-void
-gnc_gconf_general_remove_cb (const gchar *key,
-                             GncGconfGeneralCb func,
-                             gpointer user_data)
-{
-    GHookList *hook_list;
-    GHook *hook;
-
-    g_once(&gcb_init_once, gcb_init, NULL);
-    hook_list = g_hash_table_lookup(gcb_callback_hash, key);
-    if (hook_list == NULL)
-        return;
-    hook = g_hook_find_func_data(hook_list, TRUE, func, user_data);
-    if (hook == NULL)
-        return;
-
-    g_hook_destroy_link(hook_list, hook);
-    if (hook_list->hooks == NULL)
-    {
-        g_hash_table_remove(gcb_callback_hash, key);
-        g_free(hook_list);
-    }
-}
-
-
-void
-gnc_gconf_general_register_any_cb (GncGconfGeneralAnyCb func,
-                                   gpointer user_data)
-{
-    GHook *hook;
-
-    g_once(&gcb_init_once, gcb_init, NULL);
-    hook = g_hook_find_func_data(gcb_final_hook_list, TRUE, func, user_data);
-    if (hook != NULL)
-        return;
-
-    hook = g_hook_alloc(gcb_final_hook_list);
-    hook->func = func;
-    hook->data = user_data;
-    g_hook_append(gcb_final_hook_list, hook);
-}
-
-
-void
-gnc_gconf_general_remove_any_cb (GncGconfGeneralAnyCb func,
-                                 gpointer user_data)
-{
-    GHook *hook;
-
-    g_once(&gcb_init_once, gcb_init, NULL);
-    hook = g_hook_find_func_data(gcb_final_hook_list, TRUE, func, user_data);
-    if (hook == NULL)
-        return;
-
-    g_hook_unref(gcb_final_hook_list, hook);
-}
-
-
-/************************************************************/
-/*                      Gconf Utilities                     */
-/************************************************************/
-
-char *
-gnc_gconf_section_name (const char *name)
-{
-    if (name == NULL)
-    {
-        /* Need to return a newly allocated string */
-        return g_strdup(gnc_gconf_get_path_prefix());
-    }
-    if (*name == '/')
-    {
-        /* Need to return a newly allocated string */
-        return g_strdup(name);
-    }
-
-    /* This could (should?) be accomplished with a call to
-     * gnome_gconf_get_app_settings_relative(), but that would introduce
-     * a new library dependancy, even though its not a gui library.  In
-     * order to keep this file completely "gnome-free" this approach was
-     * used.
-     */
-    return g_strjoin("/", gnc_gconf_get_path_prefix(), name, NULL);
-}
-
-char *
-gnc_gconf_schema_section_name (const char *name)
-{
-    if (strncmp(name, "/schemas", sizeof("/schemas")) == 0)
-    {
-        /* Need to return a newly allocated string */
-        return g_strdup(name);
-    }
-
-    /* This could (should?) be accomplished with a call to
-     * gnome_gconf_get_app_settings_relative(), but that would introduce
-     * a new library dependancy, even though its not a gui library.  In
-     * order to keep this file completely "gnome-free" this approach was
-     * used.
-     */
-    return g_strconcat("/schemas", gnc_gconf_get_path_prefix(), "/", name, NULL);
-}
-
-static gchar *
-gnc_gconf_make_key (const gchar *section, const gchar *name)
-{
-    gchar *section_path, *key;
-
-    g_assert ((section != NULL) || (name != NULL));
-
-    if (section == NULL)
-    {
-        if (*name == '/')
-            return g_strdup(name);
-        return gnc_gconf_section_name(name);
-    }
-
-    if (name == NULL)
-    {
-        if (*section == '/')
-            return g_strdup(section);
-        return gnc_gconf_section_name(section);
-    }
-
-    if (*section == '/')
-    {
-        if (*name == '/')
-            return g_strjoin(NULL, section, name, NULL);
-        return g_strjoin("/", section, name, NULL);
-    }
-
-    section_path = gnc_gconf_section_name(section);
-    key = g_strjoin("/", section_path, name, NULL);
-    g_free(section_path);
-    return key;
-}
-
-
-static gchar *
-gnc_gconf_make_schema_key (const gchar *section, const gchar *name)
-{
-    gchar *intermediate, *key;
-
-    g_assert ((section != NULL) || (name != NULL));
-
-    intermediate = gnc_gconf_make_key(section, name);
-    key = g_strconcat("/schemas", intermediate, NULL);
-    g_free(intermediate);
-    return key;
-}
-
-
-/** Either propagate an error between data structures, or display the
- *  error to the user.  This is a helper function called by all of the
- *  load functions in this file.  It checks to see if the function
- *  that called in to this file wants to handle the error, or if this
- *  function should display a default error message.
- *
- *  @internal
- *
- *  @param key The name of the key that failed to load.
- *
- *  @param caller_error A pointer to where the caller of this file
- *  would like the error stored.  If NULL, then the caller doesn't
- *  want to handle the error.
- *
- *  @param error A pointer to the error that this file received from
- *  gconf.
- */
-static void
-gnc_gconf_load_error (const gchar *key,
-                      GError **caller_error,
-                      GError *error)
-{
-    if (caller_error)
-    {
-        g_propagate_error(caller_error, error);
-    }
-    else
-    {
-        printf("Failed to load key %s: %s", key, error->message);
-        g_error_free(error);
-    }
-}
-
-
-/** Either propagate an error between data structures, or display the
- *  error to the user.  This is a helper function called by all of the
- *  save functions in this file.  It checks to see if the function
- *  that called in to this file wants to handle the error, or if this
- *  function should display a default error message.
- *
- *  @internal
- *
- *  @param key The name of the key that failed to load.
- *
- *  @param caller_error A pointer to where the caller of this file
- *  would like the error stored.  If NULL, then the caller doesn't
- *  want to handle the error.
- *
- *  @param error A pointer to the error that this file received from
- *  gconf.
- */
-static void
-gnc_gconf_save_error (const gchar *key,
-                      GError **caller_error,
-                      GError *error)
-{
-    if (caller_error)
-    {
-        g_propagate_error(caller_error, error);
-    }
-    else if (error)
-    {
-        printf("Failed to save key %s: %s", key, error->message);
-        g_error_free(error);
-    }
-    else
-    {
-        printf("Failed to save key %s: %s", key, "Unknown error");
-    }
-}
-
-
-gboolean
-gnc_gconf_get_bool (const gchar *section,
-                    const gchar *name,
-                    GError **caller_error)
-{
-    GError *error = NULL;
-    gboolean value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_bool(our_client, key, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-    return value;
-}
-
-gboolean
-gnc_gconf_get_bool_no_error (const gchar *section,
-                             const gchar *name)
-{
-    return gnc_gconf_get_bool(section, name, NULL);
-}
-
-void
-gnc_gconf_set_bool (const gchar *section,
-                    const gchar *name,
-                    const gboolean value,
-                    GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    /* Remember whether the column width */
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_set_bool(our_client, key, value, &error))
-    {
-        gnc_gconf_save_error(key, caller_error, error);
-    }
-    g_free(key);
-}
-
-gint
-gnc_gconf_get_int (const gchar *section,
-                   const gchar *name,
-                   GError **caller_error)
-{
-    GError *error = NULL;
-    gint value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_int(our_client, key, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-    return value;
-}
-
-void
-gnc_gconf_set_int (const gchar *section,
-                   const gchar *name,
-                   const gint value,
-                   GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    /* Remember whether the column width */
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_set_int(our_client, key, value, &error))
-    {
-        gnc_gconf_save_error(key, caller_error, error);
-    }
-    g_free(key);
-}
-
-gdouble
-gnc_gconf_get_float (const gchar *section,
-                     const gchar *name,
-                     GError **caller_error)
-{
-    GError *error = NULL;
-    gdouble value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_float(our_client, key, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-    return value;
-}
-
-void
-gnc_gconf_set_float (const gchar *section,
-                     const gchar *name,
-                     const gdouble value,
-                     GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    /* Remember whether the column width */
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_set_float(our_client, key, value, &error))
-    {
-        gnc_gconf_save_error(key, caller_error, error);
-    }
-    g_free(key);
-}
-
-gchar *
-gnc_gconf_get_string (const gchar *section,
-                      const gchar *name,
-                      GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_string(our_client, key, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-
-    if (value && strlen(value) == 0)
-    {
-        g_free(value);
-        return NULL;
-    }
-    return value;
-}
-
-void
-gnc_gconf_set_string (const gchar *section,
-                      const gchar *name,
-                      const gchar *value,
-                      GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_set_string(our_client, key, value, &error))
-    {
-        gnc_gconf_save_error(key, caller_error, error);
-    }
-    g_free(key);
-}
-
-GSList *
-gnc_gconf_get_list (const gchar *section,
-                    const gchar *name,
-                    GConfValueType list_type,
-                    GError **caller_error)
-{
-    GError *error = NULL;
-    GSList *value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_list(our_client, key, list_type, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-    return value;
-}
-
-void
-gnc_gconf_set_list (const gchar *section,
-                    const gchar *name,
-                    GConfValueType list_type,
-                    GSList *value,
-                    GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_set_list(our_client, key, list_type, value, &error))
-    {
-        gnc_gconf_save_error(key, caller_error, error);
-    }
-    g_free(key);
-}
-
-GConfSchema *
-gnc_gconf_get_schema (const gchar *section,
-                      const gchar *name,
-                      GError **caller_error)
-{
-    GError *error = NULL;
-    GConfSchema *value;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    value = gconf_client_get_schema(our_client, key, &error);
-    if (error)
-    {
-        gnc_gconf_load_error(key, caller_error, error);
-    }
-    g_free(key);
-    return value;
-}
-
-GSList *
-gnc_gconf_client_all_entries (const gchar *name)
-{
-    GError *error = NULL;
-    GSList *value;
-    gchar *section;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    section = gnc_gconf_section_name(name);
-    value = gconf_client_all_entries(our_client, section, &error);
-    g_free(section);
-    if (error != NULL)
-    {
-        printf("Failed to get list of all gconf keys: %s", error->message);
-        g_error_free(error);
-    }
-
-    return value;
-}
-
-void
-gnc_gconf_unset (const gchar *section,
-                 const gchar *name,
-                 GError **caller_error)
-{
-    GError *error = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_key(section, name);
-    if (!gconf_client_unset(our_client, key, &error))
-    {
-        if (caller_error)
-        {
-            g_propagate_error(caller_error, error);
-        }
-        else
-        {
-            printf("Failed to unset key %s: %s", key, error->message);
-            g_error_free(error);
-        }
-    }
-    g_free(key);
-}
-
-
-void
-gnc_gconf_unset_dir (const gchar *section,
-                     GError **caller_error)
-{
-    GError *error = NULL;
-    GSList *entries, *tmp;
-    const gchar *key;
-    gchar *dir_key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    dir_key = gnc_gconf_make_key(section, NULL);
-    entries = gconf_client_all_entries(our_client, dir_key, &error);
-    g_free(dir_key);
-    if (error)
-    {
-        if (caller_error)
-        {
-            g_propagate_error(caller_error, error);
-        }
-        else
-        {
-            printf("Failed to get directory entries for key %s: %s",
-                   dir_key, error->message);
-            g_error_free(error);
-        }
-        return;
-    }
-
-    for (tmp = entries; tmp; tmp = g_slist_next(tmp))
-    {
-        key = gconf_entry_get_key(tmp->data);
-        if (!gconf_client_unset(our_client, key, &error))
-        {
-            if (caller_error)
-            {
-                g_propagate_error(caller_error, error);
-            }
-            else
-            {
-                printf("Failed to unset key %s: %s", key, error->message);
-                g_error_free(error);
-            }
-            break;
-        }
-    }
-
-    g_slist_foreach(entries, (GFunc)gconf_entry_free, NULL);
-    g_slist_free(entries);
-}
-
-
-void
-gnc_gconf_suggest_sync (void)
-{
-    GError *error = NULL;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    gconf_client_suggest_sync(our_client, &error);
-    if (error != NULL)
-    {
-        printf("Failed to sync gconf: %s", error->message);
-        g_error_free(error);
-    }
-}
-
-
-void
-gnc_gconf_add_notification (GObject *object,
-                            const gchar *section,
-                            GConfClientNotifyFunc callback,
-                            const gchar *whoami)
-{
-    GConfClient *client;
-    GError *error = NULL;
-    gchar *path, *client_tag, *notify_tag;
-    guint id;
-
-    g_return_if_fail(G_IS_OBJECT(object));
-    g_return_if_fail(callback != NULL);
-    g_return_if_fail(whoami != NULL);
-
-    client = gconf_client_get_default();
-    path = gnc_gconf_section_name(section);
-
-    /*
-     * First we have to add the directory...
-     */
-    gconf_client_add_dir(client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
-    if (error != NULL)
-    {
-        printf("Failed to add history section to watched directories in gconf: %s", error->message);
-        g_error_free(error);
-        g_object_unref(client);
-        g_free(path);
-        return;
-    }
-
-    /*
-     * Then we can add the notification callback.
-     */
-    id = gconf_client_notify_add(client, path, callback,
-                                 object, NULL, &error);
-    if (error != NULL)
-    {
-        printf("Failed to set gconf notify for history section: %s", error->message);
-        gconf_client_remove_dir(client, path, NULL);
-        g_error_free(error);
-        g_object_unref(client);
-        g_free(path);
-        return;
-    }
-
-    /*
-     * Save the values needed to undo this later.
-     */
-    client_tag = g_strdup_printf(CLIENT_TAG, section ? section : "", whoami);
-    notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section : "", whoami);
-    g_object_set_data(object, client_tag, client);
-    g_object_set_data(object, notify_tag, GUINT_TO_POINTER(id));
-    g_free(notify_tag);
-    g_free(client_tag);
-    g_free(path);
-}
-
-
-guint
-gnc_gconf_add_anon_notification (const gchar *section,
-                                 GConfClientNotifyFunc callback,
-                                 gpointer data)
-{
-    GConfClient *client;
-    GError *error = NULL;
-    gchar *path;
-    guint id;
-
-    g_return_val_if_fail(callback != NULL, 0);
-
-    client = gconf_client_get_default();
-    path = gnc_gconf_section_name(section);
-
-
-    /*
-     * First we have to add the directory...
-     */
-    gconf_client_add_dir(client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
-    if (error != NULL)
-    {
-        printf("Failed to add history section to watched directories in gconf: %s", error->message);
-        g_error_free(error);
-        g_object_unref(client);
-        g_free(path);
-        return 0;
-    }
-
-    /*
-     * Then we can add the notification callback.
-     */
-    id = gconf_client_notify_add(client, path, callback,
-                                 data, NULL, &error);
-    if (error != NULL)
-    {
-        printf("Failed to set gconf notify for history section: %s", error->message);
-        gconf_client_remove_dir(client, path, NULL);
-        g_error_free(error);
-        g_object_unref(client);
-        g_free(path);
-        return 0;
-    }
-    g_free(path);
-    return id;
-}
-
-
-void
-gnc_gconf_remove_notification (GObject *object,
-                               const gchar *section,
-                               const gchar *whoami)
-{
-    GConfClient *client;
-    gchar *path, *client_tag, *notify_tag;
-    guint id;
-
-    g_return_if_fail(G_IS_OBJECT(object));
-    g_return_if_fail(whoami != NULL);
-
-    /*
-     * Remove any gconf notifications
-     */
-    client_tag = g_strdup_printf(CLIENT_TAG, section ? section : "", whoami);
-    client = g_object_get_data(object, client_tag);
-    path = gnc_gconf_section_name(section);
-    if (client)
-    {
-        notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section : "", whoami);
-        id = GPOINTER_TO_UINT(g_object_get_data(object, notify_tag));
-        gconf_client_notify_remove(client, id);
-        gconf_client_remove_dir(client, path, NULL);
-        g_object_unref(client);
-        g_free(notify_tag);
-    }
-    g_free(path);
-    g_free(client_tag);
-}
-
-
-void
-gnc_gconf_remove_anon_notification (const gchar *section,
-                                    guint cnxn_id)
-{
-    GConfClient *client;
-    gchar *path;
-
-    /*
-     * Remove any gconf notifications
-     */
-    path = gnc_gconf_section_name(section);
-    client = gconf_client_get_default();
-    if (client)
-    {
-        gconf_client_notify_remove(client, cnxn_id);
-        gconf_client_remove_dir(client, path, NULL);
-        g_object_unref(client);
-    }
-    g_free(path);
-}
-
-/* ============================================================== */
-
-gboolean
-gnc_gconf_schemas_found (void)
-{
-    GConfSchema* schema;
-    GError *err = NULL;
-    gchar *key;
-
-    if (our_client == NULL)
-        our_client = gconf_client_get_default();
-
-    key = gnc_gconf_make_schema_key(GCONF_GENERAL_REGISTER, "use_theme_colors");
-    schema = gconf_client_get_schema(our_client, key, &err);
-    g_free(key);
-    if (schema == NULL)
-    {
-        return FALSE;
-    }
-    gconf_schema_free(schema);
-
-    /* Set up convenience callback for general section */
-
-    gconf_general_cb_id =
-        gnc_gconf_add_anon_notification(GCONF_GENERAL, gnc_gconf_general_changed,
-                                        NULL);
-    return TRUE;
-}

Deleted: gnucash/trunk/src/core-utils/gnc-gconf-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.h	2013-05-03 12:03:12 UTC (rev 22940)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.h	2013-05-03 12:03:23 UTC (rev 22941)
@@ -1,923 +0,0 @@
-/********************************************************************\
- * gnc-gconf-utils.h -- utility functions for storing/retrieving    *
- *              data in the GConf database for GnuCash              *
- * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>    *
- *                                                                  *
- * This program is free software; you can redistribute it and/or    *
- * modify it under the terms of the GNU General Public License as   *
- * published by the Free Software Foundation; either version 2 of   *
- * the License, or (at your option) any later version.              *
- *                                                                  *
- * This program is distributed in the hope that it will be useful,  *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
- * GNU General Public License for more details.                     *
- *                                                                  *
- * You should have received a copy of the GNU General Public License*
- * along with this program; if not, contact:                        *
- *                                                                  *
- * Free Software Foundation           Voice:  +1-617-542-5942       *
- * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
- * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-/** @addtogroup GLib
-    @{ */
-/** @addtogroup GConf GConf Utilities
-
-    The API in this file is designed to make it easy to use the GConf
-    system from within Gnucash.  GConf is a shared key/value storage
-    system.
-
-    The main benefits of these routines are that they
-    -# maintain a GConfClient object,
-    -# convert gnucash internal section names into full gconf pathnames, and
-    -# optionally take care of error checking on return values.
-
-    @{ */
-/** @file gnc-gconf-utils.h
- *  @brief GConf helper routines.
- *  @author Copyright (C) 2005,2006 David Hampton <hampton at employees.org>
- */
-
-
-#ifndef GNC_GCONF_UTILS_H
-#define GNC_GCONF_UTILS_H
-
-#include <gconf/gconf-client.h>
-
-/* Section names used across multiple modules */
-#define GCONF_GENERAL		"general"
-#define GCONF_GENERAL_REGISTER	"general/register"
-#define GCONF_GENERAL_REPORT	"general/report"
-#define GCONF_WARNINGS		"general/warnings"
-#define GCONF_WARNINGS_TEMP	"general/warnings/temporary"
-#define GCONF_WARNINGS_PERM	"general/warnings/permanent"
-
-/* Keys used across multiple modules */
-#define DESKTOP_GNOME_INTERFACE "/desktop/gnome/interface"
-#define KEY_TOOLBAR_STYLE	"toolbar_style"
-#define KEY_SAVE_GEOMETRY	"save_window_geometry"
-#define KEY_LAST_PATH		"last_path"
-#define KEY_USE_NEW   		"use_new_window"
-#define KEY_ACCOUNTING_LABELS	"use_accounting_labels"
-#define KEY_ACCOUNT_SEPARATOR	"account_separator"
-#define KEY_NEGATIVE_IN_RED	"negative_in_red"
-#define KEY_NUM_SOURCE      "num_source"
-#define KEY_ENABLE_EURO		"enable_euro"
-#define KEY_DATE_FORMAT 	"date_format"
-#define KEY_DATE_COMPLETION 	"date_completion"
-#define KEY_DATE_BACKMONTHS 	"date_backmonths"
-#define KEY_SHOW_LEAF_ACCOUNT_NAMES "show_leaf_account_names"
-
-typedef void (*GncGconfGeneralCb)    (GConfEntry *entry, gpointer user_data);
-typedef void (*GncGconfGeneralAnyCb) (gpointer user_data);
-
-
-/** @name GConf Miscellaneous Functions
- @{
-*/
-
-/** This function takes an enum value and returns its nickname.
- *
- *  @param type The value defining the enum class.  For example,
- *  GTK_TYPE_SORT_TYPE.
- *
- *  @param value A value contained in the enum.  For example,
- *  GTK_SORT_ASCENDING.
- *
- *  @return A pointer to the textual "nickname" for this enum.  Tor
- *  example, "ascending".
- */
-const gchar * gnc_enum_to_nick(GType type, gint value);
-
-/** This function takes an enum nickname and returns its value.
- *
- *  @param type The value defining the enum class.  For example,
- *  GTK_TYPE_SORT_TYPE or GTK_TYPE_ARROW_TYPE.
- *
- *  @param name The textual name for one of the items in the enum.
- *  For example, "ascending".
- *
- *  @param default_value A value contained in the enum.  This value
- *  will be returned if the supplied nickname is invalid.  For
- *  example, GTK_SORT_ASCENDING.
- *
- *  @return A pointer to the textual "nickname" for this enum.
- */
-gint gnc_enum_from_nick(GType type,
-                        const gchar *name,
-                        gint default_value);
-
-/** Convert a local key name to a full gconf path name.
- *
- *  This function takes a gconf key name and converts it into a fully
- *  qualified gconf path name.  It does this by prepending the
- *  standard path for all gnucash keys.  It the key is already fully
- *  qualified (i.e. begins with a '/' character), this routine does
- *  not change the key.
- *
- *  @param name A partial gconf key or section name.  This name is
- *  added to the standard prefix to produce a fully qualified key
- *  name.
- *
- *  @return This function returns a string pointer to the fully
- *  qualified path name of the gconf key.  It is the caller's
- *  responsibility to free this string.
- */
-char *gnc_gconf_section_name (const char *name);
-
-
-/** Convert a local schema key name to a full gconf schemapath name.
- *
- *  This function takes a gconf schema key name and converts it into a
- *  fully qualified gconf schema path name.  It does this by
- *  prepending the standard path for all gnucash schema keys.  It the
- *  key is already fully qualified (i.e. begins with the string
- *  "/schemas), this routine does not change the key.
- *
- *  @param name A partial gconf schema key or section name.  This name
- *  is added to the standard schema prefix to produce a fully
- *  qualified schema key name.
- *
- *  @return This function returns a string pointer to the fully
- *  qualified path name of the gconf schema key.  It is the caller's
- *  responsibility to free this string.
- */
-char *gnc_gconf_schema_section_name (const char *name);
-
-
-/** Tell GConf to propagate changes.
- *
- *  This function tells gconf that changes have been made and that is
- *  should propagate its internal state to permanent storage and any
- *  other clients.  This function is a suggestion to gconf, not a
- *  directive, and is therefore should be considered optional.  Doesn't
- *  hurt to call it though if you've made numerous changes to gconf in
- *  a short period of time.
- */
-void gnc_gconf_suggest_sync (void);
-
-/** @} */
-
-
-
-/** @name GConf "General" Section Convenience Functions
- @{
-*/
-
-
-/** Register a callback for when a specific key in the general section
- *  of Gnucash's gconf data is changed.  Any time the key's value
- *  changes, the routine will be invoked and will be passed both the
- *  changes gconf entry and the user data passed to this function.
- *
- *  @param key This value contains the name of the key within the
- *  "general" section to watch.
- *
- *  @param func This is a pointer to the function to call when the key
- *  changes.
- *
- *  @param user_data This pointer will be passed to the callback
- *  function.
- */
-void gnc_gconf_general_register_cb (const gchar *key,
-                                    GncGconfGeneralCb func,
-                                    gpointer user_data);
-
-
-/** Remove a function that was registered for a callback when a
- *  specific key in the general section of Gnucash's gconf data
- *  changed.  Both the func and user_data arguments are used to match
- *  up the callback to remove.
- *
- *  @param key This value contains the name of the key within the
- *  "general" section to watch.
- *
- *  @param func This is a pointer to the function to call when the key
- *  changes.
- *
- *  @param user_data This pointer will be passed to the callback
- *  function.
- */
-void gnc_gconf_general_remove_cb (const gchar *key,
-                                  GncGconfGeneralCb func,
-                                  gpointer user_data);
-
-
-/** Register a callback for when any key in the general section of
- *  Gnucash's gconf data is changed.  Any time the value of a key in
- *  this section chagnes, the routine will be invoked and will be
- *  passed the specified user data.
- *
- *  @param func This is a pointer to the function to call when the key
- *  changes.
- *
- *  @param user_data This pointer will be passed to the callback
- *  function.
- */
-void gnc_gconf_general_register_any_cb (GncGconfGeneralAnyCb func,
-                                        gpointer user_data);
-
-
-/** Remove a function that was registered for a callback when any key
- *  in the general section of Gnucash's gconf data changed.  Both the
- *  func and user_data arguments are used to match up the callback to
- *  remove.
- *
- *  @param func This is a pointer to the function to call when a key
- *  changes.
- *
- *  @param user_data This pointer will be passed to the callback
- *  function.
- */
-void gnc_gconf_general_remove_any_cb (GncGconfGeneralAnyCb func,
-                                      gpointer user_data);
-
-/** @} */
-
-
-
-/** @name GConf Get Functions
- @{
-*/
-
-/** Get a boolean value from GConf.
- *
- *  Retrieve a TRUE/FALSE value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- *
- *  @return This function returns the TRUE or FALSE value stored at
- *  the requested key in the gconf database.  If the key has never
- *  been set, this function passes on the default value returned by
- *  GConf as specified in the schema for this key.  If there is an
- *  error in processing, this function passed on the value of FALSE as
- *  returned by GConf.
- */
-gboolean gnc_gconf_get_bool (const gchar *section,
-                             /*@ null @*/ const gchar *name,
-                             /*@ null @*/ GError **error);
-
-/** Get a boolean value from GConf with no error argument.
- *
- *  Retrieve a TRUE/FALSE value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @return This function returns the TRUE or FALSE value stored at
- *  the requested key in the gconf database.  If the key has never
- *  been set, this function passes on the default value returned by
- *  GConf as specified in the schema for this key.  If there is an
- *  error in processing, this function passed on the value of FALSE as
- *  returned by GConf.
- *
- * @note This function was intended for use only by the guile wrapper
- * functions.  It should not be called from C code.
- */
-gboolean gnc_gconf_get_bool_no_error (const gchar *section,
-                                      const gchar *name);
-
-/** Get an integer value from GConf.
- *
- *  Retrieve an integer value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- *
- *  @return This function returns the integer value stored at the
- *  requested key in the gconf database.  If the key has never been
- *  set, this function passes on the default value returned by GConf
- *  as specified in the schema for this key.  If there is an error in
- *  processing, this function passed on the value of zero as returned
- *  by GConf.
- */
-gint gnc_gconf_get_int (const gchar *section,
-                        const gchar *name,
-                        GError **error);
-
-/** Get an float value from GConf.
- *
- *  Retrieve an float value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- *
- *  @return This function returns the float value stored at the
- *  requested key in the gconf database.  If the key has never been
- *  set, this function passes on the default value returned by GConf
- *  as specified in the schema for this key.  If there is an error in
- *  processing, this function passed on the value of zero as returned
- *  by GConf.
- */
-gdouble gnc_gconf_get_float (const gchar *section,
-                             const gchar *name,
-                             GError **error);
-
-/** Get a string value from GConf.
- *
- *  Retrieve an string value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- *
- *  @return This function returns the string value stored at the
- *  requested key in the gconf database.  If the key has never been
- *  set, this function passes on the default value returned by GConf
- *  as specified in the schema for this key.  If there is an error in
- *  processing, this function passed on the NULL value as returned by
- *  GConf.  It is the callers responsibility to free any string
- *  returned by this function.
- */
-char *gnc_gconf_get_string (const gchar *section,
-                            const gchar *name,
-                            GError **error);
-
-/** Get a list of values from GConf.
- *
- *  Retrieve a list of values from GConf.  This list may be of any
- *  kind of value understood by GConf, but all values in the list will
- *  be of the same type.  The section and key names provided as
- *  arguments are combined with the standard gnucash key prefix to
- *  produce a fully qualified key name.  Either name (but not both)
- *  may be a fully qualified key path name, in which case it is used
- *  as is, without the standard gnucash prefix.  This allows the
- *  program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param list_type This enum indicates the type of each item in the
- *  returned list.  This type must match the type off the stored
- *  items.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- *
- *  @return This function returns a list of value stored at the
- *  requested key in the gconf database.  If the key has never been
- *  set, this function passes on the default value returned by GConf
- *  as specified in the schema for this key.  If there is an error in
- *  processing, this function passed on the NULL value as returned by
- *  GConf.  It is the callers responsibility to free any memory
- *  returned by this function.  This include the list itself, and any
- *  list data that are string values.
- */
-GSList *gnc_gconf_get_list (const gchar *section,
-                            const gchar *name,
-                            GConfValueType list_type,
-                            GError **error);
-
-
-/** Get a schema value from GConf.
- *
- *  Retrieve a schema value from GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param caller_error An optional pointer to a GError structure.  If
- *  NULL, this function will check for any errors returned by GConf
- *  and will display an error message via stdout.  If present, this
- *  function will pass any error back to the calling function for it
- *  to handle.
- *
- *  @return This function returns the schema stored at the requested
- *  key in the gconf database.  If there is an error in processing,
- *  this function passed on the NULL value as returned by GConf.  It
- *  is the callers responsibility to free any returned schema by
- *  calling the gconf_schema_free() function.
- */
-GConfSchema *gnc_gconf_get_schema (const gchar *section,
-                                   const gchar *name,
-                                   GError **caller_error);
-
-/** @} */
-
-/** @name GConf Set/Unset Functions
- @{
-*/
-
-
-/** Store a boolean value into GConf.
- *
- *  Store a boolean value into GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param value The TRUE/FALSE value to be stored.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_set_bool (const gchar *section,
-                         const gchar *name,
-                         const gboolean value,
-                         GError **error);
-
-/** Store an integer value into GConf.
- *
- *  Store an integer into GConf.  The section and key names provided
- *  as arguments are combined with the standard gnucash key prefix to
- *  produce a fully qualified key name.  Either name (but not both)
- *  may be a fully qualified key path name, in which case it is used
- *  as is, without the standard gnucash prefix.  This allows the
- *  program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param value The number to be stored.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_set_int (const gchar *section,
-                        const gchar *name,
-                        const gint value,
-                        GError **error);
-
-/** Store an float value into GConf.
- *
- *  Store an float into GConf.  The section and key names provided
- *  as arguments are combined with the standard gnucash key prefix to
- *  produce a fully qualified key name.  Either name (but not both)
- *  may be a fully qualified key path name, in which case it is used
- *  as is, without the standard gnucash prefix.  This allows the
- *  program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param value The number to be stored.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_set_float (const gchar *section,
-                          const gchar *name,
-                          const gdouble value,
-                          GError **error);
-
-/** Store a string into GConf.
- *
- *  Store a single string into GConf.  The section and key names
- *  provided as arguments are combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  Either name (but
- *  not both) may be a fully qualified key path name, in which case it
- *  is used as is, without the standard gnucash prefix.  This allows
- *  the program to access keys like standard desktop settings.  Either
- *  name (but not both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param value The string to be stored.  GConf will make a copy of this
- *  string, so it is the callers responsibility to free the space used
- *  by this string (if necessary).
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_set_string (const gchar *section,
-                           const gchar *name,
-                           const gchar *value,
-                           GError **error);
-
-/** Store a list of values into GConf.
- *
- *  Store a list of values into GConf.  This list may be of any kind
- *  of value understood by GConf, but all values in the list must be
- *  of the same type.  The section and key names provided as arguments
- *  are combined with the standard gnucash key prefix to produce a
- *  fully qualified key name.  Either name (but not both) may be a
- *  fully qualified key path name, in which case it is used as is,
- *  without the standard gnucash prefix.  This allows the program to
- *  access keys like standard desktop settings.  Either name (but not
- *  both) may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param list_type This enum indicates the type of each item in the
- *  list to be stored.
- *
- *  @param value The list of items to be stored.  Each item in the list must
- *  be of the type specified.  E.G. If the list_type is
- *  GCONF_VALUE_STRING, then the data field of each element in the
- *  list must be a string pointer.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_set_list (const gchar *section,
-                         const gchar *name,
-                         GConfValueType list_type,
-                         GSList *value,
-                         GError **error);
-
-/** Delete a value from GConf.
- *
- *  Completely remove a value from GConf.  The next attempt to read this
- *  value will return the default as specified in the GConf schema for
- *  this key.  The section and key names provided as arguments are
- *  combined with the standard gnucash key prefix to produce a fully
- *  qualified key name.  Either name (but not both) may be a fully
- *  qualified key path name, in which case it is used as is, without
- *  the standard gnucash prefix.  This allows the program to access
- *  keys like standard desktop settings.  Either name (but not both)
- *  may be NULL.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param name This string is the name of the particular key within
- *  the named section of gconf.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_unset (const gchar *section,
-                      const gchar *name,
-                      GError **error);
-
-
-/** Delete a directory of values from GConf.
- *
- *  Completely remove a directory of values from GConf.  The next
- *  attempt to read any of these values will return the default as
- *  specified in the GConf schema for the key.  The section names
- *  provided as an arguments is combined with the standard gnucash key
- *  prefix to produce a fully qualified directory name.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @param error An optional pointer to a GError structure.  If NULL,
- *  this function will check for any errors returned by GConf and will
- *  display an error message via stdout.  If present, this function
- *  will pass any error back to the calling function for it to handle.
- */
-void gnc_gconf_unset_dir (const gchar *section,
-                          GError **error);
-
-/** @} */
-
-/** @name GConf Notification Functions
- @{
-*/
-
-/** Add a notification callback to GConf.
- *
- *  Add a function that will be called whenever a value within the
- *  specified section of the GConf tree changes.  The section name
- *  provided as an argument is combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  This name may be a
- *  fully qualified key path name, in which case it is used as is,
- *  without the standard gnucash prefix.  This allows the object to
- *  respond to keys like standard desktop settings.
- *
- *  @param object This is a pointer to a GObject derivative.  This
- *  object will be provided to the callback function when it is
- *  invoked.  Several values will also be attached to this object that
- *  are used by the gnc_gconf_remove_notification() function.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.  Any key changes within this section
- *  will invoke the notification function.
- *
- *  @param callback The function to call when a value changes.  This
- *  function will receive the key/value pair as one argument, and the
- *  'object' argument to this function as another of its arguments.
- *
- *  @param whoami A magic value that must match up this call to the
- *  corresponding call to gnc_gconf_remove_notification().  The pair of
- *  section and whoami should be unique across all callers.
- */
-void gnc_gconf_add_notification (GObject *object,
-                                 const gchar *section,
-                                 GConfClientNotifyFunc callback,
-                                 const gchar *whoami);
-
-
-/** An alternative function for adding a notification callback to
- *  GConf.
- *
- *  Add a function that will be called whenever a value within the
- *  specified section of the GConf tree changes.  The section name
- *  provided as an argument is combined with the standard gnucash key
- *  prefix to produce a fully qualified key name.  This name may be a
- *  fully qualified key path name, in which case it is used as is,
- *  without the standard gnucash prefix.  This allows the object to
- *  respond to keys like standard desktop settings.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.  Any key changes within this section
- *  will invoke the notification function.
- *
- *  @param callback The function to call when a value changes.  This
- *  function will receive the key/value pair as one argument, and the
- *  'object' argument to this function as another of its arguments.
- *
- *  @param data This pointer will be provided to the callback function
- *  when it is invoked.
- *
- *  @return This function returns an identification number that must
- *  be passed to the gnc_gconf_remove_anon_notification() function to
- *  reverse the actions of this function.
- */
-guint gnc_gconf_add_anon_notification (const gchar *section,
-                                       GConfClientNotifyFunc callback,
-                                       gpointer data);
-
-
-/** Remove a callback from GConf.
- *
- *  Remove a GConf callback function previously added with the
- *  gnc_gconf_add_notification function.  The section name must be the
- *  same string provided when the callback function was added.  This
- *  name is used to find/remove the callback.
- *
- *  @param object This is a pointer to a GObject derivative.  This
- *  must be the same object originally passed to the
- *  gnc_gconf_add_notification() function, as that function attached
- *  several values to the object that are needed by this function.
- *
- *  @param section This string is used to find the correct
- *  notification function to remove from GConf.
- *
- *  @param whoami A magic value that must match up this call to the
- *  corresponding call to gnc_gconf_add_notification().  The pair of
- *  section and whoami should be unique across all callers.
- */
-void gnc_gconf_remove_notification (GObject *object,
-                                    const gchar *section,
-                                    const gchar *whoami);
-
-
-
-/** An alternative method for remove a callback from GConf; paired
- *  with gnc_gconf_add_anon_notification().
- *
- *  Remove a GConf callback function previously added with the
- *  gnc_gconf_add_notification function.  The section name must be the
- *  same string provided when the callback function was added.  This
- *  name is used to find/remove the callback.
- *
- *  @param section This string is used to find the correct
- *  notification function to remove from GConf.
- *
- *  @param cnxn_id An identification number returned by the
- *  gnc_gconf_add_anon_notification() function.
- */
-void gnc_gconf_remove_anon_notification (const gchar *section,
-        guint cnxn_id);
-
-
-/** Retrieve a list of all key/value pairs in the specified GConf
- *  section.  The section name provided as an argument is combined
- *  with the standard gnucash key prefix to produce a fully qualified
- *  section name.
- *
- *  @param section This string provides a grouping of keys within the
- *  GnuCash section of the gconf database.  It can be a simple string
- *  as in "history" for settings that are common to many areas of
- *  gnucash, or it can be a partial path name as in
- *  "dialogs/business/invoice" for setting that only apply to one
- *  specific area of the program.
- *
- *  @return This function returns a list of all key/value pairs stored
- *  in this section of the gconf database.  These are GConfEntry
- *  objects.  It is the callers responsibility to free any memory
- *  returned by this function.  This include the list itself, and any
- *  entries contained in the list.  See gconf_client_all_entries in
- *  the gconf documentation.
- */
-GSList *gnc_gconf_client_all_entries (const gchar *section);
-
-
-/** Check gconf to see if the schema for one of the gnucash keys can
- *  be found.  This function is called to determine whether or not to
- *  launch an assistant to help the user properly set up GConf for Gnucash.
- *
- *  @return This function returns TRUE if it was able to find a
- *  schema.
- */
-gboolean gnc_gconf_schemas_found (void);
-
-/** @} */
-
-/** @name GConf One Liners
- @{
-*/
-
-#define DESTKOP_TEAROFF_MENUS "/desktop/gnome/interface/menus_have_tearoff"
-#define DESTKOP_MENUBAR_DETACHABLE "/desktop/gnome/interface/menubar_detachable"
-#define DESTKOP_TOOLBAR_DETACHABLE "/desktop/gnome/interface/toolbar_detachable"
-
-static inline gboolean
-gnc_gconf_menus_have_tearoff (void)
-{
-    return gnc_gconf_get_bool(DESTKOP_TEAROFF_MENUS, NULL, NULL);
-}
-
-static inline gboolean
-gnc_gconf_menubar_detachable (void)
-{
-    return gnc_gconf_get_bool(DESTKOP_MENUBAR_DETACHABLE, NULL, NULL);
-}
-
-static inline gboolean
-gnc_gconf_toolbar_detachable (void)
-{
-    return gnc_gconf_get_bool(DESTKOP_TOOLBAR_DETACHABLE, NULL, NULL);
-}
-
-/** @} */
-
-#endif /* GNC_GCONF_UTILS_H */
-/** @} */
-/** @} */



More information about the gnucash-changes mailing list