aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-30 09:35:22 -0500
committerTed Gould <ted@gould.cx>2010-03-30 09:35:22 -0500
commit6d6020686cd9a583a99650f1da0062ccc86584fe (patch)
tree57caec274251b4eceacaa250f93139d08d4a4c29
parent4bb479d48b2b630ad5d3c172aac6456af77f2f6d (diff)
downloadayatana-indicator-messages-6d6020686cd9a583a99650f1da0062ccc86584fe.tar.gz
ayatana-indicator-messages-6d6020686cd9a583a99650f1da0062ccc86584fe.tar.bz2
ayatana-indicator-messages-6d6020686cd9a583a99650f1da0062ccc86584fe.zip
Putting in a timeout to clear the icon if there were messages waiting when we lost the service.
-rw-r--r--src/indicator-messages.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/indicator-messages.c b/src/indicator-messages.c
index 3713204..34dfb1a 100644
--- a/src/indicator-messages.c
+++ b/src/indicator-messages.c
@@ -190,11 +190,33 @@ icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, gpointer userdata)
return icon_changed_cb(proxy, hidden, userdata);
}
+static guint connection_drop_timeout = 0;
+
+/* Resets the icon to not having messages if we can't get a good
+ answer on it from the service. */
+static gboolean
+connection_drop_cb (gpointer user_data)
+{
+ if (main_image != NULL) {
+ indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages");
+ }
+ connection_drop_timeout = 0;
+ return FALSE;
+}
+
/* Sets up all the icon information in the proxy. */
static void
connection_change (IndicatorServiceManager * sm, gboolean connected, gpointer user_data)
{
+ if (connection_drop_timeout != 0) {
+ g_source_remove(connection_drop_timeout);
+ connection_drop_timeout = 0;
+ }
+
if (!connected) {
+ /* Ensure that we're not saying there are messages
+ when we don't have a connection. */
+ connection_drop_timeout = g_timeout_add(400, connection_drop_cb, NULL);
return;
}