/* Label.c generated by valac 0.56.19, the Vala compiler
 * generated from Label.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 <adwaita.h>
#include <glib-object.h>
#include "planify.h"
#include <gee.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DIALOGS_TYPE_LABEL (dialogs_label_get_type ())
#define DIALOGS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_LABEL, DialogsLabel))
#define DIALOGS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_LABEL, DialogsLabelClass))
#define DIALOGS_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_LABEL))
#define DIALOGS_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_LABEL))
#define DIALOGS_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_LABEL, DialogsLabelClass))

typedef struct _DialogsLabel DialogsLabel;
typedef struct _DialogsLabelClass DialogsLabelClass;
typedef struct _DialogsLabelPrivate DialogsLabelPrivate;

#define WIDGETS_TYPE_COLOR_PICKER_ROW (widgets_color_picker_row_get_type ())
#define WIDGETS_COLOR_PICKER_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_COLOR_PICKER_ROW, WidgetsColorPickerRow))
#define WIDGETS_COLOR_PICKER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_COLOR_PICKER_ROW, WidgetsColorPickerRowClass))
#define WIDGETS_IS_COLOR_PICKER_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_COLOR_PICKER_ROW))
#define WIDGETS_IS_COLOR_PICKER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_COLOR_PICKER_ROW))
#define WIDGETS_COLOR_PICKER_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_COLOR_PICKER_ROW, WidgetsColorPickerRowClass))

typedef struct _WidgetsColorPickerRow WidgetsColorPickerRow;
typedef struct _WidgetsColorPickerRowClass WidgetsColorPickerRowClass;
enum  {
	DIALOGS_LABEL_0_PROPERTY,
	DIALOGS_LABEL_LABEL_PROPERTY,
	DIALOGS_LABEL_IS_CREATING_PROPERTY,
	DIALOGS_LABEL_NUM_PROPERTIES
};
static GParamSpec* dialogs_label_properties[DIALOGS_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))
typedef struct _Block87Data Block87Data;
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))

struct _DialogsLabel {
	AdwDialog parent_instance;
	DialogsLabelPrivate * priv;
};

struct _DialogsLabelClass {
	AdwDialogClass parent_class;
};

struct _DialogsLabelPrivate {
	ObjectsLabel* _label;
	AdwEntryRow* name_entry;
	WidgetsColorPickerRow* color_picker_row;
	WidgetsLoadingButton* submit_button;
	GeeHashMap* signal_map;
};

struct _Block87Data {
	int _ref_count_;
	DialogsLabel* self;
	gchar* _name;
	gchar* _color;
};

static gint DialogsLabel_private_offset;
static gpointer dialogs_label_parent_class = NULL;

VALA_EXTERN GType dialogs_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsLabel, g_object_unref)
VALA_EXTERN GType widgets_color_picker_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsColorPickerRow, g_object_unref)
VALA_EXTERN DialogsLabel* dialogs_label_new_new (ObjectsSource* source);
VALA_EXTERN DialogsLabel* dialogs_label_construct_new (GType object_type,
                                           ObjectsSource* source);
VALA_EXTERN DialogsLabel* dialogs_label_new (ObjectsLabel* label);
VALA_EXTERN DialogsLabel* dialogs_label_construct (GType object_type,
                                       ObjectsLabel* label);
static gboolean dialogs_label_is_duplicate (DialogsLabel* self,
                                     const gchar* text);
VALA_EXTERN ObjectsLabel* dialogs_label_get_label (DialogsLabel* self);
static void dialogs_label_add_update_label (DialogsLabel* self);
VALA_EXTERN gboolean dialogs_label_get_is_creating (DialogsLabel* self);
VALA_EXTERN const gchar* widgets_color_picker_row_get_color (WidgetsColorPickerRow* self);
static void dialogs_label_update_label (DialogsLabel* self,
                                 const gchar* _name,
                                 const gchar* _color);
static void dialogs_label_add_label (DialogsLabel* self);
static Block87Data* block87_data_ref (Block87Data* _data87_);
static void block87_data_unref (void * _userdata_);
static void ___lambda839_ (Block87Data* _data87_,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda839__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void ___lambda840_ (DialogsLabel* self,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda840__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
VALA_EXTERN void dialogs_label_clean_up (DialogsLabel* self);
VALA_EXTERN void widgets_color_picker_row_clean_up (WidgetsColorPickerRow* self);
static void dialogs_label_set_label (DialogsLabel* self,
                              ObjectsLabel* value);
static GObject * dialogs_label_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
VALA_EXTERN WidgetsColorPickerRow* widgets_color_picker_row_new (void);
VALA_EXTERN WidgetsColorPickerRow* widgets_color_picker_row_construct (GType object_type);
static gboolean _dialogs_label___lambda841_ (DialogsLabel* self);
VALA_EXTERN void widgets_color_picker_row_set_color (WidgetsColorPickerRow* self,
                                         const gchar* value);
static gboolean __dialogs_label___lambda841__gsource_func (gpointer self);
static void _dialogs_label_add_update_label_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                    gpointer self);
static void _dialogs_label_add_update_label_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self);
static void _dialogs_label___lambda842_ (DialogsLabel* self);
static void __dialogs_label___lambda842__gtk_editable_changed (GtkEditable* _sender,
                                                        gpointer self);
static void _dialogs_label___lambda843_ (DialogsLabel* self);
static void __dialogs_label___lambda843__adw_dialog_closed (AdwDialog* _sender,
                                                     gpointer self);
static void dialogs_label_finalize (GObject * obj);
static GType dialogs_label_get_type_once (void);
static void _vala_dialogs_label_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_dialogs_label_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);

static inline gpointer
dialogs_label_get_instance_private (DialogsLabel* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsLabel_private_offset);
}

DialogsLabel*
dialogs_label_construct_new (GType object_type,
                             ObjectsSource* source)
{
	DialogsLabel * self = NULL;
	ObjectsLabel* label = NULL;
	ObjectsLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (source != NULL, NULL);
	_tmp0_ = objects_label_new ();
	label = _tmp0_;
	objects_base_object_set_color ((ObjectsBaseObject*) label, "blue");
	objects_base_object_set_id ((ObjectsBaseObject*) label, "");
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) source);
	_tmp2_ = _tmp1_;
	objects_label_set_source_id (label, _tmp2_);
	self = (DialogsLabel*) g_object_new (object_type, "label", label, "title", _ ("New Label"), NULL);
	_g_object_unref0 (label);
	return self;
}

DialogsLabel*
dialogs_label_new_new (ObjectsSource* source)
{
	return dialogs_label_construct_new (DIALOGS_TYPE_LABEL, source);
}

DialogsLabel*
dialogs_label_construct (GType object_type,
                         ObjectsLabel* label)
{
	DialogsLabel * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (DialogsLabel*) g_object_new (object_type, "label", label, "title", _ ("Edit Label"), NULL);
	return self;
}

DialogsLabel*
dialogs_label_new (ObjectsLabel* label)
{
	return dialogs_label_construct (DIALOGS_TYPE_LABEL, label);
}

static gboolean
dialogs_label_is_duplicate (DialogsLabel* self,
                            const gchar* text)
{
	ObjectsLabel* label = NULL;
	ServicesStore* _tmp0_;
	ObjectsLabel* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ObjectsLabel* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp0_ = services_store_instance ();
	_tmp1_ = self->priv->_label;
	_tmp2_ = objects_label_get_source_id (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = services_store_get_label_by_name (_tmp0_, text, TRUE, _tmp3_);
	label = _tmp4_;
	result = label != NULL;
	_g_object_unref0 (label);
	return result;
}

static void
dialogs_label_add_update_label (DialogsLabel* self)
{
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gchar* _name = NULL;
	ObjectsLabel* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _color = NULL;
	ObjectsLabel* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	ObjectsLabel* _tmp19_;
	AdwEntryRow* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	ObjectsLabel* _tmp23_;
	WidgetsColorPickerRow* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gboolean _tmp27_;
	gboolean _tmp28_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->name_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ <= 0) {
		adw_dialog_close ((AdwDialog*) self);
		return;
	}
	_tmp6_ = dialogs_label_get_is_creating (self);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		AdwEntryRow* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp8_ = self->priv->name_entry;
		_tmp9_ = gtk_editable_get_text ((GtkEditable*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp5_ = dialogs_label_is_duplicate (self, _tmp10_);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		adw_dialog_close ((AdwDialog*) self);
		return;
	}
	_tmp11_ = self->priv->_label;
	_tmp12_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup (_tmp13_);
	_name = _tmp14_;
	_tmp15_ = self->priv->_label;
	_tmp16_ = objects_base_object_get_color ((ObjectsBaseObject*) _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strdup (_tmp17_);
	_color = _tmp18_;
	_tmp19_ = self->priv->_label;
	_tmp20_ = self->priv->name_entry;
	_tmp21_ = gtk_editable_get_text ((GtkEditable*) _tmp20_);
	_tmp22_ = _tmp21_;
	objects_base_object_set_name ((ObjectsBaseObject*) _tmp19_, _tmp22_);
	_tmp23_ = self->priv->_label;
	_tmp24_ = self->priv->color_picker_row;
	_tmp25_ = widgets_color_picker_row_get_color (_tmp24_);
	_tmp26_ = _tmp25_;
	objects_base_object_set_color ((ObjectsBaseObject*) _tmp23_, _tmp26_);
	_tmp27_ = dialogs_label_get_is_creating (self);
	_tmp28_ = _tmp27_;
	if (!_tmp28_) {
		const gchar* _tmp29_;
		const gchar* _tmp30_;
		_tmp29_ = _name;
		_tmp30_ = _color;
		dialogs_label_update_label (self, _tmp29_, _tmp30_);
	} else {
		dialogs_label_add_label (self);
	}
	_g_free0 (_color);
	_g_free0 (_name);
}

static Block87Data*
block87_data_ref (Block87Data* _data87_)
{
	g_atomic_int_inc (&_data87_->_ref_count_);
	return _data87_;
}

static void
block87_data_unref (void * _userdata_)
{
	Block87Data* _data87_;
	_data87_ = (Block87Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data87_->_ref_count_)) {
		DialogsLabel* self;
		self = _data87_->self;
		_g_free0 (_data87_->_name);
		_g_free0 (_data87_->_color);
		_g_object_unref0 (self);
		g_slice_free (Block87Data, _data87_);
	}
}

static void
___lambda839_ (Block87Data* _data87_,
               GObject* obj,
               GAsyncResult* res)
{
	DialogsLabel* self;
	WidgetsLoadingButton* _tmp0_;
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp1_;
	ServicesTodoist* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	self = _data87_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->submit_button;
	widgets_loading_button_set_is_loading (_tmp0_, FALSE);
	_tmp1_ = services_todoist_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = services_todoist_update_finish (_tmp2_, res);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp2_);
	response = _tmp4_;
	_tmp5_ = response;
	_tmp6_ = http_response_get_status (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		ServicesStore* _tmp8_;
		ObjectsLabel* _tmp9_;
		_tmp8_ = services_store_instance ();
		_tmp9_ = self->priv->_label;
		services_store_update_label (_tmp8_, _tmp9_);
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ObjectsLabel* _tmp10_;
		ObjectsLabel* _tmp11_;
		ServicesEventBus* _tmp12_;
		ServicesEventBus* _tmp13_;
		HttpResponse* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		HttpResponse* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp10_ = self->priv->_label;
		objects_base_object_set_name ((ObjectsBaseObject*) _tmp10_, _data87_->_name);
		_tmp11_ = self->priv->_label;
		objects_base_object_set_color ((ObjectsBaseObject*) _tmp11_, _data87_->_color);
		_tmp12_ = services_event_bus_get_default ();
		_tmp13_ = _tmp12_;
		_tmp14_ = response;
		_tmp15_ = http_response_get_error_code (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = response;
		_tmp18_ = http_response_get_error (_tmp17_);
		_tmp19_ = _tmp18_;
		g_signal_emit_by_name (_tmp13_, "send-error-toast", _tmp16_, _tmp19_);
		_g_object_unref0 (_tmp13_);
		adw_dialog_close ((AdwDialog*) self);
	}
	_http_response_unref0 (response);
}

static void
____lambda839__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda839_ (self, source_object, res);
	block87_data_unref (self);
}

static void
dialogs_label_update_label (DialogsLabel* self,
                            const gchar* _name,
                            const gchar* _color)
{
	Block87Data* _data87_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ObjectsLabel* _tmp3_;
	SourceType _tmp4_;
	SourceType _tmp5_;
	ObjectsLabel* _tmp11_;
	SourceType _tmp12_;
	SourceType _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_name != NULL);
	g_return_if_fail (_color != NULL);
	_data87_ = g_slice_new0 (Block87Data);
	_data87_->_ref_count_ = 1;
	_data87_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_name);
	_g_free0 (_data87_->_name);
	_data87_->_name = _tmp0_;
	_tmp1_ = g_strdup (_color);
	_g_free0 (_data87_->_color);
	_data87_->_color = _tmp1_;
	_tmp3_ = self->priv->_label;
	_tmp4_ = objects_label_get_source_type (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == SOURCE_TYPE_LOCAL) {
		_tmp2_ = TRUE;
	} else {
		ObjectsLabel* _tmp6_;
		SourceType _tmp7_;
		SourceType _tmp8_;
		_tmp6_ = self->priv->_label;
		_tmp7_ = objects_label_get_source_type (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp2_ = _tmp8_ == SOURCE_TYPE_CALDAV;
	}
	if (_tmp2_) {
		ServicesStore* _tmp9_;
		ObjectsLabel* _tmp10_;
		_tmp9_ = services_store_instance ();
		_tmp10_ = self->priv->_label;
		services_store_update_label (_tmp9_, _tmp10_);
		adw_dialog_close ((AdwDialog*) self);
		block87_data_unref (_data87_);
		_data87_ = NULL;
		return;
	}
	_tmp11_ = self->priv->_label;
	_tmp12_ = objects_label_get_source_type (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_ == SOURCE_TYPE_TODOIST) {
		WidgetsLoadingButton* _tmp14_;
		ServicesTodoist* _tmp15_;
		ServicesTodoist* _tmp16_;
		ObjectsLabel* _tmp17_;
		_tmp14_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp14_, TRUE);
		_tmp15_ = services_todoist_get_default ();
		_tmp16_ = _tmp15_;
		_tmp17_ = self->priv->_label;
		services_todoist_update (_tmp16_, (ObjectsBaseObject*) _tmp17_, ____lambda839__gasync_ready_callback, block87_data_ref (_data87_));
		_g_object_unref0 (_tmp16_);
	}
	block87_data_unref (_data87_);
	_data87_ = NULL;
}

static void
___lambda840_ (DialogsLabel* self,
               GObject* obj,
               GAsyncResult* res)
{
	WidgetsLoadingButton* _tmp0_;
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp1_;
	ServicesTodoist* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->submit_button;
	widgets_loading_button_set_is_loading (_tmp0_, FALSE);
	_tmp1_ = services_todoist_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = services_todoist_add_finish (_tmp2_, res);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp2_);
	response = _tmp4_;
	_tmp5_ = response;
	_tmp6_ = http_response_get_status (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		ObjectsLabel* _tmp8_;
		HttpResponse* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		ServicesStore* _tmp12_;
		ObjectsLabel* _tmp13_;
		_tmp8_ = self->priv->_label;
		_tmp9_ = response;
		_tmp10_ = http_response_get_data (_tmp9_);
		_tmp11_ = _tmp10_;
		objects_base_object_set_id ((ObjectsBaseObject*) _tmp8_, _tmp11_);
		_tmp12_ = services_store_instance ();
		_tmp13_ = self->priv->_label;
		services_store_insert_label (_tmp12_, _tmp13_);
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ServicesEventBus* _tmp14_;
		ServicesEventBus* _tmp15_;
		HttpResponse* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		HttpResponse* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp14_ = services_event_bus_get_default ();
		_tmp15_ = _tmp14_;
		_tmp16_ = response;
		_tmp17_ = http_response_get_error_code (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = response;
		_tmp20_ = http_response_get_error (_tmp19_);
		_tmp21_ = _tmp20_;
		g_signal_emit_by_name (_tmp15_, "send-error-toast", _tmp18_, _tmp21_);
		_g_object_unref0 (_tmp15_);
		adw_dialog_close ((AdwDialog*) self);
	}
	_http_response_unref0 (response);
}

static void
____lambda840__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda840_ ((DialogsLabel*) self, source_object, res);
	g_object_unref (self);
}

static void
dialogs_label_add_label (DialogsLabel* self)
{
	ObjectsLabel* _tmp0_;
	ServicesStore* _tmp1_;
	ObjectsLabel* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gboolean _tmp9_ = FALSE;
	ObjectsLabel* _tmp10_;
	SourceType _tmp11_;
	SourceType _tmp12_;
	ObjectsLabel* _tmp24_;
	SourceType _tmp25_;
	SourceType _tmp26_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_label;
	_tmp1_ = services_store_instance ();
	_tmp2_ = self->priv->_label;
	_tmp3_ = objects_label_get_source_id (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = services_store_get_labels_by_source (_tmp1_, _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
	_tmp8_ = _tmp7_;
	objects_label_set_item_order (_tmp0_, _tmp8_);
	_g_object_unref0 (_tmp6_);
	_tmp10_ = self->priv->_label;
	_tmp11_ = objects_label_get_source_type (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_ == SOURCE_TYPE_LOCAL) {
		_tmp9_ = TRUE;
	} else {
		ObjectsLabel* _tmp13_;
		SourceType _tmp14_;
		SourceType _tmp15_;
		_tmp13_ = self->priv->_label;
		_tmp14_ = objects_label_get_source_type (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp9_ = _tmp15_ == SOURCE_TYPE_CALDAV;
	}
	if (_tmp9_) {
		ObjectsLabel* _tmp16_;
		Util* _tmp17_;
		Util* _tmp18_;
		ObjectsLabel* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		ServicesStore* _tmp22_;
		ObjectsLabel* _tmp23_;
		_tmp16_ = self->priv->_label;
		_tmp17_ = util_get_default ();
		_tmp18_ = _tmp17_;
		_tmp19_ = self->priv->_label;
		_tmp20_ = util_generate_id (_tmp18_, (ObjectsBaseObject*) _tmp19_);
		_tmp21_ = _tmp20_;
		objects_base_object_set_id ((ObjectsBaseObject*) _tmp16_, _tmp21_);
		_g_free0 (_tmp21_);
		_g_object_unref0 (_tmp18_);
		_tmp22_ = services_store_instance ();
		_tmp23_ = self->priv->_label;
		services_store_insert_label (_tmp22_, _tmp23_);
		adw_dialog_close ((AdwDialog*) self);
		return;
	}
	_tmp24_ = self->priv->_label;
	_tmp25_ = objects_label_get_source_type (_tmp24_);
	_tmp26_ = _tmp25_;
	if (_tmp26_ == SOURCE_TYPE_TODOIST) {
		WidgetsLoadingButton* _tmp27_;
		ServicesTodoist* _tmp28_;
		ServicesTodoist* _tmp29_;
		ObjectsLabel* _tmp30_;
		_tmp27_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp27_, TRUE);
		_tmp28_ = services_todoist_get_default ();
		_tmp29_ = _tmp28_;
		_tmp30_ = self->priv->_label;
		services_todoist_add (_tmp29_, (ObjectsBaseObject*) _tmp30_, ____lambda840__gasync_ready_callback, g_object_ref (self));
		_g_object_unref0 (_tmp29_);
	}
}

void
dialogs_label_clean_up (DialogsLabel* self)
{
	GeeHashMap* _tmp15_;
	WidgetsColorPickerRow* _tmp16_;
	g_return_if_fail (self != NULL);
	{
		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_);
	_tmp16_ = self->priv->color_picker_row;
	if (_tmp16_ != NULL) {
		WidgetsColorPickerRow* _tmp17_;
		_tmp17_ = self->priv->color_picker_row;
		widgets_color_picker_row_clean_up (_tmp17_);
	}
}

ObjectsLabel*
dialogs_label_get_label (DialogsLabel* self)
{
	ObjectsLabel* result;
	ObjectsLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

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

static void
dialogs_label_set_label (DialogsLabel* self,
                         ObjectsLabel* value)
{
	ObjectsLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_label_get_label (self);
	if (old_value != value) {
		ObjectsLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_label_properties[DIALOGS_LABEL_LABEL_PROPERTY]);
	}
}

gboolean
dialogs_label_get_is_creating (DialogsLabel* self)
{
	gboolean result;
	ObjectsLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_label;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = g_strcmp0 (_tmp2_, "") == 0;
	return result;
}

static gboolean
_dialogs_label___lambda841_ (DialogsLabel* self)
{
	AdwEntryRow* _tmp0_;
	WidgetsColorPickerRow* _tmp1_;
	ObjectsLabel* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean result;
	_tmp0_ = self->priv->name_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->color_picker_row;
	_tmp2_ = self->priv->_label;
	_tmp3_ = objects_base_object_get_color ((ObjectsBaseObject*) _tmp2_);
	_tmp4_ = _tmp3_;
	widgets_color_picker_row_set_color (_tmp1_, _tmp4_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__dialogs_label___lambda841__gsource_func (gpointer self)
{
	gboolean result;
	result = _dialogs_label___lambda841_ ((DialogsLabel*) self);
	return result;
}

static void
_dialogs_label_add_update_label_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                               gpointer self)
{
	dialogs_label_add_update_label ((DialogsLabel*) self);
}

static void
_dialogs_label_add_update_label_gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self)
{
	dialogs_label_add_update_label ((DialogsLabel*) self);
}

static void
_dialogs_label___lambda842_ (DialogsLabel* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	_tmp0_ = dialogs_label_get_is_creating (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		WidgetsLoadingButton* _tmp2_;
		AdwEntryRow* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = self->priv->submit_button;
		_tmp3_ = self->priv->name_entry;
		_tmp4_ = gtk_editable_get_text ((GtkEditable*) _tmp3_);
		_tmp5_ = _tmp4_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, !dialogs_label_is_duplicate (self, _tmp5_));
	}
}

static void
__dialogs_label___lambda842__gtk_editable_changed (GtkEditable* _sender,
                                                   gpointer self)
{
	_dialogs_label___lambda842_ ((DialogsLabel*) self);
}

static void
_dialogs_label___lambda843_ (DialogsLabel* self)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	dialogs_label_clean_up (self);
	_tmp0_ = services_event_bus_get_default ();
	_tmp1_ = _tmp0_;
	g_signal_emit_by_name (_tmp1_, "connect-typing-accel");
	_g_object_unref0 (_tmp1_);
}

static void
__dialogs_label___lambda843__adw_dialog_closed (AdwDialog* _sender,
                                                gpointer self)
{
	_dialogs_label___lambda843_ ((DialogsLabel*) self);
}

static GObject *
dialogs_label_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsLabel * self;
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp0_;
	AdwHeaderBar* _tmp1_;
	AdwEntryRow* _tmp2_;
	AdwEntryRow* _tmp3_;
	AdwEntryRow* _tmp4_;
	ObjectsLabel* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	AdwPreferencesGroup* name_group = NULL;
	AdwPreferencesGroup* _tmp8_ = NULL;
	AdwPreferencesGroup* _tmp9_;
	AdwEntryRow* _tmp10_;
	WidgetsColorPickerRow* _tmp11_;
	GtkGrid* color_group = NULL;
	GtkGrid* _tmp12_ = NULL;
	GtkGrid* _tmp13_;
	GtkGrid* _tmp14_;
	WidgetsColorPickerRow* _tmp15_;
	const gchar* _tmp16_ = NULL;
	gboolean _tmp17_;
	gboolean _tmp18_;
	WidgetsLoadingButton* _tmp19_ = NULL;
	WidgetsLoadingButton* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	WidgetsLoadingButton* _tmp23_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp24_;
	GtkBox* _tmp25_;
	AdwPreferencesGroup* _tmp26_;
	GtkBox* _tmp27_;
	GtkGrid* _tmp28_;
	GtkBox* _tmp29_;
	WidgetsLoadingButton* _tmp30_;
	AdwClamp* content_clamp = NULL;
	AdwClamp* _tmp31_ = NULL;
	AdwClamp* _tmp32_;
	GtkBox* _tmp33_;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp34_;
	AdwToolbarView* _tmp35_;
	AdwHeaderBar* _tmp36_;
	AdwToolbarView* _tmp37_;
	AdwClamp* _tmp38_;
	AdwToolbarView* _tmp39_;
	ServicesEventBus* _tmp40_;
	ServicesEventBus* _tmp41_;
	GeeHashMap* _tmp42_;
	AdwEntryRow* _tmp43_;
	gulong _tmp44_;
	AdwEntryRow* _tmp45_;
	GeeHashMap* _tmp46_;
	WidgetsLoadingButton* _tmp47_;
	gulong _tmp48_;
	WidgetsLoadingButton* _tmp49_;
	GeeHashMap* _tmp50_;
	AdwEntryRow* _tmp51_;
	gulong _tmp52_;
	AdwEntryRow* _tmp53_;
	parent_class = G_OBJECT_CLASS (dialogs_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_LABEL, DialogsLabel);
	_tmp0_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp0_);
	headerbar = _tmp0_;
	_tmp1_ = headerbar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "flat");
	_tmp2_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->name_entry);
	self->priv->name_entry = _tmp2_;
	_tmp3_ = self->priv->name_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp3_, _ ("Give your label a name"));
	_tmp4_ = self->priv->name_entry;
	_tmp5_ = self->priv->_label;
	_tmp6_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp5_);
	_tmp7_ = _tmp6_;
	gtk_editable_set_text ((GtkEditable*) _tmp4_, _tmp7_);
	_tmp8_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	gtk_widget_set_margin_end ((GtkWidget*) _tmp8_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp8_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp8_, 12);
	g_object_ref_sink (_tmp8_);
	name_group = _tmp8_;
	_tmp9_ = name_group;
	_tmp10_ = self->priv->name_entry;
	adw_preferences_group_add (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = widgets_color_picker_row_new ();
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->color_picker_row);
	self->priv->color_picker_row = _tmp11_;
	_tmp12_ = (GtkGrid*) gtk_grid_new ();
	gtk_widget_set_margin_end ((GtkWidget*) _tmp12_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp12_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp12_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp12_, 1);
	gtk_widget_set_valign ((GtkWidget*) _tmp12_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp12_);
	color_group = _tmp12_;
	_tmp13_ = color_group;
	gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "card");
	_tmp14_ = color_group;
	_tmp15_ = self->priv->color_picker_row;
	gtk_grid_attach (_tmp14_, (GtkWidget*) _tmp15_, 0, 0, 1, 1);
	_tmp17_ = dialogs_label_get_is_creating (self);
	_tmp18_ = _tmp17_;
	if (_tmp18_) {
		_tmp16_ = _ ("Add Label");
	} else {
		_tmp16_ = _ ("Update Label");
	}
	_tmp19_ = widgets_loading_button_new_with_label (_tmp16_);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp19_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp19_, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp19_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp19_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp19_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp19_, 12);
	gtk_widget_set_valign ((GtkWidget*) _tmp19_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->submit_button);
	self->priv->submit_button = _tmp19_;
	_tmp20_ = self->priv->submit_button;
	_tmp21_ = dialogs_label_get_is_creating (self);
	_tmp22_ = _tmp21_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp20_, !_tmp22_);
	_tmp23_ = self->priv->submit_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp23_, "suggested-action");
	_tmp24_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp24_);
	content_box = _tmp24_;
	_tmp25_ = content_box;
	_tmp26_ = name_group;
	gtk_box_append (_tmp25_, (GtkWidget*) _tmp26_);
	_tmp27_ = content_box;
	_tmp28_ = color_group;
	gtk_box_append (_tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = content_box;
	_tmp30_ = self->priv->submit_button;
	gtk_box_append (_tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = (AdwClamp*) adw_clamp_new ();
	adw_clamp_set_maximum_size (_tmp31_, 600);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp31_, 12);
	g_object_ref_sink (_tmp31_);
	content_clamp = _tmp31_;
	_tmp32_ = content_clamp;
	_tmp33_ = content_box;
	adw_clamp_set_child (_tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp34_);
	toolbar_view = _tmp34_;
	_tmp35_ = toolbar_view;
	_tmp36_ = headerbar;
	adw_toolbar_view_add_top_bar (_tmp35_, (GtkWidget*) _tmp36_);
	_tmp37_ = toolbar_view;
	_tmp38_ = content_clamp;
	adw_toolbar_view_set_content (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = toolbar_view;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp39_);
	_tmp40_ = services_event_bus_get_default ();
	_tmp41_ = _tmp40_;
	g_signal_emit_by_name (_tmp41_, "disconnect-typing-accel");
	_g_object_unref0 (_tmp41_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 225, __dialogs_label___lambda841__gsource_func, g_object_ref (self), g_object_unref);
	_tmp42_ = self->priv->signal_map;
	_tmp43_ = self->priv->name_entry;
	_tmp44_ = g_signal_connect_object (_tmp43_, "entry-activated", (GCallback) _dialogs_label_add_update_label_adw_entry_row_entry_activated, self, 0);
	_tmp45_ = self->priv->name_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp42_, (gpointer) ((guintptr) _tmp44_), (GObject*) _tmp45_);
	_tmp46_ = self->priv->signal_map;
	_tmp47_ = self->priv->submit_button;
	_tmp48_ = g_signal_connect_object ((GtkButton*) _tmp47_, "clicked", (GCallback) _dialogs_label_add_update_label_gtk_button_clicked, self, 0);
	_tmp49_ = self->priv->submit_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp46_, (gpointer) ((guintptr) _tmp48_), (GObject*) _tmp49_);
	_tmp50_ = self->priv->signal_map;
	_tmp51_ = self->priv->name_entry;
	_tmp52_ = g_signal_connect_object ((GtkEditable*) _tmp51_, "changed", (GCallback) __dialogs_label___lambda842__gtk_editable_changed, self, 0);
	_tmp53_ = self->priv->name_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp50_, (gpointer) ((guintptr) _tmp52_), (GObject*) _tmp53_);
	g_signal_connect_object ((AdwDialog*) self, "closed", (GCallback) __dialogs_label___lambda843__adw_dialog_closed, self, 0);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (content_clamp);
	_g_object_unref0 (content_box);
	_g_object_unref0 (color_group);
	_g_object_unref0 (name_group);
	_g_object_unref0 (headerbar);
	return obj;
}

static void
dialogs_label_class_init (DialogsLabelClass * klass,
                          gpointer klass_data)
{
	dialogs_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsLabel_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_LABEL_LABEL_PROPERTY, dialogs_label_properties[DIALOGS_LABEL_LABEL_PROPERTY] = g_param_spec_object ("label", "label", "label", OBJECTS_TYPE_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_LABEL_IS_CREATING_PROPERTY, dialogs_label_properties[DIALOGS_LABEL_IS_CREATING_PROPERTY] = g_param_spec_boolean ("is-creating", "is-creating", "is-creating", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dialogs_label_instance_init (DialogsLabel * self,
                             gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dialogs_label_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_;
}

static void
dialogs_label_finalize (GObject * obj)
{
	DialogsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_LABEL, DialogsLabel);
	g_debug ("Label.vala:57: Destroying - Dialogs.Label\n");
	_g_object_unref0 (self->priv->_label);
	_g_object_unref0 (self->priv->name_entry);
	_g_object_unref0 (self->priv->color_picker_row);
	_g_object_unref0 (self->priv->submit_button);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (dialogs_label_parent_class)->finalize (obj);
}

static GType
dialogs_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsLabel), 0, (GInstanceInitFunc) dialogs_label_instance_init, NULL };
	GType dialogs_label_type_id;
	dialogs_label_type_id = g_type_register_static (adw_dialog_get_type (), "DialogsLabel", &g_define_type_info, 0);
	DialogsLabel_private_offset = g_type_add_instance_private (dialogs_label_type_id, sizeof (DialogsLabelPrivate));
	return dialogs_label_type_id;
}

GType
dialogs_label_get_type (void)
{
	static volatile gsize dialogs_label_type_id__once = 0;
	if (g_once_init_enter (&dialogs_label_type_id__once)) {
		GType dialogs_label_type_id;
		dialogs_label_type_id = dialogs_label_get_type_once ();
		g_once_init_leave (&dialogs_label_type_id__once, dialogs_label_type_id);
	}
	return dialogs_label_type_id__once;
}

static void
_vala_dialogs_label_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	DialogsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_LABEL, DialogsLabel);
	switch (property_id) {
		case DIALOGS_LABEL_LABEL_PROPERTY:
		g_value_set_object (value, dialogs_label_get_label (self));
		break;
		case DIALOGS_LABEL_IS_CREATING_PROPERTY:
		g_value_set_boolean (value, dialogs_label_get_is_creating (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_label_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	DialogsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_LABEL, DialogsLabel);
	switch (property_id) {
		case DIALOGS_LABEL_LABEL_PROPERTY:
		dialogs_label_set_label (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

