aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-31 00:38:24 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-31 10:31:00 +0800
commit2fe24b4c136b4d5f255af3571c3d6e1082071809 (patch)
tree78568dcd907204107ca08afa1cfea84362c345a2 /modules/calendar
parent41569bb778e228d4f5a04cb1e15bfa5b49bb044b (diff)
downloadgsoc2013-evolution-2fe24b4c136b4d5f255af3571c3d6e1082071809.tar.gz
gsoc2013-evolution-2fe24b4c136b4d5f255af3571c3d6e1082071809.tar.zst
gsoc2013-evolution-2fe24b4c136b4d5f255af3571c3d6e1082071809.zip
Add properties to calendar classes.
So we can bind them to EShellSettings and kill off EDayViewConfig and similar GConf notification classes.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-content.c183
-rw-r--r--modules/calendar/e-cal-shell-settings.c170
2 files changed, 340 insertions, 13 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 1a55c74d35..4e6f871d67 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
#include "calendar/gui/calendar-config.h"
@@ -73,6 +74,19 @@ typedef enum {
static gpointer parent_class;
static GType cal_shell_content_type;
+static gboolean
+transform_week_start_day (const GValue *src_value,
+ GValue *dst_value)
+{
+ gint v_int;
+
+ /* Transform day numbering from 0 = Sunday to 0 = Monday. */
+ v_int = g_value_get_int (src_value);
+ g_value_set_int (dst_value, (v_int + 6) % 7);
+
+ return TRUE;
+}
+
static void
cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
GalView *gal_view)
@@ -297,15 +311,20 @@ static void
cal_shell_content_constructed (GObject *object)
{
ECalShellContentPrivate *priv;
- ECalModelCalendar *cal_model;
+ ECalendarView *calendar_view;
+ ECalModel *calendar_model;
ECalModel *memo_model;
ECalModel *task_model;
+ EShell *shell;
EShellContent *shell_content;
EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
EShellView *shell_view;
EShellWindow *shell_window;
EShellContent *foreign_content;
EShellView *foreign_view;
+ GnomeCalendar *calendar;
+ GnomeCalendarViewType view_type;
GalViewInstance *view_instance;
GConfBridge *bridge;
GtkWidget *container;
@@ -329,11 +348,8 @@ cal_shell_content_constructed (GObject *object)
shell_backend = e_shell_view_get_shell_backend (shell_view);
config_dir = e_shell_backend_get_config_dir (shell_backend);
- /* Calendar model for the views. */
- cal_model = e_cal_model_calendar_new ();
- e_cal_model_set_flags (
- E_CAL_MODEL (cal_model),
- E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
/* We borrow the memopad and taskpad models from the memo
* and task views, loading the views if necessary. */
@@ -378,16 +394,15 @@ cal_shell_content_constructed (GObject *object)
/* Add views in the order defined by GnomeCalendarViewType, such
* that the notebook page number corresponds to the view type. */
- for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) {
- GnomeCalendar *calendar;
- ECalendarView *view;
+ calendar = GNOME_CALENDAR (priv->calendar);
- calendar = GNOME_CALENDAR (priv->calendar);
- view = gnome_calendar_get_calendar_view (calendar, ii);
+ for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) {
+ calendar_view = gnome_calendar_get_calendar_view (calendar, ii);
gtk_notebook_append_page (
- GTK_NOTEBOOK (container), GTK_WIDGET (view), NULL);
- gtk_widget_show (GTK_WIDGET (view));
+ GTK_NOTEBOOK (container),
+ GTK_WIDGET (calendar_view), NULL);
+ gtk_widget_show (GTK_WIDGET (calendar_view));
}
container = priv->vpaned;
@@ -471,6 +486,148 @@ cal_shell_content_constructed (GObject *object)
key = "/apps/evolution/calendar/display/vpane_position";
gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+ /* Bind day view properties to EShellSettings. */
+
+ view_type = GNOME_CAL_DAY_VIEW;
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-show-line",
+ G_OBJECT (calendar_view), "marcus-bains-show-line");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-day-view-color",
+ G_OBJECT (calendar_view), "marcus-bains-day-view-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-time-bar-color",
+ G_OBJECT (calendar_view), "marcus-bains-time-bar-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-time-divisions",
+ G_OBJECT (calendar_view), "mins-per-row");
+
+ e_binding_new_full (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (calendar_view), "week-start-day",
+ (EBindingTransform) transform_week_start_day,
+ (GDestroyNotify) NULL, NULL);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-hour",
+ G_OBJECT (calendar_view), "work-day-end-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-minute",
+ G_OBJECT (calendar_view), "work-day-end-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-hour",
+ G_OBJECT (calendar_view), "work-day-start-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-minute",
+ G_OBJECT (calendar_view), "work-day-start-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days",
+ G_OBJECT (calendar_view), "working-days");
+
+ /* Bind work week view properties to EShellSettings. */
+
+ view_type = GNOME_CAL_WORK_WEEK_VIEW;
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-show-line",
+ G_OBJECT (calendar_view), "marcus-bains-show-line");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-day-view-color",
+ G_OBJECT (calendar_view), "marcus-bains-day-view-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-time-bar-color",
+ G_OBJECT (calendar_view), "marcus-bains-time-bar-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-time-divisions",
+ G_OBJECT (calendar_view), "mins-per-row");
+
+ e_binding_new_full (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (calendar_view), "week-start-day",
+ (EBindingTransform) transform_week_start_day,
+ (GDestroyNotify) NULL, NULL);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-hour",
+ G_OBJECT (calendar_view), "work-day-end-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-minute",
+ G_OBJECT (calendar_view), "work-day-end-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-hour",
+ G_OBJECT (calendar_view), "work-day-start-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-minute",
+ G_OBJECT (calendar_view), "work-day-start-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days",
+ G_OBJECT (calendar_view), "working-days");
+
+ /* Bind week view properties to EShellSettings. */
+
+ view_type = GNOME_CAL_WEEK_VIEW;
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-compress-weekend",
+ G_OBJECT (calendar_view), "compress-weekend");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-show-event-end-times",
+ G_OBJECT (calendar_view), "show-event-end-times");
+
+ e_binding_new_full (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (calendar_view), "week-start-day",
+ (EBindingTransform) transform_week_start_day,
+ (GDestroyNotify) NULL, NULL);
+
+ /* Bind month view properties to EShellSettings. */
+
+ view_type = GNOME_CAL_MONTH_VIEW;
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-compress-weekend",
+ G_OBJECT (calendar_view), "compress-weekend");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-show-event-end-times",
+ G_OBJECT (calendar_view), "show-event-end-times");
+
+ e_binding_new_full (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (calendar_view), "week-start-day",
+ (EBindingTransform) transform_week_start_day,
+ (GDestroyNotify) NULL, NULL);
+
+ /* Bind calendar model properties to EShellSettings.
+ * Note, does not matter from which view we get the
+ * model, since it's shared across all of them. */
+
+ calendar_model = e_calendar_view_get_model (calendar_view);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (calendar_view), "use-24-hour-format");
+
g_object_unref (memo_model);
g_object_unref (task_model);
}
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 03af4aeebc..0379a659b4 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -34,6 +34,54 @@ e_cal_shell_backend_init_settings (EShell *shell)
* Yes it's redundant, but we're stuck with GConf. */
e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-compress-weekend",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-compress-weekend",
+ "/apps/evolution/calendar/display/compress_weekend");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "cal-marcus-bains-day-view-color",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-marcus-bains-day-view-color",
+ "/apps/evolution/calendar/display/marcus_bains_color_dayview");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "cal-marcus-bains-time-bar-color",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-marcus-bains-time-bar-color",
+ "/apps/evolution/calendar/display/marcus_bains_color_timebar");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-marcus-bains-show-line",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-marcus-bains-show-line",
+ "/apps/evolution/calendar/display/marcus_bains_line");
+
+ e_shell_settings_install_property (
g_param_spec_string (
"cal-primary-calendar",
NULL,
@@ -47,6 +95,44 @@ e_cal_shell_backend_init_settings (EShell *shell)
e_shell_settings_install_property (
g_param_spec_boolean (
+ "cal-show-event-end-times",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-show-event-end-times",
+ "/apps/evolution/calendar/display/show_event_end");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-time-divisions",
+ NULL,
+ NULL,
+ 5,
+ 60,
+ 30,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-time-divisions",
+ "/apps/evolution/calendar/display/time_divisions");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-use-24-hour-format",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-use-24-hour-format",
+ "/apps/evolution/calendar/display/use_24hour_format");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
"cal-use-system-timezone",
NULL,
NULL,
@@ -56,4 +142,88 @@ e_cal_shell_backend_init_settings (EShell *shell)
e_shell_settings_bind_to_gconf (
shell_settings, "cal-use-system-timezone",
"/apps/evolution/calendar/display/use_system_timezone");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-week-start-day",
+ NULL,
+ NULL,
+ 0, /* Sunday */
+ 6, /* Saturday */
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-week-start-day",
+ "/apps/evolution/calendar/display/week_start_day");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-work-day-end-hour",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-work-day-end-hour",
+ "/apps/evolution/calendar/display/day_end_hour");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-work-day-end-minute",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-work-day-end-minute",
+ "/apps/evolution/calendar/display/day_end_minute");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-work-day-start-hour",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-work-day-start-hour",
+ "/apps/evolution/calendar/display/day_start_hour");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-work-day-start-minute",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-work-day-start-minute",
+ "/apps/evolution/calendar/display/day_start_minute");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-working-days",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-working-days",
+ "/apps/evolution/calendar/display/working_days");
}