ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00420
[Branch ~indicator-applet-developers/indicator-messages/trunk] Rev 148: Adding in a check to see if the time was set, if not, don't display it in the menu item.
Merge authors:
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~ted/indicator-messages/mark-time/+merge/12634
proposed by: Ted Gould (ted)
review: Approve - Neil J. Patel (njpatel)
------------------------------------------------------------
revno: 148 [merge]
committer: Ted Gould <ted@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-09-30 12:03:35 -0500
message:
Adding in a check to see if the time was set, if not, don't display it in the menu item.
modified:
src/im-menu-item.c
--
lp:indicator-messages
https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-messages.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk/+edit-subscription.
=== modified file 'src/im-menu-item.c'
--- src/im-menu-item.c 2009-09-09 15:03:33 +0000
+++ src/im-menu-item.c 2009-09-29 21:46:18 +0000
@@ -47,6 +47,7 @@
IndicateListenerServer * server;
IndicateListenerIndicator * indicator;
+ glong creation_seconds;
glong seconds;
gchar * count;
gulong indicator_changed;
@@ -132,13 +133,14 @@
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(¤t_time);
- priv->seconds = current_time.tv_sec;
+ priv->creation_seconds = current_time.tv_sec;
return;
}
@@ -185,9 +187,17 @@
{
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 @@
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