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

/*
* Copyright (c) 2011-2013 Yorba Foundation
*
* 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
* 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 "io.elementary.photos.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <float.h>
#include <math.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  {
	PLUGINS_STANDARD_HOST_INTERFACE_0_PROPERTY,
	PLUGINS_STANDARD_HOST_INTERFACE_NUM_PROPERTIES
};
static GParamSpec* plugins_standard_host_interface_properties[PLUGINS_STANDARD_HOST_INTERFACE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _PluginsStandardHostInterfacePrivate {
	gchar* config_domain;
	gchar* config_id;
	GFile* module_file;
	SpitPluggableInfo info;
};

static gint PluginsStandardHostInterface_private_offset;
static gpointer plugins_standard_host_interface_parent_class = NULL;
static SpitHostInterfaceIface * plugins_standard_host_interface_spit_host_interface_parent_iface = NULL;

static GFile* plugins_standard_host_interface_real_get_module_file (SpitHostInterface* base);
static gboolean plugins_standard_host_interface_real_get_config_bool (SpitHostInterface* base,
                                                               const gchar* key,
                                                               gboolean def);
static void plugins_standard_host_interface_real_set_config_bool (SpitHostInterface* base,
                                                           const gchar* key,
                                                           gboolean val);
static gint plugins_standard_host_interface_real_get_config_int (SpitHostInterface* base,
                                                          const gchar* key,
                                                          gint def);
static void plugins_standard_host_interface_real_set_config_int (SpitHostInterface* base,
                                                          const gchar* key,
                                                          gint val);
static gchar* plugins_standard_host_interface_real_get_config_string (SpitHostInterface* base,
                                                               const gchar* key,
                                                               const gchar* def);
static void plugins_standard_host_interface_real_set_config_string (SpitHostInterface* base,
                                                             const gchar* key,
                                                             const gchar* val);
static gdouble plugins_standard_host_interface_real_get_config_double (SpitHostInterface* base,
                                                                const gchar* key,
                                                                gdouble def);
static void plugins_standard_host_interface_real_set_config_double (SpitHostInterface* base,
                                                             const gchar* key,
                                                             gdouble val);
static void plugins_standard_host_interface_real_unset_config_key (SpitHostInterface* base,
                                                            const gchar* key);
static void plugins_standard_host_interface_finalize (GObject * obj);
static GType plugins_standard_host_interface_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
plugins_standard_host_interface_get_instance_private (PluginsStandardHostInterface* self)
{
	return G_STRUCT_MEMBER_P (self, PluginsStandardHostInterface_private_offset);
}

PluginsStandardHostInterface*
plugins_standard_host_interface_construct (GType object_type,
                                           SpitPluggable* pluggable,
                                           const gchar* config_domain)
{
	PluginsStandardHostInterface * self = NULL;
	gchar* _tmp0_;
	GFile* _tmp1_;
	g_return_val_if_fail (pluggable != NULL, NULL);
	g_return_val_if_fail (config_domain != NULL, NULL);
	self = (PluginsStandardHostInterface*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (config_domain);
	_g_free0 (self->priv->config_domain);
	self->priv->config_domain = _tmp0_;
	_tmp1_ = plugins_get_pluggable_module_file (pluggable);
	_g_object_unref0 (self->priv->module_file);
	self->priv->module_file = _tmp1_;
	spit_pluggable_get_info (pluggable, &self->priv->info);
	return self;
}

PluginsStandardHostInterface*
plugins_standard_host_interface_new (SpitPluggable* pluggable,
                                     const gchar* config_domain)
{
	return plugins_standard_host_interface_construct (PLUGINS_TYPE_STANDARD_HOST_INTERFACE, pluggable, config_domain);
}

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

static GFile*
plugins_standard_host_interface_real_get_module_file (SpitHostInterface* base)
{
	PluginsStandardHostInterface * self;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GFile* result;
	self = (PluginsStandardHostInterface*) base;
	_tmp0_ = self->priv->module_file;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
plugins_standard_host_interface_real_get_config_bool (SpitHostInterface* base,
                                                      const gchar* key,
                                                      gboolean def)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	self = (PluginsStandardHostInterface*) base;
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	_tmp4_ = configuration_facade_get_plugin_bool ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, def);
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
plugins_standard_host_interface_real_set_config_bool (SpitHostInterface* base,
                                                      const gchar* key,
                                                      gboolean val)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (PluginsStandardHostInterface*) base;
	g_return_if_fail (key != NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	configuration_facade_set_plugin_bool ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, val);
	_g_object_unref0 (_tmp1_);
}

static gint
plugins_standard_host_interface_real_get_config_int (SpitHostInterface* base,
                                                     const gchar* key,
                                                     gint def)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint result;
	self = (PluginsStandardHostInterface*) base;
	g_return_val_if_fail (key != NULL, -1);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	_tmp4_ = configuration_facade_get_plugin_int ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, def);
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
plugins_standard_host_interface_real_set_config_int (SpitHostInterface* base,
                                                     const gchar* key,
                                                     gint val)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (PluginsStandardHostInterface*) base;
	g_return_if_fail (key != NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	configuration_facade_set_plugin_int ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, val);
	_g_object_unref0 (_tmp1_);
}

static gchar*
plugins_standard_host_interface_real_get_config_string (SpitHostInterface* base,
                                                        const gchar* key,
                                                        const gchar* def)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	self = (PluginsStandardHostInterface*) base;
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	_tmp4_ = configuration_facade_get_plugin_string ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, def);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp1_);
	result = _tmp5_;
	return result;
}

static void
plugins_standard_host_interface_real_set_config_string (SpitHostInterface* base,
                                                        const gchar* key,
                                                        const gchar* val)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (PluginsStandardHostInterface*) base;
	g_return_if_fail (key != NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	configuration_facade_set_plugin_string ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, val);
	_g_object_unref0 (_tmp1_);
}

static gdouble
plugins_standard_host_interface_real_get_config_double (SpitHostInterface* base,
                                                        const gchar* key,
                                                        gdouble def)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gdouble _tmp4_;
	gdouble result;
	self = (PluginsStandardHostInterface*) base;
	g_return_val_if_fail (key != NULL, -1.0);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	_tmp4_ = configuration_facade_get_plugin_double ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, def);
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
plugins_standard_host_interface_real_set_config_double (SpitHostInterface* base,
                                                        const gchar* key,
                                                        gdouble val)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (PluginsStandardHostInterface*) base;
	g_return_if_fail (key != NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	configuration_facade_set_plugin_double ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key, val);
	_g_object_unref0 (_tmp1_);
}

static void
plugins_standard_host_interface_real_unset_config_key (SpitHostInterface* base,
                                                       const gchar* key)
{
	PluginsStandardHostInterface * self;
	ConfigFacade* _tmp0_;
	ConfigFacade* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (PluginsStandardHostInterface*) base;
	g_return_if_fail (key != NULL);
	_tmp0_ = config_facade_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->config_domain;
	_tmp3_ = self->priv->config_id;
	configuration_facade_unset_plugin_key ((ConfigurationFacade*) _tmp1_, _tmp2_, _tmp3_, key);
	_g_object_unref0 (_tmp1_);
}

static void
plugins_standard_host_interface_class_init (PluginsStandardHostInterfaceClass * klass,
                                            gpointer klass_data)
{
	plugins_standard_host_interface_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PluginsStandardHostInterface_private_offset);
	G_OBJECT_CLASS (klass)->finalize = plugins_standard_host_interface_finalize;
}

static void
plugins_standard_host_interface_spit_host_interface_interface_init (SpitHostInterfaceIface * iface,
                                                                    gpointer iface_data)
{
	plugins_standard_host_interface_spit_host_interface_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_module_file = (GFile* (*) (SpitHostInterface*)) plugins_standard_host_interface_real_get_module_file;
	iface->get_config_bool = (gboolean (*) (SpitHostInterface*, const gchar*, gboolean)) plugins_standard_host_interface_real_get_config_bool;
	iface->set_config_bool = (void (*) (SpitHostInterface*, const gchar*, gboolean)) plugins_standard_host_interface_real_set_config_bool;
	iface->get_config_int = (gint (*) (SpitHostInterface*, const gchar*, gint)) plugins_standard_host_interface_real_get_config_int;
	iface->set_config_int = (void (*) (SpitHostInterface*, const gchar*, gint)) plugins_standard_host_interface_real_set_config_int;
	iface->get_config_string = (gchar* (*) (SpitHostInterface*, const gchar*, const gchar*)) plugins_standard_host_interface_real_get_config_string;
	iface->set_config_string = (void (*) (SpitHostInterface*, const gchar*, const gchar*)) plugins_standard_host_interface_real_set_config_string;
	iface->get_config_double = (gdouble (*) (SpitHostInterface*, const gchar*, gdouble)) plugins_standard_host_interface_real_get_config_double;
	iface->set_config_double = (void (*) (SpitHostInterface*, const gchar*, gdouble)) plugins_standard_host_interface_real_set_config_double;
	iface->unset_config_key = (void (*) (SpitHostInterface*, const gchar*)) plugins_standard_host_interface_real_unset_config_key;
}

static void
plugins_standard_host_interface_instance_init (PluginsStandardHostInterface * self,
                                               gpointer klass)
{
	self->priv = plugins_standard_host_interface_get_instance_private (self);
}

static void
plugins_standard_host_interface_finalize (GObject * obj)
{
	PluginsStandardHostInterface * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLUGINS_TYPE_STANDARD_HOST_INTERFACE, PluginsStandardHostInterface);
	_g_free0 (self->priv->config_domain);
	_g_free0 (self->priv->config_id);
	_g_object_unref0 (self->priv->module_file);
	spit_pluggable_info_destroy (&self->priv->info);
	G_OBJECT_CLASS (plugins_standard_host_interface_parent_class)->finalize (obj);
}

static GType
plugins_standard_host_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PluginsStandardHostInterfaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plugins_standard_host_interface_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PluginsStandardHostInterface), 0, (GInstanceInitFunc) plugins_standard_host_interface_instance_init, NULL };
	static const GInterfaceInfo spit_host_interface_info = { (GInterfaceInitFunc) plugins_standard_host_interface_spit_host_interface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType plugins_standard_host_interface_type_id;
	plugins_standard_host_interface_type_id = g_type_register_static (G_TYPE_OBJECT, "PluginsStandardHostInterface", &g_define_type_info, 0);
	g_type_add_interface_static (plugins_standard_host_interface_type_id, SPIT_TYPE_HOST_INTERFACE, &spit_host_interface_info);
	PluginsStandardHostInterface_private_offset = g_type_add_instance_private (plugins_standard_host_interface_type_id, sizeof (PluginsStandardHostInterfacePrivate));
	return plugins_standard_host_interface_type_id;
}

GType
plugins_standard_host_interface_get_type (void)
{
	static volatile gsize plugins_standard_host_interface_type_id__once = 0;
	if (g_once_init_enter (&plugins_standard_host_interface_type_id__once)) {
		GType plugins_standard_host_interface_type_id;
		plugins_standard_host_interface_type_id = plugins_standard_host_interface_get_type_once ();
		g_once_init_leave (&plugins_standard_host_interface_type_id__once, plugins_standard_host_interface_type_id);
	}
	return plugins_standard_host_interface_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

