From a7fa2367752b6d3b0c74d3391b5cf861027f122c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 1 Aug 2008 07:17:26 +0000 Subject: ** Fix for bug #353927 2008-08-01 Milan Crha ** Fix for bug #353927 * calendar/gui/alarm-notify/alarm-queue.c: (tray_icon_blink_cb), (display_notification): Do not blink the icon more than 15 seconds. * plugins/mail-notification/mail-notification.c: (icon_activated), (stop_blinking_cb), (new_notify_status): Do not blink the icon more than 15 seconds. svn path=/trunk/; revision=35875 --- plugins/mail-notification/mail-notification.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'plugins/mail-notification/mail-notification.c') diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index f9bfd4b8dd..afa633c999 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -271,6 +271,7 @@ get_config_widget_dbus (void) #define GCONF_KEY_STATUS_NOTIFICATION GCONF_KEY_ROOT "status-notification" static GtkStatusIcon *status_icon = NULL; +static guint blink_timeout_id = 0; static unsigned int status_count = 0; #ifdef HAVE_LIBNOTIFY @@ -295,6 +296,11 @@ icon_activated (GtkStatusIcon *icon, gpointer pnotify) gtk_status_icon_set_visible (status_icon, FALSE); g_object_unref (status_icon); + if (blink_timeout_id) { + g_source_remove (blink_timeout_id); + blink_timeout_id = 0; + } + status_icon = NULL; status_count = 0; } @@ -307,6 +313,17 @@ notification_callback (gpointer notify) } #endif +static gboolean +stop_blinking_cb (gpointer data) +{ + blink_timeout_id = 0; + + if (status_icon) + gtk_status_icon_set_blinking (status_icon, FALSE); + + return FALSE; +} + struct _StatusConfigureWidgets { GtkWidget *enable; @@ -428,8 +445,9 @@ static void new_notify_status (EMEventTargetFolder *t) { char *msg; + gboolean new_icon = !status_icon; - if (!status_icon) { + if (new_icon) { status_icon = gtk_status_icon_new (); gtk_status_icon_set_from_pixbuf (status_icon, e_icon_factory_get_icon ("mail-unread", E_ICON_SIZE_LARGE_TOOLBAR)); } @@ -447,8 +465,13 @@ new_notify_status (EMEventTargetFolder *t) } gtk_status_icon_set_tooltip (status_icon, msg); + + if (new_icon && is_part_enabled (GCONF_KEY_STATUS_BLINK)) { + gtk_status_icon_set_blinking (status_icon, TRUE); + blink_timeout_id = g_timeout_add_seconds (15, stop_blinking_cb, NULL); + } + gtk_status_icon_set_visible (status_icon, TRUE); - gtk_status_icon_set_blinking (status_icon, is_part_enabled (GCONF_KEY_STATUS_BLINK)); #ifdef HAVE_LIBNOTIFY /* Now check whether we're supposed to send notifications */ -- cgit