[gnome-desktop] xkb-info: Add test application
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] xkb-info: Add test application
- Date: Fri, 1 Jun 2012 17:29:00 +0000 (UTC)
commit 29c8c48c6a5a830c2b4fd165750b1802fd418eb0
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jun 1 18:28:37 2012 +0100
xkb-info: Add test application
libgnome-desktop/Makefile.am | 6 +++++
libgnome-desktop/test-xkb-info.c | 39 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
index 251f8f6..79c8ab0 100644
--- a/libgnome-desktop/Makefile.am
+++ b/libgnome-desktop/Makefile.am
@@ -120,4 +120,10 @@ gnome_rr_debug_LDADD = \
$(lib_LTLIBRARIES) \
$(XLIB_LIBS)
+noinst_PROGRAMS = test-xkb-info
+test_xkb_info_LDADD = \
+ $(GNOME_DESKTOP_LIBS) \
+ $(lib_LTLIBRARIES) \
+ $(XLIB_LIBS)
+
-include $(top_srcdir)/git.mk
diff --git a/libgnome-desktop/test-xkb-info.c b/libgnome-desktop/test-xkb-info.c
new file mode 100644
index 0000000..e88b4f8
--- /dev/null
+++ b/libgnome-desktop/test-xkb-info.c
@@ -0,0 +1,39 @@
+#include <gtk/gtk.h>
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnome-desktop/gnome-xkb-info.h>
+int
+main (int argc, char **argv)
+{
+ GnomeXkbInfo *info;
+ GList *layouts, *l;
+
+ gtk_init (&argc, &argv);
+
+ info = gnome_xkb_info_new ();
+ layouts = gnome_xkb_info_get_all_layouts (info);
+ for (l = layouts; l != NULL; l = l->next) {
+ const char *id = l->data;
+ const char *display_name;
+ const char *short_name;
+ const char *xkb_layout;
+ const char *xkb_variant;
+
+ if (gnome_xkb_info_get_layout_info (info, id,
+ &display_name,
+ &short_name,
+ &xkb_layout,
+ &xkb_variant) == FALSE) {
+ g_warning ("Failed to get info for layout '%s'", id);
+ } else {
+ g_print ("id: %s\n", id);
+ g_print ("\tdisplay name: %s\n", display_name);
+ g_print ("\tshort name: %s\n", short_name);
+ g_print ("\txkb layout: %s\n", xkb_layout);
+ g_print ("\txkb variant: %s\n", xkb_variant);
+ }
+ }
+ g_list_free (layouts);
+ g_object_unref (info);
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]