aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-storage-set-view.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-03-08 02:26:57 +0800
committerDan Winship <danw@src.gnome.org>2002-03-08 02:26:57 +0800
commit7065f6dba35467cb77519e0b9144659581746289 (patch)
treeb6758e28708d8b973d920810495b847e106aea6a /shell/e-storage-set-view.c
parent654b9618c8bc54e248a7cd5c36bed6e116bfe6a3 (diff)
downloadgsoc2013-evolution-7065f6dba35467cb77519e0b9144659581746289.tar.gz
gsoc2013-evolution-7065f6dba35467cb77519e0b9144659581746289.tar.zst
gsoc2013-evolution-7065f6dba35467cb77519e0b9144659581746289.zip
Make storages-with-toplevel-views less of a hack.
* e-folder-tree.c (e_folder_tree_add): Allow the caller to "add" a root folder, if the existing root folder has no children. (e_folder_tree_new): Use e_folder_tree_add to create the root folder, since it can do that now. * e-storage.c: (e_storage_construct): Replace toplevel_node_uri and toplevel_node_type args with root_folder. (e_storage_new): Likewise. (*): Remove toplevel uri/type stuff everywhere. Also remove display_name since now we will use the name of the root folder for that. * evolution-storage.c: Remove toplevel uri/type stuff everywhere. * e-local-storage.c (construct): Pass root_folder to e_storage_construct instead of toplevel uri/type. Also, evolution_storage_new no longer takes toplevel uri/type. * e-corba-storage.c (e_corba_storage_construct): Out with toplevel uri/type, in with root_folder. (e_corba_storage_new): Remove toplevel uri/type. * e-shell.c (setup_local_storage): Create a top-level folder of type "summary" for the Summary storage. * e-storage-set-view.c (set_e_shortcut_selection): Remove special-case for storages. (etree_icon_at): Remove special case for figuring out storage icons (but leave the code that makes the icon disappear once the storage is opened). (etree_value_at): Remove special case for storage names. (But still make storages always bold.) Remove unused special-case code for Summary. * e-shortcuts.c (load_shortcuts): Remove special case for storages, reorganize a bit. * e-shortcuts-view.c (get_shortcut_info): Remove special case for storages. * e-shell-view.c (update_for_current_uri): Remove special case for storages. (socket_destroy_cb): Likewise. (get_type_for_storage): No longer needed. (get_view_for_uri): No longer needs to special-case storages (but add a special case for folders of type "noselect", to make them unselectable like storages-without-toplevel-views used to be). * e-storage-set.c (get_storage_for_path): If passed "/foo", return "/" as subpath_return so e_storage_set_get_folder will DTRT in the NWO. * Evolution-Storage.idl (addStorage): Remove the toplevel_node_uri and toplevel_node_type arguments. * e-corba-storage-registry.c (impl_StorageRegistry_addStorage): Likewise. svn path=/trunk/; revision=15965
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r--shell/e-storage-set-view.c94
1 files changed, 37 insertions, 57 deletions
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 68845aadd5..1c91ae6231 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -585,17 +585,10 @@ set_e_shortcut_selection (EStorageSetView *storage_set_view,
g_assert (folder_path != NULL);
folder = e_storage_set_get_folder (priv->storage_set, folder_path);
- if (folder != NULL) {
+ if (folder != NULL)
name = e_folder_get_name (folder);
- } else {
- EStorage *storage;
-
- storage = e_storage_set_get_storage (priv->storage_set, folder_path + 1);
- if (storage != NULL)
- name = e_storage_get_display_name (storage);
- else
- name = NULL;
- }
+ else
+ name = NULL;
/* FIXME: Get `evolution:' from somewhere instead of hardcoding it here. */
@@ -1356,31 +1349,31 @@ impl_cursor_activated (ETree *tree,
/* ETreeModel Methods */
+static gboolean
+path_is_storage (ETreeModel *etree,
+ ETreePath tree_path)
+{
+ return e_tree_model_node_depth (etree, tree_path) == 1;
+}
+
static GdkPixbuf*
etree_icon_at (ETreeModel *etree,
ETreePath tree_path,
void *model_data)
{
- EFolderTypeRegistry *folder_type_registry;
EStorageSetView *storage_set_view;
EStorageSet *storage_set;
EFolder *folder;
char *path;
- int depth;
storage_set_view = E_STORAGE_SET_VIEW (model_data);
storage_set = storage_set_view->priv->storage_set;
- /* Tree depth will indicate storages or folders */
- depth = e_tree_model_node_depth (etree, tree_path);
-
path = (char*) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path);
- /* Is this a storage? */
-
- if (depth == 1) {
+ /* No icon for a storage with children */
+ if (path_is_storage (etree, tree_path)) {
EStorage *storage;
- const char *storage_type;
GList *subfolder_paths;
storage = e_storage_set_get_storage (storage_set, path + 1);
@@ -1389,17 +1382,8 @@ etree_icon_at (ETreeModel *etree,
e_free_string_list (subfolder_paths);
return NULL;
}
-
- folder_type_registry = e_storage_set_get_folder_type_registry (storage_set);
- storage_type = e_storage_get_toplevel_node_type (storage);
- if (storage_type != NULL)
- return e_folder_type_registry_get_icon_for_type (folder_type_registry, storage_type, TRUE);
- else
- return NULL;
}
- /* Folder. */
-
folder = e_storage_set_get_folder (storage_set, path);
if (folder == NULL)
return NULL;
@@ -1456,46 +1440,42 @@ etree_value_at (ETreeModel *etree,
{
EStorageSetView *storage_set_view;
EStorageSet *storage_set;
- EStorage *storage;
EFolder *folder;
char *path;
+ const char *folder_name;
+ int unread_count;
storage_set_view = E_STORAGE_SET_VIEW (model_data);
storage_set = storage_set_view->priv->storage_set;
+ /* Storages are always highlighted. */
+ if (path_is_storage (etree, tree_path) && col == 1)
+ return (void *) TRUE;
+
path = (char *) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), tree_path);
folder = e_storage_set_get_folder (storage_set, path);
- if (folder != NULL) {
- const char *folder_name = e_folder_get_name (folder);
- int unread_count = e_folder_get_unread_count (folder);
-
- if (unread_count > 0)
- gtk_object_set_data_full (GTK_OBJECT (folder), "name_with_unread",
- g_strdup_printf ("%s (%d)", folder_name, unread_count), g_free);
-
- if (col == 0)
- if (unread_count > 0)
- return (void *) gtk_object_get_data (GTK_OBJECT (folder),
- "name_with_unread");
- else
- return (void *) folder_name;
- else
- return (void *) e_folder_get_highlighted (folder);
- }
+ if (folder == NULL)
+ return (void *) "?";
- storage = e_storage_set_get_storage (storage_set, path + 1);
- if (storage != NULL) {
- if (col == 0)
- return (void *) e_storage_get_display_name (storage);
- else
- return (void *) TRUE;
- }
+ if (col == 1)
+ return (void *) e_folder_get_highlighted (folder);
- if (col == 0)
- return _("Summary");
- else
- return (void *) TRUE;
+ folder_name = e_folder_get_name (folder);
+ unread_count = e_folder_get_unread_count (folder);
+
+ if (unread_count > 0) {
+ char *name_with_unread;
+
+ name_with_unread = g_strdup_printf ("%s (%d)", folder_name,
+ unread_count);
+ gtk_object_set_data_full (GTK_OBJECT (folder),
+ "name_with_unread",
+ name_with_unread, g_free);
+
+ return (void *) name_with_unread;
+ } else
+ return (void *) folder_name;
}
static void