/* Clipboard.c generated by valac 0.56.19, the Vala compiler
 * generated from Clipboard.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gio/gio.h>
#include <gtksourceview/gtksource.h>
#include <gobject/gvaluecollector.h>

#define MINDER_CLIPBOARD_NODES_TARGET_NAME "x-application/minder-nodes"
#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_MINDER_CLIPBOARD (minder_clipboard_get_type ())
#define MINDER_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MINDER_CLIPBOARD, MinderClipboard))
#define MINDER_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MINDER_CLIPBOARD, MinderClipboardClass))
#define IS_MINDER_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MINDER_CLIPBOARD))
#define IS_MINDER_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MINDER_CLIPBOARD))
#define MINDER_CLIPBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MINDER_CLIPBOARD, MinderClipboardClass))

typedef struct _MinderClipboard MinderClipboard;
typedef struct _MinderClipboardClass MinderClipboardClass;
typedef struct _MinderClipboardPrivate MinderClipboardPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))

#define TYPE_MIND_MAP (mind_map_get_type ())
#define MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MIND_MAP, MindMap))
#define MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MIND_MAP, MindMapClass))
#define IS_MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MIND_MAP))
#define IS_MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MIND_MAP))
#define MIND_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MIND_MAP, MindMapClass))

typedef struct _MindMap MindMap;
typedef struct _MindMapClass MindMapClass;

#define TYPE_NODE (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_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 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 _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _connections_unref0(var) ((var == NULL) ? NULL : (var = (connections_unref (var), NULL)))
#define _node_groups_unref0(var) ((var == NULL) ? NULL : (var = (node_groups_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;

#define TYPE_NOTE_VIEW (note_view_get_type ())
#define NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NOTE_VIEW, NoteView))
#define NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NOTE_VIEW, NoteViewClass))
#define IS_NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NOTE_VIEW))
#define IS_NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NOTE_VIEW))
#define NOTE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NOTE_VIEW, NoteViewClass))

typedef struct _NoteView NoteView;
typedef struct _NoteViewClass NoteViewClass;
typedef struct _Block10Data Block10Data;

#define TYPE_NODE_LINK (node_link_get_type ())
#define NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_LINK, NodeLink))
#define NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_LINK, NodeLinkClass))
#define IS_NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_LINK))
#define IS_NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_LINK))
#define NODE_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_LINK, NodeLinkClass))

typedef struct _NodeLink NodeLink;
typedef struct _NodeLinkClass NodeLinkClass;
#define _node_link_unref0(var) ((var == NULL) ? NULL : (var = (node_link_unref (var), NULL)))
typedef struct _ParamSpecMinderClipboard ParamSpecMinderClipboard;

struct _MinderClipboard {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MinderClipboardPrivate * priv;
};

struct _MinderClipboardClass {
	GTypeClass parent_class;
	void (*finalize) (MinderClipboard *self);
};

struct _Block8Data {
	int _ref_count_;
	GdkClipboard* clipboard;
	MindMap* map;
	gboolean shift;
};

struct _Block9Data {
	int _ref_count_;
	GdkClipboard* clipboard;
	MindMap* map;
};

struct _Block10Data {
	int _ref_count_;
	GdkClipboard* clipboard;
	NoteView* note;
};

struct _ParamSpecMinderClipboard {
	GParamSpec parent_instance;
};

static gpointer minder_clipboard_parent_class = NULL;

VALA_EXTERN gpointer minder_clipboard_ref (gpointer instance);
VALA_EXTERN void minder_clipboard_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_minder_clipboard (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
VALA_EXTERN void value_set_minder_clipboard (GValue* value,
                                 gpointer v_object);
VALA_EXTERN void value_take_minder_clipboard (GValue* value,
                                  gpointer v_object);
VALA_EXTERN gpointer value_get_minder_clipboard (const GValue* value);
VALA_EXTERN GType minder_clipboard_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MinderClipboard, minder_clipboard_unref)
VALA_EXTERN void minder_clipboard_copy_text (const gchar* txt);
VALA_EXTERN void minder_clipboard_copy_image (GdkPixbuf* img);
VALA_EXTERN void minder_clipboard_copy_image_buffer (guint8* img,
                                         gint img_length1);
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 minder_clipboard_copy_nodes (MindMap* map);
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
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 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 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_get_nodes_for_clipboard (MapModel* self,
                                        GArray** nodes,
                                        Connections** conns,
                                        NodeGroups** groups);
VALA_EXTERN gchar* map_model_serialize_for_copy (MapModel* self,
                                     GArray* nodes,
                                     Connections* conns,
                                     NodeGroups* groups);
VALA_EXTERN gboolean minder_clipboard_node_pasteable (void);
VALA_EXTERN gboolean minder_clipboard_image_pasteable (void);
VALA_EXTERN gboolean minder_clipboard_text_pasteable (void);
VALA_EXTERN void minder_clipboard_paste (MindMap* map,
                             gboolean shift);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
VALA_EXTERN gboolean mind_map_is_node_editable (MindMap* self);
VALA_EXTERN gboolean mind_map_is_connection_editable (MindMap* self);
static void ___lambda87_ (Block8Data* _data8_,
                   GObject* obj,
                   GAsyncResult* res);
VALA_EXTERN gchar* utils_read_stream (GInputStream* stream);
VALA_EXTERN void map_model_paste_nodes (MapModel* self,
                            const gchar* text,
                            gboolean shift);
static void ____lambda87__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void ____lambda88_ (Block8Data* _data8_,
                    GObject* ob,
                    GAsyncResult* res);
VALA_EXTERN GdkPixbuf* utils_texture_to_pixbuf (GdkTexture* texture);
VALA_EXTERN void map_model_paste_image (MapModel* self,
                            GdkPixbuf* image,
                            gboolean shift);
static void _____lambda88__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void _____lambda89_ (Block8Data* _data8_,
                     GObject* obj,
                     GAsyncResult* res);
VALA_EXTERN void map_model_paste_text (MapModel* self,
                           const gchar* text,
                           gboolean shift);
static void ______lambda89__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
VALA_EXTERN void minder_clipboard_paste_node_link (MindMap* map);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void ____lambda90_ (Block9Data* _data9_,
                    GObject* obj,
                    GAsyncResult* res);
VALA_EXTERN void map_model_paste_node_link (MapModel* self,
                                const gchar* text);
static void _____lambda90__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
VALA_EXTERN GType note_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NoteView, g_object_unref)
VALA_EXTERN void minder_clipboard_paste_into_note (NoteView* note);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void ____lambda91_ (Block10Data* _data10_,
                    GObject* obj,
                    GAsyncResult* res);
VALA_EXTERN gpointer node_link_ref (gpointer instance);
VALA_EXTERN void node_link_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_link (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_node_link (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_node_link (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_node_link (const GValue* value);
VALA_EXTERN GType node_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeLink, node_link_unref)
VALA_EXTERN NodeLink* map_model_deserialize_for_node_link (const gchar* str);
VALA_EXTERN void note_view_paste_node_link (NoteView* self,
                                NodeLink* link);
static void _____lambda91__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void _____lambda92_ (Block10Data* _data10_,
                     GObject* obj,
                     GAsyncResult* res);
VALA_EXTERN void note_view_paste_text (NoteView* self,
                           const gchar* str);
static void ______lambda92__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
VALA_EXTERN MinderClipboard* minder_clipboard_new (void);
VALA_EXTERN MinderClipboard* minder_clipboard_construct (GType object_type);
static void minder_clipboard_finalize (MinderClipboard * obj);
static GType minder_clipboard_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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
minder_clipboard_copy_text (const gchar* txt)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	g_return_if_fail (txt != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	gdk_clipboard_set_text (clipboard, txt);
	_g_object_unref0 (clipboard);
}

void
minder_clipboard_copy_image (GdkPixbuf* img)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkTexture* texture = NULL;
	GdkTexture* _tmp3_;
	g_return_if_fail (img != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = gdk_texture_new_for_pixbuf (img);
	texture = _tmp3_;
	gdk_clipboard_set_texture (clipboard, texture);
	_g_object_unref0 (texture);
	_g_object_unref0 (clipboard);
}

void
minder_clipboard_copy_image_buffer (guint8* img,
                                    gint img_length1)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	GBytes* bytes = NULL;
	GBytes* _tmp3_;
	GdkTexture* texture = NULL;
	GdkTexture* _tmp4_;
	GError* _inner_error0_ = NULL;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = g_bytes_new (img, img_length1);
	bytes = _tmp3_;
	_tmp4_ = gdk_texture_new_from_bytes (bytes, &_inner_error0_);
	texture = _tmp4_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_bytes_unref0 (bytes);
		_g_object_unref0 (clipboard);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	gdk_clipboard_set_texture (clipboard, texture);
	_g_object_unref0 (texture);
	_g_bytes_unref0 (bytes);
	_g_object_unref0 (clipboard);
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

void
minder_clipboard_copy_nodes (MindMap* map)
{
	GArray* nodes = NULL;
	Connections* conns = NULL;
	NodeGroups* groups = NULL;
	MapModel* _tmp0_;
	MapModel* _tmp1_;
	GArray* _tmp2_ = NULL;
	Connections* _tmp3_ = NULL;
	NodeGroups* _tmp4_ = NULL;
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp5_;
	GdkClipboard* _tmp6_;
	GdkClipboard* _tmp7_;
	gchar* text = NULL;
	MapModel* _tmp8_;
	MapModel* _tmp9_;
	gchar* _tmp10_;
	GBytes* bytes = NULL;
	guint8* _tmp11_;
	gint _tmp11__length1;
	gint _tmp12_ = 0;
	guint8* _tmp13_;
	gint _tmp13__length1;
	GBytes* _tmp14_;
	GdkContentProvider* provider = NULL;
	GdkContentProvider* _tmp15_;
	g_return_if_fail (map != NULL);
	_tmp0_ = mind_map_get_model (map);
	_tmp1_ = _tmp0_;
	map_model_get_nodes_for_clipboard (_tmp1_, &_tmp2_, &_tmp3_, &_tmp4_);
	_g_array_unref0 (nodes);
	nodes = _tmp2_;
	_connections_unref0 (conns);
	conns = _tmp3_;
	_node_groups_unref0 (groups);
	groups = _tmp4_;
	_tmp5_ = gdk_display_get_default ();
	_tmp6_ = gdk_display_get_clipboard (_tmp5_);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	clipboard = _tmp7_;
	_tmp8_ = mind_map_get_model (map);
	_tmp9_ = _tmp8_;
	_tmp10_ = map_model_serialize_for_copy (_tmp9_, nodes, conns, groups);
	text = _tmp10_;
	_tmp11_ = string_get_data (text, &_tmp12_);
	_tmp11__length1 = _tmp12_;
	_tmp13_ = _tmp11_;
	_tmp13__length1 = _tmp11__length1;
	_tmp14_ = g_bytes_new (_tmp13_, _tmp13__length1);
	bytes = _tmp14_;
	_tmp15_ = gdk_content_provider_new_for_bytes (MINDER_CLIPBOARD_NODES_TARGET_NAME, bytes);
	provider = _tmp15_;
	gdk_clipboard_set_content (clipboard, provider);
	_g_object_unref0 (provider);
	_g_bytes_unref0 (bytes);
	_g_free0 (text);
	_g_object_unref0 (clipboard);
	_node_groups_unref0 (groups);
	_connections_unref0 (conns);
	_g_array_unref0 (nodes);
}

gboolean
minder_clipboard_node_pasteable (void)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkContentFormats* _tmp3_;
	gboolean result;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = gdk_clipboard_get_formats (clipboard);
	result = gdk_content_formats_contain_mime_type (_tmp3_, MINDER_CLIPBOARD_NODES_TARGET_NAME);
	_g_object_unref0 (clipboard);
	return result;
}

gboolean
minder_clipboard_image_pasteable (void)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkContentFormats* _tmp3_;
	gboolean result;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = gdk_clipboard_get_formats (clipboard);
	result = gdk_content_formats_contain_mime_type (_tmp3_, "image/png");
	_g_object_unref0 (clipboard);
	return result;
}

gboolean
minder_clipboard_text_pasteable (void)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkContentFormats* _tmp3_;
	gboolean result;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = gdk_clipboard_get_formats (clipboard);
	result = gdk_content_formats_contain_gtype (_tmp3_, G_TYPE_STRING);
	_g_object_unref0 (clipboard);
	return result;
}

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

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		_g_object_unref0 (_data8_->clipboard);
		_mind_map_unref0 (_data8_->map);
		g_slice_free (Block8Data, _data8_);
	}
}

static void
___lambda87_ (Block8Data* _data8_,
              GObject* obj,
              GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		gchar* str = NULL;
		GInputStream* stream = NULL;
		GdkClipboard* _tmp0_;
		const gchar* _tmp1_ = NULL;
		GInputStream* _tmp2_;
		gchar* _tmp3_;
		gchar* contents = NULL;
		gchar* _tmp4_;
		MapModel* _tmp5_;
		MapModel* _tmp6_;
		const gchar* _tmp7_;
		_tmp0_ = _data8_->clipboard;
		_tmp2_ = gdk_clipboard_read_finish (_tmp0_, res, &_tmp1_, &_inner_error0_);
		_g_free0 (str);
		_tmp3_ = g_strdup (_tmp1_);
		str = _tmp3_;
		stream = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (str);
			goto __catch0_g_error;
		}
		_tmp4_ = utils_read_stream (stream);
		contents = _tmp4_;
		_tmp5_ = mind_map_get_model (_data8_->map);
		_tmp6_ = _tmp5_;
		_tmp7_ = contents;
		map_model_paste_nodes (_tmp6_, _tmp7_, _data8_->shift);
		_g_free0 (contents);
		_g_object_unref0 (stream);
		_g_free0 (str);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda87__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda87_ (self, source_object, res);
	block8_data_unref (self);
}

static void
____lambda88_ (Block8Data* _data8_,
               GObject* ob,
               GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		GdkTexture* texture = NULL;
		GdkClipboard* _tmp0_;
		GdkTexture* _tmp1_;
		_tmp0_ = _data8_->clipboard;
		_tmp1_ = gdk_clipboard_read_texture_finish (_tmp0_, res, &_inner_error0_);
		texture = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (texture != NULL) {
			GdkPixbuf* pixbuf = NULL;
			GdkPixbuf* _tmp2_;
			MapModel* _tmp3_;
			MapModel* _tmp4_;
			GdkPixbuf* _tmp5_;
			_tmp2_ = utils_texture_to_pixbuf (texture);
			pixbuf = _tmp2_;
			_tmp3_ = mind_map_get_model (_data8_->map);
			_tmp4_ = _tmp3_;
			_tmp5_ = pixbuf;
			map_model_paste_image (_tmp4_, _tmp5_, TRUE);
			_g_object_unref0 (pixbuf);
		}
		_g_object_unref0 (texture);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_____lambda88__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda88_ (self, source_object, res);
	block8_data_unref (self);
}

static void
_____lambda89_ (Block8Data* _data8_,
                GObject* obj,
                GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		gchar* text = NULL;
		GdkClipboard* _tmp0_;
		gchar* _tmp1_;
		MapModel* _tmp2_;
		MapModel* _tmp3_;
		_tmp0_ = _data8_->clipboard;
		_tmp1_ = gdk_clipboard_read_text_finish (_tmp0_, res, &_inner_error0_);
		text = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = mind_map_get_model (_data8_->map);
		_tmp3_ = _tmp2_;
		map_model_paste_text (_tmp3_, text, _data8_->shift);
		_g_free0 (text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
______lambda89__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda89_ (self, source_object, res);
	block8_data_unref (self);
}

void
minder_clipboard_paste (MindMap* map,
                        gboolean shift)
{
	Block8Data* _data8_;
	MindMap* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkClipboard* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean text_needed = FALSE;
	GdkClipboard* _tmp5_;
	GdkContentFormats* _tmp6_;
	g_return_if_fail (map != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_tmp0_ = _mind_map_ref0 (map);
	_mind_map_unref0 (_data8_->map);
	_data8_->map = _tmp0_;
	_data8_->shift = shift;
	_tmp1_ = gdk_display_get_default ();
	_tmp2_ = gdk_display_get_clipboard (_tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data8_->clipboard = _tmp3_;
	if (mind_map_is_node_editable (_data8_->map)) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = mind_map_is_connection_editable (_data8_->map);
	}
	text_needed = _tmp4_;
	_tmp5_ = _data8_->clipboard;
	_tmp6_ = gdk_clipboard_get_formats (_tmp5_);
	if (gdk_content_formats_contain_mime_type (_tmp6_, MINDER_CLIPBOARD_NODES_TARGET_NAME)) {
		GdkClipboard* _tmp7_;
		gchar* _tmp8_;
		gchar** _tmp9_;
		gchar** _tmp10_;
		gint _tmp10__length1;
		_tmp7_ = _data8_->clipboard;
		_tmp8_ = g_strdup (MINDER_CLIPBOARD_NODES_TARGET_NAME);
		_tmp9_ = g_new0 (gchar*, 1 + 1);
		_tmp9_[0] = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp10__length1 = 1;
		gdk_clipboard_read_async (_tmp7_, _tmp10_, 0, NULL, ____lambda87__gasync_ready_callback, block8_data_ref (_data8_));
		_tmp10_ = (_vala_array_free (_tmp10_, _tmp10__length1, (GDestroyNotify) g_free), NULL);
	} else {
		gboolean _tmp11_ = FALSE;
		GdkClipboard* _tmp12_;
		GdkContentFormats* _tmp13_;
		_tmp12_ = _data8_->clipboard;
		_tmp13_ = gdk_clipboard_get_formats (_tmp12_);
		if (gdk_content_formats_contain_mime_type (_tmp13_, "image/png")) {
			_tmp11_ = TRUE;
		} else {
			_tmp11_ = !text_needed;
		}
		if (_tmp11_) {
			GdkClipboard* _tmp14_;
			_tmp14_ = _data8_->clipboard;
			gdk_clipboard_read_texture_async (_tmp14_, NULL, _____lambda88__gasync_ready_callback, block8_data_ref (_data8_));
		} else {
			GdkClipboard* _tmp15_;
			GdkContentFormats* _tmp16_;
			_tmp15_ = _data8_->clipboard;
			_tmp16_ = gdk_clipboard_get_formats (_tmp15_);
			if (gdk_content_formats_contain_gtype (_tmp16_, G_TYPE_STRING)) {
				GdkClipboard* _tmp17_;
				_tmp17_ = _data8_->clipboard;
				gdk_clipboard_read_text_async (_tmp17_, NULL, ______lambda89__gasync_ready_callback, block8_data_ref (_data8_));
			}
		}
	}
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		_g_object_unref0 (_data9_->clipboard);
		_mind_map_unref0 (_data9_->map);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
____lambda90_ (Block9Data* _data9_,
               GObject* obj,
               GAsyncResult* res)
{
	gchar* str = NULL;
	GInputStream* stream = NULL;
	GdkClipboard* _tmp0_;
	const gchar* _tmp1_ = NULL;
	GInputStream* _tmp2_;
	gchar* _tmp3_;
	gchar* contents = NULL;
	gchar* _tmp4_;
	MapModel* _tmp5_;
	MapModel* _tmp6_;
	const gchar* _tmp7_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data9_->clipboard;
	_tmp2_ = gdk_clipboard_read_finish (_tmp0_, res, &_tmp1_, &_inner_error0_);
	_g_free0 (str);
	_tmp3_ = g_strdup (_tmp1_);
	str = _tmp3_;
	stream = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (str);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp4_ = utils_read_stream (stream);
	contents = _tmp4_;
	_tmp5_ = mind_map_get_model (_data9_->map);
	_tmp6_ = _tmp5_;
	_tmp7_ = contents;
	map_model_paste_node_link (_tmp6_, _tmp7_);
	_g_free0 (contents);
	_g_object_unref0 (stream);
	_g_free0 (str);
}

static void
_____lambda90__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda90_ (self, source_object, res);
	block9_data_unref (self);
}

void
minder_clipboard_paste_node_link (MindMap* map)
{
	Block9Data* _data9_;
	MindMap* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkClipboard* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (map != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_tmp0_ = _mind_map_ref0 (map);
	_mind_map_unref0 (_data9_->map);
	_data9_->map = _tmp0_;
	_tmp1_ = gdk_display_get_default ();
	_tmp2_ = gdk_display_get_clipboard (_tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data9_->clipboard = _tmp3_;
	{
		GdkClipboard* _tmp4_;
		GdkContentFormats* _tmp5_;
		_tmp4_ = _data9_->clipboard;
		_tmp5_ = gdk_clipboard_get_formats (_tmp4_);
		if (gdk_content_formats_contain_mime_type (_tmp5_, MINDER_CLIPBOARD_NODES_TARGET_NAME)) {
			GdkClipboard* _tmp6_;
			gchar* _tmp7_;
			gchar** _tmp8_;
			gchar** _tmp9_;
			gint _tmp9__length1;
			_tmp6_ = _data9_->clipboard;
			_tmp7_ = g_strdup (MINDER_CLIPBOARD_NODES_TARGET_NAME);
			_tmp8_ = g_new0 (gchar*, 1 + 1);
			_tmp8_[0] = _tmp7_;
			_tmp9_ = _tmp8_;
			_tmp9__length1 = 1;
			gdk_clipboard_read_async (_tmp6_, _tmp9_, 0, NULL, _____lambda90__gasync_ready_callback, block9_data_ref (_data9_));
			_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block9_data_unref (_data9_);
		_data9_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		_g_object_unref0 (_data10_->clipboard);
		_g_object_unref0 (_data10_->note);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
____lambda91_ (Block10Data* _data10_,
               GObject* obj,
               GAsyncResult* res)
{
	gchar* str = NULL;
	GInputStream* stream = NULL;
	GdkClipboard* _tmp0_;
	const gchar* _tmp1_ = NULL;
	GInputStream* _tmp2_;
	gchar* _tmp3_;
	gchar* contents = NULL;
	gchar* _tmp4_;
	NodeLink* link = NULL;
	const gchar* _tmp5_;
	NodeLink* _tmp6_;
	NodeLink* _tmp7_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data10_->clipboard;
	_tmp2_ = gdk_clipboard_read_finish (_tmp0_, res, &_tmp1_, &_inner_error0_);
	_g_free0 (str);
	_tmp3_ = g_strdup (_tmp1_);
	str = _tmp3_;
	stream = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (str);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp4_ = utils_read_stream (stream);
	contents = _tmp4_;
	_tmp5_ = contents;
	_tmp6_ = map_model_deserialize_for_node_link (_tmp5_);
	link = _tmp6_;
	_tmp7_ = link;
	if (_tmp7_ != NULL) {
		NodeLink* _tmp8_;
		_tmp8_ = link;
		note_view_paste_node_link (_data10_->note, _tmp8_);
	}
	_node_link_unref0 (link);
	_g_free0 (contents);
	_g_object_unref0 (stream);
	_g_free0 (str);
}

static void
_____lambda91__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda91_ (self, source_object, res);
	block10_data_unref (self);
}

static void
_____lambda92_ (Block10Data* _data10_,
                GObject* obj,
                GAsyncResult* res)
{
	gchar* text = NULL;
	GdkClipboard* _tmp0_;
	gchar* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data10_->clipboard;
	_tmp1_ = gdk_clipboard_read_text_finish (_tmp0_, res, &_inner_error0_);
	text = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	note_view_paste_text (_data10_->note, text);
	_g_free0 (text);
}

static void
______lambda92__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda92_ (self, source_object, res);
	block10_data_unref (self);
}

void
minder_clipboard_paste_into_note (NoteView* note)
{
	Block10Data* _data10_;
	NoteView* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkClipboard* _tmp2_;
	GdkClipboard* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (note != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (note);
	_g_object_unref0 (_data10_->note);
	_data10_->note = _tmp0_;
	_tmp1_ = gdk_display_get_default ();
	_tmp2_ = gdk_display_get_clipboard (_tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data10_->clipboard = _tmp3_;
	{
		GdkClipboard* _tmp4_;
		GdkContentFormats* _tmp5_;
		_tmp4_ = _data10_->clipboard;
		_tmp5_ = gdk_clipboard_get_formats (_tmp4_);
		if (gdk_content_formats_contain_mime_type (_tmp5_, MINDER_CLIPBOARD_NODES_TARGET_NAME)) {
			GdkClipboard* _tmp6_;
			gchar* _tmp7_;
			gchar** _tmp8_;
			gchar** _tmp9_;
			gint _tmp9__length1;
			_tmp6_ = _data10_->clipboard;
			_tmp7_ = g_strdup (MINDER_CLIPBOARD_NODES_TARGET_NAME);
			_tmp8_ = g_new0 (gchar*, 1 + 1);
			_tmp8_[0] = _tmp7_;
			_tmp9_ = _tmp8_;
			_tmp9__length1 = 1;
			gdk_clipboard_read_async (_tmp6_, _tmp9_, 0, NULL, _____lambda91__gasync_ready_callback, block10_data_ref (_data10_));
			_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
		} else {
			GdkClipboard* _tmp10_;
			GdkContentFormats* _tmp11_;
			_tmp10_ = _data10_->clipboard;
			_tmp11_ = gdk_clipboard_get_formats (_tmp10_);
			if (gdk_content_formats_contain_gtype (_tmp11_, G_TYPE_STRING)) {
				GdkClipboard* _tmp12_;
				_tmp12_ = _data10_->clipboard;
				gdk_clipboard_read_text_async (_tmp12_, NULL, ______lambda92__gasync_ready_callback, block10_data_ref (_data10_));
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block10_data_unref (_data10_);
		_data10_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

MinderClipboard*
minder_clipboard_construct (GType object_type)
{
	MinderClipboard* self = NULL;
	self = (MinderClipboard*) g_type_create_instance (object_type);
	return self;
}

MinderClipboard*
minder_clipboard_new (void)
{
	return minder_clipboard_construct (TYPE_MINDER_CLIPBOARD);
}

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

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

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

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

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

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

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

void
value_set_minder_clipboard (GValue* value,
                            gpointer v_object)
{
	MinderClipboard * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MINDER_CLIPBOARD));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MINDER_CLIPBOARD));
		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;
		minder_clipboard_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		minder_clipboard_unref (old);
	}
}

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

static void
minder_clipboard_class_init (MinderClipboardClass * klass,
                             gpointer klass_data)
{
	minder_clipboard_parent_class = g_type_class_peek_parent (klass);
	((MinderClipboardClass *) klass)->finalize = minder_clipboard_finalize;
}

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

static void
minder_clipboard_finalize (MinderClipboard * obj)
{
	MinderClipboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MINDER_CLIPBOARD, MinderClipboard);
	g_signal_handlers_destroy (self);
}

static GType
minder_clipboard_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_minder_clipboard_init, value_minder_clipboard_free_value, value_minder_clipboard_copy_value, value_minder_clipboard_peek_pointer, "p", value_minder_clipboard_collect_value, "p", value_minder_clipboard_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (MinderClipboardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) minder_clipboard_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MinderClipboard), 0, (GInstanceInitFunc) minder_clipboard_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 minder_clipboard_type_id;
	minder_clipboard_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MinderClipboard", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return minder_clipboard_type_id;
}

GType
minder_clipboard_get_type (void)
{
	static volatile gsize minder_clipboard_type_id__once = 0;
	if (g_once_init_enter (&minder_clipboard_type_id__once)) {
		GType minder_clipboard_type_id;
		minder_clipboard_type_id = minder_clipboard_get_type_once ();
		g_once_init_leave (&minder_clipboard_type_id__once, minder_clipboard_type_id);
	}
	return minder_clipboard_type_id__once;
}

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

void
minder_clipboard_unref (gpointer instance)
{
	MinderClipboard * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MINDER_CLIPBOARD_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);
}

