diff options
author | 7 <NotZed@Ximian.com> | 2001-10-27 14:00:34 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-27 14:00:34 +0800 |
commit | c4d87ba45ad016d5a6607df96ed27ba02910e2e6 (patch) | |
tree | 5a48e3bbf61529642f7d0159642a69d8e8c57146 /camel/providers | |
parent | f4bb7b53dd93f67afb214a465828fe0cc3295f79 (diff) | |
download | gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar.gz gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar.bz2 gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar.lz gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar.xz gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.tar.zst gsoc2013-evolution-c4d87ba45ad016d5a6607df96ed27ba02910e2e6.zip |
Finished implementation.
2001-10-27 <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c (rename_folder): Finished
implementation.
* providers/local/camel-local-folder.c (local_rename): Implement
local rename of folder objects.
2001-10-26 <NotZed@Ximian.com>
* camel-vee-folder.c (camel_vee_folder_class_init): Hook into
rename function.
(vee_rename): Implement the veefolder rename function.
(camel_vee_folder_class_init):
(folder_changed_change): Kill a warning with a cast.
* camel-vee-store.c (vee_rename_folder): Emit a folder_renamed
event properly, also call parent to do some rename stuff.
* camel-store.h: Added a CamelRenameInfo for the rename event.
* camel-folder.c (camel_folder_rename): New function to rename a
folder object.
(camel_folder_class_init): Added a renamed event.
(folder_rename): Default impl, set full_name, and set name
assuming the dir separator is '/'.
* camel-store.c (camel_store_class_init): Added folder_renamed
event.
(camel_store_rename_folder): Rename an active folder object if we
have one, and update the folder table.
(rename_folder): Make a default implementation that handles
updating the folder tree.
svn path=/trunk/; revision=14204
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 23 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 28 |
2 files changed, 31 insertions, 20 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 32899b20e5..1fea5a27b9 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -1103,18 +1103,11 @@ static void rename_folder (CamelStore *store, const char *old_name, const char *new_name, CamelException *ex) { CamelImapStore *imap_store = CAMEL_IMAP_STORE (store); - CamelFolderInfo *old_fi, *new_fi; CamelImapResponse *response; - + if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex)) return; - old_fi = get_folder_info_online (store, old_name, CAMEL_STORE_FOLDER_INFO_FAST | - CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex); - - if (old_fi == NULL) - return; - /* make sure this folder isn't currently SELECTed - it's actually possible to rename INBOX but if you do another INBOX will immediately be created by the server */ @@ -1129,20 +1122,10 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name, Ca } else return; - response = camel_imap_command (imap_store, NULL, ex, "RENAME %F %F", - old_name, new_name); + response = camel_imap_command(imap_store, NULL, ex, "RENAME %F %F", old_name, new_name); - if (response) { + if (response) camel_imap_response_free (imap_store, response); - - new_fi = get_folder_info_online (store, new_name, CAMEL_STORE_FOLDER_INFO_FAST | - CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex); - - if (new_fi == NULL) - return; - - /* emit the renamed event */ - } } static CamelFolderInfo * diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index cc4a703006..985081a266 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -65,6 +65,8 @@ static GPtrArray *local_search_by_expression(CamelFolder *folder, const char *ex static GPtrArray *local_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex); static void local_search_free(CamelFolder *folder, GPtrArray * result); +static void local_rename(CamelFolder *folder, const char *newname); + static void local_finalize(CamelObject * object); static void @@ -84,6 +86,8 @@ camel_local_folder_class_init(CamelLocalFolderClass * camel_local_folder_class) camel_folder_class->search_by_uids = local_search_by_uids; camel_folder_class->search_free = local_search_free; + camel_folder_class->rename = local_rename; + camel_local_folder_class->lock = local_lock; camel_local_folder_class->unlock = local_unlock; } @@ -308,6 +312,30 @@ local_expunge(CamelFolder *folder, CamelException *ex) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, TRUE, ex); } +static void +local_rename(CamelFolder *folder, const char *newname) +{ + CamelLocalFolder *lf = (CamelLocalFolder *)folder; + + d(printf("renaming local folder paths to '%s'\n", newname)); + + /* Sync? */ + + g_free(lf->folder_path); + g_free(lf->summary_path); + g_free(lf->index_path); + lf->folder_path = g_strdup_printf("%s/%s", lf->base_path, newname); + lf->summary_path = g_strdup_printf("%s/%s.ev-summary", lf->base_path, newname); + lf->index_path = g_strdup_printf("%s/%s.ibex", lf->base_path, newname); + + /* FIXME: Poke some internals, sigh */ + camel_folder_summary_set_filename(folder->summary, lf->summary_path); + g_free(((CamelLocalSummary *)folder->summary)->folder_path); + ((CamelLocalSummary *)folder->summary)->folder_path = g_strdup(lf->folder_path); + + parent_class->rename(folder, newname); +} + static GPtrArray * local_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) { |