From 5eb74b177084b3cd03e412ea3b7f55b41542a9fe Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 10 May 2011 17:35:20 +0100 Subject: ContactWidget: support Idle's x-idle-time field. --- libempathy-gtk/empathy-contact-widget.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 #include #include +#include #include #include @@ -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 } }; -- cgit v1.2.3