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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <glib-object.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <adwaita.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

enum  {
	WIDGETS_CONTEXT_MENU_MENU_ITEM_0_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_TITLE_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_SECONDARY_TEXT_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_SUBTITLE_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_BADGE_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_MAX_WIDTH_CHARS_PROPERTY,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_NUM_PROPERTIES
};
static GParamSpec* widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_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))
enum  {
	WIDGETS_CONTEXT_MENU_MENU_ITEM_ACTIVATE_ITEM_SIGNAL,
	WIDGETS_CONTEXT_MENU_MENU_ITEM_NUM_SIGNALS
};
static guint widgets_context_menu_menu_item_signals[WIDGETS_CONTEXT_MENU_MENU_ITEM_NUM_SIGNALS] = {0};

struct _WidgetsContextMenuMenuItemPrivate {
	GtkImage* menu_icon;
	GtkRevealer* menu_icon_revealer;
	GtkLabel* menu_title;
	GtkLabel* subtitle_label;
	GtkRevealer* subtitle_revealer;
	GtkLabel* secondary_label;
	GtkLabel* badge_label;
	GtkRevealer* loading_revealer;
	GtkRevealer* secondary_label_revealer;
	GtkRevealer* badge_revealer;
	GtkRevealer* select_revealer;
	GtkRevealer* arrow_revealer;
	gboolean _autohide_popover;
	gchar* _icon;
	gboolean _is_loading;
	gboolean _selected;
	gboolean _arrow;
	GeeHashMap* signals_map;
};

static gint WidgetsContextMenuMenuItem_private_offset;
static gpointer widgets_context_menu_menu_item_parent_class = NULL;

static GObject * widgets_context_menu_menu_item_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
static void _widgets_context_menu_menu_item___lambda139_ (WidgetsContextMenuMenuItem* self);
static void __widgets_context_menu_menu_item___lambda139__gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self);
static void _widgets_context_menu_menu_item___lambda140_ (WidgetsContextMenuMenuItem* self);
static void __widgets_context_menu_menu_item___lambda140__gtk_widget_destroy (GtkWidget* _sender,
                                                                       gpointer self);
static void widgets_context_menu_menu_item_finalize (GObject * obj);
static GType widgets_context_menu_menu_item_get_type_once (void);
static void _vala_widgets_context_menu_menu_item_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_widgets_context_menu_menu_item_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_context_menu_menu_item_get_instance_private (WidgetsContextMenuMenuItem* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsContextMenuMenuItem_private_offset);
}

WidgetsContextMenuMenuItem*
widgets_context_menu_menu_item_construct (GType object_type,
                                          const gchar* title,
                                          const gchar* icon)
{
	WidgetsContextMenuMenuItem * self = NULL;
	g_return_val_if_fail (title != NULL, NULL);
	self = (WidgetsContextMenuMenuItem*) g_object_new (object_type, "title", title, "icon", icon, "hexpand", TRUE, NULL);
	return self;
}

WidgetsContextMenuMenuItem*
widgets_context_menu_menu_item_new (const gchar* title,
                                    const gchar* icon)
{
	return widgets_context_menu_menu_item_construct (WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, title, icon);
}

void
widgets_context_menu_menu_item_set_title (WidgetsContextMenuMenuItem* self,
                                          const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->menu_title;
	gtk_label_set_label (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_TITLE_PROPERTY]);
}

gboolean
widgets_context_menu_menu_item_get_autohide_popover (WidgetsContextMenuMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_autohide_popover;
	return result;
}

void
widgets_context_menu_menu_item_set_autohide_popover (WidgetsContextMenuMenuItem* self,
                                                     gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_autohide_popover = value;
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY]);
}

const gchar*
widgets_context_menu_menu_item_get_icon (WidgetsContextMenuMenuItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon;
	result = _tmp0_;
	return result;
}

void
widgets_context_menu_menu_item_set_icon (WidgetsContextMenuMenuItem* self,
                                         const gchar* value)
{
	g_return_if_fail (self != NULL);
	if (value != NULL) {
		GtkRevealer* _tmp0_;
		gchar* _tmp1_;
		GtkImage* _tmp2_;
		const gchar* _tmp3_;
		_tmp0_ = self->priv->menu_icon_revealer;
		gtk_revealer_set_reveal_child (_tmp0_, TRUE);
		_tmp1_ = g_strdup (value);
		_g_free0 (self->priv->_icon);
		self->priv->_icon = _tmp1_;
		_tmp2_ = self->priv->menu_icon;
		_tmp3_ = self->priv->_icon;
		g_object_set (_tmp2_, "icon-name", _tmp3_, NULL);
	} else {
		GtkRevealer* _tmp4_;
		_tmp4_ = self->priv->menu_icon_revealer;
		gtk_revealer_set_reveal_child (_tmp4_, FALSE);
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY]);
}

void
widgets_context_menu_menu_item_set_secondary_text (WidgetsContextMenuMenuItem* self,
                                                   const gchar* value)
{
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkRevealer* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->secondary_label;
	gtk_label_set_label (_tmp0_, value);
	_tmp1_ = self->priv->secondary_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp1_, value);
	_tmp2_ = self->priv->secondary_label_revealer;
	_tmp3_ = strlen (value);
	_tmp4_ = _tmp3_;
	gtk_revealer_set_reveal_child (_tmp2_, _tmp4_ > 0);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SECONDARY_TEXT_PROPERTY]);
}

void
widgets_context_menu_menu_item_set_subtitle (WidgetsContextMenuMenuItem* self,
                                             const gchar* value)
{
	GtkLabel* _tmp0_;
	GtkRevealer* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->subtitle_label;
	gtk_label_set_label (_tmp0_, value);
	_tmp1_ = self->priv->subtitle_revealer;
	_tmp2_ = strlen (value);
	_tmp3_ = _tmp2_;
	gtk_revealer_set_reveal_child (_tmp1_, _tmp3_ > 0);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SUBTITLE_PROPERTY]);
}

void
widgets_context_menu_menu_item_set_badge (WidgetsContextMenuMenuItem* self,
                                          const gchar* value)
{
	GtkLabel* _tmp0_;
	GtkRevealer* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->badge_label;
	gtk_label_set_label (_tmp0_, value);
	_tmp1_ = self->priv->badge_revealer;
	_tmp2_ = strlen (value);
	_tmp3_ = _tmp2_;
	gtk_revealer_set_reveal_child (_tmp1_, _tmp3_ > 0);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_BADGE_PROPERTY]);
}

gboolean
widgets_context_menu_menu_item_get_is_loading (WidgetsContextMenuMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_loading;
	return result;
}

void
widgets_context_menu_menu_item_set_is_loading (WidgetsContextMenuMenuItem* self,
                                               gboolean value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_is_loading = value;
	_tmp0_ = self->priv->loading_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, self->priv->_is_loading);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY]);
}

gboolean
widgets_context_menu_menu_item_get_selected (WidgetsContextMenuMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_selected;
	return result;
}

void
widgets_context_menu_menu_item_set_selected (WidgetsContextMenuMenuItem* self,
                                             gboolean value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_selected = value;
	_tmp0_ = self->priv->select_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, self->priv->_selected);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY]);
}

gboolean
widgets_context_menu_menu_item_get_arrow (WidgetsContextMenuMenuItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_arrow;
	return result;
}

void
widgets_context_menu_menu_item_set_arrow (WidgetsContextMenuMenuItem* self,
                                          gboolean value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_arrow = value;
	_tmp0_ = self->priv->arrow_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, self->priv->_arrow);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY]);
}

void
widgets_context_menu_menu_item_set_max_width_chars (WidgetsContextMenuMenuItem* self,
                                                    gint value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->menu_title;
	gtk_label_set_max_width_chars (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_MAX_WIDTH_CHARS_PROPERTY]);
}

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

static void
_widgets_context_menu_menu_item___lambda139_ (WidgetsContextMenuMenuItem* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	_tmp0_ = widgets_context_menu_menu_item_get_autohide_popover (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		GtkPopover* popover = NULL;
		GtkWidget* _tmp2_;
		GtkPopover* _tmp3_;
		GtkPopover* _tmp4_;
		_tmp2_ = gtk_widget_get_ancestor ((GtkWidget*) self, gtk_popover_get_type ());
		_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_popover_get_type (), GtkPopover));
		popover = _tmp3_;
		_tmp4_ = popover;
		if (_tmp4_ != NULL) {
			GtkPopover* _tmp5_;
			_tmp5_ = popover;
			gtk_popover_popdown (_tmp5_);
		}
		_g_object_unref0 (popover);
	}
	g_signal_emit (self, widgets_context_menu_menu_item_signals[WIDGETS_CONTEXT_MENU_MENU_ITEM_ACTIVATE_ITEM_SIGNAL], 0);
}

static void
__widgets_context_menu_menu_item___lambda139__gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self)
{
	_widgets_context_menu_menu_item___lambda139_ ((WidgetsContextMenuMenuItem*) self);
}

static void
_widgets_context_menu_menu_item___lambda140_ (WidgetsContextMenuMenuItem* self)
{
	GeeHashMap* _tmp21_;
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->signals_map;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GeeMapEntry* _tmp9_;
			gconstpointer _tmp10_;
			gconstpointer _tmp11_;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp9_ = entry;
			_tmp10_ = gee_map_entry_get_value (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_key (_tmp12_);
			_tmp14_ = _tmp13_;
			if (g_signal_handler_is_connected ((GObject*) _tmp11_, (gulong) ((guintptr) _tmp14_))) {
				GeeMapEntry* _tmp15_;
				gconstpointer _tmp16_;
				gconstpointer _tmp17_;
				GeeMapEntry* _tmp18_;
				gconstpointer _tmp19_;
				gconstpointer _tmp20_;
				_tmp15_ = entry;
				_tmp16_ = gee_map_entry_get_value (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp18_ = entry;
				_tmp19_ = gee_map_entry_get_key (_tmp18_);
				_tmp20_ = _tmp19_;
				g_signal_handler_disconnect ((GObject*) _tmp17_, (gulong) ((guintptr) _tmp20_));
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp21_ = self->priv->signals_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp21_);
}

static void
__widgets_context_menu_menu_item___lambda140__gtk_widget_destroy (GtkWidget* _sender,
                                                                  gpointer self)
{
	_widgets_context_menu_menu_item___lambda140_ ((WidgetsContextMenuMenuItem*) self);
}

static GObject *
widgets_context_menu_menu_item_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsContextMenuMenuItem * self;
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkWidget* _tmp2_;
	GtkRevealer* _tmp3_ = NULL;
	GtkLabel* _tmp4_ = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	GtkLabel* _tmp8_ = NULL;
	GtkLabel* _tmp9_;
	GtkWidget* _tmp10_;
	GtkRevealer* _tmp11_ = NULL;
	GtkImage* _tmp12_;
	GtkRevealer* _tmp13_ = NULL;
	GtkImage* _tmp14_ = NULL;
	GtkRevealer* _tmp15_ = NULL;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar** _tmp18_;
	GtkLabel* _tmp19_ = NULL;
	GtkLabel* _tmp20_;
	GtkWidget* _tmp21_;
	GtkRevealer* _tmp22_ = NULL;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar** _tmp25_;
	GtkLabel* _tmp26_ = NULL;
	GtkLabel* _tmp27_;
	GtkWidget* _tmp28_;
	GtkRevealer* _tmp29_ = NULL;
	gchar* _tmp30_;
	gchar** _tmp31_;
	AdwSpinner* _tmp32_ = NULL;
	GtkRevealer* _tmp33_ = NULL;
	GtkBox* end_box = NULL;
	GtkBox* _tmp34_ = NULL;
	GtkBox* _tmp35_;
	GtkRevealer* _tmp36_;
	GtkBox* _tmp37_;
	GtkRevealer* _tmp38_;
	GtkBox* _tmp39_;
	GtkRevealer* _tmp40_;
	GtkBox* _tmp41_;
	GtkRevealer* _tmp42_;
	GtkBox* _tmp43_;
	GtkRevealer* _tmp44_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp45_ = NULL;
	GtkBox* title_box = NULL;
	GtkBox* _tmp46_ = NULL;
	GtkBox* _tmp47_;
	GtkLabel* _tmp48_;
	GtkBox* _tmp49_;
	GtkRevealer* _tmp50_;
	GtkBox* _tmp51_;
	GtkRevealer* _tmp52_;
	GtkBox* _tmp53_;
	GtkBox* _tmp54_;
	GtkBox* _tmp55_;
	GtkBox* _tmp56_;
	GtkBox* _tmp57_;
	GeeHashMap* _tmp58_;
	gulong _tmp59_;
	parent_class = G_OBJECT_CLASS (widgets_context_menu_menu_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, WidgetsContextMenuMenuItem);
	gtk_widget_add_css_class ((GtkWidget*) self, "flat");
	gtk_widget_add_css_class ((GtkWidget*) self, "no-font-bold");
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->menu_icon);
	self->priv->menu_icon = _tmp0_;
	_tmp1_ = self->priv->menu_icon;
	_tmp2_ = _g_object_ref0 ((GtkWidget*) _tmp1_);
	_tmp3_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp3_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	gtk_revealer_set_reveal_child (_tmp3_, TRUE);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->menu_icon_revealer);
	self->priv->menu_icon_revealer = _tmp3_;
	_tmp4_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_label_set_use_markup (_tmp4_, TRUE);
	gtk_label_set_ellipsize (_tmp4_, PANGO_ELLIPSIZE_END);
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->menu_title);
	self->priv->menu_title = _tmp4_;
	_tmp5_ = g_strdup ("caption");
	_tmp6_ = g_strdup ("dimmed");
	_tmp7_ = g_new0 (gchar*, 2 + 1);
	_tmp7_[0] = _tmp5_;
	_tmp7_[1] = _tmp6_;
	_tmp8_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp8_, _tmp7_);
	_tmp7_ = (_vala_array_free (_tmp7_, 2, (GDestroyNotify) g_free), NULL);
	gtk_label_set_ellipsize (_tmp8_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp8_, (gfloat) 0);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->subtitle_label);
	self->priv->subtitle_label = _tmp8_;
	_tmp9_ = self->priv->subtitle_label;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp11_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_child (_tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->subtitle_revealer);
	self->priv->subtitle_revealer = _tmp11_;
	_tmp12_ = (GtkImage*) gtk_image_new_from_icon_name ("object-select-symbolic");
	g_object_ref_sink (_tmp12_);
	_tmp13_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp13_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp13_, (GtkWidget*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->select_revealer);
	self->priv->select_revealer = _tmp13_;
	_tmp14_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
	gtk_widget_set_margin_start ((GtkWidget*) _tmp14_, 6);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp15_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp15_, (GtkWidget*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->arrow_revealer);
	self->priv->arrow_revealer = _tmp15_;
	_tmp16_ = g_strdup ("dimmed");
	_tmp17_ = g_strdup ("no-font-bold");
	_tmp18_ = g_new0 (gchar*, 2 + 1);
	_tmp18_[0] = _tmp16_;
	_tmp18_[1] = _tmp17_;
	_tmp19_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp19_, _tmp18_);
	_tmp18_ = (_vala_array_free (_tmp18_, 2, (GDestroyNotify) g_free), NULL);
	gtk_label_set_ellipsize (_tmp19_, PANGO_ELLIPSIZE_MIDDLE);
	gtk_label_set_max_width_chars (_tmp19_, 12);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->secondary_label);
	self->priv->secondary_label = _tmp19_;
	_tmp20_ = self->priv->secondary_label;
	_tmp21_ = _g_object_ref0 ((GtkWidget*) _tmp20_);
	_tmp22_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp22_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp22_, _tmp21_);
	_g_object_unref0 (_tmp21_);
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->secondary_label_revealer);
	self->priv->secondary_label_revealer = _tmp22_;
	_tmp23_ = g_strdup ("caption");
	_tmp24_ = g_strdup ("border-outline");
	_tmp25_ = g_new0 (gchar*, 2 + 1);
	_tmp25_[0] = _tmp23_;
	_tmp25_[1] = _tmp24_;
	_tmp26_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp26_, _tmp25_);
	_tmp25_ = (_vala_array_free (_tmp25_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp26_, 6);
	g_object_ref_sink (_tmp26_);
	_g_object_unref0 (self->priv->badge_label);
	self->priv->badge_label = _tmp26_;
	_tmp27_ = self->priv->badge_label;
	_tmp28_ = _g_object_ref0 ((GtkWidget*) _tmp27_);
	_tmp29_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp29_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp29_, _tmp28_);
	_g_object_unref0 (_tmp28_);
	g_object_ref_sink (_tmp29_);
	_g_object_unref0 (self->priv->badge_revealer);
	self->priv->badge_revealer = _tmp29_;
	_tmp30_ = g_strdup ("submit-spinner");
	_tmp31_ = g_new0 (gchar*, 1 + 1);
	_tmp31_[0] = _tmp30_;
	_tmp32_ = (AdwSpinner*) adw_spinner_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp32_, _tmp31_);
	_tmp31_ = (_vala_array_free (_tmp31_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp32_);
	_tmp33_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp33_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	gtk_revealer_set_child (_tmp33_, (GtkWidget*) _tmp32_);
	_g_object_unref0 (_tmp32_);
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->loading_revealer);
	self->priv->loading_revealer = _tmp33_;
	_tmp34_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp34_, TRUE);
	gtk_widget_set_halign ((GtkWidget*) _tmp34_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp34_);
	end_box = _tmp34_;
	_tmp35_ = end_box;
	_tmp36_ = self->priv->secondary_label_revealer;
	gtk_box_append (_tmp35_, (GtkWidget*) _tmp36_);
	_tmp37_ = end_box;
	_tmp38_ = self->priv->badge_revealer;
	gtk_box_append (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = end_box;
	_tmp40_ = self->priv->loading_revealer;
	gtk_box_append (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = end_box;
	_tmp42_ = self->priv->select_revealer;
	gtk_box_append (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = end_box;
	_tmp44_ = self->priv->arrow_revealer;
	gtk_box_append (_tmp43_, (GtkWidget*) _tmp44_);
	_tmp45_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp45_, TRUE);
	g_object_ref_sink (_tmp45_);
	content_box = _tmp45_;
	_tmp46_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp46_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp46_);
	title_box = _tmp46_;
	_tmp47_ = title_box;
	_tmp48_ = self->priv->menu_title;
	gtk_box_append (_tmp47_, (GtkWidget*) _tmp48_);
	_tmp49_ = title_box;
	_tmp50_ = self->priv->subtitle_revealer;
	gtk_box_append (_tmp49_, (GtkWidget*) _tmp50_);
	_tmp51_ = content_box;
	_tmp52_ = self->priv->menu_icon_revealer;
	gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = content_box;
	_tmp54_ = title_box;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = content_box;
	_tmp56_ = end_box;
	gtk_box_append (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = content_box;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp57_);
	_tmp58_ = self->priv->signals_map;
	_tmp59_ = g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) __widgets_context_menu_menu_item___lambda139__gtk_button_clicked, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp58_, (gpointer) ((guintptr) _tmp59_), (GObject*) self);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) __widgets_context_menu_menu_item___lambda140__gtk_widget_destroy, self, 0);
	_g_object_unref0 (title_box);
	_g_object_unref0 (content_box);
	_g_object_unref0 (end_box);
	return obj;
}

static void
widgets_context_menu_menu_item_class_init (WidgetsContextMenuMenuItemClass * klass,
                                           gpointer klass_data)
{
	widgets_context_menu_menu_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsContextMenuMenuItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_context_menu_menu_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_context_menu_menu_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_context_menu_menu_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_context_menu_menu_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_TITLE_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY] = g_param_spec_boolean ("autohide-popover", "autohide-popover", "autohide-popover", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY] = g_param_spec_string ("icon", "icon", "icon", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_SECONDARY_TEXT_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SECONDARY_TEXT_PROPERTY] = g_param_spec_string ("secondary-text", "secondary-text", "secondary-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_SUBTITLE_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SUBTITLE_PROPERTY] = g_param_spec_string ("subtitle", "subtitle", "subtitle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_BADGE_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_BADGE_PROPERTY] = g_param_spec_string ("badge", "badge", "badge", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY] = g_param_spec_boolean ("is-loading", "is-loading", "is-loading", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY] = g_param_spec_boolean ("selected", "selected", "selected", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY] = g_param_spec_boolean ("arrow", "arrow", "arrow", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CONTEXT_MENU_MENU_ITEM_MAX_WIDTH_CHARS_PROPERTY, widgets_context_menu_menu_item_properties[WIDGETS_CONTEXT_MENU_MENU_ITEM_MAX_WIDTH_CHARS_PROPERTY] = g_param_spec_int ("max-width-chars", "max-width-chars", "max-width-chars", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	widgets_context_menu_menu_item_signals[WIDGETS_CONTEXT_MENU_MENU_ITEM_ACTIVATE_ITEM_SIGNAL] = g_signal_new ("activate-item", WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_context_menu_menu_item_instance_init (WidgetsContextMenuMenuItem * self,
                                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = widgets_context_menu_menu_item_get_instance_private (self);
	self->priv->_autohide_popover = TRUE;
	self->priv->_is_loading = FALSE;
	self->priv->_selected = FALSE;
	self->priv->_arrow = FALSE;
	_tmp0_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signals_map = _tmp0_;
}

static void
widgets_context_menu_menu_item_finalize (GObject * obj)
{
	WidgetsContextMenuMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, WidgetsContextMenuMenuItem);
	_g_object_unref0 (self->priv->menu_icon);
	_g_object_unref0 (self->priv->menu_icon_revealer);
	_g_object_unref0 (self->priv->menu_title);
	_g_object_unref0 (self->priv->subtitle_label);
	_g_object_unref0 (self->priv->subtitle_revealer);
	_g_object_unref0 (self->priv->secondary_label);
	_g_object_unref0 (self->priv->badge_label);
	_g_object_unref0 (self->priv->loading_revealer);
	_g_object_unref0 (self->priv->secondary_label_revealer);
	_g_object_unref0 (self->priv->badge_revealer);
	_g_object_unref0 (self->priv->select_revealer);
	_g_object_unref0 (self->priv->arrow_revealer);
	_g_free0 (self->priv->_icon);
	_g_object_unref0 (self->priv->signals_map);
	G_OBJECT_CLASS (widgets_context_menu_menu_item_parent_class)->finalize (obj);
}

static GType
widgets_context_menu_menu_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsContextMenuMenuItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_context_menu_menu_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsContextMenuMenuItem), 0, (GInstanceInitFunc) widgets_context_menu_menu_item_instance_init, NULL };
	GType widgets_context_menu_menu_item_type_id;
	widgets_context_menu_menu_item_type_id = g_type_register_static (gtk_button_get_type (), "WidgetsContextMenuMenuItem", &g_define_type_info, 0);
	WidgetsContextMenuMenuItem_private_offset = g_type_add_instance_private (widgets_context_menu_menu_item_type_id, sizeof (WidgetsContextMenuMenuItemPrivate));
	return widgets_context_menu_menu_item_type_id;
}

GType
widgets_context_menu_menu_item_get_type (void)
{
	static volatile gsize widgets_context_menu_menu_item_type_id__once = 0;
	if (g_once_init_enter (&widgets_context_menu_menu_item_type_id__once)) {
		GType widgets_context_menu_menu_item_type_id;
		widgets_context_menu_menu_item_type_id = widgets_context_menu_menu_item_get_type_once ();
		g_once_init_leave (&widgets_context_menu_menu_item_type_id__once, widgets_context_menu_menu_item_type_id);
	}
	return widgets_context_menu_menu_item_type_id__once;
}

static void
_vala_widgets_context_menu_menu_item_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	WidgetsContextMenuMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, WidgetsContextMenuMenuItem);
	switch (property_id) {
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY:
		g_value_set_boolean (value, widgets_context_menu_menu_item_get_autohide_popover (self));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY:
		g_value_set_string (value, widgets_context_menu_menu_item_get_icon (self));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY:
		g_value_set_boolean (value, widgets_context_menu_menu_item_get_is_loading (self));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY:
		g_value_set_boolean (value, widgets_context_menu_menu_item_get_selected (self));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY:
		g_value_set_boolean (value, widgets_context_menu_menu_item_get_arrow (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_context_menu_menu_item_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	WidgetsContextMenuMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CONTEXT_MENU_TYPE_MENU_ITEM, WidgetsContextMenuMenuItem);
	switch (property_id) {
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_TITLE_PROPERTY:
		widgets_context_menu_menu_item_set_title (self, g_value_get_string (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_AUTOHIDE_POPOVER_PROPERTY:
		widgets_context_menu_menu_item_set_autohide_popover (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_ICON_PROPERTY:
		widgets_context_menu_menu_item_set_icon (self, g_value_get_string (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_SECONDARY_TEXT_PROPERTY:
		widgets_context_menu_menu_item_set_secondary_text (self, g_value_get_string (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_SUBTITLE_PROPERTY:
		widgets_context_menu_menu_item_set_subtitle (self, g_value_get_string (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_BADGE_PROPERTY:
		widgets_context_menu_menu_item_set_badge (self, g_value_get_string (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_IS_LOADING_PROPERTY:
		widgets_context_menu_menu_item_set_is_loading (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_SELECTED_PROPERTY:
		widgets_context_menu_menu_item_set_selected (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_ARROW_PROPERTY:
		widgets_context_menu_menu_item_set_arrow (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CONTEXT_MENU_MENU_ITEM_MAX_WIDTH_CHARS_PROPERTY:
		widgets_context_menu_menu_item_set_max_width_chars (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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;
}

