aboutsummaryrefslogtreecommitdiffstats
path: root/shell
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
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')
-rw-r--r--shell/ChangeLog24
-rw-r--r--shell/Evolution-StorageSetView.idl2
-rw-r--r--shell/e-storage-set-view.c102
-rw-r--r--shell/e-storage-set-view.h4
-rw-r--r--shell/evolution-storage-set-view.c40
5 files changed, 143 insertions, 29 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 72040df21b..bf2e14e8d5 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,29 @@
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.
+
+2000-10-02 Chris Toshok <toshok@helixcode.com>
+
* evolution-storage-set-view-factory.c
(evolution_storage_set_view_factory_new_view): pass
storage_set_view_interface as second argument to
diff --git a/shell/Evolution-StorageSetView.idl b/shell/Evolution-StorageSetView.idl
index 0649b3b4a2..490da848e9 100644
--- a/shell/Evolution-StorageSetView.idl
+++ b/shell/Evolution-StorageSetView.idl
@@ -20,6 +20,8 @@ module Evolution {
exception AlreadyListening {};
exception NotFound {};
+ attribute boolean show_folders;
+
void add_listener (in StorageSetViewListener listener)
raises (AlreadyListening);
void remove_listener (in StorageSetViewListener listener)
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)
diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h
index b1e6cc699b..af5f1710ab 100644
--- a/shell/e-storage-set-view.h
+++ b/shell/e-storage-set-view.h
@@ -71,6 +71,10 @@ void e_storage_set_view_set_current_folder (EStorageSetView *storage_set
const char *path);
const char *e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view);
+void e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view,
+ gboolean show);
+gboolean e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c
index e0401c5efc..2e320c9ee5 100644
--- a/shell/evolution-storage-set-view.c
+++ b/shell/evolution-storage-set-view.c
@@ -184,7 +184,7 @@ impl_StorageSetView_add_listener (PortableServer_Servant servant,
EvolutionStorageSetView *storage_set_view;
bonobo_object = bonobo_object_from_servant (servant);
- storage_set_view = EVOLUTION_STORAGE_SET_VIEW (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
if (! add_listener (storage_set_view, listener))
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
@@ -200,13 +200,47 @@ impl_StorageSetView_remove_listener (PortableServer_Servant servant,
EvolutionStorageSetView *storage_set_view;
bonobo_object = bonobo_object_from_servant (servant);
- storage_set_view = EVOLUTION_STORAGE_SET_VIEW (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
if (! remove_listener (storage_set_view, listener))
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Evolution_StorageSetView_NotFound, NULL);
}
+static CORBA_boolean
+impl_StorageSetView__get_show_folders (PortableServer_Servant servant,
+ CORBA_Environment * ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionStorageSetView *storage_set_view;
+ EvolutionStorageSetViewPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
+ priv = storage_set_view->priv;
+
+ return (CORBA_boolean)e_storage_set_view_get_show_folders (
+ E_STORAGE_SET_VIEW(priv->storage_set_view_widget));
+}
+
+static void
+impl_StorageSetView__set_show_folders (PortableServer_Servant servant,
+ const CORBA_boolean value,
+ CORBA_Environment * ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionStorageSetView *storage_set_view;
+ EvolutionStorageSetViewPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
+ priv = storage_set_view->priv;
+
+ e_storage_set_view_set_show_folders (
+ E_STORAGE_SET_VIEW(priv->storage_set_view_widget),
+ (gboolean)value);
+}
+
/* GtkObject methods. */
@@ -254,6 +288,8 @@ corba_class_init (void)
epv = g_new0 (POA_Evolution_StorageSetView__epv, 1);
epv->add_listener = impl_StorageSetView_add_listener;
epv->remove_listener = impl_StorageSetView_remove_listener;
+ epv->_set_show_folders = impl_StorageSetView__set_show_folders;
+ epv->_get_show_folders = impl_StorageSetView__get_show_folders;
vepv = &StorageSetView_vepv;
vepv->_base_epv = base_epv;