aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-09-07 05:40:38 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-09-07 05:40:38 +0800
commite1a2491881b488a87dc2374ce459ead0b443ae84 (patch)
treeca8df6b91eca169edde395ebf7943553b2d4a575 /calendar/gui/e-week-view.c
parent9e0e4a3fbf5218ad2e764bd2816070a2eb94e91a (diff)
downloadgsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.gz
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.bz2
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.lz
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.xz
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.zst
gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.zip
kill warning
2002-09-06 JP Rosevear <jpr@ximian.com> * gui/gnome-cal.c (gnome_calendar_edit_object): kill warning * gui/e-week-view.h: new proto * gui/e-week-view.c (e_week_view_set_selected_time_range_visible): select a range of time in the currently visible area, if out side the visible area, select as much as possible (e_week_view_on_text_item_event): call above * gui/e-week-view-event-item.c (e_week_view_event_item_button_press): call above * gui/e-day-view.c (e_day_view_set_selected_time_range_in_top_visible): select a range of time in the currently visible area, if out side the visible area, select as much as possible (e_day_view_set_selected_time_range_visible): the same for the main canvas (e_day_view_on_long_event_button_press): call above (e_day_view_on_event_button_press): ditto svn path=/trunk/; revision=18010
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index dee9b03540..500701306e 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1430,6 +1430,43 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
gtk_widget_queue_draw (week_view->main_canvas);
}
+void
+e_week_view_set_selected_time_range_visible (EWeekView *week_view,
+ time_t start_time,
+ time_t end_time)
+{
+ GDate date, end_date;
+ gint num_days;
+
+ g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+
+ time_to_gdate_with_zone (&date, start_time, week_view->zone);
+
+ /* Set the selection to the given days. */
+ week_view->selection_start_day = g_date_julian (&date)
+ - g_date_julian (&week_view->first_day_shown);
+ if (end_time == start_time
+ || end_time <= time_add_day_with_zone (start_time, 1,
+ week_view->zone))
+ week_view->selection_end_day = week_view->selection_start_day;
+ else {
+ time_to_gdate_with_zone (&end_date, end_time - 60, week_view->zone);
+ week_view->selection_end_day = g_date_julian (&end_date)
+ - g_date_julian (&week_view->first_day_shown);
+ }
+
+ /* Make sure the selection is valid. */
+ num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7;
+ num_days--;
+ week_view->selection_start_day = CLAMP (week_view->selection_start_day,
+ 0, num_days);
+ week_view->selection_end_day = CLAMP (week_view->selection_end_day,
+ week_view->selection_start_day,
+ num_days);
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
/* Returns the selected time range. */
void
@@ -3055,8 +3092,8 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
if (!destroyed) {
gtk_signal_disconnect (GTK_OBJECT (e->comp), id);
-
- e_week_view_set_selected_time_range (week_view, e->start, e->end);
+
+ e_week_view_set_selected_time_range_visible (week_view, e->start, e->end);
e_week_view_show_popup_menu (week_view,
(GdkEventButton*) gdkevent,