/* Keyboard.c generated by valac 0.56.19, the Vala compiler
 * generated from Keyboard.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 <granite-7.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>

#define GALA_DAEMON_KEY_ACTION_TYPE_KEY_VAL "keyval"
#define GALA_DAEMON_KEY_ACTION_PRESS_KEY_VAL "keyval-press"
#define GALA_DAEMON_KEY_ACTION_RELEASE_KEY_VAL "keyval-release"
#define GALA_DAEMON_KEY_ACTION_SET_VIEW "set-view"
#define GALA_DAEMON_KEY_ACTION_LATCH_VIEW "latch-view"
#define GALA_DAEMON_KEY_ACTION_HIDE "hide"
#define GALA_DAEMON_KEY_ACTION_GROUP_PREFIX "keyboard"
#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 GALA_DAEMON_TYPE_KEYBOARD (gala_daemon_keyboard_get_type ())
#define GALA_DAEMON_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboard))
#define GALA_DAEMON_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboardClass))
#define GALA_DAEMON_IS_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_KEYBOARD))
#define GALA_DAEMON_IS_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_KEYBOARD))
#define GALA_DAEMON_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboardClass))

typedef struct _GalaDaemonKeyboard GalaDaemonKeyboard;
typedef struct _GalaDaemonKeyboardClass GalaDaemonKeyboardClass;
typedef struct _GalaDaemonKeyboardPrivate GalaDaemonKeyboardPrivate;

#define GALA_DAEMON_TYPE_MODEL_MANAGER (gala_daemon_model_manager_get_type ())
#define GALA_DAEMON_MODEL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_MODEL_MANAGER, GalaDaemonModelManager))
#define GALA_DAEMON_MODEL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_MODEL_MANAGER, GalaDaemonModelManagerClass))
#define GALA_DAEMON_IS_MODEL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_MODEL_MANAGER))
#define GALA_DAEMON_IS_MODEL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_MODEL_MANAGER))
#define GALA_DAEMON_MODEL_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_MODEL_MANAGER, GalaDaemonModelManagerClass))

typedef struct _GalaDaemonModelManager GalaDaemonModelManager;
typedef struct _GalaDaemonModelManagerClass GalaDaemonModelManagerClass;

#define GALA_DAEMON_TYPE_INPUT_MANAGER (gala_daemon_input_manager_get_type ())
#define GALA_DAEMON_INPUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_INPUT_MANAGER, GalaDaemonInputManager))
#define GALA_DAEMON_INPUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_INPUT_MANAGER, GalaDaemonInputManagerClass))
#define GALA_DAEMON_IS_INPUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_INPUT_MANAGER))
#define GALA_DAEMON_IS_INPUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_INPUT_MANAGER))
#define GALA_DAEMON_INPUT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_INPUT_MANAGER, GalaDaemonInputManagerClass))

typedef struct _GalaDaemonInputManager GalaDaemonInputManager;
typedef struct _GalaDaemonInputManagerClass GalaDaemonInputManagerClass;

#define GALA_DAEMON_TYPE_VIEW_CONTAINER (gala_daemon_view_container_get_type ())
#define GALA_DAEMON_VIEW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_VIEW_CONTAINER, GalaDaemonViewContainer))
#define GALA_DAEMON_VIEW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_VIEW_CONTAINER, GalaDaemonViewContainerClass))
#define GALA_DAEMON_IS_VIEW_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_VIEW_CONTAINER))
#define GALA_DAEMON_IS_VIEW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_VIEW_CONTAINER))
#define GALA_DAEMON_VIEW_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_VIEW_CONTAINER, GalaDaemonViewContainerClass))

typedef struct _GalaDaemonViewContainer GalaDaemonViewContainer;
typedef struct _GalaDaemonViewContainerClass GalaDaemonViewContainerClass;

#define GALA_DAEMON_TYPE_KEYBOARD_VIEW (gala_daemon_keyboard_view_get_type ())
#define GALA_DAEMON_KEYBOARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_KEYBOARD_VIEW, GalaDaemonKeyboardView))
#define GALA_DAEMON_KEYBOARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_KEYBOARD_VIEW, GalaDaemonKeyboardViewClass))
#define GALA_DAEMON_IS_KEYBOARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_KEYBOARD_VIEW))
#define GALA_DAEMON_IS_KEYBOARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_KEYBOARD_VIEW))
#define GALA_DAEMON_KEYBOARD_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_KEYBOARD_VIEW, GalaDaemonKeyboardViewClass))

typedef struct _GalaDaemonKeyboardView GalaDaemonKeyboardView;
typedef struct _GalaDaemonKeyboardViewClass GalaDaemonKeyboardViewClass;
enum  {
	GALA_DAEMON_KEYBOARD_0_PROPERTY,
	GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY,
	GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY,
	GALA_DAEMON_KEYBOARD_NUM_PROPERTIES
};
static GParamSpec* gala_daemon_keyboard_properties[GALA_DAEMON_KEYBOARD_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GALA_DAEMON_TYPE_KEYBOARD_MODEL (gala_daemon_keyboard_model_get_type ())
#define GALA_DAEMON_KEYBOARD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL, GalaDaemonKeyboardModel))
#define GALA_DAEMON_KEYBOARD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_KEYBOARD_MODEL, GalaDaemonKeyboardModelClass))
#define GALA_DAEMON_IS_KEYBOARD_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL))
#define GALA_DAEMON_IS_KEYBOARD_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_KEYBOARD_MODEL))
#define GALA_DAEMON_KEYBOARD_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL, GalaDaemonKeyboardModelClass))

typedef struct _GalaDaemonKeyboardModel GalaDaemonKeyboardModel;
typedef struct _GalaDaemonKeyboardModelClass GalaDaemonKeyboardModelClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GalaDaemonKeyboard {
	GraniteBin parent_instance;
	GalaDaemonKeyboardPrivate * priv;
};

struct _GalaDaemonKeyboardClass {
	GraniteBinClass parent_class;
};

struct _GalaDaemonKeyboardPrivate {
	GalaDaemonModelManager* _model_manager;
	GalaDaemonInputManager* _input_manager;
	GalaDaemonViewContainer* view_container;
	GalaDaemonKeyboardView* current_view;
	GalaDaemonKeyboardView* _active_view;
};

static gint GalaDaemonKeyboard_private_offset;
static gpointer gala_daemon_keyboard_parent_class = NULL;

VALA_EXTERN GType gala_daemon_keyboard_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboard, g_object_unref)
VALA_EXTERN GType gala_daemon_model_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonModelManager, g_object_unref)
VALA_EXTERN GType gala_daemon_input_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonInputManager, g_object_unref)
VALA_EXTERN GType gala_daemon_view_container_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonViewContainer, g_object_unref)
VALA_EXTERN GType gala_daemon_keyboard_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboardView, g_object_unref)
static void gala_daemon_keyboard_on_type_key_val (GalaDaemonKeyboard* self,
                                           GSimpleAction* action,
                                           GVariant* param);
static void _gala_daemon_keyboard_on_type_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self);
static void gala_daemon_keyboard_on_press_key_val (GalaDaemonKeyboard* self,
                                            GSimpleAction* action,
                                            GVariant* param);
static void _gala_daemon_keyboard_on_press_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                              GVariant* parameter,
                                                                              gpointer self);
static void gala_daemon_keyboard_on_release_key_val (GalaDaemonKeyboard* self,
                                              GSimpleAction* action,
                                              GVariant* param);
static void _gala_daemon_keyboard_on_release_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                GVariant* parameter,
                                                                                gpointer self);
static void gala_daemon_keyboard_on_set_view (GalaDaemonKeyboard* self,
                                       GSimpleAction* action,
                                       GVariant* param);
static void _gala_daemon_keyboard_on_set_view_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self);
static void gala_daemon_keyboard_on_latch_view (GalaDaemonKeyboard* self,
                                         GSimpleAction* action,
                                         GVariant* param);
static void _gala_daemon_keyboard_on_latch_view_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
static void gala_daemon_keyboard_on_hide (GalaDaemonKeyboard* self,
                                   GSimpleAction* action,
                                   GVariant* param);
static void _gala_daemon_keyboard_on_hide_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self);
VALA_EXTERN GalaDaemonKeyboard* gala_daemon_keyboard_new (GalaDaemonModelManager* model_manager,
                                              GalaDaemonInputManager* input_manager);
VALA_EXTERN GalaDaemonKeyboard* gala_daemon_keyboard_construct (GType object_type,
                                                    GalaDaemonModelManager* model_manager,
                                                    GalaDaemonInputManager* input_manager);
VALA_EXTERN void gala_daemon_keyboard_reset (GalaDaemonKeyboard* self);
VALA_EXTERN GType gala_daemon_keyboard_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboardModel, g_object_unref)
VALA_EXTERN GalaDaemonModelManager* gala_daemon_keyboard_get_model_manager (GalaDaemonKeyboard* self);
VALA_EXTERN GalaDaemonKeyboardModel* gala_daemon_model_manager_get_current_model (GalaDaemonModelManager* self);
VALA_EXTERN GalaDaemonKeyboardView* gala_daemon_keyboard_model_find_default_view (GalaDaemonKeyboardModel* self);
static void gala_daemon_keyboard_set_active_view (GalaDaemonKeyboard* self,
                                           GalaDaemonKeyboardView* value);
VALA_EXTERN GalaDaemonInputManager* gala_daemon_keyboard_get_input_manager (GalaDaemonKeyboard* self);
VALA_EXTERN void gala_daemon_input_manager_send_keyval (GalaDaemonInputManager* self,
                                            guint keyval);
static GalaDaemonKeyboardView* gala_daemon_keyboard_get_active_view (GalaDaemonKeyboard* self);
VALA_EXTERN void gala_daemon_input_manager_press_keyval (GalaDaemonInputManager* self,
                                             guint keyval);
VALA_EXTERN void gala_daemon_input_manager_release_keyval (GalaDaemonInputManager* self,
                                               guint keyval);
VALA_EXTERN GalaDaemonKeyboardView* gala_daemon_keyboard_model_get_view_by_name (GalaDaemonKeyboardModel* self,
                                                                     const gchar* name);
VALA_EXTERN void gala_daemon_input_manager_request_hide (GalaDaemonInputManager* self);
static void gala_daemon_keyboard_set_model_manager (GalaDaemonKeyboard* self,
                                             GalaDaemonModelManager* value);
static void gala_daemon_keyboard_set_input_manager (GalaDaemonKeyboard* self,
                                             GalaDaemonInputManager* value);
VALA_EXTERN GListModel* gala_daemon_keyboard_view_get_rows (GalaDaemonKeyboardView* self);
VALA_EXTERN void gala_daemon_view_container_set_view (GalaDaemonViewContainer* self,
                                          GListModel* value);
static GObject * gala_daemon_keyboard_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
VALA_EXTERN GalaDaemonViewContainer* gala_daemon_view_container_new (void);
VALA_EXTERN GalaDaemonViewContainer* gala_daemon_view_container_construct (GType object_type);
static void _gala_daemon_keyboard_reset_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self);
static void gala_daemon_keyboard_finalize (GObject * obj);
static GType gala_daemon_keyboard_get_type_once (void);
static void _vala_gala_daemon_keyboard_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_gala_daemon_keyboard_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static const GActionEntry GALA_DAEMON_KEYBOARD_ACTIONS[6] = {{GALA_DAEMON_KEY_ACTION_TYPE_KEY_VAL, _gala_daemon_keyboard_on_type_key_val_gsimple_action_activate_callback, "u"}, {GALA_DAEMON_KEY_ACTION_PRESS_KEY_VAL, _gala_daemon_keyboard_on_press_key_val_gsimple_action_activate_callback, "u"}, {GALA_DAEMON_KEY_ACTION_RELEASE_KEY_VAL, _gala_daemon_keyboard_on_release_key_val_gsimple_action_activate_callback, "u"}, {GALA_DAEMON_KEY_ACTION_SET_VIEW, _gala_daemon_keyboard_on_set_view_gsimple_action_activate_callback, "s"}, {GALA_DAEMON_KEY_ACTION_LATCH_VIEW, _gala_daemon_keyboard_on_latch_view_gsimple_action_activate_callback, "s"}, {GALA_DAEMON_KEY_ACTION_HIDE, _gala_daemon_keyboard_on_hide_gsimple_action_activate_callback}};

static inline gpointer
gala_daemon_keyboard_get_instance_private (GalaDaemonKeyboard* self)
{
	return G_STRUCT_MEMBER_P (self, GalaDaemonKeyboard_private_offset);
}

static void
_gala_daemon_keyboard_on_type_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self)
{
	gala_daemon_keyboard_on_type_key_val ((GalaDaemonKeyboard*) self, action, parameter);
}

static void
_gala_daemon_keyboard_on_press_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self)
{
	gala_daemon_keyboard_on_press_key_val ((GalaDaemonKeyboard*) self, action, parameter);
}

static void
_gala_daemon_keyboard_on_release_key_val_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self)
{
	gala_daemon_keyboard_on_release_key_val ((GalaDaemonKeyboard*) self, action, parameter);
}

static void
_gala_daemon_keyboard_on_set_view_gsimple_action_activate_callback (GSimpleAction* action,
                                                                    GVariant* parameter,
                                                                    gpointer self)
{
	gala_daemon_keyboard_on_set_view ((GalaDaemonKeyboard*) self, action, parameter);
}

static void
_gala_daemon_keyboard_on_latch_view_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	gala_daemon_keyboard_on_latch_view ((GalaDaemonKeyboard*) self, action, parameter);
}

static void
_gala_daemon_keyboard_on_hide_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	gala_daemon_keyboard_on_hide ((GalaDaemonKeyboard*) self, action, parameter);
}

GalaDaemonKeyboard*
gala_daemon_keyboard_construct (GType object_type,
                                GalaDaemonModelManager* model_manager,
                                GalaDaemonInputManager* input_manager)
{
	GalaDaemonKeyboard * self = NULL;
	g_return_val_if_fail (model_manager != NULL, NULL);
	g_return_val_if_fail (input_manager != NULL, NULL);
	self = (GalaDaemonKeyboard*) g_object_new (object_type, "model-manager", model_manager, "input-manager", input_manager, NULL);
	return self;
}

GalaDaemonKeyboard*
gala_daemon_keyboard_new (GalaDaemonModelManager* model_manager,
                          GalaDaemonInputManager* input_manager)
{
	return gala_daemon_keyboard_construct (GALA_DAEMON_TYPE_KEYBOARD, model_manager, input_manager);
}

void
gala_daemon_keyboard_reset (GalaDaemonKeyboard* self)
{
	GalaDaemonKeyboardModel* _tmp0_ = NULL;
	GalaDaemonModelManager* _tmp1_;
	GalaDaemonKeyboardModel* _tmp2_;
	GalaDaemonKeyboardModel* _tmp3_;
	GalaDaemonKeyboardView* _tmp4_ = NULL;
	GalaDaemonKeyboardView* _tmp6_;
	GalaDaemonKeyboardView* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_model_manager;
	_tmp2_ = gala_daemon_model_manager_get_current_model (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp0_ = _tmp3_;
	_tmp4_ = NULL;
	if (_tmp0_ != NULL) {
		GalaDaemonKeyboardView* _tmp5_;
		_tmp5_ = gala_daemon_keyboard_model_find_default_view (_tmp0_);
		_g_object_unref0 (_tmp4_);
		_tmp4_ = _tmp5_;
	}
	_tmp6_ = _tmp4_;
	_tmp4_ = NULL;
	_g_object_unref0 (self->priv->current_view);
	self->priv->current_view = _tmp6_;
	_tmp7_ = self->priv->current_view;
	gala_daemon_keyboard_set_active_view (self, _tmp7_);
	_g_object_unref0 (_tmp4_);
}

static void
gala_daemon_keyboard_on_type_key_val (GalaDaemonKeyboard* self,
                                      GSimpleAction* action,
                                      GVariant* param)
{
	guint keyval = 0U;
	GalaDaemonInputManager* _tmp0_;
	GalaDaemonKeyboardView* _tmp1_;
	GalaDaemonKeyboardView* _tmp2_;
	GalaDaemonKeyboardView* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	keyval = (guint) g_variant_get_uint32 (param);
	_tmp0_ = self->priv->_input_manager;
	gala_daemon_input_manager_send_keyval (_tmp0_, keyval);
	_tmp1_ = gala_daemon_keyboard_get_active_view (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->current_view;
	if (_tmp2_ != _tmp3_) {
		GalaDaemonKeyboardView* _tmp4_;
		_tmp4_ = self->priv->current_view;
		gala_daemon_keyboard_set_active_view (self, _tmp4_);
	}
}

static void
gala_daemon_keyboard_on_press_key_val (GalaDaemonKeyboard* self,
                                       GSimpleAction* action,
                                       GVariant* param)
{
	guint keyval = 0U;
	GalaDaemonInputManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	keyval = (guint) g_variant_get_uint32 (param);
	_tmp0_ = self->priv->_input_manager;
	gala_daemon_input_manager_press_keyval (_tmp0_, keyval);
}

static void
gala_daemon_keyboard_on_release_key_val (GalaDaemonKeyboard* self,
                                         GSimpleAction* action,
                                         GVariant* param)
{
	guint keyval = 0U;
	GalaDaemonInputManager* _tmp0_;
	GalaDaemonKeyboardView* _tmp1_;
	GalaDaemonKeyboardView* _tmp2_;
	GalaDaemonKeyboardView* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	keyval = (guint) g_variant_get_uint32 (param);
	_tmp0_ = self->priv->_input_manager;
	gala_daemon_input_manager_release_keyval (_tmp0_, keyval);
	_tmp1_ = gala_daemon_keyboard_get_active_view (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->current_view;
	if (_tmp2_ != _tmp3_) {
		GalaDaemonKeyboardView* _tmp4_;
		_tmp4_ = self->priv->current_view;
		gala_daemon_keyboard_set_active_view (self, _tmp4_);
	}
}

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

static void
gala_daemon_keyboard_on_set_view (GalaDaemonKeyboard* self,
                                  GSimpleAction* action,
                                  GVariant* param)
{
	gchar* view_name = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GalaDaemonKeyboardView* view = NULL;
	GalaDaemonModelManager* _tmp2_;
	GalaDaemonKeyboardModel* _tmp3_;
	GalaDaemonKeyboardModel* _tmp4_;
	const gchar* _tmp5_;
	GalaDaemonKeyboardView* _tmp6_;
	GalaDaemonKeyboardView* _tmp7_;
	GalaDaemonKeyboardView* _tmp9_;
	GalaDaemonKeyboardView* _tmp10_;
	GalaDaemonKeyboardView* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = g_variant_get_string (param, NULL);
	_tmp1_ = g_strdup (_tmp0_);
	view_name = _tmp1_;
	_tmp2_ = self->priv->_model_manager;
	_tmp3_ = gala_daemon_model_manager_get_current_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_name;
	_tmp6_ = gala_daemon_keyboard_model_get_view_by_name (_tmp4_, _tmp5_);
	view = _tmp6_;
	_tmp7_ = view;
	if (_tmp7_ == NULL) {
		const gchar* _tmp8_;
		_tmp8_ = view_name;
		g_warning ("Keyboard.vala:88: Tried to set view to '%s' but no such view exists", _tmp8_);
		_g_object_unref0 (view);
		_g_free0 (view_name);
		return;
	}
	_tmp9_ = view;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_g_object_unref0 (self->priv->current_view);
	self->priv->current_view = _tmp10_;
	_tmp11_ = view;
	gala_daemon_keyboard_set_active_view (self, _tmp11_);
	_g_object_unref0 (view);
	_g_free0 (view_name);
}

static void
gala_daemon_keyboard_on_latch_view (GalaDaemonKeyboard* self,
                                    GSimpleAction* action,
                                    GVariant* param)
{
	gchar* view_name = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GalaDaemonKeyboardView* view = NULL;
	GalaDaemonModelManager* _tmp2_;
	GalaDaemonKeyboardModel* _tmp3_;
	GalaDaemonKeyboardModel* _tmp4_;
	const gchar* _tmp5_;
	GalaDaemonKeyboardView* _tmp6_;
	GalaDaemonKeyboardView* _tmp7_;
	GalaDaemonKeyboardView* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = g_variant_get_string (param, NULL);
	_tmp1_ = g_strdup (_tmp0_);
	view_name = _tmp1_;
	_tmp2_ = self->priv->_model_manager;
	_tmp3_ = gala_daemon_model_manager_get_current_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_name;
	_tmp6_ = gala_daemon_keyboard_model_get_view_by_name (_tmp4_, _tmp5_);
	view = _tmp6_;
	_tmp7_ = view;
	if (_tmp7_ == NULL) {
		const gchar* _tmp8_;
		_tmp8_ = view_name;
		g_warning ("Keyboard.vala:102: Tried to latch view to '%s' but no such view exists", _tmp8_);
		_g_object_unref0 (view);
		_g_free0 (view_name);
		return;
	}
	_tmp9_ = view;
	gala_daemon_keyboard_set_active_view (self, _tmp9_);
	_g_object_unref0 (view);
	_g_free0 (view_name);
}

static void
gala_daemon_keyboard_on_hide (GalaDaemonKeyboard* self,
                              GSimpleAction* action,
                              GVariant* param)
{
	GalaDaemonInputManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_input_manager;
	gala_daemon_input_manager_request_hide (_tmp0_);
}

GalaDaemonModelManager*
gala_daemon_keyboard_get_model_manager (GalaDaemonKeyboard* self)
{
	GalaDaemonModelManager* result;
	GalaDaemonModelManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_model_manager;
	result = _tmp0_;
	return result;
}

static void
gala_daemon_keyboard_set_model_manager (GalaDaemonKeyboard* self,
                                        GalaDaemonModelManager* value)
{
	GalaDaemonModelManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_daemon_keyboard_get_model_manager (self);
	if (old_value != value) {
		GalaDaemonModelManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_model_manager);
		self->priv->_model_manager = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_daemon_keyboard_properties[GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY]);
	}
}

GalaDaemonInputManager*
gala_daemon_keyboard_get_input_manager (GalaDaemonKeyboard* self)
{
	GalaDaemonInputManager* result;
	GalaDaemonInputManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_input_manager;
	result = _tmp0_;
	return result;
}

static void
gala_daemon_keyboard_set_input_manager (GalaDaemonKeyboard* self,
                                        GalaDaemonInputManager* value)
{
	GalaDaemonInputManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_daemon_keyboard_get_input_manager (self);
	if (old_value != value) {
		GalaDaemonInputManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_input_manager);
		self->priv->_input_manager = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_daemon_keyboard_properties[GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY]);
	}
}

static GalaDaemonKeyboardView*
gala_daemon_keyboard_get_active_view (GalaDaemonKeyboard* self)
{
	GalaDaemonKeyboardView* result;
	GalaDaemonKeyboardView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_active_view;
	result = _tmp0_;
	return result;
}

static void
gala_daemon_keyboard_set_active_view (GalaDaemonKeyboard* self,
                                      GalaDaemonKeyboardView* value)
{
	GalaDaemonKeyboardView* _tmp0_;
	GalaDaemonKeyboardView* _tmp1_ = NULL;
	GListModel* _tmp2_ = NULL;
	GalaDaemonViewContainer* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_active_view);
	self->priv->_active_view = _tmp0_;
	_tmp1_ = value;
	_tmp2_ = NULL;
	if (_tmp1_ != NULL) {
		GListModel* _tmp3_;
		GListModel* _tmp4_;
		_tmp3_ = gala_daemon_keyboard_view_get_rows (_tmp1_);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_;
	}
	_tmp5_ = self->priv->view_container;
	gala_daemon_view_container_set_view (_tmp5_, _tmp2_);
}

static void
_gala_daemon_keyboard_reset_g_object_notify (GObject* _sender,
                                             GParamSpec* pspec,
                                             gpointer self)
{
	gala_daemon_keyboard_reset ((GalaDaemonKeyboard*) self);
}

static GObject *
gala_daemon_keyboard_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaDaemonKeyboard * self;
	GalaDaemonViewContainer* _tmp0_;
	GalaDaemonViewContainer* _tmp1_;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GSimpleActionGroup* _tmp4_;
	GalaDaemonModelManager* _tmp5_;
	parent_class = G_OBJECT_CLASS (gala_daemon_keyboard_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboard);
	_tmp0_ = gala_daemon_view_container_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->view_container);
	self->priv->view_container = _tmp0_;
	_tmp1_ = self->priv->view_container;
	granite_bin_set_child ((GraniteBin*) self, (GtkWidget*) _tmp1_);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	_tmp2_ = g_simple_action_group_new ();
	action_group = _tmp2_;
	_tmp3_ = action_group;
	g_action_map_add_action_entries ((GActionMap*) _tmp3_, GALA_DAEMON_KEYBOARD_ACTIONS, (gint) G_N_ELEMENTS (GALA_DAEMON_KEYBOARD_ACTIONS), self);
	_tmp4_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, GALA_DAEMON_KEY_ACTION_GROUP_PREFIX, (GActionGroup*) _tmp4_);
	_tmp5_ = self->priv->_model_manager;
	g_signal_connect_object ((GObject*) _tmp5_, "notify::current-model", (GCallback) _gala_daemon_keyboard_reset_g_object_notify, self, 0);
	_g_object_unref0 (action_group);
	return obj;
}

static void
gala_daemon_keyboard_class_init (GalaDaemonKeyboardClass * klass,
                                 gpointer klass_data)
{
	gala_daemon_keyboard_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaDaemonKeyboard_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_daemon_keyboard_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gala_daemon_keyboard_set_property;
	G_OBJECT_CLASS (klass)->constructor = gala_daemon_keyboard_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_daemon_keyboard_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY, gala_daemon_keyboard_properties[GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY] = g_param_spec_object ("model-manager", "model-manager", "model-manager", GALA_DAEMON_TYPE_MODEL_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY, gala_daemon_keyboard_properties[GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY] = g_param_spec_object ("input-manager", "input-manager", "input-manager", GALA_DAEMON_TYPE_INPUT_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
gala_daemon_keyboard_instance_init (GalaDaemonKeyboard * self,
                                    gpointer klass)
{
	self->priv = gala_daemon_keyboard_get_instance_private (self);
}

static void
gala_daemon_keyboard_finalize (GObject * obj)
{
	GalaDaemonKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboard);
	_g_object_unref0 (self->priv->_model_manager);
	_g_object_unref0 (self->priv->_input_manager);
	_g_object_unref0 (self->priv->view_container);
	_g_object_unref0 (self->priv->current_view);
	_g_object_unref0 (self->priv->_active_view);
	G_OBJECT_CLASS (gala_daemon_keyboard_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gala_daemon_keyboard_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaDaemonKeyboardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_daemon_keyboard_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaDaemonKeyboard), 0, (GInstanceInitFunc) gala_daemon_keyboard_instance_init, NULL };
	GType gala_daemon_keyboard_type_id;
	gala_daemon_keyboard_type_id = g_type_register_static (GRANITE_TYPE_BIN, "GalaDaemonKeyboard", &g_define_type_info, G_TYPE_FLAG_NONE);
	GalaDaemonKeyboard_private_offset = g_type_add_instance_private (gala_daemon_keyboard_type_id, sizeof (GalaDaemonKeyboardPrivate));
	return gala_daemon_keyboard_type_id;
}

GType
gala_daemon_keyboard_get_type (void)
{
	static gsize gala_daemon_keyboard_type_id__once = 0;
	if (g_once_init_enter (&gala_daemon_keyboard_type_id__once)) {
		GType gala_daemon_keyboard_type_id;
		gala_daemon_keyboard_type_id = gala_daemon_keyboard_get_type_once ();
		g_once_init_leave (&gala_daemon_keyboard_type_id__once, gala_daemon_keyboard_type_id);
	}
	return gala_daemon_keyboard_type_id__once;
}

static void
_vala_gala_daemon_keyboard_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GalaDaemonKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboard);
	switch (property_id) {
		case GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY:
		g_value_set_object (value, gala_daemon_keyboard_get_model_manager (self));
		break;
		case GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY:
		g_value_set_object (value, gala_daemon_keyboard_get_input_manager (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gala_daemon_keyboard_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GalaDaemonKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_DAEMON_TYPE_KEYBOARD, GalaDaemonKeyboard);
	switch (property_id) {
		case GALA_DAEMON_KEYBOARD_MODEL_MANAGER_PROPERTY:
		gala_daemon_keyboard_set_model_manager (self, g_value_get_object (value));
		break;
		case GALA_DAEMON_KEYBOARD_INPUT_MANAGER_PROPERTY:
		gala_daemon_keyboard_set_input_manager (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

