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

/*
* Copyright (c) 2025-2026 (https://github.com/phase1geo/Minder)
*
* 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.
*
* 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: Trevor Williams <phase1geo@gmail.com>
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <graphene-gobject.h>
#include <cairo-gobject.h>
#include <pango/pangocairo.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 TYPE_TAG_BOX (tag_box_get_type ())
#define TAG_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG_BOX, TagBox))
#define TAG_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG_BOX, TagBoxClass))
#define IS_TAG_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG_BOX))
#define IS_TAG_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG_BOX))
#define TAG_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG_BOX, TagBoxClass))

typedef struct _TagBox TagBox;
typedef struct _TagBoxClass TagBoxClass;
typedef struct _TagBoxPrivate TagBoxPrivate;

#define TYPE_TAG (tag_get_type ())
#define TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG, Tag))
#define TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG, TagClass))
#define IS_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG))
#define IS_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG))
#define TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG, TagClass))

typedef struct _Tag Tag;
typedef struct _TagClass TagClass;
enum  {
	TAG_BOX_0_PROPERTY,
	TAG_BOX_NAME_PROPERTY,
	TAG_BOX_ENABLE_SELECT_PROPERTY,
	TAG_BOX_ENABLE_VISIBLE_PROPERTY,
	TAG_BOX_NUM_PROPERTIES
};
static GParamSpec* tag_box_properties[TAG_BOX_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_TAG_EDITOR (tag_editor_get_type ())
#define TAG_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG_EDITOR, TagEditor))
#define TAG_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG_EDITOR, TagEditorClass))
#define IS_TAG_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG_EDITOR))
#define IS_TAG_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG_EDITOR))
#define TAG_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG_EDITOR, TagEditorClass))

typedef struct _TagEditor TagEditor;
typedef struct _TagEditorClass TagEditorClass;
typedef struct _Block73Data Block73Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	TAG_BOX_CHANGED_SIGNAL,
	TAG_BOX_SELECT_CHANGED_SIGNAL,
	TAG_BOX_VISIBLE_CHANGED_SIGNAL,
	TAG_BOX_NUM_SIGNALS
};
static guint tag_box_signals[TAG_BOX_NUM_SIGNALS] = {0};
typedef struct _TagEditorPrivate TagEditorPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;

#define TYPE_TAGS (tags_get_type ())
#define TAGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAGS, Tags))
#define TAGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAGS, TagsClass))
#define IS_TAGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAGS))
#define IS_TAGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAGS))
#define TAGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAGS, TagsClass))

typedef struct _Tags Tags;
typedef struct _TagsClass TagsClass;
enum  {
	TAG_EDITOR_0_PROPERTY,
	TAG_EDITOR_EDITABLE_PROPERTY,
	TAG_EDITOR_NUM_PROPERTIES
};
static GParamSpec* tag_editor_properties[TAG_EDITOR_NUM_PROPERTIES];
#define _tags_unref0(var) ((var == NULL) ? NULL : (var = (tags_unref (var), NULL)))
#define _g_rand_free0(var) ((var == NULL) ? NULL : (var = (g_rand_free (var), NULL)))
typedef struct _Block74Data Block74Data;
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
#define __vala_graphene_rect_t_free0(var) ((var == NULL) ? NULL : (var = (_vala_graphene_rect_t_free (var), NULL)))
enum  {
	TAG_EDITOR_TAG_CHANGED_SIGNAL,
	TAG_EDITOR_TAG_ADDED_SIGNAL,
	TAG_EDITOR_TAG_REMOVED_SIGNAL,
	TAG_EDITOR_SELECT_CHANGED_SIGNAL,
	TAG_EDITOR_VISIBLE_CHANGED_SIGNAL,
	TAG_EDITOR_UPDATE_ICONS_SIGNAL,
	TAG_EDITOR_ESCAPED_SIGNAL,
	TAG_EDITOR_NUM_SIGNALS
};
static guint tag_editor_signals[TAG_EDITOR_NUM_SIGNALS] = {0};

struct _TagBox {
	GtkBox parent_instance;
	TagBoxPrivate * priv;
};

struct _TagBoxClass {
	GtkBoxClass parent_class;
};

struct _TagBoxPrivate {
	Tag* _tag;
	GtkLabel* _name_lbl;
	guint _timeout_id;
	gboolean _visible;
	gboolean _enable_select;
	gboolean _enable_visible;
};

struct _Block73Data {
	int _ref_count_;
	TagBox* self;
	GtkColorDialogButton* color;
	GtkEntry* name_entry;
	GtkStack* name_stack;
	GtkCheckButton* selected;
	GtkButton* visible_btn;
	Tag* tag;
};

struct _TagEditor {
	GtkBox parent_instance;
	TagEditorPrivate * priv;
};

struct _TagEditorClass {
	GtkBoxClass parent_class;
};

struct _TagEditorPrivate {
	MainWindow* _win;
	Tags* _tags;
	GtkSearchEntry* _entry;
	GtkListBox* _taglist;
	GtkButton* _new_label;
	gboolean _draggable;
	gboolean _selectable;
	gboolean _editable;
};

struct _Block74Data {
	int _ref_count_;
	TagEditor* self;
	Tag* tag;
};

static gint TagBox_private_offset;
static gpointer tag_box_parent_class = NULL;
static gint TagEditor_private_offset;
static gpointer tag_editor_parent_class = NULL;

VALA_EXTERN GType tag_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TagBox, g_object_unref)
VALA_EXTERN GType tag_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tag, g_object_unref)
VALA_EXTERN GType tag_editor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TagEditor, g_object_unref)
VALA_EXTERN TagBox* tag_box_new (TagEditor* editor,
                     Tag* tag);
VALA_EXTERN TagBox* tag_box_construct (GType object_type,
                           TagEditor* editor,
                           Tag* tag);
static Block73Data* block73_data_ref (Block73Data* _data73_);
static void block73_data_unref (void * _userdata_);
VALA_EXTERN void tag_get_color (Tag* self,
                    GdkRGBA * result);
static void __lambda51_ (Block73Data* _data73_);
VALA_EXTERN Tag* tag_copy (Tag* self);
VALA_EXTERN void tag_set_color (Tag* self,
                    GdkRGBA * value);
static void ___lambda51__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
VALA_EXTERN gboolean tag_box_get_enable_select (TagBox* self);
VALA_EXTERN const gchar* tag_get_name (Tag* self);
static void __lambda52_ (Block73Data* _data73_);
VALA_EXTERN void tag_set_name (Tag* self,
                   const gchar* value);
static void ___lambda52__gtk_entry_activate (GtkEntry* _sender,
                                      gpointer self);
static void __lambda53_ (Block73Data* _data73_);
static void ___lambda53__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                    gpointer self);
static gboolean __lambda54_ (Block73Data* _data73_,
                      guint keyval,
                      guint keymod,
                      GdkModifierType state);
static gboolean ___lambda54__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                            guint keyval,
                                                            guint keycode,
                                                            GdkModifierType state,
                                                            gpointer self);
static void __lambda55_ (Block73Data* _data73_,
                  gint n_press,
                  gdouble x,
                  gdouble y);
static void ___lambda55__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                             gint n_press,
                                             gdouble x,
                                             gdouble y,
                                             gpointer self);
static void __lambda56_ (Block73Data* _data73_);
VALA_EXTERN gboolean tag_box_get_enable_visible (TagBox* self);
VALA_EXTERN void tag_box_set_visible (TagBox* self,
                          gboolean visible);
static void ___lambda56__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda57_ (Block73Data* _data73_,
                  gint n_press,
                  gdouble x,
                  gdouble y);
static gboolean ___lambda58_ (Block73Data* _data73_);
static gboolean ____lambda58__gsource_func (gpointer self);
static void ___lambda57__gtk_gesture_click_released (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void __lambda59_ (Block73Data* _data73_,
                  gdouble x,
                  gdouble y);
static void ___lambda59__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                     gdouble x,
                                                     gdouble y,
                                                     gpointer self);
static void __lambda60_ (Block73Data* _data73_);
static void ___lambda60__gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                     gpointer self);
static void __lambda61_ (Block73Data* _data73_);
VALA_EXTERN gboolean utils_use_dark_mode (GtkWidget* w);
static void ___lambda61__tag_editor_update_icons (TagEditor* _sender,
                                           gpointer self);
VALA_EXTERN void tag_box_set_selected (TagBox* self,
                           gboolean select);
VALA_EXTERN GtkWidget* utils_get_child_at_index (GtkWidget* parent,
                                     gint index);
VALA_EXTERN GtkLabel* tag_box_get_name (TagBox* self);
VALA_EXTERN void tag_box_set_enable_select (TagBox* self,
                                gboolean value);
VALA_EXTERN void tag_box_set_enable_visible (TagBox* self,
                                 gboolean value);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static void tag_box_finalize (GObject * obj);
static GType tag_box_get_type_once (void);
static void _vala_tag_box_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec);
static void _vala_tag_box_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec);
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN gpointer tags_ref (gpointer instance);
VALA_EXTERN void tags_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_tags (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags);
VALA_EXTERN void value_set_tags (GValue* value,
                     gpointer v_object);
VALA_EXTERN void value_take_tags (GValue* value,
                      gpointer v_object);
VALA_EXTERN gpointer value_get_tags (const GValue* value);
VALA_EXTERN GType tags_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tags, tags_unref)
VALA_EXTERN TagEditor* tag_editor_new (MainWindow* win,
                           gboolean draggable);
VALA_EXTERN TagEditor* tag_editor_construct (GType object_type,
                                 MainWindow* win,
                                 gboolean draggable);
static void tag_editor_search_tags (TagEditor* self);
static void _tag_editor_search_tags_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                              gpointer self);
static void __lambda50_ (TagEditor* self);
static void tag_editor_add_new_tag (TagEditor* self,
                             const gchar* name);
static void ___lambda50__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                             gpointer self);
static gboolean __lambda63_ (TagEditor* self,
                      guint keyval,
                      guint keycode,
                      GdkModifierType state);
static gboolean ___lambda63__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                            guint keyval,
                                                            guint keycode,
                                                            GdkModifierType state,
                                                            gpointer self);
static gboolean __lambda64_ (TagEditor* self,
                      guint keyval,
                      guint keycode,
                      GdkModifierType state);
static void tag_editor_remove_tag (TagEditor* self,
                            GtkListBoxRow* row);
static gboolean ___lambda64__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                            guint keyval,
                                                            guint keycode,
                                                            GdkModifierType state,
                                                            gpointer self);
static void __lambda65_ (TagEditor* self);
static void ___lambda65__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void tag_editor_handle_tag_change (TagEditor* self,
                                   Tag* tag,
                                   Tag* orig_tag);
static void tag_editor_handle_select_change (TagEditor* self,
                                      Tag* tag,
                                      gboolean selected);
static void tag_editor_handle_visible_change (TagEditor* self,
                                       Tag* tag,
                                       gboolean visible);
static TagBox* tag_editor_get_tagbox (TagEditor* self,
                               GtkListBoxRow* row);
VALA_EXTERN gint tags_size (Tags* self);
VALA_EXTERN Tag* tags_get_tag (Tags* self,
                   gint index);
VALA_EXTERN void utils_color_from_string (const gchar* value,
                              GdkRGBA* result);
VALA_EXTERN Tag* tag_new (const gchar* name,
              GdkRGBA* color);
VALA_EXTERN Tag* tag_construct (GType object_type,
                    const gchar* name,
                    GdkRGBA* color);
VALA_EXTERN gboolean tags_add_tag (Tags* self,
                       Tag* tag,
                       gint index);
static void tag_editor_add_tag (TagEditor* self,
                         Tag* tag,
                         gint pos);
static Block74Data* block74_data_ref (Block74Data* _data74_);
static void block74_data_unref (void * _userdata_);
static void _tag_editor_handle_tag_change_tag_box_changed (TagBox* _sender,
                                                    Tag* tag,
                                                    Tag* orig_tag,
                                                    gpointer self);
static void _tag_editor_handle_select_change_tag_box_select_changed (TagBox* _sender,
                                                              Tag* tag,
                                                              gboolean select,
                                                              gpointer self);
static void _tag_editor_handle_visible_change_tag_box_visible_changed (TagBox* _sender,
                                                                Tag* tag,
                                                                gboolean visible,
                                                                gpointer self);
static GdkPaintable* tag_editor_create_icon (TagEditor* self,
                                      GtkLabel* label);
static GdkContentProvider* ___lambda62_ (Block74Data* _data74_,
                                  gdouble x,
                                  gdouble y);
static GdkContentProvider* ____lambda62__gtk_drag_source_prepare (GtkDragSource* _sender,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
VALA_EXTERN void utils_set_context_color_with_alpha (cairo_t* ctx,
                                         GdkRGBA* color,
                                         gdouble alpha);
static void _vala_graphene_rect_t_free (graphene_rect_t* self);
VALA_EXTERN gboolean tags_remove_tag (Tags* self,
                          gint index);
VALA_EXTERN void tag_editor_set_tags (TagEditor* self,
                          Tags* tags);
VALA_EXTERN void tag_editor_show_selected_tags (TagEditor* self,
                                    Tags* tags);
VALA_EXTERN gboolean tags_contains_tag (Tags* self,
                            Tag* tag);
VALA_EXTERN void tag_editor_clear_visible (TagEditor* self);
static gboolean tag_editor_real_grab_focus (GtkWidget* base);
VALA_EXTERN gboolean tag_editor_get_editable (TagEditor* self);
VALA_EXTERN void tag_editor_set_editable (TagEditor* self,
                              gboolean value);
static void g_cclosure_user_marshal_VOID__OBJECT_INT (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data);
static void tag_editor_finalize (GObject * obj);
static GType tag_editor_get_type_once (void);
static void _vala_tag_editor_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec);
static void _vala_tag_editor_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
tag_box_get_instance_private (TagBox* self)
{
	return G_STRUCT_MEMBER_P (self, TagBox_private_offset);
}

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

static Block73Data*
block73_data_ref (Block73Data* _data73_)
{
	g_atomic_int_inc (&_data73_->_ref_count_);
	return _data73_;
}

static void
block73_data_unref (void * _userdata_)
{
	Block73Data* _data73_;
	_data73_ = (Block73Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data73_->_ref_count_)) {
		TagBox* self;
		self = _data73_->self;
		_g_object_unref0 (_data73_->visible_btn);
		_g_object_unref0 (_data73_->selected);
		_g_object_unref0 (_data73_->name_stack);
		_g_object_unref0 (_data73_->name_entry);
		_g_object_unref0 (_data73_->color);
		_g_object_unref0 (_data73_->tag);
		_g_object_unref0 (self);
		g_slice_free (Block73Data, _data73_);
	}
}

static void
__lambda51_ (Block73Data* _data73_)
{
	TagBox* self;
	Tag* orig_tag = NULL;
	Tag* _tmp0_;
	GtkColorDialogButton* _tmp1_;
	GdkRGBA _tmp2_;
	self = _data73_->self;
	_tmp0_ = tag_copy (_data73_->tag);
	orig_tag = _tmp0_;
	_tmp1_ = _data73_->color;
	_tmp2_ = *gtk_color_dialog_button_get_rgba (_tmp1_);
	tag_set_color (_data73_->tag, &_tmp2_);
	g_signal_emit (self, tag_box_signals[TAG_BOX_CHANGED_SIGNAL], 0, _data73_->tag, orig_tag);
	_g_object_unref0 (orig_tag);
}

static void
___lambda51__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda51_ (self);
}

static void
__lambda52_ (Block73Data* _data73_)
{
	TagBox* self;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	Tag* orig_tag = NULL;
	Tag* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	self = _data73_->self;
	_tmp0_ = self->priv->_name_lbl;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _data73_->name_entry);
	_tmp2_ = _tmp1_;
	gtk_label_set_label (_tmp0_, _tmp2_);
	gtk_stack_set_visible_child_name (_data73_->name_stack, "label");
	_tmp3_ = tag_copy (_data73_->tag);
	orig_tag = _tmp3_;
	_tmp4_ = gtk_editable_get_text ((GtkEditable*) _data73_->name_entry);
	_tmp5_ = _tmp4_;
	tag_set_name (_data73_->tag, _tmp5_);
	g_signal_emit (self, tag_box_signals[TAG_BOX_CHANGED_SIGNAL], 0, _data73_->tag, orig_tag);
	_g_object_unref0 (orig_tag);
}

static void
___lambda52__gtk_entry_activate (GtkEntry* _sender,
                                 gpointer self)
{
	__lambda52_ (self);
}

static void
__lambda53_ (Block73Data* _data73_)
{
	TagBox* self;
	self = _data73_->self;
	gtk_stack_set_visible_child_name (_data73_->name_stack, "label");
}

static void
___lambda53__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                               gpointer self)
{
	__lambda53_ (self);
}

static gboolean
__lambda54_ (Block73Data* _data73_,
             guint keyval,
             guint keymod,
             GdkModifierType state)
{
	TagBox* self;
	gboolean result;
	self = _data73_->self;
	if (keyval == GDK_KEY_Escape) {
		gtk_stack_set_visible_child_name (_data73_->name_stack, "label");
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda54__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                   guint keyval,
                                                   guint keycode,
                                                   GdkModifierType state,
                                                   gpointer self)
{
	gboolean result;
	result = __lambda54_ (self, keyval, keycode, state);
	return result;
}

static void
__lambda55_ (Block73Data* _data73_,
             gint n_press,
             gdouble x,
             gdouble y)
{
	TagBox* self;
	self = _data73_->self;
	if (n_press == 2) {
		GtkLabel* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		if (self->priv->_timeout_id != ((guint) 0)) {
			g_source_remove (self->priv->_timeout_id);
			self->priv->_timeout_id = (guint) 0;
		}
		_tmp0_ = self->priv->_name_lbl;
		_tmp1_ = gtk_label_get_label (_tmp0_);
		_tmp2_ = _tmp1_;
		gtk_editable_set_text ((GtkEditable*) _data73_->name_entry, _tmp2_);
		gtk_widget_grab_focus ((GtkWidget*) _data73_->name_entry);
		gtk_stack_set_visible_child_name (_data73_->name_stack, "entry");
	}
}

static void
___lambda55__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                        gint n_press,
                                        gdouble x,
                                        gdouble y,
                                        gpointer self)
{
	__lambda55_ (self, n_press, x, y);
}

static void
__lambda56_ (Block73Data* _data73_)
{
	TagBox* self;
	gboolean _tmp0_;
	self = _data73_->self;
	_tmp0_ = self->priv->_enable_visible;
	if (_tmp0_) {
		tag_box_set_visible (self, !self->priv->_visible);
		g_signal_emit (self, tag_box_signals[TAG_BOX_VISIBLE_CHANGED_SIGNAL], 0, _data73_->tag, self->priv->_visible);
	}
}

static void
___lambda56__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda56_ (self);
}

static gboolean
___lambda58_ (Block73Data* _data73_)
{
	TagBox* self;
	gboolean select = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean result;
	self = _data73_->self;
	self->priv->_timeout_id = (guint) 0;
	_tmp0_ = gtk_widget_get_visible ((GtkWidget*) _data73_->selected);
	_tmp1_ = _tmp0_;
	select = !_tmp1_;
	gtk_widget_set_visible ((GtkWidget*) _data73_->selected, select);
	g_signal_emit (self, tag_box_signals[TAG_BOX_SELECT_CHANGED_SIGNAL], 0, _data73_->tag, select);
	result = FALSE;
	return result;
}

static gboolean
____lambda58__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda58_ (self);
	return result;
}

static void
__lambda57_ (Block73Data* _data73_,
             gint n_press,
             gdouble x,
             gdouble y)
{
	TagBox* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	self = _data73_->self;
	_tmp1_ = self->priv->_enable_select;
	if (_tmp1_) {
		_tmp0_ = n_press == 1;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkSettings* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = gtk_settings_get_default ();
		g_object_get (_tmp2_, "gtk-double-click-time", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		self->priv->_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) _tmp4_, ____lambda58__gsource_func, block73_data_ref (_data73_), block73_data_unref);
	}
}

static void
___lambda57__gtk_gesture_click_released (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda57_ (self, n_press, x, y);
}

static void
__lambda59_ (Block73Data* _data73_,
             gdouble x,
             gdouble y)
{
	TagBox* self;
	gboolean _tmp0_;
	self = _data73_->self;
	_tmp0_ = self->priv->_enable_visible;
	if (_tmp0_) {
		gtk_widget_set_visible ((GtkWidget*) _data73_->visible_btn, TRUE);
	}
}

static void
___lambda59__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                gdouble x,
                                                gdouble y,
                                                gpointer self)
{
	__lambda59_ (self, x, y);
}

static void
__lambda60_ (Block73Data* _data73_)
{
	TagBox* self;
	self = _data73_->self;
	if (!self->priv->_visible) {
		gtk_widget_set_visible ((GtkWidget*) _data73_->visible_btn, FALSE);
	}
}

static void
___lambda60__gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                gpointer self)
{
	__lambda60_ (self);
}

static void
__lambda61_ (Block73Data* _data73_)
{
	TagBox* self;
	const gchar* _tmp0_ = NULL;
	self = _data73_->self;
	if (utils_use_dark_mode ((GtkWidget*) _data73_->visible_btn)) {
		_tmp0_ = "minder-eye-dark-symbolic";
	} else {
		_tmp0_ = "minder-eye-light-symbolic";
	}
	gtk_button_set_icon_name (_data73_->visible_btn, _tmp0_);
}

static void
___lambda61__tag_editor_update_icons (TagEditor* _sender,
                                      gpointer self)
{
	__lambda61_ (self);
}

TagBox*
tag_box_construct (GType object_type,
                   TagEditor* editor,
                   Tag* tag)
{
	TagBox * self = NULL;
	Block73Data* _data73_;
	Tag* _tmp0_;
	Tag* _tmp1_;
	GtkColorDialog* dialog = NULL;
	GtkColorDialog* _tmp2_ = NULL;
	GtkColorDialog* _tmp3_;
	GtkColorDialog* _tmp4_;
	GdkRGBA _tmp5_ = {0};
	GdkRGBA _tmp6_;
	gchar* _tmp7_;
	GtkColorDialogButton* _tmp8_ = NULL;
	GtkColorDialogButton* _tmp9_;
	GtkColorDialog* _tmp10_;
	GtkColorDialog* _tmp11_;
	GtkColorDialogButton* _tmp12_;
	GtkColorDialogButton* _tmp13_;
	const gchar* _tmp14_ = NULL;
	gboolean _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	GtkLabel* _tmp19_ = NULL;
	GtkGestureClick* name_click = NULL;
	GtkGestureClick* _tmp20_;
	GtkLabel* _tmp21_;
	GtkEventController* _tmp22_;
	gchar* _tmp23_;
	GtkEntry* _tmp24_ = NULL;
	GtkStack* _tmp25_ = NULL;
	GtkLabel* _tmp26_;
	GtkEventControllerFocus* entry_focus = NULL;
	GtkEventControllerFocus* _tmp27_;
	GtkEventController* _tmp28_;
	GtkEventControllerKey* entry_key = NULL;
	GtkEventControllerKey* _tmp29_;
	GtkEventController* _tmp30_;
	GtkCheckButton* _tmp31_ = NULL;
	GtkBox* selected_box = NULL;
	GtkBox* _tmp32_ = NULL;
	GtkCheckButton* dummy = NULL;
	GtkCheckButton* _tmp33_;
	GtkStack* sel_stack = NULL;
	GtkStack* _tmp34_ = NULL;
	gchar* _tmp35_;
	GtkButton* _tmp36_ = NULL;
	GtkBox* visible_box = NULL;
	GtkBox* _tmp37_ = NULL;
	GtkButton* visible_hide = NULL;
	GtkButton* _tmp38_ = NULL;
	GtkStack* visible_stack = NULL;
	GtkStack* _tmp39_;
	GtkBox* box = NULL;
	GtkBox* _tmp40_ = NULL;
	GtkGestureClick* box_click = NULL;
	GtkGestureClick* _tmp41_;
	GtkEventController* _tmp42_;
	GtkEventControllerMotion* box_motion = NULL;
	GtkEventControllerMotion* _tmp43_;
	GtkEventController* _tmp44_;
	GtkColorDialogButton* _tmp45_;
	g_return_val_if_fail (editor != NULL, NULL);
	g_return_val_if_fail (tag != NULL, NULL);
	_data73_ = g_slice_new0 (Block73Data);
	_data73_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (tag);
	_g_object_unref0 (_data73_->tag);
	_data73_->tag = _tmp0_;
	self = (TagBox*) g_object_new (object_type, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 5, NULL);
	_data73_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (_data73_->tag);
	_g_object_unref0 (self->priv->_tag);
	self->priv->_tag = _tmp1_;
	_tmp2_ = gtk_color_dialog_new ();
	gtk_color_dialog_set_modal (_tmp2_, TRUE);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	tag_get_color (_data73_->tag, &_tmp5_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strdup (_ ("Click to change tag color"));
	_tmp8_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp4_);
	gtk_widget_set_halign ((GtkWidget*) _tmp8_, GTK_ALIGN_START);
	gtk_color_dialog_button_set_rgba (_tmp8_, &_tmp6_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp8_, _tmp7_);
	_g_free0 (_tmp7_);
	g_object_ref_sink (_tmp8_);
	_data73_->color = _tmp8_;
	_tmp9_ = _data73_->color;
	_tmp10_ = gtk_color_dialog_button_get_dialog (_tmp9_);
	_tmp11_ = _tmp10_;
	gtk_color_dialog_set_with_alpha (_tmp11_, FALSE);
	_tmp12_ = _data73_->color;
	gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "frameless");
	_tmp13_ = _data73_->color;
	g_signal_connect_data ((GObject*) _tmp13_, "notify::rgba", (GCallback) ___lambda51__g_object_notify, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp15_ = self->priv->_enable_select;
	if (_tmp15_) {
		_tmp14_ = _ ("Click to add/remove tag to selected node(s).  Click + Delete to remove" \
" node from tag list.  Double-click to rename tag.");
	} else {
		_tmp14_ = _ ("Click + Delete to remove node from tag list.  Double-click to rename t" \
"ag.");
	}
	_tmp16_ = tag_get_name (_data73_->tag);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strdup (_tmp14_);
	_tmp19_ = (GtkLabel*) gtk_label_new (_tmp17_);
	gtk_widget_set_halign ((GtkWidget*) _tmp19_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp19_, TRUE);
	gtk_label_set_ellipsize (_tmp19_, PANGO_ELLIPSIZE_END);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp19_, _tmp18_);
	_g_free0 (_tmp18_);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->_name_lbl);
	self->priv->_name_lbl = _tmp19_;
	_tmp20_ = (GtkGestureClick*) gtk_gesture_click_new ();
	name_click = _tmp20_;
	_tmp21_ = self->priv->_name_lbl;
	_tmp22_ = _g_object_ref0 ((GtkEventController*) name_click);
	gtk_widget_add_controller ((GtkWidget*) _tmp21_, _tmp22_);
	_tmp23_ = g_strdup (_ ("Enter tag name"));
	_tmp24_ = (GtkEntry*) gtk_entry_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp24_, GTK_ALIGN_FILL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp24_, TRUE);
	gtk_entry_set_placeholder_text (_tmp24_, _tmp23_);
	_g_free0 (_tmp23_);
	g_object_ref_sink (_tmp24_);
	_data73_->name_entry = _tmp24_;
	_tmp25_ = (GtkStack*) gtk_stack_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_FILL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp25_, TRUE);
	g_object_ref_sink (_tmp25_);
	_data73_->name_stack = _tmp25_;
	_tmp26_ = self->priv->_name_lbl;
	gtk_stack_add_named (_data73_->name_stack, (GtkWidget*) _tmp26_, "label");
	gtk_stack_add_named (_data73_->name_stack, (GtkWidget*) _data73_->name_entry, "entry");
	gtk_stack_set_visible_child_name (_data73_->name_stack, "label");
	g_signal_connect_data (_data73_->name_entry, "activate", (GCallback) ___lambda52__gtk_entry_activate, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp27_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	entry_focus = _tmp27_;
	_tmp28_ = _g_object_ref0 ((GtkEventController*) entry_focus);
	gtk_widget_add_controller ((GtkWidget*) _data73_->name_entry, _tmp28_);
	_tmp29_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	entry_key = _tmp29_;
	_tmp30_ = _g_object_ref0 ((GtkEventController*) entry_key);
	gtk_widget_add_controller ((GtkWidget*) _data73_->name_entry, _tmp30_);
	g_signal_connect_data (entry_focus, "leave", (GCallback) ___lambda53__gtk_event_controller_focus_leave, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	g_signal_connect_data (entry_key, "key-pressed", (GCallback) ___lambda54__gtk_event_controller_key_key_pressed, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp31_ = (GtkCheckButton*) gtk_check_button_new ();
	gtk_widget_set_sensitive ((GtkWidget*) _tmp31_, FALSE);
	gtk_widget_set_visible ((GtkWidget*) _tmp31_, FALSE);
	gtk_check_button_set_active (_tmp31_, TRUE);
	g_object_ref_sink (_tmp31_);
	_data73_->selected = _tmp31_;
	_tmp32_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_halign ((GtkWidget*) _tmp32_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp32_);
	selected_box = _tmp32_;
	gtk_box_append (selected_box, (GtkWidget*) _data73_->selected);
	_tmp33_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp33_);
	dummy = _tmp33_;
	_tmp34_ = (GtkStack*) gtk_stack_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp34_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp34_);
	sel_stack = _tmp34_;
	gtk_stack_add_named (sel_stack, (GtkWidget*) dummy, "dummy");
	gtk_stack_add_named (sel_stack, (GtkWidget*) selected_box, "selected");
	gtk_stack_set_visible_child_name (sel_stack, "selected");
	g_signal_connect_data (name_click, "pressed", (GCallback) ___lambda55__gtk_gesture_click_pressed, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp35_ = g_strdup (_ ("Click to add tag to highlight list"));
	_tmp36_ = (GtkButton*) gtk_button_new_from_icon_name ("minder-eye-light-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp36_, GTK_ALIGN_END);
	gtk_widget_set_visible ((GtkWidget*) _tmp36_, FALSE);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp36_, _tmp35_);
	_g_free0 (_tmp35_);
	g_object_ref_sink (_tmp36_);
	_data73_->visible_btn = _tmp36_;
	gtk_widget_add_css_class ((GtkWidget*) _data73_->visible_btn, "dim-icon");
	_tmp37_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_halign ((GtkWidget*) _tmp37_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp37_);
	visible_box = _tmp37_;
	gtk_box_append (visible_box, (GtkWidget*) _data73_->visible_btn);
	_tmp38_ = (GtkButton*) gtk_button_new_from_icon_name ("minder-eye-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp38_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp38_);
	visible_hide = _tmp38_;
	g_signal_connect_data (_data73_->visible_btn, "clicked", (GCallback) ___lambda56__gtk_button_clicked, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp39_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp39_);
	visible_stack = _tmp39_;
	gtk_stack_add_named (visible_stack, (GtkWidget*) visible_hide, "hidden");
	gtk_stack_add_named (visible_stack, (GtkWidget*) visible_box, "eye");
	gtk_stack_set_visible_child_name (visible_stack, "eye");
	_tmp40_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	gtk_widget_set_halign ((GtkWidget*) _tmp40_, GTK_ALIGN_FILL);
	gtk_widget_set_can_target ((GtkWidget*) _tmp40_, TRUE);
	gtk_widget_set_focusable ((GtkWidget*) _tmp40_, TRUE);
	g_object_ref_sink (_tmp40_);
	box = _tmp40_;
	gtk_box_append (box, (GtkWidget*) _data73_->name_stack);
	gtk_box_append (box, (GtkWidget*) sel_stack);
	gtk_box_append (box, (GtkWidget*) visible_stack);
	_tmp41_ = (GtkGestureClick*) gtk_gesture_click_new ();
	box_click = _tmp41_;
	_tmp42_ = _g_object_ref0 ((GtkEventController*) box_click);
	gtk_widget_add_controller ((GtkWidget*) box, _tmp42_);
	g_signal_connect_data (box_click, "released", (GCallback) ___lambda57__gtk_gesture_click_released, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp43_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ();
	box_motion = _tmp43_;
	_tmp44_ = _g_object_ref0 ((GtkEventController*) box_motion);
	gtk_widget_add_controller ((GtkWidget*) box, _tmp44_);
	g_signal_connect_data (box_motion, "enter", (GCallback) ___lambda59__gtk_event_controller_motion_enter, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	g_signal_connect_data (box_motion, "leave", (GCallback) ___lambda60__gtk_event_controller_motion_leave, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_tmp45_ = _data73_->color;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp45_);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) box);
	g_signal_connect_data (editor, "update-icons", (GCallback) ___lambda61__tag_editor_update_icons, block73_data_ref (_data73_), (GClosureNotify) block73_data_unref, 0);
	_g_object_unref0 (box_motion);
	_g_object_unref0 (box_click);
	_g_object_unref0 (box);
	_g_object_unref0 (visible_stack);
	_g_object_unref0 (visible_hide);
	_g_object_unref0 (visible_box);
	_g_object_unref0 (sel_stack);
	_g_object_unref0 (dummy);
	_g_object_unref0 (selected_box);
	_g_object_unref0 (entry_key);
	_g_object_unref0 (entry_focus);
	_g_object_unref0 (name_click);
	_g_object_unref0 (dialog);
	block73_data_unref (_data73_);
	_data73_ = NULL;
	return self;
}

TagBox*
tag_box_new (TagEditor* editor,
             Tag* tag)
{
	return tag_box_construct (TYPE_TAG_BOX, editor, tag);
}

void
tag_box_set_selected (TagBox* self,
                      gboolean select)
{
	GtkWidget* box = NULL;
	GtkWidget* _tmp0_;
	GtkStack* stack = NULL;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkStack* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = utils_get_child_at_index ((GtkWidget*) self, 1);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = utils_get_child_at_index (_tmp1_, 1);
	stack = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_stack_get_type (), GtkStack);
	_tmp3_ = stack;
	if (_tmp3_ != NULL) {
		GtkWidget* sel_box = NULL;
		GtkStack* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* selected = NULL;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		_tmp4_ = stack;
		_tmp5_ = gtk_stack_get_visible_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		sel_box = _tmp7_;
		_tmp8_ = sel_box;
		_tmp9_ = utils_get_child_at_index (_tmp8_, 0);
		selected = _tmp9_;
		_tmp10_ = selected;
		gtk_widget_set_visible (_tmp10_, select);
		_g_object_unref0 (selected);
		_g_object_unref0 (sel_box);
	}
	_g_object_unref0 (stack);
	_g_object_unref0 (box);
}

void
tag_box_set_visible (TagBox* self,
                     gboolean visible)
{
	GtkWidget* box = NULL;
	GtkWidget* _tmp0_;
	GtkStack* stack = NULL;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkStack* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = utils_get_child_at_index ((GtkWidget*) self, 1);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = utils_get_child_at_index (_tmp1_, 2);
	stack = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_stack_get_type (), GtkStack);
	_tmp3_ = stack;
	if (_tmp3_ != NULL) {
		GtkWidget* vis_box = NULL;
		GtkStack* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* vis_btn = NULL;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		const gchar* _tmp11_ = NULL;
		GtkWidget* _tmp12_;
		_tmp4_ = stack;
		_tmp5_ = gtk_stack_get_visible_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		vis_box = _tmp7_;
		_tmp8_ = vis_box;
		_tmp9_ = utils_get_child_at_index (_tmp8_, 0);
		vis_btn = _tmp9_;
		self->priv->_visible = visible;
		_tmp10_ = vis_btn;
		gtk_widget_set_visible (_tmp10_, visible);
		if (self->priv->_visible) {
			_tmp11_ = _ ("Click to remove tag from highlight");
		} else {
			_tmp11_ = _ ("Click to add tag to highlight list");
		}
		_tmp12_ = vis_btn;
		gtk_widget_set_tooltip_text (_tmp12_, _tmp11_);
		if (visible) {
			GtkWidget* _tmp13_;
			_tmp13_ = vis_btn;
			gtk_widget_remove_css_class (_tmp13_, "dim-icon");
		} else {
			GtkWidget* _tmp14_;
			_tmp14_ = vis_btn;
			gtk_widget_add_css_class (_tmp14_, "dim-icon");
		}
		_g_object_unref0 (vis_btn);
		_g_object_unref0 (vis_box);
	}
	_g_object_unref0 (stack);
	_g_object_unref0 (box);
}

GtkLabel*
tag_box_get_name (TagBox* self)
{
	GtkLabel* result;
	GtkLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name_lbl;
	result = _tmp0_;
	return result;
}

gboolean
tag_box_get_enable_select (TagBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_enable_select;
	return result;
}

void
tag_box_set_enable_select (TagBox* self,
                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tag_box_get_enable_select (self);
	if (old_value != value) {
		self->priv->_enable_select = value;
		g_object_notify_by_pspec ((GObject *) self, tag_box_properties[TAG_BOX_ENABLE_SELECT_PROPERTY]);
	}
}

gboolean
tag_box_get_enable_visible (TagBox* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_enable_visible;
	return result;
}

void
tag_box_set_enable_visible (TagBox* self,
                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tag_box_get_enable_visible (self);
	if (old_value != value) {
		self->priv->_enable_visible = value;
		g_object_notify_by_pspec ((GObject *) self, tag_box_properties[TAG_BOX_ENABLE_VISIBLE_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_BOOLEAN) (gpointer data1, gpointer arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}

static void
tag_box_class_init (TagBoxClass * klass,
                    gpointer klass_data)
{
	tag_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TagBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tag_box_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tag_box_set_property;
	G_OBJECT_CLASS (klass)->finalize = tag_box_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TAG_BOX_NAME_PROPERTY, tag_box_properties[TAG_BOX_NAME_PROPERTY] = g_param_spec_object ("name", "name", "name", gtk_label_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TAG_BOX_ENABLE_SELECT_PROPERTY, tag_box_properties[TAG_BOX_ENABLE_SELECT_PROPERTY] = g_param_spec_boolean ("enable-select", "enable-select", "enable-select", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TAG_BOX_ENABLE_VISIBLE_PROPERTY, tag_box_properties[TAG_BOX_ENABLE_VISIBLE_PROPERTY] = g_param_spec_boolean ("enable-visible", "enable-visible", "enable-visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tag_box_signals[TAG_BOX_CHANGED_SIGNAL] = g_signal_new ("changed", TYPE_TAG_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, TYPE_TAG, TYPE_TAG);
	tag_box_signals[TAG_BOX_SELECT_CHANGED_SIGNAL] = g_signal_new ("select-changed", TYPE_TAG_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, TYPE_TAG, G_TYPE_BOOLEAN);
	tag_box_signals[TAG_BOX_VISIBLE_CHANGED_SIGNAL] = g_signal_new ("visible-changed", TYPE_TAG_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, TYPE_TAG, G_TYPE_BOOLEAN);
}

static void
tag_box_instance_init (TagBox * self,
                       gpointer klass)
{
	self->priv = tag_box_get_instance_private (self);
	self->priv->_timeout_id = (guint) 0;
	self->priv->_visible = FALSE;
	self->priv->_enable_select = FALSE;
	self->priv->_enable_visible = FALSE;
}

static void
tag_box_finalize (GObject * obj)
{
	TagBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TAG_BOX, TagBox);
	_g_object_unref0 (self->priv->_tag);
	_g_object_unref0 (self->priv->_name_lbl);
	G_OBJECT_CLASS (tag_box_parent_class)->finalize (obj);
}

static GType
tag_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TagBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tag_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TagBox), 0, (GInstanceInitFunc) tag_box_instance_init, NULL };
	GType tag_box_type_id;
	tag_box_type_id = g_type_register_static (gtk_box_get_type (), "TagBox", &g_define_type_info, 0);
	TagBox_private_offset = g_type_add_instance_private (tag_box_type_id, sizeof (TagBoxPrivate));
	return tag_box_type_id;
}

GType
tag_box_get_type (void)
{
	static volatile gsize tag_box_type_id__once = 0;
	if (g_once_init_enter (&tag_box_type_id__once)) {
		GType tag_box_type_id;
		tag_box_type_id = tag_box_get_type_once ();
		g_once_init_leave (&tag_box_type_id__once, tag_box_type_id);
	}
	return tag_box_type_id__once;
}

static void
_vala_tag_box_get_property (GObject * object,
                            guint property_id,
                            GValue * value,
                            GParamSpec * pspec)
{
	TagBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TAG_BOX, TagBox);
	switch (property_id) {
		case TAG_BOX_NAME_PROPERTY:
		g_value_set_object (value, tag_box_get_name (self));
		break;
		case TAG_BOX_ENABLE_SELECT_PROPERTY:
		g_value_set_boolean (value, tag_box_get_enable_select (self));
		break;
		case TAG_BOX_ENABLE_VISIBLE_PROPERTY:
		g_value_set_boolean (value, tag_box_get_enable_visible (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tag_box_set_property (GObject * object,
                            guint property_id,
                            const GValue * value,
                            GParamSpec * pspec)
{
	TagBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TAG_BOX, TagBox);
	switch (property_id) {
		case TAG_BOX_ENABLE_SELECT_PROPERTY:
		tag_box_set_enable_select (self, g_value_get_boolean (value));
		break;
		case TAG_BOX_ENABLE_VISIBLE_PROPERTY:
		tag_box_set_enable_visible (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
tag_editor_get_instance_private (TagEditor* self)
{
	return G_STRUCT_MEMBER_P (self, TagEditor_private_offset);
}

static void
_tag_editor_search_tags_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                         gpointer self)
{
	tag_editor_search_tags ((TagEditor*) self);
}

static void
__lambda50_ (TagEditor* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkSearchEntry* _tmp3_;
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	tag_editor_add_new_tag (self, _tmp2_);
	_tmp3_ = self->priv->_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp3_, "");
}

static void
___lambda50__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                        gpointer self)
{
	__lambda50_ ((TagEditor*) self);
}

static gboolean
__lambda63_ (TagEditor* self,
             guint keyval,
             guint keycode,
             GdkModifierType state)
{
	gboolean result;
	if (keyval == GDK_KEY_Escape) {
		GtkSearchEntry* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = self->priv->_entry;
		_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
		_tmp2_ = _tmp1_;
		if (g_strcmp0 (_tmp2_, "") == 0) {
			g_signal_emit (self, tag_editor_signals[TAG_EDITOR_ESCAPED_SIGNAL], 0);
		} else {
			GtkSearchEntry* _tmp3_;
			_tmp3_ = self->priv->_entry;
			gtk_editable_set_text ((GtkEditable*) _tmp3_, "");
		}
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda63__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                   guint keyval,
                                                   guint keycode,
                                                   GdkModifierType state,
                                                   gpointer self)
{
	gboolean result;
	result = __lambda63_ ((TagEditor*) self, keyval, keycode, state);
	return result;
}

static gboolean
__lambda64_ (TagEditor* self,
             guint keyval,
             guint keycode,
             GdkModifierType state)
{
	GtkListBoxRow* current = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	GtkListBoxRow* _tmp3_;
	gboolean result;
	_tmp0_ = self->priv->_taglist;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	current = _tmp2_;
	_tmp3_ = current;
	if (_tmp3_ != NULL) {
		if (keyval == GDK_KEY_Delete) {
			GtkListBoxRow* _tmp4_;
			_tmp4_ = current;
			tag_editor_remove_tag (self, _tmp4_);
			result = TRUE;
			_g_object_unref0 (current);
			return result;
		}
	}
	result = FALSE;
	_g_object_unref0 (current);
	return result;
}

static gboolean
___lambda64__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                   guint keyval,
                                                   guint keycode,
                                                   GdkModifierType state,
                                                   gpointer self)
{
	gboolean result;
	result = __lambda64_ ((TagEditor*) self, keyval, keycode, state);
	return result;
}

static void
__lambda65_ (TagEditor* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkSearchEntry* _tmp3_;
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	tag_editor_add_new_tag (self, _tmp2_);
	_tmp3_ = self->priv->_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp3_, "");
}

static void
___lambda65__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda65_ ((TagEditor*) self);
}

TagEditor*
tag_editor_construct (GType object_type,
                      MainWindow* win,
                      gboolean draggable)
{
	TagEditor * self = NULL;
	MainWindow* _tmp0_;
	gchar* _tmp1_;
	GtkSearchEntry* _tmp2_ = NULL;
	GtkSearchEntry* _tmp3_;
	GtkSearchEntry* _tmp4_;
	GtkEventControllerKey* entry_key = NULL;
	GtkEventControllerKey* _tmp5_;
	GtkSearchEntry* _tmp6_;
	GtkEventController* _tmp7_;
	GtkListBox* _tmp8_ = NULL;
	GtkEventControllerKey* key = NULL;
	GtkEventControllerKey* _tmp9_;
	GtkListBox* _tmp10_;
	GtkEventController* _tmp11_;
	GtkScrolledWindow* sw = NULL;
	GtkListBox* _tmp12_;
	GtkWidget* _tmp13_;
	GtkScrolledWindow* _tmp14_ = NULL;
	GtkButton* _tmp15_ = NULL;
	GtkButton* _tmp16_;
	GtkSearchEntry* _tmp17_;
	g_return_val_if_fail (win != NULL, NULL);
	self = (TagEditor*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, NULL);
	_tmp0_ = _g_object_ref0 (win);
	_g_object_unref0 (self->priv->_win);
	self->priv->_win = _tmp0_;
	self->priv->_draggable = draggable;
	_tmp1_ = g_strdup (_ ("Enter name of tag to find or create"));
	_tmp2_ = (GtkSearchEntry*) gtk_search_entry_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_FILL);
	g_object_set (_tmp2_, "placeholder-text", _tmp1_, NULL);
	_g_free0 (_tmp1_);
	gtk_editable_set_width_chars ((GtkEditable*) _tmp2_, 30);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp2_, 5);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp2_, 5);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp2_, 5);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp2_, 5);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->_entry);
	self->priv->_entry = _tmp2_;
	_tmp3_ = self->priv->_entry;
	g_signal_connect_object (_tmp3_, "search-changed", (GCallback) _tag_editor_search_tags_gtk_search_entry_search_changed, self, 0);
	_tmp4_ = self->priv->_entry;
	g_signal_connect_object (_tmp4_, "activate", (GCallback) ___lambda50__gtk_search_entry_activate, self, 0);
	_tmp5_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	entry_key = _tmp5_;
	_tmp6_ = self->priv->_entry;
	_tmp7_ = _g_object_ref0 ((GtkEventController*) entry_key);
	gtk_widget_add_controller ((GtkWidget*) _tmp6_, _tmp7_);
	g_signal_connect_object (entry_key, "key-pressed", (GCallback) ___lambda63__gtk_event_controller_key_key_pressed, self, 0);
	_tmp8_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp8_, GTK_ALIGN_FILL);
	gtk_list_box_set_selection_mode (_tmp8_, GTK_SELECTION_SINGLE);
	gtk_list_box_set_show_separators (_tmp8_, TRUE);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->_taglist);
	self->priv->_taglist = _tmp8_;
	_tmp9_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key = _tmp9_;
	g_signal_connect_object (key, "key-pressed", (GCallback) ___lambda64__gtk_event_controller_key_key_pressed, self, 0);
	_tmp10_ = self->priv->_taglist;
	_tmp11_ = _g_object_ref0 ((GtkEventController*) key);
	gtk_widget_add_controller ((GtkWidget*) _tmp10_, _tmp11_);
	_tmp12_ = self->priv->_taglist;
	_tmp13_ = _g_object_ref0 ((GtkWidget*) _tmp12_);
	_tmp14_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp14_, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	g_object_set (_tmp14_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_FILL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp14_, 5);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp14_, 5);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp14_, 5);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp14_, TRUE);
	gtk_scrolled_window_set_child (_tmp14_, _tmp13_);
	_g_object_unref0 (_tmp13_);
	g_object_ref_sink (_tmp14_);
	sw = _tmp14_;
	_tmp15_ = (GtkButton*) gtk_button_new_with_label ("");
	gtk_button_set_has_frame (_tmp15_, FALSE);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->_new_label);
	self->priv->_new_label = _tmp15_;
	_tmp16_ = self->priv->_new_label;
	g_signal_connect_object (_tmp16_, "clicked", (GCallback) ___lambda65__gtk_button_clicked, self, 0);
	_tmp17_ = self->priv->_entry;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp17_);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) sw);
	_g_object_unref0 (sw);
	_g_object_unref0 (key);
	_g_object_unref0 (entry_key);
	return self;
}

TagEditor*
tag_editor_new (MainWindow* win,
                gboolean draggable)
{
	return tag_editor_construct (TYPE_TAG_EDITOR, win, draggable);
}

static void
tag_editor_handle_tag_change (TagEditor* self,
                              Tag* tag,
                              Tag* orig_tag)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	g_return_if_fail (orig_tag != NULL);
	g_signal_emit (self, tag_editor_signals[TAG_EDITOR_TAG_CHANGED_SIGNAL], 0, tag, orig_tag);
}

static void
tag_editor_handle_select_change (TagEditor* self,
                                 Tag* tag,
                                 gboolean selected)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	g_signal_emit (self, tag_editor_signals[TAG_EDITOR_SELECT_CHANGED_SIGNAL], 0, tag, selected);
}

static void
tag_editor_handle_visible_change (TagEditor* self,
                                  Tag* tag,
                                  gboolean visible)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	g_signal_emit (self, tag_editor_signals[TAG_EDITOR_VISIBLE_CHANGED_SIGNAL], 0, tag, visible);
}

static TagBox*
tag_editor_get_tagbox (TagEditor* self,
                       GtkListBoxRow* row)
{
	TagBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (row != NULL) {
		GtkWidget* child = NULL;
		GtkWidget* _tmp0_;
		GtkWidget* _tmp1_;
		GtkWidget* _tmp2_;
		_tmp0_ = gtk_list_box_row_get_child (row);
		_tmp1_ = _g_object_ref0 (_tmp0_);
		child = _tmp1_;
		_tmp2_ = child;
		if (_tmp2_ != NULL) {
			GtkWidget* _tmp3_;
			TagBox* _tmp4_;
			_tmp3_ = child;
			_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, TYPE_TAG_BOX, TagBox));
			result = _tmp4_;
			_g_object_unref0 (child);
			return result;
		}
		_g_object_unref0 (child);
	}
	result = NULL;
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
tag_editor_search_tags (TagEditor* self)
{
	gchar* text = NULL;
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GtkButton* _tmp19_;
	const gchar* _tmp20_;
	GtkButton* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	text = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				Tags* _tmp6_;
				Tag* tag = NULL;
				Tags* _tmp7_;
				Tag* _tmp8_;
				GtkListBoxRow* tagbox = NULL;
				GtkListBox* _tmp9_;
				GtkListBoxRow* _tmp10_;
				GtkListBoxRow* _tmp11_;
				gboolean _tmp12_ = FALSE;
				const gchar* _tmp13_;
				GtkListBoxRow* _tmp18_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = self->priv->_tags;
				if (!(i < tags_size (_tmp6_))) {
					break;
				}
				_tmp7_ = self->priv->_tags;
				_tmp8_ = tags_get_tag (_tmp7_, i);
				tag = _tmp8_;
				_tmp9_ = self->priv->_taglist;
				_tmp10_ = gtk_list_box_get_row_at_index (_tmp9_, i);
				_tmp11_ = _g_object_ref0 (_tmp10_);
				tagbox = _tmp11_;
				_tmp13_ = text;
				if (g_strcmp0 (_tmp13_, "") == 0) {
					_tmp12_ = TRUE;
				} else {
					Tag* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					_tmp14_ = tag;
					_tmp15_ = tag_get_name (_tmp14_);
					_tmp16_ = _tmp15_;
					_tmp17_ = text;
					_tmp12_ = string_contains (_tmp16_, _tmp17_);
				}
				_tmp18_ = tagbox;
				gtk_widget_set_visible ((GtkWidget*) _tmp18_, _tmp12_);
				_g_object_unref0 (tagbox);
				_g_object_unref0 (tag);
			}
		}
	}
	_tmp19_ = self->priv->_new_label;
	_tmp20_ = text;
	gtk_widget_set_visible ((GtkWidget*) _tmp19_, g_strcmp0 (_tmp20_, "") != 0);
	_tmp21_ = self->priv->_new_label;
	_tmp22_ = text;
	_tmp23_ = g_strdup_printf (_ ("Create '%s' tag"), _tmp22_);
	_tmp24_ = _tmp23_;
	gtk_button_set_label (_tmp21_, _tmp24_);
	_g_free0 (_tmp24_);
	_g_free0 (text);
}

static void
tag_editor_add_new_tag (TagEditor* self,
                        const gchar* name)
{
	GRand* rand = NULL;
	GRand* _tmp0_;
	gint32 red = 0;
	GRand* _tmp1_;
	gint32 green = 0;
	GRand* _tmp2_;
	gint32 blue = 0;
	GRand* _tmp3_;
	GdkRGBA color = {0};
	gchar* _tmp4_;
	gchar* _tmp5_;
	GdkRGBA _tmp6_ = {0};
	GdkRGBA _tmp7_;
	Tag* tag = NULL;
	GdkRGBA _tmp8_;
	Tag* _tmp9_;
	Tags* _tmp10_;
	Tag* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = g_rand_new ();
	rand = _tmp0_;
	_tmp1_ = rand;
	red = g_rand_int_range (_tmp1_, (gint32) 0, (gint32) 255);
	_tmp2_ = rand;
	green = g_rand_int_range (_tmp2_, (gint32) 0, (gint32) 255);
	_tmp3_ = rand;
	blue = g_rand_int_range (_tmp3_, (gint32) 0, (gint32) 255);
	_tmp4_ = g_strdup_printf ("#%02x%02x%02x", (guint) red, (guint) green, (guint) blue);
	_tmp5_ = _tmp4_;
	utils_color_from_string (_tmp5_, &_tmp6_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	color = _tmp7_;
	_tmp8_ = color;
	_tmp9_ = tag_new (name, &_tmp8_);
	tag = _tmp9_;
	_tmp10_ = self->priv->_tags;
	_tmp11_ = tag;
	if (tags_add_tag (_tmp10_, _tmp11_, -1)) {
		Tag* _tmp12_;
		Tags* _tmp13_;
		Tag* _tmp14_;
		_tmp12_ = tag;
		_tmp13_ = self->priv->_tags;
		tag_editor_add_tag (self, _tmp12_, tags_size (_tmp13_) - 1);
		_tmp14_ = tag;
		g_signal_emit (self, tag_editor_signals[TAG_EDITOR_TAG_ADDED_SIGNAL], 0, _tmp14_);
	}
	_g_object_unref0 (tag);
	_g_rand_free0 (rand);
}

static Block74Data*
block74_data_ref (Block74Data* _data74_)
{
	g_atomic_int_inc (&_data74_->_ref_count_);
	return _data74_;
}

static void
block74_data_unref (void * _userdata_)
{
	Block74Data* _data74_;
	_data74_ = (Block74Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data74_->_ref_count_)) {
		TagEditor* self;
		self = _data74_->self;
		_g_object_unref0 (_data74_->tag);
		_g_object_unref0 (self);
		g_slice_free (Block74Data, _data74_);
	}
}

static void
_tag_editor_handle_tag_change_tag_box_changed (TagBox* _sender,
                                               Tag* tag,
                                               Tag* orig_tag,
                                               gpointer self)
{
	tag_editor_handle_tag_change ((TagEditor*) self, tag, orig_tag);
}

static void
_tag_editor_handle_select_change_tag_box_select_changed (TagBox* _sender,
                                                         Tag* tag,
                                                         gboolean select,
                                                         gpointer self)
{
	tag_editor_handle_select_change ((TagEditor*) self, tag, select);
}

static void
_tag_editor_handle_visible_change_tag_box_visible_changed (TagBox* _sender,
                                                           Tag* tag,
                                                           gboolean visible,
                                                           gpointer self)
{
	tag_editor_handle_visible_change ((TagEditor*) self, tag, visible);
}

static GdkContentProvider*
___lambda62_ (Block74Data* _data74_,
              gdouble x,
              gdouble y)
{
	TagEditor* self;
	GValue val = {0};
	GValue _tmp0_ = {0};
	Tag* _tmp1_;
	Tag* _tmp2_;
	GdkContentProvider* provider = NULL;
	GValue _tmp3_;
	GdkContentProvider* _tmp4_;
	GdkContentProvider* result;
	self = _data74_->self;
	g_value_init (&_tmp0_, TYPE_TAG);
	val = _tmp0_;
	_tmp1_ = tag_copy (_data74_->tag);
	_tmp2_ = _tmp1_;
	g_value_set_object (&val, (GObject*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = val;
	_tmp4_ = gdk_content_provider_new_for_value (&_tmp3_);
	provider = _tmp4_;
	result = provider;
	G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
	return result;
}

static GdkContentProvider*
____lambda62__gtk_drag_source_prepare (GtkDragSource* _sender,
                                       gdouble x,
                                       gdouble y,
                                       gpointer self)
{
	GdkContentProvider* result;
	result = ___lambda62_ (self, x, y);
	return result;
}

static void
tag_editor_add_tag (TagEditor* self,
                    Tag* tag,
                    gint pos)
{
	Block74Data* _data74_;
	Tag* _tmp0_;
	TagBox* tagbox = NULL;
	TagBox* _tmp1_;
	TagBox* _tmp2_;
	TagBox* _tmp3_;
	TagBox* _tmp4_;
	GtkListBox* _tmp18_;
	TagBox* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	_data74_ = g_slice_new0 (Block74Data);
	_data74_->_ref_count_ = 1;
	_data74_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (tag);
	_g_object_unref0 (_data74_->tag);
	_data74_->tag = _tmp0_;
	_tmp1_ = tag_box_new (self, _data74_->tag);
	g_object_ref_sink (_tmp1_);
	tagbox = _tmp1_;
	_tmp2_ = tagbox;
	tag_box_set_enable_select (_tmp2_, self->priv->_selectable);
	_tmp3_ = tagbox;
	tag_box_set_enable_visible (_tmp3_, self->priv->_draggable);
	_tmp4_ = tagbox;
	g_signal_connect_object (_tmp4_, "changed", (GCallback) _tag_editor_handle_tag_change_tag_box_changed, self, 0);
	if (self->priv->_draggable) {
		TagBox* _tmp5_;
		TagBox* _tmp6_;
		GtkDragSource* drag = NULL;
		GtkDragSource* _tmp7_ = NULL;
		TagBox* _tmp8_;
		GtkDragSource* _tmp9_;
		GtkEventController* _tmp10_;
		GtkDragSource* _tmp11_;
		TagBox* _tmp12_;
		GtkLabel* _tmp13_;
		GtkLabel* _tmp14_;
		GdkPaintable* _tmp15_;
		GdkPaintable* _tmp16_;
		GtkDragSource* _tmp17_;
		_tmp5_ = tagbox;
		g_signal_connect_object (_tmp5_, "select-changed", (GCallback) _tag_editor_handle_select_change_tag_box_select_changed, self, 0);
		_tmp6_ = tagbox;
		g_signal_connect_object (_tmp6_, "visible-changed", (GCallback) _tag_editor_handle_visible_change_tag_box_visible_changed, self, 0);
		_tmp7_ = gtk_drag_source_new ();
		gtk_drag_source_set_actions (_tmp7_, GDK_ACTION_COPY);
		drag = _tmp7_;
		_tmp8_ = tagbox;
		_tmp9_ = drag;
		_tmp10_ = _g_object_ref0 ((GtkEventController*) _tmp9_);
		gtk_widget_add_controller ((GtkWidget*) _tmp8_, _tmp10_);
		_tmp11_ = drag;
		_tmp12_ = tagbox;
		_tmp13_ = tag_box_get_name (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = tag_editor_create_icon (self, _tmp14_);
		_tmp16_ = _tmp15_;
		gtk_drag_source_set_icon (_tmp11_, _tmp16_, 10, 10);
		_g_object_unref0 (_tmp16_);
		_tmp17_ = drag;
		g_signal_connect_data (_tmp17_, "prepare", (GCallback) ____lambda62__gtk_drag_source_prepare, block74_data_ref (_data74_), (GClosureNotify) block74_data_unref, 0);
		_g_object_unref0 (drag);
	}
	_tmp18_ = self->priv->_taglist;
	_tmp19_ = tagbox;
	gtk_list_box_insert (_tmp18_, (GtkWidget*) _tmp19_, pos);
	_g_object_unref0 (tagbox);
	block74_data_unref (_data74_);
	_data74_ = NULL;
}

static void
_vala_graphene_rect_t_free (graphene_rect_t* self)
{
	g_boxed_free (graphene_rect_get_type (), self);
}

static GdkPaintable*
tag_editor_create_icon (TagEditor* self,
                        GtkLabel* label)
{
	PangoRectangle log = {0};
	PangoRectangle ink = {0};
	PangoLayout* layout = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	PangoLayout* _tmp2_;
	PangoRectangle _tmp3_ = {0};
	PangoRectangle _tmp4_ = {0};
	gint padding = 0;
	gdouble alpha = 0.0;
	gint width = 0;
	PangoRectangle _tmp5_;
	gint height = 0;
	PangoRectangle _tmp6_;
	graphene_rect_t* rect = NULL;
	graphene_rect_t* _tmp7_;
	GtkSnapshot* snapshot = NULL;
	GtkSnapshot* _tmp8_;
	cairo_t* context = NULL;
	graphene_rect_t _tmp9_;
	cairo_t* _tmp10_;
	GdkRGBA _tmp11_ = {0};
	GdkRGBA _tmp12_ = {0};
	PangoRectangle _tmp13_;
	GtkSnapshot* _tmp14_;
	GdkPaintable* _tmp15_;
	GdkPaintable* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = gtk_label_get_label (label);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_widget_create_pango_layout ((GtkWidget*) label, _tmp1_);
	layout = _tmp2_;
	pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
	pango_layout_set_width (layout, 200 * PANGO_SCALE);
	pango_layout_get_extents (layout, &_tmp3_, &_tmp4_);
	ink = _tmp3_;
	log = _tmp4_;
	padding = 10;
	alpha = 0.5;
	_tmp5_ = log;
	width = (_tmp5_.width / PANGO_SCALE) + (padding * 2);
	_tmp6_ = log;
	height = (_tmp6_.height / PANGO_SCALE) + (padding * 2);
	_tmp7_ = graphene_rect_alloc ();
	rect = _tmp7_;
	graphene_rect_init (rect, (gfloat) 0.0, (gfloat) 0.0, (gfloat) width, (gfloat) height);
	_tmp8_ = gtk_snapshot_new ();
	snapshot = _tmp8_;
	_tmp9_ = *rect;
	_tmp10_ = gtk_snapshot_append_cairo (snapshot, &_tmp9_);
	context = _tmp10_;
	utils_color_from_string ("#ffffff", &_tmp11_);
	utils_set_context_color_with_alpha (context, &_tmp11_, alpha);
	cairo_rectangle (context, (gdouble) 0, (gdouble) 0, (gdouble) width, (gdouble) height);
	cairo_fill (context);
	utils_color_from_string ("#000000", &_tmp12_);
	utils_set_context_color_with_alpha (context, &_tmp12_, alpha);
	_tmp13_ = log;
	cairo_move_to (context, (gdouble) (padding - (_tmp13_.x / PANGO_SCALE)), (gdouble) padding);
	pango_cairo_show_layout (context, layout);
	cairo_new_path (context);
	_tmp14_ = _g_object_ref0 (snapshot);
	_tmp15_ = gtk_snapshot_free_to_paintable (_tmp14_, NULL);
	result = _tmp15_;
	_cairo_destroy0 (context);
	_g_object_unref0 (snapshot);
	__vala_graphene_rect_t_free0 (rect);
	_g_object_unref0 (layout);
	return result;
}

static void
tag_editor_remove_tag (TagEditor* self,
                       GtkListBoxRow* row)
{
	gint index = 0;
	TagBox* tagbox = NULL;
	TagBox* _tmp0_;
	TagBox* _tmp1_;
	GtkListBox* _tmp8_;
	Tag* tag = NULL;
	Tags* _tmp9_;
	Tag* _tmp10_;
	Tag* _tmp11_;
	g_return_if_fail (self != NULL);
	index = gtk_list_box_row_get_index (row);
	_tmp0_ = tag_editor_get_tagbox (self, row);
	tagbox = _tmp0_;
	_tmp1_ = tagbox;
	if (_tmp1_ != NULL) {
		TagBox* _tmp2_;
		guint _tmp3_;
		_tmp2_ = tagbox;
		g_signal_parse_name ("changed", TYPE_TAG_BOX, &_tmp3_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _tag_editor_handle_tag_change_tag_box_changed, self);
		if (self->priv->_draggable) {
			TagBox* _tmp4_;
			guint _tmp5_;
			TagBox* _tmp6_;
			guint _tmp7_;
			_tmp4_ = tagbox;
			g_signal_parse_name ("select-changed", TYPE_TAG_BOX, &_tmp5_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _tag_editor_handle_select_change_tag_box_select_changed, self);
			_tmp6_ = tagbox;
			g_signal_parse_name ("visible-changed", TYPE_TAG_BOX, &_tmp7_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _tag_editor_handle_visible_change_tag_box_visible_changed, self);
		}
	}
	_tmp8_ = self->priv->_taglist;
	gtk_list_box_remove (_tmp8_, (GtkWidget*) row);
	_tmp9_ = self->priv->_tags;
	_tmp10_ = tags_get_tag (_tmp9_, index);
	tag = _tmp10_;
	_tmp11_ = tag;
	if (_tmp11_ != NULL) {
		Tags* _tmp12_;
		Tag* _tmp13_;
		_tmp12_ = self->priv->_tags;
		tags_remove_tag (_tmp12_, index);
		_tmp13_ = tag;
		g_signal_emit (self, tag_editor_signals[TAG_EDITOR_TAG_REMOVED_SIGNAL], 0, _tmp13_, index);
	}
	_g_object_unref0 (tag);
	_g_object_unref0 (tagbox);
}

static gpointer
_tags_ref0 (gpointer self)
{
	return self ? tags_ref (self) : NULL;
}

void
tag_editor_set_tags (TagEditor* self,
                     Tags* tags)
{
	Tags* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _tags_ref0 (tags);
	_tags_unref0 (self->priv->_tags);
	self->priv->_tags = _tmp0_;
	_tmp1_ = self->priv->_taglist;
	gtk_list_box_remove_all (_tmp1_);
	_tmp2_ = self->priv->_taglist;
	_tmp3_ = self->priv->_new_label;
	gtk_list_box_append (_tmp2_, (GtkWidget*) _tmp3_);
	_tmp4_ = self->priv->_new_label;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, FALSE);
	if (tags != NULL) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp5_ = FALSE;
				_tmp5_ = TRUE;
				while (TRUE) {
					Tag* tag = NULL;
					Tag* _tmp7_;
					Tag* _tmp8_;
					if (!_tmp5_) {
						gint _tmp6_;
						_tmp6_ = i;
						i = _tmp6_ + 1;
					}
					_tmp5_ = FALSE;
					if (!(i < tags_size (tags))) {
						break;
					}
					_tmp7_ = tags_get_tag (tags, i);
					tag = _tmp7_;
					_tmp8_ = tag;
					tag_editor_add_tag (self, _tmp8_, i);
					_g_object_unref0 (tag);
				}
			}
		}
	}
}

void
tag_editor_show_selected_tags (TagEditor* self,
                               Tags* tags)
{
	g_return_if_fail (self != NULL);
	self->priv->_selectable = tags != NULL;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				Tags* _tmp2_;
				Tag* tag = NULL;
				Tags* _tmp3_;
				Tag* _tmp4_;
				TagBox* tagbox = NULL;
				GtkListBox* _tmp5_;
				GtkListBoxRow* _tmp6_;
				TagBox* _tmp7_;
				TagBox* _tmp8_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_tags;
				if (!(i < tags_size (_tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->_tags;
				_tmp4_ = tags_get_tag (_tmp3_, i);
				tag = _tmp4_;
				_tmp5_ = self->priv->_taglist;
				_tmp6_ = gtk_list_box_get_row_at_index (_tmp5_, i);
				_tmp7_ = tag_editor_get_tagbox (self, _tmp6_);
				tagbox = _tmp7_;
				_tmp8_ = tagbox;
				if (_tmp8_ != NULL) {
					TagBox* _tmp9_;
					gboolean _tmp10_ = FALSE;
					TagBox* _tmp12_;
					_tmp9_ = tagbox;
					tag_box_set_enable_select (_tmp9_, self->priv->_selectable);
					if (tags != NULL) {
						Tag* _tmp11_;
						_tmp11_ = tag;
						_tmp10_ = tags_contains_tag (tags, _tmp11_);
					} else {
						_tmp10_ = FALSE;
					}
					_tmp12_ = tagbox;
					tag_box_set_selected (_tmp12_, _tmp10_);
				}
				_g_object_unref0 (tagbox);
				_g_object_unref0 (tag);
			}
		}
	}
}

void
tag_editor_clear_visible (TagEditor* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				Tags* _tmp2_;
				TagBox* tagbox = NULL;
				GtkListBox* _tmp3_;
				GtkListBoxRow* _tmp4_;
				TagBox* _tmp5_;
				TagBox* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_tags;
				if (!(i < tags_size (_tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->_taglist;
				_tmp4_ = gtk_list_box_get_row_at_index (_tmp3_, i);
				_tmp5_ = tag_editor_get_tagbox (self, _tmp4_);
				tagbox = _tmp5_;
				_tmp6_ = tagbox;
				if (_tmp6_ != NULL) {
					TagBox* _tmp7_;
					_tmp7_ = tagbox;
					tag_box_set_visible (_tmp7_, FALSE);
				}
				_g_object_unref0 (tagbox);
			}
		}
	}
}

static gboolean
tag_editor_real_grab_focus (GtkWidget* base)
{
	TagEditor * self;
	GtkSearchEntry* _tmp0_;
	gboolean result;
	self = (TagEditor*) base;
	_tmp0_ = self->priv->_entry;
	result = gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	return result;
}

gboolean
tag_editor_get_editable (TagEditor* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_editable;
	return result;
}

void
tag_editor_set_editable (TagEditor* self,
                         gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_editable != value) {
		GtkSearchEntry* _tmp0_;
		GtkListBox* _tmp1_;
		self->priv->_editable = value;
		_tmp0_ = self->priv->_entry;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, self->priv->_editable);
		_tmp1_ = self->priv->_taglist;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, self->priv->_editable);
	}
	g_object_notify_by_pspec ((GObject *) self, tag_editor_properties[TAG_EDITOR_EDITABLE_PROPERTY]);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_INT (GClosure * closure,
                                          GValue * return_value,
                                          guint n_param_values,
                                          const GValue * param_values,
                                          gpointer invocation_hint,
                                          gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_int (param_values + 2), data2);
}

static void
tag_editor_class_init (TagEditorClass * klass,
                       gpointer klass_data)
{
	tag_editor_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TagEditor_private_offset);
	((GtkWidgetClass *) klass)->grab_focus = (gboolean (*) (GtkWidget*)) tag_editor_real_grab_focus;
	G_OBJECT_CLASS (klass)->get_property = _vala_tag_editor_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tag_editor_set_property;
	G_OBJECT_CLASS (klass)->finalize = tag_editor_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TAG_EDITOR_EDITABLE_PROPERTY, tag_editor_properties[TAG_EDITOR_EDITABLE_PROPERTY] = g_param_spec_boolean ("editable", "editable", "editable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tag_editor_signals[TAG_EDITOR_TAG_CHANGED_SIGNAL] = g_signal_new ("tag-changed", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, TYPE_TAG, TYPE_TAG);
	tag_editor_signals[TAG_EDITOR_TAG_ADDED_SIGNAL] = g_signal_new ("tag-added", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TYPE_TAG);
	tag_editor_signals[TAG_EDITOR_TAG_REMOVED_SIGNAL] = g_signal_new ("tag-removed", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, TYPE_TAG, G_TYPE_INT);
	tag_editor_signals[TAG_EDITOR_SELECT_CHANGED_SIGNAL] = g_signal_new ("select-changed", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, TYPE_TAG, G_TYPE_BOOLEAN);
	tag_editor_signals[TAG_EDITOR_VISIBLE_CHANGED_SIGNAL] = g_signal_new ("visible-changed", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, TYPE_TAG, G_TYPE_BOOLEAN);
	tag_editor_signals[TAG_EDITOR_UPDATE_ICONS_SIGNAL] = g_signal_new ("update-icons", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	tag_editor_signals[TAG_EDITOR_ESCAPED_SIGNAL] = g_signal_new ("escaped", TYPE_TAG_EDITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
tag_editor_instance_init (TagEditor * self,
                          gpointer klass)
{
	self->priv = tag_editor_get_instance_private (self);
	self->priv->_tags = NULL;
	self->priv->_draggable = FALSE;
	self->priv->_selectable = FALSE;
	self->priv->_editable = TRUE;
}

static void
tag_editor_finalize (GObject * obj)
{
	TagEditor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TAG_EDITOR, TagEditor);
	_g_object_unref0 (self->priv->_win);
	_tags_unref0 (self->priv->_tags);
	_g_object_unref0 (self->priv->_entry);
	_g_object_unref0 (self->priv->_taglist);
	_g_object_unref0 (self->priv->_new_label);
	G_OBJECT_CLASS (tag_editor_parent_class)->finalize (obj);
}

static GType
tag_editor_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TagEditorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tag_editor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TagEditor), 0, (GInstanceInitFunc) tag_editor_instance_init, NULL };
	GType tag_editor_type_id;
	tag_editor_type_id = g_type_register_static (gtk_box_get_type (), "TagEditor", &g_define_type_info, 0);
	TagEditor_private_offset = g_type_add_instance_private (tag_editor_type_id, sizeof (TagEditorPrivate));
	return tag_editor_type_id;
}

GType
tag_editor_get_type (void)
{
	static volatile gsize tag_editor_type_id__once = 0;
	if (g_once_init_enter (&tag_editor_type_id__once)) {
		GType tag_editor_type_id;
		tag_editor_type_id = tag_editor_get_type_once ();
		g_once_init_leave (&tag_editor_type_id__once, tag_editor_type_id);
	}
	return tag_editor_type_id__once;
}

static void
_vala_tag_editor_get_property (GObject * object,
                               guint property_id,
                               GValue * value,
                               GParamSpec * pspec)
{
	TagEditor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TAG_EDITOR, TagEditor);
	switch (property_id) {
		case TAG_EDITOR_EDITABLE_PROPERTY:
		g_value_set_boolean (value, tag_editor_get_editable (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tag_editor_set_property (GObject * object,
                               guint property_id,
                               const GValue * value,
                               GParamSpec * pspec)
{
	TagEditor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TAG_EDITOR, TagEditor);
	switch (property_id) {
		case TAG_EDITOR_EDITABLE_PROPERTY:
		tag_editor_set_editable (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;
}

