aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-20 00:24:07 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-20 00:24:07 +0800
commit3b32549c69267295a9a7b482e4a6ca2db9e6c73f (patch)
treec6ebb240b7a676e2d2f233e84d9f3d77f09b07ba /mail
parentb9eebfcb4f371ce3549264a97983b5f9cb6493df (diff)
downloadgsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar.gz
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar.bz2
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar.lz
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar.xz
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.tar.zst
gsoc2013-evolution-3b32549c69267295a9a7b482e4a6ca2db9e6c73f.zip
And yet more GSettings migration on the mail component
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-message-pane.c2
-rw-r--r--mail/e-mail-session.c88
-rw-r--r--mail/em-composer-utils.c50
-rw-r--r--mail/mail-vfolder.c12
4 files changed, 56 insertions, 96 deletions
diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c
index e77974b8eb..ed2e3a3337 100644
--- a/mail/e-mail-message-pane.c
+++ b/mail/e-mail-message-pane.c
@@ -28,8 +28,6 @@
#include <string.h>
#include <glib/gi18n.h>
-#include "e-util/gconf-bridge.h"
-
#include "mail/e-mail-reader.h"
struct _EMailMessagePanePrivate {
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index c14bdd56d8..a92b6c2d96 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -38,8 +38,6 @@
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
-
#ifdef HAVE_CANBERRA
#include <canberra-gtk.h>
#endif
@@ -53,7 +51,6 @@
#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util-private.h"
-#include "e-util/gconf-bridge.h"
#include "e-mail-folder-utils.h"
#include "e-mail-junk-filter.h"
@@ -304,14 +301,14 @@ main_get_filter_driver (CamelSession *session,
EFilterRule *rule = NULL;
const gchar *config_dir;
gchar *user, *system;
- GConfClient *client;
+ GSettings *settings;
ERuleContext *fc;
shell = e_shell_get_default ();
shell_backend = e_shell_get_backend_by_name (shell, "mail");
g_return_val_if_fail (E_IS_MAIL_BACKEND (shell_backend), NULL);
- client = gconf_client_get_default ();
+ settings = g_settings_new ("org.gnome.evolution.mail");
config_dir = mail_session_get_config_dir ();
user = g_build_filename (config_dir, "filters.xml", NULL);
@@ -325,12 +322,11 @@ main_get_filter_driver (CamelSession *session,
driver = camel_filter_driver_new (session);
camel_filter_driver_set_folder_func (driver, get_folder, session);
- if (gconf_client_get_bool (client, "/apps/evolution/mail/filters/log", NULL)) {
+ if (g_settings_get_boolean (settings, "filters-log-actions")) {
if (ms->priv->filter_logfile == NULL) {
gchar *filename;
- filename = gconf_client_get_string (
- client, "/apps/evolution/mail/filters/logfile", NULL);
+ filename = g_settings_get_string (settings, "filters-log-file");
if (filename) {
ms->priv->filter_logfile = g_fopen (filename, "a+");
g_free (filename);
@@ -387,7 +383,7 @@ main_get_filter_driver (CamelSession *session,
g_object_unref (fc);
- g_object_unref (client);
+ g_object_unref (settings);
return driver;
}
@@ -419,17 +415,17 @@ ms_forward_to_cb (CamelFolder *folder,
GAsyncResult *result,
EMailSession *session)
{
- GConfClient *client;
+ GSettings *settings;
/* FIXME Poor error handling. */
if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL))
return;
- client = gconf_client_get_default ();
+ settings = g_settings_new ("org.gnome.evolution.mail");
/* do not call mail send immediately, just pile them all in the outbox */
- if (preparing_flush || gconf_client_get_bool (
- client, "/apps/evolution/mail/filters/flush-outbox", NULL)) {
+ if (preparing_flush || g_settings_get_boolean (
+ settings, "flush-outbox")) {
if (preparing_flush)
g_source_remove (preparing_flush);
@@ -438,7 +434,7 @@ ms_forward_to_cb (CamelFolder *folder,
forward_to_flush_outbox_cb, session);
}
- g_object_unref (client);
+ g_object_unref (settings);
}
static void
@@ -470,24 +466,13 @@ mail_session_make_key (CamelService *service,
}
static void
-mail_session_check_junk_notify (GConfClient *gconf,
- guint id,
- GConfEntry *entry,
+mail_session_check_junk_notify (GSettings *settings,
+ const gchar *key,
CamelSession *session)
{
- gchar *key;
-
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
- g_return_if_fail (gconf_entry_get_value (entry) != NULL);
-
- key = strrchr (gconf_entry_get_key (entry), '/');
- if (key) {
- key++;
- if (strcmp (key, "check_incoming") == 0)
- camel_session_set_check_junk (
- session, gconf_value_get_bool (
- gconf_entry_get_value (entry)));
- }
+ if (strcmp (key, "junk-check-incoming") == 0)
+ camel_session_set_check_junk (
+ session, g_settings_get_boolean (settings, key));
}
static const gchar *
@@ -515,7 +500,7 @@ mail_session_get_junk_filter_name (EMailSession *session)
"unknown to Evolution of type %s",
G_OBJECT_TYPE_NAME (junk_filter));
- return ""; /* GConfBridge doesn't like NULL strings */
+ return "";
}
static void
@@ -542,7 +527,7 @@ mail_session_set_junk_filter_name (EMailSession *session,
} else {
g_warning (
"Unrecognized junk filter name "
- "'%s' in GConf", junk_filter_name);
+ "'%s' in GSettings", junk_filter_name);
}
}
@@ -613,22 +598,12 @@ static void
mail_session_finalize (GObject *object)
{
EMailSessionPrivate *priv;
- GConfClient *client;
priv = E_MAIL_SESSION_GET_PRIVATE (object);
g_hash_table_destroy (priv->junk_filters);
g_object_unref (priv->proxy);
- client = gconf_client_get_default ();
-
- if (session_check_junk_notify_id != 0) {
- gconf_client_notify_remove (client, session_check_junk_notify_id);
- session_check_junk_notify_id = 0;
- }
-
- g_object_unref (client);
-
g_free (mail_data_dir);
g_free (mail_config_dir);
@@ -655,6 +630,7 @@ mail_session_constructed (GObject *object)
EExtensible *extensible;
GType extension_type;
GList *list, *iter;
+ GSettings *settings;
priv = E_MAIL_SESSION_GET_PRIVATE (object);
@@ -708,13 +684,11 @@ mail_session_constructed (GObject *object)
g_list_free (list);
- /* Bind the "/apps/evolution/mail/junk/default_plugin"
- * GConf key to our "junk-filter-name" property. */
+ /* Bind the "junk-default-plugin" GSettings key to our "junk-filter-name" property. */
- gconf_bridge_bind_property (
- gconf_bridge_get (),
- "/apps/evolution/mail/junk/default_plugin",
- object, "junk-filter-name");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ g_settings_bind (settings, "junk-default-plugin", object, "junk-filter-name", G_SETTINGS_BIND_DEFAULT);
+ g_object_unref (settings);
}
static CamelService *
@@ -1271,7 +1245,7 @@ e_mail_session_class_init (EMailSessionClass *class)
static void
e_mail_session_init (EMailSession *session)
{
- GConfClient *client;
+ GSettings *settings;
session->priv = E_MAIL_SESSION_GET_PRIVATE (session);
session->priv->folder_cache = mail_folder_cache_new ();
@@ -1282,24 +1256,18 @@ e_mail_session_init (EMailSession *session)
/* Initialize the EAccount setup. */
e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD);
- client = gconf_client_get_default ();
+ settings = g_settings_new ("org.gnome.evolution.mail");
- gconf_client_add_dir (
- client, "/apps/evolution/mail/junk",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
camel_session_set_check_junk (
- CAMEL_SESSION (session), gconf_client_get_bool (
- client, "/apps/evolution/mail/junk/check_incoming", NULL));
- session_check_junk_notify_id = gconf_client_notify_add (
- client, "/apps/evolution/mail/junk",
- (GConfClientNotifyFunc) mail_session_check_junk_notify,
- session, NULL, NULL);
+ CAMEL_SESSION (session), g_settings_get_boolean (
+ settings, "junk-check-incoming"));
+ g_signal_connect (settings, "changed", G_CALLBACK (mail_session_check_junk_notify), session);
mail_config_reload_junk_headers (session);
e_proxy_setup_proxy (session->priv->proxy);
- g_object_unref (client);
+ g_object_unref (settings);
}
EMailSession *
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 19f2950d4b..e6e60082cb 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -453,23 +453,21 @@ composer_presend_check_unwanted_html (EMsgComposer *composer)
{
EDestination **recipients;
EComposerHeaderTable *table;
- GConfClient *client;
+ GSettings *settings;
gboolean check_passed = TRUE;
gboolean html_mode;
gboolean send_html;
gboolean confirm_html;
gint ii;
- client = gconf_client_get_default ();
+ settings = g_settings_new ("org.gnome.evolution.mail");
table = e_msg_composer_get_header_table (composer);
recipients = e_composer_header_table_get_destinations (table);
html_mode = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer));
- send_html = gconf_client_get_bool (
- client, "/apps/evolution/mail/composer/send_html", NULL);
- confirm_html = gconf_client_get_bool (
- client, "/apps/evolution/mail/prompts/unwanted_html", NULL);
+ send_html = g_settings_get_boolean (settings, "composer-send-html");
+ confirm_html = g_settings_get_boolean (settings, "prompt-on-unwanted-html");
/* Only show this warning if our default is to send html. If it
* isn't, we've manually switched into html mode in the composer
@@ -493,7 +491,7 @@ composer_presend_check_unwanted_html (EMsgComposer *composer)
if (recipients != NULL)
e_destination_freev (recipients);
- g_object_unref (client);
+ g_object_unref (settings);
return check_passed;
}
@@ -1189,11 +1187,11 @@ typedef enum {
} QuotingTextEnum;
static struct {
- const gchar * gconf_key;
+ const gchar * conf_key;
const gchar * message;
} conf_messages[] = {
[QUOTING_ATTRIBUTION] =
- { "/apps/evolution/mail/composer/message_attribution",
+ { "composer-message-attribution",
/* Note to translators: this is the attribution string used
* when quoting messages. Each ${Variable} gets replaced
* with a value. To see a full list of available variables,
@@ -1203,12 +1201,12 @@ static struct {
},
[QUOTING_FORWARD] =
- { "/apps/evolution/mail/composer/message_forward",
+ { "composer-message-forward",
N_("-------- Forwarded Message --------")
},
[QUOTING_ORIGINAL] =
- { "/apps/evolution/mail/composer/message_original",
+ { "composer-message-original",
N_("-----Original Message-----")
}
};
@@ -1216,12 +1214,12 @@ static struct {
static gchar *
quoting_text (QuotingTextEnum type)
{
- GConfClient *client;
+ GSettings *settings;
gchar *text;
- client = gconf_client_get_default ();
- text = gconf_client_get_string (client, conf_messages[type].gconf_key, NULL);
- g_object_unref (client);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ text = g_settings_get_string (settings, conf_messages[type].conf_key);
+ g_object_unref (settings);
if (text && *text)
return text;
@@ -2340,14 +2338,12 @@ get_reply_to (CamelMimeMessage *message)
reply_to = camel_mime_message_get_reply_to (message);
if (reply_to) {
- GConfClient *client;
- const gchar *key;
+ GSettings *settings;
gboolean ignore_list_reply_to;
- client = gconf_client_get_default ();
- key = "/apps/evolution/mail/composer/ignore_list_reply_to";
- ignore_list_reply_to = gconf_client_get_bool (client, key, NULL);
- g_object_unref (client);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ ignore_list_reply_to = g_settings_get_boolean (settings, "composer-ignore-list-reply-to");
+ g_object_unref (settings);
if (ignore_list_reply_to && em_utils_is_munged_list_message (message))
reply_to = NULL;
@@ -2784,15 +2780,14 @@ composer_set_body (EMsgComposer *composer,
{
gchar *text, *credits, *original;
CamelMimePart *part;
- GConfClient *client;
+ GSettings *settings;
gboolean start_bottom, has_body_text = FALSE;
guint32 validity_found = 0;
const gchar *key;
- client = gconf_client_get_default ();
+ settings = g_settings_new ("org.gnome.evolution.mail");
- key = "/apps/evolution/mail/composer/reply_start_bottom";
- start_bottom = gconf_client_get_bool (client, key, NULL);
+ start_bottom = g_settings_get_boolean (settings, "composer-reply-start-bottom");
switch (style) {
case E_MAIL_REPLY_STYLE_DO_NOT_QUOTE:
@@ -2843,8 +2838,7 @@ composer_set_body (EMsgComposer *composer,
gtkhtml_editor_run_command (editor, "block-selection");
gtkhtml_editor_run_command (editor, "cursor-bod");
- key = "/apps/evolution/mail/composer/top_signature";
- top_signature = gconf_client_get_bool (client, key, NULL);
+ top_signature = g_settings_get_boolean (settings, "composer-top-signature");
move_cursor_to_end = top_signature ||
!gtkhtml_editor_search_by_data (
@@ -2857,7 +2851,7 @@ composer_set_body (EMsgComposer *composer,
gtkhtml_editor_run_command (editor, "unblock-selection");
}
- g_object_unref (client);
+ g_object_unref (settings);
}
gchar *
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index c1e451d04c..f2f9219b89 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1096,7 +1096,7 @@ vfolder_load_storage (EMailBackend *backend)
MailFolderCache *folder_cache;
EMailSession *session;
gchar *xmlfile;
- GConfClient *client;
+ GSettings *settings;
g_return_if_fail (E_IS_MAIL_BACKEND (backend));
@@ -1177,11 +1177,11 @@ vfolder_load_storage (EMailBackend *backend)
g_free (storeuri);
/* reenable the feature if required */
- client = gconf_client_get_default ();
- key = "/apps/evolution/mail/display/enable_vfolders";
- if (!gconf_client_get_bool (client, key, NULL))
- gconf_client_set_bool (client, key, TRUE, NULL);
- g_object_unref (client);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ key = "enable-vfolders";
+ if (!g_settings_get_boolean (settings, key))
+ g_settings_set_boolean (settings, key, TRUE);
+ g_object_unref (settings);
folder_cache = e_mail_session_get_folder_cache (session);