/* registry.c generated by valac 0.20.1.64-fa28c, the Vala compiler
 * generated from registry.vala, do not modify */

/*
 * Seahorse
 *
 * Copyright (C) 2008 Stefan Walter
 * Copyright (C) 2013 Stefan Walter
 *
 * This program 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.
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include "seahorse-internal.h"
#include <stdlib.h>
#include <string.h>

#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

struct _SeahorseRegistryPrivate {
	GHashTable* _objects;
};


static gpointer seahorse_registry_parent_class = NULL;
static SeahorseRegistry* seahorse_registry__singleton;
static SeahorseRegistry* seahorse_registry__singleton = NULL;

#define SEAHORSE_REGISTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_REGISTRY, SeahorseRegistryPrivate))
enum  {
	SEAHORSE_REGISTRY_DUMMY_PROPERTY
};
static SeahorseRegistry* seahorse_registry_instance (void);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
static GObject * seahorse_registry_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _g_hash_table_unref0_ (gpointer var);
static void seahorse_registry_finalize (GObject* obj);


static gpointer _g_object_ref0 (gpointer self) {
#line 33 "/data/projects/seahorse/common/registry.vala"
	return self ? g_object_ref (self) : NULL;
#line 61 "registry.c"
}


static SeahorseRegistry* seahorse_registry_instance (void) {
	SeahorseRegistry* result = NULL;
	SeahorseRegistry* _tmp0_ = NULL;
	SeahorseRegistry* _tmp2_ = NULL;
	SeahorseRegistry* _tmp3_ = NULL;
#line 31 "/data/projects/seahorse/common/registry.vala"
	_tmp0_ = seahorse_registry__singleton;
#line 31 "/data/projects/seahorse/common/registry.vala"
	if (_tmp0_ == NULL) {
#line 74 "registry.c"
		SeahorseRegistry* _tmp1_ = NULL;
#line 32 "/data/projects/seahorse/common/registry.vala"
		_tmp1_ = seahorse_registry_new ();
#line 32 "/data/projects/seahorse/common/registry.vala"
		_g_object_unref0 (seahorse_registry__singleton);
#line 32 "/data/projects/seahorse/common/registry.vala"
		seahorse_registry__singleton = _tmp1_;
#line 82 "registry.c"
	}
#line 33 "/data/projects/seahorse/common/registry.vala"
	_tmp2_ = seahorse_registry__singleton;
#line 33 "/data/projects/seahorse/common/registry.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 33 "/data/projects/seahorse/common/registry.vala"
	result = _tmp3_;
#line 33 "/data/projects/seahorse/common/registry.vala"
	return result;
#line 92 "registry.c"
}


void seahorse_registry_cleanup (void) {
#line 37 "/data/projects/seahorse/common/registry.vala"
	_g_object_unref0 (seahorse_registry__singleton);
#line 37 "/data/projects/seahorse/common/registry.vala"
	seahorse_registry__singleton = NULL;
#line 101 "registry.c"
}


static gpointer _g_hash_table_ref0 (gpointer self) {
#line 45 "/data/projects/seahorse/common/registry.vala"
	return self ? g_hash_table_ref (self) : NULL;
#line 108 "registry.c"
}


static void _g_object_unref0_ (gpointer var) {
#line 47 "/data/projects/seahorse/common/registry.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 115 "registry.c"
}


void seahorse_registry_register_object (GObject* object, const gchar* category) {
	SeahorseRegistry* registry = NULL;
	SeahorseRegistry* _tmp0_ = NULL;
	GHashTable* oset = NULL;
	SeahorseRegistry* _tmp1_ = NULL;
	GHashTable* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gconstpointer _tmp4_ = NULL;
	GHashTable* _tmp5_ = NULL;
	GHashTable* _tmp6_ = NULL;
	GHashTable* _tmp16_ = NULL;
	GObject* _tmp17_ = NULL;
	GObject* _tmp18_ = NULL;
	GObject* _tmp19_ = NULL;
	GObject* _tmp20_ = NULL;
#line 40 "/data/projects/seahorse/common/registry.vala"
	g_return_if_fail (object != NULL);
#line 40 "/data/projects/seahorse/common/registry.vala"
	g_return_if_fail (category != NULL);
#line 42 "/data/projects/seahorse/common/registry.vala"
	_tmp0_ = seahorse_registry_instance ();
#line 42 "/data/projects/seahorse/common/registry.vala"
	registry = _tmp0_;
#line 45 "/data/projects/seahorse/common/registry.vala"
	_tmp1_ = registry;
#line 45 "/data/projects/seahorse/common/registry.vala"
	_tmp2_ = _tmp1_->priv->_objects;
#line 45 "/data/projects/seahorse/common/registry.vala"
	_tmp3_ = category;
#line 45 "/data/projects/seahorse/common/registry.vala"
	_tmp4_ = g_hash_table_lookup (_tmp2_, _tmp3_);
#line 45 "/data/projects/seahorse/common/registry.vala"
	_tmp5_ = _g_hash_table_ref0 ((GHashTable*) _tmp4_);
#line 45 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 45 "/data/projects/seahorse/common/registry.vala"
	oset = _tmp5_;
#line 46 "/data/projects/seahorse/common/registry.vala"
	_tmp6_ = oset;
#line 46 "/data/projects/seahorse/common/registry.vala"
	if (_tmp6_ == NULL) {
#line 160 "registry.c"
		GHashFunc _tmp7_ = NULL;
		GEqualFunc _tmp8_ = NULL;
		GHashTable* _tmp9_ = NULL;
		SeahorseRegistry* _tmp10_ = NULL;
		GHashTable* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		GHashTable* _tmp14_ = NULL;
		GHashTable* _tmp15_ = NULL;
#line 47 "/data/projects/seahorse/common/registry.vala"
		_tmp7_ = g_direct_hash;
#line 47 "/data/projects/seahorse/common/registry.vala"
		_tmp8_ = g_direct_equal;
#line 47 "/data/projects/seahorse/common/registry.vala"
		_tmp9_ = g_hash_table_new_full (_tmp7_, _tmp8_, _g_object_unref0_, _g_object_unref0_);
#line 47 "/data/projects/seahorse/common/registry.vala"
		_g_hash_table_unref0 (oset);
#line 47 "/data/projects/seahorse/common/registry.vala"
		oset = _tmp9_;
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp10_ = registry;
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp11_ = _tmp10_->priv->_objects;
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp12_ = category;
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp13_ = g_strdup (_tmp12_);
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp14_ = oset;
#line 48 "/data/projects/seahorse/common/registry.vala"
		_tmp15_ = _g_hash_table_ref0 (_tmp14_);
#line 48 "/data/projects/seahorse/common/registry.vala"
		g_hash_table_replace (_tmp11_, _tmp13_, _tmp15_);
#line 194 "registry.c"
	}
#line 51 "/data/projects/seahorse/common/registry.vala"
	_tmp16_ = oset;
#line 51 "/data/projects/seahorse/common/registry.vala"
	_tmp17_ = object;
#line 51 "/data/projects/seahorse/common/registry.vala"
	_tmp18_ = _g_object_ref0 (_tmp17_);
#line 51 "/data/projects/seahorse/common/registry.vala"
	_tmp19_ = object;
#line 51 "/data/projects/seahorse/common/registry.vala"
	_tmp20_ = _g_object_ref0 (_tmp19_);
#line 51 "/data/projects/seahorse/common/registry.vala"
	g_hash_table_replace (_tmp16_, _tmp18_, _tmp20_);
#line 40 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 40 "/data/projects/seahorse/common/registry.vala"
	_g_object_unref0 (registry);
#line 212 "registry.c"
}


GObject* seahorse_registry_object_instance (const gchar* category) {
	GObject* result = NULL;
	SeahorseRegistry* registry = NULL;
	SeahorseRegistry* _tmp0_ = NULL;
	GHashTable* oset = NULL;
	SeahorseRegistry* _tmp1_ = NULL;
	GHashTable* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gconstpointer _tmp4_ = NULL;
	GHashTable* _tmp5_ = NULL;
	GHashTable* _tmp6_ = NULL;
	GHashTableIter iter = {0};
	GHashTable* _tmp7_ = NULL;
	GObject* key = NULL;
	GObject* value = NULL;
#line 54 "/data/projects/seahorse/common/registry.vala"
	g_return_val_if_fail (category != NULL, NULL);
#line 55 "/data/projects/seahorse/common/registry.vala"
	_tmp0_ = seahorse_registry_instance ();
#line 55 "/data/projects/seahorse/common/registry.vala"
	registry = _tmp0_;
#line 58 "/data/projects/seahorse/common/registry.vala"
	_tmp1_ = registry;
#line 58 "/data/projects/seahorse/common/registry.vala"
	_tmp2_ = _tmp1_->priv->_objects;
#line 58 "/data/projects/seahorse/common/registry.vala"
	_tmp3_ = category;
#line 58 "/data/projects/seahorse/common/registry.vala"
	_tmp4_ = g_hash_table_lookup (_tmp2_, _tmp3_);
#line 58 "/data/projects/seahorse/common/registry.vala"
	_tmp5_ = _g_hash_table_ref0 ((GHashTable*) _tmp4_);
#line 58 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 58 "/data/projects/seahorse/common/registry.vala"
	oset = _tmp5_;
#line 59 "/data/projects/seahorse/common/registry.vala"
	_tmp6_ = oset;
#line 59 "/data/projects/seahorse/common/registry.vala"
	if (_tmp6_ == NULL) {
#line 60 "/data/projects/seahorse/common/registry.vala"
		result = NULL;
#line 60 "/data/projects/seahorse/common/registry.vala"
		_g_hash_table_unref0 (oset);
#line 60 "/data/projects/seahorse/common/registry.vala"
		_g_object_unref0 (registry);
#line 60 "/data/projects/seahorse/common/registry.vala"
		return result;
#line 263 "registry.c"
	}
#line 62 "/data/projects/seahorse/common/registry.vala"
	_tmp7_ = oset;
#line 62 "/data/projects/seahorse/common/registry.vala"
	g_hash_table_iter_init (&iter, _tmp7_);
#line 65 "/data/projects/seahorse/common/registry.vala"
	while (TRUE) {
#line 271 "registry.c"
		gconstpointer _tmp8_ = NULL;
		gconstpointer _tmp9_ = NULL;
		gboolean _tmp10_ = FALSE;
		GObject* _tmp11_ = NULL;
		GObject* _tmp12_ = NULL;
#line 65 "/data/projects/seahorse/common/registry.vala"
		_tmp10_ = g_hash_table_iter_next (&iter, &_tmp8_, &_tmp9_);
#line 65 "/data/projects/seahorse/common/registry.vala"
		key = _tmp8_;
#line 65 "/data/projects/seahorse/common/registry.vala"
		value = _tmp9_;
#line 65 "/data/projects/seahorse/common/registry.vala"
		if (!_tmp10_) {
#line 65 "/data/projects/seahorse/common/registry.vala"
			break;
#line 287 "registry.c"
		}
#line 66 "/data/projects/seahorse/common/registry.vala"
		_tmp11_ = value;
#line 66 "/data/projects/seahorse/common/registry.vala"
		_tmp12_ = _g_object_ref0 (_tmp11_);
#line 66 "/data/projects/seahorse/common/registry.vala"
		result = _tmp12_;
#line 66 "/data/projects/seahorse/common/registry.vala"
		_g_hash_table_unref0 (oset);
#line 66 "/data/projects/seahorse/common/registry.vala"
		_g_object_unref0 (registry);
#line 66 "/data/projects/seahorse/common/registry.vala"
		return result;
#line 301 "registry.c"
	}
#line 69 "/data/projects/seahorse/common/registry.vala"
	result = NULL;
#line 69 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 69 "/data/projects/seahorse/common/registry.vala"
	_g_object_unref0 (registry);
#line 69 "/data/projects/seahorse/common/registry.vala"
	return result;
#line 311 "registry.c"
}


static void _g_list_free__g_object_unref0_ (GList* self) {
#line 72 "/data/projects/seahorse/common/registry.vala"
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
#line 72 "/data/projects/seahorse/common/registry.vala"
	g_list_free (self);
#line 320 "registry.c"
}


GList* seahorse_registry_object_instances (const gchar* category) {
	GList* result = NULL;
	SeahorseRegistry* registry = NULL;
	SeahorseRegistry* _tmp0_ = NULL;
	GHashTable* oset = NULL;
	GList* insts = NULL;
	SeahorseRegistry* _tmp1_ = NULL;
	GHashTable* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gconstpointer _tmp4_ = NULL;
	GHashTable* _tmp5_ = NULL;
	GHashTable* _tmp6_ = NULL;
	GHashTableIter iter = {0};
	GHashTable* _tmp7_ = NULL;
	GObject* key = NULL;
	GObject* value = NULL;
#line 72 "/data/projects/seahorse/common/registry.vala"
	g_return_val_if_fail (category != NULL, NULL);
#line 73 "/data/projects/seahorse/common/registry.vala"
	_tmp0_ = seahorse_registry_instance ();
#line 73 "/data/projects/seahorse/common/registry.vala"
	registry = _tmp0_;
#line 75 "/data/projects/seahorse/common/registry.vala"
	insts = NULL;
#line 77 "/data/projects/seahorse/common/registry.vala"
	_tmp1_ = registry;
#line 77 "/data/projects/seahorse/common/registry.vala"
	_tmp2_ = _tmp1_->priv->_objects;
#line 77 "/data/projects/seahorse/common/registry.vala"
	_tmp3_ = category;
#line 77 "/data/projects/seahorse/common/registry.vala"
	_tmp4_ = g_hash_table_lookup (_tmp2_, _tmp3_);
#line 77 "/data/projects/seahorse/common/registry.vala"
	_tmp5_ = _g_hash_table_ref0 ((GHashTable*) _tmp4_);
#line 77 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 77 "/data/projects/seahorse/common/registry.vala"
	oset = _tmp5_;
#line 78 "/data/projects/seahorse/common/registry.vala"
	_tmp6_ = oset;
#line 78 "/data/projects/seahorse/common/registry.vala"
	if (_tmp6_ == NULL) {
#line 79 "/data/projects/seahorse/common/registry.vala"
		result = insts;
#line 79 "/data/projects/seahorse/common/registry.vala"
		_g_hash_table_unref0 (oset);
#line 79 "/data/projects/seahorse/common/registry.vala"
		_g_object_unref0 (registry);
#line 79 "/data/projects/seahorse/common/registry.vala"
		return result;
#line 374 "registry.c"
	}
#line 81 "/data/projects/seahorse/common/registry.vala"
	_tmp7_ = oset;
#line 81 "/data/projects/seahorse/common/registry.vala"
	g_hash_table_iter_init (&iter, _tmp7_);
#line 84 "/data/projects/seahorse/common/registry.vala"
	while (TRUE) {
#line 382 "registry.c"
		gconstpointer _tmp8_ = NULL;
		gconstpointer _tmp9_ = NULL;
		gboolean _tmp10_ = FALSE;
		GObject* _tmp11_ = NULL;
		GObject* _tmp12_ = NULL;
#line 84 "/data/projects/seahorse/common/registry.vala"
		_tmp10_ = g_hash_table_iter_next (&iter, &_tmp8_, &_tmp9_);
#line 84 "/data/projects/seahorse/common/registry.vala"
		key = _tmp8_;
#line 84 "/data/projects/seahorse/common/registry.vala"
		value = _tmp9_;
#line 84 "/data/projects/seahorse/common/registry.vala"
		if (!_tmp10_) {
#line 84 "/data/projects/seahorse/common/registry.vala"
			break;
#line 398 "registry.c"
		}
#line 85 "/data/projects/seahorse/common/registry.vala"
		_tmp11_ = value;
#line 85 "/data/projects/seahorse/common/registry.vala"
		_tmp12_ = _g_object_ref0 (_tmp11_);
#line 85 "/data/projects/seahorse/common/registry.vala"
		insts = g_list_append (insts, _tmp12_);
#line 406 "registry.c"
	}
#line 88 "/data/projects/seahorse/common/registry.vala"
	result = insts;
#line 88 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (oset);
#line 88 "/data/projects/seahorse/common/registry.vala"
	_g_object_unref0 (registry);
#line 88 "/data/projects/seahorse/common/registry.vala"
	return result;
#line 416 "registry.c"
}


SeahorseRegistry* seahorse_registry_construct (GType object_type) {
	SeahorseRegistry * self = NULL;
#line 25 "/data/projects/seahorse/common/registry.vala"
	self = (SeahorseRegistry*) g_object_new (object_type, NULL);
#line 25 "/data/projects/seahorse/common/registry.vala"
	return self;
#line 426 "registry.c"
}


SeahorseRegistry* seahorse_registry_new (void) {
#line 25 "/data/projects/seahorse/common/registry.vala"
	return seahorse_registry_construct (SEAHORSE_TYPE_REGISTRY);
#line 433 "registry.c"
}


static void _g_hash_table_unref0_ (gpointer var) {
#line 92 "/data/projects/seahorse/common/registry.vala"
	(var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
#line 440 "registry.c"
}


static GObject * seahorse_registry_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	SeahorseRegistry * self;
	GHashFunc _tmp0_ = NULL;
	GEqualFunc _tmp1_ = NULL;
	GHashTable* _tmp2_ = NULL;
#line 91 "/data/projects/seahorse/common/registry.vala"
	parent_class = G_OBJECT_CLASS (seahorse_registry_parent_class);
#line 91 "/data/projects/seahorse/common/registry.vala"
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
#line 91 "/data/projects/seahorse/common/registry.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_REGISTRY, SeahorseRegistry);
#line 92 "/data/projects/seahorse/common/registry.vala"
	_tmp0_ = g_str_hash;
#line 92 "/data/projects/seahorse/common/registry.vala"
	_tmp1_ = g_str_equal;
#line 92 "/data/projects/seahorse/common/registry.vala"
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_hash_table_unref0_);
#line 92 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (self->priv->_objects);
#line 92 "/data/projects/seahorse/common/registry.vala"
	self->priv->_objects = _tmp2_;
#line 91 "/data/projects/seahorse/common/registry.vala"
	return obj;
#line 469 "registry.c"
}


static void seahorse_registry_class_init (SeahorseRegistryClass * klass) {
#line 25 "/data/projects/seahorse/common/registry.vala"
	seahorse_registry_parent_class = g_type_class_peek_parent (klass);
#line 25 "/data/projects/seahorse/common/registry.vala"
	g_type_class_add_private (klass, sizeof (SeahorseRegistryPrivate));
#line 25 "/data/projects/seahorse/common/registry.vala"
	G_OBJECT_CLASS (klass)->constructor = seahorse_registry_constructor;
#line 25 "/data/projects/seahorse/common/registry.vala"
	G_OBJECT_CLASS (klass)->finalize = seahorse_registry_finalize;
#line 482 "registry.c"
}


static void seahorse_registry_instance_init (SeahorseRegistry * self) {
#line 25 "/data/projects/seahorse/common/registry.vala"
	self->priv = SEAHORSE_REGISTRY_GET_PRIVATE (self);
#line 489 "registry.c"
}


static void seahorse_registry_finalize (GObject* obj) {
	SeahorseRegistry * self;
#line 25 "/data/projects/seahorse/common/registry.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_REGISTRY, SeahorseRegistry);
#line 26 "/data/projects/seahorse/common/registry.vala"
	_g_hash_table_unref0 (self->priv->_objects);
#line 25 "/data/projects/seahorse/common/registry.vala"
	G_OBJECT_CLASS (seahorse_registry_parent_class)->finalize (obj);
#line 501 "registry.c"
}


GType seahorse_registry_get_type (void) {
	static volatile gsize seahorse_registry_type_id__volatile = 0;
	if (g_once_init_enter (&seahorse_registry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SeahorseRegistryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_registry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorseRegistry), 0, (GInstanceInitFunc) seahorse_registry_instance_init, NULL };
		GType seahorse_registry_type_id;
		seahorse_registry_type_id = g_type_register_static (G_TYPE_OBJECT, "SeahorseRegistry", &g_define_type_info, 0);
		g_once_init_leave (&seahorse_registry_type_id__volatile, seahorse_registry_type_id);
	}
	return seahorse_registry_type_id__volatile;
}



