aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-04 16:22:49 -0500
committerTed Gould <ted@canonical.com>2009-09-04 16:22:49 -0500
commit5ce56eed0dd09f122f175971a093f07c81741206 (patch)
tree3362081a6d83363efa3666edc4de46c65f136a02
parent567920a040c541ad10dfc53844ca9f5bd1e22a21 (diff)
downloadayatana-indicator-messages-5ce56eed0dd09f122f175971a093f07c81741206.tar.gz
ayatana-indicator-messages-5ce56eed0dd09f122f175971a093f07c81741206.tar.bz2
ayatana-indicator-messages-5ce56eed0dd09f122f175971a093f07c81741206.zip
Fleshing out the count item
-rw-r--r--src/im-menu-item.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/im-menu-item.c b/src/im-menu-item.c
index 36ae2f6..11381cf 100644
--- a/src/im-menu-item.c
+++ b/src/im-menu-item.c
@@ -284,7 +284,36 @@ static void
count_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data)
{
g_debug("Got Count Information");
+ ImMenuItem * self = IM_MENU_ITEM(data);
+ /* Our data should be right */
+ g_return_if_fail(self != NULL);
+ /* We should have a property name */
+ g_return_if_fail(property != NULL);
+ /* The Property should be count */
+ g_return_if_fail(!g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_COUNT));
+
+ ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
+
+ if (propertydata == NULL || propertydata[0] == '\0') {
+ /* The count is either being unset or it was never
+ set in the first place. */
+ if (priv->count != NULL) {
+ g_free(priv->count);
+ priv->count = NULL;
+ update_time(self);
+ }
+ return;
+ }
+
+ if (priv->count != NULL) {
+ g_free(priv->count);
+ }
+
+ priv->count = g_strdup_printf("(%s)", propertydata);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), INDICATOR_MENUITEM_PROP_RIGHT, priv->count);
+
+ return;
}
/* This is getting the attention variable that's looking at whether