aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-storage-set-view.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-10-03 09:29:43 +0800
committerChris Toshok <toshok@src.gnome.org>2000-10-03 09:29:43 +0800
commit1ad5f19df9e41efd06107dc04802c69eae7ca386 (patch)
tree2e60e134b991973235469814439bbb9676493d26 /shell/e-storage-set-view.c
parent11aa32cb036c01e993ff40b8799856a85256018f (diff)
downloadgsoc2013-evolution-1ad5f19df9e41efd06107dc04802c69eae7ca386.tar.gz
gsoc2013-evolution-1ad5f19df9e41efd06107dc04802c69eae7ca386.tar.zst
gsoc2013-evolution-1ad5f19df9e41efd06107dc04802c69eae7ca386.zip
fix typo. (impl_StorageSetView_remove_listener): same.
2000-10-02 Chris Toshok <toshok@helixcode.com> * evolution-storage-set-view.c (impl_StorageSetView_add_listener): fix typo. (impl_StorageSetView_remove_listener): same. (impl_StorageSetView__get_show_folders): implementation of getter for show_folders. (impl_StorageSetView__set_show_folders): implementation of setter for show_folders. (corba_class_init): install _set_show_folders and _get_show_folders. * Evolution-StorageSetView.idl: add show_folders attribute to StorageSetView. * e-storage-set-view.h: add prototypes for e_storage_set_view_{get,set}_show_folders. * e-storage-set-view.c (insert_storages): split this code out from e_storage_set_view_construct so we can call it when "show_folders" has been changed. (e_storage_set_view_construct): remove the code to insert storages. (e_storage_set_view_set_show_folders): new function. tears down existing tree and node/path hashtable and calls insert_storages. (e_storage_set_view_get_show_folders): new function, retrieves current show_folders state. svn path=/trunk/; revision=5684
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r--shell/e-storage-set-view.c102
1 files changed, 75 insertions, 27 deletions
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 0be7c10d6d..3fb50f4b13 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -62,6 +62,8 @@ struct _EStorageSetViewPrivate {
/* Path of the row selected by the latest "cursor_change" signal. */
const char *selected_row_path;
+
+ gboolean show_folders;
};
@@ -695,6 +697,7 @@ init (EStorageSetView *storage_set_view)
priv->path_to_etree_node = g_hash_table_new (g_str_hash, g_str_equal);
priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal);
priv->selected_row_path = NULL;
+ priv->show_folders = TRUE;
storage_set_view->priv = priv;
}
@@ -800,6 +803,42 @@ insert_folders (EStorageSetView *storage_set_view,
}
static void
+insert_storages (EStorageSetView *storage_set_view)
+{
+ EStorageSetViewPrivate *priv;
+ EStorageSet *storage_set;
+ GList *storage_list;
+ GList *p;
+
+ priv = storage_set_view->priv;
+
+ storage_set = priv->storage_set;
+
+ storage_list = e_storage_set_get_storage_list (storage_set);
+
+ for (p = storage_list; p != NULL; p = p->next) {
+ EStorage *storage = E_STORAGE (p->data);
+ const char *name;
+ char *path;
+ ETreePath *parent;
+
+ name = e_storage_get_name (storage);
+ path = g_strconcat ("/", name, NULL);
+
+ parent = e_tree_model_node_insert_id (priv->etree_model, priv->root_node,
+ -1, path, path);
+ e_tree_model_node_set_expanded (priv->etree_model, parent, TRUE);
+
+ g_hash_table_insert (priv->path_to_etree_node, path, parent);
+
+ if (priv->show_folders)
+ insert_folders (storage_set_view, parent, storage, "/");
+ }
+
+ e_free_object_list (storage_list);
+}
+
+static void
right_click (EStorageSetView *storage_set_view, int row, int col,
GdkEventButton *event, gboolean *ret)
{
@@ -835,13 +874,6 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
EStorageSet *storage_set)
{
EStorageSetViewPrivate *priv;
- ETreePath *parent;
- EStorage *storage;
- GList *storage_list;
- GList *p;
- const char *name;
- char *text[2];
- char *path;
ETableCol *ecol;
ETableHeader *e_table_header;
ECell *cell_left_just;
@@ -913,26 +945,7 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
gtk_signal_connect (GTK_OBJECT (storage_set_view), "table_drag_data_get",
GTK_SIGNAL_FUNC (etable_drag_data_get), GTK_OBJECT(storage_set_view));
- storage_list = e_storage_set_get_storage_list (storage_set);
-
- text[1] = NULL;
-
- for (p = storage_list; p != NULL; p = p->next) {
- storage = E_STORAGE (p->data);
-
- name = e_storage_get_name (storage);
- path = g_strconcat ("/", name, NULL);
-
- parent = e_tree_model_node_insert_id (priv->etree_model, priv->root_node,
- -1, path, path);
- e_tree_model_node_set_expanded (priv->etree_model, parent, TRUE);
-
- g_hash_table_insert (priv->path_to_etree_node, path, parent);
-
- insert_folders (storage_set_view, parent, storage, "/");
- }
-
- e_free_object_list (storage_list);
+ insert_storages (storage_set_view);
}
GtkWidget *
@@ -998,5 +1011,40 @@ e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view)
return path;
}
+void
+e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view,
+ gboolean show)
+{
+ EStorageSetViewPrivate *priv;
+
+ g_return_if_fail (storage_set_view != NULL);
+ g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view));
+
+ priv = storage_set_view->priv;
+
+ if (show == priv->show_folders)
+ return;
+
+ /* tear down existing tree and hash table mappings */
+ e_tree_model_node_remove (priv->etree_model, priv->root_node);
+ g_hash_table_foreach (priv->path_to_etree_node, path_free_func, NULL);
+
+ /* now re-add the root node */
+ priv->root_node = e_tree_model_node_insert (priv->etree_model, NULL, -1, "/Root Node");
+
+ /* then reinsert the storages after setting the "show_folders"
+ flag. insert_storages will call insert_folders if
+ show_folders is TRUE */
+
+ priv->show_folders = show;
+ insert_storages (storage_set_view);
+}
+
+gboolean
+e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view)
+{
+ return storage_set_view->priv->show_folders;
+}
+
E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE)