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

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

#include "granite.h"
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_SIMPLE_SETTINGS_PAGE (simple_settings_page_get_type ())
#define SIMPLE_SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_SETTINGS_PAGE, SimpleSettingsPage))
#define SIMPLE_SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_SETTINGS_PAGE, SimpleSettingsPageClass))
#define IS_SIMPLE_SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_SETTINGS_PAGE))
#define IS_SIMPLE_SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_SETTINGS_PAGE))
#define SIMPLE_SETTINGS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_SETTINGS_PAGE, SimpleSettingsPageClass))

typedef struct _SimpleSettingsPage SimpleSettingsPage;
typedef struct _SimpleSettingsPageClass SimpleSettingsPageClass;
typedef struct _SimpleSettingsPagePrivate SimpleSettingsPagePrivate;
enum  {
	SIMPLE_SETTINGS_PAGE_0_PROPERTY,
	SIMPLE_SETTINGS_PAGE_NUM_PROPERTIES
};
static GParamSpec* simple_settings_page_properties[SIMPLE_SETTINGS_PAGE_NUM_PROPERTIES];
typedef struct _Block13Data Block13Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _SimpleSettingsPage {
	GraniteSimpleSettingsPage parent_instance;
	SimpleSettingsPagePrivate * priv;
};

struct _SimpleSettingsPageClass {
	GraniteSimpleSettingsPageClass parent_class;
};

struct _Block13Data {
	int _ref_count_;
	SimpleSettingsPage* self;
	GtkEntry* icon_entry;
	GtkEntry* title_entry;
	GtkEntry* description_entry;
};

static gpointer simple_settings_page_parent_class = NULL;

VALA_EXTERN GType simple_settings_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SimpleSettingsPage, g_object_unref)
VALA_EXTERN SimpleSettingsPage* simple_settings_page_new (void);
VALA_EXTERN SimpleSettingsPage* simple_settings_page_construct (GType object_type);
static void simple_settings_page_update_status (SimpleSettingsPage* self);
static GObject * simple_settings_page_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
static void _simple_settings_page___lambda20_ (Block13Data* _data13_);
static void __simple_settings_page___lambda20__gtk_editable_changed (GtkEditable* _sender,
                                                              gpointer self);
static void _simple_settings_page___lambda21_ (Block13Data* _data13_);
static void __simple_settings_page___lambda21__gtk_editable_changed (GtkEditable* _sender,
                                                              gpointer self);
static void _simple_settings_page_update_status_g_object_notify (GObject* _sender,
                                                          GParamSpec* pspec,
                                                          gpointer self);
static void _simple_settings_page___lambda22_ (Block13Data* _data13_);
static void __simple_settings_page___lambda22__gtk_editable_changed (GtkEditable* _sender,
                                                              gpointer self);
static GType simple_settings_page_get_type_once (void);

SimpleSettingsPage*
simple_settings_page_construct (GType object_type)
{
	SimpleSettingsPage * self = NULL;
	self = (SimpleSettingsPage*) g_object_new (object_type, "activatable", TRUE, "description", "This is a demo of Granite's SimpleSettingsPage", "header", "Simple Pages", "icon-name", "preferences-system", "title", "First Test Page", NULL);
	return self;
}

SimpleSettingsPage*
simple_settings_page_new (void)
{
	return simple_settings_page_construct (TYPE_SIMPLE_SETTINGS_PAGE);
}

static void
simple_settings_page_update_status (SimpleSettingsPage* self)
{
	GtkSwitch* _tmp0_;
	GtkSwitch* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = granite_simple_settings_page_get_status_switch ((GraniteSimpleSettingsPage*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_switch_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		granite_settings_page_set_status_type ((GraniteSettingsPage*) self, GRANITE_SETTINGS_PAGE_STATUS_TYPE_SUCCESS);
		granite_settings_page_set_status ((GraniteSettingsPage*) self, _ ("Enabled"));
	} else {
		granite_settings_page_set_status_type ((GraniteSettingsPage*) self, GRANITE_SETTINGS_PAGE_STATUS_TYPE_OFFLINE);
		granite_settings_page_set_status ((GraniteSettingsPage*) self, _ ("Disabled"));
	}
}

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		SimpleSettingsPage* self;
		self = _data13_->self;
		_g_object_unref0 (_data13_->description_entry);
		_g_object_unref0 (_data13_->title_entry);
		_g_object_unref0 (_data13_->icon_entry);
		_g_object_unref0 (self);
		g_slice_free (Block13Data, _data13_);
	}
}

static void
_simple_settings_page___lambda20_ (Block13Data* _data13_)
{
	SimpleSettingsPage* self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = _data13_->self;
	_tmp0_ = _data13_->description_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	granite_simple_settings_page_set_description ((GraniteSimpleSettingsPage*) self, _tmp2_);
}

static void
__simple_settings_page___lambda20__gtk_editable_changed (GtkEditable* _sender,
                                                         gpointer self)
{
	_simple_settings_page___lambda20_ (self);
}

static void
_simple_settings_page___lambda21_ (Block13Data* _data13_)
{
	SimpleSettingsPage* self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = _data13_->self;
	_tmp0_ = _data13_->icon_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	granite_simple_settings_page_set_icon_name ((GraniteSimpleSettingsPage*) self, _tmp2_);
}

static void
__simple_settings_page___lambda21__gtk_editable_changed (GtkEditable* _sender,
                                                         gpointer self)
{
	_simple_settings_page___lambda21_ (self);
}

static void
_simple_settings_page_update_status_g_object_notify (GObject* _sender,
                                                     GParamSpec* pspec,
                                                     gpointer self)
{
	simple_settings_page_update_status ((SimpleSettingsPage*) self);
}

static void
_simple_settings_page___lambda22_ (Block13Data* _data13_)
{
	SimpleSettingsPage* self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = _data13_->self;
	_tmp0_ = _data13_->title_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	granite_simple_settings_page_set_title ((GraniteSimpleSettingsPage*) self, _tmp2_);
}

static void
__simple_settings_page___lambda22__gtk_editable_changed (GtkEditable* _sender,
                                                         gpointer self)
{
	_simple_settings_page___lambda22_ (self);
}

static GObject *
simple_settings_page_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SimpleSettingsPage * self;
	Block13Data* _data13_;
	GtkLabel* icon_label = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	GtkEntry* _tmp4_;
	GtkEntry* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	GtkLabel* title_label = NULL;
	GtkLabel* _tmp8_;
	GtkLabel* _tmp9_;
	GtkEntry* _tmp10_;
	GtkEntry* _tmp11_;
	GtkEntry* _tmp12_;
	GtkLabel* description_label = NULL;
	GtkLabel* _tmp13_;
	GtkLabel* _tmp14_;
	GtkEntry* _tmp15_;
	GtkEntry* _tmp16_;
	GtkEntry* _tmp17_;
	GtkGrid* _tmp18_;
	GtkGrid* _tmp19_;
	GtkLabel* _tmp20_;
	GtkGrid* _tmp21_;
	GtkGrid* _tmp22_;
	GtkEntry* _tmp23_;
	GtkGrid* _tmp24_;
	GtkGrid* _tmp25_;
	GtkLabel* _tmp26_;
	GtkGrid* _tmp27_;
	GtkGrid* _tmp28_;
	GtkEntry* _tmp29_;
	GtkGrid* _tmp30_;
	GtkGrid* _tmp31_;
	GtkLabel* _tmp32_;
	GtkGrid* _tmp33_;
	GtkGrid* _tmp34_;
	GtkEntry* _tmp35_;
	GtkButton* button = NULL;
	GtkButton* _tmp36_;
	GtkEntry* _tmp37_;
	GtkEntry* _tmp38_;
	GtkSwitch* _tmp39_;
	GtkSwitch* _tmp40_;
	GtkEntry* _tmp41_;
	GtkButtonBox* _tmp42_;
	GtkButtonBox* _tmp43_;
	GtkButton* _tmp44_;
	parent_class = G_OBJECT_CLASS (simple_settings_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SIMPLE_SETTINGS_PAGE, SimpleSettingsPage);
	_data13_ = g_slice_new0 (Block13Data);
	_data13_->_ref_count_ = 1;
	_data13_->self = g_object_ref (self);
	_tmp0_ = (GtkLabel*) gtk_label_new ("Icon Name:");
	g_object_ref_sink (_tmp0_);
	icon_label = _tmp0_;
	_tmp1_ = icon_label;
	gtk_label_set_xalign (_tmp1_, (gfloat) 1);
	_tmp2_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp2_);
	_data13_->icon_entry = _tmp2_;
	_tmp3_ = _data13_->icon_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = _data13_->icon_entry;
	gtk_entry_set_placeholder_text (_tmp4_, "This page's icon name");
	_tmp5_ = _data13_->icon_entry;
	_tmp6_ = granite_simple_settings_page_get_icon_name ((GraniteSimpleSettingsPage*) self);
	_tmp7_ = _tmp6_;
	gtk_entry_set_text (_tmp5_, _tmp7_);
	_tmp8_ = (GtkLabel*) gtk_label_new ("Title:");
	g_object_ref_sink (_tmp8_);
	title_label = _tmp8_;
	_tmp9_ = title_label;
	gtk_label_set_xalign (_tmp9_, (gfloat) 1);
	_tmp10_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp10_);
	_data13_->title_entry = _tmp10_;
	_tmp11_ = _data13_->title_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	_tmp12_ = _data13_->title_entry;
	gtk_entry_set_placeholder_text (_tmp12_, "This page's title");
	_tmp13_ = (GtkLabel*) gtk_label_new ("Description:");
	g_object_ref_sink (_tmp13_);
	description_label = _tmp13_;
	_tmp14_ = description_label;
	gtk_label_set_xalign (_tmp14_, (gfloat) 1);
	_tmp15_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp15_);
	_data13_->description_entry = _tmp15_;
	_tmp16_ = _data13_->description_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp16_, TRUE);
	_tmp17_ = _data13_->description_entry;
	gtk_entry_set_placeholder_text (_tmp17_, "This page's description");
	_tmp18_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp19_ = _tmp18_;
	_tmp20_ = icon_label;
	gtk_grid_attach (_tmp19_, (GtkWidget*) _tmp20_, 0, 0, 1, 1);
	_tmp21_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp22_ = _tmp21_;
	_tmp23_ = _data13_->icon_entry;
	gtk_grid_attach (_tmp22_, (GtkWidget*) _tmp23_, 1, 0, 1, 1);
	_tmp24_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp25_ = _tmp24_;
	_tmp26_ = title_label;
	gtk_grid_attach (_tmp25_, (GtkWidget*) _tmp26_, 0, 1, 1, 1);
	_tmp27_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp28_ = _tmp27_;
	_tmp29_ = _data13_->title_entry;
	gtk_grid_attach (_tmp28_, (GtkWidget*) _tmp29_, 1, 1, 1, 1);
	_tmp30_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp31_ = _tmp30_;
	_tmp32_ = description_label;
	gtk_grid_attach (_tmp31_, (GtkWidget*) _tmp32_, 0, 2, 1, 1);
	_tmp33_ = granite_simple_settings_page_get_content_area ((GraniteSimpleSettingsPage*) self);
	_tmp34_ = _tmp33_;
	_tmp35_ = _data13_->description_entry;
	gtk_grid_attach (_tmp34_, (GtkWidget*) _tmp35_, 1, 2, 1, 1);
	_tmp36_ = (GtkButton*) gtk_button_new_with_label ("Test Button");
	g_object_ref_sink (_tmp36_);
	button = _tmp36_;
	simple_settings_page_update_status (self);
	_tmp37_ = _data13_->description_entry;
	g_signal_connect_data ((GtkEditable*) _tmp37_, "changed", (GCallback) __simple_settings_page___lambda20__gtk_editable_changed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0);
	_tmp38_ = _data13_->icon_entry;
	g_signal_connect_data ((GtkEditable*) _tmp38_, "changed", (GCallback) __simple_settings_page___lambda21__gtk_editable_changed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0);
	_tmp39_ = granite_simple_settings_page_get_status_switch ((GraniteSimpleSettingsPage*) self);
	_tmp40_ = _tmp39_;
	g_signal_connect_object ((GObject*) _tmp40_, "notify::active", (GCallback) _simple_settings_page_update_status_g_object_notify, self, 0);
	_tmp41_ = _data13_->title_entry;
	g_signal_connect_data ((GtkEditable*) _tmp41_, "changed", (GCallback) __simple_settings_page___lambda22__gtk_editable_changed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0);
	_tmp42_ = granite_simple_settings_page_get_action_area ((GraniteSimpleSettingsPage*) self);
	_tmp43_ = _tmp42_;
	_tmp44_ = button;
	gtk_container_add ((GtkContainer*) _tmp43_, (GtkWidget*) _tmp44_);
	_g_object_unref0 (button);
	_g_object_unref0 (description_label);
	_g_object_unref0 (title_label);
	_g_object_unref0 (icon_label);
	block13_data_unref (_data13_);
	_data13_ = NULL;
	return obj;
}

static void
simple_settings_page_class_init (SimpleSettingsPageClass * klass,
                                 gpointer klass_data)
{
	simple_settings_page_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = simple_settings_page_constructor;
}

static void
simple_settings_page_instance_init (SimpleSettingsPage * self,
                                    gpointer klass)
{
}

static GType
simple_settings_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SimpleSettingsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_settings_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SimpleSettingsPage), 0, (GInstanceInitFunc) simple_settings_page_instance_init, NULL };
	GType simple_settings_page_type_id;
	simple_settings_page_type_id = g_type_register_static (GRANITE_TYPE_SIMPLE_SETTINGS_PAGE, "SimpleSettingsPage", &g_define_type_info, 0);
	return simple_settings_page_type_id;
}

GType
simple_settings_page_get_type (void)
{
	static volatile gsize simple_settings_page_type_id__once = 0;
	if (g_once_init_enter (&simple_settings_page_type_id__once)) {
		GType simple_settings_page_type_id;
		simple_settings_page_type_id = simple_settings_page_get_type_once ();
		g_once_init_leave (&simple_settings_page_type_id__once, simple_settings_page_type_id);
	}
	return simple_settings_page_type_id__once;
}

