diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-20 02:56:17 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-21 01:14:53 +0800 |
commit | 86c9c4d793b3f9eff93fe00ad579427f254c5882 (patch) | |
tree | dd3ada63e738ac124789b64421728e6f32dd7144 | |
parent | 0c790b10190c2cff5fdb7cc1b25dc2a41dedd707 (diff) | |
download | gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar.gz gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar.bz2 gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar.lz gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar.xz gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.tar.zst gsoc2013-evolution-86c9c4d793b3f9eff93fe00ad579427f254c5882.zip |
Remove mail_remove_folder().
Use e_mail_folder_remove() instead.
-rw-r--r-- | mail/e-mail-backend.c | 2 | ||||
-rw-r--r-- | mail/e-mail-folder-utils.c | 203 | ||||
-rw-r--r-- | mail/e-mail-folder-utils.h | 12 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 132 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.h | 2 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 106 | ||||
-rw-r--r-- | mail/em-folder-utils.h | 2 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 2 | ||||
-rw-r--r-- | mail/mail-folder-cache.h | 2 | ||||
-rw-r--r-- | mail/mail-ops.c | 163 | ||||
-rw-r--r-- | mail/mail-ops.h | 5 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 11 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.h | 1 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 2 |
14 files changed, 359 insertions, 286 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index eaf3bd05b1..11362e5d58 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -367,7 +367,7 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, const gchar *uid; gchar *folder_uri; gint folder_type; - gint flags = 0; + CamelFolderInfoFlags flags = 0; folder_uri = e_mail_folder_uri_build (store, folder_fullname); diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c index f244260bf5..e0b4471041 100644 --- a/mail/e-mail-folder-utils.c +++ b/mail/e-mail-folder-utils.c @@ -673,6 +673,209 @@ e_mail_folder_get_multiple_messages_finish (CamelFolder *folder, } static void +mail_folder_remove_thread (GSimpleAsyncResult *simple, + GObject *object, + GCancellable *cancellable) +{ + GError *error = NULL; + + e_mail_folder_remove_sync ( + CAMEL_FOLDER (object), cancellable, &error); + + if (error != NULL) { + g_simple_async_result_set_from_error (simple, error); + g_error_free (error); + } +} + +static gboolean +mail_folder_remove_recursive (CamelStore *store, + CamelFolderInfo *folder_info, + GCancellable *cancellable, + GError **error) +{ + gboolean success = TRUE; + + while (folder_info != NULL) { + CamelFolder *folder; + + if (folder_info->child != NULL) { + success = mail_folder_remove_recursive ( + store, folder_info->child, cancellable, error); + if (!success) + break; + } + + folder = camel_store_get_folder_sync ( + store, folder_info->full_name, 0, cancellable, error); + if (folder == NULL) { + success = FALSE; + break; + } + + if (!CAMEL_IS_VEE_FOLDER (folder)) { + GPtrArray *uids; + guint ii; + + /* Delete every message in this folder, + * then expunge it. */ + + camel_folder_freeze (folder); + + uids = camel_folder_get_uids (folder); + + for (ii = 0; ii < uids->len; ii++) + camel_folder_delete_message ( + folder, uids->pdata[ii]); + + camel_folder_free_uids (folder, uids); + + success = camel_folder_synchronize_sync ( + folder, TRUE, cancellable, error); + + camel_folder_thaw (folder); + } + + g_object_unref (folder); + + if (!success) + break; + + /* If the store supports subscriptions, + * then unsubscribe from this folder. */ + if (camel_store_supports_subscriptions (store)) { + success = camel_store_unsubscribe_folder_sync ( + store, folder_info->full_name, + cancellable, error); + if (!success) + break; + } + + success = camel_store_delete_folder_sync ( + store, folder_info->full_name, cancellable, error); + if (!success) + break; + + folder_info = folder_info->next; + } + + return success; +} + +gboolean +e_mail_folder_remove_sync (CamelFolder *folder, + GCancellable *cancellable, + GError **error) +{ + CamelFolderInfo *folder_info; + CamelFolderInfo *to_remove; + CamelFolderInfo *next = NULL; + CamelStore *parent_store; + const gchar *full_name; + gboolean success = TRUE; + + g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE); + + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + folder_info = camel_store_get_folder_info_sync ( + parent_store, full_name, + CAMEL_STORE_FOLDER_INFO_FAST | + CAMEL_STORE_FOLDER_INFO_RECURSIVE | + CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, + cancellable, error); + + if (folder_info == NULL) + return FALSE; + + to_remove = folder_info; + + /* For cases when the top-level folder_info contains siblings, + * such as when full_name contains a wildcard letter, compare + * the folder name against folder_info->full_name to avoid + * removing more folders than requested. */ + if (folder_info->next != NULL) { + while (to_remove != NULL) { + if (g_strcmp0 (to_remove->full_name, full_name) == 0) + break; + to_remove = to_remove->next; + } + + /* XXX Should we set a GError and return FALSE here? */ + if (to_remove == NULL) { + g_warning ( + "%s: Failed to find folder '%s'", + G_STRFUNC, full_name); + camel_store_free_folder_info ( + parent_store, folder_info); + return TRUE; + } + + /* Prevent iterating over siblings. */ + next = to_remove->next; + to_remove->next = NULL; + } + + camel_operation_push_message ( + cancellable, _("Removing folder '%s'"), + camel_folder_get_full_name (folder)); + + success = mail_folder_remove_recursive ( + parent_store, to_remove, cancellable, error); + + camel_operation_pop_message (cancellable); + + /* Restore the folder_info tree to its original + * state so we don't leak folder_info nodes. */ + to_remove->next = next; + + camel_store_free_folder_info (parent_store, folder_info); + + return success; +} + +void +e_mail_folder_remove (CamelFolder *folder, + gint io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *simple; + + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + + simple = g_simple_async_result_new ( + G_OBJECT (folder), callback, + user_data, e_mail_folder_remove); + + g_simple_async_result_run_in_thread ( + simple, mail_folder_remove_thread, + io_priority, cancellable); + + g_object_unref (simple); +} + +gboolean +e_mail_folder_remove_finish (CamelFolder *folder, + GAsyncResult *result, + GError **error) +{ + GSimpleAsyncResult *simple; + + g_return_val_if_fail ( + g_simple_async_result_is_valid ( + result, G_OBJECT (folder), + e_mail_folder_remove), FALSE); + + simple = G_SIMPLE_ASYNC_RESULT (result); + + /* Assume success unless a GError is set. */ + return !g_simple_async_result_propagate_error (simple, error); +} + +static void mail_folder_remove_attachments_thread (GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable) diff --git a/mail/e-mail-folder-utils.h b/mail/e-mail-folder-utils.h index 5b178f4a90..c82d806d7a 100644 --- a/mail/e-mail-folder-utils.h +++ b/mail/e-mail-folder-utils.h @@ -97,6 +97,18 @@ GHashTable * e_mail_folder_get_multiple_messages_finish GAsyncResult *result, GError **error); +gboolean e_mail_folder_remove_sync (CamelFolder *folder, + GCancellable *cancellable, + GError **error); +void e_mail_folder_remove (CamelFolder *folder, + gint io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean e_mail_folder_remove_finish (CamelFolder *folder, + GAsyncResult *result, + GError **error); + gboolean e_mail_folder_remove_attachments_sync (CamelFolder *folder, GPtrArray *message_uids, diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 8e88d7d31a..18f5df7295 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -36,6 +36,7 @@ #include "mail/e-mail-backend.h" #include "mail/e-mail-browser.h" #include "mail/e-mail-folder-utils.h" +#include "mail/e-mail-local.h" #include "mail/em-composer-utils.h" #include "mail/em-format-html-print.h" #include "mail/em-utils.h" @@ -75,6 +76,16 @@ async_context_free (AsyncContext *context) g_slice_free (AsyncContext, context); } +static gboolean +mail_reader_is_special_local_folder (const gchar *name) +{ + return (strcmp (name, "Drafts") == 0 || + strcmp (name, "Inbox") == 0 || + strcmp (name, "Outbox") == 0 || + strcmp (name, "Sent") == 0 || + strcmp (name, "Templates") == 0); +} + void e_mail_reader_activate (EMailReader *reader, const gchar *action_name) @@ -157,6 +168,127 @@ e_mail_reader_confirm_delete (EMailReader *reader) return (response == GTK_RESPONSE_OK); } +static void +mail_reader_delete_folder_cb (CamelFolder *folder, + GAsyncResult *result, + AsyncContext *context) +{ + EAlertSink *alert_sink; + GError *error = NULL; + + alert_sink = e_activity_get_alert_sink (context->activity); + + e_mail_folder_remove_finish (folder, result, &error); + + if (e_activity_handle_cancellation (context->activity, error)) { + g_error_free (error); + + } else if (error != NULL) { + e_alert_submit ( + alert_sink, "mail:no-delete-folder", + camel_folder_get_full_name (folder), + error->message, NULL); + g_error_free (error); + } + + async_context_free (context); +} + +void +e_mail_reader_delete_folder (EMailReader *reader, + CamelFolder *folder) +{ + CamelStore *local_store; + CamelStore *parent_store; + EMailBackend *backend; + EMailSession *session; + EAlertSink *alert_sink; + MailFolderCache *folder_cache; + GtkWindow *parent = e_shell_get_active_window (NULL); + GtkWidget *dialog; + const gchar *full_name; + CamelFolderInfoFlags flags = 0; + gboolean have_flags; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + backend = e_mail_reader_get_backend (reader); + session = e_mail_backend_get_session (backend); + + local_store = e_mail_local_get_store (); + alert_sink = e_mail_reader_get_alert_sink (reader); + folder_cache = e_mail_session_get_folder_cache (session); + + if (parent_store == local_store && + mail_reader_is_special_local_folder (full_name)) { + e_mail_backend_submit_alert ( + backend, "mail:no-delete-special-folder", + full_name, NULL); + return; + } + + have_flags = mail_folder_cache_get_folder_info_flags ( + folder_cache, folder, &flags); + + if (have_flags && (flags & CAMEL_FOLDER_SYSTEM)) { + e_alert_submit ( + alert_sink, "mail:no-delete-special-folder", + camel_folder_get_display_name (folder), NULL); + return; + } + + if (have_flags && (flags & CAMEL_FOLDER_CHILDREN)) { + if (CAMEL_IS_VEE_STORE (parent_store)) + dialog = e_alert_dialog_new_for_args ( + parent, "mail:ask-delete-vfolder", + full_name, NULL); + else + dialog = e_alert_dialog_new_for_args ( + parent, "mail:ask-delete-folder", + full_name, NULL); + } else { + if (CAMEL_IS_VEE_STORE (parent_store)) + dialog = e_alert_dialog_new_for_args ( + parent, "mail:ask-delete-vfolder-nochild", + full_name, NULL); + else + dialog = e_alert_dialog_new_for_args ( + parent, "mail:ask-delete-folder-nochild", + full_name, NULL); + } + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { + EActivity *activity; + AsyncContext *context; + GCancellable *cancellable; + + activity = e_mail_reader_new_activity (reader); + cancellable = e_activity_get_cancellable (activity); + + context = g_slice_new0 (AsyncContext); + context->activity = activity; + context->reader = g_object_ref (reader); + + /* Disable the dialog until the activity finishes. */ + gtk_widget_set_sensitive (dialog, FALSE); + + /* Destroy the dialog once the activity finishes. */ + g_object_set_data_full ( + G_OBJECT (activity), "delete-dialog", + dialog, (GDestroyNotify) gtk_widget_destroy); + + e_mail_folder_remove ( + folder, G_PRIORITY_DEFAULT, + cancellable, (GAsyncReadyCallback) + mail_reader_delete_folder_cb, context); + } else + gtk_widget_destroy (dialog); +} + void e_mail_reader_mark_as_read (EMailReader *reader, const gchar *uid) diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h index b59ff3c8b7..95643e6327 100644 --- a/mail/e-mail-reader-utils.h +++ b/mail/e-mail-reader-utils.h @@ -39,6 +39,8 @@ struct _EMailReaderHeader { void e_mail_reader_activate (EMailReader *reader, const gchar *action_name); gboolean e_mail_reader_confirm_delete (EMailReader *reader); +void e_mail_reader_delete_folder (EMailReader *reader, + CamelFolder *folder); void e_mail_reader_mark_as_read (EMailReader *reader, const gchar *uid); guint e_mail_reader_mark_selected (EMailReader *reader, diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index c13337bf68..60f03002f0 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -476,112 +476,6 @@ em_folder_utils_copy_folder (GtkWindow *parent, gtk_widget_destroy (dialog); } -typedef struct { - EMailBackend *backend; - GtkWidget *dialog; -} DeleteFolderData; - -static void -emfu_delete_done (CamelFolder *folder, - gboolean removed, - GError **error, - gpointer user_data) -{ - DeleteFolderData *data = user_data; - - if (error != NULL && *error != NULL) { - e_mail_backend_submit_alert ( - data->backend, - "mail:no-delete-folder", - camel_folder_get_full_name (folder), - (*error)->message, NULL); - g_clear_error (error); - } - - g_object_unref (data->backend); - gtk_widget_destroy (data->dialog); - g_slice_free (DeleteFolderData, data); -} - -/* FIXME: these functions must be documented */ -void -em_folder_utils_delete_folder (EMailBackend *backend, - CamelFolder *folder) -{ - CamelStore *local_store; - CamelStore *parent_store; - EMailSession *session; - MailFolderCache *folder_cache; - GtkWindow *parent = e_shell_get_active_window (NULL); - GtkWidget *dialog; - const gchar *full_name; - gint flags = 0; - - g_return_if_fail (E_IS_MAIL_BACKEND (backend)); - g_return_if_fail (CAMEL_IS_FOLDER (folder)); - - full_name = camel_folder_get_full_name (folder); - parent_store = camel_folder_get_parent_store (folder); - - local_store = e_mail_local_get_store (); - session = e_mail_backend_get_session (backend); - folder_cache = e_mail_session_get_folder_cache (session); - - if (parent_store == local_store && emfu_is_special_local_folder (full_name)) { - e_mail_backend_submit_alert ( - backend, "mail:no-delete-special-folder", - full_name, NULL); - return; - } - - if (mail_folder_cache_get_folder_info_flags ( - folder_cache, folder, &flags) && - (flags & CAMEL_FOLDER_SYSTEM)) { - e_mail_backend_submit_alert ( - backend, "mail:no-delete-special-folder", - camel_folder_get_display_name (folder), NULL); - return; - } - - g_object_ref (folder); - - if (mail_folder_cache_get_folder_info_flags ( - folder_cache, folder, &flags) && - (flags & CAMEL_FOLDER_CHILDREN)) { - if (parent_store && CAMEL_IS_VEE_STORE (parent_store)) - dialog = e_alert_dialog_new_for_args ( - parent, "mail:ask-delete-vfolder", - full_name, NULL); - else - dialog = e_alert_dialog_new_for_args ( - parent, "mail:ask-delete-folder", - full_name, NULL); - } else { - if (parent_store && CAMEL_IS_VEE_STORE (parent_store)) - dialog = e_alert_dialog_new_for_args ( - parent, "mail:ask-delete-vfolder-nochild", - full_name, NULL); - else - dialog = e_alert_dialog_new_for_args ( - parent, "mail:ask-delete-folder-nochild", - full_name, NULL); - } - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - DeleteFolderData *data; - - /* disable dialog until operation finishes */ - gtk_widget_set_sensitive (dialog, FALSE); - - data = g_slice_new0 (DeleteFolderData); - data->backend = g_object_ref (backend); - data->dialog = dialog; - - mail_remove_folder (folder, emfu_delete_done, data); - } else - gtk_widget_destroy (dialog); -} - struct _EMCreateFolder { MailMsg base; diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h index 8f7a2c70d3..e3d86d1d02 100644 --- a/mail/em-folder-utils.h +++ b/mail/em-folder-utils.h @@ -44,8 +44,6 @@ void em_folder_utils_copy_folder (GtkWindow *parent, EMailBackend *backend, const gchar *folder_uri, gboolean delete); -void em_folder_utils_delete_folder (EMailBackend *backend, - CamelFolder *folder); void em_folder_utils_create_folder (GtkWindow *parent, EMFolderTree *emft, EMailSession *session, diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 8885ce47be..dcfa9d78f7 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -1336,7 +1336,7 @@ mail_folder_cache_get_folder_from_uri (MailFolderCache *self, gboolean mail_folder_cache_get_folder_info_flags (MailFolderCache *self, CamelFolder *folder, - gint *flags) + CamelFolderInfoFlags *flags) { struct _find_info fi = { NULL, NULL }; gchar *folder_uri; diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h index f89d2d9aed..681c6efdda 100644 --- a/mail/mail-folder-cache.h +++ b/mail/mail-folder-cache.h @@ -100,7 +100,7 @@ gboolean mail_folder_cache_get_folder_from_uri gboolean mail_folder_cache_get_folder_info_flags (MailFolderCache *self, CamelFolder *folder, - gint *flags); + CamelFolderInfoFlags *flags); gboolean mail_folder_cache_get_folder_has_children (MailFolderCache *self, diff --git a/mail/mail-ops.c b/mail/mail-ops.c index cbb50315ec..67906957bd 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1031,169 +1031,6 @@ mail_transfer_messages (EMailSession *session, mail_msg_slow_ordered_push (m); } -/* ** REMOVE FOLDER ******************************************************* */ - -struct _remove_folder_msg { - MailMsg base; - - CamelFolder *folder; - gboolean removed; - void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data); - gpointer data; -}; - -static gchar * -remove_folder_desc (struct _remove_folder_msg *m) -{ - return g_strdup_printf (_("Removing folder '%s'"), camel_folder_get_full_name (m->folder)); -} - -static gboolean -remove_folder_rec (CamelStore *store, - CamelFolderInfo *fi, - GCancellable *cancellable, - GError **error) -{ - while (fi) { - CamelFolder *folder; - - if (fi->child) { - if (!remove_folder_rec ( - store, fi->child, cancellable, error)) - return FALSE; - } - - d(printf ("deleting folder '%s'\n", fi->full_name)); - - folder = camel_store_get_folder_sync ( - store, fi->full_name, 0, cancellable, error); - if (folder == NULL) - return FALSE; - - if (!CAMEL_IS_VEE_FOLDER (folder)) { - GPtrArray *uids = camel_folder_get_uids (folder); - gint i; - - /* Delete every message in this folder, then expunge it */ - 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); - - /* FIXME Not passing a GCancellable or GError here. */ - camel_folder_synchronize_sync (folder, TRUE, NULL, NULL); - camel_folder_thaw (folder); - } - - /* If the store supports subscriptions, unsubscribe - * from this folder. - * FIXME Not passing a GCancellable or GError here. */ - if (camel_store_supports_subscriptions (store)) - camel_store_unsubscribe_folder_sync ( - store, fi->full_name, NULL, NULL); - - /* Then delete the folder from the store */ - if (!camel_store_delete_folder_sync ( - store, fi->full_name, cancellable, error)) - return FALSE; - - fi = fi->next; - } - - return TRUE; -} - -static void -remove_folder_exec (struct _remove_folder_msg *m, - GCancellable *cancellable, - GError **error) -{ - CamelFolderInfo *fi, *to_remove, *next = NULL; - CamelStore *parent_store; - const gchar *full_name; - - m->removed = FALSE; - - full_name = camel_folder_get_full_name (m->folder); - parent_store = camel_folder_get_parent_store (m->folder); - - fi = camel_store_get_folder_info_sync ( - parent_store, full_name, - CAMEL_STORE_FOLDER_INFO_RECURSIVE | - CAMEL_STORE_FOLDER_INFO_FAST | - CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, - cancellable, error); - if (fi == NULL) - return; - - if (fi->next) { - /* for cases when the folder info contains more folders on the 0-level, - like when full_name contains a wildcard letter, use only folder info - for the the exact full_name, to not delete more than requested */ - for (to_remove = fi; to_remove; to_remove = to_remove->next) { - if (g_strcmp0 (to_remove->full_name, full_name) == 0) - break; - } - - if (!to_remove) { - g_warning ("%s: Failed to find '%s' in returned folder info", G_STRFUNC, full_name); - camel_store_free_folder_info (parent_store, fi); - return; - } - - next = to_remove->next; - to_remove->next = NULL; - } else { - to_remove = fi; - } - - m->removed = remove_folder_rec ( - parent_store, to_remove, cancellable, error); - - to_remove->next = next; - - camel_store_free_folder_info (parent_store, fi); -} - -static void -remove_folder_done (struct _remove_folder_msg *m) -{ - if (m->done) - m->done (m->folder, m->removed, &m->base.error, m->data); -} - -static void -remove_folder_free (struct _remove_folder_msg *m) -{ - g_object_unref (m->folder); -} - -static MailMsgInfo remove_folder_info = { - sizeof (struct _remove_folder_msg), - (MailMsgDescFunc) remove_folder_desc, - (MailMsgExecFunc) remove_folder_exec, - (MailMsgDoneFunc) remove_folder_done, - (MailMsgFreeFunc) remove_folder_free -}; - -void -mail_remove_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data), gpointer data) -{ - struct _remove_folder_msg *m; - - g_return_if_fail (folder != NULL); - - m = mail_msg_new (&remove_folder_info); - m->folder = folder; - g_object_ref (folder); - m->data = data; - m->done = done; - - mail_msg_unordered_push (m); -} - /* ** SYNC FOLDER ********************************************************* */ struct _sync_folder_msg { diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 8e808d42bb..9803a6bb85 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -60,11 +60,6 @@ void mail_empty_trash (EMailSession *session, void (*done) (EAccount *account, gpointer data), gpointer data); -/* remove an existing folder */ -void mail_remove_folder (CamelFolder *folder, - void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data), - gpointer data); - /* transfer (copy/move) a folder */ void mail_xfer_folder (const gchar *src_uri, const gchar *dest_uri, gboolean remove_source, void (*done) (gchar *src_uri, gchar *dest_uri, gboolean remove_source, diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index dcef6afe74..90096393e3 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -278,22 +278,21 @@ static void action_mail_folder_delete_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; - EShellBackend *shell_backend; - EShellView *shell_view; + EMailView *mail_view; EMFolderTree *folder_tree; CamelFolder *folder; - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_backend = e_shell_view_get_shell_backend (shell_view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); folder = em_folder_tree_get_selected_folder (folder_tree); g_return_if_fail (folder != NULL); - em_folder_utils_delete_folder ( - E_MAIL_BACKEND (shell_backend), folder); + e_mail_reader_delete_folder (E_MAIL_READER (mail_view), folder); } static void diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index 15bcf8ccf3..9bd276db1d 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -43,6 +43,7 @@ #include "e-mail-label-list-store.h" #include "e-mail-local.h" #include "e-mail-reader.h" +#include "e-mail-reader-utils.h" #include "e-mail-session.h" #include "e-mail-session-utils.h" #include "e-mail-sidebar.h" diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 7a620a6db8..562a74eb9a 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -2261,7 +2261,7 @@ in_proper_folder (CamelFolder *folder) EMailSession *session; MailFolderCache *folder_cache; gboolean res = TRUE; - gint flags = 0; + CamelFolderInfoFlags flags = 0; if (!folder) return FALSE; |