aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@src.gnome.org>2000-05-30 22:47:38 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-05-30 22:47:38 +0800
commit336efb38c6245c06f48704a0f0c07693bf58f9ee (patch)
treed94b539a274e309f27d29eb366b8754a16fb5a21
parent886713b8b1393dca9f9c9abe87ccb928eca8c0ef (diff)
downloadgsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar.gz
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar.bz2
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar.lz
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar.xz
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.tar.zst
gsoc2013-evolution-336efb38c6245c06f48704a0f0c07693bf58f9ee.zip
Flush - Federico
svn path=/trunk/; revision=3280
-rw-r--r--calendar/ChangeLog21
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/e-day-view.c17
-rw-r--r--calendar/gui/e-week-view.c7
-rw-r--r--calendar/gui/event-editor-dialog.glade83
-rw-r--r--calendar/gui/event-editor-dialog.glade.h94
-rw-r--r--calendar/gui/event-editor-utils.c228
-rw-r--r--calendar/gui/event-editor-utils.h22
-rw-r--r--calendar/gui/event-editor.c1240
-rw-r--r--calendar/gui/event-editor.h2
-rw-r--r--calendar/gui/eventedit.c2
-rw-r--r--calendar/gui/gncal-todo.c2
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/gnome-cal.h3
-rw-r--r--e-util/ChangeLog18
-rw-r--r--e-util/e-dialog-widgets.c113
16 files changed, 915 insertions, 941 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a62b2c29f2..d6b28823a0 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,24 @@
+2000-05-29 Federico Mena Quintero <federico@helixcode.com>
+
+ * gui/gnome-cal.c (gnome_calendar_object_changed): Removed the
+ flags argument, since now we just proxy the calendar object to the
+ calendar client.
+
+ * gui/event-editor.c (alarm_unit_get): Moved over from
+ event-editor-utils.c.
+
+ * gui/event-editor-utils.[ch]: Removed files, since the two
+ functions that were left there (i.e. the ones not present in
+ e-dialog-widgets) can simply be moved to event-editor.c.
+
+ * gui/Makefile.am (evolution_calendar_SOURCES): Removed
+ event-editor-utils.[ch] from the list of sources.
+
+2000-05-27 Federico Mena Quintero <federico@helixcode.com>
+
+ * gui/event-editor-utils.c: Moved many functions to
+ e-util/e-dialog-widgets.c.
+
2000-05-25 Federico Mena Quintero <federico@helixcode.com>
* gui/event-editor-dialog.glade: Put the main notebook directly
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 5ef1cc9c83..3344908f2a 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -67,8 +67,6 @@ evolution_calendar_SOURCES = \
e-week-view.h \
event-editor.c \
event-editor.h \
- event-editor-utils.c \
- event-editor-utils.h \
getdate.y \
gncal-todo.c \
gncal-todo.h \
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 0963b00acb..81bcf436bd 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -2358,7 +2358,7 @@ e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
ico = ical_object_duplicate (event->ico);
ical_object_add_exdate (ico, event->start);
- gnome_calendar_object_changed (day_view->calendar, ico, CHANGE_DATES);
+ gnome_calendar_object_changed (day_view->calendar, ico);
ical_object_unref (ico);
}
@@ -2413,7 +2413,7 @@ e_day_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both iCalObjects. Note that we do this last since at
present the updates happen synchronously so our event may disappear.
*/
- gnome_calendar_object_changed (day_view->calendar, ico, CHANGE_ALL);
+ gnome_calendar_object_changed (day_view->calendar, ico);
ical_object_unref (ico);
gnome_calendar_add_object (day_view->calendar, new_ico);
@@ -2912,7 +2912,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
/* Notify calendar of change */
- gnome_calendar_object_changed (day_view->calendar, &ico, CHANGE_DATES);
+ gnome_calendar_object_changed (day_view->calendar, &ico);
}
@@ -2953,7 +2953,7 @@ e_day_view_finish_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
/* Notify calendar of change */
- gnome_calendar_object_changed (day_view->calendar, &ico, CHANGE_DATES);
+ gnome_calendar_object_changed (day_view->calendar, &ico);
}
@@ -4155,8 +4155,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
/* Notify calendar of change. This will result in a call to update,
which will reset the event label as appropriate. */
- gnome_calendar_object_changed (day_view->calendar, event->ico,
- CHANGE_SUMMARY);
+ gnome_calendar_object_changed (day_view->calendar, event->ico);
}
@@ -5108,8 +5107,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
gnome_canvas_item_show (event->canvas_item);
/* Notify calendar of change */
- gnome_calendar_object_changed (day_view->calendar,
- &ico, CHANGE_DATES);
+ gnome_calendar_object_changed (day_view->calendar, &ico);
return;
}
@@ -5187,8 +5185,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
gnome_canvas_item_show (event->canvas_item);
/* Notify calendar of change */
- gnome_calendar_object_changed (day_view->calendar,
- &ico, CHANGE_DATES);
+ gnome_calendar_object_changed (day_view->calendar, &ico);
return;
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index a233d2a66d..e45efdf908 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2374,8 +2374,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
/* Notify calendar of change. This will result in a call to update,
which will reset the event label as appropriate. */
- gnome_calendar_object_changed (week_view->calendar, event->ico,
- CHANGE_SUMMARY);
+ gnome_calendar_object_changed (week_view->calendar, event->ico);
}
@@ -2674,7 +2673,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
ico = ical_object_duplicate (event->ico);
ical_object_add_exdate (ico, event->start);
- gnome_calendar_object_changed (week_view->calendar, ico, CHANGE_DATES);
+ gnome_calendar_object_changed (week_view->calendar, ico);
ical_object_unref (ico);
}
@@ -2730,7 +2729,7 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
/* Now update both iCalObjects. Note that we do this last since at
present the updates happen synchronously so our event may disappear.
*/
- gnome_calendar_object_changed (week_view->calendar, ico, CHANGE_ALL);
+ gnome_calendar_object_changed (week_view->calendar, ico);
ical_object_unref (ico);
gnome_calendar_add_object (week_view->calendar, new_ico);
diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade
index 7cd4852d67..d7619ecd18 100644
--- a/calendar/gui/event-editor-dialog.glade
+++ b/calendar/gui/event-editor-dialog.glade
@@ -60,13 +60,14 @@
<widget>
<class>GtkLabel</class>
<name>label13</name>
- <label>Owner: </label>
+ <label>_Owner:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>general-owner</focus_target>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -104,40 +105,34 @@
<widget>
<class>GtkLabel</class>
<name>label14</name>
- <label>Summary:</label>
+ <label>_Summary:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>general-summary</focus_target>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <hscrollbar_policy>GTK_POLICY_NEVER</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>
- </child>
<widget>
- <class>GtkText</class>
+ <class>GtkEntry</class>
<name>general-summary</name>
<can_focus>True</can_focus>
<editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
<text></text>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
</widget>
</widget>
@@ -159,13 +154,13 @@
<rows>2</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
<widget>
<class>GtkLabel</class>
<name>label15</name>
- <label>Start time: </label>
+ <label>Start time:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -191,7 +186,7 @@
<widget>
<class>GtkLabel</class>
<name>label16</name>
- <label>End time: </label>
+ <label>End time:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -266,7 +261,7 @@
<class>GtkCheckButton</class>
<name>all-day-event</name>
<can_focus>True</can_focus>
- <label>All day event</label>
+ <label>A_ll day event</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
@@ -305,8 +300,8 @@
<rows>4</rows>
<columns>5</columns>
<homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
<widget>
<class>GtkSpinButton</class>
@@ -538,7 +533,7 @@ Days
<widget>
<class>GtkEntry</class>
- <name>mail-to</name>
+ <name>alarm-mail-mail-to</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
@@ -562,7 +557,7 @@ Days
<widget>
<class>GnomeFileEntry</class>
- <name>run-program-file-entry</name>
+ <name>alarm-program-run-program</name>
<max_saved>10</max_saved>
<directory>False</directory>
<modal>False</modal>
@@ -584,7 +579,7 @@ Days
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
- <name>run-program</name>
+ <name>alarm-program-run-program-entry</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
@@ -597,7 +592,7 @@ Days
<class>GtkCheckButton</class>
<name>alarm-display</name>
<can_focus>True</can_focus>
- <label>Display</label>
+ <label>_Display</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
@@ -620,7 +615,7 @@ Days
<class>GtkCheckButton</class>
<name>alarm-audio</name>
<can_focus>True</can_focus>
- <label>Audio</label>
+ <label>_Audio</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
@@ -643,7 +638,7 @@ Days
<class>GtkCheckButton</class>
<name>alarm-program</name>
<can_focus>True</can_focus>
- <label>Program</label>
+ <label>_Program</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
@@ -666,7 +661,7 @@ Days
<class>GtkCheckButton</class>
<name>alarm-mail</name>
<can_focus>True</can_focus>
- <label>Mail</label>
+ <label>_Mail</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
@@ -688,13 +683,14 @@ Days
<widget>
<class>GtkLabel</class>
<name>label18</name>
- <label>Mail to</label>
+ <label>Mail _to</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>alarm-mail-mail-to</focus_target>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
@@ -714,13 +710,14 @@ Days
<widget>
<class>GtkLabel</class>
<name>label17</name>
- <label>Run program</label>
+ <label>_Run program</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
+ <focus_target>alarm-program-run-program-entry</focus_target>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
@@ -755,13 +752,13 @@ Days
<class>GtkHBox</class>
<name>hbox6</name>
<homogeneous>False</homogeneous>
- <spacing>0</spacing>
+ <spacing>4</spacing>
<widget>
<class>GtkRadioButton</class>
- <name>classification-public</name>
+ <name>classification-radio</name>
<can_focus>True</can_focus>
- <label>Public</label>
+ <label>Pu_blic</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<group>classification_radio_group</group>
@@ -774,9 +771,9 @@ Days
<widget>
<class>GtkRadioButton</class>
- <name>classification-private</name>
+ <name></name>
<can_focus>True</can_focus>
- <label>Private</label>
+ <label>Pri_vate</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>classification_radio_group</group>
@@ -789,9 +786,9 @@ Days
<widget>
<class>GtkRadioButton</class>
- <name>classification-confidential</name>
+ <name></name>
<can_focus>True</can_focus>
- <label>Confidential</label>
+ <label>_Confidential</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>classification_radio_group</group>
@@ -1326,7 +1323,7 @@ Days
<widget>
<class>GtkSpinButton</class>
- <name>recurrence-rule-monthly-day</name>
+ <name>recurrence-rule-monthly-day-nth</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
@@ -1411,7 +1408,7 @@ Days
<widget>
<class>GtkOptionMenu</class>
- <name>recurrence-rule-monthly-day</name>
+ <name>recurrence-rule-monthly-weekpos</name>
<can_focus>True</can_focus>
<items>Monday
Tuesday
@@ -1836,7 +1833,7 @@ Sunday
<class>GtkButton</class>
<name>recurrence-exceptions-change</name>
<can_focus>True</can_focus>
- <label>Chage</label>
+ <label>Change</label>
<child>
<padding>0</padding>
<expand>False</expand>
diff --git a/calendar/gui/event-editor-dialog.glade.h b/calendar/gui/event-editor-dialog.glade.h
new file mode 100644
index 0000000000..6117bfe22f
--- /dev/null
+++ b/calendar/gui/event-editor-dialog.glade.h
@@ -0,0 +1,94 @@
+/*
+ * Translatable strings file generated by Glade.
+ * Add this file to your project's POTFILES.in.
+ * DO NOT compile it as part of your application.
+ */
+
+gchar *s = N_("window1");
+gchar *s = N_("_Owner:");
+gchar *s = N_("_Summary:");
+gchar *s = N_("Time");
+gchar *s = N_("Start time:");
+gchar *s = N_("End time:");
+gchar *s = N_("A_ll day event");
+gchar *s = N_("Alarms");
+gchar *s = N_("Minutes\n"
+ "Hours\n"
+ "Days\n"
+ "");
+gchar *s = N_("Minutes\n"
+ "Hours\n"
+ "Days\n"
+ "");
+gchar *s = N_("Minutes\n"
+ "Hours\n"
+ "Days\n"
+ "");
+gchar *s = N_("Minutes\n"
+ "Hours\n"
+ "Days\n"
+ "");
+gchar *s = N_("_Display");
+gchar *s = N_("_Audio");
+gchar *s = N_("_Program");
+gchar *s = N_("_Mail");
+gchar *s = N_("Mail _to");
+gchar *s = N_("_Run program");
+gchar *s = N_("Classification");
+gchar *s = N_("Pu_blic");
+gchar *s = N_("Pri_vate");
+gchar *s = N_("_Confidential");
+gchar *s = N_("General");
+gchar *s = N_("Recurrence rule");
+gchar *s = N_("None");
+gchar *s = N_("Daily");
+gchar *s = N_("Weekly");
+gchar *s = N_("Monthly");
+gchar *s = N_("Yearly");
+gchar *s = N_("label23");
+gchar *s = N_("Every ");
+gchar *s = N_("day(s)");
+gchar *s = N_("label24");
+gchar *s = N_("Every ");
+gchar *s = N_("week(s)");
+gchar *s = N_("Mon");
+gchar *s = N_("Tue");
+gchar *s = N_("Wed");
+gchar *s = N_("Thu");
+gchar *s = N_("Fri");
+gchar *s = N_("Sat");
+gchar *s = N_("Sun");
+gchar *s = N_("label25");
+gchar *s = N_("Recur on the");
+gchar *s = N_("th day of the month");
+gchar *s = N_("Recur on the");
+gchar *s = N_("1st\n"
+ "2nd\n"
+ "3rd\n"
+ "4th\n"
+ "5th\n"
+ "");
+gchar *s = N_("Monday\n"
+ "Tuesday\n"
+ "Wednesday\n"
+ "Thursday\n"
+ "Friday\n"
+ "Saturday\n"
+ "Sunday\n"
+ "");
+gchar *s = N_("Every");
+gchar *s = N_("month(s)");
+gchar *s = N_("label26");
+gchar *s = N_("Every ");
+gchar *s = N_("year(s)");
+gchar *s = N_("label27");
+gchar *s = N_("Ending date");
+gchar *s = N_("Repeat forever");
+gchar *s = N_("End on ");
+gchar *s = N_("End after");
+gchar *s = N_("occurrence(s)");
+gchar *s = N_("Exceptions");
+gchar *s = N_("Add");
+gchar *s = N_("Change");
+gchar *s = N_("Delete");
+gchar *s = N_("Recurrence");
diff --git a/calendar/gui/event-editor-utils.c b/calendar/gui/event-editor-utils.c
deleted file mode 100644
index 8361a493c5..0000000000
--- a/calendar/gui/event-editor-utils.c
+++ /dev/null
@@ -1,228 +0,0 @@
-#include <config.h>
-#include <gnome.h>
-#include <glade/glade.h>
-#include <gui/event-editor-utils.h>
-
-
-/***************/
-/*** storing ***/
-/***************/
-
-void
-store_to_editable (GladeXML *gui, char *widget_name, gchar *content)
-{
- GtkWidget *widget = glade_xml_get_widget (gui, widget_name);
- GtkEditable *editable = GTK_EDITABLE (widget);
- int position = 0;
-
- if (! content)
- return;
-
- gtk_editable_delete_text (editable, 0, -1);
- gtk_editable_insert_text (editable, content,
- strlen (content), &position);
-}
-
-
-void
-store_to_toggle (GladeXML *gui, char *widget_name, gboolean content)
-{
- GtkWidget *widget = glade_xml_get_widget (gui, widget_name);
- GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (widget);
- gtk_toggle_button_set_active (toggle, content);
-}
-
-
-void
-store_to_spin (GladeXML *gui, char *widget_name, gint content)
-{
- GtkWidget *widget;
- GtkSpinButton *spin;
-
- widget = glade_xml_get_widget (gui, widget_name);
- spin = GTK_SPIN_BUTTON (widget);
- gtk_spin_button_set_value (spin, (gfloat) content);
-}
-
-
-void
-store_to_alarm_unit (GladeXML *gui, char *widget_name, enum AlarmUnit content)
-{
- GtkWidget *widget;
- GtkOptionMenu *option;
-
- widget = glade_xml_get_widget (gui, widget_name);
- option = GTK_OPTION_MENU (widget);
-
- switch (content) {
- case ALARM_MINUTES:
- gtk_option_menu_set_history (option, 0); break;
- case ALARM_HOURS:
- gtk_option_menu_set_history (option, 1); break;
- case ALARM_DAYS:
- gtk_option_menu_set_history (option, 2); break;
- }
-}
-
-
-void
-store_to_option (GladeXML *gui, char *widget_name, gint content)
-{
- GtkWidget *widget;
- GtkOptionMenu *option;
-
- widget = glade_xml_get_widget (gui, widget_name);
- option = GTK_OPTION_MENU (widget);
-
- gtk_option_menu_set_history (option, content);
-}
-
-
-void
-store_to_gnome_dateedit (GladeXML *gui, char *widget_name, time_t content)
-{
- GtkWidget *widget;
- GnomeDateEdit *gde;
-
- widget = glade_xml_get_widget (gui, widget_name);
- gde = GNOME_DATE_EDIT (widget);
- gnome_date_edit_set_time (gde, content);
-}
-
-
-
-/******************/
-/*** extracting ***/
-/******************/
-
-
-gchar *extract_from_editable (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkEditable *editable;
- gchar *content;
-
- widget = glade_xml_get_widget (gui, widget_name);
- editable = GTK_EDITABLE (widget);
- content = gtk_editable_get_chars (editable, 0, -1);
- return content;
-}
-
-
-gboolean extract_from_toggle (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkToggleButton *toggle;
- gboolean content;
-
- widget = glade_xml_get_widget (gui, widget_name);
- toggle = GTK_TOGGLE_BUTTON (widget);
- content = gtk_toggle_button_get_active (toggle);
- return content;
-}
-
-
-gint extract_from_spin (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkSpinButton *spin;
- gint content;
-
- widget = glade_xml_get_widget (gui, widget_name);
- spin = GTK_SPIN_BUTTON (widget);
- content = gtk_spin_button_get_value_as_int (spin);
- return content;
-}
-
-
-#if 0
-char *extract_from_option (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkOptionMenu *option;
- GtkWidget *picked;
- GtkMenu *menu;
- GtkMenuItem *menu_item;
- //GList *children;
- GtkLabel *label;
- char *content = NULL;
-
- widget = glade_xml_get_widget (gui, widget_name);
- option = GTK_OPTION_MENU (widget);
- picked = gtk_option_menu_get_menu (option);
- menu = GTK_MENU (picked);
- menu_item = GTK_MENU_ITEM (gtk_menu_get_active (menu));
- label = GTK_LABEL (GTK_BIN (menu_item)->child);
- gtk_label_get (label, &content);
-
- return content;
-}
-#endif /* 0 */
-
-
-#if 0
-enum AlarmUnit
-extract_from_alarm_unit (GladeXML *gui, char *widget_name)
-{
- GtkWidget *option;
- enum AlarmUnit u;
-
- option = glade_xml_get_widget (gui, widget_name);
- u = (enum AlarmUnit) gtk_object_get_data (GTK_OBJECT (option), "unit");
- return u;
-}
-#endif /* 0 */
-
-
-enum AlarmUnit
-extract_from_alarm_unit (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkOptionMenu *option;
- GtkMenu *menu;
- GtkMenuShell *menu_shell;
- GtkMenuItem *menu_item;
- enum AlarmUnit content;
-
- widget = glade_xml_get_widget (gui, widget_name);
- option = GTK_OPTION_MENU (widget);
- menu = GTK_MENU (gtk_option_menu_get_menu (option));
- menu_shell = GTK_MENU_SHELL (menu);
- menu_item = GTK_MENU_ITEM (gtk_menu_get_active (menu));
-
- content = g_list_index (menu_shell->children, (gpointer) menu_item);
- return (content >= 0) ? content : ALARM_MINUTES;
-}
-
-
-guint
-extract_from_option (GladeXML *gui, char *widget_name)
-{
- GtkWidget *widget;
- GtkOptionMenu *option;
- GtkMenu *menu;
- GtkMenuShell *menu_shell;
- GtkMenuItem *menu_item;
- enum AlarmUnit content;
-
- widget = glade_xml_get_widget (gui, widget_name);
- option = GTK_OPTION_MENU (widget);
- menu = GTK_MENU (gtk_option_menu_get_menu (option));
- menu_shell = GTK_MENU_SHELL (menu);
- menu_item = GTK_MENU_ITEM (gtk_menu_get_active (menu));
-
- content = g_list_index (menu_shell->children, (gpointer) menu_item);
- return (content >= 0) ? content : 0;
-}
-
-
-time_t extract_from_gnome_dateedit (GladeXML *gui, char *widget_name)
-{
- GtkWidget *de;
- time_t t;
-
- de = glade_xml_get_widget (gui, widget_name);
- t = gnome_date_edit_get_date (GNOME_DATE_EDIT (de));
- return t;
-}
-
diff --git a/calendar/gui/event-editor-utils.h b/calendar/gui/event-editor-utils.h
deleted file mode 100644
index 61631028db..0000000000
--- a/calendar/gui/event-editor-utils.h
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#include "gnome-cal.h"
-#include <glade/glade.h>
-//#include <cal-util/timeutil.h>
-
-void store_to_editable (GladeXML *gui, char *widget_name, gchar *content);
-void store_to_toggle (GladeXML *gui, char *widget_name, gboolean content);
-void store_to_spin (GladeXML *gui, char *widget_name, gint content);
-void store_to_alarm_unit (GladeXML *gui, char *widget_name,
- enum AlarmUnit content);
-void store_to_option (GladeXML *gui, char *widget_name, gint content);
-void store_to_gnome_dateedit (GladeXML *gui, char *widget_name,
- time_t content);
-
-
-gchar *extract_from_editable (GladeXML *gui, char *widget_name);
-gboolean extract_from_toggle (GladeXML *gui, char *widget_name);
-gint extract_from_spin (GladeXML *gui, char *widget_name);
-enum AlarmUnit extract_from_alarm_unit (GladeXML *gui, char *widget_name);
-guint extract_from_option (GladeXML *gui, char *widget_name);
-time_t extract_from_gnome_dateedit (GladeXML *gui, char *widget_name);
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index c96a6118d6..52b10b0eeb 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -23,8 +23,9 @@
#include <config.h>
#include <gnome.h>
+#include <glade/glade.h>
+#include <e-util/e-dialog-widgets.h>
#include <cal-util/timeutil.h>
-#include "event-editor-utils.h"
#include "event-editor.h"
@@ -39,13 +40,17 @@ typedef struct {
/* UI handler */
BonoboUIHandler *uih;
+ /* Calendar object we are editing */
+ iCalObject *ico;
+
/* Widgets from the Glade file */
GtkWidget *general_owner;
+ GtkWidget *general_summary;
GtkWidget *start_time;
GtkWidget *end_time;
- GtkWidget *all_day_checkbox;
+ GtkWidget *all_day_event;
GtkWidget *alarm_display;
GtkWidget *alarm_program;
@@ -58,10 +63,13 @@ typedef struct {
GtkWidget *alarm_program_amount;
GtkWidget *alarm_program_unit;
GtkWidget *alarm_program_run_program;
+ GtkWidget *alarm_program_run_program_entry;
GtkWidget *alarm_mail_amount;
GtkWidget *alarm_mail_unit;
GtkWidget *alarm_mail_mail_to;
+ GtkWidget *classification_radio;
+
GtkWidget *recurrence_rule_notebook;
GtkWidget *recurrence_rule_none;
GtkWidget *recurrence_rule_daily;
@@ -69,6 +77,33 @@ typedef struct {
GtkWidget *recurrence_rule_monthly;
GtkWidget *recurrence_rule_yearly;
+ GtkWidget *recurrence_rule_daily_days;
+
+ GtkWidget *recurrence_rule_weekly_weeks;
+ GtkWidget *recurrence_rule_weekly_sun;
+ GtkWidget *recurrence_rule_weekly_mon;
+ GtkWidget *recurrence_rule_weekly_tue;
+ GtkWidget *recurrence_rule_weekly_wed;
+ GtkWidget *recurrence_rule_weekly_thu;
+ GtkWidget *recurrence_rule_weekly_fri;
+ GtkWidget *recurrence_rule_weekly_sat;
+
+ GtkWidget *recurrence_rule_monthly_on_day;
+ GtkWidget *recurrence_rule_monthly_weekday;
+ GtkWidget *recurrence_rule_monthly_day_nth;
+ GtkWidget *recurrence_rule_monthly_week;
+ GtkWidget *recurrence_rule_monthly_weekpos;
+ GtkWidget *recurrence_rule_monthly_every_n_months;
+ GtkWidget *recurrence_rule_yearly_every_n_years;
+
+ GtkWidget *recurrence_ending_date_repeat_forever;
+ GtkWidget *recurrence_ending_date_end_on;
+ GtkWidget *recurrence_ending_date_end_on_date;
+ GtkWidget *recurrence_ending_date_end_after;
+ GtkWidget *recurrence_ending_date_end_after_count;
+
+ GtkWidget *recurrence_exceptions_date;
+ GtkWidget *recurrence_exceptions_list;
GtkWidget *recurrence_exception_add;
GtkWidget *recurrence_exception_delete;
GtkWidget *recurrence_exception_change;
@@ -77,13 +112,6 @@ typedef struct {
GtkWidget *exception_date;
} EventEditorPrivate;
-typedef struct {
- GladeXML *gui;
- GtkWidget *dialog;
- GnomeCalendar *gnome_cal;
- iCalObject *ical;
-} EventEditorDialog;
-
static void event_editor_class_init (EventEditorClass *class);
@@ -98,19 +126,26 @@ extern int am_pm_flag;
extern int week_starts_on_monday;
-static void append_exception (EventEditorDialog *dialog, time_t t);
-static void check_all_day (EventEditorDialog *dialog);
-static void alarm_toggle (GtkToggleButton *toggle, EventEditorDialog *dialog);
+static void append_exception (EventEditor *ee, time_t t);
+static void check_all_day (EventEditor *ee);
+static void set_all_day (GtkWidget *toggle, EventEditor *ee);
+static void alarm_toggle (GtkWidget *toggle, EventEditor *ee);
+static void check_dates (GnomeDateEdit *gde, EventEditor *ee);
+static void check_times (GnomeDateEdit *gde, EventEditor *ee);
+static void recurrence_toggled (GtkWidget *radio, EventEditor *ee);
+static void recurrence_exception_added (GtkWidget *widget, EventEditor *ee);
+static void recurrence_exception_deleted (GtkWidget *widget, EventEditor *ee);
+static void recurrence_exception_changed (GtkWidget *widget, EventEditor *ee);
/**
* event_editor_get_type:
- * @void:
- *
+ * @void:
+ *
* Registers the #EventEditor class if necessary, and returns the type ID
* associated to it.
- *
+ *
* Return value: The type ID of the #EventEditor class.
**/
GtkType
@@ -208,7 +243,10 @@ make_title_from_ico (iCalObject *ico)
}
}
-/* Gets the widgets from the XML file and returns if they are all available */
+/* Gets the widgets from the XML file and returns if they are all available.
+ * For the widgets whose values can be simply set with e-dialog-utils, it does
+ * that as well.
+ */
static gboolean
get_widgets (EventEditor *ee)
{
@@ -219,10 +257,11 @@ get_widgets (EventEditor *ee)
#define GW(name) glade_xml_get_widget (priv->xml, name)
priv->general_owner = GW ("general-owner");
+ priv->general_summary = GW ("general-summary");
priv->start_time = GW ("start-time");
priv->end_time = GW ("end-time");
- priv->all_day_checkbox = GW ("all-day-event");
+ priv->all_day_event = GW ("all-day-event");
priv->alarm_display = GW ("alarm-display");
priv->alarm_program = GW ("alarm-program");
@@ -234,10 +273,13 @@ get_widgets (EventEditor *ee)
priv->alarm_audio_unit = GW ("alarm-audio-unit");
priv->alarm_program_amount = GW ("alarm-program-amount");
priv->alarm_program_unit = GW ("alarm-program-unit");
- priv->alarm_program_run_program = GW ("run-program-file-entry");
+ priv->alarm_program_run_program = GW ("alarm-program-run-program");
+ priv->alarm_program_run_program_entry = GW ("alarm-program-run-program-entry");
priv->alarm_mail_amount = GW ("alarm-mail-amount");
priv->alarm_mail_unit = GW ("alarm-mail-unit");
- priv->alarm_mail_mail_to = GW ("mail-to");
+ priv->alarm_mail_mail_to = GW ("alarm-mail-mail-to");
+
+ priv->classification_radio = GW ("classification-radio");
priv->recurrence_rule_notebook = GW ("recurrence-rule-notebook");
priv->recurrence_rule_none = GW ("recurrence-rule-none");
@@ -246,6 +288,33 @@ get_widgets (EventEditor *ee)
priv->recurrence_rule_monthly = GW ("recurrence-rule-monthly");
priv->recurrence_rule_yearly = GW ("recurrence-rule-yearly");
+ priv->recurrence_rule_daily_days = GW ("recurrence-rule-daily-days");
+
+ priv->recurrence_rule_weekly_weeks = GW ("recurrence-rule-weekly-weeks");
+ priv->recurrence_rule_weekly_sun = GW ("recurrence-rule-weekly-sun");
+ priv->recurrence_rule_weekly_mon = GW ("recurrence-rule-weekly-mon");
+ priv->recurrence_rule_weekly_tue = GW ("recurrence-rule-weekly-tue");
+ priv->recurrence_rule_weekly_wed = GW ("recurrence-rule-weekly-wed");
+ priv->recurrence_rule_weekly_thu = GW ("recurrence-rule-weekly-thu");
+ priv->recurrence_rule_weekly_fri = GW ("recurrence-rule-weekly-fri");
+ priv->recurrence_rule_weekly_sat = GW ("recurrence-rule-weekly-sat");
+
+ priv->recurrence_rule_monthly_on_day = GW ("recurrence-rule-monthly-on-day");
+ priv->recurrence_rule_monthly_weekday = GW ("recurrence-rule-monthly-weekday");
+ priv->recurrence_rule_monthly_day_nth = GW ("recurrence-rule-monthly-day-nth");
+ priv->recurrence_rule_monthly_week = GW ("recurrence-rule-monthly-week");
+ priv->recurrence_rule_monthly_weekpos = GW ("recurrence-rule-monthly-weekpos");
+ priv->recurrence_rule_monthly_every_n_months = GW ("recurrence-rule-monthly-every-n-months");
+ priv->recurrence_rule_yearly_every_n_years = GW ("recurrence-rule-yearly-every-n-years");
+
+ priv->recurrence_ending_date_repeat_forever = GW ("recurrence-ending-date-repeat-forever");
+ priv->recurrence_ending_date_end_on = GW ("recurrence-ending-date-end-on");
+ priv->recurrence_ending_date_end_on_date = GW ("recurrence-ending-date-end-on-date");
+ priv->recurrence_ending_date_end_after = GW ("recurrence-ending-date-end-after");
+ priv->recurrence_ending_date_end_after_count = GW ("recurrence-ending-date-end-after-count");
+
+ priv->recurrence_exceptions_date = GW ("recurrence-exceptions-date");
+ priv->recurrence_exceptions_list = GW ("recurrence-exceptions-list");
priv->recurrence_exception_add = GW ("recurrence-exceptions-add");
priv->recurrence_exception_delete = GW ("recurrence-exceptions-delete");
priv->recurrence_exception_change = GW ("recurrence-exceptions-change");
@@ -256,9 +325,10 @@ get_widgets (EventEditor *ee)
#undef GW
return (priv->general_owner
+ && priv->general_summary
&& priv->start_time
&& priv->end_time
- && priv->all_day_checkbox
+ && priv->all_day_event
&& priv->alarm_display
&& priv->alarm_program
&& priv->alarm_audio
@@ -270,15 +340,33 @@ get_widgets (EventEditor *ee)
&& priv->alarm_program_amount
&& priv->alarm_program_unit
&& priv->alarm_program_run_program
+ && priv->alarm_program_run_program_entry
&& priv->alarm_mail_amount
&& priv->alarm_mail_unit
&& priv->alarm_mail_mail_to
+ && priv->classification_radio
&& priv->recurrence_rule_notebook
&& priv->recurrence_rule_none
&& priv->recurrence_rule_daily
&& priv->recurrence_rule_weekly
&& priv->recurrence_rule_monthly
&& priv->recurrence_rule_yearly
+ && priv->recurrence_rule_daily_days
+ && priv->recurrence_rule_weekly_weeks
+ && priv->recurrence_rule_monthly_on_day
+ && priv->recurrence_rule_monthly_weekday
+ && priv->recurrence_rule_monthly_day_nth
+ && priv->recurrence_rule_monthly_week
+ && priv->recurrence_rule_monthly_weekpos
+ && priv->recurrence_rule_monthly_every_n_months
+ && priv->recurrence_rule_yearly_every_n_years
+ && priv->recurrence_ending_date_repeat_forever
+ && priv->recurrence_ending_date_end_on
+ && priv->recurrence_ending_date_end_on_date
+ && priv->recurrence_ending_date_end_after
+ && priv->recurrence_ending_date_end_after_count
+ && priv->recurrence_exceptions_date
+ && priv->recurrence_exceptions_list
&& priv->recurrence_exception_add
&& priv->recurrence_exception_delete
&& priv->recurrence_exception_change
@@ -286,6 +374,272 @@ get_widgets (EventEditor *ee)
&& priv->exception_date);
}
+/* Classification types; just an enum for mapping them to radio buttons
+ * (iCalObject uses strings for these).
+ */
+typedef enum {
+ CLASSIFICATION_PUBLIC,
+ CLASSIFICATION_PRIVATE,
+ CLASSIFICATION_CONFIDENTIAL
+} ClassificationType;
+
+static const int classification_map[] = {
+ CLASSIFICATION_PUBLIC,
+ CLASSIFICATION_PRIVATE,
+ CLASSIFICATION_CONFIDENTIAL,
+ -1
+};
+
+static const int alarm_unit_map[] = {
+ ALARM_MINUTES,
+ ALARM_HOURS,
+ ALARM_DAYS,
+ -1
+};
+
+static void
+alarm_unit_set (GtkWidget *widget, enum AlarmUnit unit)
+{
+ e_dialog_option_menu_set (widget, unit, alarm_unit_map);
+}
+
+static enum AlarmUnit
+alarm_unit_get (GtkWidget *widget)
+{
+ return e_dialog_option_menu_get (widget, alarm_unit_map);
+}
+
+/* Recurrence types for mapping them to radio buttons */
+typedef enum {
+ RECUR_OPTION_NONE,
+ RECUR_OPTION_DAILY,
+ RECUR_OPTION_WEEKLY,
+ RECUR_OPTION_MONTHLY,
+ RECUR_OPTION_YEARLY,
+} RecurOptions;
+
+static const int recur_options_map[] = {
+ RECUR_OPTION_NONE,
+ RECUR_OPTION_DAILY,
+ RECUR_OPTION_WEEKLY,
+ RECUR_OPTION_MONTHLY,
+ RECUR_OPTION_YEARLY,
+ -1
+};
+
+static RecurOptions
+recur_options_get (GtkWidget *widget)
+{
+ return e_dialog_radio_get (widget, recur_options_map);
+}
+
+static const int month_pos_map[] = { 0, 1, 2, 3, 4, -1 };
+static const int weekday_map[] = { 0, 1, 2, 3, 4, 5, 6, -1 };
+
+/* Initializes the widget's values and signals */
+static void
+init_widgets (EventEditor *ee)
+{
+ EventEditorPrivate *priv;
+ GList *list;
+
+ priv = ee->priv;
+
+ /* Owner, summary */
+
+ e_dialog_editable_set (priv->general_owner,
+ priv->ico->organizer->addr ?
+ priv->ico->organizer->addr : _("?"));
+
+ e_dialog_editable_set (priv->general_summary, priv->ico->summary);
+
+ /* Start and end times */
+
+ gtk_signal_connect (GTK_OBJECT (priv->start_time), "date_changed",
+ GTK_SIGNAL_FUNC (check_dates), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->start_time), "time_changed",
+ GTK_SIGNAL_FUNC (check_times), ee);
+
+ gtk_signal_connect (GTK_OBJECT (priv->end_time), "date_changed",
+ GTK_SIGNAL_FUNC (check_dates), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->end_time), "time_changed",
+ GTK_SIGNAL_FUNC (check_times), ee);
+
+ e_dialog_dateedit_set (priv->start_time, priv->ico->dtstart);
+ e_dialog_dateedit_set (priv->end_time, priv->ico->dtend);
+
+ check_all_day (ee);
+
+ gtk_signal_connect (GTK_OBJECT (priv->all_day_event), "toggled",
+ GTK_SIGNAL_FUNC (set_all_day), ee);
+
+ /* Alarms */
+
+ e_dialog_toggle_set (priv->alarm_display, priv->ico->dalarm.enabled);
+ e_dialog_toggle_set (priv->alarm_program, priv->ico->palarm.enabled);
+ e_dialog_toggle_set (priv->alarm_audio, priv->ico->aalarm.enabled);
+ e_dialog_toggle_set (priv->alarm_mail, priv->ico->malarm.enabled);
+ alarm_toggle (priv->alarm_display, ee);
+ alarm_toggle (priv->alarm_program, ee);
+ alarm_toggle (priv->alarm_audio, ee);
+ alarm_toggle (priv->alarm_mail, ee);
+ gtk_signal_connect (GTK_OBJECT (priv->alarm_display), "toggled",
+ GTK_SIGNAL_FUNC (alarm_toggle), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->alarm_program), "toggled",
+ GTK_SIGNAL_FUNC (alarm_toggle), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->alarm_audio), "toggled",
+ GTK_SIGNAL_FUNC (alarm_toggle), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->alarm_mail), "toggled",
+ GTK_SIGNAL_FUNC (alarm_toggle), ee);
+
+ /* Alarm data */
+
+ e_dialog_spin_set (priv->alarm_display_amount, priv->ico->dalarm.count);
+ e_dialog_spin_set (priv->alarm_audio_amount, priv->ico->aalarm.count);
+ e_dialog_spin_set (priv->alarm_program_amount, priv->ico->palarm.count);
+ e_dialog_spin_set (priv->alarm_mail_amount, priv->ico->malarm.count);
+
+ alarm_unit_set (priv->alarm_display_unit, priv->ico->dalarm.units);
+ alarm_unit_set (priv->alarm_audio_unit, priv->ico->aalarm.units);
+ alarm_unit_set (priv->alarm_program_unit, priv->ico->palarm.units);
+ alarm_unit_set (priv->alarm_mail_unit, priv->ico->malarm.units);
+
+ e_dialog_editable_set (priv->alarm_program_run_program_entry, priv->ico->palarm.data);
+ e_dialog_editable_set (priv->alarm_mail_mail_to, priv->ico->malarm.data);
+
+ /* Classification */
+
+ if (strcmp (priv->ico->class, "PUBLIC") == 0)
+ e_dialog_radio_set (priv->classification_radio, CLASSIFICATION_PUBLIC,
+ classification_map);
+ else if (strcmp (priv->ico->class, "PRIVATE") == 0)
+ e_dialog_radio_set (priv->classification_radio, CLASSIFICATION_PRIVATE,
+ classification_map);
+ else if (strcmp (priv->ico->class, "CONFIDENTIAL") == 0)
+ e_dialog_radio_set (priv->classification_radio, CLASSIFICATION_CONFIDENTIAL,
+ classification_map);
+ else {
+ /* What do do? */
+ }
+
+ /* Recurrence types */
+
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_rule_none), "toggled",
+ GTK_SIGNAL_FUNC (recurrence_toggled), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_rule_daily), "toggled",
+ GTK_SIGNAL_FUNC (recurrence_toggled), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_rule_weekly), "toggled",
+ GTK_SIGNAL_FUNC (recurrence_toggled), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_rule_monthly), "toggled",
+ GTK_SIGNAL_FUNC (recurrence_toggled), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_rule_yearly), "toggled",
+ GTK_SIGNAL_FUNC (recurrence_toggled), ee);
+
+ /* Recurrence rules */
+
+ if (!priv->ico->recur)
+ e_dialog_radio_set (priv->recurrence_rule_none, RECUR_OPTION_NONE,
+ recur_options_map);
+ else {
+ switch (priv->ico->recur->type) {
+ case RECUR_DAILY:
+ e_dialog_radio_set (priv->recurrence_rule_daily, RECUR_OPTION_DAILY,
+ recur_options_map);
+ e_dialog_spin_set (priv->recurrence_rule_daily_days,
+ priv->ico->recur->interval);
+ break;
+
+ case RECUR_WEEKLY:
+ e_dialog_radio_set (priv->recurrence_rule_weekly, RECUR_OPTION_WEEKLY,
+ recur_options_map);
+ e_dialog_spin_set (priv->recurrence_rule_weekly_weeks,
+ priv->ico->recur->interval);
+
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_sun,
+ (priv->ico->recur->weekday & (1 << 0)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_mon,
+ (priv->ico->recur->weekday & (1 << 1)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_tue,
+ (priv->ico->recur->weekday & (1 << 2)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_wed,
+ (priv->ico->recur->weekday & (1 << 3)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_thu,
+ (priv->ico->recur->weekday & (1 << 4)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_fri,
+ (priv->ico->recur->weekday & (1 << 5)) != 0);
+ e_dialog_toggle_set (priv->recurrence_rule_weekly_sat,
+ (priv->ico->recur->weekday & (1 << 6)) != 0);
+ break;
+
+ case RECUR_MONTHLY_BY_DAY:
+ e_dialog_radio_set (priv->recurrence_rule_monthly, RECUR_OPTION_MONTHLY,
+ recur_options_map);
+ e_dialog_toggle_set (priv->recurrence_rule_monthly_on_day, TRUE);
+ e_dialog_spin_set (priv->recurrence_rule_monthly_day_nth,
+ priv->ico->recur->u.month_day);
+ e_dialog_spin_set (priv->recurrence_rule_monthly_every_n_months,
+ priv->ico->recur->interval);
+ break;
+
+ case RECUR_MONTHLY_BY_POS:
+ e_dialog_radio_set (priv->recurrence_rule_monthly, RECUR_OPTION_MONTHLY,
+ recur_options_map);
+ e_dialog_toggle_set (priv->recurrence_rule_monthly_weekday, TRUE);
+ e_dialog_option_menu_set (priv->recurrence_rule_monthly_week,
+ priv->ico->recur->u.month_pos,
+ month_pos_map);
+ e_dialog_option_menu_set (priv->recurrence_rule_monthly_weekpos,
+ priv->ico->recur->weekday,
+ weekday_map);
+ e_dialog_spin_set (priv->recurrence_rule_monthly_every_n_months,
+ priv->ico->recur->interval);
+ break;
+
+ case RECUR_YEARLY_BY_DAY:
+ case RECUR_YEARLY_BY_MONTH:
+ e_dialog_radio_set (priv->recurrence_rule_yearly, RECUR_OPTION_YEARLY,
+ recur_options_map);
+ e_dialog_spin_set (priv->recurrence_rule_yearly_every_n_years,
+ priv->ico->recur->interval);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ if (priv->ico->recur->_enddate == 0) {
+ if (priv->ico->recur->duration == 0)
+ e_dialog_toggle_set (priv->recurrence_ending_date_repeat_forever,
+ TRUE);
+ else {
+ e_dialog_toggle_set (priv->recurrence_ending_date_end_after, TRUE);
+ e_dialog_spin_set (priv->recurrence_ending_date_end_after_count,
+ priv->ico->recur->duration);
+ }
+ } else {
+ e_dialog_toggle_set (priv->recurrence_ending_date_end_on, TRUE);
+ /* Shorten by one day, as we store end-on date a day ahead */
+ /* FIX ME is this correct? */
+ e_dialog_dateedit_set (priv->recurrence_ending_date_end_on_date,
+ time_add_day (priv->ico->recur->enddate, -1));
+ }
+ }
+
+ /* Exception buttons */
+
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_add), "clicked",
+ GTK_SIGNAL_FUNC (recurrence_exception_added), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_delete), "clicked",
+ GTK_SIGNAL_FUNC (recurrence_exception_deleted), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_change), "clicked",
+ GTK_SIGNAL_FUNC (recurrence_exception_changed), ee);
+
+ /* Exceptions list */
+
+ for (list = priv->ico->exdate; list; list = list->next)
+ append_exception (ee, *((time_t *) list->data));
+}
+
static GnomeUIInfo main_menu[] = {
/* FIXME */
GNOMEUIINFO_END
@@ -368,19 +722,22 @@ event_editor_construct (EventEditor *ee, GnomeCalendar *gcal, iCalObject *ico)
goto error;
}
+ priv->gcal = gcal;
+ priv->ico = ico;
+
if (!get_widgets (ee)) {
g_message ("event_editor_construct(): Could not find all widgets in the XML file!");
goto error;
}
+ init_widgets (ee);
+
gtk_object_ref (GTK_OBJECT (contents));
gtk_container_remove (GTK_CONTAINER (toplevel), GTK_WIDGET (contents));
gtk_widget_destroy (GTK_WIDGET (toplevel));
/* Construct the app */
- priv->gcal = gcal;
-
title = make_title_from_ico (ico);
gnome_app_construct (GNOME_APP (ee), "event-editor", title);
g_free (title);
@@ -403,153 +760,27 @@ event_editor_construct (EventEditor *ee, GnomeCalendar *gcal, iCalObject *ico)
GtkWidget *
event_editor_new (GnomeCalendar *gcal, iCalObject *ico)
{
- EventEditor *ee;
+ GtkWidget *ee;
g_return_val_if_fail (gcal != NULL, NULL);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
g_return_val_if_fail (ico != NULL, NULL);
g_return_val_if_fail (ico->uid != NULL, NULL);
- ee = EVENT_EDITOR (gtk_type_new (TYPE_EVENT_EDITOR));
+ ee = GTK_WIDGET (gtk_type_new (TYPE_EVENT_EDITOR));
- ee = event_editor_construct (ee, gcal, ico);
+ ee = event_editor_construct (EVENT_EDITOR (ee), gcal, ico);
if (ee)
- gtk_widget_show (GTK_WIDGET (ee));
-
- return GTK_WIDGET (ee);
-}
-
-static void
-fill_in_dialog_from_ical (EventEditorDialog *dialog)
-{
- iCalObject *ical = dialog->ical;
- GladeXML *gui = dialog->gui;
- GList *list;
- GtkWidget *alarm_display, *alarm_program, *alarm_audio, *alarm_mail;
-
- store_to_editable (gui, "general-owner",
- dialog->ical->organizer->addr ?
- dialog->ical->organizer->addr : _("?"));
+ gtk_widget_show (ee);
- store_to_editable (gui, "general-summary", ical->summary);
-
- /* start and end time */
- store_to_gnome_dateedit (gui, "start-time", ical->dtstart);
- store_to_gnome_dateedit (gui, "end-time", ical->dtend);
-
- check_all_day (dialog);
-
- /* alarms */
- alarm_display = glade_xml_get_widget (dialog->gui, "alarm-display");
- alarm_program = glade_xml_get_widget (dialog->gui, "alarm-program");
- alarm_audio = glade_xml_get_widget (dialog->gui, "alarm-audio");
- alarm_mail = glade_xml_get_widget (dialog->gui, "alarm-mail");
-
- store_to_toggle (gui, "alarm-display", ical->dalarm.enabled);
- store_to_toggle (gui, "alarm-program", ical->palarm.enabled);
- store_to_toggle (gui, "alarm-audio", ical->aalarm.enabled);
- store_to_toggle (gui, "alarm-mail", ical->malarm.enabled);
- alarm_toggle (GTK_TOGGLE_BUTTON (alarm_display), dialog);
- alarm_toggle (GTK_TOGGLE_BUTTON (alarm_program), dialog);
- alarm_toggle (GTK_TOGGLE_BUTTON (alarm_audio), dialog);
- alarm_toggle (GTK_TOGGLE_BUTTON (alarm_mail), dialog);
- gtk_signal_connect (GTK_OBJECT (alarm_display), "toggled", GTK_SIGNAL_FUNC (alarm_toggle), dialog);
- gtk_signal_connect (GTK_OBJECT (alarm_program), "toggled", GTK_SIGNAL_FUNC (alarm_toggle), dialog);
- gtk_signal_connect (GTK_OBJECT (alarm_audio), "toggled", GTK_SIGNAL_FUNC (alarm_toggle), dialog);
- gtk_signal_connect (GTK_OBJECT (alarm_mail), "toggled", GTK_SIGNAL_FUNC (alarm_toggle), dialog);
-
- /* alarm counts */
- store_to_spin (gui, "alarm-display-amount", ical->dalarm.count);
- store_to_spin (gui, "alarm-audio-amount", ical->aalarm.count);
- store_to_spin (gui, "alarm-program-amount", ical->palarm.count);
- store_to_spin (gui, "alarm-mail-amount", ical->malarm.count);
-
- store_to_alarm_unit (gui, "alarm-display-unit", ical->dalarm.units);
- store_to_alarm_unit (gui, "alarm-audio-unit", ical->aalarm.units);
- store_to_alarm_unit (gui, "alarm-program-unit", ical->palarm.units);
- store_to_alarm_unit (gui, "alarm-mail-unit", ical->malarm.units);
-
- store_to_editable (gui, "run-program", ical->palarm.data);
- store_to_editable (gui, "mail-to", ical->malarm.data);
-
- /* classification */
- if (strcmp (ical->class, "PUBLIC") == 0)
- store_to_toggle (gui, "classification-public", TRUE);
- if (strcmp (ical->class, "PRIVATE") == 0)
- store_to_toggle (gui, "classification-private", TRUE);
- if (strcmp (ical->class, "CONFIDENTIAL") == 0)
- store_to_toggle (gui, "classification-confidential", TRUE);
-
- /* recurrence rules */
-
- if (! ical->recur)
- return;
-
- switch (ical->recur->type) {
- case RECUR_DAILY:
- store_to_toggle (gui, "recurrence-rule-daily", TRUE);
- store_to_spin (gui, "recurrence-rule-daily-days", ical->recur->interval);
- break;
- case RECUR_WEEKLY:
- store_to_toggle (gui, "recurrence-rule-weekly", TRUE);
- store_to_spin (gui, "recurrence-rule-weekly-weeks", ical->recur->interval);
- if (ical->recur->weekday & (1 << 0))
- store_to_toggle (gui, "recurrence-rule-weekly-sun", TRUE);
- if (ical->recur->weekday & (1 << 1))
- store_to_toggle (gui, "recurrence-rule-weekly-mon", TRUE);
- if (ical->recur->weekday & (1 << 2))
- store_to_toggle (gui, "recurrence-rule-weekly-tue", TRUE);
- if (ical->recur->weekday & (1 << 3))
- store_to_toggle (gui, "recurrence-rule-weekly-wed", TRUE);
- if (ical->recur->weekday & (1 << 4))
- store_to_toggle (gui, "recurrence-rule-weekly-thu", TRUE);
- if (ical->recur->weekday & (1 << 5))
- store_to_toggle (gui, "recurrence-rule-weekly-fri", TRUE);
- if (ical->recur->weekday & (1 << 6))
- store_to_toggle (gui, "recurrence-rule-weekly-sat", TRUE);
- break;
- case RECUR_MONTHLY_BY_DAY:
- store_to_toggle (gui, "recurrence-rule-monthly", TRUE);
- store_to_toggle (gui, "recurrence-rule-monthly-on-day", TRUE);
- store_to_spin (gui, "recurrence-rule-monthly-day", ical->recur->u.month_day);
- store_to_spin (gui, "recurrence-rule-monthly-every-n-months", ical->recur->interval);
- break;
- case RECUR_MONTHLY_BY_POS:
- store_to_toggle (gui, "recurrence-rule-monthly", TRUE);
- store_to_toggle (gui, "recurrence-rule-monthly-weekday", TRUE);
- store_to_option (gui, "recurrence-rule-monthly-week", ical->recur->u.month_pos);
- store_to_option (gui, "recurrence-rule-monthly-day", ical->recur->weekday);
- store_to_spin (gui, "recurrence-rule-monthly-every-n-months", ical->recur->interval);
- break;
- case RECUR_YEARLY_BY_DAY:
- case RECUR_YEARLY_BY_MONTH:
- store_to_toggle (gui, "recurrence-rule-yearly", TRUE);
- store_to_spin (gui, "recurrence-rule-yearly-every-n-years", ical->recur->interval);
- break;
- }
-
-
- if (ical->recur->_enddate == 0) {
- if (ical->recur->duration == 0)
- store_to_toggle (gui, "recurrence-ending-date-repeat-forever", TRUE);
- else {
- store_to_toggle (gui, "recurrence-ending-date-end-after", TRUE);
- store_to_spin (gui, "recurrence-ending-date-end-after-count", ical->recur->duration);
- }
- } else {
- store_to_toggle (gui, "recurrence-ending-date-end-on", TRUE);
- /* Shorten by one day, as we store end-on date a day ahead */
- /* FIX ME is this correct? */
- store_to_gnome_dateedit (gui, "recurrence-ending-date-end-on-date", ical->recur->enddate - 86400);
- }
-
- /* fill the exceptions list */
- for (list = ical->exdate; list; list = list->next)
- append_exception (dialog, *((time_t *) list->data));
+ return ee;
}
-
+#if 0
+/* FIXME: put this logic in whatever code calls the event editor with a new
+ * iCalObject.
+ */
static void
fill_in_dialog_from_defaults (EventEditorDialog *dialog)
{
@@ -562,329 +793,382 @@ fill_in_dialog_from_defaults (EventEditorDialog *dialog)
store_to_gnome_dateedit (dialog->gui, "start-time", now);
store_to_gnome_dateedit (dialog->gui, "end-time", soon);
}
-
+#endif
static void
-free_exdate (iCalObject *ical)
+free_exdate (iCalObject *ico)
{
GList *list;
- if (!ical->exdate)
+ if (!ico->exdate)
return;
- for (list = ical->exdate; list; list = list->next)
+ for (list = ico->exdate; list; list = list->next)
g_free (list->data);
- g_list_free (ical->exdate);
- ical->exdate = NULL;
+ g_list_free (ico->exdate);
+ ico->exdate = NULL;
}
+/* Decode the radio button group for classifications */
+static ClassificationType
+classification_get (GtkWidget *widget)
+{
+ return e_dialog_radio_get (widget, classification_map);
+}
+/* Get the values of the widgets in the event editor and put them in the iCalObject */
static void
-dialog_to_ical (EventEditorDialog *dialog)
+dialog_to_ical_object (EventEditor *ee)
{
- iCalObject *ical = dialog->ical;
+ EventEditorPrivate *priv;
+ iCalObject *ico;
gboolean all_day_event;
- GladeXML *gui = dialog->gui;
+ int i;
+ time_t *t;
+ GtkCList *exception_list;
+
+ priv = ee->priv;
+ ico = priv->ico;
- /* general event information */
+ if (ico->summary)
+ g_free (ico->summary);
- if (ical->summary)
- g_free (ical->summary);
- ical->summary = extract_from_editable (gui, "general-summary");
+ ico->summary = e_dialog_editable_get (priv->general_summary);
- ical->dtstart = extract_from_gnome_dateedit (gui, "start-time");
- ical->dtend = extract_from_gnome_dateedit (gui, "end-time");
+ ico->dtstart = e_dialog_dateedit_get (priv->start_time);
+ ico->dtend = e_dialog_dateedit_get (priv->end_time);
- all_day_event = extract_from_toggle (gui, "all-day-event");
+ all_day_event = e_dialog_toggle_get (priv->all_day_event);
- ical->dalarm.enabled = extract_from_toggle (gui, "alarm-display");
- ical->aalarm.enabled = extract_from_toggle (gui, "alarm-program");
- ical->palarm.enabled = extract_from_toggle (gui, "alarm-audio");
- ical->malarm.enabled = extract_from_toggle (gui, "alarm-mail");
+ ico->dalarm.enabled = e_dialog_toggle_get (priv->alarm_display);
+ ico->aalarm.enabled = e_dialog_toggle_get (priv->alarm_program);
+ ico->palarm.enabled = e_dialog_toggle_get (priv->alarm_audio);
+ ico->malarm.enabled = e_dialog_toggle_get (priv->alarm_mail);
- ical->dalarm.count = extract_from_spin (gui, "alarm-display-amount");
- ical->aalarm.count = extract_from_spin (gui, "alarm-audio-amount");
- ical->palarm.count = extract_from_spin (gui, "alarm-program-amount");
- ical->malarm.count = extract_from_spin (gui, "alarm-mail-amount");
+ ico->dalarm.count = e_dialog_spin_get_int (priv->alarm_display_amount);
+ ico->aalarm.count = e_dialog_spin_get_int (priv->alarm_audio_amount);
+ ico->palarm.count = e_dialog_spin_get_int (priv->alarm_program_amount);
+ ico->malarm.count = e_dialog_spin_get_int (priv->alarm_mail_amount);
- ical->dalarm.units = extract_from_alarm_unit (gui, "alarm-display-unit");
- ical->aalarm.units = extract_from_alarm_unit (gui, "alarm-audio-unit");
- ical->palarm.units = extract_from_alarm_unit (gui, "alarm-program-unit");
- ical->malarm.units = extract_from_alarm_unit (gui, "alarm-mail-unit");
+ ico->dalarm.units = alarm_unit_get (priv->alarm_display_unit);
+ ico->aalarm.units = alarm_unit_get (priv->alarm_audio_unit);
+ ico->palarm.units = alarm_unit_get (priv->alarm_program_unit);
+ ico->malarm.units = alarm_unit_get (priv->alarm_mail_unit);
- ical->palarm.data = g_strdup (extract_from_editable (gui, "run-program"));
- ical->malarm.data = g_strdup (extract_from_editable (gui, "mail-to"));
+ if (ico->palarm.data)
+ g_free (ico->palarm.data);
- if (extract_from_toggle (gui, "classification-public"))
- ical->class = g_strdup ("PUBLIC");
- else if (extract_from_toggle (gui, "classification-private"))
- ical->class = g_strdup ("PRIVATE");
- else /* "classification-confidential" */
- ical->class = g_strdup ("CONFIDENTIAL");
+ if (ico->malarm.data)
+ g_free (ico->malarm.data);
+ ico->palarm.data = e_dialog_editable_get (priv->alarm_program_run_program);
+ ico->malarm.data = e_dialog_editable_get (priv->alarm_mail_mail_to);
+
+ if (ico->class)
+ g_free (ico->class);
+
+ switch (classification_get (priv->classification_radio)) {
+ case CLASSIFICATION_PUBLIC:
+ ico->class = g_strdup ("PUBLIC");
+ break;
- /* recurrence information */
+ case CLASSIFICATION_PRIVATE:
+ ico->class = g_strdup ("PRIVATE");
+ break;
- if (extract_from_toggle (gui, "recurrence-rule-none"))
- return; /* done */
- if (!ical->recur)
- ical->recur = g_new0 (Recurrence, 1);
+ case CLASSIFICATION_CONFIDENTIAL:
+ ico->class = g_strdup ("CONFIDENTIAL");
+ break;
- if (extract_from_toggle (gui, "recurrence-rule-daily")) {
- ical->recur->type = RECUR_DAILY;
- ical->recur->interval = extract_from_spin (gui, "recurrence-rule-daily-days");
+ default:
+ g_assert_not_reached ();
}
- if (extract_from_toggle (gui, "recurrence-rule-weekly")) {
- ical->recur->type = RECUR_WEEKLY;
- ical->recur->interval = extract_from_spin (gui, "recurrence-rule-weekly-weeks");
- ical->recur->weekday = 0;
-
- if (extract_from_toggle (gui, "recurrence-rule-weekly-sun"))
- ical->recur->weekday |= 1 << 0;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-mon"))
- ical->recur->weekday |= 1 << 1;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-tue"))
- ical->recur->weekday |= 1 << 2;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-wed"))
- ical->recur->weekday |= 1 << 3;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-thu"))
- ical->recur->weekday |= 1 << 4;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-fri"))
- ical->recur->weekday |= 1 << 5;
- if (extract_from_toggle (gui, "recurrence-rule-weekly-sat"))
- ical->recur->weekday |= 1 << 6;
+
+ /* Recurrence information */
+
+ if (ico->recur) {
+ g_free (ico->recur);
+ ico->recur = NULL;
}
- if (extract_from_toggle (gui, "recurrence-rule-monthly")) {
- if (extract_from_toggle (gui, "recurrence-rule-monthly-on-day")) {
- /* by day of in the month (ex: the 5th) */
- ical->recur->type = RECUR_MONTHLY_BY_DAY;
- ical->recur->u.month_day = extract_from_spin (gui, "recurrence-rule-monthly-day");
- }
- else { /* "recurrence-rule-monthly-weekday" is TRUE */
+ switch (recur_options_get (priv->recurrence_rule_none)) {
+ case RECUR_OPTION_NONE:
+ /* nothing */
+ break;
+
+ case RECUR_OPTION_DAILY:
+ ico->recur = g_new0 (Recurrence, 1);
+ ico->recur->type = RECUR_DAILY;
+ ico->recur->interval = e_dialog_spin_get_int (priv->recurrence_rule_daily_days);
+ break;
+
+ case RECUR_OPTION_WEEKLY:
+ ico->recur = g_new0 (Recurrence, 1);
+ ico->recur->type = RECUR_WEEKLY;
+ ico->recur->interval = e_dialog_spin_get_int (priv->recurrence_rule_weekly_weeks);
+ ico->recur->weekday = 0;
+
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_sun))
+ ico->recur->weekday |= 1 << 0;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_mon))
+ ico->recur->weekday |= 1 << 1;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_tue))
+ ico->recur->weekday |= 1 << 2;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_wed))
+ ico->recur->weekday |= 1 << 3;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_thu))
+ ico->recur->weekday |= 1 << 4;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_fri))
+ ico->recur->weekday |= 1 << 5;
+ if (e_dialog_toggle_get (priv->recurrence_rule_weekly_sat))
+ ico->recur->weekday |= 1 << 6;
+
+ break;
+
+ case RECUR_OPTION_MONTHLY:
+ ico->recur = g_new0 (Recurrence, 1);
+
+ if (e_dialog_toggle_get (priv->recurrence_rule_monthly_on_day)) {
+ /* by day of in the month (ex: the 5th) */
+ ico->recur->type = RECUR_MONTHLY_BY_DAY;
+ ico->recur->u.month_day = e_dialog_spin_get_int (
+ priv->recurrence_rule_monthly_day_nth);
+ } else if (e_dialog_toggle_get (priv->recurrence_rule_monthly_weekday)) {
+ /* "recurrence-rule-monthly-weekday" is TRUE */
/* by position on the calender (ex: 2nd monday) */
- ical->recur->type = RECUR_MONTHLY_BY_POS;
- ical->recur->u.month_pos = extract_from_option (gui, "recurrence-rule-monthly-week");
- ical->recur->weekday = extract_from_option (gui, "recurrence-rule-monthly-day");
- }
- ical->recur->interval = extract_from_spin (gui, "recurrence-rule-monthly-every-n-months");
- }
- if (extract_from_toggle (gui, "recurrence-rule-yearly")) {
- ical->recur->type = RECUR_YEARLY_BY_DAY;
- ical->recur->interval = extract_from_spin (gui, "recurrence-rule-yearly-every-n-years");
- /* FIXME: need to specify anything else? I am assuming the code will look at the dtstart
- * to figure out when to recur. - Federico
- */
- }
+ ico->recur->type = RECUR_MONTHLY_BY_POS;
+ ico->recur->u.month_pos = e_dialog_option_menu_get (
+ priv->recurrence_rule_monthly_week,
+ month_pos_map);
+ ico->recur->weekday = e_dialog_option_menu_get (
+ priv->recurrence_rule_monthly_weekpos,
+ weekday_map);
- /* recurrence ending date */
- if (extract_from_toggle (gui, "recurrence-ending-date-repeat-forever")) {
- ical->recur->_enddate = 0;
- ical->recur->enddate = 0;
- ical->recur->duration = 0;
- }
- if (extract_from_toggle (gui, "recurrence-ending-date-end-on")) {
- /* Also here, to ensure that the event is used, we add 86400 secs to get
- get next day, in accordance to the RFC */
- ical->recur->_enddate = extract_from_gnome_dateedit (gui, "recurrence-ending-date-end-on-date") + 86400;
- ical->recur->enddate = ical->recur->_enddate;
- ical->recur->duration = 0;
- }
- if (extract_from_toggle (gui, "recurrence-ending-date-end-after")) {
- ical->recur->duration = extract_from_spin (gui, "recurrence-ending-date-end-after-count");
- ical_object_compute_end (ical);
- }
+ } else
+ g_assert_not_reached ();
+ ico->recur->interval = e_dialog_spin_get_int (
+ priv->recurrence_rule_monthly_every_n_months);
- /* 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"));
+ break;
- free_exdate (ical);
+ case RECUR_OPTION_YEARLY:
+ ico->recur = g_new0 (Recurrence, 1);
+ ico->recur->type = RECUR_YEARLY_BY_DAY;
+ ico->recur->interval = e_dialog_spin_get_int (
+ priv->recurrence_rule_yearly_every_n_years);
- 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);
- }
+ default:
+ g_assert_not_reached ();
}
-}
+ /* recurrence ending date */
+
+ if (e_dialog_toggle_get (priv->recurrence_ending_date_repeat_forever)) {
+ ico->recur->_enddate = 0;
+ ico->recur->enddate = 0;
+ ico->recur->duration = 0;
+ } else if (e_dialog_toggle_get (priv->recurrence_ending_date_end_on)) {
+ /* Also here, to ensure that the event is used, we add 86400
+ * secs to get get next day, in accordance to the RFC
+ */
+ ico->recur->_enddate = e_dialog_dateedit_get (
+ priv->recurrence_ending_date_end_on_date) + 86400;
+ ico->recur->enddate = ico->recur->_enddate;
+ ico->recur->duration = 0;
+ } else if (e_dialog_toggle_get (priv->recurrence_ending_date_end_after)) {
+ ico->recur->duration = e_dialog_spin_get_int (
+ priv->recurrence_ending_date_end_after_count);
+ ical_object_compute_end (ico);
+ } else
+ g_assert_not_reached ();
+
+ /* Get exceptions from clist into ico->exdate */
+
+ free_exdate (ico);
+ exception_list = GTK_CLIST (priv->recurrence_exceptions_list);
+
+ for (i = 0; i < exception_list->rows; i++) {
+ t = gtk_clist_get_row_data (exception_list, i);
+ ico->exdate = g_list_prepend (ico->exdate, t);
+ }
+}
static void
-ee_ok (GtkWidget *widget, EventEditorDialog *dialog)
+ee_ok (GtkWidget *widget, EventEditor *ee)
{
- dialog_to_ical (dialog);
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
+ dialog_to_ical_object (ee);
- if (dialog->ical->new)
- gnome_calendar_add_object (dialog->gnome_cal, dialog->ical);
+ if (priv->ico->new)
+ gnome_calendar_add_object (priv->gcal, priv->ico);
else
- gnome_calendar_object_changed (dialog->gnome_cal,
- dialog->ical,
- CHANGE_ALL);
- dialog->ical->new = 0;
-}
+ gnome_calendar_object_changed (priv->gcal, priv->ico);
+ priv->ico->new = FALSE;
+}
static void
-ee_cancel (GtkWidget *widget, EventEditorDialog *dialog)
+ee_cancel (GtkWidget *widget, EventEditor *ee)
{
- if (dialog->ical) {
- ical_object_unref (dialog->ical);
- dialog->ical = NULL;
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
+ if (priv->ico) {
+ ical_object_unref (priv->ico);
+ priv->ico = NULL;
}
}
-
static void
-alarm_toggle (GtkToggleButton *toggle, EventEditorDialog *dialog)
+alarm_toggle (GtkWidget *toggle, EventEditor *ee)
{
- GtkWidget *alarm_display = glade_xml_get_widget (dialog->gui, "alarm-display");
- GtkWidget *alarm_program = glade_xml_get_widget (dialog->gui, "alarm-program");
- GtkWidget *alarm_audio = glade_xml_get_widget (dialog->gui, "alarm-audio");
- GtkWidget *alarm_mail = glade_xml_get_widget (dialog->gui, "alarm-mail");
- GtkWidget *alarm_amount, *alarm_unit;
-
- if (GTK_WIDGET (toggle) == alarm_display) {
- alarm_amount = glade_xml_get_widget (dialog->gui, "alarm-display-amount");
- alarm_unit = glade_xml_get_widget (dialog->gui, "alarm-display-unit");
- }
- if (GTK_WIDGET (toggle) == alarm_audio) {
- alarm_amount = glade_xml_get_widget (dialog->gui, "alarm-audio-amount");
- alarm_unit = glade_xml_get_widget (dialog->gui, "alarm-audio-unit");
- }
- if (GTK_WIDGET (toggle) == alarm_program) {
- GtkWidget *run_program;
- alarm_amount = glade_xml_get_widget (dialog->gui, "alarm-program-amount");
- alarm_unit = glade_xml_get_widget (dialog->gui, "alarm-program-unit");
- run_program = glade_xml_get_widget (dialog->gui, "run-program-file-entry");
- gtk_widget_set_sensitive (run_program, toggle->active);
- }
- if (GTK_WIDGET (toggle) == alarm_mail) {
- GtkWidget *mail_to;
- alarm_amount = glade_xml_get_widget (dialog->gui, "alarm-mail-amount");
- alarm_unit = glade_xml_get_widget (dialog->gui, "alarm-mail-unit");
- mail_to = glade_xml_get_widget (dialog->gui, "mail-to");
- gtk_widget_set_sensitive (mail_to, toggle->active);
- }
-
- gtk_widget_set_sensitive (alarm_amount, toggle->active);
- gtk_widget_set_sensitive (alarm_unit, toggle->active);
-}
+ EventEditorPrivate *priv;
+ GtkWidget *alarm_amount;
+ GtkWidget *alarm_unit;
+ gboolean active;
+ priv = ee->priv;
+ active = GTK_TOGGLE_BUTTON (toggle)->active;
+
+ if (toggle == priv->alarm_display) {
+ alarm_amount = priv->alarm_display_amount;
+ alarm_unit = priv->alarm_display_unit;
+ } else if (toggle == priv->alarm_audio) {
+ alarm_amount = priv->alarm_audio_amount;
+ alarm_unit = priv->alarm_audio_unit;
+ } else if (toggle == priv->alarm_program) {
+ alarm_amount = priv->alarm_program_amount;
+ alarm_unit = priv->alarm_program_unit;
+ gtk_widget_set_sensitive (priv->alarm_program_run_program, active);
+ } else if (toggle == priv->alarm_mail) {
+ alarm_amount = priv->alarm_mail_amount;
+ alarm_unit = priv->alarm_mail_unit;
+ gtk_widget_set_sensitive (priv->alarm_mail_mail_to, active);
+ } else
+ g_assert_not_reached ();
+
+ gtk_widget_set_sensitive (alarm_amount, active);
+ gtk_widget_set_sensitive (alarm_unit, active);
+}
/*
* Checks if the day range occupies all the day, and if so, check the
* box accordingly
*/
static void
-check_all_day (EventEditorDialog *dialog)
+check_all_day (EventEditor *ee)
{
- time_t ev_start = extract_from_gnome_dateedit (dialog->gui, "start-time");
- time_t ev_end = extract_from_gnome_dateedit (dialog->gui, "end-time");
+ EventEditorPrivate *priv;
+ time_t ev_start, ev_end;
+
+ priv = ee->priv;
+
+ ev_start = e_dialog_dateedit_get (priv->start_time);
+ ev_end = e_dialog_dateedit_get (priv->end_time);
/* all day event checkbox */
if (get_time_t_hour (ev_start) <= day_begin &&
get_time_t_hour (ev_end) >= day_end)
- store_to_toggle (dialog->gui, "all-day-event", TRUE);
+ e_dialog_toggle_set (priv->all_day_event, TRUE);
else
- store_to_toggle (dialog->gui, "all-day-event", FALSE);
+ e_dialog_toggle_set (priv->all_day_event, FALSE);
}
-
/*
* Callback: all day event box clicked
*/
static void
-set_all_day (GtkToggleButton *toggle, EventEditorDialog *dialog)
+set_all_day (GtkWidget *toggle, EventEditor *ee)
{
+ EventEditorPrivate *priv;
struct tm tm;
time_t start_t;
- start_t = extract_from_gnome_dateedit (dialog->gui, "start-time");
+ priv = ee->priv;
+
+ start_t = e_dialog_dateedit_get (priv->start_time);
tm = *localtime (&start_t);
tm.tm_hour = day_begin;
tm.tm_min = 0;
tm.tm_sec = 0;
- store_to_gnome_dateedit (dialog->gui, "start-time", mktime (&tm));
-
- if (toggle->active)
+ e_dialog_dateedit_set (priv->start_time, mktime (&tm));
+
+ if (GTK_TOGGLE_BUTTON (toggle)->active)
tm.tm_hour = day_end;
else
tm.tm_hour++;
-
- store_to_gnome_dateedit (dialog->gui, "end-time", mktime (&tm));
-}
+ e_dialog_dateedit_set (priv->end_time, mktime (&tm));
+}
/*
* Callback: checks that the dates are start < end
*/
static void
-check_dates (GnomeDateEdit *gde, EventEditorDialog *dialog)
+check_dates (GnomeDateEdit *gde, EventEditor *ee)
{
+ EventEditorPrivate *priv;
time_t start, end;
struct tm tm_start, tm_end;
- GtkWidget *start_time = glade_xml_get_widget (dialog->gui, "start-time");
- GtkWidget *end_time = glade_xml_get_widget (dialog->gui, "end-time");
+ priv = ee->priv;
- //start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- start = extract_from_gnome_dateedit (dialog->gui, "start-time");
- //end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
- end = extract_from_gnome_dateedit (dialog->gui, "end-time");
+ start = e_dialog_dateedit_get (priv->start_time);
+ end = e_dialog_dateedit_get (priv->end_time);
if (start > end) {
tm_start = *localtime (&start);
tm_end = *localtime (&end);
- if (GTK_WIDGET (gde) == start_time) {
+ if (GTK_WIDGET (gde) == priv->start_time) {
tm_end.tm_year = tm_start.tm_year;
tm_end.tm_mon = tm_start.tm_mon;
tm_end.tm_mday = tm_start.tm_mday;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == end_time) {
+ e_dialog_dateedit_set (priv->end_time, mktime (&tm_end));
+ } else if (GTK_WIDGET (gde) == priv->end_time) {
tm_start.tm_year = tm_end.tm_year;
tm_start.tm_mon = tm_end.tm_mon;
tm_start.tm_mday = tm_end.tm_mday;
- //gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm_start));
+/* e_dialog_dateedit_set (priv->start_time, mktime (&tm_start)); */
}
}
}
-
/*
* Callback: checks that start_time < end_time and whether the
* selected hour range spans all of the day
*/
static void
-check_times (GnomeDateEdit *gde, EventEditorDialog *dialog)
+check_times (GnomeDateEdit *gde, EventEditor *ee)
{
+ EventEditorPrivate *priv;
time_t start, end;
struct tm tm_start, tm_end;
- GtkWidget *start_time = glade_xml_get_widget (dialog->gui, "start-time");
- GtkWidget *end_time = glade_xml_get_widget (dialog->gui, "end-time");
+ priv = ee->priv;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_flush ();
- start = gnome_date_edit_get_date (GNOME_DATE_EDIT (start_time));
- end = gnome_date_edit_get_date (GNOME_DATE_EDIT (end_time));
+ start = e_dialog_dateedit_get (priv->start_time);
+ end = e_dialog_dateedit_get (priv->end_time);
if (start >= end) {
tm_start = *localtime (&start);
tm_end = *localtime (&end);
- if (GTK_WIDGET (gde) == start_time) {
+ if (GTK_WIDGET (gde) == priv->start_time) {
tm_end.tm_min = tm_start.tm_min;
tm_end.tm_sec = tm_start.tm_sec;
-
tm_end.tm_hour = tm_start.tm_hour + 1;
if (tm_end.tm_hour >= 24) {
@@ -893,11 +1177,10 @@ check_times (GnomeDateEdit *gde, EventEditorDialog *dialog)
tm_end.tm_sec = 0;
}
- gnome_date_edit_set_time (GNOME_DATE_EDIT (end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == end_time) {
+ e_dialog_dateedit_set (priv->end_time, mktime (&tm_end));
+ } else if (GTK_WIDGET (gde) == priv->end_time) {
tm_start.tm_min = tm_end.tm_min;
tm_start.tm_sec = tm_end.tm_sec;
-
tm_start.tm_hour = tm_end.tm_hour - 1;
if (tm_start.tm_hour < 0) {
@@ -906,37 +1189,29 @@ check_times (GnomeDateEdit *gde, EventEditorDialog *dialog)
tm_start.tm_min = 0;
}
- gnome_date_edit_set_time (GNOME_DATE_EDIT (start_time), mktime (&tm_start));
+ e_dialog_dateedit_set (priv->start_time, mktime (&tm_start));
}
}
/* Check whether the event spans the whole day */
- check_all_day (dialog);
+ check_all_day (ee);
}
-
static void
-recurrence_toggled (GtkWidget *radio, EventEditorDialog *dialog)
+recurrence_toggled (GtkWidget *radio, EventEditor *ee)
{
- GtkWidget *recurrence_rule_notebook = glade_xml_get_widget (dialog->gui, "recurrence-rule-notebook");
-
- GtkWidget *recurrence_rule_none = glade_xml_get_widget (dialog->gui, "recurrence-rule-none");
- GtkWidget *recurrence_rule_daily = glade_xml_get_widget (dialog->gui, "recurrence-rule-daily");
- GtkWidget *recurrence_rule_weekly = glade_xml_get_widget (dialog->gui, "recurrence-rule-weekly");
- GtkWidget *recurrence_rule_monthly = glade_xml_get_widget (dialog->gui, "recurrence-rule-monthly");
- GtkWidget *recurrence_rule_yearly = glade_xml_get_widget (dialog->gui, "recurrence-rule-yearly");
-
- if (radio == recurrence_rule_none)
- gtk_notebook_set_page (GTK_NOTEBOOK (recurrence_rule_notebook), 0);
- if (radio == recurrence_rule_daily)
- gtk_notebook_set_page (GTK_NOTEBOOK (recurrence_rule_notebook), 1);
- if (radio == recurrence_rule_weekly)
- gtk_notebook_set_page (GTK_NOTEBOOK (recurrence_rule_notebook), 2);
- if (radio == recurrence_rule_monthly)
- gtk_notebook_set_page (GTK_NOTEBOOK (recurrence_rule_notebook), 3);
- if (radio == recurrence_rule_yearly)
- gtk_notebook_set_page (GTK_NOTEBOOK (recurrence_rule_notebook), 4);
+ EventEditorPrivate *priv;
+ RecurOptions ro;
+
+ priv = ee->priv;
+
+ if (!GTK_TOGGLE_BUTTON (radio)->active)
+ return;
+
+ ro = e_dialog_radio_get (radio, recur_options_map);
+
+ gtk_notebook_set_page (GTK_NOTEBOOK (priv->recurrence_rule_notebook), (int) ro);
}
@@ -945,234 +1220,121 @@ get_exception_string (time_t t)
{
static char buf[256];
- strftime (buf, sizeof(buf), _("%a %b %d %Y"), localtime (&t));
+ strftime (buf, sizeof (buf), _("%a %b %d %Y"), localtime (&t));
return buf;
}
static void
-append_exception (EventEditorDialog *dialog, time_t t)
+append_exception (EventEditor *ee, time_t t)
{
+ EventEditorPrivate *priv;
time_t *tt;
- char *c[1];
- int i;
- GtkCList *exception_list = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list"));
+ char *c[1];
+ int i;
+ GtkCList *clist;
+
+ priv = ee->priv;
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);
+ clist = GTK_CLIST (priv->recurrence_exceptions_list);
+
+ i = gtk_clist_append (clist, c);
+ gtk_clist_set_row_data (clist, i, tt);
+ gtk_clist_select_row (clist, i, 0);
- //gtk_widget_set_sensitive (ee->recur_ex_vbox, TRUE);
+/* gtk_widget_set_sensitive (ee->recur_ex_vbox, TRUE); */
}
static void
-recurrence_exception_added (GtkWidget *widget, EventEditorDialog *dialog)
+recurrence_exception_added (GtkWidget *widget, EventEditor *ee)
{
- //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);
+ EventEditorPrivate *priv;
+ time_t t;
+
+ priv = ee->priv;
+
+ t = e_dialog_dateedit_get (priv->recurrence_exceptions_date);
+ append_exception (ee, t);
}
static void
-recurrence_exception_deleted (GtkWidget *widget, EventEditorDialog *dialog)
+recurrence_exception_deleted (GtkWidget *widget, EventEditor *ee)
{
+ EventEditorPrivate *priv;
GtkCList *clist;
- int sel, length;
+ int sel;
- clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list"));
- if (! clist->selection)
+ priv = ee->priv;
+
+ clist = GTK_CLIST (priv->recurrence_exceptions_list);
+ if (!clist->selection)
return;
- sel = GPOINTER_TO_INT(clist->selection->data);
+
+ 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)
+ if (sel >= clist->rows)
sel--;
- gtk_clist_select_row (clist, sel, 0);
- //if (clist->rows == 0)
- // gtk_widget_set_sensitive (ee->recur_ex_vbox, FALSE);
+ gtk_clist_select_row (clist, sel, 0);
}
static void
-recurrence_exception_changed (GtkWidget *widget, EventEditorDialog *dialog)
+recurrence_exception_changed (GtkWidget *widget, EventEditor *ee)
{
+ EventEditorPrivate *priv;
GtkCList *clist;
time_t *t;
int sel;
- clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "recurrence-exceptions-list"));
- if (! clist->selection)
+ priv = ee->priv;
+
+ clist = GTK_CLIST (priv->recurrence_exceptions_list);
+ if (!clist->selection)
return;
- sel = GPOINTER_TO_INT(clist->selection->data);
+ 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");
+ *t = e_dialog_dateedit_get (priv->recurrence_exceptions_date);
gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
}
-#if 0
-GtkWidget *event_editor_new (GnomeCalendar *gcal, iCalObject *ical)
-{
- EventEditorDialog *dialog = g_new0 (EventEditorDialog, 1);
-
- dialog->ical = ical;
- dialog->gnome_cal = gcal;
-
- printf ("glade_xml_new (%s, NULL)\n",
- EVOLUTION_GLADEDIR "/event-editor-dialog.glade");
-
- dialog->gui = glade_xml_new (EVOLUTION_GLADEDIR
- "/event-editor-dialog.glade",
- NULL);
-
- dialog->dialog = glade_xml_get_widget (dialog->gui,
- "event-editor-dialog");
-
- gnome_dialog_button_connect (GNOME_DIALOG (dialog->dialog),
- 0, GTK_SIGNAL_FUNC(ee_ok), dialog);
- gnome_dialog_button_connect (GNOME_DIALOG (dialog->dialog),
- 1, GTK_SIGNAL_FUNC(ee_cancel), dialog);
-
-
- {
- GtkWidget *start_time = glade_xml_get_widget (dialog->gui, "start-time");
- GtkWidget *end_time = glade_xml_get_widget (dialog->gui, "end-time");
-
- gtk_signal_connect (GTK_OBJECT (start_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), dialog);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), dialog);
-
- gtk_signal_connect (GTK_OBJECT (end_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), dialog);
- gtk_signal_connect (GTK_OBJECT (end_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), dialog);
- }
-
-
- {
- GtkWidget *all_day_checkbox = glade_xml_get_widget (dialog->gui, "all-day-event");
- gtk_signal_connect (GTK_OBJECT (all_day_checkbox), "toggled", GTK_SIGNAL_FUNC (set_all_day), dialog);
- }
-
-
- {
- GtkWidget *recurrence_rule_none = glade_xml_get_widget (dialog->gui, "recurrence-rule-none");
- GtkWidget *recurrence_rule_daily = glade_xml_get_widget (dialog->gui, "recurrence-rule-daily");
- GtkWidget *recurrence_rule_weekly = glade_xml_get_widget (dialog->gui, "recurrence-rule-weekly");
- GtkWidget *recurrence_rule_monthly = glade_xml_get_widget (dialog->gui, "recurrence-rule-monthly");
- GtkWidget *recurrence_rule_yearly = glade_xml_get_widget (dialog->gui, "recurrence-rule-yearly");
-
- gtk_signal_connect (GTK_OBJECT (recurrence_rule_none), "toggled",
- GTK_SIGNAL_FUNC (recurrence_toggled), dialog);
- gtk_signal_connect (GTK_OBJECT (recurrence_rule_daily), "toggled",
- GTK_SIGNAL_FUNC (recurrence_toggled), dialog);
- gtk_signal_connect (GTK_OBJECT (recurrence_rule_weekly), "toggled",
- GTK_SIGNAL_FUNC (recurrence_toggled), dialog);
- gtk_signal_connect (GTK_OBJECT (recurrence_rule_monthly), "toggled",
- GTK_SIGNAL_FUNC (recurrence_toggled), dialog);
- gtk_signal_connect (GTK_OBJECT (recurrence_rule_yearly), "toggled",
- GTK_SIGNAL_FUNC (recurrence_toggled), dialog);
-
- }
-
-
- {
- 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);
- else
- fill_in_dialog_from_ical (dialog);
-
-
- gnome_dialog_run (GNOME_DIALOG(dialog->dialog));
-
- gnome_dialog_close (GNOME_DIALOG(dialog->dialog));
-
- return dialog->dialog;
-}
-#endif
-
-void event_editor_new_whole_day (GnomeCalendar *owner, time_t day)
-{
- struct tm tm;
- iCalObject *ico;
- GtkWidget *ee;
-
- g_return_if_fail (owner != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (owner));
-
- ico = ical_new ("", user_name, "");
- ico->new = TRUE;
-
- tm = *localtime (&day);
-
- /* Set the start time of the event to the beginning of the day */
-
- tm.tm_hour = day_begin;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- ico->dtstart = mktime (&tm);
-
- /* Set the end time of the event to the end of the day */
-
- tm.tm_hour = day_end;
- ico->dtend = mktime (&tm);
-
- /* Launch the event editor */
-
- ee = event_editor_new (owner, ico);
-}
-
-
-
-GtkWidget *make_date_edit (void)
+GtkWidget *
+make_date_edit (void)
{
return date_edit_new (time (NULL), FALSE);
}
-GtkWidget *make_date_edit_with_time (void)
+GtkWidget *
+make_date_edit_with_time (void)
{
return date_edit_new (time (NULL), TRUE);
}
-
-GtkWidget *date_edit_new (time_t the_time, int show_time)
+
+GtkWidget *
+date_edit_new (time_t the_time, int show_time)
{
return gnome_date_edit_new_flags (the_time,
- ((show_time ? GNOME_DATE_EDIT_SHOW_TIME : 0)
- | (am_pm_flag ? 0 : GNOME_DATE_EDIT_24_HR)
- | (week_starts_on_monday
- ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY
- : 0)));
+ ((show_time ? GNOME_DATE_EDIT_SHOW_TIME : 0)
+ | (am_pm_flag ? 0 : GNOME_DATE_EDIT_24_HR)
+ | (week_starts_on_monday
+ ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY
+ : 0)));
}
diff --git a/calendar/gui/event-editor.h b/calendar/gui/event-editor.h
index 00646afd75..b3a9550555 100644
--- a/calendar/gui/event-editor.h
+++ b/calendar/gui/event-editor.h
@@ -70,10 +70,12 @@ GtkWidget *event_editor_construct (EventEditor *ee, GnomeCalendar *gcal, iCalObj
GtkWidget *event_editor_new (GnomeCalendar *gcal, iCalObject *ico);
+#if 0
/* Convenience function to create and show a new event editor for an
* event that goes from day_begin to day_end of the specified day.
*/
void event_editor_new_whole_day (GnomeCalendar *owner, time_t day);
+#endif
GtkWidget *make_date_edit (void);
GtkWidget *make_date_edit_with_time (void);
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index 517f2f83c8..c1b8b860f7 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -752,7 +752,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee)
if (ee->ical->new)
gnome_calendar_add_object (ee->gnome_cal, ee->ical);
else
- gnome_calendar_object_changed (ee->gnome_cal, ee->ical, CHANGE_ALL);
+ gnome_calendar_object_changed (ee->gnome_cal, ee->ical);
ee->ical->new = 0;
}
diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c
index a7c54e6086..1308a6f5eb 100644
--- a/calendar/gui/gncal-todo.c
+++ b/calendar/gui/gncal-todo.c
@@ -86,7 +86,7 @@ ok_button (GtkWidget *widget, GnomeDialog *dialog)
gnome_calendar_add_object (todo->calendar, ico);
ico->new = FALSE;
} else
- gnome_calendar_object_changed (todo->calendar, ico, CHANGE_ALL); /* ok, summary only... */
+ gnome_calendar_object_changed (todo->calendar, ico);
ical_object_unref (ico);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a38b1ca1cb..b6d035c201 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1035,7 +1035,7 @@ gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj)
}
void
-gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags)
+gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj)
{
char *obj_string;
g_return_if_fail (gcal != NULL);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 3711e65af0..41f8b43d9e 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -108,8 +108,7 @@ void gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
/* Flags is a bitmask of CalObjectChange values */
void gnome_calendar_object_changed (GnomeCalendar *gcal,
- iCalObject *obj,
- int flags);
+ iCalObject *obj);
GnomeCalendar *gnome_calendar_locate (const char *pathname);
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 519b62cb7b..9c0a9deb65 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,21 @@
+2000-05-30 Federico Mena Quintero <federico@helixcode.com>
+
+ * e-dialog-widgets.c (hook_radio): Use the exported function to
+ set the value.
+ (get_radio_value): Likewise.
+ (hook_option_menu): Likewise.
+ (get_option_menu_value): Likewise.
+ (hook_toggle): Likewise.
+ (get_toggle_value): Likewise.
+ (hook_spin_button): Likewise.
+ (get_spin_button_value): Likewise.
+ (hook_editable): Likewise.
+ (get_editable_value): Likewise.
+ (e_dialog_radio_set): Radio buttons are prepended to their parent
+ group's list, so we need to flip the index around when
+ getting/setting the value.
+ (e_dialog_radio_get): Likewise.
+
2000-05-27 Federico Mena Quintero <federico@helixcode.com>
* e-dialog-widgets.c (e_dialog_editable_set): Moved over from
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
index 98099a1891..d4a50e0cd7 100644
--- a/e-util/e-dialog-widgets.c
+++ b/e-util/e-dialog-widgets.c
@@ -136,10 +136,9 @@ static void
hook_radio (GtkWidget *dialog, GtkRadioButton *radio, gpointer value_var, gpointer info)
{
GSList *group;
+ GSList *l;
int *value;
- int i;
const int *value_map;
- GSList *l;
group = gtk_radio_button_group (radio);
@@ -148,15 +147,7 @@ hook_radio (GtkWidget *dialog, GtkRadioButton *radio, gpointer value_var, gpoint
value = (int *) value_var;
value_map = (const int *) info;
- i = value_to_index (value_map, *value);
- if (i != -1) {
- l = g_slist_nth (group, i);
- if (!l)
- g_message ("hook_radio(): could not find index %d in radio group!", i);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l->data), TRUE);
- } else
- g_message ("hook_radio(): could not find value %d in value map!", *value);
+ e_dialog_radio_set (GTK_WIDGET (radio), *value, value_map);
/* Hook to changed */
@@ -170,35 +161,13 @@ hook_radio (GtkWidget *dialog, GtkRadioButton *radio, gpointer value_var, gpoint
static void
get_radio_value (GtkRadioButton *radio, gpointer value_var, gpointer info)
{
- GSList *group;
- GSList *l;
- int i;
int *value;
const int *value_map;
- int v;
-
- group = gtk_radio_button_group (radio);
-
- for (i = 0, l = group; l; l = l->next) {
- radio = GTK_RADIO_BUTTON (l->data);
-
- if (GTK_TOGGLE_BUTTON (radio)->active)
- break;
- }
-
- if (!l)
- g_assert_not_reached ();
value = (int *) value_var;
value_map = (const int *) info;
- v = index_to_value (value_map, i);
- if (v == -1) {
- g_message ("get_radio_value(): could not find index %d in value map!", i);
- return;
- }
-
- *value = v;
+ *value = e_dialog_radio_get (GTK_WIDGET (radio), value_map);
}
/* Callback for the "activate" signal of menu items */
@@ -216,7 +185,6 @@ static void
hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, gpointer info)
{
int *value;
- int i;
const int *value_map;
/* Set the value */
@@ -224,11 +192,7 @@ hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, g
value = (int *) value_var;
value_map = (const int *) info;
- i = value_to_index (value_map, *value);
- if (i != -1)
- gtk_option_menu_set_history (omenu, i);
- else
- g_message ("hook_option_menu(): could not find value %d in value map!", *value);
+ e_dialog_option_menu_set (GTK_WIDGET (omenu), *value, value_map);
/* Hook to changed */
@@ -248,40 +212,13 @@ hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, g
static void
get_option_menu_value (GtkOptionMenu *omenu, gpointer value_var, gpointer info)
{
- GtkMenu *menu;
- GtkWidget *active;
- GList *children;
- GList *l;
- int i;
int *value;
const int *value_map;
- int v;
-
- menu = GTK_MENU (gtk_option_menu_get_menu (omenu));
-
- active = gtk_menu_get_active (menu);
- g_assert (active != NULL);
-
- children = GTK_MENU_SHELL (menu)->children;
-
- for (i = 0, l = children; l; l = l->next) {
- if (GTK_WIDGET (l->data) == active)
- break;
- }
-
- if (!l)
- g_assert_not_reached ();
value = (int *) value_var;
value_map = (const int *) info;
- v = index_to_value (value_map, i);
- if (v == -1) {
- g_message ("get_option_menu_value(): could not find index %d in value map!", i);
- return;
- }
-
- *value = v;
+ *value = e_dialog_option_menu_get (GTK_WIDGET (omenu), value_map);
}
/* Hooks a toggle button */
@@ -293,7 +230,7 @@ hook_toggle (GtkWidget *dialog, GtkToggleButton *toggle, gpointer value_var, gpo
/* Set the value */
value = (gboolean *) value_var;
- gtk_toggle_button_set_active (toggle, *value);
+ e_dialog_toggle_set (GTK_WIDGET (toggle), *value);
/* Hook to changed */
@@ -309,7 +246,7 @@ get_toggle_value (GtkToggleButton *toggle, gpointer value_var, gpointer info)
gboolean *value;
value = (gboolean *) value;
- *value = toggle->active ? TRUE : FALSE;
+ *value = e_dialog_toggle_get (GTK_WIDGET (toggle));
}
/* Callback for the "value_changed" signal of the adjustment of a spin button */
@@ -332,13 +269,12 @@ hook_spin_button (GtkWidget *dialog, GtkSpinButton *spin, gpointer value_var, gp
/* Set the value */
value = (double *) value_var;
- adj = gtk_spin_button_get_adjustment (spin);
-
- adj->value = *value;
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
+ e_dialog_spin_set (GTK_WIDGET (spin), *value);
/* Hook to changed */
+ adj = gtk_spin_button_get_adjustment (spin);
+
if (GNOME_IS_PROPERTY_BOX (dialog))
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (value_changed_cb), dialog);
@@ -349,12 +285,9 @@ static void
get_spin_button_value (GtkSpinButton *spin, gpointer value_var, gpointer info)
{
double *value;
- GtkAdjustment *adj;
value = (double *) value_var;
-
- adj = gtk_spin_button_get_adjustment (spin);
- *value = adj->value;
+ *value = e_dialog_spin_get_double (GTK_WIDGET (spin));
}
/* Callback for the "changed" signal of a GtkEditable widget */
@@ -372,18 +305,12 @@ static void
hook_editable (GtkWidget *dialog, GtkEditable *editable, gpointer value_var, gpointer info)
{
char **value;
- gint pos;
/* Set the value */
value = (char **) value_var;
- pos = 0;
- gtk_editable_delete_text (editable, 0, -1);
-
- /* Take NULL as empty string */
- if (*value)
- gtk_editable_insert_text (editable, *value, strlen (*value), &pos);
+ e_dialog_editable_set (GTK_WIDGET (editable), *value);
/* Hook to changed */
@@ -402,7 +329,7 @@ get_editable_value (GtkEditable *editable, gpointer value_var, gpointer data)
if (*value)
g_free (*value);
- *value = gtk_editable_get_chars (editable, 0, -1);
+ *value = e_dialog_editable_get (GTK_WIDGET (editable));
}
void
@@ -445,6 +372,11 @@ e_dialog_radio_set (GtkWidget *widget, int value, const int *value_map)
i = value_to_index (value_map, value);
if (i != -1) {
+ /* Groups are built by prepending items, so the list ends up in reverse
+ * order; we need to flip the index around.
+ */
+ i = g_slist_length (group) - i - 1;
+
l = g_slist_nth (group, i);
if (!l)
g_message ("e_dialog_radio_set(): could not find index %d in radio group!",
@@ -470,7 +402,7 @@ e_dialog_radio_get (GtkWidget *widget, const int *value_map)
group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget));
- for (i = 0, l = group; l; l = l->next) {
+ for (i = 0, l = group; l; l = l->next, i++) {
widget = GTK_WIDGET (l->data);
if (GTK_TOGGLE_BUTTON (widget)->active)
@@ -480,6 +412,11 @@ e_dialog_radio_get (GtkWidget *widget, const int *value_map)
if (!l)
g_assert_not_reached ();
+ /* Groups are built by prepending items, so the list ends up in reverse
+ * order; we need to flip the index around.
+ */
+ i = g_slist_length (group) - i - 1;
+
v = index_to_value (value_map, i);
if (v == -1) {
g_message ("e_dialog_radio_get(): could not find index %d in value map!", i);
@@ -584,7 +521,7 @@ e_dialog_option_menu_get (GtkWidget *widget, const int *value_map)
children = GTK_MENU_SHELL (menu)->children;
- for (i = 0, l = children; l; l = l->next) {
+ for (i = 0, l = children; l; l = l->next, i++) {
if (GTK_WIDGET (l->data) == active)
break;
}