]> git.0d.be Git - empathy.git/commitdiff
Always check if notifications are enabled when we update them.
authorXavier Claessens <xclaesse@src.gnome.org>
Fri, 30 Jan 2009 17:08:26 +0000 (17:08 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 30 Jan 2009 17:08:26 +0000 (17:08 +0000)
svn path=/trunk/; revision=2301

src/empathy-status-icon.c

index ceae254740fb78f470dc2eb7348bc2c2ed37a1aa..197b22401f48e71b32a7f976db8d9a84ff3ba31e 100644 (file)
@@ -127,12 +127,28 @@ get_pixbuf_for_event (EmpathyEvent *event)
        return pixbuf;
 }
 
+static void
+notification_close_helper (EmpathyStatusIconPriv *priv)
+{
+       if (priv->notification) {
+               notify_notification_close (priv->notification, NULL);
+               g_object_unref (priv->notification);
+               priv->notification = NULL;
+       }
+}
+
 static void
 status_icon_update_notification (EmpathyStatusIcon *icon)
 {
        EmpathyStatusIconPriv *priv = GET_PRIV (icon);
        GdkPixbuf *pixbuf = NULL;
 
+       if (!empathy_notification_is_enabled ()) {
+               /* always close the notification if this happens */
+               notification_close_helper (priv);
+               return;
+       }
+
        if (priv->event) {
                pixbuf = get_pixbuf_for_event (priv->event);
 
@@ -156,11 +172,7 @@ status_icon_update_notification (EmpathyStatusIcon *icon)
 
                g_object_unref (pixbuf);
        } else {
-               if (priv->notification) {
-                       notify_notification_close (priv->notification, NULL);
-                       g_object_unref (priv->notification);
-                       priv->notification = NULL;
-               }
+               notification_close_helper (priv);
        }
 }
 
@@ -234,10 +246,7 @@ status_icon_event_added_cb (EmpathyEventManager *manager,
 
        status_icon_update_icon (icon);
        status_icon_update_tooltip (icon);
-
-       if (empathy_notification_is_enabled ()) {
-               status_icon_update_notification (icon);
-       }
+       status_icon_update_notification (icon);
 
        if (!priv->blink_timeout) {
                priv->blink_timeout = g_timeout_add (BLINK_TIMEOUT,