diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-11 00:35:20 +0800 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-16 20:31:04 +0800 |
commit | 5eb74b177084b3cd03e412ea3b7f55b41542a9fe (patch) | |
tree | cc847349911d83c03c4de93661ed84b4c4556aad /libempathy-gtk/empathy-contact-widget.c | |
parent | 3e99c2d9e8b4f5a36507722c8bd681086c3220c4 (diff) | |
download | gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar.gz gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar.bz2 gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar.lz gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar.xz gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.tar.zst gsoc2013-empathy-5eb74b177084b3cd03e412ea3b7f55b41542a9fe.zip |
ContactWidget: support Idle's x-idle-time field.
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index f8f7b268b..1b2570de2 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -40,6 +40,7 @@ #include <libempathy/empathy-contact-manager.h> #include <libempathy/empathy-contact-list.h> #include <libempathy/empathy-location.h> +#include <libempathy/empathy-request-util.h> #include <libempathy/empathy-time.h> #include <libempathy/empathy-utils.h> @@ -298,6 +299,18 @@ linkify_first_value (GStrv values) return empathy_add_link_markup (values[0]); } +static gchar * +format_idle_time (GStrv values) +{ + const gchar *value = values[0]; + int duration = strtol (value, NULL, 10); + + if (duration <= 0) + return NULL; + + return empathy_duration_to_string (duration); +} + static InfoFieldData info_field_datas[] = { { "fn", N_("Full name:"), NULL }, @@ -305,6 +318,12 @@ static InfoFieldData info_field_datas[] = { "email", N_("E-mail address:"), linkify_first_value }, { "url", N_("Website:"), linkify_first_value }, { "bday", N_("Birthday:"), NULL }, + + /* Note to translators: this is the caption for a string of the form "5 + * minutes ago", and refers to the time since the contact last interacted + * with their IM client. + */ + { "x-idle-time", N_("Last seen:"), format_idle_time }, { NULL, NULL } }; |