aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-06-19 22:26:57 +0800
committerMilan Crha <mcrha@redhat.com>2009-06-19 22:26:57 +0800
commit186370e3a44a90b6761c373e4290213d1e51d1e7 (patch)
tree4198c4ea234af0207fa9a6c958e4b5ad62261d01 /calendar/gui
parent4a2d5ee3455556cc5d61dac2f7fe87045a00b2b2 (diff)
downloadgsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar.gz
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar.bz2
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar.lz
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar.xz
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.tar.zst
gsoc2013-evolution-186370e3a44a90b6761c373e4290213d1e51d1e7.zip
Bug #513451 - Select Today for calendar views on the first showing
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gnome-cal.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 458a5c1dc9..1e943eeb14 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -628,7 +628,7 @@ gnome_calendar_get_current_view_widget (GnomeCalendar *gcal)
}
static void
-get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_t *start_time, time_t *end_time)
+get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_t *start_time, time_t *end_time, time_t *select_time)
{
GnomeCalendarPrivate *priv;
gint shown, display_start;
@@ -697,6 +697,9 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
*start_time = icaltime_as_timet_with_zone (tt, priv->zone);
*end_time = time_add_day_with_zone (*start_time, days_shown, priv->zone);
+
+ if (select_time && E_DAY_VIEW (priv->views[view_type])->selection_start_day == -1)
+ time (select_time);
break;
case GNOME_CAL_WEEK_VIEW:
/* FIXME We should be using the same day of the week enum every where */
@@ -704,6 +707,9 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
*start_time = time_week_begin_with_zone (*start_time, display_start, priv->zone);
*end_time = time_add_week_with_zone (*start_time, 1, priv->zone);
+
+ if (select_time && E_WEEK_VIEW (priv->views[view_type])->selection_start_day == -1)
+ time (select_time);
break;
case GNOME_CAL_MONTH_VIEW:
shown = e_week_view_get_weeks_shown (E_WEEK_VIEW (priv->views[view_type]));
@@ -714,6 +720,9 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
*start_time = time_month_begin_with_zone (*start_time, priv->zone);
*start_time = time_week_begin_with_zone (*start_time, display_start, priv->zone);
*end_time = time_add_week_with_zone (*start_time, shown, priv->zone);
+
+ if (select_time && E_WEEK_VIEW (priv->views[view_type])->selection_start_day == -1)
+ time (select_time);
break;
case GNOME_CAL_LIST_VIEW:
/* FIXME What to do here? */
@@ -988,7 +997,7 @@ set_search_query (GnomeCalendar *gcal, const gchar *sexp)
e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end);
} else {
start = priv->base_view_time;
- get_times_for_views (gcal, GNOME_CAL_LIST_VIEW, &start, &end);
+ get_times_for_views (gcal, GNOME_CAL_LIST_VIEW, &start, &end, NULL);
e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end);
@@ -2183,19 +2192,22 @@ update_view_times (GnomeCalendar *gcal, time_t start_time)
GnomeCalendarPrivate *priv;
ECalModel *model;
time_t real_start_time = start_time;
- time_t end_time;
+ time_t end_time, select_time = 0;
priv = gcal->priv;
priv->base_view_time = start_time;
model = e_calendar_view_get_model (priv->views [priv->current_view_type]);
- get_times_for_views (gcal, priv->current_view_type, &real_start_time, &end_time);
+ get_times_for_views (gcal, priv->current_view_type, &real_start_time, &end_time, &select_time);
if (priv->current_view_type == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range)
return;
e_cal_model_set_time_range (model, real_start_time, end_time);
+
+ if (select_time != 0 && select_time >= real_start_time && select_time <= end_time)
+ e_calendar_view_set_selected_time_range (priv->views [priv->current_view_type], select_time, select_time);
}
static void