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

/*
 * Seahorse
 *
 * Copyright (C) 2018 Niels De Graef
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#include "seahorse-common.h"
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.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  {
	SEAHORSE_APP_SETTINGS_0_PROPERTY,
	SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY,
	SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY,
	SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY,
	SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY,
	SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY,
	SEAHORSE_APP_SETTINGS_NUM_PROPERTIES
};
static GParamSpec* seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer seahorse_app_settings_parent_class = NULL;
static SeahorseAppSettings* seahorse_app_settings__instance;
static SeahorseAppSettings* seahorse_app_settings__instance = NULL;

static void seahorse_app_settings_finalize (GObject * obj);
static GType seahorse_app_settings_get_type_once (void);
static void _vala_seahorse_app_settings_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_seahorse_app_settings_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
static gssize _vala_array_length (gpointer array);

SeahorseAppSettings*
seahorse_app_settings_construct (GType object_type)
{
	SeahorseAppSettings * self = NULL;
	self = (SeahorseAppSettings*) g_object_new (object_type, "schema-id", "org.gnome.seahorse", NULL);
	return self;
}

SeahorseAppSettings*
seahorse_app_settings_new (void)
{
	return seahorse_app_settings_construct (SEAHORSE_TYPE_APP_SETTINGS);
}

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

SeahorseAppSettings*
seahorse_app_settings_instance (void)
{
	SeahorseAppSettings* _tmp0_;
	SeahorseAppSettings* _tmp2_;
	SeahorseAppSettings* _tmp3_;
	SeahorseAppSettings* result;
	_tmp0_ = seahorse_app_settings__instance;
	if (_tmp0_ == NULL) {
		SeahorseAppSettings* _tmp1_;
		_tmp1_ = seahorse_app_settings_new ();
		_g_object_unref0 (seahorse_app_settings__instance);
		seahorse_app_settings__instance = _tmp1_;
	}
	_tmp2_ = seahorse_app_settings__instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

gchar**
seahorse_app_settings_get_last_search_servers (SeahorseAppSettings* self)
{
	gchar** result;
	gchar** _tmp0_;
	gchar** _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = _tmp0_ = g_settings_get_strv ((GSettings*) self, "last-search-servers");
	result = _tmp1_;
	return result;
}

void
seahorse_app_settings_set_last_search_servers (SeahorseAppSettings* self,
                                               gchar** value)
{
	g_return_if_fail (self != NULL);
	g_settings_set_strv ((GSettings*) self, "last-search-servers", value);
	g_object_notify_by_pspec ((GObject *) self, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY]);
}

gchar*
seahorse_app_settings_get_last_search_text (SeahorseAppSettings* self)
{
	gchar* result;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_settings_get_string ((GSettings*) self, "last-search-text");
	result = _tmp0_;
	return result;
}

void
seahorse_app_settings_set_last_search_text (SeahorseAppSettings* self,
                                            const gchar* value)
{
	g_return_if_fail (self != NULL);
	g_settings_set_string ((GSettings*) self, "last-search-text", value);
	g_object_notify_by_pspec ((GObject *) self, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY]);
}

gboolean
seahorse_app_settings_get_server_auto_publish (SeahorseAppSettings* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = g_settings_get_boolean ((GSettings*) self, "server-auto-publish");
	return result;
}

void
seahorse_app_settings_set_server_auto_publish (SeahorseAppSettings* self,
                                               gboolean value)
{
	g_return_if_fail (self != NULL);
	g_settings_set_boolean ((GSettings*) self, "server-auto-publish", value);
	g_object_notify_by_pspec ((GObject *) self, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY]);
}

gboolean
seahorse_app_settings_get_server_auto_retrieve (SeahorseAppSettings* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = g_settings_get_boolean ((GSettings*) self, "server-auto-retrieve");
	return result;
}

void
seahorse_app_settings_set_server_auto_retrieve (SeahorseAppSettings* self,
                                                gboolean value)
{
	g_return_if_fail (self != NULL);
	g_settings_set_boolean ((GSettings*) self, "server-auto-retrieve", value);
	g_object_notify_by_pspec ((GObject *) self, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY]);
}

gchar*
seahorse_app_settings_get_server_publish_to (SeahorseAppSettings* self)
{
	gchar* result;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_settings_get_string ((GSettings*) self, "server-publish-to");
	result = _tmp0_;
	return result;
}

void
seahorse_app_settings_set_server_publish_to (SeahorseAppSettings* self,
                                             const gchar* value)
{
	g_return_if_fail (self != NULL);
	g_settings_set_string ((GSettings*) self, "server-publish-to", value);
	g_object_notify_by_pspec ((GObject *) self, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY]);
}

static void
seahorse_app_settings_class_init (SeahorseAppSettingsClass * klass,
                                  gpointer klass_data)
{
	seahorse_app_settings_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_seahorse_app_settings_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_seahorse_app_settings_set_property;
	G_OBJECT_CLASS (klass)->finalize = seahorse_app_settings_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY] = g_param_spec_boxed ("last-search-servers", "last-search-servers", "last-search-servers", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY] = g_param_spec_string ("last-search-text", "last-search-text", "last-search-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY] = g_param_spec_boolean ("server-auto-publish", "server-auto-publish", "server-auto-publish", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY] = g_param_spec_boolean ("server-auto-retrieve", "server-auto-retrieve", "server-auto-retrieve", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY, seahorse_app_settings_properties[SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY] = g_param_spec_string ("server-publish-to", "server-publish-to", "server-publish-to", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
seahorse_app_settings_instance_init (SeahorseAppSettings * self,
                                     gpointer klass)
{
}

static void
seahorse_app_settings_finalize (GObject * obj)
{
	SeahorseAppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_APP_SETTINGS, SeahorseAppSettings);
	G_OBJECT_CLASS (seahorse_app_settings_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
seahorse_app_settings_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SeahorseAppSettingsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_app_settings_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorseAppSettings), 0, (GInstanceInitFunc) seahorse_app_settings_instance_init, NULL };
	GType seahorse_app_settings_type_id;
	seahorse_app_settings_type_id = g_type_register_static (g_settings_get_type (), "SeahorseAppSettings", &g_define_type_info, 0);
	return seahorse_app_settings_type_id;
}

GType
seahorse_app_settings_get_type (void)
{
	static volatile gsize seahorse_app_settings_type_id__once = 0;
	if (g_once_init_enter (&seahorse_app_settings_type_id__once)) {
		GType seahorse_app_settings_type_id;
		seahorse_app_settings_type_id = seahorse_app_settings_get_type_once ();
		g_once_init_leave (&seahorse_app_settings_type_id__once, seahorse_app_settings_type_id);
	}
	return seahorse_app_settings_type_id__once;
}

static void
_vala_seahorse_app_settings_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	SeahorseAppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_APP_SETTINGS, SeahorseAppSettings);
	switch (property_id) {
		case SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY:
		g_value_take_boxed (value, seahorse_app_settings_get_last_search_servers (self));
		break;
		case SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY:
		g_value_take_string (value, seahorse_app_settings_get_last_search_text (self));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY:
		g_value_set_boolean (value, seahorse_app_settings_get_server_auto_publish (self));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY:
		g_value_set_boolean (value, seahorse_app_settings_get_server_auto_retrieve (self));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY:
		g_value_take_string (value, seahorse_app_settings_get_server_publish_to (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_seahorse_app_settings_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	SeahorseAppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_APP_SETTINGS, SeahorseAppSettings);
	switch (property_id) {
		case SEAHORSE_APP_SETTINGS_LAST_SEARCH_SERVERS_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			seahorse_app_settings_set_last_search_servers (self, boxed);
		}
		break;
		case SEAHORSE_APP_SETTINGS_LAST_SEARCH_TEXT_PROPERTY:
		seahorse_app_settings_set_last_search_text (self, g_value_get_string (value));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_AUTO_PUBLISH_PROPERTY:
		seahorse_app_settings_set_server_auto_publish (self, g_value_get_boolean (value));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_AUTO_RETRIEVE_PROPERTY:
		seahorse_app_settings_set_server_auto_retrieve (self, g_value_get_boolean (value));
		break;
		case SEAHORSE_APP_SETTINGS_SERVER_PUBLISH_TO_PROPERTY:
		seahorse_app_settings_set_server_publish_to (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

