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

#include "pantheon-files-core.h"
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <pango/pango.h>
#include <cairo-gobject.h>
#include <gdk/gdk.h>
#include <glib-object.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

enum  {
	FILES_MULTI_LINE_EDITABLE_LABEL_0_PROPERTY,
	FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY,
	FILES_MULTI_LINE_EDITABLE_LABEL_NUM_PROPERTIES
};
static GParamSpec* files_multi_line_editable_label_properties[FILES_MULTI_LINE_EDITABLE_LABEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_GtkTextIter_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTextIter_free (var), NULL)))

struct _FilesMultiLineEditableLabelPrivate {
	GtkTextView* _textview;
};

static gint FilesMultiLineEditableLabel_private_offset;
static gpointer files_multi_line_editable_label_parent_class = NULL;

static void files_multi_line_editable_label_real_set_text (FilesAbstractEditableLabel* base,
                                                    const gchar* text);
static void files_multi_line_editable_label_real_set_line_wrap (FilesAbstractEditableLabel* base,
                                                         gboolean wrap);
static void files_multi_line_editable_label_real_set_line_wrap_mode (FilesAbstractEditableLabel* base,
                                                              PangoWrapMode mode);
static void files_multi_line_editable_label_real_set_justify (FilesAbstractEditableLabel* base,
                                                       GtkJustification jtype);
static void files_multi_line_editable_label_real_set_padding (FilesAbstractEditableLabel* base,
                                                       gint xpad,
                                                       gint ypad);
static gchar* files_multi_line_editable_label_real_get_text (FilesAbstractEditableLabel* base);
static void _vala_GtkTextIter_free (GtkTextIter* self);
static GtkTextIter* _vala_GtkTextIter_copy (GtkTextIter* self);
static void files_multi_line_editable_label_real_select_region (FilesAbstractEditableLabel* base,
                                                         gint start_pos,
                                                         gint end_pos);
static void files_multi_line_editable_label_real_do_delete_text (FilesAbstractEditableLabel* base,
                                                          gint start_pos,
                                                          gint end_pos);
static void files_multi_line_editable_label_real_do_insert_text (FilesAbstractEditableLabel* base,
                                                          const gchar* new_text,
                                                          gint new_text_length,
                                                          gint* position);
static gchar* files_multi_line_editable_label_real_get_chars (FilesAbstractEditableLabel* base,
                                                       gint start_pos,
                                                       gint end_pos);
static gint files_multi_line_editable_label_real_get_position (FilesAbstractEditableLabel* base);
static gboolean files_multi_line_editable_label_real_get_selection_bounds (FilesAbstractEditableLabel* base,
                                                                    gint* start_pos,
                                                                    gint* end_pos);
static void files_multi_line_editable_label_real_set_position (FilesAbstractEditableLabel* base,
                                                        gint position);
static gboolean files_multi_line_editable_label_real_draw (GtkWidget* base,
                                                    cairo_t* cr);
static void files_multi_line_editable_label_real_set_size_request (FilesAbstractEditableLabel* base,
                                                            gint width,
                                                            gint height);
static void files_multi_line_editable_label_real_start_editing (FilesAbstractEditableLabel* base,
                                                         GdkEvent* event);
static GObject * files_multi_line_editable_label_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties);
static void files_multi_line_editable_label_finalize (GObject * obj);
static GType files_multi_line_editable_label_get_type_once (void);
static void _vala_files_multi_line_editable_label_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_files_multi_line_editable_label_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
files_multi_line_editable_label_get_instance_private (FilesMultiLineEditableLabel* self)
{
	return G_STRUCT_MEMBER_P (self, FilesMultiLineEditableLabel_private_offset);
}

static void
files_multi_line_editable_label_real_set_text (FilesAbstractEditableLabel* base,
                                               const gchar* text)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	gchar* _tmp2_;
	self = (FilesMultiLineEditableLabel*) base;
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	gtk_text_buffer_set_text (_tmp1_, text, -1);
	_tmp2_ = g_strdup (text);
	_g_free0 (((FilesAbstractEditableLabel*) self)->original_name);
	((FilesAbstractEditableLabel*) self)->original_name = _tmp2_;
}

static void
files_multi_line_editable_label_real_set_line_wrap (FilesAbstractEditableLabel* base,
                                                    gboolean wrap)
{
	FilesMultiLineEditableLabel * self;
	self = (FilesMultiLineEditableLabel*) base;
	if (!wrap) {
		GtkTextView* _tmp0_;
		_tmp0_ = self->priv->_textview;
		gtk_text_view_set_wrap_mode (_tmp0_, GTK_WRAP_NONE);
	} else {
		GtkTextView* _tmp1_;
		_tmp1_ = self->priv->_textview;
		gtk_text_view_set_wrap_mode (_tmp1_, GTK_WRAP_CHAR);
	}
}

static void
files_multi_line_editable_label_real_set_line_wrap_mode (FilesAbstractEditableLabel* base,
                                                         PangoWrapMode mode)
{
	FilesMultiLineEditableLabel * self;
	self = (FilesMultiLineEditableLabel*) base;
	switch (mode) {
		case PANGO_WRAP_CHAR:
		{
			GtkTextView* _tmp0_;
			_tmp0_ = self->priv->_textview;
			gtk_text_view_set_wrap_mode (_tmp0_, GTK_WRAP_CHAR);
			break;
		}
		case PANGO_WRAP_WORD:
		{
			GtkTextView* _tmp1_;
			_tmp1_ = self->priv->_textview;
			gtk_text_view_set_wrap_mode (_tmp1_, GTK_WRAP_WORD);
			break;
		}
		case PANGO_WRAP_WORD_CHAR:
		{
			GtkTextView* _tmp2_;
			_tmp2_ = self->priv->_textview;
			gtk_text_view_set_wrap_mode (_tmp2_, GTK_WRAP_WORD_CHAR);
			break;
		}
		default:
		{
			break;
		}
	}
}

static void
files_multi_line_editable_label_real_set_justify (FilesAbstractEditableLabel* base,
                                                  GtkJustification jtype)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	gtk_text_view_set_justification (_tmp0_, jtype);
}

static void
files_multi_line_editable_label_real_set_padding (FilesAbstractEditableLabel* base,
                                                  gint xpad,
                                                  gint ypad)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	GtkTextView* _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextView* _tmp3_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, xpad);
	_tmp1_ = self->priv->_textview;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, xpad);
	_tmp2_ = self->priv->_textview;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp2_, ypad);
	_tmp3_ = self->priv->_textview;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, ypad);
}

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

static void
_vala_GtkTextIter_free (GtkTextIter* self)
{
	g_boxed_free (gtk_text_iter_get_type (), self);
}

static GtkTextIter*
_vala_GtkTextIter_copy (GtkTextIter* self)
{
	return g_boxed_copy (gtk_text_iter_get_type (), self);
}

static gpointer
__vala_GtkTextIter_copy0 (gpointer self)
{
	return self ? _vala_GtkTextIter_copy (self) : NULL;
}

static gchar*
files_multi_line_editable_label_real_get_text (FilesAbstractEditableLabel* base)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* start = NULL;
	GtkTextIter* end = NULL;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_;
	GtkTextIter* _tmp5_;
	GtkTextIter _tmp6_ = {0};
	GtkTextIter _tmp7_;
	GtkTextIter* _tmp8_;
	GtkTextIter* _tmp9_;
	GtkTextIter* _tmp10_;
	GtkTextIter _tmp11_;
	GtkTextIter _tmp12_;
	gchar* _tmp13_;
	gchar* result;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	start = NULL;
	end = NULL;
	gtk_text_buffer_get_start_iter (buffer, &_tmp3_);
	__vala_GtkTextIter_free0 (start);
	_tmp4_ = _tmp3_;
	_tmp5_ = __vala_GtkTextIter_copy0 (&_tmp4_);
	start = _tmp5_;
	gtk_text_buffer_get_end_iter (buffer, &_tmp6_);
	__vala_GtkTextIter_free0 (end);
	_tmp7_ = _tmp6_;
	_tmp8_ = __vala_GtkTextIter_copy0 (&_tmp7_);
	end = _tmp8_;
	_tmp9_ = start;
	_tmp10_ = end;
	_tmp11_ = *_tmp9_;
	_tmp12_ = *_tmp10_;
	_tmp13_ = gtk_text_buffer_get_text (buffer, &_tmp11_, &_tmp12_, FALSE);
	result = _tmp13_;
	__vala_GtkTextIter_free0 (end);
	__vala_GtkTextIter_free0 (start);
	_g_object_unref0 (buffer);
	return result;
}

/** Gtk.Editable interface */
static void
files_multi_line_editable_label_real_select_region (FilesAbstractEditableLabel* base,
                                                    gint start_pos,
                                                    gint end_pos)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextIter* ins = NULL;
	GtkTextIter* bound = NULL;
	GtkTextBuffer* _tmp4_;
	GtkTextIter _tmp5_ = {0};
	GtkTextIter _tmp6_;
	GtkTextIter* _tmp7_;
	GtkTextBuffer* _tmp16_;
	GtkTextIter* _tmp17_;
	GtkTextIter* _tmp18_;
	GtkTextIter _tmp19_;
	GtkTextIter _tmp20_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->_textview;
	_tmp2_ = gtk_text_view_get_buffer (_tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	buffer = _tmp3_;
	ins = NULL;
	bound = NULL;
	_tmp4_ = buffer;
	gtk_text_buffer_get_iter_at_offset (_tmp4_, &_tmp5_, start_pos);
	__vala_GtkTextIter_free0 (ins);
	_tmp6_ = _tmp5_;
	_tmp7_ = __vala_GtkTextIter_copy0 (&_tmp6_);
	ins = _tmp7_;
	if (end_pos > 0) {
		GtkTextBuffer* _tmp8_;
		GtkTextIter _tmp9_ = {0};
		GtkTextIter _tmp10_;
		GtkTextIter* _tmp11_;
		_tmp8_ = buffer;
		gtk_text_buffer_get_iter_at_offset (_tmp8_, &_tmp9_, end_pos);
		__vala_GtkTextIter_free0 (bound);
		_tmp10_ = _tmp9_;
		_tmp11_ = __vala_GtkTextIter_copy0 (&_tmp10_);
		bound = _tmp11_;
	} else {
		GtkTextBuffer* _tmp12_;
		GtkTextIter _tmp13_ = {0};
		GtkTextIter _tmp14_;
		GtkTextIter* _tmp15_;
		_tmp12_ = buffer;
		gtk_text_buffer_get_end_iter (_tmp12_, &_tmp13_);
		__vala_GtkTextIter_free0 (bound);
		_tmp14_ = _tmp13_;
		_tmp15_ = __vala_GtkTextIter_copy0 (&_tmp14_);
		bound = _tmp15_;
	}
	_tmp16_ = buffer;
	_tmp17_ = ins;
	_tmp18_ = bound;
	_tmp19_ = *_tmp17_;
	_tmp20_ = *_tmp18_;
	gtk_text_buffer_select_range (_tmp16_, &_tmp19_, &_tmp20_);
	__vala_GtkTextIter_free0 (bound);
	__vala_GtkTextIter_free0 (ins);
	_g_object_unref0 (buffer);
}

static void
files_multi_line_editable_label_real_do_delete_text (FilesAbstractEditableLabel* base,
                                                     gint start_pos,
                                                     gint end_pos)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* start = NULL;
	GtkTextIter* end = NULL;
	GtkTextBuffer* _tmp3_;
	GtkTextIter _tmp4_ = {0};
	GtkTextIter _tmp5_;
	GtkTextIter* _tmp6_;
	GtkTextBuffer* _tmp15_;
	GtkTextIter* _tmp16_;
	GtkTextIter* _tmp17_;
	GtkTextIter _tmp18_;
	GtkTextIter _tmp19_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	start = NULL;
	end = NULL;
	_tmp3_ = buffer;
	gtk_text_buffer_get_iter_at_offset (_tmp3_, &_tmp4_, start_pos);
	__vala_GtkTextIter_free0 (start);
	_tmp5_ = _tmp4_;
	_tmp6_ = __vala_GtkTextIter_copy0 (&_tmp5_);
	start = _tmp6_;
	if (end_pos > 0) {
		GtkTextBuffer* _tmp7_;
		GtkTextIter _tmp8_ = {0};
		GtkTextIter _tmp9_;
		GtkTextIter* _tmp10_;
		_tmp7_ = buffer;
		gtk_text_buffer_get_iter_at_offset (_tmp7_, &_tmp8_, end_pos);
		__vala_GtkTextIter_free0 (end);
		_tmp9_ = _tmp8_;
		_tmp10_ = __vala_GtkTextIter_copy0 (&_tmp9_);
		end = _tmp10_;
	} else {
		GtkTextBuffer* _tmp11_;
		GtkTextIter _tmp12_ = {0};
		GtkTextIter _tmp13_;
		GtkTextIter* _tmp14_;
		_tmp11_ = buffer;
		gtk_text_buffer_get_end_iter (_tmp11_, &_tmp12_);
		__vala_GtkTextIter_free0 (end);
		_tmp13_ = _tmp12_;
		_tmp14_ = __vala_GtkTextIter_copy0 (&_tmp13_);
		end = _tmp14_;
	}
	_tmp15_ = buffer;
	_tmp16_ = start;
	_tmp17_ = end;
	_tmp18_ = *_tmp16_;
	_tmp19_ = *_tmp17_;
	g_signal_emit_by_name (_tmp15_, "delete-range", &_tmp18_, &_tmp19_);
	__vala_GtkTextIter_free0 (end);
	__vala_GtkTextIter_free0 (start);
	_g_object_unref0 (buffer);
}

static void
files_multi_line_editable_label_real_do_insert_text (FilesAbstractEditableLabel* base,
                                                     const gchar* new_text,
                                                     gint new_text_length,
                                                     gint* position)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* pos = NULL;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_;
	GtkTextIter* _tmp5_;
	self = (FilesMultiLineEditableLabel*) base;
	g_return_if_fail (new_text != NULL);
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	pos = NULL;
	gtk_text_buffer_get_iter_at_offset (buffer, &_tmp3_, *position);
	__vala_GtkTextIter_free0 (pos);
	_tmp4_ = _tmp3_;
	_tmp5_ = __vala_GtkTextIter_copy0 (&_tmp4_);
	pos = _tmp5_;
	gtk_text_buffer_insert (buffer, pos, new_text, new_text_length);
	__vala_GtkTextIter_free0 (pos);
	_g_object_unref0 (buffer);
}

static gchar*
files_multi_line_editable_label_real_get_chars (FilesAbstractEditableLabel* base,
                                                gint start_pos,
                                                gint end_pos)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* start = NULL;
	GtkTextIter* end = NULL;
	GtkTextBuffer* _tmp3_;
	GtkTextIter _tmp4_ = {0};
	GtkTextIter _tmp5_;
	GtkTextIter* _tmp6_;
	GtkTextBuffer* _tmp15_;
	GtkTextIter* _tmp16_;
	GtkTextIter* _tmp17_;
	GtkTextIter _tmp18_;
	GtkTextIter _tmp19_;
	gchar* _tmp20_;
	gchar* result;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	start = NULL;
	end = NULL;
	_tmp3_ = buffer;
	gtk_text_buffer_get_iter_at_offset (_tmp3_, &_tmp4_, start_pos);
	__vala_GtkTextIter_free0 (start);
	_tmp5_ = _tmp4_;
	_tmp6_ = __vala_GtkTextIter_copy0 (&_tmp5_);
	start = _tmp6_;
	if (end_pos > 0) {
		GtkTextBuffer* _tmp7_;
		GtkTextIter _tmp8_ = {0};
		GtkTextIter _tmp9_;
		GtkTextIter* _tmp10_;
		_tmp7_ = buffer;
		gtk_text_buffer_get_iter_at_offset (_tmp7_, &_tmp8_, end_pos);
		__vala_GtkTextIter_free0 (end);
		_tmp9_ = _tmp8_;
		_tmp10_ = __vala_GtkTextIter_copy0 (&_tmp9_);
		end = _tmp10_;
	} else {
		GtkTextBuffer* _tmp11_;
		GtkTextIter _tmp12_ = {0};
		GtkTextIter _tmp13_;
		GtkTextIter* _tmp14_;
		_tmp11_ = buffer;
		gtk_text_buffer_get_end_iter (_tmp11_, &_tmp12_);
		__vala_GtkTextIter_free0 (end);
		_tmp13_ = _tmp12_;
		_tmp14_ = __vala_GtkTextIter_copy0 (&_tmp13_);
		end = _tmp14_;
	}
	_tmp15_ = buffer;
	_tmp16_ = start;
	_tmp17_ = end;
	_tmp18_ = *_tmp16_;
	_tmp19_ = *_tmp17_;
	_tmp20_ = gtk_text_buffer_get_text (_tmp15_, &_tmp18_, &_tmp19_, FALSE);
	result = _tmp20_;
	__vala_GtkTextIter_free0 (end);
	__vala_GtkTextIter_free0 (start);
	_g_object_unref0 (buffer);
	return result;
}

static gint
files_multi_line_editable_label_real_get_position (FilesAbstractEditableLabel* base)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextMark* mark = NULL;
	GtkTextMark* _tmp3_;
	GtkTextMark* _tmp4_;
	GtkTextIter* iter = NULL;
	GtkTextIter _tmp5_ = {0};
	GtkTextIter _tmp6_;
	GtkTextIter* _tmp7_;
	GtkTextIter* _tmp8_;
	gint result;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	_tmp3_ = gtk_text_buffer_get_insert (buffer);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	mark = _tmp4_;
	iter = NULL;
	gtk_text_buffer_get_iter_at_mark (buffer, &_tmp5_, mark);
	__vala_GtkTextIter_free0 (iter);
	_tmp6_ = _tmp5_;
	_tmp7_ = __vala_GtkTextIter_copy0 (&_tmp6_);
	iter = _tmp7_;
	_tmp8_ = iter;
	result = gtk_text_iter_get_offset (_tmp8_);
	__vala_GtkTextIter_free0 (iter);
	_g_object_unref0 (mark);
	_g_object_unref0 (buffer);
	return result;
}

static gboolean
files_multi_line_editable_label_real_get_selection_bounds (FilesAbstractEditableLabel* base,
                                                           gint* start_pos,
                                                           gint* end_pos)
{
	FilesMultiLineEditableLabel * self;
	gint _vala_start_pos = 0;
	gint _vala_end_pos = 0;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* start = NULL;
	GtkTextIter* end = NULL;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_ = {0};
	GtkTextIter _tmp5_;
	GtkTextIter* _tmp6_;
	GtkTextIter _tmp7_;
	GtkTextIter* _tmp8_;
	GtkTextIter* _tmp9_;
	GtkTextIter* _tmp10_;
	gboolean result;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	start = NULL;
	end = NULL;
	gtk_text_buffer_get_selection_bounds (buffer, &_tmp3_, &_tmp4_);
	__vala_GtkTextIter_free0 (start);
	_tmp5_ = _tmp3_;
	_tmp6_ = __vala_GtkTextIter_copy0 (&_tmp5_);
	start = _tmp6_;
	__vala_GtkTextIter_free0 (end);
	_tmp7_ = _tmp4_;
	_tmp8_ = __vala_GtkTextIter_copy0 (&_tmp7_);
	end = _tmp8_;
	_tmp9_ = start;
	_vala_start_pos = gtk_text_iter_get_offset (_tmp9_);
	_tmp10_ = end;
	_vala_end_pos = gtk_text_iter_get_offset (_tmp10_);
	result = _vala_start_pos != _vala_end_pos;
	__vala_GtkTextIter_free0 (end);
	__vala_GtkTextIter_free0 (start);
	_g_object_unref0 (buffer);
	if (start_pos) {
		*start_pos = _vala_start_pos;
	}
	if (end_pos) {
		*end_pos = _vala_end_pos;
	}
	return result;
}

static void
files_multi_line_editable_label_real_set_position (FilesAbstractEditableLabel* base,
                                                   gint position)
{
	FilesMultiLineEditableLabel * self;
	GtkTextBuffer* buffer = NULL;
	GtkTextView* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter* iter = NULL;
	GtkTextIter _tmp3_ = {0};
	GtkTextIter _tmp4_;
	GtkTextIter* _tmp5_;
	GtkTextIter* _tmp6_;
	GtkTextIter* _tmp7_;
	GtkTextIter _tmp8_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	_tmp1_ = gtk_text_view_get_buffer (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	buffer = _tmp2_;
	iter = NULL;
	gtk_text_buffer_get_start_iter (buffer, &_tmp3_);
	__vala_GtkTextIter_free0 (iter);
	_tmp4_ = _tmp3_;
	_tmp5_ = __vala_GtkTextIter_copy0 (&_tmp4_);
	iter = _tmp5_;
	_tmp6_ = iter;
	gtk_text_iter_set_offset (_tmp6_, position);
	_tmp7_ = iter;
	_tmp8_ = *_tmp7_;
	gtk_text_buffer_place_cursor (buffer, &_tmp8_);
	__vala_GtkTextIter_free0 (iter);
	_g_object_unref0 (buffer);
}

static gboolean
files_multi_line_editable_label_real_draw (GtkWidget* base,
                                           cairo_t* cr)
{
	FilesMultiLineEditableLabel * self;
	gboolean _result_ = FALSE;
	GtkAllocation allocation = {0};
	GdkRGBA color = {0};
	GdkRectangle outline = {0};
	GtkAllocation _tmp0_ = {0};
	GtkStyleContext* _tmp1_;
	GdkRGBA _tmp2_ = {0};
	GdkRGBA _tmp3_;
	GtkAllocation _tmp4_;
	GtkAllocation _tmp5_;
	GdkRectangle _tmp6_ = {0};
	GdkRectangle _tmp7_;
	gboolean result;
	self = (FilesMultiLineEditableLabel*) base;
	g_return_val_if_fail (cr != NULL, FALSE);
	_result_ = GTK_WIDGET_CLASS (files_multi_line_editable_label_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, FILES_TYPE_ABSTRACT_EDITABLE_LABEL, FilesAbstractEditableLabel), cr);
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
	allocation = _tmp0_;
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_get_color (_tmp1_, gtk_widget_get_state_flags ((GtkWidget*) self), &_tmp2_);
	color = _tmp2_;
	_tmp3_ = color;
	gdk_cairo_set_source_rgba (cr, &_tmp3_);
	cairo_set_line_width (cr, 1.0);
	_tmp4_ = allocation;
	_tmp5_ = allocation;
	_tmp6_.x = 0;
	_tmp6_.y = 0;
	_tmp6_.width = _tmp4_.width;
	_tmp6_.height = _tmp5_.height;
	outline = _tmp6_;
	_tmp7_ = outline;
	gdk_cairo_rectangle (cr, &_tmp7_);
	cairo_stroke (cr);
	result = _result_;
	return result;
}

static void
files_multi_line_editable_label_real_set_size_request (FilesAbstractEditableLabel* base,
                                                       gint width,
                                                       gint height)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	gtk_widget_set_size_request ((GtkWidget*) _tmp0_, width, height);
}

static void
files_multi_line_editable_label_real_start_editing (FilesAbstractEditableLabel* base,
                                                    GdkEvent* event)
{
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	self = (FilesMultiLineEditableLabel*) base;
	_tmp0_ = self->priv->_textview;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

FilesMultiLineEditableLabel*
files_multi_line_editable_label_construct (GType object_type)
{
	FilesMultiLineEditableLabel * self = NULL;
	self = (FilesMultiLineEditableLabel*) files_abstract_editable_label_construct (object_type);
	return self;
}

FilesMultiLineEditableLabel*
files_multi_line_editable_label_new (void)
{
	return files_multi_line_editable_label_construct (FILES_TYPE_MULTI_LINE_EDITABLE_LABEL);
}

GtkTextView*
files_multi_line_editable_label_get_textview (FilesMultiLineEditableLabel* self)
{
	GtkTextView* result;
	GtkTextView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_textview;
	result = _tmp0_;
	return result;
}

static void
files_multi_line_editable_label_set_textview (FilesMultiLineEditableLabel* self,
                                              GtkTextView* value)
{
	GtkTextView* old_value;
	g_return_if_fail (self != NULL);
	old_value = files_multi_line_editable_label_get_textview (self);
	if (old_value != value) {
		GtkTextView* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_textview);
		self->priv->_textview = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, files_multi_line_editable_label_properties[FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY]);
	}
}

static GObject *
files_multi_line_editable_label_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FilesMultiLineEditableLabel * self;
	GtkTextView* _tmp0_;
	GtkTextView* _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextView* _tmp3_;
	GtkWidget* _tmp4_;
	GtkScrolledWindow* _tmp5_ = NULL;
	GtkScrolledWindow* _tmp6_;
	parent_class = G_OBJECT_CLASS (files_multi_line_editable_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FILES_TYPE_MULTI_LINE_EDITABLE_LABEL, FilesMultiLineEditableLabel);
	_tmp0_ = (GtkTextView*) gtk_text_view_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	files_multi_line_editable_label_set_textview (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = self->priv->_textview;
	files_abstract_editable_label_connect_editable_widget ((FilesAbstractEditableLabel*) self, (GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->_textview;
	_tmp4_ = _g_object_ref0 ((GtkWidget*) _tmp3_);
	_tmp5_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_set ((GtkContainer*) _tmp5_, "child", _tmp4_, NULL);
	_g_object_unref0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->scrolled_window);
	self->scrolled_window = _tmp5_;
	_tmp6_ = self->scrolled_window;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp6_);
	return obj;
}

static void
files_multi_line_editable_label_class_init (FilesMultiLineEditableLabelClass * klass,
                                            gpointer klass_data)
{
	files_multi_line_editable_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FilesMultiLineEditableLabel_private_offset);
	((FilesAbstractEditableLabelClass *) klass)->set_text = (void (*) (FilesAbstractEditableLabel*, const gchar*)) files_multi_line_editable_label_real_set_text;
	((FilesAbstractEditableLabelClass *) klass)->set_line_wrap = (void (*) (FilesAbstractEditableLabel*, gboolean)) files_multi_line_editable_label_real_set_line_wrap;
	((FilesAbstractEditableLabelClass *) klass)->set_line_wrap_mode = (void (*) (FilesAbstractEditableLabel*, PangoWrapMode)) files_multi_line_editable_label_real_set_line_wrap_mode;
	((FilesAbstractEditableLabelClass *) klass)->set_justify = (void (*) (FilesAbstractEditableLabel*, GtkJustification)) files_multi_line_editable_label_real_set_justify;
	((FilesAbstractEditableLabelClass *) klass)->set_padding = (void (*) (FilesAbstractEditableLabel*, gint, gint)) files_multi_line_editable_label_real_set_padding;
	((FilesAbstractEditableLabelClass *) klass)->get_text = (gchar* (*) (FilesAbstractEditableLabel*)) files_multi_line_editable_label_real_get_text;
	((FilesAbstractEditableLabelClass *) klass)->select_region = (void (*) (FilesAbstractEditableLabel*, gint, gint)) files_multi_line_editable_label_real_select_region;
	((FilesAbstractEditableLabelClass *) klass)->do_delete_text = (void (*) (FilesAbstractEditableLabel*, gint, gint)) files_multi_line_editable_label_real_do_delete_text;
	((FilesAbstractEditableLabelClass *) klass)->do_insert_text = (void (*) (FilesAbstractEditableLabel*, const gchar*, gint, gint*)) files_multi_line_editable_label_real_do_insert_text;
	((FilesAbstractEditableLabelClass *) klass)->get_chars = (gchar* (*) (FilesAbstractEditableLabel*, gint, gint)) files_multi_line_editable_label_real_get_chars;
	((FilesAbstractEditableLabelClass *) klass)->get_position = (gint (*) (FilesAbstractEditableLabel*)) files_multi_line_editable_label_real_get_position;
	((FilesAbstractEditableLabelClass *) klass)->get_selection_bounds = (gboolean (*) (FilesAbstractEditableLabel*, gint*, gint*)) files_multi_line_editable_label_real_get_selection_bounds;
	((FilesAbstractEditableLabelClass *) klass)->set_position = (void (*) (FilesAbstractEditableLabel*, gint)) files_multi_line_editable_label_real_set_position;
	((GtkWidgetClass *) klass)->draw = (gboolean (*) (GtkWidget*, cairo_t*)) files_multi_line_editable_label_real_draw;
	((FilesAbstractEditableLabelClass *) klass)->set_size_request = (void (*) (FilesAbstractEditableLabel*, gint, gint)) files_multi_line_editable_label_real_set_size_request;
	((FilesAbstractEditableLabelClass *) klass)->start_editing = (void (*) (FilesAbstractEditableLabel*, GdkEvent*)) files_multi_line_editable_label_real_start_editing;
	G_OBJECT_CLASS (klass)->get_property = _vala_files_multi_line_editable_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_files_multi_line_editable_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = files_multi_line_editable_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = files_multi_line_editable_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY, files_multi_line_editable_label_properties[FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY] = g_param_spec_object ("textview", "textview", "textview", gtk_text_view_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
files_multi_line_editable_label_instance_init (FilesMultiLineEditableLabel * self,
                                               gpointer klass)
{
	self->priv = files_multi_line_editable_label_get_instance_private (self);
}

static void
files_multi_line_editable_label_finalize (GObject * obj)
{
	FilesMultiLineEditableLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FILES_TYPE_MULTI_LINE_EDITABLE_LABEL, FilesMultiLineEditableLabel);
	_g_object_unref0 (self->scrolled_window);
	_g_object_unref0 (self->priv->_textview);
	G_OBJECT_CLASS (files_multi_line_editable_label_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
files_multi_line_editable_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FilesMultiLineEditableLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) files_multi_line_editable_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FilesMultiLineEditableLabel), 0, (GInstanceInitFunc) files_multi_line_editable_label_instance_init, NULL };
	GType files_multi_line_editable_label_type_id;
	files_multi_line_editable_label_type_id = g_type_register_static (FILES_TYPE_ABSTRACT_EDITABLE_LABEL, "FilesMultiLineEditableLabel", &g_define_type_info, 0);
	FilesMultiLineEditableLabel_private_offset = g_type_add_instance_private (files_multi_line_editable_label_type_id, sizeof (FilesMultiLineEditableLabelPrivate));
	return files_multi_line_editable_label_type_id;
}

GType
files_multi_line_editable_label_get_type (void)
{
	static volatile gsize files_multi_line_editable_label_type_id__once = 0;
	if (g_once_init_enter (&files_multi_line_editable_label_type_id__once)) {
		GType files_multi_line_editable_label_type_id;
		files_multi_line_editable_label_type_id = files_multi_line_editable_label_get_type_once ();
		g_once_init_leave (&files_multi_line_editable_label_type_id__once, files_multi_line_editable_label_type_id);
	}
	return files_multi_line_editable_label_type_id__once;
}

static void
_vala_files_multi_line_editable_label_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	FilesMultiLineEditableLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FILES_TYPE_MULTI_LINE_EDITABLE_LABEL, FilesMultiLineEditableLabel);
	switch (property_id) {
		case FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY:
		g_value_set_object (value, files_multi_line_editable_label_get_textview (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_files_multi_line_editable_label_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	FilesMultiLineEditableLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FILES_TYPE_MULTI_LINE_EDITABLE_LABEL, FilesMultiLineEditableLabel);
	switch (property_id) {
		case FILES_MULTI_LINE_EDITABLE_LABEL_TEXTVIEW_PROPERTY:
		files_multi_line_editable_label_set_textview (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

