/* application-email-store-factory.c generated by valac 0.56.3, the Vala compiler
 * generated from application-email-store-factory.vala, do not modify */

/*
 * Copyright © 2020 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 <gee.h>
#include "geary-client-43.0.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>

#define APPLICATION_EMAIL_STORE_FACTORY_REQUIRED_FIELDS (GEARY_EMAIL_FIELD_ENVELOPE | GEARY_EMAIL_FIELD_FLAGS)

#define APPLICATION_TYPE_EMAIL_STORE_FACTORY (application_email_store_factory_get_type ())
#define APPLICATION_EMAIL_STORE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_EMAIL_STORE_FACTORY, ApplicationEmailStoreFactory))
#define APPLICATION_EMAIL_STORE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_EMAIL_STORE_FACTORY, ApplicationEmailStoreFactoryClass))
#define APPLICATION_IS_EMAIL_STORE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_EMAIL_STORE_FACTORY))
#define APPLICATION_IS_EMAIL_STORE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_EMAIL_STORE_FACTORY))
#define APPLICATION_EMAIL_STORE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_EMAIL_STORE_FACTORY, ApplicationEmailStoreFactoryClass))

typedef struct _ApplicationEmailStoreFactory ApplicationEmailStoreFactory;
typedef struct _ApplicationEmailStoreFactoryClass ApplicationEmailStoreFactoryClass;
typedef struct _ApplicationEmailStoreFactoryPrivate ApplicationEmailStoreFactoryPrivate;

#define APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL (application_plugin_manager_account_impl_get_type ())
#define APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImpl))
#define APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImplClass))
#define APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL))
#define APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL))
#define APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImplClass))

typedef struct _ApplicationPluginManagerAccountImpl ApplicationPluginManagerAccountImpl;
typedef struct _ApplicationPluginManagerAccountImplClass ApplicationPluginManagerAccountImplClass;

#define APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL (application_email_store_factory_email_store_impl_get_type ())
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl))
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImplClass))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_STORE_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_STORE_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImplClass))

typedef struct _ApplicationEmailStoreFactoryEmailStoreImpl ApplicationEmailStoreFactoryEmailStoreImpl;
typedef struct _ApplicationEmailStoreFactoryEmailStoreImplClass ApplicationEmailStoreFactoryEmailStoreImplClass;
enum  {
	APPLICATION_EMAIL_STORE_FACTORY_0_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_NUM_PROPERTIES
};
static GParamSpec* application_email_store_factory_properties[APPLICATION_EMAIL_STORE_FACTORY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL (application_email_store_factory_email_impl_get_type ())
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl))
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImplClass))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImplClass))

typedef struct _ApplicationEmailStoreFactoryEmailImpl ApplicationEmailStoreFactoryEmailImpl;
typedef struct _ApplicationEmailStoreFactoryEmailImplClass ApplicationEmailStoreFactoryEmailImplClass;

#define APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL (application_email_store_factory_id_impl_get_type ())
#define APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl))
#define APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImplClass))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL))
#define APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImplClass))

typedef struct _ApplicationEmailStoreFactoryIdImpl ApplicationEmailStoreFactoryIdImpl;
typedef struct _ApplicationEmailStoreFactoryIdImplClass ApplicationEmailStoreFactoryIdImplClass;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ApplicationEmailStoreFactoryEmailStoreImplPrivate ApplicationEmailStoreFactoryEmailStoreImplPrivate;
enum  {
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_0_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_EMAIL_IDENTIFIER_VARIANT_TYPE_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_email_store_factory_email_store_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_NUM_PROPERTIES];
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
typedef struct _ApplicationEmailStoreFactoryIdImplPrivate ApplicationEmailStoreFactoryIdImplPrivate;
typedef struct _ApplicationEmailStoreFactoryEmailStoreImplGetEmailData ApplicationEmailStoreFactoryEmailStoreImplGetEmailData;
typedef struct _ApplicationEmailStoreFactoryEmailImplPrivate ApplicationEmailStoreFactoryEmailImplPrivate;
enum  {
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_0_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IDENTIFIER_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FROM_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SENDER_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REPLY_TO_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_TO_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_CC_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BCC_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_MESSAGE_ID_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IN_REPLY_TO_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REFERENCES_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SUBJECT_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_DATE_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FLAGS_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_NUM_PROPERTIES];
typedef struct _ApplicationEmailStoreFactoryEmailImplLoadBodyAsData ApplicationEmailStoreFactoryEmailImplLoadBodyAsData;
enum  {
	APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_0_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_ACCOUNT_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY,
	APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_email_store_factory_id_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_NUM_PROPERTIES];

struct _ApplicationEmailStoreFactory {
	GearyBaseObject parent_instance;
	ApplicationEmailStoreFactoryPrivate * priv;
};

struct _ApplicationEmailStoreFactoryClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationEmailStoreFactoryPrivate {
	GeeMap* accounts;
	GeeSet* stores;
};

struct _ApplicationEmailStoreFactoryEmailStoreImpl {
	GearyBaseObject parent_instance;
	ApplicationEmailStoreFactoryEmailStoreImplPrivate * priv;
};

struct _ApplicationEmailStoreFactoryEmailStoreImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationEmailStoreFactoryEmailStoreImplPrivate {
	ApplicationEmailStoreFactory* factory;
	GVariantType* _email_id_variant_type;
};

struct _ApplicationEmailStoreFactoryIdImpl {
	GearyBaseObject parent_instance;
	ApplicationPluginManagerAccountImpl* account_impl;
	ApplicationEmailStoreFactoryIdImplPrivate * priv;
};

struct _ApplicationEmailStoreFactoryIdImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationEmailStoreFactoryEmailStoreImplGetEmailData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationEmailStoreFactoryEmailStoreImpl* self;
	GeeCollection* plugin_ids;
	GCancellable* cancellable;
	GeeCollection* result;
	GeeHashSet* emails;
	GeeHashSet* _tmp0_;
	GeeHashMap* found_accounts;
	GeeHashMap* _tmp1_;
	ApplicationAccountContext* current_account;
	GeeSet* engine_ids;
	GeeIterator* _plugin_id_it;
	GeeIterator* _tmp2_;
	GeeIterator* _tmp3_;
	PluginEmailIdentifier* plugin_id;
	GeeIterator* _tmp4_;
	gpointer _tmp5_;
	ApplicationEmailStoreFactoryIdImpl* id_impl;
	PluginEmailIdentifier* _tmp6_;
	ApplicationEmailStoreFactoryIdImpl* _tmp7_;
	ApplicationEmailStoreFactoryIdImpl* _tmp8_;
	ApplicationEmailStoreFactoryIdImpl* _tmp9_;
	ApplicationPluginManagerAccountImpl* _tmp10_;
	ApplicationAccountContext* _tmp11_;
	ApplicationAccountContext* _tmp12_;
	ApplicationAccountContext* _tmp13_;
	ApplicationEmailStoreFactoryIdImpl* _tmp14_;
	ApplicationPluginManagerAccountImpl* _tmp15_;
	ApplicationAccountContext* _tmp16_;
	ApplicationAccountContext* _tmp17_;
	ApplicationAccountContext* _tmp18_;
	GeeHashMap* _tmp19_;
	ApplicationAccountContext* _tmp20_;
	gpointer _tmp21_;
	GeeSet* _tmp22_;
	GeeHashSet* _tmp23_;
	GeeHashMap* _tmp24_;
	ApplicationAccountContext* _tmp25_;
	GeeSet* _tmp26_;
	GeeSet* _tmp27_;
	ApplicationEmailStoreFactoryIdImpl* _tmp28_;
	GearyEmailIdentifier* _tmp29_;
	GearyEmailIdentifier* _tmp30_;
	GeeIterator* _context_it;
	GeeHashMap* _tmp31_;
	GeeSet* _tmp32_;
	GeeSet* _tmp33_;
	GeeSet* _tmp34_;
	GeeIterator* _tmp35_;
	GeeIterator* _tmp36_;
	GeeIterator* _tmp37_;
	ApplicationAccountContext* context;
	GeeIterator* _tmp38_;
	gpointer _tmp39_;
	GeeCollection* batch;
	ApplicationAccountContext* _tmp40_;
	GearyAppEmailStore* _tmp41_;
	GearyAppEmailStore* _tmp42_;
	GeeHashMap* _tmp43_;
	ApplicationAccountContext* _tmp44_;
	gpointer _tmp45_;
	GeeSet* _tmp46_;
	ApplicationAccountContext* _tmp47_;
	GCancellable* _tmp48_;
	GCancellable* _tmp49_;
	GeeCollection* _tmp50_;
	GeeCollection* _tmp51_;
	GeeCollection* _tmp52_;
	GeeIterator* _email_it;
	GeeCollection* _tmp53_;
	GeeIterator* _tmp54_;
	GeeIterator* _tmp55_;
	GearyEmail* email;
	GeeIterator* _tmp56_;
	gpointer _tmp57_;
	GeeHashSet* _tmp58_;
	GearyEmail* _tmp59_;
	ApplicationEmailStoreFactory* _tmp60_;
	GeeMap* _tmp61_;
	ApplicationAccountContext* _tmp62_;
	gpointer _tmp63_;
	ApplicationPluginManagerAccountImpl* _tmp64_;
	ApplicationEmailStoreFactoryEmailImpl* _tmp65_;
	ApplicationEmailStoreFactoryEmailImpl* _tmp66_;
	GError* _inner_error0_;
};

struct _ApplicationEmailStoreFactoryEmailImpl {
	GearyBaseObject parent_instance;
	ApplicationEmailStoreFactoryEmailImplPrivate * priv;
};

struct _ApplicationEmailStoreFactoryEmailImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationEmailStoreFactoryEmailImplPrivate {
	ApplicationEmailStoreFactoryIdImpl* _id;
	GearyEmail* _backing;
	ApplicationPluginManagerAccountImpl* _account;
};

struct _ApplicationEmailStoreFactoryEmailImplLoadBodyAsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	PluginEmailBodyType type;
	gboolean convert;
	GCancellable* cancellable;
	gchar* result;
	GearyEmail* _tmp0_;
	GearyEmailField _tmp1_;
	GearyEmailField _tmp2_;
	GearyAccount* account;
	ApplicationPluginManagerAccountImpl* _tmp3_;
	ApplicationAccountContext* _tmp4_;
	ApplicationAccountContext* _tmp5_;
	GearyAccount* _tmp6_;
	GearyAccount* _tmp7_;
	GearyAccount* _tmp8_;
	GearyEmail* _tmp9_;
	GearyAccount* _tmp10_;
	GearyEmail* _tmp11_;
	GearyEmailIdentifier* _tmp12_;
	GearyEmailIdentifier* _tmp13_;
	GearyEmail* _tmp14_;
	GearyEmailField _tmp15_;
	GearyEmailField _tmp16_;
	GearyEmail* _tmp17_;
	GearyRFC822Message* message;
	GearyEmail* _tmp18_;
	GearyRFC822Message* _tmp19_;
	gchar* body;
	gchar* _tmp20_;
	GearyRFC822Message* _tmp21_;
	gchar* _tmp22_;
	GearyRFC822Message* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	GearyRFC822Message* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	GearyRFC822Message* _tmp36_;
	gchar* _tmp37_;
	GearyRFC822Message* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	GearyRFC822Message* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	GError* _inner_error0_;
};

struct _ApplicationEmailStoreFactoryIdImplPrivate {
	GearyEmailIdentifier* _backing;
};

static gint ApplicationEmailStoreFactory_private_offset;
static gpointer application_email_store_factory_parent_class = NULL;
static gint ApplicationEmailStoreFactoryEmailStoreImpl_private_offset;
static gpointer application_email_store_factory_email_store_impl_parent_class = NULL;
static PluginEmailStoreIface * application_email_store_factory_email_store_impl_plugin_email_store_parent_iface = NULL;
static gint ApplicationEmailStoreFactoryEmailImpl_private_offset;
static gpointer application_email_store_factory_email_impl_parent_class = NULL;
static GearyEmailHeaderSetIface * application_email_store_factory_email_impl_geary_email_header_set_parent_iface = NULL;
static PluginEmailIface * application_email_store_factory_email_impl_plugin_email_parent_iface = NULL;
static gint ApplicationEmailStoreFactoryIdImpl_private_offset;
static gpointer application_email_store_factory_id_impl_parent_class = NULL;
static GeeHashableIface * application_email_store_factory_id_impl_gee_hashable_parent_iface = NULL;
static PluginEmailIdentifierIface * application_email_store_factory_id_impl_plugin_email_identifier_parent_iface = NULL;

VALA_EXTERN GType application_email_store_factory_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType application_plugin_manager_account_impl_get_type (void) G_GNUC_CONST ;
static GType application_email_store_factory_email_store_impl_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN ApplicationEmailStoreFactory* application_email_store_factory_new (GeeMap* accounts);
VALA_EXTERN ApplicationEmailStoreFactory* application_email_store_factory_construct (GType object_type,
                                                                         GeeMap* accounts);
VALA_EXTERN void application_email_store_factory_destroy (ApplicationEmailStoreFactory* self,
                                              GError** error);
static void application_email_store_factory_email_store_impl_destroy (ApplicationEmailStoreFactoryEmailStoreImpl* self);
VALA_EXTERN PluginEmailStore* application_email_store_factory_new_email_store (ApplicationEmailStoreFactory* self);
static ApplicationEmailStoreFactoryEmailStoreImpl* application_email_store_factory_email_store_impl_new (ApplicationEmailStoreFactory* factory);
static ApplicationEmailStoreFactoryEmailStoreImpl* application_email_store_factory_email_store_impl_construct (GType object_type,
                                                                                                        ApplicationEmailStoreFactory* factory);
VALA_EXTERN void application_email_store_factory_destroy_email_store (ApplicationEmailStoreFactory* self,
                                                          PluginEmailStore* plugin);
VALA_EXTERN GearyEmail* application_email_store_factory_to_engine_email (ApplicationEmailStoreFactory* self,
                                                             PluginEmail* plugin);
VALA_EXTERN GType application_email_store_factory_email_impl_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyEmail* application_email_store_factory_email_impl_get_backing (ApplicationEmailStoreFactoryEmailImpl* self);
VALA_EXTERN GeeCollection* application_email_store_factory_to_plugin_ids (ApplicationEmailStoreFactory* self,
                                                              GeeCollection* engine_ids,
                                                              ApplicationAccountContext* account);
VALA_EXTERN ApplicationEmailStoreFactoryIdImpl* application_email_store_factory_id_impl_new (GearyEmailIdentifier* backing,
                                                                                 ApplicationPluginManagerAccountImpl* account);
VALA_EXTERN ApplicationEmailStoreFactoryIdImpl* application_email_store_factory_id_impl_construct (GType object_type,
                                                                                       GearyEmailIdentifier* backing,
                                                                                       ApplicationPluginManagerAccountImpl* account);
VALA_EXTERN GType application_email_store_factory_id_impl_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyEmailIdentifier* application_email_store_factory_to_engine_id (ApplicationEmailStoreFactory* self,
                                                                    PluginEmailIdentifier* plugin);
VALA_EXTERN GearyEmailIdentifier* application_email_store_factory_id_impl_get_backing (ApplicationEmailStoreFactoryIdImpl* self);
VALA_EXTERN PluginEmail* application_email_store_factory_to_plugin_email (ApplicationEmailStoreFactory* self,
                                                              GearyEmail* engine,
                                                              ApplicationAccountContext* account);
VALA_EXTERN ApplicationEmailStoreFactoryEmailImpl* application_email_store_factory_email_impl_new (GearyEmail* backing,
                                                                                       ApplicationPluginManagerAccountImpl* account);
VALA_EXTERN ApplicationEmailStoreFactoryEmailImpl* application_email_store_factory_email_impl_construct (GType object_type,
                                                                                             GearyEmail* backing,
                                                                                             ApplicationPluginManagerAccountImpl* account);
VALA_EXTERN ApplicationAccountContext* application_email_store_factory_get_account_for_variant (ApplicationEmailStoreFactory* self,
                                                                                    GVariant* target);
static gchar* _variant_get3 (GVariant* value);
VALA_EXTERN GearyEmailIdentifier* application_email_store_factory_get_email_identifier_for_variant (ApplicationEmailStoreFactory* self,
                                                                                        GVariant* target);
static void application_email_store_factory_email_store_impl_real_get_email_data_free (gpointer _data);
static void application_email_store_factory_email_store_impl_real_get_email (PluginEmailStore* base,
                                                                      GeeCollection* plugin_ids,
                                                                      GCancellable* cancellable,
                                                                      GAsyncReadyCallback _callback_,
                                                                      gpointer _user_data_);
static gboolean application_email_store_factory_email_store_impl_real_get_email_co (ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_);
VALA_EXTERN ApplicationAccountContext* application_plugin_manager_account_impl_get_backing (ApplicationPluginManagerAccountImpl* self);
static void application_email_store_factory_email_store_impl_get_email_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static PluginEmailIdentifier* application_email_store_factory_email_store_impl_real_get_email_identifier_for_variant (PluginEmailStore* base,
                                                                                                               GVariant* variant);
static void application_email_store_factory_email_store_impl_finalize (GObject * obj);
static GType application_email_store_factory_email_store_impl_get_type_once (void);
static void _vala_application_email_store_factory_email_store_impl_get_property (GObject * object,
                                                                          guint property_id,
                                                                          GValue * value,
                                                                          GParamSpec * pspec);
VALA_EXTERN ApplicationPluginManagerAccountImpl* application_email_store_factory_email_impl_get_account (ApplicationEmailStoreFactoryEmailImpl* self);
static void application_email_store_factory_email_impl_set_backing (ApplicationEmailStoreFactoryEmailImpl* self,
                                                             GearyEmail* value);
static void application_email_store_factory_email_impl_set_account (ApplicationEmailStoreFactoryEmailImpl* self,
                                                             ApplicationPluginManagerAccountImpl* value);
static GearyRFC822MailboxAddress* application_email_store_factory_email_impl_real_get_primary_originator (PluginEmail* base);
static void application_email_store_factory_email_impl_real_load_body_as_data_free (gpointer _data);
static void application_email_store_factory_email_impl_real_load_body_as (PluginEmail* base,
                                                                   PluginEmailBodyType type,
                                                                   gboolean convert,
                                                                   GCancellable* cancellable,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_);
static gboolean application_email_store_factory_email_impl_real_load_body_as_co (ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _data_);
static void application_email_store_factory_email_impl_load_body_as_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_);
static void application_email_store_factory_email_impl_finalize (GObject * obj);
static GType application_email_store_factory_email_impl_get_type_once (void);
static void _vala_application_email_store_factory_email_impl_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec);
static void _vala_application_email_store_factory_email_impl_set_property (GObject * object,
                                                                    guint property_id,
                                                                    const GValue * value,
                                                                    GParamSpec * pspec);
static void application_email_store_factory_id_impl_set_backing (ApplicationEmailStoreFactoryIdImpl* self,
                                                          GearyEmailIdentifier* value);
static GVariant* application_email_store_factory_id_impl_real_to_variant (PluginEmailIdentifier* base);
static GVariant* _variant_new2 (const gchar* value);
static gboolean application_email_store_factory_id_impl_real_equal_to (GeeHashable* base,
                                                                PluginEmailIdentifier* other);
static guint application_email_store_factory_id_impl_real_hash (GeeHashable* base);
static void application_email_store_factory_id_impl_finalize (GObject * obj);
static GType application_email_store_factory_id_impl_get_type_once (void);
static void _vala_application_email_store_factory_id_impl_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_application_email_store_factory_id_impl_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
static void application_email_store_factory_finalize (GObject * obj);
static GType application_email_store_factory_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
application_email_store_factory_get_instance_private (ApplicationEmailStoreFactory* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationEmailStoreFactory_private_offset);
}

/**
     * Constructs a new factory instance.
     */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

ApplicationEmailStoreFactory*
application_email_store_factory_construct (GType object_type,
                                           GeeMap* accounts)
{
	ApplicationEmailStoreFactory * self = NULL;
	GeeMap* _tmp0_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (accounts, GEE_TYPE_MAP), NULL);
	self = (ApplicationEmailStoreFactory*) geary_base_object_construct (object_type);
	_tmp0_ = _g_object_ref0 (accounts);
	_g_object_unref0 (self->priv->accounts);
	self->priv->accounts = _tmp0_;
	return self;
}

ApplicationEmailStoreFactory*
application_email_store_factory_new (GeeMap* accounts)
{
	return application_email_store_factory_construct (APPLICATION_TYPE_EMAIL_STORE_FACTORY, accounts);
}

/** Clearing all state of the store. */
void
application_email_store_factory_destroy (ApplicationEmailStoreFactory* self,
                                         GError** error)
{
	GeeSet* _tmp6_;
	g_return_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self));
	{
		GeeIterator* _store_it = NULL;
		GeeSet* _tmp0_;
		GeeIterator* _tmp1_;
		_tmp0_ = self->priv->stores;
		_tmp1_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ITERABLE, GeeIterable));
		_store_it = _tmp1_;
		while (TRUE) {
			GeeIterator* _tmp2_;
			ApplicationEmailStoreFactoryEmailStoreImpl* store = NULL;
			GeeIterator* _tmp3_;
			gpointer _tmp4_;
			ApplicationEmailStoreFactoryEmailStoreImpl* _tmp5_;
			_tmp2_ = _store_it;
			if (!gee_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = _store_it;
			_tmp4_ = gee_iterator_get (_tmp3_);
			store = (ApplicationEmailStoreFactoryEmailStoreImpl*) _tmp4_;
			_tmp5_ = store;
			application_email_store_factory_email_store_impl_destroy (_tmp5_);
			_g_object_unref0 (store);
		}
		_g_object_unref0 (_store_it);
	}
	_tmp6_ = self->priv->stores;
	gee_collection_clear (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GEE_TYPE_COLLECTION, GeeCollection));
}

/** Constructs a new email store for use by plugin contexts. */
PluginEmailStore*
application_email_store_factory_new_email_store (ApplicationEmailStoreFactory* self)
{
	ApplicationEmailStoreFactoryEmailStoreImpl* store = NULL;
	ApplicationEmailStoreFactoryEmailStoreImpl* _tmp0_;
	GeeSet* _tmp1_;
	PluginEmailStore* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	_tmp0_ = application_email_store_factory_email_store_impl_new (self);
	store = _tmp0_;
	_tmp1_ = self->priv->stores;
	gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_COLLECTION, GeeCollection), store);
	result = G_TYPE_CHECK_INSTANCE_CAST (store, PLUGIN_TYPE_EMAIL_STORE, PluginEmailStore);
	return result;
}

/** Destroys a folder store once is no longer required. */
void
application_email_store_factory_destroy_email_store (ApplicationEmailStoreFactory* self,
                                                     PluginEmailStore* plugin)
{
	ApplicationEmailStoreFactoryEmailStoreImpl* impl = NULL;
	ApplicationEmailStoreFactoryEmailStoreImpl* _tmp0_;
	ApplicationEmailStoreFactoryEmailStoreImpl* _tmp1_;
	g_return_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self));
	g_return_if_fail (PLUGIN_IS_EMAIL_STORE (plugin));
	_tmp0_ = _g_object_ref0 (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_STORE_IMPL (plugin) ? ((ApplicationEmailStoreFactoryEmailStoreImpl*) plugin) : NULL);
	impl = _tmp0_;
	_tmp1_ = impl;
	if (_tmp1_ != NULL) {
		ApplicationEmailStoreFactoryEmailStoreImpl* _tmp2_;
		GeeSet* _tmp3_;
		ApplicationEmailStoreFactoryEmailStoreImpl* _tmp4_;
		_tmp2_ = impl;
		application_email_store_factory_email_store_impl_destroy (_tmp2_);
		_tmp3_ = self->priv->stores;
		_tmp4_ = impl;
		gee_collection_remove (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_COLLECTION, GeeCollection), _tmp4_);
	}
	_g_object_unref0 (impl);
}

GearyEmail*
application_email_store_factory_to_engine_email (ApplicationEmailStoreFactory* self,
                                                 PluginEmail* plugin)
{
	ApplicationEmailStoreFactoryEmailImpl* impl = NULL;
	ApplicationEmailStoreFactoryEmailImpl* _tmp0_;
	GearyEmail* _tmp1_ = NULL;
	ApplicationEmailStoreFactoryEmailImpl* _tmp2_;
	GearyEmail* _tmp6_;
	GearyEmail* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_EMAIL (plugin), NULL);
	_tmp0_ = _g_object_ref0 (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL (plugin) ? ((ApplicationEmailStoreFactoryEmailImpl*) plugin) : NULL);
	impl = _tmp0_;
	_tmp2_ = impl;
	if (_tmp2_ != NULL) {
		ApplicationEmailStoreFactoryEmailImpl* _tmp3_;
		GearyEmail* _tmp4_;
		GearyEmail* _tmp5_;
		_tmp3_ = impl;
		_tmp4_ = application_email_store_factory_email_impl_get_backing (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_;
	} else {
		_tmp1_ = NULL;
	}
	_tmp6_ = _g_object_ref0 (_tmp1_);
	result = _tmp6_;
	_g_object_unref0 (impl);
	return result;
}

GeeCollection*
application_email_store_factory_to_plugin_ids (ApplicationEmailStoreFactory* self,
                                               GeeCollection* engine_ids,
                                               ApplicationAccountContext* account)
{
	GeeHashSet* plugin_ids = NULL;
	GeeHashSet* _tmp0_;
	GeeCollection* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (engine_ids, GEE_TYPE_COLLECTION), NULL);
	g_return_val_if_fail (APPLICATION_IS_ACCOUNT_CONTEXT (account), NULL);
	_tmp0_ = gee_hash_set_new (PLUGIN_TYPE_EMAIL_IDENTIFIER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	plugin_ids = _tmp0_;
	{
		GeeIterator* _id_it = NULL;
		GeeIterator* _tmp1_;
		_tmp1_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (engine_ids, GEE_TYPE_ITERABLE, GeeIterable));
		_id_it = _tmp1_;
		while (TRUE) {
			GeeIterator* _tmp2_;
			GearyEmailIdentifier* id = NULL;
			GeeIterator* _tmp3_;
			gpointer _tmp4_;
			GeeHashSet* _tmp5_;
			GearyEmailIdentifier* _tmp6_;
			GeeMap* _tmp7_;
			gpointer _tmp8_;
			ApplicationPluginManagerAccountImpl* _tmp9_;
			ApplicationEmailStoreFactoryIdImpl* _tmp10_;
			ApplicationEmailStoreFactoryIdImpl* _tmp11_;
			_tmp2_ = _id_it;
			if (!gee_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = _id_it;
			_tmp4_ = gee_iterator_get (_tmp3_);
			id = (GearyEmailIdentifier*) _tmp4_;
			_tmp5_ = plugin_ids;
			_tmp6_ = id;
			_tmp7_ = self->priv->accounts;
			_tmp8_ = gee_map_get (_tmp7_, account);
			_tmp9_ = (ApplicationPluginManagerAccountImpl*) _tmp8_;
			_tmp10_ = application_email_store_factory_id_impl_new (_tmp6_, _tmp9_);
			_tmp11_ = _tmp10_;
			gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, PLUGIN_TYPE_EMAIL_IDENTIFIER, PluginEmailIdentifier));
			_g_object_unref0 (_tmp11_);
			_g_object_unref0 (_tmp9_);
			_g_object_unref0 (id);
		}
		_g_object_unref0 (_id_it);
	}
	result = G_TYPE_CHECK_INSTANCE_CAST (plugin_ids, GEE_TYPE_COLLECTION, GeeCollection);
	return result;
}

GearyEmailIdentifier*
application_email_store_factory_to_engine_id (ApplicationEmailStoreFactory* self,
                                              PluginEmailIdentifier* plugin)
{
	ApplicationEmailStoreFactoryIdImpl* impl = NULL;
	ApplicationEmailStoreFactoryIdImpl* _tmp0_;
	GearyEmailIdentifier* _tmp1_ = NULL;
	ApplicationEmailStoreFactoryIdImpl* _tmp2_;
	GearyEmailIdentifier* _tmp6_;
	GearyEmailIdentifier* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_EMAIL_IDENTIFIER (plugin), NULL);
	_tmp0_ = _g_object_ref0 (APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL (plugin) ? ((ApplicationEmailStoreFactoryIdImpl*) plugin) : NULL);
	impl = _tmp0_;
	_tmp2_ = impl;
	if (_tmp2_ != NULL) {
		ApplicationEmailStoreFactoryIdImpl* _tmp3_;
		GearyEmailIdentifier* _tmp4_;
		GearyEmailIdentifier* _tmp5_;
		_tmp3_ = impl;
		_tmp4_ = application_email_store_factory_id_impl_get_backing (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_;
	} else {
		_tmp1_ = NULL;
	}
	_tmp6_ = _g_object_ref0 (_tmp1_);
	result = _tmp6_;
	_g_object_unref0 (impl);
	return result;
}

PluginEmail*
application_email_store_factory_to_plugin_email (ApplicationEmailStoreFactory* self,
                                                 GearyEmail* engine,
                                                 ApplicationAccountContext* account)
{
	GeeMap* _tmp0_;
	gpointer _tmp1_;
	ApplicationPluginManagerAccountImpl* _tmp2_;
	ApplicationEmailStoreFactoryEmailImpl* _tmp3_;
	PluginEmail* _tmp4_;
	PluginEmail* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (engine, GEARY_TYPE_EMAIL), NULL);
	g_return_val_if_fail (APPLICATION_IS_ACCOUNT_CONTEXT (account), NULL);
	_tmp0_ = self->priv->accounts;
	_tmp1_ = gee_map_get (_tmp0_, account);
	_tmp2_ = (ApplicationPluginManagerAccountImpl*) _tmp1_;
	_tmp3_ = application_email_store_factory_email_impl_new (engine, _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, PLUGIN_TYPE_EMAIL, PluginEmail);
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

/** Returns the account context for the given plugin email id. */
static gchar*
_variant_get3 (GVariant* value)
{
	return g_variant_dup_string (value, NULL);
}

ApplicationAccountContext*
application_email_store_factory_get_account_for_variant (ApplicationEmailStoreFactory* self,
                                                         GVariant* target)
{
	ApplicationAccountContext* account = NULL;
	gchar* id = NULL;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	ApplicationAccountContext* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (target != NULL, NULL);
	account = NULL;
	_tmp0_ = g_variant_get_child_value (target, (gsize) 0);
	_tmp1_ = _tmp0_;
	_tmp2_ = _variant_get3 (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_unref0 (_tmp1_);
	id = _tmp3_;
	{
		GeeIterator* _context_it = NULL;
		GeeMap* _tmp4_;
		GeeSet* _tmp5_;
		GeeSet* _tmp6_;
		GeeSet* _tmp7_;
		GeeIterator* _tmp8_;
		GeeIterator* _tmp9_;
		_tmp4_ = self->priv->accounts;
		_tmp5_ = gee_map_get_keys (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp9_ = _tmp8_;
		_g_object_unref0 (_tmp7_);
		_context_it = _tmp9_;
		while (TRUE) {
			GeeIterator* _tmp10_;
			ApplicationAccountContext* context = NULL;
			GeeIterator* _tmp11_;
			gpointer _tmp12_;
			GearyAccountInformation* info = NULL;
			ApplicationAccountContext* _tmp13_;
			GearyAccount* _tmp14_;
			GearyAccount* _tmp15_;
			GearyAccountInformation* _tmp16_;
			GearyAccountInformation* _tmp17_;
			GearyAccountInformation* _tmp18_;
			GearyAccountInformation* _tmp19_;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			_tmp10_ = _context_it;
			if (!gee_iterator_next (_tmp10_)) {
				break;
			}
			_tmp11_ = _context_it;
			_tmp12_ = gee_iterator_get (_tmp11_);
			context = (ApplicationAccountContext*) _tmp12_;
			_tmp13_ = context;
			_tmp14_ = application_account_context_get_account (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = geary_account_get_information (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = _g_object_ref0 (_tmp17_);
			info = _tmp18_;
			_tmp19_ = info;
			_tmp20_ = geary_account_information_get_id (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = id;
			if (g_strcmp0 (_tmp21_, _tmp22_) == 0) {
				ApplicationAccountContext* _tmp23_;
				ApplicationAccountContext* _tmp24_;
				_tmp23_ = context;
				_tmp24_ = _g_object_ref0 (_tmp23_);
				_g_object_unref0 (account);
				account = _tmp24_;
				_g_object_unref0 (info);
				_g_object_unref0 (context);
				break;
			}
			_g_object_unref0 (info);
			_g_object_unref0 (context);
		}
		_g_object_unref0 (_context_it);
	}
	result = account;
	_g_free0 (id);
	return result;
}

/** Returns the engine email id for the given plugin email id. */
GearyEmailIdentifier*
application_email_store_factory_get_email_identifier_for_variant (ApplicationEmailStoreFactory* self,
                                                                  GVariant* target)
{
	GearyEmailIdentifier* id = NULL;
	ApplicationAccountContext* context = NULL;
	ApplicationAccountContext* _tmp0_;
	ApplicationAccountContext* _tmp1_;
	GError* _inner_error0_ = NULL;
	GearyEmailIdentifier* result;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (self), NULL);
	g_return_val_if_fail (target != NULL, NULL);
	id = NULL;
	_tmp0_ = application_email_store_factory_get_account_for_variant (self, target);
	context = _tmp0_;
	_tmp1_ = context;
	if (_tmp1_ != NULL) {
		{
			GearyEmailIdentifier* _tmp2_ = NULL;
			ApplicationAccountContext* _tmp3_;
			GearyAccount* _tmp4_;
			GearyAccount* _tmp5_;
			GVariant* _tmp6_;
			GVariant* _tmp7_;
			GVariant* _tmp8_;
			GVariant* _tmp9_;
			GearyEmailIdentifier* _tmp10_;
			GearyEmailIdentifier* _tmp11_;
			GearyEmailIdentifier* _tmp12_;
			_tmp3_ = context;
			_tmp4_ = application_account_context_get_account (_tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = g_variant_get_child_value (target, (gsize) 1);
			_tmp7_ = _tmp6_;
			_tmp8_ = g_variant_get_variant (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = geary_account_to_email_identifier (_tmp5_, _tmp9_, &_inner_error0_);
			_tmp11_ = _tmp10_;
			_g_variant_unref0 (_tmp9_);
			_g_variant_unref0 (_tmp7_);
			_tmp2_ = _tmp11_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp12_ = _tmp2_;
			_tmp2_ = NULL;
			_g_object_unref0 (id);
			id = _tmp12_;
			_g_object_unref0 (_tmp2_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* err = NULL;
			GError* _tmp13_;
			const gchar* _tmp14_;
			err = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp13_ = err;
			_tmp14_ = _tmp13_->message;
			g_debug ("application-email-store-factory.vala:360: Invalid email folder id: %s", _tmp14_);
			_g_error_free0 (err);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (context);
			_g_object_unref0 (id);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = id;
	_g_object_unref0 (context);
	return result;
}

static inline gpointer
application_email_store_factory_email_store_impl_get_instance_private (ApplicationEmailStoreFactoryEmailStoreImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationEmailStoreFactoryEmailStoreImpl_private_offset);
}

static ApplicationEmailStoreFactoryEmailStoreImpl*
application_email_store_factory_email_store_impl_construct (GType object_type,
                                                            ApplicationEmailStoreFactory* factory)
{
	ApplicationEmailStoreFactoryEmailStoreImpl * self = NULL;
	g_return_val_if_fail (APPLICATION_IS_EMAIL_STORE_FACTORY (factory), NULL);
	self = (ApplicationEmailStoreFactoryEmailStoreImpl*) geary_base_object_construct (object_type);
	self->priv->factory = factory;
	return self;
}

static ApplicationEmailStoreFactoryEmailStoreImpl*
application_email_store_factory_email_store_impl_new (ApplicationEmailStoreFactory* factory)
{
	return application_email_store_factory_email_store_impl_construct (APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, factory);
}

static const GVariantType*
application_email_store_factory_email_store_impl_real_get_email_identifier_variant_type (PluginEmailStore* base)
{
	const GVariantType* result;
	ApplicationEmailStoreFactoryEmailStoreImpl* self;
	const GVariantType* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl);
	_tmp0_ = self->priv->_email_id_variant_type;
	result = _tmp0_;
	return result;
}

static void
application_email_store_factory_email_store_impl_real_get_email_data_free (gpointer _data)
{
	ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->plugin_ids);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ApplicationEmailStoreFactoryEmailStoreImplGetEmailData, _data_);
}

static void
application_email_store_factory_email_store_impl_real_get_email (PluginEmailStore* base,
                                                                 GeeCollection* plugin_ids,
                                                                 GCancellable* cancellable,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_)
{
	ApplicationEmailStoreFactoryEmailStoreImpl * self;
	ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_;
	ApplicationEmailStoreFactoryEmailStoreImpl* _tmp0_;
	GeeCollection* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (plugin_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, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl);
	_data_ = g_slice_new0 (ApplicationEmailStoreFactoryEmailStoreImplGetEmailData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_email_store_factory_email_store_impl_real_get_email_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (plugin_ids);
	_g_object_unref0 (_data_->plugin_ids);
	_data_->plugin_ids = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	application_email_store_factory_email_store_impl_real_get_email_co (_data_);
}

static GeeCollection*
application_email_store_factory_email_store_impl_get_email_finish (PluginEmailStore* base,
                                                                   GAsyncResult* _res_,
                                                                   GError** error)
{
	GeeCollection* result;
	ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
application_email_store_factory_email_store_impl_get_email_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_email_store_factory_email_store_impl_real_get_email_co (_data_);
}

static gboolean
application_email_store_factory_email_store_impl_real_get_email_co (ApplicationEmailStoreFactoryEmailStoreImplGetEmailData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gee_hash_set_new (PLUGIN_TYPE_EMAIL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->emails = _data_->_tmp0_;
	_data_->_tmp1_ = gee_hash_map_new (APPLICATION_TYPE_ACCOUNT_CONTEXT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, GEE_TYPE_SET, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->found_accounts = _data_->_tmp1_;
	_data_->current_account = NULL;
	_data_->engine_ids = NULL;
	{
		_data_->_tmp2_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_data_->plugin_ids, GEE_TYPE_ITERABLE, GeeIterable));
		_data_->_plugin_id_it = _data_->_tmp2_;
		while (TRUE) {
			_data_->_tmp3_ = _data_->_plugin_id_it;
			if (!gee_iterator_next (_data_->_tmp3_)) {
				break;
			}
			_data_->_tmp4_ = _data_->_plugin_id_it;
			_data_->_tmp5_ = gee_iterator_get (_data_->_tmp4_);
			_data_->plugin_id = (PluginEmailIdentifier*) _data_->_tmp5_;
			_data_->_tmp6_ = _data_->plugin_id;
			_data_->_tmp7_ = _g_object_ref0 (APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL (_data_->_tmp6_) ? ((ApplicationEmailStoreFactoryIdImpl*) _data_->_tmp6_) : NULL);
			_data_->id_impl = _data_->_tmp7_;
			_data_->_tmp8_ = _data_->id_impl;
			if (_data_->_tmp8_ != NULL) {
				_data_->_tmp9_ = _data_->id_impl;
				_data_->_tmp10_ = _data_->_tmp9_->account_impl;
				_data_->_tmp11_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp10_);
				_data_->_tmp12_ = _data_->_tmp11_;
				_data_->_tmp13_ = _data_->current_account;
				if (_data_->_tmp12_ != _data_->_tmp13_) {
					_data_->_tmp14_ = _data_->id_impl;
					_data_->_tmp15_ = _data_->_tmp14_->account_impl;
					_data_->_tmp16_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp15_);
					_data_->_tmp17_ = _data_->_tmp16_;
					_data_->_tmp18_ = _g_object_ref0 (_data_->_tmp17_);
					_g_object_unref0 (_data_->current_account);
					_data_->current_account = _data_->_tmp18_;
					_data_->_tmp19_ = _data_->found_accounts;
					_data_->_tmp20_ = _data_->current_account;
					_data_->_tmp21_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp19_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _data_->_tmp20_);
					_g_object_unref0 (_data_->engine_ids);
					_data_->engine_ids = (GeeSet*) _data_->_tmp21_;
					_data_->_tmp22_ = _data_->engine_ids;
					if (_data_->_tmp22_ == NULL) {
						_data_->_tmp23_ = gee_hash_set_new (GEARY_TYPE_EMAIL_IDENTIFIER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
						_g_object_unref0 (_data_->engine_ids);
						_data_->engine_ids = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp23_, GEE_TYPE_SET, GeeSet);
						_data_->_tmp24_ = _data_->found_accounts;
						_data_->_tmp25_ = _data_->current_account;
						_data_->_tmp26_ = _data_->engine_ids;
						gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp24_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _data_->_tmp25_, _data_->_tmp26_);
					}
				}
				_data_->_tmp27_ = _data_->engine_ids;
				_data_->_tmp28_ = _data_->id_impl;
				_data_->_tmp29_ = application_email_store_factory_id_impl_get_backing (_data_->_tmp28_);
				_data_->_tmp30_ = _data_->_tmp29_;
				gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp27_, GEE_TYPE_COLLECTION, GeeCollection), _data_->_tmp30_);
			}
			_g_object_unref0 (_data_->id_impl);
			_g_object_unref0 (_data_->plugin_id);
		}
		_g_object_unref0 (_data_->_plugin_id_it);
	}
	{
		_data_->_tmp31_ = _data_->found_accounts;
		_data_->_tmp32_ = gee_abstract_map_get_keys (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp31_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap));
		_data_->_tmp33_ = _data_->_tmp32_;
		_data_->_tmp34_ = _data_->_tmp33_;
		_data_->_tmp35_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp34_, GEE_TYPE_ITERABLE, GeeIterable));
		_data_->_tmp36_ = _data_->_tmp35_;
		_g_object_unref0 (_data_->_tmp34_);
		_data_->_context_it = _data_->_tmp36_;
		while (TRUE) {
			_data_->_tmp37_ = _data_->_context_it;
			if (!gee_iterator_next (_data_->_tmp37_)) {
				break;
			}
			_data_->_tmp38_ = _data_->_context_it;
			_data_->_tmp39_ = gee_iterator_get (_data_->_tmp38_);
			_data_->context = (ApplicationAccountContext*) _data_->_tmp39_;
			_data_->_tmp40_ = _data_->context;
			_data_->_tmp41_ = application_account_context_get_emails (_data_->_tmp40_);
			_data_->_tmp42_ = _data_->_tmp41_;
			_data_->_tmp43_ = _data_->found_accounts;
			_data_->_tmp44_ = _data_->context;
			_data_->_tmp45_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp43_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _data_->_tmp44_);
			_data_->_tmp46_ = (GeeSet*) _data_->_tmp45_;
			_data_->_tmp47_ = _data_->context;
			_data_->_tmp48_ = application_account_context_get_cancellable (_data_->_tmp47_);
			_data_->_tmp49_ = _data_->_tmp48_;
			_data_->_state_ = 1;
			geary_app_email_store_list_email_by_sparse_id_async (_data_->_tmp42_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp46_, GEE_TYPE_COLLECTION, GeeCollection), APPLICATION_EMAIL_STORE_FACTORY_REQUIRED_FIELDS, GEARY_FOLDER_LIST_FLAGS_NONE, _data_->_tmp49_, application_email_store_factory_email_store_impl_get_email_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp50_ = geary_app_email_store_list_email_by_sparse_id_finish (_data_->_tmp42_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp51_ = _data_->_tmp50_;
			_g_object_unref0 (_data_->_tmp46_);
			_data_->batch = _data_->_tmp51_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->context);
				_g_object_unref0 (_data_->_context_it);
				_g_object_unref0 (_data_->engine_ids);
				_g_object_unref0 (_data_->current_account);
				_g_object_unref0 (_data_->found_accounts);
				_g_object_unref0 (_data_->emails);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp52_ = _data_->batch;
			if (_data_->_tmp52_ != NULL) {
				{
					_data_->_tmp53_ = _data_->batch;
					_data_->_tmp54_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp53_, GEE_TYPE_ITERABLE, GeeIterable));
					_data_->_email_it = _data_->_tmp54_;
					while (TRUE) {
						_data_->_tmp55_ = _data_->_email_it;
						if (!gee_iterator_next (_data_->_tmp55_)) {
							break;
						}
						_data_->_tmp56_ = _data_->_email_it;
						_data_->_tmp57_ = gee_iterator_get (_data_->_tmp56_);
						_data_->email = (GearyEmail*) _data_->_tmp57_;
						_data_->_tmp58_ = _data_->emails;
						_data_->_tmp59_ = _data_->email;
						_data_->_tmp60_ = _data_->self->priv->factory;
						_data_->_tmp61_ = _data_->_tmp60_->priv->accounts;
						_data_->_tmp62_ = _data_->context;
						_data_->_tmp63_ = gee_map_get (_data_->_tmp61_, _data_->_tmp62_);
						_data_->_tmp64_ = (ApplicationPluginManagerAccountImpl*) _data_->_tmp63_;
						_data_->_tmp65_ = application_email_store_factory_email_impl_new (_data_->_tmp59_, _data_->_tmp64_);
						_data_->_tmp66_ = _data_->_tmp65_;
						gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp58_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp66_, PLUGIN_TYPE_EMAIL, PluginEmail));
						_g_object_unref0 (_data_->_tmp66_);
						_g_object_unref0 (_data_->_tmp64_);
						_g_object_unref0 (_data_->email);
					}
					_g_object_unref0 (_data_->_email_it);
				}
			}
			_g_object_unref0 (_data_->batch);
			_g_object_unref0 (_data_->context);
		}
		_g_object_unref0 (_data_->_context_it);
	}
	_data_->result = G_TYPE_CHECK_INSTANCE_CAST (_data_->emails, GEE_TYPE_COLLECTION, GeeCollection);
	_g_object_unref0 (_data_->engine_ids);
	_g_object_unref0 (_data_->current_account);
	_g_object_unref0 (_data_->found_accounts);
	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 PluginEmailIdentifier*
application_email_store_factory_email_store_impl_real_get_email_identifier_for_variant (PluginEmailStore* base,
                                                                                        GVariant* variant)
{
	ApplicationEmailStoreFactoryEmailStoreImpl * self;
	ApplicationAccountContext* account = NULL;
	ApplicationEmailStoreFactory* _tmp0_;
	ApplicationAccountContext* _tmp1_;
	GearyEmailIdentifier* id = NULL;
	ApplicationEmailStoreFactory* _tmp2_;
	GearyEmailIdentifier* _tmp3_;
	ApplicationEmailStoreFactoryIdImpl* plugin_id = NULL;
	gboolean _tmp4_ = FALSE;
	ApplicationAccountContext* _tmp5_;
	PluginEmailIdentifier* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl);
	g_return_val_if_fail (variant != NULL, NULL);
	_tmp0_ = self->priv->factory;
	_tmp1_ = application_email_store_factory_get_account_for_variant (_tmp0_, variant);
	account = _tmp1_;
	_tmp2_ = self->priv->factory;
	_tmp3_ = application_email_store_factory_get_email_identifier_for_variant (_tmp2_, variant);
	id = _tmp3_;
	plugin_id = NULL;
	_tmp5_ = account;
	if (_tmp5_ != NULL) {
		GearyEmailIdentifier* _tmp6_;
		_tmp6_ = id;
		_tmp4_ = _tmp6_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		ApplicationPluginManagerAccountImpl* plugin_account = NULL;
		ApplicationEmailStoreFactory* _tmp7_;
		GeeMap* _tmp8_;
		ApplicationAccountContext* _tmp9_;
		gpointer _tmp10_;
		ApplicationPluginManagerAccountImpl* _tmp11_;
		_tmp7_ = self->priv->factory;
		_tmp8_ = _tmp7_->priv->accounts;
		_tmp9_ = account;
		_tmp10_ = gee_map_get (_tmp8_, _tmp9_);
		plugin_account = (ApplicationPluginManagerAccountImpl*) _tmp10_;
		_tmp11_ = plugin_account;
		if (_tmp11_ != NULL) {
			GearyEmailIdentifier* _tmp12_;
			ApplicationPluginManagerAccountImpl* _tmp13_;
			ApplicationEmailStoreFactoryIdImpl* _tmp14_;
			_tmp12_ = id;
			_tmp13_ = plugin_account;
			_tmp14_ = application_email_store_factory_id_impl_new (_tmp12_, _tmp13_);
			_g_object_unref0 (plugin_id);
			plugin_id = _tmp14_;
		}
		_g_object_unref0 (plugin_account);
	}
	result = G_TYPE_CHECK_INSTANCE_CAST (plugin_id, PLUGIN_TYPE_EMAIL_IDENTIFIER, PluginEmailIdentifier);
	_g_object_unref0 (id);
	_g_object_unref0 (account);
	return result;
}

static void
application_email_store_factory_email_store_impl_destroy (ApplicationEmailStoreFactoryEmailStoreImpl* self)
{
	g_return_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_STORE_IMPL (self));
}

static void
application_email_store_factory_email_store_impl_class_init (ApplicationEmailStoreFactoryEmailStoreImplClass * klass,
                                                             gpointer klass_data)
{
	application_email_store_factory_email_store_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationEmailStoreFactoryEmailStoreImpl_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_email_store_factory_email_store_impl_get_property;
	G_OBJECT_CLASS (klass)->finalize = application_email_store_factory_email_store_impl_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_EMAIL_IDENTIFIER_VARIANT_TYPE_PROPERTY, application_email_store_factory_email_store_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_EMAIL_IDENTIFIER_VARIANT_TYPE_PROPERTY] = g_param_spec_boxed ("email-identifier-variant-type", "email-identifier-variant-type", "email-identifier-variant-type", G_TYPE_VARIANT_TYPE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
application_email_store_factory_email_store_impl_plugin_email_store_interface_init (PluginEmailStoreIface * iface,
                                                                                    gpointer iface_data)
{
	application_email_store_factory_email_store_impl_plugin_email_store_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_email = (void (*) (PluginEmailStore*, GeeCollection*, GCancellable*, GAsyncReadyCallback, gpointer)) application_email_store_factory_email_store_impl_real_get_email;
	iface->get_email_finish = (GeeCollection* (*) (PluginEmailStore*, GAsyncResult*, GError**)) application_email_store_factory_email_store_impl_get_email_finish;
	iface->get_email_identifier_for_variant = (PluginEmailIdentifier* (*) (PluginEmailStore*, GVariant*)) application_email_store_factory_email_store_impl_real_get_email_identifier_for_variant;
	iface->get_email_identifier_variant_type = application_email_store_factory_email_store_impl_real_get_email_identifier_variant_type;
}

static void
application_email_store_factory_email_store_impl_instance_init (ApplicationEmailStoreFactoryEmailStoreImpl * self,
                                                                gpointer klass)
{
	GVariantType* _tmp0_;
	self->priv = application_email_store_factory_email_store_impl_get_instance_private (self);
	_tmp0_ = g_variant_type_new ("(sv)");
	self->priv->_email_id_variant_type = _tmp0_;
}

static void
application_email_store_factory_email_store_impl_finalize (GObject * obj)
{
	ApplicationEmailStoreFactoryEmailStoreImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl);
	_g_variant_type_free0 (self->priv->_email_id_variant_type);
	G_OBJECT_CLASS (application_email_store_factory_email_store_impl_parent_class)->finalize (obj);
}

static GType
application_email_store_factory_email_store_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationEmailStoreFactoryEmailStoreImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_email_store_factory_email_store_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationEmailStoreFactoryEmailStoreImpl), 0, (GInstanceInitFunc) application_email_store_factory_email_store_impl_instance_init, NULL };
	static const GInterfaceInfo plugin_email_store_info = { (GInterfaceInitFunc) application_email_store_factory_email_store_impl_plugin_email_store_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_email_store_factory_email_store_impl_type_id;
	application_email_store_factory_email_store_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationEmailStoreFactoryEmailStoreImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_email_store_factory_email_store_impl_type_id, PLUGIN_TYPE_EMAIL_STORE, &plugin_email_store_info);
	ApplicationEmailStoreFactoryEmailStoreImpl_private_offset = g_type_add_instance_private (application_email_store_factory_email_store_impl_type_id, sizeof (ApplicationEmailStoreFactoryEmailStoreImplPrivate));
	return application_email_store_factory_email_store_impl_type_id;
}

static GType
application_email_store_factory_email_store_impl_get_type (void)
{
	static volatile gsize application_email_store_factory_email_store_impl_type_id__once = 0;
	if (g_once_init_enter (&application_email_store_factory_email_store_impl_type_id__once)) {
		GType application_email_store_factory_email_store_impl_type_id;
		application_email_store_factory_email_store_impl_type_id = application_email_store_factory_email_store_impl_get_type_once ();
		g_once_init_leave (&application_email_store_factory_email_store_impl_type_id__once, application_email_store_factory_email_store_impl_type_id);
	}
	return application_email_store_factory_email_store_impl_type_id__once;
}

static void
_vala_application_email_store_factory_email_store_impl_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec)
{
	ApplicationEmailStoreFactoryEmailStoreImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, ApplicationEmailStoreFactoryEmailStoreImpl);
	switch (property_id) {
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_STORE_IMPL_EMAIL_IDENTIFIER_VARIANT_TYPE_PROPERTY:
		g_value_set_boxed (value, plugin_email_store_get_email_identifier_variant_type (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_EMAIL_STORE, PluginEmailStore)));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
application_email_store_factory_email_impl_get_instance_private (ApplicationEmailStoreFactoryEmailImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationEmailStoreFactoryEmailImpl_private_offset);
}

static PluginEmailIdentifier*
application_email_store_factory_email_impl_real_get_identifier (PluginEmail* base)
{
	PluginEmailIdentifier* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	ApplicationEmailStoreFactoryIdImpl* _tmp0_;
	ApplicationEmailStoreFactoryIdImpl* _tmp6_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_id;
	if (_tmp0_ == NULL) {
		GearyEmail* _tmp1_;
		GearyEmailIdentifier* _tmp2_;
		GearyEmailIdentifier* _tmp3_;
		ApplicationPluginManagerAccountImpl* _tmp4_;
		ApplicationEmailStoreFactoryIdImpl* _tmp5_;
		_tmp1_ = self->priv->_backing;
		_tmp2_ = geary_email_get_id (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = self->priv->_account;
		_tmp5_ = application_email_store_factory_id_impl_new (_tmp3_, _tmp4_);
		_g_object_unref0 (self->priv->_id);
		self->priv->_id = _tmp5_;
	}
	_tmp6_ = self->priv->_id;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, PLUGIN_TYPE_EMAIL_IDENTIFIER, PluginEmailIdentifier);
	return result;
}

static GearyRFC822MailboxAddresses*
application_email_store_factory_email_impl_real_get_from (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddresses* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddresses* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_from (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MailboxAddress*
application_email_store_factory_email_impl_real_get_sender (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddress* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddress* _tmp1_;
	GearyRFC822MailboxAddress* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_sender (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MailboxAddresses*
application_email_store_factory_email_impl_real_get_reply_to (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddresses* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddresses* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_reply_to (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MailboxAddresses*
application_email_store_factory_email_impl_real_get_to (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddresses* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddresses* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_to (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MailboxAddresses*
application_email_store_factory_email_impl_real_get_cc (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddresses* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddresses* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_cc (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MailboxAddresses*
application_email_store_factory_email_impl_real_get_bcc (GearyEmailHeaderSet* base)
{
	GearyRFC822MailboxAddresses* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddresses* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_bcc (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MessageID*
application_email_store_factory_email_impl_real_get_message_id (GearyEmailHeaderSet* base)
{
	GearyRFC822MessageID* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MessageID* _tmp1_;
	GearyRFC822MessageID* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_message_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MessageIDList*
application_email_store_factory_email_impl_real_get_in_reply_to (GearyEmailHeaderSet* base)
{
	GearyRFC822MessageIDList* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MessageIDList* _tmp1_;
	GearyRFC822MessageIDList* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_in_reply_to (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822MessageIDList*
application_email_store_factory_email_impl_real_get_references (GearyEmailHeaderSet* base)
{
	GearyRFC822MessageIDList* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822MessageIDList* _tmp1_;
	GearyRFC822MessageIDList* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_references (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822Subject*
application_email_store_factory_email_impl_real_get_subject (GearyEmailHeaderSet* base)
{
	GearyRFC822Subject* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822Subject* _tmp1_;
	GearyRFC822Subject* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_subject (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyRFC822Date*
application_email_store_factory_email_impl_real_get_date (GearyEmailHeaderSet* base)
{
	GearyRFC822Date* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyRFC822Date* _tmp1_;
	GearyRFC822Date* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_header_set_get_date (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GearyEmailFlags*
application_email_store_factory_email_impl_real_get_flags (PluginEmail* base)
{
	GearyEmailFlags* result;
	ApplicationEmailStoreFactoryEmailImpl* self;
	GearyEmail* _tmp0_;
	GearyEmailFlags* _tmp1_;
	GearyEmailFlags* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = geary_email_get_email_flags (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

GearyEmail*
application_email_store_factory_email_impl_get_backing (ApplicationEmailStoreFactoryEmailImpl* self)
{
	GearyEmail* result;
	GearyEmail* _tmp0_;
	g_return_val_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL (self), NULL);
	_tmp0_ = self->priv->_backing;
	result = _tmp0_;
	return result;
}

static void
application_email_store_factory_email_impl_set_backing (ApplicationEmailStoreFactoryEmailImpl* self,
                                                        GearyEmail* value)
{
	GearyEmail* old_value;
	g_return_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL (self));
	old_value = application_email_store_factory_email_impl_get_backing (self);
	if (old_value != value) {
		GearyEmail* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_backing);
		self->priv->_backing = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY]);
	}
}

ApplicationPluginManagerAccountImpl*
application_email_store_factory_email_impl_get_account (ApplicationEmailStoreFactoryEmailImpl* self)
{
	ApplicationPluginManagerAccountImpl* result;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	g_return_val_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL (self), NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

static void
application_email_store_factory_email_impl_set_account (ApplicationEmailStoreFactoryEmailImpl* self,
                                                        ApplicationPluginManagerAccountImpl* value)
{
	ApplicationPluginManagerAccountImpl* old_value;
	g_return_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_EMAIL_IMPL (self));
	old_value = application_email_store_factory_email_impl_get_account (self);
	if (old_value != value) {
		ApplicationPluginManagerAccountImpl* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY]);
	}
}

ApplicationEmailStoreFactoryEmailImpl*
application_email_store_factory_email_impl_construct (GType object_type,
                                                      GearyEmail* backing,
                                                      ApplicationPluginManagerAccountImpl* account)
{
	ApplicationEmailStoreFactoryEmailImpl * self = NULL;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (backing, GEARY_TYPE_EMAIL), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (account), NULL);
	self = (ApplicationEmailStoreFactoryEmailImpl*) geary_base_object_construct (object_type);
	application_email_store_factory_email_impl_set_backing (self, backing);
	application_email_store_factory_email_impl_set_account (self, account);
	return self;
}

ApplicationEmailStoreFactoryEmailImpl*
application_email_store_factory_email_impl_new (GearyEmail* backing,
                                                ApplicationPluginManagerAccountImpl* account)
{
	return application_email_store_factory_email_impl_construct (APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, backing, account);
}

static GearyRFC822MailboxAddress*
application_email_store_factory_email_impl_real_get_primary_originator (PluginEmail* base)
{
	ApplicationEmailStoreFactoryEmailImpl * self;
	GearyEmail* _tmp0_;
	GearyRFC822MailboxAddress* _tmp1_;
	GearyRFC822MailboxAddress* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = util_email_get_primary_originator (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet));
	result = _tmp1_;
	return result;
}

static void
application_email_store_factory_email_impl_real_load_body_as_data_free (gpointer _data)
{
	ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ApplicationEmailStoreFactoryEmailImplLoadBodyAsData, _data_);
}

static void
application_email_store_factory_email_impl_real_load_body_as (PluginEmail* base,
                                                              PluginEmailBodyType type,
                                                              gboolean convert,
                                                              GCancellable* cancellable,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_)
{
	ApplicationEmailStoreFactoryEmailImpl * self;
	ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _data_;
	ApplicationEmailStoreFactoryEmailImpl* _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, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_data_ = g_slice_new0 (ApplicationEmailStoreFactoryEmailImplLoadBodyAsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_email_store_factory_email_impl_real_load_body_as_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->type = type;
	_data_->convert = convert;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	application_email_store_factory_email_impl_real_load_body_as_co (_data_);
}

static gchar*
application_email_store_factory_email_impl_load_body_as_finish (PluginEmail* base,
                                                                GAsyncResult* _res_,
                                                                GError** error)
{
	gchar* result;
	ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
application_email_store_factory_email_impl_load_body_as_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_)
{
	ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_email_store_factory_email_impl_real_load_body_as_co (_data_);
}

static gboolean
application_email_store_factory_email_impl_real_load_body_as_co (ApplicationEmailStoreFactoryEmailImplLoadBodyAsData* _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->_backing;
	_data_->_tmp1_ = geary_email_get_fields (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (!((_data_->_tmp2_ & GEARY_EMAIL_REQUIRED_FOR_MESSAGE) == GEARY_EMAIL_REQUIRED_FOR_MESSAGE)) {
		_data_->_tmp3_ = _data_->self->priv->_account;
		_data_->_tmp4_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = application_account_context_get_account (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
		_data_->account = _data_->_tmp8_;
		_data_->_tmp10_ = _data_->account;
		_data_->_tmp11_ = _data_->self->priv->_backing;
		_data_->_tmp12_ = geary_email_get_id (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = _data_->self->priv->_backing;
		_data_->_tmp15_ = geary_email_get_fields (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_state_ = 1;
		geary_account_local_fetch_email_async (_data_->_tmp10_, _data_->_tmp13_, GEARY_EMAIL_REQUIRED_FOR_MESSAGE | _data_->_tmp16_, _data_->cancellable, application_email_store_factory_email_impl_load_body_as_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp17_ = geary_account_local_fetch_email_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp9_ = _data_->_tmp17_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->account);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		application_email_store_factory_email_impl_set_backing (_data_->self, _data_->_tmp9_);
		_g_object_unref0 (_data_->_tmp9_);
		_g_object_unref0 (_data_->account);
	}
	_data_->_tmp18_ = _data_->self->priv->_backing;
	_data_->_tmp19_ = geary_email_get_message (_data_->_tmp18_, &_data_->_inner_error0_);
	_data_->message = _data_->_tmp19_;
	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;
	}
	_data_->_tmp20_ = g_strdup ("");
	_data_->body = _data_->_tmp20_;
	switch (_data_->type) {
		case PLUGIN_EMAIL_BODY_TYPE_PLAIN:
		{
			_data_->_tmp21_ = _data_->message;
			if (geary_rf_c822_message_has_plain_body (_data_->_tmp21_)) {
				_data_->_tmp23_ = _data_->message;
				_data_->_tmp24_ = geary_rf_c822_message_get_plain_body (_data_->_tmp23_, FALSE, NULL, NULL, &_data_->_inner_error0_);
				_data_->_tmp22_ = _data_->_tmp24_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->body);
					_g_object_unref0 (_data_->message);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp26_ = _data_->_tmp22_;
				_data_->_tmp22_ = NULL;
				_data_->_tmp25_ = _data_->_tmp26_;
				if (_data_->_tmp25_ == NULL) {
					_data_->_tmp27_ = g_strdup ("");
					_g_free0 (_data_->_tmp25_);
					_data_->_tmp25_ = _data_->_tmp27_;
				}
				_data_->_tmp28_ = _data_->_tmp25_;
				_data_->_tmp25_ = NULL;
				_g_free0 (_data_->body);
				_data_->body = _data_->_tmp28_;
				_g_free0 (_data_->_tmp25_);
				_g_free0 (_data_->_tmp22_);
			} else {
				_data_->_tmp30_ = _data_->message;
				_data_->_tmp31_ = geary_rf_c822_message_get_searchable_body (_data_->_tmp30_, FALSE, &_data_->_inner_error0_);
				_data_->_tmp29_ = _data_->_tmp31_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->body);
					_g_object_unref0 (_data_->message);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp33_ = _data_->_tmp29_;
				_data_->_tmp29_ = NULL;
				_data_->_tmp32_ = _data_->_tmp33_;
				if (_data_->_tmp32_ == NULL) {
					_data_->_tmp34_ = g_strdup ("");
					_g_free0 (_data_->_tmp32_);
					_data_->_tmp32_ = _data_->_tmp34_;
				}
				_data_->_tmp35_ = _data_->_tmp32_;
				_data_->_tmp32_ = NULL;
				_g_free0 (_data_->body);
				_data_->body = _data_->_tmp35_;
				_g_free0 (_data_->_tmp32_);
				_g_free0 (_data_->_tmp29_);
			}
			break;
		}
		case PLUGIN_EMAIL_BODY_TYPE_HTML:
		{
			_data_->_tmp36_ = _data_->message;
			if (geary_rf_c822_message_has_html_body (_data_->_tmp36_)) {
				_data_->_tmp38_ = _data_->message;
				_data_->_tmp39_ = geary_rf_c822_message_get_html_body (_data_->_tmp38_, NULL, NULL, &_data_->_inner_error0_);
				_data_->_tmp37_ = _data_->_tmp39_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->body);
					_g_object_unref0 (_data_->message);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp41_ = _data_->_tmp37_;
				_data_->_tmp37_ = NULL;
				_data_->_tmp40_ = _data_->_tmp41_;
				if (_data_->_tmp40_ == NULL) {
					_data_->_tmp42_ = g_strdup ("");
					_g_free0 (_data_->_tmp40_);
					_data_->_tmp40_ = _data_->_tmp42_;
				}
				_data_->_tmp43_ = _data_->_tmp40_;
				_data_->_tmp40_ = NULL;
				_g_free0 (_data_->body);
				_data_->body = _data_->_tmp43_;
				_g_free0 (_data_->_tmp40_);
				_g_free0 (_data_->_tmp37_);
			} else {
				_data_->_tmp45_ = _data_->message;
				_data_->_tmp46_ = geary_rf_c822_message_get_plain_body (_data_->_tmp45_, TRUE, NULL, NULL, &_data_->_inner_error0_);
				_data_->_tmp44_ = _data_->_tmp46_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->body);
					_g_object_unref0 (_data_->message);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp48_ = _data_->_tmp44_;
				_data_->_tmp44_ = NULL;
				_data_->_tmp47_ = _data_->_tmp48_;
				if (_data_->_tmp47_ == NULL) {
					_data_->_tmp49_ = g_strdup ("");
					_g_free0 (_data_->_tmp47_);
					_data_->_tmp47_ = _data_->_tmp49_;
				}
				_data_->_tmp50_ = _data_->_tmp47_;
				_data_->_tmp47_ = NULL;
				_g_free0 (_data_->body);
				_data_->body = _data_->_tmp50_;
				_g_free0 (_data_->_tmp47_);
				_g_free0 (_data_->_tmp44_);
			}
			break;
		}
		default:
		break;
	}
	_data_->result = _data_->body;
	_g_object_unref0 (_data_->message);
	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
application_email_store_factory_email_impl_class_init (ApplicationEmailStoreFactoryEmailImplClass * klass,
                                                       gpointer klass_data)
{
	application_email_store_factory_email_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationEmailStoreFactoryEmailImpl_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_email_store_factory_email_impl_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_application_email_store_factory_email_impl_set_property;
	G_OBJECT_CLASS (klass)->finalize = application_email_store_factory_email_impl_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IDENTIFIER_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IDENTIFIER_PROPERTY] = g_param_spec_object ("identifier", "identifier", "identifier", PLUGIN_TYPE_EMAIL_IDENTIFIER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FROM_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FROM_PROPERTY] = g_param_spec_object ("from", "from", "from", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SENDER_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SENDER_PROPERTY] = g_param_spec_object ("sender", "sender", "sender", GEARY_RF_C822_TYPE_MAILBOX_ADDRESS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REPLY_TO_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REPLY_TO_PROPERTY] = g_param_spec_object ("reply-to", "reply-to", "reply-to", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_TO_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_TO_PROPERTY] = g_param_spec_object ("to", "to", "to", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_CC_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_CC_PROPERTY] = g_param_spec_object ("cc", "cc", "cc", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BCC_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BCC_PROPERTY] = g_param_spec_object ("bcc", "bcc", "bcc", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_MESSAGE_ID_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_MESSAGE_ID_PROPERTY] = g_param_spec_object ("message-id", "message-id", "message-id", GEARY_RF_C822_TYPE_MESSAGE_ID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IN_REPLY_TO_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IN_REPLY_TO_PROPERTY] = g_param_spec_object ("in-reply-to", "in-reply-to", "in-reply-to", GEARY_RF_C822_TYPE_MESSAGE_ID_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REFERENCES_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REFERENCES_PROPERTY] = g_param_spec_object ("references", "references", "references", GEARY_RF_C822_TYPE_MESSAGE_ID_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SUBJECT_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SUBJECT_PROPERTY] = g_param_spec_object ("subject", "subject", "subject", GEARY_RF_C822_TYPE_SUBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_DATE_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_DATE_PROPERTY] = g_param_spec_object ("date", "date", "date", GEARY_RF_C822_TYPE_DATE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FLAGS_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FLAGS_PROPERTY] = g_param_spec_object ("flags", "flags", "flags", GEARY_TYPE_EMAIL_FLAGS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY] = g_param_spec_object ("backing", "backing", "backing", GEARY_TYPE_EMAIL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY, application_email_store_factory_email_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
application_email_store_factory_email_impl_geary_email_header_set_interface_init (GearyEmailHeaderSetIface * iface,
                                                                                  gpointer iface_data)
{
	application_email_store_factory_email_impl_geary_email_header_set_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_from = application_email_store_factory_email_impl_real_get_from;
	iface->get_sender = application_email_store_factory_email_impl_real_get_sender;
	iface->get_reply_to = application_email_store_factory_email_impl_real_get_reply_to;
	iface->get_to = application_email_store_factory_email_impl_real_get_to;
	iface->get_cc = application_email_store_factory_email_impl_real_get_cc;
	iface->get_bcc = application_email_store_factory_email_impl_real_get_bcc;
	iface->get_message_id = application_email_store_factory_email_impl_real_get_message_id;
	iface->get_in_reply_to = application_email_store_factory_email_impl_real_get_in_reply_to;
	iface->get_references = application_email_store_factory_email_impl_real_get_references;
	iface->get_subject = application_email_store_factory_email_impl_real_get_subject;
	iface->get_date = application_email_store_factory_email_impl_real_get_date;
}

static void
application_email_store_factory_email_impl_plugin_email_interface_init (PluginEmailIface * iface,
                                                                        gpointer iface_data)
{
	application_email_store_factory_email_impl_plugin_email_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_primary_originator = (GearyRFC822MailboxAddress* (*) (PluginEmail*)) application_email_store_factory_email_impl_real_get_primary_originator;
	iface->load_body_as = (void (*) (PluginEmail*, PluginEmailBodyType, gboolean, GCancellable*, GAsyncReadyCallback, gpointer)) application_email_store_factory_email_impl_real_load_body_as;
	iface->load_body_as_finish = (gchar* (*) (PluginEmail*, GAsyncResult*, GError**)) application_email_store_factory_email_impl_load_body_as_finish;
	iface->get_identifier = application_email_store_factory_email_impl_real_get_identifier;
	iface->get_flags = application_email_store_factory_email_impl_real_get_flags;
}

static void
application_email_store_factory_email_impl_instance_init (ApplicationEmailStoreFactoryEmailImpl * self,
                                                          gpointer klass)
{
	self->priv = application_email_store_factory_email_impl_get_instance_private (self);
	self->priv->_id = NULL;
}

static void
application_email_store_factory_email_impl_finalize (GObject * obj)
{
	ApplicationEmailStoreFactoryEmailImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	_g_object_unref0 (self->priv->_id);
	_g_object_unref0 (self->priv->_backing);
	_g_object_unref0 (self->priv->_account);
	G_OBJECT_CLASS (application_email_store_factory_email_impl_parent_class)->finalize (obj);
}

/** Implementation of the plugin email interface. */
static GType
application_email_store_factory_email_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationEmailStoreFactoryEmailImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_email_store_factory_email_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationEmailStoreFactoryEmailImpl), 0, (GInstanceInitFunc) application_email_store_factory_email_impl_instance_init, NULL };
	static const GInterfaceInfo geary_email_header_set_info = { (GInterfaceInitFunc) application_email_store_factory_email_impl_geary_email_header_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo plugin_email_info = { (GInterfaceInitFunc) application_email_store_factory_email_impl_plugin_email_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_email_store_factory_email_impl_type_id;
	application_email_store_factory_email_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationEmailStoreFactoryEmailImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_email_store_factory_email_impl_type_id, GEARY_TYPE_EMAIL_HEADER_SET, &geary_email_header_set_info);
	g_type_add_interface_static (application_email_store_factory_email_impl_type_id, PLUGIN_TYPE_EMAIL, &plugin_email_info);
	ApplicationEmailStoreFactoryEmailImpl_private_offset = g_type_add_instance_private (application_email_store_factory_email_impl_type_id, sizeof (ApplicationEmailStoreFactoryEmailImplPrivate));
	return application_email_store_factory_email_impl_type_id;
}

GType
application_email_store_factory_email_impl_get_type (void)
{
	static volatile gsize application_email_store_factory_email_impl_type_id__once = 0;
	if (g_once_init_enter (&application_email_store_factory_email_impl_type_id__once)) {
		GType application_email_store_factory_email_impl_type_id;
		application_email_store_factory_email_impl_type_id = application_email_store_factory_email_impl_get_type_once ();
		g_once_init_leave (&application_email_store_factory_email_impl_type_id__once, application_email_store_factory_email_impl_type_id);
	}
	return application_email_store_factory_email_impl_type_id__once;
}

static void
_vala_application_email_store_factory_email_impl_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec)
{
	ApplicationEmailStoreFactoryEmailImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	switch (property_id) {
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IDENTIFIER_PROPERTY:
		g_value_set_object (value, plugin_email_get_identifier (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_EMAIL, PluginEmail)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FROM_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_from (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SENDER_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_sender (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REPLY_TO_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_reply_to (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_TO_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_to (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_CC_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_cc (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BCC_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_bcc (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_MESSAGE_ID_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_message_id (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_IN_REPLY_TO_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_in_reply_to (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_REFERENCES_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_references (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_SUBJECT_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_subject (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_DATE_PROPERTY:
		g_value_set_object (value, geary_email_header_set_get_date (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_EMAIL_HEADER_SET, GearyEmailHeaderSet)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_FLAGS_PROPERTY:
		g_value_set_object (value, plugin_email_get_flags (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_EMAIL, PluginEmail)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY:
		g_value_set_object (value, application_email_store_factory_email_impl_get_backing (self));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY:
		g_value_set_object (value, application_email_store_factory_email_impl_get_account (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_application_email_store_factory_email_impl_set_property (GObject * object,
                                                               guint property_id,
                                                               const GValue * value,
                                                               GParamSpec * pspec)
{
	ApplicationEmailStoreFactoryEmailImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_IMPL, ApplicationEmailStoreFactoryEmailImpl);
	switch (property_id) {
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_BACKING_PROPERTY:
		application_email_store_factory_email_impl_set_backing (self, g_value_get_object (value));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_EMAIL_IMPL_ACCOUNT_PROPERTY:
		application_email_store_factory_email_impl_set_account (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
application_email_store_factory_id_impl_get_instance_private (ApplicationEmailStoreFactoryIdImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationEmailStoreFactoryIdImpl_private_offset);
}

static PluginAccount*
application_email_store_factory_id_impl_real_get_account (PluginEmailIdentifier* base)
{
	PluginAccount* result;
	ApplicationEmailStoreFactoryIdImpl* self;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	_tmp0_ = self->account_impl;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, PLUGIN_TYPE_ACCOUNT, PluginAccount);
	return result;
}

GearyEmailIdentifier*
application_email_store_factory_id_impl_get_backing (ApplicationEmailStoreFactoryIdImpl* self)
{
	GearyEmailIdentifier* result;
	GearyEmailIdentifier* _tmp0_;
	g_return_val_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL (self), NULL);
	_tmp0_ = self->priv->_backing;
	result = _tmp0_;
	return result;
}

static void
application_email_store_factory_id_impl_set_backing (ApplicationEmailStoreFactoryIdImpl* self,
                                                     GearyEmailIdentifier* value)
{
	GearyEmailIdentifier* old_value;
	g_return_if_fail (APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL (self));
	old_value = application_email_store_factory_id_impl_get_backing (self);
	if (old_value != value) {
		GearyEmailIdentifier* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_backing);
		self->priv->_backing = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, application_email_store_factory_id_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY]);
	}
}

ApplicationEmailStoreFactoryIdImpl*
application_email_store_factory_id_impl_construct (GType object_type,
                                                   GearyEmailIdentifier* backing,
                                                   ApplicationPluginManagerAccountImpl* account)
{
	ApplicationEmailStoreFactoryIdImpl * self = NULL;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (backing, GEARY_TYPE_EMAIL_IDENTIFIER), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (account), NULL);
	self = (ApplicationEmailStoreFactoryIdImpl*) geary_base_object_construct (object_type);
	application_email_store_factory_id_impl_set_backing (self, backing);
	_tmp0_ = _g_object_ref0 (account);
	_g_object_unref0 (self->account_impl);
	self->account_impl = _tmp0_;
	return self;
}

ApplicationEmailStoreFactoryIdImpl*
application_email_store_factory_id_impl_new (GearyEmailIdentifier* backing,
                                             ApplicationPluginManagerAccountImpl* account)
{
	return application_email_store_factory_id_impl_construct (APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, backing, account);
}

static GVariant*
_variant_new2 (const gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

static GVariant*
application_email_store_factory_id_impl_real_to_variant (PluginEmailIdentifier* base)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	ApplicationAccountContext* _tmp1_;
	ApplicationAccountContext* _tmp2_;
	GearyAccount* _tmp3_;
	GearyAccount* _tmp4_;
	GearyAccountInformation* _tmp5_;
	GearyAccountInformation* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GVariant* _tmp9_;
	GearyEmailIdentifier* _tmp10_;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	GVariant** _tmp14_;
	GVariant** _tmp15_;
	gint _tmp15__length1;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	GVariant* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	_tmp0_ = self->account_impl;
	_tmp1_ = application_plugin_manager_account_impl_get_backing (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = application_account_context_get_account (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = geary_account_get_information (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = geary_account_information_get_id (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _variant_new2 (_tmp8_);
	_tmp10_ = self->priv->_backing;
	_tmp11_ = geary_email_identifier_to_variant (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_variant_new_variant (_tmp12_);
	g_variant_ref_sink (_tmp13_);
	_tmp14_ = g_new0 (GVariant*, 2 + 1);
	_tmp14_[0] = _tmp9_;
	_tmp14_[1] = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp15__length1 = 2;
	_tmp16_ = g_variant_new_tuple (_tmp15_, 2);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	_tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_variant_unref), NULL);
	_g_variant_unref0 (_tmp12_);
	result = _tmp17_;
	return result;
}

static gboolean
application_email_store_factory_id_impl_real_equal_to (GeeHashable* base,
                                                       PluginEmailIdentifier* other)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	ApplicationEmailStoreFactoryIdImpl* impl = NULL;
	ApplicationEmailStoreFactoryIdImpl* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	ApplicationEmailStoreFactoryIdImpl* _tmp3_;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	g_return_val_if_fail (PLUGIN_IS_EMAIL_IDENTIFIER (other), FALSE);
	if (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_EMAIL_IDENTIFIER, PluginEmailIdentifier) == other) {
		result = TRUE;
		return result;
	}
	_tmp0_ = _g_object_ref0 (APPLICATION_EMAIL_STORE_FACTORY_IS_ID_IMPL (other) ? ((ApplicationEmailStoreFactoryIdImpl*) other) : NULL);
	impl = _tmp0_;
	_tmp3_ = impl;
	if (_tmp3_ != NULL) {
		GearyEmailIdentifier* _tmp4_;
		ApplicationEmailStoreFactoryIdImpl* _tmp5_;
		GearyEmailIdentifier* _tmp6_;
		_tmp4_ = self->priv->_backing;
		_tmp5_ = impl;
		_tmp6_ = _tmp5_->priv->_backing;
		_tmp2_ = geary_email_identifier_equal_to (_tmp4_, _tmp6_);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		ApplicationPluginManagerAccountImpl* _tmp7_;
		ApplicationAccountContext* _tmp8_;
		ApplicationAccountContext* _tmp9_;
		ApplicationEmailStoreFactoryIdImpl* _tmp10_;
		ApplicationPluginManagerAccountImpl* _tmp11_;
		ApplicationAccountContext* _tmp12_;
		ApplicationAccountContext* _tmp13_;
		_tmp7_ = self->account_impl;
		_tmp8_ = application_plugin_manager_account_impl_get_backing (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = impl;
		_tmp11_ = _tmp10_->account_impl;
		_tmp12_ = application_plugin_manager_account_impl_get_backing (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp1_ = _tmp9_ == _tmp13_;
	} else {
		_tmp1_ = FALSE;
	}
	result = _tmp1_;
	_g_object_unref0 (impl);
	return result;
}

static guint
application_email_store_factory_id_impl_real_hash (GeeHashable* base)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	GearyEmailIdentifier* _tmp0_;
	guint result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	_tmp0_ = self->priv->_backing;
	result = geary_email_identifier_hash (_tmp0_);
	return result;
}

static void
application_email_store_factory_id_impl_class_init (ApplicationEmailStoreFactoryIdImplClass * klass,
                                                    gpointer klass_data)
{
	application_email_store_factory_id_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationEmailStoreFactoryIdImpl_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_email_store_factory_id_impl_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_application_email_store_factory_id_impl_set_property;
	G_OBJECT_CLASS (klass)->finalize = application_email_store_factory_id_impl_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_ACCOUNT_PROPERTY, application_email_store_factory_id_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", PLUGIN_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY, application_email_store_factory_id_impl_properties[APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY] = g_param_spec_object ("backing", "backing", "backing", GEARY_TYPE_EMAIL_IDENTIFIER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
application_email_store_factory_id_impl_gee_hashable_interface_init (GeeHashableIface * iface,
                                                                     gpointer iface_data)
{
	application_email_store_factory_id_impl_gee_hashable_parent_iface = g_type_interface_peek_parent (iface);
	iface->equal_to = (gboolean (*) (GeeHashable*, gconstpointer)) application_email_store_factory_id_impl_real_equal_to;
	iface->hash = (guint (*) (GeeHashable*)) application_email_store_factory_id_impl_real_hash;
}

static void
application_email_store_factory_id_impl_plugin_email_identifier_interface_init (PluginEmailIdentifierIface * iface,
                                                                                gpointer iface_data)
{
	application_email_store_factory_id_impl_plugin_email_identifier_parent_iface = g_type_interface_peek_parent (iface);
	iface->to_variant = (GVariant* (*) (PluginEmailIdentifier*)) application_email_store_factory_id_impl_real_to_variant;
	iface->get_account = application_email_store_factory_id_impl_real_get_account;
}

static void
application_email_store_factory_id_impl_instance_init (ApplicationEmailStoreFactoryIdImpl * self,
                                                       gpointer klass)
{
	self->priv = application_email_store_factory_id_impl_get_instance_private (self);
}

static void
application_email_store_factory_id_impl_finalize (GObject * obj)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	_g_object_unref0 (self->account_impl);
	_g_object_unref0 (self->priv->_backing);
	G_OBJECT_CLASS (application_email_store_factory_id_impl_parent_class)->finalize (obj);
}

static GType
application_email_store_factory_id_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationEmailStoreFactoryIdImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_email_store_factory_id_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationEmailStoreFactoryIdImpl), 0, (GInstanceInitFunc) application_email_store_factory_id_impl_instance_init, NULL };
	static const GInterfaceInfo gee_hashable_info = { (GInterfaceInitFunc) application_email_store_factory_id_impl_gee_hashable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo plugin_email_identifier_info = { (GInterfaceInitFunc) application_email_store_factory_id_impl_plugin_email_identifier_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_email_store_factory_id_impl_type_id;
	application_email_store_factory_id_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationEmailStoreFactoryIdImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_email_store_factory_id_impl_type_id, GEE_TYPE_HASHABLE, &gee_hashable_info);
	g_type_add_interface_static (application_email_store_factory_id_impl_type_id, PLUGIN_TYPE_EMAIL_IDENTIFIER, &plugin_email_identifier_info);
	ApplicationEmailStoreFactoryIdImpl_private_offset = g_type_add_instance_private (application_email_store_factory_id_impl_type_id, sizeof (ApplicationEmailStoreFactoryIdImplPrivate));
	return application_email_store_factory_id_impl_type_id;
}

GType
application_email_store_factory_id_impl_get_type (void)
{
	static volatile gsize application_email_store_factory_id_impl_type_id__once = 0;
	if (g_once_init_enter (&application_email_store_factory_id_impl_type_id__once)) {
		GType application_email_store_factory_id_impl_type_id;
		application_email_store_factory_id_impl_type_id = application_email_store_factory_id_impl_get_type_once ();
		g_once_init_leave (&application_email_store_factory_id_impl_type_id__once, application_email_store_factory_id_impl_type_id);
	}
	return application_email_store_factory_id_impl_type_id__once;
}

static void
_vala_application_email_store_factory_id_impl_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	switch (property_id) {
		case APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_ACCOUNT_PROPERTY:
		g_value_set_object (value, plugin_email_identifier_get_account (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_EMAIL_IDENTIFIER, PluginEmailIdentifier)));
		break;
		case APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY:
		g_value_set_object (value, application_email_store_factory_id_impl_get_backing (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_application_email_store_factory_id_impl_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	ApplicationEmailStoreFactoryIdImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_EMAIL_STORE_FACTORY_TYPE_ID_IMPL, ApplicationEmailStoreFactoryIdImpl);
	switch (property_id) {
		case APPLICATION_EMAIL_STORE_FACTORY_ID_IMPL_BACKING_PROPERTY:
		application_email_store_factory_id_impl_set_backing (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
application_email_store_factory_class_init (ApplicationEmailStoreFactoryClass * klass,
                                            gpointer klass_data)
{
	application_email_store_factory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationEmailStoreFactory_private_offset);
	G_OBJECT_CLASS (klass)->finalize = application_email_store_factory_finalize;
}

static void
application_email_store_factory_instance_init (ApplicationEmailStoreFactory * self,
                                               gpointer klass)
{
	GeeHashSet* _tmp0_;
	self->priv = application_email_store_factory_get_instance_private (self);
	_tmp0_ = gee_hash_set_new (APPLICATION_EMAIL_STORE_FACTORY_TYPE_EMAIL_STORE_IMPL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->stores = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_SET, GeeSet);
}

static void
application_email_store_factory_finalize (GObject * obj)
{
	ApplicationEmailStoreFactory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_TYPE_EMAIL_STORE_FACTORY, ApplicationEmailStoreFactory);
	_g_object_unref0 (self->priv->accounts);
	_g_object_unref0 (self->priv->stores);
	G_OBJECT_CLASS (application_email_store_factory_parent_class)->finalize (obj);
}

/**
 * A factory for constructing plugin email stores and objects.
 *
 * This class provides a common implementation that shares email
 * objects between different plugin context instances.
 */
static GType
application_email_store_factory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationEmailStoreFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_email_store_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationEmailStoreFactory), 0, (GInstanceInitFunc) application_email_store_factory_instance_init, NULL };
	GType application_email_store_factory_type_id;
	application_email_store_factory_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationEmailStoreFactory", &g_define_type_info, 0);
	ApplicationEmailStoreFactory_private_offset = g_type_add_instance_private (application_email_store_factory_type_id, sizeof (ApplicationEmailStoreFactoryPrivate));
	return application_email_store_factory_type_id;
}

GType
application_email_store_factory_get_type (void)
{
	static volatile gsize application_email_store_factory_type_id__once = 0;
	if (g_once_init_enter (&application_email_store_factory_type_id__once)) {
		GType application_email_store_factory_type_id;
		application_email_store_factory_type_id = application_email_store_factory_get_type_once ();
		g_once_init_leave (&application_email_store_factory_type_id__once, application_email_store_factory_type_id);
	}
	return application_email_store_factory_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

