From 56b38154b0c236a158a41989c0cc72e0302cf6ff Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 20 Oct 2010 13:12:00 +0200 Subject: [PATCH] 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 file changed, 20 insertions(+), 13 deletions(-) diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index b73fd664..c0a6b822 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)); -- 2.39.2