Re: [evolution-patches] patch for 301350 (calendar)



Updated patch attached, with the missing 'return TRUE' in
check_midnight_refresh.

On Mon, 2005-05-09 at 13:01 +0200, Rodrigo Moya wrote:
> This should fix Michael's problems with the alarm daemon and suspending
> a laptop over midnight.
> 
> Michael, not sure if you're running a source code installation. If so,
> could you apply and test the attached patch? It seems to work for me,
> but to make sure it would be interesting to have it tested.
-- 
Rodrigo Moya <rodrigo novell com>
? gui/apps_evolution_calendar-2.4.schemas
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2726
diff -u -p -r1.2726 ChangeLog
--- ChangeLog	9 May 2005 09:13:11 -0000	1.2726
+++ ChangeLog	9 May 2005 11:26:29 -0000
@@ -1,3 +1,13 @@
+2005-05-09  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #301350
+
+	* gui/alarm-notify/alarm-queue.c (alarm_queue_init): install a timeout
+	handler to check, every 30 minutes, for not losing the midnight refresh.
+	(check_midnight_refresh): check the midnight refresh and if we missed it,
+	reload alarms.
+	(queue_midnight_refresh): made the midnight value be global.
+
 2005-05-09  Philip Van Hoof <pvanhoof gnome org>
 
 	* gui/alarm-notify/*: Made the alarm-notify dialog
Index: gui/alarm-notify/alarm-queue.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-queue.c,v
retrieving revision 1.85
diff -u -p -r1.85 alarm-queue.c
--- gui/alarm-notify/alarm-queue.c	9 May 2005 09:10:38 -0000	1.85
+++ gui/alarm-notify/alarm-queue.c	9 May 2005 11:26:29 -0000
@@ -125,6 +125,7 @@ typedef struct {
 
 /* Alarm ID for the midnight refresh function */
 static gpointer midnight_refresh_id = NULL;
+static time_t midnight = 0;
 
 static void
 remove_client_alarms (ClientAlarms *ca);
@@ -152,7 +153,6 @@ static void midnight_refresh_cb (gpointe
 static void
 queue_midnight_refresh (void)
 {
-	time_t midnight;
 	icaltimezone *zone;
 
 	if (midnight_refresh_id != NULL) {
@@ -1295,6 +1295,25 @@ procedure_notification (time_t trigger, 
 
 
 
+static gboolean
+check_midnight_refresh (gpointer user_data)
+{
+	time_t new_midnight;
+	icaltimezone *zone;
+
+	zone = config_data_get_timezone ();
+	new_midnight = time_day_end_with_zone (time (NULL), zone);
+
+	if (new_midnight > midnight) {
+		/* Re-load the alarms for all clients */
+		g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL);
+
+		queue_midnight_refresh ();
+	}
+
+	return TRUE;
+}
+
 /**
  * alarm_queue_init:
  *
@@ -1314,6 +1333,9 @@ alarm_queue_init (void)
 		saved_notification_time = time (NULL);
 		config_data_set_last_notification_time (saved_notification_time);
 	}
+
+	/* install timeout handler (every 30 mins) for not missing the midnight refresh */
+	g_timeout_add (1800000, (GSourceFunc) check_midnight_refresh, NULL);
 
 	alarm_queue_inited = TRUE;
 }


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