/* imap-engine-user-close.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-engine-user-close.vala, do not modify */

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 * Copyright 2018 Michael Gratton <mike@vee.net>
 *
 * 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 <gee.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#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;
typedef struct _GearyImapEngineReplayOperationPrivate GearyImapEngineReplayOperationPrivate;

#define GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER (geary_imap_db_email_identifier_get_type ())
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifier))
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifierClass))
#define GEARY_IMAP_DB_IS_EMAIL_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER))
#define GEARY_IMAP_DB_IS_EMAIL_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER))
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifierClass))

typedef struct _GearyImapDBEmailIdentifier GearyImapDBEmailIdentifier;
typedef struct _GearyImapDBEmailIdentifierClass GearyImapDBEmailIdentifierClass;
typedef enum  {
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_COMPLETED,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_CONTINUE
} GearyImapEngineReplayOperationStatus;

#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_TYPE_STATUS (geary_imap_engine_replay_operation_status_get_type ())

#define GEARY_IMAP_TYPE_FOLDER_SESSION (geary_imap_folder_session_get_type ())
#define GEARY_IMAP_FOLDER_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSession))
#define GEARY_IMAP_FOLDER_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSessionClass))
#define GEARY_IMAP_IS_FOLDER_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION))
#define GEARY_IMAP_IS_FOLDER_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_TYPE_FOLDER_SESSION))
#define GEARY_IMAP_FOLDER_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSessionClass))

typedef struct _GearyImapFolderSession GearyImapFolderSession;
typedef struct _GearyImapFolderSessionClass GearyImapFolderSessionClass;

#define GEARY_IMAP_ENGINE_TYPE_USER_CLOSE (geary_imap_engine_user_close_get_type ())
#define GEARY_IMAP_ENGINE_USER_CLOSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserClose))
#define GEARY_IMAP_ENGINE_USER_CLOSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserCloseClass))
#define GEARY_IMAP_ENGINE_IS_USER_CLOSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_USER_CLOSE))
#define GEARY_IMAP_ENGINE_IS_USER_CLOSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_USER_CLOSE))
#define GEARY_IMAP_ENGINE_USER_CLOSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserCloseClass))

typedef struct _GearyImapEngineUserClose GearyImapEngineUserClose;
typedef struct _GearyImapEngineUserCloseClass GearyImapEngineUserCloseClass;
typedef struct _GearyImapEngineUserClosePrivate GearyImapEngineUserClosePrivate;

#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;
enum  {
	GEARY_IMAP_ENGINE_USER_CLOSE_0_PROPERTY,
	GEARY_IMAP_ENGINE_USER_CLOSE_NUM_PROPERTIES
};
static GParamSpec* geary_imap_engine_user_close_properties[GEARY_IMAP_ENGINE_USER_CLOSE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef enum  {
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_SCOPE_LOCAL_AND_REMOTE,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_SCOPE_LOCAL_ONLY,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_SCOPE_REMOTE_ONLY
} GearyImapEngineReplayOperationScope;

#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_TYPE_SCOPE (geary_imap_engine_replay_operation_scope_get_type ())
typedef enum  {
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_ON_ERROR_THROW,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_ON_ERROR_RETRY,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_ON_ERROR_IGNORE_REMOTE
} GearyImapEngineReplayOperationOnError;

#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_TYPE_ON_ERROR (geary_imap_engine_replay_operation_on_error_get_type ())
typedef struct _GearyImapEngineUserCloseReplayLocalAsyncData GearyImapEngineUserCloseReplayLocalAsyncData;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GearyImapEngineReplayOperation {
	GearyBaseObject parent_instance;
	GearyImapEngineReplayOperationPrivate * priv;
};

struct _GearyImapEngineReplayOperationClass {
	GearyBaseObjectClass parent_class;
	void (*notify_remote_removed_position) (GearyImapEngineReplayOperation* self, GearyImapSequenceNumber* removed);
	void (*notify_remote_removed_ids) (GearyImapEngineReplayOperation* self, GeeCollection* ids);
	void (*get_ids_to_be_remote_removed) (GearyImapEngineReplayOperation* self, GeeCollection* ids);
	void (*replay_local_async) (GearyImapEngineReplayOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GearyImapEngineReplayOperationStatus (*replay_local_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	void (*replay_remote_async) (GearyImapEngineReplayOperation* self, GearyImapFolderSession* remote, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*replay_remote_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	void (*backout_local_async) (GearyImapEngineReplayOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*backout_local_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	gchar* (*describe_state) (GearyImapEngineReplayOperation* self);
};

struct _GearyImapEngineUserClose {
	GearyImapEngineReplayOperation parent_instance;
	GearyTrillian is_closing;
	GearyImapEngineUserClosePrivate * priv;
};

struct _GearyImapEngineUserCloseClass {
	GearyImapEngineReplayOperationClass parent_class;
};

struct _GearyImapEngineUserClosePrivate {
	GearyImapEngineMinimalFolder* owner;
	GCancellable* cancellable;
};

struct _GearyImapEngineUserCloseReplayLocalAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GearyImapEngineUserClose* self;
	GearyImapEngineReplayOperationStatus result;
	gboolean closing;
	GearyImapEngineMinimalFolder* _tmp0_;
	GCancellable* _tmp1_;
};

static gint GearyImapEngineUserClose_private_offset;
static gpointer geary_imap_engine_user_close_parent_class = NULL;

VALA_EXTERN GType geary_imap_engine_replay_operation_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_db_email_identifier_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_replay_operation_status_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_folder_session_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_user_close_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_minimal_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void geary_imap_engine_replay_operation_replay_local_async (GearyImapEngineReplayOperation* self,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
VALA_EXTERN GearyImapEngineReplayOperationStatus geary_imap_engine_replay_operation_replay_local_finish (GearyImapEngineReplayOperation* self,
                                                                                             GAsyncResult* _res_,
                                                                                             GError** error);
VALA_EXTERN gchar* geary_imap_engine_replay_operation_describe_state (GearyImapEngineReplayOperation* self);
VALA_EXTERN GearyImapEngineUserClose* geary_imap_engine_user_close_new (GearyImapEngineMinimalFolder* owner,
                                                            GCancellable* cancellable);
VALA_EXTERN GearyImapEngineUserClose* geary_imap_engine_user_close_construct (GType object_type,
                                                                  GearyImapEngineMinimalFolder* owner,
                                                                  GCancellable* cancellable);
VALA_EXTERN GType geary_imap_engine_replay_operation_scope_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_replay_operation_on_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineReplayOperation* geary_imap_engine_replay_operation_construct (GType object_type,
                                                                              const gchar* name,
                                                                              GearyImapEngineReplayOperationScope scope,
                                                                              GearyImapEngineReplayOperationOnError on_remote_error);
static void geary_imap_engine_user_close_real_replay_local_async_data_free (gpointer _data);
static void geary_imap_engine_user_close_real_replay_local_async (GearyImapEngineReplayOperation* base,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_);
static gboolean geary_imap_engine_user_close_real_replay_local_async_co (GearyImapEngineUserCloseReplayLocalAsyncData* _data_);
VALA_EXTERN void geary_imap_engine_minimal_folder_close_internal (GearyImapEngineMinimalFolder* self,
                                                      GearyFolderCloseReason local_reason,
                                                      GearyFolderCloseReason remote_reason,
                                                      GCancellable* cancellable,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
VALA_EXTERN gboolean geary_imap_engine_minimal_folder_close_internal_finish (GearyImapEngineMinimalFolder* self,
                                                                 GAsyncResult* _res_);
static void geary_imap_engine_user_close_replay_local_async_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static gchar* geary_imap_engine_user_close_real_describe_state (GearyImapEngineReplayOperation* base);
static void geary_imap_engine_user_close_finalize (GObject * obj);
static GType geary_imap_engine_user_close_get_type_once (void);

static inline gpointer
geary_imap_engine_user_close_get_instance_private (GearyImapEngineUserClose* self)
{
	return G_STRUCT_MEMBER_P (self, GearyImapEngineUserClose_private_offset);
}

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

GearyImapEngineUserClose*
geary_imap_engine_user_close_construct (GType object_type,
                                        GearyImapEngineMinimalFolder* owner,
                                        GCancellable* cancellable)
{
	GearyImapEngineUserClose * self = NULL;
	GearyImapEngineMinimalFolder* _tmp0_;
	GCancellable* _tmp1_;
	g_return_val_if_fail (GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER (owner), NULL);
	g_return_val_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()), NULL);
	self = (GearyImapEngineUserClose*) geary_imap_engine_replay_operation_construct (object_type, "UserClose", GEARY_IMAP_ENGINE_REPLAY_OPERATION_SCOPE_LOCAL_ONLY, GEARY_IMAP_ENGINE_REPLAY_OPERATION_ON_ERROR_THROW);
	_tmp0_ = _g_object_ref0 (owner);
	_g_object_unref0 (self->priv->owner);
	self->priv->owner = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (self->priv->cancellable);
	self->priv->cancellable = _tmp1_;
	return self;
}

GearyImapEngineUserClose*
geary_imap_engine_user_close_new (GearyImapEngineMinimalFolder* owner,
                                  GCancellable* cancellable)
{
	return geary_imap_engine_user_close_construct (GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, owner, cancellable);
}

static void
geary_imap_engine_user_close_real_replay_local_async_data_free (gpointer _data)
{
	GearyImapEngineUserCloseReplayLocalAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GearyImapEngineUserCloseReplayLocalAsyncData, _data_);
}

static void
geary_imap_engine_user_close_real_replay_local_async (GearyImapEngineReplayOperation* base,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	GearyImapEngineUserClose * self;
	GearyImapEngineUserCloseReplayLocalAsyncData* _data_;
	GearyImapEngineUserClose* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserClose);
	_data_ = g_slice_new0 (GearyImapEngineUserCloseReplayLocalAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, geary_imap_engine_user_close_real_replay_local_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	geary_imap_engine_user_close_real_replay_local_async_co (_data_);
}

static GearyImapEngineReplayOperationStatus
geary_imap_engine_user_close_replay_local_finish (GearyImapEngineReplayOperation* base,
                                                  GAsyncResult* _res_,
                                                  GError** error)
{
	GearyImapEngineReplayOperationStatus result;
	GearyImapEngineUserCloseReplayLocalAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return 0;
	}
	result = _data_->result;
	return result;
}

static void
geary_imap_engine_user_close_replay_local_async_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	GearyImapEngineUserCloseReplayLocalAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	geary_imap_engine_user_close_real_replay_local_async_co (_data_);
}

static gboolean
geary_imap_engine_user_close_real_replay_local_async_co (GearyImapEngineUserCloseReplayLocalAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->owner;
	_data_->_tmp1_ = _data_->self->priv->cancellable;
	_data_->_state_ = 1;
	geary_imap_engine_minimal_folder_close_internal (_data_->_tmp0_, GEARY_FOLDER_CLOSE_REASON_LOCAL_CLOSE, GEARY_FOLDER_CLOSE_REASON_REMOTE_CLOSE, _data_->_tmp1_, geary_imap_engine_user_close_replay_local_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->closing = geary_imap_engine_minimal_folder_close_internal_finish (_data_->_tmp0_, _data_->_res_);
	_data_->self->is_closing = geary_trillian_from_boolean (_data_->closing);
	_data_->result = GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_COMPLETED;
	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 gchar*
geary_imap_engine_user_close_real_describe_state (GearyImapEngineReplayOperation* base)
{
	GearyImapEngineUserClose * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserClose);
	_tmp0_ = geary_trillian_to_string (self->is_closing);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("is_closing: %s", _tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static void
geary_imap_engine_user_close_class_init (GearyImapEngineUserCloseClass * klass,
                                         gpointer klass_data)
{
	geary_imap_engine_user_close_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GearyImapEngineUserClose_private_offset);
	((GearyImapEngineReplayOperationClass *) klass)->replay_local_async = (void (*) (GearyImapEngineReplayOperation*, GAsyncReadyCallback, gpointer)) geary_imap_engine_user_close_real_replay_local_async;
	((GearyImapEngineReplayOperationClass *) klass)->replay_local_finish = (GearyImapEngineReplayOperationStatus (*) (GearyImapEngineReplayOperation*, GAsyncResult*, GError**)) geary_imap_engine_user_close_replay_local_finish;
	((GearyImapEngineReplayOperationClass *) klass)->describe_state = (gchar* (*) (GearyImapEngineReplayOperation*)) geary_imap_engine_user_close_real_describe_state;
	G_OBJECT_CLASS (klass)->finalize = geary_imap_engine_user_close_finalize;
}

static void
geary_imap_engine_user_close_instance_init (GearyImapEngineUserClose * self,
                                            gpointer klass)
{
	self->priv = geary_imap_engine_user_close_get_instance_private (self);
	self->is_closing = GEARY_TRILLIAN_UNKNOWN;
}

static void
geary_imap_engine_user_close_finalize (GObject * obj)
{
	GearyImapEngineUserClose * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_IMAP_ENGINE_TYPE_USER_CLOSE, GearyImapEngineUserClose);
	_g_object_unref0 (self->priv->owner);
	_g_object_unref0 (self->priv->cancellable);
	G_OBJECT_CLASS (geary_imap_engine_user_close_parent_class)->finalize (obj);
}

/**
 * Operation to close the folder.
 *
 * This is a replay queue operation to allow existing local ops to
 * complete, and to ease the implementation. See comments in {@link
 * MinimalFolder.close_async}.
 */
 G_GNUC_NO_INLINE static GType
geary_imap_engine_user_close_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEngineUserCloseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_engine_user_close_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEngineUserClose), 0, (GInstanceInitFunc) geary_imap_engine_user_close_instance_init, NULL };
	GType geary_imap_engine_user_close_type_id;
	geary_imap_engine_user_close_type_id = g_type_register_static (GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, "GearyImapEngineUserClose", &g_define_type_info, 0);
	GearyImapEngineUserClose_private_offset = g_type_add_instance_private (geary_imap_engine_user_close_type_id, sizeof (GearyImapEngineUserClosePrivate));
	return geary_imap_engine_user_close_type_id;
}

GType
geary_imap_engine_user_close_get_type (void)
{
	static gsize geary_imap_engine_user_close_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_engine_user_close_type_id__once)) {
		GType geary_imap_engine_user_close_type_id;
		geary_imap_engine_user_close_type_id = geary_imap_engine_user_close_get_type_once ();
		g_once_init_leave (&geary_imap_engine_user_close_type_id__once, geary_imap_engine_user_close_type_id);
	}
	return geary_imap_engine_user_close_type_id__once;
}

