[evolution/wip/gsettings] Set day-second-zones in GSettings, not GConf



commit 2f76eec65ede46b0b90972db6499b0dd65e5e2ee
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Sep 21 16:23:40 2011 +0200

    Set day-second-zones in GSettings, not GConf

 calendar/gui/calendar-config.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 1ae04af..9623dcf 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -339,6 +339,8 @@ calendar_config_set_day_second_zone (const gchar *location)
 	if (location && *location) {
 		GSList *lst, *l;
 		gint max_zones;
+		GPtrArray *array;
+		gint i;
 
 		/* configurable max number of timezones to remember */
 		max_zones = g_settings_get_int (config, "day-second-zones-max");
@@ -365,15 +367,14 @@ calendar_config_set_day_second_zone (const gchar *location)
 			lst = g_slist_prepend (lst, g_strdup (location));
 		}
 
-		while (g_slist_length (lst) > max_zones) {
-			l = g_slist_last (lst);
-			g_free (l->data);
-			lst = g_slist_delete_link (lst, l);
-		}
+		array = g_ptr_array_new ();
+		for (i = 0, l = lst; i < max_zones && l != NULL; i++, l = l->next)
+			g_ptr_array_add (array, l->data);
 
-		gconf_client_set_list (config, CALENDAR_CONFIG_DAY_SECOND_ZONES_LIST, GCONF_VALUE_STRING, lst, NULL);
+		g_settings_set_strv (config, "day-second-zones", array->pdata);
 
 		calendar_config_free_day_second_zones (lst);
+		g_ptr_array_free (array, FALSE);
 	}
 
 	g_settings_set_string (config, "day-second-zone", location ? location : "");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]