diff options
author | Dan Winship <danw@src.gnome.org> | 2002-03-15 06:22:35 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-03-15 06:22:35 +0800 |
commit | 86b700d089bfb9565c3792ff3df1a1ac6cf225c3 (patch) | |
tree | 73a4b5104266850b756b8d9e6dbcefc17904f68a /shell/evolution-storage.c | |
parent | eafda9ba48e7f29a9f98792a498eb9c568f81d59 (diff) | |
download | gsoc2013-evolution-86b700d089bfb9565c3792ff3df1a1ac6cf225c3.tar.gz gsoc2013-evolution-86b700d089bfb9565c3792ff3df1a1ac6cf225c3.tar.zst gsoc2013-evolution-86b700d089bfb9565c3792ff3df1a1ac6cf225c3.zip |
Support for delayed filling-in of storages/folders.
* Evolution-Storage.idl (StorageListener): add
notifyHasSubfolders, to announce that a folder has currently-
unknown subfolders.
(Storage): add asyncOpenFolder, to request that previously-
announced subfolders be filled in.
* evolution-storage.c (impl_Storage_async_open_folder): emit
OPEN_FOLDER.
(evolution_storage_has_subfolders): Implement by calling
notifyHasSubfolders on all of its listeners.
* evolution-storage-listener.c
(impl_GNOME_Evolution_StorageListener_notifyHasSubfolders): emit
HAS_SUBFOLDERS.
* e-corba-storage.c (impl_StorageListener_notifyHasSubfolders):
Implement by calling e_storage_has_subfolders.
(async_open_folder): Implement by calling asyncOpenFolder on the
CORBA storage.
* e-storage.c (EStoragePrivate, init, destroy): Keep a list of
pseudofolders representing un-filled-in subtrees.
(impl_async_open_folder): No-op default implementation
(e_storage_async_open_folder): New function to request that
un-filled-in subtrees be filled in.
(e_storage_new_folder): If the new folder's parent has an
"un-filled-in children" pseudofolder, remove it.
(e_storage_has_subfolders): New function to note that a folder has
unknown children. If the folder previously was marked as having
real children, remove them, and emit CLOSE_FOLDER to reset it back
to an a "unknown subfolders" state.
* e-storage-set.c (make_full_path): Make this deal with path being
"/", since that case gets used from storage_close_folder_cb
sometimes.
(storage_close_folder_cb): Proxy EStorage's CLOSE_FOLDER signal.
(storage_set_view_folder_opened): Handle EStorageSetView's
FOLDER_OPENED signal by calling e_storage_async_open_folder.
* e-storage-set-view.c (etree_fill_in_children): If the given node
is its parent's first child, emit FOLDER_OPENED for the parent.
(close_folder_cb): Handler for EStorageSet's CLOSE_FOLDER signal.
Ask the model to close that node.
(e_storage_set_view_construct): Set the default expanded state for
the tree to FALSE rather than TRUE, to prevent unwanted expansion
of delayed nodes. (This only affects the very first time the tree
is displayed anyway: after that its state is loaded off disk.)
* e-shell.c (e_shell_construct): Register the "noselect" type with
the folder type registry, so icon lookups on placeholder folders
will work.
svn path=/trunk/; revision=16169
Diffstat (limited to 'shell/evolution-storage.c')
-rw-r--r-- | shell/evolution-storage.c | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 313e4fb2a6..75d6935f1f 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -61,8 +61,9 @@ struct _EvolutionStoragePrivate { enum { CREATE_FOLDER, REMOVE_FOLDER, - UPDATE_FOLDER, XFER_FOLDER, + UPDATE_FOLDER, + OPEN_FOLDER, LAST_SIGNAL }; @@ -354,6 +355,20 @@ impl_Storage_updateFolder (PortableServer_Servant servant, } static void +impl_Storage_async_open_folder (PortableServer_Servant servant, + const CORBA_char *path, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + EvolutionStorage *storage; + + bonobo_object = bonobo_object_from_servant (servant); + storage = EVOLUTION_STORAGE (bonobo_object); + + gtk_signal_emit (GTK_OBJECT (storage), signals[OPEN_FOLDER], path); +} + +static void impl_Storage_add_listener (PortableServer_Servant servant, const GNOME_Evolution_StorageListener listener, CORBA_Environment *ev) @@ -552,6 +567,15 @@ class_init (EvolutionStorageClass *klass) GTK_TYPE_STRING, GTK_TYPE_INT); + signals[OPEN_FOLDER] = gtk_signal_new ("open_folder", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionStorageClass, + open_folder), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); corba_class_init (); @@ -582,6 +606,7 @@ evolution_storage_get_epv (void) epv->asyncCreateFolder = impl_Storage_async_create_folder; epv->asyncRemoveFolder = impl_Storage_async_remove_folder; epv->asyncXferFolder = impl_Storage_async_xfer_folder; + epv->asyncOpenFolder = impl_Storage_async_open_folder; epv->updateFolder = impl_Storage_updateFolder; epv->addListener = impl_Storage_add_listener; epv->removeListener = impl_Storage_remove_listener; @@ -1008,5 +1033,56 @@ evolution_storage_folder_exists (EvolutionStorage *evolution_storage, return e_folder_tree_get_folder (priv->folder_tree, path) != NULL; } +EvolutionStorageResult +evolution_storage_has_subfolders (EvolutionStorage *evolution_storage, + const char *path, + const char *message) +{ + EvolutionStorageResult result; + EvolutionStoragePrivate *priv; + CORBA_Environment ev; + GList *p; + + g_return_val_if_fail (evolution_storage != NULL, + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (path != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (message != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + + priv = evolution_storage->priv; + + if (priv->corba_storage_listeners == NULL) + return EVOLUTION_STORAGE_ERROR_NOTREGISTERED; + + CORBA_exception_init (&ev); + + result = EVOLUTION_STORAGE_OK; + + for (p = priv->corba_storage_listeners; p != NULL; p = p->next) { + GNOME_Evolution_StorageListener listener; + + listener = p->data; + GNOME_Evolution_StorageListener_notifyHasSubfolders (listener, path, message, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + continue; + if (ev._major != CORBA_USER_EXCEPTION) + result = EVOLUTION_STORAGE_ERROR_CORBA; + else if (strcmp (CORBA_exception_id (&ev), ex_GNOME_Evolution_StorageListener_NotFound) == 0) + result = EVOLUTION_STORAGE_ERROR_NOTFOUND; + else + result = EVOLUTION_STORAGE_ERROR_GENERIC; + + break; + } + + CORBA_exception_free (&ev); + + return result; +} + + E_MAKE_TYPE (evolution_storage, "EvolutionStorage", EvolutionStorage, class_init, init, PARENT_TYPE) |