aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-05-17 00:35:44 +0800
committerSeth Alves <alves@src.gnome.org>2000-05-17 00:35:44 +0800
commitf8cb586400f551b3ade8594890a6ffdd991ae673 (patch)
treed0fcd82709701a520efb8289d203c4e33dc33592 /calendar
parent68ef3f9f9873e2629f0953f0b5380fdce9a5dd05 (diff)
downloadgsoc2013-evolution-f8cb586400f551b3ade8594890a6ffdd991ae673.tar.gz
gsoc2013-evolution-f8cb586400f551b3ade8594890a6ffdd991ae673.tar.zst
gsoc2013-evolution-f8cb586400f551b3ade8594890a6ffdd991ae673.zip
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
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/gui/event-editor-dialog.glade149
-rw-r--r--calendar/gui/event-editor.c121
3 files changed, 229 insertions, 59 deletions
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 <alves@hungry.com>
+
+ * 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 <alves@hungry.com>
+
+ * 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 <federico@helixcode.com>
* 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
<widget>
<class>GtkNotebook</class>
<name>recurrence-rule-notebook</name>
- <can_focus>True</can_focus>
- <show_tabs>True</show_tabs>
+ <show_tabs>False</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
@@ -1692,7 +1691,7 @@ Sunday
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>True</expand>
+ <expand>False</expand>
<fill>True</fill>
</child>
@@ -1753,7 +1752,7 @@ Sunday
<last_modification_time>Sat, 13 May 2000 18:02:55 GMT</last_modification_time>
<child>
<padding>0</padding>
- <expand>True</expand>
+ <expand>False</expand>
<fill>True</fill>
</child>
</widget>
@@ -1836,19 +1835,33 @@ Sunday
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>False</expand>
+ <expand>True</expand>
<fill>True</fill>
</child>
<widget>
- <class>GtkHBox</class>
- <name>hbox11</name>
+ <class>GtkVBox</class>
+ <name>vbox12</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
- <class>GtkVBox</class>
- <name>vbox6</name>
+ <class>Custom</class>
+ <name>recurrence-exceptions-date</name>
+ <creation_function>make_date_edit</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Tue, 16 May 2000 01:42:29 GMT</last_modification_time>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox21</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
@@ -1858,66 +1871,90 @@ Sunday
</child>
<widget>
- <class>Custom</class>
- <name>recurrence-exceptions-date</name>
- <creation_function>make_date_edit</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Sat, 13 May 2000 18:04:39 GMT</last_modification_time>
+ <class>GtkVBox</class>
+ <name>vbox13</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
<child>
<padding>0</padding>
- <expand>True</expand>
+ <expand>False</expand>
<fill>True</fill>
</child>
- </widget>
- <widget>
- <class>GtkButton</class>
- <name>recurrence-exceptions-add</name>
- <can_focus>True</can_focus>
- <label>Add exception</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
+ <widget>
+ <class>GtkButton</class>
+ <name>recurrence-exceptions-add</name>
+ <can_focus>True</can_focus>
+ <label>Add</label>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
- <widget>
- <class>GtkButton</class>
- <name>recurrence-exceptions-change</name>
- <can_focus>True</can_focus>
- <label>Change selected</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
+ <widget>
+ <class>GtkButton</class>
+ <name>recurrence-exceptions-change</name>
+ <can_focus>True</can_focus>
+ <label>Chage</label>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>recurrence-exceptions-delete</name>
+ <can_focus>True</can_focus>
+ <label>Delete</label>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
</widget>
<widget>
- <class>GtkButton</class>
- <name>recurrence-exceptions-delete</name>
- <can_focus>True</can_focus>
- <label>Delete selected</label>
+ <class>GtkScrolledWindow</class>
+ <name>scrolledwindow2</name>
+ <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
+ <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
+ <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+ <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
- </widget>
- </widget>
- <widget>
- <class>GtkList</class>
- <name>recurrence-exceptions-list</name>
- <width>40</width>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
+ <widget>
+ <class>GtkCList</class>
+ <name>recurrence-exceptions-list</name>
+ <can_focus>True</can_focus>
+ <columns>1</columns>
+ <column_widths>80</column_widths>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ <show_titles>False</show_titles>
+ <shadow_type>GTK_SHADOW_IN</shadow_type>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>label40</name>
+ <label></label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
</widget>
</widget>
</widget>
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
-
*/