/* generic-platform.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from generic-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 <glib-object.h>
#include <gtk/gtk.h>
#include <handy.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  {
	GAMES_GENERIC_PLATFORM_0_PROPERTY,
	GAMES_GENERIC_PLATFORM_NUM_PROPERTIES
};
static GParamSpec* games_generic_platform_properties[GAMES_GENERIC_PLATFORM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesGenericPlatformPrivate {
	gchar* name;
	gchar* id;
	gchar* uid_prefix;
};

static gint GamesGenericPlatform_private_offset;
static gpointer games_generic_platform_parent_class = NULL;
static GamesPlatformIface * games_generic_platform_games_platform_parent_iface = NULL;

static gchar* games_generic_platform_real_get_id (GamesPlatform* base);
static gchar* games_generic_platform_real_get_name (GamesPlatform* base);
static gchar* games_generic_platform_real_get_uid_prefix (GamesPlatform* base);
static GtkListBoxRow* games_generic_platform_real_get_row (GamesPlatform* base);
static GType games_generic_platform_real_get_snapshot_type (GamesPlatform* base);
static void games_generic_platform_finalize (GObject * obj);
static GType games_generic_platform_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_generic_platform_get_instance_private (GamesGenericPlatform* self)
{
	return G_STRUCT_MEMBER_P (self, GamesGenericPlatform_private_offset);
}

GamesGenericPlatform*
games_generic_platform_construct (GType object_type,
                                  const gchar* id,
                                  const gchar* name,
                                  const gchar* uid_prefix)
{
	GamesGenericPlatform * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (uid_prefix != NULL, NULL);
	self = (GamesGenericPlatform*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (id);
	_g_free0 (self->priv->id);
	self->priv->id = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (self->priv->name);
	self->priv->name = _tmp1_;
	_tmp2_ = g_strdup (uid_prefix);
	_g_free0 (self->priv->uid_prefix);
	self->priv->uid_prefix = _tmp2_;
	return self;
}

GamesGenericPlatform*
games_generic_platform_new (const gchar* id,
                            const gchar* name,
                            const gchar* uid_prefix)
{
	return games_generic_platform_construct (GAMES_TYPE_GENERIC_PLATFORM, id, name, uid_prefix);
}

static gchar*
games_generic_platform_real_get_id (GamesPlatform* base)
{
	GamesGenericPlatform * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (GamesGenericPlatform*) base;
	_tmp0_ = self->priv->id;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
games_generic_platform_real_get_name (GamesPlatform* base)
{
	GamesGenericPlatform * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (GamesGenericPlatform*) base;
	_tmp0_ = self->priv->name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
games_generic_platform_real_get_uid_prefix (GamesPlatform* base)
{
	GamesGenericPlatform * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (GamesGenericPlatform*) base;
	_tmp0_ = self->priv->uid_prefix;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static GtkListBoxRow*
games_generic_platform_real_get_row (GamesPlatform* base)
{
	GamesGenericPlatform * self;
	HdyActionRow* generic_row = NULL;
	HdyActionRow* _tmp0_;
	const gchar* _tmp1_;
	GtkListBoxRow* result;
	self = (GamesGenericPlatform*) base;
	_tmp0_ = (HdyActionRow*) hdy_action_row_new ();
	g_object_ref_sink (_tmp0_);
	generic_row = _tmp0_;
	_tmp1_ = self->priv->name;
	hdy_preferences_row_set_title ((HdyPreferencesRow*) generic_row, _tmp1_);
	result = (GtkListBoxRow*) generic_row;
	return result;
}

static GType
games_generic_platform_real_get_snapshot_type (GamesPlatform* base)
{
	GamesGenericPlatform * self;
	GType result;
	self = (GamesGenericPlatform*) base;
	result = GAMES_TYPE_SNAPSHOT;
	return result;
}

static void
games_generic_platform_class_init (GamesGenericPlatformClass * klass,
                                   gpointer klass_data)
{
	games_generic_platform_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesGenericPlatform_private_offset);
	G_OBJECT_CLASS (klass)->finalize = games_generic_platform_finalize;
}

static void
games_generic_platform_games_platform_interface_init (GamesPlatformIface * iface,
                                                      gpointer iface_data)
{
	games_generic_platform_games_platform_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_id = (gchar* (*) (GamesPlatform*)) games_generic_platform_real_get_id;
	iface->get_name = (gchar* (*) (GamesPlatform*)) games_generic_platform_real_get_name;
	iface->get_uid_prefix = (gchar* (*) (GamesPlatform*)) games_generic_platform_real_get_uid_prefix;
	iface->get_row = (GtkListBoxRow* (*) (GamesPlatform*)) games_generic_platform_real_get_row;
	iface->get_snapshot_type = (GType (*) (GamesPlatform*)) games_generic_platform_real_get_snapshot_type;
}

static void
games_generic_platform_instance_init (GamesGenericPlatform * self,
                                      gpointer klass)
{
	self->priv = games_generic_platform_get_instance_private (self);
}

static void
games_generic_platform_finalize (GObject * obj)
{
	GamesGenericPlatform * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_GENERIC_PLATFORM, GamesGenericPlatform);
	_g_free0 (self->priv->name);
	_g_free0 (self->priv->id);
	_g_free0 (self->priv->uid_prefix);
	G_OBJECT_CLASS (games_generic_platform_parent_class)->finalize (obj);
}

static GType
games_generic_platform_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesGenericPlatformClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_generic_platform_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesGenericPlatform), 0, (GInstanceInitFunc) games_generic_platform_instance_init, NULL };
	static const GInterfaceInfo games_platform_info = { (GInterfaceInitFunc) games_generic_platform_games_platform_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_generic_platform_type_id;
	games_generic_platform_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesGenericPlatform", &g_define_type_info, 0);
	g_type_add_interface_static (games_generic_platform_type_id, GAMES_TYPE_PLATFORM, &games_platform_info);
	GamesGenericPlatform_private_offset = g_type_add_instance_private (games_generic_platform_type_id, sizeof (GamesGenericPlatformPrivate));
	return games_generic_platform_type_id;
}

GType
games_generic_platform_get_type (void)
{
	static volatile gsize games_generic_platform_type_id__once = 0;
	if (g_once_init_enter (&games_generic_platform_type_id__once)) {
		GType games_generic_platform_type_id;
		games_generic_platform_type_id = games_generic_platform_get_type_once ();
		g_once_init_leave (&games_generic_platform_type_id__once, games_generic_platform_type_id);
	}
	return games_generic_platform_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;
}

