aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-30 12:04:22 -0500
committerTed Gould <ted@canonical.com>2009-09-30 12:04:22 -0500
commitd55648edf407de6427721ac6ca0c55329b3f2289 (patch)
treedfb4e38f7393c607d6dd2731e0b08a9886a0cd78 /src
parent092563e72b12128179a1f26cd43ae205104dc79f (diff)
parentd1cf2faaec71420c36d41fc994363677fc109dd3 (diff)
downloadayatana-indicator-messages-d55648edf407de6427721ac6ca0c55329b3f2289.tar.gz
ayatana-indicator-messages-d55648edf407de6427721ac6ca0c55329b3f2289.tar.bz2
ayatana-indicator-messages-d55648edf407de6427721ac6ca0c55329b3f2289.zip
Making it so that if applications don't set the time on an indicator
the time isn't shown in the menu.
Diffstat (limited to 'src')
-rw-r--r--src/im-menu-item.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/im-menu-item.c b/src/im-menu-item.c
index c2b3d12..35bb3be 100644
--- a/src/im-menu-item.c
+++ b/src/im-menu-item.c
@@ -47,6 +47,7 @@ struct _ImMenuItemPrivate
IndicateListenerServer * server;
IndicateListenerIndicator * indicator;
+ glong creation_seconds;
glong seconds;
gchar * count;
gulong indicator_changed;
@@ -132,13 +133,14 @@ im_menu_item_init (ImMenuItem *self)
priv->indicator = NULL;
/* A sane default, but look below */
+ priv->creation_seconds = 0;
priv->seconds = 0;
/* Set the seconds to be the time when the item was
created incase we're not given a better time. */
GTimeVal current_time;
g_get_current_time(&current_time);
- priv->seconds = current_time.tv_sec;
+ priv->creation_seconds = current_time.tv_sec;
return;
}
@@ -185,9 +187,17 @@ update_time (ImMenuItem * self)
{
ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
+ /* Count has been set, so it takes priority. */
if (priv->count != NULL) {
return;
}
+
+ /* Seconds hasn't been set, so we just want to keep the time
+ area blank. */
+ if (priv->seconds == 0) {
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), INDICATOR_MENUITEM_PROP_RIGHT, "");
+ return;
+ }
gchar * timestring = NULL;
@@ -449,7 +459,12 @@ im_menu_item_get_seconds (ImMenuItem * menuitem)
g_return_val_if_fail(IS_IM_MENU_ITEM(menuitem), 0);
ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(menuitem);
- return priv->seconds;
+
+ if (priv->seconds == 0) {
+ return priv->creation_seconds;
+ } else {
+ return priv->seconds;
+ }
}
/* Gets whether or not this indicator item is