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

#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include "config.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PROTON_PLUS_MODELS_TYPE_LAUNCHER (proton_plus_models_launcher_get_type ())
#define PROTON_PLUS_MODELS_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncher))
#define PROTON_PLUS_MODELS_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncherClass))
#define PROTON_PLUS_MODELS_IS_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER))
#define PROTON_PLUS_MODELS_IS_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_LAUNCHER))
#define PROTON_PLUS_MODELS_LAUNCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncherClass))

typedef struct _ProtonPlusModelsLauncher ProtonPlusModelsLauncher;
typedef struct _ProtonPlusModelsLauncherClass ProtonPlusModelsLauncherClass;
typedef struct _ProtonPlusModelsLauncherPrivate ProtonPlusModelsLauncherPrivate;

#define PROTON_PLUS_MODELS_TYPE_GAME (proton_plus_models_game_get_type ())
#define PROTON_PLUS_MODELS_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGame))
#define PROTON_PLUS_MODELS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGameClass))
#define PROTON_PLUS_MODELS_IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_GAME))
#define PROTON_PLUS_MODELS_IS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_GAME))
#define PROTON_PLUS_MODELS_GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGameClass))

typedef struct _ProtonPlusModelsGame ProtonPlusModelsGame;
typedef struct _ProtonPlusModelsGameClass ProtonPlusModelsGameClass;

#define PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER (proton_plus_models_simple_runner_get_type ())
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunner))
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunnerClass))
#define PROTON_PLUS_MODELS_IS_SIMPLE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER))
#define PROTON_PLUS_MODELS_IS_SIMPLE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER))
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunnerClass))

typedef struct _ProtonPlusModelsSimpleRunner ProtonPlusModelsSimpleRunner;
typedef struct _ProtonPlusModelsSimpleRunnerClass ProtonPlusModelsSimpleRunnerClass;

#define PROTON_PLUS_MODELS_TYPE_GROUP (proton_plus_models_group_get_type ())
#define PROTON_PLUS_MODELS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroup))
#define PROTON_PLUS_MODELS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroupClass))
#define PROTON_PLUS_MODELS_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_GROUP))
#define PROTON_PLUS_MODELS_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_GROUP))
#define PROTON_PLUS_MODELS_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroupClass))

typedef struct _ProtonPlusModelsGroup ProtonPlusModelsGroup;
typedef struct _ProtonPlusModelsGroupClass ProtonPlusModelsGroupClass;
typedef enum  {
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM,
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_FLATPAK,
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SNAP
} ProtonPlusModelsLauncherInstallationTypes;

#define PROTON_PLUS_MODELS_LAUNCHER_TYPE_INSTALLATION_TYPES (proton_plus_models_launcher_installation_types_get_type ())

#define PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER (proton_plus_models_launchers_heroic_games_launcher_get_type ())
#define PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER, ProtonPlusModelsLaunchersHeroicGamesLauncher))
#define PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER, ProtonPlusModelsLaunchersHeroicGamesLauncherClass))
#define PROTON_PLUS_MODELS_LAUNCHERS_IS_HEROIC_GAMES_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER))
#define PROTON_PLUS_MODELS_LAUNCHERS_IS_HEROIC_GAMES_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER))
#define PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER, ProtonPlusModelsLaunchersHeroicGamesLauncherClass))

typedef struct _ProtonPlusModelsLaunchersHeroicGamesLauncher ProtonPlusModelsLaunchersHeroicGamesLauncher;
typedef struct _ProtonPlusModelsLaunchersHeroicGamesLauncherClass ProtonPlusModelsLaunchersHeroicGamesLauncherClass;
typedef struct _ProtonPlusModelsLaunchersHeroicGamesLauncherPrivate ProtonPlusModelsLaunchersHeroicGamesLauncherPrivate;
enum  {
	PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER_0_PROPERTY,
	PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_launchers_heroic_games_launcher_properties[PROTON_PLUS_MODELS_LAUNCHERS_HEROIC_GAMES_LAUNCHER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ProtonPlusModelsLauncher {
	GObject parent_instance;
	ProtonPlusModelsLauncherPrivate * priv;
	gchar* title;
	gchar* icon_path;
	gchar* directory;
	gboolean installed;
	gboolean has_library_support;
	GList* games;
	GeeArrayList* compatibility_tools;
	ProtonPlusModelsGroup** groups;
	gint groups_length1;
	ProtonPlusModelsLauncherInstallationTypes installation_type;
};

struct _ProtonPlusModelsLauncherClass {
	GObjectClass parent_class;
	void (*load_game_library) (ProtonPlusModelsLauncher* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gboolean (*load_game_library_finish) (ProtonPlusModelsLauncher* self, GAsyncResult* _res_);
	gint (*get_compatibility_tool_usage_count) (ProtonPlusModelsLauncher* self, const gchar* compatibility_tool_name);
};

struct _ProtonPlusModelsLaunchersHeroicGamesLauncher {
	ProtonPlusModelsLauncher parent_instance;
	ProtonPlusModelsLaunchersHeroicGamesLauncherPrivate * priv;
};

struct _ProtonPlusModelsLaunchersHeroicGamesLauncherClass {
	ProtonPlusModelsLauncherClass parent_class;
};

static gpointer proton_plus_models_launchers_heroic_games_launcher_parent_class = NULL;

VALA_EXTERN GType proton_plus_models_launcher_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsLauncher, g_object_unref)
VALA_EXTERN GType proton_plus_models_game_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsGame, g_object_unref)
VALA_EXTERN GType proton_plus_models_simple_runner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsSimpleRunner, g_object_unref)
VALA_EXTERN GType proton_plus_models_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsGroup, g_object_unref)
VALA_EXTERN GType proton_plus_models_launcher_installation_types_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType proton_plus_models_launchers_heroic_games_launcher_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsLaunchersHeroicGamesLauncher, g_object_unref)
VALA_EXTERN ProtonPlusModelsLaunchersHeroicGamesLauncher* proton_plus_models_launchers_heroic_games_launcher_new (ProtonPlusModelsLauncherInstallationTypes installation_type);
VALA_EXTERN ProtonPlusModelsLaunchersHeroicGamesLauncher* proton_plus_models_launchers_heroic_games_launcher_construct (GType object_type,
                                                                                                            ProtonPlusModelsLauncherInstallationTypes installation_type);
VALA_EXTERN ProtonPlusModelsLauncher* proton_plus_models_launcher_new (const gchar* title,
                                                           ProtonPlusModelsLauncherInstallationTypes installation_type,
                                                           const gchar* icon_path,
                                                           gchar** directories,
                                                           gint directories_length1);
VALA_EXTERN ProtonPlusModelsLauncher* proton_plus_models_launcher_construct (GType object_type,
                                                                 const gchar* title,
                                                                 ProtonPlusModelsLauncherInstallationTypes installation_type,
                                                                 const gchar* icon_path,
                                                                 gchar** directories,
                                                                 gint directories_length1);
static GType proton_plus_models_launchers_heroic_games_launcher_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

ProtonPlusModelsLaunchersHeroicGamesLauncher*
proton_plus_models_launchers_heroic_games_launcher_construct (GType object_type,
                                                              ProtonPlusModelsLauncherInstallationTypes installation_type)
{
	ProtonPlusModelsLaunchersHeroicGamesLauncher * self = NULL;
	gchar** directories = NULL;
	gint directories_length1;
	gint _directories_size_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	directories = NULL;
	directories_length1 = 0;
	_directories_size_ = directories_length1;
	switch (installation_type) {
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM:
		{
			const gchar* _tmp0_;
			gchar* _tmp1_;
			const gchar* _tmp2_;
			gchar* _tmp3_;
			gchar** _tmp4_;
			_tmp0_ = g_get_user_config_dir ();
			_tmp1_ = g_strdup_printf ("%s/heroic", _tmp0_);
			_tmp2_ = g_get_home_dir ();
			_tmp3_ = g_strdup_printf ("%s/.config/heroic", _tmp2_);
			_tmp4_ = g_new0 (gchar*, 2 + 1);
			_tmp4_[0] = _tmp1_;
			_tmp4_[1] = _tmp3_;
			directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
			directories = _tmp4_;
			directories_length1 = 2;
			_directories_size_ = directories_length1;
			break;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_FLATPAK:
		{
			const gchar* _tmp5_;
			gchar* _tmp6_;
			gchar** _tmp7_;
			_tmp5_ = g_get_home_dir ();
			_tmp6_ = g_strdup_printf ("%s/.var/app/com.heroicgameslauncher.hgl/config/heroic", _tmp5_);
			_tmp7_ = g_new0 (gchar*, 1 + 1);
			_tmp7_[0] = _tmp6_;
			directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
			directories = _tmp7_;
			directories_length1 = 1;
			_directories_size_ = directories_length1;
			break;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SNAP:
		{
			break;
		}
		default:
		break;
	}
	_tmp8_ = g_strdup_printf ("%s/hgl.svg", RESOURCE_BASE);
	_tmp9_ = _tmp8_;
	_tmp10_ = directories;
	_tmp10__length1 = directories_length1;
	self = (ProtonPlusModelsLaunchersHeroicGamesLauncher*) proton_plus_models_launcher_construct (object_type, "Heroic Games Launcher", installation_type, _tmp9_, _tmp10_, (gint) _tmp10__length1);
	_g_free0 (_tmp9_);
	directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

ProtonPlusModelsLaunchersHeroicGamesLauncher*
proton_plus_models_launchers_heroic_games_launcher_new (ProtonPlusModelsLauncherInstallationTypes installation_type)
{
	return proton_plus_models_launchers_heroic_games_launcher_construct (PROTON_PLUS_MODELS_LAUNCHERS_TYPE_HEROIC_GAMES_LAUNCHER, installation_type);
}

static void
proton_plus_models_launchers_heroic_games_launcher_class_init (ProtonPlusModelsLaunchersHeroicGamesLauncherClass * klass,
                                                               gpointer klass_data)
{
	proton_plus_models_launchers_heroic_games_launcher_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_models_launchers_heroic_games_launcher_instance_init (ProtonPlusModelsLaunchersHeroicGamesLauncher * self,
                                                                  gpointer klass)
{
}

static GType
proton_plus_models_launchers_heroic_games_launcher_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsLaunchersHeroicGamesLauncherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_launchers_heroic_games_launcher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsLaunchersHeroicGamesLauncher), 0, (GInstanceInitFunc) proton_plus_models_launchers_heroic_games_launcher_instance_init, NULL };
	GType proton_plus_models_launchers_heroic_games_launcher_type_id;
	proton_plus_models_launchers_heroic_games_launcher_type_id = g_type_register_static (PROTON_PLUS_MODELS_TYPE_LAUNCHER, "ProtonPlusModelsLaunchersHeroicGamesLauncher", &g_define_type_info, 0);
	return proton_plus_models_launchers_heroic_games_launcher_type_id;
}

GType
proton_plus_models_launchers_heroic_games_launcher_get_type (void)
{
	static volatile gsize proton_plus_models_launchers_heroic_games_launcher_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_launchers_heroic_games_launcher_type_id__once)) {
		GType proton_plus_models_launchers_heroic_games_launcher_type_id;
		proton_plus_models_launchers_heroic_games_launcher_type_id = proton_plus_models_launchers_heroic_games_launcher_get_type_once ();
		g_once_init_leave (&proton_plus_models_launchers_heroic_games_launcher_type_id__once, proton_plus_models_launchers_heroic_games_launcher_type_id);
	}
	return proton_plus_models_launchers_heroic_games_launcher_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

