From 602fee638e44de17ddd438d9327d7087c72bc41d Mon Sep 17 00:00:00 2001 From: Jason Leach Date: Sat, 23 Jun 2001 18:58:02 +0000 Subject: (Implemented deleting folders in the shell. Files changed that aren't (Implemented deleting folders in the shell. Files changed that aren't noted below were simply small indentation/space changes. To play with deleting folders, right click on a selected folder in the folder tree, then choose Delete.) 2001-06-23 Jason Leach * e-shell-folder-selection-dialog.c (e_shell_folder_selection_dialog_construct): Make the folder tree have a similar expanded state as the shell's folder tree. * e-local-storage.c (remove_folder): New function that does the meat of actual deletion stuff. (remove_folder_directory): A helper function that remove_folder() uses. (component_async_remove_folder_callback): A new callback to do the removing stuff from shell (if there weren't errors from the component). (impl_async_remove_folder): Implemented this. * evolution-shell-component-client.c (evolution_shell_component_client_async_remove_folder): Implemented this. * e-shell-view.c (e_shell_view_remove_control_for_uri): New function. svn path=/trunk/; revision=10446 --- shell/ChangeLog | 22 ++++ shell/e-corba-storage-registry.c | 2 + shell/e-corba-storage.c | 3 +- shell/e-local-storage.c | 191 +++++++++++++++++++++++++++---- shell/e-shell-folder-commands.c | 103 ++++++++++++++++- shell/e-shell-folder-selection-dialog.c | 11 ++ shell/e-shell-view.c | 50 ++++++-- shell/e-shell-view.h | 2 + shell/e-storage-set.c | 2 +- shell/e-storage.c | 6 +- shell/evolution-local-storage.c | 9 +- shell/evolution-session.c | 10 +- shell/evolution-shell-component-client.c | 40 ++++++- shell/evolution-shell-view.c | 4 +- 14 files changed, 404 insertions(+), 51 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 0219f0bd3f..fd68f5916c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,25 @@ +2001-06-23 Jason Leach + + * e-shell-folder-selection-dialog.c + (e_shell_folder_selection_dialog_construct): Make the folder tree + have a similar expanded state as the shell's folder tree. + + * e-local-storage.c (remove_folder): New function that does the + meat of actual deletion stuff. + (remove_folder_directory): A helper function that remove_folder() + uses. + (component_async_remove_folder_callback): A new callback to do the + removing stuff from shell (if there weren't errors from the + component). + (impl_async_remove_folder): Implemented this. + + * evolution-shell-component-client.c + (evolution_shell_component_client_async_remove_folder): + Implemented this. + + * e-shell-view.c (e_shell_view_remove_control_for_uri): New + function. + 2001-06-23 Ettore Perazzoli * e-shell-view.c (e_shell_view_set_current_shortcuts_group_num): diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c index 78dcf6234b..ae1b67ef13 100644 --- a/shell/e-corba-storage-registry.c +++ b/shell/e-corba-storage-registry.c @@ -123,6 +123,8 @@ impl_StorageRegistry_removeStorageByName (PortableServer_Servant servant, ECorbaStorageRegistryPrivate *priv; EStorage *storage; + g_print ("Shell: Removing storage -- %s\n", name); + bonobo_object = bonobo_object_from_servant (servant); storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object); priv = storage_registry->priv; diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c index 99fd265c17..d5faec2c72 100644 --- a/shell/e-corba-storage.c +++ b/shell/e-corba-storage.c @@ -393,7 +393,8 @@ async_remove_folder (EStorage *storage, const char *path, CORBA_exception_init (&ev); GNOME_Evolution_Storage_asyncRemoveFolder (priv->storage_interface, - path, e_folder_get_physical_uri (folder), + path, + e_folder_get_physical_uri (folder), corba_listener, &ev); if (ev._major != CORBA_NO_EXCEPTION) { diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 1cc856e70a..a508a9139e 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -189,7 +189,7 @@ notify_bonobo_listener (const Bonobo_Listener listener, any._value = &folder_result; CORBA_exception_init (&ev); - Bonobo_Listener_event (listener, "evolution-shell:folder_created", + Bonobo_Listener_event (listener, "result", &any, &ev); CORBA_exception_free (&ev); } @@ -384,9 +384,9 @@ create_folder (ELocalStorage *local_storage, callback_data->listener = listener; callback_data->callback = callback; callback_data->callback_data = data; - + bonobo_object_ref (BONOBO_OBJECT (component_client)); - + evolution_shell_component_client_async_create_folder (component_client, physical_uri, type, @@ -394,46 +394,170 @@ create_folder (ELocalStorage *local_storage, callback_data); } -#if 0 +struct _AsyncRemoveFolderCallbackData { + EStorage *storage; + Bonobo_Listener listener; + + char *path; + char *physical_path; +}; +typedef struct _AsyncRemoveFolderCallbackData AsyncRemoveFolderCallbackData; + +static void +component_async_remove_folder_callback (EvolutionShellComponentClient *shell_component_client, + EvolutionShellComponentResult result, + void *data) +{ + AsyncRemoveFolderCallbackData *callback_data; + EStorageResult storage_result; + + callback_data = (AsyncRemoveFolderCallbackData *) data; + + storage_result = shell_component_result_to_storage_result (result); + + /* If result == HASSUBFOLDERS then recurse delete the subfolders dir? */ + + /* FIXME: Handle errors */ + if (result == EVOLUTION_SHELL_COMPONENT_OK) + { + ELocalStoragePrivate *priv; + + priv = E_LOCAL_STORAGE (callback_data->storage)->priv; + + e_storage_removed_folder (E_STORAGE (callback_data->storage), + callback_data->path); + + evolution_storage_removed_folder (EVOLUTION_STORAGE (priv->bonobo_interface), + callback_data->path); + } + + bonobo_object_unref (BONOBO_OBJECT (shell_component_client)); + + if (callback_data->listener != CORBA_OBJECT_NIL) + notify_bonobo_listener (callback_data->listener, + storage_result, + callback_data->physical_path); + + g_free (callback_data->path); + g_free (callback_data->physical_path); + g_free (callback_data); +} + static EStorageResult remove_folder_directory (ELocalStorage *local_storage, const char *path) { + EStorage *storage; ELocalStoragePrivate *priv; - char *physical_path, *subfolder_physical_path; - char *file_name, *subfolder_path; + EFolder *folder; + const char *folder_name; + char *file_name; + char *physical_path; priv = local_storage->priv; - subfolder_path = g_strdup_printf ("%s/", path); - subfolder_physical_path = e_path_to_physical (priv->base_path, subfolder_path); - g_free (subfolder_path); - - /* 1. Delete the subfolder directory. If this fails, it means that we - have subfolders. */ - if (g_file_exists (subfolder_physical_path) && - rmdir (subfolder_physical_path) == -1) { - g_free (subfolder_physical_path); - return E_STORAGE_NOTEMPTY; /* FIXME? */ - } - g_free (subfolder_physical_path); + storage = E_STORAGE (local_storage); + folder = e_storage_get_folder (storage, path); + folder_name = g_basename (path); - /* 2. Delete the metadata file associated with this folder. */ + /* Delete the metadata file associated with this folder. */ physical_path = e_path_to_physical (priv->base_path, path); file_name = g_concat_dir_and_file (physical_path, E_LOCAL_FOLDER_METADATA_FILE_NAME); unlink (file_name); g_free (file_name); - /* 3. Delete the physical directory. */ + /* Delete the physical directory. */ if (rmdir (physical_path) == -1) { g_free (physical_path); return E_STORAGE_GENERICERROR; } g_free (physical_path); + + /* Delete the 'subfolders' directory that this folder lies in */ + if (folder_name != path + 1) { + char *subfolders_directory_physical_path; + char *parent_path; + + parent_path = g_strndup (path, folder_name - path); + subfolders_directory_physical_path = e_path_to_physical (priv->base_path, parent_path); + g_free (parent_path); + + rmdir (subfolders_directory_physical_path); + g_free (subfolders_directory_physical_path); + } + return E_STORAGE_OK; } -#endif + +static EStorageResult +remove_folder (ELocalStorage *local_storage, + Bonobo_Listener listener, + const char *path, + const char *physical_uri) +{ + ELocalStoragePrivate *priv; + EStorage *storage; + AsyncRemoveFolderCallbackData *callback_data; + EvolutionShellComponentClient *component_client; + EStorageResult result; + EFolder *folder; + char *physical_path; + GList *subfolder_paths; + GList *p; + + priv = local_storage->priv; + + storage = E_STORAGE (local_storage); + folder = e_storage_get_folder (storage, path); + + component_client = e_folder_type_registry_get_handler_for_type (priv->folder_type_registry, + e_folder_get_type_string (folder)); + if (component_client == NULL) { + if (listener != CORBA_OBJECT_NIL) + notify_bonobo_listener (listener, E_STORAGE_INVALIDTYPE, NULL); + return E_STORAGE_INVALIDTYPE; + } + + physical_path = e_path_to_physical (priv->base_path, path); + + if (!physical_uri) + physical_uri = g_strconcat ("file://", physical_path, NULL); + + /* Recursively remove the subfolders */ + subfolder_paths = e_storage_get_subfolder_paths (storage, path); + + for (p = subfolder_paths; p; p = p->next) { + remove_folder (local_storage, + listener, + p->data, + NULL); + } + + callback_data = g_new (AsyncRemoveFolderCallbackData, 1); + callback_data->storage = E_STORAGE (local_storage); + callback_data->path = g_strdup (path); + callback_data->physical_path = physical_path; + callback_data->listener = listener; + + bonobo_object_ref (BONOBO_OBJECT (component_client)); + + evolution_shell_component_client_async_remove_folder (component_client, + physical_uri, + component_async_remove_folder_callback, + callback_data); + + result = remove_folder_directory (E_LOCAL_STORAGE (local_storage), path); + + if (result != E_STORAGE_OK) { + if (listener != CORBA_OBJECT_NIL) + notify_bonobo_listener (listener, result, physical_path); + g_free (physical_path); + return result; + } + + return result; +} /* GtkObject methods. */ @@ -502,8 +626,16 @@ impl_async_remove_folder (EStorage *storage, void *data) { ELocalStorage *local_storage; + EStorageResult result; local_storage = E_LOCAL_STORAGE (storage); + + result = remove_folder (local_storage, NULL, path, NULL); + + if (callback != NULL) + (* callback) (E_STORAGE (local_storage), + result, + data); } @@ -772,6 +904,20 @@ bonobo_interface_create_folder_cb (EvolutionStorage *storage, create_folder (local_storage, listener, path, type, description, NULL, NULL); } +static void +bonobo_interface_remove_folder_cb (EvolutionStorage *storage, + const Bonobo_Listener listener, + const char *path, + const char *physical_uri, + void *data) +{ + ELocalStorage *local_storage; + + local_storage = E_LOCAL_STORAGE (data); + + remove_folder (local_storage, listener, path, physical_uri); +} + static void bonobo_interface_update_folder_cb (EvolutionLocalStorage *bonobo_local_storage, const char *path, @@ -859,6 +1005,9 @@ construct (ELocalStorage *local_storage, gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "create_folder", GTK_SIGNAL_FUNC (bonobo_interface_create_folder_cb), local_storage); + gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "remove_folder", + GTK_SIGNAL_FUNC (bonobo_interface_remove_folder_cb), + local_storage); gtk_signal_connect (GTK_OBJECT (priv->bonobo_interface), "update_folder", GTK_SIGNAL_FUNC (bonobo_interface_update_folder_cb), local_storage); diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index 6b0a1b0fe8..407b7f167b 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -29,6 +29,8 @@ #include #include +#include +#include #include @@ -83,7 +85,7 @@ folder_command_data_new (EShell *shell, new = g_new (FolderCommandData, 1); new->shell = shell; new->shell_view = shell_view; - new->command = command; + new->command = command; new->source_path = g_strdup (source_path); new->destination_path = g_strdup (destination_path); @@ -111,7 +113,7 @@ xfer_result_callback (EStorageSet *storage_set, folder_command_data = (FolderCommandData *) data; - /* FIXME do something. */ + /* FIXME: do something. */ folder_command_data_free (folder_command_data); } @@ -270,7 +272,8 @@ e_shell_command_move_folder (EShell *shell, g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (shell_view != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); current_path = e_shell_view_get_current_path (shell_view); if (current_path == NULL) { @@ -297,16 +300,102 @@ e_shell_command_move_folder (EShell *shell, gtk_widget_show (folder_selection_dialog); } +static void +delete_cb (EStorage *storage, + EStorageResult result, + void *data) +{ + /* FIXME: Do something? */ +} + +static int +delete_dialog (char *folder_name) +{ + GnomeDialog *dialog; + char *title; + GtkWidget *question_label; + char *question; + + + /* Popup a dialog asking if they are sure they want to delete + the folder */ + + title = g_strdup_printf (_("Delete folder '%s'"), + folder_name); + + dialog = GNOME_DIALOG (gnome_dialog_new (title, + GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_NO, + NULL)); + g_free (title); + + question = g_strdup_printf (_("Are you sure you want to remove the '%s' folder?"), + folder_name); + question_label = gtk_label_new (question); + gtk_widget_show (question_label); + + gtk_box_pack_start (GTK_BOX (dialog->vbox), question_label, FALSE, TRUE, 2); + g_free (question); + + gnome_dialog_set_default (dialog, 1); + + return gnome_dialog_run_and_close (dialog); +} + void e_shell_command_delete_folder (EShell *shell, EShellView *shell_view) { + EStorageSet *storage_set; + char *path; + g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); g_return_if_fail (shell_view != NULL); g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_warning ("To be implemented"); + storage_set = e_shell_get_storage_set (shell); + path = g_strdup (e_shell_view_get_current_path (shell_view)); + + if (delete_dialog (get_folder_name (shell, path)) == 0) { + /* Remove and destroy the control */ + e_shell_view_remove_control_for_uri (shell_view, + e_shell_view_get_current_uri (shell_view)); + + /* Remove the folder */ + e_storage_set_async_remove_folder (storage_set, + path, + delete_cb, + NULL); + + /* Select another folder to prevent bad things from happening */ + e_shell_view_display_uri (shell_view, "evolution:/local/Inbox"); + } + + g_free (path); +} + +static char * +rename_dialog (char *folder_name) +{ + GnomeDialog *dialog; + int result; + char *title; + GtkWidget *question_label; + GtkWidget *entry; + char *question; + + + title = g_strdup_printf (_("Rename folder '%s'"), + folder_name); + + dialog = GNOME_DIALOG (gnome_dialog_new (title, + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, + NULL)); + g_free (title); + + /* FIXME: Finish then make command_rename_folder use it */ } @@ -333,7 +422,8 @@ e_shell_command_add_to_shortcut_bar (EShell *shell, g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && ! E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (shell_view != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); shortcuts = e_shell_get_shortcuts (shell); group_num = e_shell_view_get_current_shortcuts_group_num (shell_view); @@ -349,7 +439,8 @@ e_shell_command_folder_properties (EShell *shell, { g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (shell_view != NULL && E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (shell_view != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); g_warning ("To be implemented"); } diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index aa42d153ca..0096462ab7 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -307,6 +307,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s GtkWidget *scroll_frame; GtkWidget *caption_label; int i; + char *filename; g_return_if_fail (folder_selection_dialog != NULL); g_return_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog)); @@ -352,6 +353,16 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s gtk_object_ref (GTK_OBJECT (priv->storage_set)); priv->storage_set_view = e_storage_set_new_view (priv->storage_set, NULL /* No BonoboUIContainer */); + + /* Load the expanded state for this StorageSetView */ + filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_0", + e_shell_get_local_directory (priv->shell)); + + e_tree_load_expanded_state (E_TREE (priv->storage_set_view), + filename); + + g_free (filename); + GTK_WIDGET_SET_FLAGS (priv->storage_set_view, GTK_CAN_FOCUS); gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "double_click", GTK_SIGNAL_FUNC (dbl_click_cb), diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index fac392e19b..8098eba211 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -417,7 +417,7 @@ switch_on_folder_tree_click (EShellView *shell_view, if (priv->delayed_selection) { g_free (priv->delayed_selection); priv->delayed_selection = NULL; - gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set(priv->shell)), + gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), GTK_SIGNAL_FUNC (new_folder_cb), shell_view); } @@ -1779,13 +1779,10 @@ e_shell_view_display_uri (EShellView *shell_view, set_current_notebook_page (shell_view, 0); - if (priv->uri != NULL) { - g_free (priv->uri); - priv->uri = NULL; - } + g_free (priv->uri); + priv->uri = NULL; retval = TRUE; - goto end; } @@ -1798,7 +1795,7 @@ e_shell_view_display_uri (EShellView *shell_view, if (control != NULL) { g_assert (GTK_IS_WIDGET (control)); show_existing_view (shell_view, uri, control); - } else if (! create_new_view_for_uri (shell_view, uri)) { + } else if (create_new_view_for_uri (shell_view, uri)) { priv->delayed_selection = g_strdup (uri); gtk_signal_connect_after (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), "new_folder", GTK_SIGNAL_FUNC (new_folder_cb), shell_view); @@ -1816,6 +1813,45 @@ e_shell_view_display_uri (EShellView *shell_view, return retval; } +gboolean +e_shell_view_remove_control_for_uri (EShellView *shell_view, + const char *uri) +{ + EShellViewPrivate *priv; + GtkWidget *control; + GtkWidget *socket; + int page_num; + + g_return_val_if_fail (shell_view != NULL, FALSE); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); + + priv = shell_view->priv; + + /* Get the control, remove it from our hash of controls */ + control = g_hash_table_lookup (priv->uri_to_control, uri); + if (control != NULL) + g_hash_table_remove (priv->uri_to_control, uri); + else + return FALSE; + + /* Get the socket, remove it from our list of sockets */ + socket = find_socket (GTK_CONTAINER (control)); + priv->sockets = g_list_remove (priv->sockets, socket); + + /* Remove the notebook page */ + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), + control); + gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), + page_num); + + /* Destroy things, socket first because otherwise shell will + think the control crashed */ + gtk_widget_destroy (socket); + gtk_widget_destroy (control); + + return TRUE; +} + void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index c9220b09ad..62a95beb83 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -105,6 +105,8 @@ gboolean e_shell_view_save_settings (EShellView *shell_view, gboolean e_shell_view_load_settings (EShellView *shell_view, int view_num); +gboolean e_shell_view_remove_control_for_uri (EShellView *shell_view, const char *uri); + int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view); void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, int group_num); diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index bfe1bda032..07b4e66378 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -590,7 +590,7 @@ e_storage_set_async_remove_folder (EStorageSet *storage_set, converter_data = storage_callback_converter_data_new (storage_set, callback, data); - e_storage_async_remove_folder (storage, path, + e_storage_async_remove_folder (storage, subpath, storage_callback_converter, converter_data); } diff --git a/shell/e-storage.c b/shell/e-storage.c index 4619d1c5ea..a358df2d27 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -418,10 +418,10 @@ e_storage_async_create_folder (EStorage *storage, } void -e_storage_async_remove_folder (EStorage *storage, - const char *path, +e_storage_async_remove_folder (EStorage *storage, + const char *path, EStorageResultCallback callback, - void *data) + void *data) { g_return_if_fail (storage != NULL); g_return_if_fail (E_IS_STORAGE (storage)); diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c index 3221eafe29..65017395b7 100644 --- a/shell/evolution-local-storage.c +++ b/shell/evolution-local-storage.c @@ -45,6 +45,7 @@ struct _EvolutionLocalStoragePrivate { enum { UPDATE_FOLDER, + LAST_SIGNAL }; @@ -57,10 +58,10 @@ static POA_GNOME_Evolution_LocalStorage__vepv LocalStorage_vepv; static void impl_GNOME_Evolution_LocalStorage_updateFolder (PortableServer_Servant servant, - const CORBA_char *path, - const CORBA_char *display_name, - CORBA_boolean highlighted, - CORBA_Environment *ev) + const CORBA_char *path, + const CORBA_char *display_name, + CORBA_boolean highlighted, + CORBA_Environment *ev) { BonoboObject *bonobo_object; EvolutionLocalStorage *local_storage; diff --git a/shell/evolution-session.c b/shell/evolution-session.c index 9d74744d78..818fb393e5 100644 --- a/shell/evolution-session.c +++ b/shell/evolution-session.c @@ -70,8 +70,8 @@ impl_destroy (GtkObject *object) static void impl_GNOME_Evolution_Session_saveConfiguration (PortableServer_Servant servant, - const CORBA_char *prefix, - CORBA_Environment *ev) + const CORBA_char *prefix, + CORBA_Environment *ev) { BonoboObject *self; @@ -81,8 +81,8 @@ impl_GNOME_Evolution_Session_saveConfiguration (PortableServer_Servant servant, static void impl_GNOME_Evolution_Session_loadConfiguration (PortableServer_Servant servant, - const CORBA_char *prefix, - CORBA_Environment *ev) + const CORBA_char *prefix, + CORBA_Environment *ev) { BonoboObject *self; @@ -172,7 +172,7 @@ create_corba_session (BonoboObject *object) CORBA_exception_init (&ev); POA_GNOME_Evolution_Session__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ + if (ev._major != CORBA_NO_EXCEPTION) { g_free (servant); CORBA_exception_free (&ev); return CORBA_OBJECT_NIL; diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index 7a7b44ccc8..c85eb4a299 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -655,7 +655,45 @@ evolution_shell_component_client_async_remove_folder (EvolutionShellComponentCli EvolutionShellComponentClientCallback callback, void *data) { - /* FIXME to do. */ + EvolutionShellComponentClientPrivate *priv; + GNOME_Evolution_ShellComponent corba_shell_component; + CORBA_Environment ev; + + g_return_if_fail (shell_component_client != NULL); + g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); + g_return_if_fail (physical_uri != NULL); + g_return_if_fail (callback != NULL); + + priv = shell_component_client->priv; + + if (priv->callback != NULL) { + (* callback) (shell_component_client, EVOLUTION_SHELL_COMPONENT_BUSY, data); + return; + } + + create_listener_interface (shell_component_client); + + CORBA_exception_init (&ev); + + corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); + + priv->callback = callback; + priv->callback_data = data; + + GNOME_Evolution_ShellComponent_removeFolderAsync (corba_shell_component, + priv->listener_interface, + physical_uri, + &ev); + + if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) { + (* callback) (shell_component_client, + shell_component_result_from_corba_exception (&ev), + data); + priv->callback = NULL; + priv->callback_data = NULL; + } + + CORBA_exception_free (&ev); } void diff --git a/shell/evolution-shell-view.c b/shell/evolution-shell-view.c index 24d41b492c..75639f33d2 100644 --- a/shell/evolution-shell-view.c +++ b/shell/evolution-shell-view.c @@ -124,8 +124,8 @@ impl_ShellView_set_title (PortableServer_Servant servant, static void impl_ShellView_set_folder_bar_label (PortableServer_Servant servant, - const CORBA_char *text, - CORBA_Environment *ev) + const CORBA_char *text, + CORBA_Environment *ev) { BonoboObject *bonobo_object; -- cgit v1.2.3