[evolution] Simplify em_folder_tree_restore_state().



commit e8f5c62b0233231a3bdc74a42de062b61e0c15f2
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 29 16:55:01 2010 -0400

    Simplify em_folder_tree_restore_state().

 mail/em-folder-tree.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index ce674f2..d7bbcb7 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2888,6 +2888,7 @@ em_folder_tree_restore_state (EMFolderTree *folder_tree,
 
 	while (valid) {
 		const gchar *key = STATE_KEY_EXPANDED;
+		gboolean expand_row;
 		gchar *group_name;
 		gchar *uri;
 
@@ -2899,22 +2900,17 @@ em_folder_tree_restore_state (EMFolderTree *folder_tree,
 
 		group_name = g_strdup_printf ("Store %s", uri);
 
-		if (e_shell_get_express_mode (shell)) {
-			gboolean system = FALSE;
-
-			if (strncmp (uri, "vfolder", 7) == 0 ||
-					strncmp(uri, "mbox", 4) == 0)
-				system = TRUE;
-
-			if (!system && !g_key_file_has_key (key_file, group_name, key, NULL)) {
-				GtkTreePath *path;
+		/* Expand stores that have no "Expanded" key. */
+		expand_row = !g_key_file_has_key (
+			key_file, group_name, key, NULL);
 
-				path = gtk_tree_model_get_path (tree_model, &iter);
-				gtk_tree_view_expand_row (tree_view, path, FALSE);
-				gtk_tree_path_free (path);
-			}
+		/* Do not expand local stores in Express mode. */
+		if (e_shell_get_express_mode (shell)) {
+			expand_row &= (strncmp (uri, "vfolder", 7) != 0);
+			expand_row &= (strncmp (uri, "mbox", 4) != 0);
+		}
 
-		} else if (!g_key_file_has_key (key_file, group_name, key, NULL)) {
+		if (expand_row) {
 			GtkTreePath *path;
 
 			path = gtk_tree_model_get_path (tree_model, &iter);



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