aboutsummaryrefslogtreecommitdiff
path: root/src/keyboard-lomiri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard-lomiri.c')
-rw-r--r--src/keyboard-lomiri.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/keyboard-lomiri.c b/src/keyboard-lomiri.c
new file mode 100644
index 00000000..0ae0b4a2
--- /dev/null
+++ b/src/keyboard-lomiri.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2021 Robert Tari <robert@tari.in>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib-object.h>
+#include "languages.h"
+#include "keyboard.h"
+
+enum
+{
+ LAYOUT_CHANGED,
+ CONFIG_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint m_lSignals[LAST_SIGNAL];
+
+struct _KeyboardPrivate
+{
+ guint nLayout;
+};
+
+typedef KeyboardPrivate priv_t;
+
+G_DEFINE_TYPE_WITH_PRIVATE(Keyboard, keyboard, G_TYPE_OBJECT)
+
+void keyboard_AddSource(Keyboard *pKeyboard)
+{
+ return;
+}
+
+guint keyboard_GetNumLayouts(Keyboard *pKeyboard)
+{
+ return 1;
+}
+
+void keyboard_GetLayout(Keyboard *pKeyboard, gint nLayout, gchar **pLanguage, gchar **pDescription)
+{
+ if (nLayout == -1)
+ {
+ nLayout = pKeyboard->pPrivate->nLayout;
+ }
+
+ *pLanguage = g_strdup("En");
+
+ if (pDescription != NULL)
+ {
+ *pDescription = g_strdup("English");
+ }
+}
+
+void keyboard_SetLayout(Keyboard *pKeyboard, gint nLayout)
+{
+ g_signal_emit(pKeyboard, m_lSignals[LAYOUT_CHANGED], 0);
+}
+
+static void onDispose(GObject *pObject)
+{
+ G_OBJECT_CLASS(keyboard_parent_class)->dispose(pObject);
+}
+
+static void keyboard_class_init(KeyboardClass *klass)
+{
+ GObjectClass *pClass = G_OBJECT_CLASS(klass);
+ pClass->dispose = onDispose;
+ m_lSignals[LAYOUT_CHANGED] = g_signal_new(KEYBOARD_LAYOUT_CHANGED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+ m_lSignals[CONFIG_CHANGED] = g_signal_new(KEYBOARD_CONFIG_CHANGED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+}
+
+Keyboard* keyboard_new()
+{
+ GObject *pObject = g_object_new(G_TYPE_KEYBOARD, NULL);
+
+ return G_KEYBOARD(pObject);
+}
+
+static void keyboard_init(Keyboard *self)
+{
+ self->pPrivate = keyboard_get_instance_private(self);
+ self->pPrivate->nLayout = 0;
+}