aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Heyn Olsen <eskil@src.gnome.org>1999-12-31 23:58:08 +0800
committerEskil Heyn Olsen <eskil@src.gnome.org>1999-12-31 23:58:08 +0800
commiteb7c5ae3c5fa9ab3bab2a60d7a0c8a5a4ed93cb7 (patch)
treebc250c8cc8679635d972d3f847291882f02bc062
parent0948bfda86d63a09c5b5c9661911e963cc750357 (diff)
downloadgsoc2013-evolution-eb7c5ae3c5fa9ab3bab2a60d7a0c8a5a4ed93cb7.tar.gz
gsoc2013-evolution-eb7c5ae3c5fa9ab3bab2a60d7a0c8a5a4ed93cb7.tar.zst
gsoc2013-evolution-eb7c5ae3c5fa9ab3bab2a60d7a0c8a5a4ed93cb7.zip
Committed fixes for the end-on-day recurrence bug where the last
day was skipped. Also fixed problem with multiple setitimer calls that where especially pesky in the corba part, where corba calls would cause numerous alarm dialogs when the events alarm went off. svn path=/trunk/; revision=1525
-rw-r--r--calendar/ChangeLog25
-rw-r--r--calendar/calendar-pilot-sync.c2
-rw-r--r--calendar/calendar.c8
-rw-r--r--calendar/calendar.h7
-rw-r--r--calendar/corba-cal.c2
-rw-r--r--calendar/eventedit.c11
-rw-r--r--calendar/gnome-cal.c2
-rw-r--r--calendar/gui/calendar-pilot-sync.c2
-rw-r--r--calendar/gui/calendar.c8
-rw-r--r--calendar/gui/calendar.h7
-rw-r--r--calendar/gui/corba-cal.c2
-rw-r--r--calendar/gui/eventedit.c11
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/main.c4
-rw-r--r--calendar/main.c4
15 files changed, 71 insertions, 26 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 616db438da..b5be27f69b 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,28 @@
+1999-12-31 Eskil Heyn Olsen <deity@eskil.dk>
+
+ * eventedit.c (ee_store_recur_end_to_ical): Adds 86400 secs (1
+ day) to the date chooses by the user. This ensures the recurrence
+ also occurs on that date.
+ (ee_rp_init_ending_date): And subtracts 86400 secs when about to
+ redisplay the box.
+
+ * calendar.h: Added an argument to calendar_new, to enable certain
+ features, such as initing alarms or nor.
+
+ * calendar.c (calendar_new): Implemented support for the
+ CALENDAR_INIT_ALARMS option to calendar_new.
+
+ * corba-cal.c (cal_repo_get_updated_objects): Added
+ CALENDAR_INIT_ALARMS to calendar_new calls.
+
+ * main.c: Added CALENDAR_INIT_ALARMS to calendar_new calls. This
+ should probably be CALENDAR_INIT_NIL, but I'm not sure, guess
+ steintr should check it.
+
+ * gnome-cal.c: Added CALENDAR_INIT_ALARMS to calendar_new calls.
+
+ * calendar-pilot-sync.c: Added CALENDAR_INIT_NIL to calendar_new calls.
+
1999-12-10 Russell Steinthal <rms39@columbia.edu>
* eventedit.c (ee_create_ae): Fix sensitivity bug when used to
diff --git a/calendar/calendar-pilot-sync.c b/calendar/calendar-pilot-sync.c
index a98ff9b49b..5039bb37b7 100644
--- a/calendar/calendar-pilot-sync.c
+++ b/calendar/calendar-pilot-sync.c
@@ -605,7 +605,7 @@ sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
*/
if (!only_pilot_to_desktop){
vcalendar_string = GNOME_Calendar_Repository_get_updated_objects (repo, &ev);
- dirty_cal = calendar_new ("Temporal");
+ dirty_cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
error = calendar_load_from_memory (dirty_cal, vcalendar_string);
if (!error)
sync_cal_to_pilot (repo, dirty_cal, pilot_fd);
diff --git a/calendar/calendar.c b/calendar/calendar.c
index 0fbecaf6f6..db31ba016b 100644
--- a/calendar/calendar.c
+++ b/calendar/calendar.c
@@ -33,7 +33,7 @@ static void calendar_init_alarms (Calendar *cal);
static void calendar_set_day (void);
Calendar *
-calendar_new (char *title)
+calendar_new (char *title,CalendarNewOptions options)
{
Calendar *cal;
@@ -46,7 +46,9 @@ calendar_new (char *title)
cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
- calendar_init_alarms (cal);
+ if (options & CALENDAR_INIT_ALARMS) {
+ calendar_init_alarms (cal);
+ }
return cal;
}
@@ -633,7 +635,7 @@ calendar_string_from_object (iCalObject *object)
g_return_val_if_fail (object != NULL, NULL);
- cal = calendar_new ("Temporal");
+ cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
calendar_add_object (cal, object);
str = calendar_get_as_vcal_string (cal);
calendar_remove_object (cal, object);
diff --git a/calendar/calendar.h b/calendar/calendar.h
index 4a9d4bcff2..858f0151ca 100644
--- a/calendar/calendar.h
+++ b/calendar/calendar.h
@@ -41,7 +41,12 @@ typedef struct {
iCalObject *ico;
} CalendarObject;
-Calendar *calendar_new (char *title);
+typedef enum {
+ CALENDAR_INIT_NIL = 0,
+ CALENDAR_INIT_ALARMS = 1 << 0
+} CalendarNewOptions;
+
+Calendar *calendar_new (char *title,CalendarNewOptions options);
char *calendar_get_as_vcal_string (Calendar *cal);
char *calendar_string_from_object (iCalObject *object);
diff --git a/calendar/corba-cal.c b/calendar/corba-cal.c
index 472d83008e..2a3a727869 100644
--- a/calendar/corba-cal.c
+++ b/calendar/corba-cal.c
@@ -251,7 +251,7 @@ cal_repo_get_updated_objects (PortableServer_Servant servant,
CORBA_char *res;
char *str;
- dirty_cal = calendar_new ("Temporal");
+ dirty_cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
for (l = gcal->cal->events; l; l = l->next){
iCalObject *obj = l->data;
diff --git a/calendar/eventedit.c b/calendar/eventedit.c
index 5b45674d00..31fbf11225 100644
--- a/calendar/eventedit.c
+++ b/calendar/eventedit.c
@@ -650,7 +650,9 @@ ee_store_recur_end_to_ical (EventEditor *ee)
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 @@ ee_rp_init_ending_date (EventEditor *ee)
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 --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index 9b3479e473..387d46a31c 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -227,7 +227,7 @@ gnome_calendar_new (char *title)
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 (title,CALENDAR_INIT_ALARMS);
setup_widgets (gcal);
gnome_calendar_create_corba_server (gcal);
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
index a98ff9b49b..5039bb37b7 100644
--- a/calendar/gui/calendar-pilot-sync.c
+++ b/calendar/gui/calendar-pilot-sync.c
@@ -605,7 +605,7 @@ sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
*/
if (!only_pilot_to_desktop){
vcalendar_string = GNOME_Calendar_Repository_get_updated_objects (repo, &ev);
- dirty_cal = calendar_new ("Temporal");
+ dirty_cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
error = calendar_load_from_memory (dirty_cal, vcalendar_string);
if (!error)
sync_cal_to_pilot (repo, dirty_cal, pilot_fd);
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index 0fbecaf6f6..db31ba016b 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -33,7 +33,7 @@ static void calendar_init_alarms (Calendar *cal);
static void calendar_set_day (void);
Calendar *
-calendar_new (char *title)
+calendar_new (char *title,CalendarNewOptions options)
{
Calendar *cal;
@@ -46,7 +46,9 @@ calendar_new (char *title)
cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
- calendar_init_alarms (cal);
+ if (options & CALENDAR_INIT_ALARMS) {
+ calendar_init_alarms (cal);
+ }
return cal;
}
@@ -633,7 +635,7 @@ calendar_string_from_object (iCalObject *object)
g_return_val_if_fail (object != NULL, NULL);
- cal = calendar_new ("Temporal");
+ cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
calendar_add_object (cal, object);
str = calendar_get_as_vcal_string (cal);
calendar_remove_object (cal, object);
diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h
index 4a9d4bcff2..858f0151ca 100644
--- a/calendar/gui/calendar.h
+++ b/calendar/gui/calendar.h
@@ -41,7 +41,12 @@ typedef struct {
iCalObject *ico;
} CalendarObject;
-Calendar *calendar_new (char *title);
+typedef enum {
+ CALENDAR_INIT_NIL = 0,
+ CALENDAR_INIT_ALARMS = 1 << 0
+} CalendarNewOptions;
+
+Calendar *calendar_new (char *title,CalendarNewOptions options);
char *calendar_get_as_vcal_string (Calendar *cal);
char *calendar_string_from_object (iCalObject *object);
diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c
index 472d83008e..2a3a727869 100644
--- a/calendar/gui/corba-cal.c
+++ b/calendar/gui/corba-cal.c
@@ -251,7 +251,7 @@ cal_repo_get_updated_objects (PortableServer_Servant servant,
CORBA_char *res;
char *str;
- dirty_cal = calendar_new ("Temporal");
+ dirty_cal = calendar_new ("Temporal",CALENDAR_INIT_NIL);
for (l = gcal->cal->events; l; l = l->next){
iCalObject *obj = l->data;
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index 5b45674d00..31fbf11225 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -650,7 +650,9 @@ ee_store_recur_end_to_ical (EventEditor *ee)
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 @@ ee_rp_init_ending_date (EventEditor *ee)
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 --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 9b3479e473..387d46a31c 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -227,7 +227,7 @@ gnome_calendar_new (char *title)
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 (title,CALENDAR_INIT_ALARMS);
setup_widgets (gcal);
gnome_calendar_create_corba_server (gcal);
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 98157d101d..9dead6b92e 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -788,7 +788,7 @@ dump_events (void)
process_dates ();
init_calendar ();
- cal = calendar_new (full_name);
+ cal = calendar_new (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 @@ dump_todo (void)
process_dates ();
init_calendar ();
- cal = calendar_new (full_name);
+ cal = calendar_new (full_name, CALENDAR_INIT_ALARMS);
s = calendar_load (cal, load_file ? load_file : user_calendar_file);
if (s){
printf ("error: %s\n", s);
diff --git a/calendar/main.c b/calendar/main.c
index 98157d101d..9dead6b92e 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -788,7 +788,7 @@ dump_events (void)
process_dates ();
init_calendar ();
- cal = calendar_new (full_name);
+ cal = calendar_new (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 @@ dump_todo (void)
process_dates ();
init_calendar ();
- cal = calendar_new (full_name);
+ cal = calendar_new (full_name, CALENDAR_INIT_ALARMS);
s = calendar_load (cal, load_file ? load_file : user_calendar_file);
if (s){
printf ("error: %s\n", s);