/* application-plugin-manager.c generated by valac 0.56.19, the Vala compiler
 * generated from application-plugin-manager.vala, do not modify */

/*
 * Copyright © 2019-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-client-46.0.h"
#include <glib-object.h>
#include "geary-engine.h"
#include <libpeas.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gobject/gvaluecollector.h>

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

#define APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS (application_plugin_manager_plugin_globals_get_type ())
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_GLOBALS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, ApplicationPluginManagerPluginGlobals))
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_GLOBALS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, ApplicationPluginManagerPluginGlobalsClass))
#define APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS))
#define APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS))
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_GLOBALS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, ApplicationPluginManagerPluginGlobalsClass))

typedef struct _ApplicationPluginManagerPluginGlobals ApplicationPluginManagerPluginGlobals;
typedef struct _ApplicationPluginManagerPluginGlobalsClass ApplicationPluginManagerPluginGlobalsClass;

#define APPLICATION_TYPE_CONTROLLER (application_controller_get_type ())
#define APPLICATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_CONTROLLER, ApplicationController))
#define APPLICATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_CONTROLLER, ApplicationControllerClass))
#define APPLICATION_IS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_CONTROLLER))
#define APPLICATION_IS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_CONTROLLER))
#define APPLICATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_CONTROLLER, ApplicationControllerClass))

typedef struct _ApplicationController ApplicationController;
typedef struct _ApplicationControllerClass ApplicationControllerClass;

#define APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT (application_plugin_manager_plugin_context_get_type ())
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, ApplicationPluginManagerPluginContext))
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, ApplicationPluginManagerPluginContextClass))
#define APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT))
#define APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT))
#define APPLICATION_PLUGIN_MANAGER_PLUGIN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, ApplicationPluginManagerPluginContextClass))

typedef struct _ApplicationPluginManagerPluginContext ApplicationPluginManagerPluginContext;
typedef struct _ApplicationPluginManagerPluginContextClass ApplicationPluginManagerPluginContextClass;

#define APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT (application_notification_plugin_context_get_type ())
#define APPLICATION_NOTIFICATION_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT, ApplicationNotificationPluginContext))
#define APPLICATION_NOTIFICATION_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT, ApplicationNotificationPluginContextClass))
#define APPLICATION_IS_NOTIFICATION_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT))
#define APPLICATION_IS_NOTIFICATION_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT))
#define APPLICATION_NOTIFICATION_PLUGIN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT, ApplicationNotificationPluginContextClass))

typedef struct _ApplicationNotificationPluginContext ApplicationNotificationPluginContext;
typedef struct _ApplicationNotificationPluginContextClass ApplicationNotificationPluginContextClass;

#define APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT (application_email_plugin_context_get_type ())
#define APPLICATION_EMAIL_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT, ApplicationEmailPluginContext))
#define APPLICATION_EMAIL_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT, ApplicationEmailPluginContextClass))
#define APPLICATION_IS_EMAIL_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT))
#define APPLICATION_IS_EMAIL_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT))
#define APPLICATION_EMAIL_PLUGIN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT, ApplicationEmailPluginContextClass))

typedef struct _ApplicationEmailPluginContext ApplicationEmailPluginContext;
typedef struct _ApplicationEmailPluginContextClass ApplicationEmailPluginContextClass;
enum  {
	APPLICATION_PLUGIN_MANAGER_0_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_NUM_PROPERTIES
};
static GParamSpec* application_plugin_manager_properties[APPLICATION_PLUGIN_MANAGER_NUM_PROPERTIES];
#define _application_plugin_manager_plugin_globals_unref0(var) ((var == NULL) ? NULL : (var = (application_plugin_manager_plugin_globals_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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)))

#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_TYPE_FOLDER_STORE_FACTORY (application_folder_store_factory_get_type ())
#define APPLICATION_FOLDER_STORE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_FOLDER_STORE_FACTORY, ApplicationFolderStoreFactory))
#define APPLICATION_FOLDER_STORE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_FOLDER_STORE_FACTORY, ApplicationFolderStoreFactoryClass))
#define APPLICATION_IS_FOLDER_STORE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_FOLDER_STORE_FACTORY))
#define APPLICATION_IS_FOLDER_STORE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_FOLDER_STORE_FACTORY))
#define APPLICATION_FOLDER_STORE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_FOLDER_STORE_FACTORY, ApplicationFolderStoreFactoryClass))

typedef struct _ApplicationFolderStoreFactory ApplicationFolderStoreFactory;
typedef struct _ApplicationFolderStoreFactoryClass ApplicationFolderStoreFactoryClass;

#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 _Block36Data Block36Data;
#define _application_plugin_manager_plugin_context_unref0(var) ((var == NULL) ? NULL : (var = (application_plugin_manager_plugin_context_unref (var), NULL)))

#define APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT (application_folder_plugin_context_get_type ())
#define APPLICATION_FOLDER_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT, ApplicationFolderPluginContext))
#define APPLICATION_FOLDER_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT, ApplicationFolderPluginContextClass))
#define APPLICATION_IS_FOLDER_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT))
#define APPLICATION_IS_FOLDER_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT))
#define APPLICATION_FOLDER_PLUGIN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_TYPE_FOLDER_PLUGIN_CONTEXT, ApplicationFolderPluginContextClass))

typedef struct _ApplicationFolderPluginContext ApplicationFolderPluginContext;
typedef struct _ApplicationFolderPluginContextClass ApplicationFolderPluginContextClass;
typedef struct _Block37Data Block37Data;

#define APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL (application_plugin_manager_application_impl_get_type ())
#define APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl))
#define APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImplClass))
#define APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL))
#define APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL))
#define APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImplClass))

typedef struct _ApplicationPluginManagerApplicationImpl ApplicationPluginManagerApplicationImpl;
typedef struct _ApplicationPluginManagerApplicationImplClass ApplicationPluginManagerApplicationImplClass;
typedef struct _ApplicationPluginManagerPluginGlobalsPrivate ApplicationPluginManagerPluginGlobalsPrivate;

#define APPLICATION_TYPE_ACCOUNT_INTERFACE (application_account_interface_get_type ())
#define APPLICATION_ACCOUNT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_TYPE_ACCOUNT_INTERFACE, ApplicationAccountInterface))
#define APPLICATION_IS_ACCOUNT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_TYPE_ACCOUNT_INTERFACE))
#define APPLICATION_ACCOUNT_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), APPLICATION_TYPE_ACCOUNT_INTERFACE, ApplicationAccountInterfaceIface))

typedef struct _ApplicationAccountInterface ApplicationAccountInterface;
typedef struct _ApplicationAccountInterfaceIface ApplicationAccountInterfaceIface;
typedef struct _ApplicationPluginManagerParamSpecPluginGlobals ApplicationPluginManagerParamSpecPluginGlobals;
typedef struct _ApplicationPluginManagerPluginContextPrivate ApplicationPluginManagerPluginContextPrivate;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _ApplicationPluginManagerPluginContextActivateData ApplicationPluginManagerPluginContextActivateData;
typedef struct _ApplicationPluginManagerPluginContextDeactivateData ApplicationPluginManagerPluginContextDeactivateData;
typedef struct _ApplicationPluginManagerParamSpecPluginContext ApplicationPluginManagerParamSpecPluginContext;
typedef struct _ApplicationPluginManagerApplicationImplPrivate ApplicationPluginManagerApplicationImplPrivate;

#define APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL (application_plugin_manager_composer_impl_get_type ())
#define APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl))
#define APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImplClass))
#define APPLICATION_PLUGIN_MANAGER_IS_COMPOSER_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL))
#define APPLICATION_PLUGIN_MANAGER_IS_COMPOSER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL))
#define APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImplClass))

typedef struct _ApplicationPluginManagerComposerImpl ApplicationPluginManagerComposerImpl;
typedef struct _ApplicationPluginManagerComposerImplClass ApplicationPluginManagerComposerImplClass;
enum  {
	APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL_0_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_plugin_manager_application_impl_properties[APPLICATION_PLUGIN_MANAGER_APPLICATION_IMPL_NUM_PROPERTIES];
typedef struct _ApplicationPluginManagerApplicationImplComposeBlankData ApplicationPluginManagerApplicationImplComposeBlankData;
typedef struct _ApplicationPluginManagerApplicationImplComposeWithContextData ApplicationPluginManagerApplicationImplComposeWithContextData;
typedef struct _Block38Data Block38Data;
typedef struct _Block39Data Block39Data;

#define COMPOSER_TYPE_APPLICATION_INTERFACE (composer_application_interface_get_type ())
#define COMPOSER_APPLICATION_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMPOSER_TYPE_APPLICATION_INTERFACE, ComposerApplicationInterface))
#define COMPOSER_IS_APPLICATION_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMPOSER_TYPE_APPLICATION_INTERFACE))
#define COMPOSER_APPLICATION_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), COMPOSER_TYPE_APPLICATION_INTERFACE, ComposerApplicationInterfaceIface))

typedef struct _ComposerApplicationInterface ComposerApplicationInterface;
typedef struct _ComposerApplicationInterfaceIface ComposerApplicationInterfaceIface;
typedef struct _ApplicationPluginManagerApplicationImplEmptyFolderData ApplicationPluginManagerApplicationImplEmptyFolderData;
typedef struct _ApplicationPluginManagerAccountImplPrivate ApplicationPluginManagerAccountImplPrivate;
enum  {
	APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_0_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_DISPLAY_NAME_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_plugin_manager_account_impl_properties[APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_NUM_PROPERTIES];
typedef struct _ApplicationPluginManagerComposerImplPrivate ApplicationPluginManagerComposerImplPrivate;
enum  {
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_0_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SENDER_CONTEXT_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_ACTION_GROUP_NAME_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SAVE_TO_PROPERTY,
	APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_NUM_PROPERTIES
};
static GParamSpec* application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_NUM_PROPERTIES];
enum  {
	APPLICATION_PLUGIN_MANAGER_PLUGIN_ACTIVATED_SIGNAL,
	APPLICATION_PLUGIN_MANAGER_PLUGIN_ERROR_SIGNAL,
	APPLICATION_PLUGIN_MANAGER_PLUGIN_DEACTIVATED_SIGNAL,
	APPLICATION_PLUGIN_MANAGER_NUM_SIGNALS
};
static guint application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_NUM_SIGNALS] = {0};

struct _ApplicationPluginManagerPrivate {
	ApplicationPluginManagerPluginGlobals* _globals;
	ApplicationClient* application;
	ApplicationController* controller;
	ApplicationConfiguration* config;
	PeasEngine* plugin_engine;
	gboolean is_startup;
	gboolean is_shutdown;
	gchar* trusted_path;
	GeeMap* plugin_set;
	GeeMap* notification_contexts;
	GeeMap* email_contexts;
};

struct _Block36Data {
	int _ref_count_;
	ApplicationPluginManager* self;
	ApplicationPluginManagerPluginContext* context;
};

struct _Block37Data {
	int _ref_count_;
	ApplicationPluginManager* self;
	ApplicationPluginManagerPluginContext* plugin_context;
};

struct _ApplicationPluginManagerPluginGlobals {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GeeMap* accounts;
	ApplicationPluginManagerPluginGlobalsPrivate * priv;
};

struct _ApplicationPluginManagerPluginGlobalsClass {
	GTypeClass parent_class;
	void (*finalize) (ApplicationPluginManagerPluginGlobals *self);
};

struct _ApplicationPluginManagerPluginGlobalsPrivate {
	ApplicationFolderStoreFactory* _folders;
	ApplicationEmailStoreFactory* _email;
};

struct _ApplicationAccountInterfaceIface {
	GTypeInterface parent_iface;
	ApplicationAccountContext* (*get_context_for_account) (ApplicationAccountInterface* self, GearyAccountInformation* account);
	GeeCollection* (*get_account_contexts) (ApplicationAccountInterface* self);
};

struct _ApplicationPluginManagerParamSpecPluginGlobals {
	GParamSpec parent_instance;
};

struct _ApplicationPluginManagerPluginContext {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ApplicationPluginManagerPluginContextPrivate * priv;
};

struct _ApplicationPluginManagerPluginContextClass {
	GTypeClass parent_class;
	void (*finalize) (ApplicationPluginManagerPluginContext *self);
};

struct _ApplicationPluginManagerPluginContextPrivate {
	PeasPluginInfo* _info;
	PluginPluginBase* _instance;
	ApplicationPluginManagerApplicationImpl* _application;
	gchar* _action_group_name;
};

struct _ApplicationPluginManagerPluginContextActivateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationPluginManagerPluginContext* self;
	gboolean is_startup;
	PluginPluginBase* _tmp0_;
	GError* _inner_error0_;
};

struct _ApplicationPluginManagerPluginContextDeactivateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationPluginManagerPluginContext* self;
	gboolean is_shutdown;
	PluginPluginBase* _tmp0_;
	GError* _inner_error0_;
};

struct _ApplicationPluginManagerParamSpecPluginContext {
	GParamSpec parent_instance;
};

struct _ApplicationPluginManagerApplicationImpl {
	GearyBaseObject parent_instance;
	ApplicationClient* backing;
	ApplicationPluginManagerPluginContext* plugin;
	ApplicationPluginManagerPluginGlobals* globals;
	ApplicationPluginManagerApplicationImplPrivate * priv;
};

struct _ApplicationPluginManagerApplicationImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationPluginManagerApplicationImplPrivate {
	GSimpleActionGroup* action_group;
	GeeMap* composer_impls;
};

struct _ApplicationPluginManagerApplicationImplComposeBlankData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationPluginManagerApplicationImpl* self;
	PluginAccount* source;
	PluginComposer* result;
	ApplicationPluginManagerAccountImpl* impl;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	ApplicationPluginManagerAccountImpl* _tmp1_;
	GError* _tmp2_;
	ApplicationClient* _tmp3_;
	ApplicationController* _tmp4_;
	ApplicationController* _tmp5_;
	ApplicationPluginManagerAccountImpl* _tmp6_;
	ApplicationAccountContext* _tmp7_;
	ApplicationAccountContext* _tmp8_;
	ComposerWidget* _tmp9_;
	ComposerWidget* _tmp10_;
	ApplicationPluginManagerComposerImpl* _tmp11_;
	PluginComposer* _tmp12_;
	GError* _inner_error0_;
};

struct _ApplicationPluginManagerApplicationImplComposeWithContextData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationPluginManagerApplicationImpl* self;
	PluginAccount* send_from;
	PluginComposerContextType plugin_type;
	PluginEmailIdentifier* to_load;
	gchar* quote;
	PluginComposer* result;
	ApplicationPluginManagerAccountImpl* source_impl;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	ApplicationPluginManagerAccountImpl* _tmp1_;
	GError* _tmp2_;
	GearyEmailIdentifier* id;
	ApplicationPluginManagerPluginGlobals* _tmp3_;
	ApplicationEmailStoreFactory* _tmp4_;
	ApplicationEmailStoreFactory* _tmp5_;
	GearyEmailIdentifier* _tmp6_;
	GearyEmailIdentifier* _tmp7_;
	GError* _tmp8_;
	GeeCollection* email;
	GeeCollection* _tmp9_;
	ApplicationPluginManagerAccountImpl* _tmp10_;
	ApplicationAccountContext* _tmp11_;
	ApplicationAccountContext* _tmp12_;
	GearyAppEmailStore* _tmp13_;
	GearyAppEmailStore* _tmp14_;
	GearyEmailIdentifier* _tmp15_;
	GeeCollection* _tmp16_;
	GeeCollection* _tmp17_;
	ApplicationPluginManagerAccountImpl* _tmp18_;
	ApplicationAccountContext* _tmp19_;
	ApplicationAccountContext* _tmp20_;
	GCancellable* _tmp21_;
	GCancellable* _tmp22_;
	GeeCollection* _tmp23_;
	GeeCollection* _tmp24_;
	GeeCollection* _tmp25_;
	GError* err;
	GError* _tmp26_;
	const gchar* _tmp27_;
	GError* _tmp28_;
	gboolean _tmp29_;
	GeeCollection* _tmp30_;
	GeeCollection* _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp33_;
	GError* _tmp34_;
	GearyEmail* context;
	GeeCollection* _tmp35_;
	gpointer _tmp36_;
	ComposerWidgetContextType type;
	ApplicationClient* _tmp37_;
	ApplicationController* _tmp38_;
	ApplicationController* _tmp39_;
	ApplicationPluginManagerAccountImpl* _tmp40_;
	ApplicationAccountContext* _tmp41_;
	ApplicationAccountContext* _tmp42_;
	GearyEmail* _tmp43_;
	ComposerWidget* _tmp44_;
	ComposerWidget* _tmp45_;
	ApplicationPluginManagerComposerImpl* _tmp46_;
	PluginComposer* _tmp47_;
	GError* _inner_error0_;
};

struct _Block38Data {
	int _ref_count_;
	ApplicationPluginManagerApplicationImpl* self;
	GearyFolder* target;
	gpointer _async_data_;
};

struct _Block39Data {
	int _ref_count_;
	Block38Data * _data38_;
	ApplicationController* controller;
};

struct _ComposerApplicationInterfaceIface {
	GTypeInterface parent_iface;
	void (*report_problem) (ComposerApplicationInterface* self, GearyProblemReport* report);
	void (*send_composed_email) (ComposerApplicationInterface* self, ComposerWidget* composer, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*send_composed_email_finish) (ComposerApplicationInterface* self, GAsyncResult* _res_);
	void (*save_composed_email) (ComposerApplicationInterface* self, ComposerWidget* composer, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*save_composed_email_finish) (ComposerApplicationInterface* self, GAsyncResult* _res_);
	void (*discard_composed_email) (ComposerApplicationInterface* self, ComposerWidget* composer, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*discard_composed_email_finish) (ComposerApplicationInterface* self, GAsyncResult* _res_);
};

struct _ApplicationPluginManagerApplicationImplEmptyFolderData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ApplicationPluginManagerApplicationImpl* self;
	PluginFolder* folder;
	Block38Data* _data38_;
	ApplicationMainWindow* main;
	ApplicationClient* _tmp0_;
	ApplicationMainWindow* _tmp1_;
	ApplicationMainWindow* _tmp2_;
	ApplicationMainWindow* _tmp3_;
	ApplicationMainWindow* _tmp4_;
	GError* _tmp5_;
	ApplicationPluginManagerPluginGlobals* _tmp6_;
	ApplicationFolderStoreFactory* _tmp7_;
	ApplicationFolderStoreFactory* _tmp8_;
	GearyFolder* _tmp9_;
	GearyFolder* _tmp10_;
	Block39Data* _data39_;
	ApplicationMainWindow* _tmp11_;
	GearyFolder* _tmp12_;
	GearyFolderSpecialUse _tmp13_;
	GearyFolderSpecialUse _tmp14_;
	GError* _tmp15_;
	ApplicationClient* _tmp16_;
	ApplicationController* _tmp17_;
	ApplicationController* _tmp18_;
	ApplicationController* _tmp19_;
	ApplicationController* _tmp20_;
	GearyFolder* _tmp21_;
	GError* _inner_error0_;
};

struct _ApplicationPluginManagerAccountImpl {
	GearyBaseObject parent_instance;
	ApplicationPluginManagerAccountImplPrivate * priv;
};

struct _ApplicationPluginManagerAccountImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationPluginManagerAccountImplPrivate {
	ApplicationAccountContext* _backing;
};

struct _ApplicationPluginManagerComposerImpl {
	GearyBaseObject parent_instance;
	ApplicationPluginManagerComposerImplPrivate * priv;
};

struct _ApplicationPluginManagerComposerImplClass {
	GearyBaseObjectClass parent_class;
};

struct _ApplicationPluginManagerComposerImplPrivate {
	gboolean _can_send;
	PluginAccount* _sender_context;
	gchar* _action_group_name;
	PluginFolder* _save_to;
	ComposerWidget* backing;
	ApplicationPluginManagerApplicationImpl* application;
	GSimpleActionGroup* action_group;
	GMenu* menu_items;
	GtkActionBar* action_bar;
};

static gint ApplicationPluginManager_private_offset;
static gpointer application_plugin_manager_parent_class = NULL;
static gint ApplicationPluginManagerPluginGlobals_private_offset;
static gpointer application_plugin_manager_plugin_globals_parent_class = NULL;
static gint ApplicationPluginManagerPluginContext_private_offset;
static gpointer application_plugin_manager_plugin_context_parent_class = NULL;
static gint ApplicationPluginManagerApplicationImpl_private_offset;
static gpointer application_plugin_manager_application_impl_parent_class = NULL;
static PluginApplicationIface * application_plugin_manager_application_impl_plugin_application_parent_iface = NULL;
static gint ApplicationPluginManagerAccountImpl_private_offset;
static gpointer application_plugin_manager_account_impl_parent_class = NULL;
static PluginAccountIface * application_plugin_manager_account_impl_plugin_account_parent_iface = NULL;
static gint ApplicationPluginManagerComposerImpl_private_offset;
static gpointer application_plugin_manager_composer_impl_parent_class = NULL;
static PluginComposerIface * application_plugin_manager_composer_impl_plugin_composer_parent_iface = NULL;

VALA_EXTERN gpointer application_plugin_manager_plugin_globals_ref (gpointer instance);
VALA_EXTERN void application_plugin_manager_plugin_globals_unref (gpointer instance);
VALA_EXTERN GParamSpec* application_plugin_manager_param_spec_plugin_globals (const gchar* name,
                                                                  const gchar* nick,
                                                                  const gchar* blurb,
                                                                  GType object_type,
                                                                  GParamFlags flags);
VALA_EXTERN void application_plugin_manager_value_set_plugin_globals (GValue* value,
                                                          gpointer v_object);
VALA_EXTERN void application_plugin_manager_value_take_plugin_globals (GValue* value,
                                                           gpointer v_object);
VALA_EXTERN gpointer application_plugin_manager_value_get_plugin_globals (const GValue* value);
VALA_EXTERN GType application_plugin_manager_plugin_globals_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType application_controller_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gpointer application_plugin_manager_plugin_context_ref (gpointer instance);
VALA_EXTERN void application_plugin_manager_plugin_context_unref (gpointer instance);
VALA_EXTERN GParamSpec* application_plugin_manager_param_spec_plugin_context (const gchar* name,
                                                                  const gchar* nick,
                                                                  const gchar* blurb,
                                                                  GType object_type,
                                                                  GParamFlags flags);
VALA_EXTERN void application_plugin_manager_value_set_plugin_context (GValue* value,
                                                          gpointer v_object);
VALA_EXTERN void application_plugin_manager_value_take_plugin_context (GValue* value,
                                                           gpointer v_object);
VALA_EXTERN gpointer application_plugin_manager_value_get_plugin_context (const GValue* value);
VALA_EXTERN GType application_plugin_manager_plugin_context_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType application_notification_plugin_context_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType application_email_plugin_context_get_type (void) G_GNUC_CONST ;
static void g_cclosure_user_marshal_VOID__OBJECT_BOXED (GClosure * closure,
                                                 GValue * return_value,
                                                 guint n_param_values,
                                                 const GValue * param_values,
                                                 gpointer invocation_hint,
                                                 gpointer marshal_data);
VALA_EXTERN ApplicationPluginManagerPluginGlobals* application_plugin_manager_get_globals (ApplicationPluginManager* self);
static void application_plugin_manager_set_globals (ApplicationPluginManager* self,
                                             ApplicationPluginManagerPluginGlobals* value);
VALA_EXTERN ApplicationPluginManager* application_plugin_manager_new (ApplicationClient* application,
                                                          ApplicationController* controller,
                                                          ApplicationConfiguration* config,
                                                          GFile* trusted_plugin_path,
                                                          GError** error);
VALA_EXTERN ApplicationPluginManager* application_plugin_manager_construct (GType object_type,
                                                                ApplicationClient* application,
                                                                ApplicationController* controller,
                                                                ApplicationConfiguration* config,
                                                                GFile* trusted_plugin_path,
                                                                GError** error);
VALA_EXTERN ApplicationPluginManagerPluginGlobals* application_plugin_manager_plugin_globals_new (ApplicationClient* application,
                                                                                      ApplicationController* controller);
VALA_EXTERN ApplicationPluginManagerPluginGlobals* application_plugin_manager_plugin_globals_construct (GType object_type,
                                                                                            ApplicationClient* application,
                                                                                            ApplicationController* controller);
static void application_plugin_manager_on_load_plugin (ApplicationPluginManager* self,
                                                PeasPluginInfo* info);
static void _application_plugin_manager_on_load_plugin_peas_engine_load_plugin (PeasEngine* _sender,
                                                                         PeasPluginInfo* info,
                                                                         gpointer self);
static void application_plugin_manager_on_unload_plugin (ApplicationPluginManager* self,
                                                  PeasPluginInfo* info);
static void _application_plugin_manager_on_unload_plugin_peas_engine_unload_plugin (PeasEngine* _sender,
                                                                             PeasPluginInfo* info,
                                                                             gpointer self);
static void application_plugin_manager_on_composer_registered (ApplicationPluginManager* self,
                                                        ComposerWidget* registered);
static void _application_plugin_manager_on_composer_registered_application_controller_composer_registered (ApplicationController* _sender,
                                                                                                    ComposerWidget* widget,
                                                                                                    gpointer self);
static void application_plugin_manager_on_composer_deregistered (ApplicationPluginManager* self,
                                                          ComposerWidget* deregistered);
static void _application_plugin_manager_on_composer_deregistered_application_controller_composer_deregistered (ApplicationController* _sender,
                                                                                                        ComposerWidget* widget,
                                                                                                        gpointer self);
VALA_EXTERN gboolean application_plugin_manager_is_autoload (ApplicationPluginManager* self,
                                                 PeasPluginInfo* info);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
VALA_EXTERN GType application_plugin_manager_account_impl_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ApplicationAccountContext* application_plugin_manager_account_impl_get_backing (ApplicationPluginManagerAccountImpl* self);
VALA_EXTERN GType application_folder_store_factory_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ApplicationFolderStoreFactory* application_plugin_manager_plugin_globals_get_folders (ApplicationPluginManagerPluginGlobals* self);
VALA_EXTERN GearyFolder* application_folder_store_factory_to_engine_folder (ApplicationFolderStoreFactory* self,
                                                                PluginFolder* plugin);
VALA_EXTERN GType application_email_store_factory_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ApplicationEmailStoreFactory* application_plugin_manager_plugin_globals_get_email (ApplicationPluginManagerPluginGlobals* self);
VALA_EXTERN GearyEmail* application_email_store_factory_to_engine_email (ApplicationEmailStoreFactory* self,
                                                             PluginEmail* plugin);
VALA_EXTERN void application_plugin_manager_close (ApplicationPluginManager* self,
                                       GError** error);
VALA_EXTERN void application_plugin_manager_plugin_globals_destroy (ApplicationPluginManagerPluginGlobals* self,
                                                        GError** error);
VALA_EXTERN GeeCollection* application_plugin_manager_get_notification_contexts (ApplicationPluginManager* self);
VALA_EXTERN GeeCollection* application_plugin_manager_get_email_contexts (ApplicationPluginManager* self);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
VALA_EXTERN ApplicationPluginManagerPluginContext* application_plugin_manager_plugin_context_new (PeasEngine* engine,
                                                                                      PeasPluginInfo* info,
                                                                                      ApplicationClient* application,
                                                                                      ApplicationPluginManagerPluginGlobals* globals,
                                                                                      GError** error);
VALA_EXTERN ApplicationPluginManagerPluginContext* application_plugin_manager_plugin_context_construct (GType object_type,
                                                                                            PeasEngine* engine,
                                                                                            PeasPluginInfo* info,
                                                                                            ApplicationClient* application,
                                                                                            ApplicationPluginManagerPluginGlobals* globals,
                                                                                            GError** error);
VALA_EXTERN PluginPluginBase* application_plugin_manager_plugin_context_get_instance (ApplicationPluginManagerPluginContext* self);
VALA_EXTERN ApplicationNotificationPluginContext* application_notification_plugin_context_new (ApplicationClient* application,
                                                                                   ApplicationPluginManagerPluginGlobals* globals,
                                                                                   ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN ApplicationNotificationPluginContext* application_notification_plugin_context_construct (GType object_type,
                                                                                         ApplicationClient* application,
                                                                                         ApplicationPluginManagerPluginGlobals* globals,
                                                                                         ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN ApplicationEmailPluginContext* application_email_plugin_context_new (ApplicationClient* application,
                                                                     ApplicationPluginManagerPluginGlobals* globals,
                                                                     ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN ApplicationEmailPluginContext* application_email_plugin_context_construct (GType object_type,
                                                                           ApplicationClient* application,
                                                                           ApplicationPluginManagerPluginGlobals* globals,
                                                                           ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN ApplicationClient* application_controller_get_application (ApplicationController* self);
VALA_EXTERN ApplicationFolderPluginContext* application_folder_plugin_context_new (ApplicationClient* application,
                                                                       ApplicationPluginManagerPluginGlobals* globals,
                                                                       ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN ApplicationFolderPluginContext* application_folder_plugin_context_construct (GType object_type,
                                                                             ApplicationClient* application,
                                                                             ApplicationPluginManagerPluginGlobals* globals,
                                                                             ApplicationPluginManagerPluginContext* plugin);
VALA_EXTERN GType application_folder_plugin_context_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void application_plugin_manager_plugin_context_activate (ApplicationPluginManagerPluginContext* self,
                                                         gboolean is_startup,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN void application_plugin_manager_plugin_context_activate_finish (ApplicationPluginManagerPluginContext* self,
                                                                GAsyncResult* _res_,
                                                                GError** error);
static void ____lambda148_ (Block36Data* _data36_,
                     GObject* obj,
                     GAsyncResult* res);
static void application_plugin_manager_on_plugin_activated (ApplicationPluginManager* self,
                                                     ApplicationPluginManagerPluginContext* context,
                                                     GAsyncResult* _result_);
static void _____lambda148__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
VALA_EXTERN void application_plugin_manager_plugin_context_deactivate (ApplicationPluginManagerPluginContext* self,
                                                           gboolean is_shutdown,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_);
VALA_EXTERN void application_plugin_manager_plugin_context_deactivate_finish (ApplicationPluginManagerPluginContext* self,
                                                                  GAsyncResult* _res_,
                                                                  GError** error);
static void ___lambda149_ (Block37Data* _data37_,
                    GObject* obj,
                    GAsyncResult* res);
static void application_plugin_manager_on_plugin_deactivated (ApplicationPluginManager* self,
                                                       ApplicationPluginManagerPluginContext* context,
                                                       GAsyncResult* _result_);
static void ____lambda149__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
VALA_EXTERN PeasPluginInfo* application_plugin_manager_plugin_context_get_info (ApplicationPluginManagerPluginContext* self);
static void _vala_array_add8 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add9 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN void application_notification_plugin_context_destroy (ApplicationNotificationPluginContext* self);
VALA_EXTERN void application_folder_plugin_context_destroy (ApplicationFolderPluginContext* self);
VALA_EXTERN void application_email_plugin_context_destroy (ApplicationEmailPluginContext* self);
VALA_EXTERN GType application_plugin_manager_application_impl_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ApplicationPluginManagerApplicationImpl* application_plugin_manager_plugin_context_get_application (ApplicationPluginManagerPluginContext* self);
VALA_EXTERN void application_plugin_manager_application_impl_engine_composer_registered (ApplicationPluginManagerApplicationImpl* self,
                                                                             ComposerWidget* registered);
VALA_EXTERN void application_plugin_manager_application_impl_engine_composer_deregistered (ApplicationPluginManagerApplicationImpl* self,
                                                                               ComposerWidget* deregistered);
static void application_plugin_manager_plugin_globals_set_folders (ApplicationPluginManagerPluginGlobals* self,
                                                            ApplicationFolderStoreFactory* value);
static void application_plugin_manager_plugin_globals_set_email (ApplicationPluginManagerPluginGlobals* self,
                                                          ApplicationEmailStoreFactory* value);
VALA_EXTERN ApplicationFolderStoreFactory* application_folder_store_factory_new (GeeMap* accounts);
VALA_EXTERN ApplicationFolderStoreFactory* application_folder_store_factory_construct (GType object_type,
                                                                           GeeMap* accounts);
VALA_EXTERN ApplicationEmailStoreFactory* application_email_store_factory_new (GeeMap* accounts);
VALA_EXTERN ApplicationEmailStoreFactory* application_email_store_factory_construct (GType object_type,
                                                                         GeeMap* accounts);
static void application_plugin_manager_plugin_globals_on_window_added (ApplicationPluginManagerPluginGlobals* self,
                                                                GtkWindow* window);
static void _application_plugin_manager_plugin_globals_on_window_added_gtk_application_window_added (GtkApplication* _sender,
                                                                                              GtkWindow* window,
                                                                                              gpointer self);
VALA_EXTERN void application_folder_store_factory_main_window_added (ApplicationFolderStoreFactory* self,
                                                         ApplicationMainWindow* added);
VALA_EXTERN GType application_account_interface_get_type (void) G_GNUC_CONST ;
static void application_plugin_manager_plugin_globals_on_add_account (ApplicationPluginManagerPluginGlobals* self,
                                                               ApplicationAccountContext* added);
static void _application_plugin_manager_plugin_globals_on_add_account_application_account_interface_account_available (ApplicationAccountInterface* _sender,
                                                                                                                ApplicationAccountContext* context,
                                                                                                                gboolean is_startup,
                                                                                                                gpointer self);
static void application_plugin_manager_plugin_globals_on_remove_account (ApplicationPluginManagerPluginGlobals* self,
                                                                  ApplicationAccountContext* removed);
static void _application_plugin_manager_plugin_globals_on_remove_account_application_account_interface_account_unavailable (ApplicationAccountInterface* _sender,
                                                                                                                     ApplicationAccountContext* context,
                                                                                                                     gboolean is_shutdown,
                                                                                                                     gpointer self);
VALA_EXTERN GeeCollection* application_account_interface_get_account_contexts (ApplicationAccountInterface* self);
VALA_EXTERN void application_email_store_factory_destroy (ApplicationEmailStoreFactory* self,
                                              GError** error);
VALA_EXTERN void application_folder_store_factory_destroy (ApplicationFolderStoreFactory* self,
                                               GError** error);
VALA_EXTERN ApplicationPluginManagerAccountImpl* application_plugin_manager_account_impl_new (ApplicationAccountContext* backing);
VALA_EXTERN ApplicationPluginManagerAccountImpl* application_plugin_manager_account_impl_construct (GType object_type,
                                                                                        ApplicationAccountContext* backing);
VALA_EXTERN void application_folder_store_factory_add_account (ApplicationFolderStoreFactory* self,
                                                   ApplicationAccountContext* added);
VALA_EXTERN void application_folder_store_factory_remove_account (ApplicationFolderStoreFactory* self,
                                                      ApplicationAccountContext* removed);
static void application_plugin_manager_plugin_globals_finalize (ApplicationPluginManagerPluginGlobals * obj);
static GType application_plugin_manager_plugin_globals_get_type_once (void);
static void application_plugin_manager_plugin_context_set_info (ApplicationPluginManagerPluginContext* self,
                                                         PeasPluginInfo* value);
static void application_plugin_manager_plugin_context_set_instance (ApplicationPluginManagerPluginContext* self,
                                                             PluginPluginBase* value);
static void application_plugin_manager_plugin_context_set_application (ApplicationPluginManagerPluginContext* self,
                                                                ApplicationPluginManagerApplicationImpl* value);
VALA_EXTERN const gchar* application_plugin_manager_plugin_context_get_action_group_name (ApplicationPluginManagerPluginContext* self);
static void application_plugin_manager_plugin_context_set_action_group_name (ApplicationPluginManagerPluginContext* self,
                                                                      const gchar* value);
VALA_EXTERN ApplicationPluginManagerApplicationImpl* application_plugin_manager_application_impl_new (ApplicationClient* backing,
                                                                                          ApplicationPluginManagerPluginContext* plugin,
                                                                                          ApplicationPluginManagerPluginGlobals* globals);
VALA_EXTERN ApplicationPluginManagerApplicationImpl* application_plugin_manager_application_impl_construct (GType object_type,
                                                                                                ApplicationClient* backing,
                                                                                                ApplicationPluginManagerPluginContext* plugin,
                                                                                                ApplicationPluginManagerPluginGlobals* globals);
static void _vala_GValue_array_free (GValue * array,
                              gssize array_length);
static void application_plugin_manager_plugin_context_activate_data_free (gpointer _data);
static gboolean application_plugin_manager_plugin_context_activate_co (ApplicationPluginManagerPluginContextActivateData* _data_);
static void application_plugin_manager_plugin_context_activate_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static void application_plugin_manager_plugin_context_deactivate_data_free (gpointer _data);
static gboolean application_plugin_manager_plugin_context_deactivate_co (ApplicationPluginManagerPluginContextDeactivateData* _data_);
static void application_plugin_manager_plugin_context_deactivate_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_);
static void application_plugin_manager_plugin_context_finalize (ApplicationPluginManagerPluginContext * obj);
static GType application_plugin_manager_plugin_context_get_type_once (void);
VALA_EXTERN GType application_plugin_manager_composer_impl_get_type (void) G_GNUC_CONST ;
static void application_plugin_manager_application_impl_real_compose_blank_data_free (gpointer _data);
static void application_plugin_manager_application_impl_real_compose_blank (PluginApplication* base,
                                                                     PluginAccount* source,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
static gboolean application_plugin_manager_application_impl_real_compose_blank_co (ApplicationPluginManagerApplicationImplComposeBlankData* _data_);
static ApplicationPluginManagerComposerImpl* application_plugin_manager_application_impl_to_plugin_composer (ApplicationPluginManagerApplicationImpl* self,
                                                                                                      ComposerWidget* widget);
VALA_EXTERN ApplicationController* application_client_get_controller (ApplicationClient* self);
VALA_EXTERN void application_controller_compose_blank (ApplicationController* self,
                                           ApplicationAccountContext* send_context,
                                           GearyRFC822MailboxAddress* to,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN ComposerWidget* application_controller_compose_blank_finish (ApplicationController* self,
                                                             GAsyncResult* _res_);
static void application_plugin_manager_application_impl_compose_blank_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_);
static void application_plugin_manager_application_impl_real_compose_with_context_data_free (gpointer _data);
static void application_plugin_manager_application_impl_real_compose_with_context (PluginApplication* base,
                                                                            PluginAccount* send_from,
                                                                            PluginComposerContextType plugin_type,
                                                                            PluginEmailIdentifier* to_load,
                                                                            const gchar* quote,
                                                                            GAsyncReadyCallback _callback_,
                                                                            gpointer _user_data_);
static gboolean application_plugin_manager_application_impl_real_compose_with_context_co (ApplicationPluginManagerApplicationImplComposeWithContextData* _data_);
VALA_EXTERN GearyEmailIdentifier* application_email_store_factory_to_engine_id (ApplicationEmailStoreFactory* self,
                                                                    PluginEmailIdentifier* plugin);
static void application_plugin_manager_application_impl_compose_with_context_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_);
VALA_EXTERN void application_controller_compose_with_context (ApplicationController* self,
                                                  ApplicationAccountContext* send_context,
                                                  ComposerWidgetContextType type,
                                                  GearyEmail* context,
                                                  const gchar* quote,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN ComposerWidget* application_controller_compose_with_context_finish (ApplicationController* self,
                                                                    GAsyncResult* _res_);
static void application_plugin_manager_application_impl_real_register_action (PluginApplication* base,
                                                                       GAction* action);
static void application_plugin_manager_application_impl_on_window_added (ApplicationPluginManagerApplicationImpl* self,
                                                                  GtkWindow* window);
static void _application_plugin_manager_application_impl_on_window_added_gtk_application_window_added (GtkApplication* _sender,
                                                                                                GtkWindow* window,
                                                                                                gpointer self);
static void application_plugin_manager_application_impl_real_deregister_action (PluginApplication* base,
                                                                         GAction* action);
static void application_plugin_manager_application_impl_real_show_folder (PluginApplication* base,
                                                                   PluginFolder* folder);
static void application_plugin_manager_application_impl_real_empty_folder_data_free (gpointer _data);
static void application_plugin_manager_application_impl_real_empty_folder (PluginApplication* base,
                                                                    PluginFolder* folder,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_);
static gboolean application_plugin_manager_application_impl_real_empty_folder_co (ApplicationPluginManagerApplicationImplEmptyFolderData* _data_);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
VALA_EXTERN gboolean application_main_window_prompt_empty_folder (ApplicationMainWindow* self,
                                                      GearyFolderSpecialUse type);
VALA_EXTERN void application_controller_empty_folder (ApplicationController* self,
                                          GearyFolder* target,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN void application_controller_empty_folder_finish (ApplicationController* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void ___lambda146_ (Block39Data* _data39_,
                    GObject* obj,
                    GAsyncResult* res);
VALA_EXTERN GType composer_application_interface_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void composer_application_interface_report_problem (ComposerApplicationInterface* self,
                                                    GearyProblemReport* report);
static void ____lambda146__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void application_plugin_manager_application_impl_real_report_problem (PluginApplication* base,
                                                                      GearyProblemReport* problem);
VALA_EXTERN ApplicationPluginManagerComposerImpl* application_plugin_manager_composer_impl_new (ComposerWidget* backing,
                                                                                    ApplicationPluginManagerApplicationImpl* application);
VALA_EXTERN ApplicationPluginManagerComposerImpl* application_plugin_manager_composer_impl_construct (GType object_type,
                                                                                          ComposerWidget* backing,
                                                                                          ApplicationPluginManagerApplicationImpl* application);
static void application_plugin_manager_application_impl_finalize (GObject * obj);
static GType application_plugin_manager_application_impl_get_type_once (void);
static void application_plugin_manager_account_impl_set_backing (ApplicationPluginManagerAccountImpl* self,
                                                          ApplicationAccountContext* value);
static void application_plugin_manager_account_impl_finalize (GObject * obj);
static GType application_plugin_manager_account_impl_get_type_once (void);
static void _vala_application_plugin_manager_account_impl_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_application_plugin_manager_account_impl_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
VALA_EXTERN GearyFolder* composer_widget_get_save_to (ComposerWidget* self);
VALA_EXTERN PluginFolder* application_folder_store_factory_to_plugin_folder (ApplicationFolderStoreFactory* self,
                                                                 GearyFolder* engine);
static void application_plugin_manager_composer_impl_real_save_to_folder (PluginComposer* base,
                                                                   PluginFolder* location);
static void application_plugin_manager_composer_impl_real_present (PluginComposer* base);
VALA_EXTERN void application_controller_present_composer (ApplicationController* self,
                                              ComposerWidget* composer);
static void application_plugin_manager_composer_impl_real_insert_text (PluginComposer* base,
                                                                const gchar* plain_text);
static void application_plugin_manager_composer_impl_real_register_action (PluginComposer* base,
                                                                    GAction* action);
static void application_plugin_manager_composer_impl_real_deregister_action (PluginComposer* base,
                                                                      GAction* action);
static void application_plugin_manager_composer_impl_real_append_menu_item (PluginComposer* base,
                                                                     PluginActionable* menu_item);
static void application_plugin_manager_composer_impl_real_set_action_bar (PluginComposer* base,
                                                                   PluginActionBar* plugin_bar);
static GtkWidget* application_plugin_manager_composer_impl_widget_for_item (ApplicationPluginManagerComposerImpl* self,
                                                                     PluginActionBarItem* item);
static void application_plugin_manager_composer_impl_finalize (GObject * obj);
static GType application_plugin_manager_composer_impl_get_type_once (void);
static void _vala_application_plugin_manager_composer_impl_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec);
static void _vala_application_plugin_manager_composer_impl_set_property (GObject * object,
                                                                  guint property_id,
                                                                  const GValue * value,
                                                                  GParamSpec * pspec);
static void application_plugin_manager_finalize (GObject * obj);
static GType application_plugin_manager_get_type_once (void);
static void _vala_application_plugin_manager_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_application_plugin_manager_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
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 const gchar* APPLICATION_PLUGIN_MANAGER_AUTOLOAD_MODULES[4] = {"desktop-notifications", "folder-highlight", "notification-badge", "special-folders"};

static inline gpointer
application_plugin_manager_get_instance_private (ApplicationPluginManager* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManager_private_offset);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_BOXED (GClosure * closure,
                                            GValue * return_value,
                                            guint n_param_values,
                                            const GValue * param_values,
                                            gpointer invocation_hint,
                                            gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_BOXED) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_BOXED callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_BOXED) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_boxed (param_values + 2), data2);
}

ApplicationPluginManagerPluginGlobals*
application_plugin_manager_get_globals (ApplicationPluginManager* self)
{
	ApplicationPluginManagerPluginGlobals* result;
	ApplicationPluginManagerPluginGlobals* _tmp0_;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	_tmp0_ = self->priv->_globals;
	result = _tmp0_;
	return result;
}

static gpointer
_application_plugin_manager_plugin_globals_ref0 (gpointer self)
{
	return self ? application_plugin_manager_plugin_globals_ref (self) : NULL;
}

static void
application_plugin_manager_set_globals (ApplicationPluginManager* self,
                                        ApplicationPluginManagerPluginGlobals* value)
{
	ApplicationPluginManagerPluginGlobals* old_value;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	old_value = application_plugin_manager_get_globals (self);
	if (old_value != value) {
		ApplicationPluginManagerPluginGlobals* _tmp0_;
		_tmp0_ = _application_plugin_manager_plugin_globals_ref0 (value);
		_application_plugin_manager_plugin_globals_unref0 (self->priv->_globals);
		self->priv->_globals = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, application_plugin_manager_properties[APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY]);
	}
}

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

static void
_application_plugin_manager_on_load_plugin_peas_engine_load_plugin (PeasEngine* _sender,
                                                                    PeasPluginInfo* info,
                                                                    gpointer self)
{
	application_plugin_manager_on_load_plugin ((ApplicationPluginManager*) self, info);
}

static void
_application_plugin_manager_on_unload_plugin_peas_engine_unload_plugin (PeasEngine* _sender,
                                                                        PeasPluginInfo* info,
                                                                        gpointer self)
{
	application_plugin_manager_on_unload_plugin ((ApplicationPluginManager*) self, info);
}

static void
_application_plugin_manager_on_composer_registered_application_controller_composer_registered (ApplicationController* _sender,
                                                                                               ComposerWidget* widget,
                                                                                               gpointer self)
{
	application_plugin_manager_on_composer_registered ((ApplicationPluginManager*) self, widget);
}

static void
_application_plugin_manager_on_composer_deregistered_application_controller_composer_deregistered (ApplicationController* _sender,
                                                                                                   ComposerWidget* widget,
                                                                                                   gpointer self)
{
	application_plugin_manager_on_composer_deregistered ((ApplicationPluginManager*) self, widget);
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

ApplicationPluginManager*
application_plugin_manager_construct (GType object_type,
                                      ApplicationClient* application,
                                      ApplicationController* controller,
                                      ApplicationConfiguration* config,
                                      GFile* trusted_plugin_path,
                                      GError** error)
{
	ApplicationPluginManager * self = NULL;
	ApplicationConfiguration* _tmp0_;
	ApplicationPluginManagerPluginGlobals* _tmp1_;
	ApplicationPluginManagerPluginGlobals* _tmp2_;
	PeasEngine* _tmp3_;
	PeasEngine* _tmp4_;
	gchar* _tmp5_;
	PeasEngine* _tmp6_;
	const gchar* _tmp7_;
	PeasEngine* _tmp8_;
	PeasEngine* _tmp9_;
	gchar** optional_names = NULL;
	ApplicationConfiguration* _tmp10_;
	gint _tmp11_ = 0;
	gchar** _tmp12_;
	gint optional_names_length1;
	gint _optional_names_size_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (APPLICATION_IS_CLIENT (application), NULL);
	g_return_val_if_fail (APPLICATION_IS_CONTROLLER (controller), NULL);
	g_return_val_if_fail (APPLICATION_IS_CONFIGURATION (config), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (trusted_plugin_path, g_file_get_type ()), NULL);
	self = (ApplicationPluginManager*) g_object_new (object_type, NULL);
	self->priv->application = application;
	self->priv->controller = controller;
	_tmp0_ = _g_object_ref0 (config);
	_g_object_unref0 (self->priv->config);
	self->priv->config = _tmp0_;
	_tmp1_ = application_plugin_manager_plugin_globals_new (application, controller);
	_tmp2_ = _tmp1_;
	application_plugin_manager_set_globals (self, _tmp2_);
	_application_plugin_manager_plugin_globals_unref0 (_tmp2_);
	_tmp3_ = peas_engine_get_default ();
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->plugin_engine);
	self->priv->plugin_engine = _tmp4_;
	_tmp5_ = g_file_get_path (trusted_plugin_path);
	_g_free0 (self->priv->trusted_path);
	self->priv->trusted_path = _tmp5_;
	_tmp6_ = self->priv->plugin_engine;
	_tmp7_ = self->priv->trusted_path;
	peas_engine_add_search_path (_tmp6_, _tmp7_, NULL);
	_tmp8_ = self->priv->plugin_engine;
	g_signal_connect_object (_tmp8_, "load-plugin", (GCallback) _application_plugin_manager_on_load_plugin_peas_engine_load_plugin, self, G_CONNECT_AFTER);
	_tmp9_ = self->priv->plugin_engine;
	g_signal_connect_object (_tmp9_, "unload-plugin", (GCallback) _application_plugin_manager_on_unload_plugin_peas_engine_unload_plugin, self, 0);
	g_signal_connect_object (controller, "composer-registered", (GCallback) _application_plugin_manager_on_composer_registered_application_controller_composer_registered, self, 0);
	g_signal_connect_object (controller, "composer-deregistered", (GCallback) _application_plugin_manager_on_composer_deregistered_application_controller_composer_deregistered, self, 0);
	_tmp10_ = self->priv->config;
	_tmp12_ = application_configuration_get_optional_plugins (_tmp10_, &_tmp11_);
	optional_names = _tmp12_;
	optional_names_length1 = _tmp11_;
	_optional_names_size_ = optional_names_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp13_ = FALSE;
			_tmp13_ = TRUE;
			while (TRUE) {
				PeasEngine* _tmp15_;
				PeasPluginInfo* info = NULL;
				PeasEngine* _tmp16_;
				GObject* _tmp17_;
				gchar* name = NULL;
				PeasPluginInfo* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				if (!_tmp13_) {
					guint _tmp14_;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp13_ = FALSE;
				_tmp15_ = self->priv->plugin_engine;
				if (!(i < g_list_model_get_n_items (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, g_list_model_get_type (), GListModel)))) {
					break;
				}
				_tmp16_ = self->priv->plugin_engine;
				_tmp17_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, g_list_model_get_type (), GListModel), i);
				info = G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, peas_plugin_info_get_type (), PeasPluginInfo);
				_tmp18_ = info;
				_tmp19_ = peas_plugin_info_get_module_name (_tmp18_);
				_tmp20_ = g_strdup (_tmp19_);
				name = _tmp20_;
				{
					gboolean _tmp21_ = FALSE;
					PeasPluginInfo* _tmp22_;
					_tmp22_ = info;
					_tmp21_ = peas_plugin_info_is_available (_tmp22_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					if (_tmp21_) {
						PeasPluginInfo* _tmp23_;
						_tmp23_ = info;
						if (application_plugin_manager_is_autoload (self, _tmp23_)) {
							const gchar* _tmp24_;
							PeasEngine* _tmp25_;
							PeasPluginInfo* _tmp26_;
							_tmp24_ = name;
							g_debug ("application-plugin-manager.vala:607: Loading autoload plugin: %s", _tmp24_);
							_tmp25_ = self->priv->plugin_engine;
							_tmp26_ = info;
							peas_engine_load_plugin (_tmp25_, _tmp26_);
						} else {
							const gchar* _tmp27_;
							gchar** _tmp28_;
							gint _tmp28__length1;
							_tmp27_ = name;
							_tmp28_ = optional_names;
							_tmp28__length1 = optional_names_length1;
							if (_vala_string_array_contains (_tmp28_, _tmp28__length1, _tmp27_)) {
								const gchar* _tmp29_;
								PeasEngine* _tmp30_;
								PeasPluginInfo* _tmp31_;
								_tmp29_ = name;
								g_debug ("application-plugin-manager.vala:610: Loading optional plugin: %s", _tmp29_);
								_tmp30_ = self->priv->plugin_engine;
								_tmp31_ = info;
								peas_engine_load_plugin (_tmp30_, _tmp31_);
							}
						}
					}
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* err = NULL;
					const gchar* _tmp32_;
					GError* _tmp33_;
					const gchar* _tmp34_;
					err = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp32_ = name;
					_tmp33_ = err;
					_tmp34_ = _tmp33_->message;
					g_warning ("application-plugin-manager.vala:615: Plugin %s not available: %s", _tmp32_, _tmp34_);
					_g_error_free0 (err);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_free0 (name);
					_g_object_unref0 (info);
					optional_names = (_vala_array_free (optional_names, optional_names_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (self);
					return NULL;
				}
				_g_free0 (name);
				_g_object_unref0 (info);
			}
		}
	}
	self->priv->is_startup = FALSE;
	optional_names = (_vala_array_free (optional_names, optional_names_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

ApplicationPluginManager*
application_plugin_manager_new (ApplicationClient* application,
                                ApplicationController* controller,
                                ApplicationConfiguration* config,
                                GFile* trusted_plugin_path,
                                GError** error)
{
	return application_plugin_manager_construct (APPLICATION_TYPE_PLUGIN_MANAGER, application, controller, config, trusted_plugin_path, error);
}

/** Returns the client account context for the given plugin account, if any. */
ApplicationAccountContext*
application_plugin_manager_to_client_account (ApplicationPluginManager* self,
                                              PluginAccount* plugin)
{
	ApplicationPluginManagerAccountImpl* impl = NULL;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	ApplicationAccountContext* _tmp1_ = NULL;
	ApplicationPluginManagerAccountImpl* _tmp2_;
	ApplicationAccountContext* _tmp6_;
	ApplicationAccountContext* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_ACCOUNT (plugin), NULL);
	_tmp0_ = _g_object_ref0 (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (plugin) ? ((ApplicationPluginManagerAccountImpl*) plugin) : NULL);
	impl = _tmp0_;
	_tmp2_ = impl;
	if (_tmp2_ != NULL) {
		ApplicationPluginManagerAccountImpl* _tmp3_;
		ApplicationAccountContext* _tmp4_;
		ApplicationAccountContext* _tmp5_;
		_tmp3_ = impl;
		_tmp4_ = application_plugin_manager_account_impl_get_backing (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_;
	} else {
		_tmp1_ = NULL;
	}
	_tmp6_ = _g_object_ref0 (_tmp1_);
	result = _tmp6_;
	_g_object_unref0 (impl);
	return result;
}

/** Returns the engine account for the given plugin account, if any. */
GearyAccount*
application_plugin_manager_to_engine_account (ApplicationPluginManager* self,
                                              PluginAccount* plugin)
{
	ApplicationPluginManagerAccountImpl* impl = NULL;
	ApplicationPluginManagerAccountImpl* _tmp0_;
	GearyAccount* _tmp1_ = NULL;
	ApplicationPluginManagerAccountImpl* _tmp2_;
	GearyAccount* _tmp8_;
	GearyAccount* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_ACCOUNT (plugin), NULL);
	_tmp0_ = _g_object_ref0 (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (plugin) ? ((ApplicationPluginManagerAccountImpl*) plugin) : NULL);
	impl = _tmp0_;
	_tmp2_ = impl;
	if (_tmp2_ != NULL) {
		ApplicationPluginManagerAccountImpl* _tmp3_;
		ApplicationAccountContext* _tmp4_;
		ApplicationAccountContext* _tmp5_;
		GearyAccount* _tmp6_;
		GearyAccount* _tmp7_;
		_tmp3_ = impl;
		_tmp4_ = application_plugin_manager_account_impl_get_backing (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = application_account_context_get_account (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = _tmp7_;
	} else {
		_tmp1_ = NULL;
	}
	_tmp8_ = _g_object_ref0 (_tmp1_);
	result = _tmp8_;
	_g_object_unref0 (impl);
	return result;
}

/** Returns the engine folder for the given plugin folder, if any. */
GearyFolder*
application_plugin_manager_to_engine_folder (ApplicationPluginManager* self,
                                             PluginFolder* plugin)
{
	ApplicationPluginManagerPluginGlobals* _tmp0_;
	ApplicationFolderStoreFactory* _tmp1_;
	ApplicationFolderStoreFactory* _tmp2_;
	GearyFolder* _tmp3_;
	GearyFolder* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_FOLDER (plugin), NULL);
	_tmp0_ = self->priv->_globals;
	_tmp1_ = application_plugin_manager_plugin_globals_get_folders (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = application_folder_store_factory_to_engine_folder (_tmp2_, plugin);
	result = _tmp3_;
	return result;
}

/** Returns the engine email for the given plugin email, if any. */
GearyEmail*
application_plugin_manager_to_engine_email (ApplicationPluginManager* self,
                                            PluginEmail* plugin)
{
	ApplicationPluginManagerPluginGlobals* _tmp0_;
	ApplicationEmailStoreFactory* _tmp1_;
	ApplicationEmailStoreFactory* _tmp2_;
	GearyEmail* _tmp3_;
	GearyEmail* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	g_return_val_if_fail (PLUGIN_IS_EMAIL (plugin), NULL);
	_tmp0_ = self->priv->_globals;
	_tmp1_ = application_plugin_manager_plugin_globals_get_email (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = application_email_store_factory_to_engine_email (_tmp2_, plugin);
	result = _tmp3_;
	return result;
}

GeeCollection*
application_plugin_manager_get_optional_plugins (ApplicationPluginManager* self)
{
	GeeLinkedList* plugins = NULL;
	GeeLinkedList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeCollection* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	_tmp0_ = gee_linked_list_new (peas_plugin_info_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	plugins = _tmp0_;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				PeasEngine* _tmp3_;
				PeasPluginInfo* plugin = NULL;
				PeasEngine* _tmp4_;
				GObject* _tmp5_;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->plugin_engine;
				if (!(i < g_list_model_get_n_items (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, g_list_model_get_type (), GListModel)))) {
					break;
				}
				_tmp4_ = self->priv->plugin_engine;
				_tmp5_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, g_list_model_get_type (), GListModel), i);
				plugin = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, peas_plugin_info_get_type (), PeasPluginInfo);
				{
					PeasPluginInfo* _tmp6_;
					PeasPluginInfo* _tmp7_;
					_tmp6_ = plugin;
					peas_plugin_info_is_available (_tmp6_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_tmp7_ = plugin;
					if (!application_plugin_manager_is_autoload (self, _tmp7_)) {
						GeeLinkedList* _tmp8_;
						PeasPluginInfo* _tmp9_;
						_tmp8_ = plugins;
						_tmp9_ = plugin;
						gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp9_);
					}
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* err = NULL;
					PeasPluginInfo* _tmp10_;
					const gchar* _tmp11_;
					GError* _tmp12_;
					const gchar* _tmp13_;
					err = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp10_ = plugin;
					_tmp11_ = peas_plugin_info_get_module_name (_tmp10_);
					_tmp12_ = err;
					_tmp13_ = _tmp12_->message;
					g_warning ("application-plugin-manager.vala:655: Plugin %s not available: %s", _tmp11_, _tmp13_);
					_g_error_free0 (err);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_object_unref0 (plugin);
					_g_object_unref0 (plugins);
					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;
				}
				_g_object_unref0 (plugin);
			}
		}
	}
	result = G_TYPE_CHECK_INSTANCE_CAST (plugins, GEE_TYPE_COLLECTION, GeeCollection);
	return result;
}

gboolean
application_plugin_manager_load_optional (ApplicationPluginManager* self,
                                          PeasPluginInfo* plugin,
                                          GError** error)
{
	gboolean loaded = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (plugin, peas_plugin_info_get_type ()), FALSE);
	loaded = FALSE;
	_tmp2_ = peas_plugin_info_is_available (plugin, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp3_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		return _tmp3_;
	}
	if (_tmp2_) {
		_tmp1_ = !peas_plugin_info_is_loaded (plugin);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = !application_plugin_manager_is_autoload (self, plugin);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		PeasEngine* _tmp4_;
		_tmp4_ = self->priv->plugin_engine;
		peas_engine_load_plugin (_tmp4_, plugin);
		loaded = TRUE;
	}
	result = loaded;
	return result;
}

gboolean
application_plugin_manager_unload_optional (ApplicationPluginManager* self,
                                            PeasPluginInfo* plugin,
                                            GError** error)
{
	gboolean unloaded = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (plugin, peas_plugin_info_get_type ()), FALSE);
	unloaded = FALSE;
	_tmp2_ = peas_plugin_info_is_available (plugin, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp3_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		return _tmp3_;
	}
	if (_tmp2_) {
		_tmp1_ = peas_plugin_info_is_loaded (plugin);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = !application_plugin_manager_is_autoload (self, plugin);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		PeasEngine* _tmp4_;
		_tmp4_ = self->priv->plugin_engine;
		peas_engine_unload_plugin (_tmp4_, plugin);
		unloaded = TRUE;
	}
	result = unloaded;
	return result;
}

void
application_plugin_manager_close (ApplicationPluginManager* self,
                                  GError** error)
{
	PeasEngine* _tmp0_;
	PeasEngine* _tmp1_;
	ApplicationPluginManagerPluginGlobals* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	self->priv->is_shutdown = TRUE;
	_tmp0_ = self->priv->plugin_engine;
	peas_engine_set_loaded_plugins (_tmp0_, NULL);
	_tmp1_ = self->priv->plugin_engine;
	peas_engine_garbage_collect (_tmp1_);
	_tmp2_ = self->priv->_globals;
	application_plugin_manager_plugin_globals_destroy (_tmp2_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

inline gboolean
application_plugin_manager_is_autoload (ApplicationPluginManager* self,
                                        PeasPluginInfo* info)
{
	const gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (info, peas_plugin_info_get_type ()), FALSE);
	_tmp0_ = peas_plugin_info_get_module_name (info);
	result = _vala_string_array_contains (APPLICATION_PLUGIN_MANAGER_AUTOLOAD_MODULES, G_N_ELEMENTS (APPLICATION_PLUGIN_MANAGER_AUTOLOAD_MODULES), _tmp0_);
	return result;
}

GeeCollection*
application_plugin_manager_get_notification_contexts (ApplicationPluginManager* self)
{
	GeeMap* _tmp0_;
	GeeCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	GeeCollection* _tmp5_;
	GeeCollection* _tmp6_;
	GeeCollection* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	_tmp0_ = self->priv->notification_contexts;
	_tmp1_ = gee_map_get_values (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_collection_get_read_only_view (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp3_);
	result = _tmp6_;
	return result;
}

GeeCollection*
application_plugin_manager_get_email_contexts (ApplicationPluginManager* self)
{
	GeeMap* _tmp0_;
	GeeCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	GeeCollection* _tmp5_;
	GeeCollection* _tmp6_;
	GeeCollection* result;
	g_return_val_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self), NULL);
	_tmp0_ = self->priv->email_contexts;
	_tmp1_ = gee_map_get_values (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_collection_get_read_only_view (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp3_);
	result = _tmp6_;
	return result;
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		ApplicationPluginManager* self;
		self = _data36_->self;
		_application_plugin_manager_plugin_context_unref0 (_data36_->context);
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}

static void
____lambda148_ (Block36Data* _data36_,
                GObject* obj,
                GAsyncResult* res)
{
	ApplicationPluginManager* self;
	ApplicationPluginManagerPluginContext* _tmp0_;
	self = _data36_->self;
	g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
	_tmp0_ = _data36_->context;
	application_plugin_manager_on_plugin_activated (self, _tmp0_, res);
}

static void
_____lambda148__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	____lambda148_ (self, source_object, res);
	block36_data_unref (self);
}

static void
application_plugin_manager_on_load_plugin (ApplicationPluginManager* self,
                                           PeasPluginInfo* info)
{
	Block36Data* _data36_;
	ApplicationPluginManagerPluginContext* _tmp8_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (info, peas_plugin_info_get_type ()));
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_data36_->context = NULL;
	{
		ApplicationPluginManagerPluginContext* _tmp0_ = NULL;
		PeasEngine* _tmp1_;
		ApplicationClient* _tmp2_;
		ApplicationPluginManagerPluginGlobals* _tmp3_;
		ApplicationPluginManagerPluginContext* _tmp4_;
		ApplicationPluginManagerPluginContext* _tmp5_;
		_tmp1_ = self->priv->plugin_engine;
		_tmp2_ = self->priv->application;
		_tmp3_ = self->priv->_globals;
		_tmp4_ = application_plugin_manager_plugin_context_new (_tmp1_, info, _tmp2_, _tmp3_, &_inner_error0_);
		_tmp0_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp5_ = _tmp0_;
		_tmp0_ = NULL;
		_application_plugin_manager_plugin_context_unref0 (_data36_->context);
		_data36_->context = _tmp5_;
		_application_plugin_manager_plugin_context_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = err;
		_tmp7_ = _tmp6_->message;
		g_debug ("application-plugin-manager.vala:715: Failed to create new plugin insta" \
"nce: %s", _tmp7_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block36_data_unref (_data36_);
		_data36_ = NULL;
		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;
	}
	_tmp8_ = _data36_->context;
	if (_tmp8_ != NULL) {
		gboolean do_activate = FALSE;
		PluginTrustedExtension* trusted = NULL;
		ApplicationPluginManagerPluginContext* _tmp9_;
		PluginPluginBase* _tmp10_;
		PluginPluginBase* _tmp11_;
		PluginTrustedExtension* _tmp12_;
		PluginTrustedExtension* _tmp13_;
		PluginNotificationExtension* notification = NULL;
		ApplicationPluginManagerPluginContext* _tmp20_;
		PluginPluginBase* _tmp21_;
		PluginPluginBase* _tmp22_;
		PluginNotificationExtension* _tmp23_;
		PluginNotificationExtension* _tmp24_;
		PluginEmailExtension* email = NULL;
		ApplicationPluginManagerPluginContext* _tmp33_;
		PluginPluginBase* _tmp34_;
		PluginPluginBase* _tmp35_;
		PluginEmailExtension* _tmp36_;
		PluginEmailExtension* _tmp37_;
		PluginFolderExtension* folder = NULL;
		ApplicationPluginManagerPluginContext* _tmp46_;
		PluginPluginBase* _tmp47_;
		PluginPluginBase* _tmp48_;
		PluginFolderExtension* _tmp49_;
		PluginFolderExtension* _tmp50_;
		do_activate = TRUE;
		_tmp9_ = _data36_->context;
		_tmp10_ = application_plugin_manager_plugin_context_get_instance (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _g_object_ref0 (PLUGIN_IS_TRUSTED_EXTENSION (_tmp11_) ? ((PluginTrustedExtension*) _tmp11_) : NULL);
		trusted = _tmp12_;
		_tmp13_ = trusted;
		if (_tmp13_ != NULL) {
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			_tmp14_ = peas_plugin_info_get_module_dir (info);
			_tmp15_ = self->priv->trusted_path;
			if (g_str_has_prefix (_tmp14_, _tmp15_)) {
				PluginTrustedExtension* _tmp16_;
				ApplicationClient* _tmp17_;
				PluginTrustedExtension* _tmp18_;
				_tmp16_ = trusted;
				_tmp17_ = self->priv->application;
				plugin_trusted_extension_set_client_application (_tmp16_, _tmp17_);
				_tmp18_ = trusted;
				plugin_trusted_extension_set_client_plugins (_tmp18_, self);
			} else {
				PeasEngine* _tmp19_;
				do_activate = FALSE;
				_tmp19_ = self->priv->plugin_engine;
				peas_engine_unload_plugin (_tmp19_, info);
			}
		}
		_tmp20_ = _data36_->context;
		_tmp21_ = application_plugin_manager_plugin_context_get_instance (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = _g_object_ref0 (PLUGIN_IS_NOTIFICATION_EXTENSION (_tmp22_) ? ((PluginNotificationExtension*) _tmp22_) : NULL);
		notification = _tmp23_;
		_tmp24_ = notification;
		if (_tmp24_ != NULL) {
			ApplicationNotificationPluginContext* notification_context = NULL;
			ApplicationClient* _tmp25_;
			ApplicationPluginManagerPluginGlobals* _tmp26_;
			ApplicationPluginManagerPluginContext* _tmp27_;
			ApplicationNotificationPluginContext* _tmp28_;
			GeeMap* _tmp29_;
			ApplicationNotificationPluginContext* _tmp30_;
			PluginNotificationExtension* _tmp31_;
			ApplicationNotificationPluginContext* _tmp32_;
			_tmp25_ = self->priv->application;
			_tmp26_ = self->priv->_globals;
			_tmp27_ = _data36_->context;
			_tmp28_ = application_notification_plugin_context_new (_tmp25_, _tmp26_, _tmp27_);
			notification_context = _tmp28_;
			_tmp29_ = self->priv->notification_contexts;
			_tmp30_ = notification_context;
			gee_map_set (_tmp29_, info, _tmp30_);
			_tmp31_ = notification;
			_tmp32_ = notification_context;
			plugin_notification_extension_set_notifications (_tmp31_, G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, PLUGIN_TYPE_NOTIFICATION_CONTEXT, PluginNotificationContext));
			_g_object_unref0 (notification_context);
		}
		_tmp33_ = _data36_->context;
		_tmp34_ = application_plugin_manager_plugin_context_get_instance (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = _g_object_ref0 (PLUGIN_IS_EMAIL_EXTENSION (_tmp35_) ? ((PluginEmailExtension*) _tmp35_) : NULL);
		email = _tmp36_;
		_tmp37_ = email;
		if (_tmp37_ != NULL) {
			ApplicationEmailPluginContext* email_context = NULL;
			ApplicationClient* _tmp38_;
			ApplicationPluginManagerPluginGlobals* _tmp39_;
			ApplicationPluginManagerPluginContext* _tmp40_;
			ApplicationEmailPluginContext* _tmp41_;
			GeeMap* _tmp42_;
			ApplicationEmailPluginContext* _tmp43_;
			PluginEmailExtension* _tmp44_;
			ApplicationEmailPluginContext* _tmp45_;
			_tmp38_ = self->priv->application;
			_tmp39_ = self->priv->_globals;
			_tmp40_ = _data36_->context;
			_tmp41_ = application_email_plugin_context_new (_tmp38_, _tmp39_, _tmp40_);
			email_context = _tmp41_;
			_tmp42_ = self->priv->email_contexts;
			_tmp43_ = email_context;
			gee_map_set (_tmp42_, info, _tmp43_);
			_tmp44_ = email;
			_tmp45_ = email_context;
			plugin_email_extension_set_email (_tmp44_, G_TYPE_CHECK_INSTANCE_CAST (_tmp45_, PLUGIN_TYPE_EMAIL_CONTEXT, PluginEmailContext));
			_g_object_unref0 (email_context);
		}
		_tmp46_ = _data36_->context;
		_tmp47_ = application_plugin_manager_plugin_context_get_instance (_tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = _g_object_ref0 (PLUGIN_IS_FOLDER_EXTENSION (_tmp48_) ? ((PluginFolderExtension*) _tmp48_) : NULL);
		folder = _tmp49_;
		_tmp50_ = folder;
		if (_tmp50_ != NULL) {
			PluginFolderExtension* _tmp51_;
			ApplicationController* _tmp52_;
			ApplicationClient* _tmp53_;
			ApplicationClient* _tmp54_;
			ApplicationPluginManagerPluginGlobals* _tmp55_;
			ApplicationPluginManagerPluginContext* _tmp56_;
			ApplicationFolderPluginContext* _tmp57_;
			ApplicationFolderPluginContext* _tmp58_;
			_tmp51_ = folder;
			_tmp52_ = self->priv->controller;
			_tmp53_ = application_controller_get_application (_tmp52_);
			_tmp54_ = _tmp53_;
			_tmp55_ = self->priv->_globals;
			_tmp56_ = _data36_->context;
			_tmp57_ = application_folder_plugin_context_new (_tmp54_, _tmp55_, _tmp56_);
			_tmp58_ = _tmp57_;
			plugin_folder_extension_set_folders (_tmp51_, G_TYPE_CHECK_INSTANCE_CAST (_tmp58_, PLUGIN_TYPE_FOLDER_CONTEXT, PluginFolderContext));
			_g_object_unref0 (_tmp58_);
		}
		if (do_activate) {
			ApplicationPluginManagerPluginContext* _tmp59_;
			_tmp59_ = _data36_->context;
			application_plugin_manager_plugin_context_activate (_tmp59_, self->priv->is_startup, _____lambda148__gasync_ready_callback, block36_data_ref (_data36_));
		}
		_g_object_unref0 (folder);
		_g_object_unref0 (email);
		_g_object_unref0 (notification);
		_g_object_unref0 (trusted);
	}
	block36_data_unref (_data36_);
	_data36_ = NULL;
}

static Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		ApplicationPluginManager* self;
		self = _data37_->self;
		_application_plugin_manager_plugin_context_unref0 (_data37_->plugin_context);
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

static void
___lambda149_ (Block37Data* _data37_,
               GObject* obj,
               GAsyncResult* res)
{
	ApplicationPluginManager* self;
	ApplicationPluginManagerPluginContext* _tmp0_;
	self = _data37_->self;
	g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
	_tmp0_ = _data37_->plugin_context;
	application_plugin_manager_on_plugin_deactivated (self, _tmp0_, res);
}

static void
____lambda149__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda149_ (self, source_object, res);
	block37_data_unref (self);
}

static void
application_plugin_manager_on_unload_plugin (ApplicationPluginManager* self,
                                             PeasPluginInfo* info)
{
	Block37Data* _data37_;
	GeeMap* _tmp0_;
	gpointer _tmp1_;
	ApplicationPluginManagerPluginContext* _tmp2_;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (info, peas_plugin_info_get_type ()));
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	_data37_->self = g_object_ref (self);
	_tmp0_ = self->priv->plugin_set;
	_tmp1_ = gee_map_get (_tmp0_, info);
	_data37_->plugin_context = (ApplicationPluginManagerPluginContext*) _tmp1_;
	_tmp2_ = _data37_->plugin_context;
	if (_tmp2_ != NULL) {
		ApplicationPluginManagerPluginContext* _tmp3_;
		_tmp3_ = _data37_->plugin_context;
		application_plugin_manager_plugin_context_deactivate (_tmp3_, self->priv->is_shutdown, ____lambda149__gasync_ready_callback, block37_data_ref (_data37_));
	}
	block37_data_unref (_data37_);
	_data37_ = NULL;
}

static void
_vala_array_add8 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
application_plugin_manager_on_plugin_activated (ApplicationPluginManager* self,
                                                ApplicationPluginManagerPluginContext* context,
                                                GAsyncResult* _result_)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (context));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (_result_, g_async_result_get_type ()));
	{
		GeeMap* _tmp0_;
		PeasPluginInfo* _tmp1_;
		PeasPluginInfo* _tmp2_;
		PeasPluginInfo* _tmp3_;
		PeasPluginInfo* _tmp4_;
		PeasPluginInfo* _tmp5_;
		PeasPluginInfo* _tmp6_;
		application_plugin_manager_plugin_context_activate_finish (context, _result_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp0_ = self->priv->plugin_set;
		_tmp1_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp2_ = _tmp1_;
		gee_map_set (_tmp0_, _tmp2_, context);
		_tmp3_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp4_ = _tmp3_;
		g_signal_emit (self, application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_ACTIVATED_SIGNAL], 0, _tmp4_);
		_tmp5_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp6_ = _tmp5_;
		if (!application_plugin_manager_is_autoload (self, _tmp6_)) {
			gchar* name = NULL;
			PeasPluginInfo* _tmp7_;
			PeasPluginInfo* _tmp8_;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			gchar** optional = NULL;
			ApplicationConfiguration* _tmp11_;
			gint _tmp12_ = 0;
			gchar** _tmp13_;
			gint optional_length1;
			gint _optional_size_;
			const gchar* _tmp14_;
			gchar** _tmp15_;
			gint _tmp15__length1;
			_tmp7_ = application_plugin_manager_plugin_context_get_info (context);
			_tmp8_ = _tmp7_;
			_tmp9_ = peas_plugin_info_get_module_name (_tmp8_);
			_tmp10_ = g_strdup (_tmp9_);
			name = _tmp10_;
			_tmp11_ = self->priv->config;
			_tmp13_ = application_configuration_get_optional_plugins (_tmp11_, &_tmp12_);
			optional = _tmp13_;
			optional_length1 = _tmp12_;
			_optional_size_ = optional_length1;
			_tmp14_ = name;
			_tmp15_ = optional;
			_tmp15__length1 = optional_length1;
			if (!_vala_string_array_contains (_tmp15_, _tmp15__length1, _tmp14_)) {
				const gchar* _tmp16_;
				gchar* _tmp17_;
				ApplicationConfiguration* _tmp18_;
				gchar** _tmp19_;
				gint _tmp19__length1;
				_tmp16_ = name;
				_tmp17_ = g_strdup (_tmp16_);
				_vala_array_add8 (&optional, &optional_length1, &_optional_size_, _tmp17_);
				_tmp18_ = self->priv->config;
				_tmp19_ = optional;
				_tmp19__length1 = optional_length1;
				application_configuration_set_optional_plugins (_tmp18_, _tmp19_, (gint) _tmp19__length1);
			}
			optional = (_vala_array_free (optional, optional_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (name);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		PeasPluginInfo* _tmp20_;
		PeasPluginInfo* _tmp21_;
		GError* _tmp22_;
		PeasPluginInfo* _tmp23_;
		PeasPluginInfo* _tmp24_;
		const gchar* _tmp25_;
		GError* _tmp26_;
		const gchar* _tmp27_;
		PeasEngine* _tmp28_;
		PeasPluginInfo* _tmp29_;
		PeasPluginInfo* _tmp30_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp20_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp21_ = _tmp20_;
		_tmp22_ = err;
		g_signal_emit (self, application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_ERROR_SIGNAL], 0, _tmp21_, _tmp22_);
		_tmp23_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp24_ = _tmp23_;
		_tmp25_ = peas_plugin_info_get_module_name (_tmp24_);
		_tmp26_ = err;
		_tmp27_ = _tmp26_->message;
		g_warning ("application-plugin-manager.vala:801: Activating plugin %s threw error," \
" unloading: %s", _tmp25_, _tmp27_);
		_tmp28_ = self->priv->plugin_engine;
		_tmp29_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp30_ = _tmp29_;
		peas_engine_unload_plugin (_tmp28_, _tmp30_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
_vala_array_add9 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static void
application_plugin_manager_on_plugin_deactivated (ApplicationPluginManager* self,
                                                  ApplicationPluginManagerPluginContext* context,
                                                  GAsyncResult* _result_)
{
	gboolean _tmp0_ = FALSE;
	PeasPluginInfo* _tmp1_;
	PeasPluginInfo* _tmp2_;
	GError* _error_ = NULL;
	PluginNotificationExtension* notification = NULL;
	PluginPluginBase* _tmp29_;
	PluginPluginBase* _tmp30_;
	PluginNotificationExtension* _tmp31_;
	PluginNotificationExtension* _tmp32_;
	PluginFolderExtension* folder = NULL;
	PluginPluginBase* _tmp42_;
	PluginPluginBase* _tmp43_;
	PluginFolderExtension* _tmp44_;
	PluginFolderExtension* _tmp45_;
	PluginEmailExtension* email = NULL;
	PluginPluginBase* _tmp52_;
	PluginPluginBase* _tmp53_;
	PluginEmailExtension* _tmp54_;
	PluginEmailExtension* _tmp55_;
	PeasPluginInfo* _tmp65_;
	PeasPluginInfo* _tmp66_;
	GError* _tmp67_;
	GeeMap* _tmp68_;
	PeasPluginInfo* _tmp69_;
	PeasPluginInfo* _tmp70_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (context));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (_result_, g_async_result_get_type ()));
	_tmp1_ = application_plugin_manager_plugin_context_get_info (context);
	_tmp2_ = _tmp1_;
	if (!application_plugin_manager_is_autoload (self, _tmp2_)) {
		_tmp0_ = !self->priv->is_shutdown;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* name = NULL;
		PeasPluginInfo* _tmp3_;
		PeasPluginInfo* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar** old_names = NULL;
		ApplicationConfiguration* _tmp7_;
		gint _tmp8_ = 0;
		gchar** _tmp9_;
		gint old_names_length1;
		gint _old_names_size_;
		gchar** new_names = NULL;
		gchar** _tmp10_;
		gint new_names_length1;
		gint _new_names_size_;
		ApplicationConfiguration* _tmp20_;
		gchar** _tmp21_;
		gint _tmp21__length1;
		_tmp3_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp4_ = _tmp3_;
		_tmp5_ = peas_plugin_info_get_module_name (_tmp4_);
		_tmp6_ = g_strdup (_tmp5_);
		name = _tmp6_;
		_tmp7_ = self->priv->config;
		_tmp9_ = application_configuration_get_optional_plugins (_tmp7_, &_tmp8_);
		old_names = _tmp9_;
		old_names_length1 = _tmp8_;
		_old_names_size_ = old_names_length1;
		_tmp10_ = g_new0 (gchar*, 0 + 1);
		new_names = _tmp10_;
		new_names_length1 = 0;
		_new_names_size_ = new_names_length1;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					gchar** _tmp13_;
					gint _tmp13__length1;
					gchar** _tmp14_;
					gint _tmp14__length1;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = old_names;
					_tmp13__length1 = old_names_length1;
					if (!(i < _tmp13__length1)) {
						break;
					}
					_tmp14_ = old_names;
					_tmp14__length1 = old_names_length1;
					_tmp15_ = _tmp14_[i];
					_tmp16_ = name;
					if (g_strcmp0 (_tmp15_, _tmp16_) != 0) {
						gchar** _tmp17_;
						gint _tmp17__length1;
						const gchar* _tmp18_;
						gchar* _tmp19_;
						_tmp17_ = old_names;
						_tmp17__length1 = old_names_length1;
						_tmp18_ = _tmp17_[i];
						_tmp19_ = g_strdup (_tmp18_);
						_vala_array_add9 (&new_names, &new_names_length1, &_new_names_size_, _tmp19_);
					}
				}
			}
		}
		_tmp20_ = self->priv->config;
		_tmp21_ = new_names;
		_tmp21__length1 = new_names_length1;
		application_configuration_set_optional_plugins (_tmp20_, _tmp21_, (gint) _tmp21__length1);
		new_names = (_vala_array_free (new_names, new_names_length1, (GDestroyNotify) g_free), NULL);
		old_names = (_vala_array_free (old_names, old_names_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (name);
	}
	_error_ = NULL;
	{
		application_plugin_manager_plugin_context_deactivate_finish (context, _result_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		PeasPluginInfo* _tmp22_;
		PeasPluginInfo* _tmp23_;
		const gchar* _tmp24_;
		GError* _tmp25_;
		const gchar* _tmp26_;
		GError* _tmp27_;
		GError* _tmp28_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp22_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp23_ = _tmp22_;
		_tmp24_ = peas_plugin_info_get_module_name (_tmp23_);
		_tmp25_ = err;
		_tmp26_ = _tmp25_->message;
		g_warning ("application-plugin-manager.vala:830: Deactivating plugin %s threw erro" \
"r: %s", _tmp24_, _tmp26_);
		_tmp27_ = err;
		_tmp28_ = _g_error_copy0 (_tmp27_);
		_g_error_free0 (_error_);
		_error_ = _tmp28_;
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_error_free0 (_error_);
		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;
	}
	_tmp29_ = application_plugin_manager_plugin_context_get_instance (context);
	_tmp30_ = _tmp29_;
	_tmp31_ = _g_object_ref0 (PLUGIN_IS_NOTIFICATION_EXTENSION (_tmp30_) ? ((PluginNotificationExtension*) _tmp30_) : NULL);
	notification = _tmp31_;
	_tmp32_ = notification;
	if (_tmp32_ != NULL) {
		ApplicationNotificationPluginContext* notifications = NULL;
		GeeMap* _tmp33_;
		PeasPluginInfo* _tmp34_;
		PeasPluginInfo* _tmp35_;
		gpointer _tmp36_;
		ApplicationNotificationPluginContext* _tmp37_;
		_tmp33_ = self->priv->notification_contexts;
		_tmp34_ = application_plugin_manager_plugin_context_get_info (context);
		_tmp35_ = _tmp34_;
		_tmp36_ = gee_map_get (_tmp33_, _tmp35_);
		notifications = (ApplicationNotificationPluginContext*) _tmp36_;
		_tmp37_ = notifications;
		if (_tmp37_ != NULL) {
			GeeMap* _tmp38_;
			PeasPluginInfo* _tmp39_;
			PeasPluginInfo* _tmp40_;
			ApplicationNotificationPluginContext* _tmp41_;
			_tmp38_ = self->priv->notification_contexts;
			_tmp39_ = application_plugin_manager_plugin_context_get_info (context);
			_tmp40_ = _tmp39_;
			gee_map_unset (_tmp38_, _tmp40_, NULL);
			_tmp41_ = notifications;
			application_notification_plugin_context_destroy (_tmp41_);
		}
		_g_object_unref0 (notifications);
	}
	_tmp42_ = application_plugin_manager_plugin_context_get_instance (context);
	_tmp43_ = _tmp42_;
	_tmp44_ = _g_object_ref0 (PLUGIN_IS_FOLDER_EXTENSION (_tmp43_) ? ((PluginFolderExtension*) _tmp43_) : NULL);
	folder = _tmp44_;
	_tmp45_ = folder;
	if (_tmp45_ != NULL) {
		ApplicationFolderPluginContext* folder_context = NULL;
		PluginFolderExtension* _tmp46_;
		PluginFolderContext* _tmp47_;
		PluginFolderContext* _tmp48_;
		ApplicationFolderPluginContext* _tmp49_;
		ApplicationFolderPluginContext* _tmp50_;
		_tmp46_ = folder;
		_tmp47_ = plugin_folder_extension_get_folders (_tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = _g_object_ref0 (APPLICATION_IS_FOLDER_PLUGIN_CONTEXT (_tmp48_) ? ((ApplicationFolderPluginContext*) _tmp48_) : NULL);
		folder_context = _tmp49_;
		_tmp50_ = folder_context;
		if (_tmp50_ != NULL) {
			ApplicationFolderPluginContext* _tmp51_;
			_tmp51_ = folder_context;
			application_folder_plugin_context_destroy (_tmp51_);
		}
		_g_object_unref0 (folder_context);
	}
	_tmp52_ = application_plugin_manager_plugin_context_get_instance (context);
	_tmp53_ = _tmp52_;
	_tmp54_ = _g_object_ref0 (PLUGIN_IS_EMAIL_EXTENSION (_tmp53_) ? ((PluginEmailExtension*) _tmp53_) : NULL);
	email = _tmp54_;
	_tmp55_ = email;
	if (_tmp55_ != NULL) {
		ApplicationEmailPluginContext* email_context = NULL;
		PluginEmailExtension* _tmp56_;
		PluginEmailContext* _tmp57_;
		PluginEmailContext* _tmp58_;
		ApplicationEmailPluginContext* _tmp59_;
		ApplicationEmailPluginContext* _tmp60_;
		_tmp56_ = email;
		_tmp57_ = plugin_email_extension_get_email (_tmp56_);
		_tmp58_ = _tmp57_;
		_tmp59_ = _g_object_ref0 (APPLICATION_IS_EMAIL_PLUGIN_CONTEXT (_tmp58_) ? ((ApplicationEmailPluginContext*) _tmp58_) : NULL);
		email_context = _tmp59_;
		_tmp60_ = email_context;
		if (_tmp60_ != NULL) {
			GeeMap* _tmp61_;
			PeasPluginInfo* _tmp62_;
			PeasPluginInfo* _tmp63_;
			ApplicationEmailPluginContext* _tmp64_;
			_tmp61_ = self->priv->email_contexts;
			_tmp62_ = application_plugin_manager_plugin_context_get_info (context);
			_tmp63_ = _tmp62_;
			gee_map_unset (_tmp61_, _tmp63_, NULL);
			_tmp64_ = email_context;
			application_email_plugin_context_destroy (_tmp64_);
		}
		_g_object_unref0 (email_context);
	}
	_tmp65_ = application_plugin_manager_plugin_context_get_info (context);
	_tmp66_ = _tmp65_;
	_tmp67_ = _error_;
	g_signal_emit (self, application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_DEACTIVATED_SIGNAL], 0, _tmp66_, _tmp67_);
	_tmp68_ = self->priv->plugin_set;
	_tmp69_ = application_plugin_manager_plugin_context_get_info (context);
	_tmp70_ = _tmp69_;
	gee_map_unset (_tmp68_, _tmp70_, NULL);
	_g_object_unref0 (email);
	_g_object_unref0 (folder);
	_g_object_unref0 (notification);
	_g_error_free0 (_error_);
}

static void
application_plugin_manager_on_composer_registered (ApplicationPluginManager* self,
                                                   ComposerWidget* registered)
{
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (COMPOSER_IS_WIDGET (registered));
	{
		GeeIterator* _context_it = NULL;
		GeeMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->plugin_set;
		_tmp1_ = gee_map_get_values (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_context_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			ApplicationPluginManagerPluginContext* context = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			ApplicationPluginManagerPluginContext* _tmp9_;
			ApplicationPluginManagerApplicationImpl* _tmp10_;
			ApplicationPluginManagerApplicationImpl* _tmp11_;
			_tmp6_ = _context_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _context_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			context = (ApplicationPluginManagerPluginContext*) _tmp8_;
			_tmp9_ = context;
			_tmp10_ = application_plugin_manager_plugin_context_get_application (_tmp9_);
			_tmp11_ = _tmp10_;
			application_plugin_manager_application_impl_engine_composer_registered (_tmp11_, registered);
			_application_plugin_manager_plugin_context_unref0 (context);
		}
		_g_object_unref0 (_context_it);
	}
}

static void
application_plugin_manager_on_composer_deregistered (ApplicationPluginManager* self,
                                                     ComposerWidget* deregistered)
{
	g_return_if_fail (APPLICATION_IS_PLUGIN_MANAGER (self));
	g_return_if_fail (COMPOSER_IS_WIDGET (deregistered));
	{
		GeeIterator* _context_it = NULL;
		GeeMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->plugin_set;
		_tmp1_ = gee_map_get_values (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_context_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			ApplicationPluginManagerPluginContext* context = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			ApplicationPluginManagerPluginContext* _tmp9_;
			ApplicationPluginManagerApplicationImpl* _tmp10_;
			ApplicationPluginManagerApplicationImpl* _tmp11_;
			_tmp6_ = _context_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _context_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			context = (ApplicationPluginManagerPluginContext*) _tmp8_;
			_tmp9_ = context;
			_tmp10_ = application_plugin_manager_plugin_context_get_application (_tmp9_);
			_tmp11_ = _tmp10_;
			application_plugin_manager_application_impl_engine_composer_deregistered (_tmp11_, deregistered);
			_application_plugin_manager_plugin_context_unref0 (context);
		}
		_g_object_unref0 (_context_it);
	}
}

static inline gpointer
application_plugin_manager_plugin_globals_get_instance_private (ApplicationPluginManagerPluginGlobals* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManagerPluginGlobals_private_offset);
}

ApplicationFolderStoreFactory*
application_plugin_manager_plugin_globals_get_folders (ApplicationPluginManagerPluginGlobals* self)
{
	ApplicationFolderStoreFactory* result;
	ApplicationFolderStoreFactory* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self), NULL);
	_tmp0_ = self->priv->_folders;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_globals_set_folders (ApplicationPluginManagerPluginGlobals* self,
                                                       ApplicationFolderStoreFactory* value)
{
	ApplicationFolderStoreFactory* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_folders);
	self->priv->_folders = _tmp0_;
}

ApplicationEmailStoreFactory*
application_plugin_manager_plugin_globals_get_email (ApplicationPluginManagerPluginGlobals* self)
{
	ApplicationEmailStoreFactory* result;
	ApplicationEmailStoreFactory* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self), NULL);
	_tmp0_ = self->priv->_email;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_globals_set_email (ApplicationPluginManagerPluginGlobals* self,
                                                     ApplicationEmailStoreFactory* value)
{
	ApplicationEmailStoreFactory* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_email);
	self->priv->_email = _tmp0_;
}

static void
_application_plugin_manager_plugin_globals_on_window_added_gtk_application_window_added (GtkApplication* _sender,
                                                                                         GtkWindow* window,
                                                                                         gpointer self)
{
	application_plugin_manager_plugin_globals_on_window_added ((ApplicationPluginManagerPluginGlobals*) self, window);
}

static void
_application_plugin_manager_plugin_globals_on_add_account_application_account_interface_account_available (ApplicationAccountInterface* _sender,
                                                                                                           ApplicationAccountContext* context,
                                                                                                           gboolean is_startup,
                                                                                                           gpointer self)
{
	application_plugin_manager_plugin_globals_on_add_account ((ApplicationPluginManagerPluginGlobals*) self, context);
}

static void
_application_plugin_manager_plugin_globals_on_remove_account_application_account_interface_account_unavailable (ApplicationAccountInterface* _sender,
                                                                                                                ApplicationAccountContext* context,
                                                                                                                gboolean is_shutdown,
                                                                                                                gpointer self)
{
	application_plugin_manager_plugin_globals_on_remove_account ((ApplicationPluginManagerPluginGlobals*) self, context);
}

ApplicationPluginManagerPluginGlobals*
application_plugin_manager_plugin_globals_construct (GType object_type,
                                                     ApplicationClient* application,
                                                     ApplicationController* controller)
{
	ApplicationPluginManagerPluginGlobals* self = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	GeeMap* _tmp3_;
	ApplicationFolderStoreFactory* _tmp4_;
	ApplicationFolderStoreFactory* _tmp5_;
	GeeMap* _tmp6_;
	GeeMap* _tmp7_;
	GeeMap* _tmp8_;
	GeeMap* _tmp9_;
	ApplicationEmailStoreFactory* _tmp10_;
	ApplicationEmailStoreFactory* _tmp11_;
	g_return_val_if_fail (APPLICATION_IS_CLIENT (application), NULL);
	g_return_val_if_fail (APPLICATION_IS_CONTROLLER (controller), NULL);
	self = (ApplicationPluginManagerPluginGlobals*) g_type_create_instance (object_type);
	_tmp0_ = self->accounts;
	_tmp1_ = gee_map_get_read_only_view (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = application_folder_store_factory_new (_tmp3_);
	_tmp5_ = _tmp4_;
	application_plugin_manager_plugin_globals_set_folders (self, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (_tmp3_);
	_tmp6_ = self->accounts;
	_tmp7_ = gee_map_get_read_only_view (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = application_email_store_factory_new (_tmp9_);
	_tmp11_ = _tmp10_;
	application_plugin_manager_plugin_globals_set_email (self, _tmp11_);
	_g_object_unref0 (_tmp11_);
	_g_object_unref0 (_tmp9_);
	g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (application, gtk_application_get_type (), GtkApplication), "window-added", (GCallback) _application_plugin_manager_plugin_globals_on_window_added_gtk_application_window_added, self);
	{
		GeeIterator* _main_it = NULL;
		GeeCollection* _tmp12_;
		GeeCollection* _tmp13_;
		GeeIterator* _tmp14_;
		GeeIterator* _tmp15_;
		_tmp12_ = application_client_get_main_windows (application);
		_tmp13_ = _tmp12_;
		_tmp14_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp15_ = _tmp14_;
		_g_object_unref0 (_tmp13_);
		_main_it = _tmp15_;
		while (TRUE) {
			GeeIterator* _tmp16_;
			ApplicationMainWindow* main = NULL;
			GeeIterator* _tmp17_;
			gpointer _tmp18_;
			ApplicationFolderStoreFactory* _tmp19_;
			ApplicationMainWindow* _tmp20_;
			_tmp16_ = _main_it;
			if (!gee_iterator_next (_tmp16_)) {
				break;
			}
			_tmp17_ = _main_it;
			_tmp18_ = gee_iterator_get (_tmp17_);
			main = (ApplicationMainWindow*) _tmp18_;
			_tmp19_ = self->priv->_folders;
			_tmp20_ = main;
			application_folder_store_factory_main_window_added (_tmp19_, _tmp20_);
			_g_object_unref0 (main);
		}
		_g_object_unref0 (_main_it);
	}
	g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (controller, APPLICATION_TYPE_ACCOUNT_INTERFACE, ApplicationAccountInterface), "account-available", (GCallback) _application_plugin_manager_plugin_globals_on_add_account_application_account_interface_account_available, self);
	g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (controller, APPLICATION_TYPE_ACCOUNT_INTERFACE, ApplicationAccountInterface), "account-unavailable", (GCallback) _application_plugin_manager_plugin_globals_on_remove_account_application_account_interface_account_unavailable, self);
	{
		GeeIterator* _context_it = NULL;
		GeeCollection* _tmp21_;
		GeeCollection* _tmp22_;
		GeeIterator* _tmp23_;
		GeeIterator* _tmp24_;
		_tmp21_ = application_account_interface_get_account_contexts (G_TYPE_CHECK_INSTANCE_CAST (controller, APPLICATION_TYPE_ACCOUNT_INTERFACE, ApplicationAccountInterface));
		_tmp22_ = _tmp21_;
		_tmp23_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp24_ = _tmp23_;
		_g_object_unref0 (_tmp22_);
		_context_it = _tmp24_;
		while (TRUE) {
			GeeIterator* _tmp25_;
			ApplicationAccountContext* context = NULL;
			GeeIterator* _tmp26_;
			gpointer _tmp27_;
			ApplicationAccountContext* _tmp28_;
			_tmp25_ = _context_it;
			if (!gee_iterator_next (_tmp25_)) {
				break;
			}
			_tmp26_ = _context_it;
			_tmp27_ = gee_iterator_get (_tmp26_);
			context = (ApplicationAccountContext*) _tmp27_;
			_tmp28_ = context;
			application_plugin_manager_plugin_globals_on_add_account (self, _tmp28_);
			_g_object_unref0 (context);
		}
		_g_object_unref0 (_context_it);
	}
	return self;
}

ApplicationPluginManagerPluginGlobals*
application_plugin_manager_plugin_globals_new (ApplicationClient* application,
                                               ApplicationController* controller)
{
	return application_plugin_manager_plugin_globals_construct (APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, application, controller);
}

void
application_plugin_manager_plugin_globals_destroy (ApplicationPluginManagerPluginGlobals* self,
                                                   GError** error)
{
	ApplicationEmailStoreFactory* _tmp0_;
	ApplicationFolderStoreFactory* _tmp1_;
	GeeMap* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	_tmp0_ = self->priv->_email;
	application_email_store_factory_destroy (_tmp0_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp1_ = self->priv->_folders;
	application_folder_store_factory_destroy (_tmp1_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = self->accounts;
	gee_map_clear (_tmp2_);
}

static void
application_plugin_manager_plugin_globals_on_window_added (ApplicationPluginManagerPluginGlobals* self,
                                                           GtkWindow* window)
{
	ApplicationMainWindow* main = NULL;
	ApplicationMainWindow* _tmp0_;
	ApplicationMainWindow* _tmp1_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (window, gtk_window_get_type ()));
	_tmp0_ = _g_object_ref0 (APPLICATION_IS_MAIN_WINDOW (window) ? ((ApplicationMainWindow*) window) : NULL);
	main = _tmp0_;
	_tmp1_ = main;
	if (_tmp1_ != NULL) {
		ApplicationFolderStoreFactory* _tmp2_;
		ApplicationMainWindow* _tmp3_;
		_tmp2_ = self->priv->_folders;
		_tmp3_ = main;
		application_folder_store_factory_main_window_added (_tmp2_, _tmp3_);
	}
	_g_object_unref0 (main);
}

static void
application_plugin_manager_plugin_globals_on_add_account (ApplicationPluginManagerPluginGlobals* self,
                                                          ApplicationAccountContext* added)
{
	GeeMap* _tmp0_;
	ApplicationPluginManagerAccountImpl* _tmp1_;
	ApplicationPluginManagerAccountImpl* _tmp2_;
	ApplicationFolderStoreFactory* _tmp3_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	g_return_if_fail (APPLICATION_IS_ACCOUNT_CONTEXT (added));
	_tmp0_ = self->accounts;
	_tmp1_ = application_plugin_manager_account_impl_new (added);
	_tmp2_ = _tmp1_;
	gee_map_set (_tmp0_, added, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->_folders;
	application_folder_store_factory_add_account (_tmp3_, added);
}

static void
application_plugin_manager_plugin_globals_on_remove_account (ApplicationPluginManagerPluginGlobals* self,
                                                             ApplicationAccountContext* removed)
{
	ApplicationFolderStoreFactory* _tmp0_;
	GeeMap* _tmp1_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (self));
	g_return_if_fail (APPLICATION_IS_ACCOUNT_CONTEXT (removed));
	_tmp0_ = self->priv->_folders;
	application_folder_store_factory_remove_account (_tmp0_, removed);
	_tmp1_ = self->accounts;
	gee_map_unset (_tmp1_, removed, NULL);
}

static void
application_plugin_manager_value_plugin_globals_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
application_plugin_manager_value_plugin_globals_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		application_plugin_manager_plugin_globals_unref (value->data[0].v_pointer);
	}
}

static void
application_plugin_manager_value_plugin_globals_copy_value (const GValue* src_value,
                                                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = application_plugin_manager_plugin_globals_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
application_plugin_manager_value_plugin_globals_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
application_plugin_manager_value_plugin_globals_collect_value (GValue* value,
                                                               guint n_collect_values,
                                                               GTypeCValue* collect_values,
                                                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		ApplicationPluginManagerPluginGlobals * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = application_plugin_manager_plugin_globals_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
application_plugin_manager_value_plugin_globals_lcopy_value (const GValue* value,
                                                             guint n_collect_values,
                                                             GTypeCValue* collect_values,
                                                             guint collect_flags)
{
	ApplicationPluginManagerPluginGlobals ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = application_plugin_manager_plugin_globals_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
application_plugin_manager_param_spec_plugin_globals (const gchar* name,
                                                      const gchar* nick,
                                                      const gchar* blurb,
                                                      GType object_type,
                                                      GParamFlags flags)
{
	ApplicationPluginManagerParamSpecPluginGlobals* spec;
	g_return_val_if_fail (g_type_is_a (object_type, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
application_plugin_manager_value_get_plugin_globals (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS), NULL);
	return value->data[0].v_pointer;
}

void
application_plugin_manager_value_set_plugin_globals (GValue* value,
                                                     gpointer v_object)
{
	ApplicationPluginManagerPluginGlobals * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		application_plugin_manager_plugin_globals_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		application_plugin_manager_plugin_globals_unref (old);
	}
}

void
application_plugin_manager_value_take_plugin_globals (GValue* value,
                                                      gpointer v_object)
{
	ApplicationPluginManagerPluginGlobals * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		application_plugin_manager_plugin_globals_unref (old);
	}
}

static void
application_plugin_manager_plugin_globals_class_init (ApplicationPluginManagerPluginGlobalsClass * klass,
                                                      gpointer klass_data)
{
	application_plugin_manager_plugin_globals_parent_class = g_type_class_peek_parent (klass);
	((ApplicationPluginManagerPluginGlobalsClass *) klass)->finalize = application_plugin_manager_plugin_globals_finalize;
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManagerPluginGlobals_private_offset);
}

static void
application_plugin_manager_plugin_globals_instance_init (ApplicationPluginManagerPluginGlobals * self,
                                                         gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = application_plugin_manager_plugin_globals_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (APPLICATION_TYPE_ACCOUNT_CONTEXT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->accounts = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_MAP, GeeMap);
	self->ref_count = 1;
}

static void
application_plugin_manager_plugin_globals_finalize (ApplicationPluginManagerPluginGlobals * obj)
{
	ApplicationPluginManagerPluginGlobals * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, ApplicationPluginManagerPluginGlobals);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_folders);
	_g_object_unref0 (self->priv->_email);
	_g_object_unref0 (self->accounts);
}

/** Aggregates application-wide plugin objects. */
static GType
application_plugin_manager_plugin_globals_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { application_plugin_manager_value_plugin_globals_init, application_plugin_manager_value_plugin_globals_free_value, application_plugin_manager_value_plugin_globals_copy_value, application_plugin_manager_value_plugin_globals_peek_pointer, "p", application_plugin_manager_value_plugin_globals_collect_value, "p", application_plugin_manager_value_plugin_globals_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerPluginGlobalsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_plugin_globals_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManagerPluginGlobals), 0, (GInstanceInitFunc) application_plugin_manager_plugin_globals_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType application_plugin_manager_plugin_globals_type_id;
	application_plugin_manager_plugin_globals_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ApplicationPluginManagerPluginGlobals", &g_define_type_info, &g_define_type_fundamental_info, 0);
	ApplicationPluginManagerPluginGlobals_private_offset = g_type_add_instance_private (application_plugin_manager_plugin_globals_type_id, sizeof (ApplicationPluginManagerPluginGlobalsPrivate));
	return application_plugin_manager_plugin_globals_type_id;
}

GType
application_plugin_manager_plugin_globals_get_type (void)
{
	static volatile gsize application_plugin_manager_plugin_globals_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_plugin_globals_type_id__once)) {
		GType application_plugin_manager_plugin_globals_type_id;
		application_plugin_manager_plugin_globals_type_id = application_plugin_manager_plugin_globals_get_type_once ();
		g_once_init_leave (&application_plugin_manager_plugin_globals_type_id__once, application_plugin_manager_plugin_globals_type_id);
	}
	return application_plugin_manager_plugin_globals_type_id__once;
}

gpointer
application_plugin_manager_plugin_globals_ref (gpointer instance)
{
	ApplicationPluginManagerPluginGlobals * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
application_plugin_manager_plugin_globals_unref (gpointer instance)
{
	ApplicationPluginManagerPluginGlobals * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		APPLICATION_PLUGIN_MANAGER_PLUGIN_GLOBALS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
application_plugin_manager_plugin_context_get_instance_private (ApplicationPluginManagerPluginContext* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManagerPluginContext_private_offset);
}

PeasPluginInfo*
application_plugin_manager_plugin_context_get_info (ApplicationPluginManagerPluginContext* self)
{
	PeasPluginInfo* result;
	PeasPluginInfo* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self), NULL);
	_tmp0_ = self->priv->_info;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_context_set_info (ApplicationPluginManagerPluginContext* self,
                                                    PeasPluginInfo* value)
{
	PeasPluginInfo* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_info);
	self->priv->_info = _tmp0_;
}

PluginPluginBase*
application_plugin_manager_plugin_context_get_instance (ApplicationPluginManagerPluginContext* self)
{
	PluginPluginBase* result;
	PluginPluginBase* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self), NULL);
	_tmp0_ = self->priv->_instance;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_context_set_instance (ApplicationPluginManagerPluginContext* self,
                                                        PluginPluginBase* value)
{
	PluginPluginBase* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_instance);
	self->priv->_instance = _tmp0_;
}

ApplicationPluginManagerApplicationImpl*
application_plugin_manager_plugin_context_get_application (ApplicationPluginManagerPluginContext* self)
{
	ApplicationPluginManagerApplicationImpl* result;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self), NULL);
	_tmp0_ = self->priv->_application;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_context_set_application (ApplicationPluginManagerPluginContext* self,
                                                           ApplicationPluginManagerApplicationImpl* value)
{
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_application);
	self->priv->_application = _tmp0_;
}

const gchar*
application_plugin_manager_plugin_context_get_action_group_name (ApplicationPluginManagerPluginContext* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self), NULL);
	_tmp0_ = self->priv->_action_group_name;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_plugin_context_set_action_group_name (ApplicationPluginManagerPluginContext* self,
                                                                 const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_action_group_name);
	self->priv->_action_group_name = _tmp0_;
}

static void
_vala_GValue_array_free (GValue * array,
                         gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			g_value_unset (&array[i]);
		}
	}
	g_free (array);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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;
}

ApplicationPluginManagerPluginContext*
application_plugin_manager_plugin_context_construct (GType object_type,
                                                     PeasEngine* engine,
                                                     PeasPluginInfo* info,
                                                     ApplicationClient* application,
                                                     ApplicationPluginManagerPluginGlobals* globals,
                                                     GError** error)
{
	ApplicationPluginManagerPluginContext* self = NULL;
	ApplicationPluginManagerApplicationImpl* app_impl = NULL;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	GValue app_impl_val = {0};
	GValue _tmp1_ = {0};
	ApplicationPluginManagerApplicationImpl* _tmp2_;
	PluginPluginBase* instance = NULL;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	GValue _tmp6_;
	GValue _tmp7_;
	GValue _tmp8_ = {0};
	GValue* _tmp9_;
	GValue* _tmp10_;
	gint _tmp10__length1;
	GObject* _tmp11_;
	PluginPluginBase* _tmp12_;
	PluginPluginBase* _tmp13_;
	PluginPluginBase* _tmp14_;
	ApplicationPluginManagerApplicationImpl* _tmp16_;
	PluginPluginBase* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (engine, peas_engine_get_type ()), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (info, peas_plugin_info_get_type ()), NULL);
	g_return_val_if_fail (APPLICATION_IS_CLIENT (application), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (globals), NULL);
	self = (ApplicationPluginManagerPluginContext*) g_type_create_instance (object_type);
	_tmp0_ = application_plugin_manager_application_impl_new (application, self, globals);
	app_impl = _tmp0_;
	g_value_init (&_tmp1_, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL);
	app_impl_val = _tmp1_;
	_tmp2_ = app_impl;
	g_value_set_object (&app_impl_val, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, G_TYPE_OBJECT, GObject));
	_tmp3_ = g_strdup ("plugin_application");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 1;
	_tmp6_ = app_impl_val;
	_tmp7_ = _tmp6_;
	if (G_IS_VALUE (&_tmp7_)) {
		g_value_init (&_tmp8_, G_VALUE_TYPE (&_tmp7_));
		g_value_copy (&_tmp7_, &_tmp8_);
	} else {
		_tmp8_ = _tmp7_;
	}
	_tmp9_ = g_new0 (GValue, 1);
	_tmp9_[0] = _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp10__length1 = 1;
	_tmp11_ = peas_engine_create_extension_with_properties (engine, info, PLUGIN_TYPE_PLUGIN_BASE, (guint) 1, _tmp5_, _tmp10_);
	_tmp12_ = PLUGIN_IS_PLUGIN_BASE (_tmp11_) ? ((PluginPluginBase*) _tmp11_) : NULL;
	if (_tmp12_ == NULL) {
		_g_object_unref0 (_tmp11_);
	}
	_tmp13_ = _tmp12_;
	_tmp10_ = (_vala_GValue_array_free (_tmp10_, _tmp10__length1), NULL);
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
	instance = _tmp13_;
	_tmp14_ = instance;
	if (_tmp14_ == NULL) {
		GError* _tmp15_;
		_tmp15_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_NOT_SUPPORTED, "Plugin extension does implement PluginBase");
		_inner_error0_ = _tmp15_;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (instance);
		G_IS_VALUE (&app_impl_val) ? (g_value_unset (&app_impl_val), NULL) : NULL;
		_g_object_unref0 (app_impl);
		_application_plugin_manager_plugin_context_unref0 (self);
		return NULL;
	}
	application_plugin_manager_plugin_context_set_info (self, info);
	_tmp16_ = app_impl;
	application_plugin_manager_plugin_context_set_application (self, _tmp16_);
	_tmp17_ = instance;
	application_plugin_manager_plugin_context_set_instance (self, _tmp17_);
	_tmp18_ = peas_plugin_info_get_module_name (info);
	_tmp19_ = string_replace (_tmp18_, ".", "-");
	_tmp20_ = _tmp19_;
	application_plugin_manager_plugin_context_set_action_group_name (self, _tmp20_);
	_g_free0 (_tmp20_);
	_g_object_unref0 (instance);
	G_IS_VALUE (&app_impl_val) ? (g_value_unset (&app_impl_val), NULL) : NULL;
	_g_object_unref0 (app_impl);
	return self;
}

ApplicationPluginManagerPluginContext*
application_plugin_manager_plugin_context_new (PeasEngine* engine,
                                               PeasPluginInfo* info,
                                               ApplicationClient* application,
                                               ApplicationPluginManagerPluginGlobals* globals,
                                               GError** error)
{
	return application_plugin_manager_plugin_context_construct (APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, engine, info, application, globals, error);
}

static void
application_plugin_manager_plugin_context_activate_data_free (gpointer _data)
{
	ApplicationPluginManagerPluginContextActivateData* _data_;
	_data_ = _data;
	_application_plugin_manager_plugin_context_unref0 (_data_->self);
	g_slice_free (ApplicationPluginManagerPluginContextActivateData, _data_);
}

static gpointer
_application_plugin_manager_plugin_context_ref0 (gpointer self)
{
	return self ? application_plugin_manager_plugin_context_ref (self) : NULL;
}

void
application_plugin_manager_plugin_context_activate (ApplicationPluginManagerPluginContext* self,
                                                    gboolean is_startup,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ApplicationPluginManagerPluginContextActivateData* _data_;
	ApplicationPluginManagerPluginContext* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_data_ = g_slice_new0 (ApplicationPluginManagerPluginContextActivateData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_plugin_manager_plugin_context_activate_data_free);
	_tmp0_ = _application_plugin_manager_plugin_context_ref0 (self);
	_data_->self = _tmp0_;
	_data_->is_startup = is_startup;
	application_plugin_manager_plugin_context_activate_co (_data_);
}

void
application_plugin_manager_plugin_context_activate_finish (ApplicationPluginManagerPluginContext* self,
                                                           GAsyncResult* _res_,
                                                           GError** error)
{
	ApplicationPluginManagerPluginContextActivateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
application_plugin_manager_plugin_context_activate_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	ApplicationPluginManagerPluginContextActivateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_plugin_manager_plugin_context_activate_co (_data_);
}

static gboolean
application_plugin_manager_plugin_context_activate_co (ApplicationPluginManagerPluginContextActivateData* _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->_instance;
	_data_->_state_ = 1;
	plugin_plugin_base_activate (_data_->_tmp0_, _data_->is_startup, application_plugin_manager_plugin_context_activate_ready, _data_);
	return FALSE;
	_state_1:
	plugin_plugin_base_activate_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
application_plugin_manager_plugin_context_deactivate_data_free (gpointer _data)
{
	ApplicationPluginManagerPluginContextDeactivateData* _data_;
	_data_ = _data;
	_application_plugin_manager_plugin_context_unref0 (_data_->self);
	g_slice_free (ApplicationPluginManagerPluginContextDeactivateData, _data_);
}

void
application_plugin_manager_plugin_context_deactivate (ApplicationPluginManagerPluginContext* self,
                                                      gboolean is_shutdown,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	ApplicationPluginManagerPluginContextDeactivateData* _data_;
	ApplicationPluginManagerPluginContext* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (self));
	_data_ = g_slice_new0 (ApplicationPluginManagerPluginContextDeactivateData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_plugin_manager_plugin_context_deactivate_data_free);
	_tmp0_ = _application_plugin_manager_plugin_context_ref0 (self);
	_data_->self = _tmp0_;
	_data_->is_shutdown = is_shutdown;
	application_plugin_manager_plugin_context_deactivate_co (_data_);
}

void
application_plugin_manager_plugin_context_deactivate_finish (ApplicationPluginManagerPluginContext* self,
                                                             GAsyncResult* _res_,
                                                             GError** error)
{
	ApplicationPluginManagerPluginContextDeactivateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
application_plugin_manager_plugin_context_deactivate_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_)
{
	ApplicationPluginManagerPluginContextDeactivateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_plugin_manager_plugin_context_deactivate_co (_data_);
}

static gboolean
application_plugin_manager_plugin_context_deactivate_co (ApplicationPluginManagerPluginContextDeactivateData* _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->_instance;
	_data_->_state_ = 1;
	plugin_plugin_base_deactivate (_data_->_tmp0_, _data_->is_shutdown, application_plugin_manager_plugin_context_deactivate_ready, _data_);
	return FALSE;
	_state_1:
	plugin_plugin_base_deactivate_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
application_plugin_manager_value_plugin_context_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
application_plugin_manager_value_plugin_context_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		application_plugin_manager_plugin_context_unref (value->data[0].v_pointer);
	}
}

static void
application_plugin_manager_value_plugin_context_copy_value (const GValue* src_value,
                                                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = application_plugin_manager_plugin_context_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
application_plugin_manager_value_plugin_context_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
application_plugin_manager_value_plugin_context_collect_value (GValue* value,
                                                               guint n_collect_values,
                                                               GTypeCValue* collect_values,
                                                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		ApplicationPluginManagerPluginContext * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = application_plugin_manager_plugin_context_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
application_plugin_manager_value_plugin_context_lcopy_value (const GValue* value,
                                                             guint n_collect_values,
                                                             GTypeCValue* collect_values,
                                                             guint collect_flags)
{
	ApplicationPluginManagerPluginContext ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = application_plugin_manager_plugin_context_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
application_plugin_manager_param_spec_plugin_context (const gchar* name,
                                                      const gchar* nick,
                                                      const gchar* blurb,
                                                      GType object_type,
                                                      GParamFlags flags)
{
	ApplicationPluginManagerParamSpecPluginContext* spec;
	g_return_val_if_fail (g_type_is_a (object_type, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
application_plugin_manager_value_get_plugin_context (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT), NULL);
	return value->data[0].v_pointer;
}

void
application_plugin_manager_value_set_plugin_context (GValue* value,
                                                     gpointer v_object)
{
	ApplicationPluginManagerPluginContext * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		application_plugin_manager_plugin_context_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		application_plugin_manager_plugin_context_unref (old);
	}
}

void
application_plugin_manager_value_take_plugin_context (GValue* value,
                                                      gpointer v_object)
{
	ApplicationPluginManagerPluginContext * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		application_plugin_manager_plugin_context_unref (old);
	}
}

static void
application_plugin_manager_plugin_context_class_init (ApplicationPluginManagerPluginContextClass * klass,
                                                      gpointer klass_data)
{
	application_plugin_manager_plugin_context_parent_class = g_type_class_peek_parent (klass);
	((ApplicationPluginManagerPluginContextClass *) klass)->finalize = application_plugin_manager_plugin_context_finalize;
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManagerPluginContext_private_offset);
}

static void
application_plugin_manager_plugin_context_instance_init (ApplicationPluginManagerPluginContext * self,
                                                         gpointer klass)
{
	self->priv = application_plugin_manager_plugin_context_get_instance_private (self);
	self->ref_count = 1;
}

static void
application_plugin_manager_plugin_context_finalize (ApplicationPluginManagerPluginContext * obj)
{
	ApplicationPluginManagerPluginContext * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, ApplicationPluginManagerPluginContext);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_info);
	_g_object_unref0 (self->priv->_instance);
	_g_object_unref0 (self->priv->_application);
	_g_free0 (self->priv->_action_group_name);
}

/** Aggregates state specific to a single plugin. */
static GType
application_plugin_manager_plugin_context_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { application_plugin_manager_value_plugin_context_init, application_plugin_manager_value_plugin_context_free_value, application_plugin_manager_value_plugin_context_copy_value, application_plugin_manager_value_plugin_context_peek_pointer, "p", application_plugin_manager_value_plugin_context_collect_value, "p", application_plugin_manager_value_plugin_context_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerPluginContextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_plugin_context_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManagerPluginContext), 0, (GInstanceInitFunc) application_plugin_manager_plugin_context_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType application_plugin_manager_plugin_context_type_id;
	application_plugin_manager_plugin_context_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ApplicationPluginManagerPluginContext", &g_define_type_info, &g_define_type_fundamental_info, 0);
	ApplicationPluginManagerPluginContext_private_offset = g_type_add_instance_private (application_plugin_manager_plugin_context_type_id, sizeof (ApplicationPluginManagerPluginContextPrivate));
	return application_plugin_manager_plugin_context_type_id;
}

GType
application_plugin_manager_plugin_context_get_type (void)
{
	static volatile gsize application_plugin_manager_plugin_context_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_plugin_context_type_id__once)) {
		GType application_plugin_manager_plugin_context_type_id;
		application_plugin_manager_plugin_context_type_id = application_plugin_manager_plugin_context_get_type_once ();
		g_once_init_leave (&application_plugin_manager_plugin_context_type_id__once, application_plugin_manager_plugin_context_type_id);
	}
	return application_plugin_manager_plugin_context_type_id__once;
}

gpointer
application_plugin_manager_plugin_context_ref (gpointer instance)
{
	ApplicationPluginManagerPluginContext * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
application_plugin_manager_plugin_context_unref (gpointer instance)
{
	ApplicationPluginManagerPluginContext * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		APPLICATION_PLUGIN_MANAGER_PLUGIN_CONTEXT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
application_plugin_manager_application_impl_get_instance_private (ApplicationPluginManagerApplicationImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManagerApplicationImpl_private_offset);
}

ApplicationPluginManagerApplicationImpl*
application_plugin_manager_application_impl_construct (GType object_type,
                                                       ApplicationClient* backing,
                                                       ApplicationPluginManagerPluginContext* plugin,
                                                       ApplicationPluginManagerPluginGlobals* globals)
{
	ApplicationPluginManagerApplicationImpl * self = NULL;
	g_return_val_if_fail (APPLICATION_IS_CLIENT (backing), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_CONTEXT (plugin), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_PLUGIN_GLOBALS (globals), NULL);
	self = (ApplicationPluginManagerApplicationImpl*) geary_base_object_construct (object_type);
	self->backing = backing;
	self->plugin = plugin;
	self->globals = globals;
	return self;
}

ApplicationPluginManagerApplicationImpl*
application_plugin_manager_application_impl_new (ApplicationClient* backing,
                                                 ApplicationPluginManagerPluginContext* plugin,
                                                 ApplicationPluginManagerPluginGlobals* globals)
{
	return application_plugin_manager_application_impl_construct (APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, backing, plugin, globals);
}

static void
application_plugin_manager_application_impl_real_compose_blank_data_free (gpointer _data)
{
	ApplicationPluginManagerApplicationImplComposeBlankData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ApplicationPluginManagerApplicationImplComposeBlankData, _data_);
}

static void
application_plugin_manager_application_impl_real_compose_blank (PluginApplication* base,
                                                                PluginAccount* source,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_)
{
	ApplicationPluginManagerApplicationImpl * self;
	ApplicationPluginManagerApplicationImplComposeBlankData* _data_;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	PluginAccount* _tmp1_;
	g_return_if_fail (PLUGIN_IS_ACCOUNT (source));
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	_data_ = g_slice_new0 (ApplicationPluginManagerApplicationImplComposeBlankData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_plugin_manager_application_impl_real_compose_blank_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	application_plugin_manager_application_impl_real_compose_blank_co (_data_);
}

static PluginComposer*
application_plugin_manager_application_impl_compose_blank_finish (PluginApplication* base,
                                                                  GAsyncResult* _res_,
                                                                  GError** error)
{
	PluginComposer* result;
	ApplicationPluginManagerApplicationImplComposeBlankData* _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_plugin_manager_application_impl_compose_blank_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_)
{
	ApplicationPluginManagerApplicationImplComposeBlankData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_plugin_manager_application_impl_real_compose_blank_co (_data_);
}

static gboolean
application_plugin_manager_application_impl_real_compose_blank_co (ApplicationPluginManagerApplicationImplComposeBlankData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _g_object_ref0 (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (_data_->source) ? ((ApplicationPluginManagerAccountImpl*) _data_->source) : NULL);
	_data_->impl = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->impl;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_NOT_SUPPORTED, "Not a valid account");
		_data_->_inner_error0_ = _data_->_tmp2_;
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->impl);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->impl);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp3_ = _data_->self->backing;
	_data_->_tmp4_ = application_client_get_controller (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->impl;
	_data_->_tmp7_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_state_ = 1;
	application_controller_compose_blank (_data_->_tmp5_, _data_->_tmp8_, NULL, application_plugin_manager_application_impl_compose_blank_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = application_controller_compose_blank_finish (_data_->_tmp5_, _data_->_res_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = application_plugin_manager_application_impl_to_plugin_composer (_data_->self, _data_->_tmp10_);
	_data_->_tmp12_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, PLUGIN_TYPE_COMPOSER, PluginComposer);
	_g_object_unref0 (_data_->_tmp10_);
	_data_->result = _data_->_tmp12_;
	_g_object_unref0 (_data_->impl);
	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_plugin_manager_application_impl_real_compose_with_context_data_free (gpointer _data)
{
	ApplicationPluginManagerApplicationImplComposeWithContextData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->send_from);
	_g_object_unref0 (_data_->to_load);
	_g_free0 (_data_->quote);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ApplicationPluginManagerApplicationImplComposeWithContextData, _data_);
}

static void
application_plugin_manager_application_impl_real_compose_with_context (PluginApplication* base,
                                                                       PluginAccount* send_from,
                                                                       PluginComposerContextType plugin_type,
                                                                       PluginEmailIdentifier* to_load,
                                                                       const gchar* quote,
                                                                       GAsyncReadyCallback _callback_,
                                                                       gpointer _user_data_)
{
	ApplicationPluginManagerApplicationImpl * self;
	ApplicationPluginManagerApplicationImplComposeWithContextData* _data_;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	PluginAccount* _tmp1_;
	PluginEmailIdentifier* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (PLUGIN_IS_ACCOUNT (send_from));
	g_return_if_fail (PLUGIN_IS_EMAIL_IDENTIFIER (to_load));
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	_data_ = g_slice_new0 (ApplicationPluginManagerApplicationImplComposeWithContextData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_plugin_manager_application_impl_real_compose_with_context_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (send_from);
	_g_object_unref0 (_data_->send_from);
	_data_->send_from = _tmp1_;
	_data_->plugin_type = plugin_type;
	_tmp2_ = _g_object_ref0 (to_load);
	_g_object_unref0 (_data_->to_load);
	_data_->to_load = _tmp2_;
	_tmp3_ = g_strdup (quote);
	_g_free0 (_data_->quote);
	_data_->quote = _tmp3_;
	application_plugin_manager_application_impl_real_compose_with_context_co (_data_);
}

static PluginComposer*
application_plugin_manager_application_impl_compose_with_context_finish (PluginApplication* base,
                                                                         GAsyncResult* _res_,
                                                                         GError** error)
{
	PluginComposer* result;
	ApplicationPluginManagerApplicationImplComposeWithContextData* _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_plugin_manager_application_impl_compose_with_context_ready (GObject* source_object,
                                                                        GAsyncResult* _res_,
                                                                        gpointer _user_data_)
{
	ApplicationPluginManagerApplicationImplComposeWithContextData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	application_plugin_manager_application_impl_real_compose_with_context_co (_data_);
}

static gboolean
application_plugin_manager_application_impl_real_compose_with_context_co (ApplicationPluginManagerApplicationImplComposeWithContextData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _g_object_ref0 (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (_data_->send_from) ? ((ApplicationPluginManagerAccountImpl*) _data_->send_from) : NULL);
	_data_->source_impl = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->source_impl;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_NOT_SUPPORTED, "Not a valid account");
		_data_->_inner_error0_ = _data_->_tmp2_;
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->source_impl);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->source_impl);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp3_ = _data_->self->globals;
	_data_->_tmp4_ = application_plugin_manager_plugin_globals_get_email (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = application_email_store_factory_to_engine_id (_data_->_tmp5_, _data_->to_load);
	_data_->id = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->id;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp8_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_NOT_FOUND, "Email id not found");
		_data_->_inner_error0_ = _data_->_tmp8_;
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->email = NULL;
	{
		_data_->_tmp10_ = _data_->source_impl;
		_data_->_tmp11_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = application_account_context_get_emails (_data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = _data_->id;
		_data_->_tmp16_ = geary_collection_single (GEARY_TYPE_EMAIL_IDENTIFIER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = _data_->source_impl;
		_data_->_tmp19_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = application_account_context_get_cancellable (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_state_ = 1;
		geary_app_email_store_list_email_by_sparse_id_async (_data_->_tmp14_, _data_->_tmp17_, COMPOSER_WIDGET_REQUIRED_FIELDS, GEARY_FOLDER_LIST_FLAGS_NONE, _data_->_tmp22_, application_plugin_manager_application_impl_compose_with_context_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp23_ = geary_app_email_store_list_email_by_sparse_id_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_g_object_unref0 (_data_->_tmp17_);
		_data_->_tmp9_ = _data_->_tmp24_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp25_ = _data_->_tmp9_;
		_data_->_tmp9_ = NULL;
		_g_object_unref0 (_data_->email);
		_data_->email = _data_->_tmp25_;
		_g_object_unref0 (_data_->_tmp9_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp26_ = _data_->err;
		_data_->_tmp27_ = _data_->_tmp26_->message;
		_data_->_tmp28_ = g_error_new (PLUGIN_ERROR, PLUGIN_ERROR_NOT_FOUND, "Error looking up email: %s", _data_->_tmp27_);
		_data_->_inner_error0_ = _data_->_tmp28_;
		_g_error_free0 (_data_->err);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->email);
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->email);
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp30_ = _data_->email;
	if (_data_->_tmp30_ == NULL) {
		_data_->_tmp29_ = TRUE;
	} else {
		_data_->_tmp31_ = _data_->email;
		_data_->_tmp32_ = gee_collection_get_is_empty (_data_->_tmp31_);
		_data_->_tmp33_ = _data_->_tmp32_;
		_data_->_tmp29_ = _data_->_tmp33_;
	}
	if (_data_->_tmp29_) {
		_data_->_tmp34_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_NOT_FOUND, "Email not found for id");
		_data_->_inner_error0_ = _data_->_tmp34_;
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->email);
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->email);
			_g_object_unref0 (_data_->id);
			_g_object_unref0 (_data_->source_impl);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp35_ = _data_->email;
	_data_->_tmp36_ = geary_collection_first (GEARY_TYPE_EMAIL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp35_);
	_data_->context = (GearyEmail*) _data_->_tmp36_;
	_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_NONE;
	switch (_data_->plugin_type) {
		case PLUGIN_COMPOSER_CONTEXT_TYPE_NONE:
		{
			_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_NONE;
			break;
		}
		case PLUGIN_COMPOSER_CONTEXT_TYPE_EDIT:
		{
			_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_EDIT;
			break;
		}
		case PLUGIN_COMPOSER_CONTEXT_TYPE_REPLY_SENDER:
		{
			_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_REPLY_SENDER;
			break;
		}
		case PLUGIN_COMPOSER_CONTEXT_TYPE_REPLY_ALL:
		{
			_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_REPLY_ALL;
			break;
		}
		case PLUGIN_COMPOSER_CONTEXT_TYPE_FORWARD:
		{
			_data_->type = COMPOSER_WIDGET_CONTEXT_TYPE_FORWARD;
			break;
		}
		default:
		break;
	}
	_data_->_tmp37_ = _data_->self->backing;
	_data_->_tmp38_ = application_client_get_controller (_data_->_tmp37_);
	_data_->_tmp39_ = _data_->_tmp38_;
	_data_->_tmp40_ = _data_->source_impl;
	_data_->_tmp41_ = application_plugin_manager_account_impl_get_backing (_data_->_tmp40_);
	_data_->_tmp42_ = _data_->_tmp41_;
	_data_->_tmp43_ = _data_->context;
	_data_->_state_ = 2;
	application_controller_compose_with_context (_data_->_tmp39_, _data_->_tmp42_, _data_->type, _data_->_tmp43_, _data_->quote, application_plugin_manager_application_impl_compose_with_context_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp44_ = application_controller_compose_with_context_finish (_data_->_tmp39_, _data_->_res_);
	_data_->_tmp45_ = _data_->_tmp44_;
	_data_->_tmp46_ = application_plugin_manager_application_impl_to_plugin_composer (_data_->self, _data_->_tmp45_);
	_data_->_tmp47_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp46_, PLUGIN_TYPE_COMPOSER, PluginComposer);
	_g_object_unref0 (_data_->_tmp45_);
	_data_->result = _data_->_tmp47_;
	_g_object_unref0 (_data_->context);
	_g_object_unref0 (_data_->email);
	_g_object_unref0 (_data_->id);
	_g_object_unref0 (_data_->source_impl);
	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_plugin_manager_application_impl_on_window_added_gtk_application_window_added (GtkApplication* _sender,
                                                                                           GtkWindow* window,
                                                                                           gpointer self)
{
	application_plugin_manager_application_impl_on_window_added ((ApplicationPluginManagerApplicationImpl*) self, window);
}

static void
application_plugin_manager_application_impl_real_register_action (PluginApplication* base,
                                                                  GAction* action)
{
	ApplicationPluginManagerApplicationImpl * self;
	GSimpleActionGroup* _tmp0_;
	GSimpleActionGroup* _tmp16_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (action, g_action_get_type ()));
	_tmp0_ = self->priv->action_group;
	if (_tmp0_ == NULL) {
		GSimpleActionGroup* _tmp1_;
		ApplicationClient* _tmp2_;
		_tmp1_ = g_simple_action_group_new ();
		_g_object_unref0 (self->priv->action_group);
		self->priv->action_group = _tmp1_;
		_tmp2_ = self->backing;
		g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_application_get_type (), GtkApplication), "window-added", (GCallback) _application_plugin_manager_application_impl_on_window_added_gtk_application_window_added, self, 0);
		{
			GeeIterator* _main_it = NULL;
			ApplicationClient* _tmp3_;
			GeeCollection* _tmp4_;
			GeeCollection* _tmp5_;
			GeeIterator* _tmp6_;
			GeeIterator* _tmp7_;
			_tmp3_ = self->backing;
			_tmp4_ = application_client_get_main_windows (_tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_ITERABLE, GeeIterable));
			_tmp7_ = _tmp6_;
			_g_object_unref0 (_tmp5_);
			_main_it = _tmp7_;
			while (TRUE) {
				GeeIterator* _tmp8_;
				ApplicationMainWindow* main = NULL;
				GeeIterator* _tmp9_;
				gpointer _tmp10_;
				ApplicationMainWindow* _tmp11_;
				ApplicationPluginManagerPluginContext* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				GSimpleActionGroup* _tmp15_;
				_tmp8_ = _main_it;
				if (!gee_iterator_next (_tmp8_)) {
					break;
				}
				_tmp9_ = _main_it;
				_tmp10_ = gee_iterator_get (_tmp9_);
				main = (ApplicationMainWindow*) _tmp10_;
				_tmp11_ = main;
				_tmp12_ = self->plugin;
				_tmp13_ = application_plugin_manager_plugin_context_get_action_group_name (_tmp12_);
				_tmp14_ = _tmp13_;
				_tmp15_ = self->priv->action_group;
				gtk_widget_insert_action_group (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_widget_get_type (), GtkWidget), _tmp14_, G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, g_action_group_get_type (), GActionGroup));
				_g_object_unref0 (main);
			}
			_g_object_unref0 (_main_it);
		}
	}
	_tmp16_ = self->priv->action_group;
	g_action_map_add_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, g_action_map_get_type (), GActionMap), action);
}

static void
application_plugin_manager_application_impl_real_deregister_action (PluginApplication* base,
                                                                    GAction* action)
{
	ApplicationPluginManagerApplicationImpl * self;
	GSimpleActionGroup* _tmp0_;
	const gchar* _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (action, g_action_get_type ()));
	_tmp0_ = self->priv->action_group;
	_tmp1_ = g_action_get_name (action);
	g_action_map_remove_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_action_map_get_type (), GActionMap), _tmp1_);
}

static void
application_plugin_manager_application_impl_real_show_folder (PluginApplication* base,
                                                              PluginFolder* folder)
{
	ApplicationPluginManagerApplicationImpl * self;
	GearyFolder* target = NULL;
	ApplicationPluginManagerPluginGlobals* _tmp0_;
	ApplicationFolderStoreFactory* _tmp1_;
	ApplicationFolderStoreFactory* _tmp2_;
	GearyFolder* _tmp3_;
	GearyFolder* _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	g_return_if_fail (PLUGIN_IS_FOLDER (folder));
	_tmp0_ = self->globals;
	_tmp1_ = application_plugin_manager_plugin_globals_get_folders (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = application_folder_store_factory_to_engine_folder (_tmp2_, folder);
	target = _tmp3_;
	_tmp4_ = target;
	if (_tmp4_ != NULL) {
		ApplicationMainWindow* window = NULL;
		ApplicationClient* _tmp5_;
		ApplicationMainWindow* _tmp6_;
		ApplicationMainWindow* _tmp7_;
		GearyFolder* _tmp8_;
		_tmp5_ = self->backing;
		_tmp6_ = application_client_get_active_main_window (_tmp5_);
		window = _tmp6_;
		_tmp7_ = window;
		_tmp8_ = target;
		application_main_window_select_folder (_tmp7_, _tmp8_, TRUE, FALSE, NULL, NULL);
		_g_object_unref0 (window);
	}
	_g_object_unref0 (target);
}

static void
application_plugin_manager_application_impl_real_empty_folder_data_free (gpointer _data)
{
	ApplicationPluginManagerApplicationImplEmptyFolderData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->folder);
	_g_object_unref0 (_data_->self);
	g_slice_free (ApplicationPluginManagerApplicationImplEmptyFolderData, _data_);
}

static void
application_plugin_manager_application_impl_real_empty_folder (PluginApplication* base,
                                                               PluginFolder* folder,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_)
{
	ApplicationPluginManagerApplicationImpl * self;
	ApplicationPluginManagerApplicationImplEmptyFolderData* _data_;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	PluginFolder* _tmp1_;
	g_return_if_fail (PLUGIN_IS_FOLDER (folder));
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	_data_ = g_slice_new0 (ApplicationPluginManagerApplicationImplEmptyFolderData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, application_plugin_manager_application_impl_real_empty_folder_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (folder);
	_g_object_unref0 (_data_->folder);
	_data_->folder = _tmp1_;
	application_plugin_manager_application_impl_real_empty_folder_co (_data_);
}

static void
application_plugin_manager_application_impl_empty_folder_finish (PluginApplication* base,
                                                                 GAsyncResult* _res_,
                                                                 GError** error)
{
	ApplicationPluginManagerApplicationImplEmptyFolderData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		ApplicationPluginManagerApplicationImpl* self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->target);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static Block39Data*
block39_data_ref (Block39Data* _data39_)
{
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}

static void
block39_data_unref (void * _userdata_)
{
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		ApplicationPluginManagerApplicationImpl* self;
		self = _data39_->_data38_->self;
		_g_object_unref0 (_data39_->controller);
		block38_data_unref (_data39_->_data38_);
		_data39_->_data38_ = NULL;
		g_slice_free (Block39Data, _data39_);
	}
}

static void
___lambda146_ (Block39Data* _data39_,
               GObject* obj,
               GAsyncResult* res)
{
	Block38Data* _data38_;
	ApplicationPluginManagerApplicationImpl* self;
	GError* _inner_error0_ = NULL;
	_data38_ = _data39_->_data38_;
	self = _data38_->self;
	g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
	{
		ApplicationController* _tmp0_;
		_tmp0_ = _data39_->controller;
		application_controller_empty_folder_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		ApplicationController* _tmp1_;
		GearyFolder* _tmp2_;
		GearyAccount* _tmp3_;
		GearyAccount* _tmp4_;
		GearyAccountInformation* _tmp5_;
		GearyAccountInformation* _tmp6_;
		GError* _tmp7_;
		GearyAccountProblemReport* _tmp8_;
		GearyAccountProblemReport* _tmp9_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _data39_->controller;
		_tmp2_ = _data38_->target;
		_tmp3_ = geary_folder_get_account (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = geary_account_get_information (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _error_;
		_tmp8_ = geary_account_problem_report_new (_tmp6_, _tmp7_);
		_tmp9_ = _tmp8_;
		composer_application_interface_report_problem (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, COMPOSER_TYPE_APPLICATION_INTERFACE, ComposerApplicationInterface), G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GEARY_TYPE_PROBLEM_REPORT, GearyProblemReport));
		_g_object_unref0 (_tmp9_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
____lambda146__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda146_ (self, source_object, res);
	block39_data_unref (self);
}

static gboolean
application_plugin_manager_application_impl_real_empty_folder_co (ApplicationPluginManagerApplicationImplEmptyFolderData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data38_ = g_slice_new0 (Block38Data);
	_data_->_data38_->_ref_count_ = 1;
	_data_->_data38_->self = g_object_ref (_data_->self);
	_data_->_data38_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->backing;
	_data_->_tmp1_ = application_client_get_last_active_main_window (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _g_object_ref0 (_data_->_tmp2_);
	_data_->main = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->main;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp5_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_PERMISSION_DENIED, "Cannot prompt for permission");
		_data_->_inner_error0_ = _data_->_tmp5_;
		if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->main);
			block38_data_unref (_data_->_data38_);
			_data_->_data38_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->main);
			block38_data_unref (_data_->_data38_);
			_data_->_data38_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp6_ = _data_->self->globals;
	_data_->_tmp7_ = application_plugin_manager_plugin_globals_get_folders (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = application_folder_store_factory_to_engine_folder (_data_->_tmp8_, _data_->folder);
	_data_->_data38_->target = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->_data38_->target;
	if (_data_->_tmp10_ != NULL) {
		_data_->_data39_ = g_slice_new0 (Block39Data);
		_data_->_data39_->_ref_count_ = 1;
		_data_->_data39_->_data38_ = block38_data_ref (_data_->_data38_);
		_data_->_tmp11_ = _data_->main;
		_data_->_tmp12_ = _data_->_data38_->target;
		_data_->_tmp13_ = geary_folder_get_used_as (_data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		if (!application_main_window_prompt_empty_folder (_data_->_tmp11_, _data_->_tmp14_)) {
			_data_->_tmp15_ = g_error_new_literal (PLUGIN_ERROR, PLUGIN_ERROR_PERMISSION_DENIED, "Permission not granted");
			_data_->_inner_error0_ = _data_->_tmp15_;
			if (_data_->_inner_error0_->domain == PLUGIN_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				block39_data_unref (_data_->_data39_);
				_data_->_data39_ = NULL;
				_g_object_unref0 (_data_->main);
				block38_data_unref (_data_->_data38_);
				_data_->_data38_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				block39_data_unref (_data_->_data39_);
				_data_->_data39_ = NULL;
				_g_object_unref0 (_data_->main);
				block38_data_unref (_data_->_data38_);
				_data_->_data38_ = NULL;
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		_data_->_tmp16_ = _data_->self->backing;
		_data_->_tmp17_ = application_client_get_controller (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = _g_object_ref0 (_data_->_tmp18_);
		_data_->_data39_->controller = _data_->_tmp19_;
		_data_->_tmp20_ = _data_->_data39_->controller;
		_data_->_tmp21_ = _data_->_data38_->target;
		application_controller_empty_folder (_data_->_tmp20_, _data_->_tmp21_, ____lambda146__gasync_ready_callback, block39_data_ref (_data_->_data39_));
		block39_data_unref (_data_->_data39_);
		_data_->_data39_ = NULL;
	}
	_g_object_unref0 (_data_->main);
	block38_data_unref (_data_->_data38_);
	_data_->_data38_ = NULL;
	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_plugin_manager_application_impl_real_report_problem (PluginApplication* base,
                                                                 GearyProblemReport* problem)
{
	ApplicationPluginManagerApplicationImpl * self;
	ApplicationClient* _tmp0_;
	ApplicationController* _tmp1_;
	ApplicationController* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (problem, GEARY_TYPE_PROBLEM_REPORT));
	_tmp0_ = self->backing;
	_tmp1_ = application_client_get_controller (_tmp0_);
	_tmp2_ = _tmp1_;
	composer_application_interface_report_problem (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, COMPOSER_TYPE_APPLICATION_INTERFACE, ComposerApplicationInterface), problem);
}

void
application_plugin_manager_application_impl_engine_composer_registered (ApplicationPluginManagerApplicationImpl* self,
                                                                        ComposerWidget* registered)
{
	ApplicationPluginManagerComposerImpl* impl = NULL;
	ApplicationPluginManagerComposerImpl* _tmp0_;
	ApplicationPluginManagerComposerImpl* _tmp1_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL (self));
	g_return_if_fail (COMPOSER_IS_WIDGET (registered));
	_tmp0_ = application_plugin_manager_application_impl_to_plugin_composer (self, registered);
	impl = _tmp0_;
	_tmp1_ = impl;
	if (_tmp1_ != NULL) {
		ApplicationPluginManagerComposerImpl* _tmp2_;
		_tmp2_ = impl;
		g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_APPLICATION, PluginApplication), "composer-registered", G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, PLUGIN_TYPE_COMPOSER, PluginComposer));
	}
	_g_object_unref0 (impl);
}

void
application_plugin_manager_application_impl_engine_composer_deregistered (ApplicationPluginManagerApplicationImpl* self,
                                                                          ComposerWidget* deregistered)
{
	ApplicationPluginManagerComposerImpl* impl = NULL;
	GeeMap* _tmp0_;
	gpointer _tmp1_;
	ApplicationPluginManagerComposerImpl* _tmp2_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL (self));
	g_return_if_fail (COMPOSER_IS_WIDGET (deregistered));
	_tmp0_ = self->priv->composer_impls;
	_tmp1_ = gee_map_get (_tmp0_, deregistered);
	impl = (ApplicationPluginManagerComposerImpl*) _tmp1_;
	_tmp2_ = impl;
	if (_tmp2_ != NULL) {
		ApplicationPluginManagerComposerImpl* _tmp3_;
		GeeMap* _tmp4_;
		_tmp3_ = impl;
		g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_APPLICATION, PluginApplication), "composer-deregistered", G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, PLUGIN_TYPE_COMPOSER, PluginComposer));
		_tmp4_ = self->priv->composer_impls;
		gee_map_unset (_tmp4_, deregistered, NULL);
	}
	_g_object_unref0 (impl);
}

static ApplicationPluginManagerComposerImpl*
application_plugin_manager_application_impl_to_plugin_composer (ApplicationPluginManagerApplicationImpl* self,
                                                                ComposerWidget* widget)
{
	ApplicationPluginManagerComposerImpl* impl = NULL;
	ApplicationPluginManagerComposerImpl* result;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL (self), NULL);
	g_return_val_if_fail ((widget == NULL) || COMPOSER_IS_WIDGET (widget), NULL);
	impl = NULL;
	if (widget != NULL) {
		GeeMap* _tmp0_;
		gpointer _tmp1_;
		ApplicationPluginManagerComposerImpl* _tmp2_;
		_tmp0_ = self->priv->composer_impls;
		_tmp1_ = gee_map_get (_tmp0_, widget);
		_g_object_unref0 (impl);
		impl = (ApplicationPluginManagerComposerImpl*) _tmp1_;
		_tmp2_ = impl;
		if (_tmp2_ == NULL) {
			ApplicationPluginManagerComposerImpl* _tmp3_;
			GeeMap* _tmp4_;
			ApplicationPluginManagerComposerImpl* _tmp5_;
			_tmp3_ = application_plugin_manager_composer_impl_new (widget, self);
			_g_object_unref0 (impl);
			impl = _tmp3_;
			_tmp4_ = self->priv->composer_impls;
			_tmp5_ = impl;
			gee_map_set (_tmp4_, widget, _tmp5_);
		}
	}
	result = impl;
	return result;
}

static void
application_plugin_manager_application_impl_on_window_added (ApplicationPluginManagerApplicationImpl* self,
                                                             GtkWindow* window)
{
	GSimpleActionGroup* _tmp0_;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (window, gtk_window_get_type ()));
	_tmp0_ = self->priv->action_group;
	if (_tmp0_ != NULL) {
		ApplicationMainWindow* main = NULL;
		ApplicationMainWindow* _tmp1_;
		ApplicationMainWindow* _tmp2_;
		_tmp1_ = _g_object_ref0 (APPLICATION_IS_MAIN_WINDOW (window) ? ((ApplicationMainWindow*) window) : NULL);
		main = _tmp1_;
		_tmp2_ = main;
		if (_tmp2_ != NULL) {
			ApplicationMainWindow* _tmp3_;
			ApplicationPluginManagerPluginContext* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			GSimpleActionGroup* _tmp7_;
			_tmp3_ = main;
			_tmp4_ = self->plugin;
			_tmp5_ = application_plugin_manager_plugin_context_get_action_group_name (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = self->priv->action_group;
			gtk_widget_insert_action_group (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_widget_get_type (), GtkWidget), _tmp6_, G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, g_action_group_get_type (), GActionGroup));
		}
		_g_object_unref0 (main);
	}
}

static void
application_plugin_manager_application_impl_class_init (ApplicationPluginManagerApplicationImplClass * klass,
                                                        gpointer klass_data)
{
	application_plugin_manager_application_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManagerApplicationImpl_private_offset);
	G_OBJECT_CLASS (klass)->finalize = application_plugin_manager_application_impl_finalize;
}

static void
application_plugin_manager_application_impl_plugin_application_interface_init (PluginApplicationIface * iface,
                                                                               gpointer iface_data)
{
	application_plugin_manager_application_impl_plugin_application_parent_iface = g_type_interface_peek_parent (iface);
	iface->compose_blank = (void (*) (PluginApplication*, PluginAccount*, GAsyncReadyCallback, gpointer)) application_plugin_manager_application_impl_real_compose_blank;
	iface->compose_blank_finish = (PluginComposer* (*) (PluginApplication*, GAsyncResult*, GError**)) application_plugin_manager_application_impl_compose_blank_finish;
	iface->compose_with_context = (void (*) (PluginApplication*, PluginAccount*, PluginComposerContextType, PluginEmailIdentifier*, const gchar*, GAsyncReadyCallback, gpointer)) application_plugin_manager_application_impl_real_compose_with_context;
	iface->compose_with_context_finish = (PluginComposer* (*) (PluginApplication*, GAsyncResult*, GError**)) application_plugin_manager_application_impl_compose_with_context_finish;
	iface->register_action = (void (*) (PluginApplication*, GAction*)) application_plugin_manager_application_impl_real_register_action;
	iface->deregister_action = (void (*) (PluginApplication*, GAction*)) application_plugin_manager_application_impl_real_deregister_action;
	iface->show_folder = (void (*) (PluginApplication*, PluginFolder*)) application_plugin_manager_application_impl_real_show_folder;
	iface->empty_folder = (void (*) (PluginApplication*, PluginFolder*, GAsyncReadyCallback, gpointer)) application_plugin_manager_application_impl_real_empty_folder;
	iface->empty_folder_finish = (void (*) (PluginApplication*, GAsyncResult*, GError**)) application_plugin_manager_application_impl_empty_folder_finish;
	iface->report_problem = (void (*) (PluginApplication*, GearyProblemReport*)) application_plugin_manager_application_impl_real_report_problem;
}

static void
application_plugin_manager_application_impl_instance_init (ApplicationPluginManagerApplicationImpl * self,
                                                           gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = application_plugin_manager_application_impl_get_instance_private (self);
	self->priv->action_group = NULL;
	_tmp0_ = gee_hash_map_new (COMPOSER_TYPE_WIDGET, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->composer_impls = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_MAP, GeeMap);
}

static void
application_plugin_manager_application_impl_finalize (GObject * obj)
{
	ApplicationPluginManagerApplicationImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_PLUGIN_MANAGER_TYPE_APPLICATION_IMPL, ApplicationPluginManagerApplicationImpl);
	_g_object_unref0 (self->priv->action_group);
	_g_object_unref0 (self->priv->composer_impls);
	G_OBJECT_CLASS (application_plugin_manager_application_impl_parent_class)->finalize (obj);
}

/** A plugin-specific implementation of its Application object. */
static GType
application_plugin_manager_application_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerApplicationImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_application_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManagerApplicationImpl), 0, (GInstanceInitFunc) application_plugin_manager_application_impl_instance_init, NULL };
	static const GInterfaceInfo plugin_application_info = { (GInterfaceInitFunc) application_plugin_manager_application_impl_plugin_application_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_plugin_manager_application_impl_type_id;
	application_plugin_manager_application_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationPluginManagerApplicationImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_plugin_manager_application_impl_type_id, PLUGIN_TYPE_APPLICATION, &plugin_application_info);
	ApplicationPluginManagerApplicationImpl_private_offset = g_type_add_instance_private (application_plugin_manager_application_impl_type_id, sizeof (ApplicationPluginManagerApplicationImplPrivate));
	return application_plugin_manager_application_impl_type_id;
}

GType
application_plugin_manager_application_impl_get_type (void)
{
	static volatile gsize application_plugin_manager_application_impl_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_application_impl_type_id__once)) {
		GType application_plugin_manager_application_impl_type_id;
		application_plugin_manager_application_impl_type_id = application_plugin_manager_application_impl_get_type_once ();
		g_once_init_leave (&application_plugin_manager_application_impl_type_id__once, application_plugin_manager_application_impl_type_id);
	}
	return application_plugin_manager_application_impl_type_id__once;
}

static inline gpointer
application_plugin_manager_account_impl_get_instance_private (ApplicationPluginManagerAccountImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManagerAccountImpl_private_offset);
}

static const gchar*
application_plugin_manager_account_impl_real_get_display_name (PluginAccount* base)
{
	const gchar* result;
	ApplicationPluginManagerAccountImpl* self;
	ApplicationAccountContext* _tmp0_;
	GearyAccount* _tmp1_;
	GearyAccount* _tmp2_;
	GearyAccountInformation* _tmp3_;
	GearyAccountInformation* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImpl);
	_tmp0_ = self->priv->_backing;
	_tmp1_ = application_account_context_get_account (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_account_get_information (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = geary_account_information_get_display_name (_tmp4_);
	_tmp6_ = _tmp5_;
	result = _tmp6_;
	return result;
}

ApplicationAccountContext*
application_plugin_manager_account_impl_get_backing (ApplicationPluginManagerAccountImpl* self)
{
	ApplicationAccountContext* result;
	ApplicationAccountContext* _tmp0_;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (self), NULL);
	_tmp0_ = self->priv->_backing;
	result = _tmp0_;
	return result;
}

static void
application_plugin_manager_account_impl_set_backing (ApplicationPluginManagerAccountImpl* self,
                                                     ApplicationAccountContext* value)
{
	ApplicationAccountContext* old_value;
	g_return_if_fail (APPLICATION_PLUGIN_MANAGER_IS_ACCOUNT_IMPL (self));
	old_value = application_plugin_manager_account_impl_get_backing (self);
	if (old_value != value) {
		ApplicationAccountContext* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_backing);
		self->priv->_backing = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, application_plugin_manager_account_impl_properties[APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY]);
	}
}

ApplicationPluginManagerAccountImpl*
application_plugin_manager_account_impl_construct (GType object_type,
                                                   ApplicationAccountContext* backing)
{
	ApplicationPluginManagerAccountImpl * self = NULL;
	g_return_val_if_fail (APPLICATION_IS_ACCOUNT_CONTEXT (backing), NULL);
	self = (ApplicationPluginManagerAccountImpl*) geary_base_object_construct (object_type);
	application_plugin_manager_account_impl_set_backing (self, backing);
	return self;
}

ApplicationPluginManagerAccountImpl*
application_plugin_manager_account_impl_new (ApplicationAccountContext* backing)
{
	return application_plugin_manager_account_impl_construct (APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, backing);
}

static void
application_plugin_manager_account_impl_class_init (ApplicationPluginManagerAccountImplClass * klass,
                                                    gpointer klass_data)
{
	application_plugin_manager_account_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManagerAccountImpl_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_plugin_manager_account_impl_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_application_plugin_manager_account_impl_set_property;
	G_OBJECT_CLASS (klass)->finalize = application_plugin_manager_account_impl_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_DISPLAY_NAME_PROPERTY, application_plugin_manager_account_impl_properties[APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/** The underlying backing account context for this account. */
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY, application_plugin_manager_account_impl_properties[APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY] = g_param_spec_object ("backing", "backing", "backing", APPLICATION_TYPE_ACCOUNT_CONTEXT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
application_plugin_manager_account_impl_plugin_account_interface_init (PluginAccountIface * iface,
                                                                       gpointer iface_data)
{
	application_plugin_manager_account_impl_plugin_account_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_display_name = application_plugin_manager_account_impl_real_get_display_name;
}

static void
application_plugin_manager_account_impl_instance_init (ApplicationPluginManagerAccountImpl * self,
                                                       gpointer klass)
{
	self->priv = application_plugin_manager_account_impl_get_instance_private (self);
}

static void
application_plugin_manager_account_impl_finalize (GObject * obj)
{
	ApplicationPluginManagerAccountImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImpl);
	_g_object_unref0 (self->priv->_backing);
	G_OBJECT_CLASS (application_plugin_manager_account_impl_parent_class)->finalize (obj);
}

static GType
application_plugin_manager_account_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerAccountImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_account_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManagerAccountImpl), 0, (GInstanceInitFunc) application_plugin_manager_account_impl_instance_init, NULL };
	static const GInterfaceInfo plugin_account_info = { (GInterfaceInitFunc) application_plugin_manager_account_impl_plugin_account_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_plugin_manager_account_impl_type_id;
	application_plugin_manager_account_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationPluginManagerAccountImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_plugin_manager_account_impl_type_id, PLUGIN_TYPE_ACCOUNT, &plugin_account_info);
	ApplicationPluginManagerAccountImpl_private_offset = g_type_add_instance_private (application_plugin_manager_account_impl_type_id, sizeof (ApplicationPluginManagerAccountImplPrivate));
	return application_plugin_manager_account_impl_type_id;
}

GType
application_plugin_manager_account_impl_get_type (void)
{
	static volatile gsize application_plugin_manager_account_impl_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_account_impl_type_id__once)) {
		GType application_plugin_manager_account_impl_type_id;
		application_plugin_manager_account_impl_type_id = application_plugin_manager_account_impl_get_type_once ();
		g_once_init_leave (&application_plugin_manager_account_impl_type_id__once, application_plugin_manager_account_impl_type_id);
	}
	return application_plugin_manager_account_impl_type_id__once;
}

static void
_vala_application_plugin_manager_account_impl_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	ApplicationPluginManagerAccountImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImpl);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_DISPLAY_NAME_PROPERTY:
		g_value_set_string (value, plugin_account_get_display_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_ACCOUNT, PluginAccount)));
		break;
		case APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY:
		g_value_set_object (value, application_plugin_manager_account_impl_get_backing (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_application_plugin_manager_account_impl_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	ApplicationPluginManagerAccountImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_PLUGIN_MANAGER_TYPE_ACCOUNT_IMPL, ApplicationPluginManagerAccountImpl);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_ACCOUNT_IMPL_BACKING_PROPERTY:
		application_plugin_manager_account_impl_set_backing (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
application_plugin_manager_composer_impl_get_instance_private (ApplicationPluginManagerComposerImpl* self)
{
	return G_STRUCT_MEMBER_P (self, ApplicationPluginManagerComposerImpl_private_offset);
}

static gboolean
application_plugin_manager_composer_impl_real_get_can_send (PluginComposer* base)
{
	gboolean result;
	ApplicationPluginManagerComposerImpl* self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	result = self->priv->_can_send;
	return result;
}

static void
application_plugin_manager_composer_impl_real_set_can_send (PluginComposer* base,
                                                            gboolean value)
{
	ApplicationPluginManagerComposerImpl* self;
	gboolean old_value;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	old_value = application_plugin_manager_composer_impl_real_get_can_send (base);
	if (old_value != value) {
		self->priv->_can_send = value;
		g_object_notify_by_pspec ((GObject *) self, application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY]);
	}
}

static PluginAccount*
application_plugin_manager_composer_impl_real_get_sender_context (PluginComposer* base)
{
	PluginAccount* result;
	ApplicationPluginManagerComposerImpl* self;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	ApplicationPluginManagerPluginGlobals* _tmp1_;
	GeeMap* _tmp2_;
	ComposerWidget* _tmp3_;
	ApplicationAccountContext* _tmp4_;
	ApplicationAccountContext* _tmp5_;
	gpointer _tmp6_;
	PluginAccount* _tmp7_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	_tmp0_ = self->priv->application;
	_tmp1_ = _tmp0_->globals;
	_tmp2_ = _tmp1_->accounts;
	_tmp3_ = self->priv->backing;
	_tmp4_ = composer_widget_get_sender_context (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = gee_map_get (_tmp2_, _tmp5_);
	_g_object_unref0 (self->priv->_sender_context);
	self->priv->_sender_context = G_TYPE_CHECK_INSTANCE_CAST ((ApplicationPluginManagerAccountImpl*) _tmp6_, PLUGIN_TYPE_ACCOUNT, PluginAccount);
	_tmp7_ = self->priv->_sender_context;
	result = _tmp7_;
	return result;
}

static const gchar*
application_plugin_manager_composer_impl_real_get_action_group_name (PluginComposer* base)
{
	const gchar* result;
	ApplicationPluginManagerComposerImpl* self;
	const gchar* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	_tmp0_ = self->priv->_action_group_name;
	result = _tmp0_;
	return result;
}

static PluginFolder*
application_plugin_manager_composer_impl_real_get_save_to (PluginComposer* base)
{
	PluginFolder* result;
	ApplicationPluginManagerComposerImpl* self;
	PluginFolder* _tmp0_ = NULL;
	ComposerWidget* _tmp1_;
	GearyFolder* _tmp2_;
	GearyFolder* _tmp3_;
	PluginFolder* _tmp12_;
	PluginFolder* _tmp13_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	_tmp1_ = self->priv->backing;
	_tmp2_ = composer_widget_get_save_to (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		ApplicationPluginManagerApplicationImpl* _tmp4_;
		ApplicationPluginManagerPluginGlobals* _tmp5_;
		ApplicationFolderStoreFactory* _tmp6_;
		ApplicationFolderStoreFactory* _tmp7_;
		ComposerWidget* _tmp8_;
		GearyFolder* _tmp9_;
		GearyFolder* _tmp10_;
		PluginFolder* _tmp11_;
		_tmp4_ = self->priv->application;
		_tmp5_ = _tmp4_->globals;
		_tmp6_ = application_plugin_manager_plugin_globals_get_folders (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = self->priv->backing;
		_tmp9_ = composer_widget_get_save_to (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = application_folder_store_factory_to_plugin_folder (_tmp7_, _tmp10_);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp11_;
	} else {
		_g_object_unref0 (_tmp0_);
		_tmp0_ = NULL;
	}
	_tmp12_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->_save_to);
	self->priv->_save_to = _tmp12_;
	_tmp13_ = self->priv->_save_to;
	result = _tmp13_;
	_g_object_unref0 (_tmp0_);
	return result;
}

ApplicationPluginManagerComposerImpl*
application_plugin_manager_composer_impl_construct (GType object_type,
                                                    ComposerWidget* backing,
                                                    ApplicationPluginManagerApplicationImpl* application)
{
	ApplicationPluginManagerComposerImpl * self = NULL;
	ComposerWidget* _tmp0_;
	ApplicationPluginManagerPluginContext* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_val_if_fail (COMPOSER_IS_WIDGET (backing), NULL);
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_APPLICATION_IMPL (application), NULL);
	self = (ApplicationPluginManagerComposerImpl*) geary_base_object_construct (object_type);
	_tmp0_ = _g_object_ref0 (backing);
	_g_object_unref0 (self->priv->backing);
	self->priv->backing = _tmp0_;
	self->priv->application = application;
	_tmp1_ = application->plugin;
	_tmp2_ = application_plugin_manager_plugin_context_get_action_group_name (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, "-cmp", NULL);
	_g_free0 (self->priv->_action_group_name);
	self->priv->_action_group_name = _tmp4_;
	g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (backing, G_TYPE_OBJECT, GObject), "can-send", G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "can-send", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

ApplicationPluginManagerComposerImpl*
application_plugin_manager_composer_impl_new (ComposerWidget* backing,
                                              ApplicationPluginManagerApplicationImpl* application)
{
	return application_plugin_manager_composer_impl_construct (APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, backing, application);
}

static void
application_plugin_manager_composer_impl_real_save_to_folder (PluginComposer* base,
                                                              PluginFolder* location)
{
	ApplicationPluginManagerComposerImpl * self;
	GearyFolder* engine = NULL;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	ApplicationPluginManagerPluginGlobals* _tmp1_;
	ApplicationFolderStoreFactory* _tmp2_;
	ApplicationFolderStoreFactory* _tmp3_;
	GearyFolder* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GearyFolder* _tmp6_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail ((location == NULL) || PLUGIN_IS_FOLDER (location));
	_tmp0_ = self->priv->application;
	_tmp1_ = _tmp0_->globals;
	_tmp2_ = application_plugin_manager_plugin_globals_get_folders (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = application_folder_store_factory_to_engine_folder (_tmp3_, location);
	engine = _tmp4_;
	_tmp6_ = engine;
	if (_tmp6_ != NULL) {
		GearyFolder* _tmp7_;
		GearyAccount* _tmp8_;
		GearyAccount* _tmp9_;
		ComposerWidget* _tmp10_;
		ApplicationAccountContext* _tmp11_;
		ApplicationAccountContext* _tmp12_;
		GearyAccount* _tmp13_;
		GearyAccount* _tmp14_;
		_tmp7_ = engine;
		_tmp8_ = geary_folder_get_account (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = self->priv->backing;
		_tmp11_ = composer_widget_get_sender_context (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = application_account_context_get_account (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp5_ = _tmp9_ == _tmp14_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		ComposerWidget* _tmp15_;
		GearyFolder* _tmp16_;
		_tmp15_ = self->priv->backing;
		_tmp16_ = engine;
		composer_widget_set_save_to_override (_tmp15_, _tmp16_);
	}
	_g_object_unref0 (engine);
}

static void
application_plugin_manager_composer_impl_real_present (PluginComposer* base)
{
	ApplicationPluginManagerComposerImpl * self;
	ApplicationPluginManagerApplicationImpl* _tmp0_;
	ApplicationClient* _tmp1_;
	ApplicationController* _tmp2_;
	ApplicationController* _tmp3_;
	ComposerWidget* _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	_tmp0_ = self->priv->application;
	_tmp1_ = _tmp0_->backing;
	_tmp2_ = application_client_get_controller (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->backing;
	application_controller_present_composer (_tmp3_, _tmp4_);
}

static void
application_plugin_manager_composer_impl_real_insert_text (PluginComposer* base,
                                                           const gchar* plain_text)
{
	ApplicationPluginManagerComposerImpl * self;
	GtkEntry* entry = NULL;
	ComposerWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkEntry* _tmp3_;
	GtkEntry* _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail (plain_text != NULL);
	_tmp0_ = self->priv->backing;
	_tmp1_ = composer_widget_get_focused_input_widget (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gtk_entry_get_type ()) ? ((GtkEntry*) _tmp2_) : NULL);
	entry = _tmp3_;
	_tmp4_ = entry;
	if (_tmp4_ != NULL) {
		GtkEntry* _tmp5_;
		_tmp5_ = entry;
		g_signal_emit_by_name (_tmp5_, "insert-at-cursor", plain_text);
	} else {
		ComposerWidget* _tmp6_;
		ComposerEditor* _tmp7_;
		ComposerEditor* _tmp8_;
		ComposerWebView* _tmp9_;
		ComposerWebView* _tmp10_;
		_tmp6_ = self->priv->backing;
		_tmp7_ = composer_widget_get_editor (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = composer_editor_get_body (_tmp8_);
		_tmp10_ = _tmp9_;
		composer_web_view_insert_text (_tmp10_, plain_text);
	}
	_g_object_unref0 (entry);
}

static void
application_plugin_manager_composer_impl_real_register_action (PluginComposer* base,
                                                               GAction* action)
{
	ApplicationPluginManagerComposerImpl * self;
	GSimpleActionGroup* _tmp0_;
	GSimpleActionGroup* _tmp6_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (action, g_action_get_type ()));
	_tmp0_ = self->priv->action_group;
	if (_tmp0_ == NULL) {
		GSimpleActionGroup* _tmp1_;
		ComposerWidget* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		GSimpleActionGroup* _tmp5_;
		_tmp1_ = g_simple_action_group_new ();
		_g_object_unref0 (self->priv->action_group);
		self->priv->action_group = _tmp1_;
		_tmp2_ = self->priv->backing;
		_tmp3_ = plugin_composer_get_action_group_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer));
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->action_group;
		gtk_widget_insert_action_group (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget), _tmp4_, G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, g_action_group_get_type (), GActionGroup));
	}
	_tmp6_ = self->priv->action_group;
	g_action_map_add_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, g_action_map_get_type (), GActionMap), action);
}

static void
application_plugin_manager_composer_impl_real_deregister_action (PluginComposer* base,
                                                                 GAction* action)
{
	ApplicationPluginManagerComposerImpl * self;
	GSimpleActionGroup* _tmp0_;
	const gchar* _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (action, g_action_get_type ()));
	_tmp0_ = self->priv->action_group;
	_tmp1_ = g_action_get_name (action);
	g_action_map_remove_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_action_map_get_type (), GActionMap), _tmp1_);
}

static void
application_plugin_manager_composer_impl_real_append_menu_item (PluginComposer* base,
                                                                PluginActionable* menu_item)
{
	ApplicationPluginManagerComposerImpl * self;
	GMenu* _tmp0_;
	GMenu* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GAction* _tmp13_;
	GAction* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	GVariant* _tmp19_;
	GVariant* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail (PLUGIN_IS_ACTIONABLE (menu_item));
	_tmp0_ = self->priv->menu_items;
	if (_tmp0_ == NULL) {
		GMenu* _tmp1_;
		ComposerWidget* _tmp2_;
		ComposerEditor* _tmp3_;
		ComposerEditor* _tmp4_;
		GMenu* _tmp5_;
		_tmp1_ = g_menu_new ();
		_g_object_unref0 (self->priv->menu_items);
		self->priv->menu_items = _tmp1_;
		_tmp2_ = self->priv->backing;
		_tmp3_ = composer_widget_get_editor (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->menu_items;
		composer_editor_insert_menu_section (_tmp4_, G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, g_menu_model_get_type (), GMenuModel));
	}
	_tmp6_ = self->priv->menu_items;
	_tmp7_ = plugin_actionable_get_label (menu_item);
	_tmp8_ = _tmp7_;
	_tmp9_ = plugin_composer_get_action_group_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer));
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strconcat (_tmp10_, ".", NULL);
	_tmp12_ = _tmp11_;
	_tmp13_ = plugin_actionable_get_action (menu_item);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_action_get_name (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strconcat (_tmp12_, _tmp16_, NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = plugin_actionable_get_action_target (menu_item);
	_tmp20_ = _tmp19_;
	_tmp21_ = g_action_print_detailed_name (_tmp18_, _tmp20_);
	_tmp22_ = _tmp21_;
	g_menu_append (_tmp6_, _tmp8_, _tmp22_);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp12_);
}

static void
application_plugin_manager_composer_impl_real_set_action_bar (PluginComposer* base,
                                                              PluginActionBar* plugin_bar)
{
	ApplicationPluginManagerComposerImpl * self;
	GtkActionBar* _tmp0_;
	GtkActionBar* _tmp3_;
	GtkBox* centre = NULL;
	PluginActionBarPosition* _tmp4_;
	GtkActionBar* _tmp25_;
	ComposerWidget* _tmp26_;
	ComposerEditor* _tmp27_;
	ComposerEditor* _tmp28_;
	GtkActionBar* _tmp29_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	g_return_if_fail (PLUGIN_IS_ACTION_BAR (plugin_bar));
	_tmp0_ = self->priv->action_bar;
	if (_tmp0_ != NULL) {
		GtkActionBar* _tmp1_;
		GtkActionBar* _tmp2_;
		_tmp1_ = self->priv->action_bar;
		gtk_widget_hide (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_widget_get_type (), GtkWidget));
		_tmp2_ = self->priv->action_bar;
		gtk_widget_destroy (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget));
		_g_object_unref0 (self->priv->action_bar);
		self->priv->action_bar = NULL;
	}
	_tmp3_ = (GtkActionBar*) gtk_action_bar_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->action_bar);
	self->priv->action_bar = _tmp3_;
	centre = NULL;
	_tmp4_ = g_new0 (PluginActionBarPosition, 3);
	_tmp4_[0] = PLUGIN_ACTION_BAR_POSITION_START;
	_tmp4_[1] = PLUGIN_ACTION_BAR_POSITION_CENTRE;
	_tmp4_[2] = PLUGIN_ACTION_BAR_POSITION_END;
	{
		PluginActionBarPosition* pos_collection = NULL;
		gint pos_collection_length1 = 0;
		gint _pos_collection_size_ = 0;
		gint pos_it = 0;
		pos_collection = _tmp4_;
		pos_collection_length1 = 3;
		for (pos_it = 0; pos_it < pos_collection_length1; pos_it = pos_it + 1) {
			PluginActionBarPosition pos = 0;
			pos = pos_collection[pos_it];
			{
				{
					GeeList* _item_list = NULL;
					GeeList* _tmp5_;
					gint _item_size = 0;
					GeeList* _tmp6_;
					gint _tmp7_;
					gint _tmp8_;
					gint _item_index = 0;
					_tmp5_ = plugin_action_bar_get_items (plugin_bar, pos);
					_item_list = _tmp5_;
					_tmp6_ = _item_list;
					_tmp7_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GEE_TYPE_COLLECTION, GeeCollection));
					_tmp8_ = _tmp7_;
					_item_size = _tmp8_;
					_item_index = -1;
					while (TRUE) {
						gint _tmp9_;
						gint _tmp10_;
						PluginActionBarItem* item = NULL;
						GeeList* _tmp11_;
						gpointer _tmp12_;
						GtkWidget* widget = NULL;
						PluginActionBarItem* _tmp13_;
						GtkWidget* _tmp14_;
						_item_index = _item_index + 1;
						_tmp9_ = _item_index;
						_tmp10_ = _item_size;
						if (!(_tmp9_ < _tmp10_)) {
							break;
						}
						_tmp11_ = _item_list;
						_tmp12_ = gee_list_get (_tmp11_, _item_index);
						item = (PluginActionBarItem*) _tmp12_;
						_tmp13_ = item;
						_tmp14_ = application_plugin_manager_composer_impl_widget_for_item (self, _tmp13_);
						widget = _tmp14_;
						switch (pos) {
							case PLUGIN_ACTION_BAR_POSITION_START:
							{
								GtkActionBar* _tmp15_;
								GtkWidget* _tmp16_;
								_tmp15_ = self->priv->action_bar;
								_tmp16_ = widget;
								gtk_action_bar_pack_start (_tmp15_, _tmp16_);
								break;
							}
							case PLUGIN_ACTION_BAR_POSITION_CENTRE:
							{
								GtkBox* _tmp17_;
								GtkBox* _tmp21_;
								GtkWidget* _tmp22_;
								_tmp17_ = centre;
								if (_tmp17_ == NULL) {
									GtkBox* _tmp18_;
									GtkActionBar* _tmp19_;
									GtkBox* _tmp20_;
									_tmp18_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
									g_object_ref_sink (_tmp18_);
									_g_object_unref0 (centre);
									centre = _tmp18_;
									_tmp19_ = self->priv->action_bar;
									_tmp20_ = centre;
									gtk_action_bar_set_center_widget (_tmp19_, G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, gtk_widget_get_type (), GtkWidget));
								}
								_tmp21_ = centre;
								_tmp22_ = widget;
								gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, gtk_container_get_type (), GtkContainer), _tmp22_);
								break;
							}
							case PLUGIN_ACTION_BAR_POSITION_END:
							{
								GtkActionBar* _tmp23_;
								GtkWidget* _tmp24_;
								_tmp23_ = self->priv->action_bar;
								_tmp24_ = widget;
								gtk_action_bar_pack_end (_tmp23_, _tmp24_);
								break;
							}
							default:
							break;
						}
						_g_object_unref0 (widget);
						_g_object_unref0 (item);
					}
					_g_object_unref0 (_item_list);
				}
			}
		}
		pos_collection = (g_free (pos_collection), NULL);
	}
	_tmp25_ = self->priv->action_bar;
	gtk_widget_show_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, gtk_widget_get_type (), GtkWidget));
	_tmp26_ = self->priv->backing;
	_tmp27_ = composer_widget_get_editor (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = self->priv->action_bar;
	composer_editor_add_action_bar (_tmp28_, _tmp29_);
	_g_object_unref0 (centre);
}

static GtkWidget*
application_plugin_manager_composer_impl_widget_for_item (ApplicationPluginManagerComposerImpl* self,
                                                          PluginActionBarItem* item)
{
	GType item_type = G_TYPE_NONE;
	GtkWidget* result;
	g_return_val_if_fail (APPLICATION_PLUGIN_MANAGER_IS_COMPOSER_IMPL (self), NULL);
	g_return_val_if_fail (PLUGIN_ACTION_BAR_IS_ITEM (item), NULL);
	item_type = G_TYPE_FROM_INSTANCE (G_TYPE_CHECK_INSTANCE_CAST (item, G_TYPE_OBJECT, GObject));
	if (item_type == PLUGIN_ACTION_BAR_TYPE_LABEL_ITEM) {
		GtkLabel* label = NULL;
		const gchar* _tmp0_;
		const gchar* _tmp1_;
		GtkLabel* _tmp2_;
		_tmp0_ = plugin_action_bar_label_item_get_text (G_TYPE_CHECK_INSTANCE_CAST (item, PLUGIN_ACTION_BAR_TYPE_LABEL_ITEM, PluginActionBarLabelItem));
		_tmp1_ = _tmp0_;
		_tmp2_ = (GtkLabel*) gtk_label_new (_tmp1_);
		g_object_ref_sink (_tmp2_);
		label = _tmp2_;
		result = G_TYPE_CHECK_INSTANCE_CAST (label, gtk_widget_get_type (), GtkWidget);
		return result;
	}
	if (item_type == PLUGIN_ACTION_BAR_TYPE_BUTTON_ITEM) {
		PluginActionBarButtonItem* button_item = NULL;
		PluginActionBarButtonItem* _tmp3_;
		GtkButton* button = NULL;
		PluginActionBarButtonItem* _tmp4_;
		PluginActionable* _tmp5_;
		PluginActionable* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		GtkButton* _tmp9_;
		GtkButton* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		PluginActionBarButtonItem* _tmp15_;
		PluginActionable* _tmp16_;
		PluginActionable* _tmp17_;
		GAction* _tmp18_;
		GAction* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		PluginActionBarButtonItem* _tmp24_;
		PluginActionable* _tmp25_;
		PluginActionable* _tmp26_;
		GVariant* _tmp27_;
		GVariant* _tmp28_;
		_tmp3_ = _g_object_ref0 (PLUGIN_ACTION_BAR_IS_BUTTON_ITEM (item) ? ((PluginActionBarButtonItem*) item) : NULL);
		button_item = _tmp3_;
		_tmp4_ = button_item;
		_tmp5_ = plugin_action_bar_button_item_get_action (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = plugin_actionable_get_label (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = (GtkButton*) gtk_button_new_with_label (_tmp8_);
		g_object_ref_sink (_tmp9_);
		button = _tmp9_;
		_tmp10_ = button;
		_tmp11_ = plugin_composer_get_action_group_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer));
		_tmp12_ = _tmp11_;
		_tmp13_ = g_strconcat (_tmp12_, ".", NULL);
		_tmp14_ = _tmp13_;
		_tmp15_ = button_item;
		_tmp16_ = plugin_action_bar_button_item_get_action (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = plugin_actionable_get_action (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_action_get_name (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = g_strconcat (_tmp14_, _tmp21_, NULL);
		_tmp23_ = _tmp22_;
		gtk_actionable_set_action_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_actionable_get_type (), GtkActionable), _tmp23_);
		_g_free0 (_tmp23_);
		_g_free0 (_tmp14_);
		_tmp24_ = button_item;
		_tmp25_ = plugin_action_bar_button_item_get_action (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = plugin_actionable_get_action_target (_tmp26_);
		_tmp28_ = _tmp27_;
		if (_tmp28_ != NULL) {
			GtkButton* _tmp29_;
			PluginActionBarButtonItem* _tmp30_;
			PluginActionable* _tmp31_;
			PluginActionable* _tmp32_;
			GVariant* _tmp33_;
			GVariant* _tmp34_;
			_tmp29_ = button;
			_tmp30_ = button_item;
			_tmp31_ = plugin_action_bar_button_item_get_action (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = plugin_actionable_get_action_target (_tmp32_);
			_tmp34_ = _tmp33_;
			gtk_actionable_set_action_target_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, gtk_actionable_get_type (), GtkActionable), _tmp34_);
		}
		result = G_TYPE_CHECK_INSTANCE_CAST (button, gtk_widget_get_type (), GtkWidget);
		_g_object_unref0 (button_item);
		return result;
	}
	if (item_type == PLUGIN_ACTION_BAR_TYPE_MENU_ITEM) {
		PluginActionBarMenuItem* menu_item = NULL;
		PluginActionBarMenuItem* _tmp35_;
		GtkBox* label = NULL;
		GtkBox* _tmp36_;
		GtkBox* _tmp37_;
		PluginActionBarMenuItem* _tmp38_;
		const gchar* _tmp39_;
		const gchar* _tmp40_;
		GtkLabel* _tmp41_;
		GtkLabel* _tmp42_;
		GtkBox* _tmp43_;
		GtkImage* _tmp44_;
		GtkImage* _tmp45_;
		GtkMenuButton* button = NULL;
		GtkMenuButton* _tmp46_;
		GtkMenuButton* _tmp47_;
		GtkMenuButton* _tmp48_;
		GtkMenuButton* _tmp49_;
		PluginActionBarMenuItem* _tmp50_;
		GMenuModel* _tmp51_;
		GMenuModel* _tmp52_;
		GtkMenuButton* _tmp53_;
		GtkBox* _tmp54_;
		_tmp35_ = _g_object_ref0 (PLUGIN_ACTION_BAR_IS_MENU_ITEM (item) ? ((PluginActionBarMenuItem*) item) : NULL);
		menu_item = _tmp35_;
		_tmp36_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
		g_object_ref_sink (_tmp36_);
		label = _tmp36_;
		_tmp37_ = label;
		_tmp38_ = menu_item;
		_tmp39_ = plugin_action_bar_menu_item_get_label (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = (GtkLabel*) gtk_label_new (_tmp40_);
		g_object_ref_sink (_tmp41_);
		_tmp42_ = _tmp41_;
		gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, gtk_widget_get_type (), GtkWidget));
		_g_object_unref0 (_tmp42_);
		_tmp43_ = label;
		_tmp44_ = (GtkImage*) gtk_image_new_from_icon_name ("pan-up-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
		g_object_ref_sink (_tmp44_);
		_tmp45_ = _tmp44_;
		gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp43_, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp45_, gtk_widget_get_type (), GtkWidget));
		_g_object_unref0 (_tmp45_);
		_tmp46_ = (GtkMenuButton*) gtk_menu_button_new ();
		g_object_ref_sink (_tmp46_);
		button = _tmp46_;
		_tmp47_ = button;
		gtk_menu_button_set_direction (_tmp47_, GTK_ARROW_UP);
		_tmp48_ = button;
		gtk_menu_button_set_use_popover (_tmp48_, TRUE);
		_tmp49_ = button;
		_tmp50_ = menu_item;
		_tmp51_ = plugin_action_bar_menu_item_get_menu (_tmp50_);
		_tmp52_ = _tmp51_;
		gtk_menu_button_set_menu_model (_tmp49_, _tmp52_);
		_tmp53_ = button;
		_tmp54_ = label;
		gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp54_, gtk_widget_get_type (), GtkWidget));
		result = G_TYPE_CHECK_INSTANCE_CAST (button, gtk_widget_get_type (), GtkWidget);
		_g_object_unref0 (label);
		_g_object_unref0 (menu_item);
		return result;
	}
	if (item_type == PLUGIN_ACTION_BAR_TYPE_GROUP_ITEM) {
		PluginActionBarGroupItem* group_items = NULL;
		PluginActionBarGroupItem* _tmp55_;
		GtkBox* box = NULL;
		GtkBox* _tmp56_;
		GtkBox* _tmp57_;
		GtkStyleContext* _tmp58_;
		_tmp55_ = _g_object_ref0 (PLUGIN_ACTION_BAR_IS_GROUP_ITEM (item) ? ((PluginActionBarGroupItem*) item) : NULL);
		group_items = _tmp55_;
		_tmp56_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
		g_object_ref_sink (_tmp56_);
		box = _tmp56_;
		_tmp57_ = box;
		_tmp58_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (_tmp57_, gtk_widget_get_type (), GtkWidget));
		gtk_style_context_add_class (_tmp58_, GTK_STYLE_CLASS_LINKED);
		{
			GeeList* _group_item_list = NULL;
			PluginActionBarGroupItem* _tmp59_;
			GeeList* _tmp60_;
			gint _group_item_size = 0;
			GeeList* _tmp61_;
			gint _tmp62_;
			gint _tmp63_;
			gint _group_item_index = 0;
			_tmp59_ = group_items;
			_tmp60_ = plugin_action_bar_group_item_get_items (_tmp59_);
			_group_item_list = _tmp60_;
			_tmp61_ = _group_item_list;
			_tmp62_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp61_, GEE_TYPE_COLLECTION, GeeCollection));
			_tmp63_ = _tmp62_;
			_group_item_size = _tmp63_;
			_group_item_index = -1;
			while (TRUE) {
				gint _tmp64_;
				gint _tmp65_;
				PluginActionBarItem* group_item = NULL;
				GeeList* _tmp66_;
				gpointer _tmp67_;
				GtkBox* _tmp68_;
				PluginActionBarItem* _tmp69_;
				GtkWidget* _tmp70_;
				GtkWidget* _tmp71_;
				_group_item_index = _group_item_index + 1;
				_tmp64_ = _group_item_index;
				_tmp65_ = _group_item_size;
				if (!(_tmp64_ < _tmp65_)) {
					break;
				}
				_tmp66_ = _group_item_list;
				_tmp67_ = gee_list_get (_tmp66_, _group_item_index);
				group_item = (PluginActionBarItem*) _tmp67_;
				_tmp68_ = box;
				_tmp69_ = group_item;
				_tmp70_ = application_plugin_manager_composer_impl_widget_for_item (self, _tmp69_);
				_tmp71_ = _tmp70_;
				gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp68_, gtk_container_get_type (), GtkContainer), _tmp71_);
				_g_object_unref0 (_tmp71_);
				_g_object_unref0 (group_item);
			}
			_g_object_unref0 (_group_item_list);
		}
		result = G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget);
		_g_object_unref0 (group_items);
		return result;
	}
	result = NULL;
	return result;
}

static void
application_plugin_manager_composer_impl_class_init (ApplicationPluginManagerComposerImplClass * klass,
                                                     gpointer klass_data)
{
	application_plugin_manager_composer_impl_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManagerComposerImpl_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_plugin_manager_composer_impl_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_application_plugin_manager_composer_impl_set_property;
	G_OBJECT_CLASS (klass)->finalize = application_plugin_manager_composer_impl_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY, application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY] = g_param_spec_boolean ("can-send", "can-send", "can-send", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SENDER_CONTEXT_PROPERTY, application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SENDER_CONTEXT_PROPERTY] = g_param_spec_object ("sender-context", "sender-context", "sender-context", PLUGIN_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_ACTION_GROUP_NAME_PROPERTY, application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_ACTION_GROUP_NAME_PROPERTY] = g_param_spec_string ("action-group-name", "action-group-name", "action-group-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SAVE_TO_PROPERTY, application_plugin_manager_composer_impl_properties[APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SAVE_TO_PROPERTY] = g_param_spec_object ("save-to", "save-to", "save-to", PLUGIN_TYPE_FOLDER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
application_plugin_manager_composer_impl_plugin_composer_interface_init (PluginComposerIface * iface,
                                                                         gpointer iface_data)
{
	application_plugin_manager_composer_impl_plugin_composer_parent_iface = g_type_interface_peek_parent (iface);
	iface->save_to_folder = (void (*) (PluginComposer*, PluginFolder*)) application_plugin_manager_composer_impl_real_save_to_folder;
	iface->present = (void (*) (PluginComposer*)) application_plugin_manager_composer_impl_real_present;
	iface->insert_text = (void (*) (PluginComposer*, const gchar*)) application_plugin_manager_composer_impl_real_insert_text;
	iface->register_action = (void (*) (PluginComposer*, GAction*)) application_plugin_manager_composer_impl_real_register_action;
	iface->deregister_action = (void (*) (PluginComposer*, GAction*)) application_plugin_manager_composer_impl_real_deregister_action;
	iface->append_menu_item = (void (*) (PluginComposer*, PluginActionable*)) application_plugin_manager_composer_impl_real_append_menu_item;
	iface->set_action_bar = (void (*) (PluginComposer*, PluginActionBar*)) application_plugin_manager_composer_impl_real_set_action_bar;
	iface->get_can_send = application_plugin_manager_composer_impl_real_get_can_send;
	iface->set_can_send = application_plugin_manager_composer_impl_real_set_can_send;
	iface->get_sender_context = application_plugin_manager_composer_impl_real_get_sender_context;
	iface->get_action_group_name = application_plugin_manager_composer_impl_real_get_action_group_name;
	iface->get_save_to = application_plugin_manager_composer_impl_real_get_save_to;
}

static void
application_plugin_manager_composer_impl_instance_init (ApplicationPluginManagerComposerImpl * self,
                                                        gpointer klass)
{
	self->priv = application_plugin_manager_composer_impl_get_instance_private (self);
	self->priv->_can_send = FALSE;
	self->priv->_sender_context = NULL;
	self->priv->_save_to = NULL;
	self->priv->action_group = NULL;
	self->priv->menu_items = NULL;
	self->priv->action_bar = NULL;
}

static void
application_plugin_manager_composer_impl_finalize (GObject * obj)
{
	ApplicationPluginManagerComposerImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	_g_object_unref0 (self->priv->_sender_context);
	_g_free0 (self->priv->_action_group_name);
	_g_object_unref0 (self->priv->_save_to);
	_g_object_unref0 (self->priv->backing);
	_g_object_unref0 (self->priv->action_group);
	_g_object_unref0 (self->priv->menu_items);
	_g_object_unref0 (self->priv->action_bar);
	G_OBJECT_CLASS (application_plugin_manager_composer_impl_parent_class)->finalize (obj);
}

/** An implementation of the plugin Composer interface. */
static GType
application_plugin_manager_composer_impl_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerComposerImplClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_composer_impl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManagerComposerImpl), 0, (GInstanceInitFunc) application_plugin_manager_composer_impl_instance_init, NULL };
	static const GInterfaceInfo plugin_composer_info = { (GInterfaceInitFunc) application_plugin_manager_composer_impl_plugin_composer_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType application_plugin_manager_composer_impl_type_id;
	application_plugin_manager_composer_impl_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "ApplicationPluginManagerComposerImpl", &g_define_type_info, 0);
	g_type_add_interface_static (application_plugin_manager_composer_impl_type_id, PLUGIN_TYPE_COMPOSER, &plugin_composer_info);
	ApplicationPluginManagerComposerImpl_private_offset = g_type_add_instance_private (application_plugin_manager_composer_impl_type_id, sizeof (ApplicationPluginManagerComposerImplPrivate));
	return application_plugin_manager_composer_impl_type_id;
}

GType
application_plugin_manager_composer_impl_get_type (void)
{
	static volatile gsize application_plugin_manager_composer_impl_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_composer_impl_type_id__once)) {
		GType application_plugin_manager_composer_impl_type_id;
		application_plugin_manager_composer_impl_type_id = application_plugin_manager_composer_impl_get_type_once ();
		g_once_init_leave (&application_plugin_manager_composer_impl_type_id__once, application_plugin_manager_composer_impl_type_id);
	}
	return application_plugin_manager_composer_impl_type_id__once;
}

static void
_vala_application_plugin_manager_composer_impl_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec)
{
	ApplicationPluginManagerComposerImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY:
		g_value_set_boolean (value, plugin_composer_get_can_send (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer)));
		break;
		case APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SENDER_CONTEXT_PROPERTY:
		g_value_set_object (value, plugin_composer_get_sender_context (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer)));
		break;
		case APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_ACTION_GROUP_NAME_PROPERTY:
		g_value_set_string (value, plugin_composer_get_action_group_name (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer)));
		break;
		case APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_SAVE_TO_PROPERTY:
		g_value_set_object (value, plugin_composer_get_save_to (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer)));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_application_plugin_manager_composer_impl_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec)
{
	ApplicationPluginManagerComposerImpl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_PLUGIN_MANAGER_TYPE_COMPOSER_IMPL, ApplicationPluginManagerComposerImpl);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_COMPOSER_IMPL_CAN_SEND_PROPERTY:
		plugin_composer_set_can_send (G_TYPE_CHECK_INSTANCE_CAST (self, PLUGIN_TYPE_COMPOSER, PluginComposer), g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
application_plugin_manager_class_init (ApplicationPluginManagerClass * klass,
                                       gpointer klass_data)
{
	application_plugin_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ApplicationPluginManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_application_plugin_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_application_plugin_manager_set_property;
	G_OBJECT_CLASS (klass)->finalize = application_plugin_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY, application_plugin_manager_properties[APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY] = application_plugin_manager_param_spec_plugin_globals ("globals", "globals", "globals", APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_GLOBALS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/** Emitted when a plugin is successfully loaded and activated. */
	application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_ACTIVATED_SIGNAL] = g_signal_new ("plugin-activated", APPLICATION_TYPE_PLUGIN_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, peas_plugin_info_get_type ());
	/** Emitted when a plugin raised an error loading or activating. */
	application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_ERROR_SIGNAL] = g_signal_new ("plugin-error", APPLICATION_TYPE_PLUGIN_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, peas_plugin_info_get_type (), G_TYPE_ERROR);
	/**
	     * Emitted when a plugin was unloaded.
	     *
	     * If the given error is not null, it was raised on deactivate.
	     */
	application_plugin_manager_signals[APPLICATION_PLUGIN_MANAGER_PLUGIN_DEACTIVATED_SIGNAL] = g_signal_new ("plugin-deactivated", APPLICATION_TYPE_PLUGIN_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, peas_plugin_info_get_type (), G_TYPE_ERROR);
}

static void
application_plugin_manager_instance_init (ApplicationPluginManager * self,
                                          gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	self->priv = application_plugin_manager_get_instance_private (self);
	self->priv->is_startup = TRUE;
	self->priv->is_shutdown = FALSE;
	_tmp0_ = gee_hash_map_new (peas_plugin_info_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, APPLICATION_PLUGIN_MANAGER_TYPE_PLUGIN_CONTEXT, (GBoxedCopyFunc) application_plugin_manager_plugin_context_ref, (GDestroyNotify) application_plugin_manager_plugin_context_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->plugin_set = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_MAP, GeeMap);
	_tmp1_ = gee_hash_map_new (peas_plugin_info_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, APPLICATION_TYPE_NOTIFICATION_PLUGIN_CONTEXT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->notification_contexts = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_MAP, GeeMap);
	_tmp2_ = gee_hash_map_new (peas_plugin_info_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, APPLICATION_TYPE_EMAIL_PLUGIN_CONTEXT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->email_contexts = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_MAP, GeeMap);
}

static void
application_plugin_manager_finalize (GObject * obj)
{
	ApplicationPluginManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, APPLICATION_TYPE_PLUGIN_MANAGER, ApplicationPluginManager);
	_application_plugin_manager_plugin_globals_unref0 (self->priv->_globals);
	_g_object_unref0 (self->priv->config);
	_g_object_unref0 (self->priv->plugin_engine);
	_g_free0 (self->priv->trusted_path);
	_g_object_unref0 (self->priv->plugin_set);
	_g_object_unref0 (self->priv->notification_contexts);
	_g_object_unref0 (self->priv->email_contexts);
	G_OBJECT_CLASS (application_plugin_manager_parent_class)->finalize (obj);
}

/**
 * Finds and manages application plugins.
 */
static GType
application_plugin_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ApplicationPluginManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) application_plugin_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ApplicationPluginManager), 0, (GInstanceInitFunc) application_plugin_manager_instance_init, NULL };
	GType application_plugin_manager_type_id;
	application_plugin_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "ApplicationPluginManager", &g_define_type_info, 0);
	ApplicationPluginManager_private_offset = g_type_add_instance_private (application_plugin_manager_type_id, sizeof (ApplicationPluginManagerPrivate));
	return application_plugin_manager_type_id;
}

GType
application_plugin_manager_get_type (void)
{
	static volatile gsize application_plugin_manager_type_id__once = 0;
	if (g_once_init_enter (&application_plugin_manager_type_id__once)) {
		GType application_plugin_manager_type_id;
		application_plugin_manager_type_id = application_plugin_manager_get_type_once ();
		g_once_init_leave (&application_plugin_manager_type_id__once, application_plugin_manager_type_id);
	}
	return application_plugin_manager_type_id__once;
}

static void
_vala_application_plugin_manager_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	ApplicationPluginManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_TYPE_PLUGIN_MANAGER, ApplicationPluginManager);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY:
		application_plugin_manager_value_set_plugin_globals (value, application_plugin_manager_get_globals (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_application_plugin_manager_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	ApplicationPluginManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, APPLICATION_TYPE_PLUGIN_MANAGER, ApplicationPluginManager);
	switch (property_id) {
		case APPLICATION_PLUGIN_MANAGER_GLOBALS_PROPERTY:
		application_plugin_manager_set_globals (self, application_plugin_manager_value_get_plugin_globals (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

