aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog21
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c23
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h5
-rw-r--r--calendar/gui/dialogs/comp-editor.c22
-rw-r--r--calendar/gui/dialogs/event-page.c30
-rw-r--r--calendar/gui/dialogs/task-details-page.c23
-rw-r--r--calendar/gui/dialogs/task-page.c30
7 files changed, 153 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 04c5c7f623..b7678663e1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,24 @@
+2004-04-05 Rodrigo Moya <rodrigo@ximian.com>
+
+ Fixes #56316
+
+ * gui/dialogs/comp-editor-page.[ch]: added "fill_timezones" virtual
+ method to CompEditorPage class.
+ (comp_editor_page_fill_timezones): new function.
+ (comp_editor_page_class_init): initialize new virtual method.
+
+ * gui/dialogs/event-page.c (event_page_fill_timezones,
+ event_page_class_init):
+ * gui/dialogs/task-page.c (task_page_fill_timezones,
+ task_page_class_init):
+ * gui/dialogs/task-details-page.c (task_details_page_fill_timezones,
+ task_details_page_class_init): implemented new virtual method for pages
+ dealing with timezones.
+
+ * gui/dialogs/comp-editor.c (save_comp): call the "fill_timezones"
+ method on all pages, and call...
+ (send_timezone): ...this function for each hash table item.
+
2004-04-01 Rodrigo Moya <rodrigo@ximian.com>
* gui/gnome-cal.c (client_cal_opened_cb): set the default timezone
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index 0869d67fb9..44e89a3b14 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -149,6 +149,7 @@ comp_editor_page_class_init (CompEditorPageClass *class)
class->focus_main_widget = NULL;
class->fill_widgets = NULL;
class->fill_component = NULL;
+ class->fill_timezones = NULL;
class->set_summary = NULL;
class->set_dates = NULL;
@@ -269,6 +270,28 @@ comp_editor_page_fill_component (CompEditorPage *page, ECalComponent *comp)
}
/**
+ * comp_editor_page_fill_timezones:
+ * @page: An editor page.
+ * @timezones: Hash table to which timezones will be added.
+ *
+ * Fills the given hash table with all the timezones used by the dates in the
+ * specific editor page.
+ *
+ * Returns: TRUE if the timezones were added, FALSE otherwise.
+ */
+gboolean
+comp_editor_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
+ g_return_val_if_fail (timezones != NULL, FALSE);
+
+ if (CLASS (page)->fill_timezones != NULL)
+ return (* CLASS (page)->fill_timezones) (page, timezones);
+
+ return TRUE;
+}
+
+/**
* comp_editor_page_set_e_cal:
* @page: An editor page
* @client: A #ECal object
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index a6d938984d..2b3c6c60ab 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -76,6 +76,7 @@ typedef struct {
gboolean (* fill_widgets) (CompEditorPage *page, ECalComponent *comp);
gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp);
+ gboolean (* fill_timezones) (CompEditorPage *page, GHashTable *timezones);
void (* set_summary) (CompEditorPage *page, const char *summary);
void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates);
@@ -89,7 +90,9 @@ gboolean comp_editor_page_fill_widgets (CompEditorPage *page,
ECalComponent *comp);
gboolean comp_editor_page_fill_component (CompEditorPage *page,
ECalComponent *comp);
-void comp_editor_page_set_e_cal (CompEditorPage *page,
+gboolean comp_editor_page_fill_timezones (CompEditorPage *page,
+ GHashTable *timezones);
+void comp_editor_page_set_e_cal (CompEditorPage *page,
ECal *client);
void comp_editor_page_set_summary (CompEditorPage *page,
const char *summary);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index d204de56e8..27f55cee68 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -352,6 +352,16 @@ listen_for_changes (CompEditor *editor)
}
}
+static void
+send_timezone (gpointer key, gpointer value, gpointer user_data)
+{
+ char *tzid = key;
+ icaltimezone *zone = value;
+ CompEditor *editor = user_data;
+
+ e_cal_add_timezone (editor->priv->client, zone, NULL);
+}
+
static gboolean
save_comp (CompEditor *editor)
{
@@ -360,6 +370,7 @@ save_comp (CompEditor *editor)
GList *l;
gboolean result;
GError *error = NULL;
+ GHashTable *timezones;
const char *orig_uid;
priv = editor->priv;
@@ -367,13 +378,19 @@ save_comp (CompEditor *editor)
if (!priv->changed)
return TRUE;
+ timezones = g_hash_table_new (g_str_hash, g_str_equal);
+
clone = e_cal_component_clone (priv->comp);
for (l = priv->pages; l != NULL; l = l->next) {
if (!comp_editor_page_fill_component (l->data, clone)) {
g_object_unref (clone);
+ g_hash_table_destroy (timezones);
comp_editor_show_page (editor, COMP_EDITOR_PAGE (l->data));
return FALSE;
}
+
+ /* retrieve all timezones */
+ comp_editor_page_fill_timezones (l->data, timezones);
}
/* If we are not the organizer, we don't update the sequence number */
@@ -389,6 +406,11 @@ save_comp (CompEditor *editor)
e_cal_component_get_uid (priv->comp, &orig_uid);
+ /* send timezones */
+ g_hash_table_foreach (timezones, (GHFunc) send_timezone, editor);
+ g_hash_table_destroy (timezones);
+
+ /* send the component to the server */
if (!cal_comp_is_on_server (priv->comp, priv->client)) {
result = e_cal_create_object (priv->client, e_cal_component_get_icalcomponent (priv->comp), NULL, &error);
} else {
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index c56e477fe2..a367396b93 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -97,6 +97,7 @@ static GtkWidget *event_page_get_widget (CompEditorPage *page);
static void event_page_focus_main_widget (CompEditorPage *page);
static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp);
+static gboolean event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static void event_page_set_summary (CompEditorPage *page, const char *summary);
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -132,6 +133,7 @@ event_page_class_init (EventPageClass *class)
editor_page_class->focus_main_widget = event_page_focus_main_widget;
editor_page_class->fill_widgets = event_page_fill_widgets;
editor_page_class->fill_component = event_page_fill_component;
+ editor_page_class->fill_timezones = event_page_fill_timezones;
editor_page_class->set_summary = event_page_set_summary;
editor_page_class->set_dates = event_page_set_dates;
@@ -695,6 +697,34 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return TRUE;
}
+/* fill_timezones handler for the event page */
+static gboolean
+event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
+{
+ EventPage *epage;
+ EventPagePrivate *priv;
+ icaltimezone *zone;
+
+ epage = EVENT_PAGE (page);
+ priv = epage->priv;
+
+ /* add start date timezone */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone);
+ }
+
+ /* add end date timezone */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone);
+ }
+
+ return TRUE;
+}
+
/* set_summary handler for the event page */
static void
event_page_set_summary (CompEditorPage *page, const char *summary)
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index 0d657fe59e..6c8dcbba32 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -95,6 +95,7 @@ static GtkWidget *task_details_page_get_widget (CompEditorPage *page);
static void task_details_page_focus_main_widget (CompEditorPage *page);
static gboolean task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp);
+static gboolean task_details_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static CompEditorPageClass *parent_class = NULL;
@@ -128,6 +129,7 @@ task_details_page_class_init (TaskDetailsPageClass *class)
editor_page_class->focus_main_widget = task_details_page_focus_main_widget;
editor_page_class->fill_widgets = task_details_page_fill_widgets;
editor_page_class->fill_component = task_details_page_fill_component;
+ editor_page_class->fill_timezones = task_details_page_fill_timezones;
object_class->finalize = task_details_page_finalize;
}
@@ -436,6 +438,27 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return TRUE;
}
+/* fill_timezones handler for the event page */
+static gboolean
+task_details_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
+{
+ TaskDetailsPage *tdpage;
+ TaskDetailsPagePrivate *priv;
+ icaltimezone *zone;
+
+ tdpage = TASK_DETAILS_PAGE (page);
+ priv = tdpage->priv;
+
+ /* add UTC timezone, which is the one used for the DATE-COMPLETED property */
+ zone = icaltimezone_get_utc_timezone ();
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone);
+ }
+
+ return TRUE;
+}
+
/* Gets the widgets from the XML file and returns if they are all available. */
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 9b0efc6967..828b4bf4dc 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -93,6 +93,7 @@ static GtkWidget *task_page_get_widget (CompEditorPage *page);
static void task_page_focus_main_widget (CompEditorPage *page);
static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp);
+static gboolean task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
static void task_page_set_summary (CompEditorPage *page, const char *summary);
static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -128,6 +129,7 @@ task_page_class_init (TaskPageClass *class)
editor_page_class->focus_main_widget = task_page_focus_main_widget;
editor_page_class->fill_widgets = task_page_fill_widgets;
editor_page_class->fill_component = task_page_fill_component;
+ editor_page_class->fill_timezones = task_page_fill_timezones;
editor_page_class->set_summary = task_page_set_summary;
editor_page_class->set_dates = task_page_set_dates;
@@ -568,6 +570,34 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
return TRUE;
}
+/* fill_timezones handler for the event page */
+static gboolean
+task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+ icaltimezone *zone;
+
+ tpage = TASK_PAGE (page);
+ priv = tpage->priv;
+
+ /* add due date timezone */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone));
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone);
+ }
+
+ /* add start date timezone */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ if (zone) {
+ if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone)))
+ g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone);
+ }
+
+ return TRUE;
+}
+
/* set_summary handler for the task page */
static void
task_page_set_summary (CompEditorPage *page, const char *summary)