aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-10-29 22:05:34 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-10-29 22:05:34 +0800
commit4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd (patch)
treec52b473aa7e259f552053581177c2a0b568b3c4b /calendar/gui
parent104ef59a6ae16a83f0ba16cedae32c6322b3fdc3 (diff)
downloadgsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar.gz
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar.bz2
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar.lz
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar.xz
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.tar.zst
gsoc2013-evolution-4cd045fb40ee5fcad3c5f86b9ecff5d4c21963cd.zip
set the timezone for all clients (timezone_changed_cb): callback for
2003-10-29 JP Rosevear <jpr@ximian.com> * gui/gnome-cal.c (set_timezone): set the timezone for all clients (timezone_changed_cb): callback for changes (setup_config): setup the configuration (setup_widgets): setup up configuration managers for the list view, task list and date navigator (gnome_calendar_init): setup config (gnome_calendar_destroy): destroy configuration managers and notifications (gnome_calendar_update_config_settings): remove dead bits * gui/e-mini-calendar-config.[hc]: manage configuration of an e-calendar * gui/e-day-view-config.h: remove extraneous comment, type the parent class correctly * gui/e-week-view-config.h: ditto * gui/e-day-view-config.c (e_day_view_config_class_init): type the class correctly (set_timezone): set timezone (timezone_changed_cb): timezone changed callback (e_day_view_config_set_view): track timezone changes * gui/e-week-view-config.c: ditto * gui/e-cell-date-edit-config.[hc]: manage configuration of a date edit cell * gui/e-calendar-table-config.[hc]: manage configuration of a e-calendar-table * gui/e-cal-list-view.c (get_current_time_cb): use the view timezone to compute * gui/e-cal-list-view-config.[hc]: manage configuration of a list view * gui/calendar-config.h: update protos * gui/calendar-config.c (calendar_config_add_notification_timezone): notify of timezone change (calendar_config_add_notification_dnav_show_week_no): notify of show week number setting change * gui/calendar-component.c (calendar_component_peek): remove bad comma * gui/Makefile.am: build new config classes svn path=/trunk/; revision=23114
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am10
-rw-r--r--calendar/gui/calendar-component.c2
-rw-r--r--calendar/gui/calendar-config.c18
-rw-r--r--calendar/gui/calendar-config.h2
-rw-r--r--calendar/gui/e-cal-list-view-config.c220
-rw-r--r--calendar/gui/e-cal-list-view-config.h55
-rw-r--r--calendar/gui/e-cal-list-view.c11
-rw-r--r--calendar/gui/e-calendar-table-config.c263
-rw-r--r--calendar/gui/e-calendar-table-config.h55
-rw-r--r--calendar/gui/e-cell-date-edit-config.c339
-rw-r--r--calendar/gui/e-cell-date-edit-config.h55
-rw-r--r--calendar/gui/e-day-view-config.c36
-rw-r--r--calendar/gui/e-day-view-config.h8
-rw-r--r--calendar/gui/e-mini-calendar-config.c247
-rw-r--r--calendar/gui/e-mini-calendar-config.h55
-rw-r--r--calendar/gui/e-week-view-config.c35
-rw-r--r--calendar/gui/e-week-view-config.h8
-rw-r--r--calendar/gui/gnome-cal.c130
18 files changed, 1485 insertions, 64 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 5b65905f60..26dfea9510 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -110,8 +110,14 @@ libevolution_calendar_la_SOURCES = \
e-cal-view.h \
e-cal-list-view.c \
e-cal-list-view.h \
- e-calendar-table.h \
+ e-cal-list-view-config.c \
+ e-cal-list-view-config.h \
e-calendar-table.c \
+ e-calendar-table.h \
+ e-calendar-table-config.c \
+ e-calendar-table-config.h \
+ e-cell-date-edit-config.c \
+ e-cell-date-edit-config.h \
e-cell-date-edit-text.h \
e-cell-date-edit-text.c \
e-comp-editor-registry.c \
@@ -145,6 +151,8 @@ libevolution_calendar_la_SOURCES = \
e-meeting-types.h \
e-meeting-utils.c \
e-meeting-utils.h \
+ e-mini-calendar-config.c \
+ e-mini-calendar-config.h \
e-select-names-editable.c \
e-select-names-editable.h \
e-select-names-renderer.c \
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 6621611b37..24736067bb 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -390,7 +390,7 @@ calendar_component_peek (void)
component = g_object_new (calendar_component_get_type (), NULL);
if (e_mkdir_hier (calendar_component_peek_config_directory (component), 0777) != 0) {
- g_warning (G_STRLOC, ": Cannot create directory %s: %s",
+ g_warning (G_STRLOC ": Cannot create directory %s: %s",
calendar_component_peek_config_directory (component),
g_strerror (errno));
g_object_unref (component);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index fe5bb487d4..d7bd087a8c 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -141,6 +141,15 @@ calendar_config_set_timezone (gchar *timezone)
gconf_client_set_string (config, CALENDAR_CONFIG_TIMEZONE, "UTC", NULL);
}
+guint
+calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer data)
+{
+ guint id;
+
+ id = gconf_client_notify_add (config, CALENDAR_CONFIG_TIMEZONE, func, data, NULL, NULL);
+
+ return id;
+}
/* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean
@@ -328,6 +337,15 @@ calendar_config_set_dnav_show_week_no (gboolean show_week_no)
gconf_client_set_bool (config, CALENDAR_CONFIG_DN_SHOW_WEEK_NUMBERS, show_week_no, NULL);
}
+guint
+calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func, gpointer data)
+{
+ guint id;
+
+ id = gconf_client_notify_add (config, CALENDAR_CONFIG_DN_SHOW_WEEK_NUMBERS, func, data, NULL, NULL);
+
+ return id;
+}
/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */
gint
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index fa695673b6..ad9c8531e5 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -71,6 +71,7 @@ void calendar_config_remove_notification (guint id);
/* The current timezone, e.g. "Europe/London". */
gchar* calendar_config_get_timezone (void);
void calendar_config_set_timezone (gchar *timezone);
+guint calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer data);
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays calendar_config_get_working_days (void);
@@ -122,6 +123,7 @@ guint calendar_config_add_notification_compress_weekend (GConfClientNotifyFunc f
/* Whether we show week numbers in the Date Navigator. */
gboolean calendar_config_get_dnav_show_week_no (void);
void calendar_config_set_dnav_show_week_no (gboolean show_week_no);
+guint calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func, gpointer data);
/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */
gint calendar_config_get_default_view (void);
diff --git a/calendar/gui/e-cal-list-view-config.c b/calendar/gui/e-cal-list-view-config.c
new file mode 100644
index 0000000000..cf6b586be7
--- /dev/null
+++ b/calendar/gui/e-cal-list-view-config.c
@@ -0,0 +1,220 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Author :
+ * Rodrigo Moya <rodrigo@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "calendar-config.h"
+#include "e-cal-list-view-config.h"
+
+struct _ECalListViewConfigPrivate {
+ ECalListView *view;
+
+ GList *notifications;
+};
+
+static GObjectClass *parent_class = NULL;
+
+/* Property IDs */
+enum props {
+ PROP_0,
+ PROP_VIEW,
+};
+
+static void
+e_cal_list_view_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ ECalListViewConfig *view_config;
+ ECalListViewConfigPrivate *priv;
+
+ view_config = E_CAL_LIST_VIEW_CONFIG (object);
+ priv = view_config->priv;
+
+ switch (property_id) {
+ case PROP_VIEW:
+ e_cal_list_view_config_set_view (view_config, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_cal_list_view_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ ECalListViewConfig *view_config;
+ ECalListViewConfigPrivate *priv;
+
+ view_config = E_CAL_LIST_VIEW_CONFIG (object);
+ priv = view_config->priv;
+
+ switch (property_id) {
+ case PROP_VIEW:
+ g_value_set_object (value, e_cal_list_view_config_get_view (view_config));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_cal_list_view_config_dispose (GObject *object)
+{
+ ECalListViewConfig *view_config = E_CAL_LIST_VIEW_CONFIG (object);
+ ECalListViewConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ e_cal_list_view_config_set_view (view_config, NULL);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+e_cal_list_view_config_finalize (GObject *object)
+{
+ ECalListViewConfig *view_config = E_CAL_LIST_VIEW_CONFIG (object);
+ ECalListViewConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ g_free (priv);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+e_cal_list_view_config_class_init (ECalListViewConfigClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GParamSpec *spec;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /* Method override */
+ gobject_class->set_property = e_cal_list_view_config_set_property;
+ gobject_class->get_property = e_cal_list_view_config_get_property;
+ gobject_class->dispose = e_cal_list_view_config_dispose;
+ gobject_class->finalize = e_cal_list_view_config_finalize;
+
+ spec = g_param_spec_object ("view", NULL, NULL, e_cal_list_view_get_type (),
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
+ g_object_class_install_property (gobject_class, PROP_VIEW, spec);
+}
+
+static void
+e_cal_list_view_config_init (ECalListViewConfig *view_config, ECalListViewConfigClass *klass)
+{
+ view_config->priv = g_new0 (ECalListViewConfigPrivate, 1);
+
+}
+
+E_MAKE_TYPE (e_cal_list_view_config, "ECalListViewConfig", ECalListViewConfig, e_cal_list_view_config_class_init,
+ e_cal_list_view_config_init, G_TYPE_OBJECT);
+
+ECalListViewConfig *
+e_cal_list_view_config_new (ECalListView *list_view)
+{
+ ECalListViewConfig *view_config;
+
+ view_config = g_object_new (e_cal_list_view_config_get_type (), "view", list_view, NULL);
+
+ return view_config;
+}
+
+ECalListView *
+e_cal_list_view_config_get_view (ECalListViewConfig *view_config)
+{
+ ECalListViewConfigPrivate *priv;
+
+ g_return_val_if_fail (view_config != NULL, NULL);
+ g_return_val_if_fail (E_IS_CAL_LIST_VIEW_CONFIG (view_config), NULL);
+
+ priv = view_config->priv;
+
+ return priv->view;
+}
+
+static void
+set_timezone (ECalListView *list_view)
+{
+ char *location;
+ icaltimezone *zone;
+
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+ if (!zone)
+ zone = icaltimezone_get_utc_timezone ();
+
+ e_cal_view_set_timezone (E_CAL_VIEW (list_view), zone);
+
+ g_free (location);
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECalListViewConfig *view_config = data;
+ ECalListViewConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_timezone (priv->view);
+}
+
+void
+e_cal_list_view_config_set_view (ECalListViewConfig *view_config, ECalListView *list_view)
+{
+ ECalListViewConfigPrivate *priv;
+ guint not;
+ GList *l;
+
+ g_return_if_fail (view_config != NULL);
+ g_return_if_fail (E_IS_CAL_LIST_VIEW_CONFIG (view_config));
+
+ priv = view_config->priv;
+
+ if (priv->view) {
+ g_object_unref (priv->view);
+ priv->view = NULL;
+ }
+
+ for (l = priv->notifications; l; l = l->next)
+ calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
+
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+
+ /* If the new view is NULL, return right now */
+ if (!list_view)
+ return;
+
+ priv->view = g_object_ref (list_view);
+
+ /* Time zone */
+ set_timezone (list_view);
+
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+}
diff --git a/calendar/gui/e-cal-list-view-config.h b/calendar/gui/e-cal-list-view-config.h
new file mode 100644
index 0000000000..d2f87c36b3
--- /dev/null
+++ b/calendar/gui/e-cal-list-view-config.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _E_CAL_LIST_VIEW_CONFIG_H_
+#define _E_CAL_LIST_VIEW_CONFIG_H_
+
+#include "e-cal-list-view.h"
+
+G_BEGIN_DECLS
+
+#define E_CAL_LIST_VIEW_CONFIG(obj) GTK_CHECK_CAST (obj, e_cal_list_view_config_get_type (), ECalListViewConfig)
+#define E_CAL_LIST_VIEW_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cal_list_view_config_get_type (), ECalListViewConfigClass)
+#define E_IS_CAL_LIST_VIEW_CONFIG(obj) GTK_CHECK_TYPE (obj, e_cal_list_view_config_get_type ())
+
+typedef struct _ECalListViewConfig ECalListViewConfig;
+typedef struct _ECalListViewConfigClass ECalListViewConfigClass;
+typedef struct _ECalListViewConfigPrivate ECalListViewConfigPrivate;
+
+struct _ECalListViewConfig {
+ GObject parent;
+
+ ECalListViewConfigPrivate *priv;
+};
+
+struct _ECalListViewConfigClass {
+ GObjectClass parent_class;
+};
+
+GType e_cal_list_view_config_get_type (void);
+ECalListViewConfig *e_cal_list_view_config_new (ECalListView *list_view);
+ECalListView *e_cal_list_view_config_get_view (ECalListViewConfig *view_config);
+void e_cal_list_view_config_set_view (ECalListViewConfig *view_config, ECalListView *list_view);
+
+G_END_DECLS
+
+#endif
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 720f378ac7..359ac4d557 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -152,21 +152,16 @@ e_cal_list_view_init (ECalListView *cal_list_view)
cal_list_view->set_table_id = 0;
}
-/* Returns the current time, for the ECellDateEdit items.
- FIXME: Should probably use the timezone of the item rather than the
- current timezone, though that may be difficult to get from here. */
+/* Returns the current time, for the ECellDateEdit items. */
static struct tm
get_current_time_cb (ECellDateEdit *ecde, gpointer data)
{
- char *location;
+ ECalListView *cal_list_view = data;
icaltimezone *zone;
struct tm tmp_tm = { 0 };
struct icaltimetype tt;
- /* Get the current timezone. */
- location = calendar_config_get_timezone ();
- zone = icaltimezone_get_builtin_timezone (location);
-
+ zone = e_cal_view_get_timezone (E_CAL_VIEW (cal_list_view));
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
/* Now copy it to the struct tm and return it. */
diff --git a/calendar/gui/e-calendar-table-config.c b/calendar/gui/e-calendar-table-config.c
new file mode 100644
index 0000000000..74be72143f
--- /dev/null
+++ b/calendar/gui/e-calendar-table-config.c
@@ -0,0 +1,263 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "calendar-config.h"
+#include "e-cell-date-edit-config.h"
+#include "e-calendar-table-config.h"
+
+struct _ECalendarTableConfigPrivate {
+ ECalendarTable *table;
+
+ ECellDateEditConfig *cell_config;
+
+ GList *notifications;
+};
+
+static GObjectClass *parent_class = NULL;
+
+/* Property IDs */
+enum props {
+ PROP_0,
+ PROP_TABLE
+};
+
+static void
+e_calendar_table_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ ECalendarTableConfig *table_config;
+ ECalendarTableConfigPrivate *priv;
+
+ table_config = E_CALENDAR_TABLE_CONFIG (object);
+ priv = table_config->priv;
+
+ switch (property_id) {
+ case PROP_TABLE:
+ e_calendar_table_config_set_table (table_config, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_calendar_table_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ ECalendarTableConfig *table_config;
+ ECalendarTableConfigPrivate *priv;
+
+ table_config = E_CALENDAR_TABLE_CONFIG (object);
+ priv = table_config->priv;
+
+ switch (property_id) {
+ case PROP_TABLE:
+ g_value_set_object (value, e_calendar_table_config_get_table (table_config));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_calendar_table_config_dispose (GObject *object)
+{
+ ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalendarTableConfigPrivate *priv;
+
+ priv = table_config->priv;
+
+ e_calendar_table_config_set_table (table_config, NULL);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+e_calendar_table_config_finalize (GObject *object)
+{
+ ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalendarTableConfigPrivate *priv;
+
+ priv = table_config->priv;
+
+ g_free (priv);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+e_calendar_table_config_class_init (ECalendarTableConfigClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GParamSpec *spec;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /* Method override */
+ gobject_class->set_property = e_calendar_table_config_set_property;
+ gobject_class->get_property = e_calendar_table_config_get_property;
+ gobject_class->dispose = e_calendar_table_config_dispose;
+ gobject_class->finalize = e_calendar_table_config_finalize;
+
+ spec = g_param_spec_object ("table", NULL, NULL, e_calendar_table_get_type (),
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
+ g_object_class_install_property (gobject_class, PROP_TABLE, spec);
+}
+
+static void
+e_calendar_table_config_init (ECalendarTableConfig *table_config, ECalendarTableConfigClass *klass)
+{
+ table_config->priv = g_new0 (ECalendarTableConfigPrivate, 1);
+
+}
+
+E_MAKE_TYPE (e_calendar_table_config, "ECalendarTableConfig", ECalendarTableConfig, e_calendar_table_config_class_init,
+ e_calendar_table_config_init, G_TYPE_OBJECT);
+
+ECalendarTableConfig *
+e_calendar_table_config_new (ECalendarTable *table)
+{
+ ECalendarTableConfig *table_config;
+
+ table_config = g_object_new (e_calendar_table_config_get_type (), "table", table, NULL);
+
+ return table_config;
+}
+
+ECalendarTable *
+e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
+{
+ ECalendarTableConfigPrivate *priv;
+
+ g_return_val_if_fail (table_config != NULL, NULL);
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
+
+ priv = table_config->priv;
+
+ return priv->table;
+}
+
+static void
+set_timezone (ECalendarTable *table)
+{
+ ECalModel *model;
+ char *location;
+ icaltimezone *zone;
+
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+ if (!zone)
+ zone = icaltimezone_get_utc_timezone ();
+
+ model = e_calendar_table_get_model (table);
+ if (model)
+ e_cal_model_set_timezone (model, zone);
+
+ g_free (location);
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECalendarTableConfig *table_config = data;
+ ECalendarTableConfigPrivate *priv;
+
+ priv = table_config->priv;
+
+ set_timezone (priv->table);
+}
+
+static void
+set_twentyfour_hour (ECalendarTable *table)
+{
+ ECalModel *model;
+ gboolean use_24_hour;
+
+ use_24_hour = calendar_config_get_24_hour_format ();
+
+ model = e_calendar_table_get_model (table);
+ if (model)
+ e_cal_model_set_use_24_hour_format (model, use_24_hour);
+}
+
+static void
+twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECalendarTableConfig *table_config = data;
+ ECalendarTableConfigPrivate *priv;
+
+ priv = table_config->priv;
+
+ set_twentyfour_hour (priv->table);
+}
+
+void
+e_calendar_table_config_set_table (ECalendarTableConfig *table_config, ECalendarTable *table)
+{
+ ECalendarTableConfigPrivate *priv;
+ guint not;
+ GList *l;
+
+ g_return_if_fail (table_config != NULL);
+ g_return_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config));
+
+ priv = table_config->priv;
+
+ if (priv->table) {
+ g_object_unref (priv->table);
+ priv->table = NULL;
+ }
+
+ if (priv->cell_config) {
+ g_object_unref (priv->cell_config);
+ priv->cell_config = NULL;
+ }
+
+ for (l = priv->notifications; l; l = l->next)
+ calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
+
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+
+ /* If the new view is NULL, return right now */
+ if (!table)
+ return;
+
+ priv->table = g_object_ref (table);
+
+ /* Time zone */
+ set_timezone (table);
+
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, table_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* 24 Hour format */
+ set_twentyfour_hour (table);
+
+ not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, table_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* Date cell */
+ priv->cell_config = e_cell_date_edit_config_new (table->dates_cell);
+}
diff --git a/calendar/gui/e-calendar-table-config.h b/calendar/gui/e-calendar-table-config.h
new file mode 100644
index 0000000000..399f3254d1
--- /dev/null
+++ b/calendar/gui/e-calendar-table-config.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _E_CALENDAR_TABLE_CONFIG_H_
+#define _E_CALENDAR_TABLE_CONFIG_H_
+
+#include "e-calendar-table.h"
+
+G_BEGIN_DECLS
+
+#define E_CALENDAR_TABLE_CONFIG(obj) GTK_CHECK_CAST (obj, e_calendar_table_config_get_type (), ECalendarTableConfig)
+#define E_CALENDAR_TABLE_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_calendar_table_config_get_type (), ECalendarTableConfigClass)
+#define E_IS_CALENDAR_TABLE_CONFIG(obj) GTK_CHECK_TYPE (obj, e_calendar_table_config_get_type ())
+
+typedef struct _ECalendarTableConfig ECalendarTableConfig;
+typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
+typedef struct _ECalendarTableConfigPrivate ECalendarTableConfigPrivate;
+
+struct _ECalendarTableConfig {
+ GObject parent;
+
+ ECalendarTableConfigPrivate *priv;
+};
+
+struct _ECalendarTableConfigClass {
+ GObjectClass parent_class;
+};
+
+GType e_calendar_table_config_get_type (void);
+ECalendarTableConfig *e_calendar_table_config_new (ECalendarTable *table);
+ECalendarTable *e_calendar_table_config_get_table (ECalendarTableConfig *view_config);
+void e_calendar_table_config_set_table (ECalendarTableConfig *view_config, ECalendarTable *table);
+
+G_END_DECLS
+
+#endif
diff --git a/calendar/gui/e-cell-date-edit-config.c b/calendar/gui/e-cell-date-edit-config.c
new file mode 100644
index 0000000000..8993e53d68
--- /dev/null
+++ b/calendar/gui/e-cell-date-edit-config.c
@@ -0,0 +1,339 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "calendar-config.h"
+#include "e-mini-calendar-config.h"
+#include "e-cell-date-edit-config.h"
+
+struct _ECellDateEditConfigPrivate {
+ ECellDateEdit *cell;
+
+ EMiniCalendarConfig *mini_config;
+
+ GList *notifications;
+};
+
+static GObjectClass *parent_class = NULL;
+
+/* Property IDs */
+enum props {
+ PROP_0,
+ PROP_CELL,
+};
+
+static void
+e_cell_date_edit_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ ECellDateEditConfig *view_config;
+ ECellDateEditConfigPrivate *priv;
+
+ view_config = E_CELL_DATE_EDIT_CONFIG (object);
+ priv = view_config->priv;
+
+ switch (property_id) {
+ case PROP_CELL:
+ e_cell_date_edit_config_set_cell (view_config, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_cell_date_edit_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ ECellDateEditConfig *view_config;
+ ECellDateEditConfigPrivate *priv;
+
+ view_config = E_CELL_DATE_EDIT_CONFIG (object);
+ priv = view_config->priv;
+
+ switch (property_id) {
+ case PROP_CELL:
+ g_value_set_object (value, e_cell_date_edit_config_get_cell (view_config));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_cell_date_edit_config_dispose (GObject *object)
+{
+ ECellDateEditConfig *view_config = E_CELL_DATE_EDIT_CONFIG (object);
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ e_cell_date_edit_config_set_cell (view_config, NULL);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+e_cell_date_edit_config_finalize (GObject *object)
+{
+ ECellDateEditConfig *view_config = E_CELL_DATE_EDIT_CONFIG (object);
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ g_free (priv);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+e_cell_date_edit_config_class_init (ECellDateEditConfigClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GParamSpec *spec;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /* Method override */
+ gobject_class->set_property = e_cell_date_edit_config_set_property;
+ gobject_class->get_property = e_cell_date_edit_config_get_property;
+ gobject_class->dispose = e_cell_date_edit_config_dispose;
+ gobject_class->finalize = e_cell_date_edit_config_finalize;
+
+ spec = g_param_spec_object ("cell", NULL, NULL, e_cell_date_edit_get_type (),
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
+ g_object_class_install_property (gobject_class, PROP_CELL, spec);
+}
+
+static void
+e_cell_date_edit_config_init (ECellDateEditConfig *view_config, ECellDateEditConfigClass *klass)
+{
+ view_config->priv = g_new0 (ECellDateEditConfigPrivate, 1);
+
+}
+
+E_MAKE_TYPE (e_cell_date_edit_config, "ECellDateEditConfig", ECellDateEditConfig, e_cell_date_edit_config_class_init,
+ e_cell_date_edit_config_init, G_TYPE_OBJECT);
+
+ECellDateEditConfig *
+e_cell_date_edit_config_new (ECellDateEdit *cell)
+{
+ ECellDateEditConfig *view_config;
+
+ view_config = g_object_new (e_cell_date_edit_config_get_type (), "cell", cell, NULL);
+
+ return view_config;
+}
+
+ECellDateEdit *
+e_cell_date_edit_config_get_cell (ECellDateEditConfig *view_config)
+{
+ ECellDateEditConfigPrivate *priv;
+
+ g_return_val_if_fail (view_config != NULL, NULL);
+ g_return_val_if_fail (E_IS_CELL_DATE_EDIT_CONFIG (view_config), NULL);
+
+ priv = view_config->priv;
+
+ return priv->cell;
+}
+
+static void
+set_timezone (ECellDateEdit *cell)
+{
+ ECellDateEditText *cell_text;
+ ECellPopup *cell_popup;
+ char *location;
+ icaltimezone *zone;
+
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+ if (!zone)
+ zone = icaltimezone_get_utc_timezone ();
+
+ cell_popup = E_CELL_POPUP (cell);
+ cell_text = E_CELL_DATE_EDIT_TEXT (cell_popup->child);
+ e_cell_date_edit_text_set_timezone (cell_text, zone);
+
+ g_free (location);
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECellDateEditConfig *view_config = data;
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_timezone (priv->cell);
+}
+
+static void
+set_twentyfour_hour (ECellDateEdit *cell)
+{
+ ECellDateEditText *cell_text;
+ ECellPopup *cell_popup;
+ gboolean use_24_hour;
+
+ use_24_hour = calendar_config_get_24_hour_format ();
+
+ e_cell_date_edit_freeze (cell);
+ g_object_set (G_OBJECT (cell),
+ "use_24_hour_format", use_24_hour,
+ NULL);
+ e_cell_date_edit_thaw (cell);
+
+ cell_popup = E_CELL_POPUP (cell);
+ cell_text = E_CELL_DATE_EDIT_TEXT (cell_popup->child);
+ e_cell_date_edit_text_set_use_24_hour_format (cell_text, use_24_hour);
+}
+
+static void
+twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECellDateEditConfig *view_config = data;
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_twentyfour_hour (priv->cell);
+}
+
+static void
+set_range (ECellDateEdit *cell)
+{
+ int start_hour, end_hour;
+
+ start_hour = calendar_config_get_day_start_hour ();
+ end_hour = calendar_config_get_day_end_hour ();
+
+ /* Round up the end hour. */
+ if (calendar_config_get_day_end_minute () != 0)
+ end_hour++;
+
+ /* Make sure the start hour is ok */
+ if (start_hour > end_hour)
+ start_hour = end_hour;
+
+ /* We use the default 0 - 24 now. */
+#if 0
+ g_object_set (G_OBJECT (cell),
+ "lower_hour", start_hour,
+ "upper_hour", end_hour,
+ NULL);
+#endif
+}
+
+static void
+day_start_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECellDateEditConfig *view_config = data;
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_range (priv->cell);
+}
+
+static void
+day_end_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECellDateEditConfig *view_config = data;
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_range (priv->cell);
+}
+
+static void
+day_end_minute_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ ECellDateEditConfig *view_config = data;
+ ECellDateEditConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_range (priv->cell);
+}
+
+void
+e_cell_date_edit_config_set_cell (ECellDateEditConfig *view_config, ECellDateEdit *cell)
+{
+ ECellDateEditConfigPrivate *priv;
+ guint not;
+ GList *l;
+
+ g_return_if_fail (view_config != NULL);
+ g_return_if_fail (E_IS_CELL_DATE_EDIT_CONFIG (view_config));
+
+ priv = view_config->priv;
+
+ if (priv->cell) {
+ g_object_unref (priv->cell);
+ priv->cell = NULL;
+ }
+
+ if (priv->mini_config) {
+ g_object_unref (priv->mini_config);
+ priv->mini_config = NULL;
+ }
+
+ for (l = priv->notifications; l; l = l->next)
+ calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
+
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+
+ /* If the new view is NULL, return right now */
+ if (!cell)
+ return;
+
+ priv->cell = g_object_ref (cell);
+
+ /* Time zone */
+ set_timezone (cell);
+
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* 24 Hour format */
+ set_twentyfour_hour (cell);
+
+ not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* Popup time range */
+ set_range (cell);
+
+ not = calendar_config_add_notification_day_start_hour (day_start_hour_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ not = calendar_config_add_notification_day_end_hour (day_end_hour_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ not = calendar_config_add_notification_day_end_minute (day_end_minute_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* The mini calendar */
+ priv->mini_config = e_mini_calendar_config_new (E_CALENDAR (cell->calendar));
+}
diff --git a/calendar/gui/e-cell-date-edit-config.h b/calendar/gui/e-cell-date-edit-config.h
new file mode 100644
index 0000000000..fad1d9e508
--- /dev/null
+++ b/calendar/gui/e-cell-date-edit-config.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _E_CELL_DATE_EDIT_CONFIG_H_
+#define _E_CELL_DATE_EDIT_CONFIG_H_
+
+#include <widgets/misc/e-cell-date-edit.h>
+
+G_BEGIN_DECLS
+
+#define E_CELL_DATE_EDIT_CONFIG(obj) GTK_CHECK_CAST (obj, e_cell_date_edit_config_get_type (), ECellDateEditConfig)
+#define E_CELL_DATE_EDIT_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cell_date_edit_config_get_type (), ECellDateEditConfigClass)
+#define E_IS_CELL_DATE_EDIT_CONFIG(obj) GTK_CHECK_TYPE (obj, e_cell_date_edit_config_get_type ())
+
+typedef struct _ECellDateEditConfig ECellDateEditConfig;
+typedef struct _ECellDateEditConfigClass ECellDateEditConfigClass;
+typedef struct _ECellDateEditConfigPrivate ECellDateEditConfigPrivate;
+
+struct _ECellDateEditConfig {
+ GObject parent;
+
+ ECellDateEditConfigPrivate *priv;
+};
+
+struct _ECellDateEditConfigClass {
+ GObjectClass parent_class;
+};
+
+GType e_cell_date_edit_config_get_type (void);
+ECellDateEditConfig *e_cell_date_edit_config_new (ECellDateEdit *cell);
+ECellDateEdit *e_cell_date_edit_config_get_cell (ECellDateEditConfig *cell_config);
+void e_cell_date_edit_config_set_cell (ECellDateEditConfig *view_config, ECellDateEdit *cell);
+
+G_END_DECLS
+
+#endif
diff --git a/calendar/gui/e-day-view-config.c b/calendar/gui/e-day-view-config.c
index 4e34370aff..a5fe7cc73b 100644
--- a/calendar/gui/e-day-view-config.c
+++ b/calendar/gui/e-day-view-config.c
@@ -105,7 +105,7 @@ e_day_view_config_finalize (GObject *object)
}
static void
-e_day_view_config_class_init (ECalViewClass *klass)
+e_day_view_config_class_init (EDayViewConfigClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *spec;
@@ -157,6 +157,33 @@ e_day_view_config_get_view (EDayViewConfig *view_config)
}
static void
+set_timezone (EDayView *day_view)
+{
+ char *location;
+ icaltimezone *zone;
+
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+ if (!zone)
+ zone = icaltimezone_get_utc_timezone ();
+
+ e_cal_view_set_timezone (E_CAL_VIEW (day_view), zone);
+
+ g_free (location);
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ EDayViewConfig *view_config = data;
+ EDayViewConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_timezone (priv->view);
+}
+
+static void
set_week_start (EDayView *day_view)
{
int week_start_day;
@@ -385,7 +412,13 @@ e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view)
return;
priv->view = g_object_ref (day_view);
+
+ /* Time zone */
+ set_timezone (day_view);
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
/* Week start */
set_week_start (day_view);
@@ -440,4 +473,3 @@ e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view)
not = calendar_config_add_notification_show_event_end (show_event_end_changed_cb, view_config);
priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
}
-
diff --git a/calendar/gui/e-day-view-config.h b/calendar/gui/e-day-view-config.h
index 79e49513bd..105cbb4f07 100644
--- a/calendar/gui/e-day-view-config.h
+++ b/calendar/gui/e-day-view-config.h
@@ -27,10 +27,6 @@
G_BEGIN_DECLS
-/*
- * EView - base widget class for the calendar views.
- */
-
#define E_DAY_VIEW_CONFIG(obj) GTK_CHECK_CAST (obj, e_day_view_config_get_type (), EDayViewConfig)
#define E_DAY_VIEW_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_day_view_config_get_type (), EDayViewConfigClass)
#define E_IS_DAY_VIEW_CONFIG(obj) GTK_CHECK_TYPE (obj, e_day_view_config_get_type ())
@@ -40,13 +36,13 @@ typedef struct _EDayViewConfigClass EDayViewConfigClass;
typedef struct _EDayViewConfigPrivate EDayViewConfigPrivate;
struct _EDayViewConfig {
- ECalView parent;
+ GObject parent;
EDayViewConfigPrivate *priv;
};
struct _EDayViewConfigClass {
- ECalViewClass parent_class;
+ GObjectClass parent_class;
};
GType e_day_view_config_get_type (void);
diff --git a/calendar/gui/e-mini-calendar-config.c b/calendar/gui/e-mini-calendar-config.c
new file mode 100644
index 0000000000..2f17b23beb
--- /dev/null
+++ b/calendar/gui/e-mini-calendar-config.c
@@ -0,0 +1,247 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "calendar-config.h"
+#include "e-mini-calendar-config.h"
+
+struct _EMiniCalendarConfigPrivate {
+ ECalendar *mini_cal;
+
+ GList *notifications;
+};
+
+static GObjectClass *parent_class = NULL;
+
+/* Property IDs */
+enum props {
+ PROP_0,
+ PROP_CALENDAR
+};
+
+static void
+e_mini_calendar_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ EMiniCalendarConfig *mini_config;
+ EMiniCalendarConfigPrivate *priv;
+
+ mini_config = E_MINI_CALENDAR_CONFIG (object);
+ priv = mini_config->priv;
+
+ switch (property_id) {
+ case PROP_CALENDAR:
+ e_mini_calendar_config_set_calendar (mini_config, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_mini_calendar_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ EMiniCalendarConfig *mini_config;
+ EMiniCalendarConfigPrivate *priv;
+
+ mini_config = E_MINI_CALENDAR_CONFIG (object);
+ priv = mini_config->priv;
+
+ switch (property_id) {
+ case PROP_CALENDAR:
+ g_value_set_object (value, e_mini_calendar_config_get_calendar (mini_config));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_mini_calendar_config_dispose (GObject *object)
+{
+ EMiniCalendarConfig *mini_config = E_MINI_CALENDAR_CONFIG (object);
+ EMiniCalendarConfigPrivate *priv;
+
+ priv = mini_config->priv;
+
+ e_mini_calendar_config_set_calendar (mini_config, NULL);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+e_mini_calendar_config_finalize (GObject *object)
+{
+ EMiniCalendarConfig *mini_config = E_MINI_CALENDAR_CONFIG (object);
+ EMiniCalendarConfigPrivate *priv;
+
+ priv = mini_config->priv;
+
+ g_free (priv);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+e_mini_calendar_config_class_init (EMiniCalendarConfigClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GParamSpec *spec;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /* Method override */
+ gobject_class->set_property = e_mini_calendar_config_set_property;
+ gobject_class->get_property = e_mini_calendar_config_get_property;
+ gobject_class->dispose = e_mini_calendar_config_dispose;
+ gobject_class->finalize = e_mini_calendar_config_finalize;
+
+ spec = g_param_spec_object ("calendar", NULL, NULL, e_calendar_get_type (),
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
+ g_object_class_install_property (gobject_class, PROP_CALENDAR, spec);
+}
+
+static void
+e_mini_calendar_config_init (EMiniCalendarConfig *mini_config, EMiniCalendarConfigClass *klass)
+{
+ mini_config->priv = g_new0 (EMiniCalendarConfigPrivate, 1);
+
+}
+
+E_MAKE_TYPE (e_mini_calendar_config, "EMiniCalendarConfig", EMiniCalendarConfig, e_mini_calendar_config_class_init,
+ e_mini_calendar_config_init, G_TYPE_OBJECT);
+
+EMiniCalendarConfig *
+e_mini_calendar_config_new (ECalendar *mini_cal)
+{
+ EMiniCalendarConfig *mini_config;
+
+ mini_config = g_object_new (e_mini_calendar_config_get_type (), "calendar", mini_cal, NULL);
+
+ return mini_config;
+}
+
+ECalendar *
+e_mini_calendar_config_get_calendar (EMiniCalendarConfig *mini_config)
+{
+ EMiniCalendarConfigPrivate *priv;
+
+ g_return_val_if_fail (mini_config != NULL, NULL);
+ g_return_val_if_fail (E_IS_MINI_CALENDAR_CONFIG (mini_config), NULL);
+
+ priv = mini_config->priv;
+
+ return priv->mini_cal;
+}
+
+static void
+set_week_start (ECalendar *mini_cal)
+{
+ int week_start_day;
+
+ week_start_day = calendar_config_get_week_start_day ();
+
+ /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
+ week_start_day = (week_start_day + 6) % 7;
+
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM (mini_cal->calitem),
+ "week_start_day", week_start_day,
+ NULL);
+}
+
+static void
+week_start_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ EMiniCalendarConfig *mini_config = data;
+ EMiniCalendarConfigPrivate *priv;
+
+ priv = mini_config->priv;
+
+ set_week_start (priv->mini_cal);
+}
+
+static void
+set_dnav_show_week_no (ECalendar *mini_cal)
+{
+ gboolean show_week_no;
+
+ show_week_no = calendar_config_get_dnav_show_week_no ();
+
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM (mini_cal->calitem),
+ "show_week_numbers", show_week_no,
+ NULL);
+}
+
+static void
+dnav_show_week_no_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ EMiniCalendarConfig *mini_config = data;
+ EMiniCalendarConfigPrivate *priv;
+
+ priv = mini_config->priv;
+
+ set_dnav_show_week_no (priv->mini_cal);
+}
+
+void
+e_mini_calendar_config_set_calendar (EMiniCalendarConfig *mini_config, ECalendar *mini_cal)
+{
+ EMiniCalendarConfigPrivate *priv;
+ guint not;
+ GList *l;
+
+ g_return_if_fail (mini_config != NULL);
+ g_return_if_fail (E_IS_MINI_CALENDAR_CONFIG (mini_config));
+
+ priv = mini_config->priv;
+
+ if (priv->mini_cal) {
+ g_object_unref (priv->mini_cal);
+ priv->mini_cal = NULL;
+ }
+
+ for (l = priv->notifications; l; l = l->next)
+ calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
+
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+
+ /* If the new view is NULL, return right now */
+ if (!mini_cal)
+ return;
+
+ priv->mini_cal = g_object_ref (mini_cal);
+
+ /* Week start */
+ set_week_start (mini_cal);
+
+ not = calendar_config_add_notification_week_start_day (week_start_changed_cb, mini_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* Show week numbers */
+ set_dnav_show_week_no (mini_cal);
+
+ not = calendar_config_add_notification_dnav_show_week_no (dnav_show_week_no_changed_cb, mini_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+}
diff --git a/calendar/gui/e-mini-calendar-config.h b/calendar/gui/e-mini-calendar-config.h
new file mode 100644
index 0000000000..78b9cfd363
--- /dev/null
+++ b/calendar/gui/e-mini-calendar-config.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author :
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright 2003, Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _E_MINI_CALENDAR_CONFIG_H_
+#define _E_MINI_CALENDAR_CONFIG_H_
+
+#include <widgets/misc/e-calendar.h>
+
+G_BEGIN_DECLS
+
+#define E_MINI_CALENDAR_CONFIG(obj) GTK_CHECK_CAST (obj, e_mini_calendar_config_get_type (), EMiniCalendarConfig)
+#define E_MINI_CALENDAR_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_mini_calendar_config_get_type (), EMiniCalendarConfigClass)
+#define E_IS_MINI_CALENDAR_CONFIG(obj) GTK_CHECK_TYPE (obj, e_mini_calendar_config_get_type ())
+
+typedef struct _EMiniCalendarConfig EMiniCalendarConfig;
+typedef struct _EMiniCalendarConfigClass EMiniCalendarConfigClass;
+typedef struct _EMiniCalendarConfigPrivate EMiniCalendarConfigPrivate;
+
+struct _EMiniCalendarConfig {
+ GObject parent;
+
+ EMiniCalendarConfigPrivate *priv;
+};
+
+struct _EMiniCalendarConfigClass {
+ GObjectClass parent_class;
+};
+
+GType e_mini_calendar_config_get_type (void);
+EMiniCalendarConfig *e_mini_calendar_config_new (ECalendar *mini_cal);
+ECalendar *e_mini_calendar_config_get_calendar (EMiniCalendarConfig *mini_config);
+void e_mini_calendar_config_set_calendar (EMiniCalendarConfig *mini_config, ECalendar *mini_cal);
+
+G_END_DECLS
+
+#endif
diff --git a/calendar/gui/e-week-view-config.c b/calendar/gui/e-week-view-config.c
index 8c9e2cfb70..8b1cdec6d4 100644
--- a/calendar/gui/e-week-view-config.c
+++ b/calendar/gui/e-week-view-config.c
@@ -105,7 +105,7 @@ e_week_view_config_finalize (GObject *object)
}
static void
-e_week_view_config_class_init (ECalViewClass *klass)
+e_week_view_config_class_init (EWeekViewConfigClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *spec;
@@ -157,6 +157,33 @@ e_week_view_config_get_view (EWeekViewConfig *view_config)
}
static void
+set_timezone (EWeekView *week_view)
+{
+ char *location;
+ icaltimezone *zone;
+
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+ if (!zone)
+ zone = icaltimezone_get_utc_timezone ();
+
+ e_cal_view_set_timezone (E_CAL_VIEW (week_view), zone);
+
+ g_free (location);
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ EWeekViewConfig *view_config = data;
+ EWeekViewConfigPrivate *priv;
+
+ priv = view_config->priv;
+
+ set_timezone (priv->view);
+}
+
+static void
set_week_start (EWeekView *week_view)
{
int week_start_week;
@@ -271,6 +298,12 @@ e_week_view_config_set_view (EWeekViewConfig *view_config, EWeekView *week_view)
return;
priv->view = g_object_ref (week_view);
+
+ /* Time zone */
+ set_timezone (week_view);
+
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
/* Week start */
set_week_start (week_view);
diff --git a/calendar/gui/e-week-view-config.h b/calendar/gui/e-week-view-config.h
index ab2fa6b025..e37cb0cfc0 100644
--- a/calendar/gui/e-week-view-config.h
+++ b/calendar/gui/e-week-view-config.h
@@ -27,10 +27,6 @@
G_BEGIN_DECLS
-/*
- * EView - base widget class for the calendar views.
- */
-
#define E_WEEK_VIEW_CONFIG(obj) GTK_CHECK_CAST (obj, e_week_view_config_get_type (), EWeekViewConfig)
#define E_WEEK_VIEW_CONFIG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_week_view_config_get_type (), EWeekViewConfigClass)
#define E_IS_WEEK_VIEW_CONFIG(obj) GTK_CHECK_TYPE (obj, e_week_view_config_get_type ())
@@ -40,13 +36,13 @@ typedef struct _EWeekViewConfigClass EWeekViewConfigClass;
typedef struct _EWeekViewConfigPrivate EWeekViewConfigPrivate;
struct _EWeekViewConfig {
- ECalView parent;
+ GObject parent;
EWeekViewConfigPrivate *priv;
};
struct _EWeekViewConfigClass {
- ECalViewClass parent_class;
+ GObjectClass parent_class;
};
GType e_week_view_config_get_type (void);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index da0bacdd91..f1925ad365 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -51,6 +51,9 @@
#include "e-week-view.h"
#include "e-week-view-config.h"
#include "e-cal-list-view.h"
+#include "e-cal-list-view-config.h"
+#include "e-mini-calendar-config.h"
+#include "e-calendar-table-config.h"
#include "evolution-calendar.h"
#include "gnome-cal.h"
#include "calendar-component.h"
@@ -105,9 +108,12 @@ struct _GnomeCalendarPrivate {
GtkWidget *hpane;
GtkWidget *notebook;
GtkWidget *vpane;
+
ECalendar *date_navigator;
+ EMiniCalendarConfig *date_navigator_config;
GtkWidget *todo;
-
+ ECalendarTableConfig *todo_config;
+
GtkWidget *day_view;
GtkWidget *work_week_view;
GtkWidget *week_view;
@@ -125,6 +131,8 @@ struct _GnomeCalendarPrivate {
ECalView *views[GNOME_CAL_LAST_VIEW];
GObject *configs[GNOME_CAL_LAST_VIEW];
GnomeCalendarViewType current_view_type;
+ GList *notifications;
+
gboolean range_selected;
/* These are the saved positions of the panes. They are multiples of
@@ -827,6 +835,67 @@ table_selection_change_cb (ETable *etable, gpointer data)
}
static void
+set_timezone (GnomeCalendar *calendar)
+{
+ GnomeCalendarPrivate *priv;
+ char *location;
+ GList *l;
+
+ priv = calendar->priv;
+
+ location = calendar_config_get_timezone ();
+ priv->zone = icaltimezone_get_builtin_timezone (location);
+ g_free (location);
+
+ if (!priv->zone)
+ priv->zone = icaltimezone_get_utc_timezone ();
+
+ for (l = priv->clients_list; l != NULL; l = l->next) {
+ CalClient *client = l->data;
+
+ if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED)
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (client, priv->zone, NULL);
+ }
+
+ if (priv->task_pad_client
+ && cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) {
+ /* FIXME Error Checking */
+ cal_client_set_default_timezone (priv->task_pad_client,
+ priv->zone, NULL);
+ }
+}
+
+static void
+timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+ GnomeCalendar *calendar = data;
+
+ set_timezone (calendar);
+}
+
+static void
+setup_config (GnomeCalendar *calendar)
+{
+ GnomeCalendarPrivate *priv;
+ guint not;
+
+ priv = calendar->priv;
+
+ /* Timezone */
+ set_timezone (calendar);
+
+ not = calendar_config_add_notification_timezone (timezone_changed_cb, calendar);
+ priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+
+ /* Pane positions */
+ priv->hpane_pos = calendar_config_get_hpane_pos ();
+ priv->vpane_pos = calendar_config_get_vpane_pos ();
+ priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
+ priv->vpane_pos_month_view = calendar_config_get_month_vpane_pos ();
+}
+
+static void
setup_widgets (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
@@ -875,6 +944,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The ECalendar. */
w = e_calendar_new ();
priv->date_navigator = E_CALENDAR (w);
+ priv->date_navigator_config = e_mini_calendar_config_new (priv->date_navigator);
e_calendar_item_set_days_start_week_sel (priv->date_navigator->calitem, 9);
e_calendar_item_set_max_days_sel (priv->date_navigator->calitem, 42);
gtk_widget_show (w);
@@ -891,7 +961,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The ToDo list. */
priv->todo = e_calendar_table_new ();
- calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->todo));
+ priv->todo_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->todo));
gtk_paned_pack2 (GTK_PANED (priv->vpane), priv->todo, TRUE, TRUE);
gtk_widget_show (priv->todo);
@@ -960,6 +1030,7 @@ setup_widgets (GnomeCalendar *gcal)
priv->views[GNOME_CAL_MONTH_VIEW] = E_CAL_VIEW (priv->month_view);
priv->configs[GNOME_CAL_MONTH_VIEW] = e_week_view_config_new (E_WEEK_VIEW (priv->views[GNOME_CAL_MONTH_VIEW]));
priv->views[GNOME_CAL_LIST_VIEW] = E_CAL_VIEW (priv->list_view);
+ priv->configs[GNOME_CAL_MONTH_VIEW] = e_cal_list_view_config_new (E_CAL_LIST_VIEW (priv->views[GNOME_CAL_LIST_VIEW]));
priv->configs[GNOME_CAL_LIST_VIEW] = NULL;
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
@@ -969,6 +1040,7 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (GTK_WIDGET (priv->views[i]));
}
+
gnome_calendar_update_config_settings (gcal, TRUE);
}
@@ -989,7 +1061,9 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->current_view_type = GNOME_CAL_DAY_VIEW;
priv->range_selected = FALSE;
+ setup_config (gcal);
setup_widgets (gcal);
+
priv->dn_queries = NULL;
priv->sexp = g_strdup ("#t"); /* Match all */
@@ -1034,7 +1108,8 @@ gnome_calendar_destroy (GtkObject *object)
if (priv) {
GList *l;
-
+ int i;
+
/* disconnect from signals on all the clients */
for (l = priv->clients_list; l != NULL; l = l->next) {
g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
@@ -1043,12 +1118,24 @@ gnome_calendar_destroy (GtkObject *object)
g_hash_table_destroy (priv->clients);
g_list_free (priv->clients_list);
-
+
free_categories (priv->cal_categories);
priv->cal_categories = NULL;
free_categories (priv->tasks_categories);
priv->tasks_categories = NULL;
+
+ for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
+ if (priv->configs[i])
+ g_object_unref (priv->configs[i]);
+ priv->configs[i] = NULL;
+ }
+ g_object_unref (priv->date_navigator_config);
+ g_object_unref (priv->todo_config);
+
+ for (l = priv->notifications; l; l = l->next)
+ calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
+ priv->notifications = NULL;
/* Save the TaskPad layout. */
filename = g_build_filename (calendar_component_peek_config_directory (calendar_component_peek ()),
@@ -2254,46 +2341,11 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
gboolean initializing)
{
GnomeCalendarPrivate *priv;
- char *location;
- GList *l;
- int i;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
priv = gcal->priv;
- calendar_config_configure_e_calendar (E_CALENDAR (priv->date_navigator));
-
- calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->todo));
-
- location = calendar_config_get_timezone ();
- priv->zone = icaltimezone_get_builtin_timezone (location);
-
- for (l = priv->clients_list; l != NULL; l = l->next) {
- CalClient *client = l->data;
-
- if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED)
- /* FIXME Error checking */
- cal_client_set_default_timezone (client, priv->zone, NULL);
- }
-
- if (priv->task_pad_client
- && cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) {
- /* FIXME Error Checking */
- cal_client_set_default_timezone (priv->task_pad_client,
- priv->zone, NULL);
- }
-
- for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
- e_cal_view_set_timezone (E_CAL_VIEW (priv->views[i]), priv->zone);
-
- if (initializing) {
- priv->hpane_pos = calendar_config_get_hpane_pos ();
- priv->vpane_pos = calendar_config_get_vpane_pos ();
- priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
- priv->vpane_pos_month_view = calendar_config_get_month_vpane_pos ();
- }
-
/* The range of days shown may have changed, so we update the date
navigator if needed. */
gnome_calendar_update_date_navigator (gcal);