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

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

#include <gtk/gtk.h>
#include <glib-object.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_ICON_VIEW_CHILD (boxes_icon_view_child_get_type ())
#define BOXES_ICON_VIEW_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChild))
#define BOXES_ICON_VIEW_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChildClass))
#define BOXES_IS_ICON_VIEW_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_ICON_VIEW_CHILD))
#define BOXES_IS_ICON_VIEW_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_ICON_VIEW_CHILD))
#define BOXES_ICON_VIEW_CHILD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChildClass))

typedef struct _BoxesIconViewChild BoxesIconViewChild;
typedef struct _BoxesIconViewChildClass BoxesIconViewChildClass;
typedef struct _BoxesIconViewChildPrivate BoxesIconViewChildPrivate;

#define BOXES_TYPE_THUMBNAIL (boxes_thumbnail_get_type ())
#define BOXES_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_THUMBNAIL, BoxesThumbnail))
#define BOXES_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_THUMBNAIL, BoxesThumbnailClass))
#define BOXES_IS_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_THUMBNAIL))
#define BOXES_IS_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_THUMBNAIL))
#define BOXES_THUMBNAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_THUMBNAIL, BoxesThumbnailClass))

typedef struct _BoxesThumbnail BoxesThumbnail;
typedef struct _BoxesThumbnailClass BoxesThumbnailClass;

#define BOXES_TYPE_COLLECTION_ITEM (boxes_collection_item_get_type ())
#define BOXES_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItem))
#define BOXES_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))
#define BOXES_IS_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_IS_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_COLLECTION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))

typedef struct _BoxesCollectionItem BoxesCollectionItem;
typedef struct _BoxesCollectionItemClass BoxesCollectionItemClass;
enum  {
	BOXES_ICON_VIEW_CHILD_0_PROPERTY,
	BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY,
	BOXES_ICON_VIEW_CHILD_NUM_PROPERTIES
};
static GParamSpec* boxes_icon_view_child_properties[BOXES_ICON_VIEW_CHILD_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define BOXES_TYPE_MACHINE (boxes_machine_get_type ())
#define BOXES_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE, BoxesMachine))
#define BOXES_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE, BoxesMachineClass))
#define BOXES_IS_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE))
#define BOXES_IS_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE))
#define BOXES_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE, BoxesMachineClass))

typedef struct _BoxesMachine BoxesMachine;
typedef struct _BoxesMachineClass BoxesMachineClass;

struct _BoxesIconViewChild {
	GtkBox parent_instance;
	BoxesIconViewChildPrivate * priv;
	BoxesThumbnail* thumbnail;
};

struct _BoxesIconViewChildClass {
	GtkBoxClass parent_class;
};

struct _BoxesIconViewChildPrivate {
	BoxesCollectionItem* _item;
	GtkLabel* machine_name;
	GtkLabel* machine_status;
};

static gint BoxesIconViewChild_private_offset;
static gpointer boxes_icon_view_child_parent_class = NULL;

VALA_EXTERN GType boxes_icon_view_child_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesIconViewChild, g_object_unref)
VALA_EXTERN GType boxes_thumbnail_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesThumbnail, g_object_unref)
VALA_EXTERN GType boxes_collection_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCollectionItem, g_object_unref)
VALA_EXTERN BoxesIconViewChild* boxes_icon_view_child_new (BoxesCollectionItem* item);
VALA_EXTERN BoxesIconViewChild* boxes_icon_view_child_construct (GType object_type,
                                                     BoxesCollectionItem* item);
static void boxes_icon_view_child_set_item (BoxesIconViewChild* self,
                                     BoxesCollectionItem* value);
static void boxes_icon_view_child_update_thumbnail (BoxesIconViewChild* self);
VALA_EXTERN GType boxes_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMachine, g_object_unref)
static BoxesMachine* boxes_icon_view_child_get_machine (BoxesIconViewChild* self);
static void _boxes_icon_view_child_update_thumbnail_g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self);
VALA_EXTERN void boxes_thumbnail_update (BoxesThumbnail* self,
                             BoxesMachine* machine);
VALA_EXTERN BoxesCollectionItem* boxes_icon_view_child_get_item (BoxesIconViewChild* self);
static void boxes_icon_view_child_finalize (GObject * obj);
static GType boxes_icon_view_child_get_type_once (void);
static void _vala_boxes_icon_view_child_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_boxes_icon_view_child_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
boxes_icon_view_child_get_instance_private (BoxesIconViewChild* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesIconViewChild_private_offset);
}

static void
_boxes_icon_view_child_update_thumbnail_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self)
{
	boxes_icon_view_child_update_thumbnail ((BoxesIconViewChild*) self);
}

BoxesIconViewChild*
boxes_icon_view_child_construct (GType object_type,
                                 BoxesCollectionItem* item)
{
	BoxesIconViewChild * self = NULL;
	BoxesMachine* _tmp0_;
	BoxesMachine* _tmp1_;
	BoxesMachine* _tmp2_;
	BoxesMachine* _tmp3_;
	BoxesMachine* _tmp4_;
	BoxesMachine* _tmp5_;
	BoxesMachine* _tmp6_;
	BoxesMachine* _tmp7_;
	GtkLabel* _tmp8_;
	BoxesMachine* _tmp9_;
	BoxesMachine* _tmp10_;
	GtkLabel* _tmp11_;
	g_return_val_if_fail (item != NULL, NULL);
	self = (BoxesIconViewChild*) g_object_new (object_type, NULL);
	boxes_icon_view_child_set_item (self, item);
	boxes_icon_view_child_update_thumbnail (self);
	_tmp0_ = boxes_icon_view_child_get_machine (self);
	_tmp1_ = _tmp0_;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::under-construction", (GCallback) _boxes_icon_view_child_update_thumbnail_g_object_notify, self, 0);
	_tmp2_ = boxes_icon_view_child_get_machine (self);
	_tmp3_ = _tmp2_;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::is-stopped", (GCallback) _boxes_icon_view_child_update_thumbnail_g_object_notify, self, 0);
	_tmp4_ = boxes_icon_view_child_get_machine (self);
	_tmp5_ = _tmp4_;
	g_signal_connect_object ((GObject*) _tmp5_, "notify::pixbuf", (GCallback) _boxes_icon_view_child_update_thumbnail_g_object_notify, self, 0);
	_tmp6_ = boxes_icon_view_child_get_machine (self);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->machine_name;
	g_object_bind_property_with_closures ((GObject*) _tmp7_, "name", (GObject*) _tmp8_, "label", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = boxes_icon_view_child_get_machine (self);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->machine_status;
	g_object_bind_property_with_closures ((GObject*) _tmp10_, "status", (GObject*) _tmp11_, "label", G_BINDING_SYNC_CREATE, (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 self;
}

BoxesIconViewChild*
boxes_icon_view_child_new (BoxesCollectionItem* item)
{
	return boxes_icon_view_child_construct (BOXES_TYPE_ICON_VIEW_CHILD, item);
}

static void
boxes_icon_view_child_update_thumbnail (BoxesIconViewChild* self)
{
	BoxesThumbnail* _tmp0_;
	BoxesMachine* _tmp1_;
	BoxesMachine* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->thumbnail;
	_tmp1_ = boxes_icon_view_child_get_machine (self);
	_tmp2_ = _tmp1_;
	boxes_thumbnail_update (_tmp0_, _tmp2_);
}

BoxesCollectionItem*
boxes_icon_view_child_get_item (BoxesIconViewChild* self)
{
	BoxesCollectionItem* result;
	BoxesCollectionItem* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_item;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
boxes_icon_view_child_set_item (BoxesIconViewChild* self,
                                BoxesCollectionItem* value)
{
	BoxesCollectionItem* old_value;
	g_return_if_fail (self != NULL);
	old_value = boxes_icon_view_child_get_item (self);
	if (old_value != value) {
		BoxesCollectionItem* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_item);
		self->priv->_item = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, boxes_icon_view_child_properties[BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY]);
	}
}

static BoxesMachine*
boxes_icon_view_child_get_machine (BoxesIconViewChild* self)
{
	BoxesMachine* result;
	BoxesCollectionItem* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_item;
	result = BOXES_IS_MACHINE (_tmp0_) ? ((BoxesMachine*) _tmp0_) : NULL;
	return result;
}

static void
boxes_icon_view_child_class_init (BoxesIconViewChildClass * klass,
                                  gpointer klass_data)
{
	boxes_icon_view_child_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesIconViewChild_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_icon_view_child_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_icon_view_child_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_icon_view_child_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY, boxes_icon_view_child_properties[BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY] = g_param_spec_object ("item", "item", "item", BOXES_TYPE_COLLECTION_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/icon-view-child.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "thumbnail", FALSE, G_STRUCT_OFFSET (BoxesIconViewChild, thumbnail));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "machine_name", FALSE, BoxesIconViewChild_private_offset + G_STRUCT_OFFSET (BoxesIconViewChildPrivate, machine_name));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "machine_status", FALSE, BoxesIconViewChild_private_offset + G_STRUCT_OFFSET (BoxesIconViewChildPrivate, machine_status));
}

static void
boxes_icon_view_child_instance_init (BoxesIconViewChild * self,
                                     gpointer klass)
{
	self->priv = boxes_icon_view_child_get_instance_private (self);
	g_type_ensure (BOXES_TYPE_THUMBNAIL);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_icon_view_child_finalize (GObject * obj)
{
	BoxesIconViewChild * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChild);
	_g_object_unref0 (self->priv->_item);
	G_OBJECT_CLASS (boxes_icon_view_child_parent_class)->finalize (obj);
}

static GType
boxes_icon_view_child_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesIconViewChildClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_icon_view_child_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesIconViewChild), 0, (GInstanceInitFunc) boxes_icon_view_child_instance_init, NULL };
	GType boxes_icon_view_child_type_id;
	boxes_icon_view_child_type_id = g_type_register_static (gtk_box_get_type (), "BoxesIconViewChild", &g_define_type_info, 0);
	BoxesIconViewChild_private_offset = g_type_add_instance_private (boxes_icon_view_child_type_id, sizeof (BoxesIconViewChildPrivate));
	return boxes_icon_view_child_type_id;
}

GType
boxes_icon_view_child_get_type (void)
{
	static volatile gsize boxes_icon_view_child_type_id__once = 0;
	if (g_once_init_enter (&boxes_icon_view_child_type_id__once)) {
		GType boxes_icon_view_child_type_id;
		boxes_icon_view_child_type_id = boxes_icon_view_child_get_type_once ();
		g_once_init_leave (&boxes_icon_view_child_type_id__once, boxes_icon_view_child_type_id);
	}
	return boxes_icon_view_child_type_id__once;
}

static void
_vala_boxes_icon_view_child_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	BoxesIconViewChild * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChild);
	switch (property_id) {
		case BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY:
		g_value_set_object (value, boxes_icon_view_child_get_item (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_boxes_icon_view_child_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	BoxesIconViewChild * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_ICON_VIEW_CHILD, BoxesIconViewChild);
	switch (property_id) {
		case BOXES_ICON_VIEW_CHILD_ITEM_PROPERTY:
		boxes_icon_view_child_set_item (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

