[empathy: 6/8] split filling of details_to_set and adding the widgets



commit 56b38154b0c236a158a41989c0cc72e0302cf6ff
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Oct 20 13:12:00 2010 +0200

    split filling of details_to_set and adding the widgets
    
    This will allow us to add supported fields which are not set in the vCard.

 libempathy-gtk/empathy-contact-widget.c |   33 ++++++++++++++++++------------
 1 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index b73fd66..c0a6b82 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -313,21 +313,13 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
   connection = tp_contact_get_connection (contact);
 
   info = tp_contact_get_contact_info (contact);
-  info = g_list_sort (info, (GCompareFunc) contact_info_field_cmp);
 
   specs = tp_connection_get_contact_info_supported_fields (connection);
 
+  /* Look at the fields set in our vCard */
   for (l = info; l != NULL; l = l->next)
     {
       TpContactInfoField *field = l->data;
-      InfoFieldData *field_data;
-      GtkWidget *w;
-
-      field_data = find_info_field_data (field->field_name);
-      if (field_data == NULL)
-        {
-          DEBUG ("Unhandled ContactInfo field spec: %s", field->field_name);
-        }
 
       /* make a copy for the details_to_set list */
       field = tp_contact_info_field_copy (field);
@@ -335,12 +327,27 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
 
       information->details_to_set = g_list_prepend (information->details_to_set,
           field);
+    }
+
+  /* Add widgets for supported fields */
+  information->details_to_set = g_list_sort (information->details_to_set,
+      (GCompareFunc) contact_info_field_cmp);
 
-      /* Empathy doesn't display this field so we can't change it. But we put
-       * it in the details_to_set list so it won't be erased when calling
-       * SetContactInfo (bgo #630427) */
+  for (l = information->details_to_set; l != NULL; l= g_list_next (l))
+    {
+      TpContactInfoField *field = l->data;
+      InfoFieldData *field_data;
+      GtkWidget *w;
+
+      field_data = find_info_field_data (field->field_name);
       if (field_data == NULL)
-        continue;
+        {
+          /* Empathy doesn't display this field so we can't change it.
+           * But we put it in the details_to_set list so it won't be erased
+           * when calling SetContactInfo (bgo #630427) */
+          DEBUG ("Unhandled ContactInfo field spec: %s", field->field_name);
+          continue;
+        }
 
       /* Add Title */
       w = gtk_label_new (_(field_data->title));



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