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

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

#include "planify.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <adwaita.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

enum  {
	OBJECTS_LABEL_0_PROPERTY,
	OBJECTS_LABEL_ITEM_ORDER_PROPERTY,
	OBJECTS_LABEL_IS_DELETED_PROPERTY,
	OBJECTS_LABEL_IS_FAVORITE_PROPERTY,
	OBJECTS_LABEL_BACKEND_TYPE_PROPERTY,
	OBJECTS_LABEL_SOURCE_ID_PROPERTY,
	OBJECTS_LABEL_SOURCE_PROPERTY,
	OBJECTS_LABEL_SOURCE_TYPE_PROPERTY,
	OBJECTS_LABEL_LABEL_COUNT_PROPERTY,
	OBJECTS_LABEL_SHORT_NAME_PROPERTY,
	OBJECTS_LABEL_NUM_PROPERTIES
};
static GParamSpec* objects_label_properties[OBJECTS_LABEL_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_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _Block56Data Block56Data;
typedef struct _ObjectsLabelDeleteLabelData ObjectsLabelDeleteLabelData;
enum  {
	OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL,
	OBJECTS_LABEL_NUM_SIGNALS
};
static guint objects_label_signals[OBJECTS_LABEL_NUM_SIGNALS] = {0};

struct _ObjectsLabelPrivate {
	gint _item_order;
	gboolean _is_deleted;
	gboolean _is_favorite;
	SourceType _backend_type;
	gchar* _source_id;
	ObjectsSource* _source;
	gint* _label_count;
	gchar* _short_name;
};

struct _Block56Data {
	int _ref_count_;
	ObjectsLabel* self;
	ObjectsItem* item;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _ObjectsLabelDeleteLabelData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsLabel* self;
	GtkWindow* window;
	AdwAlertDialog* dialog;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	AdwAlertDialog* _tmp4_;
	AdwAlertDialog* _tmp5_;
};

static gint ObjectsLabel_private_offset;
static gpointer objects_label_parent_class = NULL;

static gint objects_label_update_label_count (ObjectsLabel* self);
static gchar* objects_label_real_get_add_json (ObjectsBaseObject* base,
                                        const gchar* temp_id,
                                        const gchar* uuid);
static gchar* objects_label_real_get_update_json (ObjectsBaseObject* base,
                                           const gchar* uuid,
                                           const gchar* temp_id);
static void _vala_JsonNode_free (JsonNode* self);
static void objects_label_delete_label_data_free (gpointer _data);
static gboolean objects_label_delete_label_co (ObjectsLabelDeleteLabelData* _data_);
static void __lambda7_ (ObjectsLabel* self,
                 const gchar* response);
static void ____lambda30_ (ObjectsLabel* self,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda30__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block56Data* block56_data_ref (Block56Data* _data56_);
static void block56_data_unref (void * _userdata_);
static void _______lambda37_ (Block56Data* _data56_,
                       GObject* obj,
                       GAsyncResult* res);
static void ________lambda37__gasync_ready_callback (GObject* source_object,
                                              GAsyncResult* res,
                                              gpointer self);
static void ___lambda7__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                            const gchar* response,
                                            gpointer self);
static gint* _int_dup (gint* self);
static GObject * objects_label_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void _objects_label___lambda38_ (ObjectsLabel* self,
                                 ObjectsItem* item);
static void __objects_label___lambda38__services_store_item_added (ServicesStore* _sender,
                                                            ObjectsItem* item,
                                                            gboolean insert,
                                                            gpointer self);
static void _objects_label___lambda39_ (ObjectsLabel* self,
                                 ObjectsItem* item);
static void __objects_label___lambda39__services_store_item_deleted (ServicesStore* _sender,
                                                              ObjectsItem* item,
                                                              gpointer self);
static void _objects_label___lambda40_ (ObjectsLabel* self,
                                 ObjectsItem* item);
static void __objects_label___lambda40__services_store_item_updated (ServicesStore* _sender,
                                                              ObjectsItem* item,
                                                              const gchar* update_id,
                                                              gpointer self);
static void _objects_label___lambda41_ (ObjectsLabel* self,
                                 ObjectsLabel* label);
static void __objects_label___lambda41__services_store_item_label_added (ServicesStore* _sender,
                                                                  ObjectsLabel* label,
                                                                  gpointer self);
static void _objects_label___lambda42_ (ObjectsLabel* self,
                                 ObjectsLabel* label);
static void __objects_label___lambda42__services_store_item_label_deleted (ServicesStore* _sender,
                                                                    ObjectsLabel* label,
                                                                    gpointer self);
static void _objects_label___lambda43_ (ObjectsLabel* self,
                                 ObjectsItem* item);
static void __objects_label___lambda43__services_store_item_archived (ServicesStore* _sender,
                                                               ObjectsItem* item,
                                                               gpointer self);
static void _objects_label___lambda44_ (ObjectsLabel* self,
                                 ObjectsItem* item);
static void __objects_label___lambda44__services_store_item_unarchived (ServicesStore* _sender,
                                                                 ObjectsItem* item,
                                                                 gpointer self);
static void objects_label_finalize (GObject * obj);
static GType objects_label_get_type_once (void);
static void _vala_objects_label_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_objects_label_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
objects_label_get_instance_private (ObjectsLabel* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsLabel_private_offset);
}

static gint
objects_label_update_label_count (ObjectsLabel* self)
{
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_items_by_label (_tmp0_, self, FALSE);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

ObjectsLabel*
objects_label_construct_from_json (GType object_type,
                                   JsonNode* node)
{
	ObjectsLabel * self = NULL;
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (node != NULL, NULL);
	self = (ObjectsLabel*) objects_base_object_construct (object_type);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "id");
	objects_base_object_set_id ((ObjectsBaseObject*) self, _tmp1_);
	objects_label_update_from_json (self, node);
	objects_label_set_backend_type (self, SOURCE_TYPE_TODOIST);
	return self;
}

ObjectsLabel*
objects_label_new_from_json (JsonNode* node)
{
	return objects_label_construct_from_json (OBJECTS_TYPE_LABEL, node);
}

ObjectsLabel*
objects_label_construct_from_import_json (GType object_type,
                                          JsonNode* node)
{
	ObjectsLabel * self = NULL;
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	JsonObject* _tmp2_;
	const gchar* _tmp3_;
	JsonObject* _tmp4_;
	const gchar* _tmp5_;
	JsonObject* _tmp6_;
	const gchar* _tmp7_;
	JsonObject* _tmp8_;
	JsonObject* _tmp9_;
	SourceType _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	JsonObject* _tmp13_;
	g_return_val_if_fail (node != NULL, NULL);
	self = (ObjectsLabel*) objects_base_object_construct (object_type);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "id");
	objects_base_object_set_id ((ObjectsBaseObject*) self, _tmp1_);
	_tmp2_ = json_node_get_object (node);
	_tmp3_ = json_object_get_string_member (_tmp2_, "name");
	objects_base_object_set_name ((ObjectsBaseObject*) self, _tmp3_);
	_tmp4_ = json_node_get_object (node);
	_tmp5_ = json_object_get_string_member (_tmp4_, "color");
	objects_base_object_set_color ((ObjectsBaseObject*) self, _tmp5_);
	_tmp6_ = json_node_get_object (node);
	_tmp7_ = json_object_get_string_member (_tmp6_, "backend_type");
	objects_label_set_backend_type (self, source_type_parse (_tmp7_));
	_tmp8_ = json_node_get_object (node);
	objects_label_set_is_deleted (self, json_object_get_boolean_member (_tmp8_, "is_deleted"));
	_tmp9_ = json_node_get_object (node);
	objects_label_set_is_favorite (self, json_object_get_boolean_member (_tmp9_, "is_favorite"));
	_tmp10_ = self->priv->_backend_type;
	_tmp11_ = source_type_to_string (_tmp10_);
	_tmp12_ = _tmp11_;
	objects_label_set_source_id (self, _tmp12_);
	_g_free0 (_tmp12_);
	_tmp13_ = json_node_get_object (node);
	if (json_object_has_member (_tmp13_, "source_id")) {
		JsonObject* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = json_node_get_object (node);
		_tmp15_ = json_object_get_string_member (_tmp14_, "source_id");
		objects_label_set_source_id (self, _tmp15_);
	}
	return self;
}

ObjectsLabel*
objects_label_new_from_import_json (JsonNode* node)
{
	return objects_label_construct_from_import_json (OBJECTS_TYPE_LABEL, node);
}

void
objects_label_update_from_json (ObjectsLabel* self,
                                JsonNode* node)
{
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	JsonObject* _tmp2_;
	JsonObject* _tmp5_;
	JsonObject* _tmp7_;
	JsonObject* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "name");
	objects_base_object_set_name ((ObjectsBaseObject*) self, _tmp1_);
	_tmp2_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp2_, "color")) {
		JsonObject* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = json_node_get_object (node);
		_tmp4_ = json_object_get_string_member (_tmp3_, "color");
		objects_base_object_set_color ((ObjectsBaseObject*) self, _tmp4_);
	}
	_tmp5_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp5_, "is_favorite")) {
		JsonObject* _tmp6_;
		_tmp6_ = json_node_get_object (node);
		objects_label_set_is_favorite (self, json_object_get_boolean_member (_tmp6_, "is_favorite"));
	}
	_tmp7_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp7_, "is_deleted")) {
		JsonObject* _tmp8_;
		_tmp8_ = json_node_get_object (node);
		objects_label_set_is_deleted (self, json_object_get_boolean_member (_tmp8_, "is_deleted"));
	}
	_tmp9_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp9_, "item_order")) {
		JsonObject* _tmp10_;
		_tmp10_ = json_node_get_object (node);
		objects_label_set_item_order (self, (gint) ((gint32) json_object_get_int_member (_tmp10_, "item_order")));
	}
}

static gchar*
objects_label_real_get_add_json (ObjectsBaseObject* base,
                                 const gchar* temp_id,
                                 const gchar* uuid)
{
	ObjectsLabel * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ObjectsLabel*) base;
	g_return_val_if_fail (temp_id != NULL, NULL);
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = objects_base_object_get_update_json ((ObjectsBaseObject*) self, uuid, temp_id);
	result = _tmp0_;
	return result;
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gchar*
objects_label_real_get_update_json (ObjectsBaseObject* base,
                                    const gchar* uuid,
                                    const gchar* temp_id)
{
	ObjectsLabel * self;
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp4_;
	JsonBuilder* _tmp5_;
	const gchar* _tmp6_ = NULL;
	JsonBuilder* _tmp7_;
	JsonBuilder* _tmp8_;
	JsonBuilder* _tmp9_;
	JsonBuilder* _tmp12_;
	JsonBuilder* _tmp13_;
	JsonBuilder* _tmp18_;
	JsonBuilder* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	JsonBuilder* _tmp22_;
	JsonBuilder* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	JsonBuilder* _tmp26_;
	JsonBuilder* _tmp27_;
	gint _tmp28_;
	JsonBuilder* _tmp29_;
	JsonBuilder* _tmp30_;
	gboolean _tmp31_;
	JsonBuilder* _tmp32_;
	JsonBuilder* _tmp33_;
	JsonBuilder* _tmp34_;
	JsonBuilder* _tmp35_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp36_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp37_;
	JsonNode* _tmp38_;
	gchar* _tmp39_;
	gchar* result;
	self = (ObjectsLabel*) base;
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "commands");
	_tmp3_ = builder;
	json_builder_begin_array (_tmp3_);
	_tmp4_ = builder;
	json_builder_begin_object (_tmp4_);
	_tmp5_ = builder;
	json_builder_set_member_name (_tmp5_, "type");
	if (temp_id == NULL) {
		_tmp6_ = "label_update";
	} else {
		_tmp6_ = "label_add";
	}
	_tmp7_ = builder;
	json_builder_add_string_value (_tmp7_, _tmp6_);
	_tmp8_ = builder;
	json_builder_set_member_name (_tmp8_, "uuid");
	_tmp9_ = builder;
	json_builder_add_string_value (_tmp9_, uuid);
	if (temp_id != NULL) {
		JsonBuilder* _tmp10_;
		JsonBuilder* _tmp11_;
		_tmp10_ = builder;
		json_builder_set_member_name (_tmp10_, "temp_id");
		_tmp11_ = builder;
		json_builder_add_string_value (_tmp11_, temp_id);
	}
	_tmp12_ = builder;
	json_builder_set_member_name (_tmp12_, "args");
	_tmp13_ = builder;
	json_builder_begin_object (_tmp13_);
	if (temp_id == NULL) {
		JsonBuilder* _tmp14_;
		JsonBuilder* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		_tmp14_ = builder;
		json_builder_set_member_name (_tmp14_, "id");
		_tmp15_ = builder;
		_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
		_tmp17_ = _tmp16_;
		json_builder_add_string_value (_tmp15_, _tmp17_);
	}
	_tmp18_ = builder;
	json_builder_set_member_name (_tmp18_, "name");
	_tmp19_ = builder;
	_tmp20_ = objects_base_object_get_name ((ObjectsBaseObject*) self);
	_tmp21_ = _tmp20_;
	json_builder_add_string_value (_tmp19_, _tmp21_);
	_tmp22_ = builder;
	json_builder_set_member_name (_tmp22_, "color");
	_tmp23_ = builder;
	_tmp24_ = objects_base_object_get_color ((ObjectsBaseObject*) self);
	_tmp25_ = _tmp24_;
	json_builder_add_string_value (_tmp23_, _tmp25_);
	_tmp26_ = builder;
	json_builder_set_member_name (_tmp26_, "item_order");
	_tmp27_ = builder;
	_tmp28_ = self->priv->_item_order;
	json_builder_add_int_value (_tmp27_, (gint64) _tmp28_);
	_tmp29_ = builder;
	json_builder_set_member_name (_tmp29_, "is_favorite");
	_tmp30_ = builder;
	_tmp31_ = self->priv->_is_favorite;
	json_builder_add_boolean_value (_tmp30_, _tmp31_);
	_tmp32_ = builder;
	json_builder_end_object (_tmp32_);
	_tmp33_ = builder;
	json_builder_end_object (_tmp33_);
	_tmp34_ = builder;
	json_builder_end_array (_tmp34_);
	_tmp35_ = builder;
	json_builder_end_object (_tmp35_);
	_tmp36_ = json_generator_new ();
	generator = _tmp36_;
	_tmp37_ = builder;
	_tmp38_ = json_builder_get_root (_tmp37_);
	root = _tmp38_;
	json_generator_set_root (generator, root);
	_tmp39_ = json_generator_to_data (generator, NULL);
	result = _tmp39_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

static void
objects_label_delete_label_data_free (gpointer _data)
{
	ObjectsLabelDeleteLabelData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->window);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsLabelDeleteLabelData, _data_);
}

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

void
objects_label_delete_label (ObjectsLabel* self,
                            GtkWindow* window,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	ObjectsLabelDeleteLabelData* _data_;
	ObjectsLabel* _tmp0_;
	GtkWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_data_ = g_slice_new0 (ObjectsLabelDeleteLabelData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_label_delete_label_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (window);
	_g_object_unref0 (_data_->window);
	_data_->window = _tmp1_;
	objects_label_delete_label_co (_data_);
}

void
objects_label_delete_label_finish (ObjectsLabel* self,
                                   GAsyncResult* _res_)
{
	ObjectsLabelDeleteLabelData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
____lambda30_ (ObjectsLabel* self,
               GObject* obj,
               GAsyncResult* res)
{
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	ServicesStore* _tmp4_;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_delete_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	_tmp4_ = services_store_instance ();
	services_store_delete_label (_tmp4_, self);
}

static void
_____lambda30__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda30_ ((ObjectsLabel*) self, source_object, res);
	g_object_unref (self);
}

static Block56Data*
block56_data_ref (Block56Data* _data56_)
{
	g_atomic_int_inc (&_data56_->_ref_count_);
	return _data56_;
}

static void
block56_data_unref (void * _userdata_)
{
	Block56Data* _data56_;
	_data56_ = (Block56Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data56_->_ref_count_)) {
		ObjectsLabel* self;
		self = _data56_->self;
		_g_object_unref0 (_data56_->caldav_client);
		_g_object_unref0 (_data56_->item);
		_g_object_unref0 (self);
		g_slice_free (Block56Data, _data56_);
	}
}

static void
_______lambda37_ (Block56Data* _data56_,
                  GObject* obj,
                  GAsyncResult* res)
{
	ObjectsLabel* self;
	ServicesCalDAVCalDAVClient* _tmp0_;
	HttpResponse* _tmp1_;
	HttpResponse* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	self = _data56_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data56_->caldav_client;
	_tmp1_ = services_cal_dav_cal_dav_client_add_item_finish (_tmp0_, res);
	_tmp2_ = _tmp1_;
	_tmp3_ = http_response_get_status (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_http_response_unref0 (_tmp2_);
	if (_tmp5_) {
		ServicesStore* _tmp6_;
		ObjectsItem* _tmp7_;
		_tmp6_ = services_store_instance ();
		_tmp7_ = _data56_->item;
		services_store_update_item (_tmp6_, _tmp7_, "");
	}
}

static void
________lambda37__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self)
{
	_______lambda37_ (self, source_object, res);
	block56_data_unref (self);
}

static void
__lambda7_ (ObjectsLabel* self,
            const gchar* response)
{
	g_return_if_fail (response != NULL);
	if (g_strcmp0 (response, "delete") == 0) {
		SourceType _tmp0_;
		SourceType _tmp1_;
		_tmp0_ = objects_label_get_source_type (self);
		_tmp1_ = _tmp0_;
		if (_tmp1_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp2_;
			ServicesTodoist* _tmp3_;
			objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
			_tmp2_ = services_todoist_get_default ();
			_tmp3_ = _tmp2_;
			services_todoist_delete (_tmp3_, (ObjectsBaseObject*) self, _____lambda30__gasync_ready_callback, g_object_ref (self));
			_g_object_unref0 (_tmp3_);
		} else {
			SourceType _tmp4_;
			SourceType _tmp5_;
			_tmp4_ = objects_label_get_source_type (self);
			_tmp5_ = _tmp4_;
			if (_tmp5_ == SOURCE_TYPE_CALDAV) {
				ServicesStore* _tmp31_;
				objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
				{
					GeeArrayList* _item_list = NULL;
					ServicesStore* _tmp6_;
					GeeArrayList* _tmp7_;
					gint _item_size = 0;
					GeeArrayList* _tmp8_;
					gint _tmp9_;
					gint _tmp10_;
					gint _item_index = 0;
					_tmp6_ = services_store_instance ();
					_tmp7_ = services_store_get_items_by_label (_tmp6_, self, FALSE);
					_item_list = _tmp7_;
					_tmp8_ = _item_list;
					_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
					_tmp10_ = _tmp9_;
					_item_size = _tmp10_;
					_item_index = -1;
					while (TRUE) {
						Block56Data* _data56_;
						gint _tmp11_;
						gint _tmp12_;
						GeeArrayList* _tmp13_;
						gpointer _tmp14_;
						ObjectsItem* _tmp15_;
						const gchar* _tmp16_;
						const gchar* _tmp17_;
						ObjectsLabel* _tmp18_;
						ObjectsLabel* _tmp19_;
						ServicesCalDAVCore* _tmp20_;
						ServicesCalDAVCore* _tmp21_;
						ObjectsItem* _tmp22_;
						ObjectsProject* _tmp23_;
						ObjectsProject* _tmp24_;
						ObjectsSource* _tmp25_;
						ObjectsSource* _tmp26_;
						ServicesCalDAVCalDAVClient* _tmp27_;
						ServicesCalDAVCalDAVClient* _tmp28_;
						ServicesCalDAVCalDAVClient* _tmp29_;
						ObjectsItem* _tmp30_;
						_data56_ = g_slice_new0 (Block56Data);
						_data56_->_ref_count_ = 1;
						_data56_->self = g_object_ref (self);
						_item_index = _item_index + 1;
						_tmp11_ = _item_index;
						_tmp12_ = _item_size;
						if (!(_tmp11_ < _tmp12_)) {
							block56_data_unref (_data56_);
							_data56_ = NULL;
							break;
						}
						_tmp13_ = _item_list;
						_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, _item_index);
						_data56_->item = (ObjectsItem*) _tmp14_;
						_tmp15_ = _data56_->item;
						_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
						_tmp17_ = _tmp16_;
						_tmp18_ = objects_item_delete_item_label (_tmp15_, _tmp17_);
						_tmp19_ = _tmp18_;
						_g_object_unref0 (_tmp19_);
						_tmp20_ = services_cal_dav_core_get_default ();
						_tmp21_ = _tmp20_;
						_tmp22_ = _data56_->item;
						_tmp23_ = objects_item_get_project (_tmp22_);
						_tmp24_ = _tmp23_;
						_tmp25_ = objects_project_get_source (_tmp24_);
						_tmp26_ = _tmp25_;
						_tmp27_ = services_cal_dav_core_get_client (_tmp21_, _tmp26_);
						_tmp28_ = _tmp27_;
						_g_object_unref0 (_tmp21_);
						_data56_->caldav_client = _tmp28_;
						_tmp29_ = _data56_->caldav_client;
						_tmp30_ = _data56_->item;
						services_cal_dav_cal_dav_client_add_item (_tmp29_, _tmp30_, TRUE, ________lambda37__gasync_ready_callback, block56_data_ref (_data56_));
						block56_data_unref (_data56_);
						_data56_ = NULL;
					}
					_g_object_unref0 (_item_list);
				}
				_tmp31_ = services_store_instance ();
				services_store_delete_label (_tmp31_, self);
			} else {
				ServicesStore* _tmp32_;
				_tmp32_ = services_store_instance ();
				services_store_delete_label (_tmp32_, self);
			}
		}
	}
}

static void
___lambda7__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                       const gchar* response,
                                       gpointer self)
{
	__lambda7_ ((ObjectsLabel*) self, response);
}

static gboolean
objects_label_delete_label_co (ObjectsLabelDeleteLabelData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = g_strdup_printf ("Delete Label %s", _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = (AdwAlertDialog*) adw_alert_dialog_new (_ (_data_->_tmp3_), _ ("This can not be undone"));
	g_object_ref_sink (_data_->_tmp4_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_free0 (_data_->_tmp3_);
	_data_->dialog = _data_->_tmp5_;
	adw_alert_dialog_add_response (_data_->dialog, "cancel", _ ("Cancel"));
	adw_alert_dialog_add_response (_data_->dialog, "delete", _ ("Delete"));
	adw_alert_dialog_set_response_appearance (_data_->dialog, "delete", ADW_RESPONSE_DESTRUCTIVE);
	adw_dialog_present ((AdwDialog*) _data_->dialog, (GtkWidget*) _data_->window);
	g_signal_connect_object (_data_->dialog, "response", (GCallback) ___lambda7__adw_alert_dialog_response, _data_->self, 0);
	_g_object_unref0 (_data_->dialog);
	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;
}

ObjectsLabel*
objects_label_construct (GType object_type)
{
	ObjectsLabel * self = NULL;
	self = (ObjectsLabel*) objects_base_object_construct (object_type);
	return self;
}

ObjectsLabel*
objects_label_new (void)
{
	return objects_label_construct (OBJECTS_TYPE_LABEL);
}

gint
objects_label_get_item_order (ObjectsLabel* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_item_order;
	return result;
}

void
objects_label_set_item_order (ObjectsLabel* self,
                              gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_label_get_item_order (self);
	if (old_value != value) {
		self->priv->_item_order = value;
		g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_ITEM_ORDER_PROPERTY]);
	}
}

gboolean
objects_label_get_is_deleted (ObjectsLabel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_deleted;
	return result;
}

void
objects_label_set_is_deleted (ObjectsLabel* self,
                              gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_label_get_is_deleted (self);
	if (old_value != value) {
		self->priv->_is_deleted = value;
		g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_IS_DELETED_PROPERTY]);
	}
}

gboolean
objects_label_get_is_favorite (ObjectsLabel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_favorite;
	return result;
}

void
objects_label_set_is_favorite (ObjectsLabel* self,
                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_label_get_is_favorite (self);
	if (old_value != value) {
		self->priv->_is_favorite = value;
		g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_IS_FAVORITE_PROPERTY]);
	}
}

SourceType
objects_label_get_backend_type (ObjectsLabel* self)
{
	SourceType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_backend_type;
	return result;
}

void
objects_label_set_backend_type (ObjectsLabel* self,
                                SourceType value)
{
	SourceType old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_label_get_backend_type (self);
	if (old_value != value) {
		self->priv->_backend_type = value;
		g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_BACKEND_TYPE_PROPERTY]);
	}
}

const gchar*
objects_label_get_source_id (ObjectsLabel* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source_id;
	result = _tmp0_;
	return result;
}

void
objects_label_set_source_id (ObjectsLabel* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_label_get_source_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_source_id);
		self->priv->_source_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_SOURCE_ID_PROPERTY]);
	}
}

ObjectsSource*
objects_label_get_source (ObjectsLabel* self)
{
	ObjectsSource* result;
	ServicesStore* _tmp0_;
	const gchar* _tmp1_;
	ObjectsSource* _tmp2_;
	ObjectsSource* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = self->priv->_source_id;
	_tmp2_ = services_store_get_source (_tmp0_, _tmp1_);
	_g_object_unref0 (self->priv->_source);
	self->priv->_source = _tmp2_;
	_tmp3_ = self->priv->_source;
	result = _tmp3_;
	return result;
}

SourceType
objects_label_get_source_type (ObjectsLabel* self)
{
	SourceType result;
	ObjectsSource* _tmp0_;
	ObjectsSource* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = objects_label_get_source (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_source_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

gint
objects_label_get_label_count (ObjectsLabel* self)
{
	gint result;
	gint* _tmp0_;
	gint* _tmp3_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_label_count;
	if (_tmp0_ == NULL) {
		gint _tmp1_;
		gint* _tmp2_;
		_tmp1_ = objects_label_update_label_count (self);
		_tmp2_ = __int_dup0 (&_tmp1_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp2_;
	}
	_tmp3_ = self->priv->_label_count;
	result = *_tmp3_;
	return result;
}

void
objects_label_set_label_count (ObjectsLabel* self,
                               gint value)
{
	gint* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __int_dup0 (&value);
	_g_free0 (self->priv->_label_count);
	self->priv->_label_count = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, objects_label_properties[OBJECTS_LABEL_LABEL_COUNT_PROPERTY]);
}

const gchar*
objects_label_get_short_name (ObjectsLabel* self)
{
	const gchar* result;
	Util* _tmp0_;
	Util* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = util_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_base_object_get_name ((ObjectsBaseObject*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = util_get_short_name (_tmp1_, _tmp3_, CONSTANTS_SHORT_NAME_SIZE);
	_g_free0 (self->priv->_short_name);
	self->priv->_short_name = _tmp4_;
	_g_object_unref0 (_tmp1_);
	_tmp5_ = self->priv->_short_name;
	result = _tmp5_;
	return result;
}

static void
_objects_label___lambda38_ (ObjectsLabel* self,
                            ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsLabel* _tmp2_;
	ObjectsLabel* _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_get_label (item, _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ != NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		gint _tmp5_;
		gint* _tmp6_;
		_tmp5_ = objects_label_update_label_count (self);
		_tmp6_ = __int_dup0 (&_tmp5_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp6_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda38__services_store_item_added (ServicesStore* _sender,
                                                       ObjectsItem* item,
                                                       gboolean insert,
                                                       gpointer self)
{
	_objects_label___lambda38_ ((ObjectsLabel*) self, item);
}

static void
_objects_label___lambda39_ (ObjectsLabel* self,
                            ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsLabel* _tmp2_;
	ObjectsLabel* _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_get_label (item, _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ != NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		gint _tmp5_;
		gint* _tmp6_;
		_tmp5_ = objects_label_update_label_count (self);
		_tmp6_ = __int_dup0 (&_tmp5_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp6_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda39__services_store_item_deleted (ServicesStore* _sender,
                                                         ObjectsItem* item,
                                                         gpointer self)
{
	_objects_label___lambda39_ ((ObjectsLabel*) self, item);
}

static void
_objects_label___lambda40_ (ObjectsLabel* self,
                            ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsLabel* _tmp2_;
	ObjectsLabel* _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_get_label (item, _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ != NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		gint _tmp5_;
		gint* _tmp6_;
		_tmp5_ = objects_label_update_label_count (self);
		_tmp6_ = __int_dup0 (&_tmp5_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp6_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda40__services_store_item_updated (ServicesStore* _sender,
                                                         ObjectsItem* item,
                                                         const gchar* update_id,
                                                         gpointer self)
{
	_objects_label___lambda40_ ((ObjectsLabel*) self, item);
}

static void
_objects_label___lambda41_ (ObjectsLabel* self,
                            ObjectsLabel* label)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (label != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp1_, _tmp3_) == 0) {
		gint _tmp4_;
		gint* _tmp5_;
		_tmp4_ = objects_label_update_label_count (self);
		_tmp5_ = __int_dup0 (&_tmp4_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp5_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda41__services_store_item_label_added (ServicesStore* _sender,
                                                             ObjectsLabel* label,
                                                             gpointer self)
{
	_objects_label___lambda41_ ((ObjectsLabel*) self, label);
}

static void
_objects_label___lambda42_ (ObjectsLabel* self,
                            ObjectsLabel* label)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (label != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp1_, _tmp3_) == 0) {
		gint _tmp4_;
		gint* _tmp5_;
		_tmp4_ = objects_label_update_label_count (self);
		_tmp5_ = __int_dup0 (&_tmp4_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp5_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda42__services_store_item_label_deleted (ServicesStore* _sender,
                                                               ObjectsLabel* label,
                                                               gpointer self)
{
	_objects_label___lambda42_ ((ObjectsLabel*) self, label);
}

static void
_objects_label___lambda43_ (ObjectsLabel* self,
                            ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	if (objects_item_has_label (item, _tmp1_)) {
		gint _tmp2_;
		gint* _tmp3_;
		_tmp2_ = objects_label_update_label_count (self);
		_tmp3_ = __int_dup0 (&_tmp2_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp3_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda43__services_store_item_archived (ServicesStore* _sender,
                                                          ObjectsItem* item,
                                                          gpointer self)
{
	_objects_label___lambda43_ ((ObjectsLabel*) self, item);
}

static void
_objects_label___lambda44_ (ObjectsLabel* self,
                            ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	if (objects_item_has_label (item, _tmp1_)) {
		gint _tmp2_;
		gint* _tmp3_;
		_tmp2_ = objects_label_update_label_count (self);
		_tmp3_ = __int_dup0 (&_tmp2_);
		_g_free0 (self->priv->_label_count);
		self->priv->_label_count = _tmp3_;
		g_signal_emit (self, objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL], 0);
	}
}

static void
__objects_label___lambda44__services_store_item_unarchived (ServicesStore* _sender,
                                                            ObjectsItem* item,
                                                            gpointer self)
{
	_objects_label___lambda44_ ((ObjectsLabel*) self, item);
}

static GObject *
objects_label_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ObjectsLabel * self;
	ServicesStore* _tmp0_;
	ServicesStore* _tmp1_;
	ServicesStore* _tmp2_;
	ServicesStore* _tmp3_;
	ServicesStore* _tmp4_;
	ServicesStore* _tmp5_;
	ServicesStore* _tmp6_;
	parent_class = G_OBJECT_CLASS (objects_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_LABEL, ObjectsLabel);
	_tmp0_ = services_store_instance ();
	g_signal_connect_object (_tmp0_, "item-added", (GCallback) __objects_label___lambda38__services_store_item_added, self, 0);
	_tmp1_ = services_store_instance ();
	g_signal_connect_object (_tmp1_, "item-deleted", (GCallback) __objects_label___lambda39__services_store_item_deleted, self, 0);
	_tmp2_ = services_store_instance ();
	g_signal_connect_object (_tmp2_, "item-updated", (GCallback) __objects_label___lambda40__services_store_item_updated, self, 0);
	_tmp3_ = services_store_instance ();
	g_signal_connect_object (_tmp3_, "item-label-added", (GCallback) __objects_label___lambda41__services_store_item_label_added, self, 0);
	_tmp4_ = services_store_instance ();
	g_signal_connect_object (_tmp4_, "item-label-deleted", (GCallback) __objects_label___lambda42__services_store_item_label_deleted, self, 0);
	_tmp5_ = services_store_instance ();
	g_signal_connect_object (_tmp5_, "item-archived", (GCallback) __objects_label___lambda43__services_store_item_archived, self, 0);
	_tmp6_ = services_store_instance ();
	g_signal_connect_object (_tmp6_, "item-unarchived", (GCallback) __objects_label___lambda44__services_store_item_unarchived, self, 0);
	return obj;
}

static void
objects_label_class_init (ObjectsLabelClass * klass,
                          gpointer klass_data)
{
	objects_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsLabel_private_offset);
	((ObjectsBaseObjectClass *) klass)->get_add_json = (gchar* (*) (ObjectsBaseObject*, const gchar*, const gchar*)) objects_label_real_get_add_json;
	((ObjectsBaseObjectClass *) klass)->get_update_json = (gchar* (*) (ObjectsBaseObject*, const gchar*, const gchar*)) objects_label_real_get_update_json;
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = objects_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = objects_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_ITEM_ORDER_PROPERTY, objects_label_properties[OBJECTS_LABEL_ITEM_ORDER_PROPERTY] = g_param_spec_int ("item-order", "item-order", "item-order", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_IS_DELETED_PROPERTY, objects_label_properties[OBJECTS_LABEL_IS_DELETED_PROPERTY] = g_param_spec_boolean ("is-deleted", "is-deleted", "is-deleted", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_IS_FAVORITE_PROPERTY, objects_label_properties[OBJECTS_LABEL_IS_FAVORITE_PROPERTY] = g_param_spec_boolean ("is-favorite", "is-favorite", "is-favorite", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_BACKEND_TYPE_PROPERTY, objects_label_properties[OBJECTS_LABEL_BACKEND_TYPE_PROPERTY] = g_param_spec_enum ("backend-type", "backend-type", "backend-type", TYPE_SOURCE_TYPE, SOURCE_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_SOURCE_ID_PROPERTY, objects_label_properties[OBJECTS_LABEL_SOURCE_ID_PROPERTY] = g_param_spec_string ("source-id", "source-id", "source-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_SOURCE_PROPERTY, objects_label_properties[OBJECTS_LABEL_SOURCE_PROPERTY] = g_param_spec_object ("source", "source", "source", OBJECTS_TYPE_SOURCE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_SOURCE_TYPE_PROPERTY, objects_label_properties[OBJECTS_LABEL_SOURCE_TYPE_PROPERTY] = g_param_spec_enum ("source-type", "source-type", "source-type", TYPE_SOURCE_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_LABEL_COUNT_PROPERTY, objects_label_properties[OBJECTS_LABEL_LABEL_COUNT_PROPERTY] = g_param_spec_int ("label-count", "label-count", "label-count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_LABEL_SHORT_NAME_PROPERTY, objects_label_properties[OBJECTS_LABEL_SHORT_NAME_PROPERTY] = g_param_spec_string ("short-name", "short-name", "short-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	objects_label_signals[OBJECTS_LABEL_LABEL_COUNT_UPDATED_SIGNAL] = g_signal_new ("label-count-updated", OBJECTS_TYPE_LABEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
objects_label_instance_init (ObjectsLabel * self,
                             gpointer klass)
{
	gchar* _tmp0_;
	self->priv = objects_label_get_instance_private (self);
	self->priv->_item_order = 0;
	self->priv->_is_deleted = FALSE;
	self->priv->_is_favorite = FALSE;
	self->priv->_backend_type = SOURCE_TYPE_NONE;
	_tmp0_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	self->priv->_source_id = _tmp0_;
	self->priv->_label_count = NULL;
}

static void
objects_label_finalize (GObject * obj)
{
	ObjectsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_LABEL, ObjectsLabel);
	_g_free0 (self->priv->_source_id);
	_g_object_unref0 (self->priv->_source);
	_g_free0 (self->priv->_label_count);
	_g_free0 (self->priv->_short_name);
	G_OBJECT_CLASS (objects_label_parent_class)->finalize (obj);
}

static GType
objects_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsLabel), 0, (GInstanceInitFunc) objects_label_instance_init, NULL };
	GType objects_label_type_id;
	objects_label_type_id = g_type_register_static (OBJECTS_TYPE_BASE_OBJECT, "ObjectsLabel", &g_define_type_info, 0);
	ObjectsLabel_private_offset = g_type_add_instance_private (objects_label_type_id, sizeof (ObjectsLabelPrivate));
	return objects_label_type_id;
}

GType
objects_label_get_type (void)
{
	static volatile gsize objects_label_type_id__once = 0;
	if (g_once_init_enter (&objects_label_type_id__once)) {
		GType objects_label_type_id;
		objects_label_type_id = objects_label_get_type_once ();
		g_once_init_leave (&objects_label_type_id__once, objects_label_type_id);
	}
	return objects_label_type_id__once;
}

static void
_vala_objects_label_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	ObjectsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_LABEL, ObjectsLabel);
	switch (property_id) {
		case OBJECTS_LABEL_ITEM_ORDER_PROPERTY:
		g_value_set_int (value, objects_label_get_item_order (self));
		break;
		case OBJECTS_LABEL_IS_DELETED_PROPERTY:
		g_value_set_boolean (value, objects_label_get_is_deleted (self));
		break;
		case OBJECTS_LABEL_IS_FAVORITE_PROPERTY:
		g_value_set_boolean (value, objects_label_get_is_favorite (self));
		break;
		case OBJECTS_LABEL_BACKEND_TYPE_PROPERTY:
		g_value_set_enum (value, objects_label_get_backend_type (self));
		break;
		case OBJECTS_LABEL_SOURCE_ID_PROPERTY:
		g_value_set_string (value, objects_label_get_source_id (self));
		break;
		case OBJECTS_LABEL_SOURCE_PROPERTY:
		g_value_set_object (value, objects_label_get_source (self));
		break;
		case OBJECTS_LABEL_SOURCE_TYPE_PROPERTY:
		g_value_set_enum (value, objects_label_get_source_type (self));
		break;
		case OBJECTS_LABEL_LABEL_COUNT_PROPERTY:
		g_value_set_int (value, objects_label_get_label_count (self));
		break;
		case OBJECTS_LABEL_SHORT_NAME_PROPERTY:
		g_value_set_string (value, objects_label_get_short_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_label_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	ObjectsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_LABEL, ObjectsLabel);
	switch (property_id) {
		case OBJECTS_LABEL_ITEM_ORDER_PROPERTY:
		objects_label_set_item_order (self, g_value_get_int (value));
		break;
		case OBJECTS_LABEL_IS_DELETED_PROPERTY:
		objects_label_set_is_deleted (self, g_value_get_boolean (value));
		break;
		case OBJECTS_LABEL_IS_FAVORITE_PROPERTY:
		objects_label_set_is_favorite (self, g_value_get_boolean (value));
		break;
		case OBJECTS_LABEL_BACKEND_TYPE_PROPERTY:
		objects_label_set_backend_type (self, g_value_get_enum (value));
		break;
		case OBJECTS_LABEL_SOURCE_ID_PROPERTY:
		objects_label_set_source_id (self, g_value_get_string (value));
		break;
		case OBJECTS_LABEL_LABEL_COUNT_PROPERTY:
		objects_label_set_label_count (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

