[empathy] Fix setting favourites from the contact editing dialogue



commit c9602a81b0f64f20c1927947c8e456929c521119
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Jul 2 12:11:06 2010 +0100

    Fix setting favourites from the contact editing dialogue

 libempathy-gtk/empathy-contact-widget.c |   33 +++++++++++++++----------------
 1 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 76271c6..851aa53 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -1534,14 +1534,18 @@ contact_widget_contact_update (EmpathyContactWidget *information)
 
       if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE)
         {
-          gboolean is_favourite;
-
-          is_favourite = empathy_contact_list_is_favourite (
-              EMPATHY_CONTACT_LIST (information->manager),
+          FolksIndividual *individual = folks_individual_from_empathy_contact (
               information->contact);
 
-          contact_widget_favourites_changed_cb (information->manager,
-              information->contact, is_favourite, information);
+          if (individual)
+            {
+              gboolean is_favourite = folks_favourite_get_is_favourite (
+                  FOLKS_FAVOURITE (individual));
+              contact_widget_favourites_changed_cb (information->manager,
+                  information->contact, is_favourite, information);
+
+              g_object_unref (individual);
+            }
         }
 
       gtk_widget_show (information->label_alias);
@@ -1667,19 +1671,14 @@ static void
 favourite_toggled_cb (GtkToggleButton *button,
     EmpathyContactWidget *information)
 {
-  gboolean active;
-
-  active = gtk_toggle_button_get_active (button);
+  FolksIndividual *individual = folks_individual_from_empathy_contact (
+      information->contact);
 
-  if (active)
-    {
-      empathy_contact_list_add_to_favourites (
-          EMPATHY_CONTACT_LIST (information->manager), information->contact);
-    }
-  else
+  if (individual)
     {
-      empathy_contact_list_remove_from_favourites (
-          EMPATHY_CONTACT_LIST (information->manager), information->contact);
+      gboolean active = gtk_toggle_button_get_active (button);
+      folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), active);
+      g_object_unref (individual);
     }
 }
 



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