/* imap-engine-other-account.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-engine-other-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_OTHER_ACCOUNT (geary_imap_engine_other_account_get_type ())
#define GEARY_IMAP_ENGINE_OTHER_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT, GearyImapEngineOtherAccount))
#define GEARY_IMAP_ENGINE_OTHER_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT, GearyImapEngineOtherAccountClass))
#define GEARY_IMAP_ENGINE_IS_OTHER_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT))
#define GEARY_IMAP_ENGINE_IS_OTHER_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT))
#define GEARY_IMAP_ENGINE_OTHER_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT, GearyImapEngineOtherAccountClass))

typedef struct _GearyImapEngineOtherAccount GearyImapEngineOtherAccount;
typedef struct _GearyImapEngineOtherAccountClass GearyImapEngineOtherAccountClass;
typedef struct _GearyImapEngineOtherAccountPrivate GearyImapEngineOtherAccountPrivate;
enum  {
	GEARY_IMAP_ENGINE_OTHER_ACCOUNT_0_PROPERTY,
	GEARY_IMAP_ENGINE_OTHER_ACCOUNT_NUM_PROPERTIES
};
static GParamSpec* geary_imap_engine_other_account_properties[GEARY_IMAP_ENGINE_OTHER_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_GENERIC_FOLDER (geary_imap_engine_generic_folder_get_type ())
#define GEARY_IMAP_ENGINE_GENERIC_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_FOLDER, GearyImapEngineGenericFolder))
#define GEARY_IMAP_ENGINE_GENERIC_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_GENERIC_FOLDER, GearyImapEngineGenericFolderClass))
#define GEARY_IMAP_ENGINE_IS_GENERIC_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_FOLDER))
#define GEARY_IMAP_ENGINE_IS_GENERIC_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_GENERIC_FOLDER))
#define GEARY_IMAP_ENGINE_GENERIC_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_GENERIC_FOLDER, GearyImapEngineGenericFolderClass))

typedef struct _GearyImapEngineGenericFolder GearyImapEngineGenericFolder;
typedef struct _GearyImapEngineGenericFolderClass GearyImapEngineGenericFolderClass;

#define GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER (geary_imap_engine_other_folder_get_type ())
#define GEARY_IMAP_ENGINE_OTHER_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER, GearyImapEngineOtherFolder))
#define GEARY_IMAP_ENGINE_OTHER_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER, GearyImapEngineOtherFolderClass))
#define GEARY_IMAP_ENGINE_IS_OTHER_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER))
#define GEARY_IMAP_ENGINE_IS_OTHER_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER))
#define GEARY_IMAP_ENGINE_OTHER_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_OTHER_FOLDER, GearyImapEngineOtherFolderClass))

typedef struct _GearyImapEngineOtherFolder GearyImapEngineOtherFolder;
typedef struct _GearyImapEngineOtherFolderClass GearyImapEngineOtherFolderClass;

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 _GearyImapEngineOtherAccount {
	GearyImapEngineGenericAccount parent_instance;
	GearyImapEngineOtherAccountPrivate * priv;
};

struct _GearyImapEngineOtherAccountClass {
	GearyImapEngineGenericAccountClass parent_class;
};

static gpointer geary_imap_engine_other_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_other_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineMinimalFolder* geary_imap_engine_generic_account_new_folder (GearyImapEngineGenericAccount* self,
                                                                            GearyImapDBFolder* local_folder);
VALA_EXTERN GType geary_imap_db_account_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapEngineOtherAccount* geary_imap_engine_other_account_new (GearyAccountInformation* config,
                                                                  GearyImapDBAccount* local,
                                                                  GearyEndpoint* incoming_remote,
                                                                  GearyEndpoint* outgoing_remote);
VALA_EXTERN GearyImapEngineOtherAccount* geary_imap_engine_other_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 GearyImapEngineMinimalFolder* geary_imap_engine_other_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 GearyImapEngineOtherFolder* geary_imap_engine_other_folder_new (GearyImapEngineOtherAccount* account,
                                                                GearyImapDBFolder* local_folder,
                                                                GearyFolderSpecialUse use);
VALA_EXTERN GearyImapEngineOtherFolder* geary_imap_engine_other_folder_construct (GType object_type,
                                                                      GearyImapEngineOtherAccount* account,
                                                                      GearyImapDBFolder* local_folder,
                                                                      GearyFolderSpecialUse use);
VALA_EXTERN GType geary_imap_engine_generic_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_other_folder_get_type (void) G_GNUC_CONST ;
static GType geary_imap_engine_other_account_get_type_once (void);

GearyImapEngineOtherAccount*
geary_imap_engine_other_account_construct (GType object_type,
                                           GearyAccountInformation* config,
                                           GearyImapDBAccount* local,
                                           GearyEndpoint* incoming_remote,
                                           GearyEndpoint* outgoing_remote)
{
	GearyImapEngineOtherAccount * 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 = (GearyImapEngineOtherAccount*) geary_imap_engine_generic_account_construct (object_type, config, local, incoming_remote, outgoing_remote);
	return self;
}

GearyImapEngineOtherAccount*
geary_imap_engine_other_account_new (GearyAccountInformation* config,
                                     GearyImapDBAccount* local,
                                     GearyEndpoint* incoming_remote,
                                     GearyEndpoint* outgoing_remote)
{
	return geary_imap_engine_other_account_construct (GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT, config, local, incoming_remote, outgoing_remote);
}

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

static GearyImapEngineMinimalFolder*
geary_imap_engine_other_account_real_new_folder (GearyImapEngineGenericAccount* base,
                                                 GearyImapDBFolder* local_folder)
{
	GearyImapEngineOtherAccount * self;
	GearyFolderPath* path = NULL;
	GearyFolderPath* _tmp0_;
	GearyFolderPath* _tmp1_;
	GearyFolderSpecialUse use = 0;
	GearyFolderPath* _tmp2_;
	GearyImapEngineOtherFolder* _tmp7_;
	GearyImapEngineMinimalFolder* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_OTHER_ACCOUNT, GearyImapEngineOtherAccount);
	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;
		}
	}
	_tmp7_ = geary_imap_engine_other_folder_new (self, local_folder, use);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder);
	_g_object_unref0 (path);
	return result;
}

static void
geary_imap_engine_other_account_class_init (GearyImapEngineOtherAccountClass * klass,
                                            gpointer klass_data)
{
	geary_imap_engine_other_account_parent_class = g_type_class_peek_parent (klass);
	((GearyImapEngineGenericAccountClass *) klass)->new_folder = (GearyImapEngineMinimalFolder* (*) (GearyImapEngineGenericAccount*, GearyImapDBFolder*)) geary_imap_engine_other_account_real_new_folder;
}

static void
geary_imap_engine_other_account_instance_init (GearyImapEngineOtherAccount * self,
                                               gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_engine_other_account_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEngineOtherAccountClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_engine_other_account_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEngineOtherAccount), 0, (GInstanceInitFunc) geary_imap_engine_other_account_instance_init, NULL };
	GType geary_imap_engine_other_account_type_id;
	geary_imap_engine_other_account_type_id = g_type_register_static (GEARY_IMAP_ENGINE_TYPE_GENERIC_ACCOUNT, "GearyImapEngineOtherAccount", &g_define_type_info, 0);
	return geary_imap_engine_other_account_type_id;
}

GType
geary_imap_engine_other_account_get_type (void)
{
	static gsize geary_imap_engine_other_account_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_engine_other_account_type_id__once)) {
		GType geary_imap_engine_other_account_type_id;
		geary_imap_engine_other_account_type_id = geary_imap_engine_other_account_get_type_once ();
		g_once_init_leave (&geary_imap_engine_other_account_type_id__once, geary_imap_engine_other_account_type_id);
	}
	return geary_imap_engine_other_account_type_id__once;
}

