From 3b32549c69267295a9a7b482e4a6ca2db9e6c73f Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 19 Oct 2011 18:24:07 +0200 Subject: And yet more GSettings migration on the mail component --- data/evolution.convert | 7 ++- data/org.gnome.evolution.mail.gschema.xml.in | 15 +++++ mail/e-mail-message-pane.c | 2 - mail/e-mail-session.c | 88 +++++++++------------------- mail/em-composer-utils.c | 50 +++++++--------- mail/mail-vfolder.c | 12 ++-- 6 files changed, 76 insertions(+), 98 deletions(-) diff --git a/data/evolution.convert b/data/evolution.convert index ea70dc8880..774d791a76 100644 --- a/data/evolution.convert +++ b/data/evolution.convert @@ -83,12 +83,16 @@ charset = /apps/evolution/mail/display/charset citation-colour = /apps/evolution/mail/display/citation_colour composer-charset = /apps/evolution/mail/composer/charset composer-current-folder = /apps/evolution/mail/composer/current_folder +composer-group-reply-to-list = /apps/evolution/mail/composer/group_reply_to_list composer-height = /apps/evolution/mail/composer/height composer-ignore-list-reply-to = /apps/evolution/mail/composer/ignore_list_reply_to composer-inline-spelling = /apps/evolution/mail/composer/inline_spelling composer-magic-links = /apps/evolution/mail/composer/magic_links composer-magic-smileys = /apps/evolution/mail/composer/magic_smileys -composer-group-reply-to-list = /apps/evolution/mail/composer/group_reply_to_list +composer-message-attribution = /apps/evolution/mail/composer/message_attribution +composer-message-forward = /apps/evolution/mail/composer/message_forward +composer-message-original = /apps/evolution/mail/composer/message_original +composer-no-signature-delim = /apps/evolution/mail/composer/no_signature_delim composer-reply-start-bottom = /apps/evolution/mail/composer/reply_start_bottom composer-request-receipt = /apps/evolution/mail/composer/request_receipt composer-send-html = /apps/evolution/mail/composer/send_html @@ -101,7 +105,6 @@ composer-show-post-from = /apps/evolution/mail/composer/show_post_from composer-show-post-reply-to = /apps/evolution/mail/composer/show_post_reply_to composer-outlook-filenames = /apps/evolution/mail/composer/outlook_filenames composer-top-signature = /apps/evolution/mail/composer/top_signature -composer-no-signature-delim = /apps/evolution/mail/composer/no_signature_delim composer-width = /apps/evolution/mail/composer/width default-account = /apps/evolution/mail/default_account enable-vfolders = /apps/evolution/mail/display/enable_vfolders diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in index 649dca1ed8..35092ccfff 100644 --- a/data/org.gnome.evolution.mail.gschema.xml.in +++ b/data/org.gnome.evolution.mail.gschema.xml.in @@ -25,6 +25,21 @@ <_summary>Automatic emoticon recognition <_description>Recognize emoticons in text and replace them with images. + + '' + <_summary>Attribute message + <_description>The text that is inserted when replying to a message, attributing the message to the original author + + + '' + <_summary>Forward message + <_description>The text that is inserted when forwarding a message, saying that the forwarded message follows + + + '' + <_summary>Original message + <_description>The text that is inserted when replying to a message (top posting), saying that the original message follows + false <_summary>Group Reply replies to list 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 #include -#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 -#include - #ifdef HAVE_CANBERRA #include #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); -- cgit v1.2.3