diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-11-15 06:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-11-15 06:04:21 +0800 |
commit | 9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch) | |
tree | 2e1e96f33404781354c422a7e9beaf458ebeb655 /mail/em-folder-utils.c | |
parent | 7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff) | |
download | gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip |
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com>
** Remove trailing whitespace from source code.
svn path=/trunk/; revision=34537
Diffstat (limited to 'mail/em-folder-utils.c')
-rw-r--r-- | mail/em-folder-utils.c | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 3fe2587195..03d070540b 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -86,14 +86,14 @@ emfu_is_special_local_folder (const char *name) struct _EMCopyFolders { struct _mail_msg msg; - + /* input data */ CamelStore *fromstore; CamelStore *tostore; - + char *frombase; char *tobase; - + int delete; }; @@ -101,7 +101,7 @@ static char * emft_copy_folders__desc (struct _mail_msg *mm, int complete) { struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; - + return g_strdup_printf (_("Copying `%s' to `%s'"), m->frombase, m->tobase); } @@ -115,42 +115,42 @@ emft_copy_folders__copy (struct _mail_msg *mm) CamelFolderInfo *fi; const char *tmp; int fromlen; - + if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &mm->ex))) return; - + pending = g_list_append (pending, fi); - + toname = g_string_new (""); fromname = g_string_new (""); - + tmp = strrchr (m->frombase, '/'); if (tmp == NULL) fromlen = 0; else fromlen = tmp - m->frombase + 1; - + d(printf ("top name is '%s'\n", fi->full_name)); - + while (pending) { CamelFolderInfo *info = pending->data; - + pending = g_list_remove_link (pending, pending); while (info) { CamelFolder *fromfolder, *tofolder; GPtrArray *uids; int deleted = 0; - + if (info->child) pending = g_list_append (pending, info->child); - + if (m->tobase[0]) g_string_printf (toname, "%s/%s", m->tobase, info->full_name + fromlen); else g_string_printf (toname, "%s", info->full_name + fromlen); - + d(printf ("Copying from '%s' to '%s'\n", info->full_name, toname->str)); - + /* This makes sure we create the same tree, e.g. from a nonselectable source */ /* Not sure if this is really the 'right thing', e.g. for spool stores, but it makes the ui work */ if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) { @@ -159,69 +159,69 @@ emft_copy_folders__copy (struct _mail_msg *mm) camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &mm->ex); if (camel_exception_is_set (&mm->ex)) goto exception; - + /* this folder no longer exists, unsubscribe it */ if (camel_store_supports_subscriptions (m->fromstore)) camel_store_unsubscribe_folder (m->fromstore, info->full_name, NULL); - + deleted = 1; } else { if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &mm->ex))) goto exception; - + if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &mm->ex))) { camel_object_unref (fromfolder); goto exception; } - + uids = camel_folder_get_uids (fromfolder); camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &mm->ex); camel_folder_free_uids (fromfolder, uids); - + if (m->delete) camel_folder_sync(fromfolder, TRUE, NULL); - + camel_object_unref (fromfolder); camel_object_unref (tofolder); } } - + if (camel_exception_is_set (&mm->ex)) goto exception; else if (m->delete && !deleted) deleting = g_list_prepend (deleting, info); - + /* subscribe to the new folder if appropriate */ if (camel_store_supports_subscriptions (m->tostore) && !camel_store_folder_subscribed (m->tostore, toname->str)) camel_store_subscribe_folder (m->tostore, toname->str, NULL); - + info = info->next; } } - + /* delete the folders in reverse order from how we copyied them, if we are deleting any */ l = deleting; while (l) { CamelFolderInfo *info = l->data; - + d(printf ("deleting folder '%s'\n", info->full_name)); - + /* FIXME: we need to do something with the exception since otherwise the users sees a failed operation with no error message or even any warnings */ if (camel_store_supports_subscriptions (m->fromstore)) camel_store_unsubscribe_folder (m->fromstore, info->full_name, NULL); - + camel_store_delete_folder (m->fromstore, info->full_name, NULL); l = l->next; } - + exception: - + camel_store_free_folder_info (m->fromstore, fi); g_list_free (deleting); - + g_string_free (toname, TRUE); g_string_free (fromname, TRUE); } @@ -230,10 +230,10 @@ static void emft_copy_folders__free (struct _mail_msg *mm) { struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; - + camel_object_unref (m->fromstore); camel_object_unref (m->tostore); - + g_free (m->frombase); g_free (m->tobase); } @@ -284,7 +284,7 @@ emfu_copy_folder_selected (const char *uri, void *data) g_free (cfd); return; } - + camel_exception_init (&ex); if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) { @@ -292,13 +292,13 @@ emfu_copy_folder_selected (const char *uri, void *data) cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL); goto fail; } - + if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) { e_error_run(NULL, "mail:no-rename-special-folder", cfd->fi->full_name, NULL); goto fail; } - + if (!(tostore = camel_session_get_store (session, uri, &ex))) { e_error_run(NULL, cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL); @@ -314,7 +314,7 @@ emfu_copy_folder_selected (const char *uri, void *data) tobase = ""; em_folder_utils_copy_folders(fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete); - + camel_url_free (url); fail: if (fromstore) @@ -361,7 +361,7 @@ void em_folder_utils_copy_folder(CamelFolderInfo *folderinfo, int delete) { struct _copy_folder_data *cfd; - + cfd = g_malloc (sizeof (*cfd)); cfd->fi = folderinfo; cfd->delete = delete; @@ -376,40 +376,40 @@ emfu_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex) { while (fi) { CamelFolder *folder; - + if (fi->child) { emfu_delete_rec (store, fi->child, ex); if (camel_exception_is_set (ex)) return; } - + d(printf ("deleting folder '%s'\n", fi->full_name)); - + /* shouldn't camel do this itself? */ if (camel_store_supports_subscriptions (store)) camel_store_unsubscribe_folder (store, fi->full_name, NULL); - + if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex))) return; - + if (!CAMEL_IS_VEE_FOLDER (folder)) { GPtrArray *uids = camel_folder_get_uids (folder); int i; - + camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) camel_folder_delete_message (folder, uids->pdata[i]); - + camel_folder_free_uids (folder, uids); - + camel_folder_sync (folder, TRUE, NULL); camel_folder_thaw (folder); } - + camel_store_delete_folder (store, fi->full_name, ex); if (camel_exception_is_set (ex)) return; - + fi = fi->next; } } @@ -419,11 +419,11 @@ emfu_delete_folders (CamelStore *store, const char *full_name, CamelException *e { guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; CamelFolderInfo *fi; - + fi = camel_store_get_folder_info (store, full_name, flags, ex); if (camel_exception_is_set (ex)) return; - + emfu_delete_rec (store, fi, ex); camel_store_free_folder_info (store, fi); } @@ -434,10 +434,10 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) CamelStore *store; CamelException ex; char *full_name; - + full_name = g_object_get_data ((GObject *) dialog, "full_name"); store = g_object_get_data ((GObject *) dialog, "store"); - + if (response == GTK_RESPONSE_OK) { camel_exception_init (&ex); emfu_delete_folders (store, full_name, &ex); @@ -447,7 +447,7 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) camel_exception_clear (&ex); } } - + gtk_widget_destroy (dialog); } @@ -459,7 +459,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) GtkWidget *dialog; local = mail_component_peek_local_store (NULL); - + if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) { e_error_run(NULL, "mail:no-delete-special-folder", folder->full_name, NULL); return; @@ -495,12 +495,12 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-special-folder", folder->full_name, NULL); return; } - + if ((p = strrchr (folder->full_name, '/'))) base_len = (size_t) (p - folder->full_name); else base_len = 0; - + prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), folder->name); while (!done) { new_name = e_request_string (NULL, _("Rename Folder"), prompt, folder->name); @@ -515,7 +515,7 @@ em_folder_utils_rename_folder (CamelFolder *folder) CamelFolderInfo *fi; CamelException ex; char *path, *tmp; - + if (base_len > 0) { path = g_malloc (base_len + strlen (new_name) + 2); memcpy (path, folder->full_name, base_len); @@ -525,7 +525,7 @@ em_folder_utils_rename_folder (CamelFolder *folder) } else { path = g_strdup (new_name); } - + camel_exception_init (&ex); if ((fi = camel_store_get_folder_info (folder->parent_store, path, CAMEL_STORE_FOLDER_INFO_FAST, &ex)) != NULL) { camel_store_free_folder_info (folder->parent_store, fi); @@ -533,12 +533,12 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-folder-exists", folder->name, new_name, NULL); } else { const char *oldpath, *newpath; - + oldpath = folder->full_name; newpath = path; - + d(printf ("renaming %s to %s\n", oldpath, newpath)); - + camel_exception_clear (&ex); camel_store_rename_folder (folder->parent_store, oldpath, newpath, &ex); if (camel_exception_is_set (&ex)) { @@ -546,36 +546,36 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-folder", oldpath, newpath, ex.desc, NULL); camel_exception_clear (&ex); } - + done = TRUE; } - + g_free (path); } - + g_free (new_name); } } struct _EMCreateFolder { struct _mail_msg msg; - + /* input data */ CamelStore *store; char *full_name; char *parent; char *name; - + /* output data */ CamelFolderInfo *fi; - + /* callback data */ void (* done) (CamelFolderInfo *fi, void *user_data); void *user_data; }; /* Temporary Structure to hold data to pass across function */ -struct _EMCreateFolderTempData +struct _EMCreateFolderTempData { EMFolderTree * emft; EMFolderSelector * emfs; @@ -586,7 +586,7 @@ static char * emfu_create_folder__desc (struct _mail_msg *mm, int done) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + return g_strdup_printf (_("Creating folder `%s'"), m->full_name); } @@ -594,9 +594,9 @@ static void emfu_create_folder__create (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); - + if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &mm->ex))) { if (camel_store_supports_subscriptions (m->store)) camel_store_subscribe_folder (m->store, m->full_name, &mm->ex); @@ -607,7 +607,7 @@ static void emfu_create_folder__created (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + if (m->done) m->done (m->fi, m->user_data); } @@ -616,7 +616,7 @@ static void emfu_create_folder__free (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + camel_store_free_folder_info (m->store, m->fi); camel_object_unref (m->store); g_free (m->full_name); @@ -639,7 +639,7 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) struct _EMCreateFolder *m; const char *parent; int id; - + namebuf = g_strdup (full_name); if (!(name = strrchr (namebuf, '/'))) { name = namebuf; @@ -648,7 +648,7 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) *name++ = '\0'; parent = namebuf; } - + m = mail_msg_new (&create_folder_op, NULL, sizeof (struct _EMCreateFolder)); camel_object_ref (store); m->store = store; @@ -657,12 +657,12 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) m->name = g_strdup (name); m->user_data = user_data; m->done = done; - + g_free (namebuf); - + id = m->msg.seq; e_thread_put (mail_thread_new, (EMsg *) m); - + return id; } @@ -672,11 +672,11 @@ new_folder_created_cb (CamelFolderInfo *fi, void *user_data) struct _EMCreateFolderTempData *emcftd=user_data; if (fi){ gtk_widget_destroy ((GtkWidget *) emcftd->emfs); - + /* Exapnding newly created folder */ if (emcftd->emft) - em_folder_tree_set_selected ((EMFolderTree *) emcftd->emft, emcftd->uri, GPOINTER_TO_INT(g_object_get_data ((GObject *)emcftd->emft, "select")) ? FALSE : TRUE); - } + em_folder_tree_set_selected ((EMFolderTree *) emcftd->emft, emcftd->uri, GPOINTER_TO_INT(g_object_get_data ((GObject *)emcftd->emft, "select")) ? FALSE : TRUE); + } g_object_unref (emcftd->emfs); g_free (emcftd->uri); g_free (emcftd); @@ -690,7 +690,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d CamelException ex; CamelStore *store; struct _EMCreateFolderTempData *emcftd; - + if (response != GTK_RESPONSE_OK) { gtk_widget_destroy ((GtkWidget *) emfs); return; @@ -728,11 +728,11 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d emcftd->emfs = emfs; emcftd->uri = g_strdup (uri); emcftd->emft = (EMFolderTree *) data; - + g_object_ref (emfs); emfu_create_folder_real (si->store, path, new_folder_created_cb, emcftd); } - + camel_object_unref (store); camel_exception_clear (&ex); } @@ -746,7 +746,7 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft) model = mail_component_peek_tree_model (mail_component_peek ()); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); |