diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-22 00:25:55 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-28 00:52:07 +0800 |
commit | b56b48b67fe63bb40871360116a80f1df17d3273 (patch) | |
tree | 8d03e97e9b5c61164146e5c7af9985d4cc41a3b2 | |
parent | e9010cc1e7b3bdaa3366ea530d0d3780dbbfb0a4 (diff) | |
download | gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar.gz gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar.bz2 gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar.lz gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar.xz gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.tar.zst gsoc2013-empathy-b56b48b67fe63bb40871360116a80f1df17d3273.zip |
Have better user labels for location values
And have them better placed (with labels on left not expand).
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 255a68297..6a0b19d6c 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -1232,6 +1232,65 @@ contact_widget_client_update (EmpathyContactWidget *information) /* FIXME: Needs new telepathy spec */ } +/* Converts the Location's GHashTable's key to a user readable string */ +static const gchar * +location_key_to_label (const gchar *key) +{ + if (strcmp (key, EMPATHY_LOCATION_COUNTRY_CODE) == 0) + return _("Country ISO Code:"); + else if (strcmp (key, EMPATHY_LOCATION_COUNTRY) == 0) + return _("Country:"); + else if (strcmp (key, EMPATHY_LOCATION_REGION) == 0) + return _("State:"); + else if (strcmp (key, EMPATHY_LOCATION_LOCALITY) == 0) + return _("City:"); + else if (strcmp (key, EMPATHY_LOCATION_AREA) == 0) + return _("Area:"); + else if (strcmp (key, EMPATHY_LOCATION_POSTAL_CODE) == 0) + return _("Postal Code:"); + else if (strcmp (key, EMPATHY_LOCATION_STREET) == 0) + return _("Street:"); + else if (strcmp (key, EMPATHY_LOCATION_BUILDING) == 0) + return _("Building:"); + else if (strcmp (key, EMPATHY_LOCATION_FLOOR) == 0) + return _("Floor:"); + else if (strcmp (key, EMPATHY_LOCATION_ROOM) == 0) + return _("Room:"); + else if (strcmp (key, EMPATHY_LOCATION_TEXT) == 0) + return _("Text:"); + else if (strcmp (key, EMPATHY_LOCATION_DESCRIPTION) == 0) + return _("Description:"); + else if (strcmp (key, EMPATHY_LOCATION_URI) == 0) + return _("URI:"); + else if (strcmp (key, EMPATHY_LOCATION_ACCURACY_LEVEL) == 0) + return _("Accuracy Level:"); + else if (strcmp (key, EMPATHY_LOCATION_ERROR) == 0) + return _("Error:"); + else if (strcmp (key, EMPATHY_LOCATION_VERTICAL_ERROR_M) == 0) + return _("Vertical Error (meters):"); + else if (strcmp (key, EMPATHY_LOCATION_HORIZONTAL_ERROR_M) == 0) + return _("Horizontal Error (meters):"); + else if (strcmp (key, EMPATHY_LOCATION_SPEED) == 0) + return _("Speed:"); + else if (strcmp (key, EMPATHY_LOCATION_BEARING) == 0) + return _("Bearing:"); + else if (strcmp (key, EMPATHY_LOCATION_CLIMB) == 0) + return _("Climb Speed:"); + else if (strcmp (key, EMPATHY_LOCATION_TIMESTAMP) == 0) + return _("Taken at:"); + else if (strcmp (key, EMPATHY_LOCATION_LON) == 0) + return _("Longitude:"); + else if (strcmp (key, EMPATHY_LOCATION_LAT) == 0) + return _("Latitude:"); + else if (strcmp (key, EMPATHY_LOCATION_ALT) == 0) + return _("Altitude:"); + else + { + DEBUG ("Unexpected Location key: %s", key); + return key; + } +} + static void contact_widget_location_update (EmpathyContactWidget *information) { @@ -1305,16 +1364,18 @@ contact_widget_location_update (EmpathyContactWidget *information) while (g_hash_table_iter_next (&iter, &key, &value)) { const gchar *skey; + const gchar* user_label; GValue *gvalue; char *svalue = NULL; skey = (const gchar *) key; + user_label = location_key_to_label (skey); gvalue = (GValue *) value; - label = gtk_label_new (_(skey)); - gtk_table_attach_defaults (GTK_TABLE (information->table_location), - label, 0, 1, row, row + 1); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0); + label = gtk_label_new (user_label); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + gtk_table_attach (GTK_TABLE (information->table_location), + label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 10, 0); gtk_widget_show (label); if (G_VALUE_TYPE (gvalue) == G_TYPE_DOUBLE) |