[empathy] Delay setting both contact list values until the each is set.



commit 783c15aecdb7aba0ef69c4a82dae0f391007185e
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Mon Jun 21 19:08:30 2010 +1000

    Delay setting both contact list values until the each is set.
    
    Solves a loop in the notification code that caused things to get stuck.

 src/empathy-main-window.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index d57a7b2..9b818bc 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -792,22 +792,32 @@ main_window_view_contacts_list_size_cb (GtkRadioAction    *action,
 					GtkRadioAction    *current,
 					EmpathyMainWindow *window)
 {
-	gint     value;
+	GSettings *gsettings_ui;
+	gint value;
 
 	value = gtk_radio_action_get_current_value (action);
+	/* create a new GSettings, so we can delay the setting until both
+	 * values are set */
+	gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
 
-	g_settings_set_boolean (window->gsettings_ui,
+	DEBUG ("radio button toggled, value = %i", value);
+
+	g_settings_delay (gsettings_ui);
+	g_settings_set_boolean (gsettings_ui,
 				EMPATHY_PREFS_UI_SHOW_AVATARS,
 				value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
 
-	g_settings_set_boolean (window->gsettings_ui,
+	g_settings_set_boolean (gsettings_ui,
 				EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
 				value == CONTACT_LIST_COMPACT_SIZE);
+	g_settings_apply (gsettings_ui);
 
 	empathy_contact_list_store_set_show_avatars (window->list_store,
 						     value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
 	empathy_contact_list_store_set_is_compact (window->list_store,
 						   value == CONTACT_LIST_COMPACT_SIZE);
+
+	g_object_unref (gsettings_ui);
 }
 
 static void main_window_notify_show_protocols_cb (GSettings         *gsettings,
@@ -825,7 +835,7 @@ main_window_notify_contact_list_size_cb (GSettings         *gsettings,
 					 const gchar       *key,
 					 EmpathyMainWindow *window)
 {
-	gint value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
+	gint value;
 
 	if (g_settings_get_boolean (gsettings,
 			EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST)) {
@@ -837,6 +847,8 @@ main_window_notify_contact_list_size_cb (GSettings         *gsettings,
 		value = CONTACT_LIST_NORMAL_SIZE;
 	}
 
+	DEBUG ("setting changed, value = %i", value);
+
 	/* By changing the value of the GtkRadioAction,
 	   it emits a signal that calls main_window_view_contacts_list_size_cb
 	   which updates the contacts list */



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