/* editable-entry.c generated by valac 0.17.7, the Vala compiler
 * generated from editable-entry.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/
/* Boxes.EditableEntry is based on gnome-control-center CcEditableEntry*/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>


#define BOXES_TYPE_EDITABLE_ENTRY (boxes_editable_entry_get_type ())
#define BOXES_EDITABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntry))
#define BOXES_EDITABLE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntryClass))
#define BOXES_IS_EDITABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_EDITABLE_ENTRY))
#define BOXES_IS_EDITABLE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_EDITABLE_ENTRY))
#define BOXES_EDITABLE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntryClass))

typedef struct _BoxesEditableEntry BoxesEditableEntry;
typedef struct _BoxesEditableEntryClass BoxesEditableEntryClass;
typedef struct _BoxesEditableEntryPrivate BoxesEditableEntryPrivate;

#define BOXES_EDITABLE_ENTRY_TYPE_PAGE (boxes_editable_entry_page_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))
#define __vala_PangoAttrList_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoAttrList_free (var), NULL)))

struct _BoxesEditableEntry {
	GtkAlignment parent_instance;
	BoxesEditableEntryPrivate * priv;
	gboolean _editable;
};

struct _BoxesEditableEntryClass {
	GtkAlignmentClass parent_class;
};

struct _BoxesEditableEntryPrivate {
	gchar* _text;
	PangoWeight _weight;
	gboolean _weight_set;
	gdouble _scale;
	gboolean _scale_set;
	GtkNotebook* notebook;
	GtkLabel* label;
	GtkButton* button;
	GtkEntry* entry;
	gboolean in_stop_editing;
};

typedef enum  {
	BOXES_EDITABLE_ENTRY_PAGE_LABEL,
	BOXES_EDITABLE_ENTRY_PAGE_BUTTON,
	BOXES_EDITABLE_ENTRY_PAGE_ENTRY
} BoxesEditableEntryPage;


static gpointer boxes_editable_entry_parent_class = NULL;

#define EMPTY_TEXT "\xe2\x80\x94"
GType boxes_editable_entry_get_type (void) G_GNUC_CONST;
#define BOXES_EDITABLE_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntryPrivate))
enum  {
	BOXES_EDITABLE_ENTRY_DUMMY_PROPERTY,
	BOXES_EDITABLE_ENTRY_TEXT,
	BOXES_EDITABLE_ENTRY_EDITABLE,
	BOXES_EDITABLE_ENTRY_SELECTABLE,
	BOXES_EDITABLE_ENTRY_WEIGHT_SET,
	BOXES_EDITABLE_ENTRY_SCALE,
	BOXES_EDITABLE_ENTRY_SCALE_SET
};
static GType boxes_editable_entry_page_get_type (void) G_GNUC_UNUSED;
static void boxes_editable_entry_update_entry_font (BoxesEditableEntry* self, GtkEntry* entry);
gboolean boxes_editable_entry_get_scale_set (BoxesEditableEntry* self);
gboolean boxes_editable_entry_get_weight_set (BoxesEditableEntry* self);
static PangoFontDescription* _vala_PangoFontDescription_copy (PangoFontDescription* self);
gdouble boxes_editable_entry_get_scale (BoxesEditableEntry* self);
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
static void boxes_editable_entry_update_fonts (BoxesEditableEntry* self);
static void _vala_PangoAttrList_free (PangoAttrList* self);
void boxes_editable_entry_start_editing (BoxesEditableEntry* self);
static void boxes_editable_entry_stop_editing (BoxesEditableEntry* self);
void boxes_editable_entry_set_text (BoxesEditableEntry* self, const gchar* value);
static void boxes_editable_entry_cancel_editing (BoxesEditableEntry* self);
const gchar* boxes_editable_entry_get_text (BoxesEditableEntry* self);
BoxesEditableEntry* boxes_editable_entry_new (void);
BoxesEditableEntry* boxes_editable_entry_construct (GType object_type);
static void __lambda13_ (BoxesEditableEntry* self);
static void ___lambda13__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda14_ (BoxesEditableEntry* self, GtkWidget* widget, GtkAllocation* allocation);
static void ___lambda14__gtk_widget_size_allocate (GtkWidget* _sender, GtkAllocation* allocation, gpointer self);
static void __lambda15_ (BoxesEditableEntry* self);
static void ___lambda15__gtk_entry_activate (GtkEntry* _sender, gpointer self);
static gboolean __lambda16_ (BoxesEditableEntry* self);
static gboolean ___lambda16__gtk_widget_focus_out_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self);
static gboolean __lambda17_ (BoxesEditableEntry* self, GtkWidget* widget, GdkEventKey* event);
static gboolean ___lambda17__gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static void __lambda18_ (BoxesEditableEntry* self, GtkWidget* entry);
static void ___lambda18__gtk_widget_style_updated (GtkWidget* _sender, gpointer self);
gboolean boxes_editable_entry_get_editable (BoxesEditableEntry* self);
void boxes_editable_entry_set_editable (BoxesEditableEntry* self, gboolean value);
gboolean boxes_editable_entry_get_selectable (BoxesEditableEntry* self);
void boxes_editable_entry_set_selectable (BoxesEditableEntry* self, gboolean value);
void boxes_editable_entry_set_weight_set (BoxesEditableEntry* self, gboolean value);
void boxes_editable_entry_set_scale (BoxesEditableEntry* self, gdouble value);
void boxes_editable_entry_set_scale_set (BoxesEditableEntry* self, gboolean value);
static void boxes_editable_entry_finalize (GObject* obj);
static void _vala_boxes_editable_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_editable_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static GType boxes_editable_entry_page_get_type (void) {
	static volatile gsize boxes_editable_entry_page_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_editable_entry_page_type_id__volatile)) {
		static const GEnumValue values[] = {{BOXES_EDITABLE_ENTRY_PAGE_LABEL, "BOXES_EDITABLE_ENTRY_PAGE_LABEL", "label"}, {BOXES_EDITABLE_ENTRY_PAGE_BUTTON, "BOXES_EDITABLE_ENTRY_PAGE_BUTTON", "button"}, {BOXES_EDITABLE_ENTRY_PAGE_ENTRY, "BOXES_EDITABLE_ENTRY_PAGE_ENTRY", "entry"}, {0, NULL, NULL}};
		GType boxes_editable_entry_page_type_id;
		boxes_editable_entry_page_type_id = g_enum_register_static ("BoxesEditableEntryPage", values);
		g_once_init_leave (&boxes_editable_entry_page_type_id__volatile, boxes_editable_entry_page_type_id);
	}
	return boxes_editable_entry_page_type_id__volatile;
}


static PangoFontDescription* _vala_PangoFontDescription_copy (PangoFontDescription* self) {
	return g_boxed_copy (pango_font_description_get_type (), self);
}


static gpointer __vala_PangoFontDescription_copy0 (gpointer self) {
	return self ? _vala_PangoFontDescription_copy (self) : NULL;
}


static void _vala_PangoFontDescription_free (PangoFontDescription* self) {
	g_boxed_free (pango_font_description_get_type (), self);
}


static void boxes_editable_entry_update_entry_font (BoxesEditableEntry* self, GtkEntry* entry) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp3_;
	GtkEntry* _tmp4_;
	GtkEntry* _tmp5_;
	GtkEntry* _tmp6_;
	GtkStyleContext* _tmp7_ = NULL;
	GtkEntry* _tmp8_;
	GtkStateFlags _tmp9_ = 0;
	PangoFontDescription* _tmp10_ = NULL;
	PangoFontDescription* _tmp11_;
	PangoFontDescription* desc;
	gboolean _tmp12_;
	gboolean _tmp15_;
	GtkEntry* _tmp21_;
	PangoFontDescription* _tmp22_;
	GtkEntry* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp1_ = self->priv->_scale_set;
	if (!_tmp1_) {
		gboolean _tmp2_;
		_tmp2_ = self->priv->_weight_set;
		_tmp0_ = !_tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		return;
	}
	_tmp4_ = entry;
	g_signal_handlers_block_by_func (_tmp4_, (void*) boxes_editable_entry_update_entry_font, self);
	_tmp5_ = entry;
	gtk_widget_override_font ((GtkWidget*) _tmp5_, NULL);
	_tmp6_ = entry;
	_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) _tmp6_);
	_tmp8_ = entry;
	_tmp9_ = gtk_widget_get_state_flags ((GtkWidget*) _tmp8_);
	_tmp10_ = gtk_style_context_get_font (_tmp7_, _tmp9_);
	_tmp11_ = __vala_PangoFontDescription_copy0 (_tmp10_);
	desc = _tmp11_;
	_tmp12_ = self->priv->_weight_set;
	if (_tmp12_) {
		PangoFontDescription* _tmp13_;
		PangoWeight _tmp14_;
		_tmp13_ = desc;
		_tmp14_ = self->priv->_weight;
		pango_font_description_set_weight (_tmp13_, _tmp14_);
	}
	_tmp15_ = self->priv->_scale_set;
	if (_tmp15_) {
		PangoFontDescription* _tmp16_;
		gdouble _tmp17_;
		gdouble _tmp18_;
		PangoFontDescription* _tmp19_;
		gint _tmp20_ = 0;
		_tmp16_ = desc;
		_tmp17_ = boxes_editable_entry_get_scale (self);
		_tmp18_ = _tmp17_;
		_tmp19_ = desc;
		_tmp20_ = pango_font_description_get_size (_tmp19_);
		pango_font_description_set_size (_tmp16_, (gint) (_tmp18_ * _tmp20_));
	}
	_tmp21_ = entry;
	_tmp22_ = desc;
	gtk_widget_override_font ((GtkWidget*) _tmp21_, _tmp22_);
	_tmp23_ = entry;
	g_signal_handlers_unblock_by_func (_tmp23_, (void*) boxes_editable_entry_update_entry_font, self);
	__vala_PangoFontDescription_free0 (desc);
}


static void _vala_PangoAttrList_free (PangoAttrList* self) {
	g_boxed_free (pango_attr_list_get_type (), self);
}


static void boxes_editable_entry_update_fonts (BoxesEditableEntry* self) {
	PangoAttrList* _tmp0_;
	PangoAttrList* attrs;
	gboolean _tmp1_;
	gboolean _tmp6_;
	GtkLabel* _tmp10_;
	PangoAttrList* _tmp11_;
	GtkButton* _tmp12_;
	GtkWidget* _tmp13_ = NULL;
	PangoAttrList* _tmp14_;
	GtkEntry* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = pango_attr_list_new ();
	attrs = _tmp0_;
	_tmp1_ = self->priv->_scale_set;
	if (_tmp1_) {
		PangoAttrList* _tmp2_;
		gdouble _tmp3_;
		gdouble _tmp4_;
		PangoAttribute* _tmp5_ = NULL;
		_tmp2_ = attrs;
		_tmp3_ = boxes_editable_entry_get_scale (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = pango_attr_scale_new (_tmp4_);
		pango_attr_list_insert (_tmp2_, _tmp5_);
	}
	_tmp6_ = self->priv->_weight_set;
	if (_tmp6_) {
		PangoAttrList* _tmp7_;
		PangoWeight _tmp8_;
		PangoAttribute* _tmp9_ = NULL;
		_tmp7_ = attrs;
		_tmp8_ = self->priv->_weight;
		_tmp9_ = pango_attr_weight_new (_tmp8_);
		pango_attr_list_insert (_tmp7_, _tmp9_);
	}
	_tmp10_ = self->priv->label;
	_tmp11_ = attrs;
	gtk_label_set_attributes (_tmp10_, _tmp11_);
	_tmp12_ = self->priv->button;
	_tmp13_ = gtk_bin_get_child ((GtkBin*) _tmp12_);
	_tmp14_ = attrs;
	gtk_label_set_attributes (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, GTK_TYPE_LABEL) ? ((GtkLabel*) _tmp13_) : NULL, _tmp14_);
	_tmp15_ = self->priv->entry;
	boxes_editable_entry_update_entry_font (self, _tmp15_);
	__vala_PangoAttrList_free0 (attrs);
}


void boxes_editable_entry_start_editing (BoxesEditableEntry* self) {
	GtkNotebook* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notebook;
	g_object_set (_tmp0_, "page", (gint) BOXES_EDITABLE_ENTRY_PAGE_ENTRY, NULL);
}


static void boxes_editable_entry_stop_editing (BoxesEditableEntry* self) {
	gboolean _tmp0_;
	GtkNotebook* _tmp1_;
	GtkEntry* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->in_stop_editing;
	if (_tmp0_) {
		return;
	}
	self->priv->in_stop_editing = TRUE;
	_tmp1_ = self->priv->notebook;
	g_object_set (_tmp1_, "page", (gint) BOXES_EDITABLE_ENTRY_PAGE_BUTTON, NULL);
	_tmp2_ = self->priv->entry;
	_tmp3_ = gtk_entry_get_text (_tmp2_);
	_tmp4_ = _tmp3_;
	boxes_editable_entry_set_text (self, _tmp4_);
	g_signal_emit_by_name (self, "editing-done");
	self->priv->in_stop_editing = FALSE;
}


static void boxes_editable_entry_cancel_editing (BoxesEditableEntry* self) {
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkNotebook* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = boxes_editable_entry_get_text (self);
	_tmp2_ = _tmp1_;
	gtk_entry_set_text (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->notebook;
	g_object_set (_tmp3_, "page", (gint) BOXES_EDITABLE_ENTRY_PAGE_BUTTON, NULL);
}


static void __lambda13_ (BoxesEditableEntry* self) {
	boxes_editable_entry_start_editing (self);
}


static void ___lambda13__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda13_ (self);
}


static void __lambda14_ (BoxesEditableEntry* self, GtkWidget* widget, GtkAllocation* allocation) {
	GtkAllocation alloc = {0};
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_ = NULL;
	GtkAllocation _tmp2_ = {0};
	GtkAllocation _tmp3_;
	gint _tmp4_;
	GtkAllocation _tmp5_;
	gint _tmp6_;
	gint offset;
	gint _tmp7_;
	GtkLabel* _tmp8_;
	gint _tmp9_ = 0;
	gint _tmp10_;
	g_return_if_fail (widget != NULL);
	g_return_if_fail (allocation != NULL);
	_tmp0_ = widget;
	_tmp1_ = gtk_widget_get_parent (_tmp0_);
	gtk_widget_get_allocation (_tmp1_, &_tmp2_);
	alloc = _tmp2_;
	_tmp3_ = *allocation;
	_tmp4_ = _tmp3_.x;
	_tmp5_ = alloc;
	_tmp6_ = _tmp5_.x;
	offset = _tmp4_ - _tmp6_;
	_tmp7_ = offset;
	_tmp8_ = self->priv->label;
	g_object_get ((GtkMisc*) _tmp8_, "xpad", &_tmp9_, NULL);
	_tmp10_ = _tmp9_;
	if (_tmp7_ != _tmp10_) {
		GtkLabel* _tmp11_;
		gint _tmp12_;
		_tmp11_ = self->priv->label;
		_tmp12_ = offset;
		gtk_misc_set_padding ((GtkMisc*) _tmp11_, _tmp12_, 0);
	}
}


static void ___lambda14__gtk_widget_size_allocate (GtkWidget* _sender, GtkAllocation* allocation, gpointer self) {
	__lambda14_ (self, _sender, allocation);
}


static void __lambda15_ (BoxesEditableEntry* self) {
	boxes_editable_entry_stop_editing (self);
}


static void ___lambda15__gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	__lambda15_ (self);
}


static gboolean __lambda16_ (BoxesEditableEntry* self) {
	gboolean result = FALSE;
	boxes_editable_entry_stop_editing (self);
	result = FALSE;
	return result;
}


static gboolean ___lambda16__gtk_widget_focus_out_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self) {
	gboolean result;
	result = __lambda16_ (self);
	return result;
}


static gboolean __lambda17_ (BoxesEditableEntry* self, GtkWidget* widget, GdkEventKey* event) {
	gboolean result = FALSE;
	GdkEventKey _tmp0_;
	guint _tmp1_;
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = *event;
	_tmp1_ = _tmp0_.keyval;
	if (_tmp1_ == ((guint) GDK_KEY_Escape)) {
		boxes_editable_entry_cancel_editing (self);
	}
	result = FALSE;
	return result;
}


static gboolean ___lambda17__gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = __lambda17_ (self, _sender, event);
	return result;
}


static void __lambda18_ (BoxesEditableEntry* self, GtkWidget* entry) {
	GtkWidget* _tmp0_;
	g_return_if_fail (entry != NULL);
	_tmp0_ = entry;
	boxes_editable_entry_update_entry_font (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GTK_TYPE_ENTRY) ? ((GtkEntry*) _tmp0_) : NULL);
}


static void ___lambda18__gtk_widget_style_updated (GtkWidget* _sender, gpointer self) {
	__lambda18_ (self, _sender);
}


BoxesEditableEntry* boxes_editable_entry_construct (GType object_type) {
	BoxesEditableEntry * self = NULL;
	GtkNotebook* _tmp0_;
	GtkNotebook* _tmp1_;
	GtkNotebook* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkNotebook* _tmp5_;
	GtkLabel* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GtkButton* _tmp10_;
	GtkNotebook* _tmp11_;
	GtkButton* _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	GtkWidget* _tmp15_ = NULL;
	GtkEntry* _tmp16_;
	GtkNotebook* _tmp17_;
	GtkEntry* _tmp18_;
	GtkEntry* _tmp19_;
	GtkEntry* _tmp20_;
	GtkEntry* _tmp21_;
	GtkEntry* _tmp22_;
	GtkNotebook* _tmp23_;
	GtkNotebook* _tmp24_;
	self = (BoxesEditableEntry*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkNotebook*) gtk_notebook_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->notebook);
	self->priv->notebook = _tmp0_;
	_tmp1_ = self->priv->notebook;
	gtk_notebook_set_show_tabs (_tmp1_, FALSE);
	_tmp2_ = self->priv->notebook;
	gtk_notebook_set_show_border (_tmp2_, FALSE);
	_tmp3_ = (GtkLabel*) gtk_label_new (EMPTY_TEXT);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp3_;
	_tmp4_ = self->priv->label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp4_, 0.0f, 0.5f);
	_tmp5_ = self->priv->notebook;
	_tmp6_ = self->priv->label;
	gtk_notebook_append_page (_tmp5_, (GtkWidget*) _tmp6_, NULL);
	_tmp7_ = (GtkButton*) gtk_button_new_with_label (EMPTY_TEXT);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp7_;
	_tmp8_ = self->priv->button;
	gtk_widget_set_receives_default ((GtkWidget*) _tmp8_, TRUE);
	_tmp9_ = self->priv->button;
	gtk_button_set_relief (_tmp9_, GTK_RELIEF_NONE);
	_tmp10_ = self->priv->button;
	gtk_button_set_alignment (_tmp10_, 0.0f, 0.5f);
	_tmp11_ = self->priv->notebook;
	_tmp12_ = self->priv->button;
	gtk_notebook_append_page (_tmp11_, (GtkWidget*) _tmp12_, NULL);
	_tmp13_ = self->priv->button;
	g_signal_connect_object (_tmp13_, "clicked", (GCallback) ___lambda13__gtk_button_clicked, self, 0);
	_tmp14_ = self->priv->button;
	_tmp15_ = gtk_bin_get_child ((GtkBin*) _tmp14_);
	g_signal_connect_object (_tmp15_, "size-allocate", (GCallback) ___lambda14__gtk_widget_size_allocate, self, 0);
	_tmp16_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp16_;
	_tmp17_ = self->priv->notebook;
	_tmp18_ = self->priv->entry;
	gtk_notebook_append_page (_tmp17_, (GtkWidget*) _tmp18_, NULL);
	_tmp19_ = self->priv->entry;
	g_signal_connect_object (_tmp19_, "activate", (GCallback) ___lambda15__gtk_entry_activate, self, 0);
	_tmp20_ = self->priv->entry;
	g_signal_connect_object ((GtkWidget*) _tmp20_, "focus-out-event", (GCallback) ___lambda16__gtk_widget_focus_out_event, self, 0);
	_tmp21_ = self->priv->entry;
	g_signal_connect_object ((GtkWidget*) _tmp21_, "key-press-event", (GCallback) ___lambda17__gtk_widget_key_press_event, self, 0);
	_tmp22_ = self->priv->entry;
	g_signal_connect_object ((GtkWidget*) _tmp22_, "style-updated", (GCallback) ___lambda18__gtk_widget_style_updated, self, 0);
	_tmp23_ = self->priv->notebook;
	g_object_set (_tmp23_, "page", (gint) BOXES_EDITABLE_ENTRY_PAGE_LABEL, NULL);
	_tmp24_ = self->priv->notebook;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp24_);
	gtk_widget_show_all ((GtkWidget*) self);
	return self;
}


BoxesEditableEntry* boxes_editable_entry_new (void) {
	return boxes_editable_entry_construct (BOXES_TYPE_EDITABLE_ENTRY);
}


const gchar* boxes_editable_entry_get_text (BoxesEditableEntry* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_text;
	result = _tmp0_;
	return result;
}


void boxes_editable_entry_set_text (BoxesEditableEntry* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GtkEntry* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	gboolean _tmp9_;
	GtkLabel* _tmp10_;
	const gchar* _tmp11_;
	GtkButton* _tmp12_;
	GtkWidget* _tmp13_ = NULL;
	const gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_text);
	self->priv->_text = _tmp1_;
	_tmp2_ = self->priv->entry;
	_tmp3_ = value;
	gtk_entry_set_text (_tmp2_, _tmp3_);
	_tmp5_ = value;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp6_ = value;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ == 0;
	}
	_tmp9_ = _tmp4_;
	if (_tmp9_) {
		value = EMPTY_TEXT;
	}
	_tmp10_ = self->priv->label;
	_tmp11_ = value;
	gtk_label_set_label (_tmp10_, _tmp11_);
	_tmp12_ = self->priv->button;
	_tmp13_ = gtk_bin_get_child ((GtkBin*) _tmp12_);
	_tmp14_ = value;
	gtk_label_set_label (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, GTK_TYPE_LABEL) ? ((GtkLabel*) _tmp13_) : NULL, _tmp14_);
	g_object_notify ((GObject *) self, "text");
}


gboolean boxes_editable_entry_get_editable (BoxesEditableEntry* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->_editable;
	result = _tmp0_;
	return result;
}


void boxes_editable_entry_set_editable (BoxesEditableEntry* self, gboolean value) {
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	BoxesEditableEntryPage _tmp3_ = 0;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GtkNotebook* _tmp6_;
	BoxesEditableEntryPage _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = self->_editable;
	if (_tmp0_ == _tmp1_) {
		return;
	}
	_tmp2_ = value;
	self->_editable = _tmp2_;
	_tmp4_ = boxes_editable_entry_get_editable (self);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		_tmp3_ = BOXES_EDITABLE_ENTRY_PAGE_BUTTON;
	} else {
		_tmp3_ = BOXES_EDITABLE_ENTRY_PAGE_LABEL;
	}
	_tmp6_ = self->priv->notebook;
	_tmp7_ = _tmp3_;
	g_object_set (_tmp6_, "page", (gint) _tmp7_, NULL);
	g_object_notify ((GObject *) self, "editable");
}


gboolean boxes_editable_entry_get_selectable (BoxesEditableEntry* self) {
	gboolean result;
	GtkLabel* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->label;
	_tmp1_ = gtk_label_get_selectable (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


void boxes_editable_entry_set_selectable (BoxesEditableEntry* self, gboolean value) {
	gboolean _tmp0_;
	GtkLabel* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkLabel* _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = self->priv->label;
	_tmp2_ = gtk_label_get_selectable (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp0_ == _tmp3_) {
		return;
	}
	_tmp4_ = self->priv->label;
	_tmp5_ = value;
	gtk_label_set_selectable (_tmp4_, _tmp5_);
	g_object_notify ((GObject *) self, "selectable");
}


gboolean boxes_editable_entry_get_weight_set (BoxesEditableEntry* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_weight_set;
	result = _tmp0_;
	return result;
}


void boxes_editable_entry_set_weight_set (BoxesEditableEntry* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_weight_set = _tmp0_;
	g_object_notify ((GObject *) self, "weight-set");
}


gdouble boxes_editable_entry_get_scale (BoxesEditableEntry* self) {
	gdouble result;
	gdouble _tmp0_;
	g_return_val_if_fail (self != NULL, 0.0);
	_tmp0_ = self->priv->_scale;
	result = _tmp0_;
	return result;
}


void boxes_editable_entry_set_scale (BoxesEditableEntry* self, gdouble value) {
	gboolean _tmp0_ = FALSE;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gboolean _tmp4_;
	gdouble _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp1_ = value;
	_tmp2_ = self->priv->_scale;
	if (_tmp1_ == _tmp2_) {
		gboolean _tmp3_;
		_tmp3_ = self->priv->_scale_set;
		_tmp0_ = _tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp4_ = _tmp0_;
	if (_tmp4_) {
		return;
	}
	_tmp5_ = value;
	self->priv->_scale = _tmp5_;
	boxes_editable_entry_set_scale_set (self, TRUE);
	boxes_editable_entry_update_fonts (self);
	g_object_notify ((GObject *) self, "scale");
}


gboolean boxes_editable_entry_get_scale_set (BoxesEditableEntry* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_scale_set;
	result = _tmp0_;
	return result;
}


void boxes_editable_entry_set_scale_set (BoxesEditableEntry* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_scale_set = _tmp0_;
	g_object_notify ((GObject *) self, "scale-set");
}


static void boxes_editable_entry_class_init (BoxesEditableEntryClass * klass) {
	boxes_editable_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesEditableEntryPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_editable_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_editable_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_editable_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_TEXT, g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_EDITABLE, g_param_spec_boolean ("editable", "editable", "editable", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_SELECTABLE, g_param_spec_boolean ("selectable", "selectable", "selectable", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_WEIGHT_SET, g_param_spec_boolean ("weight-set", "weight-set", "weight-set", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_SCALE, g_param_spec_double ("scale", "scale", "scale", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_EDITABLE_ENTRY_SCALE_SET, g_param_spec_boolean ("scale-set", "scale-set", "scale-set", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_signal_new ("editing_done", BOXES_TYPE_EDITABLE_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void boxes_editable_entry_instance_init (BoxesEditableEntry * self) {
	self->priv = BOXES_EDITABLE_ENTRY_GET_PRIVATE (self);
	self->priv->_weight = PANGO_WEIGHT_NORMAL;
	self->priv->_scale = 1.0;
}


static void boxes_editable_entry_finalize (GObject* obj) {
	BoxesEditableEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntry);
	_g_free0 (self->priv->_text);
	_g_object_unref0 (self->priv->notebook);
	_g_object_unref0 (self->priv->label);
	_g_object_unref0 (self->priv->button);
	_g_object_unref0 (self->priv->entry);
	G_OBJECT_CLASS (boxes_editable_entry_parent_class)->finalize (obj);
}


GType boxes_editable_entry_get_type (void) {
	static volatile gsize boxes_editable_entry_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_editable_entry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesEditableEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_editable_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesEditableEntry), 0, (GInstanceInitFunc) boxes_editable_entry_instance_init, NULL };
		GType boxes_editable_entry_type_id;
		boxes_editable_entry_type_id = g_type_register_static (GTK_TYPE_ALIGNMENT, "BoxesEditableEntry", &g_define_type_info, 0);
		g_once_init_leave (&boxes_editable_entry_type_id__volatile, boxes_editable_entry_type_id);
	}
	return boxes_editable_entry_type_id__volatile;
}


static void _vala_boxes_editable_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesEditableEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntry);
	switch (property_id) {
		case BOXES_EDITABLE_ENTRY_TEXT:
		g_value_set_string (value, boxes_editable_entry_get_text (self));
		break;
		case BOXES_EDITABLE_ENTRY_EDITABLE:
		g_value_set_boolean (value, boxes_editable_entry_get_editable (self));
		break;
		case BOXES_EDITABLE_ENTRY_SELECTABLE:
		g_value_set_boolean (value, boxes_editable_entry_get_selectable (self));
		break;
		case BOXES_EDITABLE_ENTRY_WEIGHT_SET:
		g_value_set_boolean (value, boxes_editable_entry_get_weight_set (self));
		break;
		case BOXES_EDITABLE_ENTRY_SCALE:
		g_value_set_double (value, boxes_editable_entry_get_scale (self));
		break;
		case BOXES_EDITABLE_ENTRY_SCALE_SET:
		g_value_set_boolean (value, boxes_editable_entry_get_scale_set (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_editable_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesEditableEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_EDITABLE_ENTRY, BoxesEditableEntry);
	switch (property_id) {
		case BOXES_EDITABLE_ENTRY_TEXT:
		boxes_editable_entry_set_text (self, g_value_get_string (value));
		break;
		case BOXES_EDITABLE_ENTRY_EDITABLE:
		boxes_editable_entry_set_editable (self, g_value_get_boolean (value));
		break;
		case BOXES_EDITABLE_ENTRY_SELECTABLE:
		boxes_editable_entry_set_selectable (self, g_value_get_boolean (value));
		break;
		case BOXES_EDITABLE_ENTRY_WEIGHT_SET:
		boxes_editable_entry_set_weight_set (self, g_value_get_boolean (value));
		break;
		case BOXES_EDITABLE_ENTRY_SCALE:
		boxes_editable_entry_set_scale (self, g_value_get_double (value));
		break;
		case BOXES_EDITABLE_ENTRY_SCALE_SET:
		boxes_editable_entry_set_scale_set (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



