From a2f50bb029eaa8b8c0804a5788302dc15105a3ed Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 23 May 2001 22:43:03 +0000 Subject: New function that the shell component calls to copy/move a folder. 2001-05-23 Jeffrey Stedfast * component-factory.c (xfer_folder): New function that the shell component calls to copy/move a folder. (component_fn): Set the xfer_folder_fn argument. * mail-ops.c (mail_remove_folder): New async function to remove a folder. God knows if it does what the ShellComponent needs or not yet. (mail_xfer_folder): Yet another yummy async function to move or copy a folder to a new location. * component-factory.c (storage_remove_folder): New function for removing folders. (remove_folder): New function that the shell component calls to delete a folder. (component_fn): Set the remove_folder_fn argument. svn path=/trunk/; revision=9954 --- mail/component-factory.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'mail/component-factory.c') diff --git a/mail/component-factory.c b/mail/component-factory.c index 6bfd489bff..312bcf3054 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -188,9 +188,7 @@ remove_folder (EvolutionShellComponent *shell_component, CORBA_exception_init (&ev); - /* FIXME: what if the folder is mh or maildir? */ - /* ?? maybe we should just rm -rf the physical_uri?? */ - uri = g_strdup_printf ("mbox://%s", physical_uri); + uri = g_strdup_printf ("file://%s", physical_uri); mail_remove_folder (uri, do_remove_folder, CORBA_Object_duplicate (listener, &ev)); GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_OK, &ev); @@ -198,6 +196,48 @@ remove_folder (EvolutionShellComponent *shell_component, CORBA_exception_free (&ev); } +static void +do_xfer_folder (char *src_uri, char *dest_uri, gboolean remove_source, CamelFolder *dest_folder, void *data) +{ + GNOME_Evolution_ShellComponentListener listener = data; + GNOME_Evolution_ShellComponentListener_Result result; + CORBA_Environment ev; + + if (dest_folder) + result = GNOME_Evolution_ShellComponentListener_OK; + else + result = GNOME_Evolution_ShellComponentListener_INVALID_URI; + + CORBA_exception_init (&ev); + GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); + CORBA_Object_release (listener, &ev); + CORBA_exception_free (&ev); +} + +static void +xfer_folder (EvolutionShellComponent *shell_component, + const char *source_physical_uri, + const char *destination_physical_uri, + gboolean remove_source, + const GNOME_Evolution_ShellComponentListener listener, + void *closure) +{ + CORBA_Environment ev; + char *dest_uri; + + CORBA_exception_init (&ev); + + dest_uri = g_strdup_printf ("mbox://%s", destination_physical_uri); + mail_xfer_folder (source_physical_uri, dest_uri, remove_source, do_xfer_folder, + CORBA_Object_duplicate (listener, &ev)); + g_free (dest_uri); + + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_OK, &ev); + + CORBA_exception_free (&ev); +} + static struct { char *name, **uri; CamelFolder **folder; @@ -334,7 +374,7 @@ component_fn (BonoboGenericFactory *factory, void *closure) create_view, create_folder, remove_folder, - NULL, /* xfer_folder_fn */ + xfer_folder, NULL, /* populate_folder_context_menu_fn */ NULL, /* get_dnd_selection_fn */ NULL); -- cgit v1.2.3