? calendar.error
? gui/.e-meeting-time-sel-item.c.swp
? gui/.memos-component.c.swp
? gui/apps_evolution_calendar-2.6.schemas
? gui/apps_evolution_calendar-2.8.schemas
? gui/calendar-commands.c.agendaview
? gui/e-agenda-view-config.c
? gui/e-agenda-view-config.h
? gui/e-agenda-view.c
? gui/e-agenda-view.h
? gui/alarm-notify/.alarm-queue.c.swp
? gui/alarm-notify/alarm-queue.c.new
? gui/dialogs/.event-editor.c.swp
? gui/dialogs/cal-prefs-dialog.gladep
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.303
diff -u -p -r1.303 e-day-view.c
--- gui/e-day-view.c	28 Jul 2006 09:25:19 -0000	1.303
+++ gui/e-day-view.c	29 Sep 2006 16:39:57 -0000
@@ -3627,9 +3627,6 @@ e_day_view_on_long_event_button_press (E
 
 		e = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
 
-		if (!GTK_WIDGET_HAS_FOCUS (day_view))
-			gtk_widget_grab_focus (GTK_WIDGET (day_view));
-
 		e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end);
 			
 		e_day_view_on_event_right_click (day_view, event,
@@ -3669,9 +3666,6 @@ e_day_view_on_event_button_press (EDayVi
 		EDayViewEvent *e;
 
 		e = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
-
-		if (!GTK_WIDGET_HAS_FOCUS (day_view))
-			gtk_widget_grab_focus (GTK_WIDGET (day_view));
 
 		e_day_view_set_selected_time_range_visible (day_view, e->start, e->end);
 	
Index: gui/alarm-notify/alarm-notify.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-notify.c,v
retrieving revision 1.56
diff -u -p -r1.56 alarm-notify.c
--- gui/alarm-notify/alarm-notify.c	24 Aug 2006 13:53:20 -0000	1.56
+++ gui/alarm-notify/alarm-notify.c	29 Sep 2006 16:40:09 -0000
@@ -48,8 +48,8 @@ struct _AlarmNotifyPrivate {
 EThread *alarm_operation_thread;	/* for operations that can (or should) be queued */
 EMsgPort *alarm_reply_port;
 static GIOChannel *alarm_reply_channel;
-
-#define d(x) x
+FILE *alog;
+#define d(x) x; fflush(alog);
 
 
 static void alarm_notify_class_init (AlarmNotifyClass *klass);
@@ -157,7 +157,7 @@ list_changed_cb (ESourceList *source_lis
 			
 			uri = e_source_get_uri (source);
 			if (!g_hash_table_lookup (priv->uri_client_hash[source_type], uri)) {
-				d (printf("%s:%d (list_changed_cb) - Adding Calendar %s\n", __FILE__, __LINE__, uri));				
+				d (fprintf(alog, "%s:%d (list_changed_cb) - Adding Calendar %s\n", __FILE__, __LINE__, uri));				
 				alarm_notify_add_calendar (an, source_type, source, FALSE);
 			}
 			g_free (uri);
@@ -171,7 +171,7 @@ list_changed_cb (ESourceList *source_lis
 	g_hash_table_foreach (priv->uri_client_hash[source_type], (GHFunc) process_removal_in_hash, &prd);
 
 	for (l = prd.removals; l; l = l->next) {
-		d (printf("%s:%d (list_changed_cb) - Removing Calendar %s\n", __FILE__, __LINE__, (char *)l->data));
+		d (fprintf(alog, "%s:%d (list_changed_cb) - Removing Calendar %s\n", __FILE__, __LINE__, (char *)l->data));
 		alarm_notify_remove_calendar (an, source_type, l->data);
 	}
 	g_list_free (prd.removals);
@@ -195,7 +195,7 @@ load_calendars (AlarmNotify *an, ECalSou
 	priv = an->priv;
 	
 	if (!e_cal_get_sources (&source_list, source_type, NULL)) {
-		d (printf("%s:%d (load_calendars) - Cannont get sources\n ", __FILE__, __LINE__));
+		d (fprintf(alog, "%s:%d (load_calendars) - Cannont get sources\n ", __FILE__, __LINE__));
 		priv->source_lists[source_type] = NULL;
 
 		return;
@@ -215,7 +215,7 @@ load_calendars (AlarmNotify *an, ECalSou
 				continue;
 			
 			uri = e_source_get_uri (source);
-			d (printf("%s:%d (load_calendars) - Loading Calendar %s \n", __FILE__, __LINE__, uri));			
+			d (fprintf(alog, "%s:%d (load_calendars) - Loading Calendar %s \n", __FILE__, __LINE__, uri));			
 			alarm_notify_add_calendar (an, source_type, source, FALSE);
 			g_free (uri);
 			
@@ -238,7 +238,7 @@ alarm_notify_init (AlarmNotify *an, Alar
 	priv->mutex = g_mutex_new ();
 	priv->selected_calendars = config_data_get_calendars ("/apps/evolution/calendar/sources");
 
-	d (printf("%s:%d (alarm_notify_init) - Initing Alarm Notify\n", __FILE__, __LINE__));
+	d (fprintf(alog, "%s:%d (alarm_notify_init) - Initing Alarm Notify\n", __FILE__, __LINE__));
 	
 	for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
 		priv->uri_client_hash[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
@@ -254,7 +254,7 @@ dequeue_client (gpointer key, gpointer v
 {
 	ECal *client = value;
 
-	d (printf("%s:%d (dequeue_client) - Removing client %p\n ", __FILE__, __LINE__, client));
+	d (fprintf(alog, "%s:%d (dequeue_client) - Removing client %p\n ", __FILE__, __LINE__, client));
 	alarm_queue_remove_client (client);
 }
 
@@ -269,7 +269,7 @@ alarm_notify_finalize (GObject *object)
 	g_return_if_fail (object != NULL);
 	g_return_if_fail (IS_ALARM_NOTIFY (object));
 	
-	d (printf("%s:%d (alarm_notify_finalize) - Finalize \n ", __FILE__, __LINE__));
+	d (fprintf(alog, "%s:%d (alarm_notify_finalize) - Finalize \n ", __FILE__, __LINE__));
 	
 	an = ALARM_NOTIFY (object);
 	priv = an->priv;
@@ -283,12 +283,14 @@ alarm_notify_finalize (GObject *object)
 
 	g_mutex_free (priv->mutex);
 	g_free (priv);
-
+	
 	e_thread_destroy(alarm_operation_thread);
 	g_io_channel_unref(alarm_reply_channel);
 	e_msgport_destroy(alarm_reply_port);
 	if (G_OBJECT_CLASS (parent_class)->finalize)
 		(* G_OBJECT_CLASS (parent_class)->finalize) (object);
+
+	fclose (alog);
 }
 
 
@@ -299,7 +301,7 @@ alarm_channel_setup(EMsgPort **port, GIO
 	GSource *source;
 	guint id;
 
-	d (printf("%s:%d (alarm_channel_setup) - Channel Setup\n ", __FILE__, __LINE__));
+	d (fprintf(alog, "%s:%d (alarm_channel_setup) - Channel Setup\n ", __FILE__, __LINE__));
 	*port = e_msgport_new();
 #ifndef G_OS_WIN32
 	*channel = g_io_channel_unix_new(e_msgport_fd(*port));
@@ -332,7 +334,7 @@ alarm_msgport_replied(GIOChannel *source
 	EMsg *m;
 
 	while (( m = e_msgport_get(port))) {
-		d (printf("%s:%d (alarm_msgport_replied) - %p: Replied to GUI thread\n", __FILE__, __LINE__, m));
+		d (fprintf(alog, "%s:%d (alarm_msgport_replied) - %p: Replied to GUI thread\n", __FILE__, __LINE__, m));
 		alarm_msg_destroy(NULL, m, NULL);
 	}
 
@@ -344,7 +346,7 @@ alarm_msg_received(EThread *e, EMsg *msg
 {
 	AlarmMsg *m = (AlarmMsg *)msg;
 	
-	d(printf("%s:%d (alarm_msg_received) - %p: Received at thread %" G_GINT64_MODIFIER "x\n", __FILE__, __LINE__, m, e_util_pthread_id(pthread_self())));	
+	d(fprintf(alog, "%s:%d (alarm_msg_received) - %p: Received at thread %" G_GINT64_MODIFIER "x\n", __FILE__, __LINE__, m, e_util_pthread_id(pthread_self())));	
 	if (m->receive_msg) {
 		m->receive_msg (e, m, data);
 	}
@@ -362,8 +364,13 @@ AlarmNotify *
 alarm_notify_new (void)
 {
 	AlarmNotify *an;
-	
-	d (printf("%s:%d (alarm_notify_new) - Alarm Notify New \n ", __FILE__, __LINE__));
+	char *path;
+
+	path = g_build_filename (g_get_home_dir (), ".evolution", "alarm.log", NULL); 
+	alog = fopen (path, "w");
+	g_free (path);
+
+	d (fprintf(alog, "%s:%d (alarm_notify_new) - Alarm Notify New \n ", __FILE__, __LINE__));
 
 	/* Create a thread for alarm queue operation*/	
 	alarm_channel_setup(&alarm_reply_port, &alarm_reply_channel, alarm_msgport_replied);
@@ -388,7 +395,7 @@ cal_opened_cb (ECal *client, ECalendarSt
 
 	priv = an->priv;
 	
-	d (printf("%s:%d (cal_opened_cb) - Calendar Status %d\n", __FILE__, __LINE__, status==E_CALENDAR_STATUS_OK));
+	d (fprintf(alog, "%s:%d (cal_opened_cb) - Calendar Status %d\n", __FILE__, __LINE__, status==E_CALENDAR_STATUS_OK));
 	
 	if (status == E_CALENDAR_STATUS_OK)
 		alarm_queue_add_client (client);
@@ -451,7 +458,7 @@ alarm_notify_add_calendar (AlarmNotify *
 	client = auth_new_cal_from_source (source, source_type);
 
 	if (client) {
-		d (printf("%s:%d (alarm_notify_add_calendar) - Calendar Open Async... %p\n", __FILE__, __LINE__, client));	
+		d (fprintf(alog, "%s:%d (alarm_notify_add_calendar) - Calendar Open Async... %p\n", __FILE__, __LINE__, client));	
 		g_hash_table_insert (priv->uri_client_hash[source_type], g_strdup (str_uri), client);
 		g_signal_connect (G_OBJECT (client), "cal_opened", G_CALLBACK (cal_opened_cb), an);
 		e_cal_open_async (client, FALSE);
@@ -471,7 +478,7 @@ alarm_notify_remove_calendar (AlarmNotif
 
 	client = g_hash_table_lookup (priv->uri_client_hash[source_type], str_uri);
 	if (client) {
-		d (printf("%s:%d (alarm_notify_remove_calendar) - Removing Client %p\n", __FILE__, __LINE__, client));
+		d (fprintf(alog, "%s:%d (alarm_notify_remove_calendar) - Removing Client %p\n", __FILE__, __LINE__, client));
 		alarm_queue_remove_client (client);
 		g_hash_table_remove (priv->uri_client_hash[source_type], str_uri);
 	}
Index: gui/alarm-notify/alarm-queue.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-queue.c,v
retrieving revision 1.105
diff -u -p -r1.105 alarm-queue.c
--- gui/alarm-notify/alarm-queue.c	30 Aug 2006 14:36:04 -0000	1.105
+++ gui/alarm-notify/alarm-queue.c	29 Sep 2006 16:40:13 -0000
@@ -83,7 +83,7 @@
 
 
 
-#define d(x) x
+#define d(x) x; fflush(alog);
 
 /* The dialog with alarm nofications */
 static AlarmNotificationsDialog *alarm_notifications_dialog = NULL;
@@ -117,6 +117,7 @@ static AlarmNotify *an;
 
 /* Main Tasks thread for dealing with the global structures */
 extern EThread *alarm_operation_thread;
+extern FILE *alog;
 
 /* Structure that stores a client we are monitoring */
 typedef struct {
@@ -215,11 +216,11 @@ queue_midnight_refresh (void)
 	zone = config_data_get_timezone ();
 	midnight = time_day_end_with_zone (time (NULL), zone);
 
-	d(printf("%s:%d (queue_midnight_refresh) - Refresh at %s \n",__FILE__, __LINE__, ctime(&midnight)));
+	d(fprintf(alog, "%s:%d (queue_midnight_refresh) - Refresh at %s \n",__FILE__, __LINE__, ctime(&midnight)));
 	
 	midnight_refresh_id = alarm_add (midnight, midnight_refresh_cb, NULL, NULL);
 	if (!midnight_refresh_id) {
-		 d(printf("%s:%d (queue_midnight_refresh) - Could not setup the midnight refresh alarm\n",__FILE__, __LINE__));
+		 d(fprintf(alog, "%s:%d (queue_midnight_refresh) - Could not setup the midnight refresh alarm\n",__FILE__, __LINE__));
 		/* FIXME: what to do? */
 	}
 }
@@ -230,7 +231,7 @@ add_client_alarms_cb (gpointer key, gpoi
 {
 	ClientAlarms *ca = (ClientAlarms *)data;
 	
-	d(printf("%s:%d (add_client_alarms_cb) - Adding %p\n",__FILE__, __LINE__, ca));
+	d(fprintf(alog, "%s:%d (add_client_alarms_cb) - Adding %p\n",__FILE__, __LINE__, ca));
 	
 	ca = value;
 	load_alarms_for_today (ca);
@@ -246,14 +247,14 @@ midnight_refresh_async (EThread *e, Alar
 {
 	struct _midnight_refresh_msg *list = msg->data;
 
-	d(printf("%s:%d (midnight_refresh_async) \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (midnight_refresh_async) \n",__FILE__, __LINE__));
 	
 	/* Re-load the alarms for all clients */
 	g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL);
 
 	/* Re-schedule the midnight update */
 	if (list->remove && midnight_refresh_id != NULL) {
-		d(printf("%s:%d (midnight_refresh_async) - Reschedule the midnight update \n",__FILE__, __LINE__)); 
+		d(fprintf(alog, "%s:%d (midnight_refresh_async) - Reschedule the midnight update \n",__FILE__, __LINE__)); 
 		alarm_remove (midnight_refresh_id);
 		midnight_refresh_id = NULL;
 	}
@@ -276,7 +277,7 @@ midnight_refresh_cb (gpointer alarm_id, 
 	list->remove = TRUE;
 	msg->data = list;
 
-	d(printf("%s:%d (midnight_refresh_cb) - Invoking task for midnight refresh\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (midnight_refresh_cb) - Invoking task for midnight refresh\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -316,7 +317,7 @@ remove_queued_alarm (CompQueuedAlarms *c
 	QueuedAlarm *qa=NULL;
 	GSList *l;
 
-	d(printf("%s:%d (remove_queued_alarm) \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (remove_queued_alarm) \n",__FILE__, __LINE__));
 
 	for (l = cqa->queued_alarms; l; l = l->next) {
 		qa = l->data;
@@ -345,7 +346,7 @@ remove_queued_alarm (CompQueuedAlarms *c
 	if (cqa->queued_alarms != NULL)
 		return FALSE;
 
-	d(printf("%s:%d (remove_queued_alarm) - Last Component. Removing CQA- Free=%d\n",__FILE__, __LINE__, free_object));
+	d(fprintf(alog, "%s:%d (remove_queued_alarm) - Last Component. Removing CQA- Free=%d\n",__FILE__, __LINE__, free_object));
 	if (free_object) {
 		cqa->id = NULL;
 		cqa->parent_client = NULL;
@@ -373,7 +374,7 @@ alarm_trigger_cb (gpointer alarm_id, tim
 	comp = cqa->alarms->comp;
 
 	config_data_set_last_notification_time (trigger);
-	d(printf("%s:%d (alarm_trigger_cb) - Setting Last notification time to %s\n",__FILE__, __LINE__, ctime (&trigger)));
+	d(fprintf(alog, "%s:%d (alarm_trigger_cb) - Setting Last notification time to %s\n",__FILE__, __LINE__, ctime (&trigger)));
 	saved_notification_time = trigger;
 
 	qa = lookup_queued_alarm (cqa, alarm_id);
@@ -417,7 +418,7 @@ alarm_trigger_cb (gpointer alarm_id, tim
 		g_assert_not_reached ();
 		break;
 	}
-	d(printf("%s:%d (alarm_trigger_cb) - Notification sent:%d\n",__FILE__, __LINE__, action));
+	d(fprintf(alog, "%s:%d (alarm_trigger_cb) - Notification sent:%d\n",__FILE__, __LINE__, action));
 }
 
 /* Adds the alarms in a ECalComponentAlarms structure to the alarms queued for a
@@ -432,7 +433,7 @@ add_component_alarms (ClientAlarms *ca, 
 
 	/* No alarms? */
 	if (alarms == NULL || alarms->alarms == NULL) {
-		d(printf("%s:%d (add_component_alarms) - No alarms to add\n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (add_component_alarms) - No alarms to add\n",__FILE__, __LINE__));
 		if (alarms)
 			e_cal_component_alarms_free (alarms);
 		return;
@@ -444,7 +445,7 @@ add_component_alarms (ClientAlarms *ca, 
 	cqa->expecting_update = FALSE;
 
 	cqa->queued_alarms = NULL;
-	d(printf("%s:%d (add_component_alarms) - Creating CQA %p\n",__FILE__, __LINE__, cqa));
+	d(fprintf(alog, "%s:%d (add_component_alarms) - Creating CQA %p\n",__FILE__, __LINE__, cqa));
 	
 	for (l = alarms->alarms; l; l = l->next) {
 		ECalComponentAlarmInstance *instance;
@@ -456,7 +457,7 @@ add_component_alarms (ClientAlarms *ca, 
 
 		alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL);
 		if (!alarm_id) {
-			d(printf("%s:%d (add_component_alarms) - Could not schedule a trigger for %s. Discarding \n",__FILE__, __LINE__, ctime(&(instance->trigger))));
+			d(fprintf(alog, "%s:%d (add_component_alarms) - Could not schedule a trigger for %s. Discarding \n",__FILE__, __LINE__, ctime(&(instance->trigger))));
 			continue;
 		}
 
@@ -467,7 +468,7 @@ add_component_alarms (ClientAlarms *ca, 
 		qa->snooze = FALSE;
 
 		cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa);
-		d(printf("%s:%d (add_component_alarms) - Adding alarm %p %p at %s %s\n",__FILE__, __LINE__, qa, alarm_id, ctime (&(instance->trigger)), ctime(&tnow)));
+		d(fprintf(alog, "%s:%d (add_component_alarms) - Adding alarm %p %p at %s %s\n",__FILE__, __LINE__, qa, alarm_id, ctime (&(instance->trigger)), ctime(&tnow)));
 	}
 
 	id = e_cal_component_get_id (alarms->comp);
@@ -476,7 +477,7 @@ add_component_alarms (ClientAlarms *ca, 
 	if (cqa->queued_alarms == NULL) {
 		e_cal_component_alarms_free (cqa->alarms);
 		cqa->alarms = NULL;
-		d(printf("%s:%d (add_component_alarms) - Failed to add all : %p\n",__FILE__, __LINE__, cqa));
+		d(fprintf(alog, "%s:%d (add_component_alarms) - Failed to add all : %p\n",__FILE__, __LINE__, cqa));
 		g_message ("Failed to add all\n");
 		g_free (cqa);
 		return;
@@ -484,7 +485,7 @@ add_component_alarms (ClientAlarms *ca, 
 
 	cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms);
 	cqa->id = id;
-	d(printf("%s:%d (add_component_alarms) - Alarm added for %s\n",__FILE__, __LINE__, id->uid));
+	d(fprintf(alog, "%s:%d (add_component_alarms) - Alarm added for %s\n",__FILE__, __LINE__, id->uid));
 	g_hash_table_insert (ca->uid_alarms_hash, cqa->id, cqa);
 }
 
@@ -494,7 +495,7 @@ load_alarms (ClientAlarms *ca, time_t st
 {
 	char *str_query, *iso_start, *iso_end;
 
-	d(printf("%s:%d (load_alarms) \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (load_alarms) \n",__FILE__, __LINE__));
 	
 	iso_start = isodate_from_time_t (start);
 	if (!iso_start)
@@ -513,7 +514,7 @@ load_alarms (ClientAlarms *ca, time_t st
 
 	/* create the live query */
 	if (ca->query) {
-		d(printf("%s:%d (load_alarms) - Disconnecting old queries \n",__FILE__, __LINE__));		
+		d(fprintf(alog, "%s:%d (load_alarms) - Disconnecting old queries \n",__FILE__, __LINE__));		
 		g_signal_handlers_disconnect_matched (ca->query, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ca);
 		g_object_unref (ca->query);
 		ca->query = NULL;
@@ -523,7 +524,7 @@ load_alarms (ClientAlarms *ca, time_t st
 	if (!e_cal_get_query (ca->client, str_query, &ca->query, NULL)) {
 		g_warning (G_STRLOC ": Could not get query for client");
 	} else {
-		d(printf("%s:%d (load_alarms) - Setting Call backs \n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (load_alarms) - Setting Call backs \n",__FILE__, __LINE__));
 		
 		g_signal_connect (G_OBJECT (ca->query), "objects_added",
 				  G_CALLBACK (query_objects_changed_cb), ca);
@@ -557,7 +558,7 @@ load_alarms_for_today (ClientAlarms *ca)
 	from = MAX (config_data_get_last_notification_time () + 1, day_start);
 
 	day_end = time_day_end_with_zone (now, zone);
-	d(printf("%s:%d (load_alarms_for_today) - From %s to %s\n",__FILE__, __LINE__, ctime (&from), ctime(&day_end)));	
+	d(fprintf(alog, "%s:%d (load_alarms_for_today) - From %s to %s\n",__FILE__, __LINE__, ctime (&from), ctime(&day_end)));	
 	load_alarms (ca, from, day_end);
 }
 
@@ -569,7 +570,7 @@ cal_opened_cb (ECal *client, ECalendarSt
 
 	ca = data;
 
-	d(printf("%s:%d (cal_opened_cb) - Opened Calendar %p (Status %d)\n",__FILE__, __LINE__, client, status==E_CALENDAR_STATUS_OK));
+	d(fprintf(alog, "%s:%d (cal_opened_cb) - Opened Calendar %p (Status %d)\n",__FILE__, __LINE__, client, status==E_CALENDAR_STATUS_OK));
 	if (status != E_CALENDAR_STATUS_OK)
 		return;
 
@@ -588,7 +589,7 @@ remove_alarms (CompQueuedAlarms *cqa, gb
 {
 	GSList *l;
 
-	d(printf("%s:%d (remove_alarms) - Removing for %p\n",__FILE__, __LINE__, cqa));
+	d(fprintf(alog, "%s:%d (remove_alarms) - Removing for %p\n",__FILE__, __LINE__, cqa));
 	for (l = cqa->queued_alarms; l;) {
 		QueuedAlarm *qa;
 
@@ -612,7 +613,7 @@ remove_comp (ClientAlarms *ca, ECalCompo
 {
 	CompQueuedAlarms *cqa;
 
-	d(printf("%s:%d (remove_comp) - Removing uid %s\n",__FILE__, __LINE__, id->uid));
+	d(fprintf(alog, "%s:%d (remove_comp) - Removing uid %s\n",__FILE__, __LINE__, id->uid));
 
 	if (id->rid && !(*(id->rid))) {
 		g_free (id->rid);
@@ -628,7 +629,7 @@ remove_comp (ClientAlarms *ca, ECalCompo
 	 */
 	g_assert (cqa->queued_alarms != NULL);
 	
-	d(printf("%s:%d (remove_comp) - Removing CQA %p\n",__FILE__, __LINE__, cqa));
+	d(fprintf(alog, "%s:%d (remove_comp) - Removing CQA %p\n",__FILE__, __LINE__, cqa));
 	remove_alarms (cqa, TRUE);
 }
 
@@ -696,7 +697,7 @@ query_objects_changed_async (EThread *e,
 
 	day_end = time_day_end_with_zone (time (NULL), zone);
 	
-	d(printf("%s:%d (query_objects_changed_async) - Querying for object between %s to %s\n",__FILE__, __LINE__, ctime(&from), ctime(&day_end)));
+	d(fprintf(alog, "%s:%d (query_objects_changed_async) - Querying for object between %s to %s\n",__FILE__, __LINE__, ctime(&from), ctime(&day_end)));
 	
 	for (l = objects; l != NULL; l = l->next) {
 		ECalComponentId *id;
@@ -709,7 +710,7 @@ query_objects_changed_async (EThread *e,
 		found = e_cal_get_alarms_for_object (ca->client, id, from, day_end, &alarms);
 
 		if (!found) {
-			d(printf("%s:%d (query_objects_changed_async) - No Alarm found for client %p\n",__FILE__, __LINE__, ca->client));
+			d(fprintf(alog, "%s:%d (query_objects_changed_async) - No Alarm found for client %p\n",__FILE__, __LINE__, ca->client));
 			tray_list_remove_cqa (lookup_comp_queued_alarms (ca, id));
 			remove_comp (ca, id);
 			g_hash_table_remove (ca->uid_alarms_hash, id);
@@ -721,14 +722,14 @@ query_objects_changed_async (EThread *e,
 
 		cqa = lookup_comp_queued_alarms (ca, id);
 		if (!cqa) {
-			d(printf("%s:%d (query_objects_changed_async) - No currently queued alarms for %s\n",__FILE__, __LINE__, id->uid));
+			d(fprintf(alog, "%s:%d (query_objects_changed_async) - No currently queued alarms for %s\n",__FILE__, __LINE__, id->uid));
 			add_component_alarms (ca, alarms);
 			g_object_unref (comp);
 			comp = NULL;
 			continue;
 		}
 
-		d(printf("%s:%d (query_objects_changed_async) - Alarm Already Exist for %s\n",__FILE__, __LINE__, id->uid));
+		d(fprintf(alog, "%s:%d (query_objects_changed_async) - Alarm Already Exist for %s\n",__FILE__, __LINE__, id->uid));
 		/* if the alarms or the alarms list is empty remove it after updating the cqa structure */
 		if (alarms == NULL || alarms->alarms == NULL) {
 		
@@ -755,7 +756,7 @@ query_objects_changed_async (EThread *e,
 
 			alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL);
 			if (!alarm_id) {
-				d(printf("%s:%d (query_objects_changed_async) -Unable to schedule trigger for %s \n",__FILE__, __LINE__, ctime(&(instance->trigger)))); 
+				d(fprintf(alog, "%s:%d (query_objects_changed_async) -Unable to schedule trigger for %s \n",__FILE__, __LINE__, ctime(&(instance->trigger)))); 
 				continue;
 			}
 
@@ -765,7 +766,7 @@ query_objects_changed_async (EThread *e,
 			qa->snooze = FALSE;
 			qa->orig_trigger = instance->trigger;	
 			cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa);
-			d(printf("%s:%d (query_objects_changed_async) - Adding %p to queue \n",__FILE__, __LINE__, qa));
+			d(fprintf(alog, "%s:%d (query_objects_changed_async) - Adding %p to queue \n",__FILE__, __LINE__, qa));
 		}
 		
 		cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms);
@@ -790,7 +791,7 @@ query_objects_changed_cb (ECal *client, 
 	list->data = data;
 	msg->data = list;
 
-	d(printf("%s:%d (query_objects_changed_cb) - Posting a task\n",__FILE__, __LINE__));	
+	d(fprintf(alog, "%s:%d (query_objects_changed_cb) - Posting a task\n",__FILE__, __LINE__));	
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 
 }
@@ -811,7 +812,7 @@ query_objects_removed_async (EThread *e,
 	ca = list->data;
 	objects = list->objects;
 	
-	d(printf("%s:%d (query_objects_removed_async) - Removing %d objects\n",__FILE__, __LINE__, g_list_length(objects)));
+	d(fprintf(alog, "%s:%d (query_objects_removed_async) - Removing %d objects\n",__FILE__, __LINE__, g_list_length(objects)));
 	
 	for (l = objects; l != NULL; l = l->next) { 
 		/* If the alarm is already triggered remove it. */
@@ -840,7 +841,7 @@ query_objects_removed_cb (ECal *client, 
 	list->data = data;	
 	msg->data = list;
 
-	d(printf("%s:%d (query_objects_removed_cb) - Posting a task\n",__FILE__, __LINE__));	
+	d(fprintf(alog, "%s:%d (query_objects_removed_cb) - Posting a task\n",__FILE__, __LINE__));	
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 
 }
@@ -867,14 +868,14 @@ create_snooze (CompQueuedAlarms *cqa, gp
 
 	new_id = alarm_add (t, alarm_trigger_cb, cqa, NULL);
 	if (!new_id) {
-		d(printf("%s:%d (create_snooze) -Unable to schedule trigger for %s \n",__FILE__, __LINE__, ctime(&t)));
+		d(fprintf(alog, "%s:%d (create_snooze) -Unable to schedule trigger for %s \n",__FILE__, __LINE__, ctime(&t)));
 		return;
 	}
 
 	orig_qa->instance->trigger = t;
 	orig_qa->alarm_id = new_id;
 	orig_qa->snooze = TRUE;
-	d(printf("%s:%d (create_snooze) - Adding a alarm at %s\n",__FILE__, __LINE__, ctime(&t)));
+	d(fprintf(alog, "%s:%d (create_snooze) - Adding a alarm at %s\n",__FILE__, __LINE__, ctime(&t)));
 }
 
 /* Launches a component editor for a component */
@@ -888,7 +889,7 @@ edit_component (ECal *client, ECalCompon
 	GNOME_Evolution_Calendar_CompEditorFactory factory;
 	GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type;
 
-	d(printf("%s:%d (edit_component) - Client %p\n",__FILE__, __LINE__, client));
+	d(fprintf(alog, "%s:%d (edit_component) - Client %p\n",__FILE__, __LINE__, client));
 	
 	e_cal_component_get_uid (comp, &uid);
 
@@ -998,7 +999,7 @@ on_dialog_objs_removed_async (EThread *e
 	ECal *client;
 	GList *objects;
 
-	d(printf("%s:%d (on_dialog_objs_removed_async)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (on_dialog_objs_removed_async)\n",__FILE__, __LINE__));
 	
 	client = list->client;
 	tray_data = list->data;
@@ -1038,7 +1039,7 @@ on_dialog_objs_removed_cb (ECal *client,
 	list->data = data;
 	msg->data = list;
 
-	d(printf("%s:%d (on_dialog_objs_removed_cb) - Posting a task \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (on_dialog_objs_removed_cb) - Posting a task \n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);	
 }
 
@@ -1053,7 +1054,7 @@ tray_list_remove_cqa_async(EThread *e, A
 	CompQueuedAlarms *cqa = tmsg->cqa;
 	GList *list = tray_icons_list;
 
-	d(printf("%s:%d (tray_list_remove_cqa_async) - Removing CQA %p from tray list\n",__FILE__, __LINE__, cqa));
+	d(fprintf(alog, "%s:%d (tray_list_remove_cqa_async) - Removing CQA %p from tray list\n",__FILE__, __LINE__, cqa));
 	
 	while (list) {
 		TrayIconData *tray_data = list->data;
@@ -1062,7 +1063,7 @@ tray_list_remove_cqa_async(EThread *e, A
 		
 		list = list->next;
 		if (tray_data->cqa == cqa) {
-			d(printf("%s:%d (tray_list_remove_cqa_async) - Found.\n", __FILE__, __LINE__));
+			d(fprintf(alog, "%s:%d (tray_list_remove_cqa_async) - Found.\n", __FILE__, __LINE__));
 			tray_icons_list = g_list_delete_link (tray_icons_list, tmp);
 			if (alarm_notifications_dialog) {
 				model = gtk_tree_view_get_model (GTK_TREE_VIEW (alarm_notifications_dialog->treeview));
@@ -1072,7 +1073,7 @@ tray_list_remove_cqa_async(EThread *e, A
 		}
 	}
 	
-	d(printf("%s:%d (tray_list_remove_cqa_async) - %d alarms left.\n", __FILE__, __LINE__, g_list_length (tray_icons_list)));
+	d(fprintf(alog, "%s:%d (tray_list_remove_cqa_async) - %d alarms left.\n", __FILE__, __LINE__, g_list_length (tray_icons_list)));
 	
 	if (alarm_notifications_dialog) {
 		if (!g_list_length (tray_icons_list)) {
@@ -1102,7 +1103,7 @@ tray_list_remove_cqa (CompQueuedAlarms *
 	list->cqa = cqa;
 	msg->data = list;
 
-	d(printf("%s:%d (tray_list_remove_cqa) - Posting a task\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (tray_list_remove_cqa) - Posting a task\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -1112,7 +1113,7 @@ tray_list_remove_async(EThread *e, Alarm
 {
 	GList *list = tray_icons_list;
 
-	d(printf("%s:%d (tray_list_remove_async) - Removing %d alarms\n",__FILE__, __LINE__, g_list_length(list)));
+	d(fprintf(alog, "%s:%d (tray_list_remove_async) - Removing %d alarms\n",__FILE__, __LINE__, g_list_length(list)));
 	while (list != NULL) {
 
 		TrayIconData *tray_data = list->data;
@@ -1151,7 +1152,7 @@ tray_list_remove_icons ()
 
 	msg->data = NULL;
 
-	d(printf("%s:%d (tray_list_remove_icons) - Posting a task\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (tray_list_remove_icons) - Posting a task\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -1165,7 +1166,7 @@ tray_list_remove_data_async(EThread *e, 
 	struct _tray_msg *tmsg = msg->data;
 	TrayIconData *tray_data = tmsg->data;
 
-	d(printf("%s:%d (tray_list_remove_data_async) - Removing %p from tray list\n",__FILE__, __LINE__, tray_data));
+	d(fprintf(alog, "%s:%d (tray_list_remove_data_async) - Removing %p from tray list\n",__FILE__, __LINE__, tray_data));
 	
 	tray_icons_list = g_list_remove_all (tray_icons_list, tray_data);
 	free_tray_icon_data (tray_data);
@@ -1185,7 +1186,7 @@ tray_list_remove_data (TrayIconData *dat
 	list->data = data;
 	msg->data = list;
 
-	d(printf("%s:%d (tray_list_remove_data) - Posting a task\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (tray_list_remove_data) - Posting a task\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -1194,14 +1195,14 @@ notify_dialog_cb (AlarmNotifyResult resu
 {
 	TrayIconData *tray_data = data;
 
-	d(printf("%s:%d (notify_dialog_cb) - Received from dialog\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (notify_dialog_cb) - Received from dialog\n",__FILE__, __LINE__));
 	
 	g_signal_handlers_disconnect_matched (tray_data->query, G_SIGNAL_MATCH_FUNC,
 					      0, 0, NULL, on_dialog_objs_removed_cb, NULL);
 
 	switch (result) {
 	case ALARM_NOTIFY_SNOOZE:
-		d(printf("%s:%d (notify_dialog_cb) - Creating a snooze\n",__FILE__, __LINE__)); 
+		d(fprintf(alog, "%s:%d (notify_dialog_cb) - Creating a snooze\n",__FILE__, __LINE__)); 
 		create_snooze (tray_data->cqa, tray_data->alarm_id, snooze_mins);
 		tray_data->snooze_set = TRUE;
 		tray_list_remove_data (tray_data);
@@ -1236,7 +1237,7 @@ notify_dialog_cb (AlarmNotifyResult resu
 		break;
 
 	case ALARM_NOTIFY_CLOSE:
-		d(printf("%s:%d (notify_dialog_cb) - Dialog close\n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (notify_dialog_cb) - Dialog close\n",__FILE__, __LINE__));
 		if (alarm_notifications_dialog) {
 			GtkTreeIter iter;
 			GtkTreeModel *model = 
@@ -1272,7 +1273,7 @@ open_alarm_dialog (TrayIconData *tray_da
 {
 	QueuedAlarm *qa;
 
-	d(printf("%s:%d (open_alarm_dialog) \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (open_alarm_dialog) \n",__FILE__, __LINE__));
 	qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id);
 	if (qa) {
 
@@ -1322,7 +1323,7 @@ static gint
 tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 {
 	if (event->type == GDK_BUTTON_PRESS) {
-			d(printf("%s:%d (tray_icon_clicked_cb) - left click and %d alarms\n",__FILE__, __LINE__, g_list_length (tray_icons_list))); 		 
+			d(fprintf(alog, "%s:%d (tray_icon_clicked_cb) - left click and %d alarms\n",__FILE__, __LINE__, g_list_length (tray_icons_list))); 		 
 		if (event->button == 1 && g_list_length (tray_icons_list) > 0) {
 			GList *tmp;
 			for (tmp = tray_icons_list; tmp; tmp = tmp->next) {
@@ -1331,7 +1332,7 @@ tray_icon_clicked_cb (GtkWidget *widget,
 			
 			return TRUE;
 		} else if (event->button == 3) {
-			d(printf("%s:%d (tray_icon_clicked_cb) - right click\n",__FILE__, __LINE__)); 
+			d(fprintf(alog, "%s:%d (tray_icon_clicked_cb) - right click\n",__FILE__, __LINE__)); 
 			if (tray_blink_id > -1)
 				g_source_remove (tray_blink_id);
 			tray_blink_id = -1;
@@ -1397,7 +1398,7 @@ static void
 tray_list_add_async (EThread *e, AlarmMsg *msg, void *data)
 {
 	struct _tray_msg *list = msg->data;
-	d(printf("%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, list->data));	
+	d(fprintf(alog, "%s:%d (tray_list_add_async) - Add %p\n",__FILE__, __LINE__, list->data));	
 	tray_icons_list = g_list_prepend (tray_icons_list, list->data);
 }
 
@@ -1415,7 +1416,7 @@ tray_list_add_new (TrayIconData *data)
 	list->data = data;
 	msg->data = list;
 	
-	d(printf("%s:%d (tray_list_add_new) - Posting a task\n",__FILE__, __LINE__));	
+	d(fprintf(alog, "%s:%d (tray_list_add_new) - Posting a task\n",__FILE__, __LINE__));	
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -1438,7 +1439,7 @@ display_notification (time_t trigger, Co
 	icaltimezone *current_zone;
 	ECalComponentOrganizer organiser;
 
-	d(printf("%s:%d (display_notification)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (display_notification)\n",__FILE__, __LINE__));
 	
 	comp = cqa->alarms->comp;
 	qa = lookup_queued_alarm (cqa, alarm_id);
@@ -1581,7 +1582,7 @@ popup_notification (time_t trigger, Comp
 	ECalComponentOrganizer organiser;
 	char *body;
 
-	d(printf("%s:%d (popup_notification)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (popup_notification)\n",__FILE__, __LINE__));
 	
 	comp = cqa->alarms->comp;
 	qa = lookup_queued_alarm (cqa, alarm_id);
@@ -1653,7 +1654,7 @@ audio_notification (time_t trigger, Comp
 	icalattach *attach;
 	int	flag = 0;
 
-	d(printf("%s:%d (audio_notification)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (audio_notification)\n",__FILE__, __LINE__));
 	
 	comp = cqa->alarms->comp;
 	qa = lookup_queued_alarm (cqa, alarm_id);
@@ -1694,7 +1695,7 @@ mail_notification (time_t trigger, CompQ
 
 	/* FIXME */
 
-	d(printf("%s:%d (mail_notification)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (mail_notification)\n",__FILE__, __LINE__));
 	
 	dialog = gtk_dialog_new_with_buttons (_("Warning"),
 					      NULL, 0,
@@ -1719,7 +1720,7 @@ procedure_notification_dialog (const cha
 	char *str;
 	int btn;
 
-	d(printf("%s:%d (procedure_notification_dialog)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (procedure_notification_dialog)\n",__FILE__, __LINE__));
 	
 	if (config_data_is_blessed_program (url))
 		return TRUE;
@@ -1770,7 +1771,7 @@ procedure_notification (time_t trigger, 
 	char *cmd;
 	int result;
 
-	d(printf("%s:%d (procedure_notification)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (procedure_notification)\n",__FILE__, __LINE__));
 	
 	comp = cqa->alarms->comp;
 	qa = lookup_queued_alarm (cqa, alarm_id);
@@ -1830,7 +1831,7 @@ check_midnight_refresh (gpointer user_da
 	time_t new_midnight;
 	icaltimezone *zone;
 
-	d(printf("%s:%d (check_midnight_refresh)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (check_midnight_refresh)\n",__FILE__, __LINE__));
 	
 	zone = config_data_get_timezone ();
 	new_midnight = time_day_end_with_zone (time (NULL), zone);
@@ -1849,7 +1850,7 @@ check_midnight_refresh (gpointer user_da
 		/* We dont need it. So set it to NULL */
 		msg->data = list;
 
-		d(printf("%s:%d (check_midnight_refresh) - Posting a task to refresh\n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (check_midnight_refresh) - Posting a task to refresh\n",__FILE__, __LINE__));
 		e_thread_put(alarm_operation_thread, (EMsg *)msg);		
 	}
 
@@ -1868,7 +1869,7 @@ alarm_queue_init (gpointer data)
 	an = data;
 	g_return_if_fail (alarm_queue_inited == FALSE);
 
-	d(printf("%s:%d (alarm_queue_init)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (alarm_queue_init)\n",__FILE__, __LINE__));
 	
 	client_alarms_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
 	queue_midnight_refresh ();
@@ -1876,7 +1877,7 @@ alarm_queue_init (gpointer data)
 	saved_notification_time = config_data_get_last_notification_time ();
 	if (saved_notification_time == -1) {
 		saved_notification_time = time (NULL);
-		d(printf("%s:%d (alarm_queue_init) - Setting last notification time to %s\n",__FILE__, __LINE__, ctime(&saved_notification_time)));
+		d(fprintf(alog, "%s:%d (alarm_queue_init) - Setting last notification time to %s\n",__FILE__, __LINE__, ctime(&saved_notification_time)));
 		config_data_set_last_notification_time (saved_notification_time);
 	}
 
@@ -1895,12 +1896,12 @@ free_client_alarms_cb (gpointer key, gpo
 {
 	ClientAlarms *ca = value;
 
-	d(printf("%s:%d (free_client_alarms_cb) - %p\n",__FILE__, __LINE__, ca));
+	d(fprintf(alog, "%s:%d (free_client_alarms_cb) - %p\n",__FILE__, __LINE__, ca));
 	
 	if (ca) {
 		remove_client_alarms (ca);
 		if (ca->client) {
-			d(printf("%s:%d (free_client_alarms_cb) - Disconnecting Client \n",__FILE__, __LINE__));
+			d(fprintf(alog, "%s:%d (free_client_alarms_cb) - Disconnecting Client \n",__FILE__, __LINE__));
 						
 			g_signal_handlers_disconnect_matched (ca->client, G_SIGNAL_MATCH_DATA,
 							      0, 0, NULL, NULL, ca);
@@ -1908,7 +1909,7 @@ free_client_alarms_cb (gpointer key, gpo
 		}
 
 		if (ca->query) {
-			d(printf("%s:%d (free_client_alarms_cb) - Disconnecting Query \n",__FILE__, __LINE__));
+			d(fprintf(alog, "%s:%d (free_client_alarms_cb) - Disconnecting Query \n",__FILE__, __LINE__));
 			
 			g_signal_handlers_disconnect_matched (ca->query, G_SIGNAL_MATCH_DATA,
 							      0, 0, NULL, NULL, ca);
@@ -1939,7 +1940,7 @@ alarm_queue_done (void)
 	/* All clients must be unregistered by now */
 	g_return_if_fail (g_hash_table_size (client_alarms_hash) == 0);
 
-	d(printf("%s:%d (alarm_queue_done)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (alarm_queue_done)\n",__FILE__, __LINE__));
 	
 	g_hash_table_foreach_remove (client_alarms_hash, (GHRFunc) free_client_alarms_cb, NULL);
 	g_hash_table_destroy (client_alarms_hash);
@@ -2001,7 +2002,7 @@ static void alarm_queue_add_async (EThre
 		return;
 	}
 
-	d(printf("%s:%d (alarm_queue_add_async) - %p\n",__FILE__, __LINE__, client));
+	d(fprintf(alog, "%s:%d (alarm_queue_add_async) - %p\n",__FILE__, __LINE__, client));
 	
 	ca = g_new (ClientAlarms, 1);
 
@@ -2050,7 +2051,7 @@ alarm_queue_add_client (ECal *client)
 	g_object_ref (client);
 	msg->data = list;
 
-	d(printf("%s:%d (alarm_queue_add_client) - Posting a task\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (alarm_queue_add_client) - Posting a task\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -2064,7 +2065,7 @@ remove_cqa (ClientAlarms *ca, ECalCompon
 	 */
 	g_assert (cqa->queued_alarms != NULL);
 
-	d(printf("%s:%d (remove_cqa) - removing %d alarms\n",__FILE__, __LINE__, g_slist_length(cqa->queued_alarms)));
+	d(fprintf(alog, "%s:%d (remove_cqa) - removing %d alarms\n",__FILE__, __LINE__, g_slist_length(cqa->queued_alarms)));
 	remove_alarms (cqa, TRUE);
 }
 
@@ -2073,7 +2074,7 @@ remove_comp_by_id (gpointer key, gpointe
 
 	ClientAlarms *ca = (ClientAlarms *)userdata;
 	
-	d(printf("%s:%d (remove_comp_by_id)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (remove_comp_by_id)\n",__FILE__, __LINE__));
 	
 /* 	if (!g_hash_table_size (ca->uid_alarms_hash)) */
 /* 		return; */
@@ -2088,7 +2089,7 @@ remove_comp_by_id (gpointer key, gpointe
 static void
 remove_client_alarms (ClientAlarms *ca)
 {
-	d(printf("%s:%d (remove_client_alarms) - size %d \n",__FILE__, __LINE__, g_hash_table_size (ca->uid_alarms_hash))); 
+	d(fprintf(alog, "%s:%d (remove_client_alarms) - size %d \n",__FILE__, __LINE__, g_hash_table_size (ca->uid_alarms_hash))); 
 
 	g_hash_table_foreach_remove  (ca->uid_alarms_hash, (GHRFunc)remove_comp_by_id, ca);
 	
@@ -2116,12 +2117,12 @@ alarm_queue_remove_async (EThread *e, Al
 	ca = lookup_client (client);
 	g_return_if_fail (ca != NULL);
 
-	d(printf("%s:%d (alarm_queue_remove_async) \n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (alarm_queue_remove_async) \n",__FILE__, __LINE__));
 	remove_client_alarms (ca);
 
 	/* Clean up */
 	if (ca->client) {
-		d(printf("%s:%d (alarm_queue_remove_async) - Disconnecting Client \n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (alarm_queue_remove_async) - Disconnecting Client \n",__FILE__, __LINE__));
 		
 		g_signal_handlers_disconnect_matched (ca->client, G_SIGNAL_MATCH_DATA,
 						      0, 0, NULL, NULL, ca);
@@ -2130,7 +2131,7 @@ alarm_queue_remove_async (EThread *e, Al
 	}
 
 	if (ca->query) {
-		d(printf("%s:%d (alarm_queue_remove_async) - Disconnecting Query \n",__FILE__, __LINE__));
+		d(fprintf(alog, "%s:%d (alarm_queue_remove_async) - Disconnecting Query \n",__FILE__, __LINE__));
 			
 		g_signal_handlers_disconnect_matched (ca->query, G_SIGNAL_MATCH_DATA,
 						      0, 0, NULL, NULL, ca);
@@ -2160,7 +2161,7 @@ alarm_queue_remove_client (ECal *client)
 	list->client = client;
 	msg->data = list;
 
-	d(printf("%s:%d (alarm_queue_remove_client) - Posting a task\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (alarm_queue_remove_client) - Posting a task\n",__FILE__, __LINE__));
 	e_thread_put(alarm_operation_thread, (EMsg *)msg);
 }
 
@@ -2182,7 +2183,7 @@ update_cqa (CompQueuedAlarms *cqa, ECalC
 	from = time_day_begin_with_zone (time (NULL), zone);
 	to = time_day_end_with_zone (time (NULL), zone);
 
-	d(printf("%s:%d (update_cqa) - Generating alarms between %s and %s\n",__FILE__, __LINE__, ctime(&from), ctime(&to)));
+	d(fprintf(alog, "%s:%d (update_cqa) - Generating alarms between %s and %s\n",__FILE__, __LINE__, ctime(&from), ctime(&to)));
 	alarms = e_cal_util_generate_alarms_for_comp (newcomp, from, to, omit, 
 					e_cal_resolve_tzid_cb, cqa->parent_client->client, zone);
 
@@ -2196,7 +2197,7 @@ update_cqa (CompQueuedAlarms *cqa, ECalC
 		else {
 			if (e_cal_component_get_alarm (oldcomp, check_auid)) { /* Need to update QueuedAlarms */
 				if (alarms == NULL) {
-					d(printf("%s:%d (update_cqa) - No alarms found in the modified component\n",__FILE__, __LINE__)); 
+					d(fprintf(alog, "%s:%d (update_cqa) - No alarms found in the modified component\n",__FILE__, __LINE__)); 
 					break;
 				}
 				update_qa (alarms, qa);
@@ -2219,7 +2220,7 @@ update_qa (ECalComponentAlarms *alarms, 
 	ECalComponentAlarmInstance *al_inst;
 	GSList *instance_list;
 
-	d(printf("%s:%d (update_qa)\n",__FILE__, __LINE__));
+	d(fprintf(alog, "%s:%d (update_qa)\n",__FILE__, __LINE__));
 	for (instance_list = alarms->alarms; instance_list; instance_list = instance_list->next) {
 		al_inst = instance_list->data;
 		if (al_inst->trigger == qa->orig_trigger) {  /* FIXME if two or more alarm instances (audio, note) 									  for same component have same trigger */
Index: gui/alarm-notify/alarm.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm.c,v
retrieving revision 1.36
diff -u -p -r1.36 alarm.c
--- gui/alarm-notify/alarm.c	21 Apr 2006 19:38:16 -0000	1.36
+++ gui/alarm-notify/alarm.c	29 Sep 2006 16:40:14 -0000
@@ -46,7 +46,9 @@ typedef struct {
 } AlarmRecord;
 
 static void setup_timeout (void);
+extern FILE *alog;
 
+#define d(x) x; fflush(alog);
 
 
 /* Removes the head alarm from the queue.  Does not touch the timeout_id. */
@@ -77,7 +79,8 @@ alarm_ready_cb (gpointer data)
 
 	now = time (NULL);
 
-	g_message ("Alarm callback!");
+	d(fprintf(alog, "%s(%d):%s: Alarm callback! \n", __FILE__, __LINE__, __PRETTY_FUNCTION__));
+	
 	while (alarms) {
 		AlarmRecord *notify_id, *ar;
 		AlarmRecord ar_copy;
@@ -87,7 +90,7 @@ alarm_ready_cb (gpointer data)
 		if (ar->trigger > now)
 			break;
 
-		g_message ("Process alarm with trigger %lu", ar->trigger);
+		d(fprintf(alog, "%s(%d):%s: Process alarm with trigger %lu \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ar->trigger));
 		notify_id = ar;
 
 		ar_copy = *ar;
@@ -136,9 +139,9 @@ setup_timeout (void)
 	now = time (NULL);
 	
 	/* Add the time out */
-	g_message ("Setting timeout for %d %lu %lu", diff, ar->trigger, now);
-	g_message (" %s", ctime (&ar->trigger));
-	g_message (" %s", ctime (&now));
+	d(fprintf(alog, "%s(%d):%s: Setting timeout for %d %lu %lu \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, diff, ar->trigger, now)); 
+	d(fprintf(alog, "%s(%d):%s: %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ctime (&ar->trigger)));
+	d(fprintf(alog, "%s(%d):%s: %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ctime (&now)));
 	timeout_id = g_timeout_add (diff * 1000, alarm_ready_cb, NULL);
 	
 }
@@ -232,7 +235,7 @@ alarm_remove (gpointer alarm)
 
 	l = g_list_find (alarms, ar);
 	if (!l) {
-		g_message (G_STRLOC ": Requested removal of nonexistent alarm!");
+		 d(fprintf(alog, "%s(%d):%s: Requested removal of nonexistent alarm! \n", __FILE__, __LINE__, __PRETTY_FUNCTION__));
 		return;
 	}
 
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.172
diff -u -p -r1.172 comp-editor.c
--- gui/dialogs/comp-editor.c	10 Aug 2006 07:34:30 -0000	1.172
+++ gui/dialogs/comp-editor.c	29 Sep 2006 16:40:21 -0000
@@ -1278,6 +1278,48 @@ menu_file_save_cb (BonoboUIComponent *ui
 }
 
 static void
+menu_file_print_cb (BonoboUIComponent *uic,
+		   void *data,
+		   const char *path)
+{
+	CompEditor *editor = (CompEditor *) data;
+	CompEditorPrivate *priv = editor->priv;
+	ECalComponent *comp;
+	GList *l;
+	icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+	
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+
+	for (l = priv->pages; l != NULL; l = l->next)
+		 comp_editor_page_fill_component (l->data, comp);
+	
+	print_comp (comp, priv->client, FALSE);
+
+	g_object_unref (comp);	
+}
+
+static void
+menu_file_print_preview_cb (BonoboUIComponent *uic,
+		   void *data,
+		   const char *path)
+{
+	CompEditor *editor = (CompEditor *) data;
+	CompEditorPrivate *priv = editor->priv;
+	ECalComponent *comp;
+	GList *l;
+	icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+	
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+	for (l = priv->pages; l != NULL; l = l->next)
+		 comp_editor_page_fill_component (l->data, comp);	
+	print_comp (comp, priv->client, TRUE);
+
+	g_object_unref (comp);	
+}
+
+static void
 menu_file_close_cb (BonoboUIComponent *uic,
 		   void *data,
 		   const char *path)
@@ -1398,6 +1440,8 @@ menu_help_cb (BonoboUIComponent *uic,
 static BonoboUIVerb verbs [] = {
 
 	BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
+	BONOBO_UI_VERB ("CalendarPrint", menu_file_print_cb),
+	BONOBO_UI_VERB ("CalendarPrintPreview", menu_file_print_preview_cb),		
 	BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
 
 	BONOBO_UI_VERB ("EditCopy", menu_edit_copy_cb),
