aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-24 17:27:16 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-29 17:00:51 +0800
commit0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f (patch)
tree8b56382bccb9b5bfceb0e3bc7a0379b7766bf57e
parente5bf164997d4580ae94fc1f2471a3bce6ac617b8 (diff)
downloadgsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar.gz
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar.bz2
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar.lz
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar.xz
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.tar.zst
gsoc2013-empathy-0f7279a3bbbe4bfd4dceb06e54ec983082d6c58f.zip
Add unsupported contact fields to details_to_set (#630427)
This avoid to loss unsupported fields when closing the dialog.
-rw-r--r--libempathy-gtk/empathy-contact-widget.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index f20ec81c4..2cb725d07 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -290,7 +290,7 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
for (l = specs; l != NULL; l = l->next)
{
TpContactInfoFieldSpec *spec = l->data;
- TpContactInfoField *field;
+ TpContactInfoField *field = NULL;
InfoFieldData *field_data;
GList *ll;
GtkWidget *w;
@@ -299,15 +299,15 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
if (field_data == NULL)
{
DEBUG ("Unhandled ContactInfo field spec: %s", spec->name);
- continue;
}
/* Search initial value */
- for (ll = info; ll != NULL; ll = ll->next)
+ for (ll = info; ll != NULL && field == NULL; ll = ll->next)
{
- field = ll->data;
- if (!tp_strdiff (field->field_name, spec->name))
- break;
+ TpContactInfoField *tmp = ll->data;
+
+ if (!tp_strdiff (tmp->field_name, spec->name))
+ field = tmp;
}
if (field != NULL)
@@ -317,6 +317,11 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
}
else
{
+ /* Empathy doesn't support editing this file and it's not in the
+ * contact's fields so we can't do much with it. */
+ if (field_data == NULL)
+ continue;
+
field = tp_contact_info_field_new (spec->name, spec->parameters,
NULL);
}
@@ -324,6 +329,12 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
information->details_to_set = g_list_prepend (information->details_to_set,
field);
+ /* 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) */
+ if (field_data == NULL)
+ continue;
+
/* Add Title */
w = gtk_label_new (_(field_data->title));
gtk_table_attach (GTK_TABLE (information->table_details),