diff options
author | Ted Gould <ted@canonical.com> | 2009-09-04 16:32:39 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-09-04 16:32:39 -0500 |
commit | e740035a0d5605e07034ea026948cec8da3b3ee7 (patch) | |
tree | 6aac3e19d7176198d097ff4515f0324fb652fc94 | |
parent | 9533ec199b1fb11a911de5d8859f946af6a6f060 (diff) | |
download | ayatana-indicator-messages-e740035a0d5605e07034ea026948cec8da3b3ee7.tar.gz ayatana-indicator-messages-e740035a0d5605e07034ea026948cec8da3b3ee7.tar.bz2 ayatana-indicator-messages-e740035a0d5605e07034ea026948cec8da3b3ee7.zip |
Fleshing out the attention_cb to make it record the value and signal on changes.
-rw-r--r-- | src/im-menu-item.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 */ |