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

/*
* Copyright (c) 2025-2026 (https://github.com/phase1geo/Minder)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Trevor Williams <phase1geo@gmail.com>
*/

#include <glib-object.h>
#include <glib.h>
#include <libxml/tree.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gobject/gvaluecollector.h>
#include <libxml/parser.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.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

typedef enum  {
	MAP_STATE_NONE,
	MAP_STATE_NODE,
	MAP_STATE_CONNECTION,
	MAP_STATE_CALLOUT,
	MAP_STATE_STICKER,
	MAP_STATE_GROUP,
	MAP_STATE_EDITING
} MapState;

#define TYPE_MAP_STATE (map_state_get_type ())

#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_SELECTION (selection_get_type ())
#define SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SELECTION, Selection))
#define SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SELECTION, SelectionClass))
#define IS_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SELECTION))
#define IS_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SELECTION))
#define SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SELECTION, SelectionClass))

typedef struct _Selection Selection;
typedef struct _SelectionClass SelectionClass;
typedef enum  {
	KEY_COMMAND_DO_NOTHING,
	KEY_COMMAND_GENERAL_START,
	KEY_COMMAND_FILE_START,
	KEY_COMMAND_FILE_NEW,
	KEY_COMMAND_FILE_OPEN,
	KEY_COMMAND_FILE_OPEN_DIR,
	KEY_COMMAND_FILE_SAVE,
	KEY_COMMAND_FILE_SAVE_AS,
	KEY_COMMAND_FILE_PRINT,
	KEY_COMMAND_FILE_END,
	KEY_COMMAND_TAB_START,
	KEY_COMMAND_TAB_GOTO_NEXT,
	KEY_COMMAND_TAB_GOTO_PREV,
	KEY_COMMAND_TAB_CLOSE_CURRENT,
	KEY_COMMAND_TAB_END,
	KEY_COMMAND_UNDO_START,
	KEY_COMMAND_UNDO_ACTION,
	KEY_COMMAND_REDO_ACTION,
	KEY_COMMAND_UNDO_END,
	KEY_COMMAND_ZOOM_START,
	KEY_COMMAND_ZOOM_IN,
	KEY_COMMAND_ZOOM_OUT,
	KEY_COMMAND_ZOOM_FIT,
	KEY_COMMAND_ZOOM_SELECTED,
	KEY_COMMAND_ZOOM_ACTUAL,
	KEY_COMMAND_ZOOM_END,
	KEY_COMMAND_SIDEBAR_START,
	KEY_COMMAND_SHOW_CURRENT_SIDEBAR,
	KEY_COMMAND_SHOW_STYLE_SIDEBAR,
	KEY_COMMAND_SHOW_TAG_SIDEBAR,
	KEY_COMMAND_SHOW_STICKER_SIDEBAR,
	KEY_COMMAND_SHOW_MAP_SIDEBAR,
	KEY_COMMAND_SHOW_CURRENT_INFO,
	KEY_COMMAND_SIDEBAR_END,
	KEY_COMMAND_MAP_START,
	KEY_COMMAND_TOGGLE_CONNECTIONS,
	KEY_COMMAND_TOGGLE_CALLOUTS,
	KEY_COMMAND_BALANCE_NODES,
	KEY_COMMAND_FOLD_COMPLETED_TASKS,
	KEY_COMMAND_UNFOLD_ALL_NODES,
	KEY_COMMAND_MAP_END,
	KEY_COMMAND_MISCELLANEOUS_START,
	KEY_COMMAND_SHOW_PREFERENCES,
	KEY_COMMAND_SHOW_SHORTCUTS,
	KEY_COMMAND_SHOW_CONTEXTUAL_MENU,
	KEY_COMMAND_SHOW_FIND,
	KEY_COMMAND_SHOW_ABOUT,
	KEY_COMMAND_TOGGLE_BRAINDUMP,
	KEY_COMMAND_TOGGLE_FOCUS_MODE,
	KEY_COMMAND_EDIT_NOTE,
	KEY_COMMAND_EDIT_SELECTED,
	KEY_COMMAND_SHOW_SELECTED,
	KEY_COMMAND_REMOVE_STICKER_SELECTED,
	KEY_COMMAND_QUIT,
	KEY_COMMAND_MISCELLANEOUS_END,
	KEY_COMMAND_CONTROL_PRESSED,
	KEY_COMMAND_ESCAPE,
	KEY_COMMAND_GENERAL_END,
	KEY_COMMAND_NODE_START,
	KEY_COMMAND_NODE_EXIST_START,
	KEY_COMMAND_NODE_ADD_ROOT,
	KEY_COMMAND_NODE_ADD_SIBLING_AFTER,
	KEY_COMMAND_NODE_ADD_SIBLING_BEFORE,
	KEY_COMMAND_NODE_ADD_CHILD,
	KEY_COMMAND_NODE_ADD_PARENT,
	KEY_COMMAND_NODE_QUICK_ENTRY_INSERT,
	KEY_COMMAND_NODE_QUICK_ENTRY_REPLACE,
	KEY_COMMAND_NODE_REMOVE,
	KEY_COMMAND_NODE_REMOVE_ONLY,
	KEY_COMMAND_NODE_EXIST_END,
	KEY_COMMAND_NODE_CLIPBOARD_START,
	KEY_COMMAND_NODE_PASTE_NODE_LINK,
	KEY_COMMAND_NODE_PASTE_REPLACE,
	KEY_COMMAND_NODE_CLIPBOARD_END,
	KEY_COMMAND_NODE_VIEW_START,
	KEY_COMMAND_NODE_CENTER,
	KEY_COMMAND_NODE_VIEW_END,
	KEY_COMMAND_NODE_CHANGE_START,
	KEY_COMMAND_NODE_CHANGE_TASK,
	KEY_COMMAND_NODE_CHANGE_IMAGE,
	KEY_COMMAND_NODE_REMOVE_IMAGE,
	KEY_COMMAND_NODE_CHANGE_LINK_COLOR,
	KEY_COMMAND_NODE_RANDOMIZE_LINK_COLOR,
	KEY_COMMAND_NODE_REPARENT_LINK_COLOR,
	KEY_COMMAND_NODE_TOGGLE_FOLDS_SHALLOW,
	KEY_COMMAND_NODE_TOGGLE_FOLDS_DEEP,
	KEY_COMMAND_NODE_TOGGLE_LINKS,
	KEY_COMMAND_NODE_ADD_GROUP,
	KEY_COMMAND_NODE_ADD_CONNECTION,
	KEY_COMMAND_NODE_TOGGLE_CALLOUT,
	KEY_COMMAND_NODE_TOGGLE_SEQUENCE,
	KEY_COMMAND_NODE_CHANGE_END,
	KEY_COMMAND_NODE_SELECT_START,
	KEY_COMMAND_NODE_SELECT_ROOT,
	KEY_COMMAND_NODE_SELECT_PARENT,
	KEY_COMMAND_NODE_SELECT_SIBLING_NEXT,
	KEY_COMMAND_NODE_SELECT_SIBLING_PREV,
	KEY_COMMAND_NODE_SELECT_CHILD,
	KEY_COMMAND_NODE_SELECT_CHILDREN,
	KEY_COMMAND_NODE_SELECT_TREE,
	KEY_COMMAND_NODE_SELECT_DOWN,
	KEY_COMMAND_NODE_SELECT_UP,
	KEY_COMMAND_NODE_SELECT_RIGHT,
	KEY_COMMAND_NODE_SELECT_LEFT,
	KEY_COMMAND_NODE_SELECT_LINKED,
	KEY_COMMAND_NODE_SELECT_CALLOUT,
	KEY_COMMAND_NODE_SELECT_CONNECTION,
	KEY_COMMAND_NODE_SELECT_END,
	KEY_COMMAND_NODE_MOVE_START,
	KEY_COMMAND_NODE_SWAP_RIGHT,
	KEY_COMMAND_NODE_SWAP_LEFT,
	KEY_COMMAND_NODE_SWAP_UP,
	KEY_COMMAND_NODE_SWAP_DOWN,
	KEY_COMMAND_NODE_SORT_ALPHABETICALLY,
	KEY_COMMAND_NODE_SORT_RANDOMLY,
	KEY_COMMAND_NODE_DETACH,
	KEY_COMMAND_NODE_MOVE_END,
	KEY_COMMAND_NODE_ALIGN_START,
	KEY_COMMAND_NODE_ALIGN_TOP,
	KEY_COMMAND_NODE_ALIGN_VCENTER,
	KEY_COMMAND_NODE_ALIGN_BOTTOM,
	KEY_COMMAND_NODE_ALIGN_LEFT,
	KEY_COMMAND_NODE_ALIGN_HCENTER,
	KEY_COMMAND_NODE_ALIGN_RIGHT,
	KEY_COMMAND_NODE_ALIGN_END,
	KEY_COMMAND_NODE_END,
	KEY_COMMAND_CALLOUT_START,
	KEY_COMMAND_CALLOUT_SELECT_START,
	KEY_COMMAND_CALLOUT_SELECT_NODE,
	KEY_COMMAND_CALLOUT_SELECT_END,
	KEY_COMMAND_CALLOUT_REMOVE,
	KEY_COMMAND_CALLOUT_END,
	KEY_COMMAND_CONNECTION_START,
	KEY_COMMAND_CONNECTION_EXIST_START,
	KEY_COMMAND_CONNECTION_REMOVE,
	KEY_COMMAND_CONNECTION_EXIST_END,
	KEY_COMMAND_CONNECTION_SELECT_START,
	KEY_COMMAND_CONNECTION_SELECT_FROM,
	KEY_COMMAND_CONNECTION_SELECT_TO,
	KEY_COMMAND_CONNECTION_SELECT_NEXT,
	KEY_COMMAND_CONNECTION_SELECT_PREV,
	KEY_COMMAND_CONNECTION_SELECT_END,
	KEY_COMMAND_CONNECTION_END,
	KEY_COMMAND_STICKER_START,
	KEY_COMMAND_STICKER_REMOVE,
	KEY_COMMAND_STICKER_END,
	KEY_COMMAND_GROUP_START,
	KEY_COMMAND_GROUP_CHANGE_START,
	KEY_COMMAND_GROUP_CHANGE_COLOR,
	KEY_COMMAND_GROUP_MERGE,
	KEY_COMMAND_GROUP_REMOVE,
	KEY_COMMAND_GROUP_CHANGE_END,
	KEY_COMMAND_GROUP_SELECT_START,
	KEY_COMMAND_GROUP_SELECT_MAIN,
	KEY_COMMAND_GROUP_SELECT_ALL,
	KEY_COMMAND_GROUP_SELECT_END,
	KEY_COMMAND_GROUP_END,
	KEY_COMMAND_EDIT_START,
	KEY_COMMAND_EDIT_TEXT_START,
	KEY_COMMAND_EDIT_INSERT_NEWLINE,
	KEY_COMMAND_EDIT_INSERT_TAB,
	KEY_COMMAND_EDIT_INSERT_EMOJI,
	KEY_COMMAND_EDIT_ESCAPE,
	KEY_COMMAND_EDIT_BACKSPACE,
	KEY_COMMAND_EDIT_DELETE,
	KEY_COMMAND_EDIT_REMOVE_WORD_NEXT,
	KEY_COMMAND_EDIT_REMOVE_WORD_PREV,
	KEY_COMMAND_EDIT_TEXT_END,
	KEY_COMMAND_EDIT_MARKDOWN_START,
	KEY_COMMAND_EDIT_HEADER1,
	KEY_COMMAND_EDIT_HEADER2,
	KEY_COMMAND_EDIT_HEADER3,
	KEY_COMMAND_EDIT_HEADER4,
	KEY_COMMAND_EDIT_HEADER5,
	KEY_COMMAND_EDIT_HEADER6,
	KEY_COMMAND_EDIT_BOLD,
	KEY_COMMAND_EDIT_ITALICS,
	KEY_COMMAND_EDIT_STRIKE,
	KEY_COMMAND_EDIT_CODE,
	KEY_COMMAND_EDIT_HIGHLIGHT,
	KEY_COMMAND_EDIT_SUPERSCRIPT,
	KEY_COMMAND_EDIT_SUBSCRIPT,
	KEY_COMMAND_EDIT_LINK,
	KEY_COMMAND_EDIT_MARKDOWN_END,
	KEY_COMMAND_EDIT_CLIPBOARD_START,
	KEY_COMMAND_EDIT_COPY,
	KEY_COMMAND_EDIT_CUT,
	KEY_COMMAND_EDIT_PASTE,
	KEY_COMMAND_EDIT_CLIPBOARD_END,
	KEY_COMMAND_EDIT_URL_START,
	KEY_COMMAND_EDIT_OPEN_URL,
	KEY_COMMAND_EDIT_ADD_URL,
	KEY_COMMAND_EDIT_EDIT_URL,
	KEY_COMMAND_EDIT_REMOVE_URL,
	KEY_COMMAND_EDIT_URL_END,
	KEY_COMMAND_EDIT_CURSOR_START,
	KEY_COMMAND_EDIT_CURSOR_CHAR_NEXT,
	KEY_COMMAND_EDIT_CURSOR_CHAR_PREV,
	KEY_COMMAND_EDIT_CURSOR_UP,
	KEY_COMMAND_EDIT_CURSOR_DOWN,
	KEY_COMMAND_EDIT_CURSOR_WORD_NEXT,
	KEY_COMMAND_EDIT_CURSOR_WORD_PREV,
	KEY_COMMAND_EDIT_CURSOR_FIRST,
	KEY_COMMAND_EDIT_CURSOR_LAST,
	KEY_COMMAND_EDIT_CURSOR_LINESTART,
	KEY_COMMAND_EDIT_CURSOR_LINEEND,
	KEY_COMMAND_EDIT_CURSOR_END,
	KEY_COMMAND_EDIT_SELECT_START,
	KEY_COMMAND_EDIT_SELECT_CHAR_NEXT,
	KEY_COMMAND_EDIT_SELECT_CHAR_PREV,
	KEY_COMMAND_EDIT_SELECT_UP,
	KEY_COMMAND_EDIT_SELECT_DOWN,
	KEY_COMMAND_EDIT_SELECT_WORD_NEXT,
	KEY_COMMAND_EDIT_SELECT_WORD_PREV,
	KEY_COMMAND_EDIT_SELECT_START_UP,
	KEY_COMMAND_EDIT_SELECT_START_HOME,
	KEY_COMMAND_EDIT_SELECT_END_DOWN,
	KEY_COMMAND_EDIT_SELECT_END_END,
	KEY_COMMAND_EDIT_SELECT_LINESTART,
	KEY_COMMAND_EDIT_SELECT_LINEEND,
	KEY_COMMAND_EDIT_SELECT_ALL,
	KEY_COMMAND_EDIT_SELECT_NONE,
	KEY_COMMAND_EDIT_SELECT_END,
	KEY_COMMAND_EDIT_MISC_START,
	KEY_COMMAND_EDIT_RETURN,
	KEY_COMMAND_EDIT_SHIFT_RETURN,
	KEY_COMMAND_EDIT_TAB,
	KEY_COMMAND_EDIT_SHIFT_TAB,
	KEY_COMMAND_EDIT_MISC_END,
	KEY_COMMAND_EDIT_END,
	KEY_COMMAND_NUM
} KeyCommand;

#define TYPE_KEY_COMMAND (key_command_get_type ())

#define TYPE_SHORTCUT (shortcut_get_type ())
#define SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHORTCUT, Shortcut))
#define SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHORTCUT, ShortcutClass))
#define IS_SHORTCUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHORTCUT))
#define IS_SHORTCUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHORTCUT))
#define SHORTCUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHORTCUT, ShortcutClass))

typedef struct _Shortcut Shortcut;
typedef struct _ShortcutClass ShortcutClass;
typedef struct _ShortcutPrivate ShortcutPrivate;
typedef void (*KeyCommandFunc) (MindMap* map, gboolean key_activated, gpointer user_data);
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ParamSpecShortcut ParamSpecShortcut;

#define TYPE_SHORTCUTS (shortcuts_get_type ())
#define SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHORTCUTS, Shortcuts))
#define SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHORTCUTS, ShortcutsClass))
#define IS_SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHORTCUTS))
#define IS_SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHORTCUTS))
#define SHORTCUTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHORTCUTS, ShortcutsClass))

typedef struct _Shortcuts Shortcuts;
typedef struct _ShortcutsClass ShortcutsClass;
typedef struct _ShortcutsPrivate ShortcutsPrivate;
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _shortcut_unref0(var) ((var == NULL) ? NULL : (var = (shortcut_unref (var), NULL)))
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))
typedef struct _ParamSpecShortcuts ParamSpecShortcuts;
enum  {
	SHORTCUTS_SHORTCUT_CHANGED_SIGNAL,
	SHORTCUTS_NUM_SIGNALS
};
static guint shortcuts_signals[SHORTCUTS_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _Shortcut {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ShortcutPrivate * priv;
};

struct _ShortcutClass {
	GTypeClass parent_class;
	void (*finalize) (Shortcut *self);
};

struct _ShortcutPrivate {
	guint _keycode;
	gboolean _control;
	gboolean _shift;
	gboolean _alt;
	KeyCommand _command;
	KeyCommandFunc _func;
	gpointer _func_target;
	GDestroyNotify _func_target_destroy_notify;
};

struct _ParamSpecShortcut {
	GParamSpec parent_instance;
};

struct _Shortcuts {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ShortcutsPrivate * priv;
};

struct _ShortcutsClass {
	GTypeClass parent_class;
	void (*finalize) (Shortcuts *self);
};

struct _ShortcutsPrivate {
	GArray* _shortcuts;
	GArray* _defaults;
};

struct _ParamSpecShortcuts {
	GParamSpec parent_instance;
};

static gint Shortcut_private_offset;
static gpointer shortcut_parent_class = NULL;
static gint Shortcuts_private_offset;
static gpointer shortcuts_parent_class = NULL;

VALA_EXTERN GType map_state_get_type (void) G_GNUC_CONST ;
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 MapState map_state_get_state (MindMap* map);
VALA_EXTERN gboolean mind_map_is_node_editable (MindMap* self);
VALA_EXTERN gboolean mind_map_is_connection_editable (MindMap* self);
VALA_EXTERN gboolean mind_map_is_callout_editable (MindMap* self);
VALA_EXTERN gpointer selection_ref (gpointer instance);
VALA_EXTERN void selection_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_selection (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_selection (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_selection (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_selection (const GValue* value);
VALA_EXTERN GType selection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Selection, selection_unref)
VALA_EXTERN Selection* mind_map_get_selected (MindMap* self);
VALA_EXTERN gint selection_num_nodes (Selection* self);
VALA_EXTERN gint selection_num_connections (Selection* self);
VALA_EXTERN gint selection_num_callouts (Selection* self);
VALA_EXTERN gint selection_num_stickers (Selection* self);
VALA_EXTERN gint selection_num_groups (Selection* self);
VALA_EXTERN GType key_command_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean map_state_matches (MapState state,
                            KeyCommand command);
VALA_EXTERN gboolean key_command_for_node (KeyCommand self);
VALA_EXTERN gboolean key_command_for_connection (KeyCommand self);
VALA_EXTERN gboolean key_command_for_callout (KeyCommand self);
VALA_EXTERN gboolean key_command_for_sticker (KeyCommand self);
VALA_EXTERN gboolean key_command_for_group (KeyCommand self);
VALA_EXTERN gboolean key_command_for_editing (KeyCommand self);
VALA_EXTERN gboolean key_command_for_none (KeyCommand self);
VALA_EXTERN gpointer shortcut_ref (gpointer instance);
VALA_EXTERN void shortcut_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_shortcut (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_shortcut (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_shortcut (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_shortcut (const GValue* value);
VALA_EXTERN GType shortcut_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Shortcut, shortcut_unref)
VALA_EXTERN Shortcut* shortcut_new (guint keycode,
                        gboolean control,
                        gboolean shift,
                        gboolean alt,
                        KeyCommand command);
VALA_EXTERN Shortcut* shortcut_construct (GType object_type,
                              guint keycode,
                              gboolean control,
                              gboolean shift,
                              gboolean alt,
                              KeyCommand command);
VALA_EXTERN KeyCommandFunc key_command_get_func (KeyCommand self,
                                     gpointer* result_target,
                                     GDestroyNotify* result_target_destroy_notify);
VALA_EXTERN Shortcut* shortcut_new_from_xml (xmlNode* node);
VALA_EXTERN Shortcut* shortcut_construct_from_xml (GType object_type,
                                       xmlNode* node);
static void shortcut_load (Shortcut* self,
                    xmlNode* node);
static gboolean shortcut_has_key (Shortcut* self,
                           guint* kvs,
                           gint kvs_length1);
VALA_EXTERN gboolean shortcut_conflicts_with (Shortcut* self,
                                  guint keycode,
                                  gboolean control,
                                  gboolean shift,
                                  gboolean alt,
                                  KeyCommand command);
VALA_EXTERN gboolean key_command_target_matches (KeyCommand self,
                                     KeyCommand command);
VALA_EXTERN gboolean shortcut_matches_shortcut (Shortcut* self,
                                    Shortcut* shortcut);
VALA_EXTERN gboolean shortcut_matches_command (Shortcut* self,
                                   KeyCommand command);
VALA_EXTERN gboolean shortcut_matches_keypress (Shortcut* self,
                                    gboolean control,
                                    gboolean shift,
                                    gboolean alt,
                                    guint* kvs,
                                    gint kvs_length1,
                                    MapState state);
VALA_EXTERN gboolean shortcut_editable (Shortcut* self);
VALA_EXTERN gboolean key_command_editable (KeyCommand self);
VALA_EXTERN void shortcut_execute (Shortcut* self,
                       MindMap* map);
VALA_EXTERN gchar* shortcut_get_accelerator (Shortcut* self);
VALA_EXTERN gchar* shortcut_get_label (Shortcut* self);
static void _vala_array_add7 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add8 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add9 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add10 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gchar* shortcut_to_string (Shortcut* self);
VALA_EXTERN gchar* key_command_to_string (KeyCommand self);
VALA_EXTERN xmlNode* shortcut_save (Shortcut* self);
VALA_EXTERN KeyCommand key_command_parse (const gchar* str);
VALA_EXTERN KeyCommand shortcut_get_command (Shortcut* self);
static void shortcut_finalize (Shortcut * obj);
static GType shortcut_get_type_once (void);
VALA_EXTERN gpointer shortcuts_ref (gpointer instance);
VALA_EXTERN void shortcuts_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_shortcuts (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_shortcuts (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_shortcuts (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_shortcuts (const GValue* value);
VALA_EXTERN GType shortcuts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Shortcuts, shortcuts_unref)
VALA_EXTERN Shortcuts* shortcuts_new (void);
VALA_EXTERN Shortcuts* shortcuts_construct (GType object_type);
static void _shortcut_unref0_ (gpointer var);
static void _vala_Shortcut_free_function_content_of (gpointer data);
static void shortcuts_create_default_shortcuts (Shortcuts* self);
VALA_EXTERN void shortcuts_add_builtin_shortcuts (Shortcuts* self);
VALA_EXTERN void shortcuts_add_default_shortcuts (Shortcuts* self);
static void shortcuts_load (Shortcuts* self);
static gboolean shortcuts_remove_shortcut (Shortcuts* self,
                                    KeyCommand command);
VALA_EXTERN void shortcuts_clear_shortcut (Shortcuts* self,
                               KeyCommand command);
VALA_EXTERN void shortcuts_save (Shortcuts* self);
VALA_EXTERN void shortcuts_clear_all_shortcuts (Shortcuts* self);
VALA_EXTERN void shortcuts_set_shortcut (Shortcuts* self,
                             Shortcut* shortcut);
VALA_EXTERN Shortcut* shortcuts_get_shortcut (Shortcuts* self,
                                  KeyCommand command);
VALA_EXTERN Shortcut* shortcuts_get_default_shortcut (Shortcuts* self,
                                          KeyCommand command);
VALA_EXTERN Shortcut* shortcuts_shortcut_conflicts_with (Shortcuts* self,
                                             guint keycode,
                                             gboolean control,
                                             gboolean shift,
                                             gboolean alt,
                                             KeyCommand command);
VALA_EXTERN gboolean shortcuts_execute (Shortcuts* self,
                            MindMap* map,
                            guint keyval,
                            guint keycode,
                            GdkModifierType mods);
static gchar* shortcuts_shortcuts_path (Shortcuts* self);
static gboolean shortcuts_differs_from_default (Shortcuts* self,
                                         Shortcut* shortcut);
static void shortcuts_add_shortcut (Shortcuts* self,
                             guint keycode,
                             gboolean control,
                             gboolean shift,
                             gboolean alt,
                             KeyCommand command);
static void shortcuts_add_default (Shortcuts* self,
                            guint keycode,
                            gboolean control,
                            gboolean shift,
                            gboolean alt,
                            KeyCommand command);
VALA_EXTERN void shortcuts_restore_default_shortcuts (Shortcuts* self);
static xmlNode* shortcuts_make_property (Shortcuts* self,
                                  const gchar* name,
                                  const gchar* value,
                                  const gchar* translatable);
static xmlNode* shortcuts_make_object (Shortcuts* self,
                                const gchar* klass,
                                const gchar* id);
static xmlNode* shortcuts_make_child (Shortcuts* self);
static xmlNode* shortcuts_make_base_section (Shortcuts* self,
                                      const gchar* name,
                                      const gchar* title,
                                      xmlNode** obj);
static xmlNode* shortcuts_make_section (Shortcuts* self,
                                 KeyCommand command,
                                 xmlNode** obj);
VALA_EXTERN gchar* key_command_shortcut_label (KeyCommand self);
static xmlNode* shortcuts_make_base_group (Shortcuts* self,
                                    const gchar* title,
                                    xmlNode** obj);
static xmlNode* shortcuts_make_group (Shortcuts* self,
                               KeyCommand command,
                               xmlNode** obj);
static xmlNode* shortcuts_make_shortcut (Shortcuts* self,
                                  Shortcut* shortcut);
static xmlNode* shortcuts_make_mouse_shortcut (Shortcuts* self,
                                        const gchar* title,
                                        const gchar* subtitle);
VALA_EXTERN gchar* shortcuts_get_ui_string (Shortcuts* self);
VALA_EXTERN gboolean key_command_viewable (KeyCommand self);
VALA_EXTERN gboolean key_command_is_section_start (KeyCommand self);
VALA_EXTERN gboolean key_command_is_group_start (KeyCommand self);
VALA_EXTERN gboolean key_command_is_section_end (KeyCommand self);
static void g_cclosure_user_marshal_VOID__ENUM_SHORTCUT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void shortcuts_finalize (Shortcuts * obj);
static GType shortcuts_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

MapState
map_state_get_state (MindMap* map)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	MapState result;
	g_return_val_if_fail (map != NULL, 0);
	if (mind_map_is_node_editable (map)) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = mind_map_is_connection_editable (map);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = mind_map_is_callout_editable (map);
	}
	if (_tmp0_) {
		result = MAP_STATE_EDITING;
		return result;
	} else {
		Selection* _tmp2_;
		Selection* _tmp3_;
		_tmp2_ = mind_map_get_selected (map);
		_tmp3_ = _tmp2_;
		if (selection_num_nodes (_tmp3_) > 0) {
			result = MAP_STATE_NODE;
			return result;
		} else {
			Selection* _tmp4_;
			Selection* _tmp5_;
			_tmp4_ = mind_map_get_selected (map);
			_tmp5_ = _tmp4_;
			if (selection_num_connections (_tmp5_) > 0) {
				result = MAP_STATE_CONNECTION;
				return result;
			} else {
				Selection* _tmp6_;
				Selection* _tmp7_;
				_tmp6_ = mind_map_get_selected (map);
				_tmp7_ = _tmp6_;
				if (selection_num_callouts (_tmp7_) > 0) {
					result = MAP_STATE_CALLOUT;
					return result;
				} else {
					Selection* _tmp8_;
					Selection* _tmp9_;
					_tmp8_ = mind_map_get_selected (map);
					_tmp9_ = _tmp8_;
					if (selection_num_stickers (_tmp9_) > 0) {
						result = MAP_STATE_STICKER;
						return result;
					} else {
						Selection* _tmp10_;
						Selection* _tmp11_;
						_tmp10_ = mind_map_get_selected (map);
						_tmp11_ = _tmp10_;
						if (selection_num_groups (_tmp11_) > 0) {
							result = MAP_STATE_GROUP;
							return result;
						} else {
							result = MAP_STATE_NONE;
							return result;
						}
					}
				}
			}
		}
	}
}

gboolean
map_state_matches (MapState state,
                   KeyCommand command)
{
	gboolean for_node = FALSE;
	gboolean for_conn = FALSE;
	gboolean for_call = FALSE;
	gboolean for_stkr = FALSE;
	gboolean for_grp = FALSE;
	gboolean for_edit = FALSE;
	gboolean for_none = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean for_any = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	gboolean result;
	for_node = key_command_for_node (command);
	for_conn = key_command_for_connection (command);
	for_call = key_command_for_callout (command);
	for_stkr = key_command_for_sticker (command);
	for_grp = key_command_for_group (command);
	for_edit = key_command_for_editing (command);
	for_none = key_command_for_none (command);
	if (!for_node) {
		_tmp5_ = !for_conn;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		_tmp4_ = !for_call;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = !for_stkr;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = !for_grp;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = !for_edit;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = !for_none;
	} else {
		_tmp0_ = FALSE;
	}
	for_any = _tmp0_;
	if (for_node) {
		_tmp13_ = state == MAP_STATE_NODE;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		_tmp12_ = TRUE;
	} else {
		gboolean _tmp14_ = FALSE;
		if (for_conn) {
			_tmp14_ = state == MAP_STATE_CONNECTION;
		} else {
			_tmp14_ = FALSE;
		}
		_tmp12_ = _tmp14_;
	}
	if (_tmp12_) {
		_tmp11_ = TRUE;
	} else {
		gboolean _tmp15_ = FALSE;
		if (for_call) {
			_tmp15_ = state == MAP_STATE_CALLOUT;
		} else {
			_tmp15_ = FALSE;
		}
		_tmp11_ = _tmp15_;
	}
	if (_tmp11_) {
		_tmp10_ = TRUE;
	} else {
		gboolean _tmp16_ = FALSE;
		if (for_stkr) {
			_tmp16_ = state == MAP_STATE_STICKER;
		} else {
			_tmp16_ = FALSE;
		}
		_tmp10_ = _tmp16_;
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		gboolean _tmp17_ = FALSE;
		if (for_grp) {
			_tmp17_ = state == MAP_STATE_GROUP;
		} else {
			_tmp17_ = FALSE;
		}
		_tmp9_ = _tmp17_;
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		gboolean _tmp18_ = FALSE;
		if (for_edit) {
			_tmp18_ = state == MAP_STATE_EDITING;
		} else {
			_tmp18_ = FALSE;
		}
		_tmp8_ = _tmp18_;
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		gboolean _tmp19_ = FALSE;
		if (for_none) {
			_tmp19_ = state == MAP_STATE_NONE;
		} else {
			_tmp19_ = FALSE;
		}
		_tmp7_ = _tmp19_;
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = for_any;
	}
	result = _tmp6_;
	return result;
}

static GType
map_state_get_type_once (void)
{
	static const GEnumValue values[] = {{MAP_STATE_NONE, "MAP_STATE_NONE", "none"}, {MAP_STATE_NODE, "MAP_STATE_NODE", "node"}, {MAP_STATE_CONNECTION, "MAP_STATE_CONNECTION", "connection"}, {MAP_STATE_CALLOUT, "MAP_STATE_CALLOUT", "callout"}, {MAP_STATE_STICKER, "MAP_STATE_STICKER", "sticker"}, {MAP_STATE_GROUP, "MAP_STATE_GROUP", "group"}, {MAP_STATE_EDITING, "MAP_STATE_EDITING", "editing"}, {0, NULL, NULL}};
	GType map_state_type_id;
	map_state_type_id = g_enum_register_static ("MapState", values);
	return map_state_type_id;
}

GType
map_state_get_type (void)
{
	static volatile gsize map_state_type_id__once = 0;
	if (g_once_init_enter (&map_state_type_id__once)) {
		GType map_state_type_id;
		map_state_type_id = map_state_get_type_once ();
		g_once_init_leave (&map_state_type_id__once, map_state_type_id);
	}
	return map_state_type_id__once;
}

static inline gpointer
shortcut_get_instance_private (Shortcut* self)
{
	return G_STRUCT_MEMBER_P (self, Shortcut_private_offset);
}

Shortcut*
shortcut_construct (GType object_type,
                    guint keycode,
                    gboolean control,
                    gboolean shift,
                    gboolean alt,
                    KeyCommand command)
{
	Shortcut* self = NULL;
	gpointer _tmp0_ = NULL;
	GDestroyNotify _tmp1_ = NULL;
	KeyCommandFunc _tmp2_;
	self = (Shortcut*) g_type_create_instance (object_type);
	self->priv->_keycode = keycode;
	self->priv->_control = control;
	self->priv->_shift = shift;
	self->priv->_alt = alt;
	self->priv->_command = command;
	_tmp2_ = key_command_get_func (command, &_tmp0_, &_tmp1_);
	(self->priv->_func_target_destroy_notify == NULL) ? NULL : (self->priv->_func_target_destroy_notify (self->priv->_func_target), NULL);
	self->priv->_func = NULL;
	self->priv->_func_target = NULL;
	self->priv->_func_target_destroy_notify = NULL;
	self->priv->_func = _tmp2_;
	self->priv->_func_target = _tmp0_;
	self->priv->_func_target_destroy_notify = _tmp1_;
	return self;
}

Shortcut*
shortcut_new (guint keycode,
              gboolean control,
              gboolean shift,
              gboolean alt,
              KeyCommand command)
{
	return shortcut_construct (TYPE_SHORTCUT, keycode, control, shift, alt, command);
}

Shortcut*
shortcut_construct_from_xml (GType object_type,
                             xmlNode* node)
{
	Shortcut* self = NULL;
	self = (Shortcut*) g_type_create_instance (object_type);
	shortcut_load (self, node);
	return self;
}

Shortcut*
shortcut_new_from_xml (xmlNode* node)
{
	return shortcut_construct_from_xml (TYPE_SHORTCUT, node);
}

static gboolean
shortcut_has_key (Shortcut* self,
                  guint* kvs,
                  gint kvs_length1)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		guint* kv_collection = NULL;
		gint kv_collection_length1 = 0;
		gint _kv_collection_size_ = 0;
		gint kv_it = 0;
		kv_collection = kvs;
		kv_collection_length1 = kvs_length1;
		for (kv_it = 0; kv_it < kv_collection_length1; kv_it = kv_it + 1) {
			guint kv = 0U;
			kv = kv_collection[kv_it];
			{
				if (kv == self->priv->_keycode) {
					result = TRUE;
					return result;
				}
			}
		}
	}
	result = FALSE;
	return result;
}

gboolean
shortcut_conflicts_with (Shortcut* self,
                         guint keycode,
                         gboolean control,
                         gboolean shift,
                         gboolean alt,
                         KeyCommand command)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->_keycode == keycode) {
		_tmp4_ = self->priv->_control == control;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = self->priv->_shift == shift;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = self->priv->_alt == alt;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = self->priv->_command != command;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = key_command_target_matches (self->priv->_command, command);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
shortcut_matches_shortcut (Shortcut* self,
                           Shortcut* shortcut)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (shortcut != NULL, FALSE);
	if (self->priv->_keycode == shortcut->priv->_keycode) {
		_tmp3_ = self->priv->_control == shortcut->priv->_control;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = self->priv->_shift == shortcut->priv->_shift;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = self->priv->_alt == shortcut->priv->_alt;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = self->priv->_command == shortcut->priv->_command;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
shortcut_matches_command (Shortcut* self,
                          KeyCommand command)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_command == command;
	return result;
}

gboolean
shortcut_matches_keypress (Shortcut* self,
                           gboolean control,
                           gboolean shift,
                           gboolean alt,
                           guint* kvs,
                           gint kvs_length1,
                           MapState state)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->_control == control) {
		_tmp3_ = self->priv->_shift == shift;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = self->priv->_alt == alt;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = shortcut_has_key (self, kvs, (gint) kvs_length1);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = map_state_matches (state, self->priv->_command);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
shortcut_editable (Shortcut* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = key_command_editable (self->priv->_command);
	return result;
}

void
shortcut_execute (Shortcut* self,
                  MindMap* map)
{
	KeyCommandFunc _tmp0_;
	gpointer _tmp0__target;
	g_return_if_fail (self != NULL);
	g_return_if_fail (map != NULL);
	_tmp0_ = self->priv->_func;
	_tmp0__target = self->priv->_func_target;
	_tmp0_ (map, TRUE, _tmp0__target);
}

gchar*
shortcut_get_accelerator (Shortcut* self)
{
	gchar* accel = NULL;
	gchar* _tmp0_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	accel = _tmp0_;
	if (self->priv->_control) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = accel;
		_tmp2_ = g_strconcat (_tmp1_, "<Control>", NULL);
		_g_free0 (accel);
		accel = _tmp2_;
	}
	if (self->priv->_shift) {
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		if (!gdk_keyval_is_lower (self->priv->_keycode)) {
			_tmp8_ = TRUE;
		} else {
			_tmp8_ = !gdk_keyval_is_upper (self->priv->_keycode);
		}
		if (_tmp8_) {
			_tmp7_ = TRUE;
		} else {
			_tmp7_ = self->priv->_keycode == GDK_KEY_Delete;
		}
		if (_tmp7_) {
			_tmp6_ = TRUE;
		} else {
			_tmp6_ = self->priv->_keycode == GDK_KEY_BackSpace;
		}
		if (_tmp6_) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = self->priv->_keycode == GDK_KEY_Tab;
		}
		if (_tmp5_) {
			_tmp4_ = TRUE;
		} else {
			_tmp4_ = self->priv->_keycode == GDK_KEY_Return;
		}
		_tmp3_ = _tmp4_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp9_ = accel;
		_tmp10_ = g_strconcat (_tmp9_, "<Shift>", NULL);
		_g_free0 (accel);
		accel = _tmp10_;
	}
	if (self->priv->_alt) {
		const gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp11_ = accel;
		_tmp12_ = g_strconcat (_tmp11_, "<Alt>", NULL);
		_g_free0 (accel);
		accel = _tmp12_;
	}
	_tmp13_ = accel;
	_tmp14_ = gdk_keyval_name (self->priv->_keycode);
	_tmp15_ = g_strconcat (_tmp13_, _tmp14_, NULL);
	_g_free0 (accel);
	accel = _tmp15_;
	result = accel;
	return result;
}

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

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

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

static 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 void
_vala_array_add10 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

gchar*
shortcut_get_label (Shortcut* self)
{
	gchar** lbl = NULL;
	gchar** _tmp0_;
	gint lbl_length1;
	gint _lbl_size_;
	gunichar uc = 0U;
	gchar* str = NULL;
	gchar* _tmp1_;
	gchar* _tmp5_ = NULL;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar* _tmp13_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	lbl = _tmp0_;
	lbl_length1 = 0;
	_lbl_size_ = lbl_length1;
	uc = (gunichar) gdk_keyval_to_unicode (self->priv->_keycode);
	_tmp1_ = g_strdup ("");
	str = _tmp1_;
	if (self->priv->_control) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("Ctrl");
		_vala_array_add7 (&lbl, &lbl_length1, &_lbl_size_, _tmp2_);
	}
	if (self->priv->_shift) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("Shift");
		_vala_array_add8 (&lbl, &lbl_length1, &_lbl_size_, _tmp3_);
	}
	if (self->priv->_alt) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("Alt");
		_vala_array_add9 (&lbl, &lbl_length1, &_lbl_size_, _tmp4_);
	}
	if (g_unichar_isprint (uc)) {
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = g_unichar_to_string (uc);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_utf8_strup (_tmp7_, (gssize) -1);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
		_g_free0 (_tmp7_);
	} else {
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp9_ = gdk_keyval_name (self->priv->_keycode);
		_tmp10_ = g_strdup (_tmp9_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp10_;
	}
	_tmp11_ = _tmp5_;
	_tmp5_ = NULL;
	_vala_array_add10 (&lbl, &lbl_length1, &_lbl_size_, _tmp11_);
	_tmp12_ = lbl;
	_tmp12__length1 = lbl_length1;
	_tmp13_ = _vala_g_strjoinv ("+", _tmp12_, (gint) _tmp12__length1);
	result = _tmp13_;
	_g_free0 (_tmp5_);
	_g_free0 (str);
	lbl = (_vala_array_free (lbl, lbl_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

gchar*
shortcut_to_string (Shortcut* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = bool_to_string (self->priv->_control);
	_tmp1_ = _tmp0_;
	_tmp2_ = bool_to_string (self->priv->_shift);
	_tmp3_ = _tmp2_;
	_tmp4_ = bool_to_string (self->priv->_alt);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("%u", self->priv->_keycode);
	_tmp7_ = _tmp6_;
	_tmp8_ = key_command_to_string (self->priv->_command);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup_printf ("Ctrl: %s, Shift: %s, Alt: %s, Key: %s, Command: %s", _tmp1_, _tmp3_, _tmp5_, _tmp7_, _tmp9_);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp11_;
	return result;
}

xmlNode*
shortcut_save (Shortcut* self)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmlNewNode (NULL, (xmlChar*) "shortcut");
	node = _tmp0_;
	_tmp1_ = g_strdup_printf ("%u", self->priv->_keycode);
	_tmp2_ = _tmp1_;
	xmlSetProp (node, (xmlChar*) "key", (xmlChar*) _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = bool_to_string (self->priv->_control);
	_tmp4_ = _tmp3_;
	xmlSetProp (node, (xmlChar*) "control", (xmlChar*) _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = bool_to_string (self->priv->_shift);
	_tmp6_ = _tmp5_;
	xmlSetProp (node, (xmlChar*) "shift", (xmlChar*) _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = bool_to_string (self->priv->_alt);
	_tmp8_ = _tmp7_;
	xmlSetProp (node, (xmlChar*) "alt", (xmlChar*) _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = key_command_to_string (self->priv->_command);
	_tmp10_ = _tmp9_;
	xmlSetProp (node, (xmlChar*) "command", (xmlChar*) _tmp10_);
	_g_free0 (_tmp10_);
	result = node;
	return result;
}

static guint
uint_parse (const gchar* str,
            guint _base)
{
	guint result;
	g_return_val_if_fail (str != NULL, 0U);
	result = (guint) strtoul (str, NULL, (gint) _base);
	return result;
}

static gboolean
bool_parse (const gchar* str)
{
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	if (g_strcmp0 (str, "true") == 0) {
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static void
shortcut_load (Shortcut* self,
               xmlNode* node)
{
	gchar* k = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* c = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* s = NULL;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* a = NULL;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* cmd = NULL;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (gchar*) xmlGetProp (node, (xmlChar*) "key");
	k = _tmp0_;
	_tmp1_ = k;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = k;
		self->priv->_keycode = uint_parse (_tmp2_, (guint) 0);
	}
	_tmp3_ = (gchar*) xmlGetProp (node, (xmlChar*) "control");
	c = _tmp3_;
	_tmp4_ = c;
	if (_tmp4_ != NULL) {
		const gchar* _tmp5_;
		_tmp5_ = c;
		self->priv->_control = bool_parse (_tmp5_);
	}
	_tmp6_ = (gchar*) xmlGetProp (node, (xmlChar*) "shift");
	s = _tmp6_;
	_tmp7_ = s;
	if (_tmp7_ != NULL) {
		const gchar* _tmp8_;
		_tmp8_ = s;
		self->priv->_shift = bool_parse (_tmp8_);
	}
	_tmp9_ = (gchar*) xmlGetProp (node, (xmlChar*) "alt");
	a = _tmp9_;
	_tmp10_ = a;
	if (_tmp10_ != NULL) {
		const gchar* _tmp11_;
		_tmp11_ = a;
		self->priv->_alt = bool_parse (_tmp11_);
	}
	_tmp12_ = (gchar*) xmlGetProp (node, (xmlChar*) "command");
	cmd = _tmp12_;
	_tmp13_ = cmd;
	if (_tmp13_ != NULL) {
		const gchar* _tmp14_;
		gpointer _tmp15_ = NULL;
		GDestroyNotify _tmp16_ = NULL;
		KeyCommandFunc _tmp17_;
		_tmp14_ = cmd;
		self->priv->_command = key_command_parse (_tmp14_);
		_tmp17_ = key_command_get_func (self->priv->_command, &_tmp15_, &_tmp16_);
		(self->priv->_func_target_destroy_notify == NULL) ? NULL : (self->priv->_func_target_destroy_notify (self->priv->_func_target), NULL);
		self->priv->_func = NULL;
		self->priv->_func_target = NULL;
		self->priv->_func_target_destroy_notify = NULL;
		self->priv->_func = _tmp17_;
		self->priv->_func_target = _tmp15_;
		self->priv->_func_target_destroy_notify = _tmp16_;
	}
	_g_free0 (cmd);
	_g_free0 (a);
	_g_free0 (s);
	_g_free0 (c);
	_g_free0 (k);
}

KeyCommand
shortcut_get_command (Shortcut* self)
{
	KeyCommand result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_command;
	return result;
}

static void
value_shortcut_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_shortcut_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		shortcut_unref (value->data[0].v_pointer);
	}
}

static void
value_shortcut_copy_value (const GValue* src_value,
                           GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = shortcut_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_shortcut_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_shortcut_collect_value (GValue* value,
                              guint n_collect_values,
                              GTypeCValue* collect_values,
                              guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		Shortcut * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = shortcut_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_shortcut_lcopy_value (const GValue* value,
                            guint n_collect_values,
                            GTypeCValue* collect_values,
                            guint collect_flags)
{
	Shortcut ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = shortcut_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_shortcut (const gchar* name,
                     const gchar* nick,
                     const gchar* blurb,
                     GType object_type,
                     GParamFlags flags)
{
	ParamSpecShortcut* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_SHORTCUT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_shortcut (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUT), NULL);
	return value->data[0].v_pointer;
}

void
value_set_shortcut (GValue* value,
                    gpointer v_object)
{
	Shortcut * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SHORTCUT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		shortcut_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		shortcut_unref (old);
	}
}

void
value_take_shortcut (GValue* value,
                     gpointer v_object)
{
	Shortcut * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SHORTCUT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		shortcut_unref (old);
	}
}

static void
shortcut_class_init (ShortcutClass * klass,
                     gpointer klass_data)
{
	shortcut_parent_class = g_type_class_peek_parent (klass);
	((ShortcutClass *) klass)->finalize = shortcut_finalize;
	g_type_class_adjust_private_offset (klass, &Shortcut_private_offset);
}

static void
shortcut_instance_init (Shortcut * self,
                        gpointer klass)
{
	self->priv = shortcut_get_instance_private (self);
	self->ref_count = 1;
}

static void
shortcut_finalize (Shortcut * obj)
{
	Shortcut * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SHORTCUT, Shortcut);
	g_signal_handlers_destroy (self);
	(self->priv->_func_target_destroy_notify == NULL) ? NULL : (self->priv->_func_target_destroy_notify (self->priv->_func_target), NULL);
	self->priv->_func = NULL;
	self->priv->_func_target = NULL;
	self->priv->_func_target_destroy_notify = NULL;
}

static GType
shortcut_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_shortcut_init, value_shortcut_free_value, value_shortcut_copy_value, value_shortcut_peek_pointer, "p", value_shortcut_collect_value, "p", value_shortcut_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ShortcutClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) shortcut_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Shortcut), 0, (GInstanceInitFunc) shortcut_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType shortcut_type_id;
	shortcut_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Shortcut", &g_define_type_info, &g_define_type_fundamental_info, 0);
	Shortcut_private_offset = g_type_add_instance_private (shortcut_type_id, sizeof (ShortcutPrivate));
	return shortcut_type_id;
}

GType
shortcut_get_type (void)
{
	static volatile gsize shortcut_type_id__once = 0;
	if (g_once_init_enter (&shortcut_type_id__once)) {
		GType shortcut_type_id;
		shortcut_type_id = shortcut_get_type_once ();
		g_once_init_leave (&shortcut_type_id__once, shortcut_type_id);
	}
	return shortcut_type_id__once;
}

gpointer
shortcut_ref (gpointer instance)
{
	Shortcut * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
shortcut_unref (gpointer instance)
{
	Shortcut * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SHORTCUT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
shortcuts_get_instance_private (Shortcuts* self)
{
	return G_STRUCT_MEMBER_P (self, Shortcuts_private_offset);
}

static void
_shortcut_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (shortcut_unref (var), NULL));
}

static void
_vala_Shortcut_free_function_content_of (gpointer data)
{
	Shortcut* self;
	self = *((Shortcut**) data);
	_shortcut_unref0_ (self);
}

Shortcuts*
shortcuts_construct (GType object_type)
{
	Shortcuts* self = NULL;
	GArray* _tmp0_;
	GArray* _tmp1_;
	self = (Shortcuts*) g_type_create_instance (object_type);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Shortcut*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Shortcut_free_function_content_of);
	_g_array_unref0 (self->priv->_shortcuts);
	self->priv->_shortcuts = _tmp0_;
	_tmp1_ = g_array_new (TRUE, TRUE, sizeof (Shortcut*));
	g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Shortcut_free_function_content_of);
	_g_array_unref0 (self->priv->_defaults);
	self->priv->_defaults = _tmp1_;
	shortcuts_create_default_shortcuts (self);
	shortcuts_add_builtin_shortcuts (self);
	shortcuts_add_default_shortcuts (self);
	shortcuts_load (self);
	return self;
}

Shortcuts*
shortcuts_new (void)
{
	return shortcuts_construct (TYPE_SHORTCUTS);
}

static gpointer
vala_g_array_remove_index (GArray* self,
                           guint index)
{
	gpointer g = NULL;
	gpointer* _tmp0_;
	gint _tmp0__length1;
	gpointer _tmp1_;
	gpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_assert (self->len > index, "length > index");
	_tmp0_ = self->data;
	_tmp0__length1 = self->len;
	_tmp1_ = _tmp0_[index];
	_tmp0_[index] = NULL;
	g = _tmp1_;
	g_array_remove_index (self, index);
	result = g;
	return result;
}

static gboolean
shortcuts_remove_shortcut (Shortcuts* self,
                           KeyCommand command)
{
	gboolean removed = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	removed = FALSE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Shortcut* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_shortcuts;
				_tmp4_ = g_array_index (_tmp3_, Shortcut*, (guint) i);
				if (shortcut_matches_command (_tmp4_, command)) {
					GArray* _tmp5_;
					Shortcut* _tmp6_;
					Shortcut* _tmp7_;
					_tmp5_ = self->priv->_shortcuts;
					_tmp6_ = vala_g_array_remove_index (_tmp5_, (guint) i);
					_tmp7_ = _tmp6_;
					_shortcut_unref0 (_tmp7_);
					removed = TRUE;
				}
			}
		}
	}
	result = removed;
	return result;
}

void
shortcuts_clear_shortcut (Shortcuts* self,
                          KeyCommand command)
{
	g_return_if_fail (self != NULL);
	if (shortcuts_remove_shortcut (self, command)) {
		g_signal_emit (self, shortcuts_signals[SHORTCUTS_SHORTCUT_CHANGED_SIGNAL], 0, command, NULL);
		shortcuts_save (self);
	}
}

void
shortcuts_clear_all_shortcuts (Shortcuts* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				KeyCommand command = 0;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < ((gint) KEY_COMMAND_NUM))) {
					break;
				}
				command = (KeyCommand) i;
				if (shortcuts_remove_shortcut (self, command)) {
					g_signal_emit (self, shortcuts_signals[SHORTCUTS_SHORTCUT_CHANGED_SIGNAL], 0, command, NULL);
				}
			}
		}
	}
}

static gpointer
_shortcut_ref0 (gpointer self)
{
	return self ? shortcut_ref (self) : NULL;
}

void
shortcuts_set_shortcut (Shortcuts* self,
                        Shortcut* shortcut)
{
	KeyCommand _tmp0_;
	KeyCommand _tmp1_;
	GArray* _tmp2_;
	Shortcut* _tmp3_;
	KeyCommand _tmp4_;
	KeyCommand _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcut != NULL);
	_tmp0_ = shortcut_get_command (shortcut);
	_tmp1_ = _tmp0_;
	shortcuts_remove_shortcut (self, _tmp1_);
	_tmp2_ = self->priv->_shortcuts;
	_tmp3_ = _shortcut_ref0 (shortcut);
	g_array_append_val (_tmp2_, _tmp3_);
	_tmp4_ = shortcut_get_command (shortcut);
	_tmp5_ = _tmp4_;
	g_signal_emit (self, shortcuts_signals[SHORTCUTS_SHORTCUT_CHANGED_SIGNAL], 0, _tmp5_, shortcut);
	shortcuts_save (self);
}

Shortcut*
shortcuts_get_shortcut (Shortcuts* self,
                        KeyCommand command)
{
	Shortcut* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Shortcut* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_shortcuts;
				_tmp4_ = g_array_index (_tmp3_, Shortcut*, (guint) i);
				if (shortcut_matches_command (_tmp4_, command)) {
					GArray* _tmp5_;
					Shortcut* _tmp6_;
					Shortcut* _tmp7_;
					_tmp5_ = self->priv->_shortcuts;
					_tmp6_ = g_array_index (_tmp5_, Shortcut*, (guint) i);
					_tmp7_ = _shortcut_ref0 (_tmp6_);
					result = _tmp7_;
					return result;
				}
			}
		}
	}
	result = NULL;
	return result;
}

Shortcut*
shortcuts_get_default_shortcut (Shortcuts* self,
                                KeyCommand command)
{
	Shortcut* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Shortcut* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_defaults;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_defaults;
				_tmp4_ = g_array_index (_tmp3_, Shortcut*, (guint) i);
				if (shortcut_matches_command (_tmp4_, command)) {
					GArray* _tmp5_;
					Shortcut* _tmp6_;
					Shortcut* _tmp7_;
					_tmp5_ = self->priv->_defaults;
					_tmp6_ = g_array_index (_tmp5_, Shortcut*, (guint) i);
					_tmp7_ = _shortcut_ref0 (_tmp6_);
					result = _tmp7_;
					return result;
				}
			}
		}
	}
	result = NULL;
	return result;
}

Shortcut*
shortcuts_shortcut_conflicts_with (Shortcuts* self,
                                   guint keycode,
                                   gboolean control,
                                   gboolean shift,
                                   gboolean alt,
                                   KeyCommand command)
{
	Shortcut* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Shortcut* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_shortcuts;
				_tmp4_ = g_array_index (_tmp3_, Shortcut*, (guint) i);
				if (shortcut_conflicts_with (_tmp4_, keycode, control, shift, alt, command)) {
					GArray* _tmp5_;
					Shortcut* _tmp6_;
					Shortcut* _tmp7_;
					_tmp5_ = self->priv->_shortcuts;
					_tmp6_ = g_array_index (_tmp5_, Shortcut*, (guint) i);
					_tmp7_ = _shortcut_ref0 (_tmp6_);
					result = _tmp7_;
					return result;
				}
			}
		}
	}
	result = NULL;
	return result;
}

gboolean
shortcuts_execute (Shortcuts* self,
                   MindMap* map,
                   guint keyval,
                   guint keycode,
                   GdkModifierType mods)
{
	GdkKeymapKey* ks = NULL;
	GdkKeymapKey* _tmp0_;
	gint ks_length1;
	gint _ks_size_;
	guint* kvs = NULL;
	guint* _tmp1_;
	gint kvs_length1;
	gint _kvs_size_;
	MapState state = 0;
	gboolean control = FALSE;
	gboolean shift = FALSE;
	gboolean alt = FALSE;
	GdkDisplay* _tmp2_;
	GdkKeymapKey* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	guint* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (map != NULL, FALSE);
	_tmp0_ = g_new0 (GdkKeymapKey, 0);
	ks = _tmp0_;
	ks_length1 = 0;
	_ks_size_ = ks_length1;
	_tmp1_ = g_new0 (guint, 0);
	kvs = _tmp1_;
	kvs_length1 = 0;
	_kvs_size_ = kvs_length1;
	state = map_state_get_state (map);
	control = (mods & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
	shift = (mods & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
	alt = (mods & GDK_ALT_MASK) == GDK_ALT_MASK;
	_tmp2_ = gdk_display_get_default ();
	gdk_display_map_keycode (_tmp2_, keycode, &_tmp3_, &_tmp5_, &_tmp6_);
	ks = (g_free (ks), NULL);
	ks = _tmp3_;
	ks_length1 = _tmp4_;
	_ks_size_ = ks_length1;
	kvs = (g_free (kvs), NULL);
	kvs = _tmp5_;
	kvs_length1 = _tmp6_;
	_kvs_size_ = kvs_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				GArray* _tmp9_;
				GArray* _tmp10_;
				Shortcut* _tmp11_;
				guint* _tmp12_;
				gint _tmp12__length1;
				if (!_tmp7_) {
					gint _tmp8_;
					_tmp8_ = i;
					i = _tmp8_ + 1;
				}
				_tmp7_ = FALSE;
				_tmp9_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp9_->len)) {
					break;
				}
				_tmp10_ = self->priv->_shortcuts;
				_tmp11_ = g_array_index (_tmp10_, Shortcut*, (guint) i);
				_tmp12_ = kvs;
				_tmp12__length1 = kvs_length1;
				if (shortcut_matches_keypress (_tmp11_, control, shift, alt, _tmp12_, (gint) _tmp12__length1, state)) {
					GArray* _tmp13_;
					Shortcut* _tmp14_;
					_tmp13_ = self->priv->_shortcuts;
					_tmp14_ = g_array_index (_tmp13_, Shortcut*, (guint) i);
					shortcut_execute (_tmp14_, map);
					result = TRUE;
					kvs = (g_free (kvs), NULL);
					ks = (g_free (ks), NULL);
					return result;
				}
			}
		}
	}
	result = FALSE;
	kvs = (g_free (kvs), NULL);
	ks = (g_free (ks), NULL);
	return result;
}

static gchar*
shortcuts_shortcuts_path (Shortcuts* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_get_user_data_dir ();
	_tmp1_ = g_build_filename (_tmp0_, "minder", "shortcuts.xml", NULL);
	result = _tmp1_;
	return result;
}

static gboolean
shortcuts_differs_from_default (Shortcuts* self,
                                Shortcut* shortcut)
{
	Shortcut* dflt = NULL;
	KeyCommand _tmp0_;
	KeyCommand _tmp1_;
	Shortcut* _tmp2_;
	gboolean _tmp3_ = FALSE;
	Shortcut* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (shortcut != NULL, FALSE);
	_tmp0_ = shortcut_get_command (shortcut);
	_tmp1_ = _tmp0_;
	_tmp2_ = shortcuts_get_default_shortcut (self, _tmp1_);
	dflt = _tmp2_;
	_tmp4_ = dflt;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		Shortcut* _tmp5_;
		_tmp5_ = dflt;
		_tmp3_ = !shortcut_matches_shortcut (_tmp5_, shortcut);
	}
	result = _tmp3_;
	_shortcut_unref0 (dflt);
	return result;
}

void
shortcuts_save (Shortcuts* self)
{
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_;
	xmlNode* root = NULL;
	xmlNode* _tmp1_;
	xmlDoc* _tmp2_;
	xmlNode* _tmp3_;
	xmlDoc* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	xmlDoc* _tmp19_;
	g_return_if_fail (self != NULL);
	_tmp0_ = xmlNewDoc ((xmlChar*) "1.0");
	doc = _tmp0_;
	_tmp1_ = xmlNewNode (NULL, (xmlChar*) "shortcuts");
	root = _tmp1_;
	_tmp2_ = doc;
	_tmp3_ = root;
	xmlDocSetRootElement (_tmp2_, _tmp3_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				GArray* _tmp6_;
				Shortcut* shortcut = NULL;
				GArray* _tmp7_;
				Shortcut* _tmp8_;
				Shortcut* _tmp9_;
				gboolean _tmp10_ = FALSE;
				Shortcut* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp6_->len)) {
					break;
				}
				_tmp7_ = self->priv->_shortcuts;
				_tmp8_ = g_array_index (_tmp7_, Shortcut*, (guint) i);
				_tmp9_ = _shortcut_ref0 (_tmp8_);
				shortcut = _tmp9_;
				_tmp11_ = shortcut;
				if (shortcut_editable (_tmp11_)) {
					Shortcut* _tmp12_;
					_tmp12_ = shortcut;
					_tmp10_ = shortcuts_differs_from_default (self, _tmp12_);
				} else {
					_tmp10_ = FALSE;
				}
				if (_tmp10_) {
					xmlNode* _tmp13_;
					Shortcut* _tmp14_;
					xmlNode* _tmp15_;
					_tmp13_ = root;
					_tmp14_ = shortcut;
					_tmp15_ = shortcut_save (_tmp14_);
					xmlAddChild (_tmp13_, _tmp15_);
				}
				_shortcut_unref0 (shortcut);
			}
		}
	}
	_tmp16_ = doc;
	_tmp17_ = shortcuts_shortcuts_path (self);
	_tmp18_ = _tmp17_;
	xmlSaveFormatFile (_tmp18_, _tmp16_, 1);
	_g_free0 (_tmp18_);
	_tmp19_ = doc;
	_xmlFreeDoc0 (_tmp19_);
}

static void
shortcuts_load (Shortcuts* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	xmlDoc* doc = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	xmlDoc* _tmp5_;
	xmlDoc* _tmp6_;
	xmlDoc* _tmp7_;
	xmlNode* root = NULL;
	xmlDoc* _tmp8_;
	xmlNode* _tmp9_;
	xmlDoc* _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp0_ = shortcuts_shortcuts_path (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = !g_file_test (_tmp1_, G_FILE_TEST_EXISTS);
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = shortcuts_shortcuts_path (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmlParseFile (_tmp4_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	doc = _tmp6_;
	_tmp7_ = doc;
	if (_tmp7_ == NULL) {
		return;
	}
	_tmp8_ = doc;
	_tmp9_ = xmlDocGetRootElement (_tmp8_);
	root = _tmp9_;
	{
		xmlNode* it = NULL;
		xmlNode* _tmp10_;
		xmlNode* _tmp11_;
		_tmp10_ = root;
		_tmp11_ = _tmp10_->children;
		it = _tmp11_;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp15_;
				gboolean _tmp16_ = FALSE;
				xmlNode* _tmp17_;
				if (!_tmp12_) {
					xmlNode* _tmp13_;
					xmlNode* _tmp14_;
					_tmp13_ = it;
					_tmp14_ = _tmp13_->next;
					it = _tmp14_;
				}
				_tmp12_ = FALSE;
				_tmp15_ = it;
				if (!(_tmp15_ != NULL)) {
					break;
				}
				_tmp17_ = it;
				if (_tmp17_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp18_;
					const gchar* _tmp19_;
					_tmp18_ = it;
					_tmp19_ = _tmp18_->name;
					_tmp16_ = g_strcmp0 (_tmp19_, "shortcut") == 0;
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					Shortcut* shortcut = NULL;
					xmlNode* _tmp20_;
					Shortcut* _tmp21_;
					GArray* _tmp22_;
					Shortcut* _tmp23_;
					Shortcut* _tmp24_;
					_tmp20_ = it;
					_tmp21_ = shortcut_new_from_xml (_tmp20_);
					shortcut = _tmp21_;
					_tmp22_ = self->priv->_shortcuts;
					_tmp23_ = shortcut;
					_tmp24_ = _shortcut_ref0 (_tmp23_);
					g_array_append_val (_tmp22_, _tmp24_);
					_shortcut_unref0 (shortcut);
				}
			}
		}
	}
	_tmp25_ = doc;
	_xmlFreeDoc0 (_tmp25_);
}

static void
shortcuts_add_shortcut (Shortcuts* self,
                        guint keycode,
                        gboolean control,
                        gboolean shift,
                        gboolean alt,
                        KeyCommand command)
{
	Shortcut* shortcut = NULL;
	Shortcut* _tmp0_;
	GArray* _tmp1_;
	Shortcut* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = shortcut_new (keycode, control, shift, alt, command);
	shortcut = _tmp0_;
	_tmp1_ = self->priv->_shortcuts;
	_tmp2_ = _shortcut_ref0 (shortcut);
	g_array_append_val (_tmp1_, _tmp2_);
	_shortcut_unref0 (shortcut);
}

static void
shortcuts_add_default (Shortcuts* self,
                       guint keycode,
                       gboolean control,
                       gboolean shift,
                       gboolean alt,
                       KeyCommand command)
{
	Shortcut* shortcut = NULL;
	Shortcut* _tmp0_;
	GArray* _tmp1_;
	Shortcut* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = shortcut_new (keycode, control, shift, alt, command);
	shortcut = _tmp0_;
	_tmp1_ = self->priv->_defaults;
	_tmp2_ = _shortcut_ref0 (shortcut);
	g_array_append_val (_tmp1_, _tmp2_);
	_shortcut_unref0 (shortcut);
}

void
shortcuts_add_default_shortcuts (Shortcuts* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				GArray* _tmp4_;
				Shortcut* _tmp5_;
				Shortcut* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_defaults;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_shortcuts;
				_tmp4_ = self->priv->_defaults;
				_tmp5_ = g_array_index (_tmp4_, Shortcut*, (guint) i);
				_tmp6_ = _shortcut_ref0 (_tmp5_);
				g_array_append_val (_tmp3_, _tmp6_);
			}
		}
	}
}

void
shortcuts_restore_default_shortcuts (Shortcuts* self)
{
	g_return_if_fail (self != NULL);
	shortcuts_clear_all_shortcuts (self);
	shortcuts_add_builtin_shortcuts (self);
	shortcuts_add_default_shortcuts (self);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Shortcut* _tmp4_;
				KeyCommand _tmp5_;
				KeyCommand _tmp6_;
				GArray* _tmp7_;
				Shortcut* _tmp8_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_shortcuts;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_shortcuts;
				_tmp4_ = g_array_index (_tmp3_, Shortcut*, (guint) i);
				_tmp5_ = shortcut_get_command (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = self->priv->_shortcuts;
				_tmp8_ = g_array_index (_tmp7_, Shortcut*, (guint) i);
				g_signal_emit (self, shortcuts_signals[SHORTCUTS_SHORTCUT_CHANGED_SIGNAL], 0, _tmp6_, _tmp8_);
			}
		}
	}
	shortcuts_save (self);
}

void
shortcuts_add_builtin_shortcuts (Shortcuts* self)
{
	g_return_if_fail (self != NULL);
	shortcuts_add_shortcut (self, GDK_KEY_Escape, FALSE, FALSE, FALSE, KEY_COMMAND_ESCAPE);
	shortcuts_add_shortcut (self, GDK_KEY_Escape, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_ESCAPE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_BACKSPACE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_REMOVE_ONLY);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_CALLOUT_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_STICKER_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_BackSpace, FALSE, FALSE, FALSE, KEY_COMMAND_GROUP_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_DELETE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_REMOVE_ONLY);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_CALLOUT_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_STICKER_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Delete, FALSE, FALSE, FALSE, KEY_COMMAND_GROUP_REMOVE);
	shortcuts_add_shortcut (self, GDK_KEY_Return, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_RETURN);
	shortcuts_add_shortcut (self, GDK_KEY_Return, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ADD_SIBLING_AFTER);
	shortcuts_add_shortcut (self, GDK_KEY_Return, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SHIFT_RETURN);
	shortcuts_add_shortcut (self, GDK_KEY_Return, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_ADD_SIBLING_BEFORE);
	shortcuts_add_shortcut (self, GDK_KEY_Tab, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_TAB);
	shortcuts_add_shortcut (self, GDK_KEY_Tab, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ADD_CHILD);
	shortcuts_add_shortcut (self, GDK_KEY_Tab, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SHIFT_TAB);
	shortcuts_add_shortcut (self, GDK_KEY_Tab, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_ADD_PARENT);
	shortcuts_add_shortcut (self, GDK_KEY_Right, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_CHAR_NEXT);
	shortcuts_add_shortcut (self, GDK_KEY_Right, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_RIGHT);
	shortcuts_add_shortcut (self, GDK_KEY_Right, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_CHAR_NEXT);
	shortcuts_add_shortcut (self, GDK_KEY_Left, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_CHAR_PREV);
	shortcuts_add_shortcut (self, GDK_KEY_Left, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_LEFT);
	shortcuts_add_shortcut (self, GDK_KEY_Left, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_CHAR_PREV);
	shortcuts_add_shortcut (self, GDK_KEY_Up, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_UP);
	shortcuts_add_shortcut (self, GDK_KEY_Up, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_UP);
	shortcuts_add_shortcut (self, GDK_KEY_Up, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_UP);
	shortcuts_add_shortcut (self, GDK_KEY_Up, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_UP);
	shortcuts_add_shortcut (self, GDK_KEY_Down, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_DOWN);
	shortcuts_add_shortcut (self, GDK_KEY_Down, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_DOWN);
	shortcuts_add_shortcut (self, GDK_KEY_Down, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_DOWN);
	shortcuts_add_shortcut (self, GDK_KEY_Down, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_DOWN);
	shortcuts_add_shortcut (self, GDK_KEY_Page_Up, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_SIBLING_PREV);
	shortcuts_add_shortcut (self, GDK_KEY_Page_Down, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_SIBLING_NEXT);
	shortcuts_add_shortcut (self, GDK_KEY_Control_L, FALSE, FALSE, FALSE, KEY_COMMAND_CONTROL_PRESSED);
	shortcuts_add_shortcut (self, GDK_KEY_Control_R, FALSE, FALSE, FALSE, KEY_COMMAND_CONTROL_PRESSED);
}

static void
shortcuts_create_default_shortcuts (Shortcuts* self)
{
	g_return_if_fail (self != NULL);
	shortcuts_add_default (self, GDK_KEY_n, TRUE, FALSE, FALSE, KEY_COMMAND_FILE_NEW);
	shortcuts_add_default (self, GDK_KEY_o, TRUE, FALSE, FALSE, KEY_COMMAND_FILE_OPEN);
	shortcuts_add_default (self, GDK_KEY_o, TRUE, TRUE, FALSE, KEY_COMMAND_FILE_OPEN_DIR);
	shortcuts_add_default (self, GDK_KEY_s, TRUE, FALSE, FALSE, KEY_COMMAND_FILE_SAVE);
	shortcuts_add_default (self, GDK_KEY_s, TRUE, TRUE, FALSE, KEY_COMMAND_FILE_SAVE_AS);
	shortcuts_add_default (self, GDK_KEY_q, TRUE, FALSE, FALSE, KEY_COMMAND_QUIT);
	shortcuts_add_default (self, GDK_KEY_z, TRUE, FALSE, FALSE, KEY_COMMAND_UNDO_ACTION);
	shortcuts_add_default (self, GDK_KEY_z, TRUE, TRUE, FALSE, KEY_COMMAND_REDO_ACTION);
	shortcuts_add_default (self, GDK_KEY_0, TRUE, FALSE, FALSE, KEY_COMMAND_ZOOM_ACTUAL);
	shortcuts_add_default (self, GDK_KEY_1, TRUE, FALSE, FALSE, KEY_COMMAND_ZOOM_FIT);
	shortcuts_add_default (self, GDK_KEY_2, TRUE, FALSE, FALSE, KEY_COMMAND_ZOOM_SELECTED);
	shortcuts_add_default (self, GDK_KEY_plus, TRUE, FALSE, FALSE, KEY_COMMAND_ZOOM_IN);
	shortcuts_add_default (self, GDK_KEY_minus, TRUE, FALSE, FALSE, KEY_COMMAND_ZOOM_OUT);
	shortcuts_add_default (self, GDK_KEY_p, TRUE, FALSE, FALSE, KEY_COMMAND_FILE_PRINT);
	shortcuts_add_default (self, GDK_KEY_comma, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_PREFERENCES);
	shortcuts_add_default (self, GDK_KEY_question, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_SHORTCUTS);
	shortcuts_add_default (self, GDK_KEY_5, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_CURRENT_SIDEBAR);
	shortcuts_add_default (self, GDK_KEY_6, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_STYLE_SIDEBAR);
	shortcuts_add_default (self, GDK_KEY_7, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_TAG_SIDEBAR);
	shortcuts_add_default (self, GDK_KEY_8, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_STICKER_SIDEBAR);
	shortcuts_add_default (self, GDK_KEY_9, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_MAP_SIDEBAR);
	shortcuts_add_default (self, GDK_KEY_Tab, TRUE, FALSE, FALSE, KEY_COMMAND_TAB_GOTO_NEXT);
	shortcuts_add_default (self, GDK_KEY_Tab, TRUE, TRUE, FALSE, KEY_COMMAND_TAB_GOTO_PREV);
	shortcuts_add_default (self, GDK_KEY_b, TRUE, TRUE, FALSE, KEY_COMMAND_TOGGLE_BRAINDUMP);
	shortcuts_add_default (self, GDK_KEY_f, TRUE, TRUE, FALSE, KEY_COMMAND_TOGGLE_FOCUS_MODE);
	shortcuts_add_default (self, GDK_KEY_f, TRUE, FALSE, FALSE, KEY_COMMAND_SHOW_FIND);
	shortcuts_add_default (self, GDK_KEY_w, TRUE, FALSE, FALSE, KEY_COMMAND_TAB_CLOSE_CURRENT);
	shortcuts_add_default (self, GDK_KEY_c, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_COPY);
	shortcuts_add_default (self, GDK_KEY_x, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CUT);
	shortcuts_add_default (self, GDK_KEY_v, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_PASTE);
	shortcuts_add_default (self, GDK_KEY_v, TRUE, TRUE, FALSE, KEY_COMMAND_NODE_PASTE_REPLACE);
	shortcuts_add_default (self, GDK_KEY_Return, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_INSERT_NEWLINE);
	shortcuts_add_default (self, GDK_KEY_BackSpace, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_REMOVE_WORD_PREV);
	shortcuts_add_default (self, GDK_KEY_Delete, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_REMOVE_WORD_NEXT);
	shortcuts_add_default (self, GDK_KEY_Tab, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_INSERT_TAB);
	shortcuts_add_default (self, GDK_KEY_Right, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_WORD_NEXT);
	shortcuts_add_default (self, GDK_KEY_Right, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_WORD_NEXT);
	shortcuts_add_default (self, GDK_KEY_Left, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_WORD_PREV);
	shortcuts_add_default (self, GDK_KEY_Left, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_WORD_PREV);
	shortcuts_add_default (self, GDK_KEY_Up, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_START_UP);
	shortcuts_add_default (self, GDK_KEY_Up, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_FIRST);
	shortcuts_add_default (self, GDK_KEY_Down, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_END_DOWN);
	shortcuts_add_default (self, GDK_KEY_Down, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_LAST);
	shortcuts_add_default (self, GDK_KEY_Home, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_START_HOME);
	shortcuts_add_default (self, GDK_KEY_Home, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_LINESTART);
	shortcuts_add_default (self, GDK_KEY_End, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_END_END);
	shortcuts_add_default (self, GDK_KEY_End, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CURSOR_LINEEND);
	shortcuts_add_default (self, GDK_KEY_a, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_SELECT_ALL);
	shortcuts_add_default (self, GDK_KEY_a, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_SELECT_NONE);
	shortcuts_add_default (self, GDK_KEY_period, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_INSERT_EMOJI);
	shortcuts_add_default (self, GDK_KEY_e, TRUE, TRUE, FALSE, KEY_COMMAND_NODE_QUICK_ENTRY_INSERT);
	shortcuts_add_default (self, GDK_KEY_k, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_ADD_URL);
	shortcuts_add_default (self, GDK_KEY_k, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_REMOVE_URL);
	shortcuts_add_default (self, GDK_KEY_r, TRUE, TRUE, FALSE, KEY_COMMAND_NODE_QUICK_ENTRY_REPLACE);
	shortcuts_add_default (self, GDK_KEY_y, TRUE, FALSE, FALSE, KEY_COMMAND_NODE_PASTE_NODE_LINK);
	shortcuts_add_default (self, GDK_KEY_b, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_BOLD);
	shortcuts_add_default (self, GDK_KEY_i, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_ITALICS);
	shortcuts_add_default (self, GDK_KEY_x, TRUE, TRUE, FALSE, KEY_COMMAND_EDIT_STRIKE);
	shortcuts_add_default (self, GDK_KEY_grave, TRUE, FALSE, FALSE, KEY_COMMAND_EDIT_CODE);
	shortcuts_add_default (self, GDK_KEY_F10, FALSE, TRUE, FALSE, KEY_COMMAND_SHOW_CONTEXTUAL_MENU);
	shortcuts_add_default (self, GDK_KEY_Menu, FALSE, FALSE, FALSE, KEY_COMMAND_SHOW_CONTEXTUAL_MENU);
	shortcuts_add_default (self, GDK_KEY_minus, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ALIGN_TOP);
	shortcuts_add_default (self, GDK_KEY_equal, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ALIGN_VCENTER);
	shortcuts_add_default (self, GDK_KEY_bracketleft, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ALIGN_LEFT);
	shortcuts_add_default (self, GDK_KEY_bracketright, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ALIGN_RIGHT);
	shortcuts_add_default (self, GDK_KEY_underscore, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_ALIGN_BOTTOM);
	shortcuts_add_default (self, GDK_KEY_a, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_PARENT);
	shortcuts_add_default (self, GDK_KEY_d, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_CHILDREN);
	shortcuts_add_default (self, GDK_KEY_f, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_TOGGLE_FOLDS_SHALLOW);
	shortcuts_add_default (self, GDK_KEY_f, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_TOGGLE_FOLDS_DEEP);
	shortcuts_add_default (self, GDK_KEY_g, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ADD_GROUP);
	shortcuts_add_default (self, GDK_KEY_l, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_CHANGE_LINK_COLOR);
	shortcuts_add_default (self, GDK_KEY_m, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_ROOT);
	shortcuts_add_default (self, GDK_KEY_t, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_CHANGE_TASK);
	shortcuts_add_default (self, GDK_KEY_bar, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_ALIGN_HCENTER);
	shortcuts_add_default (self, GDK_KEY_numbersign, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_TOGGLE_SEQUENCE);
	shortcuts_add_default (self, GDK_KEY_x, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_ADD_CONNECTION);
	shortcuts_add_default (self, GDK_KEY_y, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_TOGGLE_LINKS);
	shortcuts_add_default (self, GDK_KEY_e, FALSE, TRUE, FALSE, KEY_COMMAND_EDIT_NOTE);
	shortcuts_add_default (self, GDK_KEY_i, FALSE, FALSE, FALSE, KEY_COMMAND_SHOW_CURRENT_INFO);
	shortcuts_add_default (self, GDK_KEY_e, FALSE, FALSE, FALSE, KEY_COMMAND_EDIT_SELECTED);
	shortcuts_add_default (self, GDK_KEY_s, FALSE, FALSE, FALSE, KEY_COMMAND_SHOW_SELECTED);
	shortcuts_add_default (self, GDK_KEY_o, FALSE, TRUE, FALSE, KEY_COMMAND_CALLOUT_SELECT_NODE);
	shortcuts_add_default (self, GDK_KEY_f, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_SELECT_FROM);
	shortcuts_add_default (self, GDK_KEY_n, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_SELECT_NEXT);
	shortcuts_add_default (self, GDK_KEY_p, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_SELECT_PREV);
	shortcuts_add_default (self, GDK_KEY_t, FALSE, FALSE, FALSE, KEY_COMMAND_CONNECTION_SELECT_TO);
	shortcuts_add_default (self, GDK_KEY_c, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_CENTER);
	shortcuts_add_default (self, GDK_KEY_d, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_SELECT_TREE);
	shortcuts_add_default (self, GDK_KEY_i, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_CHANGE_IMAGE);
	shortcuts_add_default (self, GDK_KEY_o, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_SELECT_CALLOUT);
	shortcuts_add_default (self, GDK_KEY_s, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_SORT_ALPHABETICALLY);
	shortcuts_add_default (self, GDK_KEY_x, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_SELECT_CONNECTION);
	shortcuts_add_default (self, GDK_KEY_y, FALSE, TRUE, FALSE, KEY_COMMAND_NODE_SELECT_LINKED);
	shortcuts_add_default (self, GDK_KEY_c, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_CHILD);
	shortcuts_add_default (self, GDK_KEY_h, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_LEFT);
	shortcuts_add_default (self, GDK_KEY_j, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_DOWN);
	shortcuts_add_default (self, GDK_KEY_k, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_UP);
	shortcuts_add_default (self, GDK_KEY_l, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_RIGHT);
	shortcuts_add_default (self, GDK_KEY_n, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_SIBLING_NEXT);
	shortcuts_add_default (self, GDK_KEY_o, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_TOGGLE_CALLOUT);
	shortcuts_add_default (self, GDK_KEY_p, FALSE, FALSE, FALSE, KEY_COMMAND_NODE_SELECT_SIBLING_PREV);
	shortcuts_add_default (self, GDK_KEY_Left, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_LEFT);
	shortcuts_add_default (self, GDK_KEY_Right, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_RIGHT);
	shortcuts_add_default (self, GDK_KEY_Up, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_UP);
	shortcuts_add_default (self, GDK_KEY_Down, FALSE, FALSE, TRUE, KEY_COMMAND_NODE_SWAP_DOWN);
}

static xmlNode*
shortcuts_make_property (Shortcuts* self,
                         const gchar* name,
                         const gchar* value,
                         const gchar* translatable)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = xmlNewNode (NULL, (xmlChar*) "property");
	node = _tmp0_;
	_tmp1_ = node;
	xmlSetProp (_tmp1_, (xmlChar*) "name", (xmlChar*) name);
	if (translatable != NULL) {
		xmlNode* _tmp2_;
		_tmp2_ = node;
		xmlSetProp (_tmp2_, (xmlChar*) "translatable", (xmlChar*) translatable);
	}
	_tmp3_ = node;
	xmlNodeSetContent (_tmp3_, (xmlChar*) value);
	_tmp4_ = node;
	result = _tmp4_;
	return result;
}

static xmlNode*
shortcuts_make_object (Shortcuts* self,
                       const gchar* klass,
                       const gchar* id)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	xmlNode* _tmp3_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (klass != NULL, NULL);
	_tmp0_ = xmlNewNode (NULL, (xmlChar*) "object");
	node = _tmp0_;
	_tmp1_ = node;
	xmlSetProp (_tmp1_, (xmlChar*) "class", (xmlChar*) klass);
	if (id != NULL) {
		xmlNode* _tmp2_;
		_tmp2_ = node;
		xmlSetProp (_tmp2_, (xmlChar*) "id", (xmlChar*) id);
	}
	_tmp3_ = node;
	result = _tmp3_;
	return result;
}

static xmlNode*
shortcuts_make_child (Shortcuts* self)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmlNewNode (NULL, (xmlChar*) "child");
	node = _tmp0_;
	result = node;
	return result;
}

static xmlNode*
shortcuts_make_base_section (Shortcuts* self,
                             const gchar* name,
                             const gchar* title,
                             xmlNode** obj)
{
	xmlNode* _vala_obj = NULL;
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = shortcuts_make_child (self);
	node = _tmp0_;
	_tmp1_ = shortcuts_make_object (self, "GtkShortcutsSection", NULL);
	_vala_obj = _tmp1_;
	_tmp2_ = shortcuts_make_property (self, "section-name", name, NULL);
	xmlAddChild (_vala_obj, _tmp2_);
	_tmp3_ = shortcuts_make_property (self, "title", title, "yes");
	xmlAddChild (_vala_obj, _tmp3_);
	_tmp4_ = shortcuts_make_property (self, "visible", "1", NULL);
	xmlAddChild (_vala_obj, _tmp4_);
	xmlAddChild (node, _vala_obj);
	result = node;
	if (obj) {
		*obj = _vala_obj;
	}
	return result;
}

static xmlNode*
shortcuts_make_section (Shortcuts* self,
                        KeyCommand command,
                        xmlNode** obj)
{
	xmlNode* _vala_obj = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	xmlNode* _tmp4_ = NULL;
	xmlNode* _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = key_command_to_string (command);
	_tmp1_ = _tmp0_;
	_tmp2_ = key_command_shortcut_label (command);
	_tmp3_ = _tmp2_;
	_tmp5_ = shortcuts_make_base_section (self, _tmp1_, _tmp3_, &_tmp4_);
	_vala_obj = _tmp4_;
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp6_;
	if (obj) {
		*obj = _vala_obj;
	}
	return result;
}

static xmlNode*
shortcuts_make_base_group (Shortcuts* self,
                           const gchar* title,
                           xmlNode** obj)
{
	xmlNode* _vala_obj = NULL;
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = shortcuts_make_child (self);
	node = _tmp0_;
	_tmp1_ = shortcuts_make_object (self, "GtkShortcutsGroup", NULL);
	_vala_obj = _tmp1_;
	_tmp2_ = shortcuts_make_property (self, "title", title, "yes");
	xmlAddChild (_vala_obj, _tmp2_);
	_tmp3_ = shortcuts_make_property (self, "visible", "1", NULL);
	xmlAddChild (_vala_obj, _tmp3_);
	xmlAddChild (node, _vala_obj);
	result = node;
	if (obj) {
		*obj = _vala_obj;
	}
	return result;
}

static xmlNode*
shortcuts_make_group (Shortcuts* self,
                      KeyCommand command,
                      xmlNode** obj)
{
	xmlNode* _vala_obj = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	xmlNode* _tmp2_ = NULL;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = key_command_shortcut_label (command);
	_tmp1_ = _tmp0_;
	_tmp3_ = shortcuts_make_base_group (self, _tmp1_, &_tmp2_);
	_vala_obj = _tmp2_;
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp1_);
	result = _tmp4_;
	if (obj) {
		*obj = _vala_obj;
	}
	return result;
}

static xmlNode*
shortcuts_make_shortcut (Shortcuts* self,
                         Shortcut* shortcut)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* obj = NULL;
	xmlNode* _tmp1_;
	KeyCommand _tmp2_;
	KeyCommand _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	xmlNode* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	xmlNode* _tmp9_;
	xmlNode* _tmp10_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (shortcut != NULL, NULL);
	_tmp0_ = shortcuts_make_child (self);
	node = _tmp0_;
	_tmp1_ = shortcuts_make_object (self, "GtkShortcutsShortcut", NULL);
	obj = _tmp1_;
	_tmp2_ = shortcut_get_command (shortcut);
	_tmp3_ = _tmp2_;
	_tmp4_ = key_command_shortcut_label (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = shortcuts_make_property (self, "title", _tmp5_, "yes");
	xmlAddChild (obj, _tmp6_);
	_g_free0 (_tmp5_);
	_tmp7_ = shortcut_get_accelerator (shortcut);
	_tmp8_ = _tmp7_;
	_tmp9_ = shortcuts_make_property (self, "accelerator", _tmp8_, NULL);
	xmlAddChild (obj, _tmp9_);
	_g_free0 (_tmp8_);
	_tmp10_ = shortcuts_make_property (self, "visible", "1", NULL);
	xmlAddChild (obj, _tmp10_);
	xmlAddChild (node, obj);
	result = node;
	return result;
}

static xmlNode*
shortcuts_make_mouse_shortcut (Shortcuts* self,
                               const gchar* title,
                               const gchar* subtitle)
{
	xmlNode* node = NULL;
	xmlNode* _tmp0_;
	xmlNode* obj = NULL;
	xmlNode* _tmp1_;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (subtitle != NULL, NULL);
	_tmp0_ = shortcuts_make_child (self);
	node = _tmp0_;
	_tmp1_ = shortcuts_make_object (self, "GtkShortcutsShortcut", NULL);
	obj = _tmp1_;
	_tmp2_ = shortcuts_make_property (self, "title", title, "yes");
	xmlAddChild (obj, _tmp2_);
	_tmp3_ = shortcuts_make_property (self, "subtitle", subtitle, "yes");
	xmlAddChild (obj, _tmp3_);
	_tmp4_ = shortcuts_make_property (self, "visible", "1", NULL);
	xmlAddChild (obj, _tmp4_);
	xmlAddChild (node, obj);
	result = node;
	return result;
}

gchar*
shortcuts_get_ui_string (Shortcuts* self)
{
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_;
	xmlNode* root = NULL;
	xmlNode* _tmp1_;
	xmlDoc* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* window = NULL;
	xmlNode* _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* _tmp7_;
	xmlNode* _tmp8_;
	xmlNode* _tmp9_;
	xmlNode* _tmp10_;
	xmlNode* _tmp11_;
	xmlNode* _tmp12_;
	xmlNode* _tmp13_;
	xmlNode* _tmp14_;
	xmlNode* _tmp15_;
	xmlNode* _tmp16_;
	xmlNode* _tmp17_;
	xmlNode* section = NULL;
	xmlNode* group = NULL;
	gint commands = 0;
	xmlNode* _tmp41_;
	xmlNode* _tmp42_ = NULL;
	xmlNode* _tmp43_;
	xmlNode* _tmp44_;
	xmlNode* _tmp45_ = NULL;
	xmlNode* _tmp46_;
	xmlNode* _tmp47_;
	xmlNode* _tmp48_;
	xmlNode* _tmp49_;
	xmlNode* _tmp50_;
	xmlNode* _tmp51_;
	xmlNode* _tmp52_ = NULL;
	xmlNode* _tmp53_;
	xmlNode* _tmp54_;
	xmlNode* _tmp55_;
	xmlNode* _tmp56_;
	xmlNode* _tmp57_;
	xmlNode* _tmp58_;
	xmlNode* _tmp59_;
	xmlNode* _tmp60_;
	xmlNode* _tmp61_ = NULL;
	xmlNode* _tmp62_;
	xmlNode* _tmp63_;
	xmlNode* _tmp64_;
	xmlNode* _tmp65_;
	xmlNode* _tmp66_;
	xmlNode* _tmp67_;
	xmlNode* _tmp68_;
	xmlNode* _tmp69_;
	xmlNode* _tmp70_;
	xmlNode* _tmp71_;
	xmlNode* _tmp72_;
	xmlNode* _tmp73_;
	xmlNode* _tmp74_ = NULL;
	xmlNode* _tmp75_;
	xmlNode* _tmp76_;
	xmlNode* _tmp77_;
	xmlNode* _tmp78_;
	xmlNode* _tmp79_;
	xmlNode* _tmp80_;
	xmlNode* _tmp81_;
	xmlNode* _tmp82_;
	xmlNode* _tmp83_;
	xmlNode* _tmp84_;
	xmlNode* _tmp85_ = NULL;
	xmlNode* _tmp86_;
	xmlNode* _tmp87_;
	xmlNode* _tmp88_;
	xmlNode* _tmp89_;
	xmlNode* _tmp90_;
	xmlNode* _tmp91_;
	xmlNode* _tmp92_;
	gchar* dump_str = NULL;
	gchar* _tmp93_;
	xmlDoc* _tmp94_;
	gchar* _tmp95_ = NULL;
	xmlDoc* _tmp96_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmlNewDoc ((xmlChar*) "1.0");
	doc = _tmp0_;
	_tmp1_ = xmlNewNode (NULL, (xmlChar*) "interface");
	root = _tmp1_;
	_tmp2_ = doc;
	_tmp3_ = root;
	xmlDocSetRootElement (_tmp2_, _tmp3_);
	_tmp4_ = root;
	xmlSetProp (_tmp4_, (xmlChar*) "domain", (xmlChar*) "com.github.phase1geo.minder");
	_tmp5_ = shortcuts_make_object (self, "GtkShortcutsWindow", "shortcuts");
	window = _tmp5_;
	_tmp6_ = root;
	_tmp7_ = window;
	xmlAddChild (_tmp6_, _tmp7_);
	_tmp8_ = window;
	_tmp9_ = shortcuts_make_property (self, "modal", "0", NULL);
	xmlAddChild (_tmp8_, _tmp9_);
	_tmp10_ = window;
	_tmp11_ = shortcuts_make_property (self, "resizable", "0", NULL);
	xmlAddChild (_tmp10_, _tmp11_);
	_tmp12_ = window;
	_tmp13_ = shortcuts_make_property (self, "title", "Minder Shortcuts", "yes");
	xmlAddChild (_tmp12_, _tmp13_);
	_tmp14_ = window;
	_tmp15_ = shortcuts_make_property (self, "section-name", "global", NULL);
	xmlAddChild (_tmp14_, _tmp15_);
	_tmp16_ = window;
	_tmp17_ = shortcuts_make_property (self, "view-name", "file", NULL);
	xmlAddChild (_tmp16_, _tmp17_);
	section = NULL;
	group = NULL;
	commands = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp18_ = FALSE;
			_tmp18_ = TRUE;
			while (TRUE) {
				KeyCommand command = 0;
				if (!_tmp18_) {
					gint _tmp19_;
					_tmp19_ = i;
					i = _tmp19_ + 1;
				}
				_tmp18_ = FALSE;
				if (!(i < ((gint) KEY_COMMAND_NUM))) {
					break;
				}
				command = (KeyCommand) i;
				if (key_command_viewable (command)) {
					if (key_command_is_section_start (command)) {
						gboolean _tmp20_ = FALSE;
						xmlNode* _tmp21_;
						xmlNode* _tmp24_;
						xmlNode* _tmp25_ = NULL;
						xmlNode* _tmp26_;
						_tmp21_ = group;
						if (_tmp21_ != NULL) {
							_tmp20_ = commands == 0;
						} else {
							_tmp20_ = FALSE;
						}
						if (_tmp20_) {
							xmlNode* _tmp22_;
							xmlNode* _tmp23_;
							_tmp22_ = group;
							_tmp23_ = shortcuts_make_mouse_shortcut (self, _ ("No Shortcuts Set"), "");
							xmlAddChild (_tmp22_, _tmp23_);
						}
						_tmp24_ = window;
						_tmp26_ = shortcuts_make_section (self, command, &_tmp25_);
						section = _tmp25_;
						xmlAddChild (_tmp24_, _tmp26_);
						group = NULL;
					} else {
						if (key_command_is_group_start (command)) {
							gboolean _tmp27_ = FALSE;
							xmlNode* _tmp28_;
							xmlNode* _tmp31_;
							xmlNode* _tmp32_ = NULL;
							xmlNode* _tmp33_;
							_tmp28_ = group;
							if (_tmp28_ != NULL) {
								_tmp27_ = commands == 0;
							} else {
								_tmp27_ = FALSE;
							}
							if (_tmp27_) {
								xmlNode* _tmp29_;
								xmlNode* _tmp30_;
								_tmp29_ = group;
								_tmp30_ = shortcuts_make_mouse_shortcut (self, _ ("No Shortcuts Set"), "");
								xmlAddChild (_tmp29_, _tmp30_);
							}
							commands = 0;
							_tmp31_ = section;
							_tmp33_ = shortcuts_make_group (self, command, &_tmp32_);
							group = _tmp32_;
							xmlAddChild (_tmp31_, _tmp33_);
						} else {
							gboolean _tmp34_ = FALSE;
							if (!key_command_is_section_start (command)) {
								_tmp34_ = !key_command_is_section_end (command);
							} else {
								_tmp34_ = FALSE;
							}
							if (_tmp34_) {
								Shortcut* shortcut = NULL;
								Shortcut* _tmp35_;
								Shortcut* _tmp36_;
								_tmp35_ = shortcuts_get_shortcut (self, command);
								shortcut = _tmp35_;
								_tmp36_ = shortcut;
								if (_tmp36_ != NULL) {
									xmlNode* _tmp37_;
									Shortcut* _tmp38_;
									xmlNode* _tmp39_;
									gint _tmp40_;
									_tmp37_ = group;
									_tmp38_ = shortcut;
									_tmp39_ = shortcuts_make_shortcut (self, _tmp38_);
									xmlAddChild (_tmp37_, _tmp39_);
									_tmp40_ = commands;
									commands = _tmp40_ + 1;
								}
								_shortcut_unref0 (shortcut);
							}
						}
					}
				}
			}
		}
	}
	_tmp41_ = window;
	_tmp43_ = shortcuts_make_base_section (self, "mouse", _ ("Mouse Events"), &_tmp42_);
	section = _tmp42_;
	xmlAddChild (_tmp41_, _tmp43_);
	_tmp44_ = section;
	_tmp46_ = shortcuts_make_base_group (self, _ ("General"), &_tmp45_);
	group = _tmp45_;
	xmlAddChild (_tmp44_, _tmp46_);
	_tmp47_ = group;
	_tmp48_ = shortcuts_make_mouse_shortcut (self, _ ("Show Contextual Menu"), _ ("[Right-click when item is selected]"));
	xmlAddChild (_tmp47_, _tmp48_);
	_tmp49_ = group;
	_tmp50_ = shortcuts_make_mouse_shortcut (self, _ ("Edit Image"), _ ("[Double left-click image]"));
	xmlAddChild (_tmp49_, _tmp50_);
	_tmp51_ = section;
	_tmp53_ = shortcuts_make_base_group (self, _ ("Canvas Movement"), &_tmp52_);
	group = _tmp52_;
	xmlAddChild (_tmp51_, _tmp53_);
	_tmp54_ = group;
	_tmp55_ = shortcuts_make_mouse_shortcut (self, _ ("Pan Canvas"), _ ("[Middle-click + Drag / Alt + Motion]"));
	xmlAddChild (_tmp54_, _tmp55_);
	_tmp56_ = group;
	_tmp57_ = shortcuts_make_mouse_shortcut (self, _ ("Scroll Vertically"), _ ("[Scrollwheel up/down]"));
	xmlAddChild (_tmp56_, _tmp57_);
	_tmp58_ = group;
	_tmp59_ = shortcuts_make_mouse_shortcut (self, _ ("Scroll Horizontally"), _ ("[Scrollwhile left/right]"));
	xmlAddChild (_tmp58_, _tmp59_);
	_tmp60_ = section;
	_tmp62_ = shortcuts_make_base_group (self, _ ("Item Selection"), &_tmp61_);
	group = _tmp61_;
	xmlAddChild (_tmp60_, _tmp62_);
	_tmp63_ = group;
	_tmp64_ = shortcuts_make_mouse_shortcut (self, _ ("Select Single Item"), _ ("[Left-click on item]"));
	xmlAddChild (_tmp63_, _tmp64_);
	_tmp65_ = group;
	_tmp66_ = shortcuts_make_mouse_shortcut (self, _ ("Select Child Nodes"), _ ("[Control + Left-click on parent node]"));
	xmlAddChild (_tmp65_, _tmp66_);
	_tmp67_ = group;
	_tmp68_ = shortcuts_make_mouse_shortcut (self, _ ("Select Node Tree/Subtree"), _ ("[Control + Double left-click on parent node"));
	xmlAddChild (_tmp67_, _tmp68_);
	_tmp69_ = group;
	_tmp70_ = shortcuts_make_mouse_shortcut (self, _ ("Select All Nodes at Same Depth Level"), _ ("[Control + Triple left-click on node]"));
	xmlAddChild (_tmp69_, _tmp70_);
	_tmp71_ = group;
	_tmp72_ = shortcuts_make_mouse_shortcut (self, _ ("Block Selection"), _ ("[Left-click + Drag]"));
	xmlAddChild (_tmp71_, _tmp72_);
	_tmp73_ = section;
	_tmp75_ = shortcuts_make_base_group (self, _ ("Item Selection Toggle"), &_tmp74_);
	group = _tmp74_;
	xmlAddChild (_tmp73_, _tmp75_);
	_tmp76_ = group;
	_tmp77_ = shortcuts_make_mouse_shortcut (self, _ ("Toggle Selection of Item"), _ ("[Shift + Left-click on item]"));
	xmlAddChild (_tmp76_, _tmp77_);
	_tmp78_ = group;
	_tmp79_ = shortcuts_make_mouse_shortcut (self, _ ("Toggle Selection of Child Nodes"), _ ("[Shift + Control + Left-click on item]"));
	xmlAddChild (_tmp78_, _tmp79_);
	_tmp80_ = group;
	_tmp81_ = shortcuts_make_mouse_shortcut (self, _ ("Toggle Selection of Node Tree/Subtree"), _ ("[Shift + Control + Double left-click on parent node]"));
	xmlAddChild (_tmp80_, _tmp81_);
	_tmp82_ = group;
	_tmp83_ = shortcuts_make_mouse_shortcut (self, _ ("Toggle Selection of All Nodes at Same Depth Level"), _ ("Shift + Control + Triple-click on node]"));
	xmlAddChild (_tmp82_, _tmp83_);
	_tmp84_ = section;
	_tmp86_ = shortcuts_make_base_group (self, _ ("Text Selection"), &_tmp85_);
	group = _tmp85_;
	xmlAddChild (_tmp84_, _tmp86_);
	_tmp87_ = group;
	_tmp88_ = shortcuts_make_mouse_shortcut (self, _ ("Set Cursor Insert Point"), _ ("[Left-click in text]"));
	xmlAddChild (_tmp87_, _tmp88_);
	_tmp89_ = group;
	_tmp90_ = shortcuts_make_mouse_shortcut (self, _ ("Select Current Word"), _ ("[Double left-click on word]"));
	xmlAddChild (_tmp89_, _tmp90_);
	_tmp91_ = group;
	_tmp92_ = shortcuts_make_mouse_shortcut (self, _ ("Select all text"), _ ("[Triple left-click text]"));
	xmlAddChild (_tmp91_, _tmp92_);
	_tmp93_ = g_strdup ("");
	dump_str = _tmp93_;
	_tmp94_ = doc;
	xmlDocDumpFormatMemory (_tmp94_, (xmlChar*) (&_tmp95_), NULL, TRUE);
	_g_free0 (dump_str);
	dump_str = _tmp95_;
	_tmp96_ = doc;
	_xmlFreeDoc0 (_tmp96_);
	result = dump_str;
	return result;
}

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

static void
value_shortcuts_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_shortcuts_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		shortcuts_unref (value->data[0].v_pointer);
	}
}

static void
value_shortcuts_copy_value (const GValue* src_value,
                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = shortcuts_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_shortcuts_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_shortcuts_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		Shortcuts * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = shortcuts_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_shortcuts_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	Shortcuts ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = shortcuts_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_shortcuts (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	ParamSpecShortcuts* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_SHORTCUTS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_shortcuts (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUTS), NULL);
	return value->data[0].v_pointer;
}

void
value_set_shortcuts (GValue* value,
                     gpointer v_object)
{
	Shortcuts * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUTS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SHORTCUTS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		shortcuts_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		shortcuts_unref (old);
	}
}

void
value_take_shortcuts (GValue* value,
                      gpointer v_object)
{
	Shortcuts * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SHORTCUTS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SHORTCUTS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		shortcuts_unref (old);
	}
}

static void
shortcuts_class_init (ShortcutsClass * klass,
                      gpointer klass_data)
{
	shortcuts_parent_class = g_type_class_peek_parent (klass);
	((ShortcutsClass *) klass)->finalize = shortcuts_finalize;
	g_type_class_adjust_private_offset (klass, &Shortcuts_private_offset);
	shortcuts_signals[SHORTCUTS_SHORTCUT_CHANGED_SIGNAL] = g_signal_new ("shortcut-changed", TYPE_SHORTCUTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__ENUM_SHORTCUT, G_TYPE_NONE, 2, TYPE_KEY_COMMAND, TYPE_SHORTCUT);
}

static void
shortcuts_instance_init (Shortcuts * self,
                         gpointer klass)
{
	self->priv = shortcuts_get_instance_private (self);
	self->ref_count = 1;
}

static void
shortcuts_finalize (Shortcuts * obj)
{
	Shortcuts * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SHORTCUTS, Shortcuts);
	g_signal_handlers_destroy (self);
	_g_array_unref0 (self->priv->_shortcuts);
	_g_array_unref0 (self->priv->_defaults);
}

static GType
shortcuts_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_shortcuts_init, value_shortcuts_free_value, value_shortcuts_copy_value, value_shortcuts_peek_pointer, "p", value_shortcuts_collect_value, "p", value_shortcuts_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ShortcutsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) shortcuts_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Shortcuts), 0, (GInstanceInitFunc) shortcuts_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType shortcuts_type_id;
	shortcuts_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Shortcuts", &g_define_type_info, &g_define_type_fundamental_info, 0);
	Shortcuts_private_offset = g_type_add_instance_private (shortcuts_type_id, sizeof (ShortcutsPrivate));
	return shortcuts_type_id;
}

GType
shortcuts_get_type (void)
{
	static volatile gsize shortcuts_type_id__once = 0;
	if (g_once_init_enter (&shortcuts_type_id__once)) {
		GType shortcuts_type_id;
		shortcuts_type_id = shortcuts_get_type_once ();
		g_once_init_leave (&shortcuts_type_id__once, shortcuts_type_id);
	}
	return shortcuts_type_id__once;
}

gpointer
shortcuts_ref (gpointer instance)
{
	Shortcuts * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
shortcuts_unref (gpointer instance)
{
	Shortcuts * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SHORTCUTS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

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

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

