aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/eventedit.c20
-rw-r--r--calendar/gui/eventedit.c20
3 files changed, 37 insertions, 8 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5def8c8840..b49361bbb0 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+1999-02-04 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * eventedit.c (date_edit_new): New convenience function to create
+ a properly-configured date editor widget.
+
1999-02-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gncal-week-view.c (gncal_week_view_new): Make the calendar start
diff --git a/calendar/eventedit.c b/calendar/eventedit.c
index 76816bd803..1d0236cb1c 100644
--- a/calendar/eventedit.c
+++ b/calendar/eventedit.c
@@ -209,6 +209,18 @@ set_all_day (GtkToggleButton *toggle, EventEditor *ee)
gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
}
+/* Convenience function to create a properly-configured date editor widget */
+static 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)));
+}
+
static GtkWidget *
event_editor_setup_time_frame (EventEditor *ee)
{
@@ -228,7 +240,7 @@ event_editor_setup_time_frame (EventEditor *ee)
ee->ical->dtstart = time (NULL);
ee->ical->dtend = time_add_minutes (ee->ical->dtstart, 30);
}
- ee->start_time = start_time = gnome_date_edit_new (ee->ical->dtstart, TRUE, !am_pm_flag);
+ ee->start_time = start_time = date_edit_new (ee->ical->dtstart, TRUE);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
gtk_signal_connect (GTK_OBJECT (start_time), "date_changed",
GTK_SIGNAL_FUNC (check_dates), ee);
@@ -244,7 +256,7 @@ event_editor_setup_time_frame (EventEditor *ee)
0, 0);
/* 2. End time */
- ee->end_time = end_time = gnome_date_edit_new (ee->ical->dtend, TRUE, !am_pm_flag);
+ ee->end_time = end_time = date_edit_new (ee->ical->dtend, TRUE);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
gtk_signal_connect (GTK_OBJECT (end_time), "date_changed",
GTK_SIGNAL_FUNC (check_dates), ee);
@@ -1205,7 +1217,7 @@ ee_rp_init_ending_date (EventEditor *ee)
else
enddate = ee->ical->dtend;
- ee->recur_ed_end_on = widget = gnome_date_edit_new (enddate, FALSE, !am_pm_flag);
+ ee->recur_ed_end_on = widget = date_edit_new (enddate, FALSE);
gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio1), "toggled",
@@ -1366,7 +1378,7 @@ ee_rp_init_exceptions (EventEditor *ee)
vbox = gtk_vbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
- ee->recur_ex_date = widget = gnome_date_edit_new (time (NULL), FALSE, !am_pm_flag);
+ ee->recur_ex_date = widget = date_edit_new (time (NULL), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
widget = gtk_button_new_with_label (_("Add exception"));
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index 76816bd803..1d0236cb1c 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -209,6 +209,18 @@ set_all_day (GtkToggleButton *toggle, EventEditor *ee)
gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
}
+/* Convenience function to create a properly-configured date editor widget */
+static 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)));
+}
+
static GtkWidget *
event_editor_setup_time_frame (EventEditor *ee)
{
@@ -228,7 +240,7 @@ event_editor_setup_time_frame (EventEditor *ee)
ee->ical->dtstart = time (NULL);
ee->ical->dtend = time_add_minutes (ee->ical->dtstart, 30);
}
- ee->start_time = start_time = gnome_date_edit_new (ee->ical->dtstart, TRUE, !am_pm_flag);
+ ee->start_time = start_time = date_edit_new (ee->ical->dtstart, TRUE);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
gtk_signal_connect (GTK_OBJECT (start_time), "date_changed",
GTK_SIGNAL_FUNC (check_dates), ee);
@@ -244,7 +256,7 @@ event_editor_setup_time_frame (EventEditor *ee)
0, 0);
/* 2. End time */
- ee->end_time = end_time = gnome_date_edit_new (ee->ical->dtend, TRUE, !am_pm_flag);
+ ee->end_time = end_time = date_edit_new (ee->ical->dtend, TRUE);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
gtk_signal_connect (GTK_OBJECT (end_time), "date_changed",
GTK_SIGNAL_FUNC (check_dates), ee);
@@ -1205,7 +1217,7 @@ ee_rp_init_ending_date (EventEditor *ee)
else
enddate = ee->ical->dtend;
- ee->recur_ed_end_on = widget = gnome_date_edit_new (enddate, FALSE, !am_pm_flag);
+ ee->recur_ed_end_on = widget = date_edit_new (enddate, FALSE);
gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio1), "toggled",
@@ -1366,7 +1378,7 @@ ee_rp_init_exceptions (EventEditor *ee)
vbox = gtk_vbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
- ee->recur_ex_date = widget = gnome_date_edit_new (time (NULL), FALSE, !am_pm_flag);
+ ee->recur_ex_date = widget = date_edit_new (time (NULL), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
widget = gtk_button_new_with_label (_("Add exception"));