evolution r35875 - in trunk: calendar calendar/gui/alarm-notify plugins/mail-notification



Author: mcrha
Date: Fri Aug  1 07:17:26 2008
New Revision: 35875
URL: http://svn.gnome.org/viewvc/evolution?rev=35875&view=rev

Log:
2008-08-01  Milan Crha  <mcrha redhat com>

	** 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.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/alarm-notify/alarm-queue.c
   trunk/plugins/mail-notification/ChangeLog
   trunk/plugins/mail-notification/mail-notification.c

Modified: trunk/calendar/gui/alarm-notify/alarm-queue.c
==============================================================================
--- trunk/calendar/gui/alarm-notify/alarm-queue.c	(original)
+++ trunk/calendar/gui/alarm-notify/alarm-queue.c	Fri Aug  1 07:17:26 2008
@@ -79,7 +79,7 @@
 /* Top Tray Image */
 static GtkStatusIcon *tray_icon = NULL;
 static int tray_blink_id = -1;
-static int tray_blink_state = FALSE;
+static int tray_blink_countdown = 0;
 static AlarmNotify *an;
 
 /* Structure that stores a client we are monitoring */
@@ -1383,11 +1383,13 @@
 static gboolean
 tray_icon_blink_cb (gpointer data)
 {
+	static gboolean tray_blink_state = FALSE;
 	GdkPixbuf *pixbuf;
 
-	tray_blink_state = tray_blink_state == TRUE ? FALSE: TRUE;
+	tray_blink_countdown--;
+	tray_blink_state = !tray_blink_state;
 
-	pixbuf = e_icon_factory_get_icon  (tray_blink_state == TRUE?
+	pixbuf = e_icon_factory_get_icon  ((tray_blink_state || tray_blink_countdown <= 0)?
 					   "stock_appointment-reminder-excl" :
 					   "stock_appointment-reminder",
 					   E_ICON_SIZE_LARGE_TOOLBAR);
@@ -1396,7 +1398,10 @@
 		gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf);
 	g_object_unref (pixbuf);
 
-	return TRUE;
+	if (tray_blink_countdown <= 0)
+		tray_blink_id = -1;
+
+	return tray_blink_countdown > 0;
 }
 
 
@@ -1536,8 +1541,10 @@
 		open_alarm_dialog (tray_data);
 		gtk_window_stick (GTK_WINDOW (alarm_notifications_dialog->dialog));
 	} else {
-		if (tray_blink_id == -1)
+		if (tray_blink_id == -1) {
+			tray_blink_countdown = 30;
 			tray_blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
+		}
 	}
 }
 

Modified: trunk/plugins/mail-notification/mail-notification.c
==============================================================================
--- trunk/plugins/mail-notification/mail-notification.c	(original)
+++ trunk/plugins/mail-notification/mail-notification.c	Fri Aug  1 07:17:26 2008
@@ -271,6 +271,7 @@
 #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 @@
 	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 @@
 }
 #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 @@
 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 @@
 	}
 
 	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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]