From 9edc045500fdd15bb5e95e81967cc63b8522202f Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 20 Mar 2008 17:11:59 +0200 Subject: [PATCH] Add mapper_gconf_get_boolean helper function. Fix model building and remove unused variables. --- src/config-gconf.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/config-gconf.c b/src/config-gconf.c index ad93b69..afcd1ec 100644 --- a/src/config-gconf.c +++ b/src/config-gconf.c @@ -58,9 +58,10 @@ #define PROXY_PORT (8080) -gint mapper_gconf_get_bound_int(const gchar *path, gint def, gint min, gint max); gint mapper_gconf_get_int(const gchar *path, gint def); +gint mapper_gconf_get_bound_int(const gchar *path, gint def, gint min, gint max); gfloat mapper_gconf_get_float(const gchar *path, gfloat def); +gboolean mapper_gconf_get_boolean(const gchar *path, gboolean def); void config_update_proxy(void) @@ -221,7 +222,6 @@ gboolean config_load_repo(void) { GSList *list, *curr; -GConfValue *value; guint curr_repo_index; g_assert(gconf_client); @@ -440,7 +440,7 @@ GSList *curr; *list=gconf_client_get_list(gconf_client, gconf_key, GCONF_VALUE_STRING, NULL); *model=gtk_list_store_new(1, G_TYPE_STRING); -for (curr = list; curr != NULL; curr = curr->next) { +for (curr = *list; curr != NULL; curr = curr->next) { GtkTreeIter iter; gtk_list_store_insert_with_values(*model, &iter, INT_MAX, 0, curr->data, -1); } @@ -781,6 +781,26 @@ if (value) { return v; } +/** + * + */ +gboolean +mapper_gconf_get_boolean(const gchar *path, gboolean def) +{ +GConfValue *value; +gboolean r; + +g_assert(gconf_client); +value = gconf_client_get(gconf_client, path, NULL); +if (value) { + r=gconf_value_get_bool(value); + gconf_value_free(value); +} else { + r=def; +} +return r; +} + /** * */ -- 2.39.5