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

#include "protonplus_core.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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_PROVIDERS_PROVIDER_CATALOG_0_PROPERTY,
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_CATALOG_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_providers_provider_catalog_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_CATALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer proton_plus_models_providers_provider_catalog_parent_class = NULL;

static GType proton_plus_models_providers_provider_catalog_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

ProtonPlusModelsToolsProviderTool*
proton_plus_models_providers_provider_catalog_create_tool (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                           ProtonPlusModelsGroup* group)
{
	ProtonPlusModelsProvidersInstallLayout* install_layout = NULL;
	ProtonPlusModelsLauncher* _tmp0_;
	ProtonPlusModelsLauncher* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ProtonPlusModelsProvidersInstallLayout* _tmp4_;
	ProtonPlusModelsProvidersInstallLayout* _tmp5_;
	ProtonPlusProvidersSourcesReleaseSource* source = NULL;
	ProtonPlusModelsProvidersSourceType _tmp6_;
	ProtonPlusModelsProvidersSourceType _tmp7_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp8_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp9_;
	ProtonPlusProvidersSourcesReleaseSource* _tmp10_;
	ProtonPlusModelsProvidersInstallLayout* _tmp11_;
	ProtonPlusModelsToolsProviderTool* _tmp12_;
	ProtonPlusModelsToolsProviderTool* result;
	g_return_val_if_fail (definition != NULL, NULL);
	g_return_val_if_fail (group != NULL, NULL);
	_tmp0_ = proton_plus_models_group_get_launcher (group);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_launcher_get_tool_target_family_id (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_providers_provider_definition_get_install_layout (definition, _tmp3_);
	install_layout = _tmp4_;
	_tmp5_ = install_layout;
	if (_tmp5_ == NULL) {
		result = NULL;
		_g_object_unref0 (install_layout);
		return result;
	}
	_tmp6_ = proton_plus_models_providers_provider_definition_get_source_type (definition);
	_tmp7_ = _tmp6_;
	_tmp8_ = proton_plus_providers_sources_release_source_registry_create (_tmp7_);
	source = _tmp8_;
	_tmp9_ = source;
	if (_tmp9_ == NULL) {
		result = NULL;
		_g_object_unref0 (source);
		_g_object_unref0 (install_layout);
		return result;
	}
	_tmp10_ = source;
	_tmp11_ = install_layout;
	_tmp12_ = proton_plus_models_tools_provider_tool_new_with_catalog (definition, _tmp10_, group, _tmp11_);
	result = _tmp12_;
	_g_object_unref0 (source);
	_g_object_unref0 (install_layout);
	return result;
}

ProtonPlusModelsProvidersProviderCatalog*
proton_plus_models_providers_provider_catalog_construct (GType object_type)
{
	ProtonPlusModelsProvidersProviderCatalog * self = NULL;
	self = (ProtonPlusModelsProvidersProviderCatalog*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusModelsProvidersProviderCatalog*
proton_plus_models_providers_provider_catalog_new (void)
{
	return proton_plus_models_providers_provider_catalog_construct (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_CATALOG);
}

static void
proton_plus_models_providers_provider_catalog_class_init (ProtonPlusModelsProvidersProviderCatalogClass * klass,
                                                          gpointer klass_data)
{
	proton_plus_models_providers_provider_catalog_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_models_providers_provider_catalog_instance_init (ProtonPlusModelsProvidersProviderCatalog * self,
                                                             gpointer klass)
{
}

static GType
proton_plus_models_providers_provider_catalog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsProvidersProviderCatalogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_providers_provider_catalog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsProvidersProviderCatalog), 0, (GInstanceInitFunc) proton_plus_models_providers_provider_catalog_instance_init, NULL };
	GType proton_plus_models_providers_provider_catalog_type_id;
	proton_plus_models_providers_provider_catalog_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsProvidersProviderCatalog", &g_define_type_info, 0);
	return proton_plus_models_providers_provider_catalog_type_id;
}

GType
proton_plus_models_providers_provider_catalog_get_type (void)
{
	static volatile gsize proton_plus_models_providers_provider_catalog_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_providers_provider_catalog_type_id__once)) {
		GType proton_plus_models_providers_provider_catalog_type_id;
		proton_plus_models_providers_provider_catalog_type_id = proton_plus_models_providers_provider_catalog_get_type_once ();
		g_once_init_leave (&proton_plus_models_providers_provider_catalog_type_id__once, proton_plus_models_providers_provider_catalog_type_id);
	}
	return proton_plus_models_providers_provider_catalog_type_id__once;
}

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

