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

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

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.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_UNDO_ITEM (undo_item_get_type ())
#define UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_ITEM, UndoItem))
#define UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_ITEM, UndoItemClass))
#define IS_UNDO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_ITEM))
#define IS_UNDO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_ITEM))
#define UNDO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_ITEM, UndoItemClass))

typedef struct _UndoItem UndoItem;
typedef struct _UndoItemClass UndoItemClass;
typedef struct _UndoItemPrivate UndoItemPrivate;

#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_UNDO_NODES_DELETE (undo_nodes_delete_get_type ())
#define UNDO_NODES_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_DELETE, UndoNodesDelete))
#define UNDO_NODES_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_DELETE, UndoNodesDeleteClass))
#define IS_UNDO_NODES_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_DELETE))
#define IS_UNDO_NODES_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_DELETE))
#define UNDO_NODES_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_DELETE, UndoNodesDeleteClass))

typedef struct _UndoNodesDelete UndoNodesDelete;
typedef struct _UndoNodesDeleteClass UndoNodesDeleteClass;
typedef struct _UndoNodesDeletePrivate UndoNodesDeletePrivate;

#define UNDO_NODES_DELETE_TYPE_NODE_INFO (undo_nodes_delete_node_info_get_type ())
#define UNDO_NODES_DELETE_NODE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNDO_NODES_DELETE_TYPE_NODE_INFO, UndoNodesDeleteNodeInfo))
#define UNDO_NODES_DELETE_NODE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNDO_NODES_DELETE_TYPE_NODE_INFO, UndoNodesDeleteNodeInfoClass))
#define UNDO_NODES_DELETE_IS_NODE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNDO_NODES_DELETE_TYPE_NODE_INFO))
#define UNDO_NODES_DELETE_IS_NODE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNDO_NODES_DELETE_TYPE_NODE_INFO))
#define UNDO_NODES_DELETE_NODE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNDO_NODES_DELETE_TYPE_NODE_INFO, UndoNodesDeleteNodeInfoClass))

typedef struct _UndoNodesDeleteNodeInfo UndoNodesDeleteNodeInfo;
typedef struct _UndoNodesDeleteNodeInfoClass UndoNodesDeleteNodeInfoClass;

#define TYPE_CONNECTION (connection_get_type ())
#define CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTION, Connection))
#define CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTION, ConnectionClass))
#define IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTION))
#define IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTION))
#define CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTION, ConnectionClass))

typedef struct _Connection Connection;
typedef struct _ConnectionClass ConnectionClass;

#define TYPE_UNDO_NODE_GROUPS (undo_node_groups_get_type ())
typedef struct _UndoNodeGroups UndoNodeGroups;

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

typedef struct _Node Node;
typedef struct _NodeClass NodeClass;

#define TYPE_NODE_GROUP (node_group_get_type ())
#define NODE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_GROUP, NodeGroup))
#define NODE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_GROUP, NodeGroupClass))
#define IS_NODE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_GROUP))
#define IS_NODE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_GROUP))
#define NODE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_GROUP, NodeGroupClass))

typedef struct _NodeGroup NodeGroup;
typedef struct _NodeGroupClass NodeGroupClass;
enum  {
	UNDO_NODES_DELETE_0_PROPERTY,
	UNDO_NODES_DELETE_NUM_PROPERTIES
};
static GParamSpec* undo_nodes_delete_properties[UNDO_NODES_DELETE_NUM_PROPERTIES];
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))

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

#define TYPE_ANIMATOR (animator_get_type ())
#define ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ANIMATOR, Animator))
#define ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ANIMATOR, AnimatorClass))
#define IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ANIMATOR))
#define IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ANIMATOR))
#define ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ANIMATOR, AnimatorClass))

typedef struct _Animator Animator;
typedef struct _AnimatorClass AnimatorClass;
typedef struct _UndoNodesDeleteNodeInfoPrivate UndoNodesDeleteNodeInfoPrivate;
#define _undo_nodes_delete_node_info_unref0(var) ((var == NULL) ? NULL : (var = (undo_nodes_delete_node_info_unref (var), NULL)))

#define TYPE_CONNECTIONS (connections_get_type ())
#define CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTIONS, Connections))
#define CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTIONS, ConnectionsClass))
#define IS_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTIONS))
#define IS_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTIONS))
#define CONNECTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTIONS, ConnectionsClass))

typedef struct _Connections Connections;
typedef struct _ConnectionsClass ConnectionsClass;

#define TYPE_NODE_GROUPS (node_groups_get_type ())
#define NODE_GROUPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_GROUPS, NodeGroups))
#define NODE_GROUPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_GROUPS, NodeGroupsClass))
#define IS_NODE_GROUPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_GROUPS))
#define IS_NODE_GROUPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_GROUPS))
#define NODE_GROUPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_GROUPS, NodeGroupsClass))

typedef struct _NodeGroups NodeGroups;
typedef struct _NodeGroupsClass NodeGroupsClass;
#define _undo_node_groups_free0(var) ((var == NULL) ? NULL : (var = (undo_node_groups_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _UndoNodesDeleteParamSpecNodeInfo UndoNodesDeleteParamSpecNodeInfo;

struct _UndoItem {
	GObject parent_instance;
	UndoItemPrivate * priv;
};

struct _UndoItemClass {
	GObjectClass parent_class;
	void (*undo) (UndoItem* self, MindMap* map);
	void (*redo) (UndoItem* self, MindMap* map);
	gboolean (*matches) (UndoItem* self, UndoItem* item);
	void (*replace_with_item) (UndoItem* self, UndoItem* item);
	gchar* (*to_string) (UndoItem* self);
};

struct _UndoNodesDelete {
	UndoItem parent_instance;
	UndoNodesDeletePrivate * priv;
};

struct _UndoNodesDeleteClass {
	UndoItemClass parent_class;
};

struct _UndoNodeGroups {
	Node* node;
	GArray* groups;
};

struct _UndoNodesDeletePrivate {
	GArray* _nodes;
	GArray* _conns;
	GArray* _groups;
};

struct _UndoNodesDeleteNodeInfo {
	GTypeInstance parent_instance;
	volatile int ref_count;
	UndoNodesDeleteNodeInfoPrivate * priv;
	Node* node;
	Node* parent;
	gint index;
};

struct _UndoNodesDeleteNodeInfoClass {
	GTypeClass parent_class;
	void (*finalize) (UndoNodesDeleteNodeInfo *self);
};

struct _UndoNodesDeleteParamSpecNodeInfo {
	GParamSpec parent_instance;
};

static gint UndoNodesDelete_private_offset;
static gpointer undo_nodes_delete_parent_class = NULL;
static gpointer undo_nodes_delete_node_info_parent_class = NULL;

VALA_EXTERN GType undo_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoItem, g_object_unref)
VALA_EXTERN gpointer mind_map_ref (gpointer instance);
VALA_EXTERN void mind_map_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_mind_map (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_mind_map (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_mind_map (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_mind_map (const GValue* value);
VALA_EXTERN GType mind_map_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MindMap, mind_map_unref)
VALA_EXTERN GType undo_nodes_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesDelete, g_object_unref)
static gpointer undo_nodes_delete_node_info_ref (gpointer instance);
static void undo_nodes_delete_node_info_unref (gpointer instance);
static GParamSpec* undo_nodes_delete_param_spec_node_info (const gchar* name,
                                                    const gchar* nick,
                                                    const gchar* blurb,
                                                    GType object_type,
                                                    GParamFlags flags) G_GNUC_UNUSED ;
static void undo_nodes_delete_value_set_node_info (GValue* value,
                                            gpointer v_object) G_GNUC_UNUSED ;
static void undo_nodes_delete_value_take_node_info (GValue* value,
                                             gpointer v_object) G_GNUC_UNUSED ;
static gpointer undo_nodes_delete_value_get_node_info (const GValue* value) G_GNUC_UNUSED ;
static GType undo_nodes_delete_node_info_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesDeleteNodeInfo, undo_nodes_delete_node_info_unref)
VALA_EXTERN GType connection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Connection, g_object_unref)
VALA_EXTERN GType undo_node_groups_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
VALA_EXTERN GType node_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroup, g_object_unref)
VALA_EXTERN UndoNodeGroups* undo_node_groups_dup (const UndoNodeGroups* self);
VALA_EXTERN void undo_node_groups_free (UndoNodeGroups* self);
VALA_EXTERN void undo_node_groups_copy (const UndoNodeGroups* self,
                            UndoNodeGroups* dest);
VALA_EXTERN void undo_node_groups_destroy (UndoNodeGroups* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (UndoNodeGroups, undo_node_groups_destroy)
VALA_EXTERN void undo_item_undo (UndoItem* self,
                     MindMap* map);
VALA_EXTERN void undo_item_redo (UndoItem* self,
                     MindMap* map);
VALA_EXTERN UndoNodesDelete* undo_nodes_delete_new (GArray* nodes,
                                        GArray* conns,
                                        GArray* groups,
                                        const gchar* label);
VALA_EXTERN UndoNodesDelete* undo_nodes_delete_construct (GType object_type,
                                              GArray* nodes,
                                              GArray* conns,
                                              GArray* groups,
                                              const gchar* label);
VALA_EXTERN UndoItem* undo_item_new (const gchar* name);
VALA_EXTERN UndoItem* undo_item_construct (GType object_type,
                               const gchar* name);
static void _undo_nodes_delete_node_info_unref0_ (gpointer var);
static void _vala_UndoNodesDeleteNodeInfo_free_function_content_of (gpointer data);
static UndoNodesDeleteNodeInfo* undo_nodes_delete_node_info_new (Node* n);
static UndoNodesDeleteNodeInfo* undo_nodes_delete_node_info_construct (GType object_type,
                                                                Node* n);
static void undo_nodes_delete_real_undo (UndoItem* base,
                                  MindMap* map);
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 gboolean selection_clear (Selection* self,
                          gboolean signal_change,
                          gdouble alpha);
VALA_EXTERN GType animator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Animator, g_object_unref)
VALA_EXTERN Animator* mind_map_get_animator (MindMap* self);
VALA_EXTERN void animator_add_nodes (Animator* self,
                         GArray* n,
                         gboolean exclude_selected,
                         const gchar* name);
VALA_EXTERN GArray* mind_map_get_nodes (MindMap* self);
VALA_EXTERN void node_attach_only (Node* self,
                       Node* prev_parent,
                       gint prev_index);
VALA_EXTERN gboolean selection_add_node (Selection* self,
                             Node* node,
                             gboolean force_selected,
                             gboolean signal_change);
VALA_EXTERN gpointer connections_ref (gpointer instance);
VALA_EXTERN void connections_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_connections (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_connections (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_connections (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_connections (const GValue* value);
VALA_EXTERN GType connections_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Connections, connections_unref)
VALA_EXTERN Connections* mind_map_get_connections (MindMap* self);
VALA_EXTERN void connections_add_connections (Connections* self,
                                  GArray* conns);
VALA_EXTERN gpointer node_groups_ref (gpointer instance);
VALA_EXTERN void node_groups_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_groups (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_node_groups (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_node_groups (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_node_groups (const GValue* value);
VALA_EXTERN GType node_groups_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroups, node_groups_unref)
VALA_EXTERN NodeGroups* mind_map_get_groups (MindMap* self);
VALA_EXTERN void node_groups_apply_undos (NodeGroups* self,
                              GArray* g);
VALA_EXTERN void animator_animate (Animator* self);
VALA_EXTERN void mind_map_auto_save (MindMap* self);
static void undo_nodes_delete_real_redo (UndoItem* base,
                                  MindMap* map);
VALA_EXTERN gboolean selection_clear_nodes (Selection* self,
                                gboolean signal_change,
                                gdouble alpha);
VALA_EXTERN void node_delete_only (Node* self);
VALA_EXTERN void node_groups_remove_node (NodeGroups* self,
                              Node* node,
                              UndoNodeGroups** affected);
VALA_EXTERN void connections_remove_connections (Connections* self,
                                     GArray* conns,
                                     gboolean disconnect);
VALA_EXTERN Node* node_get_parent (Node* self);
VALA_EXTERN gint node_index (Node* self);
static void undo_nodes_delete_node_info_finalize (UndoNodesDeleteNodeInfo * obj);
static GType undo_nodes_delete_node_info_get_type_once (void);
static void undo_nodes_delete_finalize (GObject * obj);
static GType undo_nodes_delete_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
undo_nodes_delete_get_instance_private (UndoNodesDelete* self)
{
	return G_STRUCT_MEMBER_P (self, UndoNodesDelete_private_offset);
}

static void
_undo_nodes_delete_node_info_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (undo_nodes_delete_node_info_unref (var), NULL));
}

static void
_vala_UndoNodesDeleteNodeInfo_free_function_content_of (gpointer data)
{
	UndoNodesDeleteNodeInfo* self;
	self = *((UndoNodesDeleteNodeInfo**) data);
	_undo_nodes_delete_node_info_unref0_ (self);
}

static gpointer
_g_array_ref0 (gpointer self)
{
	return self ? g_array_ref (self) : NULL;
}

UndoNodesDelete*
undo_nodes_delete_construct (GType object_type,
                             GArray* nodes,
                             GArray* conns,
                             GArray* groups,
                             const gchar* label)
{
	UndoNodesDelete * self = NULL;
	GArray* _tmp0_;
	GArray* _tmp6_;
	GArray* _tmp7_;
	g_return_val_if_fail (nodes != NULL, NULL);
	g_return_val_if_fail (conns != NULL, NULL);
	g_return_val_if_fail (groups != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	self = (UndoNodesDelete*) undo_item_construct (object_type, label);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (UndoNodesDeleteNodeInfo*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_UndoNodesDeleteNodeInfo_free_function_content_of);
	_g_array_unref0 (self->priv->_nodes);
	self->priv->_nodes = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GArray* _tmp3_;
				Node* _tmp4_;
				UndoNodesDeleteNodeInfo* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (nodes, Node*, (guint) i);
				_tmp5_ = undo_nodes_delete_node_info_new (_tmp4_);
				g_array_append_val (_tmp3_, _tmp5_);
			}
		}
	}
	_tmp6_ = _g_array_ref0 (conns);
	_g_array_unref0 (self->priv->_conns);
	self->priv->_conns = _tmp6_;
	_tmp7_ = _g_array_ref0 (groups);
	_g_array_unref0 (self->priv->_groups);
	self->priv->_groups = _tmp7_;
	return self;
}

UndoNodesDelete*
undo_nodes_delete_new (GArray* nodes,
                       GArray* conns,
                       GArray* groups,
                       const gchar* label)
{
	return undo_nodes_delete_construct (TYPE_UNDO_NODES_DELETE, nodes, conns, groups, label);
}

static gpointer
_undo_nodes_delete_node_info_ref0 (gpointer self)
{
	return self ? undo_nodes_delete_node_info_ref (self) : NULL;
}

static void
undo_nodes_delete_real_undo (UndoItem* base,
                             MindMap* map)
{
	UndoNodesDelete * self;
	Selection* _tmp0_;
	Selection* _tmp1_;
	Animator* _tmp2_;
	Animator* _tmp3_;
	GArray* _tmp4_;
	GArray* _tmp5_;
	Connections* _tmp21_;
	Connections* _tmp22_;
	GArray* _tmp23_;
	NodeGroups* _tmp24_;
	NodeGroups* _tmp25_;
	GArray* _tmp26_;
	Animator* _tmp27_;
	Animator* _tmp28_;
	self = (UndoNodesDelete*) base;
	g_return_if_fail (map != NULL);
	_tmp0_ = mind_map_get_selected (map);
	_tmp1_ = _tmp0_;
	selection_clear (_tmp1_, TRUE, 1.0);
	_tmp2_ = mind_map_get_animator (map);
	_tmp3_ = _tmp2_;
	_tmp4_ = mind_map_get_nodes (map);
	_tmp5_ = _tmp4_;
	animator_add_nodes (_tmp3_, _tmp5_, FALSE, "UndoNodesDelete.undo");
	_g_array_unref0 (_tmp5_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				GArray* _tmp8_;
				UndoNodesDeleteNodeInfo* ni = NULL;
				GArray* _tmp9_;
				UndoNodesDeleteNodeInfo* _tmp10_;
				UndoNodesDeleteNodeInfo* _tmp11_;
				UndoNodesDeleteNodeInfo* _tmp12_;
				Node* _tmp13_;
				UndoNodesDeleteNodeInfo* _tmp14_;
				Node* _tmp15_;
				UndoNodesDeleteNodeInfo* _tmp16_;
				Selection* _tmp17_;
				Selection* _tmp18_;
				UndoNodesDeleteNodeInfo* _tmp19_;
				Node* _tmp20_;
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				_tmp8_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp8_->len)) {
					break;
				}
				_tmp9_ = self->priv->_nodes;
				_tmp10_ = g_array_index (_tmp9_, UndoNodesDeleteNodeInfo*, (guint) i);
				_tmp11_ = _undo_nodes_delete_node_info_ref0 (_tmp10_);
				ni = _tmp11_;
				_tmp12_ = ni;
				_tmp13_ = _tmp12_->node;
				_tmp14_ = ni;
				_tmp15_ = _tmp14_->parent;
				_tmp16_ = ni;
				node_attach_only (_tmp13_, _tmp15_, _tmp16_->index);
				_tmp17_ = mind_map_get_selected (map);
				_tmp18_ = _tmp17_;
				_tmp19_ = ni;
				_tmp20_ = _tmp19_->node;
				selection_add_node (_tmp18_, _tmp20_, FALSE, TRUE);
				_undo_nodes_delete_node_info_unref0 (ni);
			}
		}
	}
	_tmp21_ = mind_map_get_connections (map);
	_tmp22_ = _tmp21_;
	_tmp23_ = self->priv->_conns;
	connections_add_connections (_tmp22_, _tmp23_);
	_tmp24_ = mind_map_get_groups (map);
	_tmp25_ = _tmp24_;
	_tmp26_ = self->priv->_groups;
	node_groups_apply_undos (_tmp25_, _tmp26_);
	_tmp27_ = mind_map_get_animator (map);
	_tmp28_ = _tmp27_;
	animator_animate (_tmp28_);
	mind_map_auto_save (map);
}

static void
undo_nodes_delete_real_redo (UndoItem* base,
                             MindMap* map)
{
	UndoNodesDelete * self;
	Selection* _tmp0_;
	Selection* _tmp1_;
	Animator* _tmp10_;
	Animator* _tmp11_;
	GArray* _tmp12_;
	GArray* _tmp13_;
	Selection* _tmp14_;
	Selection* _tmp15_;
	Connections* _tmp27_;
	Connections* _tmp28_;
	GArray* _tmp29_;
	Animator* _tmp30_;
	Animator* _tmp31_;
	self = (UndoNodesDelete*) base;
	g_return_if_fail (map != NULL);
	_tmp0_ = mind_map_get_selected (map);
	_tmp1_ = _tmp0_;
	selection_clear (_tmp1_, TRUE, 1.0);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GArray* _tmp4_;
				Selection* _tmp5_;
				Selection* _tmp6_;
				GArray* _tmp7_;
				UndoNodesDeleteNodeInfo* _tmp8_;
				Node* _tmp9_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp4_->len)) {
					break;
				}
				_tmp5_ = mind_map_get_selected (map);
				_tmp6_ = _tmp5_;
				_tmp7_ = self->priv->_nodes;
				_tmp8_ = g_array_index (_tmp7_, UndoNodesDeleteNodeInfo*, (guint) i);
				_tmp9_ = _tmp8_->node;
				selection_add_node (_tmp6_, _tmp9_, TRUE, FALSE);
			}
		}
	}
	_tmp10_ = mind_map_get_animator (map);
	_tmp11_ = _tmp10_;
	_tmp12_ = mind_map_get_nodes (map);
	_tmp13_ = _tmp12_;
	animator_add_nodes (_tmp11_, _tmp13_, TRUE, "UndoNodesDelete.redo");
	_g_array_unref0 (_tmp13_);
	_tmp14_ = mind_map_get_selected (map);
	_tmp15_ = _tmp14_;
	selection_clear_nodes (_tmp15_, FALSE, 1.0);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp16_ = FALSE;
			_tmp16_ = TRUE;
			while (TRUE) {
				GArray* _tmp18_;
				UndoNodeGroups* tmp_group = NULL;
				GArray* _tmp19_;
				UndoNodesDeleteNodeInfo* _tmp20_;
				Node* _tmp21_;
				NodeGroups* _tmp22_;
				NodeGroups* _tmp23_;
				GArray* _tmp24_;
				UndoNodesDeleteNodeInfo* _tmp25_;
				Node* _tmp26_;
				if (!_tmp16_) {
					gint _tmp17_;
					_tmp17_ = i;
					i = _tmp17_ + 1;
				}
				_tmp16_ = FALSE;
				_tmp18_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp18_->len)) {
					break;
				}
				tmp_group = NULL;
				_tmp19_ = self->priv->_nodes;
				_tmp20_ = g_array_index (_tmp19_, UndoNodesDeleteNodeInfo*, (guint) i);
				_tmp21_ = _tmp20_->node;
				node_delete_only (_tmp21_);
				_tmp22_ = mind_map_get_groups (map);
				_tmp23_ = _tmp22_;
				_tmp24_ = self->priv->_nodes;
				_tmp25_ = g_array_index (_tmp24_, UndoNodesDeleteNodeInfo*, (guint) i);
				_tmp26_ = _tmp25_->node;
				node_groups_remove_node (_tmp23_, _tmp26_, &tmp_group);
				_undo_node_groups_free0 (tmp_group);
			}
		}
	}
	_tmp27_ = mind_map_get_connections (map);
	_tmp28_ = _tmp27_;
	_tmp29_ = self->priv->_conns;
	connections_remove_connections (_tmp28_, _tmp29_, FALSE);
	_tmp30_ = mind_map_get_animator (map);
	_tmp31_ = _tmp30_;
	animator_animate (_tmp31_);
	mind_map_auto_save (map);
}

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

static UndoNodesDeleteNodeInfo*
undo_nodes_delete_node_info_construct (GType object_type,
                                       Node* n)
{
	UndoNodesDeleteNodeInfo* self = NULL;
	Node* _tmp0_;
	Node* _tmp1_;
	Node* _tmp2_;
	Node* _tmp3_;
	g_return_val_if_fail (n != NULL, NULL);
	self = (UndoNodesDeleteNodeInfo*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (n);
	_g_object_unref0 (self->node);
	self->node = _tmp0_;
	_tmp1_ = node_get_parent (n);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->parent);
	self->parent = _tmp3_;
	self->index = node_index (n);
	return self;
}

static UndoNodesDeleteNodeInfo*
undo_nodes_delete_node_info_new (Node* n)
{
	return undo_nodes_delete_node_info_construct (UNDO_NODES_DELETE_TYPE_NODE_INFO, n);
}

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

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

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

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

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

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

static GParamSpec*
undo_nodes_delete_param_spec_node_info (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags)
{
	UndoNodesDeleteParamSpecNodeInfo* spec;
	g_return_val_if_fail (g_type_is_a (object_type, UNDO_NODES_DELETE_TYPE_NODE_INFO), 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);
}

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

static void
undo_nodes_delete_value_set_node_info (GValue* value,
                                       gpointer v_object)
{
	UndoNodesDeleteNodeInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNDO_NODES_DELETE_TYPE_NODE_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNDO_NODES_DELETE_TYPE_NODE_INFO));
		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;
		undo_nodes_delete_node_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		undo_nodes_delete_node_info_unref (old);
	}
}

static void
undo_nodes_delete_value_take_node_info (GValue* value,
                                        gpointer v_object)
{
	UndoNodesDeleteNodeInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNDO_NODES_DELETE_TYPE_NODE_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNDO_NODES_DELETE_TYPE_NODE_INFO));
		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) {
		undo_nodes_delete_node_info_unref (old);
	}
}

static void
undo_nodes_delete_node_info_class_init (UndoNodesDeleteNodeInfoClass * klass,
                                        gpointer klass_data)
{
	undo_nodes_delete_node_info_parent_class = g_type_class_peek_parent (klass);
	((UndoNodesDeleteNodeInfoClass *) klass)->finalize = undo_nodes_delete_node_info_finalize;
}

static void
undo_nodes_delete_node_info_instance_init (UndoNodesDeleteNodeInfo * self,
                                           gpointer klass)
{
	self->ref_count = 1;
}

static void
undo_nodes_delete_node_info_finalize (UndoNodesDeleteNodeInfo * obj)
{
	UndoNodesDeleteNodeInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNDO_NODES_DELETE_TYPE_NODE_INFO, UndoNodesDeleteNodeInfo);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->node);
	_g_object_unref0 (self->parent);
}

static GType
undo_nodes_delete_node_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { undo_nodes_delete_value_node_info_init, undo_nodes_delete_value_node_info_free_value, undo_nodes_delete_value_node_info_copy_value, undo_nodes_delete_value_node_info_peek_pointer, "p", undo_nodes_delete_value_node_info_collect_value, "p", undo_nodes_delete_value_node_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (UndoNodesDeleteNodeInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) undo_nodes_delete_node_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UndoNodesDeleteNodeInfo), 0, (GInstanceInitFunc) undo_nodes_delete_node_info_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 undo_nodes_delete_node_info_type_id;
	undo_nodes_delete_node_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "UndoNodesDeleteNodeInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return undo_nodes_delete_node_info_type_id;
}

static GType
undo_nodes_delete_node_info_get_type (void)
{
	static volatile gsize undo_nodes_delete_node_info_type_id__once = 0;
	if (g_once_init_enter (&undo_nodes_delete_node_info_type_id__once)) {
		GType undo_nodes_delete_node_info_type_id;
		undo_nodes_delete_node_info_type_id = undo_nodes_delete_node_info_get_type_once ();
		g_once_init_leave (&undo_nodes_delete_node_info_type_id__once, undo_nodes_delete_node_info_type_id);
	}
	return undo_nodes_delete_node_info_type_id__once;
}

static gpointer
undo_nodes_delete_node_info_ref (gpointer instance)
{
	UndoNodesDeleteNodeInfo * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
undo_nodes_delete_node_info_unref (gpointer instance)
{
	UndoNodesDeleteNodeInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		UNDO_NODES_DELETE_NODE_INFO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
undo_nodes_delete_class_init (UndoNodesDeleteClass * klass,
                              gpointer klass_data)
{
	undo_nodes_delete_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &UndoNodesDelete_private_offset);
	((UndoItemClass *) klass)->undo = (void (*) (UndoItem*, MindMap*)) undo_nodes_delete_real_undo;
	((UndoItemClass *) klass)->redo = (void (*) (UndoItem*, MindMap*)) undo_nodes_delete_real_redo;
	G_OBJECT_CLASS (klass)->finalize = undo_nodes_delete_finalize;
}

static void
undo_nodes_delete_instance_init (UndoNodesDelete * self,
                                 gpointer klass)
{
	self->priv = undo_nodes_delete_get_instance_private (self);
}

static void
undo_nodes_delete_finalize (GObject * obj)
{
	UndoNodesDelete * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_UNDO_NODES_DELETE, UndoNodesDelete);
	_g_array_unref0 (self->priv->_nodes);
	_g_array_unref0 (self->priv->_conns);
	_g_array_unref0 (self->priv->_groups);
	G_OBJECT_CLASS (undo_nodes_delete_parent_class)->finalize (obj);
}

static GType
undo_nodes_delete_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UndoNodesDeleteClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) undo_nodes_delete_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UndoNodesDelete), 0, (GInstanceInitFunc) undo_nodes_delete_instance_init, NULL };
	GType undo_nodes_delete_type_id;
	undo_nodes_delete_type_id = g_type_register_static (TYPE_UNDO_ITEM, "UndoNodesDelete", &g_define_type_info, 0);
	UndoNodesDelete_private_offset = g_type_add_instance_private (undo_nodes_delete_type_id, sizeof (UndoNodesDeletePrivate));
	return undo_nodes_delete_type_id;
}

GType
undo_nodes_delete_get_type (void)
{
	static volatile gsize undo_nodes_delete_type_id__once = 0;
	if (g_once_init_enter (&undo_nodes_delete_type_id__once)) {
		GType undo_nodes_delete_type_id;
		undo_nodes_delete_type_id = undo_nodes_delete_get_type_once ();
		g_once_init_leave (&undo_nodes_delete_type_id__once, undo_nodes_delete_type_id);
	}
	return undo_nodes_delete_type_id__once;
}

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

