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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
 */

#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.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 GREETER_TYPE_PORTAL_ERROR (greeter_portal_error_get_type ())

#define GREETER_TYPE_SETTINGS_PORTAL (greeter_settings_portal_get_type ())
#define GREETER_SETTINGS_PORTAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortal))
#define GREETER_SETTINGS_PORTAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortalClass))
#define GREETER_IS_SETTINGS_PORTAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_SETTINGS_PORTAL))
#define GREETER_IS_SETTINGS_PORTAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_SETTINGS_PORTAL))
#define GREETER_SETTINGS_PORTAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortalClass))

typedef struct _GreeterSettingsPortal GreeterSettingsPortal;
typedef struct _GreeterSettingsPortalClass GreeterSettingsPortalClass;
typedef struct _GreeterSettingsPortalPrivate GreeterSettingsPortalPrivate;
enum  {
	GREETER_SETTINGS_PORTAL_0_PROPERTY,
	GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY,
	GREETER_SETTINGS_PORTAL_NUM_PROPERTIES
};
static GParamSpec* greeter_settings_portal_properties[GREETER_SETTINGS_PORTAL_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GreeterSettingsPortalReadAllData GreeterSettingsPortalReadAllData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _GreeterSettingsPortalReadData GreeterSettingsPortalReadData;
enum  {
	GREETER_SETTINGS_PORTAL_SETTING_CHANGED_SIGNAL,
	GREETER_SETTINGS_PORTAL_NUM_SIGNALS
};
static guint greeter_settings_portal_signals[GREETER_SETTINGS_PORTAL_NUM_SIGNALS] = {0};
typedef struct _GreeterSettingsPortalReadAllReadyData GreeterSettingsPortalReadAllReadyData;
typedef struct _GreeterSettingsPortalReadReadyData GreeterSettingsPortalReadReadyData;

typedef enum  {
	GREETER_PORTAL_ERROR_FAILED,
	GREETER_PORTAL_ERROR_INVALID_ARGUMENT,
	GREETER_PORTAL_ERROR_NOT_FOUND,
	GREETER_PORTAL_ERROR_EXISTS,
	GREETER_PORTAL_ERROR_NOT_ALLOWED,
	GREETER_PORTAL_ERROR_CANCELLED,
	GREETER_PORTAL_ERROR_WINDOW_DESTROYED
} GreeterPortalError;
#define GREETER_PORTAL_ERROR greeter_portal_error_quark ()

struct _GreeterSettingsPortal {
	GObject parent_instance;
	GreeterSettingsPortalPrivate * priv;
};

struct _GreeterSettingsPortalClass {
	GObjectClass parent_class;
};

struct _GreeterSettingsPortalPrivate {
	gint _prefers_color_scheme;
};

struct _GreeterSettingsPortalReadAllData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GreeterSettingsPortal* self;
	gchar** namespaces;
	gint namespaces_length1;
	GHashTable* result;
	GHashTable* dict;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GVariant* _tmp6_;
	GHashTable* ret;
	GHashFunc _tmp7_;
	GEqualFunc _tmp8_;
	GHashTable* _tmp9_;
	gchar* _tmp10_;
	GHashTable* _tmp11_;
};

struct _GreeterSettingsPortalReadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GreeterSettingsPortal* self;
	gchar* namespace;
	gchar* key;
	GVariant* result;
	gboolean _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GVariant* _tmp3_;
	GError* _tmp4_;
	GError* _inner_error0_;
};

struct _GreeterSettingsPortalReadAllReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar** namespaces;
	gint namespaces_length1;
};

struct _GreeterSettingsPortalReadReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar* namespace;
	gchar* key;
};

static gint GreeterSettingsPortal_private_offset;
static gpointer greeter_settings_portal_parent_class = NULL;
static GOnce greeter_settings_portal_instance;
static GOnce greeter_settings_portal_instance = G_ONCE_INIT;

VALA_EXTERN GQuark greeter_portal_error_quark (void);
VALA_EXTERN GType greeter_portal_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType greeter_settings_portal_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterSettingsPortal, g_object_unref)
VALA_EXTERN guint greeter_settings_portal_register_object (void* object,
                                               GDBusConnection* connection,
                                               const gchar* path,
                                               GError** error);
VALA_EXTERN GreeterSettingsPortal* greeter_settings_portal_get_default (void);
static GreeterSettingsPortal* __lambda5_ (void);
static GreeterSettingsPortal* greeter_settings_portal_new (void);
static GreeterSettingsPortal* greeter_settings_portal_construct (GType object_type);
static gpointer ___lambda5__gthread_func (gpointer self);
static void greeter_settings_portal_read_all_data_free (gpointer _data);
VALA_EXTERN void greeter_settings_portal_read_all (GreeterSettingsPortal* self,
                                       gchar** namespaces,
                                       gint namespaces_length1,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN GHashTable* greeter_settings_portal_read_all_finish (GreeterSettingsPortal* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static gboolean greeter_settings_portal_read_all_co (GreeterSettingsPortalReadAllData* _data_);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
VALA_EXTERN gint greeter_settings_portal_get_prefers_color_scheme (GreeterSettingsPortal* self);
static void _g_hash_table_unref0_ (gpointer var);
static void greeter_settings_portal_read_data_free (gpointer _data);
VALA_EXTERN void greeter_settings_portal_read (GreeterSettingsPortal* self,
                                   const gchar* namespace,
                                   const gchar* key,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN GVariant* greeter_settings_portal_read_finish (GreeterSettingsPortal* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static gboolean greeter_settings_portal_read_co (GreeterSettingsPortalReadData* _data_);
VALA_EXTERN void greeter_settings_portal_set_prefers_color_scheme (GreeterSettingsPortal* self,
                                                       gint value);
static void g_cclosure_user_marshal_VOID__STRING_STRING_VARIANT (GClosure * closure,
                                                          GValue * return_value,
                                                          guint n_param_values,
                                                          const GValue * param_values,
                                                          gpointer invocation_hint,
                                                          gpointer marshal_data);
static void greeter_settings_portal_finalize (GObject * obj);
static GType greeter_settings_portal_get_type_once (void);
static void _vala_greeter_settings_portal_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_greeter_settings_portal_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);
static void _dbus_greeter_settings_portal_read_all (GreeterSettingsPortal* self,
                                             GVariant* _parameters_,
                                             GDBusMethodInvocation* invocation);
static void _dbus_greeter_settings_portal_read_all_ready (GObject * source_object,
                                                   GAsyncResult * _res_,
                                                   gpointer _user_data_);
static void _dbus_greeter_settings_portal_read (GreeterSettingsPortal* self,
                                         GVariant* _parameters_,
                                         GDBusMethodInvocation* invocation);
static void _dbus_greeter_settings_portal_read_ready (GObject * source_object,
                                               GAsyncResult * _res_,
                                               gpointer _user_data_);
static void greeter_settings_portal_dbus_interface_method_call (GDBusConnection* connection,
                                                         const gchar* sender,
                                                         const gchar* object_path,
                                                         const gchar* interface_name,
                                                         const gchar* method_name,
                                                         GVariant* parameters,
                                                         GDBusMethodInvocation* invocation,
                                                         gpointer user_data);
static GVariant* greeter_settings_portal_dbus_interface_get_property (GDBusConnection* connection,
                                                               const gchar* sender,
                                                               const gchar* object_path,
                                                               const gchar* interface_name,
                                                               const gchar* property_name,
                                                               GError** error,
                                                               gpointer user_data);
static GVariant* _dbus_greeter_settings_portal_get_prefers_color_scheme (GreeterSettingsPortal* self);
static gboolean greeter_settings_portal_dbus_interface_set_property (GDBusConnection* connection,
                                                              const gchar* sender,
                                                              const gchar* object_path,
                                                              const gchar* interface_name,
                                                              const gchar* property_name,
                                                              GVariant* value,
                                                              GError** error,
                                                              gpointer user_data);
static void _dbus_greeter_settings_portal_set_prefers_color_scheme (GreeterSettingsPortal* self,
                                                             GVariant* _value);
static void _dbus_greeter_settings_portal_setting_changed (GObject* _sender,
                                                    const gchar* namespace,
                                                    const gchar* key,
                                                    GVariant* value,
                                                    gpointer* _data);
static void _greeter_settings_portal_unregister_object (gpointer user_data);
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 const GDBusErrorEntry greeter_portal_error_entries[] = {{GREETER_PORTAL_ERROR_FAILED, "org.freedesktop.portal.Error.Failed"}, {GREETER_PORTAL_ERROR_INVALID_ARGUMENT, "org.freedesktop.portal.Error.InvalidArgument"}, {GREETER_PORTAL_ERROR_NOT_FOUND, "org.freedesktop.portal.Error.NotFound"}, {GREETER_PORTAL_ERROR_EXISTS, "org.freedesktop.portal.Error.Exists"}, {GREETER_PORTAL_ERROR_NOT_ALLOWED, "org.freedesktop.portal.Error.NotAllowed"}, {GREETER_PORTAL_ERROR_CANCELLED, "org.freedesktop.portal.Error.Cancelled"}, {GREETER_PORTAL_ERROR_WINDOW_DESTROYED, "org.freedesktop.portal.Error.WindowDestroyed"}};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_read_all_namespaces = {-1, "namespaces", "as", NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_read_all_result = {-1, "result", "a{sa{sv}}", NULL};
static const GDBusArgInfo * const _greeter_settings_portal_dbus_arg_info_read_all_in[] = {&_greeter_settings_portal_dbus_arg_info_read_all_namespaces, NULL};
static const GDBusArgInfo * const _greeter_settings_portal_dbus_arg_info_read_all_out[] = {&_greeter_settings_portal_dbus_arg_info_read_all_result, NULL};
static const GDBusMethodInfo _greeter_settings_portal_dbus_method_info_read_all = {-1, "ReadAll", (GDBusArgInfo **) (&_greeter_settings_portal_dbus_arg_info_read_all_in), (GDBusArgInfo **) (&_greeter_settings_portal_dbus_arg_info_read_all_out), NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_read_namespace = {-1, "namespace", "s", NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_read_key = {-1, "key", "s", NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_read_result = {-1, "result", "v", NULL};
static const GDBusArgInfo * const _greeter_settings_portal_dbus_arg_info_read_in[] = {&_greeter_settings_portal_dbus_arg_info_read_namespace, &_greeter_settings_portal_dbus_arg_info_read_key, NULL};
static const GDBusArgInfo * const _greeter_settings_portal_dbus_arg_info_read_out[] = {&_greeter_settings_portal_dbus_arg_info_read_result, NULL};
static const GDBusMethodInfo _greeter_settings_portal_dbus_method_info_read = {-1, "Read", (GDBusArgInfo **) (&_greeter_settings_portal_dbus_arg_info_read_in), (GDBusArgInfo **) (&_greeter_settings_portal_dbus_arg_info_read_out), NULL};
static const GDBusMethodInfo * const _greeter_settings_portal_dbus_method_info[] = {&_greeter_settings_portal_dbus_method_info_read_all, &_greeter_settings_portal_dbus_method_info_read, NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_setting_changed_namespace = {-1, "namespace", "s", NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_setting_changed_key = {-1, "key", "s", NULL};
static const GDBusArgInfo _greeter_settings_portal_dbus_arg_info_setting_changed_value = {-1, "value", "v", NULL};
static const GDBusArgInfo * const _greeter_settings_portal_dbus_arg_info_setting_changed[] = {&_greeter_settings_portal_dbus_arg_info_setting_changed_namespace, &_greeter_settings_portal_dbus_arg_info_setting_changed_key, &_greeter_settings_portal_dbus_arg_info_setting_changed_value, NULL};
static const GDBusSignalInfo _greeter_settings_portal_dbus_signal_info_setting_changed = {-1, "SettingChanged", (GDBusArgInfo **) (&_greeter_settings_portal_dbus_arg_info_setting_changed), NULL};
static const GDBusSignalInfo * const _greeter_settings_portal_dbus_signal_info[] = {&_greeter_settings_portal_dbus_signal_info_setting_changed, NULL};
static const GDBusPropertyInfo _greeter_settings_portal_dbus_property_info_prefers_color_scheme = {-1, "PrefersColorScheme", "i", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
static const GDBusPropertyInfo * const _greeter_settings_portal_dbus_property_info[] = {&_greeter_settings_portal_dbus_property_info_prefers_color_scheme, NULL};
static const GDBusInterfaceInfo _greeter_settings_portal_dbus_interface_info = {-1, "org.freedesktop.portal.Settings", (GDBusMethodInfo **) (&_greeter_settings_portal_dbus_method_info), (GDBusSignalInfo **) (&_greeter_settings_portal_dbus_signal_info), (GDBusPropertyInfo **) (&_greeter_settings_portal_dbus_property_info), NULL};
static const GDBusInterfaceVTable _greeter_settings_portal_dbus_interface_vtable = {greeter_settings_portal_dbus_interface_method_call, greeter_settings_portal_dbus_interface_get_property, greeter_settings_portal_dbus_interface_set_property};

GQuark
greeter_portal_error_quark (void)
{
	static volatile gsize greeter_portal_error_quark_volatile = 0;
	g_dbus_error_register_error_domain ("greeter-portal-error-quark", &greeter_portal_error_quark_volatile, greeter_portal_error_entries, G_N_ELEMENTS (greeter_portal_error_entries));
	return (GQuark) greeter_portal_error_quark_volatile;
}

static inline gpointer
greeter_settings_portal_get_instance_private (GreeterSettingsPortal* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterSettingsPortal_private_offset);
}

static GreeterSettingsPortal*
__lambda5_ (void)
{
	GreeterSettingsPortal* _tmp0_;
	GreeterSettingsPortal* result;
	_tmp0_ = greeter_settings_portal_new ();
	result = _tmp0_;
	return result;
}

static gpointer
___lambda5__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda5_ ();
	return result;
}

GreeterSettingsPortal*
greeter_settings_portal_get_default (void)
{
	gconstpointer _tmp0_;
	GreeterSettingsPortal* result;
	_tmp0_ = g_once (&greeter_settings_portal_instance, ___lambda5__gthread_func, NULL);
	result = (GreeterSettingsPortal*) _tmp0_;
	return result;
}

static GreeterSettingsPortal*
greeter_settings_portal_construct (GType object_type)
{
	GreeterSettingsPortal * self = NULL;
	self = (GreeterSettingsPortal*) g_object_new (object_type, NULL);
	return self;
}

static GreeterSettingsPortal*
greeter_settings_portal_new (void)
{
	return greeter_settings_portal_construct (GREETER_TYPE_SETTINGS_PORTAL);
}

static void
greeter_settings_portal_read_all_data_free (gpointer _data)
{
	GreeterSettingsPortalReadAllData* _data_;
	_data_ = _data;
	_g_hash_table_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GreeterSettingsPortalReadAllData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
greeter_settings_portal_read_all (GreeterSettingsPortal* self,
                                  gchar** namespaces,
                                  gint namespaces_length1,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	GreeterSettingsPortalReadAllData* _data_;
	GreeterSettingsPortal* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (GreeterSettingsPortalReadAllData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, greeter_settings_portal_read_all_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->namespaces = namespaces;
	_data_->namespaces_length1 = namespaces_length1;
	greeter_settings_portal_read_all_co (_data_);
}

GHashTable*
greeter_settings_portal_read_all_finish (GreeterSettingsPortal* self,
                                         GAsyncResult* _res_,
                                         GError** error)
{
	GHashTable* result;
	GreeterSettingsPortalReadAllData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_g_variant_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}

static void
_g_hash_table_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static gboolean
greeter_settings_portal_read_all_co (GreeterSettingsPortalReadAllData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, _g_variant_unref0_);
	_data_->dict = _data_->_tmp2_;
	_data_->_tmp3_ = g_strdup ("color-scheme");
	_data_->_tmp4_ = greeter_settings_portal_get_prefers_color_scheme (_data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_variant_new_uint32 ((guint32) _data_->_tmp5_);
	g_variant_ref_sink (_data_->_tmp6_);
	g_hash_table_insert (_data_->dict, _data_->_tmp3_, _data_->_tmp6_);
	_data_->_tmp7_ = g_str_hash;
	_data_->_tmp8_ = g_str_equal;
	_data_->_tmp9_ = g_hash_table_new_full (_data_->_tmp7_, _data_->_tmp8_, _g_free0_, _g_hash_table_unref0_);
	_data_->ret = _data_->_tmp9_;
	_data_->_tmp10_ = g_strdup ("org.freedesktop.appearance");
	_data_->_tmp11_ = _g_hash_table_ref0 (_data_->dict);
	g_hash_table_insert (_data_->ret, _data_->_tmp10_, _data_->_tmp11_);
	_data_->result = _data_->ret;
	_g_hash_table_unref0 (_data_->dict);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
greeter_settings_portal_read_data_free (gpointer _data)
{
	GreeterSettingsPortalReadData* _data_;
	_data_ = _data;
	_g_free0 (_data_->namespace);
	_g_free0 (_data_->key);
	_g_variant_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GreeterSettingsPortalReadData, _data_);
}

void
greeter_settings_portal_read (GreeterSettingsPortal* self,
                              const gchar* namespace,
                              const gchar* key,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	GreeterSettingsPortalReadData* _data_;
	GreeterSettingsPortal* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (namespace != NULL);
	g_return_if_fail (key != NULL);
	_data_ = g_slice_new0 (GreeterSettingsPortalReadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, greeter_settings_portal_read_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (namespace);
	_g_free0 (_data_->namespace);
	_data_->namespace = _tmp1_;
	_tmp2_ = g_strdup (key);
	_g_free0 (_data_->key);
	_data_->key = _tmp2_;
	greeter_settings_portal_read_co (_data_);
}

GVariant*
greeter_settings_portal_read_finish (GreeterSettingsPortal* self,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	GVariant* result;
	GreeterSettingsPortalReadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
greeter_settings_portal_read_co (GreeterSettingsPortalReadData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (g_strcmp0 (_data_->namespace, "org.freedesktop.appearance") == 0) {
		_data_->_tmp0_ = g_strcmp0 (_data_->key, "color-scheme") == 0;
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp1_ = greeter_settings_portal_get_prefers_color_scheme (_data_->self);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = g_variant_new_uint32 ((guint32) _data_->_tmp2_);
		g_variant_ref_sink (_data_->_tmp3_);
		_data_->result = _data_->_tmp3_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = g_error_new_literal (GREETER_PORTAL_ERROR, GREETER_PORTAL_ERROR_NOT_FOUND, "Requested setting not found");
	_data_->_inner_error0_ = _data_->_tmp4_;
	g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gint
greeter_settings_portal_get_prefers_color_scheme (GreeterSettingsPortal* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_prefers_color_scheme;
	return result;
}

void
greeter_settings_portal_set_prefers_color_scheme (GreeterSettingsPortal* self,
                                                  gint value)
{
	gint _tmp0_;
	gint _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	g_return_if_fail (self != NULL);
	self->priv->_prefers_color_scheme = value;
	_tmp0_ = greeter_settings_portal_get_prefers_color_scheme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_new_uint32 ((guint32) _tmp1_);
	g_variant_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	g_signal_emit (self, greeter_settings_portal_signals[GREETER_SETTINGS_PORTAL_SETTING_CHANGED_SIGNAL], 0, "org.freedesktop.appearance", "color-scheme", _tmp3_);
	_g_variant_unref0 (_tmp3_);
	g_object_notify_by_pspec ((GObject *) self, greeter_settings_portal_properties[GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY]);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_VARIANT (GClosure * closure,
                                                     GValue * return_value,
                                                     guint n_param_values,
                                                     const GValue * param_values,
                                                     gpointer invocation_hint,
                                                     gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_VARIANT) (gpointer data1, const char* arg_1, const char* arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_VARIANT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_VARIANT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_variant (param_values + 3), data2);
}

static void
greeter_settings_portal_class_init (GreeterSettingsPortalClass * klass,
                                    gpointer klass_data)
{
	greeter_settings_portal_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterSettingsPortal_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_greeter_settings_portal_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_greeter_settings_portal_set_property;
	G_OBJECT_CLASS (klass)->finalize = greeter_settings_portal_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY, greeter_settings_portal_properties[GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY] = g_param_spec_int ("prefers-color-scheme", "prefers-color-scheme", "prefers-color-scheme", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	greeter_settings_portal_signals[GREETER_SETTINGS_PORTAL_SETTING_CHANGED_SIGNAL] = g_signal_new ("setting-changed", GREETER_TYPE_SETTINGS_PORTAL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_VARIANT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT);
}

static void
greeter_settings_portal_instance_init (GreeterSettingsPortal * self,
                                       gpointer klass)
{
	self->priv = greeter_settings_portal_get_instance_private (self);
	self->priv->_prefers_color_scheme = 0;
}

static void
greeter_settings_portal_finalize (GObject * obj)
{
	GreeterSettingsPortal * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortal);
	G_OBJECT_CLASS (greeter_settings_portal_parent_class)->finalize (obj);
}

static GType
greeter_settings_portal_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterSettingsPortalClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_settings_portal_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterSettingsPortal), 0, (GInstanceInitFunc) greeter_settings_portal_instance_init, NULL };
	GType greeter_settings_portal_type_id;
	greeter_settings_portal_type_id = g_type_register_static (G_TYPE_OBJECT, "GreeterSettingsPortal", &g_define_type_info, 0);
	g_type_set_qdata (greeter_settings_portal_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) greeter_settings_portal_register_object);
	GreeterSettingsPortal_private_offset = g_type_add_instance_private (greeter_settings_portal_type_id, sizeof (GreeterSettingsPortalPrivate));
	return greeter_settings_portal_type_id;
}

GType
greeter_settings_portal_get_type (void)
{
	static volatile gsize greeter_settings_portal_type_id__once = 0;
	if (g_once_init_enter (&greeter_settings_portal_type_id__once)) {
		GType greeter_settings_portal_type_id;
		greeter_settings_portal_type_id = greeter_settings_portal_get_type_once ();
		g_once_init_leave (&greeter_settings_portal_type_id__once, greeter_settings_portal_type_id);
	}
	return greeter_settings_portal_type_id__once;
}

static void
_vala_greeter_settings_portal_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	GreeterSettingsPortal * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortal);
	switch (property_id) {
		case GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY:
		g_value_set_int (value, greeter_settings_portal_get_prefers_color_scheme (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_greeter_settings_portal_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	GreeterSettingsPortal * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_SETTINGS_PORTAL, GreeterSettingsPortal);
	switch (property_id) {
		case GREETER_SETTINGS_PORTAL_PREFERS_COLOR_SCHEME_PROPERTY:
		greeter_settings_portal_set_prefers_color_scheme (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_dbus_greeter_settings_portal_read_all (GreeterSettingsPortal* self,
                                        GVariant* _parameters_,
                                        GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	GreeterSettingsPortalReadAllReadyData* _ready_data;
	GVariant* _tmp89_;
	gchar** _tmp90_;
	gint _tmp90__length;
	gint _tmp90__size;
	gint _tmp90__length1;
	GVariantIter _tmp91_;
	GVariant* _tmp92_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (GreeterSettingsPortalReadAllReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp89_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp90_ = g_new (gchar*, 5);
	_tmp90__length = 0;
	_tmp90__size = 4;
	_tmp90__length1 = 0;
	g_variant_iter_init (&_tmp91_, _tmp89_);
	for (; (_tmp92_ = g_variant_iter_next_value (&_tmp91_)) != NULL; _tmp90__length1++) {
		if (_tmp90__size == _tmp90__length) {
			_tmp90__size = 2 * _tmp90__size;
			_tmp90_ = g_renew (gchar*, _tmp90_, _tmp90__size + 1);
		}
		_tmp90_[_tmp90__length++] = g_variant_dup_string (_tmp92_, NULL);
		g_variant_unref (_tmp92_);
	}
	_ready_data->namespaces_length1 = _tmp90__length1;
	_tmp90_[_tmp90__length] = NULL;
	_ready_data->namespaces = _tmp90_;
	g_variant_unref (_tmp89_);
	greeter_settings_portal_read_all (self, _ready_data->namespaces, _ready_data->namespaces_length1, (GAsyncReadyCallback) _dbus_greeter_settings_portal_read_all_ready, _ready_data);
	_error:
	;
}

static void
_dbus_greeter_settings_portal_read_all_ready (GObject * source_object,
                                              GAsyncResult * _res_,
                                              gpointer _user_data_)
{
	GreeterSettingsPortalReadAllReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable* result;
	GVariantBuilder _tmp93_;
	GHashTableIter _tmp94_;
	gpointer _tmp95_;
	gpointer _tmp96_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = greeter_settings_portal_read_all_finish ((GreeterSettingsPortal*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_hash_table_iter_init (&_tmp94_, result);
	g_variant_builder_init (&_tmp93_, G_VARIANT_TYPE ("a{sa{sv}}"));
	while (g_hash_table_iter_next (&_tmp94_, &_tmp95_, &_tmp96_)) {
		gchar* _key;
		GHashTable* _value;
		GVariantBuilder _tmp97_;
		GHashTableIter _tmp98_;
		gpointer _tmp99_;
		gpointer _tmp100_;
		_key = (gchar*) _tmp95_;
		_value = (GHashTable*) _tmp96_;
		g_hash_table_iter_init (&_tmp98_, _value);
		g_variant_builder_init (&_tmp97_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp98_, &_tmp99_, &_tmp100_)) {
			gchar* _key;
			GVariant* _value;
			_key = (gchar*) _tmp99_;
			_value = (GVariant*) _tmp100_;
			g_variant_builder_add (&_tmp97_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add (&_tmp93_, "{?*}", g_variant_new_string (_key), g_variant_builder_end (&_tmp97_));
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp93_));
	_g_hash_table_unref0 (result);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_ready_data->namespaces = (_vala_array_free (_ready_data->namespaces, _ready_data->namespaces_length1, (GDestroyNotify) g_free), NULL);
	g_slice_free (GreeterSettingsPortalReadAllReadyData, _ready_data);
}

static void
_dbus_greeter_settings_portal_read (GreeterSettingsPortal* self,
                                    GVariant* _parameters_,
                                    GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	GreeterSettingsPortalReadReadyData* _ready_data;
	GVariant* _tmp101_;
	GVariant* _tmp102_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (GreeterSettingsPortalReadReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp101_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->namespace = g_variant_dup_string (_tmp101_, NULL);
	g_variant_unref (_tmp101_);
	_tmp102_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->key = g_variant_dup_string (_tmp102_, NULL);
	g_variant_unref (_tmp102_);
	greeter_settings_portal_read (self, _ready_data->namespace, _ready_data->key, (GAsyncReadyCallback) _dbus_greeter_settings_portal_read_ready, _ready_data);
	_error:
	;
}

static void
_dbus_greeter_settings_portal_read_ready (GObject * source_object,
                                          GAsyncResult * _res_,
                                          gpointer _user_data_)
{
	GreeterSettingsPortalReadReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GVariant* result;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = greeter_settings_portal_read_finish ((GreeterSettingsPortal*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_reply_builder, g_variant_new_variant (result));
	_g_variant_unref0 (result);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (_ready_data->namespace);
	_g_free0 (_ready_data->key);
	g_slice_free (GreeterSettingsPortalReadReadyData, _ready_data);
}

static void
greeter_settings_portal_dbus_interface_method_call (GDBusConnection* connection,
                                                    const gchar* sender,
                                                    const gchar* object_path,
                                                    const gchar* interface_name,
                                                    const gchar* method_name,
                                                    GVariant* parameters,
                                                    GDBusMethodInvocation* invocation,
                                                    gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "ReadAll") == 0) {
		_dbus_greeter_settings_portal_read_all (object, parameters, invocation);
	} else if (strcmp (method_name, "Read") == 0) {
		_dbus_greeter_settings_portal_read (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
_dbus_greeter_settings_portal_get_prefers_color_scheme (GreeterSettingsPortal* self)
{
	gint result;
	GVariant* _reply;
	result = greeter_settings_portal_get_prefers_color_scheme (self);
	_reply = g_variant_new_int32 (result);
	return _reply;
}

static GVariant*
greeter_settings_portal_dbus_interface_get_property (GDBusConnection* connection,
                                                     const gchar* sender,
                                                     const gchar* object_path,
                                                     const gchar* interface_name,
                                                     const gchar* property_name,
                                                     GError** error,
                                                     gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (property_name, "PrefersColorScheme") == 0) {
		return _dbus_greeter_settings_portal_get_prefers_color_scheme (object);
	}
	return NULL;
}

static void
_dbus_greeter_settings_portal_set_prefers_color_scheme (GreeterSettingsPortal* self,
                                                        GVariant* _value)
{
	gint value = 0;
	value = g_variant_get_int32 (_value);
	greeter_settings_portal_set_prefers_color_scheme (self, value);
}

static gboolean
greeter_settings_portal_dbus_interface_set_property (GDBusConnection* connection,
                                                     const gchar* sender,
                                                     const gchar* object_path,
                                                     const gchar* interface_name,
                                                     const gchar* property_name,
                                                     GVariant* value,
                                                     GError** error,
                                                     gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (property_name, "PrefersColorScheme") == 0) {
		_dbus_greeter_settings_portal_set_prefers_color_scheme (object, value);
		return TRUE;
	}
	return FALSE;
}

static void
_dbus_greeter_settings_portal_setting_changed (GObject* _sender,
                                               const gchar* namespace,
                                               const gchar* key,
                                               GVariant* value,
                                               gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (namespace));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (key));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_variant (value));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.portal.Settings", "SettingChanged", _arguments, NULL);
}

guint
greeter_settings_portal_register_object (gpointer object,
                                         GDBusConnection* connection,
                                         const gchar* path,
                                         GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_greeter_settings_portal_dbus_interface_info), &_greeter_settings_portal_dbus_interface_vtable, data, _greeter_settings_portal_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "setting-changed", (GCallback) _dbus_greeter_settings_portal_setting_changed, data);
	return result;
}

static void
_greeter_settings_portal_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_greeter_settings_portal_setting_changed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

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

