diff options
author | Marcel Stimberg <marcelcoding@googlemail.com> | 2009-05-14 05:05:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-21 09:58:47 +0800 |
commit | d121c3ba1da75d01d6ca174830e1454d73eda8b1 (patch) | |
tree | e8d27b968a2a65c9e1039200432fedc6eadb88dd /calendar | |
parent | 643186eba2927295ac46d4966578189a2b241e0a (diff) | |
download | gsoc2013-evolution-d121c3ba1da75d01d6ca174830e1454d73eda8b1.tar.gz gsoc2013-evolution-d121c3ba1da75d01d6ca174830e1454d73eda8b1.tar.zst gsoc2013-evolution-d121c3ba1da75d01d6ca174830e1454d73eda8b1.zip |
Make the Calendar view scroll using the arrow keys
This fixes bug 559366.
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-week-view.c | 91 |
1 files changed, 74 insertions, 17 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 22dfb3d725..f008f4e3f3 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3818,10 +3818,16 @@ static gint map_right[] = {3, 4, 5, 3, 4, 5, 6}; static void e_week_view_do_cursor_key_up (EWeekView *week_view) { - if (week_view->selection_start_day <= 0) + if (week_view->selection_start_day == -1) return; week_view->selection_start_day--; + + if (week_view->selection_start_day < 0) { + e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_UP); + week_view->selection_start_day = 6; + } + week_view->selection_end_day = week_view->selection_start_day; g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); @@ -3830,11 +3836,16 @@ e_week_view_do_cursor_key_up (EWeekView *week_view) static void e_week_view_do_cursor_key_down (EWeekView *week_view) { - if (week_view->selection_start_day == -1 || - week_view->selection_start_day >= 6) + if (week_view->selection_start_day == -1) return; week_view->selection_start_day++; + + if (week_view->selection_start_day > 6) { + e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_DOWN); + week_view->selection_start_day = 0; + } + week_view->selection_end_day = week_view->selection_start_day; g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); @@ -3867,11 +3878,23 @@ e_week_view_do_cursor_key_right (EWeekView *week_view) static void e_month_view_do_cursor_key_up (EWeekView *week_view) { - if (week_view->selection_start_day < 7) + if (week_view->selection_start_day == -1) return; - week_view->selection_start_day -= 7; - week_view->selection_end_day = week_view->selection_start_day; + if (week_view->selection_start_day < 7) { + /* no easy way to calculate new selection_start_day, therefore + * calculate a time_t value and set_selected_time_range */ + time_t current; + if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { + current = time_add_week(current,-1); + e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP); + e_week_view_set_selected_time_range_visible(week_view,current,current); + } + } else { + week_view->selection_start_day -= 7; + week_view->selection_end_day = week_view->selection_start_day; + } + g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); } @@ -3881,12 +3904,23 @@ e_month_view_do_cursor_key_down (EWeekView *week_view) { gint weeks_shown = e_week_view_get_weeks_shown (week_view); - if (week_view->selection_start_day == -1 || - week_view->selection_start_day >= (weeks_shown - 1) * 7) + if (week_view->selection_start_day == -1) return; - week_view->selection_start_day += 7; - week_view->selection_end_day = week_view->selection_start_day; + if (week_view->selection_start_day >= (weeks_shown - 1) * 7) { + /* no easy way to calculate new selection_start_day, therefore + * calculate a time_t value and set_selected_time_range */ + time_t current; + if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { + current = time_add_week(current,1); + e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); + e_week_view_set_selected_time_range_visible(week_view,current,current); + } + } else { + week_view->selection_start_day += 7; + week_view->selection_end_day = week_view->selection_start_day; + } + g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); } @@ -3894,11 +3928,23 @@ e_month_view_do_cursor_key_down (EWeekView *week_view) static void e_month_view_do_cursor_key_left (EWeekView *week_view) { - if (week_view->selection_start_day <= 0) + if (week_view->selection_start_day == -1) return; - week_view->selection_start_day--; - week_view->selection_end_day = week_view->selection_start_day; + if (week_view->selection_start_day == 0) { + /* no easy way to calculate new selection_start_day, therefore + * calculate a time_t value and set_selected_time_range */ + time_t current; + if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { + current = time_add_day(current,-1); + e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP); + e_week_view_set_selected_time_range_visible(week_view,current,current); + } + } else { + week_view->selection_start_day--; + week_view->selection_end_day = week_view->selection_start_day; + } + g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); } @@ -3908,12 +3954,23 @@ e_month_view_do_cursor_key_right (EWeekView *week_view) { gint weeks_shown = e_week_view_get_weeks_shown (week_view); - if (week_view->selection_start_day == -1 || - week_view->selection_start_day >= weeks_shown * 7 - 1) + if (week_view->selection_start_day == -1) return; - week_view->selection_start_day++; - week_view->selection_end_day = week_view->selection_start_day; + if (week_view->selection_start_day == weeks_shown * 7 - 1) { + /* no easy way to calculate new selection_start_day, therefore + * calculate a time_t value and set_selected_time_range */ + time_t current; + if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { + current = time_add_day(current,1); + e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); + e_week_view_set_selected_time_range_visible(week_view,current,current); + } + } else { + week_view->selection_start_day++; + week_view->selection_end_day = week_view->selection_start_day; + } + g_signal_emit_by_name (week_view, "selected_time_changed"); gtk_widget_queue_draw (week_view->main_canvas); } |