/* rygel-tracker-plugin-factory.c generated by valac 0.30.0.35-2c9e8, the Vala compiler
 * generated from rygel-tracker-plugin-factory.vala, do not modify */

/*
 * Copyright (C) 2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2009-2012 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *         Jens Georg <jensg@openismus.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Rygel 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <rygel-core.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <rygel-server.h>
#include <gobject/gvaluecollector.h>


#define RYGEL_TRACKER_TYPE_PLUGIN_FACTORY (rygel_tracker_plugin_factory_get_type ())
#define RYGEL_TRACKER_PLUGIN_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, RygelTrackerPluginFactory))
#define RYGEL_TRACKER_PLUGIN_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, RygelTrackerPluginFactoryClass))
#define RYGEL_TRACKER_IS_PLUGIN_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY))
#define RYGEL_TRACKER_IS_PLUGIN_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY))
#define RYGEL_TRACKER_PLUGIN_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, RygelTrackerPluginFactoryClass))

typedef struct _RygelTrackerPluginFactory RygelTrackerPluginFactory;
typedef struct _RygelTrackerPluginFactoryClass RygelTrackerPluginFactoryClass;
#define _rygel_tracker_plugin_factory_unref0(var) ((var == NULL) ? NULL : (var = (rygel_tracker_plugin_factory_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _RygelTrackerPluginFactoryPrivate RygelTrackerPluginFactoryPrivate;

#define RYGEL_TRACKER_TYPE_STATS_IFACE (rygel_tracker_stats_iface_get_type ())
#define RYGEL_TRACKER_STATS_IFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_STATS_IFACE, RygelTrackerStatsIface))
#define RYGEL_TRACKER_IS_STATS_IFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_STATS_IFACE))
#define RYGEL_TRACKER_STATS_IFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TRACKER_TYPE_STATS_IFACE, RygelTrackerStatsIfaceIface))

typedef struct _RygelTrackerStatsIface RygelTrackerStatsIface;
typedef struct _RygelTrackerStatsIfaceIface RygelTrackerStatsIfaceIface;

#define RYGEL_TRACKER_TYPE_STATS_IFACE_PROXY (rygel_tracker_stats_iface_proxy_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define RYGEL_TRACKER_TYPE_PLUGIN (rygel_tracker_plugin_get_type ())
#define RYGEL_TRACKER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_PLUGIN, RygelTrackerPlugin))
#define RYGEL_TRACKER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_PLUGIN, RygelTrackerPluginClass))
#define RYGEL_TRACKER_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_PLUGIN))
#define RYGEL_TRACKER_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_PLUGIN))
#define RYGEL_TRACKER_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_PLUGIN, RygelTrackerPluginClass))

typedef struct _RygelTrackerPlugin RygelTrackerPlugin;
typedef struct _RygelTrackerPluginClass RygelTrackerPluginClass;
typedef struct _RygelTrackerParamSpecPluginFactory RygelTrackerParamSpecPluginFactory;

struct _RygelTrackerPluginFactory {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelTrackerPluginFactoryPrivate * priv;
};

struct _RygelTrackerPluginFactoryClass {
	GTypeClass parent_class;
	void (*finalize) (RygelTrackerPluginFactory *self);
};

struct _RygelTrackerStatsIfaceIface {
	GTypeInterface parent_iface;
	gchar** (*get) (RygelTrackerStatsIface* self, int* result_length1, int* result_length2, GError** error);
};

struct _RygelTrackerPluginFactoryPrivate {
	RygelTrackerStatsIface* stats;
	RygelPluginLoader* loader;
};

struct _RygelTrackerParamSpecPluginFactory {
	GParamSpec parent_instance;
};


extern RygelTrackerPluginFactory* plugin_factory;
RygelTrackerPluginFactory* plugin_factory = NULL;
static gpointer rygel_tracker_plugin_factory_parent_class = NULL;

gpointer rygel_tracker_plugin_factory_ref (gpointer instance);
void rygel_tracker_plugin_factory_unref (gpointer instance);
GParamSpec* rygel_tracker_param_spec_plugin_factory (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_tracker_value_set_plugin_factory (GValue* value, gpointer v_object);
void rygel_tracker_value_take_plugin_factory (GValue* value, gpointer v_object);
gpointer rygel_tracker_value_get_plugin_factory (const GValue* value);
GType rygel_tracker_plugin_factory_get_type (void) G_GNUC_CONST;
void module_init (RygelPluginLoader* loader);
#define RYGEL_TRACKER_PLUGIN_NAME "Tracker"
RygelTrackerPluginFactory* rygel_tracker_plugin_factory_new (RygelPluginLoader* loader, GError** error);
RygelTrackerPluginFactory* rygel_tracker_plugin_factory_construct (GType object_type, RygelPluginLoader* loader, GError** error);
GType rygel_tracker_stats_iface_proxy_get_type (void) G_GNUC_CONST;
guint rygel_tracker_stats_iface_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType rygel_tracker_stats_iface_get_type (void) G_GNUC_CONST;
#define RYGEL_TRACKER_PLUGIN_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, RygelTrackerPluginFactoryPrivate))
enum  {
	RYGEL_TRACKER_PLUGIN_FACTORY_DUMMY_PROPERTY
};
#define RYGEL_TRACKER_PLUGIN_FACTORY_TRACKER_SERVICE "org.freedesktop.Tracker1"
#define RYGEL_TRACKER_PLUGIN_FACTORY_STATISTICS_OBJECT "/org/freedesktop/Tracker1/Statistics"
gchar** rygel_tracker_stats_iface_get (RygelTrackerStatsIface* self, int* result_length1, int* result_length2, GError** error);
RygelTrackerPlugin* rygel_tracker_plugin_new (void);
RygelTrackerPlugin* rygel_tracker_plugin_construct (GType object_type);
GType rygel_tracker_plugin_get_type (void) G_GNUC_CONST;
static void rygel_tracker_plugin_factory_finalize (RygelTrackerPluginFactory* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


void module_init (RygelPluginLoader* loader) {
	RygelPluginLoader* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_if_fail (loader != NULL);
	_tmp0_ = loader;
	_tmp1_ = rygel_plugin_loader_plugin_disabled (_tmp0_, RYGEL_TRACKER_PLUGIN_NAME);
	if (_tmp1_) {
		g_message ("rygel-tracker-plugin-factory.vala:33: Plugin '%s' disabled by user, ig" \
"noring..", RYGEL_TRACKER_PLUGIN_NAME);
		return;
	}
	{
		RygelTrackerPluginFactory* _tmp2_ = NULL;
		RygelPluginLoader* _tmp3_ = NULL;
		RygelTrackerPluginFactory* _tmp4_ = NULL;
		RygelTrackerPluginFactory* _tmp5_ = NULL;
		_tmp3_ = loader;
		_tmp4_ = rygel_tracker_plugin_factory_new (_tmp3_, &_inner_error_);
		_tmp2_ = _tmp4_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch14_g_error;
		}
		_tmp5_ = _tmp2_;
		_tmp2_ = NULL;
		_rygel_tracker_plugin_factory_unref0 (plugin_factory);
		plugin_factory = _tmp5_;
		_rygel_tracker_plugin_factory_unref0 (_tmp2_);
	}
	goto __finally14;
	__catch14_g_error:
	{
		GError* err = NULL;
		const gchar* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = _ ("Failed to start Tracker service: %s. Plugin disabled.");
		_tmp7_ = err;
		_tmp8_ = _tmp7_->message;
		g_warning (_tmp6_, _tmp8_);
		_g_error_free0 (err);
	}
	__finally14:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


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


RygelTrackerPluginFactory* rygel_tracker_plugin_factory_construct (GType object_type, RygelPluginLoader* loader, GError** error) {
	RygelTrackerPluginFactory* self = NULL;
	RygelTrackerStatsIface* _tmp0_ = NULL;
	RygelTrackerStatsIface* _tmp1_ = NULL;
	RygelTrackerStatsIface* _tmp2_ = NULL;
	RygelPluginLoader* _tmp3_ = NULL;
	RygelPluginLoader* _tmp4_ = NULL;
	RygelTrackerStatsIface* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	gchar** _tmp8_ = NULL;
	gchar** _tmp9_ = NULL;
	gint _tmp9__length1 = 0;
	gint _tmp9__length2 = 0;
	RygelPluginLoader* _tmp10_ = NULL;
	RygelTrackerPlugin* _tmp11_ = NULL;
	RygelTrackerPlugin* _tmp12_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (loader != NULL, NULL);
	self = (RygelTrackerPluginFactory*) g_type_create_instance (object_type);
	_tmp1_ = g_initable_new (RYGEL_TRACKER_TYPE_STATS_IFACE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", RYGEL_TRACKER_PLUGIN_FACTORY_TRACKER_SERVICE, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", RYGEL_TRACKER_PLUGIN_FACTORY_STATISTICS_OBJECT, "g-interface-name", "org.freedesktop.Tracker1.Statistics", "g-interface-info", g_type_get_qdata (RYGEL_TRACKER_TYPE_STATS_IFACE, g_quark_from_static_string ("vala-dbus-interface-info")), NULL);
	_tmp0_ = (RygelTrackerStatsIface*) _tmp1_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if ((_inner_error_->domain == G_IO_ERROR) || (_inner_error_->domain == G_DBUS_ERROR)) {
			g_propagate_error (error, _inner_error_);
			_rygel_tracker_plugin_factory_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->stats);
	self->priv->stats = _tmp2_;
	_tmp3_ = loader;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->loader);
	self->priv->loader = _tmp4_;
	_tmp5_ = self->priv->stats;
	_tmp8_ = rygel_tracker_stats_iface_get (_tmp5_, &_tmp6_, &_tmp7_, &_inner_error_);
	_tmp9_ = _tmp8_;
	_tmp9__length1 = _tmp6_;
	_tmp9__length2 = _tmp7_;
	_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1 * _tmp9__length2, (GDestroyNotify) g_free), NULL);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if ((_inner_error_->domain == G_IO_ERROR) || (_inner_error_->domain == G_DBUS_ERROR)) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (_tmp0_);
			_rygel_tracker_plugin_factory_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (_tmp0_);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	_tmp10_ = self->priv->loader;
	_tmp11_ = rygel_tracker_plugin_new ();
	_tmp12_ = _tmp11_;
	rygel_plugin_loader_add_plugin (_tmp10_, (RygelPlugin*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp0_);
	return self;
}


RygelTrackerPluginFactory* rygel_tracker_plugin_factory_new (RygelPluginLoader* loader, GError** error) {
	return rygel_tracker_plugin_factory_construct (RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, loader, error);
}


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


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


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


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


static gchar* rygel_tracker_value_plugin_factory_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		RygelTrackerPluginFactory* 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 = rygel_tracker_plugin_factory_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* rygel_tracker_value_plugin_factory_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	RygelTrackerPluginFactory** 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 = rygel_tracker_plugin_factory_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* rygel_tracker_param_spec_plugin_factory (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	RygelTrackerParamSpecPluginFactory* spec;
	g_return_val_if_fail (g_type_is_a (object_type, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY), 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 rygel_tracker_value_get_plugin_factory (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY), NULL);
	return value->data[0].v_pointer;
}


void rygel_tracker_value_set_plugin_factory (GValue* value, gpointer v_object) {
	RygelTrackerPluginFactory* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY));
		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;
		rygel_tracker_plugin_factory_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		rygel_tracker_plugin_factory_unref (old);
	}
}


void rygel_tracker_value_take_plugin_factory (GValue* value, gpointer v_object) {
	RygelTrackerPluginFactory* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY));
		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) {
		rygel_tracker_plugin_factory_unref (old);
	}
}


static void rygel_tracker_plugin_factory_class_init (RygelTrackerPluginFactoryClass * klass) {
	rygel_tracker_plugin_factory_parent_class = g_type_class_peek_parent (klass);
	((RygelTrackerPluginFactoryClass *) klass)->finalize = rygel_tracker_plugin_factory_finalize;
	g_type_class_add_private (klass, sizeof (RygelTrackerPluginFactoryPrivate));
}


static void rygel_tracker_plugin_factory_instance_init (RygelTrackerPluginFactory * self) {
	self->priv = RYGEL_TRACKER_PLUGIN_FACTORY_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void rygel_tracker_plugin_factory_finalize (RygelTrackerPluginFactory* obj) {
	RygelTrackerPluginFactory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TRACKER_TYPE_PLUGIN_FACTORY, RygelTrackerPluginFactory);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->stats);
	_g_object_unref0 (self->priv->loader);
}


GType rygel_tracker_plugin_factory_get_type (void) {
	static volatile gsize rygel_tracker_plugin_factory_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_tracker_plugin_factory_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { rygel_tracker_value_plugin_factory_init, rygel_tracker_value_plugin_factory_free_value, rygel_tracker_value_plugin_factory_copy_value, rygel_tracker_value_plugin_factory_peek_pointer, "p", rygel_tracker_value_plugin_factory_collect_value, "p", rygel_tracker_value_plugin_factory_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (RygelTrackerPluginFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_tracker_plugin_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelTrackerPluginFactory), 0, (GInstanceInitFunc) rygel_tracker_plugin_factory_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 rygel_tracker_plugin_factory_type_id;
		rygel_tracker_plugin_factory_type_id = g_type_register_fundamental (g_type_fundamental_next (), "RygelTrackerPluginFactory", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&rygel_tracker_plugin_factory_type_id__volatile, rygel_tracker_plugin_factory_type_id);
	}
	return rygel_tracker_plugin_factory_type_id__volatile;
}


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


void rygel_tracker_plugin_factory_unref (gpointer instance) {
	RygelTrackerPluginFactory* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		RYGEL_TRACKER_PLUGIN_FACTORY_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



