diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-03-10 21:53:12 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-03-17 20:49:12 +0800 |
commit | 2e87aa81fc94f5d9564421e036adae7b48e7380a (patch) | |
tree | 9576f15a49a6101c9246c6ce0f82e5c7bd4575c2 /mail | |
parent | 95a0ae4afb72b534c991fbcd774733a93f256514 (diff) | |
download | gsoc2013-evolution-2e87aa81fc94f5d9564421e036adae7b48e7380a.tar.gz gsoc2013-evolution-2e87aa81fc94f5d9564421e036adae7b48e7380a.tar.zst gsoc2013-evolution-2e87aa81fc94f5d9564421e036adae7b48e7380a.zip |
Remove EMailShellSettings.
EShellSettings predates GSettings and is no longer necessary.
GSettings allows binding GObject properties to GSettings keys,
with optional mapping functions. That fulfills the purpose of
EShellSettings.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-http-request.c | 7 | ||||
-rw-r--r-- | mail/e-mail-browser.c | 1 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 47 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 27 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 22 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 13 | ||||
-rw-r--r-- | mail/em-utils.c | 8 | ||||
-rw-r--r-- | mail/mail-config.ui | 68 | ||||
-rw-r--r-- | mail/message-list.c | 1 |
9 files changed, 77 insertions, 117 deletions
diff --git a/mail/e-http-request.c b/mail/e-http-request.c index 0d6ccc26a1..14bfdda181 100644 --- a/mail/e-http-request.c +++ b/mail/e-http-request.c @@ -157,7 +157,7 @@ handle_http_request (GSimpleAsyncResult *res, EMailImageLoadingPolicy image_policy; gchar *uri_md5; EShell *shell; - EShellSettings *shell_settings; + GSettings *settings; const gchar *user_cache_dir; CamelDataCache *cache; CamelStream *cache_stream; @@ -274,8 +274,9 @@ handle_http_request (GSimpleAsyncResult *res, goto cleanup; } - shell_settings = e_shell_get_shell_settings (shell); - image_policy = e_shell_settings_get_int (shell_settings, "mail-image-loading-policy"); + settings = g_settings_new ("org.gnome.evolution.mail"); + image_policy = g_settings_get_enum (settings, "image-loading-policy"); + g_object_unref (settings); /* Item not found in cache, but image loading policy allows us to fetch * it from the interwebs */ diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index bdebf269aa..36489fbcdf 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -30,7 +30,6 @@ #include "shell/e-shell.h" #include "shell/e-shell-utils.h" -#include "shell/e-shell-settings.h" #include "mail/e-mail-reader.h" #include "mail/e-mail-reader-utils.h" diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index bf7907031c..ea654aa4c5 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -496,14 +496,14 @@ mail_paned_view_set_folder (EMailReader *reader, EShell *shell; EShellView *shell_view; EShellWindow *shell_window; - EShellSettings *shell_settings; + GSettings *settings; EMailReaderInterface *default_interface; GtkWidget *message_list; GKeyFile *key_file; gchar *folder_uri; gchar *group_name; const gchar *key; - gboolean value, global_view_settings; + gboolean value, global_view_setting; GError *error = NULL; priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader); @@ -513,8 +513,12 @@ mail_paned_view_set_folder (EMailReader *reader, 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); - global_view_settings = e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting"); + + settings = g_settings_new ("org.gnome.evolution.mail"); + + /* FIXME This should be an EMailReader property. */ + global_view_setting = g_settings_get_boolean ( + settings, "global-view-setting"); message_list = e_mail_reader_get_message_list (reader); @@ -547,11 +551,11 @@ mail_paned_view_set_folder (EMailReader *reader, g_free (folder_uri); key = STATE_KEY_GROUP_BY_THREADS; - value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error); + value = g_key_file_get_boolean (key_file, global_view_setting ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error); if (error != NULL) { g_clear_error (&error); - value = !global_view_settings || + value = !global_view_setting || g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error); if (error != NULL) { g_clear_error (&error); @@ -562,11 +566,11 @@ mail_paned_view_set_folder (EMailReader *reader, e_mail_reader_set_group_by_threads (reader, value); key = STATE_KEY_PREVIEW_VISIBLE; - value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error); + value = g_key_file_get_boolean (key_file, global_view_setting ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error); if (error != NULL) { g_clear_error (&error); - value = !global_view_settings || + value = !global_view_setting || g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error); if (error != NULL) { g_clear_error (&error); @@ -576,11 +580,10 @@ mail_paned_view_set_folder (EMailReader *reader, /* XXX This is a little confusing and needs rethought. The * EShellWindow:safe-mode property blocks automatic message - * selection, but the "mail-safe-list" shell setting blocks - * both the preview pane and automatic message selection. */ - if (e_shell_settings_get_boolean (shell_settings, "mail-safe-list")) { - e_shell_settings_set_boolean ( - shell_settings, "mail-safe-list", FALSE); + * selection, but the "safe-list" setting blocks both the + * preview pane and automatic message selection. */ + if (g_settings_get_boolean (settings, "safe-list")) { + g_settings_set_boolean (settings, "safe-list", FALSE); e_shell_window_set_safe_mode (shell_window, TRUE); value = FALSE; } @@ -591,6 +594,8 @@ mail_paned_view_set_folder (EMailReader *reader, exit: message_list_thaw (MESSAGE_LIST (message_list)); + + g_object_unref (settings); } static guint @@ -806,15 +811,16 @@ mail_paned_view_update_view_instance (EMailView *view) EShellView *shell_view; EShellWindow *shell_window; EShellViewClass *shell_view_class; - EShellSettings *shell_settings; ESourceRegistry *registry; GalViewCollection *view_collection; GalViewInstance *view_instance; CamelFolder *folder; GtkOrientable *orientable; GtkOrientation orientation; + GSettings *settings; gboolean outgoing_folder; gboolean show_vertical_view; + gboolean global_view_setting; gchar *view_id; priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); @@ -826,7 +832,6 @@ mail_paned_view_update_view_instance (EMailView *view) shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); registry = e_shell_get_registry (shell); - shell_settings = e_shell_get_shell_settings (shell); reader = E_MAIL_READER (view); folder = e_mail_reader_get_folder (reader); @@ -848,7 +853,12 @@ mail_paned_view_update_view_instance (EMailView *view) em_utils_folder_is_outbox (registry, folder) || em_utils_folder_is_sent (registry, folder); - if (e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting")) + settings = g_settings_new ("org.gnome.evolution.mail"); + global_view_setting = g_settings_get_boolean ( + settings, "global-view-setting"); + g_object_unref (settings); + + if (global_view_setting) view_instance = e_shell_view_new_view_instance ( shell_view, outgoing_folder ? "global_view_sent_setting" : "global_view_setting"); @@ -860,9 +870,8 @@ mail_paned_view_update_view_instance (EMailView *view) orientable = GTK_ORIENTABLE (view); orientation = gtk_orientable_get_orientation (orientable); show_vertical_view = - (orientation == GTK_ORIENTATION_HORIZONTAL) && - !e_shell_settings_get_boolean ( - shell_settings, "mail-global-view-setting"); + !global_view_setting && + (orientation == GTK_ORIENTATION_HORIZONTAL); if (show_vertical_view) { gchar *filename; diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index dcb3383093..74369202ba 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -115,42 +115,36 @@ mail_reader_is_special_local_folder (const gchar *name) gboolean e_mail_reader_confirm_delete (EMailReader *reader) { - EShell *shell; - EMailBackend *backend; - EShellBackend *shell_backend; - EShellSettings *shell_settings; CamelFolder *folder; CamelStore *parent_store; GtkWidget *check_button; GtkWidget *container; GtkWidget *dialog; GtkWindow *window; + GSettings *settings; const gchar *label; gboolean prompt_delete_in_vfolder; - gint response; + gint response = GTK_RESPONSE_OK; /* Remind users what deleting from a search folder does. */ g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); - backend = e_mail_reader_get_backend (reader); folder = e_mail_reader_get_folder (reader); window = e_mail_reader_get_window (reader); - shell_backend = E_SHELL_BACKEND (backend); - shell = e_shell_backend_get_shell (shell_backend); - shell_settings = e_shell_get_shell_settings (shell); + settings = g_settings_new ("org.gnome.evolution.mail"); - prompt_delete_in_vfolder = e_shell_settings_get_boolean ( - shell_settings, "mail-prompt-delete-in-vfolder"); + prompt_delete_in_vfolder = g_settings_get_boolean ( + settings, "prompt-on-delete-in-vfolder"); parent_store = camel_folder_get_parent_store (folder); if (!CAMEL_IS_VEE_STORE (parent_store)) - return TRUE; + goto exit; if (!prompt_delete_in_vfolder) - return TRUE; + goto exit; dialog = e_alert_dialog_new_for_args ( window, "mail:ask-delete-vfolder-msg", @@ -166,14 +160,15 @@ e_mail_reader_confirm_delete (EMailReader *reader) response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response != GTK_RESPONSE_DELETE_EVENT) - e_shell_settings_set_boolean ( - shell_settings, - "mail-prompt-delete-in-vfolder", + g_settings_set_boolean ( + settings, + "prompt-on-delete-in-vfolder", !gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (check_button))); gtk_widget_destroy (dialog); +exit: return (response == GTK_RESPONSE_OK); } diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 64b8d78b40..69bb388d72 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2732,32 +2732,28 @@ mail_reader_message_seen_cb (EMailReaderClosure *closure) static gboolean schedule_timeout_mark_seen (EMailReader *reader) { - EShell *shell; - EMailBackend *backend; - EShellBackend *shell_backend; - EShellSettings *shell_settings; MessageList *message_list; + GSettings *settings; gboolean schedule_timeout; gint timeout_interval; const gchar *message_uid; - backend = e_mail_reader_get_backend (reader); + message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader)); - shell_backend = E_SHELL_BACKEND (backend); - shell = e_shell_backend_get_shell (shell_backend); - shell_settings = e_shell_get_shell_settings (shell); message_uid = message_list->cursor_uid; if (message_uid == NULL || e_tree_is_dragging (E_TREE (message_list))) return FALSE; + settings = g_settings_new ("org.gnome.evolution.mail"); + + /* FIXME These should be EMailReader properties. */ schedule_timeout = (message_uid != NULL) && - e_shell_settings_get_boolean ( - shell_settings, "mail-mark-seen"); - timeout_interval = - e_shell_settings_get_int ( - shell_settings, "mail-mark-seen-timeout"); + g_settings_get_boolean (settings, "mark-seen"); + timeout_interval = g_settings_get_int (settings, "mark-seen-timeout"); + + g_object_unref (settings); if (message_list->seen_id > 0) { g_source_remove (message_list->seen_id); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index d52d04c3fb..515f27885c 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1522,20 +1522,21 @@ static void emu_update_composers_security (EMsgComposer *composer, guint32 validity_found) { - EShell *shell; - EShellSettings *shell_settings; GtkAction *action; + GSettings *settings; gboolean sign_by_default; g_return_if_fail (composer != NULL); - shell = e_msg_composer_get_shell (composer); - shell_settings = e_shell_get_shell_settings (shell); + settings = g_settings_new ("org.gnome.evolution.mail"); sign_by_default = (validity_found & E_MAIL_PART_VALIDITY_SIGNED) != 0 && - e_shell_settings_get_boolean ( - shell_settings, "composer-sign-reply-if-signed"); + /* FIXME This should be an EMsgComposer property. */ + g_settings_get_boolean ( + settings, "composer-sign-reply-if-signed"); + + g_object_unref (settings); /* Pre-set only for encrypted messages, not for signed */ if (sign_by_default) { diff --git a/mail/em-utils.c b/mail/em-utils.c index 74a0eaca49..0da08fa324 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1519,7 +1519,7 @@ em_utils_is_re_in_subject (EShell *shell, const gchar *subject, gint *skip_len) { - EShellSettings *shell_settings; + GSettings *settings; gchar *prefixes, **prefixes_strv; gboolean res; gint ii; @@ -1536,8 +1536,10 @@ em_utils_is_re_in_subject (EShell *shell, if (check_prefix (subject, "Re", skip_len)) return TRUE; - shell_settings = e_shell_get_shell_settings (shell); - prefixes = e_shell_settings_get_string (shell_settings, "composer-localized-re"); + settings = g_settings_new ("org.gnome.evolution.mail"); + prefixes = g_settings_get_string (settings, "composer-localized-re"); + g_object_unref (settings); + if (!prefixes || !*prefixes) { g_free (prefixes); return FALSE; diff --git a/mail/mail-config.ui b/mail/mail-config.ui index 162cdd4dd7..2b32acb683 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -481,16 +481,14 @@ <property name="xalign">0</property> <property name="xscale">0</property> <child> - <object class="GtkComboBox" id="comboboxReplyStyle"> + <object class="GtkComboBoxText" id="comboboxReplyStyle"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="model">model3</property> - <child> - <object class="GtkCellRendererText" id="renderer3"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> + <items> + <item translatable="yes" context="ReplyForward" id="attach">Attachment</item> + <item translatable="yes" context="ReplyForward" id="outlook">Inline (Outlook style)</item> + <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item> + <item translatable="yes" context="ReplyForward" id="do-not-quote">Do Not Quote</item> + </items> </object> </child> </object> @@ -506,16 +504,13 @@ <property name="xalign">0</property> <property name="xscale">0</property> <child> - <object class="GtkComboBox" id="comboboxForwardStyle"> + <object class="GtkComboBoxText" id="comboboxForwardStyle"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="model">model4</property> - <child> - <object class="GtkCellRendererText" id="renderer4"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> + <items> + <item translatable="yes" context="ReplyForward" id="attached">Attachment</item> + <item translatable="yes" context="ReplyForward" id="inline">Inline</item> + <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item> + </items> </object> </child> </object> @@ -1065,43 +1060,6 @@ </row> </data> </object> - <object class="GtkListStore" id="model3"> - <columns> - <!-- column-name gchararray --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="ReplyForward">Attachment</col> - </row> - <row> - <col id="0" translatable="yes" context="ReplyForward">Inline (Outlook style)</col> - </row> - <row> - <col id="0" translatable="yes" context="ReplyForward">Quoted</col> - </row> - <row> - <col id="0" translatable="yes" context="ReplyForward">Do not quote</col> - </row> - </data> - </object> - <object class="GtkListStore" id="model4"> - <columns> - <!-- column-name gchararray --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="ReplyForward">Attachment</col> - </row> - <row> - <col id="0" translatable="yes" context="ReplyForward">Inline</col> - </row> - <row> - <col id="0" translatable="yes" context="ReplyForward">Quoted</col> - </row> - </data> - </object> <object class="GtkNotebook" id="network_preferences_toplevel"> <property name="visible">True</property> <property name="can_focus">True</property> diff --git a/mail/message-list.c b/mail/message-list.c index cc23f99621..dcae35ffd3 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -39,7 +39,6 @@ #include <glib/gstdio.h> #include "shell/e-shell.h" -#include "shell/e-shell-settings.h" #include "libemail-engine/e-mail-utils.h" #include "libemail-engine/mail-config.h" |