Blob Blame History Raw
From e0463ae479a2d40b8f036ac81133585d2edd6e89 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Mon, 4 Jul 2011 18:42:43 +0900
Subject: [PATCH] Supply hotkeys and icon_symbol in engine desc.

---
 configure.ac         |    4 +++
 m4/.gitignore        |    1 +
 m4/ibus.m4           |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/hangul.xml.in.in |    2 +
 4 files changed, 58 insertions(+), 0 deletions(-)
 create mode 100644 m4/ibus.m4

diff --git a/configure.ac b/configure.ac
index 043e150..edf19d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,10 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.17])
 
+# hotkeys and icon-symbol properties in component xml
+IBUS_WITH_HOTKEYS([Control+space,Hangul])
+IBUS_ICON_SYMBOL([&xD55C;])
+
 
 # OUTPUT files
 AC_CONFIG_FILES([ po/Makefile.in
diff --git a/m4/.gitignore b/m4/.gitignore
index 0f4126c..aa522fb 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -1 +1,2 @@
 *.m4
+!ibus.m4
diff --git a/m4/ibus.m4 b/m4/ibus.m4
new file mode 100644
index 0000000..b92d000
--- /dev/null
+++ b/m4/ibus.m4
@@ -0,0 +1,51 @@
+# IBUS_WITH_HOTKEYS([DEFAULT])
+AC_DEFUN([IBUS_WITH_HOTKEYS], [
+  HOTKEYS_DEFAULT=m4_default([$1], [Control+space,Zenkaku_Hankaku])
+  AC_ARG_WITH(hotkeys,
+    [AC_HELP_STRING([--with-hotkeys=HOTKEYS],
+    [Use hotkeys for ibus bridge mode. (available value: yes/no/keys)])],
+    [with_hotkeys="$withval"],
+    [with_hotkeys="no"])
+  if test x$with_hotkeys = xno; then
+    HOTKEYS_XML="<!-- <hotkeys>${HOTKEYS_DEFAULT}</hotkeys> -->"
+  elif test x$with_hotkeys = xyes -o x$with_hotkeys = x; then
+    HOTKEYS="$HOTKEYS_DEFAULT"
+    HOTKEYS_XML="<hotkeys>${HOTKEYS}</hotkeys>"
+  else
+    HOTKEYS="$with_hotkeys"
+    HOTKEYS_XML="<hotkeys>${HOTKEYS}</hotkeys>"
+  fi
+  if test x$HOTKEYS != x; then
+    AC_DEFINE_UNQUOTED(IBUS_HOTKEYS, ["$HOTKEYS"],
+      [IME specific hotkeys for IBus])
+    AC_SUBST(HOTKEYS)
+  fi
+  AC_SUBST(HOTKEYS_XML)
+])
+
+# IBUS_ICON_SYMBOL(SYMBOL)
+AC_DEFUN([IBUS_ICON_SYMBOL], [
+  ICON_SYMBOL="$1"
+  if test x$PYTHON = x; then
+    AM_PATH_PYTHON([2.5])
+  fi
+  AC_MSG_CHECKING([if ibus supports icon symbol])
+  $PYTHON <<_ICON_SYMBOL_TEST
+import ibus
+engine = ibus.EngineDesc('test')
+exit(not hasattr(engine, 'icon_symbol'))
+_ICON_SYMBOL_TEST
+  if test $? -eq 0; then
+    ICON_SYMBOL_XML="<icon_symbol>${icon_symbol}</icon_symbol>"
+    AC_MSG_RESULT([yes])
+  else
+    ICON_SYMBOL_XML="<!-- <icon_symbol>${icon_symbol}</icon_symbol> -->"
+    ICON_SYMBOL=
+    AC_MSG_RESULT([no])
+  fi
+  if test x$ICON_SYMBOL != x; then
+    AC_DEFINE_UNQUOTED([IBUS[]_ICON_SYMBOL], ["$ICON_SYMBOL"],
+      [Icon symbol string for IBus])
+  fi
+  AC_SUBST(ICON_SYMBOL_XML)
+])
diff --git a/src/hangul.xml.in.in b/src/hangul.xml.in.in
index a87df59..00ba331 100644
--- a/src/hangul.xml.in.in
+++ b/src/hangul.xml.in.in
@@ -21,6 +21,8 @@
 			<longname>Korean</longname>
 			<description>Korean Input Method</description>
 			<rank>99</rank>
+			@HOTKEYS_XML@
+			@ICON_SYMBOL_XML@
 		</engine>
 	</engines>
 
-- 
1.7.6