/* OSKService.c generated by valac 0.56.19, the Vala compiler
 * generated from OSKService.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 <gtk/gtk.h>
#include <glib.h>
#include <ibus.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 GALA_DAEMON_TYPE_OSK_SERVICE (gala_daemon_osk_service_get_type ())
#define GALA_DAEMON_OSK_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_OSK_SERVICE, GalaDaemonOSKService))
#define GALA_DAEMON_OSK_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_OSK_SERVICE, GalaDaemonOSKServiceClass))
#define GALA_DAEMON_IS_OSK_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_OSK_SERVICE))
#define GALA_DAEMON_IS_OSK_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_OSK_SERVICE))
#define GALA_DAEMON_OSK_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_OSK_SERVICE, GalaDaemonOSKServiceClass))

typedef struct _GalaDaemonOSKService GalaDaemonOSKService;
typedef struct _GalaDaemonOSKServiceClass GalaDaemonOSKServiceClass;
typedef struct _GalaDaemonOSKServicePrivate GalaDaemonOSKServicePrivate;

#define GALA_DAEMON_TYPE_IBUS_SERVICE (gala_daemon_ibus_service_get_type ())
#define GALA_DAEMON_IBUS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_IBUS_SERVICE, GalaDaemonIBusService))
#define GALA_DAEMON_IBUS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_IBUS_SERVICE, GalaDaemonIBusServiceClass))
#define GALA_DAEMON_IS_IBUS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_IBUS_SERVICE))
#define GALA_DAEMON_IS_IBUS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_IBUS_SERVICE))
#define GALA_DAEMON_IBUS_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_IBUS_SERVICE, GalaDaemonIBusServiceClass))

typedef struct _GalaDaemonIBusService GalaDaemonIBusService;
typedef struct _GalaDaemonIBusServiceClass GalaDaemonIBusServiceClass;

#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_OSK_WINDOW (gala_daemon_osk_window_get_type ())
#define GALA_DAEMON_OSK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_DAEMON_TYPE_OSK_WINDOW, GalaDaemonOSKWindow))
#define GALA_DAEMON_OSK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_DAEMON_TYPE_OSK_WINDOW, GalaDaemonOSKWindowClass))
#define GALA_DAEMON_IS_OSK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_DAEMON_TYPE_OSK_WINDOW))
#define GALA_DAEMON_IS_OSK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_DAEMON_TYPE_OSK_WINDOW))
#define GALA_DAEMON_OSK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_DAEMON_TYPE_OSK_WINDOW, GalaDaemonOSKWindowClass))

typedef struct _GalaDaemonOSKWindow GalaDaemonOSKWindow;
typedef struct _GalaDaemonOSKWindowClass GalaDaemonOSKWindowClass;
enum  {
	GALA_DAEMON_OSK_SERVICE_0_PROPERTY,
	GALA_DAEMON_OSK_SERVICE_NUM_PROPERTIES
};
static GParamSpec* gala_daemon_osk_service_properties[GALA_DAEMON_OSK_SERVICE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
enum  {
	GALA_DAEMON_OSK_SERVICE_HIDE_REQUESTED_SIGNAL,
	GALA_DAEMON_OSK_SERVICE_KEYVAL_PRESSED_SIGNAL,
	GALA_DAEMON_OSK_SERVICE_KEYVAL_RELEASED_SIGNAL,
	GALA_DAEMON_OSK_SERVICE_NUM_SIGNALS
};
static guint gala_daemon_osk_service_signals[GALA_DAEMON_OSK_SERVICE_NUM_SIGNALS] = {0};
#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 _GalaDaemonOSKService {
	GObject parent_instance;
	GalaDaemonOSKServicePrivate * priv;
};

struct _GalaDaemonOSKServiceClass {
	GObjectClass parent_class;
};

struct _GalaDaemonOSKServicePrivate {
	GalaDaemonIBusService* ibus_service;
	GalaDaemonModelManager* model_manager;
	GalaDaemonOSKWindow* osk_window;
};

static gint GalaDaemonOSKService_private_offset;
static gpointer gala_daemon_osk_service_parent_class = NULL;

VALA_EXTERN GType gala_daemon_osk_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonOSKService, g_object_unref)
VALA_EXTERN guint gala_daemon_osk_service_register_object (void* object,
                                               GDBusConnection* connection,
                                               const gchar* path,
                                               GError** error);
VALA_EXTERN GType gala_daemon_ibus_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonIBusService, 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_osk_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonOSKWindow, g_object_unref)
 G_GNUC_INTERNAL GalaDaemonOSKService* gala_daemon_osk_service_new (GalaDaemonIBusService* ibus_service);
 G_GNUC_INTERNAL GalaDaemonOSKService* gala_daemon_osk_service_construct (GType object_type,
                                                         GalaDaemonIBusService* ibus_service);
VALA_EXTERN void gala_daemon_osk_service_set_enabled (GalaDaemonOSKService* self,
                                          gboolean enabled,
                                          GError** error);
static gboolean gala_daemon_osk_service_get_enabled (GalaDaemonOSKService* self);
VALA_EXTERN GalaDaemonModelManager* gala_daemon_model_manager_new (void);
VALA_EXTERN GalaDaemonModelManager* gala_daemon_model_manager_construct (GType object_type);
VALA_EXTERN GType gala_daemon_input_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonInputManager, g_object_unref)
VALA_EXTERN GalaDaemonInputManager* gala_daemon_input_manager_new (GalaDaemonOSKService* service);
VALA_EXTERN GalaDaemonInputManager* gala_daemon_input_manager_construct (GType object_type,
                                                             GalaDaemonOSKService* service);
VALA_EXTERN GalaDaemonOSKWindow* gala_daemon_osk_window_new (GalaDaemonModelManager* model_manager,
                                                 GalaDaemonInputManager* input_manager,
                                                 GalaDaemonIBusService* ibus_service);
VALA_EXTERN GalaDaemonOSKWindow* gala_daemon_osk_window_construct (GType object_type,
                                                       GalaDaemonModelManager* model_manager,
                                                       GalaDaemonInputManager* input_manager,
                                                       GalaDaemonIBusService* ibus_service);
VALA_EXTERN void gala_daemon_osk_service_reset (GalaDaemonOSKService* self,
                                    GError** error);
VALA_EXTERN void gala_daemon_osk_window_reset (GalaDaemonOSKWindow* self);
VALA_EXTERN void gala_daemon_osk_service_set_input_purpose (GalaDaemonOSKService* self,
                                                IBusInputPurpose input_purpose,
                                                GError** error);
VALA_EXTERN void gala_daemon_model_manager_set_input_purpose (GalaDaemonModelManager* self,
                                                  IBusInputPurpose value);
static void gala_daemon_osk_service_finalize (GObject * obj);
static GType gala_daemon_osk_service_get_type_once (void);
static void _vala_gala_daemon_osk_service_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _dbus_gala_daemon_osk_service_set_enabled (GalaDaemonOSKService* self,
                                                GVariant* _parameters_,
                                                GDBusMethodInvocation* invocation);
static void _dbus_gala_daemon_osk_service_reset (GalaDaemonOSKService* self,
                                          GVariant* _parameters_,
                                          GDBusMethodInvocation* invocation);
static void _dbus_gala_daemon_osk_service_set_input_purpose (GalaDaemonOSKService* self,
                                                      GVariant* _parameters_,
                                                      GDBusMethodInvocation* invocation);
static void gala_daemon_osk_service_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* gala_daemon_osk_service_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 gboolean gala_daemon_osk_service_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_gala_daemon_osk_service_hide_requested (GObject* _sender,
                                                   gpointer* _data);
static void _dbus_gala_daemon_osk_service_keyval_pressed (GObject* _sender,
                                                   guint keyval,
                                                   gpointer* _data);
static void _dbus_gala_daemon_osk_service_keyval_released (GObject* _sender,
                                                    guint keyval,
                                                    gpointer* _data);
static void _gala_daemon_osk_service_unregister_object (gpointer user_data);

static const GDBusArgInfo _gala_daemon_osk_service_dbus_arg_info_set_enabled_enabled = {-1, "enabled", "b", NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_set_enabled_in[] = {&_gala_daemon_osk_service_dbus_arg_info_set_enabled_enabled, NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_set_enabled_out[] = {NULL};
static const GDBusMethodInfo _gala_daemon_osk_service_dbus_method_info_set_enabled = {-1, "SetEnabled", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_set_enabled_in), (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_set_enabled_out), NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_reset_in[] = {NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_reset_out[] = {NULL};
static const GDBusMethodInfo _gala_daemon_osk_service_dbus_method_info_reset = {-1, "Reset", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_reset_in), (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_reset_out), NULL};
static const GDBusArgInfo _gala_daemon_osk_service_dbus_arg_info_set_input_purpose_input_purpose = {-1, "input_purpose", "i", NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_set_input_purpose_in[] = {&_gala_daemon_osk_service_dbus_arg_info_set_input_purpose_input_purpose, NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_set_input_purpose_out[] = {NULL};
static const GDBusMethodInfo _gala_daemon_osk_service_dbus_method_info_set_input_purpose = {-1, "SetInputPurpose", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_set_input_purpose_in), (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_set_input_purpose_out), NULL};
static const GDBusMethodInfo * const _gala_daemon_osk_service_dbus_method_info[] = {&_gala_daemon_osk_service_dbus_method_info_set_enabled, &_gala_daemon_osk_service_dbus_method_info_reset, &_gala_daemon_osk_service_dbus_method_info_set_input_purpose, NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_hide_requested[] = {NULL};
static const GDBusSignalInfo _gala_daemon_osk_service_dbus_signal_info_hide_requested = {-1, "HideRequested", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_hide_requested), NULL};
static const GDBusArgInfo _gala_daemon_osk_service_dbus_arg_info_keyval_pressed_keyval = {-1, "keyval", "u", NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_keyval_pressed[] = {&_gala_daemon_osk_service_dbus_arg_info_keyval_pressed_keyval, NULL};
static const GDBusSignalInfo _gala_daemon_osk_service_dbus_signal_info_keyval_pressed = {-1, "KeyvalPressed", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_keyval_pressed), NULL};
static const GDBusArgInfo _gala_daemon_osk_service_dbus_arg_info_keyval_released_keyval = {-1, "keyval", "u", NULL};
static const GDBusArgInfo * const _gala_daemon_osk_service_dbus_arg_info_keyval_released[] = {&_gala_daemon_osk_service_dbus_arg_info_keyval_released_keyval, NULL};
static const GDBusSignalInfo _gala_daemon_osk_service_dbus_signal_info_keyval_released = {-1, "KeyvalReleased", (GDBusArgInfo **) (&_gala_daemon_osk_service_dbus_arg_info_keyval_released), NULL};
static const GDBusSignalInfo * const _gala_daemon_osk_service_dbus_signal_info[] = {&_gala_daemon_osk_service_dbus_signal_info_hide_requested, &_gala_daemon_osk_service_dbus_signal_info_keyval_pressed, &_gala_daemon_osk_service_dbus_signal_info_keyval_released, NULL};
static const GDBusPropertyInfo * const _gala_daemon_osk_service_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _gala_daemon_osk_service_dbus_interface_info = {-1, "io.elementary.OSK", (GDBusMethodInfo **) (&_gala_daemon_osk_service_dbus_method_info), (GDBusSignalInfo **) (&_gala_daemon_osk_service_dbus_signal_info), (GDBusPropertyInfo **) (&_gala_daemon_osk_service_dbus_property_info), NULL};
static const GDBusInterfaceVTable _gala_daemon_osk_service_dbus_interface_vtable = {gala_daemon_osk_service_dbus_interface_method_call, gala_daemon_osk_service_dbus_interface_get_property, gala_daemon_osk_service_dbus_interface_set_property};

static inline gpointer
gala_daemon_osk_service_get_instance_private (GalaDaemonOSKService* self)
{
	return G_STRUCT_MEMBER_P (self, GalaDaemonOSKService_private_offset);
}

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

 G_GNUC_INTERNAL GalaDaemonOSKService*
gala_daemon_osk_service_construct (GType object_type,
                                   GalaDaemonIBusService* ibus_service)
{
	GalaDaemonOSKService * self = NULL;
	GalaDaemonIBusService* _tmp0_;
	g_return_val_if_fail (ibus_service != NULL, NULL);
	self = (GalaDaemonOSKService*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (ibus_service);
	_g_object_unref0 (self->priv->ibus_service);
	self->priv->ibus_service = _tmp0_;
	return self;
}

 G_GNUC_INTERNAL GalaDaemonOSKService*
gala_daemon_osk_service_new (GalaDaemonIBusService* ibus_service)
{
	return gala_daemon_osk_service_construct (GALA_DAEMON_TYPE_OSK_SERVICE, ibus_service);
}

void
gala_daemon_osk_service_set_enabled (GalaDaemonOSKService* self,
                                     gboolean enabled,
                                     GError** error)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gala_daemon_osk_service_get_enabled (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == enabled) {
		return;
	}
	if (enabled) {
		GalaDaemonModelManager* _tmp2_;
		GalaDaemonInputManager* input_manager = NULL;
		GalaDaemonInputManager* _tmp3_;
		GalaDaemonModelManager* _tmp4_;
		GalaDaemonInputManager* _tmp5_;
		GalaDaemonIBusService* _tmp6_;
		GalaDaemonOSKWindow* _tmp7_;
		GalaDaemonOSKWindow* _tmp8_;
		_tmp2_ = gala_daemon_model_manager_new ();
		_g_object_unref0 (self->priv->model_manager);
		self->priv->model_manager = _tmp2_;
		_tmp3_ = gala_daemon_input_manager_new (self);
		input_manager = _tmp3_;
		_tmp4_ = self->priv->model_manager;
		_tmp5_ = input_manager;
		_tmp6_ = self->priv->ibus_service;
		_tmp7_ = gala_daemon_osk_window_new (_tmp4_, _tmp5_, _tmp6_);
		g_object_ref_sink (_tmp7_);
		_g_object_unref0 (self->priv->osk_window);
		self->priv->osk_window = _tmp7_;
		_tmp8_ = self->priv->osk_window;
		gtk_window_present ((GtkWindow*) _tmp8_);
		_g_object_unref0 (input_manager);
	} else {
		GalaDaemonOSKWindow* _tmp9_ = NULL;
		GalaDaemonOSKWindow* _tmp10_;
		_tmp10_ = self->priv->osk_window;
		_tmp9_ = _tmp10_;
		if (_tmp9_ != NULL) {
			gtk_window_destroy ((GtkWindow*) _tmp9_);
		}
		_g_object_unref0 (self->priv->osk_window);
		self->priv->osk_window = NULL;
		_g_object_unref0 (self->priv->model_manager);
		self->priv->model_manager = NULL;
	}
}

/**
     * Called for example when the keyboard is dismissed.
     */
void
gala_daemon_osk_service_reset (GalaDaemonOSKService* self,
                               GError** error)
{
	GalaDaemonOSKWindow* _tmp0_;
	GalaDaemonOSKWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->osk_window;
	_vala_return_if_fail (_tmp0_ != NULL, "osk_window != null");
	_tmp1_ = self->priv->osk_window;
	gala_daemon_osk_window_reset (_tmp1_);
}

void
gala_daemon_osk_service_set_input_purpose (GalaDaemonOSKService* self,
                                           IBusInputPurpose input_purpose,
                                           GError** error)
{
	GalaDaemonModelManager* _tmp0_;
	GalaDaemonModelManager* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->model_manager;
	_vala_return_if_fail (_tmp0_ != NULL, "model_manager != null");
	_tmp1_ = self->priv->model_manager;
	gala_daemon_model_manager_set_input_purpose (_tmp1_, input_purpose);
}

static gboolean
gala_daemon_osk_service_get_enabled (GalaDaemonOSKService* self)
{
	gboolean result;
	GalaDaemonOSKWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->osk_window;
	result = _tmp0_ != NULL;
	return result;
}

static void
gala_daemon_osk_service_class_init (GalaDaemonOSKServiceClass * klass,
                                    gpointer klass_data)
{
	gala_daemon_osk_service_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaDaemonOSKService_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_daemon_osk_service_get_property;
	G_OBJECT_CLASS (klass)->finalize = gala_daemon_osk_service_finalize;
	gala_daemon_osk_service_signals[GALA_DAEMON_OSK_SERVICE_HIDE_REQUESTED_SIGNAL] = g_signal_new ("hide-requested", GALA_DAEMON_TYPE_OSK_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_daemon_osk_service_signals[GALA_DAEMON_OSK_SERVICE_KEYVAL_PRESSED_SIGNAL] = g_signal_new ("keyval-pressed", GALA_DAEMON_TYPE_OSK_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
	gala_daemon_osk_service_signals[GALA_DAEMON_OSK_SERVICE_KEYVAL_RELEASED_SIGNAL] = g_signal_new ("keyval-released", GALA_DAEMON_TYPE_OSK_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
}

static void
gala_daemon_osk_service_instance_init (GalaDaemonOSKService * self,
                                       gpointer klass)
{
	self->priv = gala_daemon_osk_service_get_instance_private (self);
}

static void
gala_daemon_osk_service_finalize (GObject * obj)
{
	GalaDaemonOSKService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_DAEMON_TYPE_OSK_SERVICE, GalaDaemonOSKService);
	_g_object_unref0 (self->priv->ibus_service);
	_g_object_unref0 (self->priv->model_manager);
	_g_object_unref0 (self->priv->osk_window);
	G_OBJECT_CLASS (gala_daemon_osk_service_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gala_daemon_osk_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaDaemonOSKServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_daemon_osk_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaDaemonOSKService), 0, (GInstanceInitFunc) gala_daemon_osk_service_instance_init, NULL };
	GType gala_daemon_osk_service_type_id;
	gala_daemon_osk_service_type_id = g_type_register_static (G_TYPE_OBJECT, "GalaDaemonOSKService", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_set_qdata (gala_daemon_osk_service_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gala_daemon_osk_service_register_object);
	GalaDaemonOSKService_private_offset = g_type_add_instance_private (gala_daemon_osk_service_type_id, sizeof (GalaDaemonOSKServicePrivate));
	return gala_daemon_osk_service_type_id;
}

GType
gala_daemon_osk_service_get_type (void)
{
	static gsize gala_daemon_osk_service_type_id__once = 0;
	if (g_once_init_enter (&gala_daemon_osk_service_type_id__once)) {
		GType gala_daemon_osk_service_type_id;
		gala_daemon_osk_service_type_id = gala_daemon_osk_service_get_type_once ();
		g_once_init_leave (&gala_daemon_osk_service_type_id__once, gala_daemon_osk_service_type_id);
	}
	return gala_daemon_osk_service_type_id__once;
}

static void
_vala_gala_daemon_osk_service_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	GalaDaemonOSKService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_DAEMON_TYPE_OSK_SERVICE, GalaDaemonOSKService);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_dbus_gala_daemon_osk_service_set_enabled (GalaDaemonOSKService* self,
                                           GVariant* _parameters_,
                                           GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gboolean enabled = FALSE;
	GVariant* _tmp126_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp126_ = g_variant_iter_next_value (&_arguments_iter);
	enabled = g_variant_get_boolean (_tmp126_);
	g_variant_unref (_tmp126_);
	gala_daemon_osk_service_set_enabled (self, enabled, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_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);
	_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);
}

static void
_dbus_gala_daemon_osk_service_reset (GalaDaemonOSKService* self,
                                     GVariant* _parameters_,
                                     GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	gala_daemon_osk_service_reset (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_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);
	_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);
}

static void
_dbus_gala_daemon_osk_service_set_input_purpose (GalaDaemonOSKService* self,
                                                 GVariant* _parameters_,
                                                 GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	IBusInputPurpose input_purpose = 0;
	GVariant* _tmp127_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp127_ = g_variant_iter_next_value (&_arguments_iter);
	input_purpose = g_variant_get_int32 (_tmp127_);
	g_variant_unref (_tmp127_);
	gala_daemon_osk_service_set_input_purpose (self, input_purpose, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_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);
	_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);
}

static void
gala_daemon_osk_service_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, "SetEnabled") == 0) {
		_dbus_gala_daemon_osk_service_set_enabled (object, parameters, invocation);
	} else if (strcmp (method_name, "Reset") == 0) {
		_dbus_gala_daemon_osk_service_reset (object, parameters, invocation);
	} else if (strcmp (method_name, "SetInputPurpose") == 0) {
		_dbus_gala_daemon_osk_service_set_input_purpose (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
gala_daemon_osk_service_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)
{
	return NULL;
}

static gboolean
gala_daemon_osk_service_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)
{
	return FALSE;
}

static void
_dbus_gala_daemon_osk_service_hide_requested (GObject* _sender,
                                              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);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.OSK", "HideRequested", _arguments, NULL);
}

static void
_dbus_gala_daemon_osk_service_keyval_pressed (GObject* _sender,
                                              guint keyval,
                                              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_uint32 (keyval));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.OSK", "KeyvalPressed", _arguments, NULL);
}

static void
_dbus_gala_daemon_osk_service_keyval_released (GObject* _sender,
                                               guint keyval,
                                               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_uint32 (keyval));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.OSK", "KeyvalReleased", _arguments, NULL);
}

guint
gala_daemon_osk_service_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 *) (&_gala_daemon_osk_service_dbus_interface_info), &_gala_daemon_osk_service_dbus_interface_vtable, data, _gala_daemon_osk_service_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "hide-requested", (GCallback) _dbus_gala_daemon_osk_service_hide_requested, data);
	g_signal_connect (object, "keyval-pressed", (GCallback) _dbus_gala_daemon_osk_service_keyval_pressed, data);
	g_signal_connect (object, "keyval-released", (GCallback) _dbus_gala_daemon_osk_service_keyval_released, data);
	return result;
}

static void
_gala_daemon_osk_service_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_daemon_osk_service_hide_requested, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_daemon_osk_service_keyval_pressed, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_daemon_osk_service_keyval_released, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

