[empathy/more-contact-info: 4/7] ContactWidget: support Idle's x-idle-time field.
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy/more-contact-info: 4/7] ContactWidget: support Idle's x-idle-time field.
- Date: Thu, 12 May 2011 12:48:53 +0000 (UTC)
commit fcacdb2b8e291ab9abddd3d3bc8aea1348a90930
Author: Will Thompson <will thompson collabora co uk>
Date: Tue May 10 17:35:20 2011 +0100
ContactWidget: support Idle's x-idle-time field.
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 f8f7b26..1b2570d 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 }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]