diff options
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 22 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 6 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 12 | ||||
-rw-r--r-- | calendar/gui/e-week-view.h | 6 |
5 files changed, 64 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index cad6e38d04..baf80c23bb 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,23 @@ 2007-08-23 Milan Crha <mcrha@redhat.com> + ** Fix for bug #201201 + + * gui/e-week-view.h: (struct _EWeekView): Added properties. + * gui/e-week-view.c: (e_week_view_init), + (e_week_view_on_button_press): First click stores actual selection + in structure and when second click was inside this selection, then + the selection is restored and used for new appointment. + + ** Fix for bug #201202 + + * gui/e-day-view.h: (struct _EDayView): Added properties. + * gui/e-day-view.c: (e_day_view_init), + (e_day_view_on_top_canvas_button_press), + (e_day_view_on_main_canvas_button_press): + Same as with week view above. + +2007-08-23 Milan Crha <mcrha@redhat.com> + ** Fix for bug #338803 * gui/e-meeting-time-sel-item.c: diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 0be2ddfb41..18a99cd9cf 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -751,6 +751,9 @@ e_day_view_init (EDayView *day_view) /* String to use in 12-hour time format for times in the afternoon. */ day_view->pm_string = _("pm"); + day_view->bc_event_time = 0; + day_view->before_click_dtstart = 0; + day_view->before_click_dtend = 0; /* * Top Canvas @@ -1094,6 +1097,9 @@ e_day_view_init (EDayView *day_view) /* String to use in 12-hour time format for times in the afternoon. */ day_view->pm_string = _("pm"); + day_view->bc_event_time = 0; + day_view->before_click_dtstart = 0; + day_view->before_click_dtend = 0; /* * Top Canvas @@ -3410,6 +3416,11 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, time_t dtstart, dtend; e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend); + if (dtstart < day_view->before_click_dtend && dtend > day_view->before_click_dtstart) { + dtstart = day_view->before_click_dtstart; + dtend = day_view->before_click_dtend; + e_day_view_set_selected_time_range ((ECalendarView *) day_view, dtstart, dtend); + } e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view), dtstart, dtend, TRUE, FALSE); @@ -3423,6 +3434,9 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, FALSE, NULL, event->time) == 0) { + if (event->time - day_view->bc_event_time > 250) + e_day_view_get_selected_time_range ((ECalendarView *) day_view, &day_view->before_click_dtstart, &day_view->before_click_dtend); + day_view->bc_event_time = event->time; e_day_view_start_selection (day_view, day, -1); } } else if (event->button == 3) { @@ -3543,6 +3557,11 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, time_t dtstart, dtend; e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend); + if (dtstart < day_view->before_click_dtend && dtend > day_view->before_click_dtstart) { + dtstart = day_view->before_click_dtstart; + dtend = day_view->before_click_dtend; + e_day_view_set_selected_time_range ((ECalendarView *) day_view, dtstart, dtend); + } e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view), dtstart, dtend, FALSE, FALSE); @@ -3556,6 +3575,9 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, FALSE, NULL, event->time) == 0) { + if (event->time - day_view->bc_event_time > 250) + e_day_view_get_selected_time_range ((ECalendarView *) day_view, &day_view->before_click_dtstart, &day_view->before_click_dtend); + day_view->bc_event_time = event->time; e_day_view_start_selection (day_view, day, row); g_signal_emit_by_name (day_view, "selected_time_changed"); } diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 351bcd1039..f858ca6c26 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -453,6 +453,12 @@ struct _EDayView gchar *pm_string; gint am_string_width; gint pm_string_width; + + /* remember last selected interval when click and restore on double click, + if we double clicked inside that interval. */ + guint32 bc_event_time; + time_t before_click_dtstart; + time_t before_click_dtend; }; struct _EDayViewClass diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 97e08fe840..1be7358406 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -505,6 +505,9 @@ e_week_view_init (EWeekView *week_view) /* String to use in 12-hour time format for times in the afternoon. */ week_view->pm_string = _("pm"); + week_view->bc_event_time = 0; + week_view->before_click_dtstart = 0; + week_view->before_click_dtend = 0; /* * Titles Canvas. Note that we don't show it is only shown in the @@ -2061,6 +2064,12 @@ e_week_view_on_button_press (GtkWidget *widget, return FALSE; if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { + time_t dtstart, dtend; + + e_calendar_view_get_selected_time_range ((ECalendarView *) week_view, &dtstart, &dtend); + if (dtstart < week_view->before_click_dtend && dtend > week_view->before_click_dtstart) { + e_week_view_set_selected_time_range ((ECalendarView *) week_view, week_view->before_click_dtstart, week_view->before_click_dtend); + } e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), FALSE, FALSE, FALSE); return TRUE; } @@ -2074,6 +2083,9 @@ e_week_view_on_button_press (GtkWidget *widget, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, FALSE, NULL, event->time) == 0) { + if (event->time - week_view->bc_event_time > 250) + e_calendar_view_get_selected_time_range ((ECalendarView *) week_view, &week_view->before_click_dtstart, &week_view->before_click_dtend); + week_view->bc_event_time = event->time; week_view->selection_start_day = day; week_view->selection_end_day = day; week_view->selection_drag_pos = E_WEEK_VIEW_DRAG_END; diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index 888d88bccb..ea2e6afd31 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -331,6 +331,12 @@ struct _EWeekView gchar *pm_string; gint am_string_width; gint pm_string_width; + + /* remember last selected interval when click and restore on double click, + if we double clicked inside that interval. */ + guint32 bc_event_time; + time_t before_click_dtstart; + time_t before_click_dtend; }; struct _EWeekViewClass |