empathy r1701 - trunk/libempathy-gtk



Author: xclaesse
Date: Tue Nov 11 15:27:42 2008
New Revision: 1701
URL: http://svn.gnome.org/viewvc/empathy?rev=1701&view=rev

Log:
Update avatar chooser's account from its own callback.

This fixes a bug where the account chooser's account would change, but
the avatar picker would not be updated because the main
account_chooser::changed signal handler is suppressed!

Modified:
   trunk/libempathy-gtk/empathy-contact-widget.c

Modified: trunk/libempathy-gtk/empathy-contact-widget.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-widget.c	(original)
+++ trunk/libempathy-gtk/empathy-contact-widget.c	Tue Nov 11 15:27:42 2008
@@ -105,8 +105,6 @@
 static void contact_widget_change_contact (EmpathyContactWidget *information);
 static void contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
     EmpathyContactWidget *information);
-static void contact_widget_update_avatar_chooser_account (
-    EmpathyContactWidget *information);
 static void contact_widget_account_changed_cb (GtkComboBox *widget,
     EmpathyContactWidget *information);
 static gboolean contact_widget_id_focus_out_cb (GtkWidget *widget,
@@ -495,6 +493,16 @@
 }
 
 static void
+update_avatar_chooser_account_cb (EmpathyAccountChooser *account_chooser,
+                                  EmpathyAvatarChooser *avatar_chooser)
+{
+  McAccount *account;
+
+  account = empathy_account_chooser_get_account (account_chooser);
+  g_object_set (avatar_chooser, "account", account, NULL);
+}
+
+static void
 contact_widget_contact_setup (EmpathyContactWidget *information)
 {
   /* Setup account label/chooser */
@@ -505,7 +513,6 @@
       g_signal_connect (information->widget_account, "changed",
             G_CALLBACK (contact_widget_account_changed_cb),
             information);
-      contact_widget_update_avatar_chooser_account (information);
     }
   else
     {
@@ -527,6 +534,15 @@
       g_signal_connect (information->widget_avatar, "changed",
             G_CALLBACK (contact_widget_avatar_changed_cb),
             information);
+      if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
+        {
+          g_signal_connect (information->widget_account, "changed",
+              G_CALLBACK (update_avatar_chooser_account_cb),
+              information->widget_avatar);
+          update_avatar_chooser_account_cb (
+              EMPATHY_ACCOUNT_CHOOSER (information->widget_account),
+              EMPATHY_AVATAR_CHOOSER (information->widget_avatar));
+        }
     }
   else
     {
@@ -731,28 +747,9 @@
 }
 
 static void
-contact_widget_update_avatar_chooser_account (EmpathyContactWidget *information)
-{
-  McAccount *account;
-  EmpathyAccountChooser *account_chooser;
-
-  g_assert (EMPATHY_IS_ACCOUNT_CHOOSER (information->widget_account));
-  account_chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
-
-  if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR)
-    {
-      g_assert (EMPATHY_IS_AVATAR_CHOOSER (information->widget_avatar));
-
-      account = empathy_account_chooser_get_account (account_chooser);
-      g_object_set (information->widget_avatar, "account", account, NULL);
-    }
-}
-
-static void
 contact_widget_account_changed_cb (GtkComboBox *widget,
                                    EmpathyContactWidget *information)
 {
-  contact_widget_update_avatar_chooser_account (information);
   contact_widget_change_contact (information);
 }
 



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