From 3e208eabe5395ae452b99b5ba9fd27e7128ee1b2 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 14 Aug 2002 16:16:41 +0000 Subject: listen for the time editors to change 2002-08-14 JP Rosevear * 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 --- calendar/gui/dialogs/cal-prefs-dialog.c | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'calendar/gui/dialogs/cal-prefs-dialog.c') 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), @@ -381,6 +391,55 @@ cal_prefs_dialog_use_24_hour_toggled (GtkWidget *button, e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dialog_data->end_of_day), use_24_hour); } +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) -- cgit v1.2.3