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

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.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  {
	PROTON_PLUS_MODELS_RELEASE_CATALOG_0_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_VERSION_PROPERTY,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
typedef struct _ProtonPlusModelsReleaseCatalogLoadData ProtonPlusModelsReleaseCatalogLoadData;
typedef struct _ProtonPlusModelsReleaseCatalogRefreshData ProtonPlusModelsReleaseCatalogRefreshData;
typedef struct _ProtonPlusModelsReleaseCatalogLoadMoreData ProtonPlusModelsReleaseCatalogLoadMoreData;
typedef struct _ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData;
typedef struct _ProtonPlusModelsReleaseCatalogFetchPageData ProtonPlusModelsReleaseCatalogFetchPageData;
typedef struct _ProtonPlusModelsReleaseCatalogSaveSnapshotData ProtonPlusModelsReleaseCatalogSaveSnapshotData;
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_CHANGED_SIGNAL,
	PROTON_PLUS_MODELS_RELEASE_CATALOG_NUM_SIGNALS
};
static guint proton_plus_models_release_catalog_signals[PROTON_PLUS_MODELS_RELEASE_CATALOG_NUM_SIGNALS] = {0};

struct _ProtonPlusModelsReleaseCatalogPrivate {
	ProtonPlusModelsProvidersProviderDefinition* definition;
	ProtonPlusProvidersSourcesReleaseSource* release_source;
	ProtonPlusModelsReleaseCatalogCache* cache;
	ProtonPlusModelsRelease* static_release;
	gchar* _last_version;
	GeeLinkedList* _releases;
	gint _page;
	gboolean _has_more;
	gchar* _last_updated;
	gboolean _loading;
};

struct _ProtonPlusModelsReleaseCatalogLoadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	gboolean force_refresh;
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsRelease* _tmp0_;
	GeeLinkedList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	ProtonPlusModelsRelease* _tmp4_;
	GeeLinkedList* _tmp5_;
	GeeLinkedList* _tmp6_;
	GeeLinkedList* _tmp7_;
	ProtonPlusModelsReleaseCatalogResult* _tmp8_;
	gboolean _tmp9_;
	GeeLinkedList* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	GeeLinkedList* _tmp13_;
	ProtonPlusModelsReleaseCatalogResult* _tmp14_;
	gboolean _tmp15_;
	ProtonPlusModelsReleaseCatalogCache* _tmp16_;
	ProtonPlusModelsReleaseCatalogSnapshot* snapshot;
	ProtonPlusModelsReleaseCatalogCache* _tmp17_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp20_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp21_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp22_;
	GeeLinkedList* _tmp23_;
	GeeLinkedList* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp27_;
	GeeLinkedList* _tmp28_;
	GeeLinkedList* _tmp29_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp30_;
	GeeLinkedList* _tmp31_;
	ProtonPlusModelsReleaseCatalogResult* _tmp32_;
	ProtonPlusModelsToolsReleasePageResult* page_result;
	ProtonPlusModelsToolsReleasePageResult* _tmp33_;
	ProtonPlusModelsToolsReleasePageResult* _tmp34_;
	gboolean _tmp35_;
	gboolean _tmp36_;
	ProtonPlusModelsToolsReleasePageResult* _tmp37_;
	ProtonPlusReturnCode _tmp38_;
	ProtonPlusReturnCode _tmp39_;
	GeeLinkedList* _tmp40_;
	ProtonPlusModelsReleaseCatalogResult* _tmp41_;
	ProtonPlusModelsToolsReleasePage* release_page;
	ProtonPlusModelsToolsReleasePageResult* _tmp42_;
	ProtonPlusModelsToolsReleasePage* _tmp43_;
	ProtonPlusModelsToolsReleasePage* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	ProtonPlusModelsToolsReleasePage* _tmp47_;
	gboolean _tmp48_;
	gboolean _tmp49_;
	ProtonPlusModelsToolsReleasePage* _tmp50_;
	GeeLinkedList* _tmp51_;
	GeeLinkedList* _tmp52_;
	gint _tmp53_;
	gint _tmp54_;
	GeeLinkedList* _tmp55_;
	ProtonPlusModelsReleaseCatalogResult* _tmp56_;
	ProtonPlusModelsToolsReleasePage* _tmp57_;
	GeeLinkedList* _tmp58_;
	GeeLinkedList* _tmp59_;
	GDateTime* _tmp60_;
	GDateTime* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	GeeLinkedList* _tmp64_;
	ProtonPlusModelsReleaseCatalogResult* _tmp65_;
};

struct _ProtonPlusModelsReleaseCatalogRefreshData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsReleaseCatalogResult* _tmp0_;
};

struct _ProtonPlusModelsReleaseCatalogLoadMoreData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsRelease* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	ProtonPlusModelsReleaseCatalogResult* _tmp3_;
	ProtonPlusModelsReleaseCatalogResult* _tmp4_;
	ProtonPlusModelsToolsReleasePageResult* page_result;
	gint _tmp5_;
	ProtonPlusModelsToolsReleasePageResult* _tmp6_;
	ProtonPlusModelsToolsReleasePageResult* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	ProtonPlusModelsToolsReleasePageResult* _tmp10_;
	ProtonPlusReturnCode _tmp11_;
	ProtonPlusReturnCode _tmp12_;
	GeeLinkedList* _tmp13_;
	ProtonPlusModelsReleaseCatalogResult* _tmp14_;
	ProtonPlusModelsToolsReleasePage* release_page;
	ProtonPlusModelsToolsReleasePageResult* _tmp15_;
	ProtonPlusModelsToolsReleasePage* _tmp16_;
	GeeLinkedList* _release_list;
	ProtonPlusModelsToolsReleasePage* _tmp17_;
	GeeLinkedList* _tmp18_;
	GeeLinkedList* _tmp19_;
	gint _release_size;
	GeeLinkedList* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	gint _release_index;
	gint _tmp23_;
	gint _tmp24_;
	ProtonPlusModelsRelease* release;
	GeeLinkedList* _tmp25_;
	gpointer _tmp26_;
	GeeLinkedList* _tmp27_;
	ProtonPlusModelsRelease* _tmp28_;
	ProtonPlusModelsToolsReleasePage* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	ProtonPlusModelsToolsReleasePage* _tmp32_;
	gboolean _tmp33_;
	gboolean _tmp34_;
	ProtonPlusModelsToolsReleasePage* _tmp35_;
	GeeLinkedList* _tmp36_;
	GeeLinkedList* _tmp37_;
	ProtonPlusModelsReleaseCatalogResult* _tmp38_;
};

struct _ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	ProtonPlusModelsReleaseLookupResult* result;
	ProtonPlusModelsRelease* _tmp0_;
	ProtonPlusModelsRelease* _tmp1_;
	ProtonPlusModelsReleaseLookupResult* _tmp2_;
	gint requested_page;
	ProtonPlusModelsToolsReleasePageResult* page_result;
	ProtonPlusModelsToolsReleasePageResult* _tmp3_;
	ProtonPlusModelsToolsReleasePageResult* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	ProtonPlusModelsToolsReleasePageResult* _tmp7_;
	ProtonPlusReturnCode _tmp8_;
	ProtonPlusReturnCode _tmp9_;
	ProtonPlusModelsReleaseLookupResult* _tmp10_;
	ProtonPlusModelsToolsReleasePage* release_page;
	ProtonPlusModelsToolsReleasePageResult* _tmp11_;
	ProtonPlusModelsToolsReleasePage* _tmp12_;
	ProtonPlusModelsToolsReleasePage* _tmp13_;
	GeeLinkedList* _tmp14_;
	GeeLinkedList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	ProtonPlusModelsToolsReleasePage* _tmp18_;
	GeeLinkedList* _tmp19_;
	GeeLinkedList* _tmp20_;
	gpointer _tmp21_;
	ProtonPlusModelsRelease* _tmp22_;
	ProtonPlusModelsReleaseLookupResult* _tmp23_;
	ProtonPlusModelsReleaseLookupResult* _tmp24_;
	ProtonPlusModelsToolsReleasePage* _tmp25_;
	gboolean _tmp26_;
	gboolean _tmp27_;
	ProtonPlusModelsReleaseLookupResult* _tmp28_;
	ProtonPlusModelsToolsReleasePage* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
};

struct _ProtonPlusModelsReleaseCatalogFetchPageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	gint requested_page;
	ProtonPlusModelsToolsReleasePageResult* result;
	gboolean _tmp0_;
	ProtonPlusModelsProvidersProviderDefinition* _tmp1_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp2_;
	ProtonPlusModelsToolsReleasePageResult* _tmp3_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp4_;
	ProtonPlusModelsProvidersProviderDefinition* _tmp5_;
	ProtonPlusModelsToolsReleasePageResult* _tmp6_;
};

struct _ProtonPlusModelsReleaseCatalogSaveSnapshotData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsReleaseCatalog* self;
	ProtonPlusModelsReleaseCatalogCache* _tmp0_;
	ProtonPlusModelsReleaseCatalogCache* _tmp1_;
	GeeLinkedList* _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp6_;
	ProtonPlusModelsReleaseCatalogSnapshot* _tmp7_;
};

static gint ProtonPlusModelsReleaseCatalog_private_offset;
static gpointer proton_plus_models_release_catalog_parent_class = NULL;

static void proton_plus_models_release_catalog_load_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_load_co (ProtonPlusModelsReleaseCatalogLoadData* _data_);
static void proton_plus_models_release_catalog_replace_releases (ProtonPlusModelsReleaseCatalog* self,
                                                          GeeIterable* values);
static GeeLinkedList* proton_plus_models_release_catalog_single_release (ProtonPlusModelsReleaseCatalog* self,
                                                                  ProtonPlusModelsRelease* release);
static void proton_plus_models_release_catalog_set_loading (ProtonPlusModelsReleaseCatalog* self,
                                                     gboolean value);
static void proton_plus_models_release_catalog_load_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static gboolean proton_plus_models_release_catalog_cached_releases_match_definition (ProtonPlusModelsReleaseCatalog* self,
                                                                              GeeLinkedList* cached_releases);
static void proton_plus_models_release_catalog_apply_snapshot (ProtonPlusModelsReleaseCatalog* self,
                                                        ProtonPlusModelsReleaseCatalogSnapshot* snapshot);
static void proton_plus_models_release_catalog_fetch_page (ProtonPlusModelsReleaseCatalog* self,
                                                    gint requested_page,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static ProtonPlusModelsToolsReleasePageResult* proton_plus_models_release_catalog_fetch_page_finish (ProtonPlusModelsReleaseCatalog* self,
                                                                                              GAsyncResult* _res_);
static void proton_plus_models_release_catalog_set_page (ProtonPlusModelsReleaseCatalog* self,
                                                  gint value);
static void proton_plus_models_release_catalog_set_has_more (ProtonPlusModelsReleaseCatalog* self,
                                                      gboolean value);
static void proton_plus_models_release_catalog_set_last_updated (ProtonPlusModelsReleaseCatalog* self,
                                                          const gchar* value);
static void proton_plus_models_release_catalog_save_snapshot (ProtonPlusModelsReleaseCatalog* self,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static void proton_plus_models_release_catalog_save_snapshot_finish (ProtonPlusModelsReleaseCatalog* self,
                                                              GAsyncResult* _res_);
static void proton_plus_models_release_catalog_refresh_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_refresh_co (ProtonPlusModelsReleaseCatalogRefreshData* _data_);
static void proton_plus_models_release_catalog_refresh_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
static void proton_plus_models_release_catalog_load_more_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_load_more_co (ProtonPlusModelsReleaseCatalogLoadMoreData* _data_);
static void proton_plus_models_release_catalog_load_more_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
static void proton_plus_models_release_catalog_fetch_latest_eligible_release_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_fetch_latest_eligible_release_co (ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_);
static void proton_plus_models_release_catalog_fetch_latest_eligible_release_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_);
static void proton_plus_models_release_catalog_fetch_page_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_fetch_page_co (ProtonPlusModelsReleaseCatalogFetchPageData* _data_);
static void proton_plus_models_release_catalog_fetch_page_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void proton_plus_models_release_catalog_save_snapshot_data_free (gpointer _data);
static gboolean proton_plus_models_release_catalog_save_snapshot_co (ProtonPlusModelsReleaseCatalogSaveSnapshotData* _data_);
static void proton_plus_models_release_catalog_save_snapshot_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static void proton_plus_models_release_catalog_set_releases (ProtonPlusModelsReleaseCatalog* self,
                                                      GeeLinkedList* value);
static void proton_plus_models_release_catalog_finalize (GObject * obj);
static GType proton_plus_models_release_catalog_get_type_once (void);
static void _vala_proton_plus_models_release_catalog_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_proton_plus_models_release_catalog_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_models_release_catalog_get_instance_private (ProtonPlusModelsReleaseCatalog* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsReleaseCatalog_private_offset);
}

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

ProtonPlusModelsReleaseCatalog*
proton_plus_models_release_catalog_construct (GType object_type,
                                              const gchar* tool_id,
                                              const gchar* tool_title,
                                              ProtonPlusModelsProvidersProviderDefinition* definition,
                                              ProtonPlusProvidersSourcesReleaseSource* release_source)
{
	ProtonPlusModelsReleaseCatalog * self = NULL;
	ProtonPlusModelsProvidersProviderDefinition* _tmp0_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp1_;
	ProtonPlusModelsReleaseCatalogCache* _tmp2_;
	g_return_val_if_fail (tool_id != NULL, NULL);
	g_return_val_if_fail (tool_title != NULL, NULL);
	g_return_val_if_fail (definition != NULL, NULL);
	g_return_val_if_fail (release_source != NULL, NULL);
	self = (ProtonPlusModelsReleaseCatalog*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (definition);
	_g_object_unref0 (self->priv->definition);
	self->priv->definition = _tmp0_;
	_tmp1_ = _g_object_ref0 (release_source);
	_g_object_unref0 (self->priv->release_source);
	self->priv->release_source = _tmp1_;
	_tmp2_ = proton_plus_models_release_catalog_cache_new (tool_id, tool_title);
	_g_object_unref0 (self->priv->cache);
	self->priv->cache = _tmp2_;
	return self;
}

ProtonPlusModelsReleaseCatalog*
proton_plus_models_release_catalog_new (const gchar* tool_id,
                                        const gchar* tool_title,
                                        ProtonPlusModelsProvidersProviderDefinition* definition,
                                        ProtonPlusProvidersSourcesReleaseSource* release_source)
{
	return proton_plus_models_release_catalog_construct (PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, tool_id, tool_title, definition, release_source);
}

ProtonPlusModelsReleaseCatalog*
proton_plus_models_release_catalog_construct_with_static_release (GType object_type,
                                                                  ProtonPlusModelsRelease* release)
{
	ProtonPlusModelsReleaseCatalog * self = NULL;
	ProtonPlusModelsRelease* _tmp0_;
	g_return_val_if_fail (release != NULL, NULL);
	self = (ProtonPlusModelsReleaseCatalog*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (release);
	_g_object_unref0 (self->priv->static_release);
	self->priv->static_release = _tmp0_;
	return self;
}

ProtonPlusModelsReleaseCatalog*
proton_plus_models_release_catalog_new_with_static_release (ProtonPlusModelsRelease* release)
{
	return proton_plus_models_release_catalog_construct_with_static_release (PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, release);
}

static void
proton_plus_models_release_catalog_load_data_free (gpointer _data)
{
	ProtonPlusModelsReleaseCatalogLoadData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsReleaseCatalogLoadData, _data_);
}

void
proton_plus_models_release_catalog_load (ProtonPlusModelsReleaseCatalog* self,
                                         gboolean force_refresh,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogLoadData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogLoadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_load_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->force_refresh = force_refresh;
	proton_plus_models_release_catalog_load_co (_data_);
}

ProtonPlusModelsReleaseCatalogResult*
proton_plus_models_release_catalog_load_finish (ProtonPlusModelsReleaseCatalog* self,
                                                GAsyncResult* _res_)
{
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsReleaseCatalogLoadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_models_release_catalog_load_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogLoadData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_load_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_load_co (ProtonPlusModelsReleaseCatalogLoadData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->static_release;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->_releases;
		_data_->_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		if (_data_->_tmp3_ == 0) {
			_data_->_tmp4_ = _data_->self->priv->static_release;
			_data_->_tmp5_ = proton_plus_models_release_catalog_single_release (_data_->self, _data_->_tmp4_);
			_data_->_tmp6_ = _data_->_tmp5_;
			proton_plus_models_release_catalog_replace_releases (_data_->self, (GeeIterable*) _data_->_tmp6_);
			_g_object_unref0 (_data_->_tmp6_);
		}
		_data_->_tmp7_ = _data_->self->priv->_releases;
		_data_->_tmp8_ = proton_plus_models_release_catalog_result_success (_data_->_tmp7_);
		_data_->result = _data_->_tmp8_;
		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_->_tmp10_ = _data_->self->priv->_releases;
	_data_->_tmp11_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	if (_data_->_tmp12_ > 0) {
		_data_->_tmp9_ = !_data_->force_refresh;
	} else {
		_data_->_tmp9_ = FALSE;
	}
	if (_data_->_tmp9_) {
		_data_->_tmp13_ = _data_->self->priv->_releases;
		_data_->_tmp14_ = proton_plus_models_release_catalog_result_success (_data_->_tmp13_);
		_data_->result = _data_->_tmp14_;
		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;
	}
	proton_plus_models_release_catalog_set_loading (_data_->self, TRUE);
	if (!_data_->force_refresh) {
		_data_->_tmp16_ = _data_->self->priv->cache;
		_data_->_tmp15_ = _data_->_tmp16_ != NULL;
	} else {
		_data_->_tmp15_ = FALSE;
	}
	if (_data_->_tmp15_) {
		_data_->_tmp17_ = _data_->self->priv->cache;
		_data_->_state_ = 1;
		proton_plus_models_release_catalog_cache_load (_data_->_tmp17_, proton_plus_models_release_catalog_load_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp18_ = proton_plus_models_release_catalog_cache_load_finish (_data_->_tmp17_, _data_->_res_);
		_data_->snapshot = _data_->_tmp18_;
		_data_->_tmp21_ = _data_->snapshot;
		if (_data_->_tmp21_ != NULL) {
			_data_->_tmp22_ = _data_->snapshot;
			_data_->_tmp23_ = proton_plus_models_release_catalog_snapshot_get_releases (_data_->_tmp22_);
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_tmp25_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_tmp20_ = _data_->_tmp26_ > 0;
		} else {
			_data_->_tmp20_ = FALSE;
		}
		if (_data_->_tmp20_) {
			_data_->_tmp27_ = _data_->snapshot;
			_data_->_tmp28_ = proton_plus_models_release_catalog_snapshot_get_releases (_data_->_tmp27_);
			_data_->_tmp29_ = _data_->_tmp28_;
			_data_->_tmp19_ = proton_plus_models_release_catalog_cached_releases_match_definition (_data_->self, _data_->_tmp29_);
		} else {
			_data_->_tmp19_ = FALSE;
		}
		if (_data_->_tmp19_) {
			_data_->_tmp30_ = _data_->snapshot;
			proton_plus_models_release_catalog_apply_snapshot (_data_->self, _data_->_tmp30_);
			proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
			_data_->_tmp31_ = _data_->self->priv->_releases;
			_data_->_tmp32_ = proton_plus_models_release_catalog_result_success (_data_->_tmp31_);
			_data_->result = _data_->_tmp32_;
			_g_object_unref0 (_data_->snapshot);
			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;
		}
		_g_object_unref0 (_data_->snapshot);
	}
	_data_->_state_ = 2;
	proton_plus_models_release_catalog_fetch_page (_data_->self, 1, proton_plus_models_release_catalog_load_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp33_ = proton_plus_models_release_catalog_fetch_page_finish (_data_->self, _data_->_res_);
	_data_->page_result = _data_->_tmp33_;
	_data_->_tmp34_ = _data_->page_result;
	_data_->_tmp35_ = proton_plus_models_tools_release_page_result_get_succeeded (_data_->_tmp34_);
	_data_->_tmp36_ = _data_->_tmp35_;
	if (!_data_->_tmp36_) {
		proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
		_data_->_tmp37_ = _data_->page_result;
		_data_->_tmp38_ = proton_plus_models_tools_release_page_result_get_code (_data_->_tmp37_);
		_data_->_tmp39_ = _data_->_tmp38_;
		_data_->_tmp40_ = _data_->self->priv->_releases;
		_data_->_tmp41_ = proton_plus_models_release_catalog_result_failure (_data_->_tmp39_, _data_->_tmp40_);
		_data_->result = _data_->_tmp41_;
		_g_object_unref0 (_data_->page_result);
		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_->_tmp42_ = _data_->page_result;
	_data_->_tmp43_ = proton_plus_models_tools_release_page_result_require_page (_data_->_tmp42_);
	_data_->release_page = _data_->_tmp43_;
	_data_->_tmp44_ = _data_->release_page;
	_data_->_tmp45_ = proton_plus_models_tools_release_page_get_next_page (_data_->_tmp44_);
	_data_->_tmp46_ = _data_->_tmp45_;
	proton_plus_models_release_catalog_set_page (_data_->self, _data_->_tmp46_);
	_data_->_tmp47_ = _data_->release_page;
	_data_->_tmp48_ = proton_plus_models_tools_release_page_get_has_more (_data_->_tmp47_);
	_data_->_tmp49_ = _data_->_tmp48_;
	proton_plus_models_release_catalog_set_has_more (_data_->self, _data_->_tmp49_);
	_data_->_tmp50_ = _data_->release_page;
	_data_->_tmp51_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp50_);
	_data_->_tmp52_ = _data_->_tmp51_;
	_data_->_tmp53_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp52_);
	_data_->_tmp54_ = _data_->_tmp53_;
	if (_data_->_tmp54_ == 0) {
		proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
		_data_->_tmp55_ = _data_->self->priv->_releases;
		_data_->_tmp56_ = proton_plus_models_release_catalog_result_success (_data_->_tmp55_);
		_data_->result = _data_->_tmp56_;
		_g_object_unref0 (_data_->release_page);
		_g_object_unref0 (_data_->page_result);
		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_->_tmp57_ = _data_->release_page;
	_data_->_tmp58_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp57_);
	_data_->_tmp59_ = _data_->_tmp58_;
	proton_plus_models_release_catalog_replace_releases (_data_->self, (GeeIterable*) _data_->_tmp59_);
	_data_->_tmp60_ = g_date_time_new_now_local ();
	_data_->_tmp61_ = _data_->_tmp60_;
	_data_->_tmp62_ = g_date_time_format_iso8601 (_data_->_tmp61_);
	_data_->_tmp63_ = _data_->_tmp62_;
	proton_plus_models_release_catalog_set_last_updated (_data_->self, _data_->_tmp63_);
	_g_free0 (_data_->_tmp63_);
	_g_date_time_unref0 (_data_->_tmp61_);
	_data_->_state_ = 3;
	proton_plus_models_release_catalog_save_snapshot (_data_->self, proton_plus_models_release_catalog_load_ready, _data_);
	return FALSE;
	_state_3:
	proton_plus_models_release_catalog_save_snapshot_finish (_data_->self, _data_->_res_);
	proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
	_data_->_tmp64_ = _data_->self->priv->_releases;
	_data_->_tmp65_ = proton_plus_models_release_catalog_result_success (_data_->_tmp64_);
	_data_->result = _data_->_tmp65_;
	_g_object_unref0 (_data_->release_page);
	_g_object_unref0 (_data_->page_result);
	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
proton_plus_models_release_catalog_refresh_data_free (gpointer _data)
{
	ProtonPlusModelsReleaseCatalogRefreshData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsReleaseCatalogRefreshData, _data_);
}

void
proton_plus_models_release_catalog_refresh (ProtonPlusModelsReleaseCatalog* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogRefreshData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogRefreshData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_refresh_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_release_catalog_refresh_co (_data_);
}

ProtonPlusModelsReleaseCatalogResult*
proton_plus_models_release_catalog_refresh_finish (ProtonPlusModelsReleaseCatalog* self,
                                                   GAsyncResult* _res_)
{
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsReleaseCatalogRefreshData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_models_release_catalog_refresh_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogRefreshData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_refresh_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_refresh_co (ProtonPlusModelsReleaseCatalogRefreshData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	proton_plus_models_release_catalog_load (_data_->self, TRUE, proton_plus_models_release_catalog_refresh_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = proton_plus_models_release_catalog_load_finish (_data_->self, _data_->_res_);
	_data_->result = _data_->_tmp0_;
	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
proton_plus_models_release_catalog_load_more_data_free (gpointer _data)
{
	ProtonPlusModelsReleaseCatalogLoadMoreData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsReleaseCatalogLoadMoreData, _data_);
}

void
proton_plus_models_release_catalog_load_more (ProtonPlusModelsReleaseCatalog* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogLoadMoreData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogLoadMoreData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_load_more_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_release_catalog_load_more_co (_data_);
}

ProtonPlusModelsReleaseCatalogResult*
proton_plus_models_release_catalog_load_more_finish (ProtonPlusModelsReleaseCatalog* self,
                                                     GAsyncResult* _res_)
{
	ProtonPlusModelsReleaseCatalogResult* result;
	ProtonPlusModelsReleaseCatalogLoadMoreData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_models_release_catalog_load_more_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogLoadMoreData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_load_more_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_load_more_co (ProtonPlusModelsReleaseCatalogLoadMoreData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->static_release;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = gee_linked_list_new (PROTON_PLUS_MODELS_TYPE_RELEASE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = proton_plus_models_release_catalog_result_success (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_g_object_unref0 (_data_->_tmp2_);
		_data_->result = _data_->_tmp4_;
		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;
	}
	proton_plus_models_release_catalog_set_loading (_data_->self, TRUE);
	_data_->_tmp5_ = _data_->self->priv->_page;
	_data_->_state_ = 1;
	proton_plus_models_release_catalog_fetch_page (_data_->self, _data_->_tmp5_, proton_plus_models_release_catalog_load_more_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = proton_plus_models_release_catalog_fetch_page_finish (_data_->self, _data_->_res_);
	_data_->page_result = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->page_result;
	_data_->_tmp8_ = proton_plus_models_tools_release_page_result_get_succeeded (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	if (!_data_->_tmp9_) {
		proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
		_data_->_tmp10_ = _data_->page_result;
		_data_->_tmp11_ = proton_plus_models_tools_release_page_result_get_code (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = _data_->self->priv->_releases;
		_data_->_tmp14_ = proton_plus_models_release_catalog_result_failure (_data_->_tmp12_, _data_->_tmp13_);
		_data_->result = _data_->_tmp14_;
		_g_object_unref0 (_data_->page_result);
		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_->_tmp15_ = _data_->page_result;
	_data_->_tmp16_ = proton_plus_models_tools_release_page_result_require_page (_data_->_tmp15_);
	_data_->release_page = _data_->_tmp16_;
	{
		_data_->_tmp17_ = _data_->release_page;
		_data_->_tmp18_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_release_list = _data_->_tmp19_;
		_data_->_tmp20_ = _data_->_release_list;
		_data_->_tmp21_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_release_size = _data_->_tmp22_;
		_data_->_release_index = -1;
		while (TRUE) {
			_data_->_release_index = _data_->_release_index + 1;
			_data_->_tmp23_ = _data_->_release_index;
			_data_->_tmp24_ = _data_->_release_size;
			if (!(_data_->_tmp23_ < _data_->_tmp24_)) {
				break;
			}
			_data_->_tmp25_ = _data_->_release_list;
			_data_->_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp25_, _data_->_release_index);
			_data_->release = (ProtonPlusModelsRelease*) _data_->_tmp26_;
			_data_->_tmp27_ = _data_->self->priv->_releases;
			_data_->_tmp28_ = _data_->release;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp27_, _data_->_tmp28_);
			_g_object_unref0 (_data_->release);
		}
	}
	_data_->_tmp29_ = _data_->release_page;
	_data_->_tmp30_ = proton_plus_models_tools_release_page_get_next_page (_data_->_tmp29_);
	_data_->_tmp31_ = _data_->_tmp30_;
	proton_plus_models_release_catalog_set_page (_data_->self, _data_->_tmp31_);
	_data_->_tmp32_ = _data_->release_page;
	_data_->_tmp33_ = proton_plus_models_tools_release_page_get_has_more (_data_->_tmp32_);
	_data_->_tmp34_ = _data_->_tmp33_;
	proton_plus_models_release_catalog_set_has_more (_data_->self, _data_->_tmp34_);
	_g_free0 (_data_->self->priv->_last_version);
	_data_->self->priv->_last_version = NULL;
	g_signal_emit (_data_->self, proton_plus_models_release_catalog_signals[PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_CHANGED_SIGNAL], 0);
	_data_->_state_ = 2;
	proton_plus_models_release_catalog_save_snapshot (_data_->self, proton_plus_models_release_catalog_load_more_ready, _data_);
	return FALSE;
	_state_2:
	proton_plus_models_release_catalog_save_snapshot_finish (_data_->self, _data_->_res_);
	proton_plus_models_release_catalog_set_loading (_data_->self, FALSE);
	_data_->_tmp35_ = _data_->release_page;
	_data_->_tmp36_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp35_);
	_data_->_tmp37_ = _data_->_tmp36_;
	_data_->_tmp38_ = proton_plus_models_release_catalog_result_success (_data_->_tmp37_);
	_data_->result = _data_->_tmp38_;
	_g_object_unref0 (_data_->release_page);
	_g_object_unref0 (_data_->page_result);
	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
proton_plus_models_release_catalog_fetch_latest_eligible_release_data_free (gpointer _data)
{
	ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData, _data_);
}

void
proton_plus_models_release_catalog_fetch_latest_eligible_release (ProtonPlusModelsReleaseCatalog* self,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_fetch_latest_eligible_release_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_release_catalog_fetch_latest_eligible_release_co (_data_);
}

ProtonPlusModelsReleaseLookupResult*
proton_plus_models_release_catalog_fetch_latest_eligible_release_finish (ProtonPlusModelsReleaseCatalog* self,
                                                                         GAsyncResult* _res_)
{
	ProtonPlusModelsReleaseLookupResult* result;
	ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_models_release_catalog_fetch_latest_eligible_release_ready (GObject* source_object,
                                                                        GAsyncResult* _res_,
                                                                        gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_fetch_latest_eligible_release_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_fetch_latest_eligible_release_co (ProtonPlusModelsReleaseCatalogFetchLatestEligibleReleaseData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->static_release;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->static_release;
		_data_->_tmp2_ = proton_plus_models_release_lookup_result_found (_data_->_tmp1_);
		_data_->result = _data_->_tmp2_;
		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_->requested_page = 1;
	while (TRUE) {
		_data_->_state_ = 1;
		proton_plus_models_release_catalog_fetch_page (_data_->self, _data_->requested_page, proton_plus_models_release_catalog_fetch_latest_eligible_release_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp3_ = proton_plus_models_release_catalog_fetch_page_finish (_data_->self, _data_->_res_);
		_data_->page_result = _data_->_tmp3_;
		_data_->_tmp4_ = _data_->page_result;
		_data_->_tmp5_ = proton_plus_models_tools_release_page_result_get_succeeded (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		if (!_data_->_tmp6_) {
			_data_->_tmp7_ = _data_->page_result;
			_data_->_tmp8_ = proton_plus_models_tools_release_page_result_get_code (_data_->_tmp7_);
			_data_->_tmp9_ = _data_->_tmp8_;
			_data_->_tmp10_ = proton_plus_models_release_lookup_result_failure (_data_->_tmp9_);
			_data_->result = _data_->_tmp10_;
			_g_object_unref0 (_data_->page_result);
			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_->_tmp11_ = _data_->page_result;
		_data_->_tmp12_ = proton_plus_models_tools_release_page_result_require_page (_data_->_tmp11_);
		_data_->release_page = _data_->_tmp12_;
		_data_->_tmp13_ = _data_->release_page;
		_data_->_tmp14_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		if (_data_->_tmp17_ > 0) {
			_data_->_tmp18_ = _data_->release_page;
			_data_->_tmp19_ = proton_plus_models_tools_release_page_get_releases (_data_->_tmp18_);
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp20_, 0);
			_data_->_tmp22_ = (ProtonPlusModelsRelease*) _data_->_tmp21_;
			_data_->_tmp23_ = proton_plus_models_release_lookup_result_found (_data_->_tmp22_);
			_data_->_tmp24_ = _data_->_tmp23_;
			_g_object_unref0 (_data_->_tmp22_);
			_data_->result = _data_->_tmp24_;
			_g_object_unref0 (_data_->release_page);
			_g_object_unref0 (_data_->page_result);
			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_->_tmp25_ = _data_->release_page;
		_data_->_tmp26_ = proton_plus_models_tools_release_page_get_has_more (_data_->_tmp25_);
		_data_->_tmp27_ = _data_->_tmp26_;
		if (!_data_->_tmp27_) {
			_data_->_tmp28_ = proton_plus_models_release_lookup_result_empty ();
			_data_->result = _data_->_tmp28_;
			_g_object_unref0 (_data_->release_page);
			_g_object_unref0 (_data_->page_result);
			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_->_tmp29_ = _data_->release_page;
		_data_->_tmp30_ = proton_plus_models_tools_release_page_get_next_page (_data_->_tmp29_);
		_data_->_tmp31_ = _data_->_tmp30_;
		_data_->requested_page = _data_->_tmp31_;
		_g_object_unref0 (_data_->release_page);
		_g_object_unref0 (_data_->page_result);
	}
}

static void
proton_plus_models_release_catalog_fetch_page_data_free (gpointer _data)
{
	ProtonPlusModelsReleaseCatalogFetchPageData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsReleaseCatalogFetchPageData, _data_);
}

static void
proton_plus_models_release_catalog_fetch_page (ProtonPlusModelsReleaseCatalog* self,
                                               gint requested_page,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogFetchPageData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogFetchPageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_fetch_page_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->requested_page = requested_page;
	proton_plus_models_release_catalog_fetch_page_co (_data_);
}

static ProtonPlusModelsToolsReleasePageResult*
proton_plus_models_release_catalog_fetch_page_finish (ProtonPlusModelsReleaseCatalog* self,
                                                      GAsyncResult* _res_)
{
	ProtonPlusModelsToolsReleasePageResult* result;
	ProtonPlusModelsReleaseCatalogFetchPageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_models_release_catalog_fetch_page_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogFetchPageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_fetch_page_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_fetch_page_co (ProtonPlusModelsReleaseCatalogFetchPageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->definition;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->release_source;
		_data_->_tmp0_ = _data_->_tmp2_ == NULL;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp3_ = proton_plus_models_tools_release_page_result_failure (PROTON_PLUS_RETURN_CODE_INVALID_CONFIGURATION);
		_data_->result = _data_->_tmp3_;
		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_->_tmp4_ = _data_->self->priv->release_source;
	_data_->_tmp5_ = _data_->self->priv->definition;
	_data_->_state_ = 1;
	proton_plus_providers_sources_release_source_fetch_page (_data_->_tmp4_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, ProtonPlusModelsProvidersProviderDefinition), _data_->requested_page, PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASE_PAGE_SIZE, proton_plus_models_release_catalog_fetch_page_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = proton_plus_providers_sources_release_source_fetch_page_finish (_data_->_tmp4_, _data_->_res_);
	_data_->result = _data_->_tmp6_;
	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
proton_plus_models_release_catalog_apply_snapshot (ProtonPlusModelsReleaseCatalog* self,
                                                   ProtonPlusModelsReleaseCatalogSnapshot* snapshot)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GeeLinkedList* _tmp6_;
	GeeLinkedList* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = proton_plus_models_release_catalog_snapshot_get_page (snapshot);
	_tmp1_ = _tmp0_;
	proton_plus_models_release_catalog_set_page (self, _tmp1_);
	_tmp2_ = proton_plus_models_release_catalog_snapshot_get_has_more (snapshot);
	_tmp3_ = _tmp2_;
	proton_plus_models_release_catalog_set_has_more (self, _tmp3_);
	_tmp4_ = proton_plus_models_release_catalog_snapshot_get_last_updated (snapshot);
	_tmp5_ = _tmp4_;
	proton_plus_models_release_catalog_set_last_updated (self, _tmp5_);
	_tmp6_ = proton_plus_models_release_catalog_snapshot_get_releases (snapshot);
	_tmp7_ = _tmp6_;
	proton_plus_models_release_catalog_replace_releases (self, (GeeIterable*) _tmp7_);
}

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

static void
proton_plus_models_release_catalog_save_snapshot (ProtonPlusModelsReleaseCatalog* self,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogSaveSnapshotData* _data_;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsReleaseCatalogSaveSnapshotData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_release_catalog_save_snapshot_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_release_catalog_save_snapshot_co (_data_);
}

static void
proton_plus_models_release_catalog_save_snapshot_finish (ProtonPlusModelsReleaseCatalog* self,
                                                         GAsyncResult* _res_)
{
	ProtonPlusModelsReleaseCatalogSaveSnapshotData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
proton_plus_models_release_catalog_save_snapshot_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	ProtonPlusModelsReleaseCatalogSaveSnapshotData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_release_catalog_save_snapshot_co (_data_);
}

static gboolean
proton_plus_models_release_catalog_save_snapshot_co (ProtonPlusModelsReleaseCatalogSaveSnapshotData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->cache;
	if (_data_->_tmp0_ == 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;
	}
	_data_->_tmp1_ = _data_->self->priv->cache;
	_data_->_tmp2_ = _data_->self->priv->_releases;
	_data_->_tmp3_ = _data_->self->priv->_page;
	_data_->_tmp4_ = _data_->self->priv->_has_more;
	_data_->_tmp5_ = _data_->self->priv->_last_updated;
	_data_->_tmp6_ = proton_plus_models_release_catalog_snapshot_new (_data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_state_ = 1;
	proton_plus_models_release_catalog_cache_save (_data_->_tmp1_, _data_->_tmp7_, proton_plus_models_release_catalog_save_snapshot_ready, _data_);
	return FALSE;
	_state_1:
	proton_plus_models_release_catalog_cache_save_finish (_data_->_tmp1_, _data_->_res_);
	_g_object_unref0 (_data_->_tmp7_);
	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
proton_plus_models_release_catalog_replace_releases (ProtonPlusModelsReleaseCatalog* self,
                                                     GeeIterable* values)
{
	GeeLinkedList* replacement = NULL;
	GeeLinkedList* _tmp0_;
	GeeLinkedList* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (values != NULL);
	_tmp0_ = gee_linked_list_new (PROTON_PLUS_MODELS_TYPE_RELEASE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	replacement = _tmp0_;
	{
		GeeIterator* _release_it = NULL;
		GeeIterator* _tmp1_;
		_tmp1_ = gee_iterable_iterator (values);
		_release_it = _tmp1_;
		while (TRUE) {
			GeeIterator* _tmp2_;
			ProtonPlusModelsRelease* release = NULL;
			GeeIterator* _tmp3_;
			gpointer _tmp4_;
			GeeLinkedList* _tmp5_;
			ProtonPlusModelsRelease* _tmp6_;
			_tmp2_ = _release_it;
			if (!gee_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = _release_it;
			_tmp4_ = gee_iterator_get (_tmp3_);
			release = (ProtonPlusModelsRelease*) _tmp4_;
			_tmp5_ = replacement;
			_tmp6_ = release;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, _tmp6_);
			_g_object_unref0 (release);
		}
		_g_object_unref0 (_release_it);
	}
	_tmp7_ = replacement;
	proton_plus_models_release_catalog_set_releases (self, _tmp7_);
	_g_free0 (self->priv->_last_version);
	self->priv->_last_version = NULL;
	g_signal_emit (self, proton_plus_models_release_catalog_signals[PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_CHANGED_SIGNAL], 0);
	_g_object_unref0 (replacement);
}

static GeeLinkedList*
proton_plus_models_release_catalog_single_release (ProtonPlusModelsReleaseCatalog* self,
                                                   ProtonPlusModelsRelease* release)
{
	GeeLinkedList* values = NULL;
	GeeLinkedList* _tmp0_;
	GeeLinkedList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (release != NULL, NULL);
	_tmp0_ = gee_linked_list_new (PROTON_PLUS_MODELS_TYPE_RELEASE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	values = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) values, release);
	result = values;
	return result;
}

static gboolean
proton_plus_models_release_catalog_cached_releases_match_definition (ProtonPlusModelsReleaseCatalog* self,
                                                                     GeeLinkedList* cached_releases)
{
	ProtonPlusModelsProvidersProviderDefinition* _tmp0_;
	ProtonPlusModelsProvidersVariantDefinition** configured_variants = NULL;
	ProtonPlusModelsProvidersProviderDefinition* _tmp1_;
	gint _tmp2_ = 0;
	ProtonPlusModelsProvidersVariantDefinition** _tmp3_;
	gint configured_variants_length1;
	gint _configured_variants_size_;
	ProtonPlusModelsProvidersVariantDefinition** _tmp4_;
	gint _tmp4__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (cached_releases != NULL, FALSE);
	_tmp0_ = self->priv->definition;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->definition;
	_tmp3_ = proton_plus_models_providers_provider_definition_get_variants (_tmp1_, &_tmp2_);
	configured_variants = _tmp3_;
	configured_variants_length1 = _tmp2_;
	_configured_variants_size_ = configured_variants_length1;
	_tmp4_ = configured_variants;
	_tmp4__length1 = configured_variants_length1;
	if (_tmp4__length1 == 0) {
		result = TRUE;
		configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
		return result;
	}
	{
		GeeLinkedList* _cached_release_list = NULL;
		gint _cached_release_size = 0;
		GeeLinkedList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _cached_release_index = 0;
		_cached_release_list = cached_releases;
		_tmp5_ = _cached_release_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_cached_release_size = _tmp7_;
		_cached_release_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			ProtonPlusModelsRelease* cached_release = NULL;
			GeeLinkedList* _tmp10_;
			gpointer _tmp11_;
			const gchar* _tmp12_ = NULL;
			ProtonPlusModelsRelease* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			gchar* release_title = NULL;
			gchar* _tmp22_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp23_;
			const gchar* _tmp24_;
			ProtonPlusModelsRelease* _tmp25_;
			GeeLinkedList* _tmp26_;
			GeeLinkedList* _tmp27_;
			gint _tmp28_;
			gint _tmp29_;
			ProtonPlusModelsProvidersVariantDefinition** _tmp30_;
			gint _tmp30__length1;
			_cached_release_index = _cached_release_index + 1;
			_tmp8_ = _cached_release_index;
			_tmp9_ = _cached_release_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _cached_release_list;
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _cached_release_index);
			cached_release = (ProtonPlusModelsRelease*) _tmp11_;
			_tmp13_ = cached_release;
			_tmp14_ = proton_plus_models_release_get_source_tag (_tmp13_);
			_tmp15_ = _tmp14_;
			if (g_strcmp0 (_tmp15_, "") != 0) {
				ProtonPlusModelsRelease* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				_tmp16_ = cached_release;
				_tmp17_ = proton_plus_models_release_get_source_tag (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp12_ = _tmp18_;
			} else {
				ProtonPlusModelsRelease* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				_tmp19_ = cached_release;
				_tmp20_ = proton_plus_models_release_get_title (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp12_ = _tmp21_;
			}
			_tmp22_ = g_strdup (_tmp12_);
			release_title = _tmp22_;
			_tmp23_ = self->priv->definition;
			_tmp24_ = release_title;
			if (!proton_plus_providers_sources_catalog_release_builder_is_eligible (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, ProtonPlusModelsProvidersProviderDefinition), _tmp24_)) {
				result = FALSE;
				_g_free0 (release_title);
				_g_object_unref0 (cached_release);
				configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
				return result;
			}
			_tmp25_ = cached_release;
			_tmp26_ = proton_plus_models_release_get_variants (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = configured_variants;
			_tmp30__length1 = configured_variants_length1;
			if (_tmp29_ != _tmp30__length1) {
				result = FALSE;
				_g_free0 (release_title);
				_g_object_unref0 (cached_release);
				configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
				return result;
			}
			{
				gint index = 0;
				index = 0;
				{
					gboolean _tmp31_ = FALSE;
					_tmp31_ = TRUE;
					while (TRUE) {
						ProtonPlusModelsProvidersVariantDefinition** _tmp33_;
						gint _tmp33__length1;
						ProtonPlusModelsProvidersVariantDefinition* configured_variant = NULL;
						ProtonPlusModelsProvidersVariantDefinition** _tmp34_;
						gint _tmp34__length1;
						ProtonPlusModelsProvidersVariantDefinition* _tmp35_;
						ProtonPlusModelsProvidersVariantDefinition* _tmp36_;
						ProtonPlusModelsVariant* cached_variant = NULL;
						ProtonPlusModelsRelease* _tmp37_;
						GeeLinkedList* _tmp38_;
						GeeLinkedList* _tmp39_;
						gpointer _tmp40_;
						gboolean _tmp41_ = FALSE;
						gboolean _tmp42_ = FALSE;
						gboolean _tmp43_ = FALSE;
						ProtonPlusModelsVariant* _tmp44_;
						const gchar* _tmp45_;
						const gchar* _tmp46_;
						ProtonPlusModelsProvidersVariantDefinition* _tmp47_;
						const gchar* _tmp48_;
						const gchar* _tmp49_;
						if (!_tmp31_) {
							gint _tmp32_;
							_tmp32_ = index;
							index = _tmp32_ + 1;
						}
						_tmp31_ = FALSE;
						_tmp33_ = configured_variants;
						_tmp33__length1 = configured_variants_length1;
						if (!(index < _tmp33__length1)) {
							break;
						}
						_tmp34_ = configured_variants;
						_tmp34__length1 = configured_variants_length1;
						_tmp35_ = _tmp34_[index];
						_tmp36_ = _g_object_ref0 (_tmp35_);
						configured_variant = _tmp36_;
						_tmp37_ = cached_release;
						_tmp38_ = proton_plus_models_release_get_variants (_tmp37_);
						_tmp39_ = _tmp38_;
						_tmp40_ = gee_abstract_list_get ((GeeAbstractList*) _tmp39_, index);
						cached_variant = (ProtonPlusModelsVariant*) _tmp40_;
						_tmp44_ = cached_variant;
						_tmp45_ = proton_plus_models_variant_get_name (_tmp44_);
						_tmp46_ = _tmp45_;
						_tmp47_ = configured_variant;
						_tmp48_ = proton_plus_models_providers_variant_definition_get_name (_tmp47_);
						_tmp49_ = _tmp48_;
						if (g_strcmp0 (_tmp46_, _tmp49_) != 0) {
							_tmp43_ = TRUE;
						} else {
							ProtonPlusModelsVariant* _tmp50_;
							const gchar* _tmp51_;
							const gchar* _tmp52_;
							ProtonPlusModelsProvidersVariantDefinition* _tmp53_;
							const gchar* _tmp54_;
							const gchar* _tmp55_;
							_tmp50_ = cached_variant;
							_tmp51_ = proton_plus_models_variant_get_format (_tmp50_);
							_tmp52_ = _tmp51_;
							_tmp53_ = configured_variant;
							_tmp54_ = proton_plus_models_providers_variant_definition_get_format (_tmp53_);
							_tmp55_ = _tmp54_;
							_tmp43_ = g_strcmp0 (_tmp52_, _tmp55_) != 0;
						}
						if (_tmp43_) {
							_tmp42_ = TRUE;
						} else {
							ProtonPlusModelsVariant* _tmp56_;
							gboolean _tmp57_;
							gboolean _tmp58_;
							ProtonPlusModelsProvidersVariantDefinition* _tmp59_;
							gboolean _tmp60_;
							gboolean _tmp61_;
							_tmp56_ = cached_variant;
							_tmp57_ = proton_plus_models_variant_get_is_default (_tmp56_);
							_tmp58_ = _tmp57_;
							_tmp59_ = configured_variant;
							_tmp60_ = proton_plus_models_providers_variant_definition_get_is_default (_tmp59_);
							_tmp61_ = _tmp60_;
							_tmp42_ = _tmp58_ != _tmp61_;
						}
						if (_tmp42_) {
							_tmp41_ = TRUE;
						} else {
							ProtonPlusModelsVariant* _tmp62_;
							ProtonPlusModelsVariantCompatibility* _tmp63_;
							ProtonPlusModelsVariantCompatibility* _tmp64_;
							ProtonPlusModelsProvidersVariantDefinition* _tmp65_;
							ProtonPlusModelsVariantCompatibility* _tmp66_;
							ProtonPlusModelsVariantCompatibility* _tmp67_;
							_tmp62_ = cached_variant;
							_tmp63_ = proton_plus_models_variant_get_compatibility (_tmp62_);
							_tmp64_ = _tmp63_;
							_tmp65_ = configured_variant;
							_tmp66_ = proton_plus_models_providers_variant_definition_get_compatibility (_tmp65_);
							_tmp67_ = _tmp66_;
							_tmp41_ = !proton_plus_models_variant_compatibility_equals (_tmp64_, _tmp67_);
						}
						if (_tmp41_) {
							result = FALSE;
							_g_object_unref0 (cached_variant);
							_g_object_unref0 (configured_variant);
							_g_free0 (release_title);
							_g_object_unref0 (cached_release);
							configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
							return result;
						}
						_g_object_unref0 (cached_variant);
						_g_object_unref0 (configured_variant);
					}
				}
			}
			{
				GeeLinkedList* _cached_variant_list = NULL;
				ProtonPlusModelsRelease* _tmp68_;
				GeeLinkedList* _tmp69_;
				GeeLinkedList* _tmp70_;
				gint _cached_variant_size = 0;
				GeeLinkedList* _tmp71_;
				gint _tmp72_;
				gint _tmp73_;
				gint _cached_variant_index = 0;
				_tmp68_ = cached_release;
				_tmp69_ = proton_plus_models_release_get_variants (_tmp68_);
				_tmp70_ = _tmp69_;
				_cached_variant_list = _tmp70_;
				_tmp71_ = _cached_variant_list;
				_tmp72_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp71_);
				_tmp73_ = _tmp72_;
				_cached_variant_size = _tmp73_;
				_cached_variant_index = -1;
				while (TRUE) {
					gint _tmp74_;
					gint _tmp75_;
					ProtonPlusModelsVariant* cached_variant = NULL;
					GeeLinkedList* _tmp76_;
					gpointer _tmp77_;
					gboolean _tmp78_ = FALSE;
					ProtonPlusModelsVariant* _tmp79_;
					gboolean _tmp80_;
					gboolean _tmp81_;
					gboolean _tmp89_ = FALSE;
					ProtonPlusModelsVariant* _tmp90_;
					gboolean _tmp91_;
					gboolean _tmp92_;
					gboolean _tmp101_ = FALSE;
					gboolean _tmp102_ = FALSE;
					ProtonPlusModelsVariant* _tmp103_;
					gboolean _tmp104_;
					gboolean _tmp105_;
					_cached_variant_index = _cached_variant_index + 1;
					_tmp74_ = _cached_variant_index;
					_tmp75_ = _cached_variant_size;
					if (!(_tmp74_ < _tmp75_)) {
						break;
					}
					_tmp76_ = _cached_variant_list;
					_tmp77_ = gee_abstract_list_get ((GeeAbstractList*) _tmp76_, _cached_variant_index);
					cached_variant = (ProtonPlusModelsVariant*) _tmp77_;
					_tmp79_ = cached_variant;
					_tmp80_ = proton_plus_models_variant_get_is_default (_tmp79_);
					_tmp81_ = _tmp80_;
					if (_tmp81_) {
						gboolean _tmp82_ = FALSE;
						ProtonPlusModelsVariant* _tmp83_;
						const gchar* _tmp84_;
						const gchar* _tmp85_;
						_tmp83_ = cached_variant;
						_tmp84_ = proton_plus_models_variant_get_download_url (_tmp83_);
						_tmp85_ = _tmp84_;
						if (_tmp85_ == NULL) {
							_tmp82_ = TRUE;
						} else {
							ProtonPlusModelsVariant* _tmp86_;
							const gchar* _tmp87_;
							const gchar* _tmp88_;
							_tmp86_ = cached_variant;
							_tmp87_ = proton_plus_models_variant_get_download_url (_tmp86_);
							_tmp88_ = _tmp87_;
							_tmp82_ = g_strcmp0 (_tmp88_, "") == 0;
						}
						_tmp78_ = _tmp82_;
					} else {
						_tmp78_ = FALSE;
					}
					if (_tmp78_) {
						result = FALSE;
						_g_object_unref0 (cached_variant);
						_g_free0 (release_title);
						_g_object_unref0 (cached_release);
						configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
						return result;
					}
					_tmp90_ = cached_variant;
					_tmp91_ = proton_plus_models_variant_get_is_default (_tmp90_);
					_tmp92_ = _tmp91_;
					if (_tmp92_) {
						ProtonPlusModelsRelease* _tmp93_;
						ProtonPlusModelsAssetsAsset* _tmp94_;
						ProtonPlusModelsAssetsAsset* _tmp95_;
						const gchar* _tmp96_;
						const gchar* _tmp97_;
						ProtonPlusModelsVariant* _tmp98_;
						const gchar* _tmp99_;
						const gchar* _tmp100_;
						_tmp93_ = cached_release;
						_tmp94_ = proton_plus_models_release_get_asset (_tmp93_);
						_tmp95_ = _tmp94_;
						_tmp96_ = proton_plus_models_assets_asset_get_download_url (_tmp95_);
						_tmp97_ = _tmp96_;
						_tmp98_ = cached_variant;
						_tmp99_ = proton_plus_models_variant_get_download_url (_tmp98_);
						_tmp100_ = _tmp99_;
						_tmp89_ = g_strcmp0 (_tmp97_, _tmp100_) != 0;
					} else {
						_tmp89_ = FALSE;
					}
					if (_tmp89_) {
						result = FALSE;
						_g_object_unref0 (cached_variant);
						_g_free0 (release_title);
						_g_object_unref0 (cached_release);
						configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
						return result;
					}
					_tmp103_ = cached_variant;
					_tmp104_ = proton_plus_models_variant_get_is_default (_tmp103_);
					_tmp105_ = _tmp104_;
					if (_tmp105_) {
						ProtonPlusModelsProvidersProviderDefinition* _tmp106_;
						gboolean _tmp107_;
						gboolean _tmp108_;
						_tmp106_ = self->priv->definition;
						_tmp107_ = proton_plus_models_providers_provider_definition_get_single_archive_releases (_tmp106_);
						_tmp108_ = _tmp107_;
						_tmp102_ = !_tmp108_;
					} else {
						_tmp102_ = FALSE;
					}
					if (_tmp102_) {
						ProtonPlusModelsProvidersProviderDefinition* _tmp109_;
						ProtonPlusModelsRelease* _tmp110_;
						const gchar* _tmp111_;
						const gchar* _tmp112_;
						ProtonPlusModelsRelease* _tmp113_;
						const gchar* _tmp114_;
						const gchar* _tmp115_;
						ProtonPlusModelsRelease* _tmp116_;
						ProtonPlusModelsAssetsAsset* _tmp117_;
						ProtonPlusModelsAssetsAsset* _tmp118_;
						_tmp109_ = self->priv->definition;
						_tmp110_ = cached_release;
						_tmp111_ = proton_plus_models_release_get_title (_tmp110_);
						_tmp112_ = _tmp111_;
						_tmp113_ = cached_release;
						_tmp114_ = proton_plus_models_release_get_source_tag (_tmp113_);
						_tmp115_ = _tmp114_;
						_tmp116_ = cached_release;
						_tmp117_ = proton_plus_models_release_get_asset (_tmp116_);
						_tmp118_ = _tmp117_;
						_tmp101_ = !proton_plus_providers_sources_catalog_release_builder_default_variant_matches_asset (_tmp109_, _tmp112_, _tmp115_, _tmp118_);
					} else {
						_tmp101_ = FALSE;
					}
					if (_tmp101_) {
						result = FALSE;
						_g_object_unref0 (cached_variant);
						_g_free0 (release_title);
						_g_object_unref0 (cached_release);
						configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
						return result;
					}
					_g_object_unref0 (cached_variant);
				}
			}
			{
				gint left_index = 0;
				left_index = 0;
				{
					gboolean _tmp119_ = FALSE;
					_tmp119_ = TRUE;
					while (TRUE) {
						ProtonPlusModelsRelease* _tmp121_;
						GeeLinkedList* _tmp122_;
						GeeLinkedList* _tmp123_;
						gint _tmp124_;
						gint _tmp125_;
						ProtonPlusModelsVariant* left = NULL;
						ProtonPlusModelsRelease* _tmp126_;
						GeeLinkedList* _tmp127_;
						GeeLinkedList* _tmp128_;
						gpointer _tmp129_;
						gboolean _tmp130_ = FALSE;
						ProtonPlusModelsVariant* _tmp131_;
						const gchar* _tmp132_;
						const gchar* _tmp133_;
						if (!_tmp119_) {
							gint _tmp120_;
							_tmp120_ = left_index;
							left_index = _tmp120_ + 1;
						}
						_tmp119_ = FALSE;
						_tmp121_ = cached_release;
						_tmp122_ = proton_plus_models_release_get_variants (_tmp121_);
						_tmp123_ = _tmp122_;
						_tmp124_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp123_);
						_tmp125_ = _tmp124_;
						if (!(left_index < (_tmp125_ - 1))) {
							break;
						}
						_tmp126_ = cached_release;
						_tmp127_ = proton_plus_models_release_get_variants (_tmp126_);
						_tmp128_ = _tmp127_;
						_tmp129_ = gee_abstract_list_get ((GeeAbstractList*) _tmp128_, left_index);
						left = (ProtonPlusModelsVariant*) _tmp129_;
						_tmp131_ = left;
						_tmp132_ = proton_plus_models_variant_get_download_url (_tmp131_);
						_tmp133_ = _tmp132_;
						if (_tmp133_ == NULL) {
							_tmp130_ = TRUE;
						} else {
							ProtonPlusModelsVariant* _tmp134_;
							const gchar* _tmp135_;
							const gchar* _tmp136_;
							_tmp134_ = left;
							_tmp135_ = proton_plus_models_variant_get_download_url (_tmp134_);
							_tmp136_ = _tmp135_;
							_tmp130_ = g_strcmp0 (_tmp136_, "") == 0;
						}
						if (_tmp130_) {
							_g_object_unref0 (left);
							continue;
						}
						{
							gint right_index = 0;
							right_index = left_index + 1;
							{
								gboolean _tmp137_ = FALSE;
								_tmp137_ = TRUE;
								while (TRUE) {
									ProtonPlusModelsRelease* _tmp139_;
									GeeLinkedList* _tmp140_;
									GeeLinkedList* _tmp141_;
									gint _tmp142_;
									gint _tmp143_;
									ProtonPlusModelsVariant* right = NULL;
									ProtonPlusModelsRelease* _tmp144_;
									GeeLinkedList* _tmp145_;
									GeeLinkedList* _tmp146_;
									gpointer _tmp147_;
									gboolean _tmp148_ = FALSE;
									ProtonPlusModelsVariant* _tmp149_;
									const gchar* _tmp150_;
									const gchar* _tmp151_;
									gboolean _tmp155_ = FALSE;
									ProtonPlusModelsVariant* _tmp156_;
									const gchar* _tmp157_;
									const gchar* _tmp158_;
									ProtonPlusModelsVariant* _tmp159_;
									const gchar* _tmp160_;
									const gchar* _tmp161_;
									if (!_tmp137_) {
										gint _tmp138_;
										_tmp138_ = right_index;
										right_index = _tmp138_ + 1;
									}
									_tmp137_ = FALSE;
									_tmp139_ = cached_release;
									_tmp140_ = proton_plus_models_release_get_variants (_tmp139_);
									_tmp141_ = _tmp140_;
									_tmp142_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp141_);
									_tmp143_ = _tmp142_;
									if (!(right_index < _tmp143_)) {
										break;
									}
									_tmp144_ = cached_release;
									_tmp145_ = proton_plus_models_release_get_variants (_tmp144_);
									_tmp146_ = _tmp145_;
									_tmp147_ = gee_abstract_list_get ((GeeAbstractList*) _tmp146_, right_index);
									right = (ProtonPlusModelsVariant*) _tmp147_;
									_tmp149_ = right;
									_tmp150_ = proton_plus_models_variant_get_download_url (_tmp149_);
									_tmp151_ = _tmp150_;
									if (_tmp151_ == NULL) {
										_tmp148_ = TRUE;
									} else {
										ProtonPlusModelsVariant* _tmp152_;
										const gchar* _tmp153_;
										const gchar* _tmp154_;
										_tmp152_ = right;
										_tmp153_ = proton_plus_models_variant_get_download_url (_tmp152_);
										_tmp154_ = _tmp153_;
										_tmp148_ = g_strcmp0 (_tmp154_, "") == 0;
									}
									if (_tmp148_) {
										_g_object_unref0 (right);
										continue;
									}
									_tmp156_ = left;
									_tmp157_ = proton_plus_models_variant_get_format (_tmp156_);
									_tmp158_ = _tmp157_;
									_tmp159_ = right;
									_tmp160_ = proton_plus_models_variant_get_format (_tmp159_);
									_tmp161_ = _tmp160_;
									if (g_strcmp0 (_tmp158_, _tmp161_) != 0) {
										ProtonPlusModelsVariant* _tmp162_;
										const gchar* _tmp163_;
										const gchar* _tmp164_;
										ProtonPlusModelsVariant* _tmp165_;
										const gchar* _tmp166_;
										const gchar* _tmp167_;
										_tmp162_ = left;
										_tmp163_ = proton_plus_models_variant_get_download_url (_tmp162_);
										_tmp164_ = _tmp163_;
										_tmp165_ = right;
										_tmp166_ = proton_plus_models_variant_get_download_url (_tmp165_);
										_tmp167_ = _tmp166_;
										_tmp155_ = g_strcmp0 (_tmp164_, _tmp167_) == 0;
									} else {
										_tmp155_ = FALSE;
									}
									if (_tmp155_) {
										result = FALSE;
										_g_object_unref0 (right);
										_g_object_unref0 (left);
										_g_free0 (release_title);
										_g_object_unref0 (cached_release);
										configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
										return result;
									}
									_g_object_unref0 (right);
								}
							}
						}
						_g_object_unref0 (left);
					}
				}
			}
			_g_free0 (release_title);
			_g_object_unref0 (cached_release);
		}
	}
	result = TRUE;
	configured_variants = (_vala_array_free (configured_variants, configured_variants_length1, (GDestroyNotify) g_object_unref), NULL);
	return result;
}

GeeLinkedList*
proton_plus_models_release_catalog_get_releases (ProtonPlusModelsReleaseCatalog* self)
{
	GeeLinkedList* result;
	GeeLinkedList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_releases;
	result = _tmp0_;
	return result;
}

static void
proton_plus_models_release_catalog_set_releases (ProtonPlusModelsReleaseCatalog* self,
                                                 GeeLinkedList* value)
{
	GeeLinkedList* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_release_catalog_get_releases (self);
	if (old_value != value) {
		GeeLinkedList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_releases);
		self->priv->_releases = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY]);
	}
}

gint
proton_plus_models_release_catalog_get_page (ProtonPlusModelsReleaseCatalog* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_page;
	return result;
}

static void
proton_plus_models_release_catalog_set_page (ProtonPlusModelsReleaseCatalog* self,
                                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_release_catalog_get_page (self);
	if (old_value != value) {
		self->priv->_page = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY]);
	}
}

gboolean
proton_plus_models_release_catalog_get_has_more (ProtonPlusModelsReleaseCatalog* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_more;
	return result;
}

static void
proton_plus_models_release_catalog_set_has_more (ProtonPlusModelsReleaseCatalog* self,
                                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_release_catalog_get_has_more (self);
	if (old_value != value) {
		self->priv->_has_more = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY]);
	}
}

const gchar*
proton_plus_models_release_catalog_get_last_updated (ProtonPlusModelsReleaseCatalog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_last_updated;
	result = _tmp0_;
	return result;
}

static void
proton_plus_models_release_catalog_set_last_updated (ProtonPlusModelsReleaseCatalog* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_release_catalog_get_last_updated (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_last_updated);
		self->priv->_last_updated = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY]);
	}
}

gboolean
proton_plus_models_release_catalog_get_loading (ProtonPlusModelsReleaseCatalog* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_loading;
	return result;
}

static void
proton_plus_models_release_catalog_set_loading (ProtonPlusModelsReleaseCatalog* self,
                                                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_release_catalog_get_loading (self);
	if (old_value != value) {
		self->priv->_loading = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY]);
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gchar*
proton_plus_models_release_catalog_get_last_version (ProtonPlusModelsReleaseCatalog* self)
{
	gchar* result;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	GeeLinkedList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	ProtonPlusModelsRelease* last_release = NULL;
	GeeLinkedList* _tmp11_;
	gpointer _tmp12_;
	gboolean _tmp13_ = FALSE;
	gboolean _tmp14_ = FALSE;
	ProtonPlusModelsRelease* _tmp15_;
	gchar* title = NULL;
	ProtonPlusModelsRelease* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_last_version;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->_last_version;
		_tmp3_ = strlen (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = self->priv->_last_version;
		_tmp6_ = g_strdup (_tmp5_);
		result = _tmp6_;
		return result;
	}
	_tmp7_ = self->priv->_releases;
	_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == 0) {
		gchar* _tmp10_;
		_tmp10_ = g_strdup ("");
		result = _tmp10_;
		return result;
	}
	_tmp11_ = self->priv->_releases;
	_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, 0);
	last_release = (ProtonPlusModelsRelease*) _tmp12_;
	_tmp15_ = last_release;
	if (_tmp15_ == NULL) {
		_tmp14_ = TRUE;
	} else {
		ProtonPlusModelsRelease* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		_tmp16_ = last_release;
		_tmp17_ = proton_plus_models_release_get_title (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp14_ = _tmp18_ == NULL;
	}
	if (_tmp14_) {
		_tmp13_ = TRUE;
	} else {
		ProtonPlusModelsRelease* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp19_ = last_release;
		_tmp20_ = proton_plus_models_release_get_title (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp13_ = g_strcmp0 (_tmp21_, "") == 0;
	}
	if (_tmp13_) {
		gchar* _tmp22_;
		_tmp22_ = g_strdup ("");
		result = _tmp22_;
		_g_object_unref0 (last_release);
		return result;
	}
	_tmp23_ = last_release;
	_tmp24_ = proton_plus_models_release_get_title (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strdup (_tmp25_);
	title = _tmp26_;
	{
		GRegex* regex = NULL;
		GRegex* _tmp27_;
		GMatchInfo* match = NULL;
		GRegex* _tmp28_;
		const gchar* _tmp29_;
		GMatchInfo* _tmp30_ = NULL;
		gboolean _tmp31_;
		_tmp27_ = g_regex_new ("(\\d+[\\d\\.\\-]+?)(?:-[sS][lL][rR]|-[hH][dD][rR])?$", G_REGEX_OPTIMIZE, 0, &_inner_error0_);
		regex = _tmp27_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (title);
			_g_object_unref0 (last_release);
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		_tmp28_ = regex;
		_tmp29_ = title;
		_tmp31_ = g_regex_match (_tmp28_, _tmp29_, 0, &_tmp30_);
		_g_match_info_unref0 (match);
		match = _tmp30_;
		if (_tmp31_) {
			gchar* version = NULL;
			GMatchInfo* _tmp32_;
			gchar* _tmp33_;
			const gchar* _tmp34_;
			const gchar* _tmp40_;
			gchar* _tmp41_;
			_tmp32_ = match;
			_tmp33_ = g_match_info_fetch (_tmp32_, 1);
			version = _tmp33_;
			_tmp34_ = version;
			if (g_str_has_suffix (_tmp34_, "-")) {
				const gchar* _tmp35_;
				const gchar* _tmp36_;
				gint _tmp37_;
				gint _tmp38_;
				gchar* _tmp39_;
				_tmp35_ = version;
				_tmp36_ = version;
				_tmp37_ = strlen (_tmp36_);
				_tmp38_ = _tmp37_;
				_tmp39_ = string_substring (_tmp35_, (glong) 0, (glong) (_tmp38_ - 1));
				_g_free0 (version);
				version = _tmp39_;
			}
			_tmp40_ = version;
			_tmp41_ = g_strdup (_tmp40_);
			_g_free0 (self->priv->_last_version);
			self->priv->_last_version = _tmp41_;
			result = version;
			_g_match_info_unref0 (match);
			_g_regex_unref0 (regex);
			_g_free0 (title);
			_g_object_unref0 (last_release);
			return result;
		}
		_g_match_info_unref0 (match);
		_g_regex_unref0 (regex);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		GError* e = NULL;
		GError* _tmp42_;
		const gchar* _tmp43_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp42_ = e;
		_tmp43_ = _tmp42_->message;
		g_warning ("release-catalog.vala:60: Could not parse the release version: %s", _tmp43_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (title);
		_g_object_unref0 (last_release);
		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 NULL;
	}
	result = title;
	_g_object_unref0 (last_release);
	return result;
}

static void
proton_plus_models_release_catalog_class_init (ProtonPlusModelsReleaseCatalogClass * klass,
                                               gpointer klass_data)
{
	proton_plus_models_release_catalog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsReleaseCatalog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_release_catalog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_release_catalog_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_release_catalog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY] = g_param_spec_object ("releases", "releases", "releases", GEE_TYPE_LINKED_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY] = g_param_spec_int ("page", "page", "page", G_MININT, G_MAXINT, 1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY] = g_param_spec_boolean ("has-more", "has-more", "has-more", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY] = g_param_spec_string ("last-updated", "last-updated", "last-updated", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY] = g_param_spec_boolean ("loading", "loading", "loading", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_VERSION_PROPERTY, proton_plus_models_release_catalog_properties[PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_VERSION_PROPERTY] = g_param_spec_string ("last-version", "last-version", "last-version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	proton_plus_models_release_catalog_signals[PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_CHANGED_SIGNAL] = g_signal_new ("releases-changed", PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
proton_plus_models_release_catalog_instance_init (ProtonPlusModelsReleaseCatalog * self,
                                                  gpointer klass)
{
	GeeLinkedList* _tmp0_;
	gchar* _tmp1_;
	self->priv = proton_plus_models_release_catalog_get_instance_private (self);
	self->priv->_last_version = NULL;
	_tmp0_ = gee_linked_list_new (PROTON_PLUS_MODELS_TYPE_RELEASE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_releases = _tmp0_;
	self->priv->_page = 1;
	self->priv->_has_more = FALSE;
	_tmp1_ = g_strdup ("");
	self->priv->_last_updated = _tmp1_;
	self->priv->_loading = FALSE;
}

static void
proton_plus_models_release_catalog_finalize (GObject * obj)
{
	ProtonPlusModelsReleaseCatalog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, ProtonPlusModelsReleaseCatalog);
	_g_object_unref0 (self->priv->definition);
	_g_object_unref0 (self->priv->release_source);
	_g_object_unref0 (self->priv->cache);
	_g_object_unref0 (self->priv->static_release);
	_g_free0 (self->priv->_last_version);
	_g_object_unref0 (self->priv->_releases);
	_g_free0 (self->priv->_last_updated);
	G_OBJECT_CLASS (proton_plus_models_release_catalog_parent_class)->finalize (obj);
}

static GType
proton_plus_models_release_catalog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsReleaseCatalogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_release_catalog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsReleaseCatalog), 0, (GInstanceInitFunc) proton_plus_models_release_catalog_instance_init, NULL };
	GType proton_plus_models_release_catalog_type_id;
	proton_plus_models_release_catalog_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsReleaseCatalog", &g_define_type_info, 0);
	ProtonPlusModelsReleaseCatalog_private_offset = g_type_add_instance_private (proton_plus_models_release_catalog_type_id, sizeof (ProtonPlusModelsReleaseCatalogPrivate));
	return proton_plus_models_release_catalog_type_id;
}

GType
proton_plus_models_release_catalog_get_type (void)
{
	static volatile gsize proton_plus_models_release_catalog_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_release_catalog_type_id__once)) {
		GType proton_plus_models_release_catalog_type_id;
		proton_plus_models_release_catalog_type_id = proton_plus_models_release_catalog_get_type_once ();
		g_once_init_leave (&proton_plus_models_release_catalog_type_id__once, proton_plus_models_release_catalog_type_id);
	}
	return proton_plus_models_release_catalog_type_id__once;
}

static void
_vala_proton_plus_models_release_catalog_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusModelsReleaseCatalog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, ProtonPlusModelsReleaseCatalog);
	switch (property_id) {
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY:
		g_value_set_object (value, proton_plus_models_release_catalog_get_releases (self));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY:
		g_value_set_int (value, proton_plus_models_release_catalog_get_page (self));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_release_catalog_get_has_more (self));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY:
		g_value_set_string (value, proton_plus_models_release_catalog_get_last_updated (self));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_release_catalog_get_loading (self));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_VERSION_PROPERTY:
		g_value_take_string (value, proton_plus_models_release_catalog_get_last_version (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_release_catalog_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusModelsReleaseCatalog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_RELEASE_CATALOG, ProtonPlusModelsReleaseCatalog);
	switch (property_id) {
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_RELEASES_PROPERTY:
		proton_plus_models_release_catalog_set_releases (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_PAGE_PROPERTY:
		proton_plus_models_release_catalog_set_page (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_HAS_MORE_PROPERTY:
		proton_plus_models_release_catalog_set_has_more (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_LAST_UPDATED_PROPERTY:
		proton_plus_models_release_catalog_set_last_updated (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_RELEASE_CATALOG_LOADING_PROPERTY:
		proton_plus_models_release_catalog_set_loading (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);
}

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;
}

