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

#include "protonplus_core.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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

enum  {
	PROTON_PLUS_MODELS_LAUNCHERS_BOTTLES_0_PROPERTY,
	PROTON_PLUS_MODELS_LAUNCHERS_BOTTLES_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_launchers_bottles_properties[PROTON_PLUS_MODELS_LAUNCHERS_BOTTLES_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer proton_plus_models_launchers_bottles_parent_class = NULL;

static GType proton_plus_models_launchers_bottles_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);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

ProtonPlusModelsLaunchersBottles*
proton_plus_models_launchers_bottles_construct (GType object_type,
                                                ProtonPlusModelsLauncherInstallationTypes installation_type)
{
	ProtonPlusModelsLaunchersBottles * 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_data_dir ();
			_tmp1_ = g_build_filename (_tmp0_, "bottles", NULL);
			_tmp2_ = g_get_home_dir ();
			_tmp3_ = g_build_filename (_tmp2_, ".local", "share", "bottles", NULL);
			_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.usebottles.bottles/data/bottles", _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/bottles.svg", RESOURCE_BASE);
	_tmp9_ = _tmp8_;
	_tmp10_ = directories;
	_tmp10__length1 = directories_length1;
	self = (ProtonPlusModelsLaunchersBottles*) proton_plus_models_launcher_construct (object_type, "Bottles", installation_type, _tmp9_, _tmp10_, (gint) _tmp10__length1, PROTON_PLUS_MODELS_LAUNCHERS_BOTTLES_FAMILY_ID, NULL, (gint) 0, NULL, NULL, NULL);
	_g_free0 (_tmp9_);
	directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

ProtonPlusModelsLaunchersBottles*
proton_plus_models_launchers_bottles_new (ProtonPlusModelsLauncherInstallationTypes installation_type)
{
	return proton_plus_models_launchers_bottles_construct (PROTON_PLUS_MODELS_LAUNCHERS_TYPE_BOTTLES, installation_type);
}

static void
proton_plus_models_launchers_bottles_class_init (ProtonPlusModelsLaunchersBottlesClass * klass,
                                                 gpointer klass_data)
{
	proton_plus_models_launchers_bottles_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_models_launchers_bottles_instance_init (ProtonPlusModelsLaunchersBottles * self,
                                                    gpointer klass)
{
}

static GType
proton_plus_models_launchers_bottles_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsLaunchersBottlesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_launchers_bottles_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsLaunchersBottles), 0, (GInstanceInitFunc) proton_plus_models_launchers_bottles_instance_init, NULL };
	GType proton_plus_models_launchers_bottles_type_id;
	proton_plus_models_launchers_bottles_type_id = g_type_register_static (PROTON_PLUS_MODELS_TYPE_LAUNCHER, "ProtonPlusModelsLaunchersBottles", &g_define_type_info, 0);
	return proton_plus_models_launchers_bottles_type_id;
}

GType
proton_plus_models_launchers_bottles_get_type (void)
{
	static volatile gsize proton_plus_models_launchers_bottles_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_launchers_bottles_type_id__once)) {
		GType proton_plus_models_launchers_bottles_type_id;
		proton_plus_models_launchers_bottles_type_id = proton_plus_models_launchers_bottles_get_type_once ();
		g_once_init_leave (&proton_plus_models_launchers_bottles_type_id__once, proton_plus_models_launchers_bottles_type_id);
	}
	return proton_plus_models_launchers_bottles_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);
}

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

