/* QuickEntry.c generated by valac 0.56.19, the Vala compiler
 * generated from QuickEntry.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 <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <granite-7.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_QUICK_ENTRY (quick_entry_get_type ())
#define QUICK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUICK_ENTRY, QuickEntry))
#define QUICK_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUICK_ENTRY, QuickEntryClass))
#define IS_QUICK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUICK_ENTRY))
#define IS_QUICK_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUICK_ENTRY))
#define QUICK_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUICK_ENTRY, QuickEntryClass))

typedef struct _QuickEntry QuickEntry;
typedef struct _QuickEntryClass QuickEntryClass;
typedef struct _QuickEntryPrivate QuickEntryPrivate;

#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_NODE_HIER (node_hier_get_type ())
#define NODE_HIER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_HIER, NodeHier))
#define NODE_HIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_HIER, NodeHierClass))
#define IS_NODE_HIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_HIER))
#define IS_NODE_HIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_HIER))
#define NODE_HIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_HIER, NodeHierClass))

typedef struct _NodeHier NodeHier;
typedef struct _NodeHierClass NodeHierClass;

#define TYPE_EXPORT (export_get_type ())
#define EXPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORT, Export))
#define EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORT, ExportClass))
#define IS_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORT))
#define IS_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORT))
#define EXPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORT, ExportClass))

typedef struct _Export Export;
typedef struct _ExportClass ExportClass;

#define TYPE_EXPORT_TEXT (export_text_get_type ())
#define EXPORT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORT_TEXT, ExportText))
#define EXPORT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORT_TEXT, ExportTextClass))
#define IS_EXPORT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORT_TEXT))
#define IS_EXPORT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORT_TEXT))
#define EXPORT_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORT_TEXT, ExportTextClass))

typedef struct _ExportText ExportText;
typedef struct _ExportTextClass ExportTextClass;
enum  {
	QUICK_ENTRY_0_PROPERTY,
	QUICK_ENTRY_NUM_PROPERTIES
};
static GParamSpec* quick_entry_properties[QUICK_ENTRY_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 _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _export_unref0(var) ((var == NULL) ? NULL : (var = (export_unref (var), NULL)))
typedef struct _Block60Data Block60Data;

#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_EXPORTS (exports_get_type ())
#define EXPORTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORTS, Exports))
#define EXPORTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORTS, ExportsClass))
#define IS_EXPORTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORTS))
#define IS_EXPORTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORTS))
#define EXPORTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORTS, ExportsClass))

typedef struct _Exports Exports;
typedef struct _ExportsClass ExportsClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _NodeHierPrivate NodeHierPrivate;

#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 _node_hier_unref0(var) ((var == NULL) ? NULL : (var = (node_hier_unref (var), NULL)))

#define TYPE_NODE_IMAGE (node_image_get_type ())
#define NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_IMAGE, NodeImage))
#define NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_IMAGE, NodeImageClass))
#define IS_NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_IMAGE))
#define IS_NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_IMAGE))
#define NODE_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_IMAGE, NodeImageClass))

typedef struct _NodeImage NodeImage;
typedef struct _NodeImageClass NodeImageClass;

#define TYPE_IMAGE_MANAGER (image_manager_get_type ())
#define IMAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IMAGE_MANAGER, ImageManager))
#define IMAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IMAGE_MANAGER, ImageManagerClass))
#define IS_IMAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IMAGE_MANAGER))
#define IS_IMAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IMAGE_MANAGER))
#define IMAGE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IMAGE_MANAGER, ImageManagerClass))

typedef struct _ImageManager ImageManager;
typedef struct _ImageManagerClass ImageManagerClass;
#define _node_image_unref0(var) ((var == NULL) ? NULL : (var = (node_image_unref (var), NULL)))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define __vala_GtkTextIter_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTextIter_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;

struct _QuickEntry {
	GtkWindow parent_instance;
	QuickEntryPrivate * priv;
};

struct _QuickEntryClass {
	GtkWindowClass parent_class;
};

struct _QuickEntryPrivate {
	MindMap* _map;
	GtkTextView* _entry;
	GtkButton* _apply;
	GArray* _node_stack;
	ExportText* _export;
};

struct _Block60Data {
	int _ref_count_;
	QuickEntry* self;
	GtkLabel* help_node0;
	GtkLabel* help_node1;
	GtkRevealer* helprev;
};

struct _NodeHier {
	GTypeInstance parent_instance;
	volatile int ref_count;
	NodeHierPrivate * priv;
	gint spaces;
	Node* node;
	gboolean in_sequence;
	gint first_line;
	gint last_line;
};

struct _NodeHierClass {
	GTypeClass parent_class;
	void (*finalize) (NodeHier *self);
};

static gint QuickEntry_private_offset;
static gpointer quick_entry_parent_class = NULL;

VALA_EXTERN GType quick_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (QuickEntry, 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 gpointer node_hier_ref (gpointer instance);
VALA_EXTERN void node_hier_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_hier (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_node_hier (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_node_hier (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_node_hier (const GValue* value);
VALA_EXTERN GType node_hier_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeHier, node_hier_unref)
VALA_EXTERN gpointer export_ref (gpointer instance);
VALA_EXTERN void export_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_export (const gchar* name,
                               const gchar* nick,
                               const gchar* blurb,
                               GType object_type,
                               GParamFlags flags);
VALA_EXTERN void value_set_export (GValue* value,
                       gpointer v_object);
VALA_EXTERN void value_take_export (GValue* value,
                        gpointer v_object);
VALA_EXTERN gpointer value_get_export (const GValue* value);
VALA_EXTERN GType export_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Export, export_unref)
VALA_EXTERN GType export_text_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ExportText, export_unref)
VALA_EXTERN QuickEntry* quick_entry_new (MindMap* map,
                             gboolean replace,
                             GSettings* settings);
VALA_EXTERN QuickEntry* quick_entry_construct (GType object_type,
                                   MindMap* map,
                                   gboolean replace,
                                   GSettings* settings);
static Block60Data* block60_data_ref (Block60Data* _data60_);
static void block60_data_unref (void * _userdata_);
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN MainWindow* mind_map_get_win (MindMap* self);
VALA_EXTERN gpointer exports_ref (gpointer instance);
VALA_EXTERN void exports_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_exports (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags);
VALA_EXTERN void value_set_exports (GValue* value,
                        gpointer v_object);
VALA_EXTERN void value_take_exports (GValue* value,
                         gpointer v_object);
VALA_EXTERN gpointer value_get_exports (const GValue* value);
VALA_EXTERN GType exports_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Exports, exports_unref)
VALA_EXTERN Exports* main_window_get_exports (MainWindow* self);
VALA_EXTERN Export* exports_get_by_name (Exports* self,
                             const gchar* name);
static gboolean quick_entry_on_keypress (QuickEntry* self,
                                  guint keyval,
                                  guint keycode,
                                  GdkModifierType state);
static gboolean _quick_entry_on_keypress_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                        guint keyval,
                                                                        guint keycode,
                                                                        GdkModifierType state,
                                                                        gpointer self);
static GdkDragAction quick_entry_handle_drag_motion (QuickEntry* self,
                                              gdouble x,
                                              gdouble y);
static GdkDragAction _quick_entry_handle_drag_motion_gtk_drop_target_motion (GtkDropTarget* _sender,
                                                                      gdouble x,
                                                                      gdouble y,
                                                                      gpointer self);
static gboolean quick_entry_handle_drop (QuickEntry* self,
                                  GValue* val,
                                  gdouble x,
                                  gdouble y);
static gboolean _quick_entry_handle_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                        GValue* value,
                                                        gdouble x,
                                                        gdouble y,
                                                        gpointer self);
static void quick_entry_handle_text_insertion (QuickEntry* self,
                                        GtkTextIter* pos,
                                        const gchar* new_text,
                                        gint new_text_length);
static void _quick_entry_handle_text_insertion_gtk_text_buffer_insert_text (GtkTextBuffer* _sender,
                                                                     GtkTextIter* pos,
                                                                     const gchar* new_text,
                                                                     gint new_text_length,
                                                                     gpointer self);
VALA_EXTERN void utils_color_from_string (const gchar* value,
                              GdkRGBA* result);
static GtkLabel* quick_entry_make_help_label (QuickEntry* self,
                                       const gchar* str);
static void __lambda93_ (Block60Data* _data60_);
static void ___lambda93__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void ___lambda94_ (Block60Data* _data60_);
static gboolean quick_entry_handle_replace (QuickEntry* self);
static void ____lambda94__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN gboolean mind_map_is_node_selected (MindMap* self);
static void ___lambda95_ (Block60Data* _data60_);
static gboolean quick_entry_handle_insert (QuickEntry* self);
static void ____lambda95__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda96_ (QuickEntry* self);
static void ___lambda96__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void quick_entry_real_size_allocate (GtkWidget* base,
                                     gint width,
                                     gint height,
                                     gint baseline);
static void quick_entry_clear_node_tag (QuickEntry* self);
static void _node_hier_unref0_ (gpointer var);
static void _vala_NodeHier_free_function_content_of (gpointer data);
VALA_EXTERN gboolean export_text_parse_text (ExportText* self,
                                 MindMap* map,
                                 const gchar* txt,
                                 gint tab_spaces,
                                 GArray* stack);
VALA_EXTERN GSettings* mind_map_get_settings (MindMap* self);
VALA_EXTERN NodeHier* export_text_get_node_at_line (ExportText* self,
                                        GArray* stack,
                                        gint current_line);
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
VALA_EXTERN gpointer node_image_ref (gpointer instance);
VALA_EXTERN void node_image_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_image (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_node_image (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_node_image (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_node_image (const GValue* value);
VALA_EXTERN GType node_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeImage, node_image_unref)
VALA_EXTERN gpointer image_manager_ref (gpointer instance);
VALA_EXTERN void image_manager_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_image_manager (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void value_set_image_manager (GValue* value,
                              gpointer v_object);
VALA_EXTERN void value_take_image_manager (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer value_get_image_manager (const GValue* value);
VALA_EXTERN GType image_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ImageManager, image_manager_unref)
VALA_EXTERN ImageManager* mind_map_get_image_manager (MindMap* self);
VALA_EXTERN NodeImage* node_image_new_from_uri (ImageManager* im,
                                    const gchar* uri,
                                    gint width);
VALA_EXTERN NodeImage* node_image_construct_from_uri (GType object_type,
                                          ImageManager* im,
                                          const gchar* uri,
                                          gint width);
VALA_EXTERN void node_set_image (Node* self,
                     ImageManager* im,
                     NodeImage* ni);
VALA_EXTERN gchar* export_text_export_node (ExportText* self,
                                MindMap* map,
                                Node* node,
                                const gchar* prefix);
static gchar* quick_entry_get_line_text (QuickEntry* self,
                                  gint adjust);
static gchar* quick_entry_get_start_to_current_text (QuickEntry* self);
static gboolean quick_entry_get_whitespace (QuickEntry* self,
                                     const gchar* line,
                                     gchar** wspace);
static gboolean quick_entry_is_node_line (QuickEntry* self,
                                   const gchar* line);
static gboolean quick_entry_is_blank_line (QuickEntry* self,
                                    const gchar* line);
static gchar* quick_entry_tabs_to_spaces (QuickEntry* self,
                                   const gchar* wspace);
static gchar* quick_entry_align_to_tab (QuickEntry* self,
                                 const gchar* wspace);
static void quick_entry_delete_whitespace (QuickEntry* self,
                                    const gchar* ins_text);
static void _vala_GtkTextIter_free (GtkTextIter* self);
static gboolean quick_entry_handle_space (QuickEntry* self);
static gboolean quick_entry_handle_return (QuickEntry* self,
                                    gboolean control);
static gboolean quick_entry_handle_tab (QuickEntry* self,
                                 gboolean shift);
static gboolean quick_entry_handle_printable (QuickEntry* self,
                                       const gchar* str);
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 gboolean map_model_insert_text_as_node (MapModel* self,
                                        Node* node,
                                        const gchar* text);
VALA_EXTERN Node* mind_map_get_current_node (MindMap* self);
VALA_EXTERN gboolean map_model_replace_text_as_node (MapModel* self,
                                         Node* node,
                                         const gchar* text);
VALA_EXTERN void quick_entry_preload (QuickEntry* self,
                          const gchar* value);
static void quick_entry_finalize (GObject * obj);
static GType quick_entry_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
quick_entry_get_instance_private (QuickEntry* self)
{
	return G_STRUCT_MEMBER_P (self, QuickEntry_private_offset);
}

static Block60Data*
block60_data_ref (Block60Data* _data60_)
{
	g_atomic_int_inc (&_data60_->_ref_count_);
	return _data60_;
}

static void
block60_data_unref (void * _userdata_)
{
	Block60Data* _data60_;
	_data60_ = (Block60Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data60_->_ref_count_)) {
		QuickEntry* self;
		self = _data60_->self;
		_g_object_unref0 (_data60_->helprev);
		_g_object_unref0 (_data60_->help_node1);
		_g_object_unref0 (_data60_->help_node0);
		_g_object_unref0 (self);
		g_slice_free (Block60Data, _data60_);
	}
}

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

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

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

static GdkDragAction
_quick_entry_handle_drag_motion_gtk_drop_target_motion (GtkDropTarget* _sender,
                                                        gdouble x,
                                                        gdouble y,
                                                        gpointer self)
{
	GdkDragAction result;
	result = quick_entry_handle_drag_motion ((QuickEntry*) self, x, y);
	return result;
}

static gboolean
_quick_entry_handle_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                               GValue* value,
                                               gdouble x,
                                               gdouble y,
                                               gpointer self)
{
	gboolean result;
	result = quick_entry_handle_drop ((QuickEntry*) self, value, x, y);
	return result;
}

static void
_quick_entry_handle_text_insertion_gtk_text_buffer_insert_text (GtkTextBuffer* _sender,
                                                                GtkTextIter* pos,
                                                                const gchar* new_text,
                                                                gint new_text_length,
                                                                gpointer self)
{
	quick_entry_handle_text_insertion ((QuickEntry*) self, pos, new_text, new_text_length);
}

static void
__lambda93_ (Block60Data* _data60_)
{
	QuickEntry* self;
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data60_->self;
	_tmp0_ = _data60_->helprev;
	_tmp1_ = _data60_->helprev;
	_tmp2_ = gtk_revealer_get_reveal_child (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_revealer_set_reveal_child (_tmp0_, !_tmp3_);
}

static void
___lambda93__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda93_ (self);
}

static void
___lambda94_ (Block60Data* _data60_)
{
	QuickEntry* self;
	self = _data60_->self;
	if (quick_entry_handle_replace (self)) {
		gtk_window_close ((GtkWindow*) self);
	} else {
		GtkRevealer* _tmp0_;
		GtkLabel* _tmp1_;
		GtkLabel* _tmp2_;
		_tmp0_ = _data60_->helprev;
		gtk_revealer_set_reveal_child (_tmp0_, TRUE);
		_tmp1_ = _data60_->help_node0;
		gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "highlighted");
		_tmp2_ = _data60_->help_node1;
		gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "highlighted");
	}
}

static void
____lambda94__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda94_ (self);
}

static void
___lambda95_ (Block60Data* _data60_)
{
	QuickEntry* self;
	self = _data60_->self;
	if (quick_entry_handle_insert (self)) {
		gtk_window_close ((GtkWindow*) self);
	} else {
		GtkRevealer* _tmp0_;
		GtkLabel* _tmp1_;
		GtkLabel* _tmp2_;
		_tmp0_ = _data60_->helprev;
		gtk_revealer_set_reveal_child (_tmp0_, TRUE);
		_tmp1_ = _data60_->help_node0;
		gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "highlighted");
		_tmp2_ = _data60_->help_node1;
		gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "highlighted");
	}
}

static void
____lambda95__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda95_ (self);
}

static void
__lambda96_ (QuickEntry* self)
{
	gtk_window_close ((GtkWindow*) self);
}

static void
___lambda96__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda96_ ((QuickEntry*) self);
}

QuickEntry*
quick_entry_construct (GType object_type,
                       MindMap* map,
                       gboolean replace,
                       GSettings* settings)
{
	QuickEntry * self = NULL;
	Block60Data* _data60_;
	MainWindow* _tmp0_;
	MainWindow* _tmp1_;
	MindMap* _tmp2_;
	MainWindow* _tmp3_;
	MainWindow* _tmp4_;
	Exports* _tmp5_;
	Exports* _tmp6_;
	Export* _tmp7_;
	GtkBox* box = NULL;
	GtkBox* _tmp8_;
	GtkTextView* _tmp9_ = NULL;
	GtkTextView* _tmp10_;
	GtkEventControllerKey* key = NULL;
	GtkEventControllerKey* _tmp11_;
	GtkTextView* _tmp12_;
	GtkEventControllerKey* _tmp13_;
	GtkEventController* _tmp14_;
	GtkEventControllerKey* _tmp15_;
	GtkDropTarget* drop = NULL;
	GtkDropTarget* _tmp16_;
	GtkTextView* _tmp17_;
	GtkDropTarget* _tmp18_;
	GtkEventController* _tmp19_;
	GtkDropTarget* _tmp20_;
	GtkDropTarget* _tmp21_;
	GtkTextView* _tmp22_;
	GtkTextBuffer* _tmp23_;
	GtkTextBuffer* _tmp24_;
	GtkTextView* _tmp25_;
	GtkTextBuffer* _tmp26_;
	GtkTextBuffer* _tmp27_;
	GdkRGBA _tmp28_ = {0};
	GtkScrolledWindow* sw = NULL;
	GtkTextView* _tmp29_;
	GtkWidget* _tmp30_;
	GtkScrolledWindow* _tmp31_ = NULL;
	GtkGrid* helpgrid = NULL;
	GtkGrid* _tmp32_ = NULL;
	GtkLabel* help_title = NULL;
	gchar* _tmp33_;
	gchar* _tmp34_;
	GtkLabel* _tmp35_;
	GtkLabel* _tmp36_;
	GtkLabel* help_line = NULL;
	gchar* _tmp37_;
	gchar* _tmp38_;
	GtkLabel* _tmp39_;
	GtkLabel* _tmp40_;
	GtkLabel* help_tab0 = NULL;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	GtkLabel* _tmp45_;
	GtkLabel* _tmp46_;
	GtkLabel* help_tab1 = NULL;
	gchar* _tmp47_;
	gchar* _tmp48_;
	GtkLabel* _tmp49_;
	GtkLabel* _tmp50_;
	GtkLabel* help_hdr0 = NULL;
	GtkLabel* _tmp51_;
	GtkLabel* help_hdr1 = NULL;
	gchar* _tmp52_;
	gchar* _tmp53_;
	GtkLabel* _tmp54_;
	GtkLabel* _tmp55_;
	GtkLabel* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	GtkLabel* _tmp59_;
	GtkLabel* _tmp60_;
	GtkLabel* help_note0 = NULL;
	GtkLabel* _tmp61_;
	GtkLabel* help_note1 = NULL;
	gchar* _tmp62_;
	gchar* _tmp63_;
	GtkLabel* _tmp64_;
	GtkLabel* _tmp65_;
	GtkLabel* help_img0 = NULL;
	gchar* _tmp66_;
	gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	GtkLabel* _tmp70_;
	GtkLabel* _tmp71_;
	GtkLabel* help_img1 = NULL;
	gchar* _tmp72_;
	gchar* _tmp73_;
	GtkLabel* _tmp74_;
	GtkLabel* _tmp75_;
	GtkLabel* help_utsk0 = NULL;
	GtkLabel* _tmp76_;
	GtkLabel* help_utsk1 = NULL;
	gchar* _tmp77_;
	gchar* _tmp78_;
	GtkLabel* _tmp79_;
	GtkLabel* _tmp80_;
	GtkLabel* help_ctsk0 = NULL;
	GtkLabel* _tmp81_;
	GtkLabel* help_ctsk1 = NULL;
	gchar* _tmp82_;
	gchar* _tmp83_;
	GtkLabel* _tmp84_;
	GtkLabel* _tmp85_;
	GtkGrid* _tmp86_;
	GtkLabel* _tmp87_;
	GtkGrid* _tmp88_;
	GtkLabel* _tmp89_;
	GtkGrid* _tmp90_;
	GtkLabel* _tmp91_;
	GtkGrid* _tmp92_;
	GtkLabel* _tmp93_;
	GtkGrid* _tmp94_;
	GtkLabel* _tmp95_;
	GtkGrid* _tmp96_;
	GtkLabel* _tmp97_;
	GtkGrid* _tmp98_;
	GtkLabel* _tmp99_;
	GtkGrid* _tmp100_;
	GtkLabel* _tmp101_;
	GtkGrid* _tmp102_;
	GtkLabel* _tmp103_;
	GtkGrid* _tmp104_;
	GtkLabel* _tmp105_;
	GtkGrid* _tmp106_;
	GtkLabel* _tmp107_;
	GtkGrid* _tmp108_;
	GtkLabel* _tmp109_;
	GtkGrid* _tmp110_;
	GtkLabel* _tmp111_;
	GtkGrid* _tmp112_;
	GtkLabel* _tmp113_;
	GtkGrid* _tmp114_;
	GtkLabel* _tmp115_;
	GtkGrid* _tmp116_;
	GtkLabel* _tmp117_;
	GtkGrid* _tmp118_;
	GtkWidget* _tmp119_;
	GtkRevealer* _tmp120_ = NULL;
	GtkButton* info = NULL;
	GtkButton* _tmp121_ = NULL;
	GtkButton* _tmp122_;
	GtkButton* cancel = NULL;
	GtkButton* _tmp131_ = NULL;
	GtkBox* bbox = NULL;
	GtkBox* _tmp132_ = NULL;
	GtkButton* _tmp133_;
	GtkButton* _tmp134_;
	GtkBox* _tmp135_;
	GtkScrolledWindow* _tmp136_;
	GtkBox* _tmp137_;
	GtkRevealer* _tmp138_;
	GtkBox* _tmp139_;
	GtkBox* _tmp140_;
	g_return_val_if_fail (map != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	_data60_ = g_slice_new0 (Block60Data);
	_data60_->_ref_count_ = 1;
	self = (QuickEntry*) g_object_new (object_type, NULL);
	_data60_->self = g_object_ref (self);
	g_object_set ((GtkWindow*) self, "default-width", 500, NULL);
	g_object_set ((GtkWindow*) self, "default-height", 500, NULL);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	gtk_window_set_deletable ((GtkWindow*) self, FALSE);
	gtk_window_set_title ((GtkWindow*) self, _ ("Quick Entry"));
	_tmp0_ = mind_map_get_win (map);
	_tmp1_ = _tmp0_;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp1_);
	_tmp2_ = _mind_map_ref0 (map);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp2_;
	_tmp3_ = mind_map_get_win (map);
	_tmp4_ = _tmp3_;
	_tmp5_ = main_window_get_exports (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = exports_get_by_name (_tmp6_, "text");
	_export_unref0 (self->priv->_export);
	self->priv->_export = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_EXPORT_TEXT, ExportText);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp8_);
	box = _tmp8_;
	_tmp9_ = (GtkTextView*) gtk_text_view_new ();
	gtk_text_view_set_bottom_margin (_tmp9_, 0);
	gtk_text_view_set_wrap_mode (_tmp9_, GTK_WRAP_WORD);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->_entry);
	self->priv->_entry = _tmp9_;
	_tmp10_ = self->priv->_entry;
	gtk_widget_add_css_class ((GtkWidget*) _tmp10_, "textfield");
	_tmp11_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key = _tmp11_;
	_tmp12_ = self->priv->_entry;
	_tmp13_ = key;
	_tmp14_ = _g_object_ref0 ((GtkEventController*) _tmp13_);
	gtk_widget_add_controller ((GtkWidget*) _tmp12_, _tmp14_);
	_tmp15_ = key;
	g_signal_connect_object (_tmp15_, "key-pressed", (GCallback) _quick_entry_on_keypress_gtk_event_controller_key_key_pressed, self, 0);
	_tmp16_ = gtk_drop_target_new (g_file_get_type (), GDK_ACTION_COPY);
	drop = _tmp16_;
	_tmp17_ = self->priv->_entry;
	_tmp18_ = drop;
	_tmp19_ = _g_object_ref0 ((GtkEventController*) _tmp18_);
	gtk_widget_add_controller ((GtkWidget*) _tmp17_, _tmp19_);
	_tmp20_ = drop;
	g_signal_connect_object (_tmp20_, "motion", (GCallback) _quick_entry_handle_drag_motion_gtk_drop_target_motion, self, 0);
	_tmp21_ = drop;
	g_signal_connect_object (_tmp21_, "drop", (GCallback) _quick_entry_handle_drop_gtk_drop_target_drop, self, 0);
	_tmp22_ = self->priv->_entry;
	_tmp23_ = gtk_text_view_get_buffer (_tmp22_);
	_tmp24_ = _tmp23_;
	g_signal_connect_object (_tmp24_, "insert-text", (GCallback) _quick_entry_handle_text_insertion_gtk_text_buffer_insert_text, self, 0);
	_tmp25_ = self->priv->_entry;
	_tmp26_ = gtk_text_view_get_buffer (_tmp25_);
	_tmp27_ = _tmp26_;
	utils_color_from_string ("grey90", &_tmp28_);
	gtk_text_buffer_create_tag (_tmp27_, "node", "background_rgba", &_tmp28_, NULL, NULL);
	_tmp29_ = self->priv->_entry;
	_tmp30_ = _g_object_ref0 ((GtkWidget*) _tmp29_);
	_tmp31_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_widget_set_margin_start ((GtkWidget*) _tmp31_, 10);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp31_, 10);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp31_, 10);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp31_, 10);
	gtk_widget_set_halign ((GtkWidget*) _tmp31_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp31_, GTK_ALIGN_FILL);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp31_, TRUE);
	gtk_scrolled_window_set_child (_tmp31_, _tmp30_);
	_g_object_unref0 (_tmp30_);
	g_object_ref_sink (_tmp31_);
	sw = _tmp31_;
	_tmp32_ = (GtkGrid*) gtk_grid_new ();
	gtk_widget_set_margin_start ((GtkWidget*) _tmp32_, 5);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp32_, 5);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp32_, 5);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp32_, 5);
	g_object_ref_sink (_tmp32_);
	helpgrid = _tmp32_;
	_tmp33_ = g_strconcat (_ ("Help for inputting node information:"), "\n", NULL);
	_tmp34_ = _tmp33_;
	_tmp35_ = quick_entry_make_help_label (self, _tmp34_);
	_tmp36_ = _tmp35_;
	_g_free0 (_tmp34_);
	help_title = _tmp36_;
	_tmp37_ = g_strconcat ("  - ", _ ("Each line of text describes either the title of a node or note informa" \
"tion for a node."), NULL);
	_tmp38_ = _tmp37_;
	_tmp39_ = quick_entry_make_help_label (self, _tmp38_);
	_tmp40_ = _tmp39_;
	_g_free0 (_tmp38_);
	help_line = _tmp40_;
	_tmp41_ = g_strconcat ("  - <b>", _ ("Tab"), NULL);
	_tmp42_ = _tmp41_;
	_tmp43_ = g_strconcat (_tmp42_, "</b>:", NULL);
	_tmp44_ = _tmp43_;
	_tmp45_ = quick_entry_make_help_label (self, _tmp44_);
	_tmp46_ = _tmp45_;
	_g_free0 (_tmp44_);
	_g_free0 (_tmp42_);
	help_tab0 = _tmp46_;
	_tmp47_ = g_strconcat ("  ", _ ("Creates a child node of the previous node."), NULL);
	_tmp48_ = _tmp47_;
	_tmp49_ = quick_entry_make_help_label (self, _tmp48_);
	_tmp50_ = _tmp49_;
	_g_free0 (_tmp48_);
	help_tab1 = _tmp50_;
	_tmp51_ = quick_entry_make_help_label (self, "  - <b>#</b>:");
	help_hdr0 = _tmp51_;
	_tmp52_ = g_strconcat ("  ", _ ("If this character is the first non-whitespace character, makes a new r" \
"oot node from the title that follows."), NULL);
	_tmp53_ = _tmp52_;
	_tmp54_ = quick_entry_make_help_label (self, _tmp53_);
	_tmp55_ = _tmp54_;
	_g_free0 (_tmp53_);
	help_hdr1 = _tmp55_;
	_tmp56_ = quick_entry_make_help_label (self, "  - <b>*, - or +</b>:");
	_data60_->help_node0 = _tmp56_;
	_tmp57_ = g_strconcat ("  ", _ ("If this character is the first non-whitespace character, make a new no" \
"de from the title that follows."), NULL);
	_tmp58_ = _tmp57_;
	_tmp59_ = quick_entry_make_help_label (self, _tmp58_);
	_tmp60_ = _tmp59_;
	_g_free0 (_tmp58_);
	_data60_->help_node1 = _tmp60_;
	_tmp61_ = quick_entry_make_help_label (self, "  - <b>&gt;</b>:");
	help_note0 = _tmp61_;
	_tmp62_ = g_strconcat ("  ", _ ("If this character is the first non-whitespace character, the following" \
" line is appended to the previous node's note."), NULL);
	_tmp63_ = _tmp62_;
	_tmp64_ = quick_entry_make_help_label (self, _tmp63_);
	_tmp65_ = _tmp64_;
	_g_free0 (_tmp63_);
	help_note1 = _tmp65_;
	_tmp66_ = g_strconcat ("  - <b>!</b> <i>", _ ("URI"), NULL);
	_tmp67_ = _tmp66_;
	_tmp68_ = g_strconcat (_tmp67_, "</i>:", NULL);
	_tmp69_ = _tmp68_;
	_tmp70_ = quick_entry_make_help_label (self, _tmp69_);
	_tmp71_ = _tmp70_;
	_g_free0 (_tmp69_);
	_g_free0 (_tmp67_);
	help_img0 = _tmp71_;
	_tmp72_ = g_strconcat ("  ", _ ("If this character is the first non-whitespace character, adds an image" \
" from the URI to the previous node"), NULL);
	_tmp73_ = _tmp72_;
	_tmp74_ = quick_entry_make_help_label (self, _tmp73_);
	_tmp75_ = _tmp74_;
	_g_free0 (_tmp73_);
	help_img1 = _tmp75_;
	_tmp76_ = quick_entry_make_help_label (self, "  - <b>[ ]</b>:");
	help_utsk0 = _tmp76_;
	_tmp77_ = g_strconcat ("  ", _ ("If this follows *, + or -, the node is made an uncompleted task."), NULL);
	_tmp78_ = _tmp77_;
	_tmp79_ = quick_entry_make_help_label (self, _tmp78_);
	_tmp80_ = _tmp79_;
	_g_free0 (_tmp78_);
	help_utsk1 = _tmp80_;
	_tmp81_ = quick_entry_make_help_label (self, "  - <b>[x] or [X]</b>:");
	help_ctsk0 = _tmp81_;
	_tmp82_ = g_strconcat ("  ", _ ("If this follows *, + or -, the node is made a completed task."), NULL);
	_tmp83_ = _tmp82_;
	_tmp84_ = quick_entry_make_help_label (self, _tmp83_);
	_tmp85_ = _tmp84_;
	_g_free0 (_tmp83_);
	help_ctsk1 = _tmp85_;
	_tmp86_ = helpgrid;
	_tmp87_ = help_title;
	gtk_grid_attach (_tmp86_, (GtkWidget*) _tmp87_, 0, 0, 2, 1);
	_tmp88_ = helpgrid;
	_tmp89_ = help_line;
	gtk_grid_attach (_tmp88_, (GtkWidget*) _tmp89_, 0, 1, 2, 1);
	_tmp90_ = helpgrid;
	_tmp91_ = help_tab0;
	gtk_grid_attach (_tmp90_, (GtkWidget*) _tmp91_, 0, 2, 1, 1);
	_tmp92_ = helpgrid;
	_tmp93_ = help_tab1;
	gtk_grid_attach (_tmp92_, (GtkWidget*) _tmp93_, 1, 2, 1, 1);
	_tmp94_ = helpgrid;
	_tmp95_ = help_hdr0;
	gtk_grid_attach (_tmp94_, (GtkWidget*) _tmp95_, 0, 3, 1, 1);
	_tmp96_ = helpgrid;
	_tmp97_ = help_hdr1;
	gtk_grid_attach (_tmp96_, (GtkWidget*) _tmp97_, 1, 3, 1, 1);
	_tmp98_ = helpgrid;
	_tmp99_ = _data60_->help_node0;
	gtk_grid_attach (_tmp98_, (GtkWidget*) _tmp99_, 0, 4, 1, 1);
	_tmp100_ = helpgrid;
	_tmp101_ = _data60_->help_node1;
	gtk_grid_attach (_tmp100_, (GtkWidget*) _tmp101_, 1, 4, 1, 1);
	_tmp102_ = helpgrid;
	_tmp103_ = help_note0;
	gtk_grid_attach (_tmp102_, (GtkWidget*) _tmp103_, 0, 5, 1, 1);
	_tmp104_ = helpgrid;
	_tmp105_ = help_note1;
	gtk_grid_attach (_tmp104_, (GtkWidget*) _tmp105_, 1, 5, 1, 1);
	_tmp106_ = helpgrid;
	_tmp107_ = help_img0;
	gtk_grid_attach (_tmp106_, (GtkWidget*) _tmp107_, 0, 6, 1, 1);
	_tmp108_ = helpgrid;
	_tmp109_ = help_img1;
	gtk_grid_attach (_tmp108_, (GtkWidget*) _tmp109_, 1, 6, 1, 1);
	_tmp110_ = helpgrid;
	_tmp111_ = help_utsk0;
	gtk_grid_attach (_tmp110_, (GtkWidget*) _tmp111_, 0, 7, 1, 1);
	_tmp112_ = helpgrid;
	_tmp113_ = help_utsk1;
	gtk_grid_attach (_tmp112_, (GtkWidget*) _tmp113_, 1, 7, 1, 1);
	_tmp114_ = helpgrid;
	_tmp115_ = help_ctsk0;
	gtk_grid_attach (_tmp114_, (GtkWidget*) _tmp115_, 0, 8, 1, 1);
	_tmp116_ = helpgrid;
	_tmp117_ = help_ctsk1;
	gtk_grid_attach (_tmp116_, (GtkWidget*) _tmp117_, 1, 8, 1, 1);
	_tmp118_ = helpgrid;
	_tmp119_ = _g_object_ref0 ((GtkWidget*) _tmp118_);
	_tmp120_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp120_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp120_, GTK_ALIGN_END);
	gtk_revealer_set_reveal_child (_tmp120_, FALSE);
	gtk_revealer_set_child (_tmp120_, _tmp119_);
	_g_object_unref0 (_tmp119_);
	g_object_ref_sink (_tmp120_);
	_data60_->helprev = _tmp120_;
	_tmp121_ = (GtkButton*) gtk_button_new_from_icon_name ("dialog-information-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp121_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp121_, TRUE);
	gtk_button_set_has_frame (_tmp121_, FALSE);
	g_object_ref_sink (_tmp121_);
	info = _tmp121_;
	_tmp122_ = info;
	g_signal_connect_data (_tmp122_, "clicked", (GCallback) ___lambda93__gtk_button_clicked, block60_data_ref (_data60_), (GClosureNotify) block60_data_unref, 0);
	if (replace) {
		GtkButton* _tmp123_ = NULL;
		GtkButton* _tmp124_;
		GtkButton* _tmp125_;
		MindMap* _tmp126_;
		_tmp123_ = (GtkButton*) gtk_button_new_with_label (_ ("Replace"));
		gtk_widget_set_halign ((GtkWidget*) _tmp123_, GTK_ALIGN_END);
		g_object_ref_sink (_tmp123_);
		_g_object_unref0 (self->priv->_apply);
		self->priv->_apply = _tmp123_;
		_tmp124_ = self->priv->_apply;
		gtk_widget_add_css_class ((GtkWidget*) _tmp124_, GRANITE_STYLE_CLASS_SUGGESTED_ACTION);
		_tmp125_ = self->priv->_apply;
		g_signal_connect_data (_tmp125_, "clicked", (GCallback) ____lambda94__gtk_button_clicked, block60_data_ref (_data60_), (GClosureNotify) block60_data_unref, 0);
		_tmp126_ = self->priv->_map;
		if (!mind_map_is_node_selected (_tmp126_)) {
			GtkButton* _tmp127_;
			_tmp127_ = self->priv->_apply;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp127_, FALSE);
		}
	} else {
		GtkButton* _tmp128_ = NULL;
		GtkButton* _tmp129_;
		GtkButton* _tmp130_;
		_tmp128_ = (GtkButton*) gtk_button_new_with_label (_ ("Insert"));
		gtk_widget_set_halign ((GtkWidget*) _tmp128_, GTK_ALIGN_END);
		g_object_ref_sink (_tmp128_);
		_g_object_unref0 (self->priv->_apply);
		self->priv->_apply = _tmp128_;
		_tmp129_ = self->priv->_apply;
		gtk_widget_add_css_class ((GtkWidget*) _tmp129_, GRANITE_STYLE_CLASS_SUGGESTED_ACTION);
		_tmp130_ = self->priv->_apply;
		g_signal_connect_data (_tmp130_, "clicked", (GCallback) ____lambda95__gtk_button_clicked, block60_data_ref (_data60_), (GClosureNotify) block60_data_unref, 0);
	}
	_tmp131_ = (GtkButton*) gtk_button_new_with_label (_ ("Cancel"));
	gtk_widget_set_halign ((GtkWidget*) _tmp131_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp131_);
	cancel = _tmp131_;
	g_signal_connect_object (cancel, "clicked", (GCallback) ___lambda96__gtk_button_clicked, self, 0);
	_tmp132_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	gtk_widget_set_halign ((GtkWidget*) _tmp132_, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) _tmp132_, GTK_ALIGN_END);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp132_, 5);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp132_, 5);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp132_, 5);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp132_, 5);
	g_object_ref_sink (_tmp132_);
	bbox = _tmp132_;
	_tmp133_ = info;
	gtk_box_append (bbox, (GtkWidget*) _tmp133_);
	gtk_box_append (bbox, (GtkWidget*) cancel);
	_tmp134_ = self->priv->_apply;
	gtk_box_append (bbox, (GtkWidget*) _tmp134_);
	_tmp135_ = box;
	_tmp136_ = sw;
	gtk_box_append (_tmp135_, (GtkWidget*) _tmp136_);
	_tmp137_ = box;
	_tmp138_ = _data60_->helprev;
	gtk_box_append (_tmp137_, (GtkWidget*) _tmp138_);
	_tmp139_ = box;
	gtk_box_append (_tmp139_, (GtkWidget*) bbox);
	_tmp140_ = box;
	gtk_window_set_child ((GtkWindow*) self, (GtkWidget*) _tmp140_);
	gtk_window_present ((GtkWindow*) self);
	_g_object_unref0 (bbox);
	_g_object_unref0 (cancel);
	_g_object_unref0 (info);
	_g_object_unref0 (help_ctsk1);
	_g_object_unref0 (help_ctsk0);
	_g_object_unref0 (help_utsk1);
	_g_object_unref0 (help_utsk0);
	_g_object_unref0 (help_img1);
	_g_object_unref0 (help_img0);
	_g_object_unref0 (help_note1);
	_g_object_unref0 (help_note0);
	_g_object_unref0 (help_hdr1);
	_g_object_unref0 (help_hdr0);
	_g_object_unref0 (help_tab1);
	_g_object_unref0 (help_tab0);
	_g_object_unref0 (help_line);
	_g_object_unref0 (help_title);
	_g_object_unref0 (helpgrid);
	_g_object_unref0 (sw);
	_g_object_unref0 (drop);
	_g_object_unref0 (key);
	_g_object_unref0 (box);
	block60_data_unref (_data60_);
	_data60_ = NULL;
	return self;
}

QuickEntry*
quick_entry_new (MindMap* map,
                 gboolean replace,
                 GSettings* settings)
{
	return quick_entry_construct (TYPE_QUICK_ENTRY, map, replace, settings);
}

static void
quick_entry_real_size_allocate (GtkWidget* base,
                                gint width,
                                gint height,
                                gint baseline)
{
	QuickEntry * self;
	gint _tmp0_ = 0;
	gint new_margin = 0;
	GtkTextView* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	self = (QuickEntry*) base;
	GTK_WIDGET_CLASS (quick_entry_parent_class)->size_allocate ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), width, height, baseline);
	if ((height - 100) < 0) {
		_tmp0_ = 0;
	} else {
		_tmp0_ = height - 100;
	}
	new_margin = _tmp0_;
	_tmp1_ = self->priv->_entry;
	_tmp2_ = gtk_text_view_get_bottom_margin (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != new_margin) {
		GtkTextView* _tmp4_;
		_tmp4_ = self->priv->_entry;
		gtk_text_view_set_bottom_margin (_tmp4_, new_margin);
	}
}

static GtkLabel*
quick_entry_make_help_label (QuickEntry* self,
                             const gchar* str)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_ = NULL;
	GtkLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (str != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (str);
	gtk_label_set_use_markup (_tmp0_, TRUE);
	gtk_label_set_xalign (_tmp0_, (gfloat) 0);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "greyed-label");
	result = lbl;
	return result;
}

static gchar*
string_chug (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchug (_result_);
	result = _result_;
	return result;
}

static void
quick_entry_handle_text_insertion (QuickEntry* self,
                                   GtkTextIter* pos,
                                   const gchar* new_text,
                                   gint new_text_length)
{
	gchar* _tmp0_ = NULL;
	gchar* cleaned = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (pos != NULL);
	g_return_if_fail (new_text != NULL);
	if (gtk_text_iter_get_offset (pos) == 0) {
		gchar* _tmp1_;
		_tmp1_ = string_chug (new_text);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (new_text);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	cleaned = _tmp3_;
	_tmp4_ = cleaned;
	if (g_strcmp0 (_tmp4_, new_text) != 0) {
		void* void_entry = NULL;
		GtkTextView* _tmp5_;
		void* _tmp6_;
		GtkTextView* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextBuffer* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		void* _tmp14_;
		GtkTextView* _tmp15_;
		GtkTextBuffer* _tmp16_;
		GtkTextBuffer* _tmp17_;
		_tmp5_ = self->priv->_entry;
		void_entry = (void*) _tmp5_;
		_tmp6_ = void_entry;
		g_signal_handlers_block_by_func (_tmp6_, (void*) quick_entry_handle_text_insertion, self);
		_tmp7_ = self->priv->_entry;
		_tmp8_ = gtk_text_view_get_buffer (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = cleaned;
		_tmp11_ = cleaned;
		_tmp12_ = strlen (_tmp11_);
		_tmp13_ = _tmp12_;
		g_signal_emit_by_name (_tmp9_, "insert-text", pos, _tmp10_, _tmp13_);
		_g_array_unref0 (self->priv->_node_stack);
		self->priv->_node_stack = NULL;
		_tmp14_ = void_entry;
		g_signal_handlers_unblock_by_func (_tmp14_, (void*) quick_entry_handle_text_insertion, self);
		_tmp15_ = self->priv->_entry;
		_tmp16_ = gtk_text_view_get_buffer (_tmp15_);
		_tmp17_ = _tmp16_;
		g_signal_stop_emission_by_name (_tmp17_, "insert_text");
	}
	_g_free0 (cleaned);
	_g_free0 (_tmp0_);
}

static void
quick_entry_clear_node_tag (QuickEntry* self)
{
	GtkTextIter first = {0};
	GtkTextIter last = {0};
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter _tmp3_ = {0};
	GtkTextView* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextIter _tmp7_ = {0};
	GtkTextView* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextBuffer* _tmp10_;
	GtkTextIter _tmp11_;
	GtkTextIter _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_text_buffer_get_start_iter (_tmp2_, &_tmp3_);
	first = _tmp3_;
	_tmp4_ = self->priv->_entry;
	_tmp5_ = gtk_text_view_get_buffer (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_text_buffer_get_end_iter (_tmp6_, &_tmp7_);
	last = _tmp7_;
	_tmp8_ = self->priv->_entry;
	_tmp9_ = gtk_text_view_get_buffer (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = first;
	_tmp12_ = last;
	gtk_text_buffer_remove_tag_by_name (_tmp10_, "node", &_tmp11_, &_tmp12_);
}

static void
_node_hier_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (node_hier_unref (var), NULL));
}

static void
_vala_NodeHier_free_function_content_of (gpointer data)
{
	NodeHier* self;
	self = *((NodeHier**) data);
	_node_hier_unref0_ (self);
}

static GdkDragAction
quick_entry_handle_drag_motion (QuickEntry* self,
                                gdouble x,
                                gdouble y)
{
	GArray* _tmp0_;
	GArray* _tmp15_;
	GdkDragAction result;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = self->priv->_node_stack;
	if (_tmp0_ == NULL) {
		GArray* _tmp1_;
		ExportText* _tmp2_;
		MindMap* _tmp3_;
		GtkTextView* _tmp4_;
		GtkTextBuffer* _tmp5_;
		GtkTextBuffer* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		MindMap* _tmp10_;
		GSettings* _tmp11_;
		GSettings* _tmp12_;
		GArray* _tmp13_;
		gboolean _tmp14_;
		_tmp1_ = g_array_new (TRUE, TRUE, sizeof (NodeHier*));
		g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_NodeHier_free_function_content_of);
		_g_array_unref0 (self->priv->_node_stack);
		self->priv->_node_stack = _tmp1_;
		_tmp2_ = self->priv->_export;
		_tmp3_ = self->priv->_map;
		_tmp4_ = self->priv->_entry;
		_tmp5_ = gtk_text_view_get_buffer (_tmp4_);
		_tmp6_ = _tmp5_;
		g_object_get (_tmp6_, "text", &_tmp7_, NULL);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = self->priv->_map;
		_tmp11_ = mind_map_get_settings (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = self->priv->_node_stack;
		_tmp14_ = !export_text_parse_text (_tmp2_, _tmp3_, _tmp9_, g_settings_get_int (_tmp12_, "quick-entry-spaces-per-tab"), _tmp13_);
		_g_free0 (_tmp9_);
		if (_tmp14_) {
			_g_array_unref0 (self->priv->_node_stack);
			self->priv->_node_stack = NULL;
		}
	}
	quick_entry_clear_node_tag (self);
	_tmp15_ = self->priv->_node_stack;
	if (_tmp15_ != NULL) {
		GtkTextIter iter = {0};
		GtkTextIter first = {0};
		GtkTextIter last = {0};
		gint first_line = 0;
		gint last_line = 0;
		gint line_top = 0;
		GtkTextView* _tmp16_;
		GtkTextIter _tmp17_ = {0};
		gint _tmp18_ = 0;
		NodeHier* node_info = NULL;
		ExportText* _tmp19_;
		GArray* _tmp20_;
		NodeHier* _tmp21_;
		NodeHier* _tmp22_;
		_tmp16_ = self->priv->_entry;
		gtk_text_view_get_line_at_y (_tmp16_, &_tmp17_, (gint) y, &_tmp18_);
		iter = _tmp17_;
		line_top = _tmp18_;
		_tmp19_ = self->priv->_export;
		_tmp20_ = self->priv->_node_stack;
		_tmp21_ = export_text_get_node_at_line (_tmp19_, _tmp20_, gtk_text_iter_get_line (&iter));
		node_info = _tmp21_;
		_tmp22_ = node_info;
		if (_tmp22_ != NULL) {
			GtkTextView* _tmp23_;
			GtkTextBuffer* _tmp24_;
			GtkTextBuffer* _tmp25_;
			NodeHier* _tmp26_;
			GtkTextIter _tmp27_ = {0};
			GtkTextView* _tmp28_;
			GtkTextBuffer* _tmp29_;
			GtkTextBuffer* _tmp30_;
			NodeHier* _tmp31_;
			GtkTextIter _tmp32_ = {0};
			GtkTextView* _tmp33_;
			GtkTextBuffer* _tmp34_;
			GtkTextBuffer* _tmp35_;
			GtkTextIter _tmp36_;
			GtkTextIter _tmp37_;
			_tmp23_ = self->priv->_entry;
			_tmp24_ = gtk_text_view_get_buffer (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = node_info;
			gtk_text_buffer_get_iter_at_line (_tmp25_, &_tmp27_, _tmp26_->first_line);
			first = _tmp27_;
			_tmp28_ = self->priv->_entry;
			_tmp29_ = gtk_text_view_get_buffer (_tmp28_);
			_tmp30_ = _tmp29_;
			_tmp31_ = node_info;
			gtk_text_buffer_get_iter_at_line (_tmp30_, &_tmp32_, _tmp31_->last_line + 1);
			last = _tmp32_;
			_tmp33_ = self->priv->_entry;
			_tmp34_ = gtk_text_view_get_buffer (_tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = first;
			_tmp37_ = last;
			gtk_text_buffer_apply_tag_by_name (_tmp35_, "node", &_tmp36_, &_tmp37_);
		}
		result = GDK_ACTION_COPY;
		_node_hier_unref0 (node_info);
		return result;
	}
	result = 0;
	return result;
}

static gboolean
quick_entry_handle_drop (QuickEntry* self,
                         GValue* val,
                         gdouble x,
                         gdouble y)
{
	GtkTextIter iter = {0};
	Node* node = NULL;
	gint line_top = 0;
	gchar* prefix = NULL;
	GtkTextView* _tmp0_;
	GtkTextIter _tmp1_ = {0};
	gint _tmp2_ = 0;
	NodeHier* node_info = NULL;
	ExportText* _tmp3_;
	GArray* _tmp4_;
	NodeHier* _tmp5_;
	NodeHier* _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = self->priv->_entry;
	gtk_text_view_get_line_at_y (_tmp0_, &_tmp1_, (gint) y, &_tmp2_);
	iter = _tmp1_;
	line_top = _tmp2_;
	_tmp3_ = self->priv->_export;
	_tmp4_ = self->priv->_node_stack;
	_tmp5_ = export_text_get_node_at_line (_tmp3_, _tmp4_, gtk_text_iter_get_line (&iter));
	node_info = _tmp5_;
	_tmp6_ = node_info;
	if (_tmp6_ != NULL) {
		GtkTextIter first = {0};
		GtkTextIter last = {0};
		gchar* node_str = NULL;
		gchar* _tmp7_;
		gchar* uri = NULL;
		GValue _tmp8_;
		gchar* _tmp9_;
		NodeImage* node_image = NULL;
		MindMap* _tmp10_;
		ImageManager* _tmp11_;
		ImageManager* _tmp12_;
		const gchar* _tmp13_;
		NodeImage* _tmp14_;
		NodeHier* _tmp15_;
		Node* _tmp16_;
		MindMap* _tmp17_;
		ImageManager* _tmp18_;
		ImageManager* _tmp19_;
		NodeImage* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp24_;
		ExportText* _tmp25_;
		MindMap* _tmp26_;
		NodeHier* _tmp27_;
		Node* _tmp28_;
		NodeHier* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		gchar* _tmp34_;
		GtkTextView* _tmp35_;
		GtkTextBuffer* _tmp36_;
		GtkTextBuffer* _tmp37_;
		NodeHier* _tmp38_;
		GtkTextIter _tmp39_ = {0};
		GtkTextView* _tmp40_;
		GtkTextBuffer* _tmp41_;
		GtkTextBuffer* _tmp42_;
		NodeHier* _tmp43_;
		GtkTextIter _tmp44_ = {0};
		GtkTextView* _tmp45_;
		GtkTextBuffer* _tmp46_;
		GtkTextBuffer* _tmp47_;
		GtkTextView* _tmp48_;
		GtkTextBuffer* _tmp49_;
		GtkTextBuffer* _tmp50_;
		const gchar* _tmp51_;
		const gchar* _tmp52_;
		gint _tmp53_;
		gint _tmp54_;
		_tmp7_ = g_strdup ("");
		node_str = _tmp7_;
		_tmp8_ = *val;
		_tmp9_ = g_file_get_uri (g_value_get_object (&_tmp8_));
		uri = _tmp9_;
		_tmp10_ = self->priv->_map;
		_tmp11_ = mind_map_get_image_manager (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = uri;
		_tmp14_ = node_image_new_from_uri (_tmp12_, _tmp13_, 200);
		node_image = _tmp14_;
		_tmp15_ = node_info;
		_tmp16_ = _tmp15_->node;
		_tmp17_ = self->priv->_map;
		_tmp18_ = mind_map_get_image_manager (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = node_image;
		node_set_image (_tmp16_, _tmp19_, _tmp20_);
		_tmp21_ = node_str;
		if (g_strcmp0 (_tmp21_, "") != 0) {
			const gchar* _tmp22_;
			gchar* _tmp23_;
			_tmp22_ = node_str;
			_tmp23_ = g_strconcat (_tmp22_, "\n", NULL);
			_g_free0 (node_str);
			node_str = _tmp23_;
		}
		_tmp24_ = node_str;
		_tmp25_ = self->priv->_export;
		_tmp26_ = self->priv->_map;
		_tmp27_ = node_info;
		_tmp28_ = _tmp27_->node;
		_tmp29_ = node_info;
		_tmp30_ = g_strnfill ((gsize) _tmp29_->spaces, ' ');
		_tmp31_ = _tmp30_;
		_tmp32_ = export_text_export_node (_tmp25_, _tmp26_, _tmp28_, _tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = g_strconcat (_tmp24_, _tmp33_, NULL);
		_g_free0 (node_str);
		node_str = _tmp34_;
		_g_free0 (_tmp33_);
		_g_free0 (_tmp31_);
		_tmp35_ = self->priv->_entry;
		_tmp36_ = gtk_text_view_get_buffer (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp38_ = node_info;
		gtk_text_buffer_get_iter_at_line (_tmp37_, &_tmp39_, _tmp38_->first_line);
		first = _tmp39_;
		_tmp40_ = self->priv->_entry;
		_tmp41_ = gtk_text_view_get_buffer (_tmp40_);
		_tmp42_ = _tmp41_;
		_tmp43_ = node_info;
		gtk_text_buffer_get_iter_at_line (_tmp42_, &_tmp44_, _tmp43_->last_line + 1);
		last = _tmp44_;
		_tmp45_ = self->priv->_entry;
		_tmp46_ = gtk_text_view_get_buffer (_tmp45_);
		_tmp47_ = _tmp46_;
		gtk_text_buffer_delete (_tmp47_, &first, &last);
		_tmp48_ = self->priv->_entry;
		_tmp49_ = gtk_text_view_get_buffer (_tmp48_);
		_tmp50_ = _tmp49_;
		_tmp51_ = node_str;
		_tmp52_ = node_str;
		_tmp53_ = strlen (_tmp52_);
		_tmp54_ = _tmp53_;
		gtk_text_buffer_insert (_tmp50_, &first, _tmp51_, _tmp54_);
		_g_array_unref0 (self->priv->_node_stack);
		self->priv->_node_stack = NULL;
		result = TRUE;
		_node_image_unref0 (node_image);
		_g_free0 (uri);
		_g_free0 (node_str);
		_node_hier_unref0 (node_info);
		_g_free0 (prefix);
		_g_object_unref0 (node);
		return result;
	}
	quick_entry_clear_node_tag (self);
	result = FALSE;
	_node_hier_unref0 (node_info);
	_g_free0 (prefix);
	_g_object_unref0 (node);
	return result;
}

static gchar*
quick_entry_get_line_text (QuickEntry* self,
                           gint adjust)
{
	GtkTextIter current = {0};
	GtkTextIter startline = {0};
	GtkTextIter endline = {0};
	GtkTextBuffer* buf = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextMark* _tmp6_;
	GtkTextIter _tmp7_ = {0};
	GtkTextBuffer* _tmp8_;
	GtkTextIter _tmp9_ = {0};
	GtkTextBuffer* _tmp10_;
	GtkTextIter _tmp11_ = {0};
	GtkTextBuffer* _tmp12_;
	GtkTextIter _tmp13_;
	GtkTextIter _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	buf = _tmp3_;
	_tmp4_ = buf;
	_tmp5_ = buf;
	_tmp6_ = gtk_text_buffer_get_insert (_tmp5_);
	gtk_text_buffer_get_iter_at_mark (_tmp4_, &_tmp7_, _tmp6_);
	current = _tmp7_;
	if (adjust < 0) {
		gtk_text_iter_backward_lines (&current, 0 - adjust);
	} else {
		if (adjust > 0) {
			gtk_text_iter_backward_lines (&current, adjust);
		}
	}
	_tmp8_ = buf;
	gtk_text_buffer_get_iter_at_line (_tmp8_, &_tmp9_, gtk_text_iter_get_line (&current));
	startline = _tmp9_;
	_tmp10_ = buf;
	gtk_text_buffer_get_iter_at_line (_tmp10_, &_tmp11_, gtk_text_iter_get_line (&current) + 1);
	endline = _tmp11_;
	_tmp12_ = buf;
	_tmp13_ = startline;
	_tmp14_ = endline;
	_tmp15_ = gtk_text_buffer_get_text (_tmp12_, &_tmp13_, &_tmp14_, TRUE);
	result = _tmp15_;
	_g_object_unref0 (buf);
	return result;
}

static gchar*
quick_entry_get_start_to_current_text (QuickEntry* self)
{
	GtkTextIter startline = {0};
	GtkTextIter endline = {0};
	GtkTextBuffer* buf = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextMark* _tmp4_;
	GtkTextIter _tmp5_ = {0};
	GtkTextIter _tmp6_ = {0};
	GtkTextIter _tmp7_;
	GtkTextIter _tmp8_;
	gchar* _tmp9_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	buf = _tmp3_;
	_tmp4_ = gtk_text_buffer_get_insert (buf);
	gtk_text_buffer_get_iter_at_mark (buf, &_tmp5_, _tmp4_);
	endline = _tmp5_;
	gtk_text_buffer_get_iter_at_line (buf, &_tmp6_, gtk_text_iter_get_line (&endline));
	startline = _tmp6_;
	_tmp7_ = startline;
	_tmp8_ = endline;
	_tmp9_ = gtk_text_buffer_get_text (buf, &_tmp7_, &_tmp8_, TRUE);
	result = _tmp9_;
	_g_object_unref0 (buf);
	return result;
}

static gboolean
quick_entry_get_whitespace (QuickEntry* self,
                            const gchar* line,
                            gchar** wspace)
{
	gchar* _vala_wspace = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (line != NULL, FALSE);
	_tmp0_ = g_strdup ("");
	_g_free0 (_vala_wspace);
	_vala_wspace = _tmp0_;
	{
		GMatchInfo* match_info = NULL;
		GRegex* re = NULL;
		GRegex* _tmp1_;
		GMatchInfo* _tmp3_ = NULL;
		gboolean _tmp4_;
		_tmp1_ = g_regex_new ("^([ \\t]*)", 0, 0, &_inner_error0_);
		re = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp2_ = FALSE;
			_g_match_info_unref0 (match_info);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (_vala_wspace);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp2_;
		}
		_tmp4_ = g_regex_match (re, line, 0, &_tmp3_);
		_g_match_info_unref0 (match_info);
		match_info = _tmp3_;
		if (_tmp4_) {
			GMatchInfo* _tmp5_;
			gchar* _tmp6_;
			_tmp5_ = match_info;
			_tmp6_ = g_match_info_fetch (_tmp5_, 1);
			_g_free0 (_vala_wspace);
			_vala_wspace = _tmp6_;
			result = TRUE;
			_g_regex_unref0 (re);
			_g_match_info_unref0 (match_info);
			if (wspace) {
				*wspace = _vala_wspace;
			} else {
				_g_free0 (_vala_wspace);
			}
			return result;
		}
		_g_regex_unref0 (re);
		_g_match_info_unref0 (match_info);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		result = FALSE;
		if (wspace) {
			*wspace = _vala_wspace;
		} else {
			_g_free0 (_vala_wspace);
		}
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp7_ = FALSE;
		_g_free0 (_vala_wspace);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp7_;
	}
	result = FALSE;
	if (wspace) {
		*wspace = _vala_wspace;
	} else {
		_g_free0 (_vala_wspace);
	}
	return result;
}

static gboolean
quick_entry_is_node_line (QuickEntry* self,
                          const gchar* line)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (line != NULL, FALSE);
	result = g_regex_match_simple ("^[ \\t]*[+*#-]", line, 0, 0);
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
quick_entry_is_blank_line (QuickEntry* self,
                           const gchar* line)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (line != NULL, FALSE);
	_tmp0_ = string_strip (line);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strcmp0 (_tmp1_, "") == 0;
	_g_free0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
quick_entry_tabs_to_spaces (QuickEntry* self,
                            const gchar* wspace)
{
	gchar* tspace = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (wspace != NULL, NULL);
	_tmp0_ = g_strnfill ((gsize) 8, ' ');
	tspace = _tmp0_;
	_tmp1_ = string_replace (wspace, "\t", tspace);
	result = _tmp1_;
	_g_free0 (tspace);
	return result;
}

static gchar*
quick_entry_align_to_tab (QuickEntry* self,
                          const gchar* wspace)
{
	gchar* ws = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (wspace != NULL, NULL);
	_tmp0_ = quick_entry_tabs_to_spaces (self, wspace);
	ws = _tmp0_;
	_tmp1_ = g_strnfill ((gsize) (g_utf8_strlen (ws, (gssize) -1) / 8), '\t');
	result = _tmp1_;
	_g_free0 (ws);
	return result;
}

static void
_vala_GtkTextIter_free (GtkTextIter* self)
{
	g_boxed_free (gtk_text_iter_get_type (), self);
}

static void
quick_entry_delete_whitespace (QuickEntry* self,
                               const gchar* ins_text)
{
	gchar* ws = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gboolean _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = quick_entry_get_line_text (self, 0);
	_tmp1_ = _tmp0_;
	_tmp3_ = quick_entry_get_whitespace (self, _tmp1_, &_tmp2_);
	_g_free0 (ws);
	ws = _tmp2_;
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp1_);
	if (_tmp4_) {
		GtkTextIter current = {0};
		GtkTextIter start = {0};
		GtkTextBuffer* buf = NULL;
		GtkTextView* _tmp5_;
		GtkTextBuffer* _tmp6_;
		GtkTextBuffer* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextBuffer* _tmp9_;
		GtkTextBuffer* _tmp10_;
		GtkTextMark* _tmp11_;
		GtkTextIter _tmp12_ = {0};
		GtkTextBuffer* _tmp13_;
		GtkTextIter _tmp14_ = {0};
		GtkTextIter* end = NULL;
		GtkTextIter* _tmp15_;
		GtkTextIter* _tmp16_;
		const gchar* _tmp17_;
		GtkTextBuffer* _tmp18_;
		_tmp5_ = self->priv->_entry;
		_tmp6_ = gtk_text_view_get_buffer (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _g_object_ref0 (_tmp7_);
		buf = _tmp8_;
		_tmp9_ = buf;
		_tmp10_ = buf;
		_tmp11_ = gtk_text_buffer_get_insert (_tmp10_);
		gtk_text_buffer_get_iter_at_mark (_tmp9_, &_tmp12_, _tmp11_);
		current = _tmp12_;
		_tmp13_ = buf;
		gtk_text_buffer_get_iter_at_line (_tmp13_, &_tmp14_, gtk_text_iter_get_line (&current));
		start = _tmp14_;
		_tmp15_ = gtk_text_iter_copy (&start);
		end = _tmp15_;
		_tmp16_ = end;
		_tmp17_ = ws;
		gtk_text_iter_forward_chars (_tmp16_, g_utf8_strlen (_tmp17_, (gssize) -1));
		_tmp18_ = buf;
		gtk_text_buffer_delete (_tmp18_, &start, end);
		if (ins_text != NULL) {
			GtkTextBuffer* _tmp19_;
			gint _tmp20_;
			gint _tmp21_;
			_tmp19_ = buf;
			_tmp20_ = strlen (ins_text);
			_tmp21_ = _tmp20_;
			g_signal_emit_by_name (_tmp19_, "insert-text", &start, ins_text, _tmp21_);
		}
		__vala_GtkTextIter_free0 (end);
		_g_object_unref0 (buf);
	}
	_g_free0 (ws);
}

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static gboolean
quick_entry_on_keypress (QuickEntry* self,
                         guint keyval,
                         guint keycode,
                         GdkModifierType state)
{
	gboolean control = FALSE;
	gboolean shift = FALSE;
	gunichar ch = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	control = (gboolean) (state & GDK_CONTROL_MASK);
	shift = (gboolean) (state & GDK_SHIFT_MASK);
	ch = (gunichar) keyval;
	switch (keyval) {
		case GDK_KEY_space:
		{
			result = quick_entry_handle_space (self);
			return result;
		}
		case GDK_KEY_Return:
		{
			result = quick_entry_handle_return (self, control);
			return result;
		}
		case GDK_KEY_Tab:
		{
			result = quick_entry_handle_tab (self, FALSE);
			return result;
		}
		case GDK_KEY_ISO_Left_Tab:
		{
			result = quick_entry_handle_tab (self, TRUE);
			return result;
		}
		default:
		{
			gboolean _tmp0_ = FALSE;
			if (g_unichar_isalnum (ch)) {
				_tmp0_ = TRUE;
			} else {
				_tmp0_ = g_unichar_ismark (ch);
			}
			if (_tmp0_) {
				gchar* _tmp1_;
				gchar* _tmp2_;
				gboolean _tmp3_;
				_tmp1_ = g_unichar_to_string (ch);
				_tmp2_ = _tmp1_;
				_tmp3_ = quick_entry_handle_printable (self, _tmp2_);
				_g_free0 (_tmp2_);
				result = _tmp3_;
				return result;
			}
			break;
		}
	}
	result = FALSE;
	return result;
}

static gboolean
quick_entry_handle_space (QuickEntry* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = quick_entry_get_start_to_current_text (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_strip (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strcmp0 (_tmp3_, "") == 0;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static gboolean
quick_entry_handle_return (QuickEntry* self,
                           gboolean control)
{
	gchar* wspace = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (control) {
		GtkButton* _tmp0_;
		_tmp0_ = self->priv->_apply;
		g_signal_emit_by_name (_tmp0_, "clicked");
		result = FALSE;
		return result;
	}
	_tmp1_ = quick_entry_get_line_text (self, 0);
	_tmp2_ = _tmp1_;
	_tmp4_ = quick_entry_get_whitespace (self, _tmp2_, &_tmp3_);
	_g_free0 (wspace);
	wspace = _tmp3_;
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp2_);
	if (_tmp5_) {
		gchar* prefix = NULL;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* ins = NULL;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		GtkTextView* _tmp10_;
		GtkTextBuffer* _tmp11_;
		GtkTextBuffer* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		_tmp6_ = wspace;
		_tmp7_ = quick_entry_align_to_tab (self, _tmp6_);
		prefix = _tmp7_;
		_tmp8_ = prefix;
		_tmp9_ = g_strconcat ("\n", _tmp8_, NULL);
		ins = _tmp9_;
		_tmp10_ = self->priv->_entry;
		_tmp11_ = gtk_text_view_get_buffer (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = ins;
		_tmp14_ = ins;
		_tmp15_ = strlen (_tmp14_);
		_tmp16_ = _tmp15_;
		gtk_text_buffer_insert_at_cursor (_tmp12_, _tmp13_, _tmp16_);
		result = TRUE;
		_g_free0 (ins);
		_g_free0 (prefix);
		_g_free0 (wspace);
		return result;
	}
	result = FALSE;
	_g_free0 (wspace);
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gint
string_index_of_nth_char (const gchar* self,
                          glong c)
{
	gchar* _tmp0_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_offset_to_pointer (self, c);
	result = (gint) (_tmp0_ - ((gchar*) self));
	return result;
}

static gboolean
quick_entry_handle_tab (QuickEntry* self,
                        gboolean shift)
{
	GtkTextIter current = {0};
	gchar* prev = NULL;
	gchar* _tmp0_;
	gchar* curr = NULL;
	gchar* _tmp1_;
	gchar* line = NULL;
	gchar* _tmp2_;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextView* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextMark* _tmp9_;
	GtkTextIter _tmp10_ = {0};
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = g_strdup ("");
	prev = _tmp0_;
	_tmp1_ = g_strdup ("");
	curr = _tmp1_;
	_tmp2_ = quick_entry_get_line_text (self, 0);
	line = _tmp2_;
	_tmp3_ = self->priv->_entry;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->_entry;
	_tmp7_ = gtk_text_view_get_buffer (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = gtk_text_buffer_get_insert (_tmp8_);
	gtk_text_buffer_get_iter_at_mark (_tmp5_, &_tmp10_, _tmp9_);
	current = _tmp10_;
	if (!shift) {
		if (gtk_text_iter_get_line (&current) == 0) {
			result = TRUE;
			_g_free0 (line);
			_g_free0 (curr);
			_g_free0 (prev);
			return result;
		} else {
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_ = FALSE;
			const gchar* _tmp13_;
			gchar* _tmp14_ = NULL;
			gboolean _tmp15_;
			_tmp13_ = line;
			_tmp15_ = quick_entry_get_whitespace (self, _tmp13_, &_tmp14_);
			_g_free0 (curr);
			curr = _tmp14_;
			if (_tmp15_) {
				gchar* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_ = NULL;
				gboolean _tmp19_;
				_tmp16_ = quick_entry_get_line_text (self, -1);
				_tmp17_ = _tmp16_;
				_tmp19_ = quick_entry_get_whitespace (self, _tmp17_, &_tmp18_);
				_g_free0 (prev);
				prev = _tmp18_;
				_tmp12_ = _tmp19_;
				_g_free0 (_tmp17_);
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				gboolean _tmp20_ = FALSE;
				const gchar* _tmp21_;
				_tmp21_ = line;
				if (quick_entry_is_blank_line (self, _tmp21_)) {
					_tmp20_ = TRUE;
				} else {
					const gchar* _tmp22_;
					_tmp22_ = line;
					_tmp20_ = quick_entry_is_node_line (self, _tmp22_);
				}
				_tmp11_ = _tmp20_;
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				const gchar* _tmp23_;
				gchar* _tmp24_;
				gchar* _tmp25_;
				gint _tmp26_;
				gint _tmp27_;
				const gchar* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				gint _tmp31_;
				gint _tmp32_;
				gboolean _tmp33_;
				_tmp23_ = curr;
				_tmp24_ = quick_entry_tabs_to_spaces (self, _tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = strlen (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = prev;
				_tmp29_ = quick_entry_tabs_to_spaces (self, _tmp28_);
				_tmp30_ = _tmp29_;
				_tmp31_ = strlen (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = _tmp27_ <= _tmp32_;
				_g_free0 (_tmp30_);
				_g_free0 (_tmp25_);
				if (_tmp33_) {
					gchar* prefix = NULL;
					const gchar* _tmp34_;
					gchar* _tmp35_;
					gchar* _tmp36_;
					gchar* _tmp37_;
					gchar* _tmp38_;
					const gchar* _tmp39_;
					const gchar* _tmp42_;
					_tmp34_ = curr;
					_tmp35_ = quick_entry_align_to_tab (self, _tmp34_);
					_tmp36_ = _tmp35_;
					_tmp37_ = g_strconcat (_tmp36_, "\t", NULL);
					_tmp38_ = _tmp37_;
					_g_free0 (_tmp36_);
					prefix = _tmp38_;
					_tmp39_ = line;
					if (quick_entry_is_blank_line (self, _tmp39_)) {
						const gchar* _tmp40_;
						gchar* _tmp41_;
						_tmp40_ = prefix;
						_tmp41_ = g_strconcat (_tmp40_, "- ", NULL);
						_g_free0 (prefix);
						prefix = _tmp41_;
					}
					_tmp42_ = prefix;
					quick_entry_delete_whitespace (self, _tmp42_);
					_g_free0 (prefix);
				}
			}
		}
	} else {
		gboolean _tmp43_ = FALSE;
		const gchar* _tmp44_;
		gchar* _tmp45_ = NULL;
		gboolean _tmp46_;
		_tmp44_ = line;
		_tmp46_ = quick_entry_get_whitespace (self, _tmp44_, &_tmp45_);
		_g_free0 (curr);
		curr = _tmp45_;
		if (_tmp46_) {
			gboolean _tmp47_ = FALSE;
			const gchar* _tmp48_;
			_tmp48_ = line;
			if (quick_entry_is_blank_line (self, _tmp48_)) {
				_tmp47_ = TRUE;
			} else {
				const gchar* _tmp49_;
				_tmp49_ = line;
				_tmp47_ = quick_entry_is_node_line (self, _tmp49_);
			}
			_tmp43_ = _tmp47_;
		} else {
			_tmp43_ = FALSE;
		}
		if (_tmp43_) {
			gchar* prefix = NULL;
			const gchar* _tmp50_;
			gchar* _tmp51_;
			const gchar* _tmp52_;
			const gchar* _tmp56_;
			const gchar* _tmp59_;
			_tmp50_ = curr;
			_tmp51_ = quick_entry_align_to_tab (self, _tmp50_);
			prefix = _tmp51_;
			_tmp52_ = prefix;
			if (g_utf8_strlen (_tmp52_, (gssize) -1) > 0) {
				const gchar* _tmp53_;
				const gchar* _tmp54_;
				gchar* _tmp55_;
				_tmp53_ = prefix;
				_tmp54_ = prefix;
				_tmp55_ = string_substring (_tmp53_, (glong) string_index_of_nth_char (_tmp54_, (glong) 1), (glong) -1);
				_g_free0 (prefix);
				prefix = _tmp55_;
			}
			_tmp56_ = line;
			if (quick_entry_is_blank_line (self, _tmp56_)) {
				const gchar* _tmp57_;
				gchar* _tmp58_;
				_tmp57_ = prefix;
				_tmp58_ = g_strconcat (_tmp57_, "- ", NULL);
				_g_free0 (prefix);
				prefix = _tmp58_;
			}
			_tmp59_ = prefix;
			quick_entry_delete_whitespace (self, _tmp59_);
			_g_free0 (prefix);
		}
	}
	result = TRUE;
	_g_free0 (line);
	_g_free0 (curr);
	_g_free0 (prev);
	return result;
}

static gboolean
quick_entry_handle_printable (QuickEntry* self,
                              const gchar* str)
{
	GtkTextIter current = {0};
	gchar* prev = NULL;
	gchar* _tmp0_;
	gchar* curr = NULL;
	gchar* _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextView* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextMark* _tmp8_;
	GtkTextIter _tmp9_ = {0};
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (str != NULL, FALSE);
	_tmp0_ = g_strdup ("");
	prev = _tmp0_;
	_tmp1_ = g_strdup ("");
	curr = _tmp1_;
	_tmp2_ = self->priv->_entry;
	_tmp3_ = gtk_text_view_get_buffer (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->_entry;
	_tmp6_ = gtk_text_view_get_buffer (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_text_buffer_get_insert (_tmp7_);
	gtk_text_buffer_get_iter_at_mark (_tmp4_, &_tmp9_, _tmp8_);
	current = _tmp9_;
	_tmp10_ = quick_entry_get_start_to_current_text (self);
	_tmp11_ = _tmp10_;
	_tmp12_ = string_strip (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strcmp0 (_tmp13_, "") == 0;
	_g_free0 (_tmp13_);
	_g_free0 (_tmp11_);
	if (_tmp14_) {
		gboolean _tmp15_ = FALSE;
		gboolean _tmp16_ = FALSE;
		gboolean _tmp17_ = FALSE;
		if (g_strcmp0 (str, "-") == 0) {
			_tmp17_ = TRUE;
		} else {
			_tmp17_ = g_strcmp0 (str, "+") == 0;
		}
		if (_tmp17_) {
			_tmp16_ = TRUE;
		} else {
			_tmp16_ = g_strcmp0 (str, "*") == 0;
		}
		if (_tmp16_) {
			_tmp15_ = TRUE;
		} else {
			_tmp15_ = g_strcmp0 (str, "#") == 0;
		}
		if (_tmp15_) {
			gchar* ins = NULL;
			gchar* _tmp18_;
			GtkTextView* _tmp19_;
			GtkTextBuffer* _tmp20_;
			GtkTextBuffer* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			gint _tmp24_;
			gint _tmp25_;
			_tmp18_ = g_strconcat (str, " ", NULL);
			ins = _tmp18_;
			_tmp19_ = self->priv->_entry;
			_tmp20_ = gtk_text_view_get_buffer (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = ins;
			_tmp23_ = ins;
			_tmp24_ = strlen (_tmp23_);
			_tmp25_ = _tmp24_;
			gtk_text_buffer_insert_at_cursor (_tmp21_, _tmp22_, _tmp25_);
			result = TRUE;
			_g_free0 (ins);
			_g_free0 (curr);
			_g_free0 (prev);
			return result;
		} else {
			gboolean _tmp26_ = FALSE;
			if (g_strcmp0 (str, ">") == 0) {
				_tmp26_ = TRUE;
			} else {
				_tmp26_ = g_strcmp0 (str, "!") == 0;
			}
			if (_tmp26_) {
				gchar* ins = NULL;
				gchar* _tmp27_;
				gchar* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				GtkTextView* _tmp31_;
				GtkTextBuffer* _tmp32_;
				GtkTextBuffer* _tmp33_;
				const gchar* _tmp34_;
				const gchar* _tmp35_;
				gint _tmp36_;
				gint _tmp37_;
				_tmp27_ = g_strconcat ("  ", str, NULL);
				_tmp28_ = _tmp27_;
				_tmp29_ = g_strconcat (_tmp28_, " ", NULL);
				_tmp30_ = _tmp29_;
				_g_free0 (_tmp28_);
				ins = _tmp30_;
				_tmp31_ = self->priv->_entry;
				_tmp32_ = gtk_text_view_get_buffer (_tmp31_);
				_tmp33_ = _tmp32_;
				_tmp34_ = ins;
				_tmp35_ = ins;
				_tmp36_ = strlen (_tmp35_);
				_tmp37_ = _tmp36_;
				gtk_text_buffer_insert_at_cursor (_tmp33_, _tmp34_, _tmp37_);
				result = TRUE;
				_g_free0 (ins);
				_g_free0 (curr);
				_g_free0 (prev);
				return result;
			} else {
				gchar* ins = NULL;
				gchar* _tmp38_;
				GtkTextView* _tmp39_;
				GtkTextBuffer* _tmp40_;
				GtkTextBuffer* _tmp41_;
				const gchar* _tmp42_;
				const gchar* _tmp43_;
				gint _tmp44_;
				gint _tmp45_;
				_tmp38_ = g_strdup ("  ");
				ins = _tmp38_;
				_tmp39_ = self->priv->_entry;
				_tmp40_ = gtk_text_view_get_buffer (_tmp39_);
				_tmp41_ = _tmp40_;
				_tmp42_ = ins;
				_tmp43_ = ins;
				_tmp44_ = strlen (_tmp43_);
				_tmp45_ = _tmp44_;
				gtk_text_buffer_insert_at_cursor (_tmp41_, _tmp42_, _tmp45_);
				_g_free0 (ins);
			}
		}
	}
	result = FALSE;
	_g_free0 (curr);
	_g_free0 (prev);
	return result;
}

static gboolean
quick_entry_handle_insert (QuickEntry* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	MindMap* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GtkTextView* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_current_node (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->_entry;
	_tmp7_ = gtk_text_view_get_buffer (_tmp6_);
	_tmp8_ = _tmp7_;
	g_object_get (_tmp8_, "text", &_tmp9_, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	_tmp12_ = map_model_insert_text_as_node (_tmp2_, _tmp5_, _tmp11_);
	_g_free0 (_tmp11_);
	_g_object_unref0 (_tmp5_);
	result = _tmp12_;
	return result;
}

static gboolean
quick_entry_handle_replace (QuickEntry* self)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	MindMap* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GtkTextView* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_current_node (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->_entry;
	_tmp7_ = gtk_text_view_get_buffer (_tmp6_);
	_tmp8_ = _tmp7_;
	g_object_get (_tmp8_, "text", &_tmp9_, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	_tmp12_ = map_model_replace_text_as_node (_tmp2_, _tmp5_, _tmp11_);
	_g_free0 (_tmp11_);
	_g_object_unref0 (_tmp5_);
	result = _tmp12_;
	return result;
}

void
quick_entry_preload (QuickEntry* self,
                     const gchar* value)
{
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = strlen (value);
	_tmp4_ = _tmp3_;
	gtk_text_buffer_insert_at_cursor (_tmp2_, value, _tmp4_);
}

static void
quick_entry_class_init (QuickEntryClass * klass,
                        gpointer klass_data)
{
	quick_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &QuickEntry_private_offset);
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, gint, gint, gint)) quick_entry_real_size_allocate;
	G_OBJECT_CLASS (klass)->finalize = quick_entry_finalize;
}

static void
quick_entry_instance_init (QuickEntry * self,
                           gpointer klass)
{
	self->priv = quick_entry_get_instance_private (self);
	self->priv->_node_stack = NULL;
}

static void
quick_entry_finalize (GObject * obj)
{
	QuickEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_QUICK_ENTRY, QuickEntry);
	_mind_map_unref0 (self->priv->_map);
	_g_object_unref0 (self->priv->_entry);
	_g_object_unref0 (self->priv->_apply);
	_g_array_unref0 (self->priv->_node_stack);
	_export_unref0 (self->priv->_export);
	G_OBJECT_CLASS (quick_entry_parent_class)->finalize (obj);
}

static GType
quick_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (QuickEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) quick_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QuickEntry), 0, (GInstanceInitFunc) quick_entry_instance_init, NULL };
	GType quick_entry_type_id;
	quick_entry_type_id = g_type_register_static (gtk_window_get_type (), "QuickEntry", &g_define_type_info, 0);
	QuickEntry_private_offset = g_type_add_instance_private (quick_entry_type_id, sizeof (QuickEntryPrivate));
	return quick_entry_type_id;
}

GType
quick_entry_get_type (void)
{
	static volatile gsize quick_entry_type_id__once = 0;
	if (g_once_init_enter (&quick_entry_type_id__once)) {
		GType quick_entry_type_id;
		quick_entry_type_id = quick_entry_get_type_once ();
		g_once_init_leave (&quick_entry_type_id__once, quick_entry_type_id);
	}
	return quick_entry_type_id__once;
}

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

