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

/*
 * Copyright (c) 2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "ft_plugin_sni.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

typedef struct _SniMenuItem SniMenuItem;
typedef struct _SniMenuItemClass SniMenuItemClass;
typedef struct _SniMenuItemPrivate SniMenuItemPrivate;
enum  {
	SNI_MENU_ITEM_0_PROPERTY,
	SNI_MENU_ITEM_ID_PROPERTY,
	SNI_MENU_ITEM_NAME_PROPERTY,
	SNI_MENU_ITEM_ACTION_NAME_PROPERTY,
	SNI_MENU_ITEM_ACTION_TARGET_PROPERTY,
	SNI_MENU_ITEM_ITEM_TYPE_PROPERTY,
	SNI_MENU_ITEM_ICON_NAME_PROPERTY,
	SNI_MENU_ITEM_LABEL_PROPERTY,
	SNI_MENU_ITEM_TOGGLE_TYPE_PROPERTY,
	SNI_MENU_ITEM_TOGGLE_STATE_PROPERTY,
	SNI_MENU_ITEM_ENABLED_PROPERTY,
	SNI_MENU_ITEM_VISIBLE_PROPERTY,
	SNI_MENU_ITEM_NUM_PROPERTIES
};
static GParamSpec* sni_menu_item_properties[SNI_MENU_ITEM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block10Data Block10Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
enum  {
	SNI_MENU_ITEM_CHILD_ADDED_SIGNAL,
	SNI_MENU_ITEM_CHILD_REMOVED_SIGNAL,
	SNI_MENU_ITEM_CHANGED_SIGNAL,
	SNI_MENU_ITEM_NUM_SIGNALS
};
static guint sni_menu_item_signals[SNI_MENU_ITEM_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _SniMenuItem {
	GObject parent_instance;
	SniMenuItemPrivate * priv;
	gboolean dirty_layout;
	guint dirty_properties;
	guint modified_properties;
};

struct _SniMenuItemClass {
	GObjectClass parent_class;
};

struct _SniMenuItemPrivate {
	guint _id;
	gchar* _name;
	gchar* _action_name;
	GVariant* _action_target;
	SniMenuItemType _item_type;
	gchar* _icon_name;
	gchar* _label;
	SniMenuToggleType _toggle_type;
	gboolean _toggle_state;
	gboolean _enabled;
	gboolean _visible;
	SniMenuItem* parent;
	GList* children;
};

struct _Block10Data {
	int _ref_count_;
	SniMenuItem* self;
	GFunc func;
	gpointer func_target;
};

static gint SniMenuItem_private_offset;
static gpointer sni_menu_item_parent_class = NULL;
static guint sni_menu_item_next_id;
static guint sni_menu_item_next_id = 1U;
static GType sni_menu_item_type_id = 0;

static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void __lambda6_ (Block10Data* _data10_,
                 SniMenuItem* child);
static void ___lambda6__gfunc (gconstpointer data,
                        gpointer self);
VALA_EXTERN gboolean sni_menu_item_has_default_property (SniMenuItem* self,
                                             SniMenuItemProperty property);
VALA_EXTERN gboolean sni_menu_item_has_modified_property (SniMenuItem* self,
                                              SniMenuItemProperty property);
VALA_EXTERN void sni_menu_item_mark_dirty_layout (SniMenuItem* self);
VALA_EXTERN void sni_menu_item_mark_dirty_property (SniMenuItem* self,
                                        SniMenuItemProperty property);
static void sni_menu_item_real_dispose (GObject* base);
static void sni_menu_item_finalize (GObject * obj);
static void _vala_sni_menu_item_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_sni_menu_item_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sni_menu_item_get_instance_private (SniMenuItem* self)
{
	return G_STRUCT_MEMBER_P (self, SniMenuItem_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

SniMenuItem*
sni_menu_item_construct (GType object_type,
                         const gchar* name,
                         const gchar* label,
                         const gchar* icon_name,
                         const gchar* action_name,
                         GVariant* action_target)
{
	SniMenuItem * self = NULL;
	guint id = 0U;
	guint _tmp0_;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (icon_name != NULL, NULL);
	g_return_val_if_fail (action_name != NULL, NULL);
	id = sni_menu_item_next_id;
	_tmp0_ = sni_menu_item_next_id;
	sni_menu_item_next_id = _tmp0_ + 1;
	self = (SniMenuItem*) g_object_new (object_type, "id", id, "name", name, "item-type", SNI_MENU_ITEM_TYPE_STANDARD, "label", label, "icon-name", icon_name, "action-name", action_name, "action-target", action_target, NULL);
	return self;
}

SniMenuItem*
sni_menu_item_new (const gchar* name,
                   const gchar* label,
                   const gchar* icon_name,
                   const gchar* action_name,
                   GVariant* action_target)
{
	return sni_menu_item_construct (SNI_TYPE_MENU_ITEM, name, label, icon_name, action_name, action_target);
}

SniMenuItem*
sni_menu_item_construct_root (GType object_type)
{
	SniMenuItem * self = NULL;
	self = (SniMenuItem*) g_object_new (object_type, "id", 0U, "name", "", "item-type", SNI_MENU_ITEM_TYPE_STANDARD, NULL);
	return self;
}

SniMenuItem*
sni_menu_item_new_root (void)
{
	return sni_menu_item_construct_root (SNI_TYPE_MENU_ITEM);
}

SniMenuItem*
sni_menu_item_construct_separator (GType object_type,
                                   const gchar* name)
{
	SniMenuItem * self = NULL;
	guint id = 0U;
	guint _tmp0_;
	g_return_val_if_fail (name != NULL, NULL);
	id = sni_menu_item_next_id;
	_tmp0_ = sni_menu_item_next_id;
	sni_menu_item_next_id = _tmp0_ + 1;
	self = (SniMenuItem*) g_object_new (object_type, "id", id, "name", name, "item-type", SNI_MENU_ITEM_TYPE_SEPARATOR, NULL);
	return self;
}

SniMenuItem*
sni_menu_item_new_separator (const gchar* name)
{
	return sni_menu_item_construct_separator (SNI_TYPE_MENU_ITEM, name);
}

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

void
sni_menu_item_append (SniMenuItem* self,
                      SniMenuItem* child)
{
	SniMenuItem* _tmp0_;
	SniMenuItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = child->priv->parent;
	_vala_return_if_fail (_tmp0_ == NULL, "child.parent == null");
	child->priv->parent = self;
	_tmp1_ = _g_object_ref0 (child);
	self->priv->children = g_list_append (self->priv->children, _tmp1_);
	g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHILD_ADDED_SIGNAL], 0, child);
}

void
sni_menu_item_foreach (SniMenuItem* self,
                       GFunc func,
                       gpointer func_target)
{
	GList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->children;
	g_list_foreach (_tmp0_, func, func_target);
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		SniMenuItem* self;
		self = _data10_->self;
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
__lambda6_ (Block10Data* _data10_,
            SniMenuItem* child)
{
	SniMenuItem* self;
	self = _data10_->self;
	g_return_if_fail (child != NULL);
	sni_menu_item_traverse (child, _data10_->func, _data10_->func_target);
}

static void
___lambda6__gfunc (gconstpointer data,
                   gpointer self)
{
	__lambda6_ (self, (SniMenuItem*) data);
}

void
sni_menu_item_traverse (SniMenuItem* self,
                        GFunc func,
                        gpointer func_target)
{
	Block10Data* _data10_;
	GList* _tmp0_;
	g_return_if_fail (self != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_data10_->self = g_object_ref (self);
	_data10_->func = func;
	_data10_->func_target = func_target;
	_data10_->func (self, _data10_->func_target);
	_tmp0_ = self->priv->children;
	g_list_foreach (_tmp0_, ___lambda6__gfunc, _data10_);
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

gboolean
sni_menu_item_has_children (SniMenuItem* self)
{
	GList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->children;
	result = _tmp0_ != NULL;
	return result;
}

gboolean
sni_menu_item_needs_update (SniMenuItem* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->dirty_layout) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->dirty_properties != 0U;
	}
	result = _tmp0_;
	return result;
}

gboolean
sni_menu_item_has_default_property (SniMenuItem* self,
                                    SniMenuItemProperty property)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	switch (property) {
		case SNI_MENU_ITEM_PROPERTY_TYPE:
		{
			result = self->priv->_item_type == SNI_MENU_ITEM_TYPE_STANDARD;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_LABEL:
		{
			const gchar* _tmp0_;
			_tmp0_ = self->priv->_label;
			result = g_strcmp0 (_tmp0_, "") == 0;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ENABLED:
		{
			result = self->priv->_enabled;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_VISIBLE:
		{
			result = self->priv->_visible;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ICON_NAME:
		{
			const gchar* _tmp1_;
			_tmp1_ = self->priv->_icon_name;
			result = g_strcmp0 (_tmp1_, "") == 0;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_TOGGLE_TYPE:
		case SNI_MENU_ITEM_PROPERTY_TOGGLE_STATE:
		{
			result = self->priv->_toggle_type == SNI_MENU_TOGGLE_TYPE_NONE;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_CHILDREN_DISPLAY:
		{
			result = !sni_menu_item_has_children (self);
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ICON_DATA:
		{
			result = TRUE;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_SHORTCUT:
		{
			result = TRUE;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_INVALID:
		{
			result = TRUE;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

gboolean
sni_menu_item_has_modified_property (SniMenuItem* self,
                                     SniMenuItemProperty property)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = (self->modified_properties & (1 << ((guint) property))) != ((guint) 0);
	return result;
}

GVariant*
sni_menu_item_serialize_property (SniMenuItem* self,
                                  SniMenuItemProperty property)
{
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	switch (property) {
		case SNI_MENU_ITEM_PROPERTY_TYPE:
		{
			gchar* _tmp0_;
			gchar* _tmp1_;
			GVariant* _tmp2_;
			GVariant* _tmp3_;
			_tmp0_ = sni_menu_item_type_to_string (self->priv->_item_type);
			_tmp1_ = _tmp0_;
			_tmp2_ = g_variant_new_string (_tmp1_);
			g_variant_ref_sink (_tmp2_);
			_tmp3_ = _tmp2_;
			_g_free0 (_tmp1_);
			result = _tmp3_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_LABEL:
		{
			const gchar* _tmp4_;
			GVariant* _tmp5_;
			_tmp4_ = self->priv->_label;
			_tmp5_ = g_variant_new_string (_tmp4_);
			g_variant_ref_sink (_tmp5_);
			result = _tmp5_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ENABLED:
		{
			GVariant* _tmp6_;
			_tmp6_ = g_variant_new_boolean (self->priv->_enabled);
			g_variant_ref_sink (_tmp6_);
			result = _tmp6_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_VISIBLE:
		{
			GVariant* _tmp7_;
			_tmp7_ = g_variant_new_boolean (self->priv->_visible);
			g_variant_ref_sink (_tmp7_);
			result = _tmp7_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ICON_NAME:
		{
			const gchar* _tmp8_;
			GVariant* _tmp9_;
			_tmp8_ = self->priv->_icon_name;
			_tmp9_ = g_variant_new_string (_tmp8_);
			g_variant_ref_sink (_tmp9_);
			result = _tmp9_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_TOGGLE_TYPE:
		{
			gchar* _tmp10_;
			gchar* _tmp11_;
			GVariant* _tmp12_;
			GVariant* _tmp13_;
			_tmp10_ = sni_menu_toggle_type_to_string (self->priv->_toggle_type);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_variant_new_string (_tmp11_);
			g_variant_ref_sink (_tmp12_);
			_tmp13_ = _tmp12_;
			_g_free0 (_tmp11_);
			result = _tmp13_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_TOGGLE_STATE:
		{
			gint32 _tmp14_ = 0;
			GVariant* _tmp15_;
			if (self->priv->_toggle_type != SNI_MENU_TOGGLE_TYPE_NONE) {
				_tmp14_ = (gint32) self->priv->_toggle_state;
			} else {
				_tmp14_ = (gint32) -1;
			}
			_tmp15_ = g_variant_new_int32 (_tmp14_);
			g_variant_ref_sink (_tmp15_);
			result = _tmp15_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_CHILDREN_DISPLAY:
		{
			const gchar* _tmp16_ = NULL;
			GVariant* _tmp17_;
			if (sni_menu_item_has_children (self)) {
				_tmp16_ = "submenu";
			} else {
				_tmp16_ = "";
			}
			_tmp17_ = g_variant_new_string (_tmp16_);
			g_variant_ref_sink (_tmp17_);
			result = _tmp17_;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_ICON_DATA:
		{
			result = NULL;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_SHORTCUT:
		{
			result = NULL;
			return result;
		}
		case SNI_MENU_ITEM_PROPERTY_INVALID:
		{
			result = NULL;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

GVariant*
sni_menu_item_serialize_properties (SniMenuItem* self,
                                    SniMenuItemProperty* properties,
                                    gint properties_length1)
{
	GVariantBuilder* builder = NULL;
	const GVariantType* _tmp0_;
	GVariantBuilder* _tmp1_;
	GVariantBuilder* _tmp8_;
	GVariant* _tmp9_;
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = G_VARIANT_TYPE_VARDICT;
	_tmp1_ = g_variant_builder_new (_tmp0_);
	builder = _tmp1_;
	{
		SniMenuItemProperty* property_collection = NULL;
		gint property_collection_length1 = 0;
		gint _property_collection_size_ = 0;
		gint property_it = 0;
		property_collection = properties;
		property_collection_length1 = properties_length1;
		for (property_it = 0; property_it < property_collection_length1; property_it = property_it + 1) {
			SniMenuItemProperty property = 0;
			property = property_collection[property_it];
			{
				GVariant* value = NULL;
				GVariant* _tmp2_;
				GVariant* _tmp3_;
				_tmp2_ = sni_menu_item_serialize_property (self, property);
				value = _tmp2_;
				_tmp3_ = value;
				if (_tmp3_ != NULL) {
					GVariantBuilder* _tmp4_;
					gchar* _tmp5_;
					gchar* _tmp6_;
					GVariant* _tmp7_;
					_tmp4_ = builder;
					_tmp5_ = sni_menu_item_property_to_string (property);
					_tmp6_ = _tmp5_;
					_tmp7_ = value;
					g_variant_builder_add (_tmp4_, "{sv}", _tmp6_, _tmp7_, NULL);
					_g_free0 (_tmp6_);
				}
				_g_variant_unref0 (value);
			}
		}
	}
	_tmp8_ = builder;
	_tmp9_ = g_variant_builder_end (_tmp8_);
	g_variant_ref_sink (_tmp9_);
	result = _tmp9_;
	_g_variant_builder_unref0 (builder);
	return result;
}

void
sni_menu_item_mark_dirty_layout (SniMenuItem* self)
{
	g_return_if_fail (self != NULL);
	self->dirty_layout = TRUE;
}

void
sni_menu_item_mark_dirty_property (SniMenuItem* self,
                                   SniMenuItemProperty property)
{
	guint property_mask = 0U;
	g_return_if_fail (self != NULL);
	property_mask = 1 << ((guint) property);
	self->dirty_properties = self->dirty_properties | property_mask;
	self->modified_properties = self->modified_properties | property_mask;
}

static void
sni_menu_item_real_dispose (GObject* base)
{
	SniMenuItem * self;
	self = (SniMenuItem*) base;
	self->priv->parent = NULL;
	(self->priv->children == NULL) ? NULL : (self->priv->children = (_g_list_free__g_object_unref0_ (self->priv->children), NULL));
	self->priv->children = NULL;
	G_OBJECT_CLASS (sni_menu_item_parent_class)->dispose (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject));
}

guint
sni_menu_item_get_id (SniMenuItem* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_id;
	return result;
}

static void
sni_menu_item_set_id (SniMenuItem* self,
                      guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = sni_menu_item_get_id (self);
	if (old_value != value) {
		self->priv->_id = value;
		g_object_notify_by_pspec ((GObject *) self, sni_menu_item_properties[SNI_MENU_ITEM_ID_PROPERTY]);
	}
}

const gchar*
sni_menu_item_get_name (SniMenuItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

static void
sni_menu_item_set_name (SniMenuItem* self,
                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = sni_menu_item_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sni_menu_item_properties[SNI_MENU_ITEM_NAME_PROPERTY]);
	}
}

const gchar*
sni_menu_item_get_action_name (SniMenuItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_action_name;
	result = _tmp0_;
	return result;
}

void
sni_menu_item_set_action_name (SniMenuItem* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = sni_menu_item_get_action_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_action_name);
		self->priv->_action_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sni_menu_item_properties[SNI_MENU_ITEM_ACTION_NAME_PROPERTY]);
	}
}

GVariant*
sni_menu_item_get_action_target (SniMenuItem* self)
{
	GVariant* result;
	GVariant* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_action_target;
	result = _tmp0_;
	return result;
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

void
sni_menu_item_set_action_target (SniMenuItem* self,
                                 GVariant* value)
{
	GVariant* old_value;
	g_return_if_fail (self != NULL);
	old_value = sni_menu_item_get_action_target (self);
	if (old_value != value) {
		GVariant* _tmp0_;
		_tmp0_ = _g_variant_ref0 (value);
		_g_variant_unref0 (self->priv->_action_target);
		self->priv->_action_target = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sni_menu_item_properties[SNI_MENU_ITEM_ACTION_TARGET_PROPERTY]);
	}
}

SniMenuItemType
sni_menu_item_get_item_type (SniMenuItem* self)
{
	SniMenuItemType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_item_type;
	return result;
}

static void
sni_menu_item_set_item_type (SniMenuItem* self,
                             SniMenuItemType value)
{
	g_return_if_fail (self != NULL);
	self->priv->_item_type = value;
}

const gchar*
sni_menu_item_get_icon_name (SniMenuItem* 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
sni_menu_item_set_icon_name (SniMenuItem* self,
                             const gchar* value)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_icon_name;
	if (g_strcmp0 (_tmp0_, value) != 0) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup (value);
		_g_free0 (self->priv->_icon_name);
		self->priv->_icon_name = _tmp1_;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_ICON_NAME);
	}
}

const gchar*
sni_menu_item_get_label (SniMenuItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

void
sni_menu_item_set_label (SniMenuItem* self,
                         const gchar* value)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_label;
	if (g_strcmp0 (_tmp0_, value) != 0) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp1_;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_LABEL);
	}
}

SniMenuToggleType
sni_menu_item_get_toggle_type (SniMenuItem* self)
{
	SniMenuToggleType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_toggle_type;
	return result;
}

void
sni_menu_item_set_toggle_type (SniMenuItem* self,
                               SniMenuToggleType value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_toggle_type != value) {
		self->priv->_toggle_type = value;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_TOGGLE_TYPE);
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_TOGGLE_STATE);
	}
}

gboolean
sni_menu_item_get_toggle_state (SniMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_toggle_state;
	return result;
}

void
sni_menu_item_set_toggle_state (SniMenuItem* self,
                                gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_toggle_state != value) {
		self->priv->_toggle_state = value;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_TOGGLE_STATE);
	}
}

gboolean
sni_menu_item_get_enabled (SniMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_enabled;
	return result;
}

void
sni_menu_item_set_enabled (SniMenuItem* self,
                           gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_enabled != value) {
		self->priv->_enabled = value;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_ENABLED);
	}
}

gboolean
sni_menu_item_get_visible (SniMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_visible;
	return result;
}

void
sni_menu_item_set_visible (SniMenuItem* self,
                           gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_visible != value) {
		self->priv->_visible = value;
		g_signal_emit (self, sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL], 0, SNI_MENU_ITEM_PROPERTY_VISIBLE);
	}
}

static void
sni_menu_item_class_init (SniMenuItemClass * klass,
                          gpointer klass_data)
{
	sni_menu_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SniMenuItem_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) sni_menu_item_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_sni_menu_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_sni_menu_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = sni_menu_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ID_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_ID_PROPERTY] = g_param_spec_uint ("id", "id", "id", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_NAME_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ACTION_NAME_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_ACTION_NAME_PROPERTY] = g_param_spec_string ("action-name", "action-name", "action-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ACTION_TARGET_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_ACTION_TARGET_PROPERTY] = g_param_spec_variant ("action-target", "action-target", "action-target", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ITEM_TYPE_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_ITEM_TYPE_PROPERTY] = g_param_spec_enum ("item-type", "item-type", "item-type", SNI_TYPE_MENU_ITEM_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ICON_NAME_PROPERTY, sni_menu_item_properties[SNI_MENU_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_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_LABEL_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_TOGGLE_TYPE_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_TOGGLE_TYPE_PROPERTY] = g_param_spec_enum ("toggle-type", "toggle-type", "toggle-type", SNI_TYPE_MENU_TOGGLE_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_TOGGLE_STATE_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_TOGGLE_STATE_PROPERTY] = g_param_spec_boolean ("toggle-state", "toggle-state", "toggle-state", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_ENABLED_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNI_MENU_ITEM_VISIBLE_PROPERTY, sni_menu_item_properties[SNI_MENU_ITEM_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	sni_menu_item_signals[SNI_MENU_ITEM_CHILD_ADDED_SIGNAL] = g_signal_new ("child-added", SNI_TYPE_MENU_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SNI_TYPE_MENU_ITEM);
	sni_menu_item_signals[SNI_MENU_ITEM_CHILD_REMOVED_SIGNAL] = g_signal_new ("child-removed", SNI_TYPE_MENU_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SNI_TYPE_MENU_ITEM);
	sni_menu_item_signals[SNI_MENU_ITEM_CHANGED_SIGNAL] = g_signal_new ("changed", SNI_TYPE_MENU_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, SNI_TYPE_MENU_ITEM_PROPERTY);
}

static void
sni_menu_item_instance_init (SniMenuItem * self,
                             gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self->priv = sni_menu_item_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_action_name = _tmp0_;
	self->priv->_item_type = SNI_MENU_ITEM_TYPE_STANDARD;
	_tmp1_ = g_strdup ("");
	self->priv->_icon_name = _tmp1_;
	_tmp2_ = g_strdup ("");
	self->priv->_label = _tmp2_;
	self->priv->_toggle_type = SNI_MENU_TOGGLE_TYPE_NONE;
	self->priv->_toggle_state = FALSE;
	self->priv->_enabled = TRUE;
	self->priv->_visible = TRUE;
	self->priv->parent = NULL;
	self->dirty_layout = FALSE;
	self->dirty_properties = 0U;
	self->modified_properties = 0U;
}

static void
sni_menu_item_finalize (GObject * obj)
{
	SniMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SNI_TYPE_MENU_ITEM, SniMenuItem);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_action_name);
	_g_variant_unref0 (self->priv->_action_target);
	_g_free0 (self->priv->_icon_name);
	_g_free0 (self->priv->_label);
	(self->priv->children == NULL) ? NULL : (self->priv->children = (_g_list_free__g_object_unref0_ (self->priv->children), NULL));
	G_OBJECT_CLASS (sni_menu_item_parent_class)->finalize (obj);
}

GType
sni_menu_item_get_type (void)
{
	return sni_menu_item_type_id;
}

GType
sni_menu_item_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (SniMenuItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sni_menu_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SniMenuItem), 0, (GInstanceInitFunc) sni_menu_item_instance_init, NULL };
	sni_menu_item_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "SniMenuItem", &g_define_type_info, 0);
	SniMenuItem_private_offset = sizeof (SniMenuItemPrivate);
	return sni_menu_item_type_id;
}

static void
_vala_sni_menu_item_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	SniMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SNI_TYPE_MENU_ITEM, SniMenuItem);
	switch (property_id) {
		case SNI_MENU_ITEM_ID_PROPERTY:
		g_value_set_uint (value, sni_menu_item_get_id (self));
		break;
		case SNI_MENU_ITEM_NAME_PROPERTY:
		g_value_set_string (value, sni_menu_item_get_name (self));
		break;
		case SNI_MENU_ITEM_ACTION_NAME_PROPERTY:
		g_value_set_string (value, sni_menu_item_get_action_name (self));
		break;
		case SNI_MENU_ITEM_ACTION_TARGET_PROPERTY:
		g_value_set_variant (value, sni_menu_item_get_action_target (self));
		break;
		case SNI_MENU_ITEM_ITEM_TYPE_PROPERTY:
		g_value_set_enum (value, sni_menu_item_get_item_type (self));
		break;
		case SNI_MENU_ITEM_ICON_NAME_PROPERTY:
		g_value_set_string (value, sni_menu_item_get_icon_name (self));
		break;
		case SNI_MENU_ITEM_LABEL_PROPERTY:
		g_value_set_string (value, sni_menu_item_get_label (self));
		break;
		case SNI_MENU_ITEM_TOGGLE_TYPE_PROPERTY:
		g_value_set_enum (value, sni_menu_item_get_toggle_type (self));
		break;
		case SNI_MENU_ITEM_TOGGLE_STATE_PROPERTY:
		g_value_set_boolean (value, sni_menu_item_get_toggle_state (self));
		break;
		case SNI_MENU_ITEM_ENABLED_PROPERTY:
		g_value_set_boolean (value, sni_menu_item_get_enabled (self));
		break;
		case SNI_MENU_ITEM_VISIBLE_PROPERTY:
		g_value_set_boolean (value, sni_menu_item_get_visible (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_sni_menu_item_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	SniMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SNI_TYPE_MENU_ITEM, SniMenuItem);
	switch (property_id) {
		case SNI_MENU_ITEM_ID_PROPERTY:
		sni_menu_item_set_id (self, g_value_get_uint (value));
		break;
		case SNI_MENU_ITEM_NAME_PROPERTY:
		sni_menu_item_set_name (self, g_value_get_string (value));
		break;
		case SNI_MENU_ITEM_ACTION_NAME_PROPERTY:
		sni_menu_item_set_action_name (self, g_value_get_string (value));
		break;
		case SNI_MENU_ITEM_ACTION_TARGET_PROPERTY:
		sni_menu_item_set_action_target (self, g_value_get_variant (value));
		break;
		case SNI_MENU_ITEM_ITEM_TYPE_PROPERTY:
		sni_menu_item_set_item_type (self, g_value_get_enum (value));
		break;
		case SNI_MENU_ITEM_ICON_NAME_PROPERTY:
		sni_menu_item_set_icon_name (self, g_value_get_string (value));
		break;
		case SNI_MENU_ITEM_LABEL_PROPERTY:
		sni_menu_item_set_label (self, g_value_get_string (value));
		break;
		case SNI_MENU_ITEM_TOGGLE_TYPE_PROPERTY:
		sni_menu_item_set_toggle_type (self, g_value_get_enum (value));
		break;
		case SNI_MENU_ITEM_TOGGLE_STATE_PROPERTY:
		sni_menu_item_set_toggle_state (self, g_value_get_boolean (value));
		break;
		case SNI_MENU_ITEM_ENABLED_PROPERTY:
		sni_menu_item_set_enabled (self, g_value_get_boolean (value));
		break;
		case SNI_MENU_ITEM_VISIBLE_PROPERTY:
		sni_menu_item_set_visible (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

