/* platform.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from platform.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "gnome-games.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.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

#define _g_free0(var) (var = (g_free (var), NULL))

static GType games_platform_get_type_once (void);

gchar*
games_platform_get_id (GamesPlatform* self)
{
	GamesPlatformIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GAMES_PLATFORM_GET_INTERFACE (self);
	if (_iface_->get_id) {
		return _iface_->get_id (self);
	}
	return NULL;
}

gchar*
games_platform_get_name (GamesPlatform* self)
{
	GamesPlatformIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GAMES_PLATFORM_GET_INTERFACE (self);
	if (_iface_->get_name) {
		return _iface_->get_name (self);
	}
	return NULL;
}

gchar*
games_platform_get_uid_prefix (GamesPlatform* self)
{
	GamesPlatformIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GAMES_PLATFORM_GET_INTERFACE (self);
	if (_iface_->get_uid_prefix) {
		return _iface_->get_uid_prefix (self);
	}
	return NULL;
}

GtkListBoxRow*
games_platform_get_row (GamesPlatform* self)
{
	GamesPlatformIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GAMES_PLATFORM_GET_INTERFACE (self);
	if (_iface_->get_row) {
		return _iface_->get_row (self);
	}
	return NULL;
}

GType
games_platform_get_snapshot_type (GamesPlatform* self)
{
	GamesPlatformIface* _iface_;
	g_return_val_if_fail (self != NULL, 0UL);
	_iface_ = GAMES_PLATFORM_GET_INTERFACE (self);
	if (_iface_->get_snapshot_type) {
		return _iface_->get_snapshot_type (self);
	}
	return 0UL;
}

guint
games_platform_hash (GamesPlatform* platform)
{
	GHashFunc _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	guint _tmp3_;
	guint result;
	g_return_val_if_fail (platform != NULL, 0U);
	_tmp0_ = g_str_hash;
	_tmp1_ = games_platform_get_id (platform);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp0_ (_tmp2_);
	_g_free0 (_tmp2_);
	result = _tmp3_;
	return result;
}

gboolean
games_platform_equal (GamesPlatform* a,
                      GamesPlatform* b)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	if (a == b) {
		_tmp0_ = TRUE;
	} else {
		GEqualFunc _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp1_ = g_str_equal;
		_tmp2_ = games_platform_get_id (a);
		_tmp3_ = _tmp2_;
		_tmp4_ = games_platform_get_id (b);
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp1_ (_tmp3_, _tmp5_);
		_g_free0 (_tmp5_);
		_g_free0 (_tmp3_);
	}
	result = _tmp0_;
	return result;
}

gint
games_platform_compare (GamesPlatform* a,
                        GamesPlatform* b)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gint _tmp4_;
	gint result;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = games_platform_get_name (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = games_platform_get_name (b);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_utf8_collate (_tmp1_, _tmp3_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

gchar*
games_platform_get_system_dir (GamesPlatform* self)
{
	gchar* platforms_dir = NULL;
	gchar* _tmp0_;
	gchar* id = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	_tmp0_ = games_application_get_platforms_dir ();
	platforms_dir = _tmp0_;
	_tmp1_ = games_platform_get_id (self);
	id = _tmp1_;
	_tmp2_ = string_to_string (platforms_dir);
	_tmp3_ = string_to_string (id);
	_tmp4_ = g_strconcat (_tmp2_, "/", _tmp3_, "/system", NULL);
	result = _tmp4_;
	_g_free0 (id);
	_g_free0 (platforms_dir);
	return result;
}

static void
games_platform_default_init (GamesPlatformIface * iface,
                             gpointer iface_data)
{
}

static GType
games_platform_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesPlatformIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_platform_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType games_platform_type_id;
	games_platform_type_id = g_type_register_static (G_TYPE_INTERFACE, "GamesPlatform", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (games_platform_type_id, G_TYPE_OBJECT);
	return games_platform_type_id;
}

GType
games_platform_get_type (void)
{
	static volatile gsize games_platform_type_id__once = 0;
	if (g_once_init_enter (&games_platform_type_id__once)) {
		GType games_platform_type_id;
		games_platform_type_id = games_platform_get_type_once ();
		g_once_init_leave (&games_platform_type_id__once, games_platform_type_id);
	}
	return games_platform_type_id__once;
}

