/* SectionsOrderPopover.c generated by valac 0.56.19, the Vala compiler
 * generated from SectionsOrderPopover.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 <gtk/gtk.h>
#include <glib-object.h>
#include "planify.h"
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.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 WIDGETS_TYPE_SECTIONS_ORDER_POPOVER (widgets_sections_order_popover_get_type ())
#define WIDGETS_SECTIONS_ORDER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopover))
#define WIDGETS_SECTIONS_ORDER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopoverClass))
#define WIDGETS_IS_SECTIONS_ORDER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SECTIONS_ORDER_POPOVER))
#define WIDGETS_IS_SECTIONS_ORDER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SECTIONS_ORDER_POPOVER))
#define WIDGETS_SECTIONS_ORDER_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopoverClass))

typedef struct _WidgetsSectionsOrderPopover WidgetsSectionsOrderPopover;
typedef struct _WidgetsSectionsOrderPopoverClass WidgetsSectionsOrderPopoverClass;
typedef struct _WidgetsSectionsOrderPopoverPrivate WidgetsSectionsOrderPopoverPrivate;
enum  {
	WIDGETS_SECTIONS_ORDER_POPOVER_0_PROPERTY,
	WIDGETS_SECTIONS_ORDER_POPOVER_PROJECT_PROPERTY,
	WIDGETS_SECTIONS_ORDER_POPOVER_NUM_PROPERTIES
};
static GParamSpec* widgets_sections_order_popover_properties[WIDGETS_SECTIONS_ORDER_POPOVER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WIDGETS_TYPE_SECTIONS_ORDER_ITEM (widgets_sections_order_item_get_type ())
#define WIDGETS_SECTIONS_ORDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem))
#define WIDGETS_SECTIONS_ORDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItemClass))
#define WIDGETS_IS_SECTIONS_ORDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SECTIONS_ORDER_ITEM))
#define WIDGETS_IS_SECTIONS_ORDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SECTIONS_ORDER_ITEM))
#define WIDGETS_SECTIONS_ORDER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItemClass))

typedef struct _WidgetsSectionsOrderItem WidgetsSectionsOrderItem;
typedef struct _WidgetsSectionsOrderItemClass WidgetsSectionsOrderItemClass;
typedef struct _WidgetsSectionsOrderItemPrivate WidgetsSectionsOrderItemPrivate;
enum  {
	WIDGETS_SECTIONS_ORDER_ITEM_0_PROPERTY,
	WIDGETS_SECTIONS_ORDER_ITEM_SECTION_PROPERTY,
	WIDGETS_SECTIONS_ORDER_ITEM_NUM_PROPERTIES
};
static GParamSpec* widgets_sections_order_item_properties[WIDGETS_SECTIONS_ORDER_ITEM_NUM_PROPERTIES];

struct _WidgetsSectionsOrderPopover {
	GtkPopover parent_instance;
	WidgetsSectionsOrderPopoverPrivate * priv;
};

struct _WidgetsSectionsOrderPopoverClass {
	GtkPopoverClass parent_class;
};

struct _WidgetsSectionsOrderPopoverPrivate {
	ObjectsProject* _project;
	GtkListBox* listbox;
};

struct _WidgetsSectionsOrderItem {
	GtkListBoxRow parent_instance;
	WidgetsSectionsOrderItemPrivate * priv;
};

struct _WidgetsSectionsOrderItemClass {
	GtkListBoxRowClass parent_class;
};

struct _WidgetsSectionsOrderItemPrivate {
	ObjectsSection* _section;
	GtkGrid* handle_grid;
};

static gint WidgetsSectionsOrderPopover_private_offset;
static gpointer widgets_sections_order_popover_parent_class = NULL;
static gint WidgetsSectionsOrderItem_private_offset;
static gpointer widgets_sections_order_item_parent_class = NULL;

VALA_EXTERN GType widgets_sections_order_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsSectionsOrderPopover, g_object_unref)
VALA_EXTERN WidgetsSectionsOrderPopover* widgets_sections_order_popover_new (ObjectsProject* project);
VALA_EXTERN WidgetsSectionsOrderPopover* widgets_sections_order_popover_construct (GType object_type,
                                                                       ObjectsProject* project);
static void widgets_sections_order_popover_set_sort_func (WidgetsSectionsOrderPopover* self);
static gint __lambda991_ (WidgetsSectionsOrderPopover* self,
                   GtkListBoxRow* row1,
                   GtkListBoxRow* row2);
VALA_EXTERN GType widgets_sections_order_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsSectionsOrderItem, g_object_unref)
VALA_EXTERN ObjectsSection* widgets_sections_order_item_get_section (WidgetsSectionsOrderItem* self);
static gint ___lambda991__gtk_list_box_sort_func (GtkListBoxRow* row1,
                                           GtkListBoxRow* row2,
                                           gpointer self);
VALA_EXTERN ObjectsProject* widgets_sections_order_popover_get_project (WidgetsSectionsOrderPopover* self);
static void widgets_sections_order_popover_set_project (WidgetsSectionsOrderPopover* self,
                                                 ObjectsProject* value);
static GObject * widgets_sections_order_popover_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
VALA_EXTERN WidgetsSectionsOrderItem* widgets_sections_order_item_new (ObjectsSection* section);
VALA_EXTERN WidgetsSectionsOrderItem* widgets_sections_order_item_construct (GType object_type,
                                                                 ObjectsSection* section);
static gboolean _widgets_sections_order_popover___lambda997_ (WidgetsSectionsOrderPopover* self);
static gboolean __widgets_sections_order_popover___lambda997__gsource_func (gpointer self);
static void widgets_sections_order_popover_finalize (GObject * obj);
static GType widgets_sections_order_popover_get_type_once (void);
static void _vala_widgets_sections_order_popover_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_widgets_sections_order_popover_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);
static void widgets_sections_order_item_build_drag_and_drop (WidgetsSectionsOrderItem* self);
static GdkContentProvider* __lambda992_ (WidgetsSectionsOrderItem* self,
                                  GtkDragSource* source,
                                  gdouble x,
                                  gdouble y);
static GdkContentProvider* ___lambda992__gtk_drag_source_prepare (GtkDragSource* _sender,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
static void __lambda993_ (WidgetsSectionsOrderItem* self,
                   GtkDragSource* source,
                   GdkDrag* drag);
VALA_EXTERN void widgets_sections_order_item_drag_begin (WidgetsSectionsOrderItem* self);
static void ___lambda993__gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                               GdkDrag* drag,
                                               gpointer self);
static void __lambda994_ (WidgetsSectionsOrderItem* self,
                   GtkDragSource* source,
                   GdkDrag* drag,
                   gboolean delete_data);
VALA_EXTERN void widgets_sections_order_item_drag_end (WidgetsSectionsOrderItem* self);
static void ___lambda994__gtk_drag_source_drag_end (GtkDragSource* _sender,
                                             GdkDrag* drag,
                                             gboolean delete_data,
                                             gpointer self);
static gboolean __lambda995_ (WidgetsSectionsOrderItem* self,
                       GtkDragSource* source,
                       GdkDrag* drag,
                       GdkDragCancelReason reason);
static gboolean ___lambda995__gtk_drag_source_drag_cancel (GtkDragSource* _sender,
                                                    GdkDrag* drag,
                                                    GdkDragCancelReason reason,
                                                    gpointer self);
static gboolean __lambda996_ (WidgetsSectionsOrderItem* self,
                       GValue* value,
                       gdouble x,
                       gdouble y);
static gboolean ___lambda996__gtk_drop_target_drop (GtkDropTarget* _sender,
                                             GValue* value,
                                             gdouble x,
                                             gdouble y,
                                             gpointer self);
static void widgets_sections_order_item_set_section (WidgetsSectionsOrderItem* self,
                                              ObjectsSection* value);
static GObject * widgets_sections_order_item_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static void widgets_sections_order_item_finalize (GObject * obj);
static GType widgets_sections_order_item_get_type_once (void);
static void _vala_widgets_sections_order_item_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_widgets_sections_order_item_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
widgets_sections_order_popover_get_instance_private (WidgetsSectionsOrderPopover* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsSectionsOrderPopover_private_offset);
}

WidgetsSectionsOrderPopover*
widgets_sections_order_popover_construct (GType object_type,
                                          ObjectsProject* project)
{
	WidgetsSectionsOrderPopover * self = NULL;
	g_return_val_if_fail (project != NULL, NULL);
	self = (WidgetsSectionsOrderPopover*) g_object_new (object_type, "project", project, "has-arrow", FALSE, "position", GTK_POS_BOTTOM, "width-request", 250, NULL);
	return self;
}

WidgetsSectionsOrderPopover*
widgets_sections_order_popover_new (ObjectsProject* project)
{
	return widgets_sections_order_popover_construct (WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, project);
}

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

static gint
__lambda991_ (WidgetsSectionsOrderPopover* 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_sections_order_item_get_section (G_TYPE_CHECK_INSTANCE_CAST (row1, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem));
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	item1 = _tmp2_;
	_tmp3_ = widgets_sections_order_item_get_section (G_TYPE_CHECK_INSTANCE_CAST (row2, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem));
	_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
___lambda991__gtk_list_box_sort_func (GtkListBoxRow* row1,
                                      GtkListBoxRow* row2,
                                      gpointer self)
{
	gint result;
	result = __lambda991_ ((WidgetsSectionsOrderPopover*) self, row1, row2);
	return result;
}

static void
widgets_sections_order_popover_set_sort_func (WidgetsSectionsOrderPopover* self)
{
	GtkListBox* _tmp0_;
	GtkListBox* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp0_, ___lambda991__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);
}

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

static void
widgets_sections_order_popover_set_project (WidgetsSectionsOrderPopover* self,
                                            ObjectsProject* value)
{
	ObjectsProject* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_sections_order_popover_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, widgets_sections_order_popover_properties[WIDGETS_SECTIONS_ORDER_POPOVER_PROJECT_PROPERTY]);
	}
}

static gboolean
_widgets_sections_order_popover___lambda997_ (WidgetsSectionsOrderPopover* self)
{
	gboolean result;
	widgets_sections_order_popover_set_sort_func (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__widgets_sections_order_popover___lambda997__gsource_func (gpointer self)
{
	gboolean result;
	result = _widgets_sections_order_popover___lambda997_ ((WidgetsSectionsOrderPopover*) self);
	return result;
}

static GObject *
widgets_sections_order_popover_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsSectionsOrderPopover * self;
	GtkListBox* _tmp0_;
	WidgetsContextMenuMenuItem* add_section_item = NULL;
	WidgetsContextMenuMenuItem* _tmp1_;
	GtkBox* main_content = NULL;
	GtkBox* _tmp2_ = NULL;
	GtkBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkBox* _tmp5_;
	WidgetsContextMenuMenuSeparator* _tmp6_;
	WidgetsContextMenuMenuSeparator* _tmp7_;
	GtkBox* _tmp8_;
	WidgetsContextMenuMenuItem* _tmp9_;
	GtkBox* _tmp10_;
	parent_class = G_OBJECT_CLASS (widgets_sections_order_popover_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopover);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->listbox);
	self->priv->listbox = _tmp0_;
	_tmp1_ = widgets_context_menu_menu_item_new (_ ("Add Section"), "planner-section");
	g_object_ref_sink (_tmp1_);
	add_section_item = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	main_content = _tmp2_;
	_tmp3_ = main_content;
	_tmp4_ = self->priv->listbox;
	gtk_box_append (_tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = main_content;
	_tmp6_ = widgets_context_menu_menu_separator_new ();
	g_object_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = main_content;
	_tmp9_ = add_section_item;
	gtk_box_append (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = main_content;
	gtk_popover_set_child ((GtkPopover*) self, (GtkWidget*) _tmp10_);
	{
		GeeArrayList* _section_list = NULL;
		ObjectsProject* _tmp11_;
		GeeArrayList* _tmp12_;
		GeeArrayList* _tmp13_;
		gint _section_size = 0;
		GeeArrayList* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _section_index = 0;
		_tmp11_ = self->priv->_project;
		_tmp12_ = objects_project_get_sections (_tmp11_);
		_tmp13_ = _tmp12_;
		_section_list = _tmp13_;
		_tmp14_ = _section_list;
		_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_section_size = _tmp16_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp17_;
			gint _tmp18_;
			ObjectsSection* section = NULL;
			GeeArrayList* _tmp19_;
			gpointer _tmp20_;
			GtkListBox* _tmp21_;
			ObjectsSection* _tmp22_;
			WidgetsSectionsOrderItem* _tmp23_;
			WidgetsSectionsOrderItem* _tmp24_;
			_section_index = _section_index + 1;
			_tmp17_ = _section_index;
			_tmp18_ = _section_size;
			if (!(_tmp17_ < _tmp18_)) {
				break;
			}
			_tmp19_ = _section_list;
			_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _section_index);
			section = (ObjectsSection*) _tmp20_;
			_tmp21_ = self->priv->listbox;
			_tmp22_ = section;
			_tmp23_ = widgets_sections_order_item_new (_tmp22_);
			g_object_ref_sink (_tmp23_);
			_tmp24_ = _tmp23_;
			gtk_list_box_append (_tmp21_, (GtkWidget*) _tmp24_);
			_g_object_unref0 (_tmp24_);
			_g_object_unref0 (section);
		}
	}
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 225, __widgets_sections_order_popover___lambda997__gsource_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (main_content);
	_g_object_unref0 (add_section_item);
	return obj;
}

static void
widgets_sections_order_popover_class_init (WidgetsSectionsOrderPopoverClass * klass,
                                           gpointer klass_data)
{
	widgets_sections_order_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsSectionsOrderPopover_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_sections_order_popover_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_sections_order_popover_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_sections_order_popover_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_sections_order_popover_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SECTIONS_ORDER_POPOVER_PROJECT_PROPERTY, widgets_sections_order_popover_properties[WIDGETS_SECTIONS_ORDER_POPOVER_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
widgets_sections_order_popover_instance_init (WidgetsSectionsOrderPopover * self,
                                              gpointer klass)
{
	self->priv = widgets_sections_order_popover_get_instance_private (self);
}

static void
widgets_sections_order_popover_finalize (GObject * obj)
{
	WidgetsSectionsOrderPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopover);
	_g_object_unref0 (self->priv->_project);
	_g_object_unref0 (self->priv->listbox);
	G_OBJECT_CLASS (widgets_sections_order_popover_parent_class)->finalize (obj);
}

static GType
widgets_sections_order_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsSectionsOrderPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_sections_order_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsSectionsOrderPopover), 0, (GInstanceInitFunc) widgets_sections_order_popover_instance_init, NULL };
	GType widgets_sections_order_popover_type_id;
	widgets_sections_order_popover_type_id = g_type_register_static (gtk_popover_get_type (), "WidgetsSectionsOrderPopover", &g_define_type_info, 0);
	WidgetsSectionsOrderPopover_private_offset = g_type_add_instance_private (widgets_sections_order_popover_type_id, sizeof (WidgetsSectionsOrderPopoverPrivate));
	return widgets_sections_order_popover_type_id;
}

GType
widgets_sections_order_popover_get_type (void)
{
	static volatile gsize widgets_sections_order_popover_type_id__once = 0;
	if (g_once_init_enter (&widgets_sections_order_popover_type_id__once)) {
		GType widgets_sections_order_popover_type_id;
		widgets_sections_order_popover_type_id = widgets_sections_order_popover_get_type_once ();
		g_once_init_leave (&widgets_sections_order_popover_type_id__once, widgets_sections_order_popover_type_id);
	}
	return widgets_sections_order_popover_type_id__once;
}

static void
_vala_widgets_sections_order_popover_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	WidgetsSectionsOrderPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopover);
	switch (property_id) {
		case WIDGETS_SECTIONS_ORDER_POPOVER_PROJECT_PROPERTY:
		g_value_set_object (value, widgets_sections_order_popover_get_project (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_sections_order_popover_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	WidgetsSectionsOrderPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SECTIONS_ORDER_POPOVER, WidgetsSectionsOrderPopover);
	switch (property_id) {
		case WIDGETS_SECTIONS_ORDER_POPOVER_PROJECT_PROPERTY:
		widgets_sections_order_popover_set_project (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
widgets_sections_order_item_get_instance_private (WidgetsSectionsOrderItem* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsSectionsOrderItem_private_offset);
}

WidgetsSectionsOrderItem*
widgets_sections_order_item_construct (GType object_type,
                                       ObjectsSection* section)
{
	WidgetsSectionsOrderItem * self = NULL;
	g_return_val_if_fail (section != NULL, NULL);
	self = (WidgetsSectionsOrderItem*) g_object_new (object_type, "section", section, NULL);
	return self;
}

WidgetsSectionsOrderItem*
widgets_sections_order_item_new (ObjectsSection* section)
{
	return widgets_sections_order_item_construct (WIDGETS_TYPE_SECTIONS_ORDER_ITEM, section);
}

static GdkContentProvider*
__lambda992_ (WidgetsSectionsOrderItem* self,
              GtkDragSource* source,
              gdouble x,
              gdouble y)
{
	GValue _tmp0_ = {0};
	GdkContentProvider* _tmp1_;
	GdkContentProvider* _tmp2_;
	GdkContentProvider* result;
	g_return_val_if_fail (source != NULL, NULL);
	g_value_init (&_tmp0_, WIDGETS_TYPE_SECTIONS_ORDER_ITEM);
	g_value_set_object (&_tmp0_, self);
	_tmp1_ = gdk_content_provider_new_for_value (&_tmp0_);
	_tmp2_ = _tmp1_;
	G_IS_VALUE (&_tmp0_) ? (g_value_unset (&_tmp0_), NULL) : NULL;
	result = _tmp2_;
	return result;
}

static GdkContentProvider*
___lambda992__gtk_drag_source_prepare (GtkDragSource* _sender,
                                       gdouble x,
                                       gdouble y,
                                       gpointer self)
{
	GdkContentProvider* result;
	result = __lambda992_ ((WidgetsSectionsOrderItem*) self, _sender, x, y);
	return result;
}

static void
__lambda993_ (WidgetsSectionsOrderItem* self,
              GtkDragSource* source,
              GdkDrag* drag)
{
	GtkWidgetPaintable* paintable = NULL;
	GtkGrid* _tmp0_;
	GtkWidgetPaintable* _tmp1_;
	g_return_if_fail (source != NULL);
	g_return_if_fail (drag != NULL);
	_tmp0_ = self->priv->handle_grid;
	_tmp1_ = (GtkWidgetPaintable*) gtk_widget_paintable_new ((GtkWidget*) _tmp0_);
	paintable = _tmp1_;
	gtk_drag_source_set_icon (source, (GdkPaintable*) paintable, 0, 0);
	widgets_sections_order_item_drag_begin (self);
	_g_object_unref0 (paintable);
}

static void
___lambda993__gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                          GdkDrag* drag,
                                          gpointer self)
{
	__lambda993_ ((WidgetsSectionsOrderItem*) self, _sender, drag);
}

static void
__lambda994_ (WidgetsSectionsOrderItem* self,
              GtkDragSource* source,
              GdkDrag* drag,
              gboolean delete_data)
{
	g_return_if_fail (source != NULL);
	g_return_if_fail (drag != NULL);
	widgets_sections_order_item_drag_end (self);
}

static void
___lambda994__gtk_drag_source_drag_end (GtkDragSource* _sender,
                                        GdkDrag* drag,
                                        gboolean delete_data,
                                        gpointer self)
{
	__lambda994_ ((WidgetsSectionsOrderItem*) self, _sender, drag, delete_data);
}

static gboolean
__lambda995_ (WidgetsSectionsOrderItem* self,
              GtkDragSource* source,
              GdkDrag* drag,
              GdkDragCancelReason reason)
{
	gboolean result;
	g_return_val_if_fail (source != NULL, FALSE);
	g_return_val_if_fail (drag != NULL, FALSE);
	widgets_sections_order_item_drag_end (self);
	result = FALSE;
	return result;
}

static gboolean
___lambda995__gtk_drag_source_drag_cancel (GtkDragSource* _sender,
                                           GdkDrag* drag,
                                           GdkDragCancelReason reason,
                                           gpointer self)
{
	gboolean result;
	result = __lambda995_ ((WidgetsSectionsOrderItem*) self, _sender, drag, reason);
	return result;
}

static gboolean
__lambda996_ (WidgetsSectionsOrderItem* self,
              GValue* value,
              gdouble x,
              gdouble y)
{
	WidgetsSectionsOrderItem* picked_widget = NULL;
	GValue _tmp0_;
	WidgetsSectionsOrderItem* _tmp1_;
	WidgetsSectionsOrderItem* target_widget = NULL;
	WidgetsSectionsOrderItem* _tmp2_;
	WidgetsSectionsOrderItem* _tmp3_;
	WidgetsSectionsOrderItem* _tmp4_;
	gboolean _tmp5_ = FALSE;
	WidgetsSectionsOrderItem* _tmp6_;
	WidgetsSectionsOrderItem* _tmp7_;
	GtkListBox* source_list = NULL;
	WidgetsSectionsOrderItem* _tmp9_;
	GtkWidget* _tmp10_;
	GtkWidget* _tmp11_;
	GtkListBox* _tmp12_;
	GtkListBox* target_list = NULL;
	WidgetsSectionsOrderItem* _tmp13_;
	GtkWidget* _tmp14_;
	GtkWidget* _tmp15_;
	GtkListBox* _tmp16_;
	gint position = 0;
	GtkListBox* _tmp17_;
	WidgetsSectionsOrderItem* _tmp18_;
	WidgetsSectionsOrderItem* _tmp19_;
	GtkListBox* _tmp23_;
	WidgetsSectionsOrderItem* _tmp24_;
	gboolean result;
	g_return_val_if_fail (value != NULL, FALSE);
	_tmp0_ = *value;
	_tmp1_ = _g_object_ref0 (g_value_get_object (&_tmp0_));
	picked_widget = _tmp1_;
	_tmp2_ = _g_object_ref0 (self);
	target_widget = _tmp2_;
	_tmp3_ = picked_widget;
	widgets_sections_order_item_drag_end (_tmp3_);
	_tmp4_ = target_widget;
	widgets_sections_order_item_drag_end (_tmp4_);
	_tmp6_ = picked_widget;
	_tmp7_ = target_widget;
	if (_tmp6_ == _tmp7_) {
		_tmp5_ = TRUE;
	} else {
		WidgetsSectionsOrderItem* _tmp8_;
		_tmp8_ = target_widget;
		_tmp5_ = _tmp8_ == NULL;
	}
	if (_tmp5_) {
		result = FALSE;
		_g_object_unref0 (target_widget);
		_g_object_unref0 (picked_widget);
		return result;
	}
	_tmp9_ = picked_widget;
	_tmp10_ = gtk_widget_get_parent ((GtkWidget*) _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_list_box_get_type (), GtkListBox));
	source_list = _tmp12_;
	_tmp13_ = target_widget;
	_tmp14_ = gtk_widget_get_parent ((GtkWidget*) _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, gtk_list_box_get_type (), GtkListBox));
	target_list = _tmp16_;
	position = 0;
	_tmp17_ = source_list;
	_tmp18_ = picked_widget;
	gtk_list_box_remove (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = target_widget;
	if (gtk_list_box_row_get_index ((GtkListBoxRow*) _tmp19_) == 0) {
		WidgetsSectionsOrderItem* _tmp20_;
		_tmp20_ = target_widget;
		if (y > ((gdouble) (gtk_widget_get_height ((GtkWidget*) _tmp20_) / 2))) {
			WidgetsSectionsOrderItem* _tmp21_;
			_tmp21_ = target_widget;
			position = gtk_list_box_row_get_index ((GtkListBoxRow*) _tmp21_) + 1;
		}
	} else {
		WidgetsSectionsOrderItem* _tmp22_;
		_tmp22_ = target_widget;
		position = gtk_list_box_row_get_index ((GtkListBoxRow*) _tmp22_) + 1;
	}
	_tmp23_ = target_list;
	_tmp24_ = picked_widget;
	gtk_list_box_insert (_tmp23_, (GtkWidget*) _tmp24_, position);
	result = TRUE;
	_g_object_unref0 (target_list);
	_g_object_unref0 (source_list);
	_g_object_unref0 (target_widget);
	_g_object_unref0 (picked_widget);
	return result;
}

static gboolean
___lambda996__gtk_drop_target_drop (GtkDropTarget* _sender,
                                    GValue* value,
                                    gdouble x,
                                    gdouble y,
                                    gpointer self)
{
	gboolean result;
	result = __lambda996_ ((WidgetsSectionsOrderItem*) self, value, x, y);
	return result;
}

static void
widgets_sections_order_item_build_drag_and_drop (WidgetsSectionsOrderItem* self)
{
	GtkDragSource* drag_source = NULL;
	GtkDragSource* _tmp0_;
	GtkEventController* _tmp1_;
	GtkDropTarget* drop_target = NULL;
	GtkDropTarget* _tmp2_;
	GtkEventController* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_drag_source_new ();
	drag_source = _tmp0_;
	gtk_drag_source_set_actions (drag_source, GDK_ACTION_MOVE);
	g_signal_connect_object (drag_source, "prepare", (GCallback) ___lambda992__gtk_drag_source_prepare, self, 0);
	g_signal_connect_object (drag_source, "drag-begin", (GCallback) ___lambda993__gtk_drag_source_drag_begin, self, 0);
	g_signal_connect_object (drag_source, "drag-end", (GCallback) ___lambda994__gtk_drag_source_drag_end, self, 0);
	g_signal_connect_object (drag_source, "drag-cancel", (GCallback) ___lambda995__gtk_drag_source_drag_cancel, self, 0);
	_tmp1_ = _g_object_ref0 ((GtkEventController*) drag_source);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp1_);
	_tmp2_ = gtk_drop_target_new (WIDGETS_TYPE_SECTIONS_ORDER_ITEM, GDK_ACTION_MOVE);
	drop_target = _tmp2_;
	gtk_drop_target_set_preload (drop_target, TRUE);
	g_signal_connect_object (drop_target, "drop", (GCallback) ___lambda996__gtk_drop_target_drop, self, 0);
	_tmp3_ = _g_object_ref0 ((GtkEventController*) drop_target);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp3_);
	_g_object_unref0 (drop_target);
	_g_object_unref0 (drag_source);
}

void
widgets_sections_order_item_drag_begin (WidgetsSectionsOrderItem* self)
{
	GtkGrid* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->handle_grid;
	gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "card");
	gtk_widget_set_opacity ((GtkWidget*) self, 0.3);
}

void
widgets_sections_order_item_drag_end (WidgetsSectionsOrderItem* self)
{
	GtkGrid* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->handle_grid;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp0_, "card");
	gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) 1);
}

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

static void
widgets_sections_order_item_set_section (WidgetsSectionsOrderItem* self,
                                         ObjectsSection* value)
{
	ObjectsSection* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_sections_order_item_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, widgets_sections_order_item_properties[WIDGETS_SECTIONS_ORDER_ITEM_SECTION_PROPERTY]);
	}
}

static GObject *
widgets_sections_order_item_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsSectionsOrderItem * self;
	GtkImage* order_icon = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkImage* _tmp2_ = NULL;
	GtkGrid* widget_color = NULL;
	GtkGrid* _tmp3_ = NULL;
	GtkGrid* _tmp4_;
	Util* _tmp5_;
	Util* _tmp6_;
	GtkGrid* _tmp7_;
	GtkLabel* name_label = NULL;
	ObjectsSection* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkSwitch* visible_switch = NULL;
	GtkSwitch* _tmp14_ = NULL;
	GtkSwitch* _tmp15_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp16_ = NULL;
	GtkBox* _tmp17_;
	GtkImage* _tmp18_;
	GtkBox* _tmp19_;
	GtkLabel* _tmp20_;
	GtkBox* _tmp21_;
	GtkSwitch* _tmp22_;
	GtkGrid* _tmp23_;
	GtkGrid* _tmp24_;
	GtkBox* _tmp25_;
	GtkGrid* _tmp26_;
	parent_class = G_OBJECT_CLASS (widgets_sections_order_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem);
	gtk_widget_add_css_class ((GtkWidget*) self, "no-selectable");
	gtk_widget_add_css_class ((GtkWidget*) self, "transition");
	_tmp0_ = g_strdup ("dimmed");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("list-drag-handle-symbolic");
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_image_set_pixel_size (_tmp2_, 12);
	g_object_ref_sink (_tmp2_);
	order_icon = _tmp2_;
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	g_object_set ((GtkWidget*) _tmp3_, "height-request", 12, NULL);
	g_object_set ((GtkWidget*) _tmp3_, "width-request", 12, NULL);
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp3_);
	widget_color = _tmp3_;
	_tmp4_ = widget_color;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "label-color");
	_tmp5_ = util_get_default ();
	_tmp6_ = _tmp5_;
	_tmp7_ = widget_color;
	util_set_widget_color (_tmp6_, "#7ecc49", (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp6_);
	_tmp8_ = self->priv->_section;
	_tmp9_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = (GtkLabel*) gtk_label_new (_tmp10_);
	g_object_ref_sink (_tmp11_);
	name_label = _tmp11_;
	_tmp12_ = name_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp12_, GTK_ALIGN_CENTER);
	_tmp13_ = name_label;
	gtk_label_set_ellipsize (_tmp13_, PANGO_ELLIPSIZE_END);
	_tmp14_ = (GtkSwitch*) gtk_switch_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_END);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp14_, 6);
	g_object_ref_sink (_tmp14_);
	visible_switch = _tmp14_;
	_tmp15_ = visible_switch;
	gtk_widget_add_css_class ((GtkWidget*) _tmp15_, "switch-min");
	_tmp16_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp16_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp16_, 10);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp16_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp16_, 6);
	g_object_ref_sink (_tmp16_);
	content_box = _tmp16_;
	_tmp17_ = content_box;
	_tmp18_ = order_icon;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = content_box;
	_tmp20_ = name_label;
	gtk_box_append (_tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = content_box;
	_tmp22_ = visible_switch;
	gtk_box_append (_tmp21_, (GtkWidget*) _tmp22_);
	_tmp23_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->priv->handle_grid);
	self->priv->handle_grid = _tmp23_;
	_tmp24_ = self->priv->handle_grid;
	_tmp25_ = content_box;
	gtk_grid_attach (_tmp24_, (GtkWidget*) _tmp25_, 0, 0, 1, 1);
	_tmp26_ = self->priv->handle_grid;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp26_);
	widgets_sections_order_item_build_drag_and_drop (self);
	_g_object_unref0 (content_box);
	_g_object_unref0 (visible_switch);
	_g_object_unref0 (name_label);
	_g_object_unref0 (widget_color);
	_g_object_unref0 (order_icon);
	return obj;
}

static void
widgets_sections_order_item_class_init (WidgetsSectionsOrderItemClass * klass,
                                        gpointer klass_data)
{
	widgets_sections_order_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsSectionsOrderItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_sections_order_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_sections_order_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_sections_order_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_sections_order_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SECTIONS_ORDER_ITEM_SECTION_PROPERTY, widgets_sections_order_item_properties[WIDGETS_SECTIONS_ORDER_ITEM_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));
}

static void
widgets_sections_order_item_instance_init (WidgetsSectionsOrderItem * self,
                                           gpointer klass)
{
	self->priv = widgets_sections_order_item_get_instance_private (self);
}

static void
widgets_sections_order_item_finalize (GObject * obj)
{
	WidgetsSectionsOrderItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem);
	_g_object_unref0 (self->priv->_section);
	_g_object_unref0 (self->priv->handle_grid);
	G_OBJECT_CLASS (widgets_sections_order_item_parent_class)->finalize (obj);
}

static GType
widgets_sections_order_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsSectionsOrderItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_sections_order_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsSectionsOrderItem), 0, (GInstanceInitFunc) widgets_sections_order_item_instance_init, NULL };
	GType widgets_sections_order_item_type_id;
	widgets_sections_order_item_type_id = g_type_register_static (gtk_list_box_row_get_type (), "WidgetsSectionsOrderItem", &g_define_type_info, 0);
	WidgetsSectionsOrderItem_private_offset = g_type_add_instance_private (widgets_sections_order_item_type_id, sizeof (WidgetsSectionsOrderItemPrivate));
	return widgets_sections_order_item_type_id;
}

GType
widgets_sections_order_item_get_type (void)
{
	static volatile gsize widgets_sections_order_item_type_id__once = 0;
	if (g_once_init_enter (&widgets_sections_order_item_type_id__once)) {
		GType widgets_sections_order_item_type_id;
		widgets_sections_order_item_type_id = widgets_sections_order_item_get_type_once ();
		g_once_init_leave (&widgets_sections_order_item_type_id__once, widgets_sections_order_item_type_id);
	}
	return widgets_sections_order_item_type_id__once;
}

static void
_vala_widgets_sections_order_item_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	WidgetsSectionsOrderItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem);
	switch (property_id) {
		case WIDGETS_SECTIONS_ORDER_ITEM_SECTION_PROPERTY:
		g_value_set_object (value, widgets_sections_order_item_get_section (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_sections_order_item_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	WidgetsSectionsOrderItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SECTIONS_ORDER_ITEM, WidgetsSectionsOrderItem);
	switch (property_id) {
		case WIDGETS_SECTIONS_ORDER_ITEM_SECTION_PROPERTY:
		widgets_sections_order_item_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);
}

