diff options
author | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
commit | 2e5b2bbb530b642dda56b332cfd93810ac415098 (patch) | |
tree | e2b63c11a404a5dd99d407c989c8846fd0d5379d /e-util/e-config-listener.c | |
parent | 5cda225087bfdc66e19edb703689e8af655e171c (diff) | |
download | gsoc2013-evolution-EVOLUTION_1_2_4.tar gsoc2013-evolution-EVOLUTION_1_2_4.tar.gz gsoc2013-evolution-EVOLUTION_1_2_4.tar.bz2 gsoc2013-evolution-EVOLUTION_1_2_4.tar.lz gsoc2013-evolution-EVOLUTION_1_2_4.tar.xz gsoc2013-evolution-EVOLUTION_1_2_4.tar.zst gsoc2013-evolution-EVOLUTION_1_2_4.zip |
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_2_4
'EVOLUTION_1_2_4'.
svn path=/tags/EVOLUTION_1_2_4/; revision=20614
Diffstat (limited to 'e-util/e-config-listener.c')
-rw-r--r-- | e-util/e-config-listener.c | 408 |
1 files changed, 187 insertions, 221 deletions
diff --git a/e-util/e-config-listener.c b/e-util/e-config-listener.c index 19c40b1dba..cfd2b52eba 100644 --- a/e-util/e-config-listener.c +++ b/e-util/e-config-listener.c @@ -8,17 +8,25 @@ * Copyright 2002, Ximian, Inc. */ -#include <string.h> -#include <gconf/gconf-client.h> +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gtk/gtksignal.h> +#include <gtk/gtktypeutils.h> +#include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-event-source.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-object.h> #include "e-config-listener.h" -#define PARENT_TYPE G_TYPE_OBJECT +#define PARENT_TYPE GTK_TYPE_OBJECT typedef struct { EConfigListener *cl; - guint lid; + Bonobo_EventSource_ListenerId lid; char *key; - GConfValueType type; + GtkFundamentalType type; union { gboolean v_bool; float v_float; @@ -29,15 +37,15 @@ typedef struct { } KeyData; struct _EConfigListenerPrivate { - GConfClient *db; + Bonobo_ConfigDatabase db; GHashTable *keys; }; static void e_config_listener_class_init (EConfigListenerClass *klass); -static void e_config_listener_init (EConfigListener *cl, EConfigListenerClass *klass); -static void e_config_listener_finalize (GObject *object); +static void e_config_listener_init (EConfigListener *cl); +static void e_config_listener_destroy (GtkObject *object); -static GObjectClass *parent_class = NULL; +static GtkObjectClass *parent_class = NULL; enum { KEY_CHANGED, @@ -49,35 +57,41 @@ static guint config_listener_signals[LAST_SIGNAL]; static void e_config_listener_class_init (EConfigListenerClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); + parent_class = gtk_type_class (PARENT_TYPE); - object_class->finalize = e_config_listener_finalize; + object_class->destroy = e_config_listener_destroy; klass->key_changed = NULL; config_listener_signals[KEY_CHANGED] = - g_signal_new ("key_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EConfigListenerClass, key_changed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - - /* make sure GConf is initialized */ - if (!gconf_is_initialized ()) - gconf_init (0, NULL, NULL); + gtk_signal_new ("key_changed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EConfigListenerClass, key_changed), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, config_listener_signals, LAST_SIGNAL); } static void -e_config_listener_init (EConfigListener *cl, EConfigListenerClass *klass) +e_config_listener_init (EConfigListener *cl) { + CORBA_Environment ev; + /* allocate internal structure */ cl->priv = g_new0 (EConfigListenerPrivate, 1); cl->priv->keys = g_hash_table_new (g_str_hash, g_str_equal); - cl->priv->db = gconf_client_get_default (); + + /* activate the configuration database */ + CORBA_exception_init (&ev); + cl->priv->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + + if (BONOBO_EX (&ev) || cl->priv->db == CORBA_OBJECT_NIL) { + CORBA_exception_free (&ev); + cl->priv->db = CORBA_OBJECT_NIL; + } } static void @@ -87,11 +101,11 @@ free_key_hash (gpointer key, gpointer value, gpointer user_data) g_return_if_fail (kd != NULL); - gconf_client_notify_remove (kd->cl->priv->db, kd->lid); + bonobo_event_source_client_remove_listener (kd->cl->priv->db, kd->lid, NULL); g_free (kd->key); switch (kd->type) { - case GCONF_VALUE_STRING : + case GTK_TYPE_STRING : g_free (kd->value.v_str); break; default : @@ -102,7 +116,7 @@ free_key_hash (gpointer key, gpointer value, gpointer user_data) } static void -e_config_listener_finalize (GObject *object) +e_config_listener_destroy (GtkObject *object) { EConfigListener *cl = (EConfigListener *) object; @@ -112,36 +126,36 @@ e_config_listener_finalize (GObject *object) g_hash_table_destroy (cl->priv->keys); cl->priv->keys = NULL; - if (cl->priv->db != NULL) { - g_object_unref (G_OBJECT (cl->priv->db)); - cl->priv->db = NULL; + if (cl->priv->db != CORBA_OBJECT_NIL) { + bonobo_object_release_unref (cl->priv->db, NULL); + cl->priv->db = CORBA_OBJECT_NIL; } g_free (cl->priv); cl->priv = NULL; - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } -GType +GtkType e_config_listener_get_type (void) { - static GType type = 0; + static GtkType type = 0; if (!type) { - static const GTypeInfo info = { - sizeof (EConfigListenerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_config_listener_class_init, - NULL, - NULL, - sizeof (EConfigListener), - 0, - (GInstanceInitFunc) e_config_listener_init - }; - type = g_type_register_static (PARENT_TYPE, "EConfigListener", &info, 0); + static const GtkTypeInfo info = { + "EConfigListener", + sizeof (EConfigListener), + sizeof (EConfigListenerClass), + (GtkClassInitFunc) e_config_listener_class_init, + (GtkObjectInitFunc) e_config_listener_init, + NULL, /* reserved_1 */ + NULL, /* reserved_2 */ + (GtkClassInitFunc) NULL + }; + + type = gtk_type_unique (PARENT_TYPE, &info); } return type; @@ -162,49 +176,53 @@ e_config_listener_new (void) { EConfigListener *cl; - cl = g_object_new (E_CONFIG_LISTENER_TYPE, NULL); + cl = gtk_type_new (E_CONFIG_LISTENER_TYPE); return cl; } static void -property_change_cb (GConfEngine *engine, - guint cnxn_id, - GConfEntry *entry, +property_change_cb (BonoboListener *listener, + char *event_name, + CORBA_any *any, + CORBA_Environment *ev, gpointer user_data) { KeyData *kd = (KeyData *) user_data; - g_return_if_fail (entry != NULL); + g_return_if_fail (any != NULL); g_return_if_fail (kd != NULL); /* free previous value */ - if (kd->type == GCONF_VALUE_STRING) + if (kd->type == GTK_TYPE_STRING) g_free (kd->value.v_str); /* set new value */ - if (entry->value->type == GCONF_VALUE_BOOL) { - kd->type = GCONF_VALUE_BOOL; - kd->value.v_bool = gconf_value_get_bool (entry->value); - } else if (entry->value->type == GCONF_VALUE_FLOAT) { - kd->type = GCONF_VALUE_FLOAT; - kd->value.v_float = gconf_value_get_float (entry->value); - } else if (entry->value->type == GCONF_VALUE_INT) { - kd->type = GCONF_VALUE_INT; - kd->value.v_long = gconf_value_get_int (entry->value); - } else if (entry->value->type == GCONF_VALUE_STRING) { - kd->type = GCONF_VALUE_STRING; - kd->value.v_str = g_strdup (gconf_value_get_string (entry->value)); + if (bonobo_arg_type_is_equal (any->_type, BONOBO_ARG_BOOLEAN, NULL)) { + kd->type = GTK_TYPE_BOOL; + kd->value.v_bool = BONOBO_ARG_GET_BOOLEAN (any); + } else if (bonobo_arg_type_is_equal (any->_type, BONOBO_ARG_FLOAT, NULL)) { + kd->type = GTK_TYPE_FLOAT; + kd->value.v_float = BONOBO_ARG_GET_FLOAT (any); + } else if (bonobo_arg_type_is_equal (any->_type, BONOBO_ARG_LONG, NULL)) { + kd->type = GTK_TYPE_LONG; + kd->value.v_long = BONOBO_ARG_GET_LONG (any); + } else if (bonobo_arg_type_is_equal (any->_type, BONOBO_ARG_STRING, NULL)) { + kd->type = GTK_TYPE_STRING; + kd->value.v_str = g_strdup (BONOBO_ARG_GET_STRING (any)); } else return; - g_signal_emit (G_OBJECT (kd->cl), config_listener_signals[KEY_CHANGED], 0, kd->key); + gtk_signal_emit (GTK_OBJECT (kd->cl), config_listener_signals[KEY_CHANGED], kd->key); } static KeyData * -add_key (EConfigListener *cl, const char *key, GConfValueType type, +add_key (EConfigListener *cl, const char *key, GtkFundamentalType type, gpointer value, gboolean used_default) { KeyData *kd; + char *event_name; + char *ch; + CORBA_Environment ev; /* add the key to our hash table */ kd = g_new0 (KeyData, 1); @@ -212,17 +230,17 @@ add_key (EConfigListener *cl, const char *key, GConfValueType type, kd->key = g_strdup (key); kd->type = type; switch (type) { - case GCONF_VALUE_BOOL : + case GTK_TYPE_BOOL : memcpy (&kd->value.v_bool, value, sizeof (gboolean)); break; - case GCONF_VALUE_FLOAT : + case GTK_TYPE_FLOAT : memcpy (&kd->value.v_float, value, sizeof (float)); break; - case GCONF_VALUE_INT : + case GTK_TYPE_LONG : memcpy (&kd->value.v_long, value, sizeof (long)); break; - case GCONF_VALUE_STRING : - kd->value.v_str = g_strdup ((const char *) value); + case GTK_TYPE_STRING : + kd->value.v_str = (char *) value; break; default : break; @@ -231,20 +249,31 @@ add_key (EConfigListener *cl, const char *key, GConfValueType type, kd->used_default = used_default; /* add the listener for changes */ - gconf_client_add_dir (cl->priv->db, key, GCONF_CLIENT_PRELOAD_NONE, NULL); - kd->lid = gconf_client_notify_add (cl->priv->db, key, - (GConfClientNotifyFunc) property_change_cb, - kd, NULL, NULL); + event_name = g_strdup_printf ("=Bonobo/ConfigDatabase:change%s", + kd->key); + ch = strrchr (event_name, '/'); + if (ch) + *ch = ':'; + + CORBA_exception_init (&ev); + kd->lid = bonobo_event_source_client_add_listener ( + cl->priv->db, + property_change_cb, + event_name, + &ev, kd); + if (BONOBO_EX (&ev)) { + CORBA_exception_free (&ev); + g_free (event_name); + free_key_hash (kd->key, kd, NULL); + return NULL; + } g_hash_table_insert (cl->priv->keys, kd->key, kd); - return kd; -} + CORBA_exception_free (&ev); + g_free (event_name); -gboolean -e_config_listener_get_boolean (EConfigListener *cl, const char *key) -{ - return e_config_listener_get_boolean_with_default (cl, key, FALSE, NULL); + return kd; } gboolean @@ -253,9 +282,9 @@ e_config_listener_get_boolean_with_default (EConfigListener *cl, gboolean def, gboolean *used_default) { - GConfValue *conf_value; gboolean value; KeyData *kd; + gboolean d; gpointer orig_key, orig_value; g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), FALSE); @@ -264,26 +293,16 @@ e_config_listener_get_boolean_with_default (EConfigListener *cl, /* search for the key in our hash table */ if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) { /* not found, so retrieve it from the configuration database */ - conf_value = gconf_client_get (cl->priv->db, key, NULL); - if (conf_value) { - value = gconf_value_get_bool (conf_value); - kd = add_key (cl, key, GCONF_VALUE_BOOL, &value, FALSE); - gconf_value_free (conf_value); - - if (used_default != NULL) - *used_default = FALSE; - } else { - value = def; - kd = add_key (cl, key, GCONF_VALUE_BOOL, &def, TRUE); + value = bonobo_config_get_boolean_with_default (cl->priv->db, key, def, &d); + kd = add_key (cl, key, GTK_TYPE_BOOL, &value, d); - if (used_default != NULL) - *used_default = TRUE; - } + if (used_default != NULL) + *used_default = d; } else { kd = (KeyData *) orig_value; g_assert (kd != NULL); - if (kd->type == GCONF_VALUE_BOOL) { + if (kd->type == GTK_TYPE_BOOL) { value = kd->value.v_bool; if (used_default != NULL) *used_default = kd->used_default; @@ -295,20 +314,14 @@ e_config_listener_get_boolean_with_default (EConfigListener *cl, } float -e_config_listener_get_float (EConfigListener *cl, const char *key) -{ - return e_config_listener_get_float_with_default (cl, key, 0.0, NULL); -} - -float e_config_listener_get_float_with_default (EConfigListener *cl, const char *key, float def, gboolean *used_default) { - GConfValue *conf_value; float value; KeyData *kd; + gboolean d; gpointer orig_key, orig_value; g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), -1); @@ -317,26 +330,16 @@ e_config_listener_get_float_with_default (EConfigListener *cl, /* search for the key in our hash table */ if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) { /* not found, so retrieve it from the configuration database */ - conf_value = gconf_client_get (cl->priv->db, key, NULL); - if (conf_value) { - value = gconf_value_get_float (conf_value); - kd = add_key (cl, key, GCONF_VALUE_FLOAT, &value, FALSE); - gconf_value_free (conf_value); - - if (used_default != NULL) - *used_default = FALSE; - } else { - value = def; - kd = add_key (cl, key, GCONF_VALUE_FLOAT, &def, TRUE); + value = bonobo_config_get_float_with_default (cl->priv->db, key, def, &d); + kd = add_key (cl, key, GTK_TYPE_FLOAT, &value, d); - if (used_default != NULL) - *used_default = TRUE; - } + if (used_default != NULL) + *used_default = d; } else { kd = (KeyData *) orig_value; g_assert (kd != NULL); - if (kd->type == GCONF_VALUE_FLOAT) { + if (kd->type == GTK_TYPE_FLOAT) { value = kd->value.v_float; if (used_default != NULL) *used_default = kd->used_default; @@ -348,20 +351,14 @@ e_config_listener_get_float_with_default (EConfigListener *cl, } long -e_config_listener_get_long (EConfigListener *cl, const char *key) -{ - return e_config_listener_get_long_with_default (cl, key, 0, NULL); -} - -long e_config_listener_get_long_with_default (EConfigListener *cl, const char *key, long def, gboolean *used_default) { - GConfValue *conf_value; long value; KeyData *kd; + gboolean d; gpointer orig_key, orig_value; g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), -1); @@ -370,26 +367,16 @@ e_config_listener_get_long_with_default (EConfigListener *cl, /* search for the key in our hash table */ if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) { /* not found, so retrieve it from the configuration database */ - conf_value = gconf_client_get (cl->priv->db, key, NULL); - if (conf_value) { - value = gconf_value_get_int (conf_value); - kd = add_key (cl, key, GCONF_VALUE_INT, &value, FALSE); - gconf_value_free (conf_value); - - if (used_default != NULL) - *used_default = FALSE; - } else { - value = def; - kd = add_key (cl, key, GCONF_VALUE_INT, &def, TRUE); + value = bonobo_config_get_long_with_default (cl->priv->db, key, def, &d); + kd = add_key (cl, key, GTK_TYPE_LONG, &value, d); - if (used_default != NULL) - *used_default = TRUE; - } + if (used_default != NULL) + *used_default = d; } else { kd = (KeyData *) orig_value; g_assert (kd != NULL); - if (kd->type == GCONF_VALUE_INT) { + if (kd->type == GTK_TYPE_LONG) { value = kd->value.v_long; if (used_default != NULL) *used_default = kd->used_default; @@ -401,20 +388,14 @@ e_config_listener_get_long_with_default (EConfigListener *cl, } char * -e_config_listener_get_string (EConfigListener *cl, const char *key) -{ - return e_config_listener_get_string_with_default (cl, key, NULL, NULL); -} - -char * e_config_listener_get_string_with_default (EConfigListener *cl, const char *key, const char *def, gboolean *used_default) { - GConfValue *conf_value; char *str; KeyData *kd; + gboolean d; gpointer orig_key, orig_value; g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), NULL); @@ -423,41 +404,34 @@ e_config_listener_get_string_with_default (EConfigListener *cl, /* search for the key in our hash table */ if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) { /* not found, so retrieve it from the configuration database */ - conf_value = gconf_client_get (cl->priv->db, key, NULL); - if (conf_value) { - str = g_strdup (gconf_value_get_string (conf_value)); - kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, FALSE); - gconf_value_free (conf_value); - - if (used_default != NULL) - *used_default = FALSE; - } else { - str = g_strdup (def); - kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, TRUE); + str = bonobo_config_get_string_with_default (cl->priv->db, key, (char *) def, &d); + if (str) { + kd = add_key (cl, key, GTK_TYPE_STRING, (gpointer) str, d); if (used_default != NULL) - *used_default = TRUE; - } + *used_default = d; + } else + return NULL; } else { kd = (KeyData *) orig_value; g_assert (kd != NULL); - if (kd->type == GCONF_VALUE_STRING) { - str = g_strdup (kd->value.v_str); + if (kd->type == GTK_TYPE_STRING) { + str = kd->value.v_str; if (used_default != NULL) *used_default = kd->used_default; } else return NULL; } - return str; + return g_strdup (str); } void e_config_listener_set_boolean (EConfigListener *cl, const char *key, gboolean value) { + CORBA_Environment ev; KeyData *kd; - GError *err = NULL; g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); g_return_if_fail (key != NULL); @@ -466,23 +440,26 @@ e_config_listener_set_boolean (EConfigListener *cl, const char *key, gboolean va if (value == e_config_listener_get_boolean_with_default (cl, key, 0, NULL)) return; - gconf_client_set_bool (cl->priv->db, key, value, &err); - if (err) { - g_warning ("e_config_listener_set_bool: %s", err->message); - g_error_free (err); - } else { + CORBA_exception_init (&ev); + + bonobo_config_set_boolean (cl->priv->db, key, value, &ev); + if (BONOBO_EX (&ev)) + g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev)); + else { /* update the internal copy */ kd = g_hash_table_lookup (cl->priv->keys, key); if (kd) kd->value.v_bool = value; } + + CORBA_exception_free (&ev); } void e_config_listener_set_float (EConfigListener *cl, const char *key, float value) { + CORBA_Environment ev; KeyData *kd; - GError *err = NULL; g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); g_return_if_fail (key != NULL); @@ -491,23 +468,26 @@ e_config_listener_set_float (EConfigListener *cl, const char *key, float value) if (value == e_config_listener_get_float_with_default (cl, key, 0, NULL)) return; - gconf_client_set_float (cl->priv->db, key, value, &err); - if (err) { - g_warning ("e_config_listener_set_float: %s", err->message); - g_error_free (err); - } else { + CORBA_exception_init (&ev); + + bonobo_config_set_float (cl->priv->db, key, value, &ev); + if (BONOBO_EX (&ev)) + g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev)); + else { /* update the internal copy */ kd = g_hash_table_lookup (cl->priv->keys, key); if (kd) kd->value.v_float = value; } + + CORBA_exception_free (&ev); } void e_config_listener_set_long (EConfigListener *cl, const char *key, long value) { + CORBA_Environment ev; KeyData *kd; - GError *err = NULL; g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); g_return_if_fail (key != NULL); @@ -516,24 +496,27 @@ e_config_listener_set_long (EConfigListener *cl, const char *key, long value) if (value == e_config_listener_get_long_with_default (cl, key, 0, NULL)) return; - gconf_client_set_int (cl->priv->db, key, value, &err); - if (err) { - g_warning ("e_config_listener_set_long: %s", err->message); - g_error_free (err); - } else { + CORBA_exception_init (&ev); + + bonobo_config_set_long (cl->priv->db, key, value, &ev); + if (BONOBO_EX (&ev)) + g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev)); + else { /* update the internal copy */ kd = g_hash_table_lookup (cl->priv->keys, key); if (kd) kd->value.v_long = value; } + + CORBA_exception_free (&ev); } void e_config_listener_set_string (EConfigListener *cl, const char *key, const char *value) { + CORBA_Environment ev; char *s1, *s2; KeyData *kd; - GError *err = NULL; g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); g_return_if_fail (key != NULL); @@ -548,11 +531,12 @@ e_config_listener_set_string (EConfigListener *cl, const char *key, const char * g_free (s2); - gconf_client_set_string (cl->priv->db, key, value, &err); - if (err) { - g_warning ("e_config_listener_set_bool: %s", err->message); - g_error_free (err); - } else { + CORBA_exception_init (&ev); + + bonobo_config_set_string (cl->priv->db, key, value, &ev); + if (BONOBO_EX (&ev)) + g_warning ("Cannot save config key %s -- %s", key, BONOBO_EX_ID (&ev)); + else { /* update the internal copy */ kd = g_hash_table_lookup (cl->priv->keys, key); if (kd) { @@ -560,48 +544,30 @@ e_config_listener_set_string (EConfigListener *cl, const char *key, const char * kd->value.v_str = g_strdup (value); } } + + CORBA_exception_free (&ev); } void -e_config_listener_remove_value (EConfigListener *cl, const char *key) +e_config_listener_remove_dir (EConfigListener *cl, const char *dir) { - gpointer orig_key, orig_value; + CORBA_Environment ev; g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); - g_return_if_fail (key != NULL); - - if (g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) { - KeyData *kd = orig_value; - - g_hash_table_remove (cl->priv->keys, key); - g_free (kd->key); - if (kd->type == GCONF_VALUE_STRING) - g_free (kd->value.v_str); - gconf_client_notify_remove (cl->priv->db, kd->lid); + g_return_if_fail (dir != NULL); - g_free (kd); + CORBA_exception_init (&ev); + Bonobo_ConfigDatabase_removeDir (cl->priv->db, dir, &ev); + if (BONOBO_EX (&ev)) { + g_warning ("Cannot remove config dir %s -- %s", dir, BONOBO_EX_ID (&ev)); } - gconf_client_unset (cl->priv->db, key, NULL); + CORBA_exception_free (&ev); } -void -e_config_listener_remove_dir (EConfigListener *cl, const char *dir) +Bonobo_ConfigDatabase +e_config_listener_get_db (EConfigListener *cl) { - GSList *slist, *iter; - const gchar *key; - - g_return_if_fail (E_IS_CONFIG_LISTENER (cl)); - g_return_if_fail (dir != NULL); - - slist = gconf_client_all_entries (cl->priv->db, dir, NULL); - for (iter = slist; iter != NULL; iter = iter->next) { - GConfEntry *entry = iter->data; - - key = gconf_entry_get_key (entry); - gconf_client_unset (cl->priv->db, key, NULL); - gconf_entry_free (entry); - } - - g_slist_free (slist); + g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), CORBA_OBJECT_NIL); + return cl->priv->db; } |