From e4e894969ece81b2ed434c7d66e4b2d1b42244d3 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Thu, 25 Oct 2001 23:28:15 +0000 Subject: subtract 1 from any positive BYSETPOS value, since our array is 0-based. 2001-10-25 Damon Chaplin * cal-util/cal-recur.c (cal_obj_bysetpos_filter): subtract 1 from any positive BYSETPOS value, since our array is 0-based. * gui/dialogs/recurrence-page.c (simple_recur_to_comp): (recurrence_page_fill_widgets): Outlook (2000) will not accept monthly recurrences like BYDAY=2TU. Instead it uses BYDAY=TU;BYSETPOS=2. So to be compatable with it we now do the same, although we still accept and convert the old format. * cal-client/cal-client.c (cal_client_get_component_as_string): new function to return a complete VCALENDAR string containing a VEVENT or VTODO with all the VTIMEZONEs it uses. * gui/dialogs/comp-editor.c (save_as_ok): use above function so we save the VTIMEZONE data with the VEVENT/VTODO. Fixes bug #????. Also made sure we output "METHOD:PUBLISH" since Outlook (2000) will not import it otherwise. * gui/dialogs/comp-editor.c (page_mapped_cb): (page_unmapped_cb): install/uninstall the GtkAccelGroup for the page. (comp_editor_append_page): connect to the map/unmap signals to install/uninstall the accelerators. (This is all for bug #11609, though of course it doesn't work too well in GTK+ 1.2 anyway.) * gui/dialogs/task-page.c (get_widgets): * gui/dialogs/task-details-page.c (get_widgets): * gui/dialogs/schedule-page.c (get_widgets): * gui/dialogs/recurrence-page.c (get_widgets): * gui/dialogs/meeting-page.c (get_widgets): * gui/dialogs/event-page.c (get_widgets): * gui/dialogs/alarm-page.c (get_widgets): got the GtkAccelGroup from the original window, ref'ed it and placed it in the CompEditorPage struct. * gui/dialogs/comp-editor-page.c (comp_editor_page_destroy): unref any GtkAccelGroup for the page. * gui/dialogs/task-page.glade: changed '_Confidential' to 'Con_fidential' as it clashed with '_Contacts'. It now matches the event editor as well. * gui/dialogs/event-page.glade: * gui/dialogs/task-page.glade: Set CAN_FOCUS to TRUE for the custom EDateEdit widgets, and set them as the accel targets of the labels. svn path=/trunk/; revision=14108 --- calendar/gui/dialogs/comp-editor.c | 70 ++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 26 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index bcb104fe85..077bff879c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -461,6 +461,36 @@ comp_editor_get_needs_send (CompEditor *editor) return priv->needs_send; } +static void page_mapped_cb (GtkWidget *page_widget, + CompEditorPage *page) +{ + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (page_widget); + if (!GTK_IS_WINDOW (toplevel)) + return; + + if (page->accel_group) { + gtk_window_add_accel_group (GTK_WINDOW (toplevel), + page->accel_group); + } +} + +static void page_unmapped_cb (GtkWidget *page_widget, + CompEditorPage *page) +{ + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (page_widget); + if (!GTK_IS_WINDOW (toplevel)) + return; + + if (page->accel_group) { + gtk_window_remove_accel_group (GTK_WINDOW (toplevel), + page->accel_group); + } +} + /** * comp_editor_append_page: * @editor: A component editor @@ -518,6 +548,13 @@ comp_editor_append_page (CompEditor *editor, gtk_signal_connect (GTK_OBJECT (page), "dates_changed", GTK_SIGNAL_FUNC (page_dates_changed_cb), editor); + /* Listen for when the page is mapped/unmapped so we can + install/uninstall the appropriate GtkAccelGroup. */ + gtk_signal_connect (GTK_OBJECT (page_widget), "map", + GTK_SIGNAL_FUNC (page_mapped_cb), page); + gtk_signal_connect (GTK_OBJECT (page_widget), "unmap", + GTK_SIGNAL_FUNC (page_unmapped_cb), page); + /* The first page is the main page of the editor, so we ask it to focus * its main widget. */ @@ -1023,32 +1060,12 @@ save_as_ok (GtkWidget *widget, gpointer data) FILE *file; gchar *ical_string; - icalcomponent *top_level; - icalcomponent *icalcomp; - icalproperty *prop; - - top_level = icalcomponent_new (ICAL_VCALENDAR_COMPONENT); - - /* RFC 2445, section 4.7.1 */ - prop = icalproperty_new_calscale ("GREGORIAN"); - icalcomponent_add_property (top_level, prop); - - /* RFC 2445, section 4.7.3 */ - prop = icalproperty_new_prodid ("-//Ximian//NONSGML Evolution Calendar//EN"); - icalcomponent_add_property (top_level, prop); - - /* RFC 2445, section 4.7.4. This is the iCalendar spec version, *NOT* - * the product version! Do not change this! - */ - prop = icalproperty_new_version ("2.0"); - icalcomponent_add_property (top_level, prop); - - icalcomp = cal_component_get_icalcomponent (priv->comp); - g_assert (icalcomp != NULL); - - icalcomponent_add_component (top_level, icalcomp); - - ical_string = icalcomponent_as_ical_string (top_level); + ical_string = cal_client_get_component_as_string (priv->client, priv->comp); + if (ical_string == NULL) { + g_warning ("Couldn't convert item to a string"); + gtk_main_quit (); + return; + } file = fopen (path, "w"); if (file == NULL) { @@ -1058,6 +1075,7 @@ save_as_ok (GtkWidget *widget, gpointer data) } fprintf (file, ical_string); + g_free (ical_string); fclose (file); gtk_main_quit (); -- cgit v1.2.3