[evolution/wip/gsettings: 11/11] Mail module has now all basic settings in GSettings



commit 2782363bf143089e92f277b844505ef34f46e69c
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Fri Oct 28 12:05:31 2011 +0200

    Mail module has now all basic settings in GSettings

 modules/mail/e-mail-shell-backend.c      |   56 +++++++----------------------
 modules/mail/e-mail-shell-content.c      |    1 -
 modules/mail/e-mail-shell-view-actions.c |   14 ++++----
 3 files changed, 21 insertions(+), 50 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index ce56312..bc801da 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -481,7 +481,7 @@ mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend)
 {
 	EShell *shell;
 	EShellSettings *shell_settings;
-	GConfClient *client;
+	GSettings *settings;
 	const gchar *key;
 	gboolean delete_junk;
 	gint empty_date;
@@ -491,7 +491,7 @@ mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend)
 
 	shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
 
-	client = e_shell_get_gconf_client (shell);
+	settings = g_settings_new ("org.gnome.evolution.mail");
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	now = time (NULL) / 60 / 60 / 24;
@@ -504,32 +504,18 @@ mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend)
 	empty_date = empty_days = 0;
 
 	if (delete_junk) {
-		key = "/apps/evolution/mail/junk/empty_on_exit_days";
-		empty_days = gconf_client_get_int (client, key, &error);
-		if (error != NULL) {
-			g_warning ("%s", error->message);
-			g_error_free (error);
-			return FALSE;
-		}
-	}
-
-	if (delete_junk) {
-		key = "/apps/evolution/mail/junk/empty_date";
-		empty_date = gconf_client_get_int (client, key, &error);
-		if (error != NULL) {
-			g_warning ("%s", error->message);
-			g_error_free (error);
-			return FALSE;
-		}
+		empty_days = g_settings_get_int (settings, "junk-empty-on-exit-days");
+		empty_date = g_settings_get_int (settings, "junk-empty-date");
 	}
 
 	delete_junk &= (empty_days == 0) || (empty_date + empty_days <= now);
 
 	if (delete_junk) {
-		key = "/apps/evolution/mail/junk/empty_date";
-		gconf_client_set_int (client, key, now, NULL);
+		g_settings_set_int (settings, "junk-empty-date", now);
 	}
 
+	g_object_unref (settings);
+
 	return delete_junk;
 }
 
@@ -538,7 +524,7 @@ mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend)
 {
 	EShell *shell;
 	EShellSettings *shell_settings;
-	GConfClient *client;
+	GSettings *settings;
 	const gchar *key;
 	gboolean empty_trash;
 	gint empty_date;
@@ -548,7 +534,7 @@ mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend)
 
 	shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
 
-	client = e_shell_get_gconf_client (shell);
+	settings = g_settings_new ("org.gnome.evolution.mail");
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	now = time (NULL) / 60 / 60 / 24;
@@ -561,32 +547,18 @@ mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend)
 	empty_date = empty_days = 0;
 
 	if (empty_trash) {
-		key = "/apps/evolution/mail/trash/empty_on_exit_days";
-		empty_days = gconf_client_get_int (client, key, &error);
-		if (error != NULL) {
-			g_warning ("%s", error->message);
-			g_error_free (error);
-			return FALSE;
-		}
-	}
-
-	if (empty_trash) {
-		key = "/apps/evolution/mail/trash/empty_date";
-		empty_date = gconf_client_get_int (client, key, &error);
-		if (error != NULL) {
-			g_warning ("%s", error->message);
-			g_error_free (error);
-			return FALSE;
-		}
+		empty_days = g_settings_get_int (settings, "trash-empty-on-exit-days");
+		empty_date = g_settings_get_int (settings, "trash-empty-date");
 	}
 
 	empty_trash &= (empty_days == 0) || (empty_date + empty_days <= now);
 
 	if (empty_trash) {
-		key = "/apps/evolution/mail/trash/empty_date";
-		gconf_client_set_int (client, key, now, NULL);
+		g_settings_set_int (settings, "trash-empty-date", now);
 	}
 
+	g_object_unref (settings);
+
 	return empty_trash;
 }
 
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 9fd7d3b..7918930 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -29,7 +29,6 @@
 #include <libedataserver/e-data-server-util.h>
 
 #include "e-util/e-util-private.h"
-#include "e-util/gconf-bridge.h"
 #include "widgets/menus/gal-view-etable.h"
 #include "widgets/menus/gal-view-instance.h"
 #include "widgets/misc/e-paned.h"
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 08cdfd8..dc94c5c 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -1631,7 +1631,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
 	EMailView *mail_view;
 	GtkActionGroup *action_group;
 	GtkAction *action;
-	GConfBridge *bridge;
+	GSettings *settings;
 	GObject *object;
 	const gchar *key;
 
@@ -1689,17 +1689,17 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
 
 	g_object_set (ACTION (MAIL_SEND_RECEIVE), "is-important", TRUE, NULL);
 
-	/* Bind GObject properties for GConf keys. */
+	/* Bind GObject properties for GSettings keys. */
 
-	bridge = gconf_bridge_get ();
+	settings = g_settings_new ("org.gnome.evolution.mail");
 
 	object = G_OBJECT (ACTION (MAIL_SHOW_DELETED));
-	key = "/apps/evolution/mail/display/show_deleted";
-	gconf_bridge_bind_property (bridge, key, object, "active");
+	g_settings_bind (settings, "show-deleted", object, "active", G_SETTINGS_BIND_DEFAULT);
 
 	object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
-	key = "/apps/evolution/mail/display/layout";
-	gconf_bridge_bind_property (bridge, key, object, "current-value");
+	g_settings_bind (settings, "layout", object, "current-value", G_SETTINGS_BIND_DEFAULT);
+
+	g_object_unref (settings);
 
 	/* Fine tuning. */
 



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