diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-03-03 23:20:09 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-03-17 20:49:12 +0800 |
commit | 95a0ae4afb72b534c991fbcd774733a93f256514 (patch) | |
tree | 32293990fecd6a4a6401370e2a5aa355c6454022 /modules/settings/e-settings-client-cache.c | |
parent | 23b89997658a8eb8bd2e1d9d20234a6978880aae (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'modules/settings/e-settings-client-cache.c')
-rw-r--r-- | modules/settings/e-settings-client-cache.c | 49 |
1 files changed, 40 insertions, 9 deletions
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); } } |