[evolution/gnome-3-4] Bug #669445 - A way of turning Message Preview off by default



commit 2580512b43a3270cbf4bc7e0e4c8446603330a62
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 3 13:46:20 2012 +0200

    Bug #669445 - A way of turning Message Preview off by default

 mail/e-mail-paned-view.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index e1779a8..f1eba56 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -83,6 +83,7 @@ enum {
 #define STATE_KEY_GROUP_BY_THREADS	"GroupByThreads"
 #define STATE_KEY_SELECTED_MESSAGE	"SelectedMessage"
 #define STATE_KEY_PREVIEW_VISIBLE	"PreviewVisible"
+#define STATE_GROUP_GLOBAL_FOLDER	"GlobalFolder"
 
 /* Forward Declarations */
 static void e_mail_paned_view_reader_init (EMailReaderInterface *interface);
@@ -121,6 +122,8 @@ mail_paned_view_save_boolean (EMailView *view,
 	g_free (group_name);
 	g_free (folder_uri);
 
+	g_key_file_set_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, value);
+
 	e_shell_view_set_state_dirty (shell_view);
 }
 
@@ -512,7 +515,7 @@ mail_paned_view_set_folder (EMailReader *reader,
 	gchar *folder_uri;
 	gchar *group_name;
 	const gchar *key;
-	gboolean value;
+	gboolean value, global_view_settings;
 	GError *error = NULL;
 
 	priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
@@ -523,6 +526,7 @@ mail_paned_view_set_folder (EMailReader *reader,
 
 	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");
 
 	message_list = e_mail_reader_get_message_list (reader);
 
@@ -555,19 +559,31 @@ 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, group_name, key, &error);
+	value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
 	if (error != NULL) {
-		value = TRUE;
 		g_clear_error (&error);
+
+		value = !global_view_settings ||
+			g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error);
+		if (error != NULL) {
+			g_clear_error (&error);
+			value = TRUE;
+		}
 	}
 
 	e_mail_reader_set_group_by_threads (reader, value);
 
 	key = STATE_KEY_PREVIEW_VISIBLE;
-	value = g_key_file_get_boolean (key_file, group_name, key, &error);
+	value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
 	if (error != NULL) {
-		value = TRUE;
 		g_clear_error (&error);
+
+		value = !global_view_settings ||
+			g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error);
+		if (error != NULL) {
+			g_clear_error (&error);
+			value = TRUE;
+		}
 	}
 
 	/* XXX This is a little confusing and needs rethought.  The



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]