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

/*
 * Copyright © 2024 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_SECTION (dialogs_section_get_type ())
#define DIALOGS_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_SECTION, DialogsSection))
#define DIALOGS_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_SECTION, DialogsSectionClass))
#define DIALOGS_IS_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_SECTION))
#define DIALOGS_IS_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_SECTION))
#define DIALOGS_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_SECTION, DialogsSectionClass))

typedef struct _DialogsSection DialogsSection;
typedef struct _DialogsSectionClass DialogsSectionClass;
typedef struct _DialogsSectionPrivate DialogsSectionPrivate;

#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_SECTION_0_PROPERTY,
	DIALOGS_SECTION_SECTION_PROPERTY,
	DIALOGS_SECTION_IS_CREATING_PROPERTY,
	DIALOGS_SECTION_NUM_PROPERTIES
};
static GParamSpec* dialogs_section_properties[DIALOGS_SECTION_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 _Block84Data Block84Data;
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _Block85Data Block85Data;
typedef struct _Block86Data Block86Data;

struct _DialogsSection {
	AdwDialog parent_instance;
	DialogsSectionPrivate * priv;
};

struct _DialogsSectionClass {
	AdwDialogClass parent_class;
};

struct _DialogsSectionPrivate {
	ObjectsSection* _section;
	AdwEntryRow* name_entry;
	WidgetsColorPickerRow* color_picker_row;
	WidgetsLoadingButton* submit_button;
	AdwEntryRow* description_entry;
	GeeHashMap* signal_map;
};

struct _Block84Data {
	int _ref_count_;
	DialogsSection* self;
	gchar* _name;
	gchar* _description;
	gchar* _color;
};

struct _Block85Data {
	int _ref_count_;
	Block84Data * _data84_;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _Block86Data {
	int _ref_count_;
	DialogsSection* self;
	ServicesCalDAVCalDAVClient* caldav_client;
};

static gint DialogsSection_private_offset;
static gpointer dialogs_section_parent_class = NULL;

VALA_EXTERN GType dialogs_section_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsSection, 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 DialogsSection* dialogs_section_new_new (ObjectsProject* project);
VALA_EXTERN DialogsSection* dialogs_section_construct_new (GType object_type,
                                               ObjectsProject* project);
VALA_EXTERN DialogsSection* dialogs_section_new (ObjectsSection* section);
VALA_EXTERN DialogsSection* dialogs_section_construct (GType object_type,
                                           ObjectsSection* section);
static void dialogs_section_add_update_section (DialogsSection* self);
VALA_EXTERN ObjectsSection* dialogs_section_get_section (DialogsSection* self);
VALA_EXTERN const gchar* widgets_color_picker_row_get_color (WidgetsColorPickerRow* self);
VALA_EXTERN gboolean dialogs_section_get_is_creating (DialogsSection* self);
static void dialogs_section_update_section (DialogsSection* self,
                                     const gchar* _name,
                                     const gchar* _description,
                                     const gchar* _color);
static void dialogs_section_add_section (DialogsSection* self);
static Block84Data* block84_data_ref (Block84Data* _data84_);
static void block84_data_unref (void * _userdata_);
static void ___lambda571_ (Block84Data* _data84_,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda571__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block85Data* block85_data_ref (Block85Data* _data85_);
static void block85_data_unref (void * _userdata_);
static void ___lambda572_ (Block85Data* _data85_,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda572__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void dialogs_section_send_toast (DialogsSection* self,
                                 const gchar* message);
static void ___lambda573_ (DialogsSection* self,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda573__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block86Data* block86_data_ref (Block86Data* _data86_);
static void block86_data_unref (void * _userdata_);
static void ___lambda574_ (Block86Data* _data86_,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda574__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
VALA_EXTERN void dialogs_section_clean_up (DialogsSection* self);
VALA_EXTERN void widgets_color_picker_row_clean_up (WidgetsColorPickerRow* self);
static void dialogs_section_set_section (DialogsSection* self,
                                  ObjectsSection* value);
static GObject * dialogs_section_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_section___lambda575_ (DialogsSection* self);
VALA_EXTERN void widgets_color_picker_row_set_color (WidgetsColorPickerRow* self,
                                         const gchar* value);
static gboolean __dialogs_section___lambda575__gsource_func (gpointer self);
static void _dialogs_section_add_update_section_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                        gpointer self);
static void _dialogs_section_add_update_section_adw_entry_row_apply (AdwEntryRow* _sender,
                                                              gpointer self);
static void _dialogs_section_add_update_section_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _dialogs_section___lambda576_ (DialogsSection* self);
static void __dialogs_section___lambda576__adw_dialog_closed (AdwDialog* _sender,
                                                       gpointer self);
static void dialogs_section_finalize (GObject * obj);
static GType dialogs_section_get_type_once (void);
static void _vala_dialogs_section_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_dialogs_section_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
dialogs_section_get_instance_private (DialogsSection* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsSection_private_offset);
}

DialogsSection*
dialogs_section_construct_new (GType object_type,
                               ObjectsProject* project)
{
	DialogsSection * self = NULL;
	ObjectsSection* section = NULL;
	ObjectsSection* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = objects_section_new ();
	section = _tmp0_;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp2_ = _tmp1_;
	objects_section_set_project_id (section, _tmp2_);
	objects_base_object_set_color ((ObjectsBaseObject*) section, "blue");
	objects_base_object_set_id ((ObjectsBaseObject*) section, "");
	self = (DialogsSection*) g_object_new (object_type, "section", section, "title", _ ("New Section"), NULL);
	_g_object_unref0 (section);
	return self;
}

DialogsSection*
dialogs_section_new_new (ObjectsProject* project)
{
	return dialogs_section_construct_new (DIALOGS_TYPE_SECTION, project);
}

DialogsSection*
dialogs_section_construct (GType object_type,
                           ObjectsSection* section)
{
	DialogsSection * self = NULL;
	g_return_val_if_fail (section != NULL, NULL);
	self = (DialogsSection*) g_object_new (object_type, "section", section, "title", _ ("Edit Section"), NULL);
	return self;
}

DialogsSection*
dialogs_section_new (ObjectsSection* section)
{
	return dialogs_section_construct (DIALOGS_TYPE_SECTION, section);
}

static void
dialogs_section_add_update_section (DialogsSection* self)
{
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gchar* _name = NULL;
	ObjectsSection* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _description = NULL;
	ObjectsSection* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _color = NULL;
	ObjectsSection* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	ObjectsSection* _tmp17_;
	AdwEntryRow* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	ObjectsSection* _tmp21_;
	AdwEntryRow* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	ObjectsSection* _tmp25_;
	WidgetsColorPickerRow* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gboolean _tmp29_;
	gboolean _tmp30_;
	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;
	}
	_tmp5_ = self->priv->_section;
	_tmp6_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	_name = _tmp8_;
	_tmp9_ = self->priv->_section;
	_tmp10_ = objects_section_get_description (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup (_tmp11_);
	_description = _tmp12_;
	_tmp13_ = self->priv->_section;
	_tmp14_ = objects_base_object_get_color ((ObjectsBaseObject*) _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strdup (_tmp15_);
	_color = _tmp16_;
	_tmp17_ = self->priv->_section;
	_tmp18_ = self->priv->name_entry;
	_tmp19_ = gtk_editable_get_text ((GtkEditable*) _tmp18_);
	_tmp20_ = _tmp19_;
	objects_base_object_set_name ((ObjectsBaseObject*) _tmp17_, _tmp20_);
	_tmp21_ = self->priv->_section;
	_tmp22_ = self->priv->description_entry;
	_tmp23_ = gtk_editable_get_text ((GtkEditable*) _tmp22_);
	_tmp24_ = _tmp23_;
	objects_section_set_description (_tmp21_, _tmp24_);
	_tmp25_ = self->priv->_section;
	_tmp26_ = self->priv->color_picker_row;
	_tmp27_ = widgets_color_picker_row_get_color (_tmp26_);
	_tmp28_ = _tmp27_;
	objects_base_object_set_color ((ObjectsBaseObject*) _tmp25_, _tmp28_);
	_tmp29_ = dialogs_section_get_is_creating (self);
	_tmp30_ = _tmp29_;
	if (!_tmp30_) {
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		_tmp31_ = _name;
		_tmp32_ = _description;
		_tmp33_ = _color;
		dialogs_section_update_section (self, _tmp31_, _tmp32_, _tmp33_);
	} else {
		dialogs_section_add_section (self);
	}
	_g_free0 (_color);
	_g_free0 (_description);
	_g_free0 (_name);
}

static Block84Data*
block84_data_ref (Block84Data* _data84_)
{
	g_atomic_int_inc (&_data84_->_ref_count_);
	return _data84_;
}

static void
block84_data_unref (void * _userdata_)
{
	Block84Data* _data84_;
	_data84_ = (Block84Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data84_->_ref_count_)) {
		DialogsSection* self;
		self = _data84_->self;
		_g_free0 (_data84_->_name);
		_g_free0 (_data84_->_description);
		_g_free0 (_data84_->_color);
		_g_object_unref0 (self);
		g_slice_free (Block84Data, _data84_);
	}
}

static void
___lambda571_ (Block84Data* _data84_,
               GObject* obj,
               GAsyncResult* res)
{
	DialogsSection* self;
	WidgetsLoadingButton* _tmp0_;
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp1_;
	ServicesTodoist* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	HttpResponse* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	self = _data84_->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_;
		ObjectsSection* _tmp9_;
		_tmp8_ = services_store_instance ();
		_tmp9_ = self->priv->_section;
		services_store_update_section (_tmp8_, _tmp9_);
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ObjectsSection* _tmp10_;
		ObjectsSection* _tmp11_;
		ObjectsSection* _tmp12_;
		ServicesEventBus* _tmp13_;
		ServicesEventBus* _tmp14_;
		HttpResponse* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		HttpResponse* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp10_ = self->priv->_section;
		objects_base_object_set_name ((ObjectsBaseObject*) _tmp10_, _data84_->_name);
		_tmp11_ = self->priv->_section;
		objects_section_set_description (_tmp11_, _data84_->_description);
		_tmp12_ = self->priv->_section;
		objects_base_object_set_color ((ObjectsBaseObject*) _tmp12_, _data84_->_color);
		_tmp13_ = services_event_bus_get_default ();
		_tmp14_ = _tmp13_;
		_tmp15_ = response;
		_tmp16_ = http_response_get_error_code (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = response;
		_tmp19_ = http_response_get_error (_tmp18_);
		_tmp20_ = _tmp19_;
		g_signal_emit_by_name (_tmp14_, "send-error-toast", _tmp17_, _tmp20_);
		_g_object_unref0 (_tmp14_);
		adw_dialog_close ((AdwDialog*) self);
	}
	_http_response_unref0 (response);
}

static void
____lambda571__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda571_ (self, source_object, res);
	block84_data_unref (self);
}

static Block85Data*
block85_data_ref (Block85Data* _data85_)
{
	g_atomic_int_inc (&_data85_->_ref_count_);
	return _data85_;
}

static void
block85_data_unref (void * _userdata_)
{
	Block85Data* _data85_;
	_data85_ = (Block85Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data85_->_ref_count_)) {
		DialogsSection* self;
		self = _data85_->_data84_->self;
		_g_object_unref0 (_data85_->caldav_client);
		block84_data_unref (_data85_->_data84_);
		_data85_->_data84_ = NULL;
		g_slice_free (Block85Data, _data85_);
	}
}

static void
___lambda572_ (Block85Data* _data85_,
               GObject* obj,
               GAsyncResult* res)
{
	Block84Data* _data84_;
	DialogsSection* self;
	WidgetsLoadingButton* _tmp0_;
	HttpResponse* caldav_response = NULL;
	ServicesCalDAVCalDAVClient* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	_data84_ = _data85_->_data84_;
	self = _data84_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->submit_button;
	widgets_loading_button_set_is_loading (_tmp0_, FALSE);
	_tmp1_ = _data85_->caldav_client;
	_tmp2_ = services_cal_dav_cal_dav_client_add_section_finish (_tmp1_, res);
	caldav_response = _tmp2_;
	_tmp3_ = caldav_response;
	_tmp4_ = http_response_get_status (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		ServicesStore* _tmp6_;
		ObjectsSection* _tmp7_;
		_tmp6_ = services_store_instance ();
		_tmp7_ = self->priv->_section;
		services_store_update_section (_tmp6_, _tmp7_);
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ObjectsSection* _tmp8_;
		ServicesEventBus* _tmp9_;
		ServicesEventBus* _tmp10_;
		HttpResponse* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		HttpResponse* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp8_ = self->priv->_section;
		objects_base_object_set_name ((ObjectsBaseObject*) _tmp8_, _data84_->_name);
		_tmp9_ = services_event_bus_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = caldav_response;
		_tmp12_ = http_response_get_error_code (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = caldav_response;
		_tmp15_ = http_response_get_error (_tmp14_);
		_tmp16_ = _tmp15_;
		g_signal_emit_by_name (_tmp10_, "send-error-toast", _tmp13_, _tmp16_);
		_g_object_unref0 (_tmp10_);
		adw_dialog_close ((AdwDialog*) self);
	}
	_http_response_unref0 (caldav_response);
}

static void
____lambda572__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda572_ (self, source_object, res);
	block85_data_unref (self);
}

static void
dialogs_section_update_section (DialogsSection* self,
                                const gchar* _name,
                                const gchar* _description,
                                const gchar* _color)
{
	Block84Data* _data84_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ObjectsSection* _tmp3_;
	ObjectsProject* _tmp4_;
	ObjectsProject* _tmp5_;
	SourceType _tmp6_;
	SourceType _tmp7_;
	ObjectsSection* _tmp10_;
	ObjectsProject* _tmp11_;
	ObjectsProject* _tmp12_;
	SourceType _tmp13_;
	SourceType _tmp14_;
	ObjectsSection* _tmp19_;
	ObjectsProject* _tmp20_;
	ObjectsProject* _tmp21_;
	SourceType _tmp22_;
	SourceType _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_name != NULL);
	g_return_if_fail (_description != NULL);
	g_return_if_fail (_color != NULL);
	_data84_ = g_slice_new0 (Block84Data);
	_data84_->_ref_count_ = 1;
	_data84_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_name);
	_g_free0 (_data84_->_name);
	_data84_->_name = _tmp0_;
	_tmp1_ = g_strdup (_description);
	_g_free0 (_data84_->_description);
	_data84_->_description = _tmp1_;
	_tmp2_ = g_strdup (_color);
	_g_free0 (_data84_->_color);
	_data84_->_color = _tmp2_;
	_tmp3_ = self->priv->_section;
	_tmp4_ = objects_section_get_project (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = objects_project_get_source_type (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_ == SOURCE_TYPE_LOCAL) {
		ServicesStore* _tmp8_;
		ObjectsSection* _tmp9_;
		_tmp8_ = services_store_instance ();
		_tmp9_ = self->priv->_section;
		services_store_update_section (_tmp8_, _tmp9_);
		adw_dialog_close ((AdwDialog*) self);
		block84_data_unref (_data84_);
		_data84_ = NULL;
		return;
	}
	_tmp10_ = self->priv->_section;
	_tmp11_ = objects_section_get_project (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = objects_project_get_source_type (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ == SOURCE_TYPE_TODOIST) {
		WidgetsLoadingButton* _tmp15_;
		ServicesTodoist* _tmp16_;
		ServicesTodoist* _tmp17_;
		ObjectsSection* _tmp18_;
		_tmp15_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp15_, TRUE);
		_tmp16_ = services_todoist_get_default ();
		_tmp17_ = _tmp16_;
		_tmp18_ = self->priv->_section;
		services_todoist_update (_tmp17_, (ObjectsBaseObject*) _tmp18_, ____lambda571__gasync_ready_callback, block84_data_ref (_data84_));
		_g_object_unref0 (_tmp17_);
	}
	_tmp19_ = self->priv->_section;
	_tmp20_ = objects_section_get_project (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = objects_project_get_source_type (_tmp21_);
	_tmp23_ = _tmp22_;
	if (_tmp23_ == SOURCE_TYPE_CALDAV) {
		Block85Data* _data85_;
		WidgetsLoadingButton* _tmp24_;
		ServicesCalDAVCore* _tmp25_;
		ServicesCalDAVCore* _tmp26_;
		ObjectsSection* _tmp27_;
		ObjectsProject* _tmp28_;
		ObjectsProject* _tmp29_;
		ObjectsSource* _tmp30_;
		ObjectsSource* _tmp31_;
		ServicesCalDAVCalDAVClient* _tmp32_;
		ServicesCalDAVCalDAVClient* _tmp33_;
		ServicesCalDAVCalDAVClient* _tmp34_;
		ObjectsSection* _tmp35_;
		_data85_ = g_slice_new0 (Block85Data);
		_data85_->_ref_count_ = 1;
		_data85_->_data84_ = block84_data_ref (_data84_);
		_tmp24_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp24_, TRUE);
		_tmp25_ = services_cal_dav_core_get_default ();
		_tmp26_ = _tmp25_;
		_tmp27_ = self->priv->_section;
		_tmp28_ = objects_section_get_project (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp30_ = objects_project_get_source (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = services_cal_dav_core_get_client (_tmp26_, _tmp31_);
		_tmp33_ = _tmp32_;
		_g_object_unref0 (_tmp26_);
		_data85_->caldav_client = _tmp33_;
		_tmp34_ = _data85_->caldav_client;
		_tmp35_ = self->priv->_section;
		services_cal_dav_cal_dav_client_add_section (_tmp34_, _tmp35_, TRUE, ____lambda572__gasync_ready_callback, block85_data_ref (_data85_));
		block85_data_unref (_data85_);
		_data85_ = NULL;
	}
	block84_data_unref (_data84_);
	_data84_ = NULL;
}

static void
___lambda573_ (DialogsSection* 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_) {
		ObjectsSection* _tmp8_;
		HttpResponse* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		ObjectsSection* _tmp12_;
		ObjectsProject* _tmp13_;
		ObjectsProject* _tmp14_;
		ObjectsSection* _tmp15_;
		ObjectsSection* _tmp16_;
		ObjectsSection* _tmp17_;
		_tmp8_ = self->priv->_section;
		_tmp9_ = response;
		_tmp10_ = http_response_get_data (_tmp9_);
		_tmp11_ = _tmp10_;
		objects_base_object_set_id ((ObjectsBaseObject*) _tmp8_, _tmp11_);
		_tmp12_ = self->priv->_section;
		_tmp13_ = objects_section_get_project (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = self->priv->_section;
		_tmp16_ = objects_project_add_section_if_not_exists (_tmp14_, _tmp15_);
		_tmp17_ = _tmp16_;
		_g_object_unref0 (_tmp17_);
		dialogs_section_send_toast (self, _ ("Section added"));
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ServicesEventBus* _tmp18_;
		ServicesEventBus* _tmp19_;
		HttpResponse* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		HttpResponse* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		_tmp18_ = services_event_bus_get_default ();
		_tmp19_ = _tmp18_;
		_tmp20_ = response;
		_tmp21_ = http_response_get_error_code (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = response;
		_tmp24_ = http_response_get_error (_tmp23_);
		_tmp25_ = _tmp24_;
		g_signal_emit_by_name (_tmp19_, "send-error-toast", _tmp22_, _tmp25_);
		_g_object_unref0 (_tmp19_);
		adw_dialog_close ((AdwDialog*) self);
	}
	_http_response_unref0 (response);
}

static void
____lambda573__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda573_ ((DialogsSection*) self, source_object, res);
	g_object_unref (self);
}

static Block86Data*
block86_data_ref (Block86Data* _data86_)
{
	g_atomic_int_inc (&_data86_->_ref_count_);
	return _data86_;
}

static void
block86_data_unref (void * _userdata_)
{
	Block86Data* _data86_;
	_data86_ = (Block86Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data86_->_ref_count_)) {
		DialogsSection* self;
		self = _data86_->self;
		_g_object_unref0 (_data86_->caldav_client);
		_g_object_unref0 (self);
		g_slice_free (Block86Data, _data86_);
	}
}

static void
___lambda574_ (Block86Data* _data86_,
               GObject* obj,
               GAsyncResult* res)
{
	DialogsSection* self;
	WidgetsLoadingButton* _tmp0_;
	HttpResponse* response = NULL;
	ServicesCalDAVCalDAVClient* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	self = _data86_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->submit_button;
	widgets_loading_button_set_is_loading (_tmp0_, FALSE);
	_tmp1_ = _data86_->caldav_client;
	_tmp2_ = services_cal_dav_cal_dav_client_add_section_finish (_tmp1_, res);
	response = _tmp2_;
	_tmp3_ = response;
	_tmp4_ = http_response_get_status (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		ObjectsSection* _tmp6_;
		ObjectsProject* _tmp7_;
		ObjectsProject* _tmp8_;
		ObjectsSection* _tmp9_;
		ObjectsSection* _tmp10_;
		ObjectsSection* _tmp11_;
		_tmp6_ = self->priv->_section;
		_tmp7_ = objects_section_get_project (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = self->priv->_section;
		_tmp10_ = objects_project_add_section_if_not_exists (_tmp8_, _tmp9_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp11_);
		dialogs_section_send_toast (self, _ ("Section added"));
		adw_dialog_close ((AdwDialog*) self);
	} else {
		ServicesEventBus* _tmp12_;
		ServicesEventBus* _tmp13_;
		HttpResponse* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		HttpResponse* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_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
____lambda574__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda574_ (self, source_object, res);
	block86_data_unref (self);
}

static void
dialogs_section_add_section (DialogsSection* self)
{
	ObjectsSection* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	SourceType _tmp3_;
	SourceType _tmp4_;
	ObjectsSection* _tmp17_;
	ObjectsProject* _tmp18_;
	ObjectsProject* _tmp19_;
	SourceType _tmp20_;
	SourceType _tmp21_;
	ObjectsSection* _tmp26_;
	ObjectsProject* _tmp27_;
	ObjectsProject* _tmp28_;
	SourceType _tmp29_;
	SourceType _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_section;
	_tmp1_ = objects_section_get_project (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = objects_project_get_source_type (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == SOURCE_TYPE_LOCAL) {
		ObjectsSection* _tmp5_;
		Util* _tmp6_;
		Util* _tmp7_;
		ObjectsSection* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		ObjectsSection* _tmp11_;
		ObjectsProject* _tmp12_;
		ObjectsProject* _tmp13_;
		ObjectsSection* _tmp14_;
		ObjectsSection* _tmp15_;
		ObjectsSection* _tmp16_;
		_tmp5_ = self->priv->_section;
		_tmp6_ = util_get_default ();
		_tmp7_ = _tmp6_;
		_tmp8_ = self->priv->_section;
		_tmp9_ = util_generate_id (_tmp7_, (ObjectsBaseObject*) _tmp8_);
		_tmp10_ = _tmp9_;
		objects_base_object_set_id ((ObjectsBaseObject*) _tmp5_, _tmp10_);
		_g_free0 (_tmp10_);
		_g_object_unref0 (_tmp7_);
		_tmp11_ = self->priv->_section;
		_tmp12_ = objects_section_get_project (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = self->priv->_section;
		_tmp15_ = objects_project_add_section_if_not_exists (_tmp13_, _tmp14_);
		_tmp16_ = _tmp15_;
		_g_object_unref0 (_tmp16_);
		dialogs_section_send_toast (self, _ ("Section added"));
		adw_dialog_close ((AdwDialog*) self);
		return;
	}
	_tmp17_ = self->priv->_section;
	_tmp18_ = objects_section_get_project (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = objects_project_get_source_type (_tmp19_);
	_tmp21_ = _tmp20_;
	if (_tmp21_ == SOURCE_TYPE_TODOIST) {
		WidgetsLoadingButton* _tmp22_;
		ServicesTodoist* _tmp23_;
		ServicesTodoist* _tmp24_;
		ObjectsSection* _tmp25_;
		_tmp22_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp22_, TRUE);
		_tmp23_ = services_todoist_get_default ();
		_tmp24_ = _tmp23_;
		_tmp25_ = self->priv->_section;
		services_todoist_add (_tmp24_, (ObjectsBaseObject*) _tmp25_, ____lambda573__gasync_ready_callback, g_object_ref (self));
		_g_object_unref0 (_tmp24_);
	}
	_tmp26_ = self->priv->_section;
	_tmp27_ = objects_section_get_project (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = objects_project_get_source_type (_tmp28_);
	_tmp30_ = _tmp29_;
	if (_tmp30_ == SOURCE_TYPE_CALDAV) {
		Block86Data* _data86_;
		WidgetsLoadingButton* _tmp31_;
		ObjectsSection* _tmp32_;
		Util* _tmp33_;
		Util* _tmp34_;
		ObjectsSection* _tmp35_;
		gchar* _tmp36_;
		gchar* _tmp37_;
		ServicesCalDAVCore* _tmp38_;
		ServicesCalDAVCore* _tmp39_;
		ObjectsSection* _tmp40_;
		ObjectsProject* _tmp41_;
		ObjectsProject* _tmp42_;
		ObjectsSource* _tmp43_;
		ObjectsSource* _tmp44_;
		ServicesCalDAVCalDAVClient* _tmp45_;
		ServicesCalDAVCalDAVClient* _tmp46_;
		ServicesCalDAVCalDAVClient* _tmp47_;
		ObjectsSection* _tmp48_;
		_data86_ = g_slice_new0 (Block86Data);
		_data86_->_ref_count_ = 1;
		_data86_->self = g_object_ref (self);
		_tmp31_ = self->priv->submit_button;
		widgets_loading_button_set_is_loading (_tmp31_, TRUE);
		_tmp32_ = self->priv->_section;
		_tmp33_ = util_get_default ();
		_tmp34_ = _tmp33_;
		_tmp35_ = self->priv->_section;
		_tmp36_ = util_generate_id (_tmp34_, (ObjectsBaseObject*) _tmp35_);
		_tmp37_ = _tmp36_;
		objects_base_object_set_id ((ObjectsBaseObject*) _tmp32_, _tmp37_);
		_g_free0 (_tmp37_);
		_g_object_unref0 (_tmp34_);
		_tmp38_ = services_cal_dav_core_get_default ();
		_tmp39_ = _tmp38_;
		_tmp40_ = self->priv->_section;
		_tmp41_ = objects_section_get_project (_tmp40_);
		_tmp42_ = _tmp41_;
		_tmp43_ = objects_project_get_source (_tmp42_);
		_tmp44_ = _tmp43_;
		_tmp45_ = services_cal_dav_core_get_client (_tmp39_, _tmp44_);
		_tmp46_ = _tmp45_;
		_g_object_unref0 (_tmp39_);
		_data86_->caldav_client = _tmp46_;
		_tmp47_ = _data86_->caldav_client;
		_tmp48_ = self->priv->_section;
		services_cal_dav_cal_dav_client_add_section (_tmp47_, _tmp48_, FALSE, ____lambda574__gasync_ready_callback, block86_data_ref (_data86_));
		block86_data_unref (_data86_);
		_data86_ = NULL;
	}
}

static void
dialogs_section_send_toast (DialogsSection* self,
                            const gchar* message)
{
	AdwToast* toast = NULL;
	AdwToast* _tmp0_;
	ServicesEventBus* _tmp1_;
	ServicesEventBus* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = adw_toast_new (message);
	toast = _tmp0_;
	_tmp1_ = services_event_bus_get_default ();
	_tmp2_ = _tmp1_;
	g_signal_emit_by_name (_tmp2_, "send-toast", toast);
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (toast);
}

void
dialogs_section_clean_up (DialogsSection* 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_);
	}
}

ObjectsSection*
dialogs_section_get_section (DialogsSection* self)
{
	ObjectsSection* result;
	ObjectsSection* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_section;
	result = _tmp0_;
	return result;
}

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

static void
dialogs_section_set_section (DialogsSection* self,
                             ObjectsSection* value)
{
	ObjectsSection* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_section_get_section (self);
	if (old_value != value) {
		ObjectsSection* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_section);
		self->priv->_section = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_section_properties[DIALOGS_SECTION_SECTION_PROPERTY]);
	}
}

gboolean
dialogs_section_get_is_creating (DialogsSection* self)
{
	gboolean result;
	ObjectsSection* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_section;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = g_strcmp0 (_tmp2_, "") == 0;
	return result;
}

static gboolean
_dialogs_section___lambda575_ (DialogsSection* self)
{
	WidgetsColorPickerRow* _tmp0_;
	ObjectsSection* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	_tmp0_ = self->priv->color_picker_row;
	_tmp1_ = self->priv->_section;
	_tmp2_ = objects_base_object_get_color ((ObjectsBaseObject*) _tmp1_);
	_tmp3_ = _tmp2_;
	widgets_color_picker_row_set_color (_tmp0_, _tmp3_);
	_tmp4_ = dialogs_section_get_is_creating (self);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		AdwEntryRow* _tmp6_;
		_tmp6_ = self->priv->name_entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp6_);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__dialogs_section___lambda575__gsource_func (gpointer self)
{
	gboolean result;
	result = _dialogs_section___lambda575_ ((DialogsSection*) self);
	return result;
}

static void
_dialogs_section_add_update_section_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                   gpointer self)
{
	dialogs_section_add_update_section ((DialogsSection*) self);
}

static void
_dialogs_section_add_update_section_adw_entry_row_apply (AdwEntryRow* _sender,
                                                         gpointer self)
{
	dialogs_section_add_update_section ((DialogsSection*) self);
}

static void
_dialogs_section_add_update_section_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	dialogs_section_add_update_section ((DialogsSection*) self);
}

static void
_dialogs_section___lambda576_ (DialogsSection* self)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	dialogs_section_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_section___lambda576__adw_dialog_closed (AdwDialog* _sender,
                                                  gpointer self)
{
	_dialogs_section___lambda576_ ((DialogsSection*) self);
}

static GObject *
dialogs_section_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsSection * self;
	AdwHeaderBar* headerbar = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	AdwHeaderBar* _tmp2_ = NULL;
	AdwEntryRow* _tmp3_;
	AdwEntryRow* _tmp4_;
	AdwEntryRow* _tmp5_;
	ObjectsSection* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	AdwPreferencesGroup* name_group = NULL;
	AdwPreferencesGroup* _tmp9_ = NULL;
	AdwPreferencesGroup* _tmp10_;
	AdwEntryRow* _tmp11_;
	WidgetsColorPickerRow* _tmp12_;
	AdwBin* color_group = NULL;
	gchar* _tmp13_;
	gchar** _tmp14_;
	WidgetsColorPickerRow* _tmp15_;
	GtkWidget* _tmp16_;
	AdwBin* _tmp17_ = NULL;
	AdwEntryRow* _tmp18_;
	AdwEntryRow* _tmp19_;
	AdwEntryRow* _tmp20_;
	ObjectsSection* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	AdwPreferencesGroup* description_group = NULL;
	AdwPreferencesGroup* _tmp24_ = NULL;
	AdwPreferencesGroup* _tmp25_;
	AdwEntryRow* _tmp26_;
	const gchar* _tmp27_ = NULL;
	gboolean _tmp28_;
	gboolean _tmp29_;
	WidgetsLoadingButton* _tmp30_ = NULL;
	WidgetsLoadingButton* _tmp31_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp32_;
	GtkBox* _tmp33_;
	AdwPreferencesGroup* _tmp34_;
	GtkBox* _tmp35_;
	AdwBin* _tmp36_;
	GtkBox* _tmp37_;
	AdwPreferencesGroup* _tmp38_;
	GtkBox* _tmp39_;
	WidgetsLoadingButton* _tmp40_;
	AdwClamp* content_clamp = NULL;
	AdwClamp* _tmp41_ = NULL;
	AdwClamp* _tmp42_;
	GtkBox* _tmp43_;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp44_;
	AdwToolbarView* _tmp45_;
	AdwHeaderBar* _tmp46_;
	AdwToolbarView* _tmp47_;
	AdwClamp* _tmp48_;
	AdwToolbarView* _tmp49_;
	ServicesEventBus* _tmp50_;
	ServicesEventBus* _tmp51_;
	GeeHashMap* _tmp52_;
	AdwEntryRow* _tmp53_;
	gulong _tmp54_;
	AdwEntryRow* _tmp55_;
	GeeHashMap* _tmp56_;
	AdwEntryRow* _tmp57_;
	gulong _tmp58_;
	AdwEntryRow* _tmp59_;
	GeeHashMap* _tmp60_;
	WidgetsLoadingButton* _tmp61_;
	gulong _tmp62_;
	WidgetsLoadingButton* _tmp63_;
	parent_class = G_OBJECT_CLASS (dialogs_section_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_SECTION, DialogsSection);
	_tmp0_ = g_strdup ("flat");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (AdwHeaderBar*) adw_header_bar_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp2_);
	headerbar = _tmp2_;
	_tmp3_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->name_entry);
	self->priv->name_entry = _tmp3_;
	_tmp4_ = self->priv->name_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp4_, _ ("Section Name"));
	_tmp5_ = self->priv->name_entry;
	_tmp6_ = self->priv->_section;
	_tmp7_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp6_);
	_tmp8_ = _tmp7_;
	gtk_editable_set_text ((GtkEditable*) _tmp5_, _tmp8_);
	_tmp9_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	gtk_widget_set_margin_end ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp9_, 24);
	g_object_ref_sink (_tmp9_);
	name_group = _tmp9_;
	_tmp10_ = name_group;
	_tmp11_ = self->priv->name_entry;
	adw_preferences_group_add (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = widgets_color_picker_row_new ();
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->color_picker_row);
	self->priv->color_picker_row = _tmp12_;
	_tmp13_ = g_strdup ("card");
	_tmp14_ = g_new0 (gchar*, 1 + 1);
	_tmp14_[0] = _tmp13_;
	_tmp15_ = self->priv->color_picker_row;
	_tmp16_ = _g_object_ref0 ((GtkWidget*) _tmp15_);
	_tmp17_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_margin_end ((GtkWidget*) _tmp17_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp17_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp17_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp17_, 1);
	gtk_widget_set_valign ((GtkWidget*) _tmp17_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp17_, _tmp14_);
	_tmp14_ = (_vala_array_free (_tmp14_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp17_, _tmp16_);
	_g_object_unref0 (_tmp16_);
	g_object_ref_sink (_tmp17_);
	color_group = _tmp17_;
	_tmp18_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->description_entry);
	self->priv->description_entry = _tmp18_;
	_tmp19_ = self->priv->description_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp19_, _ ("Description"));
	_tmp20_ = self->priv->description_entry;
	_tmp21_ = self->priv->_section;
	_tmp22_ = objects_section_get_description (_tmp21_);
	_tmp23_ = _tmp22_;
	gtk_editable_set_text ((GtkEditable*) _tmp20_, _tmp23_);
	_tmp24_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	gtk_widget_set_margin_end ((GtkWidget*) _tmp24_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp24_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp24_, 24);
	g_object_ref_sink (_tmp24_);
	description_group = _tmp24_;
	_tmp25_ = description_group;
	_tmp26_ = self->priv->description_entry;
	adw_preferences_group_add (_tmp25_, (GtkWidget*) _tmp26_);
	_tmp28_ = dialogs_section_get_is_creating (self);
	_tmp29_ = _tmp28_;
	if (_tmp29_) {
		_tmp27_ = _ ("Add Section");
	} else {
		_tmp27_ = _ ("Update Section");
	}
	_tmp30_ = widgets_loading_button_new_with_label (_tmp27_);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp30_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp30_, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp30_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp30_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp30_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp30_, 24);
	gtk_widget_set_valign ((GtkWidget*) _tmp30_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->submit_button);
	self->priv->submit_button = _tmp30_;
	_tmp31_ = self->priv->submit_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "suggested-action");
	_tmp32_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp32_);
	content_box = _tmp32_;
	_tmp33_ = content_box;
	_tmp34_ = name_group;
	gtk_box_append (_tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = content_box;
	_tmp36_ = color_group;
	gtk_box_append (_tmp35_, (GtkWidget*) _tmp36_);
	_tmp37_ = content_box;
	_tmp38_ = description_group;
	gtk_box_append (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = content_box;
	_tmp40_ = self->priv->submit_button;
	gtk_box_append (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = (AdwClamp*) adw_clamp_new ();
	adw_clamp_set_maximum_size (_tmp41_, 600);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp41_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp41_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp41_, 12);
	g_object_ref_sink (_tmp41_);
	content_clamp = _tmp41_;
	_tmp42_ = content_clamp;
	_tmp43_ = content_box;
	adw_clamp_set_child (_tmp42_, (GtkWidget*) _tmp43_);
	_tmp44_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp44_);
	toolbar_view = _tmp44_;
	_tmp45_ = toolbar_view;
	_tmp46_ = headerbar;
	adw_toolbar_view_add_top_bar (_tmp45_, (GtkWidget*) _tmp46_);
	_tmp47_ = toolbar_view;
	_tmp48_ = content_clamp;
	adw_toolbar_view_set_content (_tmp47_, (GtkWidget*) _tmp48_);
	_tmp49_ = toolbar_view;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp49_);
	_tmp50_ = services_event_bus_get_default ();
	_tmp51_ = _tmp50_;
	g_signal_emit_by_name (_tmp51_, "disconnect-typing-accel");
	_g_object_unref0 (_tmp51_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 225, __dialogs_section___lambda575__gsource_func, g_object_ref (self), g_object_unref);
	_tmp52_ = self->priv->signal_map;
	_tmp53_ = self->priv->name_entry;
	_tmp54_ = g_signal_connect_object (_tmp53_, "entry-activated", (GCallback) _dialogs_section_add_update_section_adw_entry_row_entry_activated, self, 0);
	_tmp55_ = self->priv->name_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp52_, (gpointer) ((guintptr) _tmp54_), (GObject*) _tmp55_);
	_tmp56_ = self->priv->signal_map;
	_tmp57_ = self->priv->name_entry;
	_tmp58_ = g_signal_connect_object (_tmp57_, "apply", (GCallback) _dialogs_section_add_update_section_adw_entry_row_apply, self, 0);
	_tmp59_ = self->priv->name_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp56_, (gpointer) ((guintptr) _tmp58_), (GObject*) _tmp59_);
	_tmp60_ = self->priv->signal_map;
	_tmp61_ = self->priv->submit_button;
	_tmp62_ = g_signal_connect_object ((GtkButton*) _tmp61_, "clicked", (GCallback) _dialogs_section_add_update_section_gtk_button_clicked, self, 0);
	_tmp63_ = self->priv->submit_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp60_, (gpointer) ((guintptr) _tmp62_), (GObject*) _tmp63_);
	g_signal_connect_object ((AdwDialog*) self, "closed", (GCallback) __dialogs_section___lambda576__adw_dialog_closed, self, 0);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (content_clamp);
	_g_object_unref0 (content_box);
	_g_object_unref0 (description_group);
	_g_object_unref0 (color_group);
	_g_object_unref0 (name_group);
	_g_object_unref0 (headerbar);
	return obj;
}

static void
dialogs_section_class_init (DialogsSectionClass * klass,
                            gpointer klass_data)
{
	dialogs_section_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsSection_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_section_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_section_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_section_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_section_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_SECTION_SECTION_PROPERTY, dialogs_section_properties[DIALOGS_SECTION_SECTION_PROPERTY] = g_param_spec_object ("section", "section", "section", OBJECTS_TYPE_SECTION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_SECTION_IS_CREATING_PROPERTY, dialogs_section_properties[DIALOGS_SECTION_IS_CREATING_PROPERTY] = g_param_spec_boolean ("is-creating", "is-creating", "is-creating", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dialogs_section_instance_init (DialogsSection * self,
                               gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dialogs_section_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_section_finalize (GObject * obj)
{
	DialogsSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_SECTION, DialogsSection);
	g_debug ("Section.vala:58: Destroying - Dialogs.Section\n");
	_g_object_unref0 (self->priv->_section);
	_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->description_entry);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (dialogs_section_parent_class)->finalize (obj);
}

static GType
dialogs_section_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsSectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_section_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsSection), 0, (GInstanceInitFunc) dialogs_section_instance_init, NULL };
	GType dialogs_section_type_id;
	dialogs_section_type_id = g_type_register_static (adw_dialog_get_type (), "DialogsSection", &g_define_type_info, 0);
	DialogsSection_private_offset = g_type_add_instance_private (dialogs_section_type_id, sizeof (DialogsSectionPrivate));
	return dialogs_section_type_id;
}

GType
dialogs_section_get_type (void)
{
	static volatile gsize dialogs_section_type_id__once = 0;
	if (g_once_init_enter (&dialogs_section_type_id__once)) {
		GType dialogs_section_type_id;
		dialogs_section_type_id = dialogs_section_get_type_once ();
		g_once_init_leave (&dialogs_section_type_id__once, dialogs_section_type_id);
	}
	return dialogs_section_type_id__once;
}

static void
_vala_dialogs_section_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	DialogsSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_SECTION, DialogsSection);
	switch (property_id) {
		case DIALOGS_SECTION_SECTION_PROPERTY:
		g_value_set_object (value, dialogs_section_get_section (self));
		break;
		case DIALOGS_SECTION_IS_CREATING_PROPERTY:
		g_value_set_boolean (value, dialogs_section_get_is_creating (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_section_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	DialogsSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_SECTION, DialogsSection);
	switch (property_id) {
		case DIALOGS_SECTION_SECTION_PROPERTY:
		dialogs_section_set_section (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

