/* installed-tool-inventory.c generated by valac 0.56.19, the Vala compiler
 * generated from installed-tool-inventory.vala, do not modify */

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <sys/stat.h>
#include <gio/gio.h>
#include <glib/gstdio.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_INSTALLED_TOOL_ENTRY_0_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_0_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY,
	PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_installed_tool_inventory_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _ProtonPlusModelsInstalledToolEntryPrivate {
	gchar* _path;
	gchar* _directory_name;
	gchar* _internal_title;
	gchar* _display_title;
	gchar* _runner_endpoint;
	gchar* _runner_title;
	gchar* _tag;
	gchar* _provider_id;
	gchar* _tool_id;
	gchar* _launcher_id;
	gchar* _variant_id;
	gchar* _release_id;
	gboolean _has_compatibilitytool_vdf;
};

struct _ProtonPlusModelsInstalledToolInventoryPrivate {
	ProtonPlusModelsGroup* group;
	GeeArrayList* entries;
	gboolean _is_stale;
	guint _refresh_generation;
};

static gint ProtonPlusModelsInstalledToolEntry_private_offset;
static gpointer proton_plus_models_installed_tool_entry_parent_class = NULL;
static gint ProtonPlusModelsInstalledToolInventory_private_offset;
static gpointer proton_plus_models_installed_tool_inventory_parent_class = NULL;

static void proton_plus_models_installed_tool_entry_finalize (GObject * obj);
static GType proton_plus_models_installed_tool_entry_get_type_once (void);
static void _vala_proton_plus_models_installed_tool_entry_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_proton_plus_models_installed_tool_entry_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
static gchar* proton_plus_models_installed_tool_inventory_usage_identifier_for (ProtonPlusModelsInstalledToolInventory* self,
                                                                         ProtonPlusModelsInstalledToolEntry* entry);
static void proton_plus_models_installed_tool_inventory_set_is_stale (ProtonPlusModelsInstalledToolInventory* self,
                                                               gboolean value);
static void proton_plus_models_installed_tool_inventory_clear_tool_states (ProtonPlusModelsInstalledToolInventory* self);
static void proton_plus_models_installed_tool_inventory_discover_entries (ProtonPlusModelsInstalledToolInventory* self);
static void proton_plus_models_installed_tool_inventory_resolve_entries (ProtonPlusModelsInstalledToolInventory* self);
static void proton_plus_models_installed_tool_inventory_set_refresh_generation (ProtonPlusModelsInstalledToolInventory* self,
                                                                         guint value);
static void proton_plus_models_installed_tool_inventory_add_entry (ProtonPlusModelsInstalledToolInventory* self,
                                                            const gchar* path);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
static void proton_plus_models_installed_tool_inventory_resolve_steam_tinker_launch (ProtonPlusModelsInstalledToolInventory* self,
                                                                              ProtonPlusModelsTool* tool);
static void proton_plus_models_installed_tool_inventory_resolve_provider_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                        ProtonPlusModelsToolsProviderTool* tool);
VALA_EXTERN void proton_plus_models_tool_set_resolved_installation_state (ProtonPlusModelsTool* self,
                                                              ProtonPlusModelsInstalledToolEntry* entry,
                                                              const gchar* usage_identifier,
                                                              gboolean is_used);
static void proton_plus_models_installed_tool_inventory_set_tool_state (ProtonPlusModelsInstalledToolInventory* self,
                                                                 ProtonPlusModelsTool* tool,
                                                                 ProtonPlusModelsInstalledToolEntry* entry,
                                                                 const gchar* usage_identifier);
static gboolean proton_plus_models_installed_tool_inventory_persisted_identity_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                                      ProtonPlusModelsInstalledToolEntry* entry,
                                                                                      ProtonPlusModelsToolsProviderTool* tool);
static gboolean proton_plus_models_installed_tool_inventory_legacy_metadata_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                                   ProtonPlusModelsInstalledToolEntry* entry,
                                                                                   ProtonPlusModelsToolsProviderTool* tool);
static gboolean proton_plus_models_installed_tool_inventory_legacy_metadata_match_is_unambiguous (ProtonPlusModelsInstalledToolInventory* self,
                                                                                           ProtonPlusModelsInstalledToolEntry* entry);
static ProtonPlusModelsInstalledToolEntry* proton_plus_models_installed_tool_inventory_migrate_legacy_identity (ProtonPlusModelsInstalledToolInventory* self,
                                                                                                         gint index,
                                                                                                         ProtonPlusModelsToolsProviderTool* tool);
static gboolean proton_plus_models_installed_tool_inventory_identifier_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                              const gchar* identifier,
                                                                              ProtonPlusModelsToolsProviderTool* tool);
static gboolean proton_plus_models_installed_tool_inventory_legacy_tag_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                              const gchar* tag,
                                                                              ProtonPlusModelsToolsProviderTool* tool);
static gchar* proton_plus_models_installed_tool_inventory_variant_directory_suffix (ProtonPlusModelsInstalledToolInventory* self,
                                                                             ProtonPlusModelsVariant* variant);
static void proton_plus_models_installed_tool_inventory_finalize (GObject * obj);
static GType proton_plus_models_installed_tool_inventory_get_type_once (void);
static void _vala_proton_plus_models_installed_tool_inventory_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec);
static void _vala_proton_plus_models_installed_tool_inventory_set_property (GObject * object,
                                                                     guint property_id,
                                                                     const GValue * value,
                                                                     GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_models_installed_tool_entry_get_instance_private (ProtonPlusModelsInstalledToolEntry* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsInstalledToolEntry_private_offset);
}

ProtonPlusModelsInstalledToolEntry*
proton_plus_models_installed_tool_entry_construct (GType object_type,
                                                   const gchar* path,
                                                   const gchar* directory_name,
                                                   const gchar* internal_title,
                                                   const gchar* display_title,
                                                   const gchar* runner_endpoint,
                                                   const gchar* runner_title,
                                                   const gchar* tag,
                                                   const gchar* provider_id,
                                                   const gchar* tool_id,
                                                   const gchar* launcher_id,
                                                   const gchar* variant_id,
                                                   const gchar* release_id,
                                                   gboolean has_compatibilitytool_vdf)
{
	ProtonPlusModelsInstalledToolEntry * self = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	g_return_val_if_fail (directory_name != NULL, NULL);
	g_return_val_if_fail (internal_title != NULL, NULL);
	g_return_val_if_fail (display_title != NULL, NULL);
	g_return_val_if_fail (runner_endpoint != NULL, NULL);
	g_return_val_if_fail (runner_title != NULL, NULL);
	g_return_val_if_fail (tag != NULL, NULL);
	g_return_val_if_fail (provider_id != NULL, NULL);
	g_return_val_if_fail (tool_id != NULL, NULL);
	g_return_val_if_fail (launcher_id != NULL, NULL);
	g_return_val_if_fail (variant_id != NULL, NULL);
	g_return_val_if_fail (release_id != NULL, NULL);
	self = (ProtonPlusModelsInstalledToolEntry*) g_object_new (object_type, "path", path, "directory-name", directory_name, "internal-title", internal_title, "display-title", display_title, "runner-endpoint", runner_endpoint, "runner-title", runner_title, "tag", tag, "provider-id", provider_id, "tool-id", tool_id, "launcher-id", launcher_id, "variant-id", variant_id, "release-id", release_id, "has-compatibilitytool-vdf", has_compatibilitytool_vdf, NULL);
	return self;
}

ProtonPlusModelsInstalledToolEntry*
proton_plus_models_installed_tool_entry_new (const gchar* path,
                                             const gchar* directory_name,
                                             const gchar* internal_title,
                                             const gchar* display_title,
                                             const gchar* runner_endpoint,
                                             const gchar* runner_title,
                                             const gchar* tag,
                                             const gchar* provider_id,
                                             const gchar* tool_id,
                                             const gchar* launcher_id,
                                             const gchar* variant_id,
                                             const gchar* release_id,
                                             gboolean has_compatibilitytool_vdf)
{
	return proton_plus_models_installed_tool_entry_construct (PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, path, directory_name, internal_title, display_title, runner_endpoint, runner_title, tag, provider_id, tool_id, launcher_id, variant_id, release_id, has_compatibilitytool_vdf);
}

gboolean
proton_plus_models_installed_tool_entry_has_persisted_identity (ProtonPlusModelsInstalledToolEntry* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp4_ = self->priv->_provider_id;
	if (g_strcmp0 (_tmp4_, "") != 0) {
		_tmp3_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = self->priv->_tool_id;
		_tmp3_ = g_strcmp0 (_tmp5_, "") != 0;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = self->priv->_launcher_id;
		_tmp2_ = g_strcmp0 (_tmp6_, "") != 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp7_;
		_tmp7_ = self->priv->_variant_id;
		_tmp1_ = g_strcmp0 (_tmp7_, "") != 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = self->priv->_release_id;
		_tmp0_ = g_strcmp0 (_tmp8_, "") != 0;
	}
	result = _tmp0_;
	return result;
}

ProtonPlusModelsInstalledToolEntry*
proton_plus_models_installed_tool_entry_with_stable_identity (ProtonPlusModelsInstalledToolEntry* self,
                                                              const gchar* provider_id,
                                                              const gchar* tool_id,
                                                              const gchar* launcher_id)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gboolean _tmp9_;
	ProtonPlusModelsInstalledToolEntry* _tmp10_;
	ProtonPlusModelsInstalledToolEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (provider_id != NULL, NULL);
	g_return_val_if_fail (tool_id != NULL, NULL);
	g_return_val_if_fail (launcher_id != NULL, NULL);
	_tmp0_ = self->priv->_path;
	_tmp1_ = self->priv->_directory_name;
	_tmp2_ = self->priv->_internal_title;
	_tmp3_ = self->priv->_display_title;
	_tmp4_ = self->priv->_runner_endpoint;
	_tmp5_ = self->priv->_runner_title;
	_tmp6_ = self->priv->_tag;
	_tmp7_ = self->priv->_variant_id;
	_tmp8_ = self->priv->_release_id;
	_tmp9_ = self->priv->_has_compatibilitytool_vdf;
	_tmp10_ = proton_plus_models_installed_tool_entry_new (_tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp4_, _tmp5_, _tmp6_, provider_id, tool_id, launcher_id, _tmp7_, _tmp8_, _tmp9_);
	result = _tmp10_;
	return result;
}

const gchar*
proton_plus_models_installed_tool_entry_get_path (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_path;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_path (ProtonPlusModelsInstalledToolEntry* self,
                                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_path);
		self->priv->_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_directory_name (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_directory_name;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_directory_name (ProtonPlusModelsInstalledToolEntry* self,
                                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_directory_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_directory_name);
		self->priv->_directory_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_internal_title (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_internal_title;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_internal_title (ProtonPlusModelsInstalledToolEntry* self,
                                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_internal_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_internal_title);
		self->priv->_internal_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_display_title (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_display_title;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_display_title (ProtonPlusModelsInstalledToolEntry* self,
                                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_display_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_display_title);
		self->priv->_display_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_runner_endpoint (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_runner_endpoint;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_runner_endpoint (ProtonPlusModelsInstalledToolEntry* self,
                                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_runner_endpoint (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_runner_endpoint);
		self->priv->_runner_endpoint = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_runner_title (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_runner_title;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_runner_title (ProtonPlusModelsInstalledToolEntry* self,
                                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_runner_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_runner_title);
		self->priv->_runner_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_tag (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tag;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_tag (ProtonPlusModelsInstalledToolEntry* self,
                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_tag (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_tag);
		self->priv->_tag = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_provider_id (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_provider_id;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_provider_id (ProtonPlusModelsInstalledToolEntry* self,
                                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_provider_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_provider_id);
		self->priv->_provider_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_tool_id (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tool_id;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_tool_id (ProtonPlusModelsInstalledToolEntry* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_tool_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_tool_id);
		self->priv->_tool_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_launcher_id (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_launcher_id;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_launcher_id (ProtonPlusModelsInstalledToolEntry* self,
                                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_launcher_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_launcher_id);
		self->priv->_launcher_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_variant_id (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_variant_id;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_variant_id (ProtonPlusModelsInstalledToolEntry* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_variant_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_variant_id);
		self->priv->_variant_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY]);
	}
}

const gchar*
proton_plus_models_installed_tool_entry_get_release_id (ProtonPlusModelsInstalledToolEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_release_id;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_release_id (ProtonPlusModelsInstalledToolEntry* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_release_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_release_id);
		self->priv->_release_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY]);
	}
}

gboolean
proton_plus_models_installed_tool_entry_get_has_compatibilitytool_vdf (ProtonPlusModelsInstalledToolEntry* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_compatibilitytool_vdf;
	return result;
}

void
proton_plus_models_installed_tool_entry_set_has_compatibilitytool_vdf (ProtonPlusModelsInstalledToolEntry* self,
                                                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_entry_get_has_compatibilitytool_vdf (self);
	if (old_value != value) {
		self->priv->_has_compatibilitytool_vdf = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY]);
	}
}

static void
proton_plus_models_installed_tool_entry_class_init (ProtonPlusModelsInstalledToolEntryClass * klass,
                                                    gpointer klass_data)
{
	proton_plus_models_installed_tool_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsInstalledToolEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_installed_tool_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_installed_tool_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_installed_tool_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY] = g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY] = g_param_spec_string ("directory-name", "directory-name", "directory-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY] = g_param_spec_string ("internal-title", "internal-title", "internal-title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY] = g_param_spec_string ("display-title", "display-title", "display-title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY] = g_param_spec_string ("runner-endpoint", "runner-endpoint", "runner-endpoint", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY] = g_param_spec_string ("runner-title", "runner-title", "runner-title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY] = g_param_spec_string ("tag", "tag", "tag", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY] = g_param_spec_string ("provider-id", "provider-id", "provider-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY] = g_param_spec_string ("tool-id", "tool-id", "tool-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY] = g_param_spec_string ("launcher-id", "launcher-id", "launcher-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY] = g_param_spec_string ("variant-id", "variant-id", "variant-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY] = g_param_spec_string ("release-id", "release-id", "release-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY, proton_plus_models_installed_tool_entry_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY] = g_param_spec_boolean ("has-compatibilitytool-vdf", "has-compatibilitytool-vdf", "has-compatibilitytool-vdf", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
proton_plus_models_installed_tool_entry_instance_init (ProtonPlusModelsInstalledToolEntry * self,
                                                       gpointer klass)
{
	self->priv = proton_plus_models_installed_tool_entry_get_instance_private (self);
}

static void
proton_plus_models_installed_tool_entry_finalize (GObject * obj)
{
	ProtonPlusModelsInstalledToolEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, ProtonPlusModelsInstalledToolEntry);
	_g_free0 (self->priv->_path);
	_g_free0 (self->priv->_directory_name);
	_g_free0 (self->priv->_internal_title);
	_g_free0 (self->priv->_display_title);
	_g_free0 (self->priv->_runner_endpoint);
	_g_free0 (self->priv->_runner_title);
	_g_free0 (self->priv->_tag);
	_g_free0 (self->priv->_provider_id);
	_g_free0 (self->priv->_tool_id);
	_g_free0 (self->priv->_launcher_id);
	_g_free0 (self->priv->_variant_id);
	_g_free0 (self->priv->_release_id);
	G_OBJECT_CLASS (proton_plus_models_installed_tool_entry_parent_class)->finalize (obj);
}

static GType
proton_plus_models_installed_tool_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsInstalledToolEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_installed_tool_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsInstalledToolEntry), 0, (GInstanceInitFunc) proton_plus_models_installed_tool_entry_instance_init, NULL };
	GType proton_plus_models_installed_tool_entry_type_id;
	proton_plus_models_installed_tool_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsInstalledToolEntry", &g_define_type_info, 0);
	ProtonPlusModelsInstalledToolEntry_private_offset = g_type_add_instance_private (proton_plus_models_installed_tool_entry_type_id, sizeof (ProtonPlusModelsInstalledToolEntryPrivate));
	return proton_plus_models_installed_tool_entry_type_id;
}

GType
proton_plus_models_installed_tool_entry_get_type (void)
{
	static volatile gsize proton_plus_models_installed_tool_entry_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_installed_tool_entry_type_id__once)) {
		GType proton_plus_models_installed_tool_entry_type_id;
		proton_plus_models_installed_tool_entry_type_id = proton_plus_models_installed_tool_entry_get_type_once ();
		g_once_init_leave (&proton_plus_models_installed_tool_entry_type_id__once, proton_plus_models_installed_tool_entry_type_id);
	}
	return proton_plus_models_installed_tool_entry_type_id__once;
}

static void
_vala_proton_plus_models_installed_tool_entry_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	ProtonPlusModelsInstalledToolEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, ProtonPlusModelsInstalledToolEntry);
	switch (property_id) {
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_path (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_directory_name (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_internal_title (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_display_title (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_runner_endpoint (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_runner_title (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_tag (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_provider_id (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_tool_id (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_launcher_id (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_variant_id (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_installed_tool_entry_get_release_id (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_installed_tool_entry_get_has_compatibilitytool_vdf (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_installed_tool_entry_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	ProtonPlusModelsInstalledToolEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, ProtonPlusModelsInstalledToolEntry);
	switch (property_id) {
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PATH_PROPERTY:
		proton_plus_models_installed_tool_entry_set_path (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DIRECTORY_NAME_PROPERTY:
		proton_plus_models_installed_tool_entry_set_directory_name (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_INTERNAL_TITLE_PROPERTY:
		proton_plus_models_installed_tool_entry_set_internal_title (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_DISPLAY_TITLE_PROPERTY:
		proton_plus_models_installed_tool_entry_set_display_title (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_ENDPOINT_PROPERTY:
		proton_plus_models_installed_tool_entry_set_runner_endpoint (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RUNNER_TITLE_PROPERTY:
		proton_plus_models_installed_tool_entry_set_runner_title (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TAG_PROPERTY:
		proton_plus_models_installed_tool_entry_set_tag (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_PROVIDER_ID_PROPERTY:
		proton_plus_models_installed_tool_entry_set_provider_id (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_TOOL_ID_PROPERTY:
		proton_plus_models_installed_tool_entry_set_tool_id (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_LAUNCHER_ID_PROPERTY:
		proton_plus_models_installed_tool_entry_set_launcher_id (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_VARIANT_ID_PROPERTY:
		proton_plus_models_installed_tool_entry_set_variant_id (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_RELEASE_ID_PROPERTY:
		proton_plus_models_installed_tool_entry_set_release_id (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_ENTRY_HAS_COMPATIBILITYTOOL_VDF_PROPERTY:
		proton_plus_models_installed_tool_entry_set_has_compatibilitytool_vdf (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_models_installed_tool_inventory_get_instance_private (ProtonPlusModelsInstalledToolInventory* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsInstalledToolInventory_private_offset);
}

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

ProtonPlusModelsInstalledToolInventory*
proton_plus_models_installed_tool_inventory_construct (GType object_type,
                                                       ProtonPlusModelsGroup* group)
{
	ProtonPlusModelsInstalledToolInventory * self = NULL;
	ProtonPlusModelsGroup* _tmp0_;
	g_return_val_if_fail (group != NULL, NULL);
	self = (ProtonPlusModelsInstalledToolInventory*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (group);
	_g_object_unref0 (self->priv->group);
	self->priv->group = _tmp0_;
	return self;
}

ProtonPlusModelsInstalledToolInventory*
proton_plus_models_installed_tool_inventory_new (ProtonPlusModelsGroup* group)
{
	return proton_plus_models_installed_tool_inventory_construct (PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_INVENTORY, group);
}

GeeList*
proton_plus_models_installed_tool_inventory_get_snapshot (ProtonPlusModelsInstalledToolInventory* self)
{
	GeeArrayList* snapshot = NULL;
	GeeArrayList* _tmp0_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	snapshot = _tmp0_;
	{
		GeeArrayList* _entry_list = NULL;
		GeeArrayList* _tmp1_;
		gint _entry_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _entry_index = 0;
		_tmp1_ = self->priv->entries;
		_entry_list = _tmp1_;
		_tmp2_ = _entry_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_entry_size = _tmp4_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ProtonPlusModelsInstalledToolEntry* entry = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			GeeArrayList* _tmp9_;
			ProtonPlusModelsInstalledToolEntry* _tmp10_;
			_entry_index = _entry_index + 1;
			_tmp5_ = _entry_index;
			_tmp6_ = _entry_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _entry_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _entry_index);
			entry = (ProtonPlusModelsInstalledToolEntry*) _tmp8_;
			_tmp9_ = snapshot;
			_tmp10_ = entry;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp10_);
			_g_object_unref0 (entry);
		}
	}
	result = (GeeList*) snapshot;
	return result;
}

gchar*
proton_plus_models_installed_tool_inventory_get_usage_identifier_for_path (ProtonPlusModelsInstalledToolInventory* self,
                                                                           const gchar* path)
{
	gchar* target_path = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	if (g_strcmp0 (path, "") == 0) {
		result = NULL;
		return result;
	}
	_tmp0_ = g_canonicalize_filename (path, NULL);
	target_path = _tmp0_;
	{
		GeeArrayList* _entry_list = NULL;
		GeeArrayList* _tmp1_;
		gint _entry_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _entry_index = 0;
		_tmp1_ = self->priv->entries;
		_entry_list = _tmp1_;
		_tmp2_ = _entry_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_entry_size = _tmp4_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ProtonPlusModelsInstalledToolEntry* entry = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			ProtonPlusModelsInstalledToolEntry* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			const gchar* _tmp14_;
			gboolean _tmp15_;
			_entry_index = _entry_index + 1;
			_tmp5_ = _entry_index;
			_tmp6_ = _entry_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _entry_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _entry_index);
			entry = (ProtonPlusModelsInstalledToolEntry*) _tmp8_;
			_tmp9_ = entry;
			_tmp10_ = proton_plus_models_installed_tool_entry_get_path (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_canonicalize_filename (_tmp11_, NULL);
			_tmp13_ = _tmp12_;
			_tmp14_ = target_path;
			_tmp15_ = g_strcmp0 (_tmp13_, _tmp14_) == 0;
			_g_free0 (_tmp13_);
			if (_tmp15_) {
				ProtonPlusModelsInstalledToolEntry* _tmp16_;
				gchar* _tmp17_;
				_tmp16_ = entry;
				_tmp17_ = proton_plus_models_installed_tool_inventory_usage_identifier_for (self, _tmp16_);
				result = _tmp17_;
				_g_object_unref0 (entry);
				_g_free0 (target_path);
				return result;
			}
			_g_object_unref0 (entry);
		}
	}
	result = NULL;
	_g_free0 (target_path);
	return result;
}

void
proton_plus_models_installed_tool_inventory_invalidate (ProtonPlusModelsInstalledToolInventory* self)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entries;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
	proton_plus_models_installed_tool_inventory_set_is_stale (self, TRUE);
	proton_plus_models_installed_tool_inventory_clear_tool_states (self);
}

void
proton_plus_models_installed_tool_inventory_refresh (ProtonPlusModelsInstalledToolInventory* self)
{
	GeeArrayList* _tmp0_;
	guint _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entries;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
	proton_plus_models_installed_tool_inventory_discover_entries (self);
	proton_plus_models_installed_tool_inventory_resolve_entries (self);
	proton_plus_models_installed_tool_inventory_set_is_stale (self, FALSE);
	_tmp1_ = self->priv->_refresh_generation;
	proton_plus_models_installed_tool_inventory_set_refresh_generation (self, _tmp1_ + 1);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

static void
proton_plus_models_installed_tool_inventory_discover_entries (ProtonPlusModelsInstalledToolInventory* self)
{
	ProtonPlusModelsGroup* _tmp0_;
	ProtonPlusModelsLauncher* _tmp1_;
	ProtonPlusModelsLauncher* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	GList* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->group;
	_tmp1_ = proton_plus_models_group_get_launcher (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->group;
	_tmp4_ = proton_plus_models_launcher_get_managed_tool_directories (_tmp2_, _tmp3_);
	{
		GList* directory_root_collection = NULL;
		GList* directory_root_it = NULL;
		directory_root_collection = _tmp4_;
		for (directory_root_it = directory_root_collection; directory_root_it != NULL; directory_root_it = directory_root_it->next) {
			gchar* _tmp5_;
			gchar* directory_root = NULL;
			_tmp5_ = g_strdup ((const gchar*) directory_root_it->data);
			directory_root = _tmp5_;
			{
				struct stat root_stat = {0};
				gboolean _tmp6_ = FALSE;
				const gchar* _tmp7_;
				struct stat _tmp8_ = {0};
				gint _tmp9_;
				_tmp7_ = directory_root;
				_tmp9_ = lstat (_tmp7_, &_tmp8_);
				root_stat = _tmp8_;
				if (_tmp9_ != 0) {
					_tmp6_ = TRUE;
				} else {
					struct stat _tmp10_;
					_tmp10_ = root_stat;
					_tmp6_ = !S_ISDIR (_tmp10_.st_mode);
				}
				if (_tmp6_) {
					_g_free0 (directory_root);
					continue;
				}
				{
					GFile* directory = NULL;
					const gchar* _tmp11_;
					GFile* _tmp12_;
					const gchar* _tmp13_;
					GFileEnumerator* enumerator = NULL;
					GFile* _tmp14_;
					GFileEnumerator* _tmp15_;
					GFileEnumerator* _tmp16_;
					GFileInfo* file_info = NULL;
					_tmp11_ = directory_root;
					_tmp12_ = g_file_new_for_path (_tmp11_);
					directory = _tmp12_;
					_tmp13_ = directory_root;
					proton_plus_models_installed_tool_inventory_add_entry (self, _tmp13_);
					_tmp14_ = directory;
					_tmp15_ = g_file_enumerate_children (_tmp14_, "standard::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error0_);
					enumerator = _tmp15_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_object_unref0 (directory);
						goto __catch0_g_error;
					}
					_tmp16_ = enumerator;
					if (_tmp16_ == NULL) {
						_g_object_unref0 (enumerator);
						_g_object_unref0 (directory);
						_g_free0 (directory_root);
						continue;
					}
					while (TRUE) {
						GFileInfo* _tmp17_ = NULL;
						GFileEnumerator* _tmp18_;
						GFileInfo* _tmp19_;
						GFileInfo* _tmp20_;
						GFileInfo* _tmp21_;
						GFileInfo* _tmp22_;
						const gchar* _tmp23_;
						GFileInfo* _tmp24_;
						const gchar* _tmp25_;
						gchar* _tmp26_;
						gchar* _tmp27_;
						_tmp18_ = enumerator;
						_tmp19_ = g_file_enumerator_next_file (_tmp18_, NULL, &_inner_error0_);
						_tmp17_ = _tmp19_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_g_object_unref0 (file_info);
							_g_object_unref0 (enumerator);
							_g_object_unref0 (directory);
							goto __catch0_g_error;
						}
						_tmp20_ = _tmp17_;
						_tmp17_ = NULL;
						_g_object_unref0 (file_info);
						file_info = _tmp20_;
						_tmp21_ = file_info;
						if (!(_tmp21_ != NULL)) {
							_g_object_unref0 (_tmp17_);
							break;
						}
						_tmp22_ = file_info;
						if (g_file_info_get_file_type (_tmp22_) != G_FILE_TYPE_DIRECTORY) {
							_g_object_unref0 (_tmp17_);
							continue;
						}
						_tmp23_ = directory_root;
						_tmp24_ = file_info;
						_tmp25_ = g_file_info_get_name (_tmp24_);
						_tmp26_ = g_build_filename (_tmp23_, _tmp25_, NULL);
						_tmp27_ = _tmp26_;
						proton_plus_models_installed_tool_inventory_add_entry (self, _tmp27_);
						_g_free0 (_tmp27_);
						_g_object_unref0 (_tmp17_);
					}
					_g_object_unref0 (file_info);
					_g_object_unref0 (enumerator);
					_g_object_unref0 (directory);
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* e = NULL;
					GError* _tmp28_;
					const gchar* _tmp29_;
					e = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp28_ = e;
					_tmp29_ = _tmp28_->message;
					g_warning ("installed-tool-inventory.vala:143: %s", _tmp29_);
					_g_error_free0 (e);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_free0 (directory_root);
					(directory_root_collection == NULL) ? NULL : (directory_root_collection = (_g_list_free__g_free0_ (directory_root_collection), NULL));
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return;
				}
				_g_free0 (directory_root);
			}
		}
		(directory_root_collection == NULL) ? NULL : (directory_root_collection = (_g_list_free__g_free0_ (directory_root_collection), NULL));
	}
}

static void
proton_plus_models_installed_tool_inventory_add_entry (ProtonPlusModelsInstalledToolInventory* self,
                                                       const gchar* path)
{
	gchar* compatibilitytoolvdf_path = NULL;
	gchar* _tmp0_;
	gboolean has_compatibilitytool_vdf = FALSE;
	const gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gchar* directory_name = NULL;
	gchar* _tmp3_;
	gchar* internal_title = NULL;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* display_title = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	ProtonPlusUtilsMetadata* metadata = NULL;
	ProtonPlusUtilsMetadata* _tmp17_;
	GeeArrayList* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	ProtonPlusUtilsMetadata* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	ProtonPlusUtilsMetadata* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	ProtonPlusUtilsMetadata* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	ProtonPlusUtilsMetadata* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	ProtonPlusUtilsMetadata* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	ProtonPlusUtilsMetadata* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	ProtonPlusUtilsMetadata* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	ProtonPlusUtilsMetadata* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	ProtonPlusModelsInstalledToolEntry* _tmp46_;
	ProtonPlusModelsInstalledToolEntry* _tmp47_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = g_build_filename (path, "compatibilitytool.vdf", NULL);
	compatibilitytoolvdf_path = _tmp0_;
	_tmp1_ = compatibilitytoolvdf_path;
	has_compatibilitytool_vdf = g_file_test (_tmp1_, G_FILE_TEST_IS_REGULAR);
	if (!has_compatibilitytool_vdf) {
		_tmp2_ = !g_file_test (path, G_FILE_TEST_IS_DIR);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_g_free0 (compatibilitytoolvdf_path);
		return;
	}
	_tmp3_ = g_path_get_basename (path);
	directory_name = _tmp3_;
	_tmp4_ = directory_name;
	_tmp5_ = g_strdup (_tmp4_);
	internal_title = _tmp5_;
	_tmp6_ = directory_name;
	_tmp7_ = g_strdup (_tmp6_);
	display_title = _tmp7_;
	if (has_compatibilitytool_vdf) {
		ProtonPlusModelsCompatibilityTool* compatibility_tool = NULL;
		ProtonPlusModelsCompatibilityTool* _tmp8_;
		ProtonPlusModelsCompatibilityTool* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		ProtonPlusModelsCompatibilityTool* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp8_ = proton_plus_utils_vdf_compatibility_tool_loader_from_path (path);
		compatibility_tool = _tmp8_;
		_tmp9_ = compatibility_tool;
		_tmp10_ = proton_plus_models_compatibility_tool_get_internal_title (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strdup (_tmp11_);
		_g_free0 (internal_title);
		internal_title = _tmp12_;
		_tmp13_ = compatibility_tool;
		_tmp14_ = proton_plus_models_compatibility_tool_get_display_title (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_strdup (_tmp15_);
		_g_free0 (display_title);
		display_title = _tmp16_;
		_g_object_unref0 (compatibility_tool);
	}
	_tmp17_ = proton_plus_utils_metadata_load (path);
	metadata = _tmp17_;
	_tmp18_ = self->priv->entries;
	_tmp19_ = directory_name;
	_tmp20_ = internal_title;
	_tmp21_ = display_title;
	_tmp22_ = metadata;
	_tmp23_ = proton_plus_utils_metadata_get_runner_endpoint (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = metadata;
	_tmp26_ = proton_plus_utils_metadata_get_runner_title (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = metadata;
	_tmp29_ = proton_plus_utils_metadata_get_tag (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = metadata;
	_tmp32_ = proton_plus_utils_metadata_get_provider_id (_tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = metadata;
	_tmp35_ = proton_plus_utils_metadata_get_tool_id (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = metadata;
	_tmp38_ = proton_plus_utils_metadata_get_launcher_id (_tmp37_);
	_tmp39_ = _tmp38_;
	_tmp40_ = metadata;
	_tmp41_ = proton_plus_utils_metadata_get_variant_id (_tmp40_);
	_tmp42_ = _tmp41_;
	_tmp43_ = metadata;
	_tmp44_ = proton_plus_utils_metadata_get_release_id (_tmp43_);
	_tmp45_ = _tmp44_;
	_tmp46_ = proton_plus_models_installed_tool_entry_new (path, _tmp19_, _tmp20_, _tmp21_, _tmp24_, _tmp27_, _tmp30_, _tmp33_, _tmp36_, _tmp39_, _tmp42_, _tmp45_, has_compatibilitytool_vdf);
	_tmp47_ = _tmp46_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp47_);
	_g_object_unref0 (_tmp47_);
	_g_object_unref0 (metadata);
	_g_free0 (display_title);
	_g_free0 (internal_title);
	_g_free0 (directory_name);
	_g_free0 (compatibilitytoolvdf_path);
}

static void
proton_plus_models_installed_tool_inventory_resolve_entries (ProtonPlusModelsInstalledToolInventory* self)
{
	ProtonPlusModelsGroup* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	g_return_if_fail (self != NULL);
	proton_plus_models_installed_tool_inventory_clear_tool_states (self);
	_tmp0_ = self->priv->group;
	_tmp1_ = proton_plus_models_group_get_tools (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	{
		GeeLinkedList* _tool_list = NULL;
		ProtonPlusModelsGroup* _tmp3_;
		GeeLinkedList* _tmp4_;
		GeeLinkedList* _tmp5_;
		gint _tool_size = 0;
		GeeLinkedList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _tool_index = 0;
		_tmp3_ = self->priv->group;
		_tmp4_ = proton_plus_models_group_get_tools (_tmp3_);
		_tmp5_ = _tmp4_;
		_tool_list = _tmp5_;
		_tmp6_ = _tool_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tool_size = _tmp8_;
		_tool_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			ProtonPlusModelsTool* tool = NULL;
			GeeLinkedList* _tmp11_;
			gpointer _tmp12_;
			ProtonPlusModelsToolsSteamTinkerLaunch* steam_tinker_launch = NULL;
			ProtonPlusModelsTool* _tmp13_;
			ProtonPlusModelsToolsSteamTinkerLaunch* _tmp14_;
			ProtonPlusModelsToolsSteamTinkerLaunch* _tmp15_;
			ProtonPlusModelsToolsProviderTool* provider_tool = NULL;
			ProtonPlusModelsTool* _tmp17_;
			ProtonPlusModelsToolsProviderTool* _tmp18_;
			ProtonPlusModelsToolsProviderTool* _tmp19_;
			_tool_index = _tool_index + 1;
			_tmp9_ = _tool_index;
			_tmp10_ = _tool_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _tool_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _tool_index);
			tool = (ProtonPlusModelsTool*) _tmp12_;
			_tmp13_ = tool;
			_tmp14_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_STEAM_TINKER_LAUNCH (_tmp13_) ? ((ProtonPlusModelsToolsSteamTinkerLaunch*) _tmp13_) : NULL);
			steam_tinker_launch = _tmp14_;
			_tmp15_ = steam_tinker_launch;
			if (_tmp15_ != NULL) {
				ProtonPlusModelsTool* _tmp16_;
				_tmp16_ = tool;
				proton_plus_models_installed_tool_inventory_resolve_steam_tinker_launch (self, _tmp16_);
				_g_object_unref0 (steam_tinker_launch);
				_g_object_unref0 (tool);
				continue;
			}
			_tmp17_ = tool;
			_tmp18_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_tmp17_) ? ((ProtonPlusModelsToolsProviderTool*) _tmp17_) : NULL);
			provider_tool = _tmp18_;
			_tmp19_ = provider_tool;
			if (_tmp19_ != NULL) {
				ProtonPlusModelsToolsProviderTool* _tmp20_;
				_tmp20_ = provider_tool;
				proton_plus_models_installed_tool_inventory_resolve_provider_tool (self, _tmp20_);
			}
			_g_object_unref0 (provider_tool);
			_g_object_unref0 (steam_tinker_launch);
			_g_object_unref0 (tool);
		}
	}
}

static void
proton_plus_models_installed_tool_inventory_clear_tool_states (ProtonPlusModelsInstalledToolInventory* self)
{
	ProtonPlusModelsGroup* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->group;
	_tmp1_ = proton_plus_models_group_get_tools (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	{
		GeeLinkedList* _tool_list = NULL;
		ProtonPlusModelsGroup* _tmp3_;
		GeeLinkedList* _tmp4_;
		GeeLinkedList* _tmp5_;
		gint _tool_size = 0;
		GeeLinkedList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _tool_index = 0;
		_tmp3_ = self->priv->group;
		_tmp4_ = proton_plus_models_group_get_tools (_tmp3_);
		_tmp5_ = _tmp4_;
		_tool_list = _tmp5_;
		_tmp6_ = _tool_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tool_size = _tmp8_;
		_tool_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			ProtonPlusModelsTool* tool = NULL;
			GeeLinkedList* _tmp11_;
			gpointer _tmp12_;
			ProtonPlusModelsTool* _tmp13_;
			_tool_index = _tool_index + 1;
			_tmp9_ = _tool_index;
			_tmp10_ = _tool_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _tool_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _tool_index);
			tool = (ProtonPlusModelsTool*) _tmp12_;
			_tmp13_ = tool;
			proton_plus_models_tool_set_resolved_installation_state (_tmp13_, NULL, NULL, FALSE);
			_g_object_unref0 (tool);
		}
	}
}

static void
proton_plus_models_installed_tool_inventory_resolve_steam_tinker_launch (ProtonPlusModelsInstalledToolInventory* self,
                                                                         ProtonPlusModelsTool* tool)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tool != NULL);
	{
		GeeArrayList* _entry_list = NULL;
		GeeArrayList* _tmp0_;
		gint _entry_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _entry_index = 0;
		_tmp0_ = self->priv->entries;
		_entry_list = _tmp0_;
		_tmp1_ = _entry_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_entry_size = _tmp3_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ProtonPlusModelsInstalledToolEntry* entry = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			ProtonPlusModelsInstalledToolEntry* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_entry_index = _entry_index + 1;
			_tmp4_ = _entry_index;
			_tmp5_ = _entry_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _entry_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _entry_index);
			entry = (ProtonPlusModelsInstalledToolEntry*) _tmp7_;
			_tmp8_ = entry;
			_tmp9_ = proton_plus_models_installed_tool_entry_get_directory_name (_tmp8_);
			_tmp10_ = _tmp9_;
			if (g_strcmp0 (_tmp10_, "SteamTinkerLaunch") == 0) {
				ProtonPlusModelsInstalledToolEntry* _tmp11_;
				_tmp11_ = entry;
				proton_plus_models_installed_tool_inventory_set_tool_state (self, tool, _tmp11_, "Proton-stl");
				_g_object_unref0 (entry);
				return;
			}
			_g_object_unref0 (entry);
		}
	}
}

static void
proton_plus_models_installed_tool_inventory_resolve_provider_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                   ProtonPlusModelsToolsProviderTool* tool)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tool != NULL);
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GeeArrayList* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				ProtonPlusModelsInstalledToolEntry* entry = NULL;
				GeeArrayList* _tmp5_;
				gpointer _tmp6_;
				gboolean _tmp7_ = FALSE;
				ProtonPlusModelsInstalledToolEntry* _tmp8_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = index;
					index = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->entries;
				_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
				_tmp4_ = _tmp3_;
				if (!(index < _tmp4_)) {
					break;
				}
				_tmp5_ = self->priv->entries;
				_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, index);
				entry = (ProtonPlusModelsInstalledToolEntry*) _tmp6_;
				_tmp8_ = entry;
				if (proton_plus_models_installed_tool_entry_has_persisted_identity (_tmp8_)) {
					ProtonPlusModelsInstalledToolEntry* _tmp9_;
					_tmp9_ = entry;
					_tmp7_ = proton_plus_models_installed_tool_inventory_persisted_identity_matches_tool (self, _tmp9_, tool);
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					ProtonPlusModelsInstalledToolEntry* _tmp10_;
					ProtonPlusModelsInstalledToolEntry* _tmp11_;
					gchar* _tmp12_;
					gchar* _tmp13_;
					_tmp10_ = entry;
					_tmp11_ = entry;
					_tmp12_ = proton_plus_models_installed_tool_inventory_usage_identifier_for (self, _tmp11_);
					_tmp13_ = _tmp12_;
					proton_plus_models_installed_tool_inventory_set_tool_state (self, (ProtonPlusModelsTool*) tool, _tmp10_, _tmp13_);
					_g_free0 (_tmp13_);
					_g_object_unref0 (entry);
					return;
				}
				_g_object_unref0 (entry);
			}
		}
	}
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp14_ = FALSE;
			_tmp14_ = TRUE;
			while (TRUE) {
				GeeArrayList* _tmp16_;
				gint _tmp17_;
				gint _tmp18_;
				ProtonPlusModelsInstalledToolEntry* entry = NULL;
				GeeArrayList* _tmp19_;
				gpointer _tmp20_;
				gboolean _tmp21_ = FALSE;
				ProtonPlusModelsInstalledToolEntry* _tmp22_;
				ProtonPlusModelsInstalledToolEntry* _tmp24_;
				ProtonPlusModelsInstalledToolEntry* resolved_entry = NULL;
				ProtonPlusModelsInstalledToolEntry* _tmp25_;
				ProtonPlusModelsInstalledToolEntry* _tmp26_;
				ProtonPlusModelsInstalledToolEntry* _tmp27_;
				gchar* _tmp28_;
				gchar* _tmp29_;
				if (!_tmp14_) {
					gint _tmp15_;
					_tmp15_ = index;
					index = _tmp15_ + 1;
				}
				_tmp14_ = FALSE;
				_tmp16_ = self->priv->entries;
				_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp16_);
				_tmp18_ = _tmp17_;
				if (!(index < _tmp18_)) {
					break;
				}
				_tmp19_ = self->priv->entries;
				_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, index);
				entry = (ProtonPlusModelsInstalledToolEntry*) _tmp20_;
				_tmp22_ = entry;
				if (proton_plus_models_installed_tool_entry_has_persisted_identity (_tmp22_)) {
					_tmp21_ = TRUE;
				} else {
					ProtonPlusModelsInstalledToolEntry* _tmp23_;
					_tmp23_ = entry;
					_tmp21_ = !proton_plus_models_installed_tool_inventory_legacy_metadata_matches_tool (self, _tmp23_, tool);
				}
				if (_tmp21_) {
					_g_object_unref0 (entry);
					continue;
				}
				_tmp24_ = entry;
				if (!proton_plus_models_installed_tool_inventory_legacy_metadata_match_is_unambiguous (self, _tmp24_)) {
					_g_object_unref0 (entry);
					continue;
				}
				_tmp25_ = proton_plus_models_installed_tool_inventory_migrate_legacy_identity (self, index, tool);
				resolved_entry = _tmp25_;
				_tmp26_ = resolved_entry;
				_tmp27_ = resolved_entry;
				_tmp28_ = proton_plus_models_installed_tool_inventory_usage_identifier_for (self, _tmp27_);
				_tmp29_ = _tmp28_;
				proton_plus_models_installed_tool_inventory_set_tool_state (self, (ProtonPlusModelsTool*) tool, _tmp26_, _tmp29_);
				_g_free0 (_tmp29_);
				_g_object_unref0 (resolved_entry);
				_g_object_unref0 (entry);
				return;
			}
		}
	}
	{
		GeeArrayList* _entry_list = NULL;
		GeeArrayList* _tmp30_;
		gint _entry_size = 0;
		GeeArrayList* _tmp31_;
		gint _tmp32_;
		gint _tmp33_;
		gint _entry_index = 0;
		_tmp30_ = self->priv->entries;
		_entry_list = _tmp30_;
		_tmp31_ = _entry_list;
		_tmp32_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp31_);
		_tmp33_ = _tmp32_;
		_entry_size = _tmp33_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp34_;
			gint _tmp35_;
			ProtonPlusModelsInstalledToolEntry* entry = NULL;
			GeeArrayList* _tmp36_;
			gpointer _tmp37_;
			gboolean _tmp38_ = FALSE;
			ProtonPlusModelsInstalledToolEntry* _tmp39_;
			_entry_index = _entry_index + 1;
			_tmp34_ = _entry_index;
			_tmp35_ = _entry_size;
			if (!(_tmp34_ < _tmp35_)) {
				break;
			}
			_tmp36_ = _entry_list;
			_tmp37_ = gee_abstract_list_get ((GeeAbstractList*) _tmp36_, _entry_index);
			entry = (ProtonPlusModelsInstalledToolEntry*) _tmp37_;
			_tmp39_ = entry;
			if (!proton_plus_models_installed_tool_entry_has_persisted_identity (_tmp39_)) {
				ProtonPlusModelsInstalledToolEntry* _tmp40_;
				const gchar* _tmp41_;
				const gchar* _tmp42_;
				_tmp40_ = entry;
				_tmp41_ = proton_plus_models_installed_tool_entry_get_directory_name (_tmp40_);
				_tmp42_ = _tmp41_;
				_tmp38_ = proton_plus_models_installed_tool_inventory_identifier_matches_tool (self, _tmp42_, tool);
			} else {
				_tmp38_ = FALSE;
			}
			if (_tmp38_) {
				ProtonPlusModelsInstalledToolEntry* _tmp43_;
				ProtonPlusModelsInstalledToolEntry* _tmp44_;
				const gchar* _tmp45_;
				const gchar* _tmp46_;
				_tmp43_ = entry;
				_tmp44_ = entry;
				_tmp45_ = proton_plus_models_installed_tool_entry_get_directory_name (_tmp44_);
				_tmp46_ = _tmp45_;
				proton_plus_models_installed_tool_inventory_set_tool_state (self, (ProtonPlusModelsTool*) tool, _tmp43_, _tmp46_);
				_g_object_unref0 (entry);
				return;
			}
			_g_object_unref0 (entry);
		}
	}
	{
		GeeArrayList* _entry_list = NULL;
		GeeArrayList* _tmp47_;
		gint _entry_size = 0;
		GeeArrayList* _tmp48_;
		gint _tmp49_;
		gint _tmp50_;
		gint _entry_index = 0;
		_tmp47_ = self->priv->entries;
		_entry_list = _tmp47_;
		_tmp48_ = _entry_list;
		_tmp49_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp48_);
		_tmp50_ = _tmp49_;
		_entry_size = _tmp50_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp51_;
			gint _tmp52_;
			ProtonPlusModelsInstalledToolEntry* entry = NULL;
			GeeArrayList* _tmp53_;
			gpointer _tmp54_;
			gboolean _tmp55_ = FALSE;
			ProtonPlusModelsInstalledToolEntry* _tmp56_;
			ProtonPlusModelsInstalledToolEntry* _tmp60_;
			const gchar* _tmp61_;
			const gchar* _tmp62_;
			ProtonPlusModelsInstalledToolEntry* _tmp67_;
			const gchar* _tmp68_;
			const gchar* _tmp69_;
			_entry_index = _entry_index + 1;
			_tmp51_ = _entry_index;
			_tmp52_ = _entry_size;
			if (!(_tmp51_ < _tmp52_)) {
				break;
			}
			_tmp53_ = _entry_list;
			_tmp54_ = gee_abstract_list_get ((GeeAbstractList*) _tmp53_, _entry_index);
			entry = (ProtonPlusModelsInstalledToolEntry*) _tmp54_;
			_tmp56_ = entry;
			if (proton_plus_models_installed_tool_entry_has_persisted_identity (_tmp56_)) {
				_tmp55_ = TRUE;
			} else {
				ProtonPlusModelsInstalledToolEntry* _tmp57_;
				gboolean _tmp58_;
				gboolean _tmp59_;
				_tmp57_ = entry;
				_tmp58_ = proton_plus_models_installed_tool_entry_get_has_compatibilitytool_vdf (_tmp57_);
				_tmp59_ = _tmp58_;
				_tmp55_ = !_tmp59_;
			}
			if (_tmp55_) {
				_g_object_unref0 (entry);
				continue;
			}
			_tmp60_ = entry;
			_tmp61_ = proton_plus_models_installed_tool_entry_get_internal_title (_tmp60_);
			_tmp62_ = _tmp61_;
			if (proton_plus_models_installed_tool_inventory_identifier_matches_tool (self, _tmp62_, tool)) {
				ProtonPlusModelsInstalledToolEntry* _tmp63_;
				ProtonPlusModelsInstalledToolEntry* _tmp64_;
				gchar* _tmp65_;
				gchar* _tmp66_;
				_tmp63_ = entry;
				_tmp64_ = entry;
				_tmp65_ = proton_plus_models_installed_tool_inventory_usage_identifier_for (self, _tmp64_);
				_tmp66_ = _tmp65_;
				proton_plus_models_installed_tool_inventory_set_tool_state (self, (ProtonPlusModelsTool*) tool, _tmp63_, _tmp66_);
				_g_free0 (_tmp66_);
				_g_object_unref0 (entry);
				return;
			}
			_tmp67_ = entry;
			_tmp68_ = proton_plus_models_installed_tool_entry_get_display_title (_tmp67_);
			_tmp69_ = _tmp68_;
			if (proton_plus_models_installed_tool_inventory_identifier_matches_tool (self, _tmp69_, tool)) {
				ProtonPlusModelsInstalledToolEntry* _tmp70_;
				ProtonPlusModelsInstalledToolEntry* _tmp71_;
				gchar* _tmp72_;
				gchar* _tmp73_;
				_tmp70_ = entry;
				_tmp71_ = entry;
				_tmp72_ = proton_plus_models_installed_tool_inventory_usage_identifier_for (self, _tmp71_);
				_tmp73_ = _tmp72_;
				proton_plus_models_installed_tool_inventory_set_tool_state (self, (ProtonPlusModelsTool*) tool, _tmp70_, _tmp73_);
				_g_free0 (_tmp73_);
				_g_object_unref0 (entry);
				return;
			}
			_g_object_unref0 (entry);
		}
	}
}

static gboolean
proton_plus_models_installed_tool_inventory_persisted_identity_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                             ProtonPlusModelsInstalledToolEntry* entry,
                                                                             ProtonPlusModelsToolsProviderTool* tool)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp25_ = FALSE;
	gboolean _tmp26_ = FALSE;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	g_return_val_if_fail (tool != NULL, FALSE);
	_tmp0_ = proton_plus_models_installed_tool_entry_get_tool_id (entry);
	_tmp1_ = _tmp0_;
	if (g_strcmp0 (_tmp1_, "") != 0) {
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp4_ = proton_plus_models_installed_tool_entry_get_tool_id (entry);
		_tmp5_ = _tmp4_;
		_tmp6_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) tool);
		_tmp7_ = _tmp6_;
		if (g_strcmp0 (_tmp5_, _tmp7_) == 0) {
			gboolean _tmp8_ = FALSE;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp9_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
			_tmp10_ = _tmp9_;
			if (g_strcmp0 (_tmp10_, "") == 0) {
				_tmp8_ = TRUE;
			} else {
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp11_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
				_tmp12_ = _tmp11_;
				_tmp13_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) tool);
				_tmp14_ = _tmp13_;
				_tmp8_ = g_strcmp0 (_tmp12_, _tmp14_) == 0;
			}
			_tmp3_ = _tmp8_;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			gboolean _tmp15_ = FALSE;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			_tmp16_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
			_tmp17_ = _tmp16_;
			if (g_strcmp0 (_tmp17_, "") == 0) {
				_tmp15_ = TRUE;
			} else {
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				ProtonPlusModelsGroup* _tmp20_;
				ProtonPlusModelsLauncher* _tmp21_;
				ProtonPlusModelsLauncher* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				_tmp18_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
				_tmp19_ = _tmp18_;
				_tmp20_ = self->priv->group;
				_tmp21_ = proton_plus_models_group_get_launcher (_tmp20_);
				_tmp22_ = _tmp21_;
				_tmp23_ = proton_plus_models_launcher_get_tool_target_id (_tmp22_);
				_tmp24_ = _tmp23_;
				_tmp15_ = g_strcmp0 (_tmp19_, _tmp24_) == 0;
			}
			_tmp2_ = _tmp15_;
		} else {
			_tmp2_ = FALSE;
		}
		result = _tmp2_;
		return result;
	}
	_tmp27_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
	_tmp28_ = _tmp27_;
	if (g_strcmp0 (_tmp28_, "") != 0) {
		const gchar* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		_tmp29_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
		_tmp30_ = _tmp29_;
		_tmp31_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) tool);
		_tmp32_ = _tmp31_;
		_tmp26_ = g_strcmp0 (_tmp30_, _tmp32_) == 0;
	} else {
		_tmp26_ = FALSE;
	}
	if (_tmp26_) {
		gboolean _tmp33_ = FALSE;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		_tmp34_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
		_tmp35_ = _tmp34_;
		if (g_strcmp0 (_tmp35_, "") == 0) {
			_tmp33_ = TRUE;
		} else {
			const gchar* _tmp36_;
			const gchar* _tmp37_;
			ProtonPlusModelsGroup* _tmp38_;
			ProtonPlusModelsLauncher* _tmp39_;
			ProtonPlusModelsLauncher* _tmp40_;
			const gchar* _tmp41_;
			const gchar* _tmp42_;
			_tmp36_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
			_tmp37_ = _tmp36_;
			_tmp38_ = self->priv->group;
			_tmp39_ = proton_plus_models_group_get_launcher (_tmp38_);
			_tmp40_ = _tmp39_;
			_tmp41_ = proton_plus_models_launcher_get_tool_target_id (_tmp40_);
			_tmp42_ = _tmp41_;
			_tmp33_ = g_strcmp0 (_tmp37_, _tmp42_) == 0;
		}
		_tmp25_ = _tmp33_;
	} else {
		_tmp25_ = FALSE;
	}
	result = _tmp25_;
	return result;
}

static gboolean
proton_plus_models_installed_tool_inventory_legacy_metadata_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                          ProtonPlusModelsInstalledToolEntry* entry,
                                                                          ProtonPlusModelsToolsProviderTool* tool)
{
	gboolean endpoint_matches = FALSE;
	ProtonPlusModelsProvidersProviderDefinition* _tmp0_;
	ProtonPlusModelsProvidersProviderDefinition* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gboolean title_matches = FALSE;
	gboolean _tmp11_ = FALSE;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp17_ = FALSE;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	g_return_val_if_fail (tool != NULL, FALSE);
	_tmp0_ = proton_plus_models_tools_provider_tool_get_definition (tool);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_installed_tool_entry_get_runner_endpoint (entry);
	_tmp3_ = _tmp2_;
	endpoint_matches = proton_plus_models_providers_provider_definition_matches_endpoint (_tmp1_, _tmp3_);
	_tmp5_ = proton_plus_models_installed_tool_entry_get_runner_title (entry);
	_tmp6_ = _tmp5_;
	if (g_strcmp0 (_tmp6_, "") != 0) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp7_ = proton_plus_models_installed_tool_entry_get_runner_title (entry);
		_tmp8_ = _tmp7_;
		_tmp9_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) tool);
		_tmp10_ = _tmp9_;
		_tmp4_ = g_strcmp0 (_tmp8_, _tmp10_) == 0;
	} else {
		_tmp4_ = FALSE;
	}
	title_matches = _tmp4_;
	_tmp12_ = proton_plus_models_installed_tool_entry_get_runner_endpoint (entry);
	_tmp13_ = _tmp12_;
	if (g_strcmp0 (_tmp13_, "") != 0) {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = proton_plus_models_installed_tool_entry_get_runner_title (entry);
		_tmp15_ = _tmp14_;
		_tmp11_ = g_strcmp0 (_tmp15_, "") != 0;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		gboolean _tmp16_ = FALSE;
		if (endpoint_matches) {
			_tmp16_ = title_matches;
		} else {
			_tmp16_ = FALSE;
		}
		result = _tmp16_;
		return result;
	}
	_tmp18_ = proton_plus_models_installed_tool_entry_get_runner_endpoint (entry);
	_tmp19_ = _tmp18_;
	if (g_strcmp0 (_tmp19_, "") != 0) {
		_tmp17_ = TRUE;
	} else {
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp20_ = proton_plus_models_installed_tool_entry_get_runner_title (entry);
		_tmp21_ = _tmp20_;
		_tmp17_ = g_strcmp0 (_tmp21_, "") != 0;
	}
	if (_tmp17_) {
		gboolean _tmp22_ = FALSE;
		if (endpoint_matches) {
			_tmp22_ = TRUE;
		} else {
			_tmp22_ = title_matches;
		}
		result = _tmp22_;
		return result;
	}
	_tmp23_ = proton_plus_models_installed_tool_entry_get_tag (entry);
	_tmp24_ = _tmp23_;
	result = proton_plus_models_installed_tool_inventory_legacy_tag_matches_tool (self, _tmp24_, tool);
	return result;
}

static gboolean
proton_plus_models_installed_tool_inventory_legacy_tag_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                     const gchar* tag,
                                                                     ProtonPlusModelsToolsProviderTool* tool)
{
	ProtonPlusModelsReleaseCatalog* catalog = NULL;
	ProtonPlusModelsReleaseCatalog* _tmp0_;
	ProtonPlusModelsReleaseCatalog* _tmp1_;
	ProtonPlusModelsReleaseCatalog* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (tag != NULL, FALSE);
	g_return_val_if_fail (tool != NULL, FALSE);
	_tmp0_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) tool);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	catalog = _tmp2_;
	if (g_strcmp0 (tag, "") == 0) {
		_tmp3_ = TRUE;
	} else {
		ProtonPlusModelsReleaseCatalog* _tmp4_;
		_tmp4_ = catalog;
		_tmp3_ = _tmp4_ == NULL;
	}
	if (_tmp3_) {
		result = FALSE;
		_g_object_unref0 (catalog);
		return result;
	}
	{
		GeeLinkedList* _release_list = NULL;
		ProtonPlusModelsReleaseCatalog* _tmp5_;
		GeeLinkedList* _tmp6_;
		GeeLinkedList* _tmp7_;
		gint _release_size = 0;
		GeeLinkedList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _release_index = 0;
		_tmp5_ = catalog;
		_tmp6_ = proton_plus_models_release_catalog_get_releases (_tmp5_);
		_tmp7_ = _tmp6_;
		_release_list = _tmp7_;
		_tmp8_ = _release_list;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_release_size = _tmp10_;
		_release_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			ProtonPlusModelsRelease* release = NULL;
			GeeLinkedList* _tmp13_;
			gpointer _tmp14_;
			gboolean _tmp15_ = FALSE;
			ProtonPlusModelsRelease* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			_release_index = _release_index + 1;
			_tmp11_ = _release_index;
			_tmp12_ = _release_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _release_list;
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, _release_index);
			release = (ProtonPlusModelsRelease*) _tmp14_;
			_tmp16_ = release;
			_tmp17_ = proton_plus_models_release_get_title (_tmp16_);
			_tmp18_ = _tmp17_;
			if (g_strcmp0 (tag, _tmp18_) == 0) {
				_tmp15_ = TRUE;
			} else {
				ProtonPlusModelsRelease* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				_tmp19_ = release;
				_tmp20_ = proton_plus_models_release_get_source_tag (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp15_ = g_strcmp0 (tag, _tmp21_) == 0;
			}
			if (_tmp15_) {
				result = TRUE;
				_g_object_unref0 (release);
				_g_object_unref0 (catalog);
				return result;
			}
			_g_object_unref0 (release);
		}
	}
	result = FALSE;
	_g_object_unref0 (catalog);
	return result;
}

static gboolean
proton_plus_models_installed_tool_inventory_legacy_metadata_match_is_unambiguous (ProtonPlusModelsInstalledToolInventory* self,
                                                                                  ProtonPlusModelsInstalledToolEntry* entry)
{
	gint matches = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	matches = 0;
	{
		GeeLinkedList* _candidate_list = NULL;
		ProtonPlusModelsGroup* _tmp0_;
		GeeLinkedList* _tmp1_;
		GeeLinkedList* _tmp2_;
		gint _candidate_size = 0;
		GeeLinkedList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _candidate_index = 0;
		_tmp0_ = self->priv->group;
		_tmp1_ = proton_plus_models_group_get_tools (_tmp0_);
		_tmp2_ = _tmp1_;
		_candidate_list = _tmp2_;
		_tmp3_ = _candidate_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_candidate_size = _tmp5_;
		_candidate_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ProtonPlusModelsTool* candidate = NULL;
			GeeLinkedList* _tmp8_;
			gpointer _tmp9_;
			ProtonPlusModelsToolsProviderTool* provider_candidate = NULL;
			ProtonPlusModelsTool* _tmp10_;
			ProtonPlusModelsToolsProviderTool* _tmp11_;
			gboolean _tmp12_ = FALSE;
			ProtonPlusModelsToolsProviderTool* _tmp13_;
			_candidate_index = _candidate_index + 1;
			_tmp6_ = _candidate_index;
			_tmp7_ = _candidate_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _candidate_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _candidate_index);
			candidate = (ProtonPlusModelsTool*) _tmp9_;
			_tmp10_ = candidate;
			_tmp11_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_tmp10_) ? ((ProtonPlusModelsToolsProviderTool*) _tmp10_) : NULL);
			provider_candidate = _tmp11_;
			_tmp13_ = provider_candidate;
			if (_tmp13_ != NULL) {
				ProtonPlusModelsToolsProviderTool* _tmp14_;
				_tmp14_ = provider_candidate;
				_tmp12_ = proton_plus_models_installed_tool_inventory_legacy_metadata_matches_tool (self, entry, _tmp14_);
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				gint _tmp15_;
				_tmp15_ = matches;
				matches = _tmp15_ + 1;
			}
			_g_object_unref0 (provider_candidate);
			_g_object_unref0 (candidate);
		}
	}
	result = matches == 1;
	return result;
}

static ProtonPlusModelsInstalledToolEntry*
proton_plus_models_installed_tool_inventory_migrate_legacy_identity (ProtonPlusModelsInstalledToolInventory* self,
                                                                     gint index,
                                                                     ProtonPlusModelsToolsProviderTool* tool)
{
	ProtonPlusModelsInstalledToolEntry* entry = NULL;
	GeeArrayList* _tmp0_;
	gpointer _tmp1_;
	ProtonPlusUtilsMetadata* metadata = NULL;
	ProtonPlusModelsInstalledToolEntry* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ProtonPlusUtilsMetadata* _tmp5_;
	ProtonPlusUtilsMetadata* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ProtonPlusUtilsMetadata* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	ProtonPlusUtilsMetadata* _tmp12_;
	ProtonPlusModelsGroup* _tmp13_;
	ProtonPlusModelsLauncher* _tmp14_;
	ProtonPlusModelsLauncher* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	ProtonPlusUtilsMetadata* _tmp18_;
	ProtonPlusModelsInstalledToolEntry* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	ProtonPlusModelsInstalledToolEntry* migrated_entry = NULL;
	ProtonPlusModelsInstalledToolEntry* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	ProtonPlusModelsGroup* _tmp27_;
	ProtonPlusModelsLauncher* _tmp28_;
	ProtonPlusModelsLauncher* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	ProtonPlusModelsInstalledToolEntry* _tmp32_;
	GeeArrayList* _tmp33_;
	ProtonPlusModelsInstalledToolEntry* _tmp34_;
	ProtonPlusModelsInstalledToolEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (tool != NULL, NULL);
	_tmp0_ = self->priv->entries;
	_tmp1_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, index);
	entry = (ProtonPlusModelsInstalledToolEntry*) _tmp1_;
	_tmp2_ = entry;
	_tmp3_ = proton_plus_models_installed_tool_entry_get_path (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = proton_plus_utils_metadata_load (_tmp4_);
	metadata = _tmp5_;
	_tmp6_ = metadata;
	_tmp7_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) tool);
	_tmp8_ = _tmp7_;
	proton_plus_utils_metadata_set_provider_id (_tmp6_, _tmp8_);
	_tmp9_ = metadata;
	_tmp10_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) tool);
	_tmp11_ = _tmp10_;
	proton_plus_utils_metadata_set_tool_id (_tmp9_, _tmp11_);
	_tmp12_ = metadata;
	_tmp13_ = self->priv->group;
	_tmp14_ = proton_plus_models_group_get_launcher (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = proton_plus_models_launcher_get_tool_target_id (_tmp15_);
	_tmp17_ = _tmp16_;
	proton_plus_utils_metadata_set_launcher_id (_tmp12_, _tmp17_);
	_tmp18_ = metadata;
	_tmp19_ = entry;
	_tmp20_ = proton_plus_models_installed_tool_entry_get_path (_tmp19_);
	_tmp21_ = _tmp20_;
	if (!proton_plus_utils_metadata_save (_tmp18_, _tmp21_)) {
		result = entry;
		_g_object_unref0 (metadata);
		return result;
	}
	_tmp22_ = entry;
	_tmp23_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) tool);
	_tmp24_ = _tmp23_;
	_tmp25_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) tool);
	_tmp26_ = _tmp25_;
	_tmp27_ = self->priv->group;
	_tmp28_ = proton_plus_models_group_get_launcher (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = proton_plus_models_launcher_get_tool_target_id (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = proton_plus_models_installed_tool_entry_with_stable_identity (_tmp22_, _tmp24_, _tmp26_, _tmp31_);
	migrated_entry = _tmp32_;
	_tmp33_ = self->priv->entries;
	_tmp34_ = migrated_entry;
	gee_abstract_list_set ((GeeAbstractList*) _tmp33_, index, _tmp34_);
	result = migrated_entry;
	_g_object_unref0 (metadata);
	_g_object_unref0 (entry);
	return result;
}

static gboolean
proton_plus_models_installed_tool_inventory_identifier_matches_tool (ProtonPlusModelsInstalledToolInventory* self,
                                                                     const gchar* identifier,
                                                                     ProtonPlusModelsToolsProviderTool* tool)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	ProtonPlusModelsReleaseCatalog* catalog = NULL;
	ProtonPlusModelsReleaseCatalog* _tmp7_;
	ProtonPlusModelsReleaseCatalog* _tmp8_;
	ProtonPlusModelsReleaseCatalog* _tmp9_;
	gboolean _tmp10_ = FALSE;
	ProtonPlusModelsReleaseCatalog* _tmp11_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (identifier != NULL, FALSE);
	g_return_val_if_fail (tool != NULL, FALSE);
	if (g_strcmp0 (identifier, "") == 0) {
		result = FALSE;
		return result;
	}
	_tmp1_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) tool);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (identifier, _tmp2_) == 0) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp3_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) tool);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("%s Latest", _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = g_strcmp0 (identifier, _tmp6_) == 0;
		_g_free0 (_tmp6_);
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	_tmp7_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) tool);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	catalog = _tmp9_;
	_tmp11_ = catalog;
	if (_tmp11_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		ProtonPlusModelsReleaseCatalog* _tmp12_;
		GeeLinkedList* _tmp13_;
		GeeLinkedList* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		_tmp12_ = catalog;
		_tmp13_ = proton_plus_models_release_catalog_get_releases (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp10_ = _tmp16_ == 0;
	}
	if (_tmp10_) {
		result = FALSE;
		_g_object_unref0 (catalog);
		return result;
	}
	{
		GeeLinkedList* _release_list = NULL;
		ProtonPlusModelsReleaseCatalog* _tmp17_;
		GeeLinkedList* _tmp18_;
		GeeLinkedList* _tmp19_;
		gint _release_size = 0;
		GeeLinkedList* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _release_index = 0;
		_tmp17_ = catalog;
		_tmp18_ = proton_plus_models_release_catalog_get_releases (_tmp17_);
		_tmp19_ = _tmp18_;
		_release_list = _tmp19_;
		_tmp20_ = _release_list;
		_tmp21_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp20_);
		_tmp22_ = _tmp21_;
		_release_size = _tmp22_;
		_release_index = -1;
		while (TRUE) {
			gint _tmp23_;
			gint _tmp24_;
			ProtonPlusModelsRelease* release = NULL;
			GeeLinkedList* _tmp25_;
			gpointer _tmp26_;
			gchar* directory_name = NULL;
			ProtonPlusModelsRelease* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			gchar* _tmp30_;
			const gchar* _tmp31_;
			_release_index = _release_index + 1;
			_tmp23_ = _release_index;
			_tmp24_ = _release_size;
			if (!(_tmp23_ < _tmp24_)) {
				break;
			}
			_tmp25_ = _release_list;
			_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, _release_index);
			release = (ProtonPlusModelsRelease*) _tmp26_;
			_tmp27_ = release;
			_tmp28_ = proton_plus_models_release_get_title (_tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = proton_plus_models_tools_provider_tool_get_directory_name (tool, _tmp29_);
			directory_name = _tmp30_;
			_tmp31_ = directory_name;
			if (g_strcmp0 (identifier, _tmp31_) == 0) {
				result = TRUE;
				_g_free0 (directory_name);
				_g_object_unref0 (release);
				_g_object_unref0 (catalog);
				return result;
			}
			{
				GeeLinkedList* _variant_list = NULL;
				GeeLinkedList* _tmp32_;
				GeeLinkedList* _tmp33_;
				gint _variant_size = 0;
				GeeLinkedList* _tmp34_;
				gint _tmp35_;
				gint _tmp36_;
				gint _variant_index = 0;
				_tmp32_ = proton_plus_models_tools_provider_tool_get_variants (tool);
				_tmp33_ = _tmp32_;
				_variant_list = _tmp33_;
				_tmp34_ = _variant_list;
				_tmp35_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp34_);
				_tmp36_ = _tmp35_;
				_variant_size = _tmp36_;
				_variant_index = -1;
				while (TRUE) {
					gint _tmp37_;
					gint _tmp38_;
					ProtonPlusModelsVariant* variant = NULL;
					GeeLinkedList* _tmp39_;
					gpointer _tmp40_;
					const gchar* _tmp41_;
					ProtonPlusModelsVariant* _tmp42_;
					gchar* _tmp43_;
					gchar* _tmp44_;
					gchar* _tmp45_;
					gchar* _tmp46_;
					gboolean _tmp47_;
					_variant_index = _variant_index + 1;
					_tmp37_ = _variant_index;
					_tmp38_ = _variant_size;
					if (!(_tmp37_ < _tmp38_)) {
						break;
					}
					_tmp39_ = _variant_list;
					_tmp40_ = gee_abstract_list_get ((GeeAbstractList*) _tmp39_, _variant_index);
					variant = (ProtonPlusModelsVariant*) _tmp40_;
					_tmp41_ = directory_name;
					_tmp42_ = variant;
					_tmp43_ = proton_plus_models_installed_tool_inventory_variant_directory_suffix (self, _tmp42_);
					_tmp44_ = _tmp43_;
					_tmp45_ = g_strdup_printf ("%s%s", _tmp41_, _tmp44_);
					_tmp46_ = _tmp45_;
					_tmp47_ = g_strcmp0 (identifier, _tmp46_) == 0;
					_g_free0 (_tmp46_);
					_g_free0 (_tmp44_);
					if (_tmp47_) {
						result = TRUE;
						_g_object_unref0 (variant);
						_g_free0 (directory_name);
						_g_object_unref0 (release);
						_g_object_unref0 (catalog);
						return result;
					}
					_g_object_unref0 (variant);
				}
			}
			_g_free0 (directory_name);
			_g_object_unref0 (release);
		}
	}
	result = FALSE;
	_g_object_unref0 (catalog);
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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;
}

static gchar*
proton_plus_models_installed_tool_inventory_variant_directory_suffix (ProtonPlusModelsInstalledToolInventory* self,
                                                                      ProtonPlusModelsVariant* variant)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (variant != NULL, NULL);
	_tmp0_ = proton_plus_models_variant_get_is_default (variant);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("");
		result = _tmp2_;
		return result;
	}
	_tmp3_ = proton_plus_models_variant_get_name (variant);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_replace (_tmp4_, " ", "_");
	_tmp6_ = _tmp5_;
	_tmp7_ = string_replace (_tmp6_, "/", "_");
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup_printf ("-%s", _tmp8_);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	result = _tmp10_;
	return result;
}

static gchar*
proton_plus_models_installed_tool_inventory_usage_identifier_for (ProtonPlusModelsInstalledToolInventory* self,
                                                                  ProtonPlusModelsInstalledToolEntry* entry)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp12_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = proton_plus_models_installed_tool_entry_get_has_compatibilitytool_vdf (entry);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp2_ = proton_plus_models_installed_tool_entry_get_directory_name (entry);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strdup (_tmp3_);
		result = _tmp4_;
		return result;
	}
	_tmp6_ = proton_plus_models_installed_tool_entry_get_internal_title (entry);
	_tmp7_ = _tmp6_;
	if (g_strcmp0 (_tmp7_, "") != 0) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp8_ = proton_plus_models_installed_tool_entry_get_internal_title (entry);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_;
	} else {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = proton_plus_models_installed_tool_entry_get_directory_name (entry);
		_tmp11_ = _tmp10_;
		_tmp5_ = _tmp11_;
	}
	_tmp12_ = g_strdup (_tmp5_);
	result = _tmp12_;
	return result;
}

static void
proton_plus_models_installed_tool_inventory_set_tool_state (ProtonPlusModelsInstalledToolInventory* self,
                                                            ProtonPlusModelsTool* tool,
                                                            ProtonPlusModelsInstalledToolEntry* entry,
                                                            const gchar* usage_identifier)
{
	ProtonPlusModelsGroup* _tmp0_;
	ProtonPlusModelsLauncher* _tmp1_;
	ProtonPlusModelsLauncher* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tool != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (usage_identifier != NULL);
	_tmp0_ = self->priv->group;
	_tmp1_ = proton_plus_models_group_get_launcher (_tmp0_);
	_tmp2_ = _tmp1_;
	proton_plus_models_tool_set_resolved_installation_state (tool, entry, usage_identifier, proton_plus_models_launcher_get_compatibility_tool_usage_count (_tmp2_, usage_identifier) > 0);
}

gboolean
proton_plus_models_installed_tool_inventory_get_is_stale (ProtonPlusModelsInstalledToolInventory* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_stale;
	return result;
}

static void
proton_plus_models_installed_tool_inventory_set_is_stale (ProtonPlusModelsInstalledToolInventory* self,
                                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_inventory_get_is_stale (self);
	if (old_value != value) {
		self->priv->_is_stale = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_inventory_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY]);
	}
}

guint
proton_plus_models_installed_tool_inventory_get_refresh_generation (ProtonPlusModelsInstalledToolInventory* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_refresh_generation;
	return result;
}

static void
proton_plus_models_installed_tool_inventory_set_refresh_generation (ProtonPlusModelsInstalledToolInventory* self,
                                                                    guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_installed_tool_inventory_get_refresh_generation (self);
	if (old_value != value) {
		self->priv->_refresh_generation = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_installed_tool_inventory_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY]);
	}
}

static void
proton_plus_models_installed_tool_inventory_class_init (ProtonPlusModelsInstalledToolInventoryClass * klass,
                                                        gpointer klass_data)
{
	proton_plus_models_installed_tool_inventory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsInstalledToolInventory_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_installed_tool_inventory_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_installed_tool_inventory_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_installed_tool_inventory_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY, proton_plus_models_installed_tool_inventory_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY] = g_param_spec_boolean ("is-stale", "is-stale", "is-stale", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY, proton_plus_models_installed_tool_inventory_properties[PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY] = g_param_spec_uint ("refresh-generation", "refresh-generation", "refresh-generation", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_models_installed_tool_inventory_instance_init (ProtonPlusModelsInstalledToolInventory * self,
                                                           gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = proton_plus_models_installed_tool_inventory_get_instance_private (self);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->entries = _tmp0_;
	self->priv->_is_stale = TRUE;
	self->priv->_refresh_generation = (guint) 0;
}

static void
proton_plus_models_installed_tool_inventory_finalize (GObject * obj)
{
	ProtonPlusModelsInstalledToolInventory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_INVENTORY, ProtonPlusModelsInstalledToolInventory);
	_g_object_unref0 (self->priv->group);
	_g_object_unref0 (self->priv->entries);
	G_OBJECT_CLASS (proton_plus_models_installed_tool_inventory_parent_class)->finalize (obj);
}

static GType
proton_plus_models_installed_tool_inventory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsInstalledToolInventoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_installed_tool_inventory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsInstalledToolInventory), 0, (GInstanceInitFunc) proton_plus_models_installed_tool_inventory_instance_init, NULL };
	GType proton_plus_models_installed_tool_inventory_type_id;
	proton_plus_models_installed_tool_inventory_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsInstalledToolInventory", &g_define_type_info, 0);
	ProtonPlusModelsInstalledToolInventory_private_offset = g_type_add_instance_private (proton_plus_models_installed_tool_inventory_type_id, sizeof (ProtonPlusModelsInstalledToolInventoryPrivate));
	return proton_plus_models_installed_tool_inventory_type_id;
}

GType
proton_plus_models_installed_tool_inventory_get_type (void)
{
	static volatile gsize proton_plus_models_installed_tool_inventory_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_installed_tool_inventory_type_id__once)) {
		GType proton_plus_models_installed_tool_inventory_type_id;
		proton_plus_models_installed_tool_inventory_type_id = proton_plus_models_installed_tool_inventory_get_type_once ();
		g_once_init_leave (&proton_plus_models_installed_tool_inventory_type_id__once, proton_plus_models_installed_tool_inventory_type_id);
	}
	return proton_plus_models_installed_tool_inventory_type_id__once;
}

static void
_vala_proton_plus_models_installed_tool_inventory_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec)
{
	ProtonPlusModelsInstalledToolInventory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_INVENTORY, ProtonPlusModelsInstalledToolInventory);
	switch (property_id) {
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_installed_tool_inventory_get_is_stale (self));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY:
		g_value_set_uint (value, proton_plus_models_installed_tool_inventory_get_refresh_generation (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_installed_tool_inventory_set_property (GObject * object,
                                                                guint property_id,
                                                                const GValue * value,
                                                                GParamSpec * pspec)
{
	ProtonPlusModelsInstalledToolInventory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TYPE_INSTALLED_TOOL_INVENTORY, ProtonPlusModelsInstalledToolInventory);
	switch (property_id) {
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_IS_STALE_PROPERTY:
		proton_plus_models_installed_tool_inventory_set_is_stale (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_MODELS_INSTALLED_TOOL_INVENTORY_REFRESH_GENERATION_PROPERTY:
		proton_plus_models_installed_tool_inventory_set_refresh_generation (self, g_value_get_uint (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

