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

/*
 * Copyright 2026 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authored by: Leonhard Kargl <leo.kargl@proton.me>
 */

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

typedef enum  {
	GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP,
	GALA_SESSION_SETTINGS_SESSION_TYPE_GREETER,
	GALA_SESSION_SETTINGS_SESSION_TYPE_INSTALLER
} GalaSessionSettingsSessionType;

#define GALA_SESSION_SETTINGS_TYPE_SESSION_TYPE (gala_session_settings_session_type_get_type ())
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))

VALA_EXTERN GalaSessionSettingsSessionType* gala_session_settings_session_type;
GalaSessionSettingsSessionType* gala_session_settings_session_type = NULL;

 G_GNUC_INTERNAL GType gala_session_settings_session_type_get_type (void) G_GNUC_CONST ;
 G_GNUC_INTERNAL GalaSessionSettingsSessionType gala_session_settings_get_session_type (void);
static GalaSessionSettingsSessionType* _gala_session_settings_session_type_dup (GalaSessionSettingsSessionType* self);

 G_GNUC_NO_INLINE static GType
gala_session_settings_session_type_get_type_once (void)
{
	static const GEnumValue values[] = {{GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP, "GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP", "desktop"}, {GALA_SESSION_SETTINGS_SESSION_TYPE_GREETER, "GALA_SESSION_SETTINGS_SESSION_TYPE_GREETER", "greeter"}, {GALA_SESSION_SETTINGS_SESSION_TYPE_INSTALLER, "GALA_SESSION_SETTINGS_SESSION_TYPE_INSTALLER", "installer"}, {0, NULL, NULL}};
	GType gala_session_settings_session_type_type_id;
	gala_session_settings_session_type_type_id = g_enum_register_static ("GalaSessionSettingsSessionType", values);
	return gala_session_settings_session_type_type_id;
}

 G_GNUC_INTERNAL GType
gala_session_settings_session_type_get_type (void)
{
	static gsize gala_session_settings_session_type_type_id__once = 0;
	if (g_once_init_enter (&gala_session_settings_session_type_type_id__once)) {
		GType gala_session_settings_session_type_type_id;
		gala_session_settings_session_type_type_id = gala_session_settings_session_type_get_type_once ();
		g_once_init_leave (&gala_session_settings_session_type_type_id__once, gala_session_settings_session_type_type_id);
	}
	return gala_session_settings_session_type_type_id__once;
}

static GalaSessionSettingsSessionType*
_gala_session_settings_session_type_dup (GalaSessionSettingsSessionType* self)
{
	GalaSessionSettingsSessionType* dup;
	dup = g_new0 (GalaSessionSettingsSessionType, 1);
	memcpy (dup, self, sizeof (GalaSessionSettingsSessionType));
	return dup;
}

static gpointer
__gala_session_settings_session_type_dup0 (gpointer self)
{
	return self ? _gala_session_settings_session_type_dup (self) : NULL;
}

 G_GNUC_INTERNAL GalaSessionSettingsSessionType
gala_session_settings_get_session_type (void)
{
	GalaSessionSettingsSessionType* _tmp0_;
	GalaSessionSettingsSessionType* _tmp17_;
	GalaSessionSettingsSessionType result;
	_tmp0_ = gala_session_settings_session_type;
	if (_tmp0_ == NULL) {
		const gchar* _tmp1_ = NULL;
		const gchar* _tmp2_;
		gchar* session_type_str = NULL;
		gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		GQuark _tmp7_ = 0U;
		static GQuark _tmp6_label0 = 0;
		static GQuark _tmp6_label1 = 0;
		static GQuark _tmp6_label2 = 0;
		_tmp2_ = g_getenv ("GALA_SESSION_TYPE");
		_tmp1_ = _tmp2_;
		if (_tmp1_ == NULL) {
			_tmp1_ = "desktop";
		}
		_tmp3_ = g_strdup (_tmp1_);
		session_type_str = _tmp3_;
		_tmp4_ = session_type_str;
		_tmp5_ = _tmp4_;
		_tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_);
		if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("desktop")))) {
			switch (0) {
				default:
				{
					GalaSessionSettingsSessionType _tmp8_;
					GalaSessionSettingsSessionType* _tmp9_;
					_tmp8_ = GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP;
					_tmp9_ = __gala_session_settings_session_type_dup0 (&_tmp8_);
					_g_free0 (gala_session_settings_session_type);
					gala_session_settings_session_type = _tmp9_;
					break;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("greeter")))) {
			switch (0) {
				default:
				{
					GalaSessionSettingsSessionType _tmp10_;
					GalaSessionSettingsSessionType* _tmp11_;
					_tmp10_ = GALA_SESSION_SETTINGS_SESSION_TYPE_GREETER;
					_tmp11_ = __gala_session_settings_session_type_dup0 (&_tmp10_);
					_g_free0 (gala_session_settings_session_type);
					gala_session_settings_session_type = _tmp11_;
					break;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("installer")))) {
			switch (0) {
				default:
				{
					GalaSessionSettingsSessionType _tmp12_;
					GalaSessionSettingsSessionType* _tmp13_;
					_tmp12_ = GALA_SESSION_SETTINGS_SESSION_TYPE_INSTALLER;
					_tmp13_ = __gala_session_settings_session_type_dup0 (&_tmp12_);
					_g_free0 (gala_session_settings_session_type);
					gala_session_settings_session_type = _tmp13_;
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					const gchar* _tmp14_;
					GalaSessionSettingsSessionType _tmp15_;
					GalaSessionSettingsSessionType* _tmp16_;
					_tmp14_ = session_type_str;
					g_warning ("SessionSettings.vala:31: Unknown session type: %s", _tmp14_);
					_tmp15_ = GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP;
					_tmp16_ = __gala_session_settings_session_type_dup0 (&_tmp15_);
					_g_free0 (gala_session_settings_session_type);
					gala_session_settings_session_type = _tmp16_;
					break;
				}
			}
		}
		_g_free0 (session_type_str);
	}
	_tmp17_ = gala_session_settings_session_type;
	result = *_tmp17_;
	return result;
}

gboolean
gala_session_settings_is_greeter (void)
{
	gboolean result;
	result = gala_session_settings_get_session_type () != GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP;
	return result;
}

gchar*
gala_session_settings_get_shell_clients_type (void)
{
	gchar* _tmp3_;
	gchar* result;
	switch (gala_session_settings_get_session_type ()) {
		case GALA_SESSION_SETTINGS_SESSION_TYPE_DESKTOP:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("desktop");
			result = _tmp0_;
			return result;
		}
		case GALA_SESSION_SETTINGS_SESSION_TYPE_GREETER:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("greeter");
			result = _tmp1_;
			return result;
		}
		case GALA_SESSION_SETTINGS_SESSION_TYPE_INSTALLER:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("installer");
			result = _tmp2_;
			return result;
		}
		default:
		break;
	}
	_tmp3_ = g_strdup ("desktop");
	result = _tmp3_;
	return result;
}

