[evolution] Remove EBookShellSettings.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Remove EBookShellSettings.
- Date: Sun, 17 Mar 2013 13:43:06 +0000 (UTC)
commit 23b89997658a8eb8bd2e1d9d20234a6978880aae
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Mar 3 10:03:50 2013 -0500
Remove EBookShellSettings.
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.
modules/addressbook/Makefile.am | 2 -
modules/addressbook/autocompletion-config.c | 24 +++++------
modules/addressbook/e-book-shell-backend.c | 3 -
modules/addressbook/e-book-shell-settings.c | 47 ----------------------
modules/addressbook/e-book-shell-settings.h | 33 ----------------
modules/addressbook/e-book-shell-sidebar.c | 56 ++++++++++++++++++++++----
6 files changed, 58 insertions(+), 107 deletions(-)
---
diff --git a/modules/addressbook/Makefile.am b/modules/addressbook/Makefile.am
index 2accc37..be923f7 100644
--- a/modules/addressbook/Makefile.am
+++ b/modules/addressbook/Makefile.am
@@ -36,8 +36,6 @@ module_addressbook_la_SOURCES = \
e-book-shell-content.h \
e-book-shell-migrate.c \
e-book-shell-migrate.h \
- e-book-shell-settings.c \
- e-book-shell-settings.h \
e-book-shell-sidebar.c \
e-book-shell-sidebar.h \
e-book-shell-view.c \
diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c
index 49aca30..ebccce1 100644
--- a/modules/addressbook/autocompletion-config.c
+++ b/modules/addressbook/autocompletion-config.c
@@ -65,7 +65,7 @@ add_section (GtkWidget *container,
GtkWidget *
autocompletion_config_new (EPreferencesWindow *window)
{
- EShellSettings *shell_settings;
+ GSettings *settings;
ESourceRegistry *registry;
GtkWidget *container;
GtkWidget *itembox;
@@ -74,11 +74,9 @@ autocompletion_config_new (EPreferencesWindow *window)
EShell *shell;
shell = e_preferences_window_get_shell (window);
-
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
-
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
+
+ settings = g_settings_new ("org.gnome.evolution.addressbook");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_widget_show (vbox);
@@ -96,11 +94,10 @@ autocompletion_config_new (EPreferencesWindow *window)
widget = gtk_check_button_new_with_mnemonic (
_("_Format address according to standard of its destination country"));
- g_object_bind_property (
- shell_settings, "enable-address-formatting",
+ g_settings_bind (
+ settings, "address-formatting",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
@@ -108,11 +105,10 @@ autocompletion_config_new (EPreferencesWindow *window)
widget = gtk_check_button_new_with_mnemonic (
_("Always _show address of the autocompleted contact"));
- g_object_bind_property (
- shell_settings, "book-completion-show-address",
+ g_settings_bind (
+ settings, "completion-show-address",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
@@ -131,5 +127,7 @@ autocompletion_config_new (EPreferencesWindow *window)
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
+ g_object_unref (settings);
+
return vbox;
}
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 8d309a8..bfa1982 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -43,7 +43,6 @@
#include "e-book-shell-content.h"
#include "e-book-shell-migrate.h"
-#include "e-book-shell-settings.h"
#include "e-book-shell-view.h"
#ifdef ENABLE_SMIME
@@ -473,8 +472,6 @@ book_shell_backend_constructed (GObject *object)
G_CALLBACK (book_shell_backend_window_added_cb),
shell_backend);
- e_book_shell_backend_init_settings (shell);
-
/* Initialize preferences after the main loop starts so
* that all EPlugins and EPluginHooks are loaded first. */
g_idle_add ((GSourceFunc) book_shell_backend_init_preferences, shell);
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index 094e825..d8b25ee 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -52,6 +52,43 @@ G_DEFINE_DYNAMIC_TYPE (
e_book_shell_sidebar,
E_TYPE_SHELL_SIDEBAR)
+static gboolean
+book_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 *
+book_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
book_shell_sidebar_get_property (GObject *object,
guint property_id,
@@ -93,10 +130,10 @@ book_shell_sidebar_constructed (GObject *object)
EShellView *shell_view;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- EShellSettings *shell_settings;
EClientCache *client_cache;
GtkContainer *container;
GtkWidget *widget;
+ GSettings *settings;
priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object);
@@ -106,9 +143,7 @@ book_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
shell_backend = e_shell_view_get_shell_backend (shell_view);
-
shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
container = GTK_CONTAINER (shell_sidebar);
@@ -129,15 +164,18 @@ book_shell_sidebar_constructed (GObject *object)
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
- g_object_bind_property_full (
- shell_settings, "book-primary-selection",
+ settings = g_settings_new ("org.gnome.evolution.addressbook");
+
+ g_settings_bind_with_mapping (
+ settings, "primary-addressbook",
widget, "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,
+ book_shell_sidebar_map_uid_to_source,
+ book_shell_sidebar_map_source_to_uid,
e_client_cache_ref_registry (client_cache),
(GDestroyNotify) g_object_unref);
+
+ g_object_unref (settings);
}
static guint32
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]