New patches



Oy...

This patch fixes both problems ;

For the end-of-recurrence, I now do +/- 86400 in eventedit (can this be
done by the gtk_date widget ?), to facilitate hitting the correct end
date. This does not help existing entries.

For the alarm patch, I kept the calendar_new, it does not call init_alarms
anymore, and introduced a calendar_new_with_options, which as second
argument take a enum which can be |'ed connected arguments. Currently only
one for initializing the alarms is in calendar.h (dunno if there is a
opinion against using enums this way as opposed to using #defines).

In the code, I've replaced almost all occurences of calendar_new with
calendar_new_with_options(...,CALENDAR_INIT_ALARMS), so alarms should work
as before, just fewer setitimer calls when doing corba stuff.


Here's the patch

diff -u gnome-pim/gncal/ChangeLog gnome-pim-patched/gncal/ChangeLog
--- gnome-pim/gncal/ChangeLog	Wed Dec 29 16:35:39 1999
+++ gnome-pim-patched/gncal/ChangeLog	Wed Dec 22 17:02:16 1999
@@ -1,19 +1,3 @@
-1999-12-29  Eskil Heyn Olsen  <deity@eskil.dk>
-
-	* gnome-cal.c (gnome_calendar_new): Use the new
- 	calendar_new_with_options call.
-
-	* main.c (dump_events) (dump_todo): Use the new
- 	calendar_new_with_options call. 
-
-	* eventedit.c (ee_rp_init_ending_date)
-	(ee_store_recur_end_to_ical): +/- 86400 to make end-on-date
-	recurrence hit the correct date.
-
-	* calendar.c (calendar_new_with_options): Made a new calendar_new, 
-	that takes options for the new calendar. Currently, the only
-	option is the INIT_ALARMS.
-
 1999-12-10  Russell Steinthal  <rms39@columbia.edu>
 
 	* eventedit.c (ee_create_ae): Fix sensitivity bug when used to
diff -u gnome-pim/gncal/calendar.c gnome-pim-patched/gncal/calendar.c
--- gnome-pim/gncal/calendar.c	Thu Nov 11 07:09:32 1999
+++ gnome-pim-patched/gncal/calendar.c	Wed Dec 29 16:09:39 1999
@@ -46,7 +46,18 @@
 
 	cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
 	
-	calendar_init_alarms (cal);
+	return cal;
+}
+
+Calendar *
+calendar_new_with_options (char *title,CalendarNewOptions options)
+{
+	Calendar *cal;
+	cal = calendar_new(title);
+	
+	if ( options & CALENDAR_INIT_ALARMS ) {
+		calendar_init_alarms (cal);
+	}
 	
 	return cal;
 }
diff -u gnome-pim/gncal/calendar.h gnome-pim-patched/gncal/calendar.h
--- gnome-pim/gncal/calendar.h	Thu Jul 29 06:25:08 1999
+++ gnome-pim-patched/gncal/calendar.h	Wed Dec 29 15:03:38 1999
@@ -41,7 +41,12 @@
 	iCalObject *ico;
 } CalendarObject;
 
+typedef enum {
+	CALENDAR_INIT_ALARMS = 0x1
+} CalendarNewOptions;
+
 Calendar *calendar_new                  (char *title);
+Calendar *calendar_new_with_options     (char *title,CalendarNewOptions options);
 char     *calendar_get_as_vcal_string   (Calendar *cal);
 char     *calendar_string_from_object   (iCalObject *object);
 
diff -u gnome-pim/gncal/eventedit.c gnome-pim-patched/gncal/eventedit.c
--- gnome-pim/gncal/eventedit.c	Fri Dec 10 18:58:43 1999
+++ gnome-pim-patched/gncal/eventedit.c	Wed Dec 29 15:50:14 1999
@@ -650,7 +650,9 @@
 
 	case 1:
 		/* end date */
-		ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on));
+		/* Also here, to ensure that the event is used, we add 86400 secs to get 
+		   get next day, in accordance to the RFC */
+		ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on)) + 86400;
 		ical->recur->enddate = ical->recur->_enddate;
 		ical->recur->duration = 0;
 		break;
@@ -1247,9 +1249,10 @@
 	gtk_widget_set_sensitive (ihbox, FALSE);
 	gtk_box_pack_start (GTK_BOX (hbox), ihbox, FALSE, FALSE, 0);
 
-	if (ee->ical->recur)
-		enddate = ee->ical->recur->enddate;
-	else
+	if (ee->ical->recur) {
+		/* Shorten by one day, as we store end-on date a day ahead */
+		enddate = ee->ical->recur->enddate - 86400;
+	} else
 		enddate = ee->ical->dtend;
 
 	ee->recur_ed_end_on = widget = date_edit_new (enddate, FALSE);
diff -u gnome-pim/gncal/gnome-cal.c gnome-pim-patched/gncal/gnome-cal.c
--- gnome-pim/gncal/gnome-cal.c	Fri Dec  3 01:55:01 1999
+++ gnome-pim-patched/gncal/gnome-cal.c	Wed Dec 29 04:47:10 1999
@@ -227,7 +227,7 @@
 	gtk_window_set_title(GTK_WINDOW(retval), title);
 
 	gcal->current_display = time_day_begin (time (NULL));
-	gcal->cal = calendar_new (title);
+	gcal->cal = calendar_new_with_options (title,CALENDAR_INIT_ALARMS);
 	setup_widgets (gcal);
 	gnome_calendar_create_corba_server (gcal);
 
diff -u gnome-pim/gncal/main.c gnome-pim-patched/gncal/main.c
--- gnome-pim/gncal/main.c	Wed Dec 29 16:29:13 1999
+++ gnome-pim-patched/gncal/main.c	Wed Dec 29 16:39:31 1999
@@ -788,7 +788,7 @@
 	process_dates ();
 	init_calendar ();
 
-	cal = calendar_new (full_name);
+	cal = calendar_new_with_options (full_name, CALENDAR_INIT_ALARMS);
 	s = calendar_load (cal, load_file ? load_file : user_calendar_file);
 	if (s){
 		printf ("error: %s\n", s);
@@ -832,7 +832,7 @@
 	process_dates ();
 	init_calendar ();
 
-	cal = calendar_new (full_name);
+	cal = calendar_new_with_options (full_name, CALENDAR_INIT_ALARMS);
 	s = calendar_load (cal, load_file ? load_file : user_calendar_file);
 	if (s){
 		printf ("error: %s\n", s);

/dev/eskil
---



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