diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-06-14 03:07:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-06-14 03:07:00 +0800 |
commit | ab27aff72c64183166fc6207d2ef0142e1ab8c83 (patch) | |
tree | 6b95a26dedf3ca26ae70f9a2ff3ea466e42763dc /mail/e-mail-shell-sidebar.c | |
parent | 49ba34088bcdb9ab9cfae0c2b7fe11452fb60e24 (diff) | |
download | gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar.gz gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar.bz2 gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar.lz gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar.xz gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.tar.zst gsoc2013-evolution-ab27aff72c64183166fc6207d2ef0142e1ab8c83.zip |
Thought of a better way to copy folder tree state.
Revert the expanded tree model column and add a "selection"property to
EMFolderTreeModel, which the sidebar sets. If set, all new EMFolderTree
instances will automatically mimic its expanded and selected state.
Diffstat (limited to 'mail/e-mail-shell-sidebar.c')
-rw-r--r-- | mail/e-mail-shell-sidebar.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c index 7d2ef3475a..83e8b7d0a0 100644 --- a/mail/e-mail-shell-sidebar.c +++ b/mail/e-mail-shell-sidebar.c @@ -91,10 +91,6 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar) * (these are all stores) and expand those that have no * corresponding "Expanded" key in the state file. This * ensures that new stores are expanded by default. - * - * The expanded state is recorded and maintained in the tree model - * so that folder trees in other contexts can duplicate it using - * em_folder_tree_clone_expanded(). */ /* Stage 1 */ @@ -135,12 +131,6 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar) gtk_tree_model_get_iter (tree_model, &iter, path); gtk_tree_view_expand_row (tree_view, path, FALSE); gtk_tree_path_free (path); - - /* The expanded column is used to clone the sidebar's - * expanded state in other EMFolderTree instances. */ - gtk_tree_store_set ( - GTK_TREE_STORE (tree_model), &iter, - COL_BOOL_EXPANDED, TRUE, -1); } g_strfreev (groups); @@ -168,12 +158,6 @@ mail_shell_sidebar_restore_state (EMailShellSidebar *mail_shell_sidebar) path = gtk_tree_model_get_path (tree_model, &iter); gtk_tree_view_expand_row (tree_view, path, FALSE); gtk_tree_path_free (path); - - /* The expanded column is used to clone the sidebar's - * expanded state in other EMFolderTree instances. */ - gtk_tree_store_set ( - GTK_TREE_STORE (tree_model), &iter, - COL_BOOL_EXPANDED, TRUE, -1); } g_free (group_name); @@ -212,12 +196,6 @@ mail_shell_sidebar_row_collapsed_cb (EShellSidebar *shell_sidebar, g_return_if_fail (is_store || is_folder); - /* The expanded column is used to clone the sidebar's - * expanded state in other EMFolderTree instances. */ - gtk_tree_store_set ( - GTK_TREE_STORE (model), iter, - COL_BOOL_EXPANDED, FALSE, -1); - key = STATE_KEY_EXPANDED; if (is_store) group_name = g_strdup_printf ("Store %s", uri); @@ -266,12 +244,6 @@ mail_shell_sidebar_row_expanded_cb (EShellSidebar *shell_sidebar, g_return_if_fail (is_store || is_folder); - /* The expanded column is used to clone the sidebar's - * expanded state in other EMFolderTree instances. */ - gtk_tree_store_set ( - GTK_TREE_STORE (model), &iter, - COL_BOOL_EXPANDED, TRUE, -1); - key = STATE_KEY_EXPANDED; if (is_store) group_name = g_strdup_printf ("Store %s", uri); @@ -487,7 +459,10 @@ mail_shell_sidebar_constructed (GObject *object) tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree); selection = gtk_tree_view_get_selection (tree_view); - mail_shell_sidebar_restore_state (mail_shell_sidebar); + if (em_folder_tree_model_get_selection (folder_tree_model) == NULL) + mail_shell_sidebar_restore_state (mail_shell_sidebar); + + em_folder_tree_model_set_selection (folder_tree_model, selection); g_signal_connect_swapped ( tree_view, "row-collapsed", |