From e740035a0d5605e07034ea026948cec8da3b3ee7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 16:32:39 -0500 Subject: Fleshing out the attention_cb to make it record the value and signal on changes. --- src/im-menu-item.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/im-menu-item.c b/src/im-menu-item.c index ee91f71..d64a917 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -332,7 +332,30 @@ static void attention_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data) { g_debug("Got Attention 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_ATTENTION)); + ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); + + gboolean wantit; + if (propertydata == NULL || propertydata[0] == '\0' || !g_strcmp0(propertydata, "false")) { + wantit = FALSE; + } else { + wantit = TRUE; + } + + if (priv->attention != wantit) { + priv->attention = wantit; + g_signal_emit(G_OBJECT(self), signals[ATTENTION_CHANGED], 0, wantit, TRUE); + } + + return; } /* Callback when the item gets clicked on from the Messaging Menu */ -- cgit v1.2.3