← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~mterry/indicator-datetime/crash-fix-and-more into lp:indicator-datetime

 

Michael Terry has proposed merging lp:~mterry/indicator-datetime/crash-fix-and-more into lp:indicator-datetime with lp:~mterry/indicator-datetime/live-location-updates as a prerequisite.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  Bug #735445 in indicator-datetime (Ubuntu): "clock doesn't update on timezone change"
  https://bugs.launchpad.net/ubuntu/+source/indicator-datetime/+bug/735445
  Bug #740971 in indicator-datetime (Ubuntu): "No separator between "Add Event" and locations"
  https://bugs.launchpad.net/ubuntu/+source/indicator-datetime/+bug/740971
  Bug #740978 in Indicator Date and Time: "indicator-datetime-preferences crashed with SIGSEGV in g_atomic_int_exchange_and_add()"
  https://bugs.launchpad.net/indicator-datetime/+bug/740978

For more details, see:
https://code.launchpad.net/~mterry/indicator-datetime/crash-fix-and-more/+merge/54775

See bugs for reasons, in particular, bug 735445 is a beaut.
-- 
https://code.launchpad.net/~mterry/indicator-datetime/crash-fix-and-more/+merge/54775
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/datetime-prefs-locations.c'
--- src/datetime-prefs-locations.c	2011-03-24 20:26:49 +0000
+++ src/datetime-prefs-locations.c	2011-03-24 20:26:49 +0000
@@ -229,6 +229,7 @@
 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 @@
         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

=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2011-03-23 12:03:21 +0000
+++ src/datetime-service.c	2011-03-24 20:26:49 +0000
@@ -437,11 +437,11 @@
 	
 	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;
 	}

=== modified file 'src/utils.c'
--- src/utils.c	2011-03-23 15:00:52 +0000
+++ src/utils.c	2011-03-24 20:26:49 +0000
@@ -233,6 +233,8 @@
 		g_date_time_unref(future_bound);
 	}
 
+	g_date_time_unref (now);
+
 	return generate_format_string_full(show_day, show_date);
 }
 


Follow ups