From 45fd1767502d711d72087cae76c3d1acd7f46066 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@src.gnome.org>
Date: Mon, 30 Sep 2002 18:41:05 +0000
Subject: Calls e_shell_command_remove_shared_folder. (file_verbs): Set up

	* e-shell-view-menu.c (command_remove_other_users_folder): Calls
	e_shell_command_remove_shared_folder.
	(file_verbs): Set up command_remove_other_users_folder.

	* e-shell-folder-commands.c
	(e_shell_command_remove_shared_folder): New. Calls
	e_storage_set_async_remove_shared_folder with a callback to pop up
	an error dialog if it fails.

	* e-storage-set.c (e_storage_set_async_remove_shared_folder):
	Implement. Mostly like async_remove_folder.

	* e-storage.c (e_storage_supports_shared_folders,
	e_storage_async_discover_shared_folder,
	e_storage_async_remove_shared_folder): New methods. Default
	implementations return FALSE, NOTIMPLEMENTED, and NOTIMPLEMENTED.

	* e-corba-storage.c (supports_shared_folders,
	async_discover_shared_folder, async_remove_shared_folder):
	Implement using CORBA.

	* Evolution-Storage.idl: add Storage_asyncRemoveSharedFolder

	* e-shell-shared-folder-picker-dialog.c: Remove all the CORBA
	stuff from here and use the new EStorage methods.
	(setup_server_option_menu): Use e_storage_supports_shared_folders.
	(discover_folder): Use e_storage_async_discover_shared_folder.

	* evolution-storage.c (impl_Storage_asyncRemoveSharedFolder):
	Implement this by emitting a REMOVE_SHARED_FOLDER signal.
	(impl_Storage_asyncDiscoverSharedFolder): Make the
	DISCOVER_SHARED_FOLDER signal put the Bonobo_Listener first like
	all the other signals do.
	(class_init): Set up REMOVE_SHARED_FOLDER signal.

svn path=/trunk/; revision=18265
---
 shell/e-shell-folder-commands.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

(limited to 'shell/e-shell-folder-commands.c')

diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c
index 884fa97c05..4af143c920 100644
--- a/shell/e-shell-folder-commands.c
+++ b/shell/e-shell-folder-commands.c
@@ -570,6 +570,47 @@ e_shell_command_rename_folder (EShell *shell,
 	g_free (new_name);
 }
 
+
+static void
+remove_shared_cb (EStorageSet *storage_set,
+		  EStorageResult result,
+		  void *data)
+{
+	EShellView *shell_view;
+
+	shell_view = E_SHELL_VIEW (data);
+
+	if (result == E_STORAGE_NOTIMPLEMENTED ||
+	    result == E_STORAGE_UNSUPPORTEDOPERATION)
+		e_notice (GTK_WINDOW (shell_view), GNOME_MESSAGE_BOX_ERROR,
+			  _("Selected folder does not belong to another user"));
+	else if (result != E_STORAGE_OK)
+		e_notice (GTK_WINDOW (shell_view), GNOME_MESSAGE_BOX_ERROR,
+			  _("Cannot remove folder:\n%s"), e_storage_result_to_string (result));
+}
+
+void
+e_shell_command_remove_shared_folder (EShell *shell,
+				      EShellView *shell_view,
+				      const char *folder_path)
+{
+	EStorageSet *storage_set;
+
+	g_return_if_fail (shell != NULL);
+	g_return_if_fail (E_IS_SHELL (shell));
+	g_return_if_fail (shell_view != NULL || folder_path != NULL);
+	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+	g_return_if_fail (folder_path != NULL || g_path_is_absolute (folder_path));
+
+	storage_set = e_shell_get_storage_set (shell);
+
+	if (folder_path == NULL)
+		folder_path = e_shell_view_get_current_path (shell_view);
+
+	e_storage_set_async_remove_shared_folder (storage_set, folder_path,
+						  remove_shared_cb, shell_view);
+}
+
 
 void
 e_shell_command_add_to_shortcut_bar (EShell *shell,
-- 
cgit