aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-view.c
diff options
context:
space:
mode:
authorJason Leach <jleach@ximian.com>2001-06-07 03:38:28 +0800
committerJacob Leach <jleach@src.gnome.org>2001-06-07 03:38:28 +0800
commitc77b7e30202573c1c4ab54086388202d93181b45 (patch)
treeae8398641bd6ab8c397b721226d20c77aa40e0ef /shell/e-shell-view.c
parent0a7445949918ec1cc80cd303217df742e10fb6f5 (diff)
downloadgsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.gz
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.zst
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.zip
(Fix bug #418: Save state of folder tree view)
2001-06-06 Jason Leach <jleach@ximian.com> (Fix bug #418: Save state of folder tree view) * e-shell-view.c (e_shell_view_save_settings): Changed the char * @prefix argument to an int @view_num. (e_shell_view_load_settings): Ditto. (get_local_prefix_for_view): New function that gets us a prefix from a view_num. * e-shell-view.c (e_shell_view_save_settings): Save the expanded/collapsed information for each storage-set-view here. (e_shell_view_load_settings): Load it here. * e-storage-set-view.c (e_storage_set_view_construct): Make it so new storage set views have their storages expanded by default, but will respsect the expanded state information that we load into it. (insert_storages): Minor change here too. (new_folder_cb): Ditto. svn path=/trunk/; revision=10135
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r--shell/e-shell-view.c63
1 files changed, 52 insertions, 11 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 7c2814de8b..3b7f270caa 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -2079,6 +2079,24 @@ load_shortcut_bar_icon_modes (EShellView *shell_view)
}
}
+static char *
+get_local_prefix_for_view (EShellView *shell_view,
+ int view_num)
+{
+ EShellViewPrivate *priv;
+ char *prefix;
+ const char *local_directory;
+
+ priv = shell_view->priv;
+
+ local_directory = e_shell_get_local_directory (priv->shell);
+
+ prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/",
+ local_directory, view_num);
+
+ return prefix;
+}
+
/**
* e_shell_view_save_settings:
@@ -2091,17 +2109,21 @@ load_shortcut_bar_icon_modes (EShellView *shell_view)
**/
gboolean
e_shell_view_save_settings (EShellView *shell_view,
- const char *prefix)
+ int view_num)
{
EShellViewPrivate *priv;
const char *uri;
+ char *prefix;
+ char *filename;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
- g_return_val_if_fail (prefix != NULL, FALSE);
priv = shell_view->priv;
+ prefix = get_local_prefix_for_view (shell_view, view_num);
+ g_return_val_if_fail (prefix != NULL, FALSE);
+
gnome_config_push_prefix (prefix);
gnome_config_set_int ("CurrentShortcutsGroupNum", e_shell_view_get_current_shortcuts_group_num (shell_view));
@@ -2120,13 +2142,16 @@ e_shell_view_save_settings (EShellView *shell_view,
gnome_config_pop_prefix ();
-#if 0
- char *expanded_state_file = g_strdup_printf ("%s/config/shell-expanded", evolution_dir);
+ /* Save the expanded state for this ShellViews StorageSetView */
+ filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
+ e_shell_get_local_directory (priv->shell),
+ view_num);
+ e_tree_save_expanded_state (E_TREE (priv->storage_set_view),
+ filename);
+
+ g_free (filename);
+ g_free (prefix);
- e_tree_save_expanded_state(E_TREE(priv->storage_set_view), expanded_state_file);
- g_free(expanded_state_file);
-#endif
-
return TRUE;
}
@@ -2141,18 +2166,22 @@ e_shell_view_save_settings (EShellView *shell_view,
**/
gboolean
e_shell_view_load_settings (EShellView *shell_view,
- const char *prefix)
+ int view_num)
{
EShellViewPrivate *priv;
int val;
char *stringval;
+ char *prefix;
+ char *filename;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
- g_return_val_if_fail (prefix != NULL, FALSE);
priv = shell_view->priv;
+ prefix = get_local_prefix_for_view (shell_view, view_num);
+ g_return_val_if_fail (prefix != NULL, FALSE);
+
gnome_config_push_prefix (prefix);
val = gnome_config_get_int ("CurrentShortcutsGroupNum");
@@ -2178,9 +2207,21 @@ e_shell_view_load_settings (EShellView *shell_view,
load_shortcut_bar_icon_modes (shell_view);
gnome_config_pop_prefix ();
-
+
+ /* Load the expanded state for the ShellView's StorageSetView */
+ filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_%d",
+ e_shell_get_local_directory (priv->shell),
+ view_num);
+
+ e_tree_load_expanded_state (E_TREE (priv->storage_set_view),
+ filename);
+
+ g_free (filename);
+ g_free (prefix);
+
return TRUE;
}
+
E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, BONOBO_TYPE_WINDOW)