diff options
author | Frederic Peters <fpeters@0d.be> | 2009-08-21 03:54:02 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk> | 2009-11-12 23:05:46 +0800 |
commit | d5070182fd31bf85a4129e8f3b8677c3af78772b (patch) | |
tree | 29da8a67d3253172cbb66220bb6e330c41dfdf1a /libempathy-gtk/empathy-contact-widget.c | |
parent | 1020f57c4a8ea74b7738b6a8e20d299cdd65115d (diff) | |
download | gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar.gz gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar.bz2 gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar.lz gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar.xz gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.tar.zst gsoc2013-empathy-d5070182fd31bf85a4129e8f3b8677c3af78772b.zip |
Order location fields
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 81e01ff0b..c8e14e05b 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -1320,8 +1320,16 @@ contact_widget_location_update (EmpathyContactWidget *information) gboolean has_position = TRUE; GtkWidget *label; guint row = 0; - GHashTableIter iter; - gpointer key, pvalue; + static const gchar* ordered_geolocation_keys[] = { + EMPATHY_LOCATION_STREET, + EMPATHY_LOCATION_AREA, + EMPATHY_LOCATION_LOCALITY, + EMPATHY_LOCATION_REGION, + EMPATHY_LOCATION_COUNTRY, + NULL + }; + int i; + const gchar *skey; if (!(information->flags & EMPATHY_CONTACT_WIDGET_SHOW_LOCATION)) { @@ -1379,18 +1387,18 @@ contact_widget_location_update (EmpathyContactWidget *information) gtk_box_pack_start (GTK_BOX (information->subvbox_location), information->table_location, FALSE, FALSE, 5); - g_hash_table_iter_init (&iter, location); - while (g_hash_table_iter_next (&iter, &key, &pvalue)) + + for (i = 0; (skey = ordered_geolocation_keys[i]); i++) { - const gchar *skey; const gchar* user_label; GValue *gvalue; char *svalue = NULL; - skey = (const gchar *) key; + gvalue = g_hash_table_lookup (location, (gpointer) skey); + if (gvalue == NULL) + continue; user_label = location_key_to_label (skey); - gvalue = (GValue *) pvalue; label = gtk_label_new (user_label); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); @@ -1429,6 +1437,12 @@ contact_widget_location_update (EmpathyContactWidget *information) row++; } + if (row == 0) + { + gtk_widget_hide (information->vbox_location); + return; + } + gtk_widget_show (information->table_location); #if HAVE_LIBCHAMPLAIN |