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

/*
 * Copyright 2014 Tom Beckmann
 * Copyright 2023-2024 elementary, Inc. <https://elementary.io>
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib-object.h>
#include <meta/meta-background-actor.h>
#include <meta/display.h>
#include <glib.h>
#include <meta/meta-background.h>
#include <clutter/clutter.h>
#include <meta/meta-background-content.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_COMPOSITOR_TYPE_SYSTEM_BACKGROUND (greeter_compositor_system_background_get_type ())
#define GREETER_COMPOSITOR_SYSTEM_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackground))
#define GREETER_COMPOSITOR_SYSTEM_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackgroundClass))
#define GREETER_COMPOSITOR_IS_SYSTEM_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND))
#define GREETER_COMPOSITOR_IS_SYSTEM_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND))
#define GREETER_COMPOSITOR_SYSTEM_BACKGROUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackgroundClass))

typedef struct _GreeterCompositorSystemBackground GreeterCompositorSystemBackground;
typedef struct _GreeterCompositorSystemBackgroundClass GreeterCompositorSystemBackgroundClass;
typedef struct _GreeterCompositorSystemBackgroundPrivate GreeterCompositorSystemBackgroundPrivate;
enum  {
	GREETER_COMPOSITOR_SYSTEM_BACKGROUND_0_PROPERTY,
	GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY,
	GREETER_COMPOSITOR_SYSTEM_BACKGROUND_NUM_PROPERTIES
};
static GParamSpec* greeter_compositor_system_background_properties[GREETER_COMPOSITOR_SYSTEM_BACKGROUND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GreeterCompositorSystemBackground {
	GObject parent_instance;
	GreeterCompositorSystemBackgroundPrivate * priv;
};

struct _GreeterCompositorSystemBackgroundClass {
	GObjectClass parent_class;
};

struct _GreeterCompositorSystemBackgroundPrivate {
	MetaBackgroundActor* _background_actor;
};

static gint GreeterCompositorSystemBackground_private_offset;
static gpointer greeter_compositor_system_background_parent_class = NULL;

VALA_EXTERN GType greeter_compositor_system_background_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterCompositorSystemBackground, g_object_unref)
VALA_EXTERN GreeterCompositorSystemBackground* greeter_compositor_system_background_new (MetaDisplay* display);
VALA_EXTERN GreeterCompositorSystemBackground* greeter_compositor_system_background_construct (GType object_type,
                                                                                   MetaDisplay* display);
VALA_EXTERN MetaBackgroundActor* greeter_compositor_system_background_get_background_actor (GreeterCompositorSystemBackground* self);
static void greeter_compositor_system_background_set_background_actor (GreeterCompositorSystemBackground* self,
                                                                MetaBackgroundActor* value);
static GObject * greeter_compositor_system_background_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties);
static void greeter_compositor_system_background_finalize (GObject * obj);
static GType greeter_compositor_system_background_get_type_once (void);
static void _vala_greeter_compositor_system_background_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_greeter_compositor_system_background_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);

static inline gpointer
greeter_compositor_system_background_get_instance_private (GreeterCompositorSystemBackground* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterCompositorSystemBackground_private_offset);
}

GreeterCompositorSystemBackground*
greeter_compositor_system_background_construct (GType object_type,
                                                MetaDisplay* display)
{
	GreeterCompositorSystemBackground * self = NULL;
	MetaBackgroundActor* _tmp0_;
	MetaBackgroundActor* _tmp1_;
	g_return_val_if_fail (display != NULL, NULL);
	_tmp0_ = (MetaBackgroundActor*) meta_background_actor_new (display, 0);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	self = (GreeterCompositorSystemBackground*) g_object_new (object_type, "background-actor", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

GreeterCompositorSystemBackground*
greeter_compositor_system_background_new (MetaDisplay* display)
{
	return greeter_compositor_system_background_construct (GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, display);
}

MetaBackgroundActor*
greeter_compositor_system_background_get_background_actor (GreeterCompositorSystemBackground* self)
{
	MetaBackgroundActor* result;
	MetaBackgroundActor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_background_actor;
	result = _tmp0_;
	return result;
}

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

static void
greeter_compositor_system_background_set_background_actor (GreeterCompositorSystemBackground* self,
                                                           MetaBackgroundActor* value)
{
	MetaBackgroundActor* old_value;
	g_return_if_fail (self != NULL);
	old_value = greeter_compositor_system_background_get_background_actor (self);
	if (old_value != value) {
		MetaBackgroundActor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_background_actor);
		self->priv->_background_actor = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, greeter_compositor_system_background_properties[GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY]);
	}
}

static GObject *
greeter_compositor_system_background_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterCompositorSystemBackground * self;
	MetaBackground* system_background = NULL;
	MetaBackgroundActor* _tmp0_;
	MetaDisplay* _tmp1_;
	MetaDisplay* _tmp2_;
	MetaDisplay* _tmp3_;
	MetaBackground* _tmp4_;
	MetaBackground* _tmp5_;
	MetaBackground* _tmp6_;
	ClutterColor _tmp7_ = {0};
	MetaBackgroundActor* _tmp8_;
	ClutterContent* _tmp9_;
	ClutterContent* _tmp10_;
	MetaBackground* _tmp11_;
	parent_class = G_OBJECT_CLASS (greeter_compositor_system_background_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackground);
	_tmp0_ = self->priv->_background_actor;
	g_object_get (_tmp0_, "meta-display", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = meta_background_new (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	system_background = _tmp5_;
	_tmp6_ = system_background;
	_tmp7_.red = (guint8) 0x2e;
	_tmp7_.green = (guint8) 0x34;
	_tmp7_.blue = (guint8) 0x36;
	_tmp7_.alpha = (guint8) 0xff;
	meta_background_set_color (_tmp6_, &_tmp7_);
	_tmp8_ = self->priv->_background_actor;
	_tmp9_ = clutter_actor_get_content ((ClutterActor*) _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = system_background;
	g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, meta_background_content_get_type (), MetaBackgroundContent), "background", _tmp11_, NULL);
	_g_object_unref0 (system_background);
	return obj;
}

static void
greeter_compositor_system_background_class_init (GreeterCompositorSystemBackgroundClass * klass,
                                                 gpointer klass_data)
{
	greeter_compositor_system_background_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterCompositorSystemBackground_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_greeter_compositor_system_background_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_greeter_compositor_system_background_set_property;
	G_OBJECT_CLASS (klass)->constructor = greeter_compositor_system_background_constructor;
	G_OBJECT_CLASS (klass)->finalize = greeter_compositor_system_background_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY, greeter_compositor_system_background_properties[GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY] = g_param_spec_object ("background-actor", "background-actor", "background-actor", meta_background_actor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
greeter_compositor_system_background_instance_init (GreeterCompositorSystemBackground * self,
                                                    gpointer klass)
{
	self->priv = greeter_compositor_system_background_get_instance_private (self);
}

static void
greeter_compositor_system_background_finalize (GObject * obj)
{
	GreeterCompositorSystemBackground * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackground);
	_g_object_unref0 (self->priv->_background_actor);
	G_OBJECT_CLASS (greeter_compositor_system_background_parent_class)->finalize (obj);
}

static GType
greeter_compositor_system_background_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterCompositorSystemBackgroundClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_compositor_system_background_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterCompositorSystemBackground), 0, (GInstanceInitFunc) greeter_compositor_system_background_instance_init, NULL };
	GType greeter_compositor_system_background_type_id;
	greeter_compositor_system_background_type_id = g_type_register_static (G_TYPE_OBJECT, "GreeterCompositorSystemBackground", &g_define_type_info, 0);
	GreeterCompositorSystemBackground_private_offset = g_type_add_instance_private (greeter_compositor_system_background_type_id, sizeof (GreeterCompositorSystemBackgroundPrivate));
	return greeter_compositor_system_background_type_id;
}

GType
greeter_compositor_system_background_get_type (void)
{
	static volatile gsize greeter_compositor_system_background_type_id__once = 0;
	if (g_once_init_enter (&greeter_compositor_system_background_type_id__once)) {
		GType greeter_compositor_system_background_type_id;
		greeter_compositor_system_background_type_id = greeter_compositor_system_background_get_type_once ();
		g_once_init_leave (&greeter_compositor_system_background_type_id__once, greeter_compositor_system_background_type_id);
	}
	return greeter_compositor_system_background_type_id__once;
}

static void
_vala_greeter_compositor_system_background_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	GreeterCompositorSystemBackground * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackground);
	switch (property_id) {
		case GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY:
		g_value_set_object (value, greeter_compositor_system_background_get_background_actor (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_greeter_compositor_system_background_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	GreeterCompositorSystemBackground * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_COMPOSITOR_TYPE_SYSTEM_BACKGROUND, GreeterCompositorSystemBackground);
	switch (property_id) {
		case GREETER_COMPOSITOR_SYSTEM_BACKGROUND_BACKGROUND_ACTOR_PROPERTY:
		greeter_compositor_system_background_set_background_actor (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

