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

#include <glib-object.h>
#include <gmodule.h>
#include <glib.h>
#include "libdino.h"
#include <stdlib.h>
#include <string.h>
#include <gee.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 DINO_PLUGINS_TYPE_INFO (dino_plugins_info_get_type ())
#define DINO_PLUGINS_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_PLUGINS_TYPE_INFO, DinoPluginsInfo))
#define DINO_PLUGINS_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_PLUGINS_TYPE_INFO, DinoPluginsInfoClass))
#define DINO_PLUGINS_IS_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_PLUGINS_TYPE_INFO))
#define DINO_PLUGINS_IS_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_PLUGINS_TYPE_INFO))
#define DINO_PLUGINS_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_PLUGINS_TYPE_INFO, DinoPluginsInfoClass))

typedef struct _DinoPluginsInfo DinoPluginsInfo;
typedef struct _DinoPluginsInfoClass DinoPluginsInfoClass;
typedef struct _DinoPluginsInfoPrivate DinoPluginsInfoPrivate;
enum  {
	DINO_PLUGINS_INFO_0_PROPERTY,
	DINO_PLUGINS_INFO_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_info_properties[DINO_PLUGINS_INFO_NUM_PROPERTIES];
#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL)))
enum  {
	DINO_PLUGINS_LOADER_0_PROPERTY,
	DINO_PLUGINS_LOADER_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_loader_properties[DINO_PLUGINS_LOADER_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 _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef GType (*DinoPluginsLoaderRegisterPluginFunction) (GModule* module);

struct _DinoPluginsInfo {
	GObject parent_instance;
	DinoPluginsInfoPrivate * priv;
	GModule* module;
	GType gtype;
};

struct _DinoPluginsInfoClass {
	GObjectClass parent_class;
};

struct _DinoPluginsLoaderPrivate {
	DinoApplication* app;
	gchar** search_paths;
	gint search_paths_length1;
	gint _search_paths_size_;
	DinoPluginsRootInterface** plugins;
	gint plugins_length1;
	gint _plugins_size_;
	DinoPluginsInfo** infos;
	gint infos_length1;
	gint _infos_size_;
};

static gpointer dino_plugins_info_parent_class = NULL;
static gint DinoPluginsLoader_private_offset;
static gpointer dino_plugins_loader_parent_class = NULL;

VALA_EXTERN GType dino_plugins_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DinoPluginsInfo* dino_plugins_info_new (GType type,
                                        GModule* module);
VALA_EXTERN DinoPluginsInfo* dino_plugins_info_construct (GType object_type,
                                              GType type,
                                              GModule* module);
static void dino_plugins_info_finalize (GObject * obj);
static GType dino_plugins_info_get_type_once (void);
static void _vala_array_add1 (DinoPluginsInfo** * array,
                       gint* length,
                       gint* size,
                       DinoPluginsInfo* value);
static void _vala_array_add2 (DinoPluginsRootInterface** * array,
                       gint* length,
                       gint* size,
                       DinoPluginsRootInterface* value);
static void dino_plugins_loader_finalize (GObject * obj);
static GType dino_plugins_loader_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

DinoPluginsInfo*
dino_plugins_info_construct (GType object_type,
                             GType type,
                             GModule* module)
{
	DinoPluginsInfo * self = NULL;
	GModule* _tmp0_;
	g_return_val_if_fail (module != NULL, NULL);
	self = (DinoPluginsInfo*) g_object_new (object_type, NULL);
	_tmp0_ = module;
	module = NULL;
	_g_module_close0 (self->module);
	self->module = _tmp0_;
	self->gtype = type;
	_g_module_close0 (module);
	return self;
}

DinoPluginsInfo*
dino_plugins_info_new (GType type,
                       GModule* module)
{
	return dino_plugins_info_construct (DINO_PLUGINS_TYPE_INFO, type, module);
}

static void
dino_plugins_info_class_init (DinoPluginsInfoClass * klass,
                              gpointer klass_data)
{
	dino_plugins_info_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_info_finalize;
}

static void
dino_plugins_info_instance_init (DinoPluginsInfo * self,
                                 gpointer klass)
{
}

static void
dino_plugins_info_finalize (GObject * obj)
{
	DinoPluginsInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_TYPE_INFO, DinoPluginsInfo);
	_g_module_close0 (self->module);
	G_OBJECT_CLASS (dino_plugins_info_parent_class)->finalize (obj);
}

static GType
dino_plugins_info_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsInfo), 0, (GInstanceInitFunc) dino_plugins_info_instance_init, NULL };
	GType dino_plugins_info_type_id;
	dino_plugins_info_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPluginsInfo", &g_define_type_info, 0);
	return dino_plugins_info_type_id;
}

GType
dino_plugins_info_get_type (void)
{
	static volatile gsize dino_plugins_info_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_info_type_id__once)) {
		GType dino_plugins_info_type_id;
		dino_plugins_info_type_id = dino_plugins_info_get_type_once ();
		g_once_init_leave (&dino_plugins_info_type_id__once, dino_plugins_info_type_id);
	}
	return dino_plugins_info_type_id__once;
}

static inline gpointer
dino_plugins_loader_get_instance_private (DinoPluginsLoader* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsLoader_private_offset);
}

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

DinoPluginsLoader*
dino_plugins_loader_construct (GType object_type,
                               DinoApplication* app)
{
	DinoPluginsLoader * self = NULL;
	DinoApplication* _tmp0_;
	DinoSearchPathGenerator* _tmp1_;
	DinoSearchPathGenerator* _tmp2_;
	gint _tmp3_ = 0;
	gchar** _tmp4_;
	g_return_val_if_fail (app != NULL, NULL);
	self = (DinoPluginsLoader*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (app);
	_g_object_unref0 (self->priv->app);
	self->priv->app = _tmp0_;
	_tmp1_ = dino_application_get_search_path_generator (app);
	_tmp2_ = _tmp1_;
	_tmp4_ = dino_search_path_generator_get_plugin_paths (_tmp2_, &_tmp3_);
	self->priv->search_paths = (_vala_array_free (self->priv->search_paths, self->priv->search_paths_length1, (GDestroyNotify) g_free), NULL);
	self->priv->search_paths = _tmp4_;
	self->priv->search_paths_length1 = _tmp3_;
	self->priv->_search_paths_size_ = self->priv->search_paths_length1;
	return self;
}

DinoPluginsLoader*
dino_plugins_loader_new (DinoApplication* app)
{
	return dino_plugins_loader_construct (DINO_PLUGINS_TYPE_LOADER, app);
}

void
dino_plugins_loader_load_all (DinoPluginsLoader* self,
                              GError** error)
{
	GeeHashSet* plugin_names = NULL;
	GeeHashSet* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (g_module_supported () == FALSE) {
		GError* _tmp0_;
		_tmp0_ = g_error_new ((GQuark) -1, 0, "Plugins are not supported");
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp1_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	plugin_names = _tmp1_;
	_tmp2_ = self->priv->search_paths;
	_tmp2__length1 = self->priv->search_paths_length1;
	{
		gchar** path_collection = NULL;
		gint path_collection_length1 = 0;
		gint _path_collection_size_ = 0;
		gint path_it = 0;
		path_collection = _tmp2_;
		path_collection_length1 = _tmp2__length1;
		for (path_it = 0; path_it < path_collection_length1; path_it = path_it + 1) {
			gchar* _tmp3_;
			gchar* path = NULL;
			_tmp3_ = g_strdup (path_collection[path_it]);
			path = _tmp3_;
			{
				{
					GDir* dir = NULL;
					const gchar* _tmp4_;
					GDir* _tmp5_;
					gchar* file = NULL;
					_tmp4_ = path;
					_tmp5_ = g_dir_open (_tmp4_, (guint) 0, &_inner_error0_);
					dir = _tmp5_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					file = NULL;
					while (TRUE) {
						GDir* _tmp6_;
						const gchar* _tmp7_;
						gchar* _tmp8_;
						const gchar* _tmp9_;
						const gchar* _tmp10_;
						_tmp6_ = dir;
						_tmp7_ = g_dir_read_name (_tmp6_);
						_tmp8_ = g_strdup (_tmp7_);
						_g_free0 (file);
						file = _tmp8_;
						_tmp9_ = file;
						if (!(_tmp9_ != NULL)) {
							break;
						}
						_tmp10_ = file;
						if (g_str_has_suffix (_tmp10_, G_MODULE_SUFFIX)) {
							GeeHashSet* _tmp11_;
							const gchar* _tmp12_;
							_tmp11_ = plugin_names;
							_tmp12_ = file;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, _tmp12_);
						}
					}
					_g_free0 (file);
					_g_dir_close0 (dir);
				}
				goto __finally0;
				__catch0_g_error:
				{
					g_clear_error (&_inner_error0_);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_free0 (path);
					_g_object_unref0 (plugin_names);
					return;
				}
				_g_free0 (path);
			}
		}
	}
	{
		GeeIterator* _plugin_it = NULL;
		GeeHashSet* _tmp13_;
		GeeIterator* _tmp14_;
		_tmp13_ = plugin_names;
		_tmp14_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp13_);
		_plugin_it = _tmp14_;
		while (TRUE) {
			GeeIterator* _tmp15_;
			gchar* plugin = NULL;
			GeeIterator* _tmp16_;
			gpointer _tmp17_;
			const gchar* _tmp18_;
			DinoPluginsRootInterface* _tmp19_;
			DinoPluginsRootInterface* _tmp20_;
			_tmp15_ = _plugin_it;
			if (!gee_iterator_next (_tmp15_)) {
				break;
			}
			_tmp16_ = _plugin_it;
			_tmp17_ = gee_iterator_get (_tmp16_);
			plugin = (gchar*) _tmp17_;
			_tmp18_ = plugin;
			_tmp19_ = dino_plugins_loader_load (self, _tmp18_, &_inner_error0_);
			_tmp20_ = _tmp19_;
			_g_object_unref0 (_tmp20_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_free0 (plugin);
				_g_object_unref0 (_plugin_it);
				_g_object_unref0 (plugin_names);
				return;
			}
			_g_free0 (plugin);
		}
		_g_object_unref0 (_plugin_it);
	}
	_g_object_unref0 (plugin_names);
}

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

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

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

DinoPluginsRootInterface*
dino_plugins_loader_load (DinoPluginsLoader* self,
                          const gchar* name,
                          GError** error)
{
	GModule* module = NULL;
	gchar* path = NULL;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GModule* _tmp9_;
	void* function = NULL;
	GModule* _tmp16_;
	void* _tmp17_ = NULL;
	void* _tmp18_;
	DinoPluginsLoaderRegisterPluginFunction register_plugin = NULL;
	void* _tmp20_;
	GType type = G_TYPE_NONE;
	DinoPluginsLoaderRegisterPluginFunction _tmp21_;
	GModule* _tmp22_;
	DinoPluginsInfo* info = NULL;
	GModule* _tmp24_;
	DinoPluginsInfo* _tmp25_;
	DinoPluginsInfo* _tmp26_;
	DinoPluginsInfo* _tmp27_;
	DinoPluginsRootInterface* plugin = NULL;
	GObject* _tmp28_;
	GObject* _tmp29_;
	DinoPluginsRootInterface* _tmp30_;
	DinoPluginsRootInterface* _tmp31_;
	DinoPluginsRootInterface* _tmp32_;
	DinoApplication* _tmp33_;
	GError* _inner_error0_ = NULL;
	DinoPluginsRootInterface* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	if (g_module_supported () == FALSE) {
		GError* _tmp0_;
		_tmp0_ = g_error_new ((GQuark) -1, 0, "Plugins are not supported");
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	module = NULL;
	_tmp1_ = g_strdup ("");
	path = _tmp1_;
	_tmp2_ = self->priv->search_paths;
	_tmp2__length1 = self->priv->search_paths_length1;
	{
		gchar** prefix_collection = NULL;
		gint prefix_collection_length1 = 0;
		gint _prefix_collection_size_ = 0;
		gint prefix_it = 0;
		prefix_collection = _tmp2_;
		prefix_collection_length1 = _tmp2__length1;
		for (prefix_it = 0; prefix_it < prefix_collection_length1; prefix_it = prefix_it + 1) {
			gchar* _tmp3_;
			gchar* prefix = NULL;
			_tmp3_ = g_strdup (prefix_collection[prefix_it]);
			prefix = _tmp3_;
			{
				const gchar* _tmp4_;
				gchar* _tmp5_;
				const gchar* _tmp6_;
				GModule* _tmp7_;
				GModule* _tmp8_;
				_tmp4_ = prefix;
				_tmp5_ = g_build_filename (_tmp4_, name, NULL);
				_g_free0 (path);
				path = _tmp5_;
				_tmp6_ = path;
				_tmp7_ = g_module_open (_tmp6_, G_MODULE_BIND_LAZY);
				_g_module_close0 (module);
				module = _tmp7_;
				_tmp8_ = module;
				if (_tmp8_ != NULL) {
					_g_free0 (prefix);
					break;
				}
				_g_free0 (prefix);
			}
		}
	}
	_tmp9_ = module;
	if (_tmp9_ == NULL) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		GError* _tmp14_;
		GError* _tmp15_;
		_tmp10_ = g_module_error ();
		_tmp11_ = path;
		_tmp12_ = string_replace (_tmp10_, _tmp11_, name);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_error_new ((GQuark) -1, 1, "%s", _tmp13_);
		_tmp15_ = _tmp14_;
		_g_free0 (_tmp13_);
		_inner_error0_ = _tmp15_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (path);
		_g_module_close0 (module);
		return NULL;
	}
	_tmp16_ = module;
	g_module_symbol (_tmp16_, "register_plugin", &_tmp17_);
	function = _tmp17_;
	_tmp18_ = function;
	if (_tmp18_ == NULL) {
		GError* _tmp19_;
		_tmp19_ = g_error_new ((GQuark) -1, 2, "register_plugin () not found");
		_inner_error0_ = _tmp19_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (path);
		_g_module_close0 (module);
		return NULL;
	}
	_tmp20_ = function;
	register_plugin = (DinoPluginsLoaderRegisterPluginFunction) _tmp20_;
	_tmp21_ = register_plugin;
	_tmp22_ = module;
	type = _tmp21_ (_tmp22_);
	if (g_type_is_a (type, DINO_PLUGINS_TYPE_ROOT_INTERFACE) == FALSE) {
		GError* _tmp23_;
		_tmp23_ = g_error_new ((GQuark) -1, 3, "Unexpected type");
		_inner_error0_ = _tmp23_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (path);
		_g_module_close0 (module);
		return NULL;
	}
	_tmp24_ = module;
	module = NULL;
	_tmp25_ = dino_plugins_info_new (type, _tmp24_);
	info = _tmp25_;
	_tmp26_ = info;
	_tmp27_ = _g_object_ref0 (_tmp26_);
	_vala_array_add1 (&self->priv->infos, &self->priv->infos_length1, &self->priv->_infos_size_, _tmp27_);
	_tmp28_ = g_object_new (type, NULL);
	_tmp29_ = G_IS_INITIALLY_UNOWNED (_tmp28_) ? g_object_ref_sink (_tmp28_) : _tmp28_;
	plugin = G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, DINO_PLUGINS_TYPE_ROOT_INTERFACE, DinoPluginsRootInterface);
	_tmp30_ = plugin;
	_tmp31_ = _g_object_ref0 (_tmp30_);
	_vala_array_add2 (&self->priv->plugins, &self->priv->plugins_length1, &self->priv->_plugins_size_, _tmp31_);
	_tmp32_ = plugin;
	_tmp33_ = self->priv->app;
	dino_plugins_root_interface_registered (_tmp32_, _tmp33_);
	result = plugin;
	_g_object_unref0 (info);
	_g_free0 (path);
	_g_module_close0 (module);
	return result;
}

void
dino_plugins_loader_shutdown (DinoPluginsLoader* self)
{
	DinoPluginsRootInterface** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->plugins;
	_tmp0__length1 = self->priv->plugins_length1;
	{
		DinoPluginsRootInterface** p_collection = NULL;
		gint p_collection_length1 = 0;
		gint _p_collection_size_ = 0;
		gint p_it = 0;
		p_collection = _tmp0_;
		p_collection_length1 = _tmp0__length1;
		for (p_it = 0; p_it < p_collection_length1; p_it = p_it + 1) {
			DinoPluginsRootInterface* _tmp1_;
			DinoPluginsRootInterface* p = NULL;
			_tmp1_ = _g_object_ref0 (p_collection[p_it]);
			p = _tmp1_;
			{
				DinoPluginsRootInterface* _tmp2_;
				_tmp2_ = p;
				dino_plugins_root_interface_shutdown (_tmp2_);
				_g_object_unref0 (p);
			}
		}
	}
}

static void
dino_plugins_loader_class_init (DinoPluginsLoaderClass * klass,
                                gpointer klass_data)
{
	dino_plugins_loader_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsLoader_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_loader_finalize;
}

static void
dino_plugins_loader_instance_init (DinoPluginsLoader * self,
                                   gpointer klass)
{
	DinoPluginsRootInterface** _tmp0_;
	DinoPluginsInfo** _tmp1_;
	self->priv = dino_plugins_loader_get_instance_private (self);
	_tmp0_ = g_new0 (DinoPluginsRootInterface*, 0 + 1);
	self->priv->plugins = _tmp0_;
	self->priv->plugins_length1 = 0;
	self->priv->_plugins_size_ = self->priv->plugins_length1;
	_tmp1_ = g_new0 (DinoPluginsInfo*, 0 + 1);
	self->priv->infos = _tmp1_;
	self->priv->infos_length1 = 0;
	self->priv->_infos_size_ = self->priv->infos_length1;
}

static void
dino_plugins_loader_finalize (GObject * obj)
{
	DinoPluginsLoader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_TYPE_LOADER, DinoPluginsLoader);
	_g_object_unref0 (self->priv->app);
	self->priv->search_paths = (_vala_array_free (self->priv->search_paths, self->priv->search_paths_length1, (GDestroyNotify) g_free), NULL);
	self->priv->plugins = (_vala_array_free (self->priv->plugins, self->priv->plugins_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->infos = (_vala_array_free (self->priv->infos, self->priv->infos_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (dino_plugins_loader_parent_class)->finalize (obj);
}

static GType
dino_plugins_loader_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsLoaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_loader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsLoader), 0, (GInstanceInitFunc) dino_plugins_loader_instance_init, NULL };
	GType dino_plugins_loader_type_id;
	dino_plugins_loader_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPluginsLoader", &g_define_type_info, 0);
	DinoPluginsLoader_private_offset = g_type_add_instance_private (dino_plugins_loader_type_id, sizeof (DinoPluginsLoaderPrivate));
	return dino_plugins_loader_type_id;
}

GType
dino_plugins_loader_get_type (void)
{
	static volatile gsize dino_plugins_loader_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_loader_type_id__once)) {
		GType dino_plugins_loader_type_id;
		dino_plugins_loader_type_id = dino_plugins_loader_get_type_once ();
		g_once_init_leave (&dino_plugins_loader_type_id__once, dino_plugins_loader_type_id);
	}
	return dino_plugins_loader_type_id__once;
}

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

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

