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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.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_SWITCH_ROW (switch_row_get_type ())
#define SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SWITCH_ROW, SwitchRow))
#define SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SWITCH_ROW, SwitchRowClass))
#define IS_SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SWITCH_ROW))
#define IS_SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SWITCH_ROW))
#define SWITCH_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SWITCH_ROW, SwitchRowClass))

typedef struct _SwitchRow SwitchRow;
typedef struct _SwitchRowClass SwitchRowClass;
typedef struct _SwitchRowPrivate SwitchRowPrivate;
enum  {
	SWITCH_ROW_0_PROPERTY,
	SWITCH_ROW_ACTIVE_PROPERTY,
	SWITCH_ROW_STATE_PROPERTY,
	SWITCH_ROW_NUM_PROPERTIES
};
static GParamSpec* switch_row_properties[SWITCH_ROW_NUM_PROPERTIES];
enum  {
	SWITCH_ROW_STATE_SET_SIGNAL,
	SWITCH_ROW_NUM_SIGNALS
};
static guint switch_row_signals[SWITCH_ROW_NUM_SIGNALS] = {0};

struct _SwitchRow {
	AdwActionRow parent_instance;
	SwitchRowPrivate * priv;
};

struct _SwitchRowClass {
	AdwActionRowClass parent_class;
};

struct _SwitchRowPrivate {
	gboolean _active;
	gboolean _state;
};

static gint SwitchRow_private_offset;
static gpointer switch_row_parent_class = NULL;

VALA_EXTERN GType switch_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwitchRow, g_object_unref)
static gboolean switch_row_on_state_set (SwitchRow* self,
                                  gboolean state);
static gboolean _switch_row_on_state_set_gtk_switch_state_set (GtkSwitch* _sender,
                                                        gboolean state,
                                                        gpointer self);
VALA_EXTERN SwitchRow* switch_row_new (void);
VALA_EXTERN SwitchRow* switch_row_construct (GType object_type);
VALA_EXTERN gboolean switch_row_get_active (SwitchRow* self);
VALA_EXTERN void switch_row_set_active (SwitchRow* self,
                            gboolean value);
VALA_EXTERN gboolean switch_row_get_state (SwitchRow* self);
VALA_EXTERN void switch_row_set_state (SwitchRow* self,
                           gboolean value);
static void g_cclosure_user_marshal_BOOLEAN__BOOLEAN (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data);
static void switch_row_finalize (GObject * obj);
static GType switch_row_get_type_once (void);
static void _vala_switch_row_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec);
static void _vala_switch_row_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec);

static inline gpointer
switch_row_get_instance_private (SwitchRow* self)
{
	return G_STRUCT_MEMBER_P (self, SwitchRow_private_offset);
}

static gboolean
switch_row_on_state_set (SwitchRow* self,
                         gboolean state)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_signal_emit (self, switch_row_signals[SWITCH_ROW_STATE_SET_SIGNAL], 0, state, &_tmp0_);
	result = _tmp0_;
	return result;
}

static gboolean
_switch_row_on_state_set_gtk_switch_state_set (GtkSwitch* _sender,
                                               gboolean state,
                                               gpointer self)
{
	gboolean result;
	result = switch_row_on_state_set ((SwitchRow*) self, state);
	return result;
}

SwitchRow*
switch_row_construct (GType object_type)
{
	SwitchRow * self = NULL;
	self = (SwitchRow*) g_object_new (object_type, NULL);
	return self;
}

SwitchRow*
switch_row_new (void)
{
	return switch_row_construct (TYPE_SWITCH_ROW);
}

gboolean
switch_row_get_active (SwitchRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_active;
	return result;
}

void
switch_row_set_active (SwitchRow* self,
                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = switch_row_get_active (self);
	if (old_value != value) {
		self->priv->_active = value;
		g_object_notify_by_pspec ((GObject *) self, switch_row_properties[SWITCH_ROW_ACTIVE_PROPERTY]);
	}
}

gboolean
switch_row_get_state (SwitchRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_state;
	return result;
}

void
switch_row_set_state (SwitchRow* self,
                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = switch_row_get_state (self);
	if (old_value != value) {
		self->priv->_state = value;
		g_object_notify_by_pspec ((GObject *) self, switch_row_properties[SWITCH_ROW_STATE_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_BOOLEAN__BOOLEAN (GClosure * closure,
                                          GValue * return_value,
                                          guint n_param_values,
                                          const GValue * param_values,
                                          gpointer invocation_hint,
                                          gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__BOOLEAN) (gpointer data1, gboolean arg_1, gpointer data2);
	register GMarshalFunc_BOOLEAN__BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_boolean (param_values + 1), data2);
	g_value_set_boolean (return_value, v_return);
}

static void
switch_row_class_init (SwitchRowClass * klass,
                       gpointer klass_data)
{
	switch_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwitchRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_switch_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_switch_row_set_property;
	G_OBJECT_CLASS (klass)->finalize = switch_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCH_ROW_ACTIVE_PROPERTY, switch_row_properties[SWITCH_ROW_ACTIVE_PROPERTY] = g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCH_ROW_STATE_PROPERTY, switch_row_properties[SWITCH_ROW_STATE_PROPERTY] = g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/DejaDup/SwitchRow.ui");
	switch_row_signals[SWITCH_ROW_STATE_SET_SIGNAL] = g_signal_new ("state-set", TYPE_SWITCH_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__BOOLEAN, G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_state_set", G_CALLBACK(_switch_row_on_state_set_gtk_switch_state_set));
}

static void
switch_row_instance_init (SwitchRow * self,
                          gpointer klass)
{
	self->priv = switch_row_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
switch_row_finalize (GObject * obj)
{
	SwitchRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SWITCH_ROW, SwitchRow);
	G_OBJECT_CLASS (switch_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
switch_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switch_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchRow), 0, (GInstanceInitFunc) switch_row_instance_init, NULL };
	GType switch_row_type_id;
	switch_row_type_id = g_type_register_static (adw_action_row_get_type (), "SwitchRow", &g_define_type_info, 0);
	SwitchRow_private_offset = g_type_add_instance_private (switch_row_type_id, sizeof (SwitchRowPrivate));
	return switch_row_type_id;
}

GType
switch_row_get_type (void)
{
	static gsize switch_row_type_id__once = 0;
	if (g_once_init_enter (&switch_row_type_id__once)) {
		GType switch_row_type_id;
		switch_row_type_id = switch_row_get_type_once ();
		g_once_init_leave (&switch_row_type_id__once, switch_row_type_id);
	}
	return switch_row_type_id__once;
}

static void
_vala_switch_row_get_property (GObject * object,
                               guint property_id,
                               GValue * value,
                               GParamSpec * pspec)
{
	SwitchRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SWITCH_ROW, SwitchRow);
	switch (property_id) {
		case SWITCH_ROW_ACTIVE_PROPERTY:
		g_value_set_boolean (value, switch_row_get_active (self));
		break;
		case SWITCH_ROW_STATE_PROPERTY:
		g_value_set_boolean (value, switch_row_get_state (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_switch_row_set_property (GObject * object,
                               guint property_id,
                               const GValue * value,
                               GParamSpec * pspec)
{
	SwitchRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SWITCH_ROW, SwitchRow);
	switch (property_id) {
		case SWITCH_ROW_ACTIVE_PROPERTY:
		switch_row_set_active (self, g_value_get_boolean (value));
		break;
		case SWITCH_ROW_STATE_PROPERTY:
		switch_row_set_state (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

