From b995d99498160db3006cb4288b5048f3396d1d88 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 18 May 2010 20:08:25 -0400 Subject: Bug 619010 - Mailer's crash avoidance features are broken --- modules/mail/e-mail-shell-content.c | 53 +++++++++++++++++++++--------------- modules/mail/e-mail-shell-settings.c | 4 +++ 2 files changed, 35 insertions(+), 22 deletions(-) (limited to 'modules') diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 9ac74a48ea..846c1ee854 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -70,10 +70,9 @@ struct _EMailShellContentPrivate { /* Signal handler IDs */ guint message_list_built_id; - guint group_by_threads : 1; - guint preview_visible : 1; - guint suppress_message_selection : 1; - guint show_deleted : 1; + guint group_by_threads : 1; + guint preview_visible : 1; + guint show_deleted : 1; }; enum { @@ -121,8 +120,9 @@ mail_shell_content_message_list_built_cb (EMailShellContent *mail_shell_content, MessageList *message_list) { EMailShellContentPrivate *priv = mail_shell_content->priv; - EShellContent *shell_content; EShellView *shell_view; + EShellWindow *shell_window; + EShellContent *shell_content; GKeyFile *key_file; gchar *uid; @@ -132,6 +132,8 @@ mail_shell_content_message_list_built_cb (EMailShellContent *mail_shell_content, shell_content = E_SHELL_CONTENT (mail_shell_content); shell_view = e_shell_content_get_shell_view (shell_content); + shell_window = e_shell_view_get_shell_window (shell_view); + key_file = e_shell_view_get_state_key_file (shell_view); if (message_list->cursor_uid != NULL) @@ -140,10 +142,11 @@ mail_shell_content_message_list_built_cb (EMailShellContent *mail_shell_content, else if (message_list->folder_uri == NULL) uid = NULL; - else if (mail_shell_content->priv->suppress_message_selection) + else if (e_shell_window_get_safe_mode (shell_window)) { + e_shell_window_set_safe_mode (shell_window, FALSE); uid = NULL; - else { + } else { const gchar *folder_uri; const gchar *key; gchar *group_name; @@ -566,29 +569,33 @@ mail_shell_content_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri) { + EShell *shell; EShellView *shell_view; + EShellWindow *shell_window; EShellContent *shell_content; + EShellSettings *shell_settings; EMailShellContentPrivate *priv; EMailReaderIface *default_iface; GtkWidget *message_list; - CamelFolder *old_folder; GKeyFile *key_file; gchar *group_name; const gchar *key; - gboolean different_folder; gboolean value; GError *error = NULL; priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - old_folder = e_mail_reader_get_folder (reader); + shell_content = E_SHELL_CONTENT (reader); + shell_view = e_shell_content_get_shell_view (shell_content); + 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); + message_list = e_mail_reader_get_message_list (reader); message_list_freeze (MESSAGE_LIST (message_list)); - different_folder = - (old_folder != NULL && folder != old_folder); - /* Chain up to interface's default set_folder() method. */ default_iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); default_iface->set_folder (reader, folder, folder_uri); @@ -598,12 +605,6 @@ mail_shell_content_set_folder (EMailReader *reader, mail_refresh_folder (folder, NULL, NULL); - /* This function gets triggered several times at startup, - * so we don't want to reset the message suppression state - * unless we're actually switching to a different folder. */ - if (different_folder) - priv->suppress_message_selection = FALSE; - /* This is a one-time-only callback. */ if (MESSAGE_LIST (message_list)->cursor_uid == NULL && priv->message_list_built_id == 0) @@ -614,9 +615,6 @@ mail_shell_content_set_folder (EMailReader *reader, /* Restore the folder's preview and threaded state. */ - shell_content = E_SHELL_CONTENT (reader); - shell_view = e_shell_content_get_shell_view (shell_content); - key_file = e_shell_view_get_state_key_file (shell_view); group_name = g_strdup_printf ("Folder %s", folder_uri); @@ -637,6 +635,17 @@ mail_shell_content_set_folder (EMailReader *reader, g_clear_error (&error); } + /* 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); + e_shell_window_set_safe_mode (shell_window, TRUE); + value = FALSE; + } + e_mail_shell_content_set_preview_visible ( E_MAIL_SHELL_CONTENT (shell_content), value); diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 1434951b81..48fd042d58 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -165,6 +165,10 @@ e_mail_shell_settings_init (EShell *shell) "mail-reply-style", "/apps/evolution/mail/format/reply_style"); + e_shell_settings_install_property_for_key ( + "mail-safe-list", + "/apps/evolution/mail/display/safe_list"); + e_shell_settings_install_property_for_key ( "mail-show-animated-images", "/apps/evolution/mail/display/animated_images"); -- cgit v1.2.3