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

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2018-2025 elementary, Inc. (https://elementary.io)
 *
 * Authors: Corentin Noël <corentin@elementary.io>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>

#define GREETER_BASE_CARD_ERROR_SHAKE_DURATION 450
#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_BASE_CARD (greeter_base_card_get_type ())
#define GREETER_BASE_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_BASE_CARD, GreeterBaseCard))
#define GREETER_BASE_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_BASE_CARD, GreeterBaseCardClass))
#define GREETER_IS_BASE_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_BASE_CARD))
#define GREETER_IS_BASE_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_BASE_CARD))
#define GREETER_BASE_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_BASE_CARD, GreeterBaseCardClass))

typedef struct _GreeterBaseCard GreeterBaseCard;
typedef struct _GreeterBaseCardClass GreeterBaseCardClass;
typedef struct _GreeterBaseCardPrivate GreeterBaseCardPrivate;
enum  {
	GREETER_BASE_CARD_0_PROPERTY,
	GREETER_BASE_CARD_CONNECTING_PROPERTY,
	GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY,
	GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY,
	GREETER_BASE_CARD_NUM_PROPERTIES
};
static GParamSpec* greeter_base_card_properties[GREETER_BASE_CARD_NUM_PROPERTIES];
enum  {
	GREETER_BASE_CARD_DO_CONNECT_SIGNAL,
	GREETER_BASE_CARD_GO_LEFT_SIGNAL,
	GREETER_BASE_CARD_GO_RIGHT_SIGNAL,
	GREETER_BASE_CARD_NUM_SIGNALS
};
static guint greeter_base_card_signals[GREETER_BASE_CARD_NUM_SIGNALS] = {0};

struct _GreeterBaseCard {
	GtkBin parent_instance;
	GreeterBaseCardPrivate * priv;
};

struct _GreeterBaseCardClass {
	GtkBinClass parent_class;
	void (*wrong_credentials) (GreeterBaseCard* self);
};

struct _GreeterBaseCardPrivate {
	gboolean _connecting;
	gboolean _need_password;
	gboolean _use_fingerprint;
};

static gint GreeterBaseCard_private_offset;
static gpointer greeter_base_card_parent_class = NULL;

VALA_EXTERN GType greeter_base_card_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterBaseCard, g_object_unref)
VALA_EXTERN void greeter_base_card_wrong_credentials (GreeterBaseCard* self);
static gboolean greeter_base_card_real_focus (GtkWidget* base,
                                       GtkDirectionType direction);
static void greeter_base_card_real_wrong_credentials (GreeterBaseCard* self);
VALA_EXTERN GreeterBaseCard* greeter_base_card_construct (GType object_type);
VALA_EXTERN gboolean greeter_base_card_get_connecting (GreeterBaseCard* self);
VALA_EXTERN void greeter_base_card_set_connecting (GreeterBaseCard* self,
                                       gboolean value);
VALA_EXTERN gboolean greeter_base_card_get_need_password (GreeterBaseCard* self);
VALA_EXTERN void greeter_base_card_set_need_password (GreeterBaseCard* self,
                                          gboolean value);
VALA_EXTERN gboolean greeter_base_card_get_use_fingerprint (GreeterBaseCard* self);
VALA_EXTERN void greeter_base_card_set_use_fingerprint (GreeterBaseCard* self,
                                            gboolean value);
static GObject * greeter_base_card_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void greeter_base_card_finalize (GObject * obj);
static GType greeter_base_card_get_type_once (void);
static void _vala_greeter_base_card_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_greeter_base_card_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
greeter_base_card_get_instance_private (GreeterBaseCard* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterBaseCard_private_offset);
}

static gboolean
greeter_base_card_real_focus (GtkWidget* base,
                              GtkDirectionType direction)
{
	GreeterBaseCard * self;
	gboolean result;
	self = (GreeterBaseCard*) base;
	if (direction == GTK_DIR_LEFT) {
		g_signal_emit (self, greeter_base_card_signals[GREETER_BASE_CARD_GO_LEFT_SIGNAL], 0);
		result = GDK_EVENT_STOP;
		return result;
	} else {
		if (direction == GTK_DIR_RIGHT) {
			g_signal_emit (self, greeter_base_card_signals[GREETER_BASE_CARD_GO_RIGHT_SIGNAL], 0);
			result = GDK_EVENT_STOP;
			return result;
		}
	}
	result = GTK_WIDGET_CLASS (greeter_base_card_parent_class)->focus ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin), direction);
	return result;
}

static void
greeter_base_card_real_wrong_credentials (GreeterBaseCard* self)
{
	g_critical ("Type `%s' does not implement abstract method `greeter_base_card_wrong_credentials'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
greeter_base_card_wrong_credentials (GreeterBaseCard* self)
{
	GreeterBaseCardClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = GREETER_BASE_CARD_GET_CLASS (self);
	if (_klass_->wrong_credentials) {
		_klass_->wrong_credentials (self);
	}
}

GreeterBaseCard*
greeter_base_card_construct (GType object_type)
{
	GreeterBaseCard * self = NULL;
	self = (GreeterBaseCard*) g_object_new (object_type, NULL);
	return self;
}

gboolean
greeter_base_card_get_connecting (GreeterBaseCard* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_connecting;
	return result;
}

void
greeter_base_card_set_connecting (GreeterBaseCard* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = greeter_base_card_get_connecting (self);
	if (old_value != value) {
		self->priv->_connecting = value;
		g_object_notify_by_pspec ((GObject *) self, greeter_base_card_properties[GREETER_BASE_CARD_CONNECTING_PROPERTY]);
	}
}

gboolean
greeter_base_card_get_need_password (GreeterBaseCard* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_need_password;
	return result;
}

void
greeter_base_card_set_need_password (GreeterBaseCard* self,
                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = greeter_base_card_get_need_password (self);
	if (old_value != value) {
		self->priv->_need_password = value;
		g_object_notify_by_pspec ((GObject *) self, greeter_base_card_properties[GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY]);
	}
}

gboolean
greeter_base_card_get_use_fingerprint (GreeterBaseCard* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_use_fingerprint;
	return result;
}

void
greeter_base_card_set_use_fingerprint (GreeterBaseCard* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = greeter_base_card_get_use_fingerprint (self);
	if (old_value != value) {
		self->priv->_use_fingerprint = value;
		g_object_notify_by_pspec ((GObject *) self, greeter_base_card_properties[GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY]);
	}
}

static GObject *
greeter_base_card_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterBaseCard * self;
	parent_class = G_OBJECT_CLASS (greeter_base_card_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_BASE_CARD, GreeterBaseCard);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	g_object_set ((GtkWidget*) self, "width-request", 350, NULL);
	return obj;
}

static void
greeter_base_card_class_init (GreeterBaseCardClass * klass,
                              gpointer klass_data)
{
	greeter_base_card_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterBaseCard_private_offset);
	((GtkWidgetClass *) klass)->focus = (gboolean (*) (GtkWidget*, GtkDirectionType)) greeter_base_card_real_focus;
	((GreeterBaseCardClass *) klass)->wrong_credentials = (void (*) (GreeterBaseCard*)) greeter_base_card_real_wrong_credentials;
	G_OBJECT_CLASS (klass)->get_property = _vala_greeter_base_card_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_greeter_base_card_set_property;
	G_OBJECT_CLASS (klass)->constructor = greeter_base_card_constructor;
	G_OBJECT_CLASS (klass)->finalize = greeter_base_card_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_BASE_CARD_CONNECTING_PROPERTY, greeter_base_card_properties[GREETER_BASE_CARD_CONNECTING_PROPERTY] = g_param_spec_boolean ("connecting", "connecting", "connecting", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY, greeter_base_card_properties[GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY] = g_param_spec_boolean ("need-password", "need-password", "need-password", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY, greeter_base_card_properties[GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY] = g_param_spec_boolean ("use-fingerprint", "use-fingerprint", "use-fingerprint", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	greeter_base_card_signals[GREETER_BASE_CARD_DO_CONNECT_SIGNAL] = g_signal_new ("do-connect", GREETER_TYPE_BASE_CARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	greeter_base_card_signals[GREETER_BASE_CARD_GO_LEFT_SIGNAL] = g_signal_new ("go-left", GREETER_TYPE_BASE_CARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	greeter_base_card_signals[GREETER_BASE_CARD_GO_RIGHT_SIGNAL] = g_signal_new ("go-right", GREETER_TYPE_BASE_CARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
greeter_base_card_instance_init (GreeterBaseCard * self,
                                 gpointer klass)
{
	self->priv = greeter_base_card_get_instance_private (self);
	self->priv->_connecting = FALSE;
	self->priv->_need_password = FALSE;
	self->priv->_use_fingerprint = FALSE;
}

static void
greeter_base_card_finalize (GObject * obj)
{
	GreeterBaseCard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_BASE_CARD, GreeterBaseCard);
	G_OBJECT_CLASS (greeter_base_card_parent_class)->finalize (obj);
}

static GType
greeter_base_card_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterBaseCardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_base_card_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterBaseCard), 0, (GInstanceInitFunc) greeter_base_card_instance_init, NULL };
	GType greeter_base_card_type_id;
	greeter_base_card_type_id = g_type_register_static (gtk_bin_get_type (), "GreeterBaseCard", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	GreeterBaseCard_private_offset = g_type_add_instance_private (greeter_base_card_type_id, sizeof (GreeterBaseCardPrivate));
	return greeter_base_card_type_id;
}

GType
greeter_base_card_get_type (void)
{
	static volatile gsize greeter_base_card_type_id__once = 0;
	if (g_once_init_enter (&greeter_base_card_type_id__once)) {
		GType greeter_base_card_type_id;
		greeter_base_card_type_id = greeter_base_card_get_type_once ();
		g_once_init_leave (&greeter_base_card_type_id__once, greeter_base_card_type_id);
	}
	return greeter_base_card_type_id__once;
}

static void
_vala_greeter_base_card_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	GreeterBaseCard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_BASE_CARD, GreeterBaseCard);
	switch (property_id) {
		case GREETER_BASE_CARD_CONNECTING_PROPERTY:
		g_value_set_boolean (value, greeter_base_card_get_connecting (self));
		break;
		case GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY:
		g_value_set_boolean (value, greeter_base_card_get_need_password (self));
		break;
		case GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY:
		g_value_set_boolean (value, greeter_base_card_get_use_fingerprint (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_greeter_base_card_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	GreeterBaseCard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_BASE_CARD, GreeterBaseCard);
	switch (property_id) {
		case GREETER_BASE_CARD_CONNECTING_PROPERTY:
		greeter_base_card_set_connecting (self, g_value_get_boolean (value));
		break;
		case GREETER_BASE_CARD_NEED_PASSWORD_PROPERTY:
		greeter_base_card_set_need_password (self, g_value_get_boolean (value));
		break;
		case GREETER_BASE_CARD_USE_FINGERPRINT_PROPERTY:
		greeter_base_card_set_use_fingerprint (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

