diff options
author | William Hua <william.hua@canonical.com> | 2013-03-22 08:47:23 -0400 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2013-03-22 08:47:23 -0400 |
commit | db995f3ede60a41dc3c4abb080b0d9deb593334b (patch) | |
tree | bdaf75ac022292fba573ee1d8a4fc713261e5330 /lib | |
parent | bb5d7364fcc89d18a9c431344acf56f48fcbc684 (diff) | |
download | ayatana-indicator-keyboard-db995f3ede60a41dc3c4abb080b0d9deb593334b.tar.gz ayatana-indicator-keyboard-db995f3ede60a41dc3c4abb080b0d9deb593334b.tar.bz2 ayatana-indicator-keyboard-db995f3ede60a41dc3c4abb080b0d9deb593334b.zip |
Use .metadata files instead.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 19 | ||||
-rw-r--r-- | lib/main.vala | 52 |
2 files changed, 48 insertions, 23 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index df1cb0cc..65cecfc6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,6 +1,19 @@ +AM_VALAFLAGS = --metadatadir $(top_srcdir)/deps \ + --vapidir $(top_srcdir)/deps + libexec_PROGRAMS = indicator-keyboard-service indicator_keyboard_service_SOURCES = main.vala -indicator_keyboard_service_VALAFLAGS = --pkg gio-2.0 --pkg ibus-1.0 $(AM_VALAFLAGS) -indicator_keyboard_service_CFLAGS = $(GIO_CFLAGS) $(IBUS_CFLAGS) $(AM_CFLAGS) -indicator_keyboard_service_LDFLAGS = $(GIO_LIBS) $(IBUS_LIBS) $(AM_LDFLAGS) +indicator_keyboard_service_VALAFLAGS = --pkg gtk+-3.0 \ + --pkg ibus-1.0 \ + --pkg libgnomekbd \ + --pkg Xkl-1.0 \ + $(AM_VALAFLAGS) +indicator_keyboard_service_CFLAGS = $(GIO_CFLAGS) \ + $(IBUS_CFLAGS) \ + $(LIBGNOMEKBD_CFLAGS) \ + $(AM_CFLAGS) +indicator_keyboard_service_LDFLAGS = $(GIO_LIBS) \ + $(IBUS_LIBS) \ + $(LIBGNOMEKBD_LIBS) \ + $(AM_LDFLAGS) diff --git a/lib/main.vala b/lib/main.vala index 09e1c7f4..757ec1cd 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -32,34 +32,46 @@ public class Indicator.Keyboard.Service : GLib.Object { [DBus (visible = false)] protected virtual GLib.MenuModel create_menu_model () { - IBus.init (); - var ibus = new IBus.Bus (); - var engines = ibus.list_engines (); - var menu = new GLib.Menu (); var submenu = new GLib.Menu (); var section = new GLib.Menu (); - foreach (var engine in engines) { - GLib.stdout.printf ("author = %s\n", engine.author); - GLib.stdout.printf ("description = %s\n", engine.description); - GLib.stdout.printf ("hotkeys = %s\n", engine.hotkeys); - GLib.stdout.printf ("icon = %s\n", engine.icon); - GLib.stdout.printf ("language = %s\n", engine.language); - GLib.stdout.printf ("layout = %s\n", engine.layout); - GLib.stdout.printf ("license = %s\n", engine.license); - GLib.stdout.printf ("longname = %s\n", engine.longname); - GLib.stdout.printf ("name = %s\n", engine.name); - GLib.stdout.printf ("rank = %u\n", engine.rank); - GLib.stdout.printf ("setup = %s\n", engine.setup); - GLib.stdout.printf ("symbol = %s\n", engine.symbol); - GLib.stdout.printf ("---\n"); - } + IBus.init (); + var ibus = new IBus.Bus (); + var engines = ibus.list_active_engines (); + var context = IBus.InputContext.get_input_context (ibus.current_input_context (), ibus.get_connection ()); + + ibus.connected.connect (() => { + GLib.stdout.printf ("connected\n"); + }); + ibus.disconnected.connect (() => { + GLib.stdout.printf ("disconnected\n"); + }); + ibus.global_engine_changed.connect ((name) => { + GLib.stdout.printf ("global engine changed %s\n", name); + }); + ibus.name_owner_changed.connect ((name, old_owner, new_owner) => { + GLib.stdout.printf ("name owner changed %s %s %s\n", name, old_owner, new_owner); + }); + + GLib.stdout.printf ("%p\n", context); + GLib.stdout.printf ("%d\n", (int) context.is_enabled ()); + GLib.stdout.printf ("%p\n", context.get_engine ()); + + context.set_engine ("emoji-table"); + + var configuration = Gkbd.Configuration.get (); + + foreach (var group in configuration.get_group_names ()) + GLib.stdout.printf ("%s\n", group); + + GLib.stdout.printf ("----------\n"); + GLib.stdout.printf ("current group = %u\n", configuration.get_current_group ()); foreach (var engine in engines) { - section.append (@"$(engine.language) - $(engine.name)", null); + section.append (@"$(engine.language) - $(engine.longname)", null); } submenu.append_section (null, section); |