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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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 3 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: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.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  {
	WIDGETS_TEXT_VIEW_0_PROPERTY,
	WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY,
	WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY,
	WIDGETS_TEXT_VIEW_NUM_PROPERTIES
};
static GParamSpec* widgets_text_view_properties[WIDGETS_TEXT_VIEW_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))
enum  {
	WIDGETS_TEXT_VIEW_ENTER_SIGNAL,
	WIDGETS_TEXT_VIEW_LEAVE_SIGNAL,
	WIDGETS_TEXT_VIEW_NUM_SIGNALS
};
static guint widgets_text_view_signals[WIDGETS_TEXT_VIEW_NUM_SIGNALS] = {0};

struct _WidgetsTextViewPrivate {
	GeeHashMap* signal_map;
	gboolean showing_placeholder;
	gchar* _placeholder_text;
	gboolean _event_focus;
};

static gint WidgetsTextView_private_offset;
static gpointer widgets_text_view_parent_class = NULL;

static void widgets_text_view_handle_focus_in (WidgetsTextView* self);
static void widgets_text_view_update_placeholder_visibility (WidgetsTextView* self);
static GObject * widgets_text_view_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void _widgets_text_view___lambda352_ (WidgetsTextView* self);
static void __widgets_text_view___lambda352__gtk_widget_realize (GtkWidget* _sender,
                                                          gpointer self);
static void _widgets_text_view___lambda353_ (WidgetsTextView* self);
static void __widgets_text_view___lambda353__g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self);
static void _widgets_text_view_handle_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                          gpointer self);
static void _widgets_text_view___lambda354_ (WidgetsTextView* self);
static void __widgets_text_view___lambda354__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                        gpointer self);
static void _widgets_text_view___lambda355_ (WidgetsTextView* self);
static void __widgets_text_view___lambda355__gtk_widget_destroy (GtkWidget* _sender,
                                                          gpointer self);
static void widgets_text_view_finalize (GObject * obj);
static GType widgets_text_view_get_type_once (void);
static void _vala_widgets_text_view_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_widgets_text_view_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
widgets_text_view_get_instance_private (WidgetsTextView* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsTextView_private_offset);
}

static void
widgets_text_view_handle_focus_in (WidgetsTextView* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_event_focus;
	if (_tmp0_) {
		ServicesEventBus* _tmp1_;
		ServicesEventBus* _tmp2_;
		_tmp1_ = services_event_bus_get_default ();
		_tmp2_ = _tmp1_;
		g_signal_emit_by_name (_tmp2_, "disconnect-typing-accel");
		_g_object_unref0 (_tmp2_);
	}
	if (self->priv->showing_placeholder) {
		GtkTextBuffer* _tmp3_;
		GtkTextBuffer* _tmp4_;
		_tmp3_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp4_ = _tmp3_;
		g_object_set (_tmp4_, "text", "", NULL);
		gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) 1);
		self->priv->showing_placeholder = FALSE;
	}
	g_signal_emit (self, widgets_text_view_signals[WIDGETS_TEXT_VIEW_ENTER_SIGNAL], 0);
}

void
widgets_text_view_update_on_leave (WidgetsTextView* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_event_focus;
	if (_tmp0_) {
		ServicesEventBus* _tmp1_;
		ServicesEventBus* _tmp2_;
		_tmp1_ = services_event_bus_get_default ();
		_tmp2_ = _tmp1_;
		g_signal_emit_by_name (_tmp2_, "connect-typing-accel");
		_g_object_unref0 (_tmp2_);
	}
	g_signal_emit (self, widgets_text_view_signals[WIDGETS_TEXT_VIEW_LEAVE_SIGNAL], 0);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
widgets_text_view_update_placeholder_visibility (WidgetsTextView* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		GtkTextBuffer* _tmp4_;
		GtkTextBuffer* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp5_ = _tmp4_;
		g_object_get (_tmp5_, "text", &_tmp6_, NULL);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = string_strip (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp1_ = g_strcmp0 (_tmp10_, "") == 0;
		_g_free0 (_tmp10_);
		_g_free0 (_tmp8_);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp11_;
		_tmp11_ = self->priv->_placeholder_text;
		_tmp0_ = g_strcmp0 (_tmp11_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkTextBuffer* _tmp12_;
		GtkTextBuffer* _tmp13_;
		const gchar* _tmp14_;
		self->priv->showing_placeholder = TRUE;
		_tmp12_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp13_ = _tmp12_;
		_tmp14_ = self->priv->_placeholder_text;
		g_object_set (_tmp13_, "text", _tmp14_, NULL);
		gtk_widget_set_opacity ((GtkWidget*) self, 0.5);
	} else {
		gboolean _tmp15_ = FALSE;
		if (self->priv->showing_placeholder) {
			gboolean _tmp16_;
			gboolean _tmp17_;
			g_object_get ((GtkWidget*) self, "has-focus", &_tmp16_, NULL);
			_tmp17_ = _tmp16_;
			_tmp15_ = _tmp17_;
		} else {
			_tmp15_ = FALSE;
		}
		if (_tmp15_) {
			GtkTextBuffer* _tmp18_;
			GtkTextBuffer* _tmp19_;
			_tmp18_ = gtk_text_view_get_buffer ((GtkTextView*) self);
			_tmp19_ = _tmp18_;
			g_object_set (_tmp19_, "text", "", NULL);
			gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) 1);
			self->priv->showing_placeholder = FALSE;
		}
	}
}

gchar*
widgets_text_view_get_text (WidgetsTextView* self)
{
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	GtkTextIter _tmp3_ = {0};
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextIter _tmp6_ = {0};
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextIter _tmp9_;
	GtkTextIter _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (self->priv->showing_placeholder) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp2_ = _tmp1_;
	gtk_text_buffer_get_start_iter (_tmp2_, &_tmp3_);
	start = _tmp3_;
	_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp5_ = _tmp4_;
	gtk_text_buffer_get_end_iter (_tmp5_, &_tmp6_);
	end = _tmp6_;
	_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp8_ = _tmp7_;
	_tmp9_ = start;
	_tmp10_ = end;
	_tmp11_ = gtk_text_buffer_get_text (_tmp8_, &_tmp9_, &_tmp10_, TRUE);
	_tmp12_ = _tmp11_;
	_tmp13_ = string_strip (_tmp12_);
	_tmp14_ = _tmp13_;
	_g_free0 (_tmp12_);
	result = _tmp14_;
	return result;
}

void
widgets_text_view_set_text (WidgetsTextView* self,
                            const gchar* text)
{
	GtkTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp1_ = _tmp0_;
	g_object_set (_tmp1_, "text", text, NULL);
	self->priv->showing_placeholder = FALSE;
	gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) 1);
	widgets_text_view_update_placeholder_visibility (self);
}

WidgetsTextView*
widgets_text_view_construct (GType object_type)
{
	WidgetsTextView * self = NULL;
	self = (WidgetsTextView*) g_object_new (object_type, NULL);
	return self;
}

WidgetsTextView*
widgets_text_view_new (void)
{
	return widgets_text_view_construct (WIDGETS_TYPE_TEXT_VIEW);
}

const gchar*
widgets_text_view_get_placeholder_text (WidgetsTextView* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_placeholder_text;
	result = _tmp0_;
	return result;
}

void
widgets_text_view_set_placeholder_text (WidgetsTextView* self,
                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_text_view_get_placeholder_text (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_placeholder_text);
		self->priv->_placeholder_text = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_text_view_properties[WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY]);
	}
}

gboolean
widgets_text_view_get_event_focus (WidgetsTextView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_event_focus;
	return result;
}

void
widgets_text_view_set_event_focus (WidgetsTextView* self,
                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_text_view_get_event_focus (self);
	if (old_value != value) {
		self->priv->_event_focus = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_text_view_properties[WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY]);
	}
}

static void
_widgets_text_view___lambda352_ (WidgetsTextView* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		widgets_text_view_handle_focus_in (self);
	}
	widgets_text_view_update_placeholder_visibility (self);
}

static void
__widgets_text_view___lambda352__gtk_widget_realize (GtkWidget* _sender,
                                                     gpointer self)
{
	_widgets_text_view___lambda352_ ((WidgetsTextView*) self);
}

static void
_widgets_text_view___lambda353_ (WidgetsTextView* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		widgets_text_view_handle_focus_in (self);
	} else {
		widgets_text_view_update_on_leave (self);
	}
	widgets_text_view_update_placeholder_visibility (self);
}

static void
__widgets_text_view___lambda353__g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self)
{
	_widgets_text_view___lambda353_ ((WidgetsTextView*) self);
}

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

static void
_widgets_text_view_handle_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                     gpointer self)
{
	widgets_text_view_handle_focus_in ((WidgetsTextView*) self);
}

static void
_widgets_text_view___lambda354_ (WidgetsTextView* self)
{
	widgets_text_view_update_on_leave (self);
	widgets_text_view_update_placeholder_visibility (self);
}

static void
__widgets_text_view___lambda354__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                   gpointer self)
{
	_widgets_text_view___lambda354_ ((WidgetsTextView*) self);
}

static void
_widgets_text_view___lambda355_ (WidgetsTextView* self)
{
	GeeHashMap* _tmp15_;
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->signal_map;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GeeMapEntry* _tmp9_;
			gconstpointer _tmp10_;
			gconstpointer _tmp11_;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp9_ = entry;
			_tmp10_ = gee_map_entry_get_value (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_key (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_handler_disconnect ((GObject*) _tmp11_, (gulong) ((guintptr) _tmp14_));
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp15_ = self->priv->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp15_);
}

static void
__widgets_text_view___lambda355__gtk_widget_destroy (GtkWidget* _sender,
                                                     gpointer self)
{
	_widgets_text_view___lambda355_ ((WidgetsTextView*) self);
}

static GObject *
widgets_text_view_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsTextView * self;
	GeeHashMap* _tmp0_;
	gulong _tmp1_;
	GeeHashMap* _tmp2_;
	gulong _tmp3_;
	GtkEventControllerFocus* gesture = NULL;
	GtkEventControllerFocus* _tmp4_;
	GtkEventControllerFocus* _tmp5_;
	GtkEventController* _tmp6_;
	GeeHashMap* _tmp7_;
	GtkEventControllerFocus* _tmp8_;
	gulong _tmp9_;
	GtkEventControllerFocus* _tmp10_;
	GeeHashMap* _tmp11_;
	GtkEventControllerFocus* _tmp12_;
	gulong _tmp13_;
	GtkEventControllerFocus* _tmp14_;
	parent_class = G_OBJECT_CLASS (widgets_text_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_TEXT_VIEW, WidgetsTextView);
	_tmp0_ = self->priv->signal_map;
	_tmp1_ = g_signal_connect_object ((GtkWidget*) self, "realize", (GCallback) __widgets_text_view___lambda352__gtk_widget_realize, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, (gpointer) ((guintptr) _tmp1_), (GObject*) self);
	_tmp2_ = self->priv->signal_map;
	_tmp3_ = g_signal_connect_object ((GObject*) self, "notify::has-focus", (GCallback) __widgets_text_view___lambda353__g_object_notify, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, (gpointer) ((guintptr) _tmp3_), (GObject*) self);
	_tmp4_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	gesture = _tmp4_;
	_tmp5_ = gesture;
	_tmp6_ = _g_object_ref0 ((GtkEventController*) _tmp5_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp6_);
	_tmp7_ = self->priv->signal_map;
	_tmp8_ = gesture;
	_tmp9_ = g_signal_connect_object (_tmp8_, "enter", (GCallback) _widgets_text_view_handle_focus_in_gtk_event_controller_focus_enter, self, 0);
	_tmp10_ = gesture;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp7_, (gpointer) ((guintptr) _tmp9_), (GObject*) _tmp10_);
	_tmp11_ = self->priv->signal_map;
	_tmp12_ = gesture;
	_tmp13_ = g_signal_connect_object (_tmp12_, "leave", (GCallback) __widgets_text_view___lambda354__gtk_event_controller_focus_leave, self, 0);
	_tmp14_ = gesture;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp11_, (gpointer) ((guintptr) _tmp13_), (GObject*) _tmp14_);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) __widgets_text_view___lambda355__gtk_widget_destroy, self, 0);
	widgets_text_view_update_placeholder_visibility (self);
	_g_object_unref0 (gesture);
	return obj;
}

static void
widgets_text_view_class_init (WidgetsTextViewClass * klass,
                              gpointer klass_data)
{
	widgets_text_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsTextView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_text_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_text_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_text_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_text_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY, widgets_text_view_properties[WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY] = g_param_spec_string ("placeholder-text", "placeholder-text", "placeholder-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY, widgets_text_view_properties[WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY] = g_param_spec_boolean ("event-focus", "event-focus", "event-focus", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	widgets_text_view_signals[WIDGETS_TEXT_VIEW_ENTER_SIGNAL] = g_signal_new ("enter", WIDGETS_TYPE_TEXT_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	widgets_text_view_signals[WIDGETS_TEXT_VIEW_LEAVE_SIGNAL] = g_signal_new ("leave", WIDGETS_TYPE_TEXT_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_text_view_instance_init (WidgetsTextView * self,
                                 gpointer klass)
{
	GeeHashMap* _tmp0_;
	gchar* _tmp1_;
	self->priv = widgets_text_view_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signal_map = _tmp0_;
	self->priv->showing_placeholder = FALSE;
	_tmp1_ = g_strdup ("");
	self->priv->_placeholder_text = _tmp1_;
	self->priv->_event_focus = TRUE;
}

static void
widgets_text_view_finalize (GObject * obj)
{
	WidgetsTextView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_TEXT_VIEW, WidgetsTextView);
	_g_object_unref0 (self->priv->signal_map);
	_g_free0 (self->priv->_placeholder_text);
	G_OBJECT_CLASS (widgets_text_view_parent_class)->finalize (obj);
}

static GType
widgets_text_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsTextViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_text_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsTextView), 0, (GInstanceInitFunc) widgets_text_view_instance_init, NULL };
	GType widgets_text_view_type_id;
	widgets_text_view_type_id = g_type_register_static (gtk_text_view_get_type (), "WidgetsTextView", &g_define_type_info, 0);
	WidgetsTextView_private_offset = g_type_add_instance_private (widgets_text_view_type_id, sizeof (WidgetsTextViewPrivate));
	return widgets_text_view_type_id;
}

GType
widgets_text_view_get_type (void)
{
	static volatile gsize widgets_text_view_type_id__once = 0;
	if (g_once_init_enter (&widgets_text_view_type_id__once)) {
		GType widgets_text_view_type_id;
		widgets_text_view_type_id = widgets_text_view_get_type_once ();
		g_once_init_leave (&widgets_text_view_type_id__once, widgets_text_view_type_id);
	}
	return widgets_text_view_type_id__once;
}

static void
_vala_widgets_text_view_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	WidgetsTextView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_TEXT_VIEW, WidgetsTextView);
	switch (property_id) {
		case WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY:
		g_value_set_string (value, widgets_text_view_get_placeholder_text (self));
		break;
		case WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY:
		g_value_set_boolean (value, widgets_text_view_get_event_focus (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_text_view_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	WidgetsTextView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_TEXT_VIEW, WidgetsTextView);
	switch (property_id) {
		case WIDGETS_TEXT_VIEW_PLACEHOLDER_TEXT_PROPERTY:
		widgets_text_view_set_placeholder_text (self, g_value_get_string (value));
		break;
		case WIDGETS_TEXT_VIEW_EVENT_FOCUS_PROPERTY:
		widgets_text_view_set_event_focus (self, g_value_get_boolean (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;
}

