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

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 * Copyright 2019 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 <glib-object.h>
#include <glib.h>

#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;
typedef struct _GearyImapEngineGenericAccountPrivate GearyImapEngineGenericAccountPrivate;

#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 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;

#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;
typedef struct _GearyImapEngineGmailAccountPrivate GearyImapEngineGmailAccountPrivate;
enum  {
	GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_0_PROPERTY,
	GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_NUM_PROPERTIES
};
static GParamSpec* geary_imap_engine_gmail_account_properties[GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_NUM_PROPERTIES];

#define GEARY_IMAP_DB_TYPE_ACCOUNT (geary_imap_db_account_get_type ())
#define GEARY_IMAP_DB_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_DB_TYPE_ACCOUNT, GearyImapDBAccount))
#define GEARY_IMAP_DB_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_DB_TYPE_ACCOUNT, GearyImapDBAccountClass))
#define GEARY_IMAP_DB_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_DB_TYPE_ACCOUNT))
#define GEARY_IMAP_DB_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_DB_TYPE_ACCOUNT))
#define GEARY_IMAP_DB_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_DB_TYPE_ACCOUNT, GearyImapDBAccountClass))

typedef struct _GearyImapDBAccount GearyImapDBAccount;
typedef struct _GearyImapDBAccountClass GearyImapDBAccountClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER (geary_imap_engine_gmail_all_mail_folder_get_type ())
#define GEARY_IMAP_ENGINE_GMAIL_ALL_MAIL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER, GearyImapEngineGmailAllMailFolder))
#define GEARY_IMAP_ENGINE_GMAIL_ALL_MAIL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER, GearyImapEngineGmailAllMailFolderClass))
#define GEARY_IMAP_ENGINE_IS_GMAIL_ALL_MAIL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER))
#define GEARY_IMAP_ENGINE_IS_GMAIL_ALL_MAIL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER))
#define GEARY_IMAP_ENGINE_GMAIL_ALL_MAIL_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_ALL_MAIL_FOLDER, GearyImapEngineGmailAllMailFolderClass))

typedef struct _GearyImapEngineGmailAllMailFolder GearyImapEngineGmailAllMailFolder;
typedef struct _GearyImapEngineGmailAllMailFolderClass GearyImapEngineGmailAllMailFolderClass;

#define GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER (geary_imap_engine_gmail_drafts_folder_get_type ())
#define GEARY_IMAP_ENGINE_GMAIL_DRAFTS_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER, GearyImapEngineGmailDraftsFolder))
#define GEARY_IMAP_ENGINE_GMAIL_DRAFTS_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER, GearyImapEngineGmailDraftsFolderClass))
#define GEARY_IMAP_ENGINE_IS_GMAIL_DRAFTS_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER))
#define GEARY_IMAP_ENGINE_IS_GMAIL_DRAFTS_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER))
#define GEARY_IMAP_ENGINE_GMAIL_DRAFTS_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_DRAFTS_FOLDER, GearyImapEngineGmailDraftsFolderClass))

typedef struct _GearyImapEngineGmailDraftsFolder GearyImapEngineGmailDraftsFolder;
typedef struct _GearyImapEngineGmailDraftsFolderClass GearyImapEngineGmailDraftsFolderClass;

#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;

#define GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER (geary_imap_engine_gmail_folder_get_type ())
#define GEARY_IMAP_ENGINE_GMAIL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER, GearyImapEngineGmailFolder))
#define GEARY_IMAP_ENGINE_GMAIL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER, GearyImapEngineGmailFolderClass))
#define GEARY_IMAP_ENGINE_IS_GMAIL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER))
#define GEARY_IMAP_ENGINE_IS_GMAIL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER))
#define GEARY_IMAP_ENGINE_GMAIL_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GMAIL_FOLDER, GearyImapEngineGmailFolderClass))

typedef struct _GearyImapEngineGmailFolder GearyImapEngineGmailFolder;
typedef struct _GearyImapEngineGmailFolderClass GearyImapEngineGmailFolderClass;

struct _GearyImapEngineGenericAccount {
	GearyAccount parent_instance;
	GearyImapEngineGenericAccountPrivate * priv;
};

struct _GearyImapEngineGenericAccountClass {
	GearyAccountClass parent_class;
	GearyImapEngineMinimalFolder* (*new_folder) (GearyImapEngineGenericAccount* self, GearyImapDBFolder* local_folder);
	GearyFolderSpecialUse* (*get_supported_special_folders) (GearyImapEngineGenericAccount* self, gint* result_length1);
};

struct _GearyImapEngineGmailAccount {
	GearyImapEngineGenericAccount parent_instance;
	GearyImapEngineGmailAccountPrivate * priv;
};

struct _GearyImapEngineGmailAccountClass {
	GearyImapEngineGenericAccountClass parent_class;
};

static gpointer geary_imap_engine_gmail_account_parent_class = NULL;

VALA_EXTERN GType geary_imap_engine_generic_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_db_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_minimal_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_gmail_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyFolderSpecialUse* geary_imap_engine_generic_account_get_supported_special_folders (GearyImapEngineGenericAccount* self,
                                                                                        gint* result_length1);
VALA_EXTERN GearyImapEngineMinimalFolder* geary_imap_engine_generic_account_new_folder (GearyImapEngineGenericAccount* self,
                                                                            GearyImapDBFolder* local_folder);
VALA_EXTERN void geary_imap_engine_gmail_account_setup_account (GearyAccountInformation* account);
VALA_EXTERN void geary_imap_engine_gmail_account_setup_service (GearyServiceInformation* service);
VALA_EXTERN GType geary_imap_db_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineGmailAccount* geary_imap_engine_gmail_account_new (GearyAccountInformation* config,
                                                                  GearyImapDBAccount* local,
                                                                  GearyEndpoint* incoming_remote,
                                                                  GearyEndpoint* outgoing_remote);
VALA_EXTERN GearyImapEngineGmailAccount* geary_imap_engine_gmail_account_construct (GType object_type,
                                                                        GearyAccountInformation* config,
                                                                        GearyImapDBAccount* local,
                                                                        GearyEndpoint* incoming_remote,
                                                                        GearyEndpoint* outgoing_remote);
VALA_EXTERN GearyImapEngineGenericAccount* geary_imap_engine_generic_account_construct (GType object_type,
                                                                            GearyAccountInformation* config,
                                                                            GearyImapDBAccount* local,
                                                                            GearyEndpoint* incoming_remote,
                                                                            GearyEndpoint* outgoing_remote);
static GearyFolderSpecialUse* geary_imap_engine_gmail_account_real_get_supported_special_folders (GearyImapEngineGenericAccount* base,
                                                                                           gint* result_length1);
static GearyFolderSpecialUse* _vala_array_dup7 (GearyFolderSpecialUse* self,
                                         gssize length);
static GearyImapEngineMinimalFolder* geary_imap_engine_gmail_account_real_new_folder (GearyImapEngineGenericAccount* base,
                                                                               GearyImapDBFolder* local_folder);
VALA_EXTERN GearyFolderPath* geary_imap_db_folder_get_path (GearyImapDBFolder* self);
VALA_EXTERN GearyImapFolderProperties* geary_imap_db_folder_get_properties (GearyImapDBFolder* self);
VALA_EXTERN GearyImapEngineGmailAllMailFolder* geary_imap_engine_gmail_all_mail_folder_new (GearyImapEngineGmailAccount* account,
                                                                                GearyImapDBFolder* local_folder);
VALA_EXTERN GearyImapEngineGmailAllMailFolder* geary_imap_engine_gmail_all_mail_folder_construct (GType object_type,
                                                                                      GearyImapEngineGmailAccount* account,
                                                                                      GearyImapDBFolder* local_folder);
VALA_EXTERN GType geary_imap_engine_gmail_all_mail_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineGmailDraftsFolder* geary_imap_engine_gmail_drafts_folder_new (GearyImapEngineGmailAccount* account,
                                                                             GearyImapDBFolder* local_folder);
VALA_EXTERN GearyImapEngineGmailDraftsFolder* geary_imap_engine_gmail_drafts_folder_construct (GType object_type,
                                                                                   GearyImapEngineGmailAccount* account,
                                                                                   GearyImapDBFolder* local_folder);
VALA_EXTERN GType geary_imap_engine_gmail_drafts_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 GType geary_imap_engine_gmail_spam_trash_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineGmailFolder* geary_imap_engine_gmail_folder_new (GearyImapEngineGmailAccount* account,
                                                                GearyImapDBFolder* local_folder,
                                                                GearyFolderSpecialUse use);
VALA_EXTERN GearyImapEngineGmailFolder* geary_imap_engine_gmail_folder_construct (GType object_type,
                                                                      GearyImapEngineGmailAccount* account,
                                                                      GearyImapDBFolder* local_folder,
                                                                      GearyFolderSpecialUse use);
VALA_EXTERN GType geary_imap_engine_gmail_folder_get_type (void) G_GNUC_CONST ;
static GType geary_imap_engine_gmail_account_get_type_once (void);

static const GearyFolderSpecialUse GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_SUPPORTED_SPECIAL_FOLDERS[4] = {GEARY_FOLDER_SPECIAL_USE_DRAFTS, GEARY_FOLDER_SPECIAL_USE_SENT, GEARY_FOLDER_SPECIAL_USE_JUNK, GEARY_FOLDER_SPECIAL_USE_TRASH};

void
geary_imap_engine_gmail_account_setup_account (GearyAccountInformation* account)
{
	g_return_if_fail (GEARY_IS_ACCOUNT_INFORMATION (account));
	geary_account_information_set_save_sent (account, FALSE);
}

void
geary_imap_engine_gmail_account_setup_service (GearyServiceInformation* service)
{
	GearyProtocol _tmp0_;
	GearyProtocol _tmp1_;
	g_return_if_fail (GEARY_IS_SERVICE_INFORMATION (service));
	_tmp0_ = geary_service_information_get_protocol (service);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case GEARY_PROTOCOL_IMAP:
		{
			geary_service_information_set_host (service, "imap.gmail.com");
			geary_service_information_set_port (service, GEARY_IMAP_IMAP_TLS_PORT);
			geary_service_information_set_transport_security (service, GEARY_TLS_NEGOTIATION_METHOD_TRANSPORT);
			break;
		}
		case GEARY_PROTOCOL_SMTP:
		{
			geary_service_information_set_host (service, "smtp.gmail.com");
			geary_service_information_set_port (service, GEARY_SMTP_SUBMISSION_TLS_PORT);
			geary_service_information_set_transport_security (service, GEARY_TLS_NEGOTIATION_METHOD_TRANSPORT);
			break;
		}
		default:
		break;
	}
}

GearyImapEngineGmailAccount*
geary_imap_engine_gmail_account_construct (GType object_type,
                                           GearyAccountInformation* config,
                                           GearyImapDBAccount* local,
                                           GearyEndpoint* incoming_remote,
                                           GearyEndpoint* outgoing_remote)
{
	GearyImapEngineGmailAccount * self = NULL;
	g_return_val_if_fail (GEARY_IS_ACCOUNT_INFORMATION (config), NULL);
	g_return_val_if_fail (GEARY_IMAP_DB_IS_ACCOUNT (local), NULL);
	g_return_val_if_fail (GEARY_IS_ENDPOINT (incoming_remote), NULL);
	g_return_val_if_fail (GEARY_IS_ENDPOINT (outgoing_remote), NULL);
	self = (GearyImapEngineGmailAccount*) geary_imap_engine_generic_account_construct (object_type, config, local, incoming_remote, outgoing_remote);
	return self;
}

GearyImapEngineGmailAccount*
geary_imap_engine_gmail_account_new (GearyAccountInformation* config,
                                     GearyImapDBAccount* local,
                                     GearyEndpoint* incoming_remote,
                                     GearyEndpoint* outgoing_remote)
{
	return geary_imap_engine_gmail_account_construct (GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, config, local, incoming_remote, outgoing_remote);
}

static GearyFolderSpecialUse*
_vala_array_dup7 (GearyFolderSpecialUse* self,
                  gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (GearyFolderSpecialUse));
	}
	return NULL;
}

static GearyFolderSpecialUse*
geary_imap_engine_gmail_account_real_get_supported_special_folders (GearyImapEngineGenericAccount* base,
                                                                    gint* result_length1)
{
	GearyImapEngineGmailAccount * self;
	GearyFolderSpecialUse* _tmp0_;
	gint _tmp0__length1;
	GearyFolderSpecialUse* _tmp1_;
	gint _tmp1__length1;
	GearyFolderSpecialUse* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, GearyImapEngineGmailAccount);
	_tmp0_ = _vala_array_dup7 (GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_SUPPORTED_SPECIAL_FOLDERS, G_N_ELEMENTS (GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_SUPPORTED_SPECIAL_FOLDERS));
	_tmp0__length1 = G_N_ELEMENTS (GEARY_IMAP_ENGINE_GMAIL_ACCOUNT_SUPPORTED_SPECIAL_FOLDERS);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

static GearyImapEngineMinimalFolder*
geary_imap_engine_gmail_account_real_new_folder (GearyImapEngineGenericAccount* base,
                                                 GearyImapDBFolder* local_folder)
{
	GearyImapEngineGmailAccount * self;
	GearyFolderPath* path = NULL;
	GearyFolderPath* _tmp0_;
	GearyFolderPath* _tmp1_;
	GearyFolderSpecialUse use = 0;
	GearyFolderPath* _tmp2_;
	GearyImapEngineMinimalFolder* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_GMAIL_ACCOUNT, GearyImapEngineGmailAccount);
	g_return_val_if_fail (GEARY_IMAP_DB_IS_FOLDER (local_folder), NULL);
	_tmp0_ = geary_imap_db_folder_get_path (local_folder);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	path = _tmp1_;
	use = GEARY_FOLDER_SPECIAL_USE_NONE;
	_tmp2_ = path;
	if (geary_imap_mailbox_specifier_folder_path_is_inbox (_tmp2_)) {
		use = GEARY_FOLDER_SPECIAL_USE_INBOX;
	} else {
		GearyImapFolderProperties* _tmp3_;
		GearyImapFolderProperties* _tmp4_;
		GearyImapMailboxAttributes* _tmp5_;
		GearyImapMailboxAttributes* _tmp6_;
		_tmp3_ = geary_imap_db_folder_get_properties (local_folder);
		_tmp4_ = _tmp3_;
		_tmp5_ = geary_imap_folder_properties_get_attrs (_tmp4_);
		_tmp6_ = _tmp5_;
		use = geary_imap_mailbox_attributes_get_special_use (_tmp6_);
		_g_object_unref0 (_tmp4_);
		if (use == GEARY_FOLDER_SPECIAL_USE_INBOX) {
			use = GEARY_FOLDER_SPECIAL_USE_NONE;
		}
	}
	switch (use) {
		case GEARY_FOLDER_SPECIAL_USE_ALL_MAIL:
		{
			GearyImapEngineGmailAllMailFolder* _tmp7_;
			_tmp7_ = geary_imap_engine_gmail_all_mail_folder_new (self, local_folder);
			result = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder);
			_g_object_unref0 (path);
			return result;
		}
		case GEARY_FOLDER_SPECIAL_USE_DRAFTS:
		{
			GearyImapEngineGmailDraftsFolder* _tmp8_;
			_tmp8_ = geary_imap_engine_gmail_drafts_folder_new (self, local_folder);
			result = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder);
			_g_object_unref0 (path);
			return result;
		}
		case GEARY_FOLDER_SPECIAL_USE_JUNK:
		case GEARY_FOLDER_SPECIAL_USE_TRASH:
		{
			GearyImapEngineGmailSpamTrashFolder* _tmp9_;
			_tmp9_ = geary_imap_engine_gmail_spam_trash_folder_new (self, local_folder, use);
			result = G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder);
			_g_object_unref0 (path);
			return result;
		}
		default:
		{
			GearyImapEngineGmailFolder* _tmp10_;
			_tmp10_ = geary_imap_engine_gmail_folder_new (self, local_folder, use);
			result = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder);
			_g_object_unref0 (path);
			return result;
		}
	}
}

static void
geary_imap_engine_gmail_account_class_init (GearyImapEngineGmailAccountClass * klass,
                                            gpointer klass_data)
{
	geary_imap_engine_gmail_account_parent_class = g_type_class_peek_parent (klass);
	((GearyImapEngineGenericAccountClass *) klass)->get_supported_special_folders = (GearyFolderSpecialUse* (*) (GearyImapEngineGenericAccount*, gint*)) geary_imap_engine_gmail_account_real_get_supported_special_folders;
	((GearyImapEngineGenericAccountClass *) klass)->new_folder = (GearyImapEngineMinimalFolder* (*) (GearyImapEngineGenericAccount*, GearyImapDBFolder*)) geary_imap_engine_gmail_account_real_new_folder;
}

static void
geary_imap_engine_gmail_account_instance_init (GearyImapEngineGmailAccount * self,
                                               gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_engine_gmail_account_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEngineGmailAccountClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_engine_gmail_account_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEngineGmailAccount), 0, (GInstanceInitFunc) geary_imap_engine_gmail_account_instance_init, NULL };
	GType geary_imap_engine_gmail_account_type_id;
	geary_imap_engine_gmail_account_type_id = g_type_register_static (GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, "GearyImapEngineGmailAccount", &g_define_type_info, 0);
	return geary_imap_engine_gmail_account_type_id;
}

GType
geary_imap_engine_gmail_account_get_type (void)
{
	static gsize geary_imap_engine_gmail_account_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_engine_gmail_account_type_id__once)) {
		GType geary_imap_engine_gmail_account_type_id;
		geary_imap_engine_gmail_account_type_id = geary_imap_engine_gmail_account_get_type_once ();
		g_once_init_leave (&geary_imap_engine_gmail_account_type_id__once, geary_imap_engine_gmail_account_type_id);
	}
	return geary_imap_engine_gmail_account_type_id__once;
}

