aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-07-25 00:02:54 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-07-25 00:02:54 +0800
commitef14a8c5a5049749c22e991da83225e04ab1df02 (patch)
treea76532e1afce69c22142cb1ff4807f9230d5b0bd
parent3f060f07b401bad248daab957bbc79a6d21afb6c (diff)
downloadgsoc2013-evolution-ef14a8c5a5049749c22e991da83225e04ab1df02.tar.gz
gsoc2013-evolution-ef14a8c5a5049749c22e991da83225e04ab1df02.tar.zst
gsoc2013-evolution-ef14a8c5a5049749c22e991da83225e04ab1df02.zip
new function. (e_cal_view_get_timezone, e_cal_view_set_timezone): new
2003-07-24 Rodrigo Moya <rodrigo@ximian.com> * gui/e-cal-view.[ch] (e_cal_view_delete_selected_occurrence): new function. (e_cal_view_get_timezone, e_cal_view_set_timezone): new functions. (e_cal_view_class_init): added new class' signal. * gui/e-week-view.[ch] (e_week_view_delete_occurrence, e_week_view_delete_occurrence_internal): removed. (e_week_view_get_timezone): removed. (e_week_view_set_timezone): renamed to timezone_changed_cb, as the callback for timezone changes in the parent ECalView. (e_week_view_on_button_press): call gnome_calendar_new_appointment instead of the non-existant e_week_view_new_appointment. * gui/e-day-view.[ch] (e_day_view_delete_occurrence, e_day_view_delete_occurrence_internal): removed. (e_day_view_get_timezone): removed. (e_day_view_set_timezone): renamed to timezone_changed_cb, as the callback for timezone changes in the parent ECalView. * gui/gnome-cal.c (gnome_calendar_delete_selected_occurrence): made it call e_cal_view_delete_selected_occurrence. (gnome_calendar_update_config_settings): call the generic e_cal_view_set_timezone on all view widgets. * gui/e-day-view-top-item.c: * gui/e-week-view-main-item.c: * gui/e-day-view-main-item.c: removed mentions to non-existant structure fields. svn path=/trunk/; revision=21948
-rw-r--r--calendar/ChangeLog31
-rw-r--r--calendar/gui/e-cal-view.c76
-rw-r--r--calendar/gui/e-cal-view.h4
-rw-r--r--calendar/gui/e-calendar-view.c76
-rw-r--r--calendar/gui/e-calendar-view.h4
-rw-r--r--calendar/gui/e-day-view-main-item.c3
-rw-r--r--calendar/gui/e-day-view-top-item.c3
-rw-r--r--calendar/gui/e-day-view.c187
-rw-r--r--calendar/gui/e-day-view.h9
-rw-r--r--calendar/gui/e-week-view-main-item.c3
-rw-r--r--calendar/gui/e-week-view.c163
-rw-r--r--calendar/gui/e-week-view.h8
-rw-r--r--calendar/gui/gnome-cal.c14
13 files changed, 312 insertions, 269 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 1a3465079d..72b1ff8cf0 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,36 @@
2003-07-24 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/e-cal-view.[ch] (e_cal_view_delete_selected_occurrence):
+ new function.
+ (e_cal_view_get_timezone, e_cal_view_set_timezone): new functions.
+ (e_cal_view_class_init): added new class' signal.
+
+ * gui/e-week-view.[ch] (e_week_view_delete_occurrence,
+ e_week_view_delete_occurrence_internal): removed.
+ (e_week_view_get_timezone): removed.
+ (e_week_view_set_timezone): renamed to timezone_changed_cb, as
+ the callback for timezone changes in the parent ECalView.
+ (e_week_view_on_button_press): call gnome_calendar_new_appointment
+ instead of the non-existant e_week_view_new_appointment.
+
+ * gui/e-day-view.[ch] (e_day_view_delete_occurrence,
+ e_day_view_delete_occurrence_internal): removed.
+ (e_day_view_get_timezone): removed.
+ (e_day_view_set_timezone): renamed to timezone_changed_cb, as
+ the callback for timezone changes in the parent ECalView.
+
+ * gui/gnome-cal.c (gnome_calendar_delete_selected_occurrence):
+ made it call e_cal_view_delete_selected_occurrence.
+ (gnome_calendar_update_config_settings): call the generic
+ e_cal_view_set_timezone on all view widgets.
+
+ * gui/e-day-view-top-item.c:
+ * gui/e-week-view-main-item.c:
+ * gui/e-day-view-main-item.c: removed mentions to non-existant
+ structure fields.
+
+2003-07-24 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/e-cal-view.h: define ECalViewEvent as the base struct for
the other views.
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index 8913da5de2..1895de2e61 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -28,6 +28,7 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-dialog-utils.h"
+#include "cal-util/cal-util-marshal.h"
#include "cal-util/timeutil.h"
#include "evolution-activity-client.h"
#include "calendar-commands.h"
@@ -65,6 +66,9 @@ struct _ECalViewPrivate {
/* The popup menu */
EPopupMenu *view_menu;
+
+ /* The timezone. */
+ icaltimezone *zone;
};
static void e_cal_view_class_init (ECalViewClass *klass);
@@ -77,6 +81,7 @@ static GdkAtom clipboard_atom = GDK_NONE;
/* Signal IDs */
enum {
SELECTION_CHANGED,
+ TIMEZONE_CHANGED,
LAST_SIGNAL
};
@@ -99,6 +104,14 @@ e_cal_view_class_init (ECalViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ e_cal_view_signals[TIMEZONE_CHANGED] =
+ g_signal_new ("timezone_changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalViewClass, timezone_changed),
+ NULL, NULL,
+ cal_util_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
/* Method override */
object_class->destroy = e_cal_view_destroy;
@@ -410,6 +423,29 @@ e_cal_view_set_query (ECalView *cal_view, const gchar *sexp)
e_cal_view_update_query (cal_view);
}
+icaltimezone *
+e_cal_view_get_timezone (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ return cal_view->priv->zone;
+}
+
+void
+e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone)
+{
+ icaltimezone *old_zone;
+
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ if (zone == cal_view->priv->zone)
+ return;
+
+ old_zone = cal_view->priv->zone;
+ cal_view->priv->zone = zone;
+ g_signal_emit (G_OBJECT (cal_view), e_cal_view_signals[TIMEZONE_CHANGED], 0,
+ old_zone, cal_view->priv->zone);
+}
+
void
e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
{
@@ -646,6 +682,44 @@ e_cal_view_delete_selected_events (ECalView *cal_view)
g_list_free (selected);
}
+void
+e_cal_view_delete_selected_occurrence (ECalView *cal_view)
+{
+ ECalViewEvent *event;
+ GList *selected;
+
+ selected = e_cal_view_get_selected_events (cal_view);
+ if (!selected)
+ return;
+
+ event = (ECalViewEvent *) selected->data;
+
+ if (cal_component_is_instance (event->comp)) {
+ const char *uid;
+
+ cal_component_get_uid (event->comp, &uid);
+ delete_error_dialog (
+ cal_client_remove_object_with_mod (cal_view->priv->client, uid, CALOBJ_MOD_THIS),
+ CAL_COMPONENT_EVENT);
+ } else {
+ CalComponent *comp;
+
+ /* we must duplicate the CalComponent, or we won't know it has changed
+ when we get the "update_event" signal */
+ comp = cal_component_clone (event->comp);
+ cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone);
+
+ if (cal_client_update_object (cal_view->priv->client, comp)
+ != CAL_CLIENT_RESULT_SUCCESS)
+ g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!");
+
+ g_object_unref (comp);
+ }
+
+ /* free memory */
+ g_list_free (selected);
+}
+
static void
on_new_appointment (GtkWidget *widget, gpointer user_data)
{
@@ -890,7 +964,7 @@ on_delete_occurrence (GtkWidget *widget, gpointer user_data)
ECalView *cal_view;
cal_view = E_CAL_VIEW (user_data);
- gnome_calendar_delete_selected_occurrence (cal_view->priv->calendar);
+ e_cal_view_delete_selected_occurrence (cal_view);
}
static void
diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h
index ba9376b467..1af47f74af 100644
--- a/calendar/gui/e-cal-view.h
+++ b/calendar/gui/e-cal-view.h
@@ -75,6 +75,7 @@ struct _ECalViewClass {
/* Notification signals */
void (* selection_changed) (ECalView *cal_view);
+ void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
/* Virtual methods */
GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
@@ -92,6 +93,8 @@ CalClient *e_cal_view_get_cal_client (ECalView *cal_view);
void e_cal_view_set_cal_client (ECalView *cal_view, CalClient *client);
const gchar *e_cal_view_get_query (ECalView *cal_view);
void e_cal_view_set_query (ECalView *cal_view, const gchar *sexp);
+icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
+void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
@@ -106,6 +109,7 @@ void e_cal_view_copy_clipboard (ECalView *cal_view);
void e_cal_view_paste_clipboard (ECalView *cal_view);
void e_cal_view_delete_selected_event (ECalView *cal_view);
void e_cal_view_delete_selected_events (ECalView *cal_view);
+void e_cal_view_delete_selected_occurrence (ECalView *cal_view);
GtkMenu *e_cal_view_create_popup_menu (ECalView *cal_view);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 8913da5de2..1895de2e61 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -28,6 +28,7 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-dialog-utils.h"
+#include "cal-util/cal-util-marshal.h"
#include "cal-util/timeutil.h"
#include "evolution-activity-client.h"
#include "calendar-commands.h"
@@ -65,6 +66,9 @@ struct _ECalViewPrivate {
/* The popup menu */
EPopupMenu *view_menu;
+
+ /* The timezone. */
+ icaltimezone *zone;
};
static void e_cal_view_class_init (ECalViewClass *klass);
@@ -77,6 +81,7 @@ static GdkAtom clipboard_atom = GDK_NONE;
/* Signal IDs */
enum {
SELECTION_CHANGED,
+ TIMEZONE_CHANGED,
LAST_SIGNAL
};
@@ -99,6 +104,14 @@ e_cal_view_class_init (ECalViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ e_cal_view_signals[TIMEZONE_CHANGED] =
+ g_signal_new ("timezone_changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalViewClass, timezone_changed),
+ NULL, NULL,
+ cal_util_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
/* Method override */
object_class->destroy = e_cal_view_destroy;
@@ -410,6 +423,29 @@ e_cal_view_set_query (ECalView *cal_view, const gchar *sexp)
e_cal_view_update_query (cal_view);
}
+icaltimezone *
+e_cal_view_get_timezone (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+ return cal_view->priv->zone;
+}
+
+void
+e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone)
+{
+ icaltimezone *old_zone;
+
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ if (zone == cal_view->priv->zone)
+ return;
+
+ old_zone = cal_view->priv->zone;
+ cal_view->priv->zone = zone;
+ g_signal_emit (G_OBJECT (cal_view), e_cal_view_signals[TIMEZONE_CHANGED], 0,
+ old_zone, cal_view->priv->zone);
+}
+
void
e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
{
@@ -646,6 +682,44 @@ e_cal_view_delete_selected_events (ECalView *cal_view)
g_list_free (selected);
}
+void
+e_cal_view_delete_selected_occurrence (ECalView *cal_view)
+{
+ ECalViewEvent *event;
+ GList *selected;
+
+ selected = e_cal_view_get_selected_events (cal_view);
+ if (!selected)
+ return;
+
+ event = (ECalViewEvent *) selected->data;
+
+ if (cal_component_is_instance (event->comp)) {
+ const char *uid;
+
+ cal_component_get_uid (event->comp, &uid);
+ delete_error_dialog (
+ cal_client_remove_object_with_mod (cal_view->priv->client, uid, CALOBJ_MOD_THIS),
+ CAL_COMPONENT_EVENT);
+ } else {
+ CalComponent *comp;
+
+ /* we must duplicate the CalComponent, or we won't know it has changed
+ when we get the "update_event" signal */
+ comp = cal_component_clone (event->comp);
+ cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone);
+
+ if (cal_client_update_object (cal_view->priv->client, comp)
+ != CAL_CLIENT_RESULT_SUCCESS)
+ g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!");
+
+ g_object_unref (comp);
+ }
+
+ /* free memory */
+ g_list_free (selected);
+}
+
static void
on_new_appointment (GtkWidget *widget, gpointer user_data)
{
@@ -890,7 +964,7 @@ on_delete_occurrence (GtkWidget *widget, gpointer user_data)
ECalView *cal_view;
cal_view = E_CAL_VIEW (user_data);
- gnome_calendar_delete_selected_occurrence (cal_view->priv->calendar);
+ e_cal_view_delete_selected_occurrence (cal_view);
}
static void
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index ba9376b467..1af47f74af 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -75,6 +75,7 @@ struct _ECalViewClass {
/* Notification signals */
void (* selection_changed) (ECalView *cal_view);
+ void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
/* Virtual methods */
GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
@@ -92,6 +93,8 @@ CalClient *e_cal_view_get_cal_client (ECalView *cal_view);
void e_cal_view_set_cal_client (ECalView *cal_view, CalClient *client);
const gchar *e_cal_view_get_query (ECalView *cal_view);
void e_cal_view_set_query (ECalView *cal_view, const gchar *sexp);
+icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
+void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
@@ -106,6 +109,7 @@ void e_cal_view_copy_clipboard (ECalView *cal_view);
void e_cal_view_paste_clipboard (ECalView *cal_view);
void e_cal_view_delete_selected_event (ECalView *cal_view);
void e_cal_view_delete_selected_events (ECalView *cal_view);
+void e_cal_view_delete_selected_occurrence (ECalView *cal_view);
GtkMenu *e_cal_view_create_popup_menu (ECalView *cal_view);
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 698f702c86..560c2d79d2 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -186,7 +186,8 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
work_day_end_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_end_hour, day_view->work_day_end_minute) - y;
for (day = 0; day < day_view->days_shown; day++) {
- day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, day_view->zone);
+ day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE,
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
weekday = icaltime_day_of_week (day_start_tt) - 1;
work_day = day_view->working_days & (1 << weekday);
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 298998b7db..d589538e22 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -245,7 +245,8 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item,
/* Draw the date. Set a clipping rectangle so we don't draw over the
next day. */
for (day = 0; day < day_view->days_shown; day++) {
- day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, day_view->zone);
+ day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE,
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
day_start.tm_year = day_start_tt.year - 1900;
day_start.tm_mon = day_start_tt.month - 1;
day_start.tm_mday = day_start_tt.day;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 38642ec8eb..b7979c7bbd 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -476,6 +476,31 @@ e_day_view_class_init (EDayViewClass *class)
}
static void
+timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
+ icaltimezone *new_zone, gpointer user_data)
+{
+ struct icaltimetype tt;
+ time_t lower;
+ EDayView *day_view = (EDayView *) cal_view;
+
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+ /* If our time hasn't been set yet, just return. */
+ if (day_view->lower == 0 && day_view->upper == 0)
+ return;
+
+ /* Recalculate the new start of the first day. We just use exactly
+ the same time, but with the new timezone. */
+ tt = icaltime_from_timet_with_zone (day_view->lower, FALSE,
+ old_zone);
+
+ lower = icaltime_as_timet_with_zone (tt, new_zone);
+
+ e_day_view_recalc_day_starts (day_view, lower);
+ e_day_view_update_query (day_view);
+}
+
+static void
e_day_view_init (EDayView *day_view)
{
gint day;
@@ -508,8 +533,6 @@ e_day_view_init (EDayView *day_view)
day_view->work_week_view = FALSE;
day_view->days_shown = 1;
- day_view->zone = NULL;
-
day_view->mins_per_row = 30;
day_view->date_format = E_DAY_VIEW_DATE_FULL;
day_view->rows_in_top_display = 0;
@@ -790,6 +813,10 @@ e_day_view_init (EDayView *day_view)
GTK_DEST_DEFAULT_ALL,
target_table, n_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+
+ /* connect to ECalView's signals */
+ g_signal_connect (G_OBJECT (day_view), "timezone_changed",
+ G_CALLBACK (timezone_changed_cb), NULL);
}
@@ -1477,7 +1504,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
e_day_view_add_event, day_view,
cal_client_resolve_tzid_cb,
e_cal_view_get_cal_client (E_CAL_VIEW (day_view)),
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
g_object_unref (comp);
e_day_view_queue_layout (day_view);
@@ -1971,7 +1998,7 @@ e_day_view_set_selected_time_range (EDayView *day_view,
start of the day given by start_time, otherwise it is the previous
work-week start day. */
if (!day_view->work_week_view) {
- lower = time_day_begin_with_zone (start_time, day_view->zone);
+ lower = time_day_begin_with_zone (start_time, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
} else {
lower = e_day_view_find_work_week_start (day_view, start_time);
}
@@ -2138,7 +2165,7 @@ e_day_view_find_work_week_start (EDayView *day_view,
guint offset;
struct icaltimetype tt = icaltime_null_time ();
- time_to_gdate_with_zone (&date, start_time, day_view->zone);
+ time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
/* The start of the work-week is the first working day after the
week start day. */
@@ -2169,7 +2196,7 @@ e_day_view_find_work_week_start (EDayView *day_view,
tt.month = g_date_month (&date);
tt.day = g_date_day (&date);
- return icaltime_as_timet_with_zone (tt, day_view->zone);
+ return icaltime_as_timet_with_zone (tt, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
}
@@ -2236,7 +2263,7 @@ e_day_view_recalc_day_starts (EDayView *day_view,
day_view->day_starts[0] = start_time;
for (day = 1; day <= day_view->days_shown; day++) {
- day_view->day_starts[day] = time_add_day_with_zone (day_view->day_starts[day - 1], 1, day_view->zone);
+ day_view->day_starts[day] = time_add_day_with_zone (day_view->day_starts[day - 1], 1, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
}
#if 0
@@ -2519,49 +2546,6 @@ e_day_view_set_show_event_end_times (EDayView *day_view,
}
}
-
-/* The current timezone. */
-icaltimezone*
-e_day_view_get_timezone (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), NULL);
-
- return day_view->zone;
-}
-
-
-void
-e_day_view_set_timezone (EDayView *day_view,
- icaltimezone *zone)
-{
- icaltimezone *old_zone;
- struct icaltimetype tt;
- time_t lower;
-
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- old_zone = day_view->zone;
- if (old_zone == zone)
- return;
-
- day_view->zone = zone;
-
- /* If our time hasn't been set yet, just return. */
- if (day_view->lower == 0 && day_view->upper == 0)
- return;
-
- /* Recalculate the new start of the first day. We just use exactly
- the same time, but with the new timezone. */
- tt = icaltime_from_timet_with_zone (day_view->lower, FALSE,
- old_zone);
-
- lower = icaltime_as_timet_with_zone (tt, zone);
-
- e_day_view_recalc_day_starts (day_view, lower);
- e_day_view_update_query (day_view);
-}
-
-
/* This is a callback used to update all day event labels. */
static gboolean
e_day_view_set_show_times_cb (EDayView *day_view,
@@ -3459,57 +3443,6 @@ e_day_view_on_event_right_click (EDayView *day_view,
day, event_num);
}
-static void
-e_day_view_delete_occurrence_internal (EDayView *day_view, EDayViewEvent *event)
-{
- CalComponent *comp;
-
- if (cal_component_is_instance (event->comp)) {
- const char *uid;
-
- cal_component_get_uid (event->comp, &uid);
-
- delete_error_dialog (
- cal_client_remove_object_with_mod (e_cal_view_get_cal_client (E_CAL_VIEW (day_view)),
- uid, CALOBJ_MOD_THIS),
- CAL_COMPONENT_EVENT);
- return;
- }
-
- /* We must duplicate the CalComponent, or we won't know it has changed
- when we get the "update_event" callback. */
- comp = cal_component_clone (event->comp);
- cal_comp_util_add_exdate (comp, event->start, day_view->zone);
-
- if (cal_client_update_object (e_cal_view_get_cal_client (E_CAL_VIEW (day_view)), comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
-
- g_object_unref (comp);
-}
-
-void
-e_day_view_delete_occurrence (EDayView *day_view)
-{
- EDayViewEvent *event;
-
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- if (day_view->editing_event_day == -1)
- return;
-
- if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT)
- event = &g_array_index (day_view->long_events,
- EDayViewEvent,
- day_view->editing_event_num);
- else
- event = &g_array_index (day_view->events[day_view->editing_event_day],
- EDayViewEvent,
- day_view->editing_event_num);
-
- e_day_view_delete_occurrence_internal (day_view, event);
-}
-
void
e_day_view_unrecur_appointment (EDayView *day_view)
{
@@ -3529,7 +3462,7 @@ e_day_view_unrecur_appointment (EDayView *day_view)
instance. */
comp = cal_component_clone (event->comp);
- cal_comp_util_add_exdate (comp, event->start, day_view->zone);
+ cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
/* For the unrecurred instance we duplicate the original object,
create a new uid for it, get rid of the recurrence rules, and set
@@ -3542,13 +3475,13 @@ e_day_view_unrecur_appointment (EDayView *day_view)
cal_component_set_exrule_list (new_comp, NULL);
date.value = &itt;
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
*date.value = icaltime_from_timet_with_zone (event->start, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtstart (new_comp, &date);
*date.value = icaltime_from_timet_with_zone (event->end, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtend (new_comp, &date);
@@ -4078,17 +4011,17 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
date.value = &itt;
/* FIXME: Should probably keep the timezone of the original start
and end times. */
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
if (day_view->resize_drag_pos == E_CAL_VIEW_POS_LEFT_EDGE) {
dt = day_view->day_starts[day_view->resize_start_row];
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtstart (comp, &date);
} else {
dt = day_view->day_starts[day_view->resize_end_row + 1];
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtend (comp, &date);
}
@@ -4152,17 +4085,17 @@ e_day_view_finish_resize (EDayView *day_view)
date.value = &itt;
/* FIXME: Should probably keep the timezone of the original start
and end times. */
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
if (day_view->resize_drag_pos == E_CAL_VIEW_POS_TOP_EDGE) {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_start_row);
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtstart (comp, &date);
} else {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_end_row + 1);
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtend (comp, &date);
}
@@ -4307,9 +4240,9 @@ e_day_view_add_event (CalComponent *comp,
g_return_val_if_fail (end > day_view->lower, TRUE);
start_tt = icaltime_from_timet_with_zone (start, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
end_tt = icaltime_from_timet_with_zone (end, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
event.comp = comp;
g_object_ref (comp);
@@ -4329,7 +4262,7 @@ e_day_view_add_event (CalComponent *comp,
event.different_timezone = FALSE;
if (!cal_comp_util_compare_event_timezones (comp, e_cal_view_get_cal_client (E_CAL_VIEW (day_view)),
- day_view->zone))
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view))))
event.different_timezone = TRUE;
/* Find out which array to add the event to. */
@@ -4954,17 +4887,17 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
start_tt = icaltime_from_timet_with_zone (dtstart, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
end_tt = icaltime_from_timet_with_zone (dtend, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
if (day_view->selection_in_top_canvas) {
start_dt.tzid = NULL;
start_tt.is_date = 1;
end_tt.is_date = 1;
} else {
- start_dt.tzid = icaltimezone_get_tzid (day_view->zone);
+ start_dt.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
}
start_dt.value = &start_tt;
@@ -5866,12 +5799,12 @@ e_day_view_convert_grid_position_to_time (EDayView *day_view,
/* Create an icaltimetype and convert to a time_t. */
tt = icaltime_from_timet_with_zone (day_view->day_starts[col],
- FALSE, day_view->zone);
+ FALSE, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
tt.hour = minutes / 60;
tt.minute = minutes % 60;
tt.second = 0;
- val = icaltime_as_timet_with_zone (tt, day_view->zone);
+ val = icaltime_as_timet_with_zone (tt, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
return val;
}
@@ -5901,7 +5834,7 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
/* To find the row we need to convert the time to an icaltimetype,
calculate the offset in minutes from the top of the display and
divide it by the mins per row setting. */
- tt = icaltime_from_timet_with_zone (time, FALSE, day_view->zone);
+ tt = icaltime_from_timet_with_zone (time, FALSE, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
minutes = tt.hour * 60 + tt.minute;
minutes -= day_view->first_hour_shown * 60 + day_view->first_minute_shown;
@@ -6890,14 +6823,14 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
dt = day_view->day_starts[day] + start_offset * 60;
itt = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
if (all_day_event) {
itt.is_date = TRUE;
date.tzid = NULL;
} else {
/* FIXME: Should probably keep the timezone of
the original start and end times. */
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
}
cal_component_set_dtstart (comp, &date);
@@ -6906,14 +6839,14 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
else
dt = day_view->day_starts[day + num_days - 1] + end_offset * 60;
itt = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
if (all_day_event) {
itt.is_date = TRUE;
date.tzid = NULL;
} else {
/* FIXME: Should probably keep the timezone of
the original start and end times. */
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
}
cal_component_set_dtend (comp, &date);
@@ -7040,15 +6973,15 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
comp = cal_component_clone (event->comp);
date.value = &itt;
- date.tzid = icaltimezone_get_tzid (day_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
dt = e_day_view_convert_grid_position_to_time (day_view, day, row) + start_offset * 60;
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtstart (comp, &date);
dt = e_day_view_convert_grid_position_to_time (day_view, day, row + num_rows) - end_offset * 60;
*date.value = icaltime_from_timet_with_zone (dt, FALSE,
- day_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtend (comp, &date);
gtk_drag_finish (context, TRUE, TRUE, time);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 4aad2a6751..3a16da7daa 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -228,9 +228,6 @@ struct _EDayView
/* The start of each day & an extra element to hold the last time. */
time_t day_starts[E_DAY_VIEW_MAX_DAYS + 1];
- /* The timezone. */
- icaltimezone *zone;
-
/* An array of EDayViewEvent elements for the top view and each day. */
GArray *long_events;
GArray *events[E_DAY_VIEW_MAX_DAYS];
@@ -530,12 +527,6 @@ gint e_day_view_get_week_start_day (EDayView *day_view);
void e_day_view_set_week_start_day (EDayView *day_view,
gint week_start_day);
-/* The current timezone. */
-icaltimezone* e_day_view_get_timezone (EDayView *day_view);
-void e_day_view_set_timezone (EDayView *day_view,
- icaltimezone *zone);
-
-
void e_day_view_delete_occurrence (EDayView *day_view);
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index 68a1681a32..ca80da28c3 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -345,7 +345,8 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem,
struct icaltimetype tt;
/* Check if we are drawing today */
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, week_view->zone);
+ tt = icaltime_from_timet_with_zone (time (NULL), FALSE,
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
if (g_date_year (date) == tt.year
&& g_date_month (date) == tt.month
&& g_date_day (date) == tt.day)
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 3aa58a0a36..ef4f718c4e 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -230,6 +230,31 @@ e_week_view_class_init (EWeekViewClass *class)
view_class->update_query = e_week_view_update_query;
}
+static void
+timezone_changed_cb (ECalView *cal_view, icaltimezone *old_zone,
+ icaltimezone *new_zone, gpointer user_data)
+{
+ struct icaltimetype tt = icaltime_null_time ();
+ time_t lower;
+ EWeekView *week_view = (EWeekView *) cal_view;
+
+ g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+
+ /* If we don't have a valid date set yet, just return. */
+ if (!g_date_valid (&week_view->first_day_shown))
+ return;
+
+ /* Recalculate the new start of the first week. We just use exactly
+ the same time, but with the new timezone. */
+ tt.year = g_date_year (&week_view->first_day_shown);
+ tt.month = g_date_month (&week_view->first_day_shown);
+ tt.day = g_date_day (&week_view->first_day_shown);
+
+ lower = icaltime_as_timet_with_zone (tt, new_zone);
+
+ e_week_view_recalc_day_starts (week_view, lower);
+ e_week_view_update_query (week_view);
+}
static void
e_week_view_init (EWeekView *week_view)
@@ -253,7 +278,6 @@ e_week_view_init (EWeekView *week_view)
week_view->spans = NULL;
- week_view->zone = NULL;
week_view->multi_week_view = FALSE;
week_view->weeks_shown = 6;
week_view->rows = 6;
@@ -369,6 +393,10 @@ e_week_view_init (EWeekView *week_view)
week_view->move_cursor = gdk_cursor_new (GDK_FLEUR);
week_view->resize_width_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
week_view->last_cursor_set = NULL;
+
+ /* connect to ECalView's signals */
+ g_signal_connect (G_OBJECT (week_view), "timezone_changed",
+ G_CALLBACK (timezone_changed_cb), NULL);
}
@@ -1078,7 +1106,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
e_week_view_add_event, week_view,
cal_client_resolve_tzid_cb,
e_cal_view_get_cal_client (E_CAL_VIEW (week_view)),
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
g_object_unref (comp);
@@ -1273,7 +1301,7 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
- time_to_gdate_with_zone (&date, start_time, week_view->zone);
+ time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
if (week_view->multi_week_view) {
/* Find the number of days since the start of the month. */
@@ -1322,9 +1350,9 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
|| g_date_compare (&week_view->first_day_shown, &base_date)) {
week_view->first_day_shown = base_date;
start_time = time_add_day_with_zone (start_time, -day_offset,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
start_time = time_day_begin_with_zone (start_time,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, start_time);
e_week_view_update_query (week_view);
}
@@ -1334,10 +1362,10 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
- g_date_julian (&base_date);
if (end_time == start_time
|| end_time <= time_add_day_with_zone (start_time, 1,
- week_view->zone))
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view))))
week_view->selection_end_day = week_view->selection_start_day;
else {
- time_to_gdate_with_zone (&end_date, end_time - 60, week_view->zone);
+ time_to_gdate_with_zone (&end_date, end_time - 60, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
week_view->selection_end_day = g_date_julian (&end_date)
- g_date_julian (&base_date);
}
@@ -1370,17 +1398,17 @@ e_week_view_set_selected_time_range_visible (EWeekView *week_view,
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
- time_to_gdate_with_zone (&date, start_time, week_view->zone);
+ time_to_gdate_with_zone (&date, start_time, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
/* 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))
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view))))
week_view->selection_end_day = week_view->selection_start_day;
else {
- time_to_gdate_with_zone (&end_date, end_time - 60, week_view->zone);
+ time_to_gdate_with_zone (&end_date, end_time - 60, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
week_view->selection_end_day = g_date_julian (&end_date)
- g_date_julian (&week_view->first_day_shown);
}
@@ -1503,7 +1531,7 @@ e_week_view_set_first_day_shown (EWeekView *week_view,
start_tt.day = g_date_day (&base_date);
start_time = icaltime_as_timet_with_zone (start_tt,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, start_time);
e_week_view_update_query (week_view);
@@ -1553,7 +1581,7 @@ e_week_view_recalc_day_starts (EWeekView *week_view,
week_view->day_starts[0] = tmp_time;
for (day = 1; day <= num_days; day++) {
tmp_time = time_add_day_with_zone (tmp_time, 1,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
week_view->day_starts[day] = tmp_time;
}
}
@@ -1778,49 +1806,6 @@ e_week_view_set_24_hour_format (EWeekView *week_view,
gtk_widget_queue_draw (week_view->main_canvas);
}
-
-/* The current timezone. */
-icaltimezone*
-e_week_view_get_timezone (EWeekView *week_view)
-{
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), NULL);
-
- return week_view->zone;
-}
-
-
-void
-e_week_view_set_timezone (EWeekView *week_view,
- icaltimezone *zone)
-{
- icaltimezone *old_zone;
- struct icaltimetype tt = icaltime_null_time ();
- time_t lower;
-
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-
- old_zone = week_view->zone;
- if (old_zone == zone)
- return;
-
- week_view->zone = zone;
-
- /* If we don't have a valid date set yet, just return. */
- if (!g_date_valid (&week_view->first_day_shown))
- return;
-
- /* Recalculate the new start of the first week. We just use exactly
- the same time, but with the new timezone. */
- tt.year = g_date_year (&week_view->first_day_shown);
- tt.month = g_date_month (&week_view->first_day_shown);
- tt.day = g_date_day (&week_view->first_day_shown);
-
- lower = icaltime_as_timet_with_zone (tt, zone);
-
- e_week_view_recalc_day_starts (week_view, lower);
- e_week_view_update_query (week_view);
-}
-
static gboolean
e_week_view_recalc_display_start_day (EWeekView *week_view)
{
@@ -2072,7 +2057,7 @@ e_week_view_on_button_press (GtkWidget *widget,
return FALSE;
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
- e_week_view_new_appointment (week_view, FALSE);
+ gnome_calendar_new_appointment (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
return TRUE;
}
@@ -2364,9 +2349,9 @@ e_week_view_add_event (CalComponent *comp,
g_return_val_if_fail (end > week_view->day_starts[0], TRUE);
start_tt = icaltime_from_timet_with_zone (start, FALSE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
end_tt = icaltime_from_timet_with_zone (end, FALSE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
event.comp = comp;
g_object_ref (event.comp);
@@ -2382,7 +2367,7 @@ e_week_view_add_event (CalComponent *comp,
event.different_timezone = FALSE;
if (!cal_comp_util_compare_event_timezones (comp, e_cal_view_get_cal_client (E_CAL_VIEW (week_view)),
- week_view->zone))
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view))))
event.different_timezone = TRUE;
g_array_append_val (week_view->events, event);
@@ -2801,7 +2786,7 @@ e_week_view_on_adjustment_changed (GtkAdjustment *adjustment,
start_tt.month = g_date_month (&date);
start_tt.day = g_date_day (&date);
- lower = icaltime_as_timet_with_zone (start_tt, week_view->zone);
+ lower = icaltime_as_timet_with_zone (start_tt, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
e_week_view_recalc_day_starts (week_view, lower);
e_week_view_update_query (week_view);
@@ -3340,14 +3325,14 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
date.tzid = NULL;
/* We use DATE values now, so we don't need the timezone. */
- /*date.tzid = icaltimezone_get_tzid (week_view->zone);*/
+ /*date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (week_view)));*/
*date.value = icaltime_from_timet_with_zone (dtstart, TRUE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
cal_component_set_dtstart (comp, &date);
*date.value = icaltime_from_timet_with_zone (dtend, TRUE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
cal_component_set_dtend (comp, &date);
cal_component_set_categories (comp, week_view->default_category);
@@ -3409,50 +3394,6 @@ e_week_view_popup_menu (GtkWidget *widget)
return TRUE;
}
-static void
-e_week_view_delete_occurrence_internal (EWeekView *week_view, gint event_num)
-{
- EWeekViewEvent *event;
- CalComponent *comp;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- event_num);
-
- if (cal_component_is_instance (event->comp)) {
- const char *uid;
-
- cal_component_get_uid (event->comp, &uid);
- delete_error_dialog (cal_client_remove_object_with_mod (
- e_cal_view_get_cal_client (E_CAL_VIEW (week_view)),
- uid, CALOBJ_MOD_THIS),
- CAL_COMPONENT_EVENT);
- return;
- }
-
- /* We must duplicate the CalComponent, or we won't know it has changed
- when we get the "update_event" callback. */
-
- comp = cal_component_clone (event->comp);
- cal_comp_util_add_exdate (comp, event->start, week_view->zone);
-
- if (cal_client_update_object (e_cal_view_get_cal_client (E_CAL_VIEW (week_view)), comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_week_view_on_delete_occurrence(): Could not update the object!");
-
- g_object_unref (comp);
-}
-
-void
-e_week_view_delete_occurrence (EWeekView *week_view)
-{
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-
- if (week_view->editing_event_num == -1)
- return;
-
- e_week_view_delete_occurrence_internal (week_view, week_view->editing_event_num);
-}
-
void
e_week_view_unrecur_appointment (EWeekView *week_view)
{
@@ -3470,7 +3411,7 @@ e_week_view_unrecur_appointment (EWeekView *week_view)
/* For the recurring object, we add a exception to get rid of the
instance. */
comp = cal_component_clone (event->comp);
- cal_comp_util_add_exdate (comp, event->start, week_view->zone);
+ cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
/* For the unrecurred instance we duplicate the original object,
create a new uid for it, get rid of the recurrence rules, and set
@@ -3483,13 +3424,13 @@ e_week_view_unrecur_appointment (EWeekView *week_view)
cal_component_set_exrule_list (new_comp, NULL);
date.value = &itt;
- date.tzid = icaltimezone_get_tzid (week_view->zone);
+ date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
*date.value = icaltime_from_timet_with_zone (event->start, FALSE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
cal_component_set_dtstart (new_comp, &date);
*date.value = icaltime_from_timet_with_zone (event->end, FALSE,
- week_view->zone);
+ e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
cal_component_set_dtend (new_comp, &date);
/* Now update both CalComponents. Note that we do this last since at
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index c879797edd..c12ad0cfca 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -193,9 +193,6 @@ struct _EWeekView
/* The start of each day displayed. */
time_t day_starts[E_WEEK_VIEW_MAX_WEEKS * 7 + 1];
- /* The timezone. */
- icaltimezone *zone;
-
/* The base date, where the adjustment value is 0. */
GDate base_date;
@@ -396,11 +393,6 @@ gboolean e_week_view_get_24_hour_format (EWeekView *week_view);
void e_week_view_set_24_hour_format (EWeekView *week_view,
gboolean use_24_hour);
-/* The current timezone. */
-icaltimezone* e_week_view_get_timezone (EWeekView *week_view);
-void e_week_view_set_timezone (EWeekView *week_view,
- icaltimezone *zone);
-
void e_week_view_delete_occurrence (EWeekView *week_view);
/* Returns the number of selected events (0 or 1 at present). */
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index ee4efe44e5..7598aecd8d 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2270,10 +2270,10 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
priv->zone);
}
- e_day_view_set_timezone (E_DAY_VIEW (priv->day_view), priv->zone);
- e_day_view_set_timezone (E_DAY_VIEW (priv->work_week_view), priv->zone);
- e_week_view_set_timezone (E_WEEK_VIEW (priv->week_view), priv->zone);
- e_week_view_set_timezone (E_WEEK_VIEW (priv->month_view), priv->zone);
+ e_cal_view_set_timezone (E_CAL_VIEW (priv->day_view), priv->zone);
+ e_cal_view_set_timezone (E_CAL_VIEW (priv->work_week_view), priv->zone);
+ e_cal_view_set_timezone (E_CAL_VIEW (priv->week_view), priv->zone);
+ e_cal_view_set_timezone (E_CAL_VIEW (priv->month_view), priv->zone);
if (initializing) {
priv->hpane_pos = calendar_config_get_hpane_pos ();
@@ -2942,11 +2942,7 @@ gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
if (location == FOCUS_CALENDAR) {
view = gnome_calendar_get_current_view_widget (gcal);
-
- if (E_IS_DAY_VIEW (view))
- e_day_view_delete_occurrence (E_DAY_VIEW (view));
- else
- e_week_view_delete_occurrence (E_WEEK_VIEW (view));
+ e_cal_view_delete_selected_occurrence (E_CAL_VIEW (view));
}
}