/* imap-engine-gmail-spam-trash-folder.c generated by valac 0.56.19, the Vala compiler
 * generated from imap-engine-gmail-spam-trash-folder.vala, do not modify */

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-engine.h"
#include <glib-object.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER (geary_imap_engine_minimal_folder_get_type ())
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder))
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolderClass))
#define GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER))
#define GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER))
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolderClass))

typedef struct _GearyImapEngineMinimalFolder GearyImapEngineMinimalFolder;
typedef struct _GearyImapEngineMinimalFolderClass GearyImapEngineMinimalFolderClass;
typedef struct _GearyImapEngineMinimalFolderPrivate GearyImapEngineMinimalFolderPrivate;

#define GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION (geary_imap_engine_replay_operation_get_type ())
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperation))
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperationClass))
#define GEARY_IMAP_ENGINE_IS_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_IS_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperationClass))

typedef struct _GearyImapEngineReplayOperation GearyImapEngineReplayOperation;
typedef struct _GearyImapEngineReplayOperationClass GearyImapEngineReplayOperationClass;

#define GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER (geary_imap_engine_gmail_spam_trash_folder_get_type ())
#define GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, GearyImapEngineGmailSpamTrashFolder))
#define GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, GearyImapEngineGmailSpamTrashFolderClass))
#define GEARY_IMAP_ENGINE_IS_GMAIL_SPAM_TRASH_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER))
#define GEARY_IMAP_ENGINE_IS_GMAIL_SPAM_TRASH_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER))
#define GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, GearyImapEngineGmailSpamTrashFolderClass))

typedef struct _GearyImapEngineGmailSpamTrashFolder GearyImapEngineGmailSpamTrashFolder;
typedef struct _GearyImapEngineGmailSpamTrashFolderClass GearyImapEngineGmailSpamTrashFolderClass;
typedef struct _GearyImapEngineGmailSpamTrashFolderPrivate GearyImapEngineGmailSpamTrashFolderPrivate;
enum  {
	GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER_0_PROPERTY,
	GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER_NUM_PROPERTIES
};
static GParamSpec* geary_imap_engine_gmail_spam_trash_folder_properties[GEARY_IMAP_ENGINE_GMAIL_SPAM_TRASH_FOLDER_NUM_PROPERTIES];

#define GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT (geary_imap_engine_generic_account_get_type ())
#define GEARY_IMAP_ENGINE_GENERIC_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, GearyImapEngineGenericAccount))
#define GEARY_IMAP_ENGINE_GENERIC_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, GearyImapEngineGenericAccountClass))
#define GEARY_IMAP_ENGINE_IS_GENERIC_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT))
#define GEARY_IMAP_ENGINE_IS_GENERIC_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT))
#define GEARY_IMAP_ENGINE_GENERIC_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, GearyImapEngineGenericAccountClass))

typedef struct _GearyImapEngineGenericAccount GearyImapEngineGenericAccount;
typedef struct _GearyImapEngineGenericAccountClass GearyImapEngineGenericAccountClass;

#define GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT (geary_imap_engine_gmail_account_get_type ())
#define GEARY_IMAP_ENGINE_GMAIL_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, GearyImapEngineGmailAccount))
#define GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, GearyImapEngineGmailAccountClass))
#define GEARY_IMAP_ENGINE_IS_GMAIL_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT))
#define GEARY_IMAP_ENGINE_IS_GMAIL_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT))
#define GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, GearyImapEngineGmailAccountClass))

typedef struct _GearyImapEngineGmailAccount GearyImapEngineGmailAccount;
typedef struct _GearyImapEngineGmailAccountClass GearyImapEngineGmailAccountClass;

#define GEARY_IMAP_DB_TYPE_FOLDER (geary_imap_db_folder_get_type ())
#define GEARY_IMAP_DB_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolder))
#define GEARY_IMAP_DB_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolderClass))
#define GEARY_IMAP_DB_IS_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_DB_TYPE_FOLDER))
#define GEARY_IMAP_DB_IS_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_DB_TYPE_FOLDER))
#define GEARY_IMAP_DB_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolderClass))

typedef struct _GearyImapDBFolder GearyImapDBFolder;
typedef struct _GearyImapDBFolderClass GearyImapDBFolderClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData;
typedef struct _GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData;

struct _GearyImapEngineMinimalFolder {
	GearyFolder parent_instance;
	GearyImapEngineMinimalFolderPrivate * priv;
};

struct _GearyImapEngineMinimalFolderClass {
	GearyFolderClass parent_class;
	void (*notify_closing) (GearyImapEngineMinimalFolder* self, GeeList* final_ops);
	void (*mark_email_async) (GearyImapEngineMinimalFolder* self, GeeCollection* to_mark, GearyEmailFlags* flags_to_add, GearyEmailFlags* flags_to_remove, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*mark_email_finish) (GearyImapEngineMinimalFolder* self, GAsyncResult* _res_, GError** error);
	void (*copy_email_async) (GearyImapEngineMinimalFolder* self, GeeCollection* to_copy, GearyFolderPath* destination, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*copy_email_finish) (GearyImapEngineMinimalFolder* self, GAsyncResult* _res_, GError** error);
	void (*move_email_async) (GearyImapEngineMinimalFolder* self, GeeCollection* to_move, GearyFolderPath* destination, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GearyRevokable* (*move_email_finish) (GearyImapEngineMinimalFolder* self, GAsyncResult* _res_, GError** error);
	void (*notify_marked_email_removed) (GearyImapEngineMinimalFolder* self, GeeCollection* removed);
};

struct _GearyImapEngineGmailSpamTrashFolder {
	GearyImapEngineMinimalFolder parent_instance;
	GearyImapEngineGmailSpamTrashFolderPrivate * priv;
};

struct _GearyImapEngineGmailSpamTrashFolderClass {
	GearyImapEngineMinimalFolderClass parent_class;
};

struct _GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GearyImapEngineGmailSpamTrashFolder* self;
	GeeCollection* email_ids;
	GCancellable* cancellable;
	GError* _inner_error0_;
};

struct _GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GearyImapEngineGmailSpamTrashFolder* self;
	GCancellable* cancellable;
	GError* _inner_error0_;
};

static gpointer geary_imap_engine_gmail_spam_trash_folder_parent_class = NULL;
static GearyFolderSupportRemoveIface * geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_remove_parent_iface = NULL;
static GearyFolderSupportEmptyIface * geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_empty_parent_iface = NULL;

VALA_EXTERN GType geary_imap_engine_minimal_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_replay_operation_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_gmail_spam_trash_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_generic_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_gmail_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_db_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineGmailSpamTrashFolder* geary_imap_engine_gmail_spam_trash_folder_new (GearyImapEngineGmailAccount* account,
                                                                                    GearyImapDBFolder* local_folder,
                                                                                    GearyFolderSpecialUse use);
VALA_EXTERN GearyImapEngineGmailSpamTrashFolder* geary_imap_engine_gmail_spam_trash_folder_construct (GType object_type,
                                                                                          GearyImapEngineGmailAccount* account,
                                                                                          GearyImapDBFolder* local_folder,
                                                                                          GearyFolderSpecialUse use);
VALA_EXTERN GearyImapEngineMinimalFolder* geary_imap_engine_minimal_folder_new (GearyImapEngineGenericAccount* account,
                                                                    GearyImapDBFolder* local_folder,
                                                                    GearyFolderSpecialUse use);
VALA_EXTERN GearyImapEngineMinimalFolder* geary_imap_engine_minimal_folder_construct (GType object_type,
                                                                          GearyImapEngineGenericAccount* account,
                                                                          GearyImapDBFolder* local_folder,
                                                                          GearyFolderSpecialUse use);
static void geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_data_free (gpointer _data);
static void geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async (GearyFolderSupportRemove* base,
                                                                        GeeCollection* email_ids,
                                                                        GCancellable* cancellable,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static gboolean geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_co (GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_);
VALA_EXTERN void geary_imap_engine_minimal_folder_expunge_email_async (GearyImapEngineMinimalFolder* self,
                                                           GeeCollection* to_expunge,
                                                           GCancellable* cancellable,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_);
VALA_EXTERN void geary_imap_engine_minimal_folder_expunge_email_finish (GearyImapEngineMinimalFolder* self,
                                                            GAsyncResult* _res_,
                                                            GError** error);
static void geary_imap_engine_gmail_spam_trash_folder_remove_email_async_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_);
static void geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_data_free (gpointer _data);
static void geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async (GearyFolderSupportEmpty* base,
                                                                        GCancellable* cancellable,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static gboolean geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_co (GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_);
VALA_EXTERN void geary_imap_engine_minimal_folder_expunge_all_async (GearyImapEngineMinimalFolder* self,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN void geary_imap_engine_minimal_folder_expunge_all_finish (GearyImapEngineMinimalFolder* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void geary_imap_engine_gmail_spam_trash_folder_empty_folder_async_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_);
static GType geary_imap_engine_gmail_spam_trash_folder_get_type_once (void);

GearyImapEngineGmailSpamTrashFolder*
geary_imap_engine_gmail_spam_trash_folder_construct (GType object_type,
                                                     GearyImapEngineGmailAccount* account,
                                                     GearyImapDBFolder* local_folder,
                                                     GearyFolderSpecialUse use)
{
	GearyImapEngineGmailSpamTrashFolder * self = NULL;
	g_return_val_if_fail (GEARY_IMAP_ENGINE_IS_GMAIL_ACCOUNT (account), NULL);
	g_return_val_if_fail (GEARY_IMAP_DB_IS_FOLDER (local_folder), NULL);
	self = (GearyImapEngineGmailSpamTrashFolder*) geary_imap_engine_minimal_folder_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (account, GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, GearyImapEngineGenericAccount), local_folder, use);
	return self;
}

GearyImapEngineGmailSpamTrashFolder*
geary_imap_engine_gmail_spam_trash_folder_new (GearyImapEngineGmailAccount* account,
                                               GearyImapDBFolder* local_folder,
                                               GearyFolderSpecialUse use)
{
	return geary_imap_engine_gmail_spam_trash_folder_construct (GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, account, local_folder, use);
}

static void
geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_data_free (gpointer _data)
{
	GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->email_ids);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async (GearyFolderSupportRemove* base,
                                                                   GeeCollection* email_ids,
                                                                   GCancellable* cancellable,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	GearyImapEngineGmailSpamTrashFolder * self;
	GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_;
	GearyImapEngineGmailSpamTrashFolder* _tmp0_;
	GeeCollection* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (email_ids, GEE_TYPE_COLLECTION));
	g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()));
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, GearyImapEngineGmailSpamTrashFolder);
	_data_ = g_slice_new0 (GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (email_ids);
	_g_object_unref0 (_data_->email_ids);
	_data_->email_ids = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_co (_data_);
}

static void
geary_imap_engine_gmail_spam_trash_folder_remove_email_finish (GearyFolderSupportRemove* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
geary_imap_engine_gmail_spam_trash_folder_remove_email_async_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_)
{
	GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_co (_data_);
}

static gboolean
geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async_co (GearyImapEngineGmailSpamTrashFolderRemoveEmailAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	geary_imap_engine_minimal_folder_expunge_email_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder), _data_->email_ids, _data_->cancellable, geary_imap_engine_gmail_spam_trash_folder_remove_email_async_ready, _data_);
	return FALSE;
	_state_1:
	geary_imap_engine_minimal_folder_expunge_email_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_data_free (gpointer _data)
{
	GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData, _data_);
}

static void
geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async (GearyFolderSupportEmpty* base,
                                                                   GCancellable* cancellable,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	GearyImapEngineGmailSpamTrashFolder * self;
	GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_;
	GearyImapEngineGmailSpamTrashFolder* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()));
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_GMAIL_SPAM_TRASH_FOLDER, GearyImapEngineGmailSpamTrashFolder);
	_data_ = g_slice_new0 (GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_co (_data_);
}

static void
geary_imap_engine_gmail_spam_trash_folder_empty_folder_finish (GearyFolderSupportEmpty* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
geary_imap_engine_gmail_spam_trash_folder_empty_folder_async_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_)
{
	GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_co (_data_);
}

static gboolean
geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async_co (GearyImapEngineGmailSpamTrashFolderEmptyFolderAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	geary_imap_engine_minimal_folder_expunge_all_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder), _data_->cancellable, geary_imap_engine_gmail_spam_trash_folder_empty_folder_async_ready, _data_);
	return FALSE;
	_state_1:
	geary_imap_engine_minimal_folder_expunge_all_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
geary_imap_engine_gmail_spam_trash_folder_class_init (GearyImapEngineGmailSpamTrashFolderClass * klass,
                                                      gpointer klass_data)
{
	geary_imap_engine_gmail_spam_trash_folder_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_remove_interface_init (GearyFolderSupportRemoveIface * iface,
                                                                                      gpointer iface_data)
{
	geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_remove_parent_iface = g_type_interface_peek_parent (iface);
	iface->remove_email_async = (void (*) (GearyFolderSupportRemove*, GeeCollection*, GCancellable*, GAsyncReadyCallback, gpointer)) geary_imap_engine_gmail_spam_trash_folder_real_remove_email_async;
	iface->remove_email_finish = (void (*) (GearyFolderSupportRemove*, GAsyncResult*, GError**)) geary_imap_engine_gmail_spam_trash_folder_remove_email_finish;
}

static void
geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_empty_interface_init (GearyFolderSupportEmptyIface * iface,
                                                                                     gpointer iface_data)
{
	geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_empty_parent_iface = g_type_interface_peek_parent (iface);
	iface->empty_folder_async = (void (*) (GearyFolderSupportEmpty*, GCancellable*, GAsyncReadyCallback, gpointer)) geary_imap_engine_gmail_spam_trash_folder_real_empty_folder_async;
	iface->empty_folder_finish = (void (*) (GearyFolderSupportEmpty*, GAsyncResult*, GError**)) geary_imap_engine_gmail_spam_trash_folder_empty_folder_finish;
}

static void
geary_imap_engine_gmail_spam_trash_folder_instance_init (GearyImapEngineGmailSpamTrashFolder * self,
                                                         gpointer klass)
{
}

/**
 * Gmail's Spam and Trash folders support basic operations and
 * removing messages with a traditional IMAP STORE/EXPUNGE operation.
 */
 G_GNUC_NO_INLINE static GType
geary_imap_engine_gmail_spam_trash_folder_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEngineGmailSpamTrashFolderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_engine_gmail_spam_trash_folder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEngineGmailSpamTrashFolder), 0, (GInstanceInitFunc) geary_imap_engine_gmail_spam_trash_folder_instance_init, NULL };
	static const GInterfaceInfo geary_folder_support_remove_info = { (GInterfaceInitFunc) geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_remove_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo geary_folder_support_empty_info = { (GInterfaceInitFunc) geary_imap_engine_gmail_spam_trash_folder_geary_folder_support_empty_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_engine_gmail_spam_trash_folder_type_id;
	geary_imap_engine_gmail_spam_trash_folder_type_id = g_type_register_static (GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, "GearyImapEngineGmailSpamTrashFolder", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_engine_gmail_spam_trash_folder_type_id, GEARY_FOLDER_SUPPORT_TYPE_REMOVE, &geary_folder_support_remove_info);
	g_type_add_interface_static (geary_imap_engine_gmail_spam_trash_folder_type_id, GEARY_FOLDER_SUPPORT_TYPE_EMPTY, &geary_folder_support_empty_info);
	return geary_imap_engine_gmail_spam_trash_folder_type_id;
}

GType
geary_imap_engine_gmail_spam_trash_folder_get_type (void)
{
	static gsize geary_imap_engine_gmail_spam_trash_folder_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_engine_gmail_spam_trash_folder_type_id__once)) {
		GType geary_imap_engine_gmail_spam_trash_folder_type_id;
		geary_imap_engine_gmail_spam_trash_folder_type_id = geary_imap_engine_gmail_spam_trash_folder_get_type_once ();
		g_once_init_leave (&geary_imap_engine_gmail_spam_trash_folder_type_id__once, geary_imap_engine_gmail_spam_trash_folder_type_id);
	}
	return geary_imap_engine_gmail_spam_trash_folder_type_id__once;
}

