/* steam-tinker-launch-yad-compatibility.c generated by valac 0.56.19, the Vala compiler
 * generated from steam-tinker-launch-yad-compatibility.vala, do not modify */

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.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_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_0_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_steam_tinker_launch_yad_compatibility_properties[PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_NUM_PROPERTIES];
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

static gpointer proton_plus_services_steam_tinker_launch_yad_compatibility_parent_class = NULL;

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

static GType
proton_plus_services_steam_tinker_launch_yad_compatibility_status_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_UNKNOWN, "PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_UNKNOWN", "unknown"}, {PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_TOO_OLD, "PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_TOO_OLD", "too-old"}, {PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_SUPPORTED, "PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_SUPPORTED", "supported"}, {PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_INCOMPATIBLE_15, "PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_INCOMPATIBLE_15", "incompatible-15"}, {0, NULL, NULL}};
	GType proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id;
	proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id = g_enum_register_static ("ProtonPlusServicesSteamTinkerLaunchYadCompatibilityStatus", values);
	return proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id;
}

GType
proton_plus_services_steam_tinker_launch_yad_compatibility_status_get_type (void)
{
	static volatile gsize proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id__once)) {
		GType proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id;
		proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id = proton_plus_services_steam_tinker_launch_yad_compatibility_status_get_type_once ();
		g_once_init_leave (&proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id__once, proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id);
	}
	return proton_plus_services_steam_tinker_launch_yad_compatibility_status_type_id__once;
}

ProtonPlusServicesSteamTinkerLaunchYadCompatibilityStatus
proton_plus_services_steam_tinker_launch_yad_compatibility_classify_version_output (const gchar* output)
{
	GError* _inner_error0_ = NULL;
	ProtonPlusServicesSteamTinkerLaunchYadCompatibilityStatus result;
	g_return_val_if_fail (output != NULL, 0);
	{
		GRegex* regex = NULL;
		GRegex* _tmp0_;
		GMatchInfo* match_info = NULL;
		GRegex* _tmp1_;
		GMatchInfo* _tmp2_ = NULL;
		gboolean _tmp3_;
		gint major = 0;
		GMatchInfo* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gint _tmp7_;
		gint minor = 0;
		GMatchInfo* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gint _tmp11_;
		gboolean _tmp12_ = FALSE;
		_tmp0_ = g_regex_new ("(\\d+)[.,](\\d+)\\s*\\(GTK\\+", 0, 0, &_inner_error0_);
		regex = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = regex;
		_tmp3_ = g_regex_match (_tmp1_, output, 0, &_tmp2_);
		_g_match_info_unref0 (match_info);
		match_info = _tmp2_;
		if (!_tmp3_) {
			result = PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_UNKNOWN;
			_g_match_info_unref0 (match_info);
			_g_regex_unref0 (regex);
			return result;
		}
		_tmp4_ = match_info;
		_tmp5_ = g_match_info_fetch (_tmp4_, 1);
		_tmp6_ = _tmp5_;
		_tmp7_ = atoi (_tmp6_);
		_g_free0 (_tmp6_);
		major = _tmp7_;
		_tmp8_ = match_info;
		_tmp9_ = g_match_info_fetch (_tmp8_, 2);
		_tmp10_ = _tmp9_;
		_tmp11_ = atoi (_tmp10_);
		_g_free0 (_tmp10_);
		minor = _tmp11_;
		if (major == 15) {
			result = PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_INCOMPATIBLE_15;
			_g_match_info_unref0 (match_info);
			_g_regex_unref0 (regex);
			return result;
		}
		if (major > 7) {
			_tmp12_ = TRUE;
		} else {
			gboolean _tmp13_ = FALSE;
			if (major == 7) {
				_tmp13_ = minor >= 2;
			} else {
				_tmp13_ = FALSE;
			}
			_tmp12_ = _tmp13_;
		}
		if (_tmp12_) {
			result = PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_SUPPORTED;
			_g_match_info_unref0 (match_info);
			_g_regex_unref0 (regex);
			return result;
		}
		result = PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_TOO_OLD;
		_g_match_info_unref0 (match_info);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp14_;
		const gchar* _tmp15_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp14_ = e;
		_tmp15_ = _tmp14_->message;
		g_warning ("steam-tinker-launch-yad-compatibility.vala:26: Could not determine the" \
" installed YAD version: %s", _tmp15_);
		result = PROTON_PLUS_SERVICES_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY_STATUS_UNKNOWN;
		_g_error_free0 (e);
		return result;
	}
	__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 0;
}

ProtonPlusServicesSteamTinkerLaunchYadCompatibility*
proton_plus_services_steam_tinker_launch_yad_compatibility_construct (GType object_type)
{
	ProtonPlusServicesSteamTinkerLaunchYadCompatibility * self = NULL;
	self = (ProtonPlusServicesSteamTinkerLaunchYadCompatibility*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusServicesSteamTinkerLaunchYadCompatibility*
proton_plus_services_steam_tinker_launch_yad_compatibility_new (void)
{
	return proton_plus_services_steam_tinker_launch_yad_compatibility_construct (PROTON_PLUS_SERVICES_TYPE_STEAM_TINKER_LAUNCH_YAD_COMPATIBILITY);
}

static void
proton_plus_services_steam_tinker_launch_yad_compatibility_class_init (ProtonPlusServicesSteamTinkerLaunchYadCompatibilityClass * klass,
                                                                       gpointer klass_data)
{
	proton_plus_services_steam_tinker_launch_yad_compatibility_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_services_steam_tinker_launch_yad_compatibility_instance_init (ProtonPlusServicesSteamTinkerLaunchYadCompatibility * self,
                                                                          gpointer klass)
{
}

static GType
proton_plus_services_steam_tinker_launch_yad_compatibility_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesSteamTinkerLaunchYadCompatibilityClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_steam_tinker_launch_yad_compatibility_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesSteamTinkerLaunchYadCompatibility), 0, (GInstanceInitFunc) proton_plus_services_steam_tinker_launch_yad_compatibility_instance_init, NULL };
	GType proton_plus_services_steam_tinker_launch_yad_compatibility_type_id;
	proton_plus_services_steam_tinker_launch_yad_compatibility_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesSteamTinkerLaunchYadCompatibility", &g_define_type_info, 0);
	return proton_plus_services_steam_tinker_launch_yad_compatibility_type_id;
}

GType
proton_plus_services_steam_tinker_launch_yad_compatibility_get_type (void)
{
	static volatile gsize proton_plus_services_steam_tinker_launch_yad_compatibility_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_steam_tinker_launch_yad_compatibility_type_id__once)) {
		GType proton_plus_services_steam_tinker_launch_yad_compatibility_type_id;
		proton_plus_services_steam_tinker_launch_yad_compatibility_type_id = proton_plus_services_steam_tinker_launch_yad_compatibility_get_type_once ();
		g_once_init_leave (&proton_plus_services_steam_tinker_launch_yad_compatibility_type_id__once, proton_plus_services_steam_tinker_launch_yad_compatibility_type_id);
	}
	return proton_plus_services_steam_tinker_launch_yad_compatibility_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;
}

