diff options
Diffstat (limited to 'mail/e-mail-session.c')
-rw-r--r-- | mail/e-mail-session.c | 88 |
1 files changed, 28 insertions, 60 deletions
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 * |