From f8cb586400f551b3ade8594890a6ffdd991ae673 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 16 May 2000 16:35:44 +0000 Subject: hook the radio buttons to the pages of the notebook. (append_exception): * gui/event-editor.c (recurrence_toggled): hook the radio buttons to the pages of the notebook. (append_exception): (recurrence_exception_added): (recurrence_exception_deleted): (recurrence_exception_changed): code to deal with the recurrence exception list. * gui/event-editor.[ch]: gladeified replacement for eventedit.c * gui/event-editor-utils.[ch]: utilities used by event-editor.c * gui/event-editor-dialog.glade: glade file used by event-editor.c svn path=/trunk/; revision=3092 --- calendar/ChangeLog | 18 ++++ calendar/gui/event-editor-dialog.glade | 149 ++++++++++++++++++++------------- calendar/gui/event-editor.c | 121 +++++++++++++++++++++++++- 3 files changed, 229 insertions(+), 59 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4810a7bbc0..b485ac04f1 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +2000-05-16 Seth Alves + + * gui/event-editor.c (recurrence_toggled): hook the radio buttons + to the pages of the notebook. + (append_exception): + (recurrence_exception_added): + (recurrence_exception_deleted): + (recurrence_exception_changed): code to deal with the recurrence + exception list. + +2000-05-15 Seth Alves + + * gui/event-editor.[ch]: gladeified replacement for eventedit.c + + * gui/event-editor-utils.[ch]: utilities used by event-editor.c + + * gui/event-editor-dialog.glade: glade file used by event-editor.c + 2000-05-14 Federico Mena Quintero * gui/gnome-cal.c (display_notification): Use the alarm diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade index 72bb7bbd98..2c00501978 100644 --- a/calendar/gui/event-editor-dialog.glade +++ b/calendar/gui/event-editor-dialog.glade @@ -1004,8 +1004,7 @@ Days GtkNotebook recurrence-rule-notebook - True - True + False True GTK_POS_TOP False @@ -1692,7 +1691,7 @@ Sunday GTK_SHADOW_ETCHED_IN 0 - True + False True @@ -1753,7 +1752,7 @@ Sunday Sat, 13 May 2000 18:02:55 GMT 0 - True + False True @@ -1836,19 +1835,33 @@ Sunday GTK_SHADOW_ETCHED_IN 0 - False + True True - GtkHBox - hbox11 + GtkVBox + vbox12 False 0 - GtkVBox - vbox6 + Custom + recurrence-exceptions-date + make_date_edit + 0 + 0 + Tue, 16 May 2000 01:42:29 GMT + + 0 + True + True + + + + + GtkHBox + hbox21 False 0 @@ -1858,66 +1871,90 @@ Sunday - Custom - recurrence-exceptions-date - make_date_edit - 0 - 0 - Sat, 13 May 2000 18:04:39 GMT + GtkVBox + vbox13 + False + 0 0 - True + False True - - - GtkButton - recurrence-exceptions-add - True - - - 0 - False - False - - + + GtkButton + recurrence-exceptions-add + True + + + 0 + False + False + + - - GtkButton - recurrence-exceptions-change - True - - - 0 - False - False - + + GtkButton + recurrence-exceptions-change + True + + + 0 + False + False + + + + + GtkButton + recurrence-exceptions-delete + True + + + 0 + False + False + + - GtkButton - recurrence-exceptions-delete - True - + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS 0 - False - False + True + True - - - - GtkList - recurrence-exceptions-list - 40 - GTK_SELECTION_SINGLE - - 0 - True - True - + + GtkCList + recurrence-exceptions-list + True + 1 + 80 + GTK_SELECTION_SINGLE + False + GTK_SHADOW_IN + + + GtkLabel + CList:title + label40 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 50d6c8a346..f4e0255375 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -20,11 +20,14 @@ extern int am_pm_flag; extern int week_starts_on_monday; +static void append_exception (EventEditorDialog *dialog, time_t t); + static void fill_in_dialog_from_ical (EventEditorDialog *dialog) { iCalObject *ical = dialog->ical; GladeXML *gui = dialog->gui; + GList *list; store_to_editable (gui, "general-owner", dialog->ical->organizer->addr ? @@ -130,6 +133,11 @@ fill_in_dialog_from_ical (EventEditorDialog *dialog) store_to_gnome_dateedit (gui, "recurrence-ending-date-end-on-date", ical->recur->enddate - 86400); } /* else repeat forever */ + + + /* fill the exceptions list */ + for (list = ical->exdate; list; list = list->next) + append_exception (dialog, *((time_t *) list->data)); } @@ -262,6 +270,18 @@ dialog_to_ical (EventEditorDialog *dialog) ical->recur->duration = extract_from_spin (gui, "recurrence-ending-date-end-after-count"); ical_object_compute_end (ical); } + + + /* get exceptions from clist into ical->exdate */ + { + int i; + time_t *t; + GtkCList *exception_list = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list")); + for (i = 0; i < exception_list->rows; i++) { + t = gtk_clist_get_row_data (exception_list, i); + ical->exdate = g_list_prepend (ical->exdate, t); + } + } } @@ -314,6 +334,90 @@ recurrence_toggled (GtkWidget *radio, EventEditorDialog *dialog) } +static char * +get_exception_string (time_t t) +{ + static char buf[256]; + + strftime (buf, sizeof(buf), _("%a %b %d %Y"), localtime (&t)); + return buf; +} + + +static void +append_exception (EventEditorDialog *dialog, time_t t) +{ + time_t *tt; + char *c[1]; + int i; + GtkCList *exception_list = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list")); + + c[0] = get_exception_string (t); + + tt = g_new (time_t, 1); + *tt = t; + + i = gtk_clist_append (exception_list, c); + gtk_clist_set_row_data (exception_list, i, tt); + gtk_clist_select_row (exception_list, i, 0); + + //gtk_widget_set_sensitive (ee->recur_ex_vbox, TRUE); +} + + +static void +recurrence_exception_added (GtkWidget *widget, EventEditorDialog *dialog) +{ + //GtkWidget *exception_date = glade_xml_get_widget (dialog->gui, "recurrence-exceptions-date"); + time_t t = extract_from_gnome_dateedit (dialog->gui, "recurrence-exceptions-date"); + append_exception (dialog, t); +} + + +static void +recurrence_exception_deleted (GtkWidget *widget, EventEditorDialog *dialog) +{ + GtkCList *clist; + int sel, length; + + clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list")); + if (! clist->selection) + return; + sel = GPOINTER_TO_INT(clist->selection->data); + + g_free (gtk_clist_get_row_data (clist, sel)); /* free the time_t stored there */ + + gtk_clist_remove (clist, sel); + length = g_list_length(clist->row_list); + if (sel >= length) + sel--; + gtk_clist_select_row (clist, sel, 0); + + //if (clist->rows == 0) + // gtk_widget_set_sensitive (ee->recur_ex_vbox, FALSE); +} + + +static void +recurrence_exception_changed (GtkWidget *widget, EventEditorDialog *dialog) +{ + GtkCList *clist; + time_t *t; + int sel; + + clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list")); + if (! clist->selection) + return; + + sel = GPOINTER_TO_INT(clist->selection->data); + + t = gtk_clist_get_row_data (clist, sel); + *t = extract_from_gnome_dateedit (dialog->gui, "recurrence-exceptions-date"); + + gtk_clist_set_text (clist, sel, 0, get_exception_string (*t)); +} + + GtkWidget *event_editor_new (GnomeCalendar *gcal, iCalObject *ical) { @@ -359,6 +463,20 @@ GtkWidget *event_editor_new (GnomeCalendar *gcal, iCalObject *ical) } + { + GtkWidget *recurrence_exception_add = glade_xml_get_widget (dialog->gui, "recurrence-exceptions-add"); + GtkWidget *recurrence_exception_delete = glade_xml_get_widget (dialog->gui, "recurrence-exceptions-delete"); + GtkWidget *recurrence_exception_change = glade_xml_get_widget (dialog->gui, "recurrence-exceptions-change"); + + gtk_signal_connect (GTK_OBJECT (recurrence_exception_add), "clicked", + GTK_SIGNAL_FUNC (recurrence_exception_added), dialog); + gtk_signal_connect (GTK_OBJECT (recurrence_exception_delete), "clicked", + GTK_SIGNAL_FUNC (recurrence_exception_deleted), dialog); + gtk_signal_connect (GTK_OBJECT (recurrence_exception_change), "clicked", + GTK_SIGNAL_FUNC (recurrence_exception_changed), dialog); + } + + if (ical->new) fill_in_dialog_from_defaults (dialog); @@ -431,8 +549,5 @@ make_spin_button (int val, int low, int high) figure out why alarm units aren't sticking between edits extract from and store to the ending date in the recurrence rule stuff - - finish the recurrence rule exceptions - */ -- cgit v1.2.3