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

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

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>

#define GALA_DAEMON_KEY_ACTION_GROUP_PREFIX "keyboard"
#define GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_GROUP_PREFIX "."
#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_LATCH_VIEW "latch-view"
#define GALA_DAEMON_KEY_ACTION_SET_VIEW "set-view"
#define GALA_DAEMON_KEY_ACTION_HIDE "hide"
#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_MODEL_BUILDER (gala_daemon_keyboard_model_builder_get_type ())
#define GALA_DAEMON_KEYBOARD_MODEL_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER, GalaDaemonKeyboardModelBuilder))
#define GALA_DAEMON_KEYBOARD_MODEL_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER, GalaDaemonKeyboardModelBuilderClass))
#define GALA_DAEMON_IS_KEYBOARD_MODEL_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER))
#define GALA_DAEMON_IS_KEYBOARD_MODEL_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER))
#define GALA_DAEMON_KEYBOARD_MODEL_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER, GalaDaemonKeyboardModelBuilderClass))

typedef struct _GalaDaemonKeyboardModelBuilder GalaDaemonKeyboardModelBuilder;
typedef struct _GalaDaemonKeyboardModelBuilderClass GalaDaemonKeyboardModelBuilderClass;
typedef struct _GalaDaemonKeyboardModelBuilderPrivate GalaDaemonKeyboardModelBuilderPrivate;

#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;
enum  {
	GALA_DAEMON_KEYBOARD_MODEL_BUILDER_0_PROPERTY,
	GALA_DAEMON_KEYBOARD_MODEL_BUILDER_NUM_PROPERTIES
};
static GParamSpec* gala_daemon_keyboard_model_builder_properties[GALA_DAEMON_KEYBOARD_MODEL_BUILDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#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;

#define GALA_DAEMON_TYPE_KEY (gala_daemon_key_get_type ())
#define GALA_DAEMON_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_KEY, GalaDaemonKey))
#define GALA_DAEMON_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_KEY, GalaDaemonKeyClass))
#define GALA_DAEMON_IS_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_KEY))
#define GALA_DAEMON_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_KEY))
#define GALA_DAEMON_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_KEY, GalaDaemonKeyClass))

typedef struct _GalaDaemonKey GalaDaemonKey;
typedef struct _GalaDaemonKeyClass GalaDaemonKeyClass;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GalaDaemonKeyboardModelBuilder {
	GObject parent_instance;
	GalaDaemonKeyboardModelBuilderPrivate * priv;
};

struct _GalaDaemonKeyboardModelBuilderClass {
	GObjectClass parent_class;
};

struct _GalaDaemonKeyboardModelBuilderPrivate {
	GalaDaemonKeyboardModel* model;
	GListStore* views_store;
	gchar* current_view_name;
	GListStore* current_view_store;
	gboolean current_view_is_default;
	GListStore* current_row;
	gdouble current_key_left_offset;
	gdouble current_key_width;
	gdouble current_key_height;
	gchar* current_key_detailed_action_name;
	gchar* current_key_press_detailed_action_name;
	GListStore* current_key_popup_keys;
	gchar* current_key_label;
	GIcon* current_key_icon;
};

static gint GalaDaemonKeyboardModelBuilder_private_offset;
static gpointer gala_daemon_keyboard_model_builder_parent_class = NULL;

VALA_EXTERN GType gala_daemon_keyboard_model_builder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboardModelBuilder, g_object_unref)
VALA_EXTERN GType gala_daemon_keyboard_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboardModel, g_object_unref)
VALA_EXTERN GalaDaemonKeyboardModel* gala_daemon_keyboard_model_builder_end (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_begin_view (GalaDaemonKeyboardModelBuilder* self,
                                                    const gchar* name);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_view_default (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_end_view (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN GType gala_daemon_keyboard_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKeyboardView, g_object_unref)
VALA_EXTERN GalaDaemonKeyboardView* gala_daemon_keyboard_view_new (const gchar* name,
                                                       GListModel* rows,
                                                       gboolean is_default);
VALA_EXTERN GalaDaemonKeyboardView* gala_daemon_keyboard_view_construct (GType object_type,
                                                             const gchar* name,
                                                             GListModel* rows,
                                                             gboolean is_default);
VALA_EXTERN void gala_daemon_keyboard_model_builder_begin_row (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN GType gala_daemon_key_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonKey, g_object_unref)
VALA_EXTERN void gala_daemon_keyboard_model_builder_end_row (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_begin_key (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_left_offset (GalaDaemonKeyboardModelBuilder* self,
                                                             gdouble left_offset);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_width (GalaDaemonKeyboardModelBuilder* self,
                                                       gdouble width);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_height (GalaDaemonKeyboardModelBuilder* self,
                                                        gdouble height);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_val_action (GalaDaemonKeyboardModelBuilder* self,
                                                            guint val);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_erase_action (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_latch_view_action (GalaDaemonKeyboardModelBuilder* self,
                                                               const gchar* view_name);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_set_view_action (GalaDaemonKeyboardModelBuilder* self,
                                                             const gchar* view_name);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_hide_action (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_label (GalaDaemonKeyboardModelBuilder* self,
                                                       const gchar* label);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_icon (GalaDaemonKeyboardModelBuilder* self,
                                                      GIcon* icon);
VALA_EXTERN void gala_daemon_keyboard_model_builder_set_key_icon_name (GalaDaemonKeyboardModelBuilder* self,
                                                           const gchar* icon_name);
VALA_EXTERN void gala_daemon_keyboard_model_builder_end_key (GalaDaemonKeyboardModelBuilder* self);
VALA_EXTERN GalaDaemonKey* gala_daemon_key_new (gdouble left_offset,
                                    gdouble width,
                                    gdouble height,
                                    const gchar* detailed_action_name,
                                    const gchar* press_detailed_action_name,
                                    GListModel* popup_keys,
                                    const gchar* label,
                                    GIcon* icon);
VALA_EXTERN GalaDaemonKey* gala_daemon_key_construct (GType object_type,
                                          gdouble left_offset,
                                          gdouble width,
                                          gdouble height,
                                          const gchar* detailed_action_name,
                                          const gchar* press_detailed_action_name,
                                          GListModel* popup_keys,
                                          const gchar* label,
                                          GIcon* icon);
VALA_EXTERN GalaDaemonKeyboardModelBuilder* gala_daemon_keyboard_model_builder_new (void);
VALA_EXTERN GalaDaemonKeyboardModelBuilder* gala_daemon_keyboard_model_builder_construct (GType object_type);
static GObject * gala_daemon_keyboard_model_builder_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
VALA_EXTERN GalaDaemonKeyboardModel* gala_daemon_keyboard_model_new (GListModel* views);
VALA_EXTERN GalaDaemonKeyboardModel* gala_daemon_keyboard_model_construct (GType object_type,
                                                               GListModel* views);
static void gala_daemon_keyboard_model_builder_finalize (GObject * obj);
static GType gala_daemon_keyboard_model_builder_get_type_once (void);

static inline gpointer
gala_daemon_keyboard_model_builder_get_instance_private (GalaDaemonKeyboardModelBuilder* self)
{
	return G_STRUCT_MEMBER_P (self, GalaDaemonKeyboardModelBuilder_private_offset);
}

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

GalaDaemonKeyboardModel*
gala_daemon_keyboard_model_builder_end (GalaDaemonKeyboardModelBuilder* self)
{
	GalaDaemonKeyboardModel* _tmp0_;
	GalaDaemonKeyboardModel* _tmp1_;
	GalaDaemonKeyboardModel* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->model;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
gala_daemon_keyboard_model_builder_begin_view (GalaDaemonKeyboardModelBuilder* self,
                                               const gchar* name)
{
	const gchar* _tmp0_;
	GListStore* _tmp1_;
	gchar* _tmp2_;
	GListStore* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = self->priv->current_view_name;
	_tmp1_ = self->priv->current_view_store;
	_vala_return_if_fail ((_tmp0_ == NULL) && (_tmp1_ == NULL), "current_view_name == null && current_view_store == null");
	_tmp2_ = g_strdup (name);
	_g_free0 (self->priv->current_view_name);
	self->priv->current_view_name = _tmp2_;
	_tmp3_ = g_list_store_new (g_list_store_get_type ());
	_g_object_unref0 (self->priv->current_view_store);
	self->priv->current_view_store = _tmp3_;
}

void
gala_daemon_keyboard_model_builder_set_view_default (GalaDaemonKeyboardModelBuilder* self)
{
	const gchar* _tmp0_;
	GListStore* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_view_name;
	_tmp1_ = self->priv->current_view_store;
	_vala_return_if_fail ((_tmp0_ != NULL) && (_tmp1_ != NULL), "current_view_name != null && current_view_store != null");
	self->priv->current_view_is_default = TRUE;
}

void
gala_daemon_keyboard_model_builder_end_view (GalaDaemonKeyboardModelBuilder* self)
{
	const gchar* _tmp0_;
	GListStore* _tmp1_;
	GalaDaemonKeyboardView* view = NULL;
	const gchar* _tmp2_;
	GListStore* _tmp3_;
	GalaDaemonKeyboardView* _tmp4_;
	GListStore* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_view_name;
	_tmp1_ = self->priv->current_view_store;
	_vala_return_if_fail ((_tmp0_ != NULL) && (_tmp1_ != NULL), "current_view_name != null && current_view_store != null");
	_tmp2_ = self->priv->current_view_name;
	_tmp3_ = self->priv->current_view_store;
	_tmp4_ = gala_daemon_keyboard_view_new (_tmp2_, (GListModel*) _tmp3_, self->priv->current_view_is_default);
	view = _tmp4_;
	_tmp5_ = self->priv->views_store;
	g_list_store_append (_tmp5_, (GObject*) view);
	_g_free0 (self->priv->current_view_name);
	self->priv->current_view_name = NULL;
	_g_object_unref0 (self->priv->current_view_store);
	self->priv->current_view_store = NULL;
	self->priv->current_view_is_default = FALSE;
	_g_object_unref0 (view);
}

void
gala_daemon_keyboard_model_builder_begin_row (GalaDaemonKeyboardModelBuilder* self)
{
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	GListStore* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_view_store;
	_tmp1_ = self->priv->current_row;
	_vala_return_if_fail ((_tmp0_ != NULL) && (_tmp1_ == NULL), "current_view_store != null && current_row == null");
	_tmp2_ = g_list_store_new (GALA_DAEMON_TYPE_KEY);
	_g_object_unref0 (self->priv->current_row);
	self->priv->current_row = _tmp2_;
}

void
gala_daemon_keyboard_model_builder_end_row (GalaDaemonKeyboardModelBuilder* self)
{
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	GListStore* _tmp2_;
	GListStore* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_view_store;
	_tmp1_ = self->priv->current_row;
	_vala_return_if_fail ((_tmp0_ != NULL) && (_tmp1_ != NULL), "current_view_store != null && current_row != null");
	_tmp2_ = self->priv->current_view_store;
	_tmp3_ = self->priv->current_row;
	g_list_store_append (_tmp2_, (GObject*) _tmp3_);
	_g_object_unref0 (self->priv->current_row);
	self->priv->current_row = NULL;
}

void
gala_daemon_keyboard_model_builder_begin_key (GalaDaemonKeyboardModelBuilder* self)
{
	GListStore* _tmp0_;
	const gchar* _tmp1_;
	GListStore* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_row;
	_tmp1_ = self->priv->current_key_detailed_action_name;
	_vala_return_if_fail ((_tmp0_ != NULL) && (_tmp1_ == NULL), "current_row != null && current_key_detailed_action_name == null");
	_tmp2_ = g_list_store_new (GALA_DAEMON_TYPE_KEY);
	_g_object_unref0 (self->priv->current_key_popup_keys);
	self->priv->current_key_popup_keys = _tmp2_;
}

void
gala_daemon_keyboard_model_builder_set_key_left_offset (GalaDaemonKeyboardModelBuilder* self,
                                                        gdouble left_offset)
{
	g_return_if_fail (self != NULL);
	self->priv->current_key_left_offset = left_offset;
}

void
gala_daemon_keyboard_model_builder_set_key_width (GalaDaemonKeyboardModelBuilder* self,
                                                  gdouble width)
{
	g_return_if_fail (self != NULL);
	self->priv->current_key_width = width;
}

void
gala_daemon_keyboard_model_builder_set_key_height (GalaDaemonKeyboardModelBuilder* self,
                                                   gdouble height)
{
	g_return_if_fail (self != NULL);
	self->priv->current_key_height = height;
}

void
gala_daemon_keyboard_model_builder_set_key_val_action (GalaDaemonKeyboardModelBuilder* self,
                                                       guint val)
{
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gchar* _tmp2_;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_variant_new_uint32 ((guint32) val);
	g_variant_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_action_print_detailed_name (GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_PRESS_KEY_VAL, _tmp1_);
	_g_free0 (self->priv->current_key_press_detailed_action_name);
	self->priv->current_key_press_detailed_action_name = _tmp2_;
	_g_variant_unref0 (_tmp1_);
	_tmp3_ = g_variant_new_uint32 ((guint32) val);
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_action_print_detailed_name (GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_RELEASE_KEY_VAL, _tmp4_);
	_g_free0 (self->priv->current_key_detailed_action_name);
	self->priv->current_key_detailed_action_name = _tmp5_;
	_g_variant_unref0 (_tmp4_);
}

void
gala_daemon_keyboard_model_builder_set_erase_action (GalaDaemonKeyboardModelBuilder* self)
{
	g_return_if_fail (self != NULL);
	gala_daemon_keyboard_model_builder_set_key_val_action (self, GDK_KEY_BackSpace);
}

void
gala_daemon_keyboard_model_builder_set_latch_view_action (GalaDaemonKeyboardModelBuilder* self,
                                                          const gchar* view_name)
{
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view_name != NULL);
	_tmp0_ = g_variant_new_string (view_name);
	g_variant_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_action_print_detailed_name (GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_LATCH_VIEW, _tmp1_);
	_g_free0 (self->priv->current_key_detailed_action_name);
	self->priv->current_key_detailed_action_name = _tmp2_;
	_g_variant_unref0 (_tmp1_);
}

void
gala_daemon_keyboard_model_builder_set_set_view_action (GalaDaemonKeyboardModelBuilder* self,
                                                        const gchar* view_name)
{
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view_name != NULL);
	_tmp0_ = g_variant_new_string (view_name);
	g_variant_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_action_print_detailed_name (GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_SET_VIEW, _tmp1_);
	_g_free0 (self->priv->current_key_detailed_action_name);
	self->priv->current_key_detailed_action_name = _tmp2_;
	_g_variant_unref0 (_tmp1_);
}

void
gala_daemon_keyboard_model_builder_set_hide_action (GalaDaemonKeyboardModelBuilder* self)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_action_print_detailed_name (GALA_DAEMON_KEY_ACTION_PREFIX GALA_DAEMON_KEY_ACTION_HIDE, NULL);
	_g_free0 (self->priv->current_key_detailed_action_name);
	self->priv->current_key_detailed_action_name = _tmp0_;
}

void
gala_daemon_keyboard_model_builder_set_key_label (GalaDaemonKeyboardModelBuilder* self,
                                                  const gchar* label)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = g_strdup (label);
	_g_free0 (self->priv->current_key_label);
	self->priv->current_key_label = _tmp0_;
}

void
gala_daemon_keyboard_model_builder_set_key_icon (GalaDaemonKeyboardModelBuilder* self,
                                                 GIcon* icon)
{
	GIcon* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon != NULL);
	_tmp0_ = _g_object_ref0 (icon);
	_g_object_unref0 (self->priv->current_key_icon);
	self->priv->current_key_icon = _tmp0_;
}

void
gala_daemon_keyboard_model_builder_set_key_icon_name (GalaDaemonKeyboardModelBuilder* self,
                                                      const gchar* icon_name)
{
	GThemedIcon* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_name != NULL);
	_tmp0_ = (GThemedIcon*) g_themed_icon_new (icon_name);
	_g_object_unref0 (self->priv->current_key_icon);
	self->priv->current_key_icon = (GIcon*) _tmp0_;
}

void
gala_daemon_keyboard_model_builder_end_key (GalaDaemonKeyboardModelBuilder* self)
{
	GListStore* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_;
	GalaDaemonKey* key = NULL;
	const gchar* _tmp6_;
	GListStore* _tmp7_;
	const gchar* _tmp8_;
	GIcon* _tmp9_;
	GalaDaemonKey* _tmp10_;
	GListStore* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_row;
	_vala_return_if_fail (_tmp0_ != NULL, "current_row != null");
	_tmp2_ = self->priv->current_key_label;
	if (_tmp2_ != NULL) {
		GIcon* _tmp3_;
		_tmp3_ = self->priv->current_key_icon;
		_tmp1_ = _tmp3_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		g_critical ("KeyboardModelBuilder.vala:115: A key should have at least an icon or l" \
"abel.");
	}
	_tmp5_ = self->priv->current_key_detailed_action_name;
	_tmp4_ = _tmp5_;
	if (_tmp4_ == NULL) {
		_tmp4_ = "none";
	}
	_tmp6_ = self->priv->current_key_press_detailed_action_name;
	_tmp7_ = self->priv->current_key_popup_keys;
	_tmp8_ = self->priv->current_key_label;
	_tmp9_ = self->priv->current_key_icon;
	_tmp10_ = gala_daemon_key_new (self->priv->current_key_left_offset, self->priv->current_key_width, self->priv->current_key_height, _tmp4_, _tmp6_, (GListModel*) _tmp7_, _tmp8_, _tmp9_);
	key = _tmp10_;
	_tmp11_ = self->priv->current_row;
	g_list_store_append (_tmp11_, (GObject*) key);
	self->priv->current_key_left_offset = 0.0;
	self->priv->current_key_width = 1.0;
	self->priv->current_key_height = 1.0;
	_g_free0 (self->priv->current_key_detailed_action_name);
	self->priv->current_key_detailed_action_name = NULL;
	_g_free0 (self->priv->current_key_press_detailed_action_name);
	self->priv->current_key_press_detailed_action_name = NULL;
	_g_object_unref0 (self->priv->current_key_popup_keys);
	self->priv->current_key_popup_keys = NULL;
	_g_free0 (self->priv->current_key_label);
	self->priv->current_key_label = NULL;
	_g_object_unref0 (self->priv->current_key_icon);
	self->priv->current_key_icon = NULL;
	_g_object_unref0 (key);
}

GalaDaemonKeyboardModelBuilder*
gala_daemon_keyboard_model_builder_construct (GType object_type)
{
	GalaDaemonKeyboardModelBuilder * self = NULL;
	self = (GalaDaemonKeyboardModelBuilder*) g_object_new (object_type, NULL);
	return self;
}

GalaDaemonKeyboardModelBuilder*
gala_daemon_keyboard_model_builder_new (void)
{
	return gala_daemon_keyboard_model_builder_construct (GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER);
}

static GObject *
gala_daemon_keyboard_model_builder_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaDaemonKeyboardModelBuilder * self;
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	GalaDaemonKeyboardModel* _tmp2_;
	parent_class = G_OBJECT_CLASS (gala_daemon_keyboard_model_builder_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER, GalaDaemonKeyboardModelBuilder);
	_tmp0_ = g_list_store_new (GALA_DAEMON_TYPE_KEYBOARD_VIEW);
	_g_object_unref0 (self->priv->views_store);
	self->priv->views_store = _tmp0_;
	_tmp1_ = self->priv->views_store;
	_tmp2_ = gala_daemon_keyboard_model_new ((GListModel*) _tmp1_);
	_g_object_unref0 (self->priv->model);
	self->priv->model = _tmp2_;
	return obj;
}

static void
gala_daemon_keyboard_model_builder_class_init (GalaDaemonKeyboardModelBuilderClass * klass,
                                               gpointer klass_data)
{
	gala_daemon_keyboard_model_builder_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaDaemonKeyboardModelBuilder_private_offset);
	G_OBJECT_CLASS (klass)->constructor = gala_daemon_keyboard_model_builder_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_daemon_keyboard_model_builder_finalize;
}

static void
gala_daemon_keyboard_model_builder_instance_init (GalaDaemonKeyboardModelBuilder * self,
                                                  gpointer klass)
{
	self->priv = gala_daemon_keyboard_model_builder_get_instance_private (self);
	self->priv->current_view_is_default = FALSE;
	self->priv->current_key_left_offset = 0.0;
	self->priv->current_key_width = 1.0;
	self->priv->current_key_height = 1.0;
}

static void
gala_daemon_keyboard_model_builder_finalize (GObject * obj)
{
	GalaDaemonKeyboardModelBuilder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_DAEMON_TYPE_KEYBOARD_MODEL_BUILDER, GalaDaemonKeyboardModelBuilder);
	_g_object_unref0 (self->priv->model);
	_g_object_unref0 (self->priv->views_store);
	_g_free0 (self->priv->current_view_name);
	_g_object_unref0 (self->priv->current_view_store);
	_g_object_unref0 (self->priv->current_row);
	_g_free0 (self->priv->current_key_detailed_action_name);
	_g_free0 (self->priv->current_key_press_detailed_action_name);
	_g_object_unref0 (self->priv->current_key_popup_keys);
	_g_free0 (self->priv->current_key_label);
	_g_object_unref0 (self->priv->current_key_icon);
	G_OBJECT_CLASS (gala_daemon_keyboard_model_builder_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gala_daemon_keyboard_model_builder_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaDaemonKeyboardModelBuilderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_daemon_keyboard_model_builder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaDaemonKeyboardModelBuilder), 0, (GInstanceInitFunc) gala_daemon_keyboard_model_builder_instance_init, NULL };
	GType gala_daemon_keyboard_model_builder_type_id;
	gala_daemon_keyboard_model_builder_type_id = g_type_register_static (G_TYPE_OBJECT, "GalaDaemonKeyboardModelBuilder", &g_define_type_info, G_TYPE_FLAG_NONE);
	GalaDaemonKeyboardModelBuilder_private_offset = g_type_add_instance_private (gala_daemon_keyboard_model_builder_type_id, sizeof (GalaDaemonKeyboardModelBuilderPrivate));
	return gala_daemon_keyboard_model_builder_type_id;
}

GType
gala_daemon_keyboard_model_builder_get_type (void)
{
	static gsize gala_daemon_keyboard_model_builder_type_id__once = 0;
	if (g_once_init_enter (&gala_daemon_keyboard_model_builder_type_id__once)) {
		GType gala_daemon_keyboard_model_builder_type_id;
		gala_daemon_keyboard_model_builder_type_id = gala_daemon_keyboard_model_builder_get_type_once ();
		g_once_init_leave (&gala_daemon_keyboard_model_builder_type_id__once, gala_daemon_keyboard_model_builder_type_id);
	}
	return gala_daemon_keyboard_model_builder_type_id__once;
}

