[empathy] Order location fields
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] Order location fields
- Date: Thu, 12 Nov 2009 15:34:36 +0000 (UTC)
commit d5070182fd31bf85a4129e8f3b8677c3af78772b
Author: Frederic Peters <fpeters 0d be>
Date: Thu Aug 20 15:54:02 2009 -0400
Order location fields
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 81e01ff..c8e14e0 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]