/* settings_item.c generated by valac 0.56.3, the Vala compiler
 * generated from settings_item.vala, do not modify */

/*
 * This file is part of budgie-desktop
 *
 * Copyright © 2015-2022 Budgie Desktop Developers
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#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 BUDGIE_TYPE_SETTINGS_ITEM (budgie_settings_item_get_type ())
#define BUDGIE_SETTINGS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItem))
#define BUDGIE_SETTINGS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItemClass))
#define BUDGIE_IS_SETTINGS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_SETTINGS_ITEM))
#define BUDGIE_IS_SETTINGS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_SETTINGS_ITEM))
#define BUDGIE_SETTINGS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItemClass))

typedef struct _BudgieSettingsItem BudgieSettingsItem;
typedef struct _BudgieSettingsItemClass BudgieSettingsItemClass;
typedef struct _BudgieSettingsItemPrivate BudgieSettingsItemPrivate;
enum  {
	BUDGIE_SETTINGS_ITEM_0_PROPERTY,
	BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY,
	BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY,
	BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY,
	BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY,
	BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY,
	BUDGIE_SETTINGS_ITEM_NUM_PROPERTIES
};
static GParamSpec* budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BudgieSettingsItem {
	GtkBox parent_instance;
	BudgieSettingsItemPrivate * priv;
};

struct _BudgieSettingsItemClass {
	GtkBoxClass parent_class;
};

struct _BudgieSettingsItemPrivate {
	GtkImage* widget_icon;
	GtkLabel* widget_label;
	gint _display_weight;
	gchar* _icon_name;
	gchar* _group;
	gchar* _content_id;
};

static gint BudgieSettingsItem_private_offset;
static gpointer budgie_settings_item_parent_class = NULL;

VALA_EXTERN GType budgie_settings_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BudgieSettingsItem, g_object_unref)
VALA_EXTERN BudgieSettingsItem* budgie_settings_item_new (const gchar* group,
                                              const gchar* content_id,
                                              const gchar* label,
                                              const gchar* icon_name);
VALA_EXTERN BudgieSettingsItem* budgie_settings_item_construct (GType object_type,
                                                    const gchar* group,
                                                    const gchar* content_id,
                                                    const gchar* label,
                                                    const gchar* icon_name);
VALA_EXTERN void budgie_settings_item_set_icon_name (BudgieSettingsItem* self,
                                         const gchar* value);
VALA_EXTERN void budgie_settings_item_set_label (BudgieSettingsItem* self,
                                     const gchar* value);
VALA_EXTERN void budgie_settings_item_set_group (BudgieSettingsItem* self,
                                     const gchar* value);
VALA_EXTERN void budgie_settings_item_set_content_id (BudgieSettingsItem* self,
                                          const gchar* value);
VALA_EXTERN gint budgie_settings_item_get_display_weight (BudgieSettingsItem* self);
VALA_EXTERN void budgie_settings_item_set_display_weight (BudgieSettingsItem* self,
                                              gint value);
VALA_EXTERN const gchar* budgie_settings_item_get_icon_name (BudgieSettingsItem* self);
VALA_EXTERN const gchar* budgie_settings_item_get_label (BudgieSettingsItem* self);
VALA_EXTERN const gchar* budgie_settings_item_get_group (BudgieSettingsItem* self);
VALA_EXTERN const gchar* budgie_settings_item_get_content_id (BudgieSettingsItem* self);
static void budgie_settings_item_finalize (GObject * obj);
static GType budgie_settings_item_get_type_once (void);
static void _vala_budgie_settings_item_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_budgie_settings_item_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
budgie_settings_item_get_instance_private (BudgieSettingsItem* self)
{
	return G_STRUCT_MEMBER_P (self, BudgieSettingsItem_private_offset);
}

BudgieSettingsItem*
budgie_settings_item_construct (GType object_type,
                                const gchar* group,
                                const gchar* content_id,
                                const gchar* label,
                                const gchar* icon_name)
{
	BudgieSettingsItem * self = NULL;
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	GtkImage* _tmp8_;
	GtkImage* _tmp9_;
	GtkImage* _tmp10_;
	GtkLabel* _tmp11_;
	GtkImage* _tmp12_;
	g_return_val_if_fail (group != NULL, NULL);
	g_return_val_if_fail (content_id != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (icon_name != NULL, NULL);
	self = (BudgieSettingsItem*) g_object_new (object_type, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 0, NULL);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->widget_icon);
	self->priv->widget_icon = _tmp0_;
	_tmp1_ = self->priv->widget_icon;
	g_object_set (_tmp1_, "icon-size", (gint) GTK_ICON_SIZE_DND, NULL);
	_tmp2_ = self->priv->widget_icon;
	gtk_image_set_pixel_size (_tmp2_, 32);
	_tmp3_ = (GtkLabel*) gtk_label_new (label);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->widget_label);
	self->priv->widget_label = _tmp3_;
	_tmp4_ = self->priv->widget_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	_tmp5_ = self->priv->widget_label;
	gtk_label_set_use_markup (_tmp5_, TRUE);
	_tmp6_ = self->priv->widget_label;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 24);
	_tmp7_ = self->priv->widget_label;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 6);
	_tmp8_ = self->priv->widget_icon;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp8_, 8);
	_tmp9_ = self->priv->widget_icon;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) self, 2);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 2);
	_tmp10_ = self->priv->widget_icon;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp10_, FALSE, FALSE, (guint) 0);
	_tmp11_ = self->priv->widget_label;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp11_, FALSE, FALSE, (guint) 0);
	_tmp12_ = self->priv->widget_icon;
	g_object_bind_property_with_closures ((GObject*) self, "icon-name", (GObject*) _tmp12_, "icon-name", G_BINDING_DEFAULT | 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)));
	budgie_settings_item_set_icon_name (self, icon_name);
	budgie_settings_item_set_label (self, label);
	budgie_settings_item_set_group (self, group);
	budgie_settings_item_set_content_id (self, content_id);
	return self;
}

BudgieSettingsItem*
budgie_settings_item_new (const gchar* group,
                          const gchar* content_id,
                          const gchar* label,
                          const gchar* icon_name)
{
	return budgie_settings_item_construct (BUDGIE_TYPE_SETTINGS_ITEM, group, content_id, label, icon_name);
}

gint
budgie_settings_item_get_display_weight (BudgieSettingsItem* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_display_weight;
	return result;
}

void
budgie_settings_item_set_display_weight (BudgieSettingsItem* self,
                                         gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_settings_item_get_display_weight (self);
	if (old_value != value) {
		self->priv->_display_weight = value;
		g_object_notify_by_pspec ((GObject *) self, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY]);
	}
}

const gchar*
budgie_settings_item_get_icon_name (BudgieSettingsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon_name;
	result = _tmp0_;
	return result;
}

void
budgie_settings_item_set_icon_name (BudgieSettingsItem* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_settings_item_get_icon_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_icon_name);
		self->priv->_icon_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY]);
	}
}

const gchar*
budgie_settings_item_get_label (BudgieSettingsItem* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->widget_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	result = _tmp1_;
	return result;
}

void
budgie_settings_item_set_label (BudgieSettingsItem* self,
                                const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->widget_label;
	gtk_label_set_markup (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY]);
}

const gchar*
budgie_settings_item_get_group (BudgieSettingsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_group;
	result = _tmp0_;
	return result;
}

void
budgie_settings_item_set_group (BudgieSettingsItem* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_settings_item_get_group (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_group);
		self->priv->_group = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY]);
	}
}

const gchar*
budgie_settings_item_get_content_id (BudgieSettingsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_id;
	result = _tmp0_;
	return result;
}

void
budgie_settings_item_set_content_id (BudgieSettingsItem* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_settings_item_get_content_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_content_id);
		self->priv->_content_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY]);
	}
}

static void
budgie_settings_item_class_init (BudgieSettingsItemClass * klass,
                                 gpointer klass_data)
{
	budgie_settings_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BudgieSettingsItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_budgie_settings_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_budgie_settings_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = budgie_settings_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY] = g_param_spec_int ("display-weight", "display-weight", "display-weight", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY] = g_param_spec_string ("group", "group", "group", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY, budgie_settings_item_properties[BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY] = g_param_spec_string ("content-id", "content-id", "content-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
budgie_settings_item_instance_init (BudgieSettingsItem * self,
                                    gpointer klass)
{
	self->priv = budgie_settings_item_get_instance_private (self);
	self->priv->_display_weight = 0;
}

static void
budgie_settings_item_finalize (GObject * obj)
{
	BudgieSettingsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItem);
	_g_object_unref0 (self->priv->widget_icon);
	_g_object_unref0 (self->priv->widget_label);
	_g_free0 (self->priv->_icon_name);
	_g_free0 (self->priv->_group);
	_g_free0 (self->priv->_content_id);
	G_OBJECT_CLASS (budgie_settings_item_parent_class)->finalize (obj);
}

static GType
budgie_settings_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BudgieSettingsItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) budgie_settings_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BudgieSettingsItem), 0, (GInstanceInitFunc) budgie_settings_item_instance_init, NULL };
	GType budgie_settings_item_type_id;
	budgie_settings_item_type_id = g_type_register_static (gtk_box_get_type (), "BudgieSettingsItem", &g_define_type_info, 0);
	BudgieSettingsItem_private_offset = g_type_add_instance_private (budgie_settings_item_type_id, sizeof (BudgieSettingsItemPrivate));
	return budgie_settings_item_type_id;
}

GType
budgie_settings_item_get_type (void)
{
	static volatile gsize budgie_settings_item_type_id__once = 0;
	if (g_once_init_enter (&budgie_settings_item_type_id__once)) {
		GType budgie_settings_item_type_id;
		budgie_settings_item_type_id = budgie_settings_item_get_type_once ();
		g_once_init_leave (&budgie_settings_item_type_id__once, budgie_settings_item_type_id);
	}
	return budgie_settings_item_type_id__once;
}

static void
_vala_budgie_settings_item_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	BudgieSettingsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItem);
	switch (property_id) {
		case BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY:
		g_value_set_int (value, budgie_settings_item_get_display_weight (self));
		break;
		case BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY:
		g_value_set_string (value, budgie_settings_item_get_icon_name (self));
		break;
		case BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY:
		g_value_set_string (value, budgie_settings_item_get_label (self));
		break;
		case BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY:
		g_value_set_string (value, budgie_settings_item_get_group (self));
		break;
		case BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY:
		g_value_set_string (value, budgie_settings_item_get_content_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_budgie_settings_item_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	BudgieSettingsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BUDGIE_TYPE_SETTINGS_ITEM, BudgieSettingsItem);
	switch (property_id) {
		case BUDGIE_SETTINGS_ITEM_DISPLAY_WEIGHT_PROPERTY:
		budgie_settings_item_set_display_weight (self, g_value_get_int (value));
		break;
		case BUDGIE_SETTINGS_ITEM_ICON_NAME_PROPERTY:
		budgie_settings_item_set_icon_name (self, g_value_get_string (value));
		break;
		case BUDGIE_SETTINGS_ITEM_LABEL_PROPERTY:
		budgie_settings_item_set_label (self, g_value_get_string (value));
		break;
		case BUDGIE_SETTINGS_ITEM_GROUP_PROPERTY:
		budgie_settings_item_set_group (self, g_value_get_string (value));
		break;
		case BUDGIE_SETTINGS_ITEM_CONTENT_ID_PROPERTY:
		budgie_settings_item_set_content_id (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

