/* SettingsPage.c generated by valac 0.56.17, the Vala compiler
 * generated from SettingsPage.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 <gtk/gtk.h>
#include <glib.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_SETTINGS_PAGE (settings_page_get_type ())
#define SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_PAGE, SettingsPage))
#define SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_PAGE, SettingsPageClass))
#define IS_SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_PAGE))
#define IS_SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_PAGE))
#define SETTINGS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_PAGE, SettingsPageClass))

typedef struct _SettingsPage SettingsPage;
typedef struct _SettingsPageClass SettingsPageClass;
typedef struct _SettingsPagePrivate SettingsPagePrivate;
enum  {
	SETTINGS_PAGE_0_PROPERTY,
	SETTINGS_PAGE_NUM_PROPERTIES
};
static GParamSpec* settings_page_properties[SETTINGS_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block12Data Block12Data;

struct _SettingsPage {
	GraniteSettingsPage parent_instance;
	SettingsPagePrivate * priv;
};

struct _SettingsPageClass {
	GraniteSettingsPageClass parent_class;
};

struct _Block12Data {
	int _ref_count_;
	SettingsPage* self;
	GtkEntry* title_entry;
};

static gpointer settings_page_parent_class = NULL;

VALA_EXTERN GType settings_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SettingsPage, g_object_unref)
VALA_EXTERN SettingsPage* settings_page_new (void);
VALA_EXTERN SettingsPage* settings_page_construct (GType object_type);
static GObject * settings_page_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
static void _settings_page___lambda23_ (Block12Data* _data12_);
static void __settings_page___lambda23__gtk_editable_changed (GtkEditable* _sender,
                                                       gpointer self);
static GType settings_page_get_type_once (void);

SettingsPage*
settings_page_construct (GType object_type)
{
	SettingsPage * self = NULL;
	GtkSpinner* display_widget = NULL;
	GtkSpinner* _tmp0_ = NULL;
	_tmp0_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_set ((GtkWidget*) _tmp0_, "height-request", 32, NULL);
	g_object_ref_sink (_tmp0_);
	display_widget = _tmp0_;
	gtk_spinner_start (display_widget);
	self = (SettingsPage*) g_object_new (object_type, "display-widget", display_widget, "status", "Spinning", "header", "Manual Pages", "title", "Custom Display Widget Page", NULL);
	_g_object_unref0 (display_widget);
	return self;
}

SettingsPage*
settings_page_new (void)
{
	return settings_page_construct (TYPE_SETTINGS_PAGE);
}

static Block12Data*
block12_data_ref (Block12Data* _data12_)
{
	g_atomic_int_inc (&_data12_->_ref_count_);
	return _data12_;
}

static void
block12_data_unref (void * _userdata_)
{
	Block12Data* _data12_;
	_data12_ = (Block12Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
		SettingsPage* self;
		self = _data12_->self;
		_g_object_unref0 (_data12_->title_entry);
		_g_object_unref0 (self);
		g_slice_free (Block12Data, _data12_);
	}
}

static void
_settings_page___lambda23_ (Block12Data* _data12_)
{
	SettingsPage* self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = _data12_->self;
	_tmp0_ = _data12_->title_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	granite_settings_page_set_title ((GraniteSettingsPage*) self, _tmp2_);
}

static void
__settings_page___lambda23__gtk_editable_changed (GtkEditable* _sender,
                                                  gpointer self)
{
	_settings_page___lambda23_ (self);
}

static GObject *
settings_page_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SettingsPage * self;
	Block12Data* _data12_;
	GtkLabel* title_label = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	GtkEntry* _tmp4_;
	GtkGrid* content_area = NULL;
	GtkGrid* _tmp5_;
	GtkGrid* _tmp6_;
	GtkGrid* _tmp7_;
	GtkGrid* _tmp8_;
	GtkGrid* _tmp9_;
	GtkLabel* _tmp10_;
	GtkGrid* _tmp11_;
	GtkEntry* _tmp12_;
	GtkGrid* _tmp13_;
	GtkEntry* _tmp14_;
	parent_class = G_OBJECT_CLASS (settings_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SETTINGS_PAGE, SettingsPage);
	_data12_ = g_slice_new0 (Block12Data);
	_data12_->_ref_count_ = 1;
	_data12_->self = g_object_ref (self);
	_tmp0_ = (GtkLabel*) gtk_label_new ("Title:");
	g_object_ref_sink (_tmp0_);
	title_label = _tmp0_;
	_tmp1_ = title_label;
	gtk_label_set_xalign (_tmp1_, (gfloat) 1);
	_tmp2_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp2_);
	_data12_->title_entry = _tmp2_;
	_tmp3_ = _data12_->title_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = _data12_->title_entry;
	gtk_entry_set_placeholder_text (_tmp4_, "This page's title");
	_tmp5_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp5_);
	content_area = _tmp5_;
	_tmp6_ = content_area;
	gtk_grid_set_column_spacing (_tmp6_, 12);
	_tmp7_ = content_area;
	gtk_grid_set_row_spacing (_tmp7_, 12);
	_tmp8_ = content_area;
	g_object_set ((GtkWidget*) _tmp8_, "margin", 12, NULL);
	_tmp9_ = content_area;
	_tmp10_ = title_label;
	gtk_grid_attach (_tmp9_, (GtkWidget*) _tmp10_, 0, 1, 1, 1);
	_tmp11_ = content_area;
	_tmp12_ = _data12_->title_entry;
	gtk_grid_attach (_tmp11_, (GtkWidget*) _tmp12_, 1, 1, 1, 1);
	_tmp13_ = content_area;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp13_);
	_tmp14_ = _data12_->title_entry;
	g_signal_connect_data ((GtkEditable*) _tmp14_, "changed", (GCallback) __settings_page___lambda23__gtk_editable_changed, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (content_area);
	_g_object_unref0 (title_label);
	block12_data_unref (_data12_);
	_data12_ = NULL;
	return obj;
}

static void
settings_page_class_init (SettingsPageClass * klass,
                          gpointer klass_data)
{
	settings_page_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = settings_page_constructor;
}

static void
settings_page_instance_init (SettingsPage * self,
                             gpointer klass)
{
}

static GType
settings_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SettingsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsPage), 0, (GInstanceInitFunc) settings_page_instance_init, NULL };
	GType settings_page_type_id;
	settings_page_type_id = g_type_register_static (GRANITE_TYPE_SETTINGS_PAGE, "SettingsPage", &g_define_type_info, 0);
	return settings_page_type_id;
}

GType
settings_page_get_type (void)
{
	static volatile gsize settings_page_type_id__once = 0;
	if (g_once_init_enter (&settings_page_type_id__once)) {
		GType settings_page_type_id;
		settings_page_type_id = settings_page_get_type_once ();
		g_once_init_leave (&settings_page_type_id__once, settings_page_type_id);
	}
	return settings_page_type_id__once;
}

