diff options
author | JP Rosevear <jpr@ximian.com> | 2002-08-15 00:16:41 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-08-15 00:16:41 +0800 |
commit | 3e208eabe5395ae452b99b5ba9fd27e7128ee1b2 (patch) | |
tree | 5583fff842f477424971d80f5cce64fac0a4a7c9 /calendar/gui/dialogs/cal-prefs-dialog.c | |
parent | 1c5f4cda4f80598409b6649b802d010430f0cf0f (diff) | |
download | gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.gz gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.zst gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.zip |
listen for the time editors to change
2002-08-14 JP Rosevear <jpr@ximian.com>
* gui/dialogs/cal-prefs-dialog.c (init_widgets): listen for the
time editors to change
(cal_prefs_dialog_start_of_day_changed): make sure the start is
never after the end
(cal_prefs_dialog_end_of_day_changed): make sure the end is never
after the start
* gui/e-meeting-time-sel.c
(e_meeting_time_selector_set_working_hours): make sure to show a
minimum of 1 hour for work day
* gui/e-day-view-main-item.c (e_day_view_main_item_draw):
calculate the work/not working color boxes to the nearest pixel,
rather the the nearest time division
Fixes #10286, #26285
svn path=/trunk/; revision=17776
Diffstat (limited to 'calendar/gui/dialogs/cal-prefs-dialog.c')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 639738c3bc..533101c7a0 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -110,6 +110,8 @@ static void config_control_apply_callback (EvolutionConfigControl *config_contro static void config_control_destroy_callback (GtkObject *object, void *data); static void cal_prefs_dialog_use_24_hour_toggled(GtkWidget *button, void *data); +static void cal_prefs_dialog_end_of_day_changed (GtkWidget *button, void *data); +static void cal_prefs_dialog_start_of_day_changed (GtkWidget *button, void *data); static void cal_prefs_dialog_hide_completed_tasks_toggled (GtkWidget *button, void *data); GtkWidget *cal_prefs_dialog_create_time_edit (void); @@ -359,6 +361,14 @@ init_widgets (DialogData *dialog_data) GTK_SIGNAL_FUNC (cal_prefs_dialog_use_24_hour_toggled), dialog_data); + gtk_signal_connect (GTK_OBJECT (dialog_data->start_of_day), "changed", + GTK_SIGNAL_FUNC (cal_prefs_dialog_start_of_day_changed), + dialog_data); + + gtk_signal_connect (GTK_OBJECT (dialog_data->end_of_day), "changed", + GTK_SIGNAL_FUNC (cal_prefs_dialog_end_of_day_changed), + dialog_data); + gtk_signal_connect (GTK_OBJECT (dialog_data->tasks_hide_completed_checkbutton), "toggled", GTK_SIGNAL_FUNC (cal_prefs_dialog_hide_completed_tasks_toggled), @@ -382,6 +392,55 @@ cal_prefs_dialog_use_24_hour_toggled (GtkWidget *button, } static void +cal_prefs_dialog_start_of_day_changed (GtkWidget *button, void *data) +{ + DialogData *dialog_data; + EDateEdit *start, *end; + int start_hour, start_minute, end_hour, end_minute; + + dialog_data = (DialogData *) data; + + start = E_DATE_EDIT (dialog_data->start_of_day); + end = E_DATE_EDIT (dialog_data->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((start_hour > end_hour) + || (start_hour == end_hour && start_minute > end_minute)) { + + if (start_hour < 23) + e_date_edit_set_time_of_day (end, start_hour + 1, start_minute); + else + e_date_edit_set_time_of_day (end, 23, 59); + } +} + +static void +cal_prefs_dialog_end_of_day_changed (GtkWidget *button, void *data) +{ + DialogData *dialog_data; + EDateEdit *start, *end; + int start_hour, start_minute, end_hour, end_minute; + + dialog_data = (DialogData *) data; + + start = E_DATE_EDIT (dialog_data->start_of_day); + end = E_DATE_EDIT (dialog_data->end_of_day); + + e_date_edit_get_time_of_day (start, &start_hour, &start_minute); + e_date_edit_get_time_of_day (end, &end_hour, &end_minute); + + if ((end_hour < start_hour) + || (end_hour == start_hour && end_minute < start_minute)) { + if (end_hour < 1) + e_date_edit_set_time_of_day (start, 0, 0); + else + e_date_edit_set_time_of_day (start, end_hour - 1, end_minute); + } +} + +static void cal_prefs_dialog_hide_completed_tasks_toggled (GtkWidget *button, void *data) { |