aboutsummaryrefslogtreecommitdiffstats
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
parent0a7445949918ec1cc80cd303217df742e10fb6f5 (diff)
downloadgsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.gz
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.bz2
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.lz
gsoc2013-evolution-c77b7e30202573c1c4ab54086388202d93181b45.tar.xz
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
-rw-r--r--shell/ChangeLog20
-rw-r--r--shell/e-shell-view.c63
-rw-r--r--shell/e-shell-view.h5
-rw-r--r--shell/e-shell.c24
-rw-r--r--shell/e-storage-set-view.c8
5 files changed, 86 insertions, 34 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 621cf77da1..47a245668e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,23 @@
+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.
+
2001-06-05 Jason Leach <jleach@ximian.com>
* e-shell-view-menu.c: Plug in all the folder tree right click
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)
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 605691b46d..c7ee7fa4af 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -96,9 +96,10 @@ int e_shell_view_get_current_shortcuts_group_num (EShellView *she
void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, int group_num);
gboolean e_shell_view_save_settings (EShellView *shell_view,
- const char *prefix);
+ int view_num);
gboolean e_shell_view_load_settings (EShellView *shell_view,
- const char *prefix);
+ int view_num);
+
#ifdef __cplusplus
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 566a9e6a72..e931da6377 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -361,7 +361,8 @@ setup_corba_storages (EShell *shell)
if (corba_storage_registry == NULL)
return FALSE;
- bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (corba_storage_registry));
+ bonobo_object_add_interface (BONOBO_OBJECT (shell),
+ BONOBO_OBJECT (corba_storage_registry));
/* Notice that `bonobo_object_add_interface()' aggregates the two object's
reference counts, so we need an extra ref here if we want to keep a separate
@@ -764,7 +765,7 @@ e_shell_construct (EShell *shell,
priv->local_directory = g_strdup (local_directory);
priv->folder_type_registry = e_folder_type_registry_new ();
- priv->storage_set = e_storage_set_new (shell->priv->folder_type_registry);
+ priv->storage_set = e_storage_set_new (priv->folder_type_registry);
/* CORBA storages must be set up before the components, because otherwise components
cannot register their own storages. */
@@ -986,15 +987,10 @@ save_settings_for_views (EShell *shell)
view = E_SHELL_VIEW (p->data);
- prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/",
- priv->local_directory, i);
-
- if (! e_shell_view_save_settings (view, prefix)) {
+ if (! e_shell_view_save_settings (view, i)) {
g_warning ("Cannot save settings for view -- %d", i);
retval = FALSE;
}
-
- g_free (prefix);
}
prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews",
@@ -1023,7 +1019,8 @@ save_settings_for_component (EShell *shell,
CORBA_exception_init (&ev);
- session_interface = Bonobo_Unknown_queryInterface (unknown_interface, "IDL:GNOME/Evolution/Session:1.0", &ev);
+ session_interface = Bonobo_Unknown_queryInterface (unknown_interface,
+ "IDL:GNOME/Evolution/Session:1.0", &ev);
if (ev._major != CORBA_NO_EXCEPTION || CORBA_Object_is_nil (session_interface, &ev)) {
CORBA_exception_free (&ev);
return TRUE;
@@ -1137,17 +1134,12 @@ e_shell_restore_from_settings (EShell *shell)
for (i = 0; i < num_views; i++) {
EShellView *view;
- prefix = g_strdup_printf ("=%s/config/Shell=/Views/%d/",
- priv->local_directory, i);
-
- /* FIXME restore the URI here. There should be an
+ /* FIXME: restore the URI here. There should be an
e_shell_view_new_from_configuration() thingie. */
view = e_shell_new_view (shell, NULL);
- if (! e_shell_view_load_settings (view, prefix))
+ if (! e_shell_view_load_settings (view, i))
retval = FALSE;
-
- g_free (prefix);
}
return retval;
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 6c08a0bda5..3129cdd976 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -1499,9 +1499,7 @@ new_storage_cb (EStorageSet *storage_set,
node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model),
priv->root_node,
-1, path);
- e_tree_memory_sort_node(E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view);
-
- e_tree_node_set_expanded (E_TREE(storage_set_view), node, TRUE);
+ e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view);
if (! add_node_to_hash (storage_set_view, path, node)) {
e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), node);
@@ -1822,8 +1820,7 @@ insert_storages (EStorageSetView *storage_set_view)
parent = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node,
-1, path);
- e_tree_memory_sort_node(E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view);
- e_tree_node_set_expanded (E_TREE(storage_set_view), parent, TRUE);
+ e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view);
g_hash_table_insert (priv->path_to_etree_node, path, parent);
@@ -1874,6 +1871,7 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
storage_set_view);
e_tree_memory_set_node_destroy_func (E_TREE_MEMORY (priv->etree_model), (GFunc) g_free, NULL);
+ e_tree_memory_set_expanded_default (E_TREE_MEMORY (priv->etree_model), TRUE);
priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, g_strdup ("/Root Node"));