/* BaseMenu.c generated by valac 0.56.19, the Vala compiler
 * generated from BaseMenu.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 <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_BASE_MENU (base_menu_get_type ())
#define BASE_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BASE_MENU, BaseMenu))
#define BASE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BASE_MENU, BaseMenuClass))
#define IS_BASE_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BASE_MENU))
#define IS_BASE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BASE_MENU))
#define BASE_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BASE_MENU, BaseMenuClass))

typedef struct _BaseMenu BaseMenu;
typedef struct _BaseMenuClass BaseMenuClass;
typedef struct _BaseMenuPrivate BaseMenuPrivate;

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_DRAW_AREA (draw_area_get_type ())
#define DRAW_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DRAW_AREA, DrawArea))
#define DRAW_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DRAW_AREA, DrawAreaClass))
#define IS_DRAW_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DRAW_AREA))
#define IS_DRAW_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DRAW_AREA))
#define DRAW_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DRAW_AREA, DrawAreaClass))

typedef struct _DrawArea DrawArea;
typedef struct _DrawAreaClass DrawAreaClass;

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

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;

#define TYPE_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 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 _Block4Data Block4Data;
#define _base_menu_unref0(var) ((var == NULL) ? NULL : (var = (base_menu_unref (var), NULL)))
typedef void (*KeyCommandFunc) (MindMap* map, gboolean key_activated, gpointer user_data);
#define _shortcut_unref0(var) ((var == NULL) ? NULL : (var = (shortcut_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _ParamSpecBaseMenu ParamSpecBaseMenu;

struct _BaseMenu {
	GTypeInstance parent_instance;
	volatile int ref_count;
	BaseMenuPrivate * priv;
};

struct _BaseMenuClass {
	GTypeClass parent_class;
	void (*finalize) (BaseMenu *self);
	void (*on_popup) (BaseMenu* self);
	void (*on_popdown) (BaseMenu* self);
};

struct _BaseMenuPrivate {
	GtkApplication* _app;
	MindMap* _map;
	gchar* _group_name;
	GSimpleActionGroup* _group;
	GtkPopoverMenu* _popover;
	GMenu* _menu;
};

struct _Block4Data {
	int _ref_count_;
	BaseMenu* self;
	KeyCommand command;
	gboolean grab_canvas;
};

struct _ParamSpecBaseMenu {
	GParamSpec parent_instance;
};

static gint BaseMenu_private_offset;
static gpointer base_menu_parent_class = NULL;

VALA_EXTERN gpointer base_menu_ref (gpointer instance);
VALA_EXTERN void base_menu_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_base_menu (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_base_menu (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_base_menu (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_base_menu (const GValue* value);
VALA_EXTERN GType base_menu_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BaseMenu, base_menu_unref)
VALA_EXTERN gpointer mind_map_ref (gpointer instance);
VALA_EXTERN void mind_map_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_mind_map (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_mind_map (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_mind_map (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_mind_map (const GValue* value);
VALA_EXTERN GType mind_map_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MindMap, mind_map_unref)
VALA_EXTERN void base_menu_on_popup (BaseMenu* self);
VALA_EXTERN void base_menu_on_popdown (BaseMenu* self);
VALA_EXTERN GType draw_area_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DrawArea, g_object_unref)
VALA_EXTERN BaseMenu* base_menu_new (GtkApplication* app,
                         DrawArea* canvas,
                         const gchar* group);
VALA_EXTERN BaseMenu* base_menu_construct (GType object_type,
                               GtkApplication* app,
                               DrawArea* canvas,
                               const gchar* group);
VALA_EXTERN MindMap* draw_area_get_map (DrawArea* self);
VALA_EXTERN MindMap* base_menu_get_map (BaseMenu* self);
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN MainWindow* mind_map_get_win (MindMap* self);
VALA_EXTERN gpointer 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* main_window_get_shortcuts (MainWindow* self);
VALA_EXTERN GType key_command_get_type (void) G_GNUC_CONST ;
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)
static void base_menu_handle_shortcut_change (BaseMenu* self,
                                       KeyCommand command,
                                       Shortcut* shortcut);
static void _base_menu_handle_shortcut_change_shortcuts_shortcut_changed (Shortcuts* _sender,
                                                                   KeyCommand command,
                                                                   Shortcut* shortcut,
                                                                   gpointer self);
static void _base_menu_on_popdown_gtk_popover_closed (GtkPopover* _sender,
                                               gpointer self);
static void base_menu_real_on_popup (BaseMenu* self);
static void base_menu_real_on_popdown (BaseMenu* self);
VALA_EXTERN void base_menu_show (BaseMenu* self,
                     gdouble x,
                     gdouble y);
VALA_EXTERN void base_menu_hide (BaseMenu* self);
static gchar* base_menu_detailed_name (BaseMenu* self,
                                KeyCommand command);
VALA_EXTERN gchar* key_command_to_string (KeyCommand self);
VALA_EXTERN void base_menu_append_menu_item (BaseMenu* self,
                                 GMenu* menu,
                                 KeyCommand command,
                                 const gchar* label,
                                 gboolean grab_canvas);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda86_ (Block4Data* _data4_,
                  GVariant* v);
VALA_EXTERN KeyCommandFunc key_command_get_func (KeyCommand self,
                                     gpointer* result_target,
                                     GDestroyNotify* result_target_destroy_notify);
VALA_EXTERN DrawArea* mind_map_get_canvas (MindMap* self);
static void ___lambda86__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
VALA_EXTERN Shortcut* shortcuts_get_shortcut (Shortcuts* self,
                                  KeyCommand command);
VALA_EXTERN gchar* shortcut_get_accelerator (Shortcut* self);
VALA_EXTERN void base_menu_change_menu_item_label (BaseMenu* self,
                                       GMenu* menu,
                                       KeyCommand command,
                                       const gchar* label);
VALA_EXTERN void base_menu_set_enabled (BaseMenu* self,
                            KeyCommand command,
                            gboolean enable);
static void base_menu_shortcut_removed (BaseMenu* self,
                                 KeyCommand command);
static void base_menu_shortcut_added (BaseMenu* self,
                               Shortcut* shortcut);
VALA_EXTERN KeyCommand shortcut_get_command (Shortcut* self);
VALA_EXTERN GMenu* base_menu_get_menu (BaseMenu* self);
static void base_menu_finalize (BaseMenu * obj);
static GType base_menu_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
base_menu_get_instance_private (BaseMenu* self)
{
	return G_STRUCT_MEMBER_P (self, BaseMenu_private_offset);
}

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

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

static void
_base_menu_handle_shortcut_change_shortcuts_shortcut_changed (Shortcuts* _sender,
                                                              KeyCommand command,
                                                              Shortcut* shortcut,
                                                              gpointer self)
{
	base_menu_handle_shortcut_change ((BaseMenu*) self, command, shortcut);
}

static void
_base_menu_on_popdown_gtk_popover_closed (GtkPopover* _sender,
                                          gpointer self)
{
	base_menu_on_popdown ((BaseMenu*) self);
}

BaseMenu*
base_menu_construct (GType object_type,
                     GtkApplication* app,
                     DrawArea* canvas,
                     const gchar* group)
{
	BaseMenu* self = NULL;
	MindMap* _tmp0_;
	MindMap* _tmp1_;
	MindMap* _tmp2_;
	GtkApplication* _tmp3_;
	gchar* _tmp4_;
	MindMap* _tmp5_;
	MindMap* _tmp6_;
	MainWindow* _tmp7_;
	MainWindow* _tmp8_;
	Shortcuts* _tmp9_;
	Shortcuts* _tmp10_;
	GSimpleActionGroup* _tmp11_;
	const gchar* _tmp12_;
	GSimpleActionGroup* _tmp13_;
	GMenu* _tmp14_;
	GMenu* _tmp15_;
	GtkPopoverMenu* _tmp16_;
	GtkPopoverMenu* _tmp17_;
	GtkPopoverMenu* _tmp18_;
	g_return_val_if_fail (app != NULL, NULL);
	g_return_val_if_fail (canvas != NULL, NULL);
	g_return_val_if_fail (group != NULL, NULL);
	self = (BaseMenu*) g_type_create_instance (object_type);
	_tmp0_ = draw_area_get_map (canvas);
	_tmp1_ = _tmp0_;
	_tmp2_ = _mind_map_ref0 (_tmp1_);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp2_;
	_tmp3_ = _g_object_ref0 (app);
	_g_object_unref0 (self->priv->_app);
	self->priv->_app = _tmp3_;
	_tmp4_ = g_strdup (group);
	_g_free0 (self->priv->_group_name);
	self->priv->_group_name = _tmp4_;
	_tmp5_ = base_menu_get_map (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = mind_map_get_win (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = main_window_get_shortcuts (_tmp8_);
	_tmp10_ = _tmp9_;
	g_signal_connect (_tmp10_, "shortcut-changed", (GCallback) _base_menu_handle_shortcut_change_shortcuts_shortcut_changed, self);
	_tmp11_ = g_simple_action_group_new ();
	_g_object_unref0 (self->priv->_group);
	self->priv->_group = _tmp11_;
	_tmp12_ = self->priv->_group_name;
	_tmp13_ = self->priv->_group;
	gtk_widget_insert_action_group ((GtkWidget*) canvas, _tmp12_, (GActionGroup*) _tmp13_);
	_tmp14_ = g_menu_new ();
	_g_object_unref0 (self->priv->_menu);
	self->priv->_menu = _tmp14_;
	_tmp15_ = self->priv->_menu;
	_tmp16_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) _tmp15_);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->_popover);
	self->priv->_popover = _tmp16_;
	_tmp17_ = self->priv->_popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp17_, (GtkWidget*) canvas);
	_tmp18_ = self->priv->_popover;
	g_signal_connect ((GtkPopover*) _tmp18_, "closed", (GCallback) _base_menu_on_popdown_gtk_popover_closed, self);
	return self;
}

BaseMenu*
base_menu_new (GtkApplication* app,
               DrawArea* canvas,
               const gchar* group)
{
	return base_menu_construct (TYPE_BASE_MENU, app, canvas, group);
}

static void
base_menu_real_on_popup (BaseMenu* self)
{
}

void
base_menu_on_popup (BaseMenu* self)
{
	BaseMenuClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BASE_MENU_GET_CLASS (self);
	if (_klass_->on_popup) {
		_klass_->on_popup (self);
	}
}

static void
base_menu_real_on_popdown (BaseMenu* self)
{
}

void
base_menu_on_popdown (BaseMenu* self)
{
	BaseMenuClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BASE_MENU_GET_CLASS (self);
	if (_klass_->on_popdown) {
		_klass_->on_popdown (self);
	}
}

void
base_menu_show (BaseMenu* self,
                gdouble x,
                gdouble y)
{
	GdkRectangle rect = {0};
	GdkRectangle _tmp0_ = {0};
	GtkPopoverMenu* _tmp1_;
	GdkRectangle _tmp2_;
	GtkPopoverMenu* _tmp3_;
	g_return_if_fail (self != NULL);
	base_menu_on_popup (self);
	_tmp0_.x = (gint) x;
	_tmp0_.y = (gint) y;
	_tmp0_.width = 1;
	_tmp0_.height = 1;
	rect = _tmp0_;
	_tmp1_ = self->priv->_popover;
	_tmp2_ = rect;
	g_object_set ((GtkPopover*) _tmp1_, "pointing-to", &_tmp2_, NULL);
	_tmp3_ = self->priv->_popover;
	gtk_popover_popup ((GtkPopover*) _tmp3_);
}

void
base_menu_hide (BaseMenu* self)
{
	GtkPopoverMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_popover;
	gtk_popover_popdown ((GtkPopover*) _tmp0_);
}

static gchar*
base_menu_detailed_name (BaseMenu* self,
                         KeyCommand command)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_group_name;
	_tmp1_ = key_command_to_string (command);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("%s.%s", _tmp0_, _tmp2_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		BaseMenu* self;
		self = _data4_->self;
		_base_menu_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda86_ (Block4Data* _data4_,
             GVariant* v)
{
	BaseMenu* self;
	KeyCommandFunc func = NULL;
	gpointer _tmp0_ = NULL;
	GDestroyNotify _tmp1_ = NULL;
	KeyCommandFunc _tmp2_;
	gpointer func_target;
	GDestroyNotify func_target_destroy_notify;
	KeyCommandFunc _tmp3_;
	gpointer _tmp3__target;
	MindMap* _tmp4_;
	MindMap* _tmp5_;
	self = _data4_->self;
	_tmp2_ = key_command_get_func (_data4_->command, &_tmp0_, &_tmp1_);
	func = _tmp2_;
	func_target = _tmp0_;
	func_target_destroy_notify = _tmp1_;
	_tmp3_ = func;
	_tmp3__target = func_target;
	_tmp4_ = base_menu_get_map (self);
	_tmp5_ = _tmp4_;
	_tmp3_ (_tmp5_, FALSE, _tmp3__target);
	if (_data4_->grab_canvas) {
		MindMap* _tmp6_;
		MindMap* _tmp7_;
		DrawArea* _tmp8_;
		DrawArea* _tmp9_;
		_tmp6_ = base_menu_get_map (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = mind_map_get_canvas (_tmp7_);
		_tmp9_ = _tmp8_;
		gtk_widget_grab_focus ((GtkWidget*) _tmp9_);
	}
	(func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
}

static void
___lambda86__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda86_ (self, parameter);
}

void
base_menu_append_menu_item (BaseMenu* self,
                            GMenu* menu,
                            KeyCommand command,
                            const gchar* label,
                            gboolean grab_canvas)
{
	Block4Data* _data4_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GSimpleAction* action = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* _tmp6_;
	GSimpleActionGroup* _tmp7_;
	GSimpleAction* _tmp8_;
	Shortcut* shortcut = NULL;
	MindMap* _tmp9_;
	MainWindow* _tmp10_;
	MainWindow* _tmp11_;
	Shortcuts* _tmp12_;
	Shortcuts* _tmp13_;
	Shortcut* _tmp14_;
	Shortcut* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (menu != NULL);
	g_return_if_fail (label != NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = base_menu_ref (self);
	_data4_->command = command;
	_data4_->grab_canvas = grab_canvas;
	_tmp0_ = base_menu_detailed_name (self, _data4_->command);
	_tmp1_ = _tmp0_;
	g_menu_append (menu, label, _tmp1_);
	_g_free0 (_tmp1_);
	_tmp2_ = key_command_to_string (_data4_->command);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_simple_action_new (_tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	action = _tmp5_;
	_tmp6_ = action;
	g_signal_connect_data (_tmp6_, "activate", (GCallback) ___lambda86__g_simple_action_activate, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp7_ = self->priv->_group;
	_tmp8_ = action;
	g_action_map_add_action ((GActionMap*) _tmp7_, (GAction*) _tmp8_);
	_tmp9_ = self->priv->_map;
	_tmp10_ = mind_map_get_win (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = main_window_get_shortcuts (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = shortcuts_get_shortcut (_tmp13_, _data4_->command);
	shortcut = _tmp14_;
	_tmp15_ = shortcut;
	if (_tmp15_ != NULL) {
		GtkApplication* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		Shortcut* _tmp19_;
		gchar* _tmp20_;
		gchar** _tmp21_;
		gchar** _tmp22_;
		gint _tmp22__length1;
		_tmp16_ = self->priv->_app;
		_tmp17_ = base_menu_detailed_name (self, _data4_->command);
		_tmp18_ = _tmp17_;
		_tmp19_ = shortcut;
		_tmp20_ = shortcut_get_accelerator (_tmp19_);
		_tmp21_ = g_new0 (gchar*, 1 + 1);
		_tmp21_[0] = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp22__length1 = 1;
		gtk_application_set_accels_for_action (_tmp16_, _tmp18_, _tmp22_);
		_tmp22_ = (_vala_array_free (_tmp22_, _tmp22__length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_tmp18_);
	}
	_shortcut_unref0 (shortcut);
	_g_object_unref0 (action);
	block4_data_unref (_data4_);
	_data4_ = NULL;
}

void
base_menu_change_menu_item_label (BaseMenu* self,
                                  GMenu* menu,
                                  KeyCommand command,
                                  const gchar* label)
{
	gchar* detailed_action = NULL;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (menu != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = base_menu_detailed_name (self, command);
	detailed_action = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GVariant* variant = NULL;
				GVariant* _tmp3_;
				gboolean _tmp4_ = FALSE;
				GVariant* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < g_menu_model_get_n_items ((GMenuModel*) menu))) {
					break;
				}
				_tmp3_ = g_menu_model_get_item_attribute_value ((GMenuModel*) menu, i, G_MENU_ATTRIBUTE_ACTION, NULL);
				variant = _tmp3_;
				_tmp5_ = variant;
				if (_tmp5_ != NULL) {
					GVariant* _tmp6_;
					const gchar* _tmp7_;
					const gchar* _tmp8_;
					_tmp6_ = variant;
					_tmp7_ = g_variant_get_string (_tmp6_, NULL);
					_tmp8_ = detailed_action;
					_tmp4_ = g_strcmp0 (_tmp7_, _tmp8_) == 0;
				} else {
					_tmp4_ = FALSE;
				}
				if (_tmp4_) {
					gchar* _tmp9_;
					gchar* _tmp10_;
					g_menu_remove (menu, i);
					_tmp9_ = base_menu_detailed_name (self, command);
					_tmp10_ = _tmp9_;
					g_menu_insert (menu, i, label, _tmp10_);
					_g_free0 (_tmp10_);
					_g_variant_unref0 (variant);
					_g_free0 (detailed_action);
					return;
				}
				_g_variant_unref0 (variant);
			}
		}
	}
	_g_free0 (detailed_action);
}

void
base_menu_set_enabled (BaseMenu* self,
                       KeyCommand command,
                       gboolean enable)
{
	GAction* action = NULL;
	GSimpleActionGroup* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GAction* _tmp3_;
	GAction* _tmp4_;
	GAction* _tmp5_;
	GAction* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_group;
	_tmp1_ = key_command_to_string (command);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_action_map_lookup_action ((GActionMap*) _tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp2_);
	action = _tmp5_;
	_tmp6_ = action;
	if (_tmp6_ != NULL) {
		GAction* _tmp7_;
		_tmp7_ = action;
		g_simple_action_set_enabled (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp7_) : NULL, enable);
	}
	_g_object_unref0 (action);
}

static void
base_menu_handle_shortcut_change (BaseMenu* self,
                                  KeyCommand command,
                                  Shortcut* shortcut)
{
	GAction* action = NULL;
	GSimpleActionGroup* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GAction* _tmp3_;
	GAction* _tmp4_;
	GAction* _tmp5_;
	GAction* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_group;
	_tmp1_ = key_command_to_string (command);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_action_map_lookup_action ((GActionMap*) _tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp2_);
	action = _tmp5_;
	_tmp6_ = action;
	if (_tmp6_ != NULL) {
		if (shortcut == NULL) {
			base_menu_shortcut_removed (self, command);
		} else {
			base_menu_shortcut_added (self, shortcut);
		}
	}
	_g_object_unref0 (action);
}

static void
base_menu_shortcut_removed (BaseMenu* self,
                            KeyCommand command)
{
	GtkApplication* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = base_menu_detailed_name (self, command);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_new0 (gchar*, 0 + 1);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 0;
	gtk_application_set_accels_for_action (_tmp0_, _tmp2_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp2_);
}

static void
base_menu_shortcut_added (BaseMenu* self,
                          Shortcut* shortcut)
{
	GtkApplication* _tmp0_;
	KeyCommand _tmp1_;
	KeyCommand _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcut != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = shortcut_get_command (shortcut);
	_tmp2_ = _tmp1_;
	_tmp3_ = base_menu_detailed_name (self, _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = shortcut_get_accelerator (shortcut);
	_tmp6_ = g_new0 (gchar*, 1 + 1);
	_tmp6_[0] = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 1;
	gtk_application_set_accels_for_action (_tmp0_, _tmp4_, _tmp7_);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp4_);
}

MindMap*
base_menu_get_map (BaseMenu* self)
{
	MindMap* result;
	MindMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_map;
	result = _tmp0_;
	return result;
}

GMenu*
base_menu_get_menu (BaseMenu* self)
{
	GMenu* result;
	GMenu* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_menu;
	result = _tmp0_;
	return result;
}

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

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

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

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

static gchar*
value_base_menu_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		BaseMenu * 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 = base_menu_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_base_menu_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	BaseMenu ** 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 = base_menu_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_base_menu (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	ParamSpecBaseMenu* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_BASE_MENU), 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_base_menu (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BASE_MENU), NULL);
	return value->data[0].v_pointer;
}

void
value_set_base_menu (GValue* value,
                     gpointer v_object)
{
	BaseMenu * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BASE_MENU));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BASE_MENU));
		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;
		base_menu_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		base_menu_unref (old);
	}
}

void
value_take_base_menu (GValue* value,
                      gpointer v_object)
{
	BaseMenu * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BASE_MENU));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BASE_MENU));
		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) {
		base_menu_unref (old);
	}
}

static void
base_menu_class_init (BaseMenuClass * klass,
                      gpointer klass_data)
{
	base_menu_parent_class = g_type_class_peek_parent (klass);
	((BaseMenuClass *) klass)->finalize = base_menu_finalize;
	g_type_class_adjust_private_offset (klass, &BaseMenu_private_offset);
	((BaseMenuClass *) klass)->on_popup = (void (*) (BaseMenu*)) base_menu_real_on_popup;
	((BaseMenuClass *) klass)->on_popdown = (void (*) (BaseMenu*)) base_menu_real_on_popdown;
}

static void
base_menu_instance_init (BaseMenu * self,
                         gpointer klass)
{
	self->priv = base_menu_get_instance_private (self);
	self->ref_count = 1;
}

static void
base_menu_finalize (BaseMenu * obj)
{
	BaseMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BASE_MENU, BaseMenu);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_app);
	_mind_map_unref0 (self->priv->_map);
	_g_free0 (self->priv->_group_name);
	_g_object_unref0 (self->priv->_group);
	_g_object_unref0 (self->priv->_popover);
	_g_object_unref0 (self->priv->_menu);
}

static GType
base_menu_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_base_menu_init, value_base_menu_free_value, value_base_menu_copy_value, value_base_menu_peek_pointer, "p", value_base_menu_collect_value, "p", value_base_menu_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (BaseMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) base_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BaseMenu), 0, (GInstanceInitFunc) base_menu_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 base_menu_type_id;
	base_menu_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BaseMenu", &g_define_type_info, &g_define_type_fundamental_info, 0);
	BaseMenu_private_offset = g_type_add_instance_private (base_menu_type_id, sizeof (BaseMenuPrivate));
	return base_menu_type_id;
}

GType
base_menu_get_type (void)
{
	static volatile gsize base_menu_type_id__once = 0;
	if (g_once_init_enter (&base_menu_type_id__once)) {
		GType base_menu_type_id;
		base_menu_type_id = base_menu_get_type_once ();
		g_once_init_leave (&base_menu_type_id__once, base_menu_type_id);
	}
	return base_menu_type_id__once;
}

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

void
base_menu_unref (gpointer instance)
{
	BaseMenu * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		BASE_MENU_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);
}

