/* ConnectionInspector.c generated by valac 0.56.19, the Vala compiler
 * generated from ConnectionInspector.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 <gtksourceview/gtksource.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.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_CONNECTION_INSPECTOR (connection_inspector_get_type ())
#define CONNECTION_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTION_INSPECTOR, ConnectionInspector))
#define CONNECTION_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTION_INSPECTOR, ConnectionInspectorClass))
#define IS_CONNECTION_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTION_INSPECTOR))
#define IS_CONNECTION_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTION_INSPECTOR))
#define CONNECTION_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTION_INSPECTOR, ConnectionInspectorClass))

typedef struct _ConnectionInspector ConnectionInspector;
typedef struct _ConnectionInspectorClass ConnectionInspectorClass;
typedef struct _ConnectionInspectorPrivate ConnectionInspectorPrivate;

#define TYPE_NOTE_VIEW (note_view_get_type ())
#define NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NOTE_VIEW, NoteView))
#define NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NOTE_VIEW, NoteViewClass))
#define IS_NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NOTE_VIEW))
#define IS_NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NOTE_VIEW))
#define NOTE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NOTE_VIEW, NoteViewClass))

typedef struct _NoteView NoteView;
typedef struct _NoteViewClass NoteViewClass;

#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_CONNECTION (connection_get_type ())
#define CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTION, Connection))
#define CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTION, ConnectionClass))
#define IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTION))
#define IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTION))
#define CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTION, ConnectionClass))

typedef struct _Connection Connection;
typedef struct _ConnectionClass ConnectionClass;
enum  {
	CONNECTION_INSPECTOR_0_PROPERTY,
	CONNECTION_INSPECTOR_NOTE_PROPERTY,
	CONNECTION_INSPECTOR_NUM_PROPERTIES
};
static GParamSpec* connection_inspector_properties[CONNECTION_INSPECTOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (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;

#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_UNICODE_INSERT (unicode_insert_get_type ())
#define UNICODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNICODE_INSERT, UnicodeInsert))
#define UNICODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNICODE_INSERT, UnicodeInsertClass))
#define IS_UNICODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNICODE_INSERT))
#define IS_UNICODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNICODE_INSERT))
#define UNICODE_INSERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNICODE_INSERT, UnicodeInsertClass))

typedef struct _UnicodeInsert UnicodeInsert;
typedef struct _UnicodeInsertClass UnicodeInsertClass;

#define TYPE_NODE_LINK (node_link_get_type ())
#define NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_LINK, NodeLink))
#define NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_LINK, NodeLinkClass))
#define IS_NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_LINK))
#define IS_NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_LINK))
#define NODE_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_LINK, NodeLinkClass))

typedef struct _NodeLink NodeLink;
typedef struct _NodeLinkClass NodeLinkClass;

#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_CONNECTION_NOTE (undo_connection_note_get_type ())
#define UNDO_CONNECTION_NOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_NOTE, UndoConnectionNote))
#define UNDO_CONNECTION_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_NOTE, UndoConnectionNoteClass))
#define IS_UNDO_CONNECTION_NOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_NOTE))
#define IS_UNDO_CONNECTION_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_NOTE))
#define UNDO_CONNECTION_NOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_NOTE, UndoConnectionNoteClass))

typedef struct _UndoConnectionNote UndoConnectionNote;
typedef struct _UndoConnectionNoteClass UndoConnectionNoteClass;

#define TYPE_NODE_LINKS (node_links_get_type ())
#define NODE_LINKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_LINKS, NodeLinks))
#define NODE_LINKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_LINKS, NodeLinksClass))
#define IS_NODE_LINKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_LINKS))
#define IS_NODE_LINKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_LINKS))
#define NODE_LINKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_LINKS, NodeLinksClass))

typedef struct _NodeLinks NodeLinks;
typedef struct _NodeLinksClass NodeLinksClass;
#define _node_link_unref0(var) ((var == NULL) ? NULL : (var = (node_link_unref (var), NULL)))
#define __vala_GdkRGBA_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL)))

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;
enum  {
	CONNECTION_INSPECTOR_EDITABLE_CHANGED_SIGNAL,
	CONNECTION_INSPECTOR_NUM_SIGNALS
};
static guint connection_inspector_signals[CONNECTION_INSPECTOR_NUM_SIGNALS] = {0};

struct _ConnectionInspector {
	GtkBox parent_instance;
	ConnectionInspectorPrivate * priv;
};

struct _ConnectionInspectorClass {
	GtkBoxClass parent_class;
};

struct _ConnectionInspectorPrivate {
	GtkScrolledWindow* _sw;
	GtkColorButton* _color;
	GtkButton* _reset;
	NoteView* _note;
	MindMap* _map;
	gchar* _orig_note;
	Connection* _connection;
};

static gint ConnectionInspector_private_offset;
static gpointer connection_inspector_parent_class = NULL;

VALA_EXTERN GType connection_inspector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ConnectionInspector, g_object_unref)
VALA_EXTERN GType note_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NoteView, 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 connection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Connection, 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 ConnectionInspector* connection_inspector_new (MainWindow* win);
VALA_EXTERN ConnectionInspector* connection_inspector_construct (GType object_type,
                                                     MainWindow* win);
static void connection_inspector_create_title (ConnectionInspector* self);
static void connection_inspector_create_color (ConnectionInspector* self);
static void connection_inspector_create_note (ConnectionInspector* self,
                                       MainWindow* win);
static void connection_inspector_create_buttons (ConnectionInspector* self);
static void connection_inspector_tab_changed (ConnectionInspector* self,
                                       MindMap* map);
static void _connection_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                                   MindMap* map,
                                                                   gpointer self);
static void connection_inspector_connection_changed (ConnectionInspector* self);
static void _connection_inspector_connection_changed_connection_inspector_editable_changed (ConnectionInspector* _sender,
                                                                                     gpointer self);
static void _connection_inspector_connection_changed_mind_map_current_changed (MindMap* _sender,
                                                                        MindMap* map,
                                                                        gpointer self);
VALA_EXTERN void connection_inspector_set_width (ConnectionInspector* self,
                                     gint width);
static void __lambda121_ (ConnectionInspector* self);
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 void map_model_change_current_connection_color (MapModel* self,
                                                GdkRGBA* color);
static void ___lambda121__gtk_color_button_color_set (GtkColorButton* _sender,
                                               gpointer self);
static void __lambda122_ (ConnectionInspector* self);
static void ___lambda122__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN NoteView* note_view_new (MainWindow* win);
VALA_EXTERN NoteView* note_view_construct (GType object_type,
                               MainWindow* win);
VALA_EXTERN gpointer unicode_insert_ref (gpointer instance);
VALA_EXTERN void unicode_insert_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_unicode_insert (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags);
VALA_EXTERN void value_set_unicode_insert (GValue* value,
                               gpointer v_object);
VALA_EXTERN void value_take_unicode_insert (GValue* value,
                                gpointer v_object);
VALA_EXTERN gpointer value_get_unicode_insert (const GValue* value);
VALA_EXTERN GType unicode_insert_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UnicodeInsert, unicode_insert_unref)
VALA_EXTERN void note_view_add_unicode_completion (NoteView* self,
                                       MainWindow* win,
                                       UnicodeInsert* unicoder);
VALA_EXTERN UnicodeInsert* main_window_get_unicoder (MainWindow* self);
static void connection_inspector_note_changed (ConnectionInspector* self);
static void _connection_inspector_note_changed_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                                 gpointer self);
static void connection_inspector_note_focus_in (ConnectionInspector* self);
static void _connection_inspector_note_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                           gpointer self);
static void connection_inspector_note_focus_out (ConnectionInspector* self);
static void _connection_inspector_note_focus_out_gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                            gpointer self);
VALA_EXTERN gpointer node_link_ref (gpointer instance);
VALA_EXTERN void node_link_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_link (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_node_link (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_node_link (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_node_link (const GValue* value);
VALA_EXTERN GType node_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeLink, node_link_unref)
static gint connection_inspector_note_node_link_added (ConnectionInspector* self,
                                                NodeLink* link,
                                                gchar** text);
static gint _connection_inspector_note_node_link_added_note_view_node_link_added (NoteView* _sender,
                                                                           NodeLink* link,
                                                                           gchar** text,
                                                                           gpointer self);
static void connection_inspector_note_node_link_clicked (ConnectionInspector* self,
                                                  gint id);
static void _connection_inspector_note_node_link_clicked_note_view_node_link_clicked (NoteView* _sender,
                                                                               gint id,
                                                                               gpointer self);
static void connection_inspector_note_node_link_hover (ConnectionInspector* self,
                                                gint id);
static void _connection_inspector_note_node_link_hover_note_view_node_link_hover (NoteView* _sender,
                                                                           gint id,
                                                                           gpointer self);
static void connection_inspector_connection_delete (ConnectionInspector* self);
static void _connection_inspector_connection_delete_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
VALA_EXTERN void map_model_change_current_connection_note (MapModel* self,
                                               const gchar* note);
VALA_EXTERN Connection* mind_map_get_current_connection (MindMap* self);
VALA_EXTERN void mind_map_unedit_text (MindMap* self);
VALA_EXTERN const gchar* connection_get_note (Connection* 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 UndoConnectionNote* undo_connection_note_new (Connection* c,
                                              const gchar* old_note);
VALA_EXTERN UndoConnectionNote* undo_connection_note_construct (GType object_type,
                                                    Connection* c,
                                                    const gchar* old_note);
VALA_EXTERN GType undo_connection_note_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionNote, g_object_unref)
VALA_EXTERN gint map_model_add_note_node_link (MapModel* self,
                                   NodeLink* link,
                                   gchar** text);
VALA_EXTERN void map_model_note_node_link_clicked (MapModel* self,
                                       gint id);
VALA_EXTERN gpointer node_links_ref (gpointer instance);
VALA_EXTERN void node_links_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_links (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_node_links (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_node_links (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_node_links (const GValue* value);
VALA_EXTERN GType node_links_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeLinks, node_links_unref)
VALA_EXTERN NodeLinks* map_model_get_node_links (MapModel* self);
VALA_EXTERN NodeLink* node_links_get_node_link (NodeLinks* self,
                                    gint id);
VALA_EXTERN void note_view_show_tooltip (NoteView* self,
                             const gchar* tooltip);
VALA_EXTERN gchar* node_link_get_tooltip (NodeLink* self,
                              MindMap* map);
VALA_EXTERN void map_model_delete_connection (MapModel* self);
VALA_EXTERN void connection_inspector_grab_note (ConnectionInspector* self);
VALA_EXTERN GdkRGBA* connection_get_color (Connection* self);
static GdkRGBA* _vala_GdkRGBA_copy (GdkRGBA* self);
static void _vala_GdkRGBA_free (GdkRGBA* self);
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
VALA_EXTERN Theme* mind_map_get_theme (MindMap* self);
VALA_EXTERN GdkRGBA* theme_get_color (Theme* self,
                          const gchar* name);
VALA_EXTERN gboolean mind_map_get_editable (MindMap* self);
VALA_EXTERN void connection_inspector_grab_first (ConnectionInspector* self);
VALA_EXTERN NoteView* connection_inspector_get_note (ConnectionInspector* self);
static void connection_inspector_finalize (GObject * obj);
static GType connection_inspector_get_type_once (void);
static void _vala_connection_inspector_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
connection_inspector_get_instance_private (ConnectionInspector* self)
{
	return G_STRUCT_MEMBER_P (self, ConnectionInspector_private_offset);
}

static void
_connection_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                              MindMap* map,
                                                              gpointer self)
{
	connection_inspector_tab_changed ((ConnectionInspector*) self, map);
}

static void
_connection_inspector_connection_changed_connection_inspector_editable_changed (ConnectionInspector* _sender,
                                                                                gpointer self)
{
	connection_inspector_connection_changed ((ConnectionInspector*) self);
}

ConnectionInspector*
connection_inspector_construct (GType object_type,
                                MainWindow* win)
{
	ConnectionInspector * self = NULL;
	g_return_val_if_fail (win != NULL, NULL);
	self = (ConnectionInspector*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 10, NULL);
	connection_inspector_create_title (self);
	connection_inspector_create_color (self);
	connection_inspector_create_note (self, win);
	connection_inspector_create_buttons (self);
	g_signal_connect_object (win, "canvas-changed", (GCallback) _connection_inspector_tab_changed_main_window_canvas_changed, self, 0);
	g_signal_connect_object (self, "editable-changed", (GCallback) _connection_inspector_connection_changed_connection_inspector_editable_changed, self, 0);
	return self;
}

ConnectionInspector*
connection_inspector_new (MainWindow* win)
{
	return connection_inspector_construct (TYPE_CONNECTION_INSPECTOR, win);
}

static void
_connection_inspector_connection_changed_mind_map_current_changed (MindMap* _sender,
                                                                   MindMap* map,
                                                                   gpointer self)
{
	connection_inspector_connection_changed ((ConnectionInspector*) self);
}

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

static void
connection_inspector_tab_changed (ConnectionInspector* self,
                                  MindMap* map)
{
	MindMap* _tmp0_;
	MindMap* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		MindMap* _tmp1_;
		guint _tmp2_;
		_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) _connection_inspector_connection_changed_mind_map_current_changed, self);
	}
	_tmp3_ = _mind_map_ref0 (map);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp3_;
	if (map != NULL) {
		g_signal_connect_object (map, "current-changed", (GCallback) _connection_inspector_connection_changed_mind_map_current_changed, self, 0);
	}
}

void
connection_inspector_set_width (ConnectionInspector* self,
                                gint width)
{
	GtkScrolledWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sw;
	g_object_set ((GtkWidget*) _tmp0_, "width-request", width, NULL);
}

static void
connection_inspector_create_title (ConnectionInspector* self)
{
	GtkLabel* title = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkLabel* _tmp4_ = NULL;
	GtkLabel* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strconcat ("<big>", _ ("Connection"), NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, "</big>", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	gtk_label_set_use_markup (_tmp4_, TRUE);
	gtk_label_set_justify (_tmp4_, GTK_JUSTIFY_CENTER);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	title = _tmp5_;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) title);
	_g_object_unref0 (title);
}

static void
__lambda121_ (ConnectionInspector* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	GtkColorButton* _tmp3_;
	GdkRGBA _tmp4_ = {0};
	GdkRGBA _tmp5_;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_color;
	gtk_color_chooser_get_rgba ((GtkColorChooser*) _tmp3_, &_tmp4_);
	_tmp5_ = _tmp4_;
	map_model_change_current_connection_color (_tmp2_, &_tmp5_);
}

static void
___lambda121__gtk_color_button_color_set (GtkColorButton* _sender,
                                          gpointer self)
{
	__lambda121_ ((ConnectionInspector*) self);
}

static void
__lambda122_ (ConnectionInspector* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	map_model_change_current_connection_color (_tmp2_, NULL);
}

static void
___lambda122__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda122_ ((ConnectionInspector*) self);
}

static void
connection_inspector_create_color (ConnectionInspector* self)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_ = NULL;
	GtkColorButton* _tmp1_ = NULL;
	GtkColorButton* _tmp2_;
	gchar* _tmp3_;
	GtkButton* _tmp4_ = NULL;
	GtkButton* _tmp5_;
	GtkBox* bbox = NULL;
	GtkBox* _tmp6_ = NULL;
	GtkColorButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkBox* box = NULL;
	GtkBox* _tmp9_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Color"));
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_START);
	gtk_label_set_xalign (_tmp0_, (gfloat) 0);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "titled");
	_tmp1_ = (GtkColorButton*) gtk_color_button_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->_color);
	self->priv->_color = _tmp1_;
	_tmp2_ = self->priv->_color;
	g_signal_connect_object (_tmp2_, "color-set", (GCallback) ___lambda121__gtk_color_button_color_set, self, 0);
	_tmp3_ = g_strdup (_ ("Use Theme Default Color"));
	_tmp4_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->_reset);
	self->priv->_reset = _tmp4_;
	_tmp5_ = self->priv->_reset;
	g_signal_connect_object (_tmp5_, "clicked", (GCallback) ___lambda122__gtk_button_clicked, self, 0);
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp6_);
	bbox = _tmp6_;
	_tmp7_ = self->priv->_color;
	gtk_box_append (bbox, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->_reset;
	gtk_box_append (bbox, (GtkWidget*) _tmp8_);
	_tmp9_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_set_homogeneous (_tmp9_, TRUE);
	g_object_ref_sink (_tmp9_);
	box = _tmp9_;
	gtk_box_append (box, (GtkWidget*) lbl);
	gtk_box_append (box, (GtkWidget*) bbox);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) box);
	_g_object_unref0 (box);
	_g_object_unref0 (bbox);
	_g_object_unref0 (lbl);
}

static void
_connection_inspector_note_changed_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                            gpointer self)
{
	connection_inspector_note_changed ((ConnectionInspector*) self);
}

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

static void
_connection_inspector_note_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                      gpointer self)
{
	connection_inspector_note_focus_in ((ConnectionInspector*) self);
}

static void
_connection_inspector_note_focus_out_gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                       gpointer self)
{
	connection_inspector_note_focus_out ((ConnectionInspector*) self);
}

static gint
_connection_inspector_note_node_link_added_note_view_node_link_added (NoteView* _sender,
                                                                      NodeLink* link,
                                                                      gchar** text,
                                                                      gpointer self)
{
	gint result;
	result = connection_inspector_note_node_link_added ((ConnectionInspector*) self, link, text);
	return result;
}

static void
_connection_inspector_note_node_link_clicked_note_view_node_link_clicked (NoteView* _sender,
                                                                          gint id,
                                                                          gpointer self)
{
	connection_inspector_note_node_link_clicked ((ConnectionInspector*) self, id);
}

static void
_connection_inspector_note_node_link_hover_note_view_node_link_hover (NoteView* _sender,
                                                                      gint id,
                                                                      gpointer self)
{
	connection_inspector_note_node_link_hover ((ConnectionInspector*) self, id);
}

static void
connection_inspector_create_note (ConnectionInspector* self,
                                  MainWindow* win)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_ = NULL;
	NoteView* _tmp1_ = NULL;
	NoteView* _tmp2_;
	UnicodeInsert* _tmp3_;
	UnicodeInsert* _tmp4_;
	NoteView* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextBuffer* _tmp7_;
	NoteView* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextBuffer* _tmp10_;
	GtkEventControllerFocus* focus = NULL;
	GtkEventControllerFocus* _tmp11_;
	NoteView* _tmp12_;
	GtkEventController* _tmp13_;
	NoteView* _tmp14_;
	NoteView* _tmp15_;
	NoteView* _tmp16_;
	NoteView* _tmp17_;
	GtkWidget* _tmp18_;
	GtkScrolledWindow* _tmp19_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp20_ = NULL;
	GtkScrolledWindow* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (win != NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Note"));
	gtk_widget_set_valign ((GtkWidget*) _tmp0_, GTK_ALIGN_START);
	gtk_label_set_xalign (_tmp0_, (gfloat) 0);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "titled");
	_tmp1_ = note_view_new (win);
	gtk_widget_set_valign ((GtkWidget*) _tmp1_, GTK_ALIGN_FILL);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_text_view_set_wrap_mode ((GtkTextView*) _tmp1_, GTK_WRAP_WORD);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->_note);
	self->priv->_note = _tmp1_;
	_tmp2_ = self->priv->_note;
	_tmp3_ = main_window_get_unicoder (win);
	_tmp4_ = _tmp3_;
	note_view_add_unicode_completion (_tmp2_, win, _tmp4_);
	_tmp5_ = self->priv->_note;
	_tmp6_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp5_);
	_tmp7_ = _tmp6_;
	g_object_set (_tmp7_, "text", "", NULL);
	_tmp8_ = self->priv->_note;
	_tmp9_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp8_);
	_tmp10_ = _tmp9_;
	g_signal_connect_object (_tmp10_, "changed", (GCallback) _connection_inspector_note_changed_gtk_text_buffer_changed, self, 0);
	_tmp11_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus = _tmp11_;
	_tmp12_ = self->priv->_note;
	_tmp13_ = _g_object_ref0 ((GtkEventController*) focus);
	gtk_widget_add_controller ((GtkWidget*) _tmp12_, _tmp13_);
	g_signal_connect_object (focus, "enter", (GCallback) _connection_inspector_note_focus_in_gtk_event_controller_focus_enter, self, 0);
	g_signal_connect_object (focus, "leave", (GCallback) _connection_inspector_note_focus_out_gtk_event_controller_focus_leave, self, 0);
	_tmp14_ = self->priv->_note;
	g_signal_connect_object (_tmp14_, "node-link-added", (GCallback) _connection_inspector_note_node_link_added_note_view_node_link_added, self, 0);
	_tmp15_ = self->priv->_note;
	g_signal_connect_object (_tmp15_, "node-link-clicked", (GCallback) _connection_inspector_note_node_link_clicked_note_view_node_link_clicked, self, 0);
	_tmp16_ = self->priv->_note;
	g_signal_connect_object (_tmp16_, "node-link-hover", (GCallback) _connection_inspector_note_node_link_hover_note_view_node_link_hover, self, 0);
	_tmp17_ = self->priv->_note;
	_tmp18_ = _g_object_ref0 ((GtkWidget*) _tmp17_);
	_tmp19_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp19_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp19_, GTK_ALIGN_FILL);
	gtk_scrolled_window_set_min_content_width (_tmp19_, 300);
	gtk_scrolled_window_set_min_content_height (_tmp19_, 100);
	gtk_scrolled_window_set_child (_tmp19_, _tmp18_);
	_g_object_unref0 (_tmp18_);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->_sw);
	self->priv->_sw = _tmp19_;
	_tmp20_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	gtk_widget_set_halign ((GtkWidget*) _tmp20_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp20_, GTK_ALIGN_FILL);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp20_, 5);
	g_object_ref_sink (_tmp20_);
	box = _tmp20_;
	gtk_box_append (box, (GtkWidget*) lbl);
	_tmp21_ = self->priv->_sw;
	gtk_box_append (box, (GtkWidget*) _tmp21_);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) box);
	_g_object_unref0 (box);
	_g_object_unref0 (focus);
	_g_object_unref0 (lbl);
}

static void
_connection_inspector_connection_delete_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	connection_inspector_connection_delete ((ConnectionInspector*) self);
}

static void
connection_inspector_create_buttons (ConnectionInspector* self)
{
	GtkGrid* grid = NULL;
	GtkGrid* _tmp0_ = NULL;
	GtkButton* del_btn = NULL;
	gchar* _tmp1_;
	GtkButton* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_homogeneous (_tmp0_, TRUE);
	gtk_grid_set_column_spacing (_tmp0_, 5);
	g_object_ref_sink (_tmp0_);
	grid = _tmp0_;
	_tmp1_ = g_strdup (_ ("Delete Connection"));
	_tmp2_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-delete-symbolic");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_ref_sink (_tmp2_);
	del_btn = _tmp2_;
	g_signal_connect_object (del_btn, "clicked", (GCallback) _connection_inspector_connection_delete_gtk_button_clicked, self, 0);
	gtk_grid_attach (grid, (GtkWidget*) del_btn, 0, 0, 1, 1);
	_g_object_unref0 (del_btn);
	_g_object_unref0 (grid);
}

static void
connection_inspector_note_changed (ConnectionInspector* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	NoteView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_note;
	_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp3_);
	_tmp5_ = _tmp4_;
	g_object_get (_tmp5_, "text", &_tmp6_, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	map_model_change_current_connection_note (_tmp2_, _tmp8_);
	_g_free0 (_tmp8_);
}

static void
connection_inspector_note_focus_in (ConnectionInspector* self)
{
	MindMap* _tmp0_;
	Connection* _tmp1_;
	NoteView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	MindMap* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_connection (_tmp0_);
	_g_object_unref0 (self->priv->_connection);
	self->priv->_connection = _tmp1_;
	_tmp2_ = self->priv->_note;
	_tmp3_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp2_);
	_tmp4_ = _tmp3_;
	g_object_get (_tmp4_, "text", &_tmp5_, NULL);
	_tmp6_ = _tmp5_;
	_g_free0 (self->priv->_orig_note);
	self->priv->_orig_note = _tmp6_;
	_tmp7_ = self->priv->_map;
	mind_map_unedit_text (_tmp7_);
}

static void
connection_inspector_note_focus_out (ConnectionInspector* self)
{
	gboolean _tmp0_ = FALSE;
	Connection* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_connection;
	if (_tmp1_ != NULL) {
		Connection* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = self->priv->_connection;
		_tmp3_ = connection_get_note (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->_orig_note;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp5_) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		MindMap* _tmp6_;
		Connection* _tmp7_;
		const gchar* _tmp8_;
		UndoConnectionNote* _tmp9_;
		UndoConnectionNote* _tmp10_;
		_tmp6_ = self->priv->_map;
		_tmp7_ = self->priv->_connection;
		_tmp8_ = self->priv->_orig_note;
		_tmp9_ = undo_connection_note_new (_tmp7_, _tmp8_);
		_tmp10_ = _tmp9_;
		mind_map_add_undo (_tmp6_, (UndoItem*) _tmp10_);
		_g_object_unref0 (_tmp10_);
	}
}

static gint
connection_inspector_note_node_link_added (ConnectionInspector* self,
                                           NodeLink* link,
                                           gchar** text)
{
	gchar* _vala_text = NULL;
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	gchar* _tmp3_ = NULL;
	gint _tmp4_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (link != NULL, -1);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp4_ = map_model_add_note_node_link (_tmp2_, link, &_tmp3_);
	_g_free0 (_vala_text);
	_vala_text = _tmp3_;
	result = _tmp4_;
	if (text) {
		*text = _vala_text;
	} else {
		_g_free0 (_vala_text);
	}
	return result;
}

static void
connection_inspector_note_node_link_clicked (ConnectionInspector* self,
                                             gint id)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	map_model_note_node_link_clicked (_tmp2_, id);
}

static void
connection_inspector_note_node_link_hover (ConnectionInspector* self,
                                           gint id)
{
	NodeLink* link = NULL;
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	NodeLinks* _tmp3_;
	NodeLinks* _tmp4_;
	NodeLink* _tmp5_;
	NodeLink* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = map_model_get_node_links (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = node_links_get_node_link (_tmp4_, id);
	link = _tmp5_;
	_tmp6_ = link;
	if (_tmp6_ != NULL) {
		NoteView* _tmp7_;
		NodeLink* _tmp8_;
		MindMap* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp7_ = self->priv->_note;
		_tmp8_ = link;
		_tmp9_ = self->priv->_map;
		_tmp10_ = node_link_get_tooltip (_tmp8_, _tmp9_);
		_tmp11_ = _tmp10_;
		note_view_show_tooltip (_tmp7_, _tmp11_);
		_g_free0 (_tmp11_);
	}
	_node_link_unref0 (link);
}

static void
connection_inspector_connection_delete (ConnectionInspector* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	map_model_delete_connection (_tmp2_);
}

void
connection_inspector_grab_note (ConnectionInspector* self)
{
	NoteView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_note;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

static GdkRGBA*
_vala_GdkRGBA_copy (GdkRGBA* self)
{
	return g_boxed_copy (gdk_rgba_get_type (), self);
}

static gpointer
__vala_GdkRGBA_copy0 (gpointer self)
{
	return self ? _vala_GdkRGBA_copy (self) : NULL;
}

static void
_vala_GdkRGBA_free (GdkRGBA* self)
{
	g_boxed_free (gdk_rgba_get_type (), self);
}

static void
connection_inspector_connection_changed (ConnectionInspector* self)
{
	Connection* current = NULL;
	MindMap* _tmp0_;
	Connection* _tmp1_;
	Connection* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_connection (_tmp0_);
	current = _tmp1_;
	_tmp2_ = current;
	if (_tmp2_ != NULL) {
		gchar* note = NULL;
		Connection* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		GdkRGBA* _tmp7_ = NULL;
		Connection* _tmp8_;
		GdkRGBA* _tmp9_;
		GdkRGBA* _tmp10_;
		GtkColorButton* _tmp19_;
		GdkRGBA _tmp20_;
		GtkColorButton* _tmp21_;
		MindMap* _tmp22_;
		gboolean _tmp23_;
		gboolean _tmp24_;
		NoteView* _tmp25_;
		GtkTextBuffer* _tmp26_;
		GtkTextBuffer* _tmp27_;
		const gchar* _tmp28_;
		NoteView* _tmp29_;
		MindMap* _tmp30_;
		gboolean _tmp31_;
		gboolean _tmp32_;
		gboolean _tmp33_ = FALSE;
		Connection* _tmp34_;
		GdkRGBA* _tmp35_;
		GdkRGBA* _tmp36_;
		GtkButton* _tmp40_;
		_tmp3_ = current;
		_tmp4_ = connection_get_note (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup (_tmp5_);
		note = _tmp6_;
		_tmp8_ = current;
		_tmp9_ = connection_get_color (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ != NULL) {
			Connection* _tmp11_;
			GdkRGBA* _tmp12_;
			GdkRGBA* _tmp13_;
			GdkRGBA* _tmp14_;
			_tmp11_ = current;
			_tmp12_ = connection_get_color (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = __vala_GdkRGBA_copy0 (_tmp13_);
			__vala_GdkRGBA_free0 (_tmp7_);
			_tmp7_ = _tmp14_;
		} else {
			MindMap* _tmp15_;
			Theme* _tmp16_;
			Theme* _tmp17_;
			GdkRGBA* _tmp18_;
			_tmp15_ = self->priv->_map;
			_tmp16_ = mind_map_get_theme (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = theme_get_color (_tmp17_, "connection_background");
			__vala_GdkRGBA_free0 (_tmp7_);
			_tmp7_ = _tmp18_;
			_g_object_unref0 (_tmp17_);
		}
		_tmp19_ = self->priv->_color;
		_tmp20_ = *_tmp7_;
		gtk_color_chooser_set_rgba ((GtkColorChooser*) _tmp19_, &_tmp20_);
		_tmp21_ = self->priv->_color;
		_tmp22_ = self->priv->_map;
		_tmp23_ = mind_map_get_editable (_tmp22_);
		_tmp24_ = _tmp23_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp21_, _tmp24_);
		_tmp25_ = self->priv->_note;
		_tmp26_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = note;
		g_object_set (_tmp27_, "text", _tmp28_, NULL);
		_tmp29_ = self->priv->_note;
		_tmp30_ = self->priv->_map;
		_tmp31_ = mind_map_get_editable (_tmp30_);
		_tmp32_ = _tmp31_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp29_, _tmp32_);
		_tmp34_ = current;
		_tmp35_ = connection_get_color (_tmp34_);
		_tmp36_ = _tmp35_;
		if (_tmp36_ != NULL) {
			MindMap* _tmp37_;
			gboolean _tmp38_;
			gboolean _tmp39_;
			_tmp37_ = self->priv->_map;
			_tmp38_ = mind_map_get_editable (_tmp37_);
			_tmp39_ = _tmp38_;
			_tmp33_ = _tmp39_;
		} else {
			_tmp33_ = FALSE;
		}
		_tmp40_ = self->priv->_reset;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp40_, _tmp33_);
		__vala_GdkRGBA_free0 (_tmp7_);
		_g_free0 (note);
	}
	_g_object_unref0 (current);
}

void
connection_inspector_grab_first (ConnectionInspector* self)
{
	GtkColorButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_color;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

NoteView*
connection_inspector_get_note (ConnectionInspector* self)
{
	NoteView* result;
	NoteView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_note;
	result = _tmp0_;
	return result;
}

static void
connection_inspector_class_init (ConnectionInspectorClass * klass,
                                 gpointer klass_data)
{
	connection_inspector_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ConnectionInspector_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_connection_inspector_get_property;
	G_OBJECT_CLASS (klass)->finalize = connection_inspector_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONNECTION_INSPECTOR_NOTE_PROPERTY, connection_inspector_properties[CONNECTION_INSPECTOR_NOTE_PROPERTY] = g_param_spec_object ("note", "note", "note", TYPE_NOTE_VIEW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	connection_inspector_signals[CONNECTION_INSPECTOR_EDITABLE_CHANGED_SIGNAL] = g_signal_new ("editable-changed", TYPE_CONNECTION_INSPECTOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
connection_inspector_instance_init (ConnectionInspector * self,
                                    gpointer klass)
{
	gchar* _tmp0_;
	self->priv = connection_inspector_get_instance_private (self);
	self->priv->_map = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->_orig_note = _tmp0_;
	self->priv->_connection = NULL;
}

static void
connection_inspector_finalize (GObject * obj)
{
	ConnectionInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CONNECTION_INSPECTOR, ConnectionInspector);
	_g_object_unref0 (self->priv->_sw);
	_g_object_unref0 (self->priv->_color);
	_g_object_unref0 (self->priv->_reset);
	_g_object_unref0 (self->priv->_note);
	_mind_map_unref0 (self->priv->_map);
	_g_free0 (self->priv->_orig_note);
	_g_object_unref0 (self->priv->_connection);
	G_OBJECT_CLASS (connection_inspector_parent_class)->finalize (obj);
}

static GType
connection_inspector_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ConnectionInspectorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) connection_inspector_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ConnectionInspector), 0, (GInstanceInitFunc) connection_inspector_instance_init, NULL };
	GType connection_inspector_type_id;
	connection_inspector_type_id = g_type_register_static (gtk_box_get_type (), "ConnectionInspector", &g_define_type_info, 0);
	ConnectionInspector_private_offset = g_type_add_instance_private (connection_inspector_type_id, sizeof (ConnectionInspectorPrivate));
	return connection_inspector_type_id;
}

GType
connection_inspector_get_type (void)
{
	static volatile gsize connection_inspector_type_id__once = 0;
	if (g_once_init_enter (&connection_inspector_type_id__once)) {
		GType connection_inspector_type_id;
		connection_inspector_type_id = connection_inspector_get_type_once ();
		g_once_init_leave (&connection_inspector_type_id__once, connection_inspector_type_id);
	}
	return connection_inspector_type_id__once;
}

static void
_vala_connection_inspector_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	ConnectionInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CONNECTION_INSPECTOR, ConnectionInspector);
	switch (property_id) {
		case CONNECTION_INSPECTOR_NOTE_PROPERTY:
		g_value_set_object (value, connection_inspector_get_note (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

