aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-02-05 11:14:44 +0100
committerTed Gould <ted@canonical.com>2009-02-05 11:14:44 +0100
commitc53679a64a9bdb3e576e68d8e3568a39de0a85c1 (patch)
treeab2fe5b247c66b45b68305ff7e36b82ec1e3f6ec
parent72030b3b48ac4a02496a3356954874846e47d0bd (diff)
downloadayatana-indicator-messages-c53679a64a9bdb3e576e68d8e3568a39de0a85c1.tar.gz
ayatana-indicator-messages-c53679a64a9bdb3e576e68d8e3568a39de0a85c1.tar.bz2
ayatana-indicator-messages-c53679a64a9bdb3e576e68d8e3568a39de0a85c1.zip
Oh, two things. First is setting alignment of the two strings and also getting the time from an ISO8601 string
-rw-r--r--src/im-menu-item.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/im-menu-item.c b/src/im-menu-item.c
index 7ffa4bb..f0de2f9 100644
--- a/src/im-menu-item.c
+++ b/src/im-menu-item.c
@@ -2,6 +2,7 @@
#include "config.h"
#endif
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "im-menu-item.h"
@@ -79,6 +80,9 @@ im_menu_item_init (ImMenuItem *self)
priv->user = GTK_LABEL(gtk_label_new(""));
priv->time = GTK_LABEL(gtk_label_new(""));
+ gtk_misc_set_alignment(GTK_MISC(priv->user), 0.0, 0.5);
+ gtk_misc_set_alignment(GTK_MISC(priv->time), 0.0, 0.5);
+
if (icon_group == NULL) {
icon_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
}
@@ -139,8 +143,20 @@ time_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateL
ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
- gtk_label_set_label(priv->time, propertydata);
- gtk_widget_show(priv->time);
+ GTimeVal time;
+ if (g_time_val_from_iso8601(propertydata, &time)) {
+ time_t timet;
+ struct tm * structtm;
+
+ timet = time.tv_sec;
+ structtm = localtime(&timet);
+
+ gchar timestring[80];
+ strftime(timestring, 80, _("%I:%M"), structtm);
+
+ gtk_label_set_label(priv->time, timestring);
+ gtk_widget_show(priv->time);
+ }
return;
}