aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-08-15 00:16:41 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-08-15 00:16:41 +0800
commit3e208eabe5395ae452b99b5ba9fd27e7128ee1b2 (patch)
tree5583fff842f477424971d80f5cce64fac0a4a7c9 /calendar/gui
parent1c5f4cda4f80598409b6649b802d010430f0cf0f (diff)
downloadgsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar
gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.gz
gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.bz2
gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.lz
gsoc2013-evolution-3e208eabe5395ae452b99b5ba9fd27e7128ee1b2.tar.xz
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')
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c59
-rw-r--r--calendar/gui/e-day-view-main-item.c7
-rw-r--r--calendar/gui/e-meeting-time-sel.c11
3 files changed, 70 insertions, 7 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)
{
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 201f0cbc52..ebdac5c2de 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -187,7 +187,6 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
GdkFont *font;
gint row, row_y, grid_x1, grid_x2;
gint day, grid_y1, grid_y2;
- gint work_day_start_row, work_day_end_row;
gint work_day_start_y, work_day_end_y;
gint day_x, day_w, work_day;
gint start_row, end_row, rect_x, rect_y, rect_width, rect_height;
@@ -207,10 +206,8 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
/* Paint the background colors. */
gc = day_view->main_gc;
- work_day_start_row = e_day_view_convert_time_to_row (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute);
- work_day_start_y = work_day_start_row * day_view->row_height - y;
- work_day_end_row = e_day_view_convert_time_to_row (day_view, day_view->work_day_end_hour, day_view->work_day_end_minute);
- work_day_end_y = work_day_end_row * day_view->row_height - y;
+ work_day_start_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute) - y;
+ work_day_end_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_end_hour, day_view->work_day_end_minute) - y;
for (day = 0; day < day_view->days_shown; day++) {
day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, day_view->zone);
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index dbe8a58c6d..7df2996013 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -1202,9 +1202,16 @@ e_meeting_time_selector_set_working_hours (EMeetingTimeSelector *mts,
mts->day_start_hour = day_start_hour;
mts->day_start_minute = day_start_minute;
- mts->day_end_hour = day_end_hour;
- mts->day_end_minute = day_end_minute;
+ /* Make sure we always show atleast an hour */
+ if (day_start_hour * 60 + day_start_minute + 60 < day_end_hour * 60 + day_end_minute) {
+ mts->day_end_hour = day_end_hour;
+ mts->day_end_minute = day_end_minute;
+ } else {
+ mts->day_end_hour = day_start_hour + 1;
+ mts->day_end_minute = day_start_minute;
+ }
+
e_meeting_time_selector_save_position (mts, &saved_time);
e_meeting_time_selector_recalc_grid (mts);
e_meeting_time_selector_restore_position (mts, &saved_time);