/* editorconfig.c generated by valac 0.56.19, the Vala compiler
 * generated from editorconfig.vala, do not modify */

/*
* Copyright (c) 2018 elementary LLC. (https://github.com/elementary)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include "editorconfig.h"
#include "codecore.h"
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include "editorconfig/editorconfig.h"
#include <stdlib.h>
#include <string.h>
#include <gtksourceview/gtksource.h>
#include <libpeas.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

enum  {
	SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_0_PROPERTY,
	SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY,
	SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* scratch_plugins_editor_config_plugin_properties[SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _editorconfig_handle_destroy0(var) ((var == NULL) ? NULL : (var = (editorconfig_handle_destroy (var), NULL)))
typedef struct _ScratchPluginsEditorConfigPluginUpdateConfigData ScratchPluginsEditorConfigPluginUpdateConfigData;

struct _ScratchPluginsEditorConfigPluginPrivate {
	ScratchServicesInterface* plugins;
	GObject* _object;
	CodeFormatBar* format_bar;
};

struct _ScratchPluginsEditorConfigPluginUpdateConfigData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ScratchPluginsEditorConfigPlugin* self;
	ScratchServicesDocument* d;
	CodeFormatBar* _tmp0_;
	CodeFormatBar* _tmp1_;
	CodeFormatBar* _tmp2_;
	ScratchWidgetsSourceView* view;
	ScratchWidgetsSourceView* _tmp3_;
	ScratchWidgetsSourceView* _tmp4_;
	ScratchWidgetsSourceView* _tmp5_;
	GFile* file;
	GFile* _tmp6_;
	GFile* _tmp7_;
	GFile* _tmp8_;
	gboolean _tmp9_;
	GFile* _tmp10_;
	GFile* _tmp11_;
	editorconfig_handle* handle;
	editorconfig_handle* _tmp12_;
	editorconfig_handle* _tmp13_;
	editorconfig_handle* _tmp14_;
	GFile* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gboolean _tmp18_;
	gint i;
	gboolean _tmp19_;
	gint _tmp20_;
	editorconfig_handle* _tmp21_;
	gchar* name;
	gchar* val;
	editorconfig_handle* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GQuark _tmp30_;
	CodeFormatBar* _tmp31_;
	gboolean use_spaces;
	const gchar* _tmp32_;
	CodeFormatBar* _tmp33_;
	CodeFormatBar* _tmp34_;
	gint indent_width;
	const gchar* _tmp35_;
	CodeFormatBar* _tmp36_;
	ScratchWidgetsSourceView* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
};

static gint ScratchPluginsEditorConfigPlugin_private_offset;
static gpointer scratch_plugins_editor_config_plugin_parent_class = NULL;
static ScratchServicesActivatablePluginIface * scratch_plugins_editor_config_plugin_scratch_services_activatable_plugin_parent_iface = NULL;
static GType scratch_plugins_editor_config_plugin_type_id = 0;

static void scratch_plugins_editor_config_plugin_real_update_state (ScratchServicesActivatablePlugin* base);
static void scratch_plugins_editor_config_plugin_real_activate (ScratchServicesActivatablePlugin* base);
static void __lambda4_ (ScratchPluginsEditorConfigPlugin* self,
                 ScratchHeaderBar* tb);
static void ___lambda4__scratch_services_interface_hook_toolbar (ScratchServicesInterface* _sender,
                                                          ScratchHeaderBar* toolbar,
                                                          gpointer self);
static void __lambda5_ (ScratchPluginsEditorConfigPlugin* self,
                 ScratchServicesDocument* d);
static void scratch_plugins_editor_config_plugin_update_config (ScratchPluginsEditorConfigPlugin* self,
                                                         ScratchServicesDocument* d,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static void scratch_plugins_editor_config_plugin_update_config_finish (ScratchPluginsEditorConfigPlugin* self,
                                                                GAsyncResult* _res_);
static void ___lambda5__scratch_services_interface_hook_document (ScratchServicesInterface* _sender,
                                                           ScratchServicesDocument* doc,
                                                           gpointer self);
static void scratch_plugins_editor_config_plugin_update_config_data_free (gpointer _data);
static gboolean scratch_plugins_editor_config_plugin_update_config_co (ScratchPluginsEditorConfigPluginUpdateConfigData* _data_);
static void scratch_plugins_editor_config_plugin_real_deactivate (ScratchServicesActivatablePlugin* base);
static void scratch_plugins_editor_config_plugin_finalize (GObject * obj);
static void _vala_scratch_plugins_editor_config_plugin_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_scratch_plugins_editor_config_plugin_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);

static inline gpointer
scratch_plugins_editor_config_plugin_get_instance_private (ScratchPluginsEditorConfigPlugin* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchPluginsEditorConfigPlugin_private_offset);
}

static void
scratch_plugins_editor_config_plugin_real_update_state (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsEditorConfigPlugin * self;
	self = (ScratchPluginsEditorConfigPlugin*) base;
}

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

static void
__lambda4_ (ScratchPluginsEditorConfigPlugin* self,
            ScratchHeaderBar* tb)
{
	CodeFormatBar* _tmp0_;
	CodeFormatBar* _tmp1_;
	g_return_if_fail (tb != NULL);
	_tmp0_ = tb->format_bar;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->format_bar);
	self->priv->format_bar = _tmp1_;
}

static void
___lambda4__scratch_services_interface_hook_toolbar (ScratchServicesInterface* _sender,
                                                     ScratchHeaderBar* toolbar,
                                                     gpointer self)
{
	__lambda4_ ((ScratchPluginsEditorConfigPlugin*) self, toolbar);
}

static void
__lambda5_ (ScratchPluginsEditorConfigPlugin* self,
            ScratchServicesDocument* d)
{
	g_return_if_fail (d != NULL);
	scratch_plugins_editor_config_plugin_update_config (self, d, NULL, NULL);
}

static void
___lambda5__scratch_services_interface_hook_document (ScratchServicesInterface* _sender,
                                                      ScratchServicesDocument* doc,
                                                      gpointer self)
{
	__lambda5_ ((ScratchPluginsEditorConfigPlugin*) self, doc);
}

static void
scratch_plugins_editor_config_plugin_real_activate (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsEditorConfigPlugin * self;
	GObject* _tmp0_;
	GObject* _tmp1_;
	ScratchServicesInterface* _tmp2_;
	ScratchServicesInterface* _tmp3_;
	self = (ScratchPluginsEditorConfigPlugin*) base;
	_tmp0_ = scratch_services_activatable_plugin_get_object ((ScratchServicesActivatablePlugin*) self);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (self->priv->plugins);
	self->priv->plugins = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SCRATCH_SERVICES_TYPE_INTERFACE, ScratchServicesInterface);
	_tmp2_ = self->priv->plugins;
	g_signal_connect_object (_tmp2_, "hook-toolbar", (GCallback) ___lambda4__scratch_services_interface_hook_toolbar, self, 0);
	_tmp3_ = self->priv->plugins;
	g_signal_connect_object (_tmp3_, "hook-document", (GCallback) ___lambda5__scratch_services_interface_hook_document, self, 0);
}

static void
scratch_plugins_editor_config_plugin_update_config_data_free (gpointer _data)
{
	ScratchPluginsEditorConfigPluginUpdateConfigData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->d);
	_g_object_unref0 (_data_->self);
	g_slice_free (ScratchPluginsEditorConfigPluginUpdateConfigData, _data_);
}

static void
scratch_plugins_editor_config_plugin_update_config (ScratchPluginsEditorConfigPlugin* self,
                                                    ScratchServicesDocument* d,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ScratchPluginsEditorConfigPluginUpdateConfigData* _data_;
	ScratchPluginsEditorConfigPlugin* _tmp0_;
	ScratchServicesDocument* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (d != NULL);
	_data_ = g_slice_new0 (ScratchPluginsEditorConfigPluginUpdateConfigData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, scratch_plugins_editor_config_plugin_update_config_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (d);
	_g_object_unref0 (_data_->d);
	_data_->d = _tmp1_;
	scratch_plugins_editor_config_plugin_update_config_co (_data_);
}

static void
scratch_plugins_editor_config_plugin_update_config_finish (ScratchPluginsEditorConfigPlugin* self,
                                                           GAsyncResult* _res_)
{
	ScratchPluginsEditorConfigPluginUpdateConfigData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
scratch_plugins_editor_config_plugin_update_config_co (ScratchPluginsEditorConfigPluginUpdateConfigData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->format_bar;
	code_format_bar_set_tab_style_set_by_editor_config (_data_->_tmp0_, FALSE);
	_data_->_tmp1_ = _data_->self->priv->format_bar;
	code_format_bar_set_tab_width_set_by_editor_config (_data_->_tmp1_, FALSE);
	_data_->_tmp2_ = _data_->self->priv->format_bar;
	code_format_bar_set_document (_data_->_tmp2_, _data_->d);
	_data_->_tmp3_ = scratch_services_document_get_source_view (_data_->d);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _g_object_ref0 (_data_->_tmp4_);
	_data_->view = _data_->_tmp5_;
	_data_->_tmp6_ = scratch_services_document_get_file (_data_->d);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
	_data_->file = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->file;
	if (_data_->_tmp10_ == NULL) {
		_data_->_tmp9_ = TRUE;
	} else {
		_data_->_tmp11_ = _data_->file;
		_data_->_tmp9_ = !g_file_query_exists (_data_->_tmp11_, NULL);
	}
	if (_data_->_tmp9_) {
		_g_object_unref0 (_data_->file);
		_g_object_unref0 (_data_->view);
		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;
	}
	_data_->_tmp12_ = editorconfig_handle_init ();
	_data_->handle = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->handle;
	editorconfig_handle_set_conf_file_name (_data_->_tmp13_, ".editorconfig");
	_data_->_tmp14_ = _data_->handle;
	_data_->_tmp15_ = _data_->file;
	_data_->_tmp16_ = g_file_get_path (_data_->_tmp15_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->_tmp18_ = editorconfig_parse (_data_->_tmp17_, _data_->_tmp14_) != 0;
	_g_free0 (_data_->_tmp17_);
	if (_data_->_tmp18_) {
		_editorconfig_handle_destroy0 (_data_->handle);
		_g_object_unref0 (_data_->file);
		_g_object_unref0 (_data_->view);
		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;
	}
	{
		_data_->i = 0;
		{
			_data_->_tmp19_ = TRUE;
			while (TRUE) {
				static GQuark _tmp29_label0 = 0;
				static GQuark _tmp29_label1 = 0;
				static GQuark _tmp29_label2 = 0;
				static GQuark _tmp29_label3 = 0;
				static GQuark _tmp29_label4 = 0;
				static GQuark _tmp29_label5 = 0;
				static GQuark _tmp29_label6 = 0;
				static GQuark _tmp29_label7 = 0;
				if (!_data_->_tmp19_) {
					_data_->_tmp20_ = _data_->i;
					_data_->i = _data_->_tmp20_ + 1;
				}
				_data_->_tmp19_ = FALSE;
				_data_->_tmp21_ = _data_->handle;
				if (!(_data_->i < editorconfig_handle_get_name_value_count (_data_->_tmp21_))) {
					break;
				}
				_data_->_tmp22_ = _data_->handle;
				_data_->_tmp23_ = NULL;
				_data_->_tmp24_ = NULL;
				editorconfig_handle_get_name_value (_data_->_tmp22_, _data_->i, &_data_->_tmp23_, &_data_->_tmp24_);
				_g_free0 (_data_->name);
				_data_->_tmp25_ = g_strdup (_data_->_tmp23_);
				_data_->name = _data_->_tmp25_;
				_g_free0 (_data_->val);
				_data_->_tmp26_ = g_strdup (_data_->_tmp24_);
				_data_->val = _data_->_tmp26_;
				_data_->_tmp27_ = _data_->name;
				_data_->_tmp30_ = 0U;
				_data_->_tmp28_ = _data_->_tmp27_;
				_data_->_tmp30_ = (NULL == _data_->_tmp28_) ? 0 : g_quark_from_string (_data_->_tmp28_);
				if (_data_->_tmp30_ == ((0 != _tmp29_label0) ? _tmp29_label0 : (_tmp29_label0 = g_quark_from_static_string ("indent_style")))) {
					switch (0) {
						default:
						{
							_data_->_tmp31_ = _data_->self->priv->format_bar;
							code_format_bar_set_tab_style_set_by_editor_config (_data_->_tmp31_, TRUE);
							_data_->_tmp32_ = _data_->val;
							_data_->use_spaces = g_strcmp0 (_data_->_tmp32_, "tab") != 0;
							_data_->_tmp33_ = _data_->self->priv->format_bar;
							code_format_bar_set_insert_spaces_instead_of_tabs (_data_->_tmp33_, _data_->use_spaces);
							break;
						}
					}
				} else if ((_data_->_tmp30_ == ((0 != _tmp29_label1) ? _tmp29_label1 : (_tmp29_label1 = g_quark_from_static_string ("indent_size")))) || (_data_->_tmp30_ == ((0 != _tmp29_label2) ? _tmp29_label2 : (_tmp29_label2 = g_quark_from_static_string ("tab_width"))))) {
					switch (0) {
						default:
						{
							_data_->_tmp34_ = _data_->self->priv->format_bar;
							code_format_bar_set_tab_width_set_by_editor_config (_data_->_tmp34_, TRUE);
							_data_->_tmp35_ = _data_->val;
							_data_->indent_width = CLAMP (atoi (_data_->_tmp35_), 2, 16);
							_data_->_tmp36_ = _data_->self->priv->format_bar;
							code_format_bar_set_tab_width (_data_->_tmp36_, _data_->indent_width);
							break;
						}
					}
				} else if (_data_->_tmp30_ == ((0 != _tmp29_label3) ? _tmp29_label3 : (_tmp29_label3 = g_quark_from_static_string ("end_of_line")))) {
					switch (0) {
						default:
						{
							break;
						}
					}
				} else if (_data_->_tmp30_ == ((0 != _tmp29_label4) ? _tmp29_label4 : (_tmp29_label4 = g_quark_from_static_string ("charset")))) {
					switch (0) {
						default:
						{
							break;
						}
					}
				} else if (_data_->_tmp30_ == ((0 != _tmp29_label5) ? _tmp29_label5 : (_tmp29_label5 = g_quark_from_static_string ("trim_trailing_whitespace")))) {
					switch (0) {
						default:
						{
							break;
						}
					}
				} else if (_data_->_tmp30_ == ((0 != _tmp29_label6) ? _tmp29_label6 : (_tmp29_label6 = g_quark_from_static_string ("insert_final_newline")))) {
					switch (0) {
						default:
						{
							break;
						}
					}
				} else if (_data_->_tmp30_ == ((0 != _tmp29_label7) ? _tmp29_label7 : (_tmp29_label7 = g_quark_from_static_string ("max_line_length")))) {
					switch (0) {
						default:
						{
							_data_->_tmp37_ = _data_->view;
							_data_->_tmp38_ = _data_->val;
							gtk_source_view_set_right_margin_position ((GtkSourceView*) _data_->_tmp37_, (guint) atoi (_data_->_tmp38_));
							break;
						}
					}
				} else {
					switch (0) {
						default:
						{
							_data_->_tmp39_ = _data_->name;
							_data_->_tmp40_ = _data_->val;
							g_warning ("editorconfig.vala:87: unrecognised name/value %s/%s", _data_->_tmp39_, _data_->_tmp40_);
							break;
						}
					}
				}
				_g_free0 (_data_->val);
				_g_free0 (_data_->name);
			}
		}
	}
	_editorconfig_handle_destroy0 (_data_->handle);
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->view);
	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
scratch_plugins_editor_config_plugin_real_deactivate (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsEditorConfigPlugin * self;
	self = (ScratchPluginsEditorConfigPlugin*) base;
	g_debug ("editorconfig.vala:93: Editor config deactivate");
}

ScratchPluginsEditorConfigPlugin*
scratch_plugins_editor_config_plugin_construct (GType object_type)
{
	ScratchPluginsEditorConfigPlugin * self = NULL;
	self = (ScratchPluginsEditorConfigPlugin*) g_object_new (object_type, NULL);
	return self;
}

ScratchPluginsEditorConfigPlugin*
scratch_plugins_editor_config_plugin_new (void)
{
	return scratch_plugins_editor_config_plugin_construct (SCRATCH_PLUGINS_TYPE_EDITOR_CONFIG_PLUGIN);
}

static GObject*
scratch_plugins_editor_config_plugin_real_get_object (ScratchServicesActivatablePlugin* base)
{
	GObject* result;
	ScratchPluginsEditorConfigPlugin* self;
	GObject* _tmp0_;
	GObject* _tmp1_;
	self = (ScratchPluginsEditorConfigPlugin*) base;
	_tmp0_ = self->priv->_object;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
scratch_plugins_editor_config_plugin_real_set_object (ScratchServicesActivatablePlugin* base,
                                                      GObject* value)
{
	ScratchPluginsEditorConfigPlugin* self;
	GObject* old_value;
	self = (ScratchPluginsEditorConfigPlugin*) base;
	old_value = scratch_plugins_editor_config_plugin_real_get_object (base);
	if (old_value != value) {
		GObject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_object);
		self->priv->_object = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, scratch_plugins_editor_config_plugin_properties[SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY]);
	}
	_g_object_unref0 (old_value);
}

static void
scratch_plugins_editor_config_plugin_class_init (ScratchPluginsEditorConfigPluginClass * klass,
                                                 gpointer klass_data)
{
	scratch_plugins_editor_config_plugin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchPluginsEditorConfigPlugin_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_plugins_editor_config_plugin_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_scratch_plugins_editor_config_plugin_set_property;
	G_OBJECT_CLASS (klass)->finalize = scratch_plugins_editor_config_plugin_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY, scratch_plugins_editor_config_plugin_properties[SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY] = g_param_spec_object ("object", "object", "object", G_TYPE_OBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
scratch_plugins_editor_config_plugin_scratch_services_activatable_plugin_interface_init (ScratchServicesActivatablePluginIface * iface,
                                                                                         gpointer iface_data)
{
	scratch_plugins_editor_config_plugin_scratch_services_activatable_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->update_state = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_editor_config_plugin_real_update_state;
	iface->activate = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_editor_config_plugin_real_activate;
	iface->deactivate = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_editor_config_plugin_real_deactivate;
	iface->get_object = scratch_plugins_editor_config_plugin_real_get_object;
	iface->set_object = scratch_plugins_editor_config_plugin_real_set_object;
}

static void
scratch_plugins_editor_config_plugin_instance_init (ScratchPluginsEditorConfigPlugin * self,
                                                    gpointer klass)
{
	self->priv = scratch_plugins_editor_config_plugin_get_instance_private (self);
}

static void
scratch_plugins_editor_config_plugin_finalize (GObject * obj)
{
	ScratchPluginsEditorConfigPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_PLUGINS_TYPE_EDITOR_CONFIG_PLUGIN, ScratchPluginsEditorConfigPlugin);
	_g_object_unref0 (self->priv->plugins);
	_g_object_unref0 (self->priv->_object);
	_g_object_unref0 (self->priv->format_bar);
	G_OBJECT_CLASS (scratch_plugins_editor_config_plugin_parent_class)->finalize (obj);
}

GType
scratch_plugins_editor_config_plugin_get_type (void)
{
	return scratch_plugins_editor_config_plugin_type_id;
}

GType
scratch_plugins_editor_config_plugin_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchPluginsEditorConfigPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_plugins_editor_config_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchPluginsEditorConfigPlugin), 0, (GInstanceInitFunc) scratch_plugins_editor_config_plugin_instance_init, NULL };
	static const GInterfaceInfo scratch_services_activatable_plugin_info = { (GInterfaceInitFunc) scratch_plugins_editor_config_plugin_scratch_services_activatable_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	scratch_plugins_editor_config_plugin_type_id = g_type_module_register_type (module, peas_extension_base_get_type (), "ScratchPluginsEditorConfigPlugin", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_module_add_interface (module, scratch_plugins_editor_config_plugin_type_id, SCRATCH_SERVICES_TYPE_ACTIVATABLE_PLUGIN, &scratch_services_activatable_plugin_info);
	ScratchPluginsEditorConfigPlugin_private_offset = sizeof (ScratchPluginsEditorConfigPluginPrivate);
	return scratch_plugins_editor_config_plugin_type_id;
}

static void
_vala_scratch_plugins_editor_config_plugin_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	ScratchPluginsEditorConfigPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_PLUGINS_TYPE_EDITOR_CONFIG_PLUGIN, ScratchPluginsEditorConfigPlugin);
	switch (property_id) {
		case SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY:
		g_value_take_object (value, scratch_services_activatable_plugin_get_object ((ScratchServicesActivatablePlugin*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_scratch_plugins_editor_config_plugin_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	ScratchPluginsEditorConfigPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_PLUGINS_TYPE_EDITOR_CONFIG_PLUGIN, ScratchPluginsEditorConfigPlugin);
	switch (property_id) {
		case SCRATCH_PLUGINS_EDITOR_CONFIG_PLUGIN_OBJECT_PROPERTY:
		scratch_services_activatable_plugin_set_object ((ScratchServicesActivatablePlugin*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
peas_register_types (GTypeModule* module)
{
	PeasObjectModule* objmodule = NULL;
	PeasObjectModule* _tmp0_;
	g_return_if_fail (module != NULL);
	scratch_plugins_editor_config_plugin_register_type (module);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (module, peas_object_module_get_type ()) ? ((PeasObjectModule*) module) : NULL);
	objmodule = _tmp0_;
	peas_object_module_register_extension_type (objmodule, SCRATCH_SERVICES_TYPE_ACTIVATABLE_PLUGIN, SCRATCH_PLUGINS_TYPE_EDITOR_CONFIG_PLUGIN);
	_g_object_unref0 (objmodule);
}

