static void gnc_reset_warnings_release_entries (GSList *entries) { GSList *tmp; ENTER(" "); for (tmp = entries; tmp; tmp = g_slist_next(tmp)) { gconf_entry_free(tmp->data); } g_slist_free(entries); LEAVE(" "); }
static GHashTable * load_options (void) { GHashTable *ht = NULL; GConfClient *client = gconf_client_get_default (); GSList *entries, *e; GError *error = NULL; gconf_client_add_dir (client, GEOCLUE_GCONF_TOP, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); entries = gconf_client_all_entries (client, GEOCLUE_GCONF_TOP, &error); if (error != NULL) { g_warning ("Error loading master options: %s", error->message); g_error_free (error); return NULL; } /* Setup keys monitoring */ gconf_client_notify_add (client, GEOCLUE_GCONF_TOP, (GConfClientNotifyFunc) gconf_key_changed, NULL, NULL, NULL); ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); g_print ("Master options:\n"); for (e = entries; e; e = e->next) { GConfEntry *entry = e->data; const char *key, *value; GConfValue *v; key = gconf_entry_get_key (entry); v = gconf_entry_get_value (entry); if (v->type != GCONF_VALUE_STRING) continue; value = gconf_value_get_string (v); if (value != NULL && value[0] == '\0') value = NULL; g_print (" %s = %s\n", key, value); g_hash_table_insert (ht, g_path_get_basename (key), g_strdup (value)); gconf_entry_free (entry); } g_slist_free (entries); return ht; }
static void database_handle_get_all_entries (DBusConnection *conn, DBusMessage *message, GConfDatabase *db) { GSList *entries, *l; gchar *dir; gchar *locale; GError *gerror = NULL; GConfLocaleList* locales; DBusMessage *reply; DBusMessageIter iter; if (!gconfd_dbus_get_message_args (conn, message, DBUS_TYPE_STRING, &dir, DBUS_TYPE_STRING, &locale, DBUS_TYPE_INVALID)) return; locales = gconfd_locale_cache_lookup (locale); entries = gconf_database_all_entries (db, dir, locales->list, &gerror); if (gconfd_dbus_set_exception (conn, message, &gerror)) return; reply = dbus_message_new_method_return (message); dbus_message_iter_init_append (reply, &iter); gconf_dbus_utils_append_entries (&iter, entries); for (l = entries; l; l = l->next) { GConfEntry *entry = l->data; gconf_entry_free (entry); } dbus_connection_send (conn, reply, NULL); dbus_message_unref (reply); g_slist_free (entries); }