aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-13 22:36:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-13 23:21:00 +0800
commita44eac756d55b0210cc541e1d9b7138805a2133e (patch)
tree69f199d2df4a858466e9f98cd363cc1ebfe9174d
parent311c8dd1226555f81c2eaca738969f5d9e123d1f (diff)
downloadgsoc2013-evolution-a44eac756d55b0210cc541e1d9b7138805a2133e.tar.gz
gsoc2013-evolution-a44eac756d55b0210cc541e1d9b7138805a2133e.tar.zst
gsoc2013-evolution-a44eac756d55b0210cc541e1d9b7138805a2133e.zip
Track the timezone in one place: ECalModel
-rw-r--r--calendar/gui/ea-gnome-calendar.c4
-rw-r--r--calendar/gui/gnome-cal.c194
-rw-r--r--calendar/gui/gnome-cal.h3
-rw-r--r--calendar/gui/goto.c6
-rw-r--r--modules/calendar/e-cal-shell-view-private.c15
5 files changed, 119 insertions, 103 deletions
diff --git a/calendar/gui/ea-gnome-calendar.c b/calendar/gui/ea-gnome-calendar.c
index 52798c99f0..f021214c5a 100644
--- a/calendar/gui/ea-gnome-calendar.c
+++ b/calendar/gui/ea-gnome-calendar.c
@@ -130,6 +130,7 @@ ea_gnome_calendar_new (GtkWidget *widget)
const gchar *
ea_gnome_calendar_get_label_description (GnomeCalendar *gcal)
{
+ ECalModel *model;
icaltimezone *zone;
struct icaltimetype start_tt, end_tt;
time_t start_time, end_time;
@@ -138,8 +139,9 @@ ea_gnome_calendar_get_label_description (GnomeCalendar *gcal)
gchar end_buffer[256];
GnomeCalendarViewType view;
+ model = gnome_calendar_get_calendar_model (gcal);
gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time);
- zone = gnome_calendar_get_timezone (gcal);
+ zone = e_cal_model_get_timezone (model);
start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
start_tm.tm_year = start_tt.year - 1900;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 5bb6b81c70..1a7fe610ab 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -124,9 +124,6 @@ struct _GnomeCalendarPrivate {
/* Our current week start */
gint week_start_day;
- /* Our current timezone. */
- icaltimezone *zone;
-
/* The dates currently shown. If they are -1 then we have no dates
shown. We only use these to check if we need to emit a
'dates-shown-changed' signal.*/
@@ -232,10 +229,12 @@ update_adjustment (GnomeCalendar *gcal,
EWeekView *week_view)
{
GDate date;
+ ECalModel *model;
gint week_offset;
struct icaltimetype start_tt = icaltime_null_time ();
time_t lower;
guint32 old_first_day_julian, new_first_day_julian;
+ icaltimezone *timezone;
/* If we don't have a valid date set yet, just return. */
if (!g_date_valid (&week_view->first_day_shown))
@@ -259,7 +258,9 @@ update_adjustment (GnomeCalendar *gcal,
start_tt.month = g_date_get_month (&date);
start_tt.day = g_date_get_day (&date);
- lower = icaltime_as_timet_with_zone (start_tt, gcal->priv->zone);
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
+ lower = icaltime_as_timet_with_zone (start_tt, timezone);
e_week_view_set_update_base_date (week_view, FALSE);
gnome_calendar_set_selected_time_range (gcal, lower);
@@ -436,7 +437,6 @@ gnome_calendar_constructed (GObject *object)
/* Day View */
calendar_view = e_day_view_new (model);
e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
gcal->priv->views[GNOME_CAL_DAY_VIEW] = calendar_view;
g_signal_connect_swapped (
@@ -448,7 +448,6 @@ gnome_calendar_constructed (GObject *object)
e_day_view_set_work_week_view (E_DAY_VIEW (calendar_view), TRUE);
e_day_view_set_days_shown (E_DAY_VIEW (calendar_view), 5);
e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
gcal->priv->views[GNOME_CAL_WORK_WEEK_VIEW] = calendar_view;
g_signal_connect_swapped (
@@ -458,7 +457,6 @@ gnome_calendar_constructed (GObject *object)
/* Week View */
calendar_view = e_week_view_new (model);
e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
gcal->priv->views[GNOME_CAL_WEEK_VIEW] = calendar_view;
g_signal_connect_swapped (
@@ -476,7 +474,6 @@ gnome_calendar_constructed (GObject *object)
e_week_view_set_multi_week_view (E_WEEK_VIEW (calendar_view), TRUE);
e_week_view_set_weeks_shown (E_WEEK_VIEW (calendar_view), 6);
e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
gcal->priv->views[GNOME_CAL_MONTH_VIEW] = calendar_view;
g_signal_connect_swapped (
@@ -492,7 +489,6 @@ gnome_calendar_constructed (GObject *object)
/* List View */
calendar_view = e_cal_list_view_new (model);
e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
gcal->priv->views[GNOME_CAL_LIST_VIEW] = calendar_view;
g_signal_connect_swapped (
@@ -749,22 +745,25 @@ static void
ensure_dates_are_in_default_zone (GnomeCalendar *gcal,
icalcomponent *icalcomp)
{
+ ECalModel *model;
+ icaltimezone *timezone;
icaltimetype dt;
- icaltimezone *zone;
- zone = gnome_calendar_get_timezone (gcal);
- if (!zone)
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
+
+ if (timezone == NULL)
return;
dt = icalcomponent_get_dtstart (icalcomp);
if (dt.is_utc) {
- dt = icaltime_convert_to_zone (dt, zone);
+ dt = icaltime_convert_to_zone (dt, timezone);
icalcomponent_set_dtstart (icalcomp, dt);
}
dt = icalcomponent_get_dtend (icalcomp);
if (dt.is_utc) {
- dt = icaltime_convert_to_zone (dt, zone);
+ dt = icaltime_convert_to_zone (dt, timezone);
icalcomponent_set_dtend (icalcomp, dt);
}
}
@@ -847,24 +846,29 @@ static void
get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_t *start_time, time_t *end_time, time_t *select_time)
{
GnomeCalendarPrivate *priv;
+ ECalModel *model;
gint shown, display_start;
GDate date;
gint weekday, first_day, last_day, days_shown, i;
gboolean has_working_days = FALSE;
guint offset;
struct icaltimetype tt = icaltime_null_time ();
+ icaltimezone *timezone;
+
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
priv = gcal->priv;
switch (view_type) {
case GNOME_CAL_DAY_VIEW:
shown = e_day_view_get_days_shown (E_DAY_VIEW (priv->views[view_type]));
- *start_time = time_day_begin_with_zone (*start_time, priv->zone);
- *end_time = time_add_day_with_zone (*start_time, shown, priv->zone);
+ *start_time = time_day_begin_with_zone (*start_time, timezone);
+ *end_time = time_add_day_with_zone (*start_time, shown, timezone);
break;
case GNOME_CAL_WORK_WEEK_VIEW:
/* FIXME Kind of gross, but it works */
- time_to_gdate_with_zone (&date, *start_time, priv->zone);
+ time_to_gdate_with_zone (&date, *start_time, timezone);
/* The start of the work-week is the first working day after the
week start day. */
@@ -911,8 +915,8 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
tt.month = g_date_get_month (&date);
tt.day = g_date_get_day (&date);
- *start_time = icaltime_as_timet_with_zone (tt, priv->zone);
- *end_time = time_add_day_with_zone (*start_time, days_shown, priv->zone);
+ *start_time = icaltime_as_timet_with_zone (tt, timezone);
+ *end_time = time_add_day_with_zone (*start_time, days_shown, timezone);
if (select_time && E_DAY_VIEW (priv->views[view_type])->selection_start_day == -1)
time (select_time);
@@ -921,8 +925,8 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
/* FIXME We should be using the same day of the week enum every where */
display_start = (E_WEEK_VIEW (priv->views[view_type])->display_start_day + 1) % 7;
- *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);
+ *start_time = time_week_begin_with_zone (*start_time, display_start, timezone);
+ *end_time = time_add_week_with_zone (*start_time, 1, timezone);
if (select_time && E_WEEK_VIEW (priv->views[view_type])->selection_start_day == -1)
time (select_time);
@@ -933,17 +937,17 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
display_start = (E_WEEK_VIEW (priv->views[view_type])->display_start_day + 1) % 7;
if (!priv->range_selected && (!E_WEEK_VIEW (priv->views[view_type])->multi_week_view || !E_WEEK_VIEW (priv->views[view_type])->month_scroll_by_week))
- *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);
+ *start_time = time_month_begin_with_zone (*start_time, timezone);
+ *start_time = time_week_begin_with_zone (*start_time, display_start, timezone);
+ *end_time = time_add_week_with_zone (*start_time, shown, timezone);
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? */
- *start_time = time_month_begin_with_zone (*start_time, priv->zone);
- *end_time = time_add_month_with_zone (*start_time, 1, priv->zone);
+ *start_time = time_month_begin_with_zone (*start_time, timezone);
+ *end_time = time_add_month_with_zone (*start_time, 1, timezone);
break;
default:
g_return_if_reached ();
@@ -954,20 +958,23 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
static void
get_date_navigator_range (GnomeCalendar *gcal, time_t *start_time, time_t *end_time)
{
- GnomeCalendarPrivate *priv;
+ ECalModel *model;
gint start_year, start_month, start_day;
gint end_year, end_month, end_day;
struct icaltimetype start_tt;
struct icaltimetype end_tt;
+ icaltimezone *timezone;
- priv = gcal->priv;
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
start_tt = icaltime_null_time ();
end_tt = icaltime_null_time ();
- if (!e_calendar_item_get_date_range (priv->date_navigator->calitem,
- &start_year, &start_month, &start_day,
- &end_year, &end_month, &end_day)) {
+ if (!e_calendar_item_get_date_range (
+ gcal->priv->date_navigator->calitem,
+ &start_year, &start_month, &start_day,
+ &end_year, &end_month, &end_day)) {
*start_time = -1;
*end_time = -1;
return;
@@ -983,8 +990,8 @@ get_date_navigator_range (GnomeCalendar *gcal, time_t *start_time, time_t *end_t
icaltime_adjust (&end_tt, 1, 0, 0, 0);
- *start_time = icaltime_as_timet_with_zone (start_tt, priv->zone);
- *end_time = icaltime_as_timet_with_zone (end_tt, priv->zone);
+ *start_time = icaltime_as_timet_with_zone (start_tt, timezone);
+ *end_time = icaltime_as_timet_with_zone (end_tt, timezone);
}
/* Adjusts a given query sexp with the time range of the date navigator */
@@ -1169,21 +1176,21 @@ gnome_calendar_set_search_query (GnomeCalendar *gcal,
}
static void
-set_timezone (GnomeCalendar *calendar)
+set_timezone (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
+ ECalModel *model;
+ icaltimezone *timezone;
GList *l;
- priv = calendar->priv;
-
- priv->zone = calendar_config_get_icaltimezone ();
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
- for (l = priv->clients_list; l != NULL; l = l->next) {
+ for (l = gcal->priv->clients_list; l != NULL; l = l->next) {
ECal *client = l->data;
if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
/* FIXME Error checking */
- e_cal_set_default_timezone (client, priv->zone, NULL);
+ e_cal_set_default_timezone (client, timezone, NULL);
}
}
@@ -1528,13 +1535,15 @@ static void
gnome_calendar_goto_date (GnomeCalendar *gcal,
GnomeCalendarGotoDateType goto_date)
{
- GnomeCalendarPrivate *priv;
+ ECalModel *model;
time_t new_time = 0;
gboolean need_updating = FALSE;
+ icaltimezone *timezone;
g_return_if_fail (GNOME_IS_CALENDAR(gcal));
- priv = gcal->priv;
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
switch (goto_date) {
/* GNOME_CAL_GOTO_TODAY and GNOME_CAL_GOTO_DATE are
@@ -1545,39 +1554,47 @@ gnome_calendar_goto_date (GnomeCalendar *gcal,
case GNOME_CAL_GOTO_DATE:
break;
case GNOME_CAL_GOTO_FIRST_DAY_OF_MONTH:
- new_time = time_month_begin_with_zone (priv->base_view_time, priv->zone);
+ new_time = time_month_begin_with_zone (
+ gcal->priv->base_view_time, timezone);
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_LAST_DAY_OF_MONTH:
- new_time = time_add_month_with_zone (priv->base_view_time, 1, priv->zone);
- new_time = time_month_begin_with_zone (new_time, priv->zone);
- new_time = time_add_day_with_zone (new_time, -1, priv->zone);
+ new_time = time_add_month_with_zone (
+ gcal->priv->base_view_time, 1, timezone);
+ new_time = time_month_begin_with_zone (new_time, timezone);
+ new_time = time_add_day_with_zone (new_time, -1, timezone);
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_FIRST_DAY_OF_WEEK:
- new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start_day, priv->zone);
+ new_time = time_week_begin_with_zone (
+ gcal->priv->base_view_time,
+ gcal->priv->week_start_day, timezone);
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_LAST_DAY_OF_WEEK:
- new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start_day, priv->zone);
- if (priv->current_view_type == GNOME_CAL_DAY_VIEW ||
- priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW) {
+ new_time = time_week_begin_with_zone (
+ gcal->priv->base_view_time,
+ gcal->priv->week_start_day, timezone);
+ if (gcal->priv->current_view_type == GNOME_CAL_DAY_VIEW ||
+ gcal->priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW) {
/* FIXME Shouldn't hard code work week end */
/* goto Friday of this week */
- new_time = time_add_day_with_zone (new_time, 4, priv->zone);
+ new_time = time_add_day_with_zone (new_time, 4, timezone);
} else {
/* goto Sunday of this week */
/* FIXME Shouldn't hard code week end */
- new_time = time_add_day_with_zone (new_time, 6, priv->zone);
+ new_time = time_add_day_with_zone (new_time, 6, timezone);
}
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_SAME_DAY_OF_PREVIOUS_WEEK:
- new_time = time_add_week_with_zone (priv->base_view_time, -1, priv->zone);
+ new_time = time_add_week_with_zone (
+ gcal->priv->base_view_time, -1, timezone);
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK:
- new_time = time_add_week_with_zone (priv->base_view_time, 1, priv->zone);
+ new_time = time_add_week_with_zone (
+ gcal->priv->base_view_time, 1, timezone);
need_updating = TRUE;
break;
default:
@@ -1636,28 +1653,33 @@ update_view_times (GnomeCalendar *gcal, time_t start_time)
static void
gnome_calendar_direction (GnomeCalendar *gcal, gint direction)
{
- GnomeCalendarPrivate *priv;
+ ECalModel *model;
+ icaltimezone *timezone;
- priv = gcal->priv;
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
- switch (priv->current_view_type) {
+ switch (gnome_calendar_get_view (gcal)) {
case GNOME_CAL_DAY_VIEW:
- priv->base_view_time = time_add_day_with_zone (priv->base_view_time, direction, priv->zone);
+ gcal->priv->base_view_time = time_add_day_with_zone (
+ gcal->priv->base_view_time, direction, timezone);
break;
case GNOME_CAL_WORK_WEEK_VIEW:
case GNOME_CAL_WEEK_VIEW:
- priv->base_view_time = time_add_week_with_zone (priv->base_view_time, direction, priv->zone);
+ gcal->priv->base_view_time = time_add_week_with_zone (
+ gcal->priv->base_view_time, direction, timezone);
break;
- case GNOME_CAL_LIST_VIEW:
- g_warning ("Using month view time interval for list view.");
case GNOME_CAL_MONTH_VIEW:
- priv->base_view_time = time_add_month_with_zone (priv->base_view_time, direction, priv->zone);
+ case GNOME_CAL_LIST_VIEW:
+ gcal->priv->base_view_time = time_add_month_with_zone (
+ gcal->priv->base_view_time, direction, timezone);
break;
default:
g_return_if_reached ();
}
- gnome_calendar_set_selected_time_range (gcal, priv->base_view_time);
+ gnome_calendar_set_selected_time_range (
+ gcal, gcal->priv->base_view_time);
}
void
@@ -1679,15 +1701,18 @@ gnome_calendar_previous (GnomeCalendar *gcal)
void
gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
{
- GnomeCalendarPrivate *priv;
+ ECalModel *model;
+ icaltimezone *timezone;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- priv = gcal->priv;
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
- priv->base_view_time = time_day_begin_with_zone (time, priv->zone);
+ gcal->priv->base_view_time =
+ time_day_begin_with_zone (time, timezone);
- update_view_times (gcal, priv->base_view_time);
+ update_view_times (gcal, gcal->priv->base_view_time);
gnome_calendar_set_view (gcal, GNOME_CAL_DAY_VIEW);
}
@@ -2229,13 +2254,15 @@ gnome_calendar_set_week_start_day (GnomeCalendar *gcal,
ECalModel *
gnome_calendar_get_calendar_model (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
+ ECalendarView *calendar_view;
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
- priv = gcal->priv;
+ /* XXX This is kind of silly. The views all share the same
+ * model now. We should just keep our own reference. */
+ calendar_view = gcal->priv->views[gcal->priv->current_view_type];
- return e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ return e_calendar_view_get_model (calendar_view);
}
/**
@@ -2564,6 +2591,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
ECalModel *model;
time_t start, end;
GDate start_date, end_date;
+ icaltimezone *timezone;
priv = gcal->priv;
@@ -2578,10 +2606,11 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
if (priv->current_view_type == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range)
return;
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ model = gnome_calendar_get_calendar_model (gcal);
e_cal_model_get_time_range (model, &start, &end);
+ timezone = e_cal_model_get_timezone (model);
- time_to_gdate_with_zone (&start_date, start, priv->zone);
+ time_to_gdate_with_zone (&start_date, start, timezone);
if (priv->current_view_type == GNOME_CAL_MONTH_VIEW) {
EWeekView *week_view = E_WEEK_VIEW (priv->views[priv->current_view_type]);
@@ -2589,7 +2618,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
&& (!week_view->multi_week_view || week_view->compress_weekend))
g_date_add_days (&start_date, 1);
}
- time_to_gdate_with_zone (&end_date, end, priv->zone);
+ time_to_gdate_with_zone (&end_date, end, timezone);
g_date_subtract_days (&end_date, 1);
e_calendar_item_set_selection (priv->date_navigator->calitem,
@@ -2608,22 +2637,24 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom
gboolean starts_on_week_start_day;
time_t new_time, start, end;
struct icaltimetype tt;
+ icaltimezone *timezone;
priv = gcal->priv;
starts_on_week_start_day = FALSE;
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ model = gnome_calendar_get_calendar_model (gcal);
+ timezone = e_cal_model_get_timezone (model);
e_cal_model_get_time_range (model, &start, &end);
- time_to_gdate_with_zone (&start_date, start, priv->zone);
+ time_to_gdate_with_zone (&start_date, start, timezone);
if (priv->current_view_type == GNOME_CAL_MONTH_VIEW) {
EWeekView *week_view = E_WEEK_VIEW (priv->views[priv->current_view_type]);
if (priv->week_start_day == 0 && (!week_view->multi_week_view || week_view->compress_weekend))
g_date_add_days (&start_date, 1);
}
- time_to_gdate_with_zone (&end_date, end, priv->zone);
+ time_to_gdate_with_zone (&end_date, end, timezone);
g_date_subtract_days (&end_date, 1);
e_calendar_item_get_selection (calitem, &new_start_date, &new_end_date);
@@ -2648,7 +2679,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom
tt.year = g_date_get_year (&new_start_date);
tt.month = g_date_get_month (&new_start_date);
tt.day = g_date_get_day (&new_start_date);
- new_time = icaltime_as_timet_with_zone (tt, priv->zone);
+ new_time = icaltime_as_timet_with_zone (tt, timezone);
/* Switch views as appropriate, and change the number of days or weeks
shown. */
@@ -2787,15 +2818,6 @@ gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
e_calendar_view_paste_clipboard (view);
}
-/* Get the current timezone. */
-icaltimezone*
-gnome_calendar_get_timezone (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return gcal->priv->zone;
-}
-
static void
gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal)
{
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index a9dda216f0..437bce0f01 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -168,9 +168,6 @@ gboolean gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
/* Returns the number of selected events (0 or 1 at present). */
gint gnome_calendar_get_num_events_selected (GnomeCalendar *gcal);
-/* Get the current timezone. */
-icaltimezone *gnome_calendar_get_timezone (GnomeCalendar *gcal);
-
/* Clipboard operations */
void gnome_calendar_cut_clipboard (GnomeCalendar *gcal);
void gnome_calendar_copy_clipboard (GnomeCalendar *gcal);
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index dcbe643901..5f3e80f5ae 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -94,16 +94,20 @@ ecal_event (ECalendarItem *calitem, gpointer user_data)
#if 0 /* KILL-BONOBO */
GoToDialog *dlg = user_data;
GDate start_date, end_date;
+ ECalModel *model;
struct icaltimetype tt = icaltime_null_time ();
+ icaltimezone *timezone;
time_t et;
+ model = gnome_calendar_get_calendar_model (dlg->gcal);
e_calendar_item_get_selection (calitem, &start_date, &end_date);
+ timezone = e_cal_model_get_timezone (model);
tt.year = g_date_get_year (&start_date);
tt.month = g_date_get_month (&start_date);
tt.day = g_date_get_day (&start_date);
- et = icaltime_as_timet_with_zone (tt, gnome_calendar_get_timezone (dlg->gcal));
+ et = icaltime_as_timet_with_zone (tt, timezone);
gnome_calendar_goto (dlg->gcal, et);
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 60ec3c77ab..8c18176af5 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -40,17 +40,6 @@ cal_shell_view_process_completed_tasks (ECalShellView *cal_shell_view,
#endif
}
-static void
-cal_shell_view_config_timezone_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer user_data)
-{
- ECalShellView *cal_shell_view = user_data;
-
- e_cal_shell_view_update_timezone (cal_shell_view);
-}
-
static struct tm
cal_shell_view_get_current_time (ECalendarItem *calitem,
ECalShellView *cal_shell_view)
@@ -666,6 +655,7 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
ECalShellContent *cal_shell_content;
GnomeCalendar *calendar;
GnomeCalendarViewType view;
+ ECalModel *model;
time_t start_time, end_time;
struct tm start_tm, end_tm;
struct icaltimetype start_tt, end_tt;
@@ -683,7 +673,8 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
gnome_calendar_get_visible_time_range (
calendar, &start_time, &end_time);
- timezone = gnome_calendar_get_timezone (calendar);
+ model = gnome_calendar_get_calendar_model (calendar);
+ timezone = e_cal_model_get_timezone (model);
view = gnome_calendar_get_view (calendar);
start_tt = icaltime_from_timet_with_zone (start_time, FALSE, timezone);