diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-07-23 10:04:14 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-07-23 10:04:14 +0800 |
commit | 97cc1d57adcdefb5b63a704f42f692e3cffb4014 (patch) | |
tree | 8cf6ca737156fa7ae603a5b479813f6a6c5830d5 | |
parent | 13c7f54818b9b6a25a47289768d17e5a885cec7a (diff) | |
download | gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.gz gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.bz2 gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.lz gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.xz gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.zst gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.zip |
Add an extra @type arg to the xferFolder and removeFolder methods in
the ShellComponent interface. Updated the EvolutionShellComponent
GTK+ wrapper and all the component accordingly. Get the calendar to
use this so it can delete both tasks and calendar folders.
svn path=/trunk/; revision=11300
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 30 | ||||
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 38 | ||||
-rw-r--r-- | calendar/gui/component-factory.c | 38 | ||||
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/component-factory.c | 17 | ||||
-rw-r--r-- | shell/ChangeLog | 25 | ||||
-rw-r--r-- | shell/Evolution-ShellComponent.idl | 4 | ||||
-rw-r--r-- | shell/e-local-storage.c | 2 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.c | 4 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.h | 2 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 5 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 2 |
14 files changed, 174 insertions, 17 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 359745c7de..e2c01bfafa 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-07-22 Ettore Perazzoli <ettore@ximian.com> + + * gui/component/addressbook-component.c (remove_folder): Add a + @type arg. If the type is not "contacts", report an + `UNSUPPORTED_TYPE' error through the listener. Also, remove + `g_print()' debugging messages. + (xfer_folder): Likewise. + 2001-07-21 Ettore Perazzoli <ettore@ximian.com> * gui/component/addressbook-component.c: Make the "contacts" diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 02e3fb85f9..1dca130042 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -64,7 +64,7 @@ static char *accepted_dnd_types[] = { static const EvolutionShellComponentFolderType folder_types[] = { { "contacts", "evolution-contacts.png", TRUE, accepted_dnd_types, NULL }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, FALSE, NULL, NULL } }; @@ -113,6 +113,7 @@ create_folder (EvolutionShellComponent *shell_component, static void remove_folder (EvolutionShellComponent *shell_component, const char *physical_uri, + const char *type, const GNOME_Evolution_ShellComponentListener listener, void *closure) { @@ -121,10 +122,16 @@ remove_folder (EvolutionShellComponent *shell_component, struct stat sb; int rv; - g_print ("should remove %s\n", physical_uri); - CORBA_exception_init(&ev); + if (strcmp (type, "contacts") != 0) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free(&ev); + return; + } + if (!strncmp (physical_uri, "ldap://", 7)) { GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, @@ -176,6 +183,7 @@ static void xfer_folder (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure) @@ -184,8 +192,13 @@ xfer_folder (EvolutionShellComponent *shell_component, char *source_path; char *destination_path; - g_print ("should transfer %s to %s, %s source\n", source_physical_uri, - destination_physical_uri, remove_source ? "removing" : "not removing"); + if (strcmp (type, "contacts") != 0) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free(&ev); + return; + } if (!strncmp (source_physical_uri, "ldap://", 7) || !strncmp (destination_physical_uri, "ldap://", 7)) { @@ -208,13 +221,6 @@ xfer_folder (EvolutionShellComponent *shell_component, source_path = g_concat_dir_and_file (source_physical_uri + 7, "addressbook.db"); destination_path = g_concat_dir_and_file (destination_physical_uri + 7, "addressbook.db"); - if (remove_source) { - g_print ("rename %s %s\n", source_path, destination_path); - } - else { - g_print ("copy %s %s\n", source_path, destination_path); - } - CORBA_exception_init (&ev); /* XXX always fail for now, until the above stuff is written */ diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4d74592553..fd0ca261b9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2001-07-22 Ettore Perazzoli <ettore@ximian.com> + + * gui/component-factory.c (get_local_file_name_for_folder_type): + New helper function. + (remove_folder): Add a @type arg and handle it, by deleting + "tasks.ics" instead of "calendar.ics" if the type is "tasks". If + the type is not "tasks" or "calendar", report an + `UNSUPPORTED_TYPE' error. + (xfer_folder): Likewise. + 2001-07-21 Ettore Perazzoli <ettore@ximian.com> * gui/component-factory.c: Make folders of type "calendar" and diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index dd161a46dc..4b47fe697d 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -53,6 +53,20 @@ static const EvolutionShellComponentFolderType folder_types[] = { }; +/* Utility functions. */ + +static const char * +get_local_file_name_for_folder_type (const char *type) +{ + if (strcmp (type, "calendar") == 0) + return "calendar.ics"; + else if (strcmp (type, "tasks") == 0) + return "tasks.ics"; + else + return NULL; +} + + /* EvolutionShellComponent methods and signals. */ static EvolutionShellComponentResult @@ -107,10 +121,12 @@ create_folder (EvolutionShellComponent *shell_component, static void remove_folder (EvolutionShellComponent *shell_component, const char *physical_uri, + const char *type, const GNOME_Evolution_ShellComponentListener listener, void *closure) { CORBA_Environment ev; + const char *file_name; gchar *path; int rv; @@ -128,8 +144,17 @@ remove_folder (EvolutionShellComponent *shell_component, /* FIXME: check if there are subfolders? */ + file_name = get_local_file_name_for_folder_type (type); + if (file_name == NULL) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free (&ev); + return; + } + /* remove the .ics file */ - path = g_concat_dir_and_file (physical_uri + 7, "calendar.ics"); + path = g_concat_dir_and_file (physical_uri + 7, file_name); rv = unlink (path); g_free (path); if (rv == 0) { @@ -169,6 +194,7 @@ static void xfer_folder (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure) @@ -182,6 +208,7 @@ xfer_folder (EvolutionShellComponent *shell_component, GnomeVFSURI *uri; GnomeVFSFileSize out; char *buf; + const char *file_name; CORBA_exception_init (&ev); @@ -196,6 +223,15 @@ xfer_folder (EvolutionShellComponent *shell_component, return; } + file_name = get_local_file_name_for_folder_type (type); + if (file_name == NULL) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free (&ev); + return; + } + /* open source and destination files */ source_path = g_concat_dir_and_file (source_physical_uri + 7, "calendar.ics"); diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index dd161a46dc..4b47fe697d 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -53,6 +53,20 @@ static const EvolutionShellComponentFolderType folder_types[] = { }; +/* Utility functions. */ + +static const char * +get_local_file_name_for_folder_type (const char *type) +{ + if (strcmp (type, "calendar") == 0) + return "calendar.ics"; + else if (strcmp (type, "tasks") == 0) + return "tasks.ics"; + else + return NULL; +} + + /* EvolutionShellComponent methods and signals. */ static EvolutionShellComponentResult @@ -107,10 +121,12 @@ create_folder (EvolutionShellComponent *shell_component, static void remove_folder (EvolutionShellComponent *shell_component, const char *physical_uri, + const char *type, const GNOME_Evolution_ShellComponentListener listener, void *closure) { CORBA_Environment ev; + const char *file_name; gchar *path; int rv; @@ -128,8 +144,17 @@ remove_folder (EvolutionShellComponent *shell_component, /* FIXME: check if there are subfolders? */ + file_name = get_local_file_name_for_folder_type (type); + if (file_name == NULL) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free (&ev); + return; + } + /* remove the .ics file */ - path = g_concat_dir_and_file (physical_uri + 7, "calendar.ics"); + path = g_concat_dir_and_file (physical_uri + 7, file_name); rv = unlink (path); g_free (path); if (rv == 0) { @@ -169,6 +194,7 @@ static void xfer_folder (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure) @@ -182,6 +208,7 @@ xfer_folder (EvolutionShellComponent *shell_component, GnomeVFSURI *uri; GnomeVFSFileSize out; char *buf; + const char *file_name; CORBA_exception_init (&ev); @@ -196,6 +223,15 @@ xfer_folder (EvolutionShellComponent *shell_component, return; } + file_name = get_local_file_name_for_folder_type (type); + if (file_name == NULL) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, + &ev); + CORBA_exception_free (&ev); + return; + } + /* open source and destination files */ source_path = g_concat_dir_and_file (source_physical_uri + 7, "calendar.ics"); diff --git a/mail/ChangeLog b/mail/ChangeLog index d784aa1f79..4bcf917cc4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-07-22 Ettore Perazzoli <ettore@ximian.com> + + * component-factory.c (remove_folder): Updated to get a @type + argument. Return an error if the type isn't "mail". + (xfer_folder): Likewise. + 2001-07-21 Ettore Perazzoli <ettore@ximian.com> * component-factory.c: Make types "mailstorage" and "vtrash" diff --git a/mail/component-factory.c b/mail/component-factory.c index c0d257399d..b005863c3a 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -93,7 +93,7 @@ static const EvolutionShellComponentFolderType folder_types[] = { { "mail", "evolution-inbox.png", TRUE, accepted_dnd_types, exported_dnd_types }, { "mailstorage", "evolution-inbox.png", FALSE, NULL, NULL }, { "vtrash", "evolution-trash.png", FALSE, accepted_dnd_types, exported_dnd_types }, - { NULL, NULL, NULL, NULL } + { NULL, NULL, FALSE, NULL, NULL } }; static const char *schema_types[] = { @@ -231,6 +231,7 @@ do_remove_folder (char *uri, gboolean removed, void *data) static void remove_folder (EvolutionShellComponent *shell_component, const char *physical_uri, + const char *type, const GNOME_Evolution_ShellComponentListener listener, void *closure) { @@ -238,6 +239,13 @@ remove_folder (EvolutionShellComponent *shell_component, CORBA_exception_init (&ev); + if (strcmp (type, "mail") != 0) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); + CORBA_exception_free (&ev); + return; + } + mail_remove_folder (physical_uri, do_remove_folder, CORBA_Object_duplicate (listener, &ev)); GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_OK, &ev); @@ -267,6 +275,7 @@ static void xfer_folder (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure) @@ -282,6 +291,12 @@ xfer_folder (EvolutionShellComponent *shell_component, return; } + if (strcmp (type, "mail") != 0) { + GNOME_Evolution_ShellComponentListener_notifyResult (listener, + GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); + return; + } + camel_exception_init (&ex); source = mail_tool_uri_to_folder (source_physical_uri, &ex); camel_exception_clear (&ex); diff --git a/shell/ChangeLog b/shell/ChangeLog index 881bc24f0a..4affcd9754 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,28 @@ +2001-07-22 Ettore Perazzoli <ettore@ximian.com> + + * e-local-storage.c (remove_folder): Pass the folder type to + `evolution_shell_component_client_async_remove_folder()'. + (async_xfer_folder_step): Likewise with + `evolution_shell_component_client_async_xfer_folder()'. + + * evolution-shell-component-client.c + (evolution_shell_component_client_async_remove_folder): New arg + @type. Pass it to the `ShellComponent::removeFolder' CORBA + method. + (evolution_shell_component_client_async_xfer_folder): Likewise + with `::xferFolder'. + + * evolution-shell-component.c (impl_removeFolderAsync): Add @type + arg according to the IDL. + (impl_xferFolderAsync): Likewise. + + * evolution-shell-component.h: Add arg @type to + `EvolutionShellComponentRemoveFolderFn' and + EvolutionShellComponentXferFolderFn'. + + * Evolution-ShellComponent.idl: Add @type arg to + `::removeFolderAsync' and `::xferFolderAsync'. + 2001-07-21 Ettore Perazzoli <ettore@ximian.com> * e-shell-folder-creation-dialog.c (add_folder_types): Only put diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index 73110b5011..7c65544c01 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -68,12 +68,14 @@ module Evolution { raises (Busy); void removeFolderAsync (in ShellComponentListener listener, - in string physical_uri) + in string physical_uri, + in string type) raises (Busy); void xferFolderAsync (in ShellComponentListener listener, in string source_physical_uri, in string destination_physical_uri, + in string type, in boolean remove_source) raises (Busy); diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 6d83cfaaf6..cc92c43329 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -500,6 +500,7 @@ remove_folder (ELocalStorage *local_storage, evolution_shell_component_client_async_remove_folder (component_client, physical_uri, + e_folder_get_type_string (folder), component_async_remove_folder_callback, callback_data); @@ -705,6 +706,7 @@ async_xfer_folder_step (ELocalStorage *local_storage, evolution_shell_component_client_async_xfer_folder (component_client, e_folder_get_physical_uri (source_folder), physical_uri, + e_folder_get_type_string (source_folder), remove_source, component_client_callback, component_client_callback_data); diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index 60b39d9aa2..47059377d0 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -675,6 +675,7 @@ evolution_shell_component_client_async_create_folder (EvolutionShellComponentCli void evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client, const char *physical_uri, + const char *type, EvolutionShellComponentClientCallback callback, void *data) { @@ -706,6 +707,7 @@ evolution_shell_component_client_async_remove_folder (EvolutionShellComponentCli GNOME_Evolution_ShellComponent_removeFolderAsync (corba_shell_component, priv->listener_interface, physical_uri, + type, &ev); if (ev._major != CORBA_NO_EXCEPTION && priv->callback != NULL) { @@ -723,6 +725,7 @@ void evolution_shell_component_client_async_xfer_folder (EvolutionShellComponentClient *shell_component_client, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, EvolutionShellComponentClientCallback callback, void *data) @@ -757,6 +760,7 @@ evolution_shell_component_client_async_xfer_folder (EvolutionShellComponentClien priv->listener_interface, source_physical_uri, destination_physical_uri, + type, remove_source, &ev); diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h index 9b3a7d0ff0..eca4440f96 100644 --- a/shell/evolution-shell-component-client.h +++ b/shell/evolution-shell-component-client.h @@ -103,11 +103,13 @@ void evolution_shell_component_client_async_create_folder (EvolutionShellCompo void *data); void evolution_shell_component_client_async_remove_folder (EvolutionShellComponentClient *shell_component_client, const char *physical_uri, + const char *type, EvolutionShellComponentClientCallback callback, void *data); void evolution_shell_component_client_async_xfer_folder (EvolutionShellComponentClient *shell_component_client, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, EvolutionShellComponentClientCallback callback, void *data); diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index cf7de2354c..8bf0f68f10 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -369,6 +369,7 @@ static void impl_removeFolderAsync (PortableServer_Servant servant, const GNOME_Evolution_ShellComponentListener listener, const CORBA_char *physical_uri, + const CORBA_char *type, CORBA_Environment *ev) { BonoboObject *bonobo_object; @@ -386,7 +387,7 @@ impl_removeFolderAsync (PortableServer_Servant servant, return; } - (* priv->remove_folder_fn) (shell_component, physical_uri, listener, priv->closure); + (* priv->remove_folder_fn) (shell_component, physical_uri, type, listener, priv->closure); } static void @@ -394,6 +395,7 @@ impl_xferFolderAsync (PortableServer_Servant servant, const GNOME_Evolution_ShellComponentListener listener, const CORBA_char *source_physical_uri, const CORBA_char *destination_physical_uri, + const CORBA_char *type, const CORBA_boolean remove_source, CORBA_Environment *ev) { @@ -415,6 +417,7 @@ impl_xferFolderAsync (PortableServer_Servant servant, (* priv->xfer_folder_fn) (shell_component, source_physical_uri, destination_physical_uri, + type, remove_source, listener, priv->closure); diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index 28401826a0..de48b84108 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -83,11 +83,13 @@ typedef void (* EvolutionShellComponentCreateFolderFn) (EvolutionShellComponent void *closure); typedef void (* EvolutionShellComponentRemoveFolderFn) (EvolutionShellComponent *shell_component, const char *physical_uri, + const char *type, const GNOME_Evolution_ShellComponentListener listener, void *closure); typedef void (* EvolutionShellComponentXferFolderFn) (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, + const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure); |