Make EvolutionStorage' and
ELocalstorage' actually update the CORBA
listeners and fix a bug with the creation of the `EvolutionStorageListener' servant. svn path=/trunk/; revision=5334
This commit is contained in:
@ -1,3 +1,27 @@
|
|||||||
|
2000-09-11 Ettore Perazzoli <ettore@helixcode.com>
|
||||||
|
|
||||||
|
* evolution-storage.c (evolution_storage_new_folder): If
|
||||||
|
description is NULL, use the empty string instead.
|
||||||
|
|
||||||
|
* e-local-storage.c (new_folder): New utility function to add a
|
||||||
|
new folder by keeping both the Bonobo interface and the EStorage
|
||||||
|
up-to-date.
|
||||||
|
(load_folders): Use it here instead of just
|
||||||
|
`e_storage_new_folder()'.
|
||||||
|
(component_async_create_folder_callback): Likewise.
|
||||||
|
|
||||||
|
* e-shell-view.c (update_for_current_uri): Prevent an
|
||||||
|
EStorageSetView warning if the path is NULL.
|
||||||
|
|
||||||
|
* evolution-storage.c (impl_Storage_add_listener): New,
|
||||||
|
implementation for `Evolution::Storage::add_listener'.
|
||||||
|
(evolution_storage_get_epv): Install it.
|
||||||
|
|
||||||
|
* evolution-storage-listener.c
|
||||||
|
(evolution_storage_listener_corba_objref): New.
|
||||||
|
(create_servant): Create the servant with `g_new0()' instead of
|
||||||
|
`g_new()'.
|
||||||
|
|
||||||
2000-09-11 Ettore Perazzoli <ettore@helixcode.com>
|
2000-09-11 Ettore Perazzoli <ettore@helixcode.com>
|
||||||
|
|
||||||
* evolution-storage-listener.c
|
* evolution-storage-listener.c
|
||||||
|
@ -372,7 +372,7 @@ e_folder_tree_foreach (EFolderTree *folder_tree,
|
|||||||
root_node = g_hash_table_lookup (folder_tree->path_to_folder,
|
root_node = g_hash_table_lookup (folder_tree->path_to_folder,
|
||||||
G_DIR_SEPARATOR_S);
|
G_DIR_SEPARATOR_S);
|
||||||
if (root_node == NULL) {
|
if (root_node == NULL) {
|
||||||
g_warning ("%s -- What?! No root node!?", __FUNCTION__);
|
g_warning ("e_folder_tree_foreach -- What?! No root node!?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
* - If the LocalStorage is destroyed and an async operation on a shell component is
|
* - If the LocalStorage is destroyed and an async operation on a shell component is
|
||||||
* pending, we get a callback on a bogus object. We need support for cancelling
|
* pending, we get a callback on a bogus object. We need support for cancelling
|
||||||
* operations on the shell component.
|
* operations on the shell component.
|
||||||
|
*
|
||||||
|
* - The tree is kept both in the EStorage and the EvolutionStorage. Very
|
||||||
|
* bad design.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -151,6 +154,27 @@ get_physical_path (ELocalStorage *local_storage,
|
|||||||
return real_path;
|
return real_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
new_folder (ELocalStorage *local_storage,
|
||||||
|
const char *path,
|
||||||
|
EFolder *folder)
|
||||||
|
{
|
||||||
|
ELocalStoragePrivate *priv;
|
||||||
|
|
||||||
|
priv = local_storage->priv;
|
||||||
|
|
||||||
|
g_print ("%s:%s -- %s\n", __FILE__, __FUNCTION__, path);
|
||||||
|
|
||||||
|
e_storage_new_folder (E_STORAGE (local_storage), path, folder);
|
||||||
|
|
||||||
|
evolution_storage_new_folder (EVOLUTION_STORAGE (priv->bonobo_interface),
|
||||||
|
path,
|
||||||
|
e_folder_get_name (folder),
|
||||||
|
e_folder_get_type_string (folder),
|
||||||
|
e_folder_get_physical_uri (folder),
|
||||||
|
e_folder_get_description (folder));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
load_folders (ELocalStorage *local_storage,
|
load_folders (ELocalStorage *local_storage,
|
||||||
const char *parent_path,
|
const char *parent_path,
|
||||||
@ -174,7 +198,7 @@ load_folders (ELocalStorage *local_storage,
|
|||||||
if (folder == NULL)
|
if (folder == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
e_storage_new_folder (E_STORAGE (local_storage), path, folder);
|
new_folder (E_STORAGE (local_storage), path, folder);
|
||||||
|
|
||||||
subfolder_directory_path = g_concat_dir_and_file (physical_path, SUBFOLDER_DIR_NAME);
|
subfolder_directory_path = g_concat_dir_and_file (physical_path, SUBFOLDER_DIR_NAME);
|
||||||
}
|
}
|
||||||
@ -334,9 +358,7 @@ component_async_create_folder_callback (EvolutionShellComponentClient *shell_com
|
|||||||
e_folder_set_physical_uri (folder, callback_data->physical_uri);
|
e_folder_set_physical_uri (folder, callback_data->physical_uri);
|
||||||
|
|
||||||
if (e_local_folder_save (E_LOCAL_FOLDER (folder))) {
|
if (e_local_folder_save (E_LOCAL_FOLDER (folder))) {
|
||||||
e_storage_new_folder (callback_data->storage,
|
new_folder (callback_data->storage, callback_data->path, folder);
|
||||||
callback_data->path,
|
|
||||||
folder);
|
|
||||||
} else {
|
} else {
|
||||||
rmdir (callback_data->physical_path);
|
rmdir (callback_data->physical_path);
|
||||||
gtk_object_unref (GTK_OBJECT (folder));
|
gtk_object_unref (GTK_OBJECT (folder));
|
||||||
|
@ -951,8 +951,10 @@ update_for_current_uri (EShellView *shell_view)
|
|||||||
gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view),
|
gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view),
|
||||||
GTK_SIGNAL_FUNC (folder_selected_cb),
|
GTK_SIGNAL_FUNC (folder_selected_cb),
|
||||||
shell_view);
|
shell_view);
|
||||||
e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view),
|
|
||||||
path);
|
if (path != NULL)
|
||||||
|
e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), path);
|
||||||
|
|
||||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (priv->storage_set_view),
|
gtk_signal_handler_unblock_by_func (GTK_OBJECT (priv->storage_set_view),
|
||||||
GTK_SIGNAL_FUNC (folder_selected_cb),
|
GTK_SIGNAL_FUNC (folder_selected_cb),
|
||||||
shell_view);
|
shell_view);
|
||||||
|
@ -115,7 +115,7 @@ create_servant (EvolutionStorageListener *listener)
|
|||||||
|
|
||||||
CORBA_exception_init (&ev);
|
CORBA_exception_init (&ev);
|
||||||
|
|
||||||
servant = g_new (EvolutionStorageListenerServant, 1);
|
servant = g_new0 (EvolutionStorageListenerServant, 1);
|
||||||
corba_servant = (POA_Evolution_StorageListener *) servant;
|
corba_servant = (POA_Evolution_StorageListener *) servant;
|
||||||
|
|
||||||
corba_servant->vepv = &my_Evolution_StorageListener_vepv;
|
corba_servant->vepv = &my_Evolution_StorageListener_vepv;
|
||||||
@ -301,6 +301,28 @@ evolution_storage_listener_new (void)
|
|||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* evolution_storage_listener_corba_objref:
|
||||||
|
* @listener: A pointer to an EvolutionStorageListener
|
||||||
|
*
|
||||||
|
* Get the CORBA object reference for the interface embedded in this GTK+
|
||||||
|
* object wrapper.
|
||||||
|
*
|
||||||
|
* Return value: A pointer to the CORBA object reference.
|
||||||
|
**/
|
||||||
|
Evolution_StorageListener
|
||||||
|
evolution_storage_listener_corba_objref (EvolutionStorageListener *listener)
|
||||||
|
{
|
||||||
|
EvolutionStorageListenerPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (listener != NULL, CORBA_OBJECT_NIL);
|
||||||
|
g_return_val_if_fail (EVOLUTION_IS_STORAGE_LISTENER (listener), CORBA_OBJECT_NIL);
|
||||||
|
|
||||||
|
priv = listener->priv;
|
||||||
|
return priv->corba_objref;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
E_MAKE_TYPE (evolution_storage_listener, "EvolutionStorageListener", EvolutionStorageListener,
|
E_MAKE_TYPE (evolution_storage_listener, "EvolutionStorageListener", EvolutionStorageListener,
|
||||||
class_init, init, PARENT_TYPE)
|
class_init, init, PARENT_TYPE)
|
||||||
|
@ -79,6 +79,8 @@ void evolution_storage_listener_construct (EvolutionStorag
|
|||||||
Evolution_StorageListener corba_objref);
|
Evolution_StorageListener corba_objref);
|
||||||
EvolutionStorageListener *evolution_storage_listener_new (void);
|
EvolutionStorageListener *evolution_storage_listener_new (void);
|
||||||
|
|
||||||
|
Evolution_StorageListener evolution_storage_listener_corba_objref (EvolutionStorageListener *listener);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -172,6 +172,20 @@ impl_Storage__get_name (PortableServer_Servant servant,
|
|||||||
return CORBA_string_dup (priv->name);
|
return CORBA_string_dup (priv->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
impl_Storage_add_listener (PortableServer_Servant servant,
|
||||||
|
const Evolution_StorageListener listener,
|
||||||
|
CORBA_Environment *ev)
|
||||||
|
{
|
||||||
|
BonoboObject *bonobo_object;
|
||||||
|
EvolutionStorage *storage;
|
||||||
|
|
||||||
|
bonobo_object = bonobo_object_from_servant (servant);
|
||||||
|
storage = EVOLUTION_STORAGE (bonobo_object);
|
||||||
|
|
||||||
|
add_listener (storage, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* GtkObject methods. */
|
/* GtkObject methods. */
|
||||||
|
|
||||||
@ -265,6 +279,7 @@ evolution_storage_get_epv (void)
|
|||||||
|
|
||||||
epv = g_new0 (POA_Evolution_Storage__epv, 1);
|
epv = g_new0 (POA_Evolution_Storage__epv, 1);
|
||||||
epv->_get_name = impl_Storage__get_name;
|
epv->_get_name = impl_Storage__get_name;
|
||||||
|
epv->add_listener = impl_Storage_add_listener;
|
||||||
|
|
||||||
return epv;
|
return epv;
|
||||||
}
|
}
|
||||||
@ -411,10 +426,12 @@ evolution_storage_new_folder (EvolutionStorage *evolution_storage,
|
|||||||
EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
||||||
g_return_val_if_fail (path != NULL, 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 (g_path_is_absolute (path), EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
||||||
g_return_val_if_fail (description != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
|
||||||
g_return_val_if_fail (type != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
g_return_val_if_fail (type != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
||||||
g_return_val_if_fail (physical_uri != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
g_return_val_if_fail (physical_uri != NULL, EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER);
|
||||||
|
|
||||||
|
if (description == NULL)
|
||||||
|
description = "";
|
||||||
|
|
||||||
priv = evolution_storage->priv;
|
priv = evolution_storage->priv;
|
||||||
|
|
||||||
CORBA_exception_init (&ev);
|
CORBA_exception_init (&ev);
|
||||||
|
Reference in New Issue
Block a user