diff options
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/Makefile.am | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-attachment-handler.c | 18 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 86 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.c | 386 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.h | 33 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 24 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 24 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.c | 264 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 407 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.h | 5 |
10 files changed, 410 insertions, 839 deletions
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am index bbf8366cfb..a488ba292e 100644 --- a/modules/mail/Makefile.am +++ b/modules/mail/Makefile.am @@ -23,8 +23,6 @@ module_mail_la_SOURCES = \ e-mail-shell-backend.h \ e-mail-shell-content.c \ e-mail-shell-content.h \ - e-mail-shell-settings.c \ - e-mail-shell-settings.h \ e-mail-shell-sidebar.c \ e-mail-shell-sidebar.h \ e-mail-shell-view.c \ diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index 98680f8299..d6caecf556 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -121,19 +121,18 @@ mail_attachment_handler_forward (GtkAction *action, EAttachmentHandler *handler) { EMailAttachmentHandlerPrivate *priv; - EShellSettings *shell_settings; + GSettings *settings; EMailForwardStyle style; CamelMimeMessage *message; - const gchar *property_name; priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); message = mail_attachment_handler_get_selected_message (handler); g_return_if_fail (message != NULL); - property_name = "mail-forward-style"; - shell_settings = e_shell_get_shell_settings (priv->shell); - style = e_shell_settings_get_int (shell_settings, property_name); + settings = g_settings_new ("org.gnome.evolution.mail"); + style = g_settings_get_enum (settings, "forward-style-name"); + g_object_unref (settings); em_utils_forward_message ( priv->shell, CAMEL_SESSION (priv->session), @@ -147,19 +146,18 @@ mail_attachment_handler_reply (EAttachmentHandler *handler, EMailReplyType reply_type) { EMailAttachmentHandlerPrivate *priv; - EShellSettings *shell_settings; + GSettings *settings; EMailReplyStyle style; CamelMimeMessage *message; - const gchar *property_name; priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); message = mail_attachment_handler_get_selected_message (handler); g_return_if_fail (message != NULL); - property_name = "mail-reply-style"; - shell_settings = e_shell_get_shell_settings (priv->shell); - style = e_shell_settings_get_int (shell_settings, property_name); + settings = g_settings_new ("org.gnome.evolution.mail"); + style = g_settings_get_enum (settings, "reply-style-name"); + g_object_unref (settings); em_utils_reply_to_message ( priv->shell, message, diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 1abcb8a136..ecb295ea10 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -53,7 +53,6 @@ #include <em-format/e-mail-formatter.h> #include <em-format/e-mail-part-utils.h> -#include "e-mail-shell-settings.h" #include "e-mail-shell-sidebar.h" #include "e-mail-shell-view.h" #include "em-account-prefs.h" @@ -369,7 +368,7 @@ mail_shell_backend_window_added_cb (GtkApplication *application, /* This applies to both the composer and signature editor. */ if (GTKHTML_IS_EDITOR (window)) { - EShellSettings *shell_settings; + GSettings *settings; GList *spell_languages; gboolean active = TRUE; @@ -378,12 +377,14 @@ mail_shell_backend_window_added_cb (GtkApplication *application, GTKHTML_EDITOR (window), spell_languages); g_list_free (spell_languages); - shell_settings = e_shell_get_shell_settings (shell); + settings = g_settings_new ("org.gnome.evolution.mail"); /* Express mode does not honor this setting. */ if (!e_shell_get_express_mode (shell)) - active = e_shell_settings_get_boolean ( - shell_settings, "composer-format-html"); + active = g_settings_get_boolean ( + settings, "composer-send-html"); + + g_object_unref (settings); gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (window), active); } @@ -513,15 +514,14 @@ static void mail_shell_backend_constructed (GObject *object) { EShell *shell; - EShellSettings *shell_settings; EShellBackend *shell_backend; EMailSession *mail_session; CamelService *vstore; GtkWidget *preferences_window; + GSettings *settings; shell_backend = E_SHELL_BACKEND (object); shell = e_shell_backend_get_shell (shell_backend); - shell_settings = e_shell_get_shell_settings (shell); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_mail_shell_backend_parent_class)->constructed (object); @@ -543,8 +543,6 @@ mail_shell_backend_constructed (GObject *object) G_CALLBACK (mail_shell_backend_window_added_cb), shell_backend); - e_mail_shell_settings_init (shell_backend); - /* Setup preference widget factories */ preferences_window = e_shell_get_preferences_window (shell); @@ -589,10 +587,14 @@ mail_shell_backend_constructed (GObject *object) CAMEL_SESSION (mail_session), E_MAIL_SESSION_VFOLDER_UID); g_return_if_fail (vstore != NULL); - g_object_bind_property ( - shell_settings, "mail-enable-unmatched-search-folder", + settings = g_settings_new ("org.gnome.evolution.mail"); + + g_settings_bind ( + settings, "enable-unmatched", vstore, "unmatched-enabled", - G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + G_SETTINGS_BIND_DEFAULT); + + g_object_unref (settings); g_object_unref (vstore); } @@ -630,38 +632,31 @@ mail_shell_backend_start (EShellBackend *shell_backend) static gboolean mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend) { - EShell *shell; - EShellSettings *shell_settings; GSettings *settings; gboolean delete_junk; - gint empty_date; - gint empty_days; + gint empty_date = 0; + gint empty_days = 0; gint now; - shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend)); - settings = g_settings_new ("org.gnome.evolution.mail"); - shell_settings = e_shell_get_shell_settings (shell); now = time (NULL) / 60 / 60 / 24; - delete_junk = e_shell_settings_get_boolean ( - shell_settings, "mail-empty-junk-on-exit"); - - /* XXX No EShellSettings properties for these keys. */ - - empty_date = empty_days = 0; + delete_junk = g_settings_get_boolean (settings, "junk-empty-on-exit"); if (delete_junk) { - empty_days = g_settings_get_int (settings, "junk-empty-on-exit-days"); - empty_date = g_settings_get_int (settings, "junk-empty-date"); + empty_days = g_settings_get_int ( + settings, "junk-empty-on-exit-days"); + empty_date = g_settings_get_int ( + settings, "junk-empty-date"); } - delete_junk = delete_junk && ((empty_days == 0) || (empty_days > 0 && empty_date + empty_days <= now)); + delete_junk = delete_junk && ( + (empty_days == 0) || + (empty_days > 0 && empty_date + empty_days <= now)); - if (delete_junk) { + if (delete_junk) g_settings_set_int (settings, "junk-empty-date", now); - } g_object_unref (settings); @@ -671,38 +666,31 @@ mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend) static gboolean mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend) { - EShell *shell; - EShellSettings *shell_settings; GSettings *settings; gboolean empty_trash; - gint empty_date; - gint empty_days; + gint empty_date = 0; + gint empty_days = 0; gint now; - shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend)); - settings = g_settings_new ("org.gnome.evolution.mail"); - shell_settings = e_shell_get_shell_settings (shell); now = time (NULL) / 60 / 60 / 24; - empty_trash = e_shell_settings_get_boolean ( - shell_settings, "mail-empty-trash-on-exit"); - - /* XXX No EShellSettings properties for these keys. */ - - empty_date = empty_days = 0; + empty_trash = g_settings_get_boolean (settings, "trash-empty-on-exit"); if (empty_trash) { - empty_days = g_settings_get_int (settings, "trash-empty-on-exit-days"); - empty_date = g_settings_get_int (settings, "trash-empty-date"); + 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_trash && ((empty_days == 0) || (empty_days > 0 && empty_date + empty_days <= now)); + empty_trash = empty_trash && ( + (empty_days == 0) || + (empty_days > 0 && empty_date + empty_days <= now)); - if (empty_trash) { + if (empty_trash) g_settings_set_int (settings, "trash-empty-date", now); - } g_object_unref (settings); @@ -852,8 +840,6 @@ e_mail_shell_backend_edit_account (EMailShellBackend *mail_shell_backend, /******************* Code below here belongs elsewhere. *******************/ -#include "shell/e-shell-settings.h" - static GSList * mail_labels_get_filter_options (gboolean include_none) { diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c deleted file mode 100644 index 6982345b88..0000000000 --- a/modules/mail/e-mail-shell-settings.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * e-mail-shell-settings.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-mail-shell-settings.h" - -#include <mail/e-mail-backend.h> - -#include <shell/e-shell.h> - -#define MAIL_SCHEMA "org.gnome.evolution.mail" - -static gboolean -transform_no_folder_dots_to_ellipsize (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer user_data) -{ - PangoEllipsizeMode ellipsize; - - if (g_value_get_boolean (source_value)) - ellipsize = PANGO_ELLIPSIZE_NONE; - else - ellipsize = PANGO_ELLIPSIZE_END; - - g_value_set_enum (target_value, ellipsize); - - return TRUE; -} - -void -e_mail_shell_settings_init (EShellBackend *shell_backend) -{ - EShell *shell; - EShellSettings *shell_settings; - EMailBackend *backend; - EMailSession *session; - - shell = e_shell_backend_get_shell (shell_backend); - shell_settings = e_shell_get_shell_settings (shell); - - backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); - - /*** Global Objects ***/ - - e_shell_settings_install_property ( - g_param_spec_pointer ( - "mail-session", - NULL, - NULL, - G_PARAM_READWRITE)); - - e_shell_settings_set_pointer ( - shell_settings, "mail-session", - g_object_ref (session)); - - /*** Mail Preferences ***/ - - e_shell_settings_install_property_for_key ( - "mail-address-compress", - MAIL_SCHEMA, - "address-compress"); - - e_shell_settings_install_property_for_key ( - "mail-address-count", - MAIL_SCHEMA, - "address-count"); - - e_shell_settings_install_property_for_key ( - "mail-charset", - MAIL_SCHEMA, - "charset"); - - e_shell_settings_install_property_for_key ( - "mail-check-for-junk", - MAIL_SCHEMA, - "junk-check-incoming"); - - e_shell_settings_install_property_for_key ( - "mail-check-on-start", - MAIL_SCHEMA, - "send-recv-on-start"); - - e_shell_settings_install_property_for_key ( - "mail-check-all-on-start", - MAIL_SCHEMA, - "send-recv-all-on-start"); - - e_shell_settings_install_property_for_key ( - "mail-citation-color", - MAIL_SCHEMA, - "citation-color"); - - e_shell_settings_install_property_for_key ( - "mail-confirm-expunge", - MAIL_SCHEMA, - "prompt-on-expunge"); - - e_shell_settings_install_property_for_key ( - "mail-confirm-unwanted-html", - MAIL_SCHEMA, - "prompt-on-unwanted-html"); - - e_shell_settings_install_property_for_key ( - "mail-empty-junk-on-exit", - MAIL_SCHEMA, - "junk-empty-on-exit"); - - e_shell_settings_install_property_for_key ( - "mail-empty-trash-on-exit", - MAIL_SCHEMA, - "trash-empty-on-exit"); - - e_shell_settings_install_property_for_key ( - "mail-enable-unmatched-search-folder", - MAIL_SCHEMA, - "enable-unmatched"); - - e_shell_settings_install_property_for_key ( - "mail-font-monospace", - MAIL_SCHEMA, - "monospace-font"); - - e_shell_settings_install_property_for_key ( - "mail-font-variable", - MAIL_SCHEMA, - "variable-width-font"); - - /* This value corresponds to the EMailForwardStyle enum. */ - e_shell_settings_install_property_for_key ( - "mail-forward-style", - MAIL_SCHEMA, - "forward-style"); - - /* This value corresponds to MailConfigHTTPMode enum. */ - e_shell_settings_install_property_for_key ( - "mail-image-loading-policy", - MAIL_SCHEMA, - "load-http-images"); - - e_shell_settings_install_property_for_key ( - "mail-magic-spacebar", - MAIL_SCHEMA, - "magic-spacebar"); - - e_shell_settings_install_property_for_key ( - "mail-global-view-setting", - MAIL_SCHEMA, - "global-view-setting"); - - e_shell_settings_install_property_for_key ( - "mail-mark-citations", - MAIL_SCHEMA, - "mark-citations"); - - e_shell_settings_install_property_for_key ( - "mail-mark-seen", - MAIL_SCHEMA, - "mark-seen"); - - e_shell_settings_install_property_for_key ( - "mail-mark-seen-timeout", - MAIL_SCHEMA, - "mark-seen-timeout"); - - /* Do not bind to this. Use "mail-sidebar-ellipsize" instead. */ - e_shell_settings_install_property_for_key ( - "mail-no-folder-dots", - MAIL_SCHEMA, - "no-folder-dots"); - - e_shell_settings_install_property_for_key ( - "mail-only-local-photos", - MAIL_SCHEMA, - "photo-local"); - - e_shell_settings_install_property_for_key ( - "mail-show-real-date", - MAIL_SCHEMA, - "show-real-date"); - - e_shell_settings_install_property_for_key ( - "mail-sort-accounts-alpha", - MAIL_SCHEMA, - "sort-accounts-alpha"); - - e_shell_settings_install_property_for_key ( - "mail-prompt-delete-in-vfolder", - MAIL_SCHEMA, - "prompt-on-delete-in-vfolder"); - - /* This value corresponds to the EMailReplyStyle enum, - * but the ordering of the combo box items in preferences - * has changed. We use transformation functions there. */ - e_shell_settings_install_property_for_key ( - "mail-reply-style", - MAIL_SCHEMA, - "reply-style"); - - e_shell_settings_install_property_for_key ( - "mail-safe-list", - MAIL_SCHEMA, - "safe-list"); - - e_shell_settings_install_property_for_key ( - "mail-show-animated-images", - MAIL_SCHEMA, - "show-animated-images"); - - e_shell_settings_install_property_for_key ( - "mail-show-sender-photo", - MAIL_SCHEMA, - "show-sender-photo"); - - e_shell_settings_install_property_for_key ( - "mail-sidebar-search", - MAIL_SCHEMA, - "side-bar-search"); - - e_shell_settings_install_property_for_key ( - "mail-thread-by-subject", - MAIL_SCHEMA, - "thread-subject"); - - e_shell_settings_install_property_for_key ( - "mail-use-custom-fonts", - MAIL_SCHEMA, - "use-custom-font"); - - /*** Composer Preferences ***/ - - e_shell_settings_install_property_for_key ( - "composer-charset", - MAIL_SCHEMA, - "composer-charset"); - - e_shell_settings_install_property_for_key ( - "composer-format-html", - MAIL_SCHEMA, - "composer-send-html"); - - e_shell_settings_install_property_for_key ( - "composer-inline-spelling", - MAIL_SCHEMA, - "composer-inline-spelling"); - - e_shell_settings_install_property_for_key ( - "composer-magic-links", - MAIL_SCHEMA, - "composer-magic-links"); - - e_shell_settings_install_property_for_key ( - "composer-magic-smileys", - MAIL_SCHEMA, - "composer-magic-smileys"); - - e_shell_settings_install_property_for_key ( - "composer-outlook-filenames", - MAIL_SCHEMA, - "composer-outlook-filenames"); - - e_shell_settings_install_property_for_key ( - "composer-localized-re", - MAIL_SCHEMA, - "composer-localized-re"); - - e_shell_settings_install_property_for_key ( - "composer-ignore-list-reply-to", - MAIL_SCHEMA, - "composer-ignore-list-reply-to"); - - e_shell_settings_install_property_for_key ( - "composer-group-reply-to-list", - MAIL_SCHEMA, - "composer-group-reply-to-list"); - - e_shell_settings_install_property_for_key ( - "composer-sign-reply-if-signed", - MAIL_SCHEMA, - "composer-sign-reply-if-signed"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-only-bcc", - MAIL_SCHEMA, - "prompt-on-only-bcc"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-private-list-reply", - MAIL_SCHEMA, - "prompt-on-private-list-reply"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-reply-many-recips", - MAIL_SCHEMA, - "prompt-on-reply-many-recips"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-list-reply-to", - MAIL_SCHEMA, - "prompt-on-list-reply-to"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-empty-subject", - MAIL_SCHEMA, - "prompt-on-empty-subject"); - - e_shell_settings_install_property_for_key ( - "composer-prompt-send-invalid-recip", - MAIL_SCHEMA, - "prompt-on-invalid-recip"); - - e_shell_settings_install_property_for_key ( - "composer-reply-start-bottom", - MAIL_SCHEMA, - "composer-reply-start-bottom"); - - e_shell_settings_install_property_for_key ( - "composer-request-receipt", - MAIL_SCHEMA, - "composer-request-receipt"); - - e_shell_settings_install_property_for_key ( - "composer-spell-color", - MAIL_SCHEMA, - "composer-spell-color"); - - e_shell_settings_install_property_for_key ( - "composer-top-signature", - MAIL_SCHEMA, - "composer-top-signature"); - - e_shell_settings_install_property_for_key ( - "composer-no-signature-delim", - MAIL_SCHEMA, - "composer-no-signature-delim"); - - e_shell_settings_install_property_for_key ( - "composer-gallery-path", - MAIL_SCHEMA, - "composer-gallery-path"); - - e_shell_settings_install_property_for_key ( - "mail-headers-collapsed", - MAIL_SCHEMA, - "headers-collapsed"); - - e_shell_settings_install_property ( - g_param_spec_enum ( - "mail-sidebar-ellipsize", - NULL, - NULL, - PANGO_TYPE_ELLIPSIZE_MODE, - PANGO_ELLIPSIZE_NONE, - G_PARAM_READWRITE)); - - g_object_bind_property_full ( - shell_settings, "mail-no-folder-dots", - shell_settings, "mail-sidebar-ellipsize", - G_BINDING_SYNC_CREATE, - transform_no_folder_dots_to_ellipsize, - NULL, - g_object_ref (shell_settings), - (GDestroyNotify) g_object_unref); -} diff --git a/modules/mail/e-mail-shell-settings.h b/modules/mail/e-mail-shell-settings.h deleted file mode 100644 index 1faf6c6faf..0000000000 --- a/modules/mail/e-mail-shell-settings.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * e-mail-shell-settings.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef E_MAIL_SHELL_SETTINGS_H -#define E_MAIL_SHELL_SETTINGS_H - -#include <shell/e-shell-backend.h> - -G_BEGIN_DECLS - -void e_mail_shell_settings_init (EShellBackend *shell_backend); - -G_END_DECLS - -#endif /* E_MAIL_SHELL_SETTINGS_H */ diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 2c2cdfb4d5..7f3c569288 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -122,12 +122,9 @@ static void mail_shell_sidebar_constructed (GObject *object) { EMailShellSidebar *mail_shell_sidebar; - EShellSettings *shell_settings; EShellBackend *shell_backend; EShellSidebar *shell_sidebar; - EShellWindow *shell_window; EShellView *shell_view; - EShell *shell; EMailBackend *backend; EMailSession *session; EAlertSink *alert_sink; @@ -135,6 +132,7 @@ mail_shell_sidebar_constructed (GObject *object) GtkTreeView *tree_view; GtkWidget *container; GtkWidget *widget; + GSettings *settings; /* Chain up to parent's constructed method. */ G_OBJECT_CLASS (e_mail_shell_sidebar_parent_class)->constructed (object); @@ -142,10 +140,6 @@ mail_shell_sidebar_constructed (GObject *object) shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); shell_backend = e_shell_view_get_shell_backend (shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); backend = E_MAIL_BACKEND (shell_backend); session = e_mail_backend_get_session (backend); @@ -179,15 +173,19 @@ mail_shell_sidebar_constructed (GObject *object) widget, "key-file", G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "mail-sidebar-ellipsize", + settings = g_settings_new ("org.gnome.evolution.mail"); + + g_settings_bind ( + settings, "side-bar-ellipsize-mode", widget, "ellipsize", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); - g_object_bind_property ( - shell_settings, "mail-sidebar-search", + g_settings_bind ( + settings, "side-bar-search", widget, "enable-search", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); + + g_object_unref (settings); g_signal_connect_swapped ( widget, "key-file-changed", diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 92cb0d5814..ed5b30702c 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -953,10 +953,8 @@ static void action_mail_smart_backward_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EShell *shell; EShellView *shell_view; EShellWindow *shell_window; - EShellSettings *shell_settings; EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; @@ -967,6 +965,7 @@ action_mail_smart_backward_cb (GtkAction *action, GtkWidget *window; GtkAdjustment *adj; EMailDisplay *display; + GSettings *settings; gboolean caret_mode; gboolean magic_spacebar; gdouble value; @@ -975,8 +974,6 @@ action_mail_smart_backward_cb (GtkAction *action, shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); mail_shell_content = mail_shell_view->priv->mail_shell_content; mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); @@ -988,8 +985,9 @@ action_mail_smart_backward_cb (GtkAction *action, display = e_mail_reader_get_mail_display (reader); message_list = e_mail_reader_get_message_list (reader); - magic_spacebar = e_shell_settings_get_boolean ( - shell_settings, "mail-magic-spacebar"); + settings = g_settings_new ("org.gnome.evolution.mail"); + magic_spacebar = g_settings_get_boolean (settings, "magic-spacebar"); + g_object_unref (settings); toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE)); caret_mode = gtk_toggle_action_get_active (toggle_action); @@ -1005,7 +1003,7 @@ action_mail_smart_backward_cb (GtkAction *action, if (caret_mode || !magic_spacebar) return; - /* XXX Are two separate calls really necessary? */ + /* XXX Are two separate calls really necessary? */ if (message_list_select ( MESSAGE_LIST (message_list), @@ -1038,10 +1036,8 @@ static void action_mail_smart_forward_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EShell *shell; EShellView *shell_view; EShellWindow *shell_window; - EShellSettings *shell_settings; EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; @@ -1052,6 +1048,7 @@ action_mail_smart_forward_cb (GtkAction *action, GtkAdjustment *adj; GtkToggleAction *toggle_action; EMailDisplay *display; + GSettings *settings; gboolean caret_mode; gboolean magic_spacebar; gdouble value; @@ -1061,8 +1058,6 @@ action_mail_smart_forward_cb (GtkAction *action, shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); mail_shell_content = mail_shell_view->priv->mail_shell_content; mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); @@ -1074,8 +1069,9 @@ action_mail_smart_forward_cb (GtkAction *action, display = e_mail_reader_get_mail_display (reader); message_list = e_mail_reader_get_message_list (reader); - magic_spacebar = e_shell_settings_get_boolean ( - shell_settings, "mail-magic-spacebar"); + settings = g_settings_new ("org.gnome.evolution.mail"); + magic_spacebar = g_settings_get_boolean (settings, "magic-spacebar"); + g_object_unref (settings); toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE)); caret_mode = gtk_toggle_action_get_active (toggle_action); @@ -1092,7 +1088,7 @@ action_mail_smart_forward_cb (GtkAction *action, if (caret_mode || !magic_spacebar) return; - /* XXX Are two separate calls really necessary? */ + /* XXX Are two separate calls really necessary? */ if (message_list_select ( MESSAGE_LIST (message_list), diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 58066e0f0b..7d80bbcb1c 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -52,75 +52,50 @@ G_DEFINE_TYPE ( GTK_TYPE_VBOX) static gboolean -transform_old_to_new_reply_style (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer user_data) +composer_prefs_map_string_to_color (GValue *value, + GVariant *variant, + gpointer user_data) { - gboolean success = TRUE; - - /* XXX This is the kind of legacy crap we wind up - * with when we don't migrate things properly. */ - - switch (g_value_get_int (source_value)) { - case 0: /* Quoted: 0 -> 2 */ - g_value_set_int (target_value, 2); - break; - - case 1: /* Do Not Quote: 1 -> 3 */ - g_value_set_int (target_value, 3); - break; - - case 2: /* Attach: 2 -> 0 */ - g_value_set_int (target_value, 0); - break; - - case 3: /* Outlook: 3 -> 1 */ - g_value_set_int (target_value, 1); - break; - - default: - success = FALSE; - break; + GdkColor color; + const gchar *string; + gboolean success = FALSE; + + string = g_variant_get_string (variant, NULL); + if (gdk_color_parse (string, &color)) { + g_value_set_boxed (value, &color); + success = TRUE; } return success; } -static gboolean -transform_new_to_old_reply_style (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer user_data) +static GVariant * +composer_prefs_map_color_to_string (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) { - gboolean success = TRUE; - - /* XXX This is the kind of legacy crap we wind up - * with when we don't migrate things properly. */ - - switch (g_value_get_int (source_value)) { - case 0: /* Attach: 0 -> 2 */ - g_value_set_int (target_value, 2); - break; - - case 1: /* Outlook: 1 -> 3 */ - g_value_set_int (target_value, 3); - break; - - case 2: /* Quoted: 2 -> 0 */ - g_value_set_int (target_value, 0); - break; - - case 3: /* Do Not Quote: 3 -> 1 */ - g_value_set_int (target_value, 1); - break; - - default: - success = FALSE; - break; + GVariant *variant; + const GdkColor *color; + + color = g_value_get_boxed (value); + if (color == NULL) { + variant = g_variant_new_string (""); + } else { + gchar *string; + + /* Encode the color manually because CSS styles expect + * color codes as #rrggbb, whereas gdk_color_to_string() + * returns color codes as #rrrrggggbbbb. */ + string = g_strdup_printf ( + "#%02x%02x%02x", + (gint) color->red * 256 / 65536, + (gint) color->green * 256 / 65536, + (gint) color->blue * 256 / 65536); + variant = g_variant_new_string (string); + g_free (string); } - return success; + return variant; } static void @@ -302,7 +277,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, { GtkWidget *toplevel, *widget, *info_pixmap; GtkWidget *container; - EShellSettings *shell_settings; + GSettings *settings; ESourceRegistry *registry; GtkTreeView *view; GtkListStore *store; @@ -314,7 +289,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, gint i; registry = e_shell_get_registry (shell); - shell_settings = e_shell_get_shell_settings (shell); + + settings = g_settings_new ("org.gnome.evolution.mail"); /* Make sure our custom widget classes are registered with * GType before we load the GtkBuilder definition file. */ @@ -343,129 +319,113 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Express mode does not honor this setting. */ widget = e_builder_get_widget (prefs->builder, "chkSendHTML"); - if (e_shell_get_express_mode (shell)) + if (e_shell_get_express_mode (shell)) { gtk_widget_hide (widget); - else - g_object_bind_property ( - shell_settings, "composer-format-html", + } else { + g_settings_bind ( + settings, "composer-send-html", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); + } widget = e_builder_get_widget (prefs->builder, "chkPromptEmptySubject"); - g_object_bind_property ( - shell_settings, "composer-prompt-empty-subject", + g_settings_bind ( + settings, "prompt-on-empty-subject", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptBccOnly"); - g_object_bind_property ( - shell_settings, "composer-prompt-only-bcc", + g_settings_bind ( + settings, "prompt-on-only-bcc", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptPrivateListReply"); - g_object_bind_property ( - shell_settings, "composer-prompt-private-list-reply", + g_settings_bind ( + settings, "prompt-on-private-list-reply", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptReplyManyRecips"); - g_object_bind_property ( - shell_settings, "composer-prompt-reply-many-recips", + g_settings_bind ( + settings, "prompt-on-reply-many-recips", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptListReplyTo"); - g_object_bind_property ( - shell_settings, "composer-prompt-list-reply-to", + g_settings_bind ( + settings, "prompt-on-list-reply-to", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptSendInvalidRecip"); - g_object_bind_property ( - shell_settings, "composer-prompt-send-invalid-recip", + g_settings_bind ( + settings, "prompt-on-invalid-recip", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkAutoSmileys"); - g_object_bind_property ( - shell_settings, "composer-magic-smileys", + g_settings_bind ( + settings, "composer-magic-smileys", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkRequestReceipt"); - g_object_bind_property ( - shell_settings, "composer-request-receipt", + g_settings_bind ( + settings, "composer-request-receipt", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkReplyStartBottom"); - g_object_bind_property ( - shell_settings, "composer-reply-start-bottom", + g_settings_bind ( + settings, "composer-reply-start-bottom", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkOutlookFilenames"); - g_object_bind_property ( - shell_settings, "composer-outlook-filenames", + g_settings_bind ( + settings, "composer-outlook-filenames", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkIgnoreListReplyTo"); - g_object_bind_property ( - shell_settings, "composer-ignore-list-reply-to", + g_settings_bind ( + settings, "composer-ignore-list-reply-to", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkGroupReplyToList"); - g_object_bind_property ( - shell_settings, "composer-group-reply-to-list", + g_settings_bind ( + settings, "composer-group-reply-to-list", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkSignReplyIfSigned"); - g_object_bind_property ( - shell_settings, "composer-sign-reply-if-signed", + g_settings_bind ( + settings, "composer-sign-reply-if-signed", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkTopSignature"); - g_object_bind_property ( - shell_settings, "composer-top-signature", + g_settings_bind ( + settings, "composer-top-signature", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkEnableSpellChecking"); - g_object_bind_property ( - shell_settings, "composer-inline-spelling", + g_settings_bind ( + settings, "composer-inline-spelling", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_charset_combo_box_new (); container = e_builder_get_widget (prefs->builder, "hboxComposerCharset"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); - g_object_bind_property ( - shell_settings, "composer-charset", + g_settings_bind ( + settings, "composer-charset", widget, "charset", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); container = e_builder_get_widget (prefs->builder, "lblCharset"); gtk_label_set_mnemonic_widget (GTK_LABEL (container), widget); @@ -500,34 +460,28 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON); widget = e_builder_get_widget (prefs->builder, "colorButtonSpellCheckColor"); - g_object_bind_property_full ( - shell_settings, "composer-spell-color", + g_settings_bind_with_mapping ( + settings, "composer-spell-color", widget, "color", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE, - e_binding_transform_string_to_color, - e_binding_transform_color_to_string, + G_SETTINGS_BIND_DEFAULT, + composer_prefs_map_string_to_color, + composer_prefs_map_color_to_string, NULL, (GDestroyNotify) NULL); spell_setup (prefs); /* Forwards and Replies */ widget = e_builder_get_widget (prefs->builder, "comboboxForwardStyle"); - g_object_bind_property ( - shell_settings, "mail-forward-style", - widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + g_settings_bind ( + settings, "forward-style-name", + widget, "active-id", + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "comboboxReplyStyle"); - g_object_bind_property_full ( - shell_settings, "mail-reply-style", - widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE, - transform_old_to_new_reply_style, - transform_new_to_old_reply_style, - NULL, (GDestroyNotify) NULL); + g_settings_bind ( + settings, "reply-style-name", + widget, "active-id", + G_SETTINGS_BIND_DEFAULT); /* Signatures */ container = e_builder_get_widget ( @@ -544,10 +498,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Express mode does not honor this setting. */ if (!e_shell_get_express_mode (shell)) - g_object_bind_property ( - shell_settings, "composer-format-html", + g_settings_bind ( + settings, "composer-send-html", widget, "prefer-html", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); /* Sanitize the dialog for Express mode */ e_shell_hide_widgets_for_express_mode ( @@ -561,6 +515,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, e_config_set_target ((EConfig *) ec, (EConfigTarget *) target); toplevel = e_config_create_widget ((EConfig *) ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); + + g_object_unref (settings); } GtkWidget * diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 83a23ef735..469425ff41 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -117,35 +117,79 @@ em_mailer_prefs_init (EMMailerPrefs *preferences) } static gboolean -mark_seen_milliseconds_to_seconds (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer user_data) +mailer_prefs_map_milliseconds_to_seconds (GValue *value, + GVariant *variant, + gpointer user_data) { - gint milliseconds; + gint32 milliseconds; gdouble seconds; - milliseconds = g_value_get_int (source_value); + milliseconds = g_variant_get_int32 (variant); seconds = milliseconds / 1000.0; - g_value_set_double (target_value, seconds); + g_value_set_double (value, seconds); return TRUE; } -static gboolean -mark_seen_seconds_to_milliseconds (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer user_data) +static GVariant * +mailer_prefs_map_seconds_to_milliseconds (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) { - gint milliseconds; + gint32 milliseconds; gdouble seconds; - seconds = g_value_get_double (source_value); + seconds = g_value_get_double (value); milliseconds = seconds * 1000; - g_value_set_int (target_value, milliseconds); - return TRUE; + return g_variant_new_int32 (milliseconds); +} + +static gboolean +mailer_prefs_map_string_to_color (GValue *value, + GVariant *variant, + gpointer user_data) +{ + GdkColor color; + const gchar *string; + gboolean success = FALSE; + + string = g_variant_get_string (variant, NULL); + if (gdk_color_parse (string, &color)) { + g_value_set_boxed (value, &color); + success = TRUE; + } + + return success; +} + +static GVariant * +mailer_prefs_map_color_to_string (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) +{ + GVariant *variant; + const GdkColor *color; + + color = g_value_get_boxed (value); + if (color == NULL) { + variant = g_variant_new_string (""); + } else { + gchar *string; + + /* Encode the color manually because CSS styles expect + * color codes as #rrggbb, whereas gdk_color_to_string() + * returns color codes as #rrrrggggbbbb. */ + string = g_strdup_printf ( + "#%02x%02x%02x", + (gint) color->red * 256 / 65536, + (gint) color->green * 256 / 65536, + (gint) color->blue * 256 / 65536); + variant = g_variant_new_string (string); + g_free (string); + } + + return variant; } enum { @@ -687,19 +731,51 @@ emmp_empty_junk_init (EMMailerPrefs *prefs, } static void -http_images_changed (GtkWidget *widget, - EMMailerPrefs *prefs) +image_loading_policy_always_cb (GtkToggleButton *toggle_button) +{ + if (gtk_toggle_button_get_active (toggle_button)) { + GSettings *settings; + + settings = g_settings_new ("org.gnome.evolution.mail"); + + g_settings_set_enum ( + settings, "image-loading-policy", + E_MAIL_IMAGE_LOADING_POLICY_ALWAYS); + + g_object_unref (settings); + } +} + +static void +image_loading_policy_sometimes_cb (GtkToggleButton *toggle_button) { - EMailImageLoadingPolicy policy; + if (gtk_toggle_button_get_active (toggle_button)) { + GSettings *settings; + + settings = g_settings_new ("org.gnome.evolution.mail"); - if (gtk_toggle_button_get_active (prefs->images_always)) - policy = E_MAIL_IMAGE_LOADING_POLICY_ALWAYS; - else if (gtk_toggle_button_get_active (prefs->images_sometimes)) - policy = E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES; - else - policy = E_MAIL_IMAGE_LOADING_POLICY_NEVER; + g_settings_set_enum ( + settings, "image-loading-policy", + E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES); - g_settings_set_int (prefs->settings, "load-http-images", policy); + g_object_unref (settings); + } +} + +static void +image_loading_policy_never_cb (GtkToggleButton *toggle_button) +{ + if (gtk_toggle_button_get_active (toggle_button)) { + GSettings *settings; + + settings = g_settings_new ("org.gnome.evolution.mail"); + + g_settings_set_enum ( + settings, "image-loading-policy", + E_MAIL_IMAGE_LOADING_POLICY_NEVER); + + g_object_unref (settings); + } } static GtkWidget * @@ -750,7 +826,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, { GSList *header_add_list, *p; gchar **headers_config; - EShellSettings *shell_settings; + GSettings *settings; GHashTable *default_header_hash; GtkWidget *toplevel; GtkWidget *container; @@ -760,12 +836,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, GtkCellRenderer *renderer; GtkTreeIter iter; gboolean locked; + gboolean writable; gint val, i; EMConfig *ec; EMConfigTargetPrefs *target; GSList *l; - shell_settings = e_shell_get_shell_settings (shell); + settings = g_settings_new ("org.gnome.evolution.mail"); /* Make sure our custom widget classes are registered with * GType before we load the GtkBuilder definition file. */ @@ -791,197 +868,187 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* General tab */ widget = e_builder_get_widget (prefs->builder, "chkCheckMailOnStart"); - g_object_bind_property ( - shell_settings, "mail-check-on-start", + g_settings_bind ( + settings, "send-recv-on-start", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkCheckMailInAllOnStart"); - g_object_bind_property ( - shell_settings, "mail-check-all-on-start", + g_settings_bind ( + settings, "send-recv-all-on-start", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "mail-check-on-start", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "send-recv-on-start", widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); /* Message Display */ widget = e_builder_get_widget (prefs->builder, "chkMarkTimeout"); - g_object_bind_property ( - shell_settings, "mail-mark-seen", + g_settings_bind ( + settings, "mark-seen", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); /* The "mark seen" timeout requires special transform functions * because we display the timeout value to the user in seconds * but store the settings value in milliseconds. */ widget = e_builder_get_widget (prefs->builder, "spinMarkTimeout"); - g_object_bind_property ( - shell_settings, "mail-mark-seen", - widget, "sensitive", - G_BINDING_SYNC_CREATE); - g_object_bind_property_full ( - shell_settings, "mail-mark-seen-timeout", + g_settings_bind_with_mapping ( + settings, "mark-seen-timeout", widget, "value", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE, - mark_seen_milliseconds_to_seconds, - mark_seen_seconds_to_milliseconds, + G_SETTINGS_BIND_DEFAULT, + mailer_prefs_map_milliseconds_to_seconds, + mailer_prefs_map_seconds_to_milliseconds, NULL, (GDestroyNotify) NULL); + g_settings_bind ( + settings, "mark-seen", + widget, "sensitive", + G_SETTINGS_BIND_GET); widget = e_builder_get_widget (prefs->builder, "view-check"); - g_object_bind_property ( - shell_settings, "mail-global-view-setting", + g_settings_bind ( + settings, "global-view-setting", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_charset_combo_box_new (); container = e_builder_get_widget (prefs->builder, "hboxDefaultCharset"); - gtk_label_set_mnemonic_widget (GTK_LABEL (e_builder_get_widget (prefs->builder, "lblDefaultCharset")), widget); + gtk_label_set_mnemonic_widget ( + GTK_LABEL (e_builder_get_widget ( + prefs->builder, "lblDefaultCharset")), widget); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); - g_object_bind_property ( - shell_settings, "mail-charset", + g_settings_bind ( + settings, "charset", widget, "charset", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkHighlightCitations"); - g_object_bind_property ( - shell_settings, "mail-mark-citations", + g_settings_bind ( + settings, "mark-citations", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "colorButtonHighlightCitations"); - g_object_bind_property ( - shell_settings, "mail-mark-citations", - widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); - g_object_bind_property_full ( - shell_settings, "mail-citation-color", + g_settings_bind_with_mapping ( + settings, "citation-color", widget, "color", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE, - e_binding_transform_string_to_color, - e_binding_transform_color_to_string, + G_SETTINGS_BIND_DEFAULT, + mailer_prefs_map_string_to_color, + mailer_prefs_map_color_to_string, NULL, (GDestroyNotify) NULL); + g_settings_bind ( + settings, "mark-citations", + widget, "sensitive", + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "thread-by-subject"); - g_object_bind_property ( - shell_settings, "mail-thread-by-subject", + g_settings_bind ( + settings, "thread-subject", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); /* Deleting Mail */ widget = e_builder_get_widget (prefs->builder, "chkEmptyTrashOnExit"); - g_object_bind_property ( - shell_settings, "mail-empty-trash-on-exit", + g_settings_bind ( + settings, "trash-empty-on-exit", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "comboboxEmptyTrashDays"); - g_object_bind_property ( - shell_settings, "mail-empty-trash-on-exit", + g_settings_bind ( + settings, "trash-empty-on-exit", widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); emmp_empty_trash_init (prefs, GTK_COMBO_BOX (widget)); widget = e_builder_get_widget (prefs->builder, "chkConfirmExpunge"); - g_object_bind_property ( - shell_settings, "mail-confirm-expunge", + g_settings_bind ( + settings, "prompt-on-expunge", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); /* Mail Fonts */ widget = e_builder_get_widget (prefs->builder, "radFontUseSame"); - g_object_bind_property ( - shell_settings, "mail-use-custom-fonts", + g_settings_bind ( + settings, "use-custom-font", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE | - G_BINDING_INVERT_BOOLEAN); + G_SETTINGS_BIND_DEFAULT | + G_SETTINGS_BIND_INVERT_BOOLEAN); widget = e_builder_get_widget (prefs->builder, "FontFixed"); - g_object_bind_property ( - shell_settings, "mail-font-monospace", + g_settings_bind ( + settings, "monospace-font", widget, "font-name", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "mail-use-custom-fonts", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "use-custom-font", widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); widget = e_builder_get_widget (prefs->builder, "FontVariable"); - g_object_bind_property ( - shell_settings, "mail-font-variable", + g_settings_bind ( + settings, "variable-width-font", widget, "font-name", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "mail-use-custom-fonts", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "use-custom-font", widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); /* HTML Mail tab */ /* Loading Images */ - locked = !g_settings_is_writable (prefs->settings, "load-http-images"); + writable = g_settings_is_writable ( + prefs->settings, "image-loading-policy"); - val = g_settings_get_int (prefs->settings, "load-http-images"); - prefs->images_never = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesNever")); - gtk_toggle_button_set_active (prefs->images_never, val == E_MAIL_IMAGE_LOADING_POLICY_NEVER); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->images_never, FALSE); + val = g_settings_get_enum (prefs->settings, "image-loading-policy"); + widget = e_builder_get_widget ( + prefs->builder, "radImagesNever"); + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (widget), + val == E_MAIL_IMAGE_LOADING_POLICY_NEVER); + gtk_widget_set_sensitive (widget, writable); - prefs->images_sometimes = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesSometimes")); - gtk_toggle_button_set_active (prefs->images_sometimes, val == E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->images_sometimes, FALSE); + g_signal_connect ( + widget, "toggled", + G_CALLBACK (image_loading_policy_never_cb), NULL); - prefs->images_always = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesAlways")); - gtk_toggle_button_set_active (prefs->images_always, val == E_MAIL_IMAGE_LOADING_POLICY_ALWAYS); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->images_always, FALSE); + widget = e_builder_get_widget ( + prefs->builder, "radImagesSometimes"); + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (widget), + val == E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES); + gtk_widget_set_sensitive (widget, writable); g_signal_connect ( - prefs->images_never, "toggled", - G_CALLBACK (http_images_changed), prefs); - g_signal_connect ( - prefs->images_sometimes, "toggled", - G_CALLBACK (http_images_changed), prefs); + widget, "toggled", + G_CALLBACK (image_loading_policy_sometimes_cb), NULL); + + widget = e_builder_get_widget ( + prefs->builder, "radImagesAlways"); + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (widget), + val == E_MAIL_IMAGE_LOADING_POLICY_ALWAYS); + gtk_widget_set_sensitive (widget, FALSE); + g_signal_connect ( - prefs->images_always, "toggled", - G_CALLBACK (http_images_changed), prefs); + widget, "toggled", + G_CALLBACK (image_loading_policy_always_cb), NULL); widget = e_builder_get_widget (prefs->builder, "chkShowAnimatedImages"); - g_object_bind_property ( - shell_settings, "mail-show-animated-images", + g_settings_bind ( + settings, "show-animated-images", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "chkPromptWantHTML"); - g_object_bind_property ( - shell_settings, "mail-confirm-unwanted-html", + g_settings_bind ( + settings, "prompt-on-unwanted-html", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); container = e_builder_get_widget (prefs->builder, "labels-alignment"); widget = e_mail_label_manager_new (); @@ -997,23 +1064,20 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, locked = !g_settings_is_writable (prefs->settings, "headers"); widget = e_builder_get_widget (prefs->builder, "photo_show"); - g_object_bind_property ( - shell_settings, "mail-show-sender-photo", + g_settings_bind ( + settings, "show-sender-photo", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "photo_local"); - g_object_bind_property ( - shell_settings, "mail-show-sender-photo", - widget, "sensitive", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); - g_object_bind_property ( - shell_settings, "mail-only-local-photos", + g_settings_bind ( + settings, "photo-local", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "show-sender-photo", + widget, "sensitive", + G_SETTINGS_BIND_GET); /* always de-sensitised until the user types something in the entry */ prefs->add_header = GTK_BUTTON (e_builder_get_widget (prefs->builder, "cmdHeadersAdd")); @@ -1142,33 +1206,30 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget = gtk_check_button_new_with_mnemonic (_("Show _original header value")); gtk_widget_show (widget); gtk_table_attach ((GtkTable *) table, widget, 0, 3, 2, 3, GTK_EXPAND | GTK_FILL, 0, 12, 0); - g_object_bind_property ( - shell_settings, "mail-show-real-date", + g_settings_bind ( + settings, "show-real-date", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); /* Junk prefs */ widget = e_builder_get_widget (prefs->builder, "chkCheckIncomingMail"); - g_object_bind_property ( - shell_settings, "mail-check-for-junk", + g_settings_bind ( + settings, "junk-check-incoming", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "junk_empty_check"); - g_object_bind_property ( - shell_settings, "mail-empty-junk-on-exit", + g_settings_bind ( + settings, "junk-empty-on-exit", widget, "active", - G_BINDING_BIDIRECTIONAL | - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_DEFAULT); widget = e_builder_get_widget (prefs->builder, "junk_empty_combobox"); emmp_empty_junk_init (prefs, GTK_COMBO_BOX (widget)); - g_object_bind_property ( - shell_settings, "mail-empty-junk-on-exit", + g_settings_bind ( + settings, "junk-empty-on-exit", widget, "sensitive", - G_BINDING_SYNC_CREATE); + G_SETTINGS_BIND_GET); widget = e_builder_get_widget (prefs->builder, "junk-module-options"); e_mail_junk_options_set_session (E_MAIL_JUNK_OPTIONS (widget), session); @@ -1211,6 +1272,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, e_config_set_target ((EConfig *) ec, (EConfigTarget *) target); toplevel = e_config_create_widget ((EConfig *) ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); + + g_object_unref (settings); } GtkWidget * diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h index afd88afb1f..67cd1f64cb 100644 --- a/modules/mail/em-mailer-prefs.h +++ b/modules/mail/em-mailer-prefs.h @@ -67,11 +67,6 @@ struct _EMMailerPrefs { GtkFontButton *font_fixed; GtkToggleButton *font_share; - /* Loading Images */ - GtkToggleButton *images_always; - GtkToggleButton *images_sometimes; - GtkToggleButton *images_never; - GtkToggleButton *autodetect_links; /* Labels and Colours tab */ |