[caribou: 17/22] Added executable and DBus service file for Antler.



commit 18e6f7f81a8923570cd84084653df95421e053ce
Author: Eitan Isaacson <eitan monotonous org>
Date:   Fri Apr 29 15:46:59 2011 -0700

    Added executable and DBus service file for Antler.

 .gitignore                               |    3 ++-
 bin/Makefile.am                          |    1 +
 bin/antler-keyboard.in                   |   18 ++++++++++++++++++
 caribou/daemon/main.py                   |    1 +
 configure.ac                             |    1 +
 data/Makefile.am                         |    7 +++++++
 data/org.gnome.Caribou.Antler.service.in |    3 +++
 7 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index de388bc..2e70547 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ autom4te.cache
 *.make
 bin/caribou
 bin/caribou-preferences
+bin/antler-keyboard
 install-sh
 missing
 py-compile
@@ -44,4 +45,4 @@ caribou-1.0.vapi
 caribou-internals-1.0.vapi
 caribou-internals.h
 *.stamp
-
+data/org.gnome.Caribou.Antler.service
diff --git a/bin/Makefile.am b/bin/Makefile.am
index e7797ec..88f281d 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,4 +1,5 @@
 bin_SCRIPTS = caribou caribou-preferences
+libexec_SCRIPTS = antler-keyboard
 
 CLEANFILES = $(bin_SCRIPTS)
 
diff --git a/bin/antler-keyboard.in b/bin/antler-keyboard.in
new file mode 100644
index 0000000..85d88ec
--- /dev/null
+++ b/bin/antler-keyboard.in
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import sys, os
+import traceback
+
+libs = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@', 'site-packages')
+
+# This might be run from the build dir.
+_dirname = os.path.dirname(__file__)
+if _dirname != "@prefix@/libexec":
+    libs = os.path.normpath(os.path.join(_dirname, '..'))
+
+sys.path.insert(1, libs)
+
+from caribou.antler.main import AntlerKeyboardService
+
+antler_keyboard_service = AntlerKeyboardService()
+antler_keyboard_service.run()
diff --git a/caribou/daemon/main.py b/caribou/daemon/main.py
index b9df5cf..1798592 100644
--- a/caribou/daemon/main.py
+++ b/caribou/daemon/main.py
@@ -17,6 +17,7 @@ class CaribouDaemon:
             dbus_obj = bus.get_object("org.gnome.Caribou.%s" % keyboard_name,
                                       "/org/gnome/Caribou/%s" % keyboard_name)
         except dbus.DBusException:
+            raise
             print "%s is not running, and is not provided by any .service file" % \
                 keyboard_name
             return
diff --git a/configure.ac b/configure.ac
index f1d0895..f8f5783 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,7 @@ caribou/daemon/Makefile
 bin/Makefile
 bin/caribou
 bin/caribou-preferences
+bin/antler-keyboard
 data/Makefile
 data/layouts/Makefile
 data/layouts/touch/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 745443b..11e2611 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -13,6 +13,13 @@ autostartdir	 = $(sysconfdir)/xdg/autostart
 autostart_in_files = caribou-autostart.desktop.in
 autostart_DATA   = $(autostart_in_files:.desktop.in=.desktop)
 
+servicefiledir = $(datadir)/dbus-1/services
+servicefile_in_files = org.gnome.Caribou.Antler.service.in
+servicefile_DATA = $(servicefile_in_files:.service.in=.service)
+
+org.gnome.Caribou.Antler.service: org.gnome.Caribou.Antler.service.in
+	$(AM_V_GEN)sed -e "s|[ ]libexecdir[@]|$(libexecdir)|" $< > $@
+
 @INTLTOOL_DESKTOP_RULE@
 
 EXTRA_DIST = $(desktop_in_files) $(autostart_in_files)
diff --git a/data/org.gnome.Caribou.Antler.service.in b/data/org.gnome.Caribou.Antler.service.in
new file mode 100644
index 0000000..fd85a4e
--- /dev/null
+++ b/data/org.gnome.Caribou.Antler.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Caribou.Antler
+Exec= libexecdir@/antler-keyboard



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]