diff options
author | JP Rosevear <jpr@ximian.com> | 2003-04-08 22:58:26 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2003-04-08 22:58:26 +0800 |
commit | fb450633e9dbe98c10d0a3d1bde767292d694ea7 (patch) | |
tree | 0ca8ae73a817d76f083ef6c3f17b94df56ebb597 /calendar/gui/gnome-cal.c | |
parent | 2906114f454ca67c8d7daf5d297e98f00e2d00c6 (diff) | |
download | gsoc2013-evolution-fb450633e9dbe98c10d0a3d1bde767292d694ea7.tar.gz gsoc2013-evolution-fb450633e9dbe98c10d0a3d1bde767292d694ea7.tar.zst gsoc2013-evolution-fb450633e9dbe98c10d0a3d1bde767292d694ea7.zip |
update the selection for all view types
2003-04-08 JP Rosevear <jpr@ximian.com>
* gui/gnome-cal.c
(gnome_calendar_on_date_navigator_selection_changed): update the
selection for all view types
svn path=/trunk/; revision=20753
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r-- | calendar/gui/gnome-cal.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index da2dde2948..570577fd22 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2541,6 +2541,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, GDate start_date, end_date, new_start_date, new_end_date; gint days_shown, new_days_shown; gboolean starts_on_week_start_day; + struct icaltimetype tt; priv = gcal->priv; @@ -2567,6 +2568,15 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, if (g_date_weekday (&new_start_date) % 7 == calendar_config_get_week_start_day ()) starts_on_week_start_day = TRUE; + /* Update selection to be in the new time range */ + tt = icaltime_null_time (); + tt.year = g_date_year (&new_start_date); + tt.month = g_date_month (&new_start_date); + tt.day = g_date_day (&new_start_date); + priv->selection_start_time = icaltime_as_timet_with_zone (tt, priv->zone); + icaltime_adjust (&tt, 1, 0, 0, 0); + priv->selection_end_time = icaltime_as_timet_with_zone (tt, priv->zone); + /* Switch views as appropriate, and change the number of days or weeks shown. */ if (new_days_shown > 9) { @@ -2583,31 +2593,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, set_view (gcal, GNOME_CAL_WEEK_VIEW, TRUE, FALSE); gnome_calendar_update_date_navigator (gcal); gnome_calendar_notify_dates_shown_changed (gcal); - } else { - gint start_year, start_month, start_day; - gint end_year, end_month, end_day; - struct icaltimetype tt; - - start_year = g_date_year (&new_start_date); - start_month = g_date_month (&new_start_date); - start_day = g_date_day (&new_start_date); - end_year = g_date_year (&new_end_date); - end_month = g_date_month (&new_end_date); - end_day = g_date_day (&new_end_date); - - tt = icaltime_null_time (); - tt.year = start_year; - tt.month = start_month; - tt.day = start_day; - priv->selection_start_time = icaltime_as_timet_with_zone (tt, priv->zone); - - tt = icaltime_null_time (); - tt.year = end_year; - tt.month = end_month; - tt.day = end_day; - icaltime_adjust (&tt, 1, 0, 0, 0); - priv->selection_end_time = icaltime_as_timet_with_zone (tt, priv->zone); - + } else { e_day_view_set_days_shown (E_DAY_VIEW (priv->day_view), new_days_shown); if (new_days_shown == 5 && priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW) |