diff options
author | Sebastian Reichel <sre@ring0.de> | 2013-03-27 14:50:06 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2013-03-27 14:50:06 +0100 |
commit | 062729a367beeac7d813a4e6fa67b38690bf4d4b (patch) | |
tree | 963eb0f84f0c6f41c1e338a5f6ffb54fb5b20a4a | |
parent | d6bdcc8895e38e8b4a61dd6e550103bce44e71b3 (diff) | |
download | serial-barcode-scanner-062729a367beeac7d813a4e6fa67b38690bf4d4b.tar.bz2 |
display messages from scanner session
-rw-r--r-- | src/curses-ui/Makefile | 2 | ||||
-rw-r--r-- | src/curses-ui/main.vala | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/curses-ui/Makefile b/src/curses-ui/Makefile index 5d168ba..37aacc6 100644 --- a/src/curses-ui/Makefile +++ b/src/curses-ui/Makefile @@ -1,6 +1,6 @@ all: curses-ui -curses-ui: clock.vala curses-ui.vala dialog.vala logo.vala main.vala message_box.vala numbers.vala status.vala ../audio/audio-interface.vala +curses-ui: clock.vala curses-ui.vala dialog.vala logo.vala main.vala message_box.vala numbers.vala status.vala ../audio/audio-interface.vala ../scanner-session/scannersession-interface.vala valac -o $@ --pkg curses -X -lncursesw --pkg posix --pkg gio-2.0 $^ clean: diff --git a/src/curses-ui/main.vala b/src/curses-ui/main.vala index b70ecbc..00ca9fb 100644 --- a/src/curses-ui/main.vala +++ b/src/curses-ui/main.vala @@ -15,6 +15,8 @@ public MainLoop loop; public AudioPlayer audio; +public ScannerSession scanner; +public CursesUI ui; private static void play(string file) { try { @@ -22,6 +24,10 @@ private static void play(string file) { } catch(IOError e) { } } +public void msg_handler(MessageType type, string message) { + ui.log(message); +} + public static int main(string[] args) { /* handle unix signals */ @@ -30,11 +36,14 @@ public static int main(string[] args) { try { audio = Bus.get_proxy_sync(BusType.SESSION, "io.mainframe.shopsystem.AudioPlayer", "/io/mainframe/shopsystem/audio"); + scanner = Bus.get_proxy_sync(BusType.SESSION, "io.mainframe.shopsystem.ScannerSession", "/io/mainframe/shopsystem/scanner_session"); } catch(IOError e) { error("IOError: %s\n", e.message); } - var ui = new CursesUI(); + ui = new CursesUI(); + + scanner.msg.connect(msg_handler); ui.log("KtT Shop System has been started"); play("startup.ogg"); |