aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}