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

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <handy.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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 BOXES_TYPE_VM_NAME_ROW (boxes_vm_name_row_get_type ())
#define BOXES_VM_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow))
#define BOXES_VM_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRowClass))
#define BOXES_IS_VM_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_VM_NAME_ROW))
#define BOXES_IS_VM_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_VM_NAME_ROW))
#define BOXES_VM_NAME_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRowClass))

typedef struct _BoxesVMNameRow BoxesVMNameRow;
typedef struct _BoxesVMNameRowClass BoxesVMNameRowClass;
typedef struct _BoxesVMNameRowPrivate BoxesVMNameRowPrivate;
enum  {
	BOXES_VM_NAME_ROW_0_PROPERTY,
	BOXES_VM_NAME_ROW_TEXT_PROPERTY,
	BOXES_VM_NAME_ROW_NUM_PROPERTIES
};
static GParamSpec* boxes_vm_name_row_properties[BOXES_VM_NAME_ROW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BoxesVMNameRow {
	HdyPreferencesRow parent_instance;
	BoxesVMNameRowPrivate * priv;
};

struct _BoxesVMNameRowClass {
	HdyPreferencesRowClass parent_class;
};

struct _BoxesVMNameRowPrivate {
	GtkEntry* entry;
	gchar* _text;
};

static gint BoxesVMNameRow_private_offset;
static gpointer boxes_vm_name_row_parent_class = NULL;

VALA_EXTERN GType boxes_vm_name_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesVMNameRow, g_object_unref)
VALA_EXTERN BoxesVMNameRow* boxes_vm_name_row_new (void);
VALA_EXTERN BoxesVMNameRow* boxes_vm_name_row_construct (GType object_type);
VALA_EXTERN const gchar* boxes_vm_name_row_get_text (BoxesVMNameRow* self);
VALA_EXTERN void boxes_vm_name_row_set_text (BoxesVMNameRow* self,
                                 const gchar* value);
static GObject * boxes_vm_name_row_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void boxes_vm_name_row_finalize (GObject * obj);
static GType boxes_vm_name_row_get_type_once (void);
static void _vala_boxes_vm_name_row_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_boxes_vm_name_row_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
boxes_vm_name_row_get_instance_private (BoxesVMNameRow* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesVMNameRow_private_offset);
}

BoxesVMNameRow*
boxes_vm_name_row_construct (GType object_type)
{
	BoxesVMNameRow * self = NULL;
	self = (BoxesVMNameRow*) g_object_new (object_type, NULL);
	return self;
}

BoxesVMNameRow*
boxes_vm_name_row_new (void)
{
	return boxes_vm_name_row_construct (BOXES_TYPE_VM_NAME_ROW);
}

const gchar*
boxes_vm_name_row_get_text (BoxesVMNameRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_text;
	result = _tmp0_;
	return result;
}

void
boxes_vm_name_row_set_text (BoxesVMNameRow* self,
                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = boxes_vm_name_row_get_text (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_text);
		self->priv->_text = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, boxes_vm_name_row_properties[BOXES_VM_NAME_ROW_TEXT_PROPERTY]);
	}
}

static GObject *
boxes_vm_name_row_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BoxesVMNameRow * self;
	GtkEntry* _tmp0_;
	parent_class = G_OBJECT_CLASS (boxes_vm_name_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow);
	_tmp0_ = self->priv->entry;
	g_object_bind_property_with_closures ((GObject*) self, "text", (GObject*) _tmp0_, "text", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return obj;
}

static void
boxes_vm_name_row_class_init (BoxesVMNameRowClass * klass,
                              gpointer klass_data)
{
	boxes_vm_name_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesVMNameRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_vm_name_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_vm_name_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = boxes_vm_name_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = boxes_vm_name_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_VM_NAME_ROW_TEXT_PROPERTY, boxes_vm_name_row_properties[BOXES_VM_NAME_ROW_TEXT_PROPERTY] = g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/vm-name-row.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "entry", FALSE, BoxesVMNameRow_private_offset + G_STRUCT_OFFSET (BoxesVMNameRowPrivate, entry));
}

static void
boxes_vm_name_row_instance_init (BoxesVMNameRow * self,
                                 gpointer klass)
{
	self->priv = boxes_vm_name_row_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_vm_name_row_finalize (GObject * obj)
{
	BoxesVMNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow);
	_g_free0 (self->priv->_text);
	G_OBJECT_CLASS (boxes_vm_name_row_parent_class)->finalize (obj);
}

static GType
boxes_vm_name_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesVMNameRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_vm_name_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesVMNameRow), 0, (GInstanceInitFunc) boxes_vm_name_row_instance_init, NULL };
	GType boxes_vm_name_row_type_id;
	boxes_vm_name_row_type_id = g_type_register_static (hdy_preferences_row_get_type (), "BoxesVMNameRow", &g_define_type_info, 0);
	BoxesVMNameRow_private_offset = g_type_add_instance_private (boxes_vm_name_row_type_id, sizeof (BoxesVMNameRowPrivate));
	return boxes_vm_name_row_type_id;
}

GType
boxes_vm_name_row_get_type (void)
{
	static volatile gsize boxes_vm_name_row_type_id__once = 0;
	if (g_once_init_enter (&boxes_vm_name_row_type_id__once)) {
		GType boxes_vm_name_row_type_id;
		boxes_vm_name_row_type_id = boxes_vm_name_row_get_type_once ();
		g_once_init_leave (&boxes_vm_name_row_type_id__once, boxes_vm_name_row_type_id);
	}
	return boxes_vm_name_row_type_id__once;
}

static void
_vala_boxes_vm_name_row_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	BoxesVMNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow);
	switch (property_id) {
		case BOXES_VM_NAME_ROW_TEXT_PROPERTY:
		g_value_set_string (value, boxes_vm_name_row_get_text (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_boxes_vm_name_row_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	BoxesVMNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow);
	switch (property_id) {
		case BOXES_VM_NAME_ROW_TEXT_PROPERTY:
		boxes_vm_name_row_set_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

