/* preferences-dialog.c generated by valac 0.56.19, the Vala compiler
 * generated from preferences-dialog.vala, do not modify */

/* This file is part of Elastic. License: GPL-3.0+.*/

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.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 ELASTIC_TYPE_PREFERENCES_DIALOG (elastic_preferences_dialog_get_type ())
#define ELASTIC_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialog))
#define ELASTIC_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialogClass))
#define ELASTIC_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ELASTIC_TYPE_PREFERENCES_DIALOG))
#define ELASTIC_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ELASTIC_TYPE_PREFERENCES_DIALOG))
#define ELASTIC_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialogClass))

typedef struct _ElasticPreferencesDialog ElasticPreferencesDialog;
typedef struct _ElasticPreferencesDialogClass ElasticPreferencesDialogClass;
typedef struct _ElasticPreferencesDialogPrivate ElasticPreferencesDialogPrivate;
enum  {
	ELASTIC_PREFERENCES_DIALOG_0_PROPERTY,
	ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY,
	ELASTIC_PREFERENCES_DIALOG_NUM_PROPERTIES
};
static GParamSpec* elastic_preferences_dialog_properties[ELASTIC_PREFERENCES_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ElasticPreferencesDialog {
	AdwPreferencesDialog parent_instance;
	ElasticPreferencesDialogPrivate * priv;
};

struct _ElasticPreferencesDialogClass {
	AdwPreferencesDialogClass parent_class;
};

struct _ElasticPreferencesDialogPrivate {
	gboolean _use_damping;
	GSettings* settings;
};

static gint ElasticPreferencesDialog_private_offset;
static gpointer elastic_preferences_dialog_parent_class = NULL;

VALA_EXTERN GType elastic_preferences_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ElasticPreferencesDialog, g_object_unref)
VALA_EXTERN ElasticPreferencesDialog* elastic_preferences_dialog_new (void);
VALA_EXTERN ElasticPreferencesDialog* elastic_preferences_dialog_construct (GType object_type);
VALA_EXTERN gboolean elastic_preferences_dialog_get_use_damping (ElasticPreferencesDialog* self);
VALA_EXTERN void elastic_preferences_dialog_set_use_damping (ElasticPreferencesDialog* self,
                                                 gboolean value);
static GObject * elastic_preferences_dialog_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static void elastic_preferences_dialog_finalize (GObject * obj);
static GType elastic_preferences_dialog_get_type_once (void);
static void _vala_elastic_preferences_dialog_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_elastic_preferences_dialog_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);

static inline gpointer
elastic_preferences_dialog_get_instance_private (ElasticPreferencesDialog* self)
{
	return G_STRUCT_MEMBER_P (self, ElasticPreferencesDialog_private_offset);
}

ElasticPreferencesDialog*
elastic_preferences_dialog_construct (GType object_type)
{
	ElasticPreferencesDialog * self = NULL;
	self = (ElasticPreferencesDialog*) g_object_new (object_type, NULL);
	return self;
}

ElasticPreferencesDialog*
elastic_preferences_dialog_new (void)
{
	return elastic_preferences_dialog_construct (ELASTIC_TYPE_PREFERENCES_DIALOG);
}

gboolean
elastic_preferences_dialog_get_use_damping (ElasticPreferencesDialog* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_use_damping;
	return result;
}

void
elastic_preferences_dialog_set_use_damping (ElasticPreferencesDialog* self,
                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = elastic_preferences_dialog_get_use_damping (self);
	if (old_value != value) {
		self->priv->_use_damping = value;
		g_object_notify_by_pspec ((GObject *) self, elastic_preferences_dialog_properties[ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY]);
	}
}

static GObject *
elastic_preferences_dialog_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ElasticPreferencesDialog * self;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	parent_class = G_OBJECT_CLASS (elastic_preferences_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialog);
	_tmp0_ = g_settings_new ("app.drey.Elastic");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = self->priv->settings;
	g_settings_bind (_tmp1_, "use-damping", (GObject*) self, "use-damping", G_SETTINGS_BIND_DEFAULT);
	return obj;
}

static void
elastic_preferences_dialog_class_init (ElasticPreferencesDialogClass * klass,
                                       gpointer klass_data)
{
	elastic_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ElasticPreferencesDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_elastic_preferences_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_elastic_preferences_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = elastic_preferences_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = elastic_preferences_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY, elastic_preferences_dialog_properties[ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY] = g_param_spec_boolean ("use-damping", "use-damping", "use-damping", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/app/drey/Elastic/preferences-dialog.ui");
}

static void
elastic_preferences_dialog_instance_init (ElasticPreferencesDialog * self,
                                          gpointer klass)
{
	self->priv = elastic_preferences_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
elastic_preferences_dialog_finalize (GObject * obj)
{
	ElasticPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialog);
	_g_object_unref0 (self->priv->settings);
	G_OBJECT_CLASS (elastic_preferences_dialog_parent_class)->finalize (obj);
}

static GType
elastic_preferences_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ElasticPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) elastic_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ElasticPreferencesDialog), 0, (GInstanceInitFunc) elastic_preferences_dialog_instance_init, NULL };
	GType elastic_preferences_dialog_type_id;
	elastic_preferences_dialog_type_id = g_type_register_static (adw_preferences_dialog_get_type (), "ElasticPreferencesDialog", &g_define_type_info, 0);
	ElasticPreferencesDialog_private_offset = g_type_add_instance_private (elastic_preferences_dialog_type_id, sizeof (ElasticPreferencesDialogPrivate));
	return elastic_preferences_dialog_type_id;
}

GType
elastic_preferences_dialog_get_type (void)
{
	static volatile gsize elastic_preferences_dialog_type_id__once = 0;
	if (g_once_init_enter (&elastic_preferences_dialog_type_id__once)) {
		GType elastic_preferences_dialog_type_id;
		elastic_preferences_dialog_type_id = elastic_preferences_dialog_get_type_once ();
		g_once_init_leave (&elastic_preferences_dialog_type_id__once, elastic_preferences_dialog_type_id);
	}
	return elastic_preferences_dialog_type_id__once;
}

static void
_vala_elastic_preferences_dialog_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	ElasticPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialog);
	switch (property_id) {
		case ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY:
		g_value_set_boolean (value, elastic_preferences_dialog_get_use_damping (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_elastic_preferences_dialog_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	ElasticPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ELASTIC_TYPE_PREFERENCES_DIALOG, ElasticPreferencesDialog);
	switch (property_id) {
		case ELASTIC_PREFERENCES_DIALOG_USE_DAMPING_PROPERTY:
		elastic_preferences_dialog_set_use_damping (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

