[evolution/wip/gsettings: 3/7] Addressbook module GSettings migration



commit 80937eb544e24b51244f3ade02e69fb7a3157920
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Tue Nov 1 17:40:16 2011 +0100

    Addressbook module GSettings migration

 data/evolution.convert                             |    2 ++
 .../org.gnome.evolution.addressbook.gschema.xml.in |   10 ++++++++++
 modules/addressbook/e-book-shell-backend.c         |    9 ++++-----
 modules/addressbook/e-book-shell-content.c         |   18 ++++++------------
 modules/addressbook/e-book-shell-view-actions.c    |   17 ++++++++---------
 5 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/data/evolution.convert b/data/evolution.convert
index 992286f..bd391b7 100644
--- a/data/evolution.convert
+++ b/data/evolution.convert
@@ -29,6 +29,8 @@ completion-minimum-query-length = /apps/evolution/addressbook/completion/minimum
 completion-show-address = /apps/evolution/addressbook/completion/show_address
 hpane-position = /apps/evolution/addressbook/display/hpane_position
 layout = /apps/evolution/addressbook/display/layout
+preview-show-maps = /apps/evolution/addressbook/display/preview_show_maps
+primary-addressbook = /apps/evolution/addressbook/display/primary_addressbook
 select-names-last-used-uri = /apps/evolution/addressbook/select_names/last_used_uri
 show-preview = /apps/evolution/addressbook/display/show_preview
 vpane-position = /apps/evolution/addressbook/display/vpane_position
diff --git a/data/org.gnome.evolution.addressbook.gschema.xml.in b/data/org.gnome.evolution.addressbook.gschema.xml.in
index 11efc0c..0dcaedd 100644
--- a/data/org.gnome.evolution.addressbook.gschema.xml.in
+++ b/data/org.gnome.evolution.addressbook.gschema.xml.in
@@ -35,6 +35,16 @@
       <_summary>Contact preview pane position (vertical)</_summary>
       <_description>Position of the contact preview pane when oriented vertically.</_description>
     </key>
+    <key name="preview-show-maps" type="b">
+      <default>false</default>
+      <_summary>Show maps</_summary>
+      <_description>Whether to show maps in preview pane</_description>
+    </key>
+    <key name="primary-addressbook" type="s">
+      <default>''</default>
+      <_summary>Primary address book</_summary>
+      <_description>The UID of the selected (or "primary") address book in the sidebar of the "Contacts" view</_description>
+    </key>
     <key name="show-preview" type="b">
       <default>true</default>
       <_summary>Show preview pane</_summary>
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 92341e4..ab21d68 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -245,11 +245,10 @@ action_contact_new_cb (GtkAction *action,
 {
 	EShell *shell;
 	EShellBackend *shell_backend;
-	GConfClient *client;
+	GSettings *settings;
 	ESourceList *source_list;
 	ESource *source = NULL;
 	const gchar *action_name;
-	const gchar *key;
 	gchar *uid;
 
 	/* This callback is used for both contacts and contact lists. */
@@ -260,9 +259,9 @@ action_contact_new_cb (GtkAction *action,
 	g_object_get (shell_backend, "source-list", &source_list, NULL);
 	g_return_if_fail (E_IS_SOURCE_LIST (source_list));
 
-	client = e_shell_get_gconf_client (shell);
-	key = "/apps/evolution/addressbook/display/primary_addressbook";
-	uid = gconf_client_get_string (client, key, NULL);
+	settings = g_settings_new ("org.gnome.evolution.addressbook");
+	uid = g_settings_get_string (settings, "primary-addressbook");
+	g_object_unref (settings);
 
 	if (uid != NULL) {
 		source = e_source_list_peek_source_by_uid (source_list, uid);
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index e8f2afd..f4c3d74 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -28,7 +28,6 @@
 #include <glib/gi18n.h>
 
 #include "e-util/e-selection.h"
-#include "e-util/gconf-bridge.h"
 #include "shell/e-shell-utils.h"
 #include "widgets/misc/e-paned.h"
 #include "widgets/misc/e-preview-pane.h"
@@ -82,23 +81,18 @@ book_shell_content_restore_state_cb (EShellWindow *shell_window,
                                      EShellContent *shell_content)
 {
 	EBookShellContentPrivate *priv;
-	GConfBridge *bridge;
-	GObject *object;
-	const gchar *key;
+	GSettings *settings;
 
 	priv = E_BOOK_SHELL_CONTENT (shell_content)->priv;
 
-	/* Bind GObject properties to GConf keys. */
+	/* Bind GObject properties to GSettings keys. */
 
-	bridge = gconf_bridge_get ();
+	settings = g_settings_new ("org.gnome.evolution.addressbook");
 
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/addressbook/display/hpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
+	g_settings_bind (settings, "hpane-position", priv->paned, "hposition", G_SETTINGS_BIND_DEFAULT);
+	g_settings_bind (settings, "vpane-position", priv->paned, "vposition", G_SETTINGS_BIND_DEFAULT);
 
-	object = G_OBJECT (priv->paned);
-	key = "/apps/evolution/addressbook/display/vpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
+	g_object_unref (settings);
 }
 
 static GtkOrientation
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index a6aebe0..e967b11 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -1147,7 +1147,7 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
 	EPreviewPane *preview_pane;
 	EWebView *web_view;
 	GtkActionGroup *action_group;
-	GConfBridge *bridge;
+	GSettings *settings;
 	GtkAction *action;
 	GObject *object;
 	const gchar *key;
@@ -1206,21 +1206,20 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
 		action_group, lockdown_save_to_disk_popup_entries,
 		G_N_ELEMENTS (lockdown_save_to_disk_popup_entries));
 
-	/* Bind GObject properties to GConf keys. */
+	/* Bind GObject properties to GSettings keys. */
 
-	bridge = gconf_bridge_get ();
+	settings = g_settings_new ("org.gnome.evolution.addressbook");
 
 	object = G_OBJECT (ACTION (CONTACT_PREVIEW));
-	key = "/apps/evolution/addressbook/display/show_preview";
-	gconf_bridge_bind_property (bridge, key, object, "active");
+	g_settings_bind (settings, "show-preview", object, "active", G_SETTINGS_BIND_DEFAULT);
 
 	object = G_OBJECT (ACTION (CONTACT_VIEW_VERTICAL));
-	key = "/apps/evolution/addressbook/display/layout";
-	gconf_bridge_bind_property (bridge, key, object, "current-value");
+	g_settings_bind (settings, "layout", object, "current-value", G_SETTINGS_BIND_DEFAULT);
 
 	object = G_OBJECT (ACTION (CONTACT_PREVIEW_SHOW_MAPS));
-	key = "/apps/evolution/addressbook/display/preview_show_maps";
-	gconf_bridge_bind_property (bridge, key, object, "active");
+	g_settings_bind (settings, "preview-show-maps", object, "active", G_SETTINGS_BIND_DEFAULT);
+
+	g_object_unref (settings);
 
 	/* Fine tuning. */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]