/* ManageSectionOrder.c generated by valac 0.56.19, the Vala compiler
 * generated from ManageSectionOrder.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 <gtk/gtk.h>
#include <gee.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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_MANAGE_SECTION_ORDER (dialogs_manage_section_order_get_type ())
#define DIALOGS_MANAGE_SECTION_ORDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrder))
#define DIALOGS_MANAGE_SECTION_ORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrderClass))
#define DIALOGS_IS_MANAGE_SECTION_ORDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_MANAGE_SECTION_ORDER))
#define DIALOGS_IS_MANAGE_SECTION_ORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_MANAGE_SECTION_ORDER))
#define DIALOGS_MANAGE_SECTION_ORDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrderClass))

typedef struct _DialogsManageSectionOrder DialogsManageSectionOrder;
typedef struct _DialogsManageSectionOrderClass DialogsManageSectionOrderClass;
typedef struct _DialogsManageSectionOrderPrivate DialogsManageSectionOrderPrivate;

#define WIDGETS_TYPE_SCROLLED_WINDOW (widgets_scrolled_window_get_type ())
#define WIDGETS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow))
#define WIDGETS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindowClass))
#define WIDGETS_IS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SCROLLED_WINDOW))
#define WIDGETS_IS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SCROLLED_WINDOW))
#define WIDGETS_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindowClass))

typedef struct _WidgetsScrolledWindow WidgetsScrolledWindow;
typedef struct _WidgetsScrolledWindowClass WidgetsScrolledWindowClass;
enum  {
	DIALOGS_MANAGE_SECTION_ORDER_0_PROPERTY,
	DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY,
	DIALOGS_MANAGE_SECTION_ORDER_NUM_PROPERTIES
};
static GParamSpec* dialogs_manage_section_order_properties[DIALOGS_MANAGE_SECTION_ORDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WIDGETS_TYPE_SECTION_ITEM_ROW (widgets_section_item_row_get_type ())
#define WIDGETS_SECTION_ITEM_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow))
#define WIDGETS_SECTION_ITEM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRowClass))
#define WIDGETS_IS_SECTION_ITEM_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SECTION_ITEM_ROW))
#define WIDGETS_IS_SECTION_ITEM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SECTION_ITEM_ROW))
#define WIDGETS_SECTION_ITEM_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRowClass))

typedef struct _WidgetsSectionItemRow WidgetsSectionItemRow;
typedef struct _WidgetsSectionItemRowClass WidgetsSectionItemRowClass;
typedef struct _Block89Data Block89Data;

struct _DialogsManageSectionOrder {
	AdwDialog parent_instance;
	DialogsManageSectionOrderPrivate * priv;
};

struct _DialogsManageSectionOrderClass {
	AdwDialogClass parent_class;
};

struct _DialogsManageSectionOrderPrivate {
	ObjectsProject* _project;
	GtkListBox* listbox;
	GtkListBox* archived_listbox;
	WidgetsScrolledWindow* scrolled_window;
	GeeHashMap* signal_map;
};

struct _Block89Data {
	int _ref_count_;
	DialogsManageSectionOrder* self;
	GtkRevealer* archived_revealer;
};

static gint DialogsManageSectionOrder_private_offset;
static gpointer dialogs_manage_section_order_parent_class = NULL;

VALA_EXTERN GType dialogs_manage_section_order_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsManageSectionOrder, g_object_unref)
VALA_EXTERN GType widgets_scrolled_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsScrolledWindow, g_object_unref)
VALA_EXTERN DialogsManageSectionOrder* dialogs_manage_section_order_new (ObjectsProject* project);
VALA_EXTERN DialogsManageSectionOrder* dialogs_manage_section_order_construct (GType object_type,
                                                                   ObjectsProject* project);
static void dialogs_manage_section_order_set_sort_func (DialogsManageSectionOrder* self);
static gint __lambda581_ (DialogsManageSectionOrder* self,
                   GtkListBoxRow* row1,
                   GtkListBoxRow* row2);
VALA_EXTERN GType widgets_section_item_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsSectionItemRow, g_object_unref)
VALA_EXTERN ObjectsSection* widgets_section_item_row_get_section (WidgetsSectionItemRow* self);
static gint ___lambda581__gtk_list_box_sort_func (GtkListBoxRow* row1,
                                           GtkListBoxRow* row2,
                                           gpointer self);
static void dialogs_manage_section_order_update_section_section_order (DialogsManageSectionOrder* self);
VALA_EXTERN void dialogs_manage_section_order_add_sections (DialogsManageSectionOrder* self);
VALA_EXTERN ObjectsProject* dialogs_manage_section_order_get_project (DialogsManageSectionOrder* self);
VALA_EXTERN WidgetsSectionItemRow* widgets_section_item_row_new (ObjectsSection* section,
                                                     const gchar* widget_type);
VALA_EXTERN WidgetsSectionItemRow* widgets_section_item_row_construct (GType object_type,
                                                           ObjectsSection* section,
                                                           const gchar* widget_type);
VALA_EXTERN void dialogs_manage_section_order_add_section (DialogsManageSectionOrder* self,
                                               WidgetsSectionItemRow* row);
static void __lambda593_ (DialogsManageSectionOrder* self);
static void ___lambda593__widgets_section_item_row_update_section (WidgetsSectionItemRow* _sender,
                                                            gpointer self);
VALA_EXTERN void dialogs_manage_section_order_clean_up (DialogsManageSectionOrder* self);
VALA_EXTERN void widgets_section_item_row_clean_up (WidgetsSectionItemRow* self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void dialogs_manage_section_order_set_project (DialogsManageSectionOrder* self,
                                               ObjectsProject* value);
static GObject * dialogs_manage_section_order_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties);
static Block89Data* block89_data_ref (Block89Data* _data89_);
static void block89_data_unref (void * _userdata_);
VALA_EXTERN WidgetsScrolledWindow* widgets_scrolled_window_new (GtkWidget* widget,
                                                    GtkOrientation orientation);
VALA_EXTERN WidgetsScrolledWindow* widgets_scrolled_window_construct (GType object_type,
                                                          GtkWidget* widget,
                                                          GtkOrientation orientation);
static gboolean _dialogs_manage_section_order___lambda594_ (DialogsManageSectionOrder* self);
static gboolean __dialogs_manage_section_order___lambda594__gsource_func (gpointer self);
static void _dialogs_manage_section_order___lambda595_ (Block89Data* _data89_,
                                                 ObjectsSection* section);
static void __dialogs_manage_section_order___lambda595__services_store_section_deleted (ServicesStore* _sender,
                                                                                 ObjectsSection* section,
                                                                                 gpointer self);
static void _dialogs_manage_section_order___lambda596_ (Block89Data* _data89_,
                                                 ObjectsSection* section);
static void __dialogs_manage_section_order___lambda596__services_store_section_unarchived (ServicesStore* _sender,
                                                                                    ObjectsSection* section,
                                                                                    gpointer self);
static void _dialogs_manage_section_order___lambda597_ (DialogsManageSectionOrder* self);
static void __dialogs_manage_section_order___lambda597__adw_dialog_closed (AdwDialog* _sender,
                                                                    gpointer self);
static void dialogs_manage_section_order_finalize (GObject * obj);
static GType dialogs_manage_section_order_get_type_once (void);
static void _vala_dialogs_manage_section_order_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_dialogs_manage_section_order_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_manage_section_order_get_instance_private (DialogsManageSectionOrder* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsManageSectionOrder_private_offset);
}

DialogsManageSectionOrder*
dialogs_manage_section_order_construct (GType object_type,
                                        ObjectsProject* project)
{
	DialogsManageSectionOrder * self = NULL;
	g_return_val_if_fail (project != NULL, NULL);
	self = (DialogsManageSectionOrder*) g_object_new (object_type, "project", project, "title", _ ("Manage Sections"), "content-width", 320, "content-height", 450, NULL);
	return self;
}

DialogsManageSectionOrder*
dialogs_manage_section_order_new (ObjectsProject* project)
{
	return dialogs_manage_section_order_construct (DIALOGS_TYPE_MANAGE_SECTION_ORDER, project);
}

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

static gint
__lambda581_ (DialogsManageSectionOrder* self,
              GtkListBoxRow* row1,
              GtkListBoxRow* row2)
{
	ObjectsSection* item1 = NULL;
	ObjectsSection* _tmp0_;
	ObjectsSection* _tmp1_;
	ObjectsSection* _tmp2_;
	ObjectsSection* item2 = NULL;
	ObjectsSection* _tmp3_;
	ObjectsSection* _tmp4_;
	ObjectsSection* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint result;
	g_return_val_if_fail (row1 != NULL, -1);
	g_return_val_if_fail (row2 != NULL, -1);
	_tmp0_ = widgets_section_item_row_get_section (G_TYPE_CHECK_INSTANCE_CAST (row1, WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow));
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	item1 = _tmp2_;
	_tmp3_ = widgets_section_item_row_get_section (G_TYPE_CHECK_INSTANCE_CAST (row2, WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow));
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	item2 = _tmp5_;
	_tmp6_ = objects_section_get_section_order (item1);
	_tmp7_ = _tmp6_;
	_tmp8_ = objects_section_get_section_order (item2);
	_tmp9_ = _tmp8_;
	result = _tmp7_ - _tmp9_;
	_g_object_unref0 (item2);
	_g_object_unref0 (item1);
	return result;
}

static gint
___lambda581__gtk_list_box_sort_func (GtkListBoxRow* row1,
                                      GtkListBoxRow* row2,
                                      gpointer self)
{
	gint result;
	result = __lambda581_ ((DialogsManageSectionOrder*) self, row1, row2);
	return result;
}

static void
dialogs_manage_section_order_set_sort_func (DialogsManageSectionOrder* self)
{
	GtkListBox* _tmp0_;
	GtkListBox* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp0_, ___lambda581__gtk_list_box_sort_func, g_object_ref (self), g_object_unref);
	_tmp1_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp1_, NULL, NULL, NULL);
}

static void
dialogs_manage_section_order_update_section_section_order (DialogsManageSectionOrder* self)
{
	WidgetsSectionItemRow* section_row = NULL;
	gint row_index = 0;
	g_return_if_fail (self != NULL);
	section_row = NULL;
	row_index = 0;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			GtkListBox* _tmp2_;
			GtkListBoxRow* _tmp3_;
			WidgetsSectionItemRow* _tmp4_;
			gint _tmp12_;
			if (!_tmp0_) {
				WidgetsSectionItemRow* _tmp1_;
				_tmp1_ = section_row;
				if (!(_tmp1_ != NULL)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp2_ = self->priv->listbox;
			_tmp3_ = gtk_list_box_get_row_at_index (_tmp2_, row_index);
			section_row = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow);
			_tmp4_ = section_row;
			if (_tmp4_ != NULL) {
				WidgetsSectionItemRow* _tmp5_;
				ObjectsSection* _tmp6_;
				ObjectsSection* _tmp7_;
				ServicesStore* _tmp8_;
				WidgetsSectionItemRow* _tmp9_;
				ObjectsSection* _tmp10_;
				ObjectsSection* _tmp11_;
				_tmp5_ = section_row;
				_tmp6_ = widgets_section_item_row_get_section (_tmp5_);
				_tmp7_ = _tmp6_;
				objects_section_set_section_order (_tmp7_, row_index);
				_tmp8_ = services_store_instance ();
				_tmp9_ = section_row;
				_tmp10_ = widgets_section_item_row_get_section (_tmp9_);
				_tmp11_ = _tmp10_;
				services_store_update_section (_tmp8_, _tmp11_);
			}
			_tmp12_ = row_index;
			row_index = _tmp12_ + 1;
		}
	}
}

void
dialogs_manage_section_order_add_sections (DialogsManageSectionOrder* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _section_list = NULL;
		ObjectsProject* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		gint _section_size = 0;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _section_index = 0;
		_tmp0_ = self->priv->_project;
		_tmp1_ = objects_project_get_sections (_tmp0_);
		_tmp2_ = _tmp1_;
		_section_list = _tmp2_;
		_tmp3_ = _section_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_section_size = _tmp5_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ObjectsSection* section = NULL;
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			ObjectsSection* _tmp10_;
			_section_index = _section_index + 1;
			_tmp6_ = _section_index;
			_tmp7_ = _section_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _section_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _section_index);
			section = (ObjectsSection*) _tmp9_;
			_tmp10_ = section;
			if (objects_section_was_archived (_tmp10_)) {
				GtkListBox* _tmp11_;
				ObjectsSection* _tmp12_;
				WidgetsSectionItemRow* _tmp13_;
				WidgetsSectionItemRow* _tmp14_;
				_tmp11_ = self->priv->archived_listbox;
				_tmp12_ = section;
				_tmp13_ = widgets_section_item_row_new (_tmp12_, "menu");
				g_object_ref_sink (_tmp13_);
				_tmp14_ = _tmp13_;
				gtk_list_box_append (_tmp11_, (GtkWidget*) _tmp14_);
				_g_object_unref0 (_tmp14_);
			} else {
				ObjectsSection* _tmp15_;
				WidgetsSectionItemRow* _tmp16_;
				WidgetsSectionItemRow* _tmp17_;
				_tmp15_ = section;
				_tmp16_ = widgets_section_item_row_new (_tmp15_, "order");
				g_object_ref_sink (_tmp16_);
				_tmp17_ = _tmp16_;
				dialogs_manage_section_order_add_section (self, _tmp17_);
				_g_object_unref0 (_tmp17_);
			}
			_g_object_unref0 (section);
		}
	}
}

static void
__lambda593_ (DialogsManageSectionOrder* self)
{
	ObjectsProject* _tmp0_;
	dialogs_manage_section_order_update_section_section_order (self);
	_tmp0_ = self->priv->_project;
	g_signal_emit_by_name (_tmp0_, "section-sort-order-changed");
}

static void
___lambda593__widgets_section_item_row_update_section (WidgetsSectionItemRow* _sender,
                                                       gpointer self)
{
	__lambda593_ ((DialogsManageSectionOrder*) self);
}

void
dialogs_manage_section_order_add_section (DialogsManageSectionOrder* self,
                                          WidgetsSectionItemRow* row)
{
	GeeHashMap* _tmp0_;
	gulong _tmp1_;
	GtkListBox* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = self->priv->signal_map;
	_tmp1_ = g_signal_connect_object (row, "update-section", (GCallback) ___lambda593__widgets_section_item_row_update_section, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, (gpointer) ((guintptr) _tmp1_), (GObject*) row);
	_tmp2_ = self->priv->listbox;
	gtk_list_box_append (_tmp2_, (GtkWidget*) row);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

void
dialogs_manage_section_order_clean_up (DialogsManageSectionOrder* self)
{
	GtkListBox* _tmp0_;
	GeeHashMap* _tmp16_;
	Util* _tmp17_;
	Util* _tmp18_;
	GtkListBox* _tmp19_;
	GList* _tmp20_;
	GList* _tmp21_;
	Util* _tmp23_;
	Util* _tmp24_;
	GtkListBox* _tmp25_;
	GList* _tmp26_;
	GList* _tmp27_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp0_, NULL, NULL, NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp1_ = self->priv->signal_map;
		_tmp2_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_entry_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			GeeMapEntry* _tmp13_;
			gconstpointer _tmp14_;
			gconstpointer _tmp15_;
			_tmp7_ = _entry_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _entry_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			entry = (GeeMapEntry*) _tmp9_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_value (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = entry;
			_tmp14_ = gee_map_entry_get_key (_tmp13_);
			_tmp15_ = _tmp14_;
			g_signal_handler_disconnect ((GObject*) _tmp12_, (gulong) ((guintptr) _tmp15_));
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp16_ = self->priv->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp16_);
	_tmp17_ = util_get_default ();
	_tmp18_ = _tmp17_;
	_tmp19_ = self->priv->listbox;
	_tmp20_ = util_get_children (_tmp18_, _tmp19_);
	_tmp21_ = _tmp20_;
	_g_object_unref0 (_tmp18_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp21_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) ((GtkListBoxRow*) child_it->data);
			{
				GtkWidget* _tmp22_;
				_tmp22_ = child;
				widgets_section_item_row_clean_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow));
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (_g_list_free__g_object_unref0_ (child_collection), NULL));
	}
	_tmp23_ = util_get_default ();
	_tmp24_ = _tmp23_;
	_tmp25_ = self->priv->archived_listbox;
	_tmp26_ = util_get_children (_tmp24_, _tmp25_);
	_tmp27_ = _tmp26_;
	_g_object_unref0 (_tmp24_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp27_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) ((GtkListBoxRow*) child_it->data);
			{
				GtkWidget* _tmp28_;
				_tmp28_ = child;
				widgets_section_item_row_clean_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, WIDGETS_TYPE_SECTION_ITEM_ROW, WidgetsSectionItemRow));
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (_g_list_free__g_object_unref0_ (child_collection), NULL));
	}
}

ObjectsProject*
dialogs_manage_section_order_get_project (DialogsManageSectionOrder* self)
{
	ObjectsProject* result;
	ObjectsProject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_project;
	result = _tmp0_;
	return result;
}

static void
dialogs_manage_section_order_set_project (DialogsManageSectionOrder* self,
                                          ObjectsProject* value)
{
	ObjectsProject* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_manage_section_order_get_project (self);
	if (old_value != value) {
		ObjectsProject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_project);
		self->priv->_project = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_manage_section_order_properties[DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY]);
	}
}

static Block89Data*
block89_data_ref (Block89Data* _data89_)
{
	g_atomic_int_inc (&_data89_->_ref_count_);
	return _data89_;
}

static void
block89_data_unref (void * _userdata_)
{
	Block89Data* _data89_;
	_data89_ = (Block89Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data89_->_ref_count_)) {
		DialogsManageSectionOrder* self;
		self = _data89_->self;
		_g_object_unref0 (_data89_->archived_revealer);
		_g_object_unref0 (self);
		g_slice_free (Block89Data, _data89_);
	}
}

static gboolean
_dialogs_manage_section_order___lambda594_ (DialogsManageSectionOrder* self)
{
	gboolean result;
	dialogs_manage_section_order_set_sort_func (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__dialogs_manage_section_order___lambda594__gsource_func (gpointer self)
{
	gboolean result;
	result = _dialogs_manage_section_order___lambda594_ ((DialogsManageSectionOrder*) self);
	return result;
}

static void
_dialogs_manage_section_order___lambda595_ (Block89Data* _data89_,
                                            ObjectsSection* section)
{
	DialogsManageSectionOrder* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsProject* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	self = _data89_->self;
	g_return_if_fail (section != NULL);
	_tmp0_ = objects_section_get_project_id (section);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_project;
	_tmp3_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp2_);
	_tmp4_ = _tmp3_;
	if (g_strcmp0 (_tmp1_, _tmp4_) == 0) {
		GtkRevealer* _tmp5_;
		ObjectsProject* _tmp6_;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp5_ = _data89_->archived_revealer;
		_tmp6_ = self->priv->_project;
		_tmp7_ = objects_project_get_sections_archived (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		gtk_revealer_set_reveal_child (_tmp5_, _tmp10_ > 0);
	}
}

static void
__dialogs_manage_section_order___lambda595__services_store_section_deleted (ServicesStore* _sender,
                                                                            ObjectsSection* section,
                                                                            gpointer self)
{
	_dialogs_manage_section_order___lambda595_ (self, section);
}

static void
_dialogs_manage_section_order___lambda596_ (Block89Data* _data89_,
                                            ObjectsSection* section)
{
	DialogsManageSectionOrder* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsProject* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	self = _data89_->self;
	g_return_if_fail (section != NULL);
	_tmp0_ = objects_section_get_project_id (section);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_project;
	_tmp3_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp2_);
	_tmp4_ = _tmp3_;
	if (g_strcmp0 (_tmp1_, _tmp4_) == 0) {
		GtkRevealer* _tmp5_;
		ObjectsProject* _tmp6_;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp5_ = _data89_->archived_revealer;
		_tmp6_ = self->priv->_project;
		_tmp7_ = objects_project_get_sections_archived (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		gtk_revealer_set_reveal_child (_tmp5_, _tmp10_ > 0);
	}
}

static void
__dialogs_manage_section_order___lambda596__services_store_section_unarchived (ServicesStore* _sender,
                                                                               ObjectsSection* section,
                                                                               gpointer self)
{
	_dialogs_manage_section_order___lambda596_ (self, section);
}

static void
_dialogs_manage_section_order___lambda597_ (DialogsManageSectionOrder* self)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	dialogs_manage_section_order_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_manage_section_order___lambda597__adw_dialog_closed (AdwDialog* _sender,
                                                               gpointer self)
{
	_dialogs_manage_section_order___lambda597_ ((DialogsManageSectionOrder*) self);
}

static GObject *
dialogs_manage_section_order_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsManageSectionOrder * self;
	Block89Data* _data89_;
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp0_;
	AdwHeaderBar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	GtkListBox* _tmp4_ = NULL;
	GtkLabel* label = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	GtkLabel* _tmp8_ = NULL;
	AdwBin* listbox_card = NULL;
	gchar* _tmp9_;
	gchar** _tmp10_;
	GtkListBox* _tmp11_;
	GtkWidget* _tmp12_;
	AdwBin* _tmp13_ = NULL;
	GtkLabel* archived_title = NULL;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar** _tmp16_;
	GtkLabel* _tmp17_ = NULL;
	gchar* _tmp18_;
	gchar** _tmp19_;
	GtkListBox* _tmp20_ = NULL;
	AdwBin* archived_listbox_card = NULL;
	gchar* _tmp21_;
	gchar** _tmp22_;
	GtkListBox* _tmp23_;
	GtkWidget* _tmp24_;
	AdwBin* _tmp25_ = NULL;
	GtkBox* archived_box = NULL;
	GtkBox* _tmp26_ = NULL;
	GtkBox* _tmp27_;
	GtkLabel* _tmp28_;
	GtkBox* _tmp29_;
	AdwBin* _tmp30_;
	GtkBox* _tmp31_;
	GtkWidget* _tmp32_;
	ObjectsProject* _tmp33_;
	GeeArrayList* _tmp34_;
	GeeArrayList* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	GtkRevealer* _tmp38_ = NULL;
	GtkBox* content_box = NULL;
	GtkBox* _tmp39_ = NULL;
	GtkBox* _tmp40_;
	AdwBin* _tmp41_;
	GtkBox* _tmp42_;
	GtkLabel* _tmp43_;
	GtkBox* _tmp44_;
	GtkRevealer* _tmp45_;
	GtkBox* _tmp46_;
	WidgetsScrolledWindow* _tmp47_;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp48_;
	AdwToolbarView* _tmp49_;
	AdwHeaderBar* _tmp50_;
	AdwToolbarView* _tmp51_;
	WidgetsScrolledWindow* _tmp52_;
	AdwToolbarView* _tmp53_;
	ServicesEventBus* _tmp54_;
	ServicesEventBus* _tmp55_;
	GeeHashMap* _tmp56_;
	ServicesStore* _tmp57_;
	gulong _tmp58_;
	ServicesStore* _tmp59_;
	GeeHashMap* _tmp60_;
	ServicesStore* _tmp61_;
	gulong _tmp62_;
	ServicesStore* _tmp63_;
	parent_class = G_OBJECT_CLASS (dialogs_manage_section_order_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrder);
	_data89_ = g_slice_new0 (Block89Data);
	_data89_->_ref_count_ = 1;
	_data89_->self = g_object_ref (self);
	_tmp0_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp0_);
	headerbar = _tmp0_;
	_tmp1_ = headerbar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "flat");
	_tmp2_ = g_strdup ("listbox-background");
	_tmp3_ = g_new0 (gchar*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp4_, _tmp3_);
	_tmp3_ = (_vala_array_free (_tmp3_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->listbox);
	self->priv->listbox = _tmp4_;
	_tmp5_ = g_strdup ("caption");
	_tmp6_ = g_strdup ("dimmed");
	_tmp7_ = g_new0 (gchar*, 2 + 1);
	_tmp7_[0] = _tmp5_;
	_tmp7_[1] = _tmp6_;
	_tmp8_ = (GtkLabel*) gtk_label_new (_ ("You can sort your sections by dragging and dropping"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp8_, _tmp7_);
	_tmp7_ = (_vala_array_free (_tmp7_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp8_, GTK_ALIGN_START);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp8_, 16);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp8_, 16);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp8_, 3);
	gtk_label_set_wrap (_tmp8_, TRUE);
	gtk_label_set_wrap_mode (_tmp8_, PANGO_WRAP_CHAR);
	gtk_label_set_natural_wrap_mode (_tmp8_, GTK_NATURAL_WRAP_NONE);
	gtk_label_set_xalign (_tmp8_, (gfloat) 0);
	g_object_ref_sink (_tmp8_);
	label = _tmp8_;
	_tmp9_ = g_strdup ("card");
	_tmp10_ = g_new0 (gchar*, 1 + 1);
	_tmp10_[0] = _tmp9_;
	_tmp11_ = self->priv->listbox;
	_tmp12_ = _g_object_ref0 ((GtkWidget*) _tmp11_);
	_tmp13_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_margin_start ((GtkWidget*) _tmp13_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp13_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp13_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp13_, 1);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp13_, _tmp10_);
	_tmp10_ = (_vala_array_free (_tmp10_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp13_, _tmp12_);
	_g_object_unref0 (_tmp12_);
	gtk_widget_set_valign ((GtkWidget*) _tmp13_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp13_);
	listbox_card = _tmp13_;
	_tmp14_ = g_strdup ("heading");
	_tmp15_ = g_strdup ("h4");
	_tmp16_ = g_new0 (gchar*, 2 + 1);
	_tmp16_[0] = _tmp14_;
	_tmp16_[1] = _tmp15_;
	_tmp17_ = (GtkLabel*) gtk_label_new (_ ("Archived"));
	gtk_widget_set_halign ((GtkWidget*) _tmp17_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp17_, _tmp16_);
	_tmp16_ = (_vala_array_free (_tmp16_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp17_, 16);
	g_object_ref_sink (_tmp17_);
	archived_title = _tmp17_;
	_tmp18_ = g_strdup ("listbox-background");
	_tmp19_ = g_new0 (gchar*, 1 + 1);
	_tmp19_[0] = _tmp18_;
	_tmp20_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp20_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp20_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp20_, _tmp19_);
	_tmp19_ = (_vala_array_free (_tmp19_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp20_);
	_g_object_unref0 (self->priv->archived_listbox);
	self->priv->archived_listbox = _tmp20_;
	_tmp21_ = g_strdup ("card");
	_tmp22_ = g_new0 (gchar*, 1 + 1);
	_tmp22_[0] = _tmp21_;
	_tmp23_ = self->priv->archived_listbox;
	_tmp24_ = _g_object_ref0 ((GtkWidget*) _tmp23_);
	_tmp25_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_margin_start ((GtkWidget*) _tmp25_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp25_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp25_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp25_, 3);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp25_, _tmp22_);
	_tmp22_ = (_vala_array_free (_tmp22_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp25_, _tmp24_);
	_g_object_unref0 (_tmp24_);
	gtk_widget_set_valign ((GtkWidget*) _tmp25_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp25_);
	archived_listbox_card = _tmp25_;
	_tmp26_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp26_, 12);
	g_object_ref_sink (_tmp26_);
	archived_box = _tmp26_;
	_tmp27_ = archived_box;
	_tmp28_ = archived_title;
	gtk_box_append (_tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = archived_box;
	_tmp30_ = archived_listbox_card;
	gtk_box_append (_tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = archived_box;
	_tmp32_ = _g_object_ref0 ((GtkWidget*) _tmp31_);
	_tmp33_ = self->priv->_project;
	_tmp34_ = objects_project_get_sections_archived (_tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp38_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_child (_tmp38_, _tmp32_);
	_g_object_unref0 (_tmp32_);
	gtk_revealer_set_reveal_child (_tmp38_, _tmp37_ > 0);
	g_object_ref_sink (_tmp38_);
	_data89_->archived_revealer = _tmp38_;
	_tmp39_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp39_, 6);
	g_object_ref_sink (_tmp39_);
	content_box = _tmp39_;
	_tmp40_ = content_box;
	_tmp41_ = listbox_card;
	gtk_box_append (_tmp40_, (GtkWidget*) _tmp41_);
	_tmp42_ = content_box;
	_tmp43_ = label;
	gtk_box_append (_tmp42_, (GtkWidget*) _tmp43_);
	_tmp44_ = content_box;
	_tmp45_ = _data89_->archived_revealer;
	gtk_box_append (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = content_box;
	_tmp47_ = widgets_scrolled_window_new ((GtkWidget*) _tmp46_, GTK_ORIENTATION_VERTICAL);
	g_object_ref_sink (_tmp47_);
	_g_object_unref0 (self->priv->scrolled_window);
	self->priv->scrolled_window = _tmp47_;
	_tmp48_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp48_);
	toolbar_view = _tmp48_;
	_tmp49_ = toolbar_view;
	_tmp50_ = headerbar;
	adw_toolbar_view_add_top_bar (_tmp49_, (GtkWidget*) _tmp50_);
	_tmp51_ = toolbar_view;
	_tmp52_ = self->priv->scrolled_window;
	adw_toolbar_view_set_content (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = toolbar_view;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp53_);
	dialogs_manage_section_order_add_sections (self);
	_tmp54_ = services_event_bus_get_default ();
	_tmp55_ = _tmp54_;
	g_signal_emit_by_name (_tmp55_, "disconnect-typing-accel");
	_g_object_unref0 (_tmp55_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 225, __dialogs_manage_section_order___lambda594__gsource_func, g_object_ref (self), g_object_unref);
	_tmp56_ = self->priv->signal_map;
	_tmp57_ = services_store_instance ();
	_tmp58_ = g_signal_connect_data (_tmp57_, "section-deleted", (GCallback) __dialogs_manage_section_order___lambda595__services_store_section_deleted, block89_data_ref (_data89_), (GClosureNotify) block89_data_unref, 0);
	_tmp59_ = services_store_instance ();
	gee_abstract_map_set ((GeeAbstractMap*) _tmp56_, (gpointer) ((guintptr) _tmp58_), (GObject*) _tmp59_);
	_tmp60_ = self->priv->signal_map;
	_tmp61_ = services_store_instance ();
	_tmp62_ = g_signal_connect_data (_tmp61_, "section-unarchived", (GCallback) __dialogs_manage_section_order___lambda596__services_store_section_unarchived, block89_data_ref (_data89_), (GClosureNotify) block89_data_unref, 0);
	_tmp63_ = services_store_instance ();
	gee_abstract_map_set ((GeeAbstractMap*) _tmp60_, (gpointer) ((guintptr) _tmp62_), (GObject*) _tmp63_);
	g_signal_connect_object ((AdwDialog*) self, "closed", (GCallback) __dialogs_manage_section_order___lambda597__adw_dialog_closed, self, 0);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (content_box);
	_g_object_unref0 (archived_box);
	_g_object_unref0 (archived_listbox_card);
	_g_object_unref0 (archived_title);
	_g_object_unref0 (listbox_card);
	_g_object_unref0 (label);
	_g_object_unref0 (headerbar);
	block89_data_unref (_data89_);
	_data89_ = NULL;
	return obj;
}

static void
dialogs_manage_section_order_class_init (DialogsManageSectionOrderClass * klass,
                                         gpointer klass_data)
{
	dialogs_manage_section_order_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsManageSectionOrder_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_manage_section_order_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_manage_section_order_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_manage_section_order_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_manage_section_order_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY, dialogs_manage_section_order_properties[DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY] = g_param_spec_object ("project", "project", "project", OBJECTS_TYPE_PROJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
dialogs_manage_section_order_instance_init (DialogsManageSectionOrder * self,
                                            gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dialogs_manage_section_order_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_manage_section_order_finalize (GObject * obj)
{
	DialogsManageSectionOrder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrder);
	g_debug ("ManageSectionOrder.vala:41: Destroying - Dialogs.ManageSectionOrder\n");
	_g_object_unref0 (self->priv->_project);
	_g_object_unref0 (self->priv->listbox);
	_g_object_unref0 (self->priv->archived_listbox);
	_g_object_unref0 (self->priv->scrolled_window);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (dialogs_manage_section_order_parent_class)->finalize (obj);
}

static GType
dialogs_manage_section_order_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsManageSectionOrderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_manage_section_order_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsManageSectionOrder), 0, (GInstanceInitFunc) dialogs_manage_section_order_instance_init, NULL };
	GType dialogs_manage_section_order_type_id;
	dialogs_manage_section_order_type_id = g_type_register_static (adw_dialog_get_type (), "DialogsManageSectionOrder", &g_define_type_info, 0);
	DialogsManageSectionOrder_private_offset = g_type_add_instance_private (dialogs_manage_section_order_type_id, sizeof (DialogsManageSectionOrderPrivate));
	return dialogs_manage_section_order_type_id;
}

GType
dialogs_manage_section_order_get_type (void)
{
	static volatile gsize dialogs_manage_section_order_type_id__once = 0;
	if (g_once_init_enter (&dialogs_manage_section_order_type_id__once)) {
		GType dialogs_manage_section_order_type_id;
		dialogs_manage_section_order_type_id = dialogs_manage_section_order_get_type_once ();
		g_once_init_leave (&dialogs_manage_section_order_type_id__once, dialogs_manage_section_order_type_id);
	}
	return dialogs_manage_section_order_type_id__once;
}

static void
_vala_dialogs_manage_section_order_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	DialogsManageSectionOrder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrder);
	switch (property_id) {
		case DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY:
		g_value_set_object (value, dialogs_manage_section_order_get_project (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_manage_section_order_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	DialogsManageSectionOrder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_MANAGE_SECTION_ORDER, DialogsManageSectionOrder);
	switch (property_id) {
		case DIALOGS_MANAGE_SECTION_ORDER_PROJECT_PROPERTY:
		dialogs_manage_section_order_set_project (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);
}

