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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <adwaita.h>
#include <glib-object.h>
#include "planify.h"
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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_ATTACHMENTS (widgets_attachments_get_type ())
#define WIDGETS_ATTACHMENTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachments))
#define WIDGETS_ATTACHMENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachmentsClass))
#define WIDGETS_IS_ATTACHMENTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_ATTACHMENTS))
#define WIDGETS_IS_ATTACHMENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_ATTACHMENTS))
#define WIDGETS_ATTACHMENTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachmentsClass))

typedef struct _WidgetsAttachments WidgetsAttachments;
typedef struct _WidgetsAttachmentsClass WidgetsAttachmentsClass;
typedef struct _WidgetsAttachmentsPrivate WidgetsAttachmentsPrivate;

#define WIDGETS_TYPE_ATTACHMENT_ROW (widgets_attachment_row_get_type ())
#define WIDGETS_ATTACHMENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_ATTACHMENT_ROW, WidgetsAttachmentRow))
#define WIDGETS_ATTACHMENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_ATTACHMENT_ROW, WidgetsAttachmentRowClass))
#define WIDGETS_IS_ATTACHMENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_ATTACHMENT_ROW))
#define WIDGETS_IS_ATTACHMENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_ATTACHMENT_ROW))
#define WIDGETS_ATTACHMENT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_ATTACHMENT_ROW, WidgetsAttachmentRowClass))

typedef struct _WidgetsAttachmentRow WidgetsAttachmentRow;
typedef struct _WidgetsAttachmentRowClass WidgetsAttachmentRowClass;
enum  {
	WIDGETS_ATTACHMENTS_0_PROPERTY,
	WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY,
	WIDGETS_ATTACHMENTS_ITEM_PROPERTY,
	WIDGETS_ATTACHMENTS_CARD_PROPERTY,
	WIDGETS_ATTACHMENTS_NUM_PROPERTIES
};
static GParamSpec* widgets_attachments_properties[WIDGETS_ATTACHMENTS_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GdkFileList_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkFileList_free (var), NULL)))
typedef struct _Block53Data Block53Data;

#define TYPE_PLANIFY (planify_get_type ())
#define PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLANIFY, Planify))
#define PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLANIFY, PlanifyClass))
#define IS_PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLANIFY))
#define IS_PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLANIFY))
#define PLANIFY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLANIFY, PlanifyClass))

typedef struct _Planify Planify;
typedef struct _PlanifyClass PlanifyClass;
typedef struct _PlanifyPrivate PlanifyPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _WidgetsAttachmentsUploadFilesData WidgetsAttachmentsUploadFilesData;
enum  {
	WIDGETS_ATTACHMENTS_UPDATE_COUNT_SIGNAL,
	WIDGETS_ATTACHMENTS_FILE_SELECTOR_OPENED_SIGNAL,
	WIDGETS_ATTACHMENTS_NUM_SIGNALS
};
static guint widgets_attachments_signals[WIDGETS_ATTACHMENTS_NUM_SIGNALS] = {0};

struct _WidgetsAttachments {
	AdwBin parent_instance;
	WidgetsAttachmentsPrivate * priv;
	WidgetsLoadingButton* add_button;
	GeeHashMap* attachments_map;
};

struct _WidgetsAttachmentsClass {
	AdwBinClass parent_class;
};

struct _WidgetsAttachmentsPrivate {
	gboolean _is_board;
	ObjectsItem* _item;
	GtkListBox* listbox;
	GtkLabel* count_label;
	GeeHashMap* signals_map;
};

struct _Block53Data {
	int _ref_count_;
	WidgetsAttachments* self;
	GtkFileDialog* chooser;
};

struct _Planify {
	AdwApplication parent_instance;
	PlanifyPrivate * priv;
	MainWindow* main_window;
};

struct _PlanifyClass {
	AdwApplicationClass parent_class;
};

struct _WidgetsAttachmentsUploadFilesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	WidgetsAttachments* self;
	GFile** files;
	gint files_length1;
	gint selected_files_amount;
	ObjectsAttachment** attachments_for_upload;
	ObjectsAttachment** _tmp0_;
	gint attachments_for_upload_length1;
	gint _attachments_for_upload_size_;
	gint i;
	gboolean _tmp1_;
	gint _tmp2_;
	GFile* file;
	GFile* _tmp3_;
	GFile* _tmp4_;
	ObjectsAttachment* attachment;
	ObjectsAttachment* _tmp5_;
	GFileInfo* file_info;
	GFile* _tmp6_;
	GFileInfo* _tmp7_;
	gchar* file_content_type;
	GFileInfo* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	ObjectsAttachment* _tmp14_;
	GFileInfo* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	ObjectsAttachment* _tmp18_;
	const gchar* _tmp19_;
	ObjectsAttachment* _tmp20_;
	GFile* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	ObjectsAttachment* _tmp24_;
	GFile* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ObjectsAttachment* _tmp28_;
	ObjectsAttachment* _tmp29_;
	GError* e;
	GError* _tmp30_;
	const gchar* _tmp31_;
	ObjectsAttachment** _tmp32_;
	gint _tmp32__length1;
	ObjectsAttachment** attachment_collection;
	gint attachment_collection_length1;
	gint _attachment_collection_size_;
	gint attachment_it;
	ObjectsAttachment* _tmp33_;
	ObjectsAttachment* _vala1_attachment;
	ObjectsAttachment* _tmp34_;
	Util* _tmp35_;
	Util* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	ObjectsAttachment* _tmp39_;
	ObjectsItem* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	ObjectsItem* _tmp43_;
	ObjectsAttachment* _tmp44_;
	ObjectsAttachment* _tmp45_;
	ObjectsAttachment* _tmp46_;
	GError* _inner_error0_;
};

static gint WidgetsAttachments_private_offset;
static gpointer widgets_attachments_parent_class = NULL;
VALA_EXTERN Planify* planify__instance;

VALA_EXTERN GType widgets_attachments_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsAttachments, g_object_unref)
VALA_EXTERN GType widgets_attachment_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsAttachmentRow, g_object_unref)
VALA_EXTERN ObjectsItem* widgets_attachments_get_item (WidgetsAttachments* self);
VALA_EXTERN WidgetsAttachments* widgets_attachments_new (gboolean is_board);
VALA_EXTERN WidgetsAttachments* widgets_attachments_construct (GType object_type,
                                                   gboolean is_board);
static gboolean widgets_attachments_on_drag_drop (WidgetsAttachments* self,
                                           GValue* val,
                                           gdouble x,
                                           gdouble y);
static GdkFileList* _vala_GdkFileList_copy (GdkFileList* self);
static void _vala_GdkFileList_free (GdkFileList* self);
static void _vala_array_add4 (GFile** * array,
                       gint* length,
                       gint* size,
                       GFile* value);
static void widgets_attachments_upload_files (WidgetsAttachments* self,
                                       GFile** files,
                                       gint files_length1,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
static void widgets_attachments_upload_files_finish (WidgetsAttachments* self,
                                              GAsyncResult* _res_);
static void __lambda46_ (WidgetsAttachments* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda46__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void widgets_attachments_show_file_selector (WidgetsAttachments* self);
static Block53Data* block53_data_ref (Block53Data* _data53_);
static void block53_data_unref (void * _userdata_);
VALA_EXTERN GType planify_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Planify, g_object_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
static void __lambda47_ (Block53Data* _data53_,
                  GObject* obj,
                  GAsyncResult* res);
static void _vala_array_add5 (GFile** * array,
                       gint* length,
                       gint* size,
                       GFile* value);
static void ___lambda48_ (WidgetsAttachments* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda48__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void ___lambda47__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void widgets_attachments_upload_files_data_free (gpointer _data);
static gboolean widgets_attachments_upload_files_co (WidgetsAttachmentsUploadFilesData* _data_);
static void _vala_array_add6 (ObjectsAttachment** * array,
                       gint* length,
                       gint* size,
                       ObjectsAttachment* value);
VALA_EXTERN void widgets_attachments_present_item (WidgetsAttachments* self,
                                       ObjectsItem* _item);
VALA_EXTERN void widgets_attachments_set_item (WidgetsAttachments* self,
                                   ObjectsItem* value);
VALA_EXTERN void widgets_attachments_add_attachments (WidgetsAttachments* self);
static void __lambda49_ (WidgetsAttachments* self,
                  ObjectsAttachment* attachment);
VALA_EXTERN void widgets_attachments_add_attachment (WidgetsAttachments* self,
                                         ObjectsAttachment* attachment);
static void ___lambda49__objects_item_attachment_added (ObjectsItem* _sender,
                                                 ObjectsAttachment* attachment,
                                                 gpointer self);
static void __lambda50_ (WidgetsAttachments* self,
                  ObjectsAttachment* attachment);
VALA_EXTERN void widgets_attachment_row_hide_destroy (WidgetsAttachmentRow* self);
static void widgets_attachments_update_count_label (WidgetsAttachments* self,
                                             gint count);
static void ___lambda50__objects_item_attachment_deleted (ObjectsItem* _sender,
                                                   ObjectsAttachment* attachment,
                                                   gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN WidgetsAttachmentRow* widgets_attachment_row_new (ObjectsAttachment* attachment);
VALA_EXTERN WidgetsAttachmentRow* widgets_attachment_row_construct (GType object_type,
                                                        ObjectsAttachment* attachment);
static GtkWidget* widgets_attachments_get_placeholder (WidgetsAttachments* self);
VALA_EXTERN void widgets_attachments_clean_up (WidgetsAttachments* self);
VALA_EXTERN gboolean widgets_attachments_get_is_board (WidgetsAttachments* self);
static void widgets_attachments_set_is_board (WidgetsAttachments* self,
                                       gboolean value);
VALA_EXTERN void widgets_attachments_set_card (WidgetsAttachments* self,
                                   gboolean value);
static GObject * widgets_attachments_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void _widgets_attachments___lambda51_ (WidgetsAttachments* self);
static void __widgets_attachments___lambda51__gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static gboolean _widgets_attachments_on_drag_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                 GValue* value,
                                                                 gdouble x,
                                                                 gdouble y,
                                                                 gpointer self);
static void widgets_attachments_finalize (GObject * obj);
static GType widgets_attachments_get_type_once (void);
static void _vala_widgets_attachments_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_widgets_attachments_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_attachments_get_instance_private (WidgetsAttachments* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsAttachments_private_offset);
}

WidgetsAttachments*
widgets_attachments_construct (GType object_type,
                               gboolean is_board)
{
	WidgetsAttachments * self = NULL;
	self = (WidgetsAttachments*) g_object_new (object_type, "is-board", is_board, NULL);
	return self;
}

WidgetsAttachments*
widgets_attachments_new (gboolean is_board)
{
	return widgets_attachments_construct (WIDGETS_TYPE_ATTACHMENTS, is_board);
}

static GdkFileList*
_vala_GdkFileList_copy (GdkFileList* self)
{
	return g_boxed_copy (gdk_file_list_get_type (), self);
}

static gpointer
__vala_GdkFileList_copy0 (gpointer self)
{
	return self ? _vala_GdkFileList_copy (self) : NULL;
}

static void
_vala_GdkFileList_free (GdkFileList* self)
{
	g_boxed_free (gdk_file_list_get_type (), self);
}

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

static void
_vala_array_add4 (GFile** * array,
                  gint* length,
                  gint* size,
                  GFile* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GFile*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
__lambda46_ (WidgetsAttachments* self,
             GObject* obj,
             GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	widgets_attachments_upload_files_finish (self, res);
}

static void
___lambda46__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda46_ ((WidgetsAttachments*) self, source_object, res);
	g_object_unref (self);
}

static gboolean
widgets_attachments_on_drag_drop (WidgetsAttachments* self,
                                  GValue* val,
                                  gdouble x,
                                  gdouble y)
{
	GdkFileList* file_list = NULL;
	GValue _tmp0_;
	GdkFileList* _tmp1_;
	GdkFileList* _tmp2_;
	GSList* files = NULL;
	GdkFileList* _tmp3_;
	GSList* _tmp4_;
	GSList* _tmp5_;
	GFile** files_to_upload = NULL;
	GFile** _tmp6_;
	gint files_to_upload_length1;
	gint _files_to_upload_size_;
	GSList* _tmp7_;
	GFile** _tmp10_;
	gint _tmp10__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = *val;
	_tmp1_ = __vala_GdkFileList_copy0 (g_value_get_boxed (&_tmp0_));
	file_list = _tmp1_;
	_tmp2_ = file_list;
	if (_tmp2_ == NULL) {
		result = FALSE;
		__vala_GdkFileList_free0 (file_list);
		return result;
	}
	_tmp3_ = file_list;
	_tmp4_ = gdk_file_list_get_files (_tmp3_);
	files = _tmp4_;
	_tmp5_ = files;
	if (g_slist_length (_tmp5_) == ((guint) 0)) {
		result = FALSE;
		(files == NULL) ? NULL : (files = (g_slist_free (files), NULL));
		__vala_GdkFileList_free0 (file_list);
		return result;
	}
	_tmp6_ = g_new0 (GFile*, 0 + 1);
	files_to_upload = _tmp6_;
	files_to_upload_length1 = 0;
	_files_to_upload_size_ = files_to_upload_length1;
	_tmp7_ = files;
	{
		GSList* file_collection = NULL;
		GSList* file_it = NULL;
		file_collection = _tmp7_;
		for (file_it = file_collection; file_it != NULL; file_it = file_it->next) {
			GFile* file = NULL;
			file = (GFile*) file_it->data;
			{
				GFile* _tmp8_;
				GFile* _tmp9_;
				_tmp8_ = file;
				_tmp9_ = _g_object_ref0 (_tmp8_);
				_vala_array_add4 (&files_to_upload, &files_to_upload_length1, &_files_to_upload_size_, _tmp9_);
			}
		}
	}
	_tmp10_ = files_to_upload;
	_tmp10__length1 = files_to_upload_length1;
	widgets_attachments_upload_files (self, _tmp10_, (gint) _tmp10__length1, ___lambda46__gasync_ready_callback, g_object_ref (self));
	result = TRUE;
	files_to_upload = (_vala_array_free (files_to_upload, files_to_upload_length1, (GDestroyNotify) g_object_unref), NULL);
	(files == NULL) ? NULL : (files = (g_slist_free (files), NULL));
	__vala_GdkFileList_free0 (file_list);
	return result;
}

static Block53Data*
block53_data_ref (Block53Data* _data53_)
{
	g_atomic_int_inc (&_data53_->_ref_count_);
	return _data53_;
}

static void
block53_data_unref (void * _userdata_)
{
	Block53Data* _data53_;
	_data53_ = (Block53Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data53_->_ref_count_)) {
		WidgetsAttachments* self;
		self = _data53_->self;
		_g_object_unref0 (_data53_->chooser);
		_g_object_unref0 (self);
		g_slice_free (Block53Data, _data53_);
	}
}

static void
_vala_array_add5 (GFile** * array,
                  gint* length,
                  gint* size,
                  GFile* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GFile*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
___lambda48_ (WidgetsAttachments* self,
              GObject* obj,
              GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	widgets_attachments_upload_files_finish (self, res);
}

static void
____lambda48__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda48_ ((WidgetsAttachments*) self, source_object, res);
	g_object_unref (self);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
__lambda47_ (Block53Data* _data53_,
             GObject* obj,
             GAsyncResult* res)
{
	WidgetsAttachments* self;
	GError* _inner_error0_ = NULL;
	self = _data53_->self;
	g_return_if_fail (res != NULL);
	{
		GListModel* files = NULL;
		GListModel* _tmp0_;
		GFile** files_to_upload = NULL;
		GFile** _tmp1_;
		gint files_to_upload_length1;
		gint _files_to_upload_size_;
		guint amount_of_files = 0U;
		GListModel* _tmp2_;
		GFile** _tmp11_;
		gint _tmp11__length1;
		_tmp0_ = gtk_file_dialog_open_multiple_finish (_data53_->chooser, res, &_inner_error0_);
		files = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = g_new0 (GFile*, 0 + 1);
		files_to_upload = _tmp1_;
		files_to_upload_length1 = 0;
		_files_to_upload_size_ = files_to_upload_length1;
		_tmp2_ = files;
		amount_of_files = g_list_model_get_n_items (_tmp2_);
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					GFile* file = NULL;
					GListModel* _tmp5_;
					GObject* _tmp6_;
					GFile* _tmp7_;
					GFile* _tmp8_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					if (!(((guint) i) < amount_of_files)) {
						break;
					}
					_tmp5_ = files;
					_tmp6_ = g_list_model_get_item (_tmp5_, (guint) i);
					_tmp7_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, g_file_get_type ()) ? ((GFile*) _tmp6_) : NULL;
					if (_tmp7_ == NULL) {
						_g_object_unref0 (_tmp6_);
					}
					file = _tmp7_;
					_tmp8_ = file;
					if (_tmp8_ != NULL) {
						GFile* _tmp9_;
						GFile* _tmp10_;
						_tmp9_ = file;
						_tmp10_ = _g_object_ref0 (_tmp9_);
						_vala_array_add5 (&files_to_upload, &files_to_upload_length1, &_files_to_upload_size_, _tmp10_);
					}
					_g_object_unref0 (file);
				}
			}
		}
		_tmp11_ = files_to_upload;
		_tmp11__length1 = files_to_upload_length1;
		widgets_attachments_upload_files (self, _tmp11_, (gint) _tmp11__length1, ____lambda48__gasync_ready_callback, g_object_ref (self));
		g_signal_emit (self, widgets_attachments_signals[WIDGETS_ATTACHMENTS_FILE_SELECTOR_OPENED_SIGNAL], 0, FALSE);
		files_to_upload = (_vala_array_free (files_to_upload, files_to_upload_length1, (GDestroyNotify) g_object_unref), NULL);
		_g_object_unref0 (files);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		_tmp14_ = string_to_string (_tmp13_);
		_tmp15_ = g_strconcat ("Couldn't get the result of FileDialog for AttachmentsPage: ", _tmp14_, NULL);
		_tmp16_ = _tmp15_;
		g_warning ("Attachments.vala:167: %s", _tmp16_);
		_g_free0 (_tmp16_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda47__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda47_ (self, source_object, res);
	block53_data_unref (self);
}

static void
widgets_attachments_show_file_selector (WidgetsAttachments* self)
{
	Block53Data* _data53_;
	gchar* _tmp0_;
	GtkFileDialog* _tmp1_ = NULL;
	Planify* _tmp2_;
	MainWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	_data53_ = g_slice_new0 (Block53Data);
	_data53_->_ref_count_ = 1;
	_data53_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_ ("Open"));
	_tmp1_ = gtk_file_dialog_new ();
	gtk_file_dialog_set_title (_tmp1_, _tmp0_);
	_g_free0 (_tmp0_);
	gtk_file_dialog_set_modal (_tmp1_, TRUE);
	_data53_->chooser = _tmp1_;
	_tmp2_ = planify__instance;
	_tmp3_ = _tmp2_->main_window;
	gtk_file_dialog_open_multiple (_data53_->chooser, (GtkWindow*) _tmp3_, NULL, ___lambda47__gasync_ready_callback, block53_data_ref (_data53_));
	block53_data_unref (_data53_);
	_data53_ = NULL;
}

static void
widgets_attachments_upload_files_data_free (gpointer _data)
{
	WidgetsAttachmentsUploadFilesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (WidgetsAttachmentsUploadFilesData, _data_);
}

static void
widgets_attachments_upload_files (WidgetsAttachments* self,
                                  GFile** files,
                                  gint files_length1,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	WidgetsAttachmentsUploadFilesData* _data_;
	WidgetsAttachments* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (WidgetsAttachmentsUploadFilesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, widgets_attachments_upload_files_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->files = files;
	_data_->files_length1 = files_length1;
	widgets_attachments_upload_files_co (_data_);
}

static void
widgets_attachments_upload_files_finish (WidgetsAttachments* self,
                                         GAsyncResult* _res_)
{
	WidgetsAttachmentsUploadFilesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_vala_array_add6 (ObjectsAttachment** * array,
                  gint* length,
                  gint* size,
                  ObjectsAttachment* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (ObjectsAttachment*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
widgets_attachments_upload_files_co (WidgetsAttachmentsUploadFilesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->selected_files_amount = _data_->files_length1;
	if (_data_->selected_files_amount == 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = g_new0 (ObjectsAttachment*, 0 + 1);
	_data_->attachments_for_upload = _data_->_tmp0_;
	_data_->attachments_for_upload_length1 = 0;
	_data_->_attachments_for_upload_size_ = _data_->attachments_for_upload_length1;
	{
		_data_->i = 0;
		{
			_data_->_tmp1_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp1_) {
					_data_->_tmp2_ = _data_->i;
					_data_->i = _data_->_tmp2_ + 1;
				}
				_data_->_tmp1_ = FALSE;
				if (!(_data_->i < _data_->selected_files_amount)) {
					break;
				}
				_data_->_tmp3_ = _data_->files[_data_->i];
				_data_->_tmp4_ = _g_object_ref0 (_data_->_tmp3_);
				_data_->file = _data_->_tmp4_;
				_data_->_tmp5_ = objects_attachment_new ();
				_data_->attachment = _data_->_tmp5_;
				{
					_data_->_tmp6_ = _data_->file;
					_data_->_tmp7_ = g_file_query_info (_data_->_tmp6_, "standard::size,standard::content-type", 0, NULL, &_data_->_inner_error0_);
					_data_->file_info = _data_->_tmp7_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_data_->_tmp8_ = _data_->file_info;
					_data_->_tmp9_ = g_file_info_get_content_type (_data_->_tmp8_);
					_data_->_tmp10_ = g_strdup (_data_->_tmp9_);
					_data_->file_content_type = _data_->_tmp10_;
					_data_->_tmp11_ = _data_->file_content_type;
					if (_data_->_tmp11_ != NULL) {
						_data_->_tmp12_ = _data_->file_content_type;
						_data_->_tmp13_ = g_utf8_strdown (_data_->_tmp12_, (gssize) -1);
						_g_free0 (_data_->file_content_type);
						_data_->file_content_type = _data_->_tmp13_;
						_data_->_tmp14_ = _data_->attachment;
						_data_->_tmp15_ = _data_->file_info;
						_data_->_tmp16_ = g_strdup_printf ("%" G_GINT64_FORMAT, g_file_info_get_size (_data_->_tmp15_));
						_data_->_tmp17_ = _data_->_tmp16_;
						objects_attachment_set_file_size (_data_->_tmp14_, _data_->_tmp17_);
						_g_free0 (_data_->_tmp17_);
						_data_->_tmp18_ = _data_->attachment;
						_data_->_tmp19_ = _data_->file_content_type;
						objects_attachment_set_file_type (_data_->_tmp18_, _data_->_tmp19_);
						_data_->_tmp20_ = _data_->attachment;
						_data_->_tmp21_ = _data_->file;
						_data_->_tmp22_ = g_file_get_basename (_data_->_tmp21_);
						_data_->_tmp23_ = _data_->_tmp22_;
						objects_attachment_set_file_name (_data_->_tmp20_, _data_->_tmp23_);
						_g_free0 (_data_->_tmp23_);
						_data_->_tmp24_ = _data_->attachment;
						_data_->_tmp25_ = _data_->file;
						_data_->_tmp26_ = g_file_get_uri (_data_->_tmp25_);
						_data_->_tmp27_ = _data_->_tmp26_;
						objects_attachment_set_file_path (_data_->_tmp24_, _data_->_tmp27_);
						_g_free0 (_data_->_tmp27_);
						_data_->_tmp28_ = _data_->attachment;
						_data_->_tmp29_ = _g_object_ref0 (_data_->_tmp28_);
						_vala_array_add6 (&_data_->attachments_for_upload, &_data_->attachments_for_upload_length1, &_data_->_attachments_for_upload_size_, _data_->_tmp29_);
					}
					_g_free0 (_data_->file_content_type);
					_g_object_unref0 (_data_->file_info);
				}
				goto __finally0;
				__catch0_g_error:
				{
					_data_->e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp30_ = _data_->e;
					_data_->_tmp31_ = _data_->_tmp30_->message;
					g_warning ("Attachments.vala:196: %s", _data_->_tmp31_);
					_g_error_free0 (_data_->e);
				}
				__finally0:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->attachment);
					_g_object_unref0 (_data_->file);
					_data_->attachments_for_upload = (_vala_array_free (_data_->attachments_for_upload, _data_->attachments_for_upload_length1, (GDestroyNotify) g_object_unref), NULL);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->attachment);
				_g_object_unref0 (_data_->file);
			}
		}
	}
	_data_->_tmp32_ = _data_->attachments_for_upload;
	_data_->_tmp32__length1 = _data_->attachments_for_upload_length1;
	{
		_data_->attachment_collection_length1 = 0;
		_data_->_attachment_collection_size_ = 0;
		_data_->attachment_collection = _data_->_tmp32_;
		_data_->attachment_collection_length1 = _data_->_tmp32__length1;
		for (_data_->attachment_it = 0; _data_->attachment_it < _data_->attachment_collection_length1; _data_->attachment_it = _data_->attachment_it + 1) {
			_data_->_tmp33_ = _g_object_ref0 (_data_->attachment_collection[_data_->attachment_it]);
			_data_->_vala1_attachment = _data_->_tmp33_;
			{
				_data_->_tmp34_ = _data_->_vala1_attachment;
				_data_->_tmp35_ = util_get_default ();
				_data_->_tmp36_ = _data_->_tmp35_;
				_data_->_tmp37_ = util_generate_id (_data_->_tmp36_, NULL);
				_data_->_tmp38_ = _data_->_tmp37_;
				objects_attachment_set_id (_data_->_tmp34_, _data_->_tmp38_);
				_g_free0 (_data_->_tmp38_);
				_g_object_unref0 (_data_->_tmp36_);
				_data_->_tmp39_ = _data_->_vala1_attachment;
				_data_->_tmp40_ = _data_->self->priv->_item;
				_data_->_tmp41_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp40_);
				_data_->_tmp42_ = _data_->_tmp41_;
				objects_attachment_set_item_id (_data_->_tmp39_, _data_->_tmp42_);
				_data_->_tmp43_ = _data_->self->priv->_item;
				_data_->_tmp44_ = _data_->_vala1_attachment;
				_data_->_tmp45_ = objects_item_add_attachment_if_not_exists (_data_->_tmp43_, _data_->_tmp44_);
				_data_->_tmp46_ = _data_->_tmp45_;
				_g_object_unref0 (_data_->_tmp46_);
				_g_object_unref0 (_data_->_vala1_attachment);
			}
		}
	}
	_data_->attachments_for_upload = (_vala_array_free (_data_->attachments_for_upload, _data_->attachments_for_upload_length1, (GDestroyNotify) g_object_unref), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda49_ (WidgetsAttachments* self,
             ObjectsAttachment* attachment)
{
	g_return_if_fail (attachment != NULL);
	widgets_attachments_add_attachment (self, attachment);
}

static void
___lambda49__objects_item_attachment_added (ObjectsItem* _sender,
                                            ObjectsAttachment* attachment,
                                            gpointer self)
{
	__lambda49_ ((WidgetsAttachments*) self, attachment);
}

static void
__lambda50_ (WidgetsAttachments* self,
             ObjectsAttachment* attachment)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeHashMap* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	g_return_if_fail (attachment != NULL);
	_tmp0_ = self->attachments_map;
	_tmp1_ = objects_attachment_get_id (attachment);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gpointer _tmp6_;
		WidgetsAttachmentRow* _tmp7_;
		GeeHashMap* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp3_ = self->attachments_map;
		_tmp4_ = objects_attachment_get_id (attachment);
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, _tmp5_);
		_tmp7_ = (WidgetsAttachmentRow*) _tmp6_;
		widgets_attachment_row_hide_destroy (_tmp7_);
		_g_object_unref0 (_tmp7_);
		_tmp8_ = self->attachments_map;
		_tmp9_ = objects_attachment_get_id (attachment);
		_tmp10_ = _tmp9_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp8_, _tmp10_, NULL);
	}
	_tmp11_ = self->attachments_map;
	_tmp12_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp11_);
	_tmp13_ = _tmp12_;
	widgets_attachments_update_count_label (self, _tmp13_);
}

static void
___lambda50__objects_item_attachment_deleted (ObjectsItem* _sender,
                                              ObjectsAttachment* attachment,
                                              gpointer self)
{
	__lambda50_ ((WidgetsAttachments*) self, attachment);
}

void
widgets_attachments_present_item (WidgetsAttachments* self,
                                  ObjectsItem* _item)
{
	GeeHashMap* _tmp0_;
	ObjectsItem* _tmp1_;
	gulong _tmp2_;
	ObjectsItem* _tmp3_;
	GeeHashMap* _tmp4_;
	ObjectsItem* _tmp5_;
	gulong _tmp6_;
	ObjectsItem* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_item != NULL);
	widgets_attachments_set_item (self, _item);
	widgets_attachments_add_attachments (self);
	_tmp0_ = self->priv->signals_map;
	_tmp1_ = self->priv->_item;
	_tmp2_ = g_signal_connect_object (_tmp1_, "attachment-added", (GCallback) ___lambda49__objects_item_attachment_added, self, 0);
	_tmp3_ = self->priv->_item;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, (gpointer) ((guintptr) _tmp2_), (GObject*) _tmp3_);
	_tmp4_ = self->priv->signals_map;
	_tmp5_ = self->priv->_item;
	_tmp6_ = g_signal_connect_object (_tmp5_, "attachment-deleted", (GCallback) ___lambda50__objects_item_attachment_deleted, self, 0);
	_tmp7_ = self->priv->_item;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, (gpointer) ((guintptr) _tmp6_), (GObject*) _tmp7_);
}

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
widgets_attachments_add_attachments (WidgetsAttachments* self)
{
	GeeHashMap* _tmp0_;
	Util* _tmp1_;
	Util* _tmp2_;
	GtkListBox* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->attachments_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp0_);
	_tmp1_ = util_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->listbox;
	_tmp4_ = util_get_children (_tmp2_, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp5_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) ((GtkListBoxRow*) child_it->data);
			{
				GtkListBox* _tmp6_;
				GtkWidget* _tmp7_;
				_tmp6_ = self->priv->listbox;
				_tmp7_ = child;
				gtk_list_box_remove (_tmp6_, _tmp7_);
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (_g_list_free__g_object_unref0_ (child_collection), NULL));
	}
	{
		GeeArrayList* _attachment_list = NULL;
		ObjectsItem* _tmp8_;
		GeeArrayList* _tmp9_;
		GeeArrayList* _tmp10_;
		gint _attachment_size = 0;
		GeeArrayList* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		gint _attachment_index = 0;
		_tmp8_ = self->priv->_item;
		_tmp9_ = objects_item_get_attachments (_tmp8_);
		_tmp10_ = _tmp9_;
		_attachment_list = _tmp10_;
		_tmp11_ = _attachment_list;
		_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
		_tmp13_ = _tmp12_;
		_attachment_size = _tmp13_;
		_attachment_index = -1;
		while (TRUE) {
			gint _tmp14_;
			gint _tmp15_;
			ObjectsAttachment* attachment = NULL;
			GeeArrayList* _tmp16_;
			gpointer _tmp17_;
			ObjectsAttachment* _tmp18_;
			_attachment_index = _attachment_index + 1;
			_tmp14_ = _attachment_index;
			_tmp15_ = _attachment_size;
			if (!(_tmp14_ < _tmp15_)) {
				break;
			}
			_tmp16_ = _attachment_list;
			_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _attachment_index);
			attachment = (ObjectsAttachment*) _tmp17_;
			_tmp18_ = attachment;
			widgets_attachments_add_attachment (self, _tmp18_);
			_g_object_unref0 (attachment);
		}
	}
}

void
widgets_attachments_add_attachment (WidgetsAttachments* self,
                                    ObjectsAttachment* attachment)
{
	GeeHashMap* _tmp0_;
	ObjectsItem* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GeeHashMap* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attachment != NULL);
	_tmp0_ = self->attachments_map;
	_tmp1_ = self->priv->_item;
	_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp3_)) {
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		WidgetsAttachmentRow* _tmp7_;
		WidgetsAttachmentRow* _tmp8_;
		GtkListBox* _tmp9_;
		GeeHashMap* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gpointer _tmp13_;
		WidgetsAttachmentRow* _tmp14_;
		_tmp4_ = self->attachments_map;
		_tmp5_ = objects_attachment_get_id (attachment);
		_tmp6_ = _tmp5_;
		_tmp7_ = widgets_attachment_row_new (attachment);
		g_object_ref_sink (_tmp7_);
		_tmp8_ = _tmp7_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp8_);
		_g_object_unref0 (_tmp8_);
		_tmp9_ = self->priv->listbox;
		_tmp10_ = self->attachments_map;
		_tmp11_ = objects_attachment_get_id (attachment);
		_tmp12_ = _tmp11_;
		_tmp13_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp10_, _tmp12_);
		_tmp14_ = (WidgetsAttachmentRow*) _tmp13_;
		gtk_list_box_append (_tmp9_, (GtkWidget*) _tmp14_);
		_g_object_unref0 (_tmp14_);
	}
	_tmp15_ = self->attachments_map;
	_tmp16_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp15_);
	_tmp17_ = _tmp16_;
	widgets_attachments_update_count_label (self, _tmp17_);
}

static GtkWidget*
widgets_attachments_get_placeholder (WidgetsAttachments* self)
{
	GtkLabel* message_label = NULL;
	GtkLabel* _tmp0_ = NULL;
	GtkGrid* placeholder_grid = NULL;
	GtkGrid* _tmp1_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("No attachments found. Add files here."));
	gtk_label_set_wrap (_tmp0_, TRUE);
	gtk_label_set_justify (_tmp0_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp0_, 6);
	g_object_ref_sink (_tmp0_);
	message_label = _tmp0_;
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 24);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 24);
	g_object_ref_sink (_tmp1_);
	placeholder_grid = _tmp1_;
	gtk_grid_attach (placeholder_grid, (GtkWidget*) message_label, 0, 0, 1, 1);
	result = (GtkWidget*) placeholder_grid;
	_g_object_unref0 (message_label);
	return result;
}

void
widgets_attachments_clean_up (WidgetsAttachments* self)
{
	GeeHashMap* _tmp15_;
	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->signals_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->signals_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp15_);
}

static void
widgets_attachments_update_count_label (WidgetsAttachments* self,
                                        gint count)
{
	gchar* _tmp0_ = NULL;
	GtkLabel* _tmp3_;
	g_return_if_fail (self != NULL);
	if (count <= 0) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		gchar* _tmp2_;
		_tmp2_ = g_strdup_printf ("%i", count);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = self->priv->count_label;
	gtk_label_set_label (_tmp3_, _tmp0_);
	g_signal_emit (self, widgets_attachments_signals[WIDGETS_ATTACHMENTS_UPDATE_COUNT_SIGNAL], 0, count);
	_g_free0 (_tmp0_);
}

gboolean
widgets_attachments_get_is_board (WidgetsAttachments* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_board;
	return result;
}

static void
widgets_attachments_set_is_board (WidgetsAttachments* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_attachments_get_is_board (self);
	if (old_value != value) {
		self->priv->_is_board = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_attachments_properties[WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY]);
	}
}

ObjectsItem*
widgets_attachments_get_item (WidgetsAttachments* self)
{
	ObjectsItem* result;
	ObjectsItem* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_item;
	result = _tmp0_;
	return result;
}

void
widgets_attachments_set_item (WidgetsAttachments* self,
                              ObjectsItem* value)
{
	ObjectsItem* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_attachments_get_item (self);
	if (old_value != value) {
		ObjectsItem* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_item);
		self->priv->_item = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_attachments_properties[WIDGETS_ATTACHMENTS_ITEM_PROPERTY]);
	}
}

void
widgets_attachments_set_card (WidgetsAttachments* self,
                              gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value) {
		GtkListBox* _tmp0_;
		GtkListBox* _tmp1_;
		_tmp0_ = self->priv->listbox;
		gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "boxed-list");
		_tmp1_ = self->priv->listbox;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp1_, "listbox-background");
	} else {
		GtkListBox* _tmp2_;
		GtkListBox* _tmp3_;
		_tmp2_ = self->priv->listbox;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp2_, "boxed-list");
		_tmp3_ = self->priv->listbox;
		gtk_widget_add_css_class ((GtkWidget*) _tmp3_, "listbox-background");
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_attachments_properties[WIDGETS_ATTACHMENTS_CARD_PROPERTY]);
}

static void
_widgets_attachments___lambda51_ (WidgetsAttachments* self)
{
	g_signal_emit (self, widgets_attachments_signals[WIDGETS_ATTACHMENTS_FILE_SELECTOR_OPENED_SIGNAL], 0, TRUE);
	widgets_attachments_show_file_selector (self);
}

static void
__widgets_attachments___lambda51__gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	_widgets_attachments___lambda51_ ((WidgetsAttachments*) self);
}

static gboolean
_widgets_attachments_on_drag_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                        GValue* value,
                                                        gdouble x,
                                                        gdouble y,
                                                        gpointer self)
{
	gboolean result;
	result = widgets_attachments_on_drag_drop ((WidgetsAttachments*) self, value, x, y);
	return result;
}

static GObject *
widgets_attachments_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsAttachments * self;
	GtkLabel* title = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	GtkLabel* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar** _tmp9_;
	WidgetsLoadingButton* _tmp10_ = NULL;
	gint _tmp11_ = 0;
	gboolean _tmp12_;
	gint _tmp13_ = 0;
	gboolean _tmp14_;
	GtkBox* headerbox = NULL;
	GtkBox* _tmp15_ = NULL;
	GtkBox* _tmp16_;
	GtkLabel* _tmp17_;
	GtkBox* _tmp18_;
	GtkLabel* _tmp19_;
	GtkBox* _tmp20_;
	WidgetsLoadingButton* _tmp21_;
	gchar* _tmp22_;
	gchar** _tmp23_;
	GtkListBox* _tmp24_ = NULL;
	GtkListBox* _tmp25_;
	GtkWidget* _tmp26_;
	GtkWidget* _tmp27_;
	gint _tmp28_ = 0;
	gboolean _tmp29_;
	gint _tmp30_ = 0;
	gboolean _tmp31_;
	gint _tmp32_ = 0;
	gboolean _tmp33_;
	AdwBin* listbox_card = NULL;
	GtkListBox* _tmp34_;
	GtkWidget* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar** _tmp38_;
	AdwBin* _tmp39_ = NULL;
	gint _tmp40_ = 0;
	gboolean _tmp41_;
	GtkBox* content = NULL;
	GtkBox* _tmp42_ = NULL;
	GtkBox* _tmp43_;
	GtkBox* _tmp44_;
	GtkBox* _tmp45_;
	AdwBin* _tmp46_;
	GtkBox* _tmp47_;
	WidgetsLoadingButton* _tmp48_;
	GtkDropTarget* dnd_controller = NULL;
	GtkDropTarget* _tmp49_;
	AdwBin* _tmp50_;
	GtkDropTarget* _tmp51_;
	GtkEventController* _tmp52_;
	GtkDropTarget* _tmp53_;
	parent_class = G_OBJECT_CLASS (widgets_attachments_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachments);
	_tmp0_ = g_strdup ("heading");
	_tmp1_ = g_strdup ("h4");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Attachments"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp3_, _tmp2_);
	_tmp2_ = (_vala_array_free (_tmp2_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp3_);
	title = _tmp3_;
	_tmp4_ = g_strdup ("dimmed");
	_tmp5_ = g_strdup ("caption");
	_tmp6_ = g_new0 (gchar*, 2 + 1);
	_tmp6_[0] = _tmp4_;
	_tmp6_[1] = _tmp5_;
	_tmp7_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 9);
	gtk_widget_set_halign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp7_, _tmp6_);
	_tmp6_ = (_vala_array_free (_tmp6_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->count_label);
	self->priv->count_label = _tmp7_;
	_tmp8_ = g_strdup ("flat");
	_tmp9_ = g_new0 (gchar*, 1 + 1);
	_tmp9_[0] = _tmp8_;
	_tmp10_ = widgets_loading_button_new_with_icon ("plus-large-symbolic", 16);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp10_, _tmp9_);
	_tmp9_ = (_vala_array_free (_tmp9_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
	gtk_widget_set_halign ((GtkWidget*) _tmp10_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->add_button);
	self->add_button = _tmp10_;
	_tmp12_ = self->priv->_is_board;
	if (_tmp12_) {
		_tmp11_ = 9;
	} else {
		_tmp11_ = 6;
	}
	_tmp14_ = self->priv->_is_board;
	if (_tmp14_) {
		_tmp13_ = 9;
	} else {
		_tmp13_ = 6;
	}
	_tmp15_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, _tmp11_);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp15_, _tmp13_);
	g_object_ref_sink (_tmp15_);
	headerbox = _tmp15_;
	_tmp16_ = headerbox;
	_tmp17_ = title;
	gtk_box_append (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = headerbox;
	_tmp19_ = self->priv->count_label;
	gtk_box_append (_tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = headerbox;
	_tmp21_ = self->add_button;
	gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
	_tmp22_ = g_strdup ("listbox-background");
	_tmp23_ = g_new0 (gchar*, 1 + 1);
	_tmp23_[0] = _tmp22_;
	_tmp24_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp24_, GTK_ALIGN_START);
	gtk_list_box_set_activate_on_single_click (_tmp24_, TRUE);
	gtk_list_box_set_selection_mode (_tmp24_, GTK_SELECTION_SINGLE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp24_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp24_, _tmp23_);
	_tmp23_ = (_vala_array_free (_tmp23_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->listbox);
	self->priv->listbox = _tmp24_;
	_tmp25_ = self->priv->listbox;
	_tmp26_ = widgets_attachments_get_placeholder (self);
	_tmp27_ = _tmp26_;
	gtk_list_box_set_placeholder (_tmp25_, _tmp27_);
	_g_object_unref0 (_tmp27_);
	_tmp29_ = self->priv->_is_board;
	if (_tmp29_) {
		_tmp28_ = 9;
	} else {
		_tmp28_ = 0;
	}
	_tmp31_ = self->priv->_is_board;
	if (_tmp31_) {
		_tmp30_ = 12;
	} else {
		_tmp30_ = 0;
	}
	_tmp33_ = self->priv->_is_board;
	if (_tmp33_) {
		_tmp32_ = 6;
	} else {
		_tmp32_ = 0;
	}
	_tmp34_ = self->priv->listbox;
	_tmp35_ = _g_object_ref0 ((GtkWidget*) _tmp34_);
	_tmp36_ = g_strdup ("transition");
	_tmp37_ = g_strdup ("drop-target");
	_tmp38_ = g_new0 (gchar*, 2 + 1);
	_tmp38_[0] = _tmp36_;
	_tmp38_[1] = _tmp37_;
	_tmp39_ = (AdwBin*) adw_bin_new ();
	adw_bin_set_child (_tmp39_, _tmp35_);
	_g_object_unref0 (_tmp35_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp39_, _tmp28_);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp39_, _tmp30_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp39_, _tmp32_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp39_, _tmp38_);
	_tmp38_ = (_vala_array_free (_tmp38_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp39_);
	listbox_card = _tmp39_;
	_tmp41_ = self->priv->_is_board;
	if (_tmp41_) {
		_tmp40_ = 3;
	} else {
		_tmp40_ = 0;
	}
	_tmp42_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp42_, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp42_, _tmp40_);
	g_object_ref_sink (_tmp42_);
	content = _tmp42_;
	_tmp43_ = content;
	_tmp44_ = headerbox;
	gtk_box_append (_tmp43_, (GtkWidget*) _tmp44_);
	_tmp45_ = content;
	_tmp46_ = listbox_card;
	gtk_box_append (_tmp45_, (GtkWidget*) _tmp46_);
	_tmp47_ = content;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp47_);
	_tmp48_ = self->add_button;
	g_signal_connect_object ((GtkButton*) _tmp48_, "clicked", (GCallback) __widgets_attachments___lambda51__gtk_button_clicked, self, 0);
	_tmp49_ = gtk_drop_target_new (gdk_file_list_get_type (), GDK_ACTION_COPY);
	dnd_controller = _tmp49_;
	_tmp50_ = listbox_card;
	_tmp51_ = dnd_controller;
	_tmp52_ = _g_object_ref0 ((GtkEventController*) _tmp51_);
	gtk_widget_add_controller ((GtkWidget*) _tmp50_, _tmp52_);
	_tmp53_ = dnd_controller;
	g_signal_connect_object (_tmp53_, "drop", (GCallback) _widgets_attachments_on_drag_drop_gtk_drop_target_drop, self, 0);
	_g_object_unref0 (dnd_controller);
	_g_object_unref0 (content);
	_g_object_unref0 (listbox_card);
	_g_object_unref0 (headerbox);
	_g_object_unref0 (title);
	return obj;
}

static void
widgets_attachments_class_init (WidgetsAttachmentsClass * klass,
                                gpointer klass_data)
{
	widgets_attachments_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsAttachments_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_attachments_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_attachments_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_attachments_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_attachments_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY, widgets_attachments_properties[WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY] = g_param_spec_boolean ("is-board", "is-board", "is-board", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_ATTACHMENTS_ITEM_PROPERTY, widgets_attachments_properties[WIDGETS_ATTACHMENTS_ITEM_PROPERTY] = g_param_spec_object ("item", "item", "item", OBJECTS_TYPE_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_ATTACHMENTS_CARD_PROPERTY, widgets_attachments_properties[WIDGETS_ATTACHMENTS_CARD_PROPERTY] = g_param_spec_boolean ("card", "card", "card", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	widgets_attachments_signals[WIDGETS_ATTACHMENTS_UPDATE_COUNT_SIGNAL] = g_signal_new ("update-count", WIDGETS_TYPE_ATTACHMENTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
	widgets_attachments_signals[WIDGETS_ATTACHMENTS_FILE_SELECTOR_OPENED_SIGNAL] = g_signal_new ("file-selector-opened", WIDGETS_TYPE_ATTACHMENTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
widgets_attachments_instance_init (WidgetsAttachments * self,
                                   gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = widgets_attachments_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, WIDGETS_TYPE_ATTACHMENT_ROW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->attachments_map = _tmp0_;
	_tmp1_ = 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->signals_map = _tmp1_;
}

static void
widgets_attachments_finalize (GObject * obj)
{
	WidgetsAttachments * self;
	ObjectsItem* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachments);
	_tmp0_ = self->priv->_item;
	_tmp1_ = objects_item_get_content (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("Destroying - Widgets.Attachments - %s\n", _tmp2_);
	_tmp4_ = _tmp3_;
	g_debug ("Attachments.vala:54: %s", _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (self->priv->_item);
	_g_object_unref0 (self->add_button);
	_g_object_unref0 (self->priv->listbox);
	_g_object_unref0 (self->priv->count_label);
	_g_object_unref0 (self->attachments_map);
	_g_object_unref0 (self->priv->signals_map);
	G_OBJECT_CLASS (widgets_attachments_parent_class)->finalize (obj);
}

static GType
widgets_attachments_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsAttachmentsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_attachments_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsAttachments), 0, (GInstanceInitFunc) widgets_attachments_instance_init, NULL };
	GType widgets_attachments_type_id;
	widgets_attachments_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsAttachments", &g_define_type_info, 0);
	WidgetsAttachments_private_offset = g_type_add_instance_private (widgets_attachments_type_id, sizeof (WidgetsAttachmentsPrivate));
	return widgets_attachments_type_id;
}

GType
widgets_attachments_get_type (void)
{
	static volatile gsize widgets_attachments_type_id__once = 0;
	if (g_once_init_enter (&widgets_attachments_type_id__once)) {
		GType widgets_attachments_type_id;
		widgets_attachments_type_id = widgets_attachments_get_type_once ();
		g_once_init_leave (&widgets_attachments_type_id__once, widgets_attachments_type_id);
	}
	return widgets_attachments_type_id__once;
}

static void
_vala_widgets_attachments_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	WidgetsAttachments * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachments);
	switch (property_id) {
		case WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY:
		g_value_set_boolean (value, widgets_attachments_get_is_board (self));
		break;
		case WIDGETS_ATTACHMENTS_ITEM_PROPERTY:
		g_value_set_object (value, widgets_attachments_get_item (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_attachments_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	WidgetsAttachments * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_ATTACHMENTS, WidgetsAttachments);
	switch (property_id) {
		case WIDGETS_ATTACHMENTS_IS_BOARD_PROPERTY:
		widgets_attachments_set_is_board (self, g_value_get_boolean (value));
		break;
		case WIDGETS_ATTACHMENTS_ITEM_PROPERTY:
		widgets_attachments_set_item (self, g_value_get_object (value));
		break;
		case WIDGETS_ATTACHMENTS_CARD_PROPERTY:
		widgets_attachments_set_card (self, g_value_get_boolean (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);
}

