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

/*
* Copyright (c) 2018-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 <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.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_INSPECTOR (tag_inspector_get_type ())
#define TAG_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG_INSPECTOR, TagInspector))
#define TAG_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG_INSPECTOR, TagInspectorClass))
#define IS_TAG_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG_INSPECTOR))
#define IS_TAG_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG_INSPECTOR))
#define TAG_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG_INSPECTOR, TagInspectorClass))

typedef struct _TagInspector TagInspector;
typedef struct _TagInspectorClass TagInspectorClass;
typedef struct _TagInspectorPrivate TagInspectorPrivate;

#define TYPE_MIND_MAP (mind_map_get_type ())
#define MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MIND_MAP, MindMap))
#define MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MIND_MAP, MindMapClass))
#define IS_MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MIND_MAP))
#define IS_MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MIND_MAP))
#define MIND_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MIND_MAP, MindMapClass))

typedef struct _MindMap MindMap;
typedef struct _MindMapClass MindMapClass;

#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;
enum  {
	TAG_INSPECTOR_0_PROPERTY,
	TAG_INSPECTOR_NUM_PROPERTIES
};
static GParamSpec* tag_inspector_properties[TAG_INSPECTOR_NUM_PROPERTIES];
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
typedef struct _Block75Data Block75Data;

#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;
typedef enum  {
	TAG_COMBO_TYPE_AND,
	TAG_COMBO_TYPE_OR,
	TAG_COMBO_TYPE_NONE,
	TAG_COMBO_TYPE_NUM
} TagComboType;

#define TYPE_TAG_COMBO_TYPE (tag_combo_type_get_type ())

#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;
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_MAP_MODEL (map_model_get_type ())
#define MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_MODEL, MapModel))
#define MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_MODEL, MapModelClass))
#define IS_MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_MODEL))
#define IS_MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_MODEL))
#define MAP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_MODEL, MapModelClass))

typedef struct _MapModel MapModel;
typedef struct _MapModelClass MapModelClass;

#define TYPE_UNDO_ITEM (undo_item_get_type ())
#define UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_ITEM, UndoItem))
#define UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_ITEM, UndoItemClass))
#define IS_UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_ITEM))
#define IS_UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_ITEM))
#define UNDO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_ITEM, UndoItemClass))

typedef struct _UndoItem UndoItem;
typedef struct _UndoItemClass UndoItemClass;

#define TYPE_UNDO_TAG_CHANGE (undo_tag_change_get_type ())
#define UNDO_TAG_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_TAG_CHANGE, UndoTagChange))
#define UNDO_TAG_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_TAG_CHANGE, UndoTagChangeClass))
#define IS_UNDO_TAG_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_TAG_CHANGE))
#define IS_UNDO_TAG_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_TAG_CHANGE))
#define UNDO_TAG_CHANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_TAG_CHANGE, UndoTagChangeClass))

typedef struct _UndoTagChange UndoTagChange;
typedef struct _UndoTagChangeClass UndoTagChangeClass;

#define TYPE_NODE (node_get_type ())
#define NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE, Node))
#define NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE, NodeClass))
#define IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE))
#define IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE))
#define NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE, NodeClass))

typedef struct _Node Node;
typedef struct _NodeClass NodeClass;

#define TYPE_UNDO_TAGS_ADD (undo_tags_add_get_type ())
#define UNDO_TAGS_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_TAGS_ADD, UndoTagsAdd))
#define UNDO_TAGS_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_TAGS_ADD, UndoTagsAddClass))
#define IS_UNDO_TAGS_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_TAGS_ADD))
#define IS_UNDO_TAGS_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_TAGS_ADD))
#define UNDO_TAGS_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_TAGS_ADD, UndoTagsAddClass))

typedef struct _UndoTagsAdd UndoTagsAdd;
typedef struct _UndoTagsAddClass UndoTagsAddClass;
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))

#define TYPE_UNDO_TAGS_REMOVE (undo_tags_remove_get_type ())
#define UNDO_TAGS_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_TAGS_REMOVE, UndoTagsRemove))
#define UNDO_TAGS_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_TAGS_REMOVE, UndoTagsRemoveClass))
#define IS_UNDO_TAGS_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_TAGS_REMOVE))
#define IS_UNDO_TAGS_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_TAGS_REMOVE))
#define UNDO_TAGS_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_TAGS_REMOVE, UndoTagsRemoveClass))

typedef struct _UndoTagsRemove UndoTagsRemove;
typedef struct _UndoTagsRemoveClass UndoTagsRemoveClass;

#define TYPE_UNDO_NODES_TAG_ADD (undo_nodes_tag_add_get_type ())
#define UNDO_NODES_TAG_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_TAG_ADD, UndoNodesTagAdd))
#define UNDO_NODES_TAG_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_TAG_ADD, UndoNodesTagAddClass))
#define IS_UNDO_NODES_TAG_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_TAG_ADD))
#define IS_UNDO_NODES_TAG_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_TAG_ADD))
#define UNDO_NODES_TAG_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_TAG_ADD, UndoNodesTagAddClass))

typedef struct _UndoNodesTagAdd UndoNodesTagAdd;
typedef struct _UndoNodesTagAddClass UndoNodesTagAddClass;

#define TYPE_UNDO_NODES_TAG_REMOVE (undo_nodes_tag_remove_get_type ())
#define UNDO_NODES_TAG_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_TAG_REMOVE, UndoNodesTagRemove))
#define UNDO_NODES_TAG_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_TAG_REMOVE, UndoNodesTagRemoveClass))
#define IS_UNDO_NODES_TAG_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_TAG_REMOVE))
#define IS_UNDO_NODES_TAG_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_TAG_REMOVE))
#define UNDO_NODES_TAG_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_TAG_REMOVE, UndoNodesTagRemoveClass))

typedef struct _UndoNodesTagRemove UndoNodesTagRemove;
typedef struct _UndoNodesTagRemoveClass UndoNodesTagRemoveClass;
#define _tags_unref0(var) ((var == NULL) ? NULL : (var = (tags_unref (var), NULL)))
enum  {
	TAG_INSPECTOR_EDITABLE_CHANGED_SIGNAL,
	TAG_INSPECTOR_UPDATE_ICONS_SIGNAL,
	TAG_INSPECTOR_NUM_SIGNALS
};
static guint tag_inspector_signals[TAG_INSPECTOR_NUM_SIGNALS] = {0};

struct _TagInspector {
	GtkBox parent_instance;
	TagInspectorPrivate * priv;
};

struct _TagInspectorClass {
	GtkBoxClass parent_class;
};

struct _TagInspectorPrivate {
	MindMap* _map;
	TagEditor* _editor;
	GtkBox* _highlight_box;
};

struct _Block75Data {
	int _ref_count_;
	TagInspector* self;
	GtkDropDown* highlight_mode;
};

static gint TagInspector_private_offset;
static gpointer tag_inspector_parent_class = NULL;

VALA_EXTERN GType tag_inspector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TagInspector, g_object_unref)
VALA_EXTERN gpointer mind_map_ref (gpointer instance);
VALA_EXTERN void mind_map_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_mind_map (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_mind_map (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_mind_map (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_mind_map (const GValue* value);
VALA_EXTERN GType mind_map_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MindMap, mind_map_unref)
VALA_EXTERN GType tag_editor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TagEditor, g_object_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN TagInspector* tag_inspector_new (MainWindow* win);
VALA_EXTERN TagInspector* tag_inspector_construct (GType object_type,
                                       MainWindow* win);
static Block75Data* block75_data_ref (Block75Data* _data75_);
static void block75_data_unref (void * _userdata_);
VALA_EXTERN TagEditor* tag_editor_new (MainWindow* win,
                           gboolean draggable);
VALA_EXTERN TagEditor* tag_editor_construct (GType object_type,
                                 MainWindow* win,
                                 gboolean draggable);
VALA_EXTERN GType tag_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tag, g_object_unref)
static void tag_inspector_tag_changed (TagInspector* self,
                                Tag* tag,
                                Tag* orig_tag);
static void _tag_inspector_tag_changed_tag_editor_tag_changed (TagEditor* _sender,
                                                        Tag* tag,
                                                        Tag* orig_tag,
                                                        gpointer self);
static void tag_inspector_tag_added (TagInspector* self,
                              Tag* tag);
static void _tag_inspector_tag_added_tag_editor_tag_added (TagEditor* _sender,
                                                    Tag* tag,
                                                    gpointer self);
static void tag_inspector_tag_removed (TagInspector* self,
                                Tag* tag,
                                gint index);
static void _tag_inspector_tag_removed_tag_editor_tag_removed (TagEditor* _sender,
                                                        Tag* tag,
                                                        gint index,
                                                        gpointer self);
static void tag_inspector_tag_select_changed (TagInspector* self,
                                       Tag* tag,
                                       gboolean selected);
static void _tag_inspector_tag_select_changed_tag_editor_select_changed (TagEditor* _sender,
                                                                  Tag* tag,
                                                                  gboolean select,
                                                                  gpointer self);
static void tag_inspector_tag_visible_changed (TagInspector* self,
                                        Tag* tag,
                                        gboolean visible);
static void _tag_inspector_tag_visible_changed_tag_editor_visible_changed (TagEditor* _sender,
                                                                    Tag* tag,
                                                                    gboolean visible,
                                                                    gpointer self);
static void __lambda142_ (TagInspector* self);
static void ___lambda142__tag_editor_escaped (TagEditor* _sender,
                                       gpointer self);
static void tag_inspector_tab_changed (TagInspector* self,
                                MindMap* map);
static void _tag_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                            MindMap* map,
                                                            gpointer self);
static void __lambda143_ (TagInspector* self);
VALA_EXTERN gboolean mind_map_get_editable (MindMap* self);
VALA_EXTERN void tag_editor_set_editable (TagEditor* self,
                              gboolean value);
static void ___lambda143__tag_inspector_editable_changed (TagInspector* _sender,
                                                   gpointer self);
VALA_EXTERN GType tag_combo_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* tag_combo_type_label (TagComboType self);
static void _vala_array_add46 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void __lambda144_ (Block75Data* _data75_);
VALA_EXTERN void mind_map_set_highlight_mode (MindMap* self,
                                  TagComboType value);
static void ___lambda144__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda145_ (TagInspector* self);
VALA_EXTERN void tag_editor_clear_visible (TagEditor* self);
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 Tags* mind_map_get_highlighted (MindMap* self);
VALA_EXTERN void tags_clear_tags (Tags* self);
static void tag_inspector_enable_highlight_box (TagInspector* self,
                                         gboolean show);
static void ___lambda145__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda146_ (TagInspector* self);
static void ___lambda146__tag_inspector_update_icons (TagInspector* _sender,
                                               gpointer self);
static void tag_inspector_current_changed (TagInspector* self);
static void _tag_inspector_current_changed_mind_map_current_changed (MindMap* _sender,
                                                              MindMap* map,
                                                              gpointer self);
static void tag_inspector_reload_tags (TagInspector* self);
static void _tag_inspector_reload_tags_mind_map_reload_tags (MindMap* _sender,
                                                      gpointer self);
VALA_EXTERN void tag_editor_set_tags (TagEditor* self,
                          Tags* tags);
VALA_EXTERN gpointer map_model_ref (gpointer instance);
VALA_EXTERN void map_model_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_map_model (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_map_model (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_map_model (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_map_model (const GValue* value);
VALA_EXTERN GType map_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MapModel, map_model_unref)
VALA_EXTERN MapModel* mind_map_get_model (MindMap* self);
VALA_EXTERN Tags* map_model_get_tags (MapModel* self);
VALA_EXTERN GType undo_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoItem, g_object_unref)
VALA_EXTERN void mind_map_add_undo (MindMap* self,
                        UndoItem* item);
VALA_EXTERN UndoTagChange* undo_tag_change_new (Tag* tag,
                                    Tag* prev_tag);
VALA_EXTERN UndoTagChange* undo_tag_change_construct (GType object_type,
                                          Tag* tag,
                                          Tag* prev_tag);
VALA_EXTERN GType undo_tag_change_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoTagChange, g_object_unref)
VALA_EXTERN void mind_map_queue_draw (MindMap* self);
VALA_EXTERN void mind_map_auto_save (MindMap* self);
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
VALA_EXTERN GArray* mind_map_get_selected_nodes (MindMap* self);
VALA_EXTERN gboolean node_add_tag (Node* self,
                       Tag* tag);
VALA_EXTERN gint tags_size (Tags* self);
VALA_EXTERN UndoTagsAdd* undo_tags_add_new (Tag* tag,
                                gint index,
                                GArray* nodes);
VALA_EXTERN UndoTagsAdd* undo_tags_add_construct (GType object_type,
                                      Tag* tag,
                                      gint index,
                                      GArray* nodes);
VALA_EXTERN GType undo_tags_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoTagsAdd, g_object_unref)
static void _g_object_unref0_ (gpointer var);
static void _vala_Node_free_function_content_of (gpointer data);
VALA_EXTERN void mind_map_remove_tag (MindMap* self,
                          Tag* tag,
                          GArray* nodes);
VALA_EXTERN UndoTagsRemove* undo_tags_remove_new (Tag* tag,
                                      gint index,
                                      GArray* nodes);
VALA_EXTERN UndoTagsRemove* undo_tags_remove_construct (GType object_type,
                                            Tag* tag,
                                            gint index,
                                            GArray* nodes);
VALA_EXTERN GType undo_tags_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoTagsRemove, g_object_unref)
VALA_EXTERN UndoNodesTagAdd* undo_nodes_tag_add_new (GArray* nodes,
                                         Tag* tag);
VALA_EXTERN UndoNodesTagAdd* undo_nodes_tag_add_construct (GType object_type,
                                               GArray* nodes,
                                               Tag* tag);
VALA_EXTERN GType undo_nodes_tag_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesTagAdd, g_object_unref)
VALA_EXTERN gboolean node_remove_tag (Node* self,
                          Tag* tag,
                          GArray* nodes);
VALA_EXTERN UndoNodesTagRemove* undo_nodes_tag_remove_new (GArray* nodes,
                                               Tag* tag);
VALA_EXTERN UndoNodesTagRemove* undo_nodes_tag_remove_construct (GType object_type,
                                                     GArray* nodes,
                                                     Tag* tag);
VALA_EXTERN GType undo_nodes_tag_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesTagRemove, g_object_unref)
VALA_EXTERN gboolean tags_add_tag (Tags* self,
                       Tag* tag,
                       gint index);
VALA_EXTERN gint tags_get_tag_index (Tags* self,
                         Tag* tag);
VALA_EXTERN gboolean tags_remove_tag (Tags* self,
                          gint index);
VALA_EXTERN void tag_editor_show_selected_tags (TagEditor* self,
                                    Tags* tags);
VALA_EXTERN Tags* node_get_tags (Node* self);
VALA_EXTERN Tags* tags_intersect (Tags* first,
                      Tags* second);
VALA_EXTERN void tag_inspector_grab_first (TagInspector* self);
static void tag_inspector_finalize (GObject * obj);
static GType tag_inspector_get_type_once (void);
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
tag_inspector_get_instance_private (TagInspector* self)
{
	return G_STRUCT_MEMBER_P (self, TagInspector_private_offset);
}

static Block75Data*
block75_data_ref (Block75Data* _data75_)
{
	g_atomic_int_inc (&_data75_->_ref_count_);
	return _data75_;
}

static void
block75_data_unref (void * _userdata_)
{
	Block75Data* _data75_;
	_data75_ = (Block75Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data75_->_ref_count_)) {
		TagInspector* self;
		self = _data75_->self;
		_g_object_unref0 (_data75_->highlight_mode);
		_g_object_unref0 (self);
		g_slice_free (Block75Data, _data75_);
	}
}

static void
_tag_inspector_tag_changed_tag_editor_tag_changed (TagEditor* _sender,
                                                   Tag* tag,
                                                   Tag* orig_tag,
                                                   gpointer self)
{
	tag_inspector_tag_changed ((TagInspector*) self, tag, orig_tag);
}

static void
_tag_inspector_tag_added_tag_editor_tag_added (TagEditor* _sender,
                                               Tag* tag,
                                               gpointer self)
{
	tag_inspector_tag_added ((TagInspector*) self, tag);
}

static void
_tag_inspector_tag_removed_tag_editor_tag_removed (TagEditor* _sender,
                                                   Tag* tag,
                                                   gint index,
                                                   gpointer self)
{
	tag_inspector_tag_removed ((TagInspector*) self, tag, index);
}

static void
_tag_inspector_tag_select_changed_tag_editor_select_changed (TagEditor* _sender,
                                                             Tag* tag,
                                                             gboolean select,
                                                             gpointer self)
{
	tag_inspector_tag_select_changed ((TagInspector*) self, tag, select);
}

static void
_tag_inspector_tag_visible_changed_tag_editor_visible_changed (TagEditor* _sender,
                                                               Tag* tag,
                                                               gboolean visible,
                                                               gpointer self)
{
	tag_inspector_tag_visible_changed ((TagInspector*) self, tag, visible);
}

static void
__lambda142_ (TagInspector* self)
{
	MindMap* _tmp0_;
	_tmp0_ = self->priv->_map;
	g_signal_emit_by_name (_tmp0_, "hide-properties");
}

static void
___lambda142__tag_editor_escaped (TagEditor* _sender,
                                  gpointer self)
{
	__lambda142_ ((TagInspector*) self);
}

static void
_tag_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                       MindMap* map,
                                                       gpointer self)
{
	tag_inspector_tab_changed ((TagInspector*) self, map);
}

static void
__lambda143_ (TagInspector* self)
{
	gboolean _tmp0_ = FALSE;
	MindMap* _tmp1_;
	TagEditor* _tmp5_;
	_tmp1_ = self->priv->_map;
	if (_tmp1_ != NULL) {
		MindMap* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->priv->_map;
		_tmp3_ = mind_map_get_editable (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp5_ = self->priv->_editor;
	tag_editor_set_editable (_tmp5_, _tmp0_);
}

static void
___lambda143__tag_inspector_editable_changed (TagInspector* _sender,
                                              gpointer self)
{
	__lambda143_ ((TagInspector*) self);
}

static void
_vala_array_add46 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
__lambda144_ (Block75Data* _data75_)
{
	TagInspector* self;
	MindMap* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	self = _data75_->self;
	_tmp0_ = self->priv->_map;
	_tmp1_ = gtk_drop_down_get_selected (_data75_->highlight_mode);
	_tmp2_ = _tmp1_;
	mind_map_set_highlight_mode (_tmp0_, (TagComboType) _tmp2_);
}

static void
___lambda144__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda144_ (self);
}

static void
__lambda145_ (TagInspector* self)
{
	TagEditor* _tmp0_;
	MindMap* _tmp1_;
	Tags* _tmp2_;
	Tags* _tmp3_;
	_tmp0_ = self->priv->_editor;
	tag_editor_clear_visible (_tmp0_);
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_highlighted (_tmp1_);
	_tmp3_ = _tmp2_;
	tags_clear_tags (_tmp3_);
	tag_inspector_enable_highlight_box (self, FALSE);
}

static void
___lambda145__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda145_ ((TagInspector*) self);
}

static void
__lambda146_ (TagInspector* self)
{
	TagEditor* _tmp0_;
	_tmp0_ = self->priv->_editor;
	g_signal_emit_by_name (_tmp0_, "update-icons");
}

static void
___lambda146__tag_inspector_update_icons (TagInspector* _sender,
                                          gpointer self)
{
	__lambda146_ ((TagInspector*) self);
}

TagInspector*
tag_inspector_construct (GType object_type,
                         MainWindow* win)
{
	TagInspector * self = NULL;
	Block75Data* _data75_;
	gchar* note_str = NULL;
	gchar* _tmp0_;
	GtkLabel* note = NULL;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	TagEditor* _tmp3_;
	TagEditor* _tmp4_;
	TagEditor* _tmp5_;
	TagEditor* _tmp6_;
	TagEditor* _tmp7_;
	TagEditor* _tmp8_;
	TagEditor* _tmp9_;
	gchar** mode_strs = NULL;
	gchar** _tmp10_;
	gint mode_strs_length1;
	gint _mode_strs_size_;
	GtkLabel* highlight_mode_lbl = NULL;
	GtkLabel* _tmp14_ = NULL;
	gchar** _tmp15_;
	gint _tmp15__length1;
	GtkDropDown* _tmp16_ = NULL;
	GtkButton* highlight_disable = NULL;
	GtkButton* _tmp17_ = NULL;
	GtkBox* _tmp18_ = NULL;
	GtkBox* _tmp19_;
	GtkBox* _tmp20_;
	GtkBox* _tmp21_;
	GtkLabel* _tmp22_;
	TagEditor* _tmp23_;
	GtkBox* _tmp24_;
	g_return_val_if_fail (win != NULL, NULL);
	_data75_ = g_slice_new0 (Block75Data);
	_data75_->_ref_count_ = 1;
	self = (TagInspector*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 10, "valign", GTK_ALIGN_FILL, NULL);
	_data75_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_ ("Create, delete, edit mindmap tags.  Add or remove tags in selected nod" \
"e(s).  Highlight tagged nodes in map."));
	note_str = _tmp0_;
	_tmp1_ = note_str;
	_tmp2_ = (GtkLabel*) gtk_label_new (_tmp1_);
	gtk_label_set_wrap_mode (_tmp2_, PANGO_WRAP_WORD);
	gtk_label_set_wrap (_tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	note = _tmp2_;
	_tmp3_ = tag_editor_new (win, TRUE);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->_editor);
	self->priv->_editor = _tmp3_;
	_tmp4_ = self->priv->_editor;
	g_signal_connect_object (_tmp4_, "tag-changed", (GCallback) _tag_inspector_tag_changed_tag_editor_tag_changed, self, 0);
	_tmp5_ = self->priv->_editor;
	g_signal_connect_object (_tmp5_, "tag-added", (GCallback) _tag_inspector_tag_added_tag_editor_tag_added, self, 0);
	_tmp6_ = self->priv->_editor;
	g_signal_connect_object (_tmp6_, "tag-removed", (GCallback) _tag_inspector_tag_removed_tag_editor_tag_removed, self, 0);
	_tmp7_ = self->priv->_editor;
	g_signal_connect_object (_tmp7_, "select-changed", (GCallback) _tag_inspector_tag_select_changed_tag_editor_select_changed, self, 0);
	_tmp8_ = self->priv->_editor;
	g_signal_connect_object (_tmp8_, "visible-changed", (GCallback) _tag_inspector_tag_visible_changed_tag_editor_visible_changed, self, 0);
	_tmp9_ = self->priv->_editor;
	g_signal_connect_object (_tmp9_, "escaped", (GCallback) ___lambda142__tag_editor_escaped, self, 0);
	g_signal_connect_object (win, "canvas-changed", (GCallback) _tag_inspector_tab_changed_main_window_canvas_changed, self, 0);
	g_signal_connect_object (self, "editable-changed", (GCallback) ___lambda143__tag_inspector_editable_changed, self, 0);
	_tmp10_ = g_new0 (gchar*, 0 + 1);
	mode_strs = _tmp10_;
	mode_strs_length1 = 0;
	_mode_strs_size_ = mode_strs_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp11_ = FALSE;
			_tmp11_ = TRUE;
			while (TRUE) {
				TagComboType mode = 0;
				gchar* _tmp13_;
				if (!_tmp11_) {
					gint _tmp12_;
					_tmp12_ = i;
					i = _tmp12_ + 1;
				}
				_tmp11_ = FALSE;
				if (!(i < ((gint) TAG_COMBO_TYPE_NUM))) {
					break;
				}
				mode = (TagComboType) i;
				_tmp13_ = tag_combo_type_label (mode);
				_vala_array_add46 (&mode_strs, &mode_strs_length1, &_mode_strs_size_, _tmp13_);
			}
		}
	}
	_tmp14_ = (GtkLabel*) gtk_label_new (_ ("Highlight Mode"));
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp14_);
	highlight_mode_lbl = _tmp14_;
	_tmp15_ = mode_strs;
	_tmp15__length1 = mode_strs_length1;
	_tmp16_ = (GtkDropDown*) gtk_drop_down_new_from_strings (_tmp15_);
	gtk_widget_set_halign ((GtkWidget*) _tmp16_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp16_);
	_data75_->highlight_mode = _tmp16_;
	g_signal_connect_data ((GObject*) _data75_->highlight_mode, "notify::selected", (GCallback) ___lambda144__g_object_notify, block75_data_ref (_data75_), (GClosureNotify) block75_data_unref, 0);
	_tmp17_ = (GtkButton*) gtk_button_new_with_label (_ ("End Tag Highlighting"));
	gtk_widget_set_halign ((GtkWidget*) _tmp17_, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp17_, TRUE);
	g_object_ref_sink (_tmp17_);
	highlight_disable = _tmp17_;
	g_signal_connect_object (highlight_disable, "clicked", (GCallback) ___lambda145__gtk_button_clicked, self, 0);
	_tmp18_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	gtk_widget_set_valign ((GtkWidget*) _tmp18_, GTK_ALIGN_END);
	gtk_widget_set_visible ((GtkWidget*) _tmp18_, FALSE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp18_, 5);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp18_, 5);
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->_highlight_box);
	self->priv->_highlight_box = _tmp18_;
	_tmp19_ = self->priv->_highlight_box;
	gtk_box_append (_tmp19_, (GtkWidget*) highlight_mode_lbl);
	_tmp20_ = self->priv->_highlight_box;
	gtk_box_append (_tmp20_, (GtkWidget*) _data75_->highlight_mode);
	_tmp21_ = self->priv->_highlight_box;
	gtk_box_append (_tmp21_, (GtkWidget*) highlight_disable);
	_tmp22_ = note;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp22_);
	_tmp23_ = self->priv->_editor;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp23_);
	_tmp24_ = self->priv->_highlight_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp24_);
	g_signal_connect_object (self, "update-icons", (GCallback) ___lambda146__tag_inspector_update_icons, self, 0);
	_g_object_unref0 (highlight_disable);
	_g_object_unref0 (highlight_mode_lbl);
	mode_strs = (_vala_array_free (mode_strs, mode_strs_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (note);
	_g_free0 (note_str);
	block75_data_unref (_data75_);
	_data75_ = NULL;
	return self;
}

TagInspector*
tag_inspector_new (MainWindow* win)
{
	return tag_inspector_construct (TYPE_TAG_INSPECTOR, win);
}

static void
tag_inspector_enable_highlight_box (TagInspector* self,
                                    gboolean show)
{
	GtkBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_highlight_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, show);
}

static void
_tag_inspector_current_changed_mind_map_current_changed (MindMap* _sender,
                                                         MindMap* map,
                                                         gpointer self)
{
	tag_inspector_current_changed ((TagInspector*) self);
}

static void
_tag_inspector_reload_tags_mind_map_reload_tags (MindMap* _sender,
                                                 gpointer self)
{
	tag_inspector_reload_tags ((TagInspector*) self);
}

static gpointer
_mind_map_ref0 (gpointer self)
{
	return self ? mind_map_ref (self) : NULL;
}

static void
tag_inspector_tab_changed (TagInspector* self,
                           MindMap* map)
{
	MindMap* _tmp0_;
	MindMap* _tmp5_;
	TagEditor* _tmp6_;
	MapModel* _tmp7_;
	MapModel* _tmp8_;
	Tags* _tmp9_;
	Tags* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		MindMap* _tmp1_;
		guint _tmp2_;
		MindMap* _tmp3_;
		guint _tmp4_;
		_tmp1_ = self->priv->_map;
		g_signal_parse_name ("current-changed", TYPE_MIND_MAP, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _tag_inspector_current_changed_mind_map_current_changed, self);
		_tmp3_ = self->priv->_map;
		g_signal_parse_name ("reload-tags", TYPE_MIND_MAP, &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _tag_inspector_reload_tags_mind_map_reload_tags, self);
	}
	_tmp5_ = _mind_map_ref0 (map);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp5_;
	_tmp6_ = self->priv->_editor;
	_tmp7_ = mind_map_get_model (map);
	_tmp8_ = _tmp7_;
	_tmp9_ = map_model_get_tags (_tmp8_);
	_tmp10_ = _tmp9_;
	tag_editor_set_tags (_tmp6_, _tmp10_);
	if (map != NULL) {
		g_signal_connect_object (map, "current-changed", (GCallback) _tag_inspector_current_changed_mind_map_current_changed, self, 0);
		g_signal_connect_object (map, "reload-tags", (GCallback) _tag_inspector_reload_tags_mind_map_reload_tags, self, 0);
		tag_inspector_current_changed (self);
	}
}

static void
tag_inspector_reload_tags (TagInspector* self)
{
	TagEditor* _tmp0_;
	MindMap* _tmp1_;
	MapModel* _tmp2_;
	MapModel* _tmp3_;
	Tags* _tmp4_;
	Tags* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_editor;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_model (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = map_model_get_tags (_tmp3_);
	_tmp5_ = _tmp4_;
	tag_editor_set_tags (_tmp0_, _tmp5_);
	tag_inspector_current_changed (self);
}

static void
tag_inspector_tag_changed (TagInspector* self,
                           Tag* tag,
                           Tag* orig_tag)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	g_return_if_fail (orig_tag != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		MindMap* _tmp1_;
		UndoTagChange* _tmp2_;
		UndoTagChange* _tmp3_;
		MindMap* _tmp4_;
		MindMap* _tmp5_;
		_tmp1_ = self->priv->_map;
		_tmp2_ = undo_tag_change_new (tag, orig_tag);
		_tmp3_ = _tmp2_;
		mind_map_add_undo (_tmp1_, (UndoItem*) _tmp3_);
		_g_object_unref0 (_tmp3_);
		_tmp4_ = self->priv->_map;
		mind_map_queue_draw (_tmp4_);
		_tmp5_ = self->priv->_map;
		mind_map_auto_save (_tmp5_);
	}
}

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

static void
tag_inspector_tag_added (TagInspector* self,
                         Tag* tag)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		GArray* nodes = NULL;
		MindMap* _tmp1_;
		GArray* _tmp2_;
		MindMap* _tmp10_;
		MindMap* _tmp11_;
		MapModel* _tmp12_;
		MapModel* _tmp13_;
		Tags* _tmp14_;
		Tags* _tmp15_;
		GArray* _tmp16_;
		UndoTagsAdd* _tmp17_;
		UndoTagsAdd* _tmp18_;
		GArray* _tmp19_;
		MindMap* _tmp21_;
		_tmp1_ = self->priv->_map;
		_tmp2_ = mind_map_get_selected_nodes (_tmp1_);
		nodes = _tmp2_;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					GArray* _tmp5_;
					Node* node = NULL;
					GArray* _tmp6_;
					Node* _tmp7_;
					Node* _tmp8_;
					Node* _tmp9_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					_tmp5_ = nodes;
					if (!(((guint) i) < _tmp5_->len)) {
						break;
					}
					_tmp6_ = nodes;
					_tmp7_ = g_array_index (_tmp6_, Node*, (guint) i);
					_tmp8_ = _g_object_ref0 (_tmp7_);
					node = _tmp8_;
					_tmp9_ = node;
					node_add_tag (_tmp9_, tag);
					_g_object_unref0 (node);
				}
			}
		}
		_tmp10_ = self->priv->_map;
		_tmp11_ = self->priv->_map;
		_tmp12_ = mind_map_get_model (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = map_model_get_tags (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = nodes;
		_tmp17_ = undo_tags_add_new (tag, tags_size (_tmp15_) - 1, _tmp16_);
		_tmp18_ = _tmp17_;
		mind_map_add_undo (_tmp10_, (UndoItem*) _tmp18_);
		_g_object_unref0 (_tmp18_);
		_tmp19_ = nodes;
		if (_tmp19_->len > ((guint) 0)) {
			MindMap* _tmp20_;
			tag_inspector_current_changed (self);
			_tmp20_ = self->priv->_map;
			mind_map_queue_draw (_tmp20_);
		}
		_tmp21_ = self->priv->_map;
		mind_map_auto_save (_tmp21_);
		_g_array_unref0 (nodes);
	}
}

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

static void
_vala_Node_free_function_content_of (gpointer data)
{
	Node* self;
	self = *((Node**) data);
	_g_object_unref0_ (self);
}

static void
tag_inspector_tag_removed (TagInspector* self,
                           Tag* tag,
                           gint index)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		GArray* nodes = NULL;
		GArray* _tmp1_;
		MindMap* _tmp2_;
		GArray* _tmp3_;
		MindMap* _tmp4_;
		GArray* _tmp5_;
		UndoTagsRemove* _tmp6_;
		UndoTagsRemove* _tmp7_;
		GArray* _tmp8_;
		MindMap* _tmp10_;
		_tmp1_ = g_array_new (TRUE, TRUE, sizeof (Node*));
		g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Node_free_function_content_of);
		nodes = _tmp1_;
		_tmp2_ = self->priv->_map;
		_tmp3_ = nodes;
		mind_map_remove_tag (_tmp2_, tag, _tmp3_);
		_tmp4_ = self->priv->_map;
		_tmp5_ = nodes;
		_tmp6_ = undo_tags_remove_new (tag, index, _tmp5_);
		_tmp7_ = _tmp6_;
		mind_map_add_undo (_tmp4_, (UndoItem*) _tmp7_);
		_g_object_unref0 (_tmp7_);
		_tmp8_ = nodes;
		if (_tmp8_->len > ((guint) 0)) {
			MindMap* _tmp9_;
			_tmp9_ = self->priv->_map;
			mind_map_queue_draw (_tmp9_);
		}
		_tmp10_ = self->priv->_map;
		mind_map_auto_save (_tmp10_);
		_g_array_unref0 (nodes);
	}
}

static void
tag_inspector_tag_select_changed (TagInspector* self,
                                  Tag* tag,
                                  gboolean selected)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	GArray* _tmp1_;
	GArray* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected_nodes (_tmp0_);
	nodes = _tmp1_;
	_tmp2_ = nodes;
	if (_tmp2_->len > ((guint) 0)) {
		GArray* changed_nodes = NULL;
		GArray* _tmp3_;
		MindMap* _tmp32_;
		MindMap* _tmp33_;
		_tmp3_ = g_array_new (TRUE, TRUE, sizeof (Node*));
		g_array_set_clear_func (_tmp3_, (GDestroyNotify) _vala_Node_free_function_content_of);
		changed_nodes = _tmp3_;
		if (selected) {
			MindMap* _tmp14_;
			GArray* _tmp15_;
			UndoNodesTagAdd* _tmp16_;
			UndoNodesTagAdd* _tmp17_;
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp4_ = FALSE;
					_tmp4_ = TRUE;
					while (TRUE) {
						GArray* _tmp6_;
						Node* node = NULL;
						GArray* _tmp7_;
						Node* _tmp8_;
						Node* _tmp9_;
						Node* _tmp10_;
						if (!_tmp4_) {
							gint _tmp5_;
							_tmp5_ = i;
							i = _tmp5_ + 1;
						}
						_tmp4_ = FALSE;
						_tmp6_ = nodes;
						if (!(((guint) i) < _tmp6_->len)) {
							break;
						}
						_tmp7_ = nodes;
						_tmp8_ = g_array_index (_tmp7_, Node*, (guint) i);
						_tmp9_ = _g_object_ref0 (_tmp8_);
						node = _tmp9_;
						_tmp10_ = node;
						if (node_add_tag (_tmp10_, tag)) {
							GArray* _tmp11_;
							Node* _tmp12_;
							Node* _tmp13_;
							_tmp11_ = changed_nodes;
							_tmp12_ = node;
							_tmp13_ = _g_object_ref0 (_tmp12_);
							g_array_append_val (_tmp11_, _tmp13_);
						}
						_g_object_unref0 (node);
					}
				}
			}
			_tmp14_ = self->priv->_map;
			_tmp15_ = nodes;
			_tmp16_ = undo_nodes_tag_add_new (_tmp15_, tag);
			_tmp17_ = _tmp16_;
			mind_map_add_undo (_tmp14_, (UndoItem*) _tmp17_);
			_g_object_unref0 (_tmp17_);
		} else {
			MindMap* _tmp28_;
			GArray* _tmp29_;
			UndoNodesTagRemove* _tmp30_;
			UndoNodesTagRemove* _tmp31_;
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp18_ = FALSE;
					_tmp18_ = TRUE;
					while (TRUE) {
						GArray* _tmp20_;
						Node* node = NULL;
						GArray* _tmp21_;
						Node* _tmp22_;
						Node* _tmp23_;
						Node* _tmp24_;
						if (!_tmp18_) {
							gint _tmp19_;
							_tmp19_ = i;
							i = _tmp19_ + 1;
						}
						_tmp18_ = FALSE;
						_tmp20_ = nodes;
						if (!(((guint) i) < _tmp20_->len)) {
							break;
						}
						_tmp21_ = nodes;
						_tmp22_ = g_array_index (_tmp21_, Node*, (guint) i);
						_tmp23_ = _g_object_ref0 (_tmp22_);
						node = _tmp23_;
						_tmp24_ = node;
						if (node_remove_tag (_tmp24_, tag, NULL)) {
							GArray* _tmp25_;
							Node* _tmp26_;
							Node* _tmp27_;
							_tmp25_ = changed_nodes;
							_tmp26_ = node;
							_tmp27_ = _g_object_ref0 (_tmp26_);
							g_array_append_val (_tmp25_, _tmp27_);
						}
						_g_object_unref0 (node);
					}
				}
			}
			_tmp28_ = self->priv->_map;
			_tmp29_ = nodes;
			_tmp30_ = undo_nodes_tag_remove_new (_tmp29_, tag);
			_tmp31_ = _tmp30_;
			mind_map_add_undo (_tmp28_, (UndoItem*) _tmp31_);
			_g_object_unref0 (_tmp31_);
		}
		_tmp32_ = self->priv->_map;
		mind_map_auto_save (_tmp32_);
		_tmp33_ = self->priv->_map;
		mind_map_queue_draw (_tmp33_);
		_g_array_unref0 (changed_nodes);
	}
	_g_array_unref0 (nodes);
}

static void
tag_inspector_tag_visible_changed (TagInspector* self,
                                   Tag* tag,
                                   gboolean visible)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	if (visible) {
		MindMap* _tmp0_;
		Tags* _tmp1_;
		Tags* _tmp2_;
		_tmp0_ = self->priv->_map;
		_tmp1_ = mind_map_get_highlighted (_tmp0_);
		_tmp2_ = _tmp1_;
		tags_add_tag (_tmp2_, tag, -1);
		tag_inspector_enable_highlight_box (self, TRUE);
	} else {
		gint index = 0;
		MindMap* _tmp3_;
		Tags* _tmp4_;
		Tags* _tmp5_;
		MindMap* _tmp6_;
		Tags* _tmp7_;
		Tags* _tmp8_;
		MindMap* _tmp9_;
		Tags* _tmp10_;
		Tags* _tmp11_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_highlighted (_tmp3_);
		_tmp5_ = _tmp4_;
		index = tags_get_tag_index (_tmp5_, tag);
		_tmp6_ = self->priv->_map;
		_tmp7_ = mind_map_get_highlighted (_tmp6_);
		_tmp8_ = _tmp7_;
		tags_remove_tag (_tmp8_, index);
		_tmp9_ = self->priv->_map;
		_tmp10_ = mind_map_get_highlighted (_tmp9_);
		_tmp11_ = _tmp10_;
		if (tags_size (_tmp11_) == 0) {
			tag_inspector_enable_highlight_box (self, FALSE);
		}
	}
}

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

static void
tag_inspector_current_changed (TagInspector* self)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		GArray* nodes = NULL;
		MindMap* _tmp1_;
		GArray* _tmp2_;
		GArray* _tmp3_;
		_tmp1_ = self->priv->_map;
		_tmp2_ = mind_map_get_selected_nodes (_tmp1_);
		nodes = _tmp2_;
		_tmp3_ = nodes;
		if (_tmp3_->len == ((guint) 0)) {
			TagEditor* _tmp4_;
			_tmp4_ = self->priv->_editor;
			tag_editor_show_selected_tags (_tmp4_, NULL);
		} else {
			GArray* _tmp5_;
			_tmp5_ = nodes;
			if (_tmp5_->len == ((guint) 1)) {
				TagEditor* _tmp6_;
				GArray* _tmp7_;
				Node* _tmp8_;
				Tags* _tmp9_;
				Tags* _tmp10_;
				_tmp6_ = self->priv->_editor;
				_tmp7_ = nodes;
				_tmp8_ = g_array_index (_tmp7_, Node*, (guint) 0);
				_tmp9_ = node_get_tags (_tmp8_);
				_tmp10_ = _tmp9_;
				tag_editor_show_selected_tags (_tmp6_, _tmp10_);
			} else {
				Tags* tags = NULL;
				GArray* _tmp11_;
				Node* _tmp12_;
				Tags* _tmp13_;
				Tags* _tmp14_;
				Tags* _tmp15_;
				TagEditor* _tmp25_;
				Tags* _tmp26_;
				_tmp11_ = nodes;
				_tmp12_ = g_array_index (_tmp11_, Node*, (guint) 0);
				_tmp13_ = node_get_tags (_tmp12_);
				_tmp14_ = _tmp13_;
				_tmp15_ = _tags_ref0 (_tmp14_);
				tags = _tmp15_;
				{
					gint i = 0;
					i = 1;
					{
						gboolean _tmp16_ = FALSE;
						_tmp16_ = TRUE;
						while (TRUE) {
							GArray* _tmp18_;
							Tags* _tmp19_;
							GArray* _tmp20_;
							Node* _tmp21_;
							Tags* _tmp22_;
							Tags* _tmp23_;
							Tags* _tmp24_;
							if (!_tmp16_) {
								gint _tmp17_;
								_tmp17_ = i;
								i = _tmp17_ + 1;
							}
							_tmp16_ = FALSE;
							_tmp18_ = nodes;
							if (!(((guint) i) < _tmp18_->len)) {
								break;
							}
							_tmp19_ = tags;
							_tmp20_ = nodes;
							_tmp21_ = g_array_index (_tmp20_, Node*, (guint) 1);
							_tmp22_ = node_get_tags (_tmp21_);
							_tmp23_ = _tmp22_;
							_tmp24_ = tags_intersect (_tmp19_, _tmp23_);
							_tags_unref0 (tags);
							tags = _tmp24_;
						}
					}
				}
				_tmp25_ = self->priv->_editor;
				_tmp26_ = tags;
				tag_editor_show_selected_tags (_tmp25_, _tmp26_);
				_tags_unref0 (tags);
			}
		}
		_g_array_unref0 (nodes);
	}
}

void
tag_inspector_grab_first (TagInspector* self)
{
	TagEditor* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_editor;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	tag_inspector_current_changed (self);
}

static void
tag_inspector_class_init (TagInspectorClass * klass,
                          gpointer klass_data)
{
	tag_inspector_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TagInspector_private_offset);
	G_OBJECT_CLASS (klass)->finalize = tag_inspector_finalize;
	tag_inspector_signals[TAG_INSPECTOR_EDITABLE_CHANGED_SIGNAL] = g_signal_new ("editable-changed", TYPE_TAG_INSPECTOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	tag_inspector_signals[TAG_INSPECTOR_UPDATE_ICONS_SIGNAL] = g_signal_new ("update-icons", TYPE_TAG_INSPECTOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
tag_inspector_instance_init (TagInspector * self,
                             gpointer klass)
{
	self->priv = tag_inspector_get_instance_private (self);
	self->priv->_map = NULL;
}

static void
tag_inspector_finalize (GObject * obj)
{
	TagInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TAG_INSPECTOR, TagInspector);
	_mind_map_unref0 (self->priv->_map);
	_g_object_unref0 (self->priv->_editor);
	_g_object_unref0 (self->priv->_highlight_box);
	G_OBJECT_CLASS (tag_inspector_parent_class)->finalize (obj);
}

static GType
tag_inspector_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TagInspectorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tag_inspector_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TagInspector), 0, (GInstanceInitFunc) tag_inspector_instance_init, NULL };
	GType tag_inspector_type_id;
	tag_inspector_type_id = g_type_register_static (gtk_box_get_type (), "TagInspector", &g_define_type_info, 0);
	TagInspector_private_offset = g_type_add_instance_private (tag_inspector_type_id, sizeof (TagInspectorPrivate));
	return tag_inspector_type_id;
}

GType
tag_inspector_get_type (void)
{
	static volatile gsize tag_inspector_type_id__once = 0;
	if (g_once_init_enter (&tag_inspector_type_id__once)) {
		GType tag_inspector_type_id;
		tag_inspector_type_id = tag_inspector_get_type_once ();
		g_once_init_leave (&tag_inspector_type_id__once, tag_inspector_type_id);
	}
	return tag_inspector_type_id__once;
}

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

