/* Priority.c generated by valac 0.56.19, the Vala compiler
 * generated from Priority.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 <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	OBJECTS_FILTERS_PRIORITY_0_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_ICON_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_COLOR_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_TITLE_PROPERTY,
	OBJECTS_FILTERS_PRIORITY_NUM_PROPERTIES
};
static GParamSpec* objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_NUM_PROPERTIES];
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ObjectsFiltersPriorityPrivate {
	gint _priority;
	gint* _count;
};

static gint ObjectsFiltersPriority_private_offset;
static gpointer objects_filters_priority_parent_class = NULL;
static GeeHashMap* objects_filters_priority__instances;
static GeeHashMap* objects_filters_priority__instances = NULL;
static ObjectsFiltersPriority* objects_filters_priority__high_instance;
static ObjectsFiltersPriority* objects_filters_priority__high_instance = NULL;
static ObjectsFiltersPriority* objects_filters_priority__medium_instance;
static ObjectsFiltersPriority* objects_filters_priority__medium_instance = NULL;
static ObjectsFiltersPriority* objects_filters_priority__low_instance;
static ObjectsFiltersPriority* objects_filters_priority__low_instance = NULL;
static ObjectsFiltersPriority* objects_filters_priority__none_instance;
static ObjectsFiltersPriority* objects_filters_priority__none_instance = NULL;

static gchar* objects_filters_priority_get_keywords (ObjectsFiltersPriority* self);
static void objects_filters_priority_real_count_update (ObjectsBaseObject* base);
static gint* _int_dup (gint* self);
static GObject * objects_filters_priority_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _objects_filters_priority___lambda389_ (ObjectsFiltersPriority* self,
                                             ObjectsItem* item,
                                             gboolean updated);
static void __objects_filters_priority___lambda389__services_store_item_added (ServicesStore* _sender,
                                                                        ObjectsItem* item,
                                                                        gboolean insert,
                                                                        gpointer self);
static void _objects_filters_priority___lambda390_ (ObjectsFiltersPriority* self,
                                             ObjectsItem* item);
static void __objects_filters_priority___lambda390__services_store_item_deleted (ServicesStore* _sender,
                                                                          ObjectsItem* item,
                                                                          gpointer self);
static void _objects_filters_priority___lambda391_ (ObjectsFiltersPriority* self,
                                             ObjectsItem* item);
static void __objects_filters_priority___lambda391__services_store_item_archived (ServicesStore* _sender,
                                                                           ObjectsItem* item,
                                                                           gpointer self);
static void _objects_filters_priority___lambda392_ (ObjectsFiltersPriority* self,
                                             ObjectsItem* item);
static void __objects_filters_priority___lambda392__services_store_item_unarchived (ServicesStore* _sender,
                                                                             ObjectsItem* item,
                                                                             gpointer self);
static void _objects_filters_priority___lambda393_ (ObjectsFiltersPriority* self,
                                             ObjectsItem* item,
                                             const gchar* update_id);
static void __objects_filters_priority___lambda393__services_store_item_updated (ServicesStore* _sender,
                                                                          ObjectsItem* item,
                                                                          const gchar* update_id,
                                                                          gpointer self);
static void _objects_filters_priority___lambda394_ (ObjectsFiltersPriority* self,
                                             ObjectsProject* project);
static void __objects_filters_priority___lambda394__services_store_project_updated (ServicesStore* _sender,
                                                                             ObjectsProject* project,
                                                                             gpointer self);
static void objects_filters_priority_finalize (GObject * obj);
static GType objects_filters_priority_get_type_once (void);
static void _vala_objects_filters_priority_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_objects_filters_priority_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_filters_priority_get_instance_private (ObjectsFiltersPriority* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsFiltersPriority_private_offset);
}

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

ObjectsFiltersPriority*
objects_filters_priority_high (void)
{
	ObjectsFiltersPriority* _tmp0_;
	ObjectsFiltersPriority* _tmp2_;
	ObjectsFiltersPriority* _tmp3_;
	ObjectsFiltersPriority* result;
	_tmp0_ = objects_filters_priority__high_instance;
	if (_tmp0_ == NULL) {
		ObjectsFiltersPriority* _tmp1_;
		_tmp1_ = objects_filters_priority_new (OBJECTS_FILTERS_PRIORITY_HIGH);
		_g_object_unref0 (objects_filters_priority__high_instance);
		objects_filters_priority__high_instance = _tmp1_;
	}
	_tmp2_ = objects_filters_priority__high_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

ObjectsFiltersPriority*
objects_filters_priority_medium (void)
{
	ObjectsFiltersPriority* _tmp0_;
	ObjectsFiltersPriority* _tmp2_;
	ObjectsFiltersPriority* _tmp3_;
	ObjectsFiltersPriority* result;
	_tmp0_ = objects_filters_priority__medium_instance;
	if (_tmp0_ == NULL) {
		ObjectsFiltersPriority* _tmp1_;
		_tmp1_ = objects_filters_priority_new (OBJECTS_FILTERS_PRIORITY_MEDIUM);
		_g_object_unref0 (objects_filters_priority__medium_instance);
		objects_filters_priority__medium_instance = _tmp1_;
	}
	_tmp2_ = objects_filters_priority__medium_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

ObjectsFiltersPriority*
objects_filters_priority_low (void)
{
	ObjectsFiltersPriority* _tmp0_;
	ObjectsFiltersPriority* _tmp2_;
	ObjectsFiltersPriority* _tmp3_;
	ObjectsFiltersPriority* result;
	_tmp0_ = objects_filters_priority__low_instance;
	if (_tmp0_ == NULL) {
		ObjectsFiltersPriority* _tmp1_;
		_tmp1_ = objects_filters_priority_new (OBJECTS_FILTERS_PRIORITY_LOW);
		_g_object_unref0 (objects_filters_priority__low_instance);
		objects_filters_priority__low_instance = _tmp1_;
	}
	_tmp2_ = objects_filters_priority__low_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

ObjectsFiltersPriority*
objects_filters_priority_none (void)
{
	ObjectsFiltersPriority* _tmp0_;
	ObjectsFiltersPriority* _tmp2_;
	ObjectsFiltersPriority* _tmp3_;
	ObjectsFiltersPriority* result;
	_tmp0_ = objects_filters_priority__none_instance;
	if (_tmp0_ == NULL) {
		ObjectsFiltersPriority* _tmp1_;
		_tmp1_ = objects_filters_priority_new (OBJECTS_FILTERS_PRIORITY_NONE);
		_g_object_unref0 (objects_filters_priority__none_instance);
		objects_filters_priority__none_instance = _tmp1_;
	}
	_tmp2_ = objects_filters_priority__none_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

ObjectsFiltersPriority*
objects_filters_priority_get_default (gint priority)
{
	GeeHashMap* _tmp0_;
	gboolean _tmp2_ = FALSE;
	GeeHashMap* _tmp3_;
	GeeHashMap* _tmp7_;
	gpointer _tmp8_;
	ObjectsFiltersPriority* result;
	_tmp0_ = objects_filters_priority__instances;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		_tmp1_ = gee_hash_map_new (G_TYPE_INT, NULL, NULL, OBJECTS_FILTERS_TYPE_PRIORITY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (objects_filters_priority__instances);
		objects_filters_priority__instances = _tmp1_;
	}
	if (priority < 1) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = priority > 4;
	}
	if (_tmp2_) {
		g_warning ("Priority.vala:72: Prioridad inválida: %d. Debe estar entre 1 y 4", priority);
		priority = OBJECTS_FILTERS_PRIORITY_NONE;
	}
	_tmp3_ = objects_filters_priority__instances;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, (gpointer) ((gintptr) priority))) {
		GeeHashMap* _tmp4_;
		ObjectsFiltersPriority* _tmp5_;
		ObjectsFiltersPriority* _tmp6_;
		_tmp4_ = objects_filters_priority__instances;
		_tmp5_ = objects_filters_priority_new (priority);
		_tmp6_ = _tmp5_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, (gpointer) ((gintptr) priority), _tmp6_);
		_g_object_unref0 (_tmp6_);
	}
	_tmp7_ = objects_filters_priority__instances;
	_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, (gpointer) ((gintptr) priority));
	result = (ObjectsFiltersPriority*) _tmp8_;
	return result;
}

ObjectsFiltersPriority*
objects_filters_priority_construct (GType object_type,
                                    gint priority)
{
	ObjectsFiltersPriority * self = NULL;
	self = (ObjectsFiltersPriority*) g_object_new (object_type, "priority", priority, NULL);
	return self;
}

ObjectsFiltersPriority*
objects_filters_priority_new (gint priority)
{
	return objects_filters_priority_construct (OBJECTS_FILTERS_TYPE_PRIORITY, priority);
}

static gchar*
objects_filters_priority_get_keywords (ObjectsFiltersPriority* self)
{
	gint _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == OBJECTS_FILTERS_PRIORITY_HIGH) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup_printf ("%s;%s", "p1", _ ("high"));
		result = _tmp1_;
		return result;
	} else {
		gint _tmp2_;
		_tmp2_ = self->priv->_priority;
		if (_tmp2_ == OBJECTS_FILTERS_PRIORITY_MEDIUM) {
			gchar* _tmp3_;
			_tmp3_ = g_strdup_printf ("%s;%s", "p2", _ ("medium"));
			result = _tmp3_;
			return result;
		} else {
			gint _tmp4_;
			_tmp4_ = self->priv->_priority;
			if (_tmp4_ == OBJECTS_FILTERS_PRIORITY_LOW) {
				gchar* _tmp5_;
				_tmp5_ = g_strdup_printf ("%s;%s", "p3", _ ("low"));
				result = _tmp5_;
				return result;
			} else {
				gchar* _tmp6_;
				_tmp6_ = g_strdup_printf ("%s;%s", "p4", _ ("none"));
				result = _tmp6_;
				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;
}

static void
objects_filters_priority_real_count_update (ObjectsBaseObject* base)
{
	ObjectsFiltersPriority * self;
	ServicesStore* _tmp0_;
	gint _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint* _tmp6_;
	self = (ObjectsFiltersPriority*) base;
	_tmp0_ = services_store_instance ();
	_tmp1_ = self->priv->_priority;
	_tmp2_ = services_store_get_items_by_priority (_tmp0_, _tmp1_, FALSE);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = __int_dup0 (&_tmp5_);
	_g_free0 (self->priv->_count);
	self->priv->_count = _tmp6_;
	_g_object_unref0 (_tmp3_);
	g_signal_emit_by_name ((ObjectsBaseObject*) self, "count-updated");
}

gint
objects_filters_priority_get_priority (ObjectsFiltersPriority* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_priority;
	return result;
}

static void
objects_filters_priority_set_priority (ObjectsFiltersPriority* self,
                                       gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_filters_priority_get_priority (self);
	if (old_value != value) {
		self->priv->_priority = value;
		g_object_notify_by_pspec ((GObject *) self, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY]);
	}
}

gint
objects_filters_priority_get_count (ObjectsFiltersPriority* self)
{
	gint result;
	gint* _tmp0_;
	gint* _tmp8_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_count;
	if (_tmp0_ == NULL) {
		ServicesStore* _tmp1_;
		gint _tmp2_;
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint* _tmp7_;
		_tmp1_ = services_store_instance ();
		_tmp2_ = self->priv->_priority;
		_tmp3_ = services_store_get_items_by_priority (_tmp1_, _tmp2_, FALSE);
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = __int_dup0 (&_tmp6_);
		_g_free0 (self->priv->_count);
		self->priv->_count = _tmp7_;
		_g_object_unref0 (_tmp4_);
	}
	_tmp8_ = self->priv->_count;
	result = *_tmp8_;
	return result;
}

void
objects_filters_priority_set_count (ObjectsFiltersPriority* self,
                                    gint value)
{
	gint* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __int_dup0 (&value);
	_g_free0 (self->priv->_count);
	self->priv->_count = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY]);
}

const gchar*
objects_filters_priority_get_icon (ObjectsFiltersPriority* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = "flag-outline-thick-symbolic";
	return result;
}

const gchar*
objects_filters_priority_get_color (ObjectsFiltersPriority* self)
{
	const gchar* result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == OBJECTS_FILTERS_PRIORITY_HIGH) {
		result = "#ff7066";
		return result;
	} else {
		gint _tmp1_;
		_tmp1_ = self->priv->_priority;
		if (_tmp1_ == OBJECTS_FILTERS_PRIORITY_MEDIUM) {
			result = "#ff9914";
			return result;
		} else {
			gint _tmp2_;
			_tmp2_ = self->priv->_priority;
			if (_tmp2_ == OBJECTS_FILTERS_PRIORITY_LOW) {
				result = "#5297ff";
				return result;
			} else {
				const gchar* _tmp3_ = NULL;
				ServicesSettings* _tmp4_;
				ServicesSettings* _tmp5_;
				GSettings* _tmp6_;
				gboolean _tmp7_;
				_tmp4_ = services_settings_get_default ();
				_tmp5_ = _tmp4_;
				_tmp6_ = _tmp5_->settings;
				_tmp7_ = g_settings_get_boolean (_tmp6_, "dark-mode");
				_g_object_unref0 (_tmp5_);
				if (_tmp7_) {
					_tmp3_ = "#fafafa";
				} else {
					_tmp3_ = "#333333";
				}
				result = _tmp3_;
				return result;
			}
		}
	}
}

const gchar*
objects_filters_priority_get_title (ObjectsFiltersPriority* self)
{
	const gchar* result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == OBJECTS_FILTERS_PRIORITY_HIGH) {
		result = _ ("Priority 1: high");
		return result;
	} else {
		gint _tmp1_;
		_tmp1_ = self->priv->_priority;
		if (_tmp1_ == OBJECTS_FILTERS_PRIORITY_MEDIUM) {
			result = _ ("Priority 2: medium");
			return result;
		} else {
			gint _tmp2_;
			_tmp2_ = self->priv->_priority;
			if (_tmp2_ == OBJECTS_FILTERS_PRIORITY_LOW) {
				result = _ ("Priority 3: low");
				return result;
			} else {
				result = _ ("Priority 4: none");
				return result;
			}
		}
	}
}

static void
_objects_filters_priority___lambda389_ (ObjectsFiltersPriority* self,
                                        ObjectsItem* item,
                                        gboolean updated)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_item_get_project (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_freeze_update (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda389__services_store_item_added (ServicesStore* _sender,
                                                                   ObjectsItem* item,
                                                                   gboolean insert,
                                                                   gpointer self)
{
	_objects_filters_priority___lambda389_ ((ObjectsFiltersPriority*) self, item, insert);
}

static void
_objects_filters_priority___lambda390_ (ObjectsFiltersPriority* self,
                                        ObjectsItem* item)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_item_get_project (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_freeze_update (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda390__services_store_item_deleted (ServicesStore* _sender,
                                                                     ObjectsItem* item,
                                                                     gpointer self)
{
	_objects_filters_priority___lambda390_ ((ObjectsFiltersPriority*) self, item);
}

static void
_objects_filters_priority___lambda391_ (ObjectsFiltersPriority* self,
                                        ObjectsItem* item)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_item_get_project (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_freeze_update (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda391__services_store_item_archived (ServicesStore* _sender,
                                                                      ObjectsItem* item,
                                                                      gpointer self)
{
	_objects_filters_priority___lambda391_ ((ObjectsFiltersPriority*) self, item);
}

static void
_objects_filters_priority___lambda392_ (ObjectsFiltersPriority* self,
                                        ObjectsItem* item)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_item_get_project (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_freeze_update (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda392__services_store_item_unarchived (ServicesStore* _sender,
                                                                        ObjectsItem* item,
                                                                        gpointer self)
{
	_objects_filters_priority___lambda392_ ((ObjectsFiltersPriority*) self, item);
}

static void
_objects_filters_priority___lambda393_ (ObjectsFiltersPriority* self,
                                        ObjectsItem* item,
                                        const gchar* update_id)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (update_id != NULL);
	_tmp0_ = objects_item_get_project (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_freeze_update (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda393__services_store_item_updated (ServicesStore* _sender,
                                                                     ObjectsItem* item,
                                                                     const gchar* update_id,
                                                                     gpointer self)
{
	_objects_filters_priority___lambda393_ ((ObjectsFiltersPriority*) self, item, update_id);
}

static void
_objects_filters_priority___lambda394_ (ObjectsFiltersPriority* self,
                                        ObjectsProject* project)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (project != NULL);
	_tmp0_ = objects_project_get_freeze_update (project);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		objects_base_object_count_update ((ObjectsBaseObject*) self);
	}
}

static void
__objects_filters_priority___lambda394__services_store_project_updated (ServicesStore* _sender,
                                                                        ObjectsProject* project,
                                                                        gpointer self)
{
	_objects_filters_priority___lambda394_ ((ObjectsFiltersPriority*) self, project);
}

static GObject *
objects_filters_priority_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ObjectsFiltersPriority * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ServicesStore* _tmp9_;
	ServicesStore* _tmp10_;
	ServicesStore* _tmp11_;
	ServicesStore* _tmp12_;
	ServicesStore* _tmp13_;
	ServicesStore* _tmp14_;
	parent_class = G_OBJECT_CLASS (objects_filters_priority_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_FILTERS_TYPE_PRIORITY, ObjectsFiltersPriority);
	_tmp0_ = objects_filters_priority_get_keywords (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, ";", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, _ ("filters"), NULL);
	_tmp5_ = _tmp4_;
	objects_base_object_set_keywords ((ObjectsBaseObject*) self, _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	_tmp6_ = self->priv->_priority;
	_tmp7_ = g_strdup_printf ("priority-%d", _tmp6_);
	_tmp8_ = _tmp7_;
	objects_base_object_set_view_id ((ObjectsBaseObject*) self, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = services_store_instance ();
	g_signal_connect_object (_tmp9_, "item-added", (GCallback) __objects_filters_priority___lambda389__services_store_item_added, self, 0);
	_tmp10_ = services_store_instance ();
	g_signal_connect_object (_tmp10_, "item-deleted", (GCallback) __objects_filters_priority___lambda390__services_store_item_deleted, self, 0);
	_tmp11_ = services_store_instance ();
	g_signal_connect_object (_tmp11_, "item-archived", (GCallback) __objects_filters_priority___lambda391__services_store_item_archived, self, 0);
	_tmp12_ = services_store_instance ();
	g_signal_connect_object (_tmp12_, "item-unarchived", (GCallback) __objects_filters_priority___lambda392__services_store_item_unarchived, self, 0);
	_tmp13_ = services_store_instance ();
	g_signal_connect_object (_tmp13_, "item-updated", (GCallback) __objects_filters_priority___lambda393__services_store_item_updated, self, 0);
	_tmp14_ = services_store_instance ();
	g_signal_connect_object (_tmp14_, "project-updated", (GCallback) __objects_filters_priority___lambda394__services_store_project_updated, self, 0);
	return obj;
}

static void
objects_filters_priority_class_init (ObjectsFiltersPriorityClass * klass,
                                     gpointer klass_data)
{
	objects_filters_priority_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsFiltersPriority_private_offset);
	((ObjectsBaseObjectClass *) klass)->count_update = (void (*) (ObjectsBaseObject*)) objects_filters_priority_real_count_update;
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_filters_priority_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_filters_priority_set_property;
	G_OBJECT_CLASS (klass)->constructor = objects_filters_priority_constructor;
	G_OBJECT_CLASS (klass)->finalize = objects_filters_priority_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY] = g_param_spec_int ("priority", "priority", "priority", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY] = g_param_spec_int ("count", "count", "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_FILTERS_PRIORITY_ICON_PROPERTY, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_ICON_PROPERTY] = g_param_spec_string ("icon", "icon", "icon", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_FILTERS_PRIORITY_COLOR_PROPERTY, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_COLOR_PROPERTY] = g_param_spec_string ("color", "color", "color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_FILTERS_PRIORITY_TITLE_PROPERTY, objects_filters_priority_properties[OBJECTS_FILTERS_PRIORITY_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
objects_filters_priority_instance_init (ObjectsFiltersPriority * self,
                                        gpointer klass)
{
	self->priv = objects_filters_priority_get_instance_private (self);
	self->priv->_count = NULL;
}

static void
objects_filters_priority_finalize (GObject * obj)
{
	ObjectsFiltersPriority * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_FILTERS_TYPE_PRIORITY, ObjectsFiltersPriority);
	_g_free0 (self->priv->_count);
	G_OBJECT_CLASS (objects_filters_priority_parent_class)->finalize (obj);
}

static GType
objects_filters_priority_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsFiltersPriorityClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_filters_priority_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsFiltersPriority), 0, (GInstanceInitFunc) objects_filters_priority_instance_init, NULL };
	GType objects_filters_priority_type_id;
	objects_filters_priority_type_id = g_type_register_static (OBJECTS_TYPE_BASE_OBJECT, "ObjectsFiltersPriority", &g_define_type_info, 0);
	ObjectsFiltersPriority_private_offset = g_type_add_instance_private (objects_filters_priority_type_id, sizeof (ObjectsFiltersPriorityPrivate));
	return objects_filters_priority_type_id;
}

GType
objects_filters_priority_get_type (void)
{
	static volatile gsize objects_filters_priority_type_id__once = 0;
	if (g_once_init_enter (&objects_filters_priority_type_id__once)) {
		GType objects_filters_priority_type_id;
		objects_filters_priority_type_id = objects_filters_priority_get_type_once ();
		g_once_init_leave (&objects_filters_priority_type_id__once, objects_filters_priority_type_id);
	}
	return objects_filters_priority_type_id__once;
}

static void
_vala_objects_filters_priority_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	ObjectsFiltersPriority * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_FILTERS_TYPE_PRIORITY, ObjectsFiltersPriority);
	switch (property_id) {
		case OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY:
		g_value_set_int (value, objects_filters_priority_get_priority (self));
		break;
		case OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY:
		g_value_set_int (value, objects_filters_priority_get_count (self));
		break;
		case OBJECTS_FILTERS_PRIORITY_ICON_PROPERTY:
		g_value_set_string (value, objects_filters_priority_get_icon (self));
		break;
		case OBJECTS_FILTERS_PRIORITY_COLOR_PROPERTY:
		g_value_set_string (value, objects_filters_priority_get_color (self));
		break;
		case OBJECTS_FILTERS_PRIORITY_TITLE_PROPERTY:
		g_value_set_string (value, objects_filters_priority_get_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_filters_priority_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	ObjectsFiltersPriority * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_FILTERS_TYPE_PRIORITY, ObjectsFiltersPriority);
	switch (property_id) {
		case OBJECTS_FILTERS_PRIORITY_PRIORITY_PROPERTY:
		objects_filters_priority_set_priority (self, g_value_get_int (value));
		break;
		case OBJECTS_FILTERS_PRIORITY_COUNT_PROPERTY:
		objects_filters_priority_set_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;
}

