From 1f3958dbd1fef814f3c7d655ff6f4bfbbf8229bd Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Fri, 12 Feb 1999 01:27:52 +0000 Subject: Gnomecal now autosaves all the time. Gnomecal now autosaves all the time. Miguel. svn path=/trunk/; revision=662 --- calendar/ChangeLog | 11 +++++++++++ calendar/eventedit.c | 1 + calendar/gncal-day-panel.c | 1 + calendar/gncal-full-day.c | 10 ++++++++-- calendar/gncal-todo.c | 4 +++- calendar/gui/eventedit.c | 1 + calendar/gui/gncal-day-panel.c | 1 + calendar/gui/gncal-full-day.c | 10 ++++++++-- calendar/gui/gncal-todo.c | 4 +++- calendar/gui/main.c | 12 ++++++++++++ calendar/gui/main.h | 1 + calendar/main.c | 12 ++++++++++++ calendar/main.h | 1 + 13 files changed, 63 insertions(+), 6 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a2f218d048..6c40222a54 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +1999-02-11 Miguel de Icaza + + * main.c (save_default_calendar): New function. Saves the + calendar if it is the user's default calendar + + * gncal-full-day.c (unrecur_appointment): + * gncal-day-panel.c (day_view_range_activated): + * eventedit.c (ee_ok): + * gncal-todo.c (ok_button): Added autosave for the default + calendar. + 1999-02-09 Tomas Ogren * main.c: Removed the gtk_widget_realize call. diff --git a/calendar/eventedit.c b/calendar/eventedit.c index 1d0236cb1c..15a33d92ea 100644 --- a/calendar/eventedit.c +++ b/calendar/eventedit.c @@ -729,6 +729,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) else gnome_calendar_object_changed (ee->gnome_cal, ee->ical, CHANGE_ALL); + save_default_calendar (ee->gnome_cal); ee->ical->new = 0; } diff --git a/calendar/gncal-day-panel.c b/calendar/gncal-day-panel.c index b847cf8168..ba6ac2bdfe 100644 --- a/calendar/gncal-day-panel.c +++ b/calendar/gncal-day-panel.c @@ -44,6 +44,7 @@ day_view_range_activated (GncalFullDay *fullday, GncalDayPanel *dpanel) gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend); gnome_calendar_add_object (dpanel->calendar, ical); + save_default_calendar (dpanel->calendar); gncal_full_day_focus_child (fullday, ical); } diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index c33cb2ed31..f813f1598c 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -431,13 +431,15 @@ delete_occurance (GtkWidget *widget, gpointer data) Child *child; iCalObject *ical; time_t *t; - + GnomeCalendar *gcal = GNCAL_FULL_DAY (child->widget->parent)->calendar; + child = data; ical = child->ico; t = g_new(time_t, 1); *t = child->start; ical->exdate = g_list_prepend(ical->exdate, t); - gnome_calendar_object_changed(GNCAL_FULL_DAY (child->widget->parent)->calendar, child->ico, CHANGE_DATES); + gnome_calendar_object_changed (gcal, child->ico, CHANGE_DATES); + save_default_calendar (gcal); } @@ -452,6 +454,7 @@ delete_appointment (GtkWidget *widget, gpointer data) fullday = GNCAL_FULL_DAY (child->widget->parent); gnome_calendar_remove_object (fullday->calendar, child->ico); + save_default_calendar (fullday->calendar); } static void @@ -476,6 +479,7 @@ unrecur_appointment (GtkWidget *widget, gpointer data) gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_ALL); gnome_calendar_add_object (fullday->calendar, new); + save_default_calendar (fullday->calendar); } static void @@ -629,6 +633,7 @@ child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data) fullday = GNCAL_FULL_DAY (widget->parent); gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_SUMMARY); + save_default_calendar (fullday->calendar); return FALSE; } @@ -1827,6 +1832,7 @@ update_from_drag_info (GncalFullDay *fullday) /* Notify calendar of change */ gnome_calendar_object_changed (fullday->calendar, di->child->ico, CHANGE_DATES); + save_default_calendar (fullday->calendar); } static gint diff --git a/calendar/gncal-todo.c b/calendar/gncal-todo.c index 33e596b203..a78bd9432b 100644 --- a/calendar/gncal-todo.c +++ b/calendar/gncal-todo.c @@ -59,9 +59,10 @@ ok_button (GtkWidget *widget, GnomeDialog *dialog) if (ico->new) { gnome_calendar_add_object (todo->calendar, ico); ico->new = FALSE; - } else + } else gnome_calendar_object_changed (todo->calendar, ico, CHANGE_ALL); /* ok, summary only... */ + save_default_calendar (todo->calendar); gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -170,6 +171,7 @@ static void delete_todo (GncalTodo *todo) { gnome_calendar_remove_object (todo->calendar, get_clist_selected_ico (todo->clist)); + save_default_calendar (todo->calendar); } static void diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index 1d0236cb1c..15a33d92ea 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -729,6 +729,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) else gnome_calendar_object_changed (ee->gnome_cal, ee->ical, CHANGE_ALL); + save_default_calendar (ee->gnome_cal); ee->ical->new = 0; } diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c index b847cf8168..ba6ac2bdfe 100644 --- a/calendar/gui/gncal-day-panel.c +++ b/calendar/gui/gncal-day-panel.c @@ -44,6 +44,7 @@ day_view_range_activated (GncalFullDay *fullday, GncalDayPanel *dpanel) gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend); gnome_calendar_add_object (dpanel->calendar, ical); + save_default_calendar (dpanel->calendar); gncal_full_day_focus_child (fullday, ical); } diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c index c33cb2ed31..f813f1598c 100644 --- a/calendar/gui/gncal-full-day.c +++ b/calendar/gui/gncal-full-day.c @@ -431,13 +431,15 @@ delete_occurance (GtkWidget *widget, gpointer data) Child *child; iCalObject *ical; time_t *t; - + GnomeCalendar *gcal = GNCAL_FULL_DAY (child->widget->parent)->calendar; + child = data; ical = child->ico; t = g_new(time_t, 1); *t = child->start; ical->exdate = g_list_prepend(ical->exdate, t); - gnome_calendar_object_changed(GNCAL_FULL_DAY (child->widget->parent)->calendar, child->ico, CHANGE_DATES); + gnome_calendar_object_changed (gcal, child->ico, CHANGE_DATES); + save_default_calendar (gcal); } @@ -452,6 +454,7 @@ delete_appointment (GtkWidget *widget, gpointer data) fullday = GNCAL_FULL_DAY (child->widget->parent); gnome_calendar_remove_object (fullday->calendar, child->ico); + save_default_calendar (fullday->calendar); } static void @@ -476,6 +479,7 @@ unrecur_appointment (GtkWidget *widget, gpointer data) gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_ALL); gnome_calendar_add_object (fullday->calendar, new); + save_default_calendar (fullday->calendar); } static void @@ -629,6 +633,7 @@ child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data) fullday = GNCAL_FULL_DAY (widget->parent); gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_SUMMARY); + save_default_calendar (fullday->calendar); return FALSE; } @@ -1827,6 +1832,7 @@ update_from_drag_info (GncalFullDay *fullday) /* Notify calendar of change */ gnome_calendar_object_changed (fullday->calendar, di->child->ico, CHANGE_DATES); + save_default_calendar (fullday->calendar); } static gint diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c index 33e596b203..a78bd9432b 100644 --- a/calendar/gui/gncal-todo.c +++ b/calendar/gui/gncal-todo.c @@ -59,9 +59,10 @@ ok_button (GtkWidget *widget, GnomeDialog *dialog) if (ico->new) { gnome_calendar_add_object (todo->calendar, ico); ico->new = FALSE; - } else + } else gnome_calendar_object_changed (todo->calendar, ico, CHANGE_ALL); /* ok, summary only... */ + save_default_calendar (todo->calendar); gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -170,6 +171,7 @@ static void delete_todo (GncalTodo *todo) { gnome_calendar_remove_object (todo->calendar, get_clist_selected_ico (todo->clist)); + save_default_calendar (todo->calendar); } static void diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 19cebcd8c8..be26bcff46 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -426,6 +426,18 @@ save_calendar_cmd (GtkWidget *widget, void *data) save_as_calendar_cmd (widget, data); } +/* + * Saves @gcal if it is the default calendar + */ +void +save_default_calendar (GnomeCalendar *gcal) +{ + if (!gcal->cal->filename) + return; + + save_calendar_cmd (NULL, gcal); +} + static GnomeUIInfo gnome_cal_file_menu [] = { GNOMEUIINFO_MENU_NEW_ITEM(N_("_New calendar"), N_("Create a new calendar"), diff --git a/calendar/gui/main.h b/calendar/gui/main.h index 615b372acf..476349f3aa 100644 --- a/calendar/gui/main.h +++ b/calendar/gui/main.h @@ -56,5 +56,6 @@ void parse_color_spec (char *spec, int *r, int *g, int *b); /* Calls build_color_spec() for the color in the specified property number */ char *color_spec_from_prop (ColorProp propnum); +void save_default_calendar (GnomeCalendar *gcal); #endif diff --git a/calendar/main.c b/calendar/main.c index 19cebcd8c8..be26bcff46 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -426,6 +426,18 @@ save_calendar_cmd (GtkWidget *widget, void *data) save_as_calendar_cmd (widget, data); } +/* + * Saves @gcal if it is the default calendar + */ +void +save_default_calendar (GnomeCalendar *gcal) +{ + if (!gcal->cal->filename) + return; + + save_calendar_cmd (NULL, gcal); +} + static GnomeUIInfo gnome_cal_file_menu [] = { GNOMEUIINFO_MENU_NEW_ITEM(N_("_New calendar"), N_("Create a new calendar"), diff --git a/calendar/main.h b/calendar/main.h index 615b372acf..476349f3aa 100644 --- a/calendar/main.h +++ b/calendar/main.h @@ -56,5 +56,6 @@ void parse_color_spec (char *spec, int *r, int *g, int *b); /* Calls build_color_spec() for the color in the specified property number */ char *color_spec_from_prop (ColorProp propnum); +void save_default_calendar (GnomeCalendar *gcal); #endif -- cgit