aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datetime-prefs-locations.c15
-rw-r--r--src/datetime-service.c10
-rw-r--r--src/utils.c2
3 files changed, 19 insertions, 8 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 5550450..d13f95a 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -229,6 +229,7 @@ fill_from_settings (GObject * store, GSettings * conf)
static void
save_to_settings (GObject * store, GSettings * conf)
{
+ gboolean empty = TRUE;
GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
@@ -246,13 +247,21 @@ save_to_settings (GObject * store, GSettings * conf)
gchar * settings_string = g_strdup_printf("%s %s", strzone, strname);
g_variant_builder_add (&builder, "s", settings_string);
g_free (settings_string);
+ empty = FALSE;
}
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
}
- GVariant * locations = g_variant_builder_end (&builder);
- g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, g_variant_get_strv (locations, NULL));
- g_variant_unref (locations);
+ if (empty) {
+ /* Empty list */
+ g_variant_builder_clear (&builder);
+ g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, NULL);
+ }
+ else {
+ GVariant * locations = g_variant_builder_end (&builder);
+ g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, g_variant_get_strv (locations, NULL));
+ g_variant_unref (locations);
+ }
}
static gboolean
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 7e01f88..905128b 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -438,11 +438,11 @@ update_timezone_menu_items(gpointer user_data) {
gboolean show = g_settings_get_boolean (conf, SETTINGS_SHOW_LOCATIONS_S);
- if (len > 0) {
- dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
- dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
- dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- } else {
+ dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
+ dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
+ dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+
+ if (len == 0) {
g_debug("No locations configured (Empty List)");
return FALSE;
}
diff --git a/src/utils.c b/src/utils.c
index 537495b..d8851aa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -233,6 +233,8 @@ generate_format_string_at_time (GDateTime * time)
g_date_time_unref(future_bound);
}
+ g_date_time_unref (now);
+
return generate_format_string_full(show_day, show_date);
}