From 9717e6f9efc0f5acfb0c15e576a703e02c0cd753 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 2 Jun 2000 05:48:02 +0000 Subject: Implemented. (gnome_calendar_add_object): Removed function, since it was 2000-06-02 Federico Mena Quintero * gui/gnome-cal.c (save_ical_object_cb): Implemented. (gnome_calendar_add_object): Removed function, since it was identical to gnome_calendar_update_object(). Modified the rest of the code to use only the latter. (gnome_calendar_remove_object): Be more paranoid about the UID. (gnome_calendar_update_object): Ditto. Also, renamed this function from gnome_calendar_object_changed(), for consistency with the lower-level CalClient interface. * gui/event-editor.c (event_editor_class_init): New "save_ical_object" signal to ask that our parent store the calendar object to the backend. (save_ical_object): New function to save the calendar object, actually if just emits the signal. (file_save_cb): Implemented. (dialog_to_ical_object): We want priv-> alarm_program_run_program_entry (i.e. the entry inside the GnomeFileEntry), not the file entry itself. (dialog_to_ical_object): Only insert the recurrence ending date if the event is recurrent! svn path=/trunk/; revision=3380 --- calendar/gui/gnome-cal.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e97947cbf0..e6e7082666 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1014,14 +1014,15 @@ gnome_calendar_open (GnomeCalendar *gcal, return 1; } - void -gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj) +gnome_calendar_update_object (GnomeCalendar *gcal, iCalObject *obj) { char *obj_string; + g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); g_return_if_fail (obj != NULL); + g_return_if_fail (obj->uid != NULL); obj_string = ical_object_to_string (obj); cal_client_update_object (gcal->client, obj->uid, obj_string); @@ -1036,23 +1037,11 @@ gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj) g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); g_return_if_fail (obj != NULL); + g_return_if_fail (obj->uid != NULL); r = cal_client_remove_object (gcal->client, obj->uid); } -void -gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj) -{ - char *obj_string; - g_return_if_fail (gcal != NULL); - g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - g_return_if_fail (obj != NULL); - - obj_string = ical_object_to_string (obj); - cal_client_update_object (gcal->client, obj->uid, obj_string); - g_free (obj_string); -} - static void stop_beeping (GtkObject* object, gpointer data) { @@ -1334,6 +1323,16 @@ editor_closed_cb (EventEditor *ee, gpointer data) gtk_object_unref (GTK_OBJECT (ee)); } +/* Callback used when an event editor requests that an object be saved */ +static void +save_ical_object_cb (EventEditor *ee, iCalObject *ico, gpointer data) +{ + GnomeCalendar *gcal; + + gcal = GNOME_CALENDAR (data); + gnome_calendar_update_object (gcal, ico); +} + void gnome_calendar_edit_object (GnomeCalendar *gcal, iCalObject *ico) { @@ -1363,6 +1362,9 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, iCalObject *ico) gtk_signal_connect (GTK_OBJECT (ee), "editor_closed", GTK_SIGNAL_FUNC (editor_closed_cb), gcal); + gtk_signal_connect (GTK_OBJECT (ee), "save_ical_object", + GTK_SIGNAL_FUNC (save_ical_object_cb), gcal); + event_editor_set_ical_object (EVENT_EDITOR (ee), ico); } -- cgit v1.2.3