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

/*
 * Copyright 2017–2021 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "granite-7.h"
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.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  {
	GRANITE_SETTINGS_PAGE_0_PROPERTY,
	GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY,
	GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY,
	GRANITE_SETTINGS_PAGE_HEADER_PROPERTY,
	GRANITE_SETTINGS_PAGE_STATUS_PROPERTY,
	GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY,
	GRANITE_SETTINGS_PAGE_TITLE_PROPERTY,
	GRANITE_SETTINGS_PAGE_CHILD_PROPERTY,
	GRANITE_SETTINGS_PAGE_NUM_PROPERTIES
};
static GParamSpec* granite_settings_page_properties[GRANITE_SETTINGS_PAGE_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 _GraniteSettingsPagePrivate {
	GtkScrolledWindow* scrolled;
	GraniteSettingsPageStatusType _status_type;
	GtkWidget* _display_widget;
	gchar* _header;
	gchar* _status;
};

static gint GraniteSettingsPage_private_offset;
static gpointer granite_settings_page_parent_class = NULL;

static GObject * granite_settings_page_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void granite_settings_page_finalize (GObject * obj);
static GType granite_settings_page_get_type_once (void);
static void _vala_granite_settings_page_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_granite_settings_page_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
granite_settings_page_get_instance_private (GraniteSettingsPage* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteSettingsPage_private_offset);
}

/**
     * Used to display a status icon overlayed on the display_widget in a Granite.SettingsSidebar
     */
static GType
granite_settings_page_status_type_get_type_once (void)
{
	static const GEnumValue values[] = {{GRANITE_SETTINGS_PAGE_STATUS_TYPE_ERROR, "GRANITE_SETTINGS_PAGE_STATUS_TYPE_ERROR", "error"}, {GRANITE_SETTINGS_PAGE_STATUS_TYPE_OFFLINE, "GRANITE_SETTINGS_PAGE_STATUS_TYPE_OFFLINE", "offline"}, {GRANITE_SETTINGS_PAGE_STATUS_TYPE_SUCCESS, "GRANITE_SETTINGS_PAGE_STATUS_TYPE_SUCCESS", "success"}, {GRANITE_SETTINGS_PAGE_STATUS_TYPE_WARNING, "GRANITE_SETTINGS_PAGE_STATUS_TYPE_WARNING", "warning"}, {GRANITE_SETTINGS_PAGE_STATUS_TYPE_NONE, "GRANITE_SETTINGS_PAGE_STATUS_TYPE_NONE", "none"}, {0, NULL, NULL}};
	GType granite_settings_page_status_type_type_id;
	granite_settings_page_status_type_type_id = g_enum_register_static ("GraniteSettingsPageStatusType", values);
	return granite_settings_page_status_type_type_id;
}

GType
granite_settings_page_status_type_get_type (void)
{
	static volatile gsize granite_settings_page_status_type_type_id__once = 0;
	if (g_once_init_enter (&granite_settings_page_status_type_type_id__once)) {
		GType granite_settings_page_status_type_type_id;
		granite_settings_page_status_type_type_id = granite_settings_page_status_type_get_type_once ();
		g_once_init_leave (&granite_settings_page_status_type_type_id__once, granite_settings_page_status_type_type_id);
	}
	return granite_settings_page_status_type_type_id__once;
}

GraniteSettingsPageStatusType
granite_settings_page_get_status_type (GraniteSettingsPage* self)
{
	GraniteSettingsPageStatusType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_status_type;
	return result;
}

void
granite_settings_page_set_status_type (GraniteSettingsPage* self,
                                       GraniteSettingsPageStatusType value)
{
	GraniteSettingsPageStatusType old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_settings_page_get_status_type (self);
	if (old_value != value) {
		self->priv->_status_type = value;
		g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY]);
	}
}

GtkWidget*
granite_settings_page_get_display_widget (GraniteSettingsPage* self)
{
	GtkWidget* result;
	GtkWidget* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_display_widget;
	result = _tmp0_;
	return result;
}

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

static void
granite_settings_page_set_display_widget (GraniteSettingsPage* self,
                                          GtkWidget* value)
{
	GtkWidget* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_settings_page_get_display_widget (self);
	if (old_value != value) {
		GtkWidget* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_display_widget);
		self->priv->_display_widget = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY]);
	}
}

const gchar*
granite_settings_page_get_header (GraniteSettingsPage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_header;
	result = _tmp0_;
	return result;
}

static void
granite_settings_page_set_header (GraniteSettingsPage* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_settings_page_get_header (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_header);
		self->priv->_header = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_HEADER_PROPERTY]);
	}
}

const gchar*
granite_settings_page_get_status (GraniteSettingsPage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_status;
	result = _tmp0_;
	return result;
}

void
granite_settings_page_set_status (GraniteSettingsPage* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_settings_page_get_status (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_status);
		self->priv->_status = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_STATUS_PROPERTY]);
	}
}

const gchar*
granite_settings_page_get_icon_name (GraniteSettingsPage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_icon_name;
	result = _tmp0_;
	return result;
}

void
granite_settings_page_set_icon_name (GraniteSettingsPage* self,
                                     const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_icon_name);
	self->_icon_name = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY]);
}

const gchar*
granite_settings_page_get_title (GraniteSettingsPage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_title;
	result = _tmp0_;
	return result;
}

void
granite_settings_page_set_title (GraniteSettingsPage* self,
                                 const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_title);
	self->_title = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_TITLE_PROPERTY]);
}

GtkWidget*
granite_settings_page_get_child (GraniteSettingsPage* self)
{
	GtkWidget* result;
	GtkScrolledWindow* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->scrolled;
	_tmp1_ = gtk_scrolled_window_get_child (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_settings_page_set_child (GraniteSettingsPage* self,
                                 GtkWidget* value)
{
	GtkScrolledWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->scrolled;
	gtk_scrolled_window_set_child (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_CHILD_PROPERTY]);
}

GraniteSettingsPage*
granite_settings_page_construct (GType object_type)
{
	GraniteSettingsPage * self = NULL;
	self = (GraniteSettingsPage*) g_object_new (object_type, NULL);
	return self;
}

static GObject *
granite_settings_page_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteSettingsPage * self;
	GtkScrolledWindow* _tmp0_ = NULL;
	GtkScrolledWindow* _tmp1_;
	parent_class = G_OBJECT_CLASS (granite_settings_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_TYPE_SETTINGS_PAGE, GraniteSettingsPage);
	_tmp0_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp0_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->scrolled);
	self->priv->scrolled = _tmp0_;
	_tmp1_ = self->priv->scrolled;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp1_);
	return obj;
}

static void
granite_settings_page_class_init (GraniteSettingsPageClass * klass,
                                  gpointer klass_data)
{
	granite_settings_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteSettingsPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_granite_settings_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_granite_settings_page_set_property;
	G_OBJECT_CLASS (klass)->constructor = granite_settings_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_settings_page_finalize;
	/**
	     * Selects a colored icon to be displayed in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY] = g_param_spec_enum ("status-type", "status-type", "status-type", GRANITE_SETTINGS_PAGE_TYPE_STATUS_TYPE, GRANITE_SETTINGS_PAGE_STATUS_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	     * A widget to display in place of an icon in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY] = g_param_spec_object ("display-widget", "display-widget", "display-widget", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	/**
	     * A header to be sorted under in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_HEADER_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_HEADER_PROPERTY] = g_param_spec_string ("header", "header", "header", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	/**
	     * A status string to be displayed underneath the title in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_STATUS_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_STATUS_PROPERTY] = g_param_spec_string ("status", "status", "status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	/**
	     * An icon name to be displayed in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	/**
	     * A title to be displayed in a Granite.SettingsSidebar
	     */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_TITLE_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_SETTINGS_PAGE_CHILD_PROPERTY, granite_settings_page_properties[GRANITE_SETTINGS_PAGE_CHILD_PROPERTY] = g_param_spec_object ("child", "child", "child", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
granite_settings_page_instance_init (GraniteSettingsPage * self,
                                     gpointer klass)
{
	self->priv = granite_settings_page_get_instance_private (self);
	self->priv->_status_type = GRANITE_SETTINGS_PAGE_STATUS_TYPE_NONE;
}

static void
granite_settings_page_finalize (GObject * obj)
{
	GraniteSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_TYPE_SETTINGS_PAGE, GraniteSettingsPage);
	_g_free0 (self->_icon_name);
	_g_free0 (self->_title);
	_g_object_unref0 (self->priv->scrolled);
	_g_object_unref0 (self->priv->_display_widget);
	_g_free0 (self->priv->_header);
	_g_free0 (self->priv->_status);
	G_OBJECT_CLASS (granite_settings_page_parent_class)->finalize (obj);
}

/**
 * AbstractSettingsPage is a {@link Gtk.ScrolledWindow} subclass with properties used
 * by other Granite settings widgets.
 */
static GType
granite_settings_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteSettingsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_settings_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteSettingsPage), 0, (GInstanceInitFunc) granite_settings_page_instance_init, NULL };
	GType granite_settings_page_type_id;
	granite_settings_page_type_id = g_type_register_static (gtk_box_get_type (), "GraniteSettingsPage", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	GraniteSettingsPage_private_offset = g_type_add_instance_private (granite_settings_page_type_id, sizeof (GraniteSettingsPagePrivate));
	return granite_settings_page_type_id;
}

GType
granite_settings_page_get_type (void)
{
	static volatile gsize granite_settings_page_type_id__once = 0;
	if (g_once_init_enter (&granite_settings_page_type_id__once)) {
		GType granite_settings_page_type_id;
		granite_settings_page_type_id = granite_settings_page_get_type_once ();
		g_once_init_leave (&granite_settings_page_type_id__once, granite_settings_page_type_id);
	}
	return granite_settings_page_type_id__once;
}

static void
_vala_granite_settings_page_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	GraniteSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_TYPE_SETTINGS_PAGE, GraniteSettingsPage);
	switch (property_id) {
		case GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY:
		g_value_set_enum (value, granite_settings_page_get_status_type (self));
		break;
		case GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY:
		g_value_set_object (value, granite_settings_page_get_display_widget (self));
		break;
		case GRANITE_SETTINGS_PAGE_HEADER_PROPERTY:
		g_value_set_string (value, granite_settings_page_get_header (self));
		break;
		case GRANITE_SETTINGS_PAGE_STATUS_PROPERTY:
		g_value_set_string (value, granite_settings_page_get_status (self));
		break;
		case GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY:
		g_value_set_string (value, granite_settings_page_get_icon_name (self));
		break;
		case GRANITE_SETTINGS_PAGE_TITLE_PROPERTY:
		g_value_set_string (value, granite_settings_page_get_title (self));
		break;
		case GRANITE_SETTINGS_PAGE_CHILD_PROPERTY:
		g_value_set_object (value, granite_settings_page_get_child (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_granite_settings_page_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	GraniteSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_TYPE_SETTINGS_PAGE, GraniteSettingsPage);
	switch (property_id) {
		case GRANITE_SETTINGS_PAGE_STATUS_TYPE_PROPERTY:
		granite_settings_page_set_status_type (self, g_value_get_enum (value));
		break;
		case GRANITE_SETTINGS_PAGE_DISPLAY_WIDGET_PROPERTY:
		granite_settings_page_set_display_widget (self, g_value_get_object (value));
		break;
		case GRANITE_SETTINGS_PAGE_HEADER_PROPERTY:
		granite_settings_page_set_header (self, g_value_get_string (value));
		break;
		case GRANITE_SETTINGS_PAGE_STATUS_PROPERTY:
		granite_settings_page_set_status (self, g_value_get_string (value));
		break;
		case GRANITE_SETTINGS_PAGE_ICON_NAME_PROPERTY:
		granite_settings_page_set_icon_name (self, g_value_get_string (value));
		break;
		case GRANITE_SETTINGS_PAGE_TITLE_PROPERTY:
		granite_settings_page_set_title (self, g_value_get_string (value));
		break;
		case GRANITE_SETTINGS_PAGE_CHILD_PROPERTY:
		granite_settings_page_set_child (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

