/* KeyFileFactory.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from KeyFileFactory.vala, do not modify */

/*
* Copyright 2013-2017 elementary, Inc. (https://elementary.io)
*
* 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
*
* Authored by: Julien Spautz <spautz.julien@gmail.com>
*/

#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "applications.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 STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY (startup_backend_key_file_factory_get_type ())
#define STARTUP_BACKEND_KEY_FILE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY, StartupBackendKeyFileFactory))
#define STARTUP_BACKEND_KEY_FILE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY, StartupBackendKeyFileFactoryClass))
#define STARTUP_BACKEND_IS_KEY_FILE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY))
#define STARTUP_BACKEND_IS_KEY_FILE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY))
#define STARTUP_BACKEND_KEY_FILE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY, StartupBackendKeyFileFactoryClass))

typedef struct _StartupBackendKeyFileFactory StartupBackendKeyFileFactory;
typedef struct _StartupBackendKeyFileFactoryClass StartupBackendKeyFileFactoryClass;
typedef struct _StartupBackendKeyFileFactoryPrivate StartupBackendKeyFileFactoryPrivate;
enum  {
	STARTUP_BACKEND_KEY_FILE_FACTORY_0_PROPERTY,
	STARTUP_BACKEND_KEY_FILE_FACTORY_NUM_PROPERTIES
};
static GParamSpec* startup_backend_key_file_factory_properties[STARTUP_BACKEND_KEY_FILE_FACTORY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _StartupBackendKeyFileFactory {
	GObject parent_instance;
	StartupBackendKeyFileFactoryPrivate * priv;
};

struct _StartupBackendKeyFileFactoryClass {
	GObjectClass parent_class;
};

static gpointer startup_backend_key_file_factory_parent_class = NULL;
static GeeMap* startup_backend_key_file_factory_cache;
static GeeMap* startup_backend_key_file_factory_cache = NULL;

VALA_EXTERN GType startup_backend_key_file_factory_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void startup_backend_key_file_factory_init (void);
VALA_EXTERN StartupBackendKeyFile* startup_backend_key_file_factory_get_or_create (const gchar* path);
VALA_EXTERN StartupBackendKeyFileFactory* startup_backend_key_file_factory_new (void);
VALA_EXTERN StartupBackendKeyFileFactory* startup_backend_key_file_factory_construct (GType object_type);
static void startup_backend_key_file_factory_finalize (GObject * obj);
static GType startup_backend_key_file_factory_get_type_once (void);

void
startup_backend_key_file_factory_init (void)
{
	GeeHashMap* _tmp0_;
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, STARTUP_BACKEND_TYPE_KEY_FILE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (startup_backend_key_file_factory_cache);
	startup_backend_key_file_factory_cache = (GeeMap*) _tmp0_;
}

StartupBackendKeyFile*
startup_backend_key_file_factory_get_or_create (const gchar* path)
{
	GeeMap* _tmp0_;
	gpointer _tmp1_;
	StartupBackendKeyFile* _tmp2_;
	gboolean _tmp3_;
	GeeMap* _tmp7_;
	gpointer _tmp8_;
	StartupBackendKeyFile* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = startup_backend_key_file_factory_cache;
	_tmp1_ = gee_map_get (_tmp0_, path);
	_tmp2_ = (StartupBackendKeyFile*) _tmp1_;
	_tmp3_ = _tmp2_ == NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		GeeMap* _tmp4_;
		StartupBackendKeyFile* _tmp5_;
		StartupBackendKeyFile* _tmp6_;
		_tmp4_ = startup_backend_key_file_factory_cache;
		_tmp5_ = startup_backend_key_file_new (path);
		_tmp6_ = _tmp5_;
		gee_map_set (_tmp4_, path, _tmp6_);
		_g_object_unref0 (_tmp6_);
	}
	_tmp7_ = startup_backend_key_file_factory_cache;
	_tmp8_ = gee_map_get (_tmp7_, path);
	result = (StartupBackendKeyFile*) _tmp8_;
	return result;
}

StartupBackendKeyFileFactory*
startup_backend_key_file_factory_construct (GType object_type)
{
	StartupBackendKeyFileFactory * self = NULL;
	self = (StartupBackendKeyFileFactory*) g_object_new (object_type, NULL);
	return self;
}

StartupBackendKeyFileFactory*
startup_backend_key_file_factory_new (void)
{
	return startup_backend_key_file_factory_construct (STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY);
}

static void
startup_backend_key_file_factory_class_init (StartupBackendKeyFileFactoryClass * klass,
                                             gpointer klass_data)
{
	startup_backend_key_file_factory_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = startup_backend_key_file_factory_finalize;
}

static void
startup_backend_key_file_factory_instance_init (StartupBackendKeyFileFactory * self,
                                                gpointer klass)
{
}

static void
startup_backend_key_file_factory_finalize (GObject * obj)
{
	StartupBackendKeyFileFactory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, STARTUP_BACKEND_TYPE_KEY_FILE_FACTORY, StartupBackendKeyFileFactory);
	G_OBJECT_CLASS (startup_backend_key_file_factory_parent_class)->finalize (obj);
}

static GType
startup_backend_key_file_factory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (StartupBackendKeyFileFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) startup_backend_key_file_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (StartupBackendKeyFileFactory), 0, (GInstanceInitFunc) startup_backend_key_file_factory_instance_init, NULL };
	GType startup_backend_key_file_factory_type_id;
	startup_backend_key_file_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "StartupBackendKeyFileFactory", &g_define_type_info, 0);
	return startup_backend_key_file_factory_type_id;
}

GType
startup_backend_key_file_factory_get_type (void)
{
	static volatile gsize startup_backend_key_file_factory_type_id__once = 0;
	if (g_once_init_enter (&startup_backend_key_file_factory_type_id__once)) {
		GType startup_backend_key_file_factory_type_id;
		startup_backend_key_file_factory_type_id = startup_backend_key_file_factory_get_type_once ();
		g_once_init_leave (&startup_backend_key_file_factory_type_id__once, startup_backend_key_file_factory_type_id);
	}
	return startup_backend_key_file_factory_type_id__once;
}

