/* UndoNodeDelete.c generated by valac 0.56.19, the Vala compiler
 * generated from UndoNodeDelete.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 <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

#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_NODE_DELETE (undo_node_delete_get_type ())
#define UNDO_NODE_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_DELETE, UndoNodeDelete))
#define UNDO_NODE_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_DELETE, UndoNodeDeleteClass))
#define IS_UNDO_NODE_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_DELETE))
#define IS_UNDO_NODE_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_DELETE))
#define UNDO_NODE_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_DELETE, UndoNodeDeleteClass))

typedef struct _UndoNodeDelete UndoNodeDelete;
typedef struct _UndoNodeDeleteClass UndoNodeDeleteClass;
typedef struct _UndoNodeDeletePrivate UndoNodeDeletePrivate;

#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_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_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_NODE_DELETE_0_PROPERTY,
	UNDO_NODE_DELETE_NUM_PROPERTIES
};
static GParamSpec* undo_node_delete_properties[UNDO_NODE_DELETE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _undo_node_groups_free0(var) ((var == NULL) ? NULL : (var = (undo_node_groups_free (var), NULL)))

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

#define TYPE_MAP_MODEL (map_model_get_type ())
#define MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_MODEL, MapModel))
#define MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_MODEL, MapModelClass))
#define IS_MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_MODEL))
#define IS_MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_MODEL))
#define MAP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_MODEL, MapModelClass))

typedef struct _MapModel MapModel;
typedef struct _MapModelClass MapModelClass;

#define TYPE_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;
typedef enum  {
	NODE_SIDE_LEFT = 1,
	NODE_SIDE_TOP = 2,
	NODE_SIDE_RIGHT = 4,
	NODE_SIDE_BOTTOM = 8
} NodeSide;

#define TYPE_NODE_SIDE (node_side_get_type ())

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 _UndoNodeDelete {
	UndoItem parent_instance;
	UndoNodeDeletePrivate * priv;
};

struct _UndoNodeDeleteClass {
	UndoItemClass parent_class;
};

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

struct _UndoNodeDeletePrivate {
	Node* _node;
	Node* _parent;
	gint _index;
	GArray* _conns;
	UndoNodeGroups* _groups;
};

static gint UndoNodeDelete_private_offset;
static gpointer undo_node_delete_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_node_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeDelete, g_object_unref)
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_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_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 UndoNodeDelete* undo_node_delete_new (Node* n,
                                      gint index,
                                      GArray* conns,
                                      UndoNodeGroups* groups);
VALA_EXTERN UndoNodeDelete* undo_node_delete_construct (GType object_type,
                                            Node* n,
                                            gint index,
                                            GArray* conns,
                                            UndoNodeGroups* groups);
VALA_EXTERN UndoItem* undo_item_new (const gchar* name);
VALA_EXTERN UndoItem* undo_item_construct (GType object_type,
                               const gchar* name);
VALA_EXTERN Node* node_get_parent (Node* self);
static void undo_node_delete_real_undo (UndoItem* base,
                                 MindMap* map);
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 gpointer map_model_ref (gpointer instance);
VALA_EXTERN void map_model_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_map_model (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_map_model (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_map_model (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_map_model (const GValue* value);
VALA_EXTERN GType map_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MapModel, map_model_unref)
VALA_EXTERN MapModel* mind_map_get_model (MindMap* self);
VALA_EXTERN void map_model_add_root (MapModel* self,
                         Node* n,
                         gint index);
VALA_EXTERN void node_set_attached (Node* self,
                        gboolean value);
VALA_EXTERN void node_attach_init (Node* self,
                       Node* parent,
                       gint index);
VALA_EXTERN void mind_map_set_current_node (MindMap* self,
                                Node* n);
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_connection (Connections* self,
                                 Connection* conn);
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_undo (NodeGroups* self,
                             UndoNodeGroups* g);
VALA_EXTERN void animator_animate (Animator* self);
VALA_EXTERN void mind_map_auto_save (MindMap* self);
static void undo_node_delete_real_redo (UndoItem* base,
                                 MindMap* map);
VALA_EXTERN void map_model_remove_root (MapModel* self,
                            gint index);
VALA_EXTERN GType node_side_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void node_detach (Node* self,
                  NodeSide side);
VALA_EXTERN NodeSide node_get_side (Node* self);
VALA_EXTERN gboolean connections_remove_connection (Connections* self,
                                        Connection* conn,
                                        gboolean disconnect);
VALA_EXTERN void node_groups_remove_node (NodeGroups* self,
                              Node* node,
                              UndoNodeGroups** affected);
static void undo_node_delete_finalize (GObject * obj);
static GType undo_node_delete_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
undo_node_delete_get_instance_private (UndoNodeDelete* self)
{
	return G_STRUCT_MEMBER_P (self, UndoNodeDelete_private_offset);
}

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

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

static gpointer
_undo_node_groups_dup0 (gpointer self)
{
	return self ? undo_node_groups_dup (self) : NULL;
}

UndoNodeDelete*
undo_node_delete_construct (GType object_type,
                            Node* n,
                            gint index,
                            GArray* conns,
                            UndoNodeGroups* groups)
{
	UndoNodeDelete * self = NULL;
	Node* _tmp0_;
	Node* _tmp1_;
	Node* _tmp2_;
	Node* _tmp3_;
	GArray* _tmp4_;
	UndoNodeGroups* _tmp5_;
	g_return_val_if_fail (n != NULL, NULL);
	g_return_val_if_fail (conns != NULL, NULL);
	self = (UndoNodeDelete*) undo_item_construct (object_type, _ ("delete node"));
	_tmp0_ = _g_object_ref0 (n);
	_g_object_unref0 (self->priv->_node);
	self->priv->_node = _tmp0_;
	_tmp1_ = node_get_parent (n);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->_parent);
	self->priv->_parent = _tmp3_;
	self->priv->_index = index;
	_tmp4_ = _g_array_ref0 (conns);
	_g_array_unref0 (self->priv->_conns);
	self->priv->_conns = _tmp4_;
	_tmp5_ = _undo_node_groups_dup0 (groups);
	_undo_node_groups_free0 (self->priv->_groups);
	self->priv->_groups = _tmp5_;
	return self;
}

UndoNodeDelete*
undo_node_delete_new (Node* n,
                      gint index,
                      GArray* conns,
                      UndoNodeGroups* groups)
{
	return undo_node_delete_construct (TYPE_UNDO_NODE_DELETE, n, index, conns, groups);
}

static void
undo_node_delete_real_undo (UndoItem* base,
                            MindMap* map)
{
	UndoNodeDelete * self;
	Animator* _tmp0_;
	Animator* _tmp1_;
	GArray* _tmp2_;
	GArray* _tmp3_;
	Node* _tmp4_;
	Node* _tmp11_;
	NodeGroups* _tmp19_;
	NodeGroups* _tmp20_;
	UndoNodeGroups* _tmp21_;
	Animator* _tmp22_;
	Animator* _tmp23_;
	self = (UndoNodeDelete*) base;
	g_return_if_fail (map != NULL);
	_tmp0_ = mind_map_get_animator (map);
	_tmp1_ = _tmp0_;
	_tmp2_ = mind_map_get_nodes (map);
	_tmp3_ = _tmp2_;
	animator_add_nodes (_tmp1_, _tmp3_, FALSE, "UndoNodeDelete.undo");
	_g_array_unref0 (_tmp3_);
	_tmp4_ = self->priv->_parent;
	if (_tmp4_ == NULL) {
		MapModel* _tmp5_;
		MapModel* _tmp6_;
		Node* _tmp7_;
		_tmp5_ = mind_map_get_model (map);
		_tmp6_ = _tmp5_;
		_tmp7_ = self->priv->_node;
		map_model_add_root (_tmp6_, _tmp7_, self->priv->_index);
	} else {
		Node* _tmp8_;
		Node* _tmp9_;
		Node* _tmp10_;
		_tmp8_ = self->priv->_node;
		node_set_attached (_tmp8_, TRUE);
		_tmp9_ = self->priv->_node;
		_tmp10_ = self->priv->_parent;
		node_attach_init (_tmp9_, _tmp10_, self->priv->_index);
	}
	_tmp11_ = self->priv->_node;
	mind_map_set_current_node (map, _tmp11_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				GArray* _tmp14_;
				Connections* _tmp15_;
				Connections* _tmp16_;
				GArray* _tmp17_;
				Connection* _tmp18_;
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				_tmp14_ = self->priv->_conns;
				if (!(((guint) i) < _tmp14_->len)) {
					break;
				}
				_tmp15_ = mind_map_get_connections (map);
				_tmp16_ = _tmp15_;
				_tmp17_ = self->priv->_conns;
				_tmp18_ = g_array_index (_tmp17_, Connection*, (guint) i);
				connections_add_connection (_tmp16_, _tmp18_);
			}
		}
	}
	_tmp19_ = mind_map_get_groups (map);
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->_groups;
	node_groups_apply_undo (_tmp20_, _tmp21_);
	_tmp22_ = mind_map_get_animator (map);
	_tmp23_ = _tmp22_;
	animator_animate (_tmp23_);
	mind_map_auto_save (map);
}

static void
undo_node_delete_real_redo (UndoItem* base,
                            MindMap* map)
{
	UndoNodeDelete * self;
	UndoNodeGroups* tmp_groups = NULL;
	Animator* _tmp0_;
	Animator* _tmp1_;
	GArray* _tmp2_;
	GArray* _tmp3_;
	Node* _tmp4_;
	NodeGroups* _tmp18_;
	NodeGroups* _tmp19_;
	Node* _tmp20_;
	Animator* _tmp21_;
	Animator* _tmp22_;
	self = (UndoNodeDelete*) base;
	g_return_if_fail (map != NULL);
	tmp_groups = NULL;
	_tmp0_ = mind_map_get_animator (map);
	_tmp1_ = _tmp0_;
	_tmp2_ = mind_map_get_nodes (map);
	_tmp3_ = _tmp2_;
	animator_add_nodes (_tmp1_, _tmp3_, TRUE, "UndoNodeDelete.redo");
	_g_array_unref0 (_tmp3_);
	_tmp4_ = self->priv->_parent;
	if (_tmp4_ == NULL) {
		MapModel* _tmp5_;
		MapModel* _tmp6_;
		_tmp5_ = mind_map_get_model (map);
		_tmp6_ = _tmp5_;
		map_model_remove_root (_tmp6_, self->priv->_index);
	} else {
		Node* _tmp7_;
		Node* _tmp8_;
		NodeSide _tmp9_;
		NodeSide _tmp10_;
		_tmp7_ = self->priv->_node;
		_tmp8_ = self->priv->_node;
		_tmp9_ = node_get_side (_tmp8_);
		_tmp10_ = _tmp9_;
		node_detach (_tmp7_, _tmp10_);
	}
	mind_map_set_current_node (map, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp11_ = FALSE;
			_tmp11_ = TRUE;
			while (TRUE) {
				GArray* _tmp13_;
				Connections* _tmp14_;
				Connections* _tmp15_;
				GArray* _tmp16_;
				Connection* _tmp17_;
				if (!_tmp11_) {
					gint _tmp12_;
					_tmp12_ = i;
					i = _tmp12_ + 1;
				}
				_tmp11_ = FALSE;
				_tmp13_ = self->priv->_conns;
				if (!(((guint) i) < _tmp13_->len)) {
					break;
				}
				_tmp14_ = mind_map_get_connections (map);
				_tmp15_ = _tmp14_;
				_tmp16_ = self->priv->_conns;
				_tmp17_ = g_array_index (_tmp16_, Connection*, (guint) i);
				connections_remove_connection (_tmp15_, _tmp17_, FALSE);
			}
		}
	}
	_tmp18_ = mind_map_get_groups (map);
	_tmp19_ = _tmp18_;
	_tmp20_ = self->priv->_node;
	node_groups_remove_node (_tmp19_, _tmp20_, &tmp_groups);
	_tmp21_ = mind_map_get_animator (map);
	_tmp22_ = _tmp21_;
	animator_animate (_tmp22_);
	mind_map_auto_save (map);
	_undo_node_groups_free0 (tmp_groups);
}

static void
undo_node_delete_class_init (UndoNodeDeleteClass * klass,
                             gpointer klass_data)
{
	undo_node_delete_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &UndoNodeDelete_private_offset);
	((UndoItemClass *) klass)->undo = (void (*) (UndoItem*, MindMap*)) undo_node_delete_real_undo;
	((UndoItemClass *) klass)->redo = (void (*) (UndoItem*, MindMap*)) undo_node_delete_real_redo;
	G_OBJECT_CLASS (klass)->finalize = undo_node_delete_finalize;
}

static void
undo_node_delete_instance_init (UndoNodeDelete * self,
                                gpointer klass)
{
	self->priv = undo_node_delete_get_instance_private (self);
}

static void
undo_node_delete_finalize (GObject * obj)
{
	UndoNodeDelete * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_UNDO_NODE_DELETE, UndoNodeDelete);
	_g_object_unref0 (self->priv->_node);
	_g_object_unref0 (self->priv->_parent);
	_g_array_unref0 (self->priv->_conns);
	_undo_node_groups_free0 (self->priv->_groups);
	G_OBJECT_CLASS (undo_node_delete_parent_class)->finalize (obj);
}

static GType
undo_node_delete_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UndoNodeDeleteClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) undo_node_delete_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UndoNodeDelete), 0, (GInstanceInitFunc) undo_node_delete_instance_init, NULL };
	GType undo_node_delete_type_id;
	undo_node_delete_type_id = g_type_register_static (TYPE_UNDO_ITEM, "UndoNodeDelete", &g_define_type_info, 0);
	UndoNodeDelete_private_offset = g_type_add_instance_private (undo_node_delete_type_id, sizeof (UndoNodeDeletePrivate));
	return undo_node_delete_type_id;
}

GType
undo_node_delete_get_type (void)
{
	static volatile gsize undo_node_delete_type_id__once = 0;
	if (g_once_init_enter (&undo_node_delete_type_id__once)) {
		GType undo_node_delete_type_id;
		undo_node_delete_type_id = undo_node_delete_get_type_once ();
		g_once_init_leave (&undo_node_delete_type_id__once, undo_node_delete_type_id);
	}
	return undo_node_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;
}

