diff options
-rw-r--r-- | shell/ChangeLog | 62 | ||||
-rw-r--r-- | shell/Evolution-Storage.idl | 6 | ||||
-rw-r--r-- | shell/e-corba-storage-registry.c | 12 | ||||
-rw-r--r-- | shell/e-corba-storage.c | 13 | ||||
-rw-r--r-- | shell/e-corba-storage.h | 6 | ||||
-rw-r--r-- | shell/e-folder-tree.c | 22 | ||||
-rw-r--r-- | shell/e-local-storage.c | 9 | ||||
-rw-r--r-- | shell/e-shell-view.c | 61 | ||||
-rw-r--r-- | shell/e-shell.c | 6 | ||||
-rw-r--r-- | shell/e-shortcuts-view.c | 13 | ||||
-rw-r--r-- | shell/e-shortcuts.c | 43 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 94 | ||||
-rw-r--r-- | shell/e-storage-set.c | 19 | ||||
-rw-r--r-- | shell/e-storage.c | 89 | ||||
-rw-r--r-- | shell/e-storage.h | 22 | ||||
-rw-r--r-- | shell/evolution-storage.c | 33 | ||||
-rw-r--r-- | shell/evolution-storage.h | 24 |
17 files changed, 192 insertions, 342 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index fd976a604c..4b4ff3691a 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,65 @@ +2002-03-07 Dan Winship <danw@ximian.com> + + 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. + 2002-03-06 Dan Winship <danw@ximian.com> * e-storage.c: Keep the storage name and display_name in diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl index 68758ff009..82e93f4d6f 100644 --- a/shell/Evolution-Storage.idl +++ b/shell/Evolution-Storage.idl @@ -99,12 +99,8 @@ module Evolution { string name; }; - /* FIXME: The toplevel attributes should probably be attributes - of the storage instead of being passed here. */ StorageListener addStorage (in Storage storage, - in string name, - in string toplevel_node_uri, - in string toplevel_node_type) + in string name) raises (Exists); Storage getStorageByName (in string name) diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c index f528019f93..6086bda60e 100644 --- a/shell/e-corba-storage-registry.c +++ b/shell/e-corba-storage-registry.c @@ -100,8 +100,6 @@ static GNOME_Evolution_StorageListener impl_StorageRegistry_addStorage (PortableServer_Servant servant, const GNOME_Evolution_Storage storage_interface, const CORBA_char *name, - const CORBA_char *toplevel_node_uri, - const CORBA_char *toplevel_node_type, CORBA_Environment *ev) { BonoboObject *bonobo_object; @@ -114,15 +112,7 @@ impl_StorageRegistry_addStorage (PortableServer_Servant servant, storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object); priv = storage_registry->priv; - if (toplevel_node_uri[0] == '\0') - toplevel_node_uri = NULL; - if (toplevel_node_type[0] == '\0') - toplevel_node_type = NULL; - - storage = e_corba_storage_new (toplevel_node_uri, - toplevel_node_type, - storage_interface, - name); + storage = e_corba_storage_new (storage_interface, name); if (! e_storage_set_add_storage (priv->storage_set, storage)) { CORBA_exception_set (ev, diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c index 9601d1d89d..28238b68d6 100644 --- a/shell/e-corba-storage.c +++ b/shell/e-corba-storage.c @@ -490,13 +490,12 @@ init (ECorbaStorage *corba_storage) /* FIXME: OK to have a boolean construct function? */ void e_corba_storage_construct (ECorbaStorage *corba_storage, - const char *toplevel_node_uri, - const char *toplevel_node_type, const GNOME_Evolution_Storage storage_interface, const char *name) { ECorbaStoragePrivate *priv; CORBA_Environment ev; + EFolder *root_folder; g_return_if_fail (corba_storage != NULL); g_return_if_fail (E_IS_CORBA_STORAGE (corba_storage)); @@ -504,8 +503,8 @@ e_corba_storage_construct (ECorbaStorage *corba_storage, g_return_if_fail (name != NULL); /* FIXME: Need separate name and display name. */ - e_storage_construct (E_STORAGE (corba_storage), name, name, - toplevel_node_uri, toplevel_node_type); + root_folder = e_folder_new (name, "noselect", ""); + e_storage_construct (E_STORAGE (corba_storage), name, root_folder); priv = corba_storage->priv; @@ -523,9 +522,7 @@ e_corba_storage_construct (ECorbaStorage *corba_storage, } EStorage * -e_corba_storage_new (const char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_Evolution_Storage storage_interface, +e_corba_storage_new (const GNOME_Evolution_Storage storage_interface, const char *name) { EStorage *new; @@ -536,8 +533,6 @@ e_corba_storage_new (const char *toplevel_node_uri, new = gtk_type_new (e_corba_storage_get_type ()); e_corba_storage_construct (E_CORBA_STORAGE (new), - toplevel_node_uri, - toplevel_node_type, storage_interface, name); return new; diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h index 843e41c92e..432214f170 100644 --- a/shell/e-corba-storage.h +++ b/shell/e-corba-storage.h @@ -56,13 +56,9 @@ struct _ECorbaStorageClass { GtkType e_corba_storage_get_type (void); void e_corba_storage_construct (ECorbaStorage *corba_storage, - const char *toplevel_node_uri, - const char *toplevel_node_type, const GNOME_Evolution_Storage storage_interface, const char *name); -EStorage *e_corba_storage_new (const char *toplevel_node_uri, - const char *toplevel_node_type, - const GNOME_Evolution_Storage storage_interface, +EStorage *e_corba_storage_new (const GNOME_Evolution_Storage storage_interface, const char *name); GNOME_Evolution_Storage e_corba_storage_get_corba_objref (ECorbaStorage *corba_storage); diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c index 0368b4b23f..d89476df2e 100644 --- a/shell/e-folder-tree.c +++ b/shell/e-folder-tree.c @@ -177,7 +177,6 @@ e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, void *closure) { EFolderTree *new; - Folder *root_folder; new = g_new (EFolderTree, 1); @@ -187,9 +186,7 @@ e_folder_tree_new (EFolderDestroyNotify folder_destroy_notify, new->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal); new->data_to_path = g_hash_table_new (g_direct_hash, g_direct_equal); - root_folder = folder_new (G_DIR_SEPARATOR_S, NULL); - g_hash_table_insert (new->path_to_folder, root_folder->path, root_folder); - g_hash_table_insert (new->data_to_path, root_folder->data, root_folder->path); + e_folder_tree_add (new, G_DIR_SEPARATOR_S, NULL); return new; } @@ -240,6 +237,23 @@ e_folder_tree_add (EFolderTree *folder_tree, g_return_val_if_fail (path != NULL, FALSE); g_return_val_if_fail (g_path_is_absolute (path), FALSE); + /* Can only "add" a new root folder if the tree is empty */ + if (! strcmp (path, G_DIR_SEPARATOR_S)) { + folder = g_hash_table_lookup (folder_tree->path_to_folder, path); + if (folder) { + if (folder->subfolders) { + g_warning ("e_folder_tree_add() -- Trying to change root folder after adding children"); + return FALSE; + } + remove_folder (folder_tree, folder); + } + + folder = folder_new (path, data); + g_hash_table_insert (folder_tree->path_to_folder, folder->path, folder); + g_hash_table_insert (folder_tree->data_to_path, data, folder->path); + return TRUE; + } + parent_path = get_parent_path (path); parent_folder = g_hash_table_lookup (folder_tree->path_to_folder, parent_path); diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 95175106ac..70bcabf6b1 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -1016,11 +1016,13 @@ construct (ELocalStorage *local_storage, const char *base_path) { ELocalStoragePrivate *priv; + EFolder *root_folder; int base_path_len; + root_folder = e_folder_new (U_("Local Folders"), "noselect", ""); e_storage_construct (E_STORAGE (local_storage), - E_LOCAL_STORAGE_NAME, U_("Local Folders"), - NULL, NULL); + E_LOCAL_STORAGE_NAME, + root_folder); priv = local_storage->priv; @@ -1038,8 +1040,7 @@ construct (ELocalStorage *local_storage, priv->base_path = g_strndup (base_path, base_path_len); g_assert (priv->bonobo_interface == NULL); - priv->bonobo_interface = evolution_storage_new (E_LOCAL_STORAGE_NAME, - NULL, NULL); + priv->bonobo_interface = evolution_storage_new (E_LOCAL_STORAGE_NAME); gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "create_folder", GTK_SIGNAL_FUNC (bonobo_interface_create_folder_cb), diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 29d815db97..f822dfc228 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1802,30 +1802,19 @@ update_for_current_uri (EShellView *shell_view) path = get_storage_set_path_from_uri (priv->uri); + folder = NULL; folder_name = NULL; type = NULL; unread_count = 0; - if (path == NULL) { - folder = NULL; - } else { + if (path != NULL) { folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path); if (folder != NULL) { folder_name = e_folder_get_name (folder); type = e_folder_get_type_string (folder); unread_count = e_folder_get_unread_count (folder); - } else if (path != NULL) { - EStorage *storage; - - storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1); - unread_count = 0; - - if (storage != NULL) { - folder_name = e_storage_get_display_name (storage); - type = e_storage_get_toplevel_node_type (storage); - } - } + } } if (unread_count > 0) @@ -2020,17 +2009,10 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data) path = get_storage_set_path_from_uri (uri); folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path); - if (folder != NULL) { + if (folder != NULL) folder_type = e_folder_get_type_string (folder); - } else { - EStorage *storage; - - storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1); - if (storage == NULL) - folder_type = NULL; - else - folder_type = e_storage_get_toplevel_node_type (storage); - } + else + folder_type = NULL; /* See if we were actively viewing the uri for the socket that's being closed */ current_uri = e_shell_view_get_current_uri (shell_view); @@ -2055,27 +2037,6 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data) static const char * -get_type_for_storage (EShellView *shell_view, - const char *name, - const char **physical_uri_return) -{ - EShellViewPrivate *priv; - EStorageSet *storage_set; - EStorage *storage; - - priv = shell_view->priv; - - storage_set = e_shell_get_storage_set (priv->shell); - storage = e_storage_set_get_storage (storage_set, name); - if (!storage) - return NULL; - - *physical_uri_return = e_storage_get_toplevel_node_uri (storage); - - return e_storage_get_toplevel_node_type (storage); -} - -static const char * get_type_for_folder (EShellView *shell_view, const char *path, const char **physical_uri_return) @@ -2112,7 +2073,6 @@ get_view_for_uri (EShellView *shell_view, GtkWidget *socket; Bonobo_Control corba_control; const char *path; - const char *slash; const char *physical_uri; const char *folder_type; int destroy_connection_id; @@ -2127,13 +2087,8 @@ get_view_for_uri (EShellView *shell_view, if (*path == '\0') return NULL; - /* FIXME: This code needs to be made more robust. */ - slash = strchr (path + 1, G_DIR_SEPARATOR); - if (slash == NULL || slash[1] == '\0') - folder_type = get_type_for_storage (shell_view, path + 1, &physical_uri); - else - folder_type = get_type_for_folder (shell_view, path, &physical_uri); - if (folder_type == NULL) + folder_type = get_type_for_folder (shell_view, path, &physical_uri); + if (folder_type == NULL || strcmp (folder_type, "noselect") == 0) return NULL; folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view)); diff --git a/shell/e-shell.c b/shell/e-shell.c index 8b137adc68..29340d41cd 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -639,6 +639,7 @@ setup_local_storage (EShell *shell) EStorage *local_storage; EShellPrivate *priv; gchar *local_storage_path; + EFolder *summary_folder; priv = shell->priv; @@ -657,9 +658,10 @@ setup_local_storage (EShell *shell) e_storage_set_add_storage (priv->storage_set, local_storage); priv->local_storage = E_LOCAL_STORAGE (local_storage); + summary_folder = e_folder_new (U_("Summary"), "summary", ""); + e_folder_set_physical_uri (summary_folder, "/"); priv->summary_storage = e_storage_new (E_SUMMARY_STORAGE_NAME, - U_("Summary"), - "/", "summary"); + summary_folder); e_storage_set_add_storage (priv->storage_set, priv->summary_storage); return TRUE; diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index 29c2a7e0c6..a5aee5eb12 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -482,7 +482,6 @@ get_shortcut_info (EShortcutsView *shortcuts_view, { EShortcutsViewPrivate *priv; EStorageSet *storage_set; - EStorage *storage; EFolder *folder; const char *path; @@ -501,18 +500,10 @@ get_shortcut_info (EShortcutsView *shortcuts_view, if (folder != NULL) { *unread_count_return = e_folder_get_unread_count (folder); *type_return = e_folder_get_type_string (folder); - return; - } - - storage = e_storage_set_get_storage (storage_set, path + 1); - if (storage != NULL) { + } else { *unread_count_return = 0; - *type_return = e_storage_get_toplevel_node_type (storage); - return; + *type_return = NULL; } - - *unread_count_return = 0; - *type_return = NULL; } static void diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c index 3b155f0acc..b231bc4df2 100644 --- a/shell/e-shortcuts.c +++ b/shell/e-shortcuts.c @@ -328,51 +328,32 @@ load_shortcuts (EShortcuts *shortcuts, continue; uri = xmlNodeListGetString (doc, q->childs, 1); - name = xmlGetProp (q, "name"); - type = xmlGetProp (q, "type"); + if (uri == NULL) + continue; - if (uri != NULL && strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { + if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { EFolder *folder; folder = e_storage_set_get_folder (priv->storage_set, uri + E_SHELL_URI_PREFIX_LEN); if (folder != NULL) { - if (type != NULL) - xmlFree (type); + name = xmlMemStrdup (e_folder_get_name (folder)); type = xmlMemStrdup (e_folder_get_type_string (folder)); } else { - EStorage *storage; - const char *storage_type; - - storage = e_storage_set_get_storage (priv->storage_set, - uri + E_SHELL_URI_PREFIX_LEN + 1); - if (storage != NULL) { - if (type != NULL) - xmlFree (type); - storage_type = e_storage_get_toplevel_node_type (storage); - - if (storage_type == NULL) - type = NULL; - else - type = xmlMemStrdup (storage_type); - - if (name != NULL) - xmlFree (name); - - name = xmlMemStrdup (e_storage_get_display_name (storage)); - } + name = xmlGetProp (q, "name"); + type = xmlGetProp (q, "type"); } shortcut_item = shortcut_item_new (uri, name, 0, type); shortcut_group->shortcuts = g_slist_prepend (shortcut_group->shortcuts, shortcut_item); + + if (name != NULL) + xmlFree (name); + if (type != NULL) + xmlFree (type); } - if (uri != NULL) - xmlFree (uri); - if (name != NULL) - xmlFree (name); - if (type != NULL) - xmlFree (type); + xmlFree (uri); } shortcut_group->shortcuts = g_slist_reverse (shortcut_group->shortcuts); 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 diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 84748d70c2..bbe9f5a718 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -219,22 +219,23 @@ get_storage_for_path (EStorageSet *storage_set, const char *first_separator; g_return_val_if_fail (g_path_is_absolute (path), NULL); + g_return_val_if_fail (path[1] != G_DIR_SEPARATOR, NULL); /* Skip initial separator. */ path++; first_separator = strchr (path, G_DIR_SEPARATOR); - if (first_separator == NULL || first_separator == path || first_separator[1] == 0) { - *subpath_return = NULL; - return NULL; - } + if (first_separator == NULL || first_separator[1] == 0) { + storage = e_storage_set_get_storage (storage_set, path); + *subpath_return = G_DIR_SEPARATOR_S; + } else { + storage_name = g_strndup (path, first_separator - path); + storage = e_storage_set_get_storage (storage_set, storage_name); + g_free (storage_name); - storage_name = g_strndup (path, first_separator - path); - storage = e_storage_set_get_storage (storage_set, storage_name); - g_free (storage_name); - - *subpath_return = first_separator; + *subpath_return = first_separator; + } return storage; } diff --git a/shell/e-storage.c b/shell/e-storage.c index 7b55145d6e..4efc069193 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -52,15 +52,6 @@ struct _EStoragePrivate { /* Internal name of the storage */ char *name; - - /* User-visible localized UTF-8 name */ - char *display_name; - - /* URI for the toplevel node. */ - char *toplevel_node_uri; - - /* Toplevel node type. */ - char *toplevel_node_type; }; enum { @@ -148,9 +139,6 @@ destroy (GtkObject *object) e_folder_tree_destroy (priv->folder_tree); g_free (priv->name); - g_free (priv->display_name); - g_free (priv->toplevel_node_uri); - g_free (priv->toplevel_node_type); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -189,12 +177,6 @@ impl_get_name (EStorage *storage) return storage->priv->name; } -static const char * -impl_get_display_name (EStorage *storage) -{ - return storage->priv->display_name; -} - static void impl_async_create_folder (EStorage *storage, const char *path, @@ -242,7 +224,6 @@ class_init (EStorageClass *class) class->get_subfolder_paths = impl_get_subfolder_paths; class->get_folder = impl_get_folder; class->get_name = impl_get_name; - class->get_display_name = impl_get_display_name; class->async_create_folder = impl_async_create_folder; class->async_remove_folder = impl_async_remove_folder; class->async_xfer_folder = impl_async_xfer_folder; @@ -282,9 +263,8 @@ init (EStorage *storage) priv = g_new (EStoragePrivate, 1); - priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL); - priv->toplevel_node_uri = NULL; - priv->toplevel_node_type = NULL; + priv->folder_tree = e_folder_tree_new (folder_destroy_notify, NULL); + priv->name = NULL; storage->priv = priv; } @@ -295,9 +275,7 @@ init (EStorage *storage) void e_storage_construct (EStorage *storage, const char *name, - const char *display_name, - const char *toplevel_node_uri, - const char *toplevel_node_type) + EFolder *root_folder) { EStoragePrivate *priv; @@ -307,25 +285,21 @@ e_storage_construct (EStorage *storage, priv = storage->priv; priv->name = g_strdup (name); - priv->display_name = g_strdup (display_name); - priv->toplevel_node_uri = g_strdup (toplevel_node_uri); - priv->toplevel_node_type = g_strdup (toplevel_node_type); + + e_storage_new_folder (storage, "/", root_folder); GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (storage), GTK_FLOATING); } EStorage * e_storage_new (const char *name, - const char *display_name, - const char *toplevel_node_uri, - const char *toplevel_node_type) + EFolder *root_folder) { EStorage *new; new = gtk_type_new (e_storage_get_type ()); - e_storage_construct (new, name, display_name, - toplevel_node_uri, toplevel_node_type); + e_storage_construct (new, name, root_folder); return new; } @@ -381,55 +355,6 @@ e_storage_get_name (EStorage *storage) return (* ES_CLASS (storage)->get_name) (storage); } -const char * -e_storage_get_display_name (EStorage *storage) -{ - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - return (* ES_CLASS (storage)->get_display_name) (storage); -} - -/** - * e_storage_get_toplevel_node_uri: - * @storage: A pointer to an EStorage object - * - * Get the physical URI for the toplevel node in the storage. - * - * Return value: a pointer to a string representing that URI. - **/ -const char * -e_storage_get_toplevel_node_uri (EStorage *storage) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - priv = storage->priv; - return priv->toplevel_node_uri; -} - -/** - * e_storage_get_toplevel_node_type: - * @storage: A pointer to an EStorage object. - * - * Get the folder type for the toplevel node. - * - * Return value: A string identifying the type of the toplevel node. - **/ -const char * -e_storage_get_toplevel_node_type (EStorage *storage) -{ - EStoragePrivate *priv; - - g_return_val_if_fail (storage != NULL, NULL); - g_return_val_if_fail (E_IS_STORAGE (storage), NULL); - - priv = storage->priv; - return priv->toplevel_node_type; -} - /* Folder operations. */ diff --git a/shell/e-storage.h b/shell/e-storage.h index 9a64732503..878aabeee5 100644 --- a/shell/e-storage.h +++ b/shell/e-storage.h @@ -86,7 +86,6 @@ struct _EStorageClass { GList * (* get_subfolder_paths) (EStorage *storage, const char *path); EFolder * (* get_folder) (EStorage *storage, const char *path); const char * (* get_name) (EStorage *storage); - const char * (* get_display_name) (EStorage *storage); void (* async_create_folder) (EStorage *storage, const char *path, @@ -109,16 +108,12 @@ struct _EStorageClass { }; -GtkType e_storage_get_type (void); -void e_storage_construct (EStorage *storage, - const char *name, - const char *display_name, - const char *toplevel_node_uri, - const char *toplevel_node_type); -EStorage *e_storage_new (const char *name, - const char *display_name, - const char *toplevel_node_uri, - const char *toplevel_node_type); +GtkType e_storage_get_type (void); +void e_storage_construct (EStorage *storage, + const char *name, + EFolder *root_folder); +EStorage *e_storage_new (const char *name, + EFolder *root_folder); gboolean e_storage_path_is_relative (const char *path); gboolean e_storage_path_is_absolute (const char *path); @@ -128,10 +123,7 @@ GList *e_storage_get_subfolder_paths (EStorage *storage, EFolder *e_storage_get_folder (EStorage *storage, const char *path); -const char *e_storage_get_name (EStorage *storage); -const char *e_storage_get_display_name (EStorage *storage); -const char *e_storage_get_toplevel_node_uri (EStorage *storage); -const char *e_storage_get_toplevel_node_type (EStorage *storage); +const char *e_storage_get_name (EStorage *storage); /* Folder operations. */ diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 9958714cc4..313e4fb2a6 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -47,12 +47,6 @@ struct _EvolutionStoragePrivate { /* What we will display as the name of the storage. */ char *display_name; - /* URI for the toplevel node of the storage. */ - char *toplevel_node_uri; - - /* Type for the toplevel node of the storage. */ - char *toplevel_node_type; - /* The set of folders we have in this storage. */ EFolderTree *folder_tree; @@ -78,15 +72,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; /* Utility functions. */ -static const CORBA_char * -safe_corba_string (const char *s) -{ - if (s == NULL) - return (CORBA_char *) ""; - - return s; -} - static void list_through_listener_foreach (EFolderTree *tree, const char *path, @@ -420,8 +405,6 @@ destroy (GtkObject *object) priv = storage->priv; g_free (priv->name); - g_free (priv->toplevel_node_uri); - g_free (priv->toplevel_node_type); if (priv->folder_tree != NULL) e_folder_tree_destroy (priv->folder_tree); if (priv->uri_to_path != NULL) { @@ -581,8 +564,6 @@ init (EvolutionStorage *storage) priv = g_new (EvolutionStoragePrivate, 1); priv->name = NULL; - priv->toplevel_node_uri = NULL; - priv->toplevel_node_type = NULL; priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage); priv->uri_to_path = g_hash_table_new (g_str_hash, g_str_equal); priv->corba_storage_listeners = NULL; @@ -611,9 +592,7 @@ evolution_storage_get_epv (void) void evolution_storage_construct (EvolutionStorage *storage, GNOME_Evolution_Storage corba_object, - const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type) + const char *name) { EvolutionStoragePrivate *priv; CORBA_Environment ev; @@ -630,16 +609,12 @@ evolution_storage_construct (EvolutionStorage *storage, priv = storage->priv; priv->name = g_strdup (name); - priv->toplevel_node_uri = g_strdup (toplevel_node_uri); - priv->toplevel_node_type = g_strdup (toplevel_node_type); CORBA_exception_free (&ev); } EvolutionStorage * -evolution_storage_new (const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type) +evolution_storage_new (const char *name) { EvolutionStorage *new; POA_GNOME_Evolution_Storage *servant; @@ -655,7 +630,7 @@ evolution_storage_new (const char *name, new = gtk_type_new (evolution_storage_get_type ()); corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - evolution_storage_construct (new, corba_object, name, toplevel_node_uri, toplevel_node_type); + evolution_storage_construct (new, corba_object, name); return new; } @@ -695,8 +670,6 @@ evolution_storage_register (EvolutionStorage *evolution_storage, corba_storage_listener = GNOME_Evolution_StorageRegistry_addStorage (corba_storage_registry, corba_storage, priv->name, - safe_corba_string (priv->toplevel_node_uri), - safe_corba_string (priv->toplevel_node_type), &ev); if (ev._major == CORBA_NO_EXCEPTION) { diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h index c0ef46a300..aec35e15d8 100644 --- a/shell/evolution-storage.h +++ b/shell/evolution-storage.h @@ -107,25 +107,21 @@ struct _EvolutionStorageClass { POA_GNOME_Evolution_Storage__epv *evolution_storage_get_epv (void); -GtkType evolution_storage_get_type (void); -void evolution_storage_construct (EvolutionStorage *storage, - GNOME_Evolution_Storage corba_object, - const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type); -EvolutionStorage *evolution_storage_new (const char *name, - const char *toplevel_node_uri, - const char *toplevel_node_type); - -void evolution_storage_rename (EvolutionStorage *storage, - const char *new_name); +GtkType evolution_storage_get_type (void); +void evolution_storage_construct (EvolutionStorage *storage, + GNOME_Evolution_Storage corba_object, + const char *name); +EvolutionStorage *evolution_storage_new (const char *name); + +void evolution_storage_rename (EvolutionStorage *storage, + const char *new_name); EvolutionStorageResult evolution_storage_register (EvolutionStorage *storage, GNOME_Evolution_StorageRegistry corba_registry); EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, GNOME_Evolution_Shell corba_shell); -EvolutionStorageResult evolution_storage_deregister_on_shell (EvolutionStorage *storage, - GNOME_Evolution_Shell corba_shell); +EvolutionStorageResult evolution_storage_deregister_on_shell (EvolutionStorage *storage, + GNOME_Evolution_Shell corba_shell); EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage, const char *path, const char *display_name, |