[caribou: 3/22] libcaribou: Added methods for retrieving keyboard groups.
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [caribou: 3/22] libcaribou: Added methods for retrieving keyboard groups.
- Date: Mon, 2 May 2011 17:26:23 +0000 (UTC)
commit c4c811f2860faafe0b2aee6e9cc53dfcfb33bef2
Author: Eitan Isaacson <eitan monotonous org>
Date: Fri Apr 22 17:35:01 2011 -0700
libcaribou: Added methods for retrieving keyboard groups.
libcaribou/caribou-virtual-keyboard.c | 63 +++++++++++++++++++++++++++++++++
libcaribou/caribou-virtual-keyboard.h | 7 ++++
2 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/libcaribou/caribou-virtual-keyboard.c b/libcaribou/caribou-virtual-keyboard.c
index bd4d1da..0f32bf2 100644
--- a/libcaribou/caribou-virtual-keyboard.c
+++ b/libcaribou/caribou-virtual-keyboard.c
@@ -240,3 +240,66 @@ caribou_virtual_keyboard_keyval_release (CaribouVirtualKeyboard *self,
gdk_display_sync (gdk_display_get_default ());
}
+/**
+ * caribou_virtual_keyboard_get_current_group:
+ * @group_name: (out) (transfer full): Location to store name of current group,
+ * or NULL.
+ * @variant_name: (out) (transfer full): Location to store name of current group's
+ * variant or NULL.
+ *
+ * Retrieve the keyboard's currently active group.
+ *
+ * Returns: Current group index.
+ */
+guint
+caribou_virtual_keyboard_get_current_group (CaribouVirtualKeyboard *self,
+ gchar **group_name,
+ gchar **variant_name)
+{
+ CaribouVirtualKeyboardPrivate *priv = self->priv;
+
+ if (group_name != NULL || variant_name != NULL) {
+ XklConfigRec *config_rec = xkl_config_rec_new ();
+ xkl_config_rec_get_from_server (config_rec, priv->xkl_engine);
+
+ if (group_name != NULL)
+ *group_name = g_strdup (config_rec->layouts[priv->group]);
+
+ if (variant_name != NULL)
+ *variant_name = g_strdup (config_rec->variants[priv->group]);
+
+ g_object_unref (config_rec);
+ }
+
+ return priv->group;
+}
+
+/**
+ * caribou_virtual_keyboard_get_groups:
+ * @group_names: (out) (transfer full) (array zero-terminated=1): Location to store
+ * names of available groups or NULL.
+ * @variant_names: (out) (transfer full) (array zero-terminated=1): Location to store
+ * variants of available groups or NULL.
+ *
+ * Retrieve the keyboard's available groups.
+ */
+void
+caribou_virtual_keyboard_get_groups (CaribouVirtualKeyboard *self,
+ gchar ***group_names,
+ gchar ***variant_names)
+{
+ CaribouVirtualKeyboardPrivate *priv = self->priv;
+
+ if (group_names != NULL || variant_names != NULL) {
+ XklConfigRec *config_rec = xkl_config_rec_new ();
+ xkl_config_rec_get_from_server (config_rec, priv->xkl_engine);
+
+ if (group_names != NULL)
+ *group_names = g_strdupv (config_rec->layouts);
+
+ if (variant_names != NULL)
+ *variant_names = g_strdupv (config_rec->variants);
+
+ g_object_unref (config_rec);
+ }
+}
diff --git a/libcaribou/caribou-virtual-keyboard.h b/libcaribou/caribou-virtual-keyboard.h
index 01e7499..0fa3715 100644
--- a/libcaribou/caribou-virtual-keyboard.h
+++ b/libcaribou/caribou-virtual-keyboard.h
@@ -47,6 +47,13 @@ void caribou_virtual_keyboard_mod_latch (CaribouVirtualKeyboard *self,
void caribou_virtual_keyboard_mod_unlatch (CaribouVirtualKeyboard *self,
int mask);
+guint caribou_virtual_keyboard_get_current_group (CaribouVirtualKeyboard *self,
+ gchar **group_name,
+ gchar **variant_name);
+
+void caribou_virtual_keyboard_get_groups (CaribouVirtualKeyboard *self,
+ gchar ***group_names,
+ gchar ***variant_names);
G_END_DECLS
#endif /* CARIBOU_VIRTUAL_KEYBOARD_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]