aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-03-03 23:20:09 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-03-17 20:49:12 +0800
commit95a0ae4afb72b534c991fbcd774733a93f256514 (patch)
tree32293990fecd6a4a6401370e2a5aa355c6454022
parent23b89997658a8eb8bd2e1d9d20234a6978880aae (diff)
downloadgsoc2013-evolution-95a0ae4afb72b534c991fbcd774733a93f256514.tar.gz
gsoc2013-evolution-95a0ae4afb72b534c991fbcd774733a93f256514.tar.zst
gsoc2013-evolution-95a0ae4afb72b534c991fbcd774733a93f256514.zip
Remove ECalShellSettings.
EShellSettings predates GSettings and is no longer necessary. GSettings allows binding GObject properties to GSettings keys, with optional mapping functions. That fulfills the purpose of EShellSettings.
-rw-r--r--calendar/gui/calendar-config.c24
-rw-r--r--calendar/gui/itip-utils.c11
-rw-r--r--calendar/gui/print.c15
-rw-r--r--calendar/gui/tag-calendar.c30
-rw-r--r--calendar/importers/icalendar-importer.c15
-rw-r--r--modules/calendar/Makefile.am2
-rw-r--r--modules/calendar/e-cal-shell-backend.c70
-rw-r--r--modules/calendar/e-cal-shell-settings.c906
-rw-r--r--modules/calendar/e-cal-shell-settings.h33
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c90
-rw-r--r--modules/calendar/e-cal-shell-view-private.c55
-rw-r--r--modules/calendar/e-calendar-preferences.c639
-rw-r--r--modules/calendar/e-calendar-preferences.h2
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c67
-rw-r--r--modules/calendar/e-task-shell-sidebar.c67
-rw-r--r--modules/calendar/e-task-shell-view-private.c78
-rw-r--r--modules/calendar/e-task-shell-view-private.h6
-rw-r--r--modules/itip-formatter/itip-view.c47
-rw-r--r--modules/settings/e-settings-cal-model.c179
-rw-r--r--modules/settings/e-settings-calendar-item.c22
-rw-r--r--modules/settings/e-settings-calendar-view.c52
-rw-r--r--modules/settings/e-settings-client-cache.c49
-rw-r--r--modules/settings/e-settings-comp-editor.c83
-rw-r--r--modules/settings/e-settings-date-edit.c28
-rw-r--r--modules/settings/e-settings-meeting-store.c65
-rw-r--r--modules/settings/e-settings-meeting-time-selector.c15
-rw-r--r--modules/settings/e-settings-weekday-chooser.c15
27 files changed, 1042 insertions, 1623 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index d5f0691f60..04ca534ca4 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -100,15 +100,15 @@ calendar_config_get_timezone_stored (void)
static gchar *
calendar_config_get_timezone (void)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
gboolean use_system_timezone;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- use_system_timezone = e_shell_settings_get_boolean (
- shell_settings, "cal-use-system-timezone");
+ use_system_timezone =
+ g_settings_get_boolean (settings, "use-system-timezone");
+
+ g_object_unref (settings);
if (use_system_timezone)
return e_cal_util_get_system_timezone_location ();
@@ -442,19 +442,17 @@ calendar_config_add_notification_day_second_zone (CalendarConfigChangedFunc func
gboolean
calendar_config_get_prefer_meeting (void)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
gchar *prefer_new_item;
gboolean prefer_meeting;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- prefer_new_item = e_shell_settings_get_string (
- shell_settings, "cal-prefer-new-item");
+ prefer_new_item = g_settings_get_string (settings, "prefer-new-item");
prefer_meeting = g_strcmp0 (prefer_new_item, "event-meeting-new") == 0;
-
g_free (prefer_new_item);
+ g_object_unref (settings);
+
return prefer_meeting;
}
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index ad5c83cf28..82dc88a37f 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1653,7 +1653,7 @@ itip_send_comp (ESourceRegistry *registry,
gboolean only_new_attendees)
{
EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
EMsgComposer *composer;
EComposerHeaderTable *table;
EDestination **destinations;
@@ -1670,10 +1670,13 @@ itip_send_comp (ESourceRegistry *registry,
/* FIXME Pass this in. */
shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
- use_24_hour_format = e_shell_settings_get_boolean (
- shell_settings, "cal-use-24-hour-format");
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ use_24_hour_format =
+ g_settings_get_boolean (settings, "use-24hour-format");
+
+ g_object_unref (settings);
default_zone = e_cal_client_get_default_timezone (cal_client);
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 7b9df1578d..9ae8fbf503 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -637,14 +637,17 @@ titled_box (GtkPrintContext *context,
static gboolean
get_show_week_numbers (void)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
+ gboolean show_week_numbers;
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ show_week_numbers =
+ g_settings_get_boolean (settings, "show-week-numbers");
+
+ g_object_unref (settings);
- return e_shell_settings_get_boolean (
- shell_settings, "cal-show-week-numbers");
+ return show_week_numbers;
}
enum datefmt {
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index 06e2bb006f..93b6e63597 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -29,7 +29,6 @@
#endif
#include "shell/e-shell.h"
-#include "shell/e-shell-settings.h"
#include "calendar-config.h"
#include "tag-calendar.h"
@@ -129,19 +128,6 @@ tag_calendar_cb (ECalComponent *comp,
return TRUE;
}
-static gboolean
-get_recur_events_italic (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- return e_shell_settings_get_boolean (
- shell_settings, "cal-recur-events-italic");
-}
-
/**
* tag_calendar_by_client:
* @ecal: Calendar widget to tag.
@@ -156,6 +142,7 @@ tag_calendar_by_client (ECalendar *ecal,
ECalClient *client,
GCancellable *cancellable)
{
+ GSettings *settings;
struct calendar_tag_closure *closure;
g_return_if_fail (E_IS_CALENDAR (ecal));
@@ -172,8 +159,13 @@ tag_calendar_by_client (ECalendar *ecal,
return;
}
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
closure->skip_transparent_events = TRUE;
- closure->recur_events_italic = get_recur_events_italic ();
+ closure->recur_events_italic =
+ g_settings_get_boolean (settings, "recur-events-italic");
+
+ g_object_unref (settings);
e_cal_client_generate_instances (
client, closure->start_time, closure->end_time, cancellable,
@@ -235,6 +227,7 @@ tag_calendar_by_comp (ECalendar *ecal,
gboolean can_recur_events_italic,
GCancellable *cancellable)
{
+ GSettings *settings;
struct calendar_tag_closure closure;
g_return_if_fail (E_IS_CALENDAR (ecal));
@@ -247,9 +240,14 @@ tag_calendar_by_comp (ECalendar *ecal,
if (!prepare_tag (ecal, &closure, display_zone, clear_first))
return;
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
closure.skip_transparent_events = FALSE;
closure.recur_events_italic =
- can_recur_events_italic && get_recur_events_italic ();
+ can_recur_events_italic &&
+ g_settings_get_boolean (settings, "recur-events-italic");
+
+ g_object_unref (settings);
if (comp_is_on_server) {
struct calendar_tag_closure *alloced_closure;
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index 4d8657df5b..3cda9da6ac 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -1407,25 +1407,20 @@ static icaltimezone *
get_users_timezone (void)
{
/* more or less copy&paste of calendar_config_get_icaltimezone */
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
icaltimezone *zone = NULL;
gchar *location;
- /* FIXME Pass this in. */
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- if (e_shell_settings_get_boolean (shell_settings, "cal-use-system-timezone")) {
+ if (g_settings_get_boolean (settings, "use-system-timezone")) {
location = e_cal_util_get_system_timezone_location ();
} else {
- GSettings *settings = g_settings_new ("org.gnome.evolution.calendar");
-
location = g_settings_get_string (settings, "timezone");
-
- g_object_unref (settings);
}
+ g_object_unref (settings);
+
if (location) {
zone = icaltimezone_get_builtin_timezone (location);
diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am
index e8ec2af362..540d61a88f 100644
--- a/modules/calendar/Makefile.am
+++ b/modules/calendar/Makefile.am
@@ -27,8 +27,6 @@ module_calendar_la_SOURCES = \
e-cal-shell-content.h \
e-cal-shell-migrate.c \
e-cal-shell-migrate.h \
- e-cal-shell-settings.c \
- e-cal-shell-settings.h \
e-cal-shell-sidebar.c \
e-cal-shell-sidebar.h \
e-cal-shell-view.c \
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index ec7af990e5..95ecf398e8 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -41,7 +41,6 @@
#include "e-cal-shell-content.h"
#include "e-cal-shell-migrate.h"
-#include "e-cal-shell-settings.h"
#include "e-cal-shell-sidebar.h"
#include "e-cal-shell-view.h"
@@ -67,26 +66,25 @@ cal_shell_backend_new_event (ECalClient *cal_client,
gboolean all_day)
{
ECalComponent *comp;
- EShellSettings *shell_settings;
+ GSettings *settings;
CompEditor *editor;
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
editor = event_editor_new (cal_client, shell, flags);
comp = cal_comp_event_new_with_current_time (
cal_client, all_day,
- e_shell_settings_get_boolean (
- shell_settings, "cal-use-default-reminder"),
- e_shell_settings_get_int (
- shell_settings, "cal-default-reminder-interval"),
- e_shell_settings_get_int ( /* enum, actually */
- shell_settings, "cal-default-reminder-units"));
+ g_settings_get_boolean (settings, "use-default-reminder"),
+ g_settings_get_int (settings, "default-reminder-interval"),
+ g_settings_get_enum (settings, "default-reminder-units"));
e_cal_component_commit_sequence (comp);
comp_editor_edit_comp (editor, comp);
gtk_window_present (GTK_WINDOW (editor));
g_object_unref (comp);
+
+ g_object_unref (settings);
}
static void
@@ -391,7 +389,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
const gchar *uri)
{
EShell *shell;
- EShellSettings *shell_settings;
CompEditor *editor;
CompEditorFlags flags = 0;
EClient *client;
@@ -399,6 +396,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ECalComponent *comp;
ESource *source;
ESourceRegistry *registry;
+ GSettings *settings;
SoupURI *soup_uri;
icalcomponent *icalcomp;
icalproperty *icalprop;
@@ -414,9 +412,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
shell = e_shell_backend_get_shell (shell_backend);
client_cache = e_shell_get_client_cache (shell);
- shell_settings = e_shell_get_shell_settings (shell);
-
- zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
if (strncmp (uri, "calendar:", 9) != 0)
return FALSE;
@@ -433,6 +428,26 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_date_clear (&start_date, 1);
g_date_clear (&end_date, 1);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ if (g_settings_get_boolean (settings, "use-system-timezone"))
+ zone = e_cal_util_get_system_timezone ();
+ else {
+ gchar *location;
+
+ location = g_settings_get_string (settings, "timezone");
+
+ if (location != NULL) {
+ zone = icaltimezone_get_builtin_timezone (location);
+ g_free (location);
+ }
+ }
+
+ if (zone == NULL)
+ zone = icaltimezone_get_utc_timezone ();
+
+ g_object_unref (settings);
+
while (*cp != '\0') {
gchar *header;
gchar *content;
@@ -642,11 +657,19 @@ ensure_alarm_notify_is_running (void)
}
static void
+cal_shell_backend_use_system_timezone_changed_cb (GSettings *settings,
+ const gchar *key)
+{
+ g_signal_emit_by_name (settings, "changed::timezone", timezone);
+}
+
+static void
cal_shell_backend_constructed (GObject *object)
{
EShell *shell;
EShellBackend *shell_backend;
GtkWidget *preferences_window;
+ GSettings *settings;
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
@@ -663,8 +686,6 @@ cal_shell_backend_constructed (GObject *object)
cal_shell_backend_init_importers ();
- e_cal_shell_backend_init_settings (shell);
-
/* Setup preference widget factories */
preferences_window = e_shell_get_preferences_window (shell);
@@ -677,11 +698,22 @@ cal_shell_backend_constructed (GObject *object)
e_calendar_preferences_new,
600);
- g_object_bind_property (
- e_shell_get_shell_settings (shell), "cal-prefer-new-item",
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ g_settings_bind (
+ settings, "prefer-new-item",
shell_backend, "prefer-new-item",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
+
+ /* Changing whether or not to use the system timezone may change
+ * Evolution's current timezone. Need to emit "changed" signals
+ * for both keys. */
+ g_signal_connect (
+ settings, "changed::use-system-timezone",
+ G_CALLBACK (cal_shell_backend_use_system_timezone_changed_cb),
+ NULL);
+
+ g_object_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_cal_shell_backend_parent_class)->constructed (object);
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
deleted file mode 100644
index d3288401f5..0000000000
--- a/modules/calendar/e-cal-shell-settings.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- * e-cal-shell-settings.c
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-cal-shell-settings.h"
-
-#include <libecal/libecal.h>
-
-#include <e-util/e-util.h>
-#include <e-util/e-util-enumtypes.h>
-
-#define CALENDAR_SCHEMA "org.gnome.evolution.calendar"
-#define EDS_CALENDAR_CONTACTS_SCHEMA "org.gnome.evolution-data-server.calendar"
-
-static gboolean
-transform_string_to_icaltimezone (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gboolean use_system_timezone;
- const gchar *location = NULL;
- icaltimezone *timezone = NULL;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- use_system_timezone = e_shell_settings_get_boolean (
- shell_settings, "cal-use-system-timezone");
-
- if (use_system_timezone)
- timezone = e_cal_util_get_system_timezone ();
- else
- location = g_value_get_string (source_value);
-
- if (location != NULL && *location != '\0')
- timezone = icaltimezone_get_builtin_timezone (location);
-
- if (timezone == NULL)
- timezone = icaltimezone_get_utc_timezone ();
-
- g_value_set_pointer (target_value, timezone);
-
- return TRUE;
-}
-
-static gboolean
-transform_icaltimezone_to_string (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gboolean use_system_timezone;
- const gchar *location = NULL;
- gchar *location_str = NULL;
- icaltimezone *timezone;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- use_system_timezone = e_shell_settings_get_boolean (
- shell_settings, "cal-use-system-timezone");
-
- if (use_system_timezone) {
- location_str = e_shell_settings_get_string (
- shell_settings, "cal-timezone-string");
- location = location_str;
- } else {
- timezone = g_value_get_pointer (source_value);
-
- if (timezone != NULL)
- location = icaltimezone_get_location (timezone);
- }
-
- if (location == NULL)
- location = "UTC";
-
- g_value_set_string (target_value, location);
-
- g_free (location_str);
-
- return TRUE;
-}
-
-static gboolean
-transform_weekdays_settings_to_evolution (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- GDateWeekday weekday;
-
- /* XXX At some point, Evolution changed its weekday numbering
- * from 0 = Sunday to 0 = Monday, but did not migrate the
- * "week_start_day" key. Both enumerations are of course
- * different from GDateWeekday. We should have saved the
- * weekday as a string instead. */
-
- /* This is purposefully verbose for better readability. */
-
- /* setting numbering */
- switch (g_value_get_int (source_value)) {
- case 0:
- weekday = G_DATE_SUNDAY;
- break;
- case 1:
- weekday = G_DATE_MONDAY;
- break;
- case 2:
- weekday = G_DATE_TUESDAY;
- break;
- case 3:
- weekday = G_DATE_WEDNESDAY;
- break;
- case 4:
- weekday = G_DATE_THURSDAY;
- break;
- case 5:
- weekday = G_DATE_FRIDAY;
- break;
- case 6:
- weekday = G_DATE_SATURDAY;
- break;
- default:
- return FALSE;
- }
-
- /* Evolution numbering */
- g_value_set_enum (target_value, weekday);
-
- return TRUE;
-}
-
-static gboolean
-transform_weekdays_evolution_to_settings (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- GDateWeekday weekday;
-
- /* XXX At some point, Evolution changed its weekday numbering
- * from 0 = Sunday to 0 = Monday, but did not migrate the
- * "week_start_day" key. Both enumerations are of course
- * different from GDateWeekday. We should have saved the
- * weekday as a string instead. */
-
- /* This is purposefully verbose for better readability. */
-
- /* Evolution numbering */
- weekday = g_value_get_enum (source_value);
-
- /* setting numbering */
- switch (weekday) {
- case G_DATE_MONDAY:
- g_value_set_int (target_value, 1);
- break;
- case G_DATE_TUESDAY:
- g_value_set_int (target_value, 2);
- break;
- case G_DATE_WEDNESDAY:
- g_value_set_int (target_value, 3);
- break;
- case G_DATE_THURSDAY:
- g_value_set_int (target_value, 4);
- break;
- case G_DATE_FRIDAY:
- g_value_set_int (target_value, 5);
- break;
- case G_DATE_SATURDAY:
- g_value_set_int (target_value, 6);
- break;
- case G_DATE_SUNDAY:
- g_value_set_int (target_value, 0);
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Working day flags */
-enum {
- WORKING_DAY_SUNDAY = 1 << 0,
- WORKING_DAY_MONDAY = 1 << 1,
- WORKING_DAY_TUESDAY = 1 << 2,
- WORKING_DAY_WEDNESDAY = 1 << 3,
- WORKING_DAY_THURSDAY = 1 << 4,
- WORKING_DAY_FRIDAY = 1 << 5,
- WORKING_DAY_SATURDAY = 1 << 6
-};
-
-static gboolean
-transform_working_days_bitset_to_sunday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_SUNDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_sunday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_SUNDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_SUNDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_monday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_MONDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_monday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_MONDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_MONDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_tuesday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_TUESDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_tuesday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_TUESDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_TUESDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_wednesday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_WEDNESDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_wednesday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_WEDNESDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_WEDNESDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_thursday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_THURSDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_thursday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_THURSDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_THURSDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_friday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_FRIDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_friday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_FRIDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_FRIDAY) | bit);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_bitset_to_saturday (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- gint bitset;
- gboolean working_day;
-
- bitset = g_value_get_int (source_value);
- working_day = ((bitset & WORKING_DAY_SATURDAY) != 0);
- g_value_set_boolean (target_value, working_day);
-
- return TRUE;
-}
-
-static gboolean
-transform_working_days_saturday_to_bitset (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- EShellSettings *shell_settings;
- gint bitset, bit;
-
- shell_settings = E_SHELL_SETTINGS (user_data);
-
- bitset = e_shell_settings_get_int (
- shell_settings, "cal-working-days-bitset");
-
- bit = g_value_get_boolean (source_value) ? WORKING_DAY_SATURDAY : 0;
- g_value_set_int (target_value, (bitset & ~WORKING_DAY_SATURDAY) | bit);
-
- return TRUE;
-}
-
-static void
-cal_use_system_timezone_changed_cb (GObject *shell_settings)
-{
- g_object_notify (shell_settings, "cal-timezone-string");
-}
-
-void
-e_cal_shell_backend_init_settings (EShell *shell)
-{
- EShellSettings *shell_settings;
-
- shell_settings = e_shell_get_shell_settings (shell);
-
- e_shell_settings_install_property_for_key (
- "cal-ba-reminder-interval",
- EDS_CALENDAR_CONTACTS_SCHEMA,
- "contacts-reminder-interval");
-
- e_shell_settings_install_property_for_key (
- "cal-ba-reminder-units-string",
- EDS_CALENDAR_CONTACTS_SCHEMA,
- "contacts-reminder-units");
-
- e_shell_settings_install_property_for_key (
- "cal-compress-weekend",
- CALENDAR_SCHEMA,
- "compress-weekend");
-
- e_shell_settings_install_property_for_key (
- "cal-confirm-delete",
- CALENDAR_SCHEMA,
- "confirm-delete");
-
- e_shell_settings_install_property_for_key (
- "cal-confirm-purge",
- CALENDAR_SCHEMA,
- "confirm-purge");
-
- e_shell_settings_install_property_for_key (
- "cal-default-reminder-interval",
- CALENDAR_SCHEMA,
- "default-reminder-interval");
-
- /* Do not bind to this.
- * Use "cal-default-reminder-units" instead. */
- e_shell_settings_install_property_for_key (
- "cal-default-reminder-units-string",
- CALENDAR_SCHEMA,
- "default-reminder-units");
-
- e_shell_settings_install_property_for_key (
- "cal-free-busy-template",
- CALENDAR_SCHEMA,
- "publish-template");
-
- e_shell_settings_install_property_for_key (
- "cal-hide-completed-tasks",
- CALENDAR_SCHEMA,
- "hide-completed-tasks");
-
- /* Do not bind to this.
- * Use "cal-hide-completed-tasks-units" instead. */
- e_shell_settings_install_property_for_key (
- "cal-hide-completed-tasks-units-string",
- CALENDAR_SCHEMA,
- "hide-completed-tasks-units");
-
- e_shell_settings_install_property_for_key (
- "cal-hide-completed-tasks-value",
- CALENDAR_SCHEMA,
- "hide-completed-tasks-value");
-
- e_shell_settings_install_property_for_key (
- "cal-marcus-bains-day-view-color",
- CALENDAR_SCHEMA,
- "marcus-bains-color-dayview");
-
- e_shell_settings_install_property_for_key (
- "cal-marcus-bains-time-bar-color",
- CALENDAR_SCHEMA,
- "marcus-bains-color-timebar");
-
- e_shell_settings_install_property_for_key (
- "cal-marcus-bains-show-line",
- CALENDAR_SCHEMA,
- "marcus-bains-line");
-
- e_shell_settings_install_property_for_key (
- "cal-month-scroll-by-week",
- CALENDAR_SCHEMA,
- "month-scroll-by-week");
-
- e_shell_settings_install_property_for_key (
- "cal-primary-calendar",
- CALENDAR_SCHEMA,
- "primary-calendar");
-
- e_shell_settings_install_property_for_key (
- "cal-primary-memo-list",
- CALENDAR_SCHEMA,
- "primary-memos");
-
- e_shell_settings_install_property_for_key (
- "cal-primary-task-list",
- CALENDAR_SCHEMA,
- "primary-tasks");
-
- e_shell_settings_install_property_for_key (
- "cal-recur-events-italic",
- CALENDAR_SCHEMA,
- "recur-events-italic");
-
- e_shell_settings_install_property_for_key (
- "cal-search-range-years",
- CALENDAR_SCHEMA,
- "search-range-years");
-
- e_shell_settings_install_property_for_key (
- "cal-show-event-end-times",
- CALENDAR_SCHEMA,
- "show-event-end");
-
- e_shell_settings_install_property_for_key (
- "cal-show-week-numbers",
- CALENDAR_SCHEMA,
- "show-week-numbers");
-
- e_shell_settings_install_property_for_key (
- "cal-tasks-highlight-due-today",
- CALENDAR_SCHEMA,
- "task-due-today-highlight");
-
- e_shell_settings_install_property_for_key (
- "cal-tasks-color-due-today",
- CALENDAR_SCHEMA,
- "task-due-today-color");
-
- e_shell_settings_install_property_for_key (
- "cal-tasks-highlight-overdue",
- CALENDAR_SCHEMA,
- "task-overdue-highlight");
-
- e_shell_settings_install_property_for_key (
- "cal-tasks-color-overdue",
- CALENDAR_SCHEMA,
- "task-overdue-color");
-
- e_shell_settings_install_property_for_key (
- "cal-time-divisions",
- CALENDAR_SCHEMA,
- "time-divisions");
-
- /* Do not bind to this. Use "cal-timezone" instead. */
- e_shell_settings_install_property_for_key (
- "cal-timezone-string",
- CALENDAR_SCHEMA,
- "timezone");
-
- e_shell_settings_install_property_for_key (
- "cal-use-24-hour-format",
- CALENDAR_SCHEMA,
- "use-24hour-format");
-
- e_shell_settings_install_property_for_key (
- "cal-use-ba-reminder",
- EDS_CALENDAR_CONTACTS_SCHEMA,
- "contacts-reminder-enabled");
-
- e_shell_settings_install_property_for_key (
- "cal-use-default-reminder",
- CALENDAR_SCHEMA,
- "use-default-reminder");
-
- e_shell_settings_install_property_for_key (
- "cal-use-system-timezone",
- CALENDAR_SCHEMA,
- "use-system-timezone");
-
- /* Do not bind to this. Use "cal-week-start-day" instead. */
- e_shell_settings_install_property_for_key (
- "cal-week-start-day-setting",
- CALENDAR_SCHEMA,
- "week-start-day");
-
- e_shell_settings_install_property_for_key (
- "cal-work-day-end-hour",
- CALENDAR_SCHEMA,
- "day-end-hour");
-
- e_shell_settings_install_property_for_key (
- "cal-work-day-end-minute",
- CALENDAR_SCHEMA,
- "day-end-minute");
-
- e_shell_settings_install_property_for_key (
- "cal-work-day-start-hour",
- CALENDAR_SCHEMA,
- "day-start-hour");
-
- e_shell_settings_install_property_for_key (
- "cal-work-day-start-minute",
- CALENDAR_SCHEMA,
- "day-start-minute");
-
- e_shell_settings_install_property_for_key (
- "cal-working-days-bitset",
- CALENDAR_SCHEMA,
- "working-days");
-
- e_shell_settings_install_property_for_key (
- "cal-prefer-new-item",
- CALENDAR_SCHEMA,
- "prefer-new-item");
-
- /* These properties use transform functions to convert
- * GSettings values to forms more useful to Evolution.
- */
-
- e_shell_settings_install_property (
- g_param_spec_enum (
- "cal-ba-reminder-units",
- NULL,
- NULL,
- E_TYPE_DURATION_TYPE,
- E_DURATION_MINUTES,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-ba-reminder-units-string",
- shell_settings, "cal-ba-reminder-units",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_enum_nick_to_value,
- e_binding_transform_enum_value_to_nick,
- NULL, (GDestroyNotify) NULL);
-
- e_shell_settings_install_property (
- g_param_spec_enum (
- "cal-default-reminder-units",
- NULL,
- NULL,
- E_TYPE_DURATION_TYPE,
- E_DURATION_MINUTES,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-default-reminder-units-string",
- shell_settings, "cal-default-reminder-units",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_enum_nick_to_value,
- e_binding_transform_enum_value_to_nick,
- NULL, (GDestroyNotify) NULL);
-
- e_shell_settings_install_property (
- g_param_spec_enum (
- "cal-hide-completed-tasks-units",
- NULL,
- NULL,
- E_TYPE_DURATION_TYPE,
- E_DURATION_MINUTES,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-hide-completed-tasks-units-string",
- shell_settings, "cal-hide-completed-tasks-units",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_enum_nick_to_value,
- e_binding_transform_enum_value_to_nick,
- NULL, (GDestroyNotify) NULL);
-
- e_shell_settings_install_property (
- g_param_spec_pointer (
- "cal-timezone",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-timezone-string",
- shell_settings, "cal-timezone",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_string_to_icaltimezone,
- transform_icaltimezone_to_string,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_enum (
- "cal-week-start-day",
- NULL,
- NULL,
- E_TYPE_DATE_WEEKDAY,
- G_DATE_MONDAY,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-week-start-day-setting",
- shell_settings, "cal-week-start-day",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_weekdays_settings_to_evolution,
- transform_weekdays_evolution_to_settings,
- NULL, (GDestroyNotify) NULL);
-
- /* XXX These are my favorite. Storing a bit array in GSettings
- * instead of separate boolean keys. Brilliant move. */
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-sunday",
- NULL,
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-sunday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_sunday,
- transform_working_days_sunday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-monday",
- NULL,
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-monday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_monday,
- transform_working_days_monday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-tuesday",
- NULL,
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-tuesday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_tuesday,
- transform_working_days_tuesday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-wednesday",
- NULL,
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-wednesday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_wednesday,
- transform_working_days_wednesday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-thursday",
- NULL,
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-thursday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_thursday,
- transform_working_days_thursday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-friday",
- NULL,
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-friday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_friday,
- transform_working_days_friday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- e_shell_settings_install_property (
- g_param_spec_boolean (
- "cal-working-days-saturday",
- NULL,
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "cal-working-days-bitset",
- shell_settings, "cal-working-days-saturday",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_working_days_bitset_to_saturday,
- transform_working_days_saturday_to_bitset,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-
- g_signal_connect (
- shell_settings, "notify::cal-use-system-timezone",
- G_CALLBACK (cal_use_system_timezone_changed_cb), NULL);
-}
diff --git a/modules/calendar/e-cal-shell-settings.h b/modules/calendar/e-cal-shell-settings.h
deleted file mode 100644
index 5f7293bbed..0000000000
--- a/modules/calendar/e-cal-shell-settings.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * e-cal-shell-settings.h
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef E_CAL_SHELL_SETTINGS_H
-#define E_CAL_SHELL_SETTINGS_H
-
-#include <shell/e-shell.h>
-
-G_BEGIN_DECLS
-
-void e_cal_shell_backend_init_settings (EShell *shell);
-
-G_END_DECLS
-
-#endif /* E_CAL_SHELL_SETTINGS_H */
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index ad5327f34e..5a5fa5c5ac 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -121,6 +121,43 @@ connect_closure_free (ConnectClosure *closure)
g_slice_free (ConnectClosure, closure);
}
+static gboolean
+cal_shell_sidebar_map_uid_to_source (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ ESourceRegistry *registry;
+ ESource *source;
+ const gchar *uid;
+
+ registry = E_SOURCE_REGISTRY (user_data);
+ uid = g_variant_get_string (variant, NULL);
+ source = e_source_registry_ref_source (registry, uid);
+ g_value_take_object (value, source);
+
+ return (source != NULL);
+}
+
+static GVariant *
+cal_shell_sidebar_map_source_to_uid (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant = NULL;
+ ESource *source;
+
+ source = g_value_get_object (value);
+
+ if (source != NULL) {
+ const gchar *uid;
+
+ uid = e_source_get_uid (source);
+ variant = g_variant_new_string (uid);
+ }
+
+ return variant;
+}
+
static void
cal_shell_sidebar_emit_client_added (ECalShellSidebar *cal_shell_sidebar,
EClient *client)
@@ -359,28 +396,17 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShellSidebar *shell_sidebar)
{
ECalShellSidebarPrivate *priv;
- EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
ESourceRegistry *registry;
ESourceSelector *selector;
GSettings *settings;
GtkTreeModel *model;
- GObject *object;
priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- shell_backend = e_shell_view_get_shell_backend (shell_view);
- g_return_if_fail (E_IS_CAL_SHELL_BACKEND (shell_backend));
-
selector = E_SOURCE_SELECTOR (priv->selector);
+ registry = e_source_selector_get_registry (selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- registry = e_shell_get_registry (shell);
-
g_signal_connect_swapped (
model, "row-changed",
G_CALLBACK (cal_shell_sidebar_row_changed_cb),
@@ -391,24 +417,25 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (cal_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- g_object_bind_property_full (
- shell_settings, "cal-primary-calendar",
- selector, "primary-selection",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- (GBindingTransformFunc) e_binding_transform_uid_to_source,
- (GBindingTransformFunc) e_binding_transform_source_to_uid,
- g_object_ref (registry),
- (GDestroyNotify) g_object_unref);
-
/* Bind GObject properties to settings keys. */
settings = g_settings_new ("org.gnome.evolution.calendar");
- object = G_OBJECT (priv->paned);
- g_settings_bind (settings, "date-navigator-pane-position", object, "vposition", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind_with_mapping (
+ settings, "primary-calendar",
+ selector, "primary-selection",
+ G_SETTINGS_BIND_DEFAULT,
+ cal_shell_sidebar_map_uid_to_source,
+ cal_shell_sidebar_map_source_to_uid,
+ g_object_ref (registry),
+ (GDestroyNotify) g_object_unref);
- g_object_unref (G_OBJECT (settings));
+ g_settings_bind (
+ settings, "date-navigator-pane-position",
+ priv->paned, "vposition",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_object_unref (settings);
}
static void
@@ -500,7 +527,6 @@ cal_shell_sidebar_constructed (GObject *object)
EShellWindow *shell_window;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- EShellSettings *shell_settings;
EClientCache *client_cache;
ECalendarItem *calitem;
GtkWidget *container;
@@ -516,9 +542,7 @@ cal_shell_sidebar_constructed (GObject *object)
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
-
shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
container = GTK_WIDGET (shell_sidebar);
@@ -576,16 +600,6 @@ cal_shell_sidebar_constructed (GObject *object)
priv->date_navigator = g_object_ref (widget);
gtk_widget_show (widget);
- g_object_bind_property (
- shell_settings, "cal-show-week-numbers",
- calitem, "show-week-numbers",
- G_BINDING_SYNC_CREATE);
-
- g_object_bind_property (
- shell_settings, "cal-week-start-day",
- calitem, "week-start-day",
- G_BINDING_SYNC_CREATE);
-
/* Restore widget state from the last session once
* the shell view is fully initialized and visible. */
g_signal_connect (
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 4561ad35dd..144245514d 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -503,15 +503,7 @@ system_timezone_monitor_changed (GFileMonitor *handle,
GFileMonitorEvent event,
gpointer user_data)
{
- ECalShellView *view = E_CAL_SHELL_VIEW (user_data);
- ECalShellViewPrivate *priv = view->priv;
- ECalShellContent *cal_shell_content;
- icaltimezone *timezone = NULL, *current_zone = NULL;
- EShellSettings *settings;
- EShellBackend *shell_backend;
- EShell *shell;
- ECalModel *model;
- const gchar *location;
+ GSettings *settings;
if (event != G_FILE_MONITOR_EVENT_CHANGED &&
event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT &&
@@ -519,25 +511,9 @@ system_timezone_monitor_changed (GFileMonitor *handle,
event != G_FILE_MONITOR_EVENT_CREATED)
return;
- cal_shell_content = priv->cal_shell_content;
- model = e_cal_shell_content_get_model (cal_shell_content);
- current_zone = e_cal_model_get_timezone (model);
- timezone = e_cal_util_get_system_timezone ();
-
- if (!g_strcmp0 (
- icaltimezone_get_tzid (timezone),
- icaltimezone_get_tzid (current_zone)))
- return;
-
- shell_backend = e_shell_view_get_shell_backend ((EShellView *) view);
- shell = e_shell_backend_get_shell (shell_backend);
- settings = e_shell_get_shell_settings (shell);
- location = icaltimezone_get_location (timezone);
- if (location == NULL)
- location = "UTC";
-
- g_object_set (settings, "cal-timezone-string", location, NULL);
- g_object_set (settings, "cal-timezone", timezone, NULL);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+ g_signal_emit_by_name (settings, "changed::timezone", "timezone");
+ g_object_unref (settings);
}
static void
@@ -555,10 +531,10 @@ init_timezone_monitors (ECalShellView *view)
g_object_unref (file);
if (priv->monitors[i])
- g_signal_connect_object (
+ g_signal_connect (
priv->monitors[i], "changed",
G_CALLBACK (system_timezone_monitor_changed),
- view, 0);
+ NULL);
}
}
@@ -1211,18 +1187,19 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
static gint
cal_searching_get_search_range_years (ECalShellView *cal_shell_view)
{
- EShellBackend *backend;
- EShellSettings *shell_settings;
- gint value;
+ GSettings *settings;
+ gint search_range_years;
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- backend = e_shell_view_get_shell_backend (E_SHELL_VIEW (cal_shell_view));
- shell_settings = e_shell_get_shell_settings (e_shell_backend_get_shell (backend));
+ search_range_years =
+ g_settings_get_int (settings, "search-range-years");
+ if (search_range_years <= 0)
+ search_range_years = 10;
- value = e_shell_settings_get_int (shell_settings, "cal-search-range-years");
- if (value <= 0)
- value = 10;
+ g_object_unref (settings);
- return value;
+ return search_range_years;
}
static gint
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 0079b2cf95..48c50e3500 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -47,30 +47,130 @@ G_DEFINE_DYNAMIC_TYPE (
GTK_TYPE_VBOX)
static gboolean
-transform_time_divisions_to_index (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used)
+calendar_preferences_map_string_to_integer (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
{
- gboolean success = TRUE;
+ GEnumClass *enum_class = G_ENUM_CLASS (user_data);
+ GEnumValue *enum_value;
+ const gchar *nick;
+
+ /* XXX GSettings should know how to bind enum settings to
+ * integer properties. I filed a bug asking for this:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=695217 */
+
+ nick = g_variant_get_string (variant, NULL);
+ enum_value = g_enum_get_value_by_nick (enum_class, nick);
+ g_return_val_if_fail (enum_value != NULL, FALSE);
+ g_value_set_int (value, enum_value->value);
+
+ return TRUE;
+}
+
+static GVariant *
+calendar_preferences_map_integer_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GEnumClass *enum_class = G_ENUM_CLASS (user_data);
+ GEnumValue *enum_value;
+
+ /* XXX GSettings should know how to bind enum settings to
+ * integer properties. I filed a bug asking for this:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=695217 */
+
+ enum_value = g_enum_get_value (enum_class, g_value_get_int (value));
+ g_return_val_if_fail (enum_value != NULL, NULL);
+
+ return g_variant_new_string (enum_value->value_nick);
+}
+
+static gboolean
+calendar_preferences_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;
+}
- g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+static GVariant *
+calendar_preferences_map_icaltimezone_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant;
+ GSettings *settings;
+ const gchar *location = NULL;
+ gchar *location_str = NULL;
+ icaltimezone *timezone;
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ if (g_settings_get_boolean (settings, "use-system-timezone")) {
+ location_str = g_settings_get_string (settings, "timezone");
+ location = location_str;
+ } else {
+ timezone = g_value_get_pointer (value);
+
+ if (timezone != NULL)
+ location = icaltimezone_get_location (timezone);
+ }
+
+ if (location == NULL)
+ location = "UTC";
+
+ variant = g_variant_new_string (location);
+
+ g_free (location_str);
+
+ g_object_unref (settings);
+
+ return variant;
+}
- switch (g_value_get_int (source_value)) {
+static gboolean
+calendar_preferences_map_time_divisions_to_index (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ gboolean success = TRUE;
+
+ switch (g_variant_get_int32 (variant)) {
case 60:
- g_value_set_int (target_value, 0);
+ g_value_set_int (value, 0);
break;
case 30:
- g_value_set_int (target_value, 1);
+ g_value_set_int (value, 1);
break;
case 15:
- g_value_set_int (target_value, 2);
+ g_value_set_int (value, 2);
break;
case 10:
- g_value_set_int (target_value, 3);
+ g_value_set_int (value, 3);
break;
case 5:
- g_value_set_int (target_value, 4);
+ g_value_set_int (value, 4);
break;
default:
success = FALSE;
@@ -79,37 +179,69 @@ transform_time_divisions_to_index (GBinding *binding,
return success;
}
-static gboolean
-transform_index_to_time_divisions (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer not_used)
+static GVariant *
+calendar_preferences_map_index_to_time_divisions (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
{
- gboolean success = TRUE;
-
- switch (g_value_get_int (source_value)) {
+ switch (g_value_get_int (value)) {
case 0:
- g_value_set_int (target_value, 60);
- break;
+ return g_variant_new_int32 (60);
case 1:
- g_value_set_int (target_value, 30);
- break;
+ return g_variant_new_int32 (30);
case 2:
- g_value_set_int (target_value, 15);
- break;
+ return g_variant_new_int32 (15);
case 3:
- g_value_set_int (target_value, 10);
- break;
+ return g_variant_new_int32 (10);
case 4:
- g_value_set_int (target_value, 5);
- break;
+ return g_variant_new_int32 (5);
default:
- success = FALSE;
+ break;
+ }
+
+ return NULL;
+}
+
+static gboolean
+calendar_preferences_map_string_to_gdk_color (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ string = g_variant_get_string (variant, NULL);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (value, &color);
+ success = TRUE;
}
return success;
}
+static GVariant *
+calendar_preferences_map_gdk_color_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant;
+ const GdkColor *color;
+
+ color = g_value_get_boxed (value);
+ if (color == NULL) {
+ variant = g_variant_new_string ("");
+ } else {
+ gchar *string;
+
+ string = gdk_color_to_string (color);
+ variant = g_variant_new_string (string);
+ g_free (string);
+ }
+
+ return variant;
+}
+
static void
calendar_preferences_dispose (GObject *object)
{
@@ -125,11 +257,6 @@ calendar_preferences_dispose (GObject *object)
prefs->registry = NULL;
}
- if (prefs->shell_settings != NULL) {
- g_object_unref (prefs->shell_settings);
- prefs->shell_settings = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_calendar_preferences_parent_class)->dispose (object);
}
@@ -276,8 +403,12 @@ static void
start_of_day_changed (GtkWidget *widget,
ECalendarPreferences *prefs)
{
- gint start_hour, start_minute, end_hour, end_minute;
EDateEdit *start, *end;
+ GSettings *settings;
+ gint start_hour;
+ gint start_minute;
+ gint end_hour;
+ gint end_minute;
start = E_DATE_EDIT (prefs->start_of_day);
end = E_DATE_EDIT (prefs->end_of_day);
@@ -294,20 +425,24 @@ start_of_day_changed (GtkWidget *widget,
return;
}
- e_shell_settings_set_int (
- prefs->shell_settings,
- "cal-work-day-start-hour", start_hour);
- e_shell_settings_set_int (
- prefs->shell_settings,
- "cal-work-day-start-minute", start_minute);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ g_settings_set_int (settings, "day-start-hour", start_hour);
+ g_settings_set_int (settings, "day-start-minute", start_minute);
+
+ g_object_unref (settings);
}
static void
end_of_day_changed (GtkWidget *widget,
ECalendarPreferences *prefs)
{
- gint start_hour, start_minute, end_hour, end_minute;
EDateEdit *start, *end;
+ GSettings *settings;
+ gint start_hour;
+ gint start_minute;
+ gint end_hour;
+ gint end_minute;
start = E_DATE_EDIT (prefs->start_of_day);
end = E_DATE_EDIT (prefs->end_of_day);
@@ -324,30 +459,16 @@ end_of_day_changed (GtkWidget *widget,
return;
}
- e_shell_settings_set_int (
- prefs->shell_settings,
- "cal-work-day-end-hour", end_hour);
- e_shell_settings_set_int (
- prefs->shell_settings,
- "cal-work-day-end-minute", end_minute);
-}
-
-static void
-notify_with_tray_toggled (GtkToggleButton *toggle,
- ECalendarPreferences *prefs)
-{
- GSettings *settings;
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- g_return_if_fail (toggle != NULL);
+ g_settings_set_int (settings, "day-end-hour", end_hour);
+ g_settings_set_int (settings, "day-end-minute", end_minute);
- settings = g_settings_new ("org.gnome.evolution.calendar");
- g_settings_set_boolean (settings, "notify-with-tray", gtk_toggle_button_get_active (toggle));
g_object_unref (settings);
}
static void
-update_system_tz_widgets (EShellSettings *shell_settings,
- GParamSpec *pspec,
+update_system_tz_widgets (GtkCheckButton *button,
ECalendarPreferences *prefs)
{
GtkWidget *widget;
@@ -383,16 +504,11 @@ setup_changes (ECalendarPreferences *prefs)
g_signal_connect (
prefs->end_of_day, "changed",
G_CALLBACK (end_of_day_changed), prefs);
-
- g_signal_connect (
- prefs->notify_with_tray, "toggled",
- G_CALLBACK (notify_with_tray_toggled), prefs);
}
static void
show_alarms_config (ECalendarPreferences *prefs)
{
- GSettings *settings;
GtkWidget *widget;
widget = e_alarm_selector_new (prefs->registry);
@@ -401,19 +517,15 @@ show_alarms_config (ECalendarPreferences *prefs)
_("Selected Calendars for Alarms"));
gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), widget);
gtk_widget_show (widget);
-
- settings = g_settings_new ("org.gnome.evolution.calendar");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), g_settings_get_boolean (settings, "notify-with-tray"));
- g_object_unref (settings);
}
/* Shows the current config settings in the dialog. */
static void
show_config (ECalendarPreferences *prefs)
{
- EShellSettings *shell_settings;
+ GSettings *settings;
- shell_settings = prefs->shell_settings;
+ settings = g_settings_new ("org.gnome.evolution.calendar");
/* Day's second zone */
update_day_second_zone_caption (prefs);
@@ -421,21 +533,19 @@ show_config (ECalendarPreferences *prefs)
/* Start of Day. */
e_date_edit_set_time_of_day (
E_DATE_EDIT (prefs->start_of_day),
- e_shell_settings_get_int (
- shell_settings, "cal-work-day-start-hour"),
- e_shell_settings_get_int (
- shell_settings, "cal-work-day-start-minute"));
+ g_settings_get_int (settings, "day-start-hour"),
+ g_settings_get_int (settings, "day-start-minute"));
/* End of Day. */
e_date_edit_set_time_of_day (
E_DATE_EDIT (prefs->end_of_day),
- e_shell_settings_get_int (
- shell_settings, "cal-work-day-end-hour"),
- e_shell_settings_get_int (
- shell_settings, "cal-work-day-end-minute"));
+ g_settings_get_int (settings, "day-end-hour"),
+ g_settings_get_int (settings, "day-end-minute"));
/* Alarms list */
show_alarms_config (prefs);
+
+ g_object_unref (settings);
}
/* plugin meta-data */
@@ -468,7 +578,8 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
{
ECalConfig *ec;
ECalConfigTargetPrefs *target;
- EShellSettings *shell_settings;
+ GSettings *settings;
+ GSettings *eds_settings;
gboolean locale_supports_12_hour_format;
gint i;
GtkWidget *toplevel;
@@ -476,15 +587,14 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
GtkWidget *table;
GSList *l;
- shell_settings = prefs->shell_settings;
+ settings = g_settings_new ("org.gnome.evolution.calendar");
locale_supports_12_hour_format =
calendar_config_locale_supports_12_hour_format ();
/* Force 24 hour format for locales which don't support 12 hour format */
- if (!locale_supports_12_hour_format
- && !e_shell_settings_get_boolean (shell_settings, "cal-use-24-hour-format"))
- e_shell_settings_set_boolean (shell_settings, "cal-use-24-hour-format", TRUE);
+ if (!locale_supports_12_hour_format)
+ g_settings_set_boolean (settings, "use-24hour-format", TRUE);
/* Make sure our custom widget classes are registered with
* GType before we load the GtkBuilder definition file. */
@@ -508,317 +618,307 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
e_config_add_items ((EConfig *) ec, l, eccp_free, prefs);
widget = e_builder_get_widget (prefs->builder, "use-system-tz-check");
- g_object_bind_property (
- shell_settings, "cal-use-system-timezone",
+ g_settings_bind (
+ settings, "use-system-timezone",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect (
- shell_settings, "notify::cal-use-system-timezone",
+ widget, "toggled",
G_CALLBACK (update_system_tz_widgets), prefs);
- update_system_tz_widgets (shell_settings, NULL, prefs);
+ update_system_tz_widgets (GTK_CHECK_BUTTON (widget), prefs);
widget = e_builder_get_widget (prefs->builder, "timezone");
- g_object_bind_property (
- shell_settings, "cal-timezone",
+ g_settings_bind_with_mapping (
+ settings, "timezone",
widget, "timezone",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-use-system-timezone",
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_icaltimezone,
+ calendar_preferences_map_icaltimezone_to_string,
+ NULL, (GDestroyNotify) NULL);
+ g_settings_bind (
+ settings, "use-system-timezone",
widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE |
- G_BINDING_INVERT_BOOLEAN);
+ G_SETTINGS_BIND_DEFAULT |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
/* General tab */
prefs->day_second_zone = e_builder_get_widget (prefs->builder, "day_second_zone");
widget = e_builder_get_widget (prefs->builder, "sun_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-sunday",
+ g_settings_bind (
+ settings, "work-day-sunday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "mon_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-monday",
+ g_settings_bind (
+ settings, "work-day-monday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "tue_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-tuesday",
+ g_settings_bind (
+ settings, "work-day-tuesday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "wed_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-wednesday",
+ g_settings_bind (
+ settings, "work-day-wednesday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "thu_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-thursday",
+ g_settings_bind (
+ settings, "work-day-thursday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "fri_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-friday",
+ g_settings_bind (
+ settings, "work-day-friday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "sat_button");
- g_object_bind_property (
- shell_settings, "cal-working-days-saturday",
+ g_settings_bind (
+ settings, "work-day-saturday",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "week_start_day");
- g_object_bind_property_full (
- shell_settings, "cal-week-start-day",
+ g_settings_bind (
+ settings, "week-start-day-name",
widget, "active-id",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_enum_value_to_nick,
- e_binding_transform_enum_nick_to_value,
- NULL, (GDestroyNotify) NULL);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "start_of_day");
prefs->start_of_day = widget; /* XXX delete this */
if (locale_supports_12_hour_format)
- g_object_bind_property (
- shell_settings, "cal-use-24-hour-format",
+ g_settings_bind (
+ settings, "use-24hour-format",
widget, "use-24-hour-format",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "end_of_day");
prefs->end_of_day = widget; /* XXX delete this */
if (locale_supports_12_hour_format)
- g_object_bind_property (
- shell_settings, "cal-use-24-hour-format",
+ g_settings_bind (
+ settings, "use-24hour-format",
widget, "use-24-hour-format",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "use_12_hour");
gtk_widget_set_sensitive (widget, locale_supports_12_hour_format);
- g_object_bind_property (
- shell_settings, "cal-use-24-hour-format",
+ g_settings_bind (
+ settings, "use-24hour-format",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE |
- G_BINDING_INVERT_BOOLEAN);
+ G_SETTINGS_BIND_DEFAULT |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
widget = e_builder_get_widget (prefs->builder, "use_24_hour");
gtk_widget_set_sensitive (widget, locale_supports_12_hour_format);
- g_object_bind_property (
- shell_settings, "cal-use-24-hour-format",
+ g_settings_bind (
+ settings, "use-24hour-format",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "confirm_delete");
- g_object_bind_property (
- shell_settings, "cal-confirm-delete",
+ g_settings_bind (
+ settings, "confirm-delete",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "default_reminder");
- g_object_bind_property (
- shell_settings, "cal-use-default-reminder",
+ g_settings_bind (
+ settings, "use-default-reminder",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "default_reminder_interval");
- g_object_bind_property (
- shell_settings, "cal-default-reminder-interval",
+ g_settings_bind (
+ settings, "default-reminder-interval",
widget, "value",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-use-default-reminder",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "use-default-reminder",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "default_reminder_units");
- g_object_bind_property (
- shell_settings, "cal-default-reminder-units",
+ g_settings_bind_with_mapping (
+ settings, "default-reminder-units",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-use-default-reminder",
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_integer,
+ calendar_preferences_map_integer_to_string,
+ g_type_class_ref (E_TYPE_DURATION_TYPE),
+ (GDestroyNotify) g_type_class_unref);
+ g_settings_bind (
+ settings, "use-default-reminder",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
+
+ /* These settings control the "Birthdays & Anniversaries" backend. */
+
+ eds_settings =
+ g_settings_new ("org.gnome.evolution-data-server.calendar");
widget = e_builder_get_widget (prefs->builder, "ba_reminder");
- g_object_bind_property (
- shell_settings, "cal-use-ba-reminder",
+ g_settings_bind (
+ eds_settings, "contacts-reminder-enabled",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "ba_reminder_interval");
- g_object_bind_property (
- shell_settings, "cal-ba-reminder-interval",
+ g_settings_bind (
+ eds_settings, "contacts-reminder-interval",
widget, "value",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-use-ba-reminder",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ eds_settings, "contacts-reminder-enabled",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "ba_reminder_units");
- g_object_bind_property (
- shell_settings, "cal-ba-reminder-units",
+ g_settings_bind_with_mapping (
+ eds_settings, "contacts-reminder-units",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-use-ba-reminder",
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_integer,
+ calendar_preferences_map_integer_to_string,
+ g_type_class_ref (E_TYPE_DURATION_TYPE),
+ (GDestroyNotify) g_type_class_unref);
+ g_settings_bind (
+ eds_settings, "contacts-reminder-enabled",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (eds_settings);
/* Display tab */
widget = e_builder_get_widget (prefs->builder, "time_divisions");
- g_object_bind_property_full (
- shell_settings, "cal-time-divisions",
+ g_settings_bind_with_mapping (
+ settings, "time-divisions",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_time_divisions_to_index,
- transform_index_to_time_divisions,
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_time_divisions_to_index,
+ calendar_preferences_map_index_to_time_divisions,
NULL, (GDestroyNotify) NULL);
widget = e_builder_get_widget (prefs->builder, "show_end_times");
- g_object_bind_property (
- shell_settings, "cal-show-event-end-times",
+ g_settings_bind (
+ settings, "show-event-end",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "compress_weekend");
- g_object_bind_property (
- shell_settings, "cal-compress-weekend",
+ g_settings_bind (
+ settings, "compress-weekend",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "show_week_numbers");
- g_object_bind_property (
- shell_settings, "cal-show-week-numbers",
+ g_settings_bind (
+ settings, "show-week-numbers",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "recur_events_italic");
- g_object_bind_property (
- shell_settings, "cal-recur-events-italic",
+ g_settings_bind (
+ settings, "recur-events-italic",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "month_scroll_by_week");
- g_object_bind_property (
- shell_settings, "cal-month-scroll-by-week",
+ g_settings_bind (
+ settings, "month-scroll-by-week",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "tasks_due_today_highlight");
- g_object_bind_property (
- shell_settings, "cal-tasks-highlight-due-today",
+ g_settings_bind (
+ settings, "task-due-today-highlight",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "tasks_due_today_color");
- g_object_bind_property_full (
- shell_settings, "cal-tasks-color-due-today",
+ g_settings_bind_with_mapping (
+ settings, "task-due-today-color",
widget, "color",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_string_to_color,
- e_binding_transform_color_to_string,
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_gdk_color,
+ calendar_preferences_map_gdk_color_to_string,
NULL, (GDestroyNotify) NULL);
- g_object_bind_property (
- shell_settings, "cal-tasks-highlight-due-today",
+ g_settings_bind (
+ settings, "task-due-today-highlight",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "tasks_overdue_highlight");
- g_object_bind_property (
- shell_settings, "cal-tasks-highlight-overdue",
+ g_settings_bind (
+ settings, "task-overdue-highlight",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "tasks_overdue_color");
- g_object_bind_property_full (
- shell_settings, "cal-tasks-color-overdue",
+ g_settings_bind_with_mapping (
+ settings, "task-overdue-color",
widget, "color",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_string_to_color,
- e_binding_transform_color_to_string,
- (GDestroyNotify) NULL, NULL);
- g_object_bind_property (
- shell_settings, "cal-tasks-highlight-overdue",
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_gdk_color,
+ calendar_preferences_map_gdk_color_to_string,
+ NULL, (GDestroyNotify) NULL);
+ g_settings_bind (
+ settings, "task-overdue-highlight",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed");
- g_object_bind_property (
- shell_settings, "cal-hide-completed-tasks",
+ g_settings_bind (
+ settings, "hide-completed-tasks",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_interval");
- g_object_bind_property (
- shell_settings, "cal-hide-completed-tasks-value",
+ g_settings_bind (
+ settings, "hide-completed-tasks-value",
widget, "value",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-hide-completed-tasks",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "hide-completed-tasks",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed_units");
- g_object_bind_property (
- shell_settings, "cal-hide-completed-tasks-units",
+ g_settings_bind_with_mapping (
+ settings, "hide-completed-tasks-units",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "cal-hide-completed-tasks",
+ G_SETTINGS_BIND_DEFAULT,
+ calendar_preferences_map_string_to_integer,
+ calendar_preferences_map_integer_to_string,
+ g_type_class_ref (E_TYPE_DURATION_TYPE),
+ (GDestroyNotify) g_type_class_unref);
+ g_settings_bind (
+ settings, "hide-completed-tasks",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
/* Alarms tab */
- prefs->notify_with_tray = e_builder_get_widget (prefs->builder, "notify_with_tray");
+ widget = e_builder_get_widget (prefs->builder, "notify_with_tray");
+ g_settings_bind (
+ settings, "notify-with-tray",
+ widget, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
prefs->scrolled_window = e_builder_get_widget (prefs->builder, "calendar-source-scrolled-window");
/* Free/Busy tab */
widget = e_builder_get_widget (prefs->builder, "template_url");
- g_object_bind_property (
- shell_settings, "cal-free-busy-template",
+ g_settings_bind (
+ settings, "publish-template",
widget, "text",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* date/time format */
table = e_builder_get_widget (prefs->builder, "datetime_format_table");
@@ -860,6 +960,8 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
show_config (prefs);
/* FIXME: weakref? */
setup_changes (prefs);
+
+ g_object_unref (settings);
}
void
@@ -876,20 +978,17 @@ e_calendar_preferences_new (EPreferencesWindow *window)
{
EShell *shell;
ESourceRegistry *registry;
- EShellSettings *shell_settings;
ECalendarPreferences *preferences;
shell = e_preferences_window_get_shell (window);
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
preferences = g_object_new (E_TYPE_CALENDAR_PREFERENCES, NULL);
preferences->registry = g_object_ref (registry);
- preferences->shell_settings = g_object_ref (shell_settings);
/* FIXME Kill this function. */
calendar_preferences_construct (preferences, shell);
diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h
index d1e8ede3b7..3920cd1916 100644
--- a/modules/calendar/e-calendar-preferences.h
+++ b/modules/calendar/e-calendar-preferences.h
@@ -56,7 +56,6 @@ struct _ECalendarPreferences {
GtkBuilder *builder;
ESourceRegistry *registry;
- EShellSettings *shell_settings;
/* General tab */
GtkWidget *day_second_zone;
@@ -67,7 +66,6 @@ struct _ECalendarPreferences {
GtkWidget *ba_reminder_units;
/* Alarms tab */
- GtkWidget *notify_with_tray;
GtkWidget *scrolled_window;
};
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 2998c94c32..597838cbee 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -118,6 +118,43 @@ connect_closure_free (ConnectClosure *closure)
g_slice_free (ConnectClosure, closure);
}
+static gboolean
+memo_shell_sidebar_map_uid_to_source (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ ESourceRegistry *registry;
+ ESource *source;
+ const gchar *uid;
+
+ registry = E_SOURCE_REGISTRY (user_data);
+ uid = g_variant_get_string (variant, NULL);
+ source = e_source_registry_ref_source (registry, uid);
+ g_value_take_object (value, source);
+
+ return (source != NULL);
+}
+
+static GVariant *
+memo_shell_sidebar_map_source_to_uid (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant = NULL;
+ ESource *source;
+
+ source = g_value_get_object (value);
+
+ if (source != NULL) {
+ const gchar *uid;
+
+ uid = e_source_get_uid (source);
+ variant = g_variant_new_string (uid);
+ }
+
+ return variant;
+}
+
static void
memo_shell_sidebar_emit_client_added (EMemoShellSidebar *memo_shell_sidebar,
EClient *client)
@@ -356,26 +393,17 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShellSidebar *shell_sidebar)
{
EMemoShellSidebarPrivate *priv;
- EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
ESourceRegistry *registry;
ESourceSelector *selector;
+ GSettings *settings;
GtkTreeModel *model;
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- shell_backend = e_shell_view_get_shell_backend (shell_view);
- g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (shell_backend));
-
selector = E_SOURCE_SELECTOR (priv->selector);
+ registry = e_source_selector_get_registry (selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- registry = e_shell_get_registry (shell);
-
g_signal_connect_swapped (
model, "row-changed",
G_CALLBACK (memo_shell_sidebar_row_changed_cb),
@@ -386,15 +414,20 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- g_object_bind_property_full (
- shell_settings, "cal-primary-memo-list",
+ /* Bind GObject properties to settings keys. */
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ g_settings_bind_with_mapping (
+ settings, "primary-memos",
selector, "primary-selection",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- (GBindingTransformFunc) e_binding_transform_uid_to_source,
- (GBindingTransformFunc) e_binding_transform_source_to_uid,
+ G_SETTINGS_BIND_DEFAULT,
+ memo_shell_sidebar_map_uid_to_source,
+ memo_shell_sidebar_map_source_to_uid,
g_object_ref (registry),
(GDestroyNotify) g_object_unref);
+
+ g_object_unref (settings);
}
static void
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index ef767cf31c..d611b1969a 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -118,6 +118,43 @@ connect_closure_free (ConnectClosure *closure)
g_slice_free (ConnectClosure, closure);
}
+static gboolean
+task_shell_sidebar_map_uid_to_source (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ ESourceRegistry *registry;
+ ESource *source;
+ const gchar *uid;
+
+ registry = E_SOURCE_REGISTRY (user_data);
+ uid = g_variant_get_string (variant, NULL);
+ source = e_source_registry_ref_source (registry, uid);
+ g_value_take_object (value, source);
+
+ return (source != NULL);
+}
+
+static GVariant *
+task_shell_sidebar_map_source_to_uid (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant = NULL;
+ ESource *source;
+
+ source = g_value_get_object (value);
+
+ if (source != NULL) {
+ const gchar *uid;
+
+ uid = e_source_get_uid (source);
+ variant = g_variant_new_string (uid);
+ }
+
+ return variant;
+}
+
static void
task_shell_sidebar_emit_client_added (ETaskShellSidebar *task_shell_sidebar,
EClient *client)
@@ -356,26 +393,17 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
EShellSidebar *shell_sidebar)
{
ETaskShellSidebarPrivate *priv;
- EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
ESourceRegistry *registry;
ESourceSelector *selector;
+ GSettings *settings;
GtkTreeModel *model;
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- shell_backend = e_shell_view_get_shell_backend (shell_view);
- g_return_if_fail (E_IS_TASK_SHELL_BACKEND (shell_backend));
-
selector = E_SOURCE_SELECTOR (priv->selector);
+ registry = e_source_selector_get_registry (selector);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
- registry = e_shell_get_registry (shell);
-
g_signal_connect_swapped (
model, "row-changed",
G_CALLBACK (task_shell_sidebar_row_changed_cb),
@@ -386,15 +414,20 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (task_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- g_object_bind_property_full (
- shell_settings, "cal-primary-task-list",
+ /* Bind GObject properties to settings keys. */
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ g_settings_bind_with_mapping (
+ settings, "primary-tasks",
selector, "primary-selection",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- (GBindingTransformFunc) e_binding_transform_uid_to_source,
- (GBindingTransformFunc) e_binding_transform_source_to_uid,
+ G_SETTINGS_BIND_DEFAULT,
+ task_shell_sidebar_map_uid_to_source,
+ task_shell_sidebar_map_source_to_uid,
g_object_ref (registry),
(GDestroyNotify) g_object_unref);
+
+ g_object_unref (settings);
}
static void
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 87a843d622..b204711977 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -45,11 +45,14 @@ task_shell_view_model_row_appended_cb (ETaskShellView *task_shell_view,
}
static gboolean
-task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view)
+task_shell_view_process_completed_tasks_cb (gpointer user_data)
{
ETaskShellContent *task_shell_content;
+ ETaskShellView *task_shell_view;
ETaskTable *task_table;
+ task_shell_view = E_TASK_SHELL_VIEW (user_data);
+
task_shell_view->priv->update_completed_timeout = 0;
task_shell_content = task_shell_view->priv->task_shell_content;
@@ -65,7 +68,7 @@ task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view)
}
static void
-task_shell_view_schedule_process_completed_tasks (ETaskShellView *task_shell_view)
+task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view)
{
guint source_id;
@@ -75,13 +78,21 @@ task_shell_view_schedule_process_completed_tasks (ETaskShellView *task_shell_vie
g_source_remove (source_id);
source_id = g_timeout_add_seconds (
- 1, (GSourceFunc) task_shell_view_process_completed_tasks,
+ 1, task_shell_view_process_completed_tasks_cb,
task_shell_view);
task_shell_view->priv->update_completed_timeout = source_id;
}
static void
+task_shell_view_hide_completed_tasks_changed_cb (GSettings *settings,
+ const gchar *key,
+ ETaskShellView *task_shell_view)
+{
+ task_shell_view_process_completed_tasks (task_shell_view);
+}
+
+static void
task_shell_view_table_popup_event_cb (EShellView *shell_view,
GdkEvent *button_event)
{
@@ -244,7 +255,6 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
ETaskShellViewPrivate *priv = task_shell_view->priv;
ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
- EShellSettings *shell_settings;
EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
@@ -261,9 +271,7 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
-
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
e_shell_window_add_action_group (shell_window, "tasks");
e_shell_window_add_action_group (shell_window, "tasks-filter");
@@ -273,6 +281,8 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
priv->task_shell_content = g_object_ref (shell_content);
priv->task_shell_sidebar = g_object_ref (shell_sidebar);
+ priv->settings = g_settings_new ("org.gnome.evolution.calendar");
+
task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
task_table = e_task_shell_content_get_task_table (task_shell_content);
model = e_task_table_get_model (task_table);
@@ -365,11 +375,10 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
task_shell_view);
/* Listen for configuration changes. */
- g_object_bind_property (
- shell_settings, "cal-confirm-purge",
+ g_settings_bind (
+ priv->settings, "confirm-purge",
task_shell_view, "confirm-purge",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* Keep the ECalModel in sync with the sidebar. */
g_object_bind_property (
@@ -378,18 +387,21 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
G_BINDING_SYNC_CREATE);
/* Hide Completed Tasks (enable/units/value) */
- g_signal_connect_object (
- shell_settings, "notify::cal-hide-completed-tasks",
- G_CALLBACK (task_shell_view_schedule_process_completed_tasks),
- task_shell_view, G_CONNECT_SWAPPED);
- g_signal_connect_object (
- shell_settings, "notify::cal-hide-completed-tasks-units",
- G_CALLBACK (task_shell_view_schedule_process_completed_tasks),
- task_shell_view, G_CONNECT_SWAPPED);
- g_signal_connect_object (
- shell_settings, "notify::cal-hide-completed-tasks-value",
- G_CALLBACK (task_shell_view_schedule_process_completed_tasks),
- task_shell_view, G_CONNECT_SWAPPED);
+ handler_id = g_signal_connect (
+ priv->settings, "changed::hide-completed-tasks",
+ G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
+ task_shell_view);
+ priv->settings_hide_completed_tasks_handler_id = handler_id;
+ handler_id = g_signal_connect (
+ priv->settings, "changed::hide-completed-tasks-units",
+ G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
+ task_shell_view);
+ priv->settings_hide_completed_tasks_units_handler_id = handler_id;
+ handler_id = g_signal_connect (
+ priv->settings, "changed::hide-completed-tasks-value",
+ G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
+ task_shell_view);
+ priv->settings_hide_completed_tasks_value_handler_id = handler_id;
e_task_shell_view_actions_init (task_shell_view);
e_task_shell_view_update_sidebar (task_shell_view);
@@ -416,11 +428,33 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
priv->backend_error_handler_id = 0;
}
+ if (priv->settings_hide_completed_tasks_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->settings,
+ priv->settings_hide_completed_tasks_handler_id);
+ priv->settings_hide_completed_tasks_handler_id = 0;
+ }
+
+ if (priv->settings_hide_completed_tasks_units_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->settings,
+ priv->settings_hide_completed_tasks_units_handler_id);
+ priv->settings_hide_completed_tasks_units_handler_id = 0;
+ }
+
+ if (priv->settings_hide_completed_tasks_value_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->settings,
+ priv->settings_hide_completed_tasks_value_handler_id);
+ priv->settings_hide_completed_tasks_units_handler_id = 0;
+ }
+
g_clear_object (&priv->task_shell_backend);
g_clear_object (&priv->task_shell_content);
g_clear_object (&priv->task_shell_sidebar);
g_clear_object (&priv->client_cache);
+ g_clear_object (&priv->settings);
if (task_shell_view->priv->activity != NULL) {
/* XXX Activity is not cancellable. */
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index 8906215221..3360928864 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -89,6 +89,12 @@ struct _ETaskShellViewPrivate {
EClientCache *client_cache;
gulong backend_error_handler_id;
+ /* org.gnome.evolution.calendar */
+ GSettings *settings;
+ gulong settings_hide_completed_tasks_handler_id;
+ gulong settings_hide_completed_tasks_units_handler_id;
+ gulong settings_hide_completed_tasks_value_handler_id;
+
EActivity *activity;
guint update_timeout;
guint update_completed_timeout;
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index 21bc036f60..bf6d2421fa 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -5350,8 +5350,7 @@ extract_itip_data (EMailPartItip *pitip,
ItipView *view,
gboolean *have_alarms)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
icalproperty *prop;
icalcomponent_kind kind = ICAL_NO_COMPONENT;
icalcomponent *tz_comp;
@@ -5361,9 +5360,6 @@ extract_itip_data (EMailPartItip *pitip,
ECalComponent *comp;
gboolean use_default_reminder;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
if (!pitip->vcalendar) {
set_itip_error (
view,
@@ -5563,8 +5559,10 @@ extract_itip_data (EMailPartItip *pitip,
/* Add default reminder if the config says so */
- use_default_reminder = e_shell_settings_get_boolean (
- shell_settings, "cal-use-default-reminder");
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ use_default_reminder =
+ g_settings_get_boolean (settings, "use-default-reminder");
if (use_default_reminder) {
ECalComponentAlarm *acomp;
@@ -5572,10 +5570,10 @@ extract_itip_data (EMailPartItip *pitip,
EDurationType units;
ECalComponentAlarmTrigger trigger;
- interval = e_shell_settings_get_int (
- shell_settings, "cal-default-reminder-interval");
- units = e_shell_settings_get_int (
- shell_settings, "cal-default-reminder-units");
+ interval = g_settings_get_int (
+ settings, "default-reminder-interval");
+ units = g_settings_get_enum (
+ settings, "default-reminder-units");
acomp = e_cal_component_alarm_new ();
@@ -5606,6 +5604,8 @@ extract_itip_data (EMailPartItip *pitip,
e_cal_component_alarm_free (acomp);
}
+ g_object_unref (settings);
+
find_from_address (view, pitip, pitip->ical_comp);
find_to_address (view, pitip, pitip->ical_comp, NULL);
@@ -5810,12 +5810,13 @@ void
itip_view_init_view (ItipView *view)
{
EShell *shell;
- EShellSettings *shell_settings;
EClientCache *client_cache;
ECalComponentText text;
ECalComponentOrganizer organizer;
ECalComponentDateTime datetime;
- icaltimezone *from_zone, *to_zone;
+ icaltimezone *from_zone;
+ icaltimezone *to_zone = NULL;
+ GSettings *settings;
GString *gstring = NULL;
GSList *list, *l;
icalcomponent *icalcomp;
@@ -5829,7 +5830,6 @@ itip_view_init_view (ItipView *view)
shell = e_shell_get_default ();
client_cache = e_shell_get_client_cache (shell);
- shell_settings = e_shell_get_shell_settings (shell);
info->client_cache = g_object_ref (client_cache);
@@ -6045,7 +6045,24 @@ itip_view_init_view (ItipView *view)
g_free (html);
}
- to_zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ if (g_settings_get_boolean (settings, "use-system-timezone"))
+ to_zone = e_cal_util_get_system_timezone ();
+ else {
+ gchar *location;
+
+ location = g_settings_get_string (settings, "timezone");
+ if (location != NULL) {
+ to_zone = icaltimezone_get_builtin_timezone (location);
+ g_free (location);
+ }
+ }
+
+ if (to_zone == NULL)
+ to_zone = icaltimezone_get_utc_timezone ();
+
+ g_object_unref (settings);
e_cal_component_get_dtstart (info->comp, &datetime);
info->start_time = 0;
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);
diff --git a/modules/settings/e-settings-calendar-item.c b/modules/settings/e-settings-calendar-item.c
index ae3c37b4ae..14420b8a57 100644
--- a/modules/settings/e-settings-calendar-item.c
+++ b/modules/settings/e-settings-calendar-item.c
@@ -22,7 +22,7 @@
#include "e-settings-calendar-item.h"
-#include <shell/e-shell.h>
+#include <e-util/e-util.h>
#define E_SETTINGS_CALENDAR_ITEM_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -42,24 +42,24 @@ settings_calendar_item_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");
- g_object_bind_property (
- shell_settings, "cal-show-week-numbers",
+ g_settings_bind (
+ settings, "show-week-numbers",
extensible, "show-week-numbers",
- 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_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_calendar_item_parent_class)->
diff --git a/modules/settings/e-settings-calendar-view.c b/modules/settings/e-settings-calendar-view.c
index 12614e6fd9..e35b5dd514 100644
--- a/modules/settings/e-settings-calendar-view.c
+++ b/modules/settings/e-settings-calendar-view.c
@@ -22,7 +22,6 @@
#include "e-settings-calendar-view.h"
-#include <shell/e-shell.h>
#include <calendar/gui/e-day-view.h>
#include <calendar/gui/e-week-view.h>
@@ -44,61 +43,60 @@ settings_calendar_view_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");
- g_object_bind_property (
- shell_settings, "cal-time-divisions",
+ g_settings_bind (
+ settings, "time-divisions",
extensible, "time-divisions",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/*** EDayView ***/
if (E_IS_DAY_VIEW (extensible)) {
- g_object_bind_property (
- shell_settings, "cal-show-week-numbers",
+ g_settings_bind (
+ settings, "show-week-numbers",
E_DAY_VIEW (extensible)->week_number_label, "visible",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "cal-marcus-bains-show-line",
+ g_settings_bind (
+ settings, "marcus-bains-line",
extensible, "marcus-bains-show-line",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "cal-marcus-bains-day-view-color",
+ g_settings_bind (
+ settings, "marcus-bains-color-dayview",
extensible, "marcus-bains-day-view-color",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "cal-marcus-bains-time-bar-color",
+ g_settings_bind (
+ settings, "marcus-bains-color-timebar",
extensible, "marcus-bains-time-bar-color",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
}
/*** EWeekView ***/
if (E_IS_WEEK_VIEW (extensible)) {
- 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-show-event-end-times",
+ g_settings_bind (
+ settings, "show-event-end",
extensible, "show-event-end-times",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
}
+ g_object_unref (settings);
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_calendar_view_parent_class)->
constructed (object);
diff --git a/modules/settings/e-settings-client-cache.c b/modules/settings/e-settings-client-cache.c
index 809678a513..8d74af6023 100644
--- a/modules/settings/e-settings-client-cache.c
+++ b/modules/settings/e-settings-client-cache.c
@@ -21,7 +21,6 @@
#include "e-settings-client-cache.h"
#include <e-util/e-util.h>
-#include <shell/e-shell.h>
#define E_SETTINGS_CLIENT_CACHE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -36,21 +35,53 @@ G_DEFINE_DYNAMIC_TYPE (
e_settings_client_cache,
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_client_cache_client_created_cb (EClientCache *client_cache,
EClient *client)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ if (E_IS_CAL_CLIENT (client)) {
+ GSettings *settings;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.calendar");
- if (E_IS_CAL_CLIENT (client)) {
- g_object_bind_property (
- shell_settings, "cal-timezone",
+ g_settings_bind_with_mapping (
+ settings, "timezone",
client, "default-timezone",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET,
+ settings_map_string_to_icaltimezone,
+ NULL, /* one-way binding */
+ NULL, (GDestroyNotify) NULL);
+
+ g_object_unref (settings);
}
}
diff --git a/modules/settings/e-settings-comp-editor.c b/modules/settings/e-settings-comp-editor.c
index 574b1fb569..b783abf96b 100644
--- a/modules/settings/e-settings-comp-editor.c
+++ b/modules/settings/e-settings-comp-editor.c
@@ -22,7 +22,6 @@
#include "e-settings-comp-editor.h"
-#include <shell/e-shell.h>
#include <calendar/gui/dialogs/comp-editor.h>
#define E_SETTINGS_COMP_EDITOR_GET_PRIVATE(obj) \
@@ -38,54 +37,86 @@ G_DEFINE_DYNAMIC_TYPE (
e_settings_comp_editor,
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_comp_editor_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");
- 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-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-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);
+
+ g_object_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_comp_editor_parent_class)->
diff --git a/modules/settings/e-settings-date-edit.c b/modules/settings/e-settings-date-edit.c
index b7549a9425..5e9e04e3f9 100644
--- a/modules/settings/e-settings-date-edit.c
+++ b/modules/settings/e-settings-date-edit.c
@@ -22,7 +22,7 @@
#include "e-settings-date-edit.h"
-#include <shell/e-shell.h>
+#include <e-util/e-util.h>
#define E_SETTINGS_DATE_EDIT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -42,29 +42,29 @@ settings_date_edit_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");
- g_object_bind_property (
- shell_settings, "cal-show-week-numbers",
+ g_settings_bind (
+ settings, "show-week-numbers",
extensible, "show-week-numbers",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- 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-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_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_date_edit_parent_class)->
diff --git a/modules/settings/e-settings-meeting-store.c b/modules/settings/e-settings-meeting-store.c
index a932cfcf86..725ebcb202 100644
--- a/modules/settings/e-settings-meeting-store.c
+++ b/modules/settings/e-settings-meeting-store.c
@@ -22,7 +22,6 @@
#include "e-settings-meeting-store.h"
-#include <shell/e-shell.h>
#include <calendar/gui/e-meeting-store.h>
#define E_SETTINGS_MEETING_STORE_GET_PRIVATE(obj) \
@@ -38,39 +37,71 @@ G_DEFINE_DYNAMIC_TYPE (
e_settings_meeting_store,
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_meeting_store_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");
- 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-free-busy-template",
+ g_settings_bind (
+ settings, "publish-template",
extensible, "free-busy-template",
- 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_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_meeting_store_parent_class)->
diff --git a/modules/settings/e-settings-meeting-time-selector.c b/modules/settings/e-settings-meeting-time-selector.c
index f6d9cef614..95b5dea967 100644
--- a/modules/settings/e-settings-meeting-time-selector.c
+++ b/modules/settings/e-settings-meeting-time-selector.c
@@ -22,7 +22,6 @@
#include "e-settings-meeting-time-selector.h"
-#include <shell/e-shell.h>
#include <calendar/gui/e-meeting-time-sel.h>
#define E_SETTINGS_MEETING_TIME_SELECTOR_GET_PRIVATE(obj) \
@@ -43,19 +42,19 @@ settings_meeting_time_selector_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");
- 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_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_meeting_time_selector_parent_class)->
diff --git a/modules/settings/e-settings-weekday-chooser.c b/modules/settings/e-settings-weekday-chooser.c
index e4b92d73c5..594a459228 100644
--- a/modules/settings/e-settings-weekday-chooser.c
+++ b/modules/settings/e-settings-weekday-chooser.c
@@ -18,7 +18,6 @@
#include "e-settings-weekday-chooser.h"
-#include <shell/e-shell.h>
#include <calendar/gui/e-weekday-chooser.h>
#define E_SETTINGS_WEEKDAY_CHOOSER_GET_PRIVATE(obj) \
@@ -39,19 +38,19 @@ settings_weekday_chooser_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");
- 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_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_weekday_chooser_parent_class)->