diff options
Diffstat (limited to 'modules/settings/e-settings-cal-model.c')
-rw-r--r-- | modules/settings/e-settings-cal-model.c | 179 |
1 files changed, 105 insertions, 74 deletions
diff --git a/modules/settings/e-settings-cal-model.c b/modules/settings/e-settings-cal-model.c index b973ebdc21..821f3b1165 100644 --- a/modules/settings/e-settings-cal-model.c +++ b/modules/settings/e-settings-cal-model.c @@ -22,7 +22,6 @@ #include "e-settings-cal-model.h" -#include <shell/e-shell.h> #include <calendar/gui/e-cal-model.h> #include <calendar/gui/e-cal-model-tasks.h> @@ -39,142 +38,174 @@ G_DEFINE_DYNAMIC_TYPE ( e_settings_cal_model, E_TYPE_EXTENSION) +static gboolean +settings_map_string_to_icaltimezone (GValue *value, + GVariant *variant, + gpointer user_data) +{ + GSettings *settings; + const gchar *location = NULL; + icaltimezone *timezone = NULL; + + settings = g_settings_new ("org.gnome.evolution.calendar"); + + if (g_settings_get_boolean (settings, "use-system-timezone")) + timezone = e_cal_util_get_system_timezone (); + else + location = g_variant_get_string (variant, NULL); + + if (location != NULL && *location != '\0') + timezone = icaltimezone_get_builtin_timezone (location); + + if (timezone == NULL) + timezone = icaltimezone_get_utc_timezone (); + + g_value_set_pointer (value, timezone); + + g_object_unref (settings); + + return TRUE; +} + static void settings_cal_model_constructed (GObject *object) { EExtension *extension; EExtensible *extensible; - EShellSettings *shell_settings; - EShell *shell; + GSettings *settings; extension = E_EXTENSION (object); extensible = e_extension_get_extensible (extension); - shell = e_shell_get_default (); - shell_settings = e_shell_get_shell_settings (shell); + settings = g_settings_new ("org.gnome.evolution.calendar"); /*** ECalModel ***/ - g_object_bind_property ( - shell_settings, "cal-compress-weekend", + g_settings_bind ( + settings, "compress-weekend", extensible, "compress-weekend", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-confirm-delete", + g_settings_bind ( + settings, "confirm-delete", extensible, "confirm-delete", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-default-reminder-interval", + g_settings_bind ( + settings, "default-reminder-interval", extensible, "default-reminder-interval", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-default-reminder-units", + g_settings_bind ( + settings, "default-reminder-units", extensible, "default-reminder-units", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-timezone", + g_settings_bind_with_mapping ( + settings, "timezone", extensible, "timezone", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET, + settings_map_string_to_icaltimezone, + NULL, /* one-way binding */ + NULL, (GDestroyNotify) NULL); - g_object_bind_property ( - shell_settings, "cal-use-24-hour-format", + g_settings_bind ( + settings, "use-24hour-format", extensible, "use-24-hour-format", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-use-default-reminder", + g_settings_bind ( + settings, "use-default-reminder", extensible, "use-default-reminder", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-week-start-day", + g_settings_bind ( + settings, "week-start-day-name", extensible, "week-start-day", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-monday", + g_settings_bind ( + settings, "work-day-monday", extensible, "work-day-monday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-tuesday", + g_settings_bind ( + settings, "work-day-tuesday", extensible, "work-day-tuesday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-wednesday", + g_settings_bind ( + settings, "work-day-wednesday", extensible, "work-day-wednesday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-thursday", + g_settings_bind ( + settings, "work-day-thursday", extensible, "work-day-thursday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-friday", + g_settings_bind ( + settings, "work-day-friday", extensible, "work-day-friday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-saturday", + g_settings_bind ( + settings, "work-day-saturday", extensible, "work-day-saturday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-working-days-sunday", + g_settings_bind ( + settings, "work-day-sunday", extensible, "work-day-sunday", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-work-day-end-hour", + g_settings_bind ( + settings, "day-end-hour", extensible, "work-day-end-hour", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-work-day-end-minute", + g_settings_bind ( + settings, "day-end-minute", extensible, "work-day-end-minute", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-work-day-start-hour", + g_settings_bind ( + settings, "day-start-hour", extensible, "work-day-start-hour", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-work-day-start-minute", + g_settings_bind ( + settings, "day-start-minute", extensible, "work-day-start-minute", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); /*** ECalModelTasks ***/ if (E_IS_CAL_MODEL_TASKS (extensible)) { - g_object_bind_property ( - shell_settings, "cal-tasks-highlight-due-today", + g_settings_bind ( + settings, "task-due-today-highlight", extensible, "highlight-due-today", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-tasks-color-due-today", + g_settings_bind ( + settings, "task-due-today-color", extensible, "color-due-today", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-tasks-highlight-overdue", + g_settings_bind ( + settings, "task-overdue-highlight", extensible, "highlight-overdue", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "cal-tasks-color-overdue", + g_settings_bind ( + settings, "task-overdue-color", extensible, "color-overdue", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); } + g_object_unref (settings); + /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_settings_cal_model_parent_class)-> constructed (object); |