Update to 1.3.3-11.

This commit is contained in:
Daiki Ueno 2012-03-30 18:05:56 +09:00
parent 0d0a00da59
commit 0539517109
11 changed files with 3267 additions and 2635 deletions

2860
ibus-m17n-HEAD.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
From 4a2f3279fb4fbeb8be66ff7bf40cce57e616d45b Mon Sep 17 00:00:00 2001
From 5978feeb0d96d633417318daf29c3d4974e17b2d Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Tue, 25 Oct 2011 14:26:41 +0900
Subject: [PATCH] Blacklist some engines useless under ibus environment.
Subject: [PATCH 3/4] Blacklist some engines useless under ibus environment.
---
src/default.xml.in.in | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
src/default.xml.in.in | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
Index: ibus-m17n-1.3.3/src/default.xml.in.in
===================================================================
--- ibus-m17n-1.3.3.orig/src/default.xml.in.in
+++ ibus-m17n-1.3.3/src/default.xml.in.in
@@ -14,6 +14,38 @@
@IBUS_HOTKEYS_XML@
<virtual-keyboard>us</virtual-keyboard>
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index beae494..fda4f30 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -12,6 +12,32 @@
<preedit-highlight>FALSE</preedit-highlight>
<symbol></symbol>
</engine>
+ <!-- Blacklist some engines -->
+ <!-- kbd engines are duplicate of xkb engines -->
@ -21,12 +21,6 @@ Index: ibus-m17n-1.3.3/src/default.xml.in.in
+ <name>m17n:*:kbd</name>
+ <rank>-1</rank>
+ </engine>
+ <!-- zh:pinyin is considered as a toy, since it does not
+ support Han characters -->
+ <engine>
+ <name>m17n:zh:pinyin</name>
+ <rank>-1</rank>
+ </engine>
+ <!-- zh:py is superseded by ibus-pinyin etc -->
+ <engine>
+ <name>m17n:zh:py</name>
@ -50,3 +44,6 @@ Index: ibus-m17n-1.3.3/src/default.xml.in.in
<!-- Indic engines should be selected by default:
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
<engine>
--
1.7.7.6

View File

@ -1,49 +0,0 @@
From b4e843c27e9d357e915dbe29806f5b33011b4e78 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Tue, 6 Dec 2011 16:15:40 +0900
Subject: [PATCH] Supply custom setup element in EngineDesc (RHBZ#760427).
---
src/m17nutil.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 72fb63d..381e27b 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -119,6 +119,7 @@ ibus_m17n_engine_new (MSymbol lang,
gchar *engine_title;
gchar *engine_icon;
gchar *engine_desc;
+ gchar *engine_setup;
engine_name = g_strdup_printf ("m17n:%s:%s", msymbol_name (lang), msymbol_name (name));
@@ -126,6 +127,8 @@ ibus_m17n_engine_new (MSymbol lang,
engine_title = ibus_m17n_mtext_to_utf8 (title);
engine_icon = ibus_m17n_mtext_to_utf8 (icon);
engine_desc = ibus_m17n_mtext_to_utf8 (desc);
+ engine_setup = g_strdup_printf ("%s/ibus-setup-m17n --name %s",
+ LIBEXECDIR, engine_name);
#if IBUS_CHECK_VERSION(1,3,99)
engine = ibus_engine_desc_new_varargs ("name", engine_name,
@@ -138,6 +141,7 @@ ibus_m17n_engine_new (MSymbol lang,
"rank", config->rank,
"hotkeys", config->hotkeys ? config->hotkeys : "",
"symbol", config->symbol ? config->symbol : "",
+ "setup", engine_setup,
NULL);
#else
engine = ibus_engine_desc_new (engine_name,
@@ -156,6 +160,7 @@ ibus_m17n_engine_new (MSymbol lang,
g_free (engine_title);
g_free (engine_icon);
g_free (engine_desc);
+ g_free (engine_setup);
return engine;
}
--
1.7.7.3

View File

@ -1,621 +0,0 @@
From e37bcc53f1d145e10974fb0bb91802d735921fcd Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 31 Aug 2011 11:44:46 +0900
Subject: [PATCH 1/6] Update the format of default.xml to allow override.
This patch allows value inheritance from the previous matches.
With the new format:
<engines>
<engine>
<name>*</name>
<rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ja:*</name>
<rank>2</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:ja:anthy</name>
<rank>1</rank>
</engine>
</engines>
We will get preedit-highlight == TRUE and rank == 1 for m17n:ja:anthy.
---
src/Makefile.am | 3 +-
src/default.xml.in.in | 221 +++++++++++++++++++------------------------------
src/engine.c | 2 +
src/m17nutil.c | 68 +++++++---------
src/m17nutil.h | 1 +
src/test.c | 66 +++++++++++++++
6 files changed, 186 insertions(+), 175 deletions(-)
create mode 100644 src/test.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 282128a..e354149 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,11 +40,10 @@ TESTS = \
test_m17n_SOURCES = \
- m17nutil.c \
+ test.c \
$(NULL)
test_m17n_CFLAGS = \
$(AM_CFLAGS) \
- -DDEBUG \
$(NULL)
test_m17n_LDADD = \
libm17ncommon.a \
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index 5c5d67d..dc93fd3 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -1,246 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<engines>
<!-- This file defines the default config value for each
- engine. The "engine" elements below are checked in
- first-to-last order and a "name" element in an "engine"
- element allows wildcard patterns. Please keep more
- specific entries to appear first. -->
- <!-- Indic engines which represent languages. -->
+ engine. A "name" element in an "engine" element allows
+ wildcard patterns. "engine" elements are evaluated in
+ first-to-last order and the latter match may override the
+ existing default. -->
+ <!-- Default for other engines. -->
+ <engine>
+ <name>m17n:*</name>
+ <rank>0</rank>
+ <preedit-highlight>FALSE</preedit-highlight>
+ </engine>
+ <!-- Indic engines should be selected by default:
+ https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
+ <engine>
+ <name>m17n:as:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:bn:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:gu:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:hi:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:kn:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ks:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:mai:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ml:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:mr:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ne:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:or:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:pa:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:sa:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:sd:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:si:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:ta:*</name>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>m17n:te:*</name>
+ <rank>1</rank>
+ </engine>
+ <!-- Assign higher rank to Indic engines which represent each
+ language. -->
<engine>
<name>m17n:as:phonetic</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:bn:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:gu:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:hi:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:kn:kgp</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ks:kbd</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:mai:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ml:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:mr:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ne:rom</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:or:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:pa:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:sa:harvard-kyoto</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:sd:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:si:wijesekera</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:ta:tamil99</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
<engine>
<name>m17n:te:inscript</name>
<rank>2</rank>
- <preedit-highlight>FALSE</preedit-highlight>
</engine>
- <!-- Samanala should have lower rank than other Sinhala
- engines since it is the only non-keyboard input method in
- Sinhala. -->
+ <!-- Assign lower rank to Sinhala Samanala since it is a
+ non-keyboard input method in Sinhala. -->
<engine>
<name>m17n:si:samanala</name>
<rank>0</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <!-- Chinese and Japanese engines which require preedit decoration. -->
- <engine>
- <name>m17n:ja:anthy</name>
- <rank>0</rank>
- <preedit-highlight>TRUE</preedit-highlight>
</engine>
+ <!-- Some CJK engines use preedit. -->
<engine>
<name>m17n:zh:cangjie</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:py-b5</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:py-gb</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:py</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:quick</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:tonepy-b5</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:tonepy-gb</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
<name>m17n:zh:tonepy</name>
- <rank>0</rank>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
<engine>
- <name>m17n:zh:util</name>
- <rank>0</rank>
+ <name>m17n:ja:anthy</name>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
- <!-- Other Indic engines should be selected by default:
- https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
- <engine>
- <name>m17n:as:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:bn:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:gu:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:hi:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:kn:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ks:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:mai:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ml:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:mr:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ne:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:or:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:pa:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:sa:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:sd:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:si:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:ta:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <engine>
- <name>m17n:te:*</name>
- <rank>1</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
- <!-- Default for other engines. -->
- <engine>
- <name>m17n:*</name>
- <rank>0</rank>
- <preedit-highlight>FALSE</preedit-highlight>
- </engine>
</engines>
diff --git a/src/engine.c b/src/engine.c
index cfb853c..dcff0c7 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -290,6 +290,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
&klass->lookup_table_orientation))
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
+ ibus_m17n_engine_config_free (engine_config);
+
g_signal_connect (config, "value-changed",
G_CALLBACK(ibus_m17n_config_value_changed),
klass);
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 42aa8f6..b06f71d 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -13,12 +13,18 @@ static MConverter *utf8_converter = NULL;
#define DEFAULT_XML (SETUPDIR "/default.xml")
-struct _IBusM17NEngineConfigNode {
+typedef enum {
+ ENGINE_CONFIG_RANK_MASK = 1 << 0,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
+} EngineConfigMask;
+
+struct _EngineConfigNode {
gchar *name;
+ EngineConfigMask mask;
IBusM17NEngineConfig config;
};
-typedef struct _IBusM17NEngineConfigNode IBusM17NEngineConfigNode;
+typedef struct _EngineConfigNode EngineConfigNode;
static GSList *config_list = NULL;
@@ -257,20 +263,31 @@ ibus_m17n_list_engines (void)
IBusM17NEngineConfig *
ibus_m17n_get_engine_config (const gchar *engine_name)
{
+ IBusM17NEngineConfig *config = g_slice_new0 (IBusM17NEngineConfig);
GSList *p;
for (p = config_list; p != NULL; p = p->next) {
- IBusM17NEngineConfigNode *cnode = p->data;
+ EngineConfigNode *cnode = p->data;
- if (g_pattern_match_simple (cnode->name, engine_name))
- return &cnode->config;
+ if (g_pattern_match_simple (cnode->name, engine_name)) {
+ if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
+ config->rank = cnode->config.rank;
+ if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
+ config->preedit_highlight = cnode->config.preedit_highlight;
+ }
}
- g_return_val_if_reached (NULL);
+ return config;
+}
+
+void
+ibus_m17n_engine_config_free (IBusM17NEngineConfig *config)
+{
+ g_slice_free (IBusM17NEngineConfig, config);
}
static gboolean
-ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
- XMLNode *node)
+ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
+ XMLNode *node)
{
GList *p;
@@ -284,6 +301,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
}
if (g_strcmp0 (sub_node->name , "rank") == 0) {
cnode->config.rank = atoi (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_RANK_MASK;
continue;
}
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
@@ -292,6 +310,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
else if (g_ascii_strcasecmp ("FALSE", sub_node->text) != 0)
g_warning ("<%s> element contains invalid boolean value %s",
sub_node->name, sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK;
continue;
}
g_warning ("<engine> element contains invalid element <%s>",
@@ -320,7 +339,7 @@ ibus_m17n_get_component (void)
if (node && g_strcmp0 (node->name, "engines") == 0) {
for (p = node->sub_nodes; p != NULL; p = p->next) {
XMLNode *sub_node = p->data;
- IBusM17NEngineConfigNode *cnode;
+ EngineConfigNode *cnode;
if (g_strcmp0 (sub_node->name, "engine") != 0) {
g_warning ("<engines> element contains invalid element <%s>",
@@ -328,9 +347,9 @@ ibus_m17n_get_component (void)
continue;
}
- cnode = g_slice_new0 (IBusM17NEngineConfigNode);
+ cnode = g_slice_new0 (EngineConfigNode);
if (!ibus_m17n_engine_config_parse_xml_node (cnode, sub_node)) {
- g_slice_free (IBusM17NEngineConfigNode, cnode);
+ g_slice_free (EngineConfigNode, cnode);
continue;
}
config_list = g_slist_prepend (config_list, cnode);
@@ -448,30 +467,3 @@ ibus_m17n_config_get_int (IBusConfig *config,
return FALSE;
#endif /* !IBUS_CHECK_VERSION(1,3,99) */
}
-
-#ifdef DEBUG
-#include <locale.h>
-
-int main ()
-{
- IBusComponent *component;
- GString *output;
-
- setlocale (LC_ALL, "");
- ibus_init ();
- ibus_m17n_init_common ();
-
- component = ibus_m17n_get_component ();
-
- output = g_string_new ("");
-
- ibus_component_output (component, output, 1);
-
- g_debug ("\n%s", output->str);
-
- g_string_free (output, TRUE);
- g_object_unref (component);
-
- return 0;
-}
-#endif
diff --git a/src/m17nutil.h b/src/m17nutil.h
index f083194..313e7bc 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -30,6 +30,7 @@ gunichar *ibus_m17n_mtext_to_ucs4 (MText *text,
guint ibus_m17n_parse_color (const gchar *hex);
IBusM17NEngineConfig
*ibus_m17n_get_engine_config (const gchar *engine_name);
+void ibus_m17n_engine_config_free (IBusM17NEngineConfig *config);
void ibus_m17n_config_set_string (IBusConfig *config,
const gchar *section,
const gchar *name,
diff --git a/src/test.c b/src/test.c
new file mode 100644
index 0000000..0908818
--- /dev/null
+++ b/src/test.c
@@ -0,0 +1,66 @@
+/* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ibus.h>
+#include <locale.h>
+#include "m17nutil.h"
+
+static void
+test_output_component (void)
+{
+ IBusComponent *component;
+ GString *output;
+
+ component = ibus_m17n_get_component ();
+
+ output = g_string_new ("");
+
+ ibus_component_output (component, output, 1);
+
+ g_debug ("\n%s", output->str);
+
+ g_string_free (output, TRUE);
+ g_object_unref (component);
+}
+
+static void
+test_engine_config (void)
+{
+ IBusM17NEngineConfig *config;
+
+ config = ibus_m17n_get_engine_config ("m17n:non:exsistent");
+ g_assert_cmpint (config->rank, ==, 0);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:wijesekera");
+ g_assert_cmpint (config->rank, ==, 2);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:phonetic-dynamic");
+ g_assert_cmpint (config->rank, ==, 1);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+
+ config = ibus_m17n_get_engine_config ("m17n:si:samanala");
+ g_assert_cmpint (config->rank, ==, 0);
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
+ ibus_m17n_engine_config_free (config);
+}
+
+int main (int argc, char **argv)
+{
+ setlocale (LC_ALL, "");
+ ibus_init ();
+ ibus_m17n_init_common ();
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/test-m17n/output-component", test_output_component);
+ g_test_add_func ("/test-m17n/engine-config", test_engine_config);
+
+ return g_test_run ();
+}
--
1.7.6.2

View File

@ -1,25 +1,25 @@
From d4a1cb9c6bd852da73ba6520fc5c14edbe84ec14 Mon Sep 17 00:00:00 2001
From 02022c17212357afb5cec727edd8f095aa40d98d Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Thu, 29 Sep 2011 10:17:28 +0900
Subject: [PATCH] Hide status from the panel if status == title.
Subject: [PATCH 2/4] Hide status from the panel if status == title.
---
src/engine.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/engine.c b/src/engine.c
index f23d982..a0dcc70 100644
index 4c7411c..efbce66 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -43,6 +43,7 @@ struct _IBusM17NEngineClass {
gboolean virtual_keyboard_enabled;
gboolean use_iok;
@@ -35,6 +35,7 @@ struct _IBusM17NEngineClass {
gint preedit_underline;
gint lookup_table_orientation;
+ gchar *title;
MInputMethod *im;
};
@@ -256,6 +257,10 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
@@ -244,6 +245,10 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
}
engine_name = g_strdup_printf ("m17n:%s:%s", lang, name);
klass->config_section = g_strdup_printf ("engine/M17N/%s/%s", lang, name);
@ -27,10 +27,10 @@ index f23d982..a0dcc70 100644
+ if (l && mplist_key (l) == Mtext) {
+ klass->title = ibus_m17n_mtext_to_utf8 (mplist_value (l));
+ }
/* whether to use iok - maybe good to move this to default.xml */
klass->use_iok = g_strcmp0 (name, "inscript") == 0 ||
g_strcmp0 (name, "inscript2") == 0;
@@ -994,8 +999,9 @@ ibus_m17n_engine_callback (MInputContext *context,
g_free (lang);
g_free (name);
@@ -895,8 +900,9 @@ ibus_m17n_engine_callback (MInputContext *context,
else if (command == Minput_status_draw) {
gchar *status;
status = ibus_m17n_mtext_to_utf8 (m17n->context->status);
@ -42,5 +42,5 @@ index f23d982..a0dcc70 100644
text = ibus_text_new_from_string (status);
ibus_property_set_label (m17n->status_prop, text);
--
1.7.6.4
1.7.7.6

View File

@ -1,102 +0,0 @@
From 07ff49d4718bd468fb260bf31922b1df2d6cfa70 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Fri, 2 Sep 2011 11:27:02 +0900
Subject: [PATCH 6/6] Apply iok patch from fedora.
---
src/engine.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/engine.c b/src/engine.c
index 1e6bd1b..f23d982 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -26,6 +26,7 @@ struct _IBusM17NEngine {
IBusProperty *setup_prop;
#endif /* HAVE_SETUP */
IBusProperty *virtkbd_prop;
+ IBusProperty *show_iok_prop;
IBusPropList *prop_list;
};
@@ -40,6 +41,7 @@ struct _IBusM17NEngineClass {
gint lookup_table_orientation;
gchar *virtual_keyboard;
gboolean virtual_keyboard_enabled;
+ gboolean use_iok;
MInputMethod *im;
};
@@ -254,6 +256,9 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
}
engine_name = g_strdup_printf ("m17n:%s:%s", lang, name);
klass->config_section = g_strdup_printf ("engine/M17N/%s/%s", lang, name);
+ /* whether to use iok - maybe good to move this to default.xml */
+ klass->use_iok = g_strcmp0 (name, "inscript") == 0 ||
+ g_strcmp0 (name, "inscript2") == 0;
g_free (lang);
g_free (name);
@@ -412,6 +417,22 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
klass->virtual_keyboard != NULL)
ibus_property_set_visible (m17n->virtkbd_prop, TRUE);
+ label = ibus_text_new_from_string ("iok");
+ m17n->show_iok_prop = ibus_property_new ("iok",
+ PROP_TYPE_NORMAL,
+ label,
+ "/usr/share/pixmaps/iok.xpm",
+ label,
+ TRUE,
+ FALSE,
+ 0,
+ NULL);
+ g_object_ref_sink (m17n->show_iok_prop);
+ ibus_prop_list_append (m17n->prop_list, m17n->show_iok_prop);
+
+ if (klass->use_iok && !klass->virtual_keyboard_enabled)
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
+
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
g_object_ref_sink (m17n->table);
m17n->context = NULL;
@@ -502,6 +523,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
m17n->virtkbd_prop = NULL;
}
+ if (m17n->show_iok_prop) {
+ g_object_unref (m17n->show_iok_prop);
+ m17n->show_iok_prop = NULL;
+ }
+
if (m17n->table) {
g_object_unref (m17n->table);
m17n->table = NULL;
@@ -842,6 +868,24 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
}
#endif /* HAVE_EEKBOARD */
+ if (g_strcmp0 (prop_name, "iok") == 0) {
+ const gchar *engine_name;
+ gchar *lang = NULL, *name = NULL;
+
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
+ gchar *iok;
+
+ iok = g_strdup_printf ("/usr/bin/iok -n %s", lang);
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d",
+ engine_name, prop_name, prop_state);
+ g_spawn_command_line_async(iok, NULL);
+ g_free (iok);
+ }
+ g_free (lang);
+ g_free (name);
+ }
+
parent_class->property_activate (engine, prop_name, prop_state);
}
--
1.7.6.2

View File

@ -1,843 +0,0 @@
From bd48b1f5c71ab849e1d2c78fd069a92d37426dc3 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Thu, 1 Sep 2011 18:48:41 +0900
Subject: [PATCH 2/6] Refactor setup.c.
---
src/ibus-m17n-preferences.ui | 3 +-
src/setup.c | 663 +++++++++++++++++++++++-------------------
2 files changed, 362 insertions(+), 304 deletions(-)
diff --git a/src/ibus-m17n-preferences.ui b/src/ibus-m17n-preferences.ui
index 6f6ace7..a46ab49 100644
--- a/src/ibus-m17n-preferences.ui
+++ b/src/ibus-m17n-preferences.ui
@@ -263,9 +263,10 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
- <object class="GtkTreeView" id="treeviewMimConfig">
+ <object class="GtkTreeView" id="treeview_mim_config">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
<property name="enable_grid_lines">both</property>
</object>
</child>
diff --git a/src/setup.c b/src/setup.c
index aba0e92..30386df 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -17,19 +17,24 @@ enum {
NUM_COLS
};
-struct _ConfigContext {
- IBusConfig *config;
- MSymbol language;
- MSymbol name;
- GtkListStore *store;
- gchar *section;
+struct _SetupDialog {
+ GtkWidget *dialog;
+ GtkWidget *combobox_underline;
+ GtkWidget *combobox_orientation;
+ GtkWidget *checkbutton_foreground;
GtkWidget *colorbutton_foreground;
+ GtkWidget *checkbutton_background;
GtkWidget *colorbutton_background;
+ GtkWidget *treeview;
+ GtkListStore *store;
-};
-typedef struct _ConfigContext ConfigContext;
+ gchar *lang;
+ gchar *name;
-static IBusConfig *config = NULL;
+ IBusConfig *config;
+ gchar *section;
+};
+typedef struct _SetupDialog SetupDialog;
static gchar *opt_name = NULL;
static const GOptionEntry options[] = {
@@ -38,17 +43,8 @@ static const GOptionEntry options[] = {
{NULL}
};
-void
-ibus_m17n_init (IBusBus *bus)
-{
- config = ibus_bus_get_config (bus);
- if (config)
- g_object_ref_sink (config);
- ibus_m17n_init_common ();
-}
-
static gchar *
-format_value (MPlist *plist)
+format_m17n_value (MPlist *plist)
{
if (mplist_key (plist) == Msymbol)
return g_strdup (msymbol_name ((MSymbol) mplist_value (plist)));
@@ -64,7 +60,7 @@ format_value (MPlist *plist)
}
static MPlist *
-parse_value (MPlist *plist, gchar *text)
+parse_m17n_value (MPlist *plist, gchar *text)
{
MPlist *value;
@@ -100,7 +96,7 @@ parse_value (MPlist *plist, gchar *text)
}
static void
-insert_items (GtkListStore *store, MSymbol language, MSymbol name)
+insert_m17n_items (GtkListStore *store, MSymbol language, MSymbol name)
{
MPlist *plist;
@@ -109,8 +105,8 @@ insert_items (GtkListStore *store, MSymbol language, MSymbol name)
for (; plist && mplist_key (plist) == Mplist; plist = mplist_next (plist)) {
GtkTreeIter iter;
MSymbol key;
- MPlist *p, *value;
- gchar *description;
+ MPlist *p, *mvalue;
+ gchar *description, *value;
p = mplist_value (plist);
key = mplist_value (p); /* name */
@@ -118,15 +114,17 @@ insert_items (GtkListStore *store, MSymbol language, MSymbol name)
p = mplist_next (p); /* description */
description = ibus_m17n_mtext_to_utf8 ((MText *) mplist_value (p));
p = mplist_next (p); /* status */
- value = mplist_next (p);
+ mvalue = mplist_next (p);
+ value = format_m17n_value (mvalue);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COLUMN_KEY, msymbol_name (key),
COLUMN_DESCRIPTION, description,
- COLUMN_VALUE, format_value (value),
+ COLUMN_VALUE, value,
-1);
g_free (description);
+ g_free (value);
}
}
@@ -163,95 +161,238 @@ on_edited (GtkCellRendererText *cell,
gchar *new_text,
gpointer data)
{
- ConfigContext *context = data;
- GtkTreeModel *model = GTK_TREE_MODEL (context->store);
+ SetupDialog *dialog = data;
+ GtkTreeModel *model = GTK_TREE_MODEL (dialog->store);
GtkTreeIter iter;
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
- MPlist *plist, *p, *value;
- gchar *key;
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, COLUMN_KEY, &key, -1);
- plist = minput_get_variable (context->language, context->name,
- msymbol (key));
- if (!plist)
- goto fail;
+ gtk_list_store_set (dialog->store, &iter,
+ COLUMN_VALUE, new_text,
+ -1);
+ gtk_tree_path_free (path);
+}
- p = mplist_next (mplist_next (mplist_next (mplist_value (plist))));
- if (!p)
- goto fail;
+static void
+toggle_colorbutton_sensitive (GtkToggleButton *togglebutton,
+ GtkWidget *colorbutton)
+{
+ if (gtk_toggle_button_get_active (togglebutton))
+ gtk_widget_set_sensitive (colorbutton, TRUE);
+ else
+ gtk_widget_set_sensitive (colorbutton, FALSE);
+}
- value = parse_value (p, new_text);
- if (!value)
- goto fail;
+static void
+on_foreground_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ SetupDialog *dialog = user_data;
+ toggle_colorbutton_sensitive (togglebutton, dialog->colorbutton_foreground);
+}
- if (minput_config_variable (context->language, context->name,
- msymbol (key), value) != 0)
- goto fail;
+static void
+on_background_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ SetupDialog *dialog = user_data;
+ toggle_colorbutton_sensitive (togglebutton, dialog->colorbutton_background);
+}
- if (minput_save_config () != 1)
- goto fail;
+static gint
+get_combo_box_index_by_value (GtkComboBox *combobox, gint value)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint index;
- gtk_list_store_set (context->store, &iter,
- COLUMN_VALUE, new_text,
- -1);
+ index = 0;
+ model = gtk_combo_box_get_model (combobox);
+ if (!gtk_tree_model_get_iter_first (model, &iter))
+ return -1;
- fail:
- gtk_tree_path_free (path);
+ do {
+ gint _value;
+ gtk_tree_model_get (model, &iter, COLUMN_VALUE, &_value, -1);
+ if (_value == value)
+ return index;
+ index++;
+ } while (gtk_tree_model_iter_next (model, &iter));
+ return -1;
}
static void
-color_to_gdk (guint color, GdkColor *color_gdk)
+_gdk_color_from_uint (guint color, GdkColor *color_gdk)
{
- memset (color_gdk, 0, sizeof *color_gdk);
+ color_gdk->pixel = 0;
color_gdk->red = (color >> 8) & 0xFF00;
color_gdk->green = color & 0xFF00;
color_gdk->blue = (color & 0xFF) << 8;
}
static void
-set_color (ConfigContext *context, const gchar *name, GdkColor *color)
+setup_dialog_load_config (SetupDialog *dialog)
{
- gchar buf[8];
+ gchar *color;
+ gboolean bvalue;
+ gint ivalue;
+ GdkColor cvalue;
+ GtkCellRenderer *renderer;
+ gint index;
- if (color)
- sprintf (buf, "#%02X%02X%02X",
- (color->red & 0xFF00) >> 8,
- (color->green & 0xFF00) >> 8,
- (color->blue & 0xFF00) >> 8);
- else
- strcpy (buf, "none");
- ibus_m17n_config_set_string (config, context->section, name, buf);
+ /* General -> Pre-edit Appearance */
+ /* foreground color of pre-edit buffer */
+ bvalue = FALSE;
+ _gdk_color_from_uint (PREEDIT_FOREGROUND, &cvalue);
+ if (ibus_m17n_config_get_string (dialog->config,
+ dialog->section,
+ "preedit_foreground",
+ &color)) {
+ if (g_strcmp0 (color, "none") != 0 && gdk_color_parse (color, &cvalue))
+ bvalue = TRUE;
+ g_free (color);
+ }
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->checkbutton_foreground),
+ bvalue);
+ g_signal_connect (dialog->checkbutton_foreground, "toggled",
+ G_CALLBACK(on_foreground_toggled),
+ dialog);
+ gtk_widget_set_sensitive (dialog->colorbutton_foreground,
+ bvalue);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON(dialog->colorbutton_foreground),
+ &cvalue);
+
+ /* background color of pre-edit buffer */
+ bvalue = FALSE;
+ _gdk_color_from_uint (PREEDIT_BACKGROUND, &cvalue);
+ if (ibus_m17n_config_get_string (dialog->config,
+ dialog->section,
+ "preedit_background",
+ &color)) {
+ if (g_strcmp0 (color, "none") != 0 && gdk_color_parse (color, &cvalue))
+ bvalue = TRUE;
+ g_free (color);
+ }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->checkbutton_background),
+ bvalue);
+ g_signal_connect (dialog->checkbutton_background, "toggled",
+ G_CALLBACK(on_background_toggled),
+ dialog);
+ gtk_widget_set_sensitive (dialog->colorbutton_background,
+ bvalue);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON(dialog->colorbutton_background),
+ &cvalue);
+
+ /* underline of pre-edit buffer */
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(dialog->combobox_underline),
+ renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(dialog->combobox_underline),
+ renderer, "text", 0, NULL);
+ if (!ibus_m17n_config_get_int (dialog->config,
+ dialog->section,
+ "preedit_underline",
+ &ivalue))
+ ivalue = IBUS_ATTR_UNDERLINE_NONE;
+
+ index = get_combo_box_index_by_value
+ (GTK_COMBO_BOX(dialog->combobox_underline),
+ ivalue);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(dialog->combobox_underline),
+ index);
+
+ /* General -> Other */
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(dialog->combobox_orientation),
+ renderer, TRUE);
+ gtk_cell_layout_set_attributes
+ (GTK_CELL_LAYOUT(dialog->combobox_orientation),
+ renderer, "text", 0, NULL);
+ if (!ibus_m17n_config_get_int (dialog->config,
+ dialog->section,
+ "lookup_table_orientation",
+ &ivalue))
+ ivalue = IBUS_ORIENTATION_SYSTEM;
+
+ index = get_combo_box_index_by_value
+ (GTK_COMBO_BOX(dialog->combobox_orientation),
+ ivalue);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(dialog->combobox_orientation),
+ index);
+
+ /* Advanced -> m17n-lib configuration */
+ dialog->store = gtk_list_store_new (NUM_COLS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+ insert_m17n_items (dialog->store,
+ msymbol (dialog->lang),
+ msymbol (dialog->name));
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW(dialog->treeview),
+ GTK_TREE_MODEL (dialog->store));
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes
+ (GTK_TREE_VIEW (dialog->treeview), -1,
+ "Key",
+ renderer,
+ "text", COLUMN_KEY,
+ NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes
+ (GTK_TREE_VIEW (dialog->treeview), -1,
+ "Value",
+ renderer,
+ "text", COLUMN_VALUE,
+ NULL);
+ g_object_set (renderer, "editable", TRUE, NULL);
+ g_signal_connect (renderer, "edited", G_CALLBACK(on_edited), dialog);
+
+ g_signal_connect (dialog->treeview, "query-tooltip",
+ G_CALLBACK(on_query_tooltip), NULL);
}
-static void
-on_foreground_color_set (GtkColorButton *widget,
- gpointer user_data)
+static gchar *
+_gdk_color_to_string (GdkColor *color)
{
- ConfigContext *context = user_data;
- GdkColor color;
-
- gtk_color_button_get_color (GTK_COLOR_BUTTON(widget), &color);
- set_color (context, "preedit_foreground", &color);
+ g_strdup_printf ("#%02X%02X%02X",
+ (color->red & 0xFF00) >> 8,
+ (color->green & 0xFF00) >> 8,
+ (color->blue & 0xFF00) >> 8);
}
static void
-on_background_color_set (GtkColorButton *widget,
- gpointer user_data)
+save_color (SetupDialog *dialog,
+ GtkToggleButton *togglebutton,
+ GtkColorButton *colorbutton,
+ const gchar *name)
{
- ConfigContext *context = user_data;
- GdkColor color;
-
- gtk_color_button_get_color (GTK_COLOR_BUTTON(widget), &color);
- set_color (context, "preedit_background", &color);
+ if (gtk_toggle_button_get_active (togglebutton)) {
+ GdkColor color;
+ gchar *svalue;
+
+ gtk_color_button_get_color (colorbutton, &color);
+ svalue = _gdk_color_to_string (&color);
+ ibus_m17n_config_set_string (dialog->config,
+ dialog->section,
+ name,
+ svalue);
+ g_free (svalue);
+ } else
+ ibus_m17n_config_set_string (dialog->config,
+ dialog->section,
+ name,
+ "none");
}
static void
-on_underline_changed (GtkComboBox *combo,
- gpointer user_data)
+save_choice (SetupDialog *dialog,
+ GtkComboBox *combo,
+ const gchar *name)
{
- ConfigContext *context = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
gint active;
@@ -260,123 +401,164 @@ on_underline_changed (GtkComboBox *combo,
gtk_combo_box_get_active_iter (combo, &iter);
gtk_tree_model_get (model, &iter, COLUMN_VALUE, &active, -1);
- ibus_m17n_config_set_int (config,
- context->section,
- "preedit_underline",
- active);
+ ibus_m17n_config_set_int (dialog->config, dialog->section, name, active);
}
-static void
-on_orientation_changed (GtkComboBox *combo,
- gpointer user_data)
+static gboolean
+save_m17n_options (SetupDialog *dialog)
{
- ConfigContext *context = user_data;
- GtkTreeModel *model;
+ GtkTreeModel *model = GTK_TREE_MODEL (dialog->store);
GtkTreeIter iter;
- gint active;
+ MPlist *plist, *p, *mvalue = NULL;
+ MSymbol lang, name;
+ gchar *key = NULL, *value = NULL;
+ gboolean retval = TRUE;
- model = gtk_combo_box_get_model (combo);
- gtk_combo_box_get_active_iter (combo, &iter);
- gtk_tree_model_get (model, &iter, COLUMN_VALUE, &active, -1);
+ if (!gtk_tree_model_get_iter_first (model, &iter))
+ return;
- ibus_m17n_config_set_int (config,
- context->section,
- "lookup_table_orientation",
- active);
-}
+ lang = msymbol (dialog->lang);
+ name = msymbol (dialog->name);
-static void
-toggle_color (ConfigContext *context,
- GtkToggleButton *togglebutton,
- GtkWidget *colorbutton,
- const gchar *name)
-{
- GdkColor color;
+ do {
+ gtk_tree_model_get (model, &iter,
+ COLUMN_KEY, &key,
+ COLUMN_VALUE, &value,
+ -1);
- if (gtk_toggle_button_get_active (togglebutton)) {
- gtk_widget_set_sensitive (colorbutton, TRUE);
- gtk_color_button_get_color (GTK_COLOR_BUTTON(colorbutton), &color);
- set_color (context, name, &color);
- } else {
- gtk_widget_set_sensitive (colorbutton, FALSE);
- gtk_color_button_get_color (GTK_COLOR_BUTTON(colorbutton), &color);
- set_color (context, name, NULL);
- }
+ plist = minput_get_variable (lang, name, msymbol (key));
+ if (!plist) {
+ retval = FALSE;
+ break;
+ }
+
+ p = mplist_next (mplist_next (mplist_next (mplist_value (plist))));
+ if (!p) {
+ retval = FALSE;
+ break;
+ }
+
+ mvalue = parse_m17n_value (p, value);
+ if (!mvalue) {
+ retval = FALSE;
+ break;
+ }
+
+ if (minput_config_variable (lang, name, msymbol (key), mvalue) != 0) {
+ retval = FALSE;
+ break;
+ }
+
+ if (mvalue)
+ m17n_object_unref (mvalue);
+ g_free (key);
+ g_free (value);
+ mvalue = NULL;
+ key = NULL;
+ value = NULL;
+ } while (gtk_tree_model_iter_next (model, &iter));
+
+ if (retval && minput_save_config () != 1)
+ retval = FALSE;
+
+ if (mvalue)
+ m17n_object_unref (mvalue);
+ g_free (key);
+ g_free (value);
+
+ return retval;
}
static void
-on_foreground_toggled (GtkToggleButton *togglebutton,
- gpointer user_data)
+setup_dialog_save_config (SetupDialog *dialog)
{
- ConfigContext *context = user_data;
-
- toggle_color (context,
- togglebutton,
- context->colorbutton_foreground,
- "preedit_foreground");
+ save_color (dialog,
+ GTK_TOGGLE_BUTTON(dialog->checkbutton_foreground),
+ GTK_COLOR_BUTTON(dialog->colorbutton_foreground),
+ "preedit_foreground");
+ save_color (dialog,
+ GTK_TOGGLE_BUTTON(dialog->checkbutton_background),
+ GTK_COLOR_BUTTON(dialog->colorbutton_background),
+ "preedit_background");
+ save_choice (dialog,
+ GTK_COMBO_BOX(dialog->combobox_underline),
+ "preedit_underline");
+ save_choice (dialog,
+ GTK_COMBO_BOX(dialog->combobox_orientation),
+ "lookup_table_orientation");
+ save_m17n_options (dialog);
}
-static void
-on_background_toggled (GtkToggleButton *togglebutton,
- gpointer user_data)
+static SetupDialog *
+setup_dialog_new (IBusConfig *config,
+ const gchar *lang,
+ const gchar *name)
{
- ConfigContext *context = user_data;
+ GtkBuilder *builder;
+ SetupDialog *dialog;
+ GObject *object;
+ GError *error;
+
+ dialog = g_slice_new0 (SetupDialog);
+ dialog->config = g_object_ref_sink (config);
+ dialog->lang = g_strdup (lang);
+ dialog->name = g_strdup (name);
+ dialog->section = g_strdup_printf ("engine/M17N/%s/%s", lang, name);
+
+ builder = gtk_builder_new ();
+ gtk_builder_set_translation_domain (builder, "ibus-m17n");
+
+ error = NULL;
+ gtk_builder_add_from_file (builder,
+ SETUPDIR "/ibus-m17n-preferences.ui",
+ &error);
+ g_assert_no_error (error);
+
+ object = gtk_builder_get_object (builder, "dialog");
+ dialog->dialog = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "checkbutton_foreground");
+ dialog->checkbutton_foreground = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "colorbutton_foreground");
+ dialog->colorbutton_foreground = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "checkbutton_background");
+ dialog->checkbutton_background = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "colorbutton_background");
+ dialog->colorbutton_background = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "combobox_underline");
+ dialog->combobox_underline = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "combobox_orientation");
+ dialog->combobox_orientation = GTK_WIDGET(object);
+ object = gtk_builder_get_object (builder, "treeview_mim_config");
+ dialog->treeview = GTK_WIDGET(object);
- toggle_color (context,
- togglebutton,
- context->colorbutton_background,
- "preedit_background");
+ return dialog;
}
-static gint
-get_combo_box_index_by_value (GtkComboBox *combobox, gint value)
+static void
+setup_dialog_free (SetupDialog *dialog)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- gint index;
+ gtk_widget_destroy (dialog->dialog);
- index = 0;
- model = gtk_combo_box_get_model (combobox);
- if (!gtk_tree_model_get_iter_first (model, &iter))
- return -1;
+ g_free (dialog->lang);
+ g_free (dialog->name);
- do {
- gint _value;
- gtk_tree_model_get (model, &iter, COLUMN_VALUE, &_value, -1);
- if (_value == value)
- return index;
- index++;
- } while (gtk_tree_model_iter_next (model, &iter));
- return -1;
+ g_free (dialog->section);
+ g_object_unref (dialog->store);
+ g_slice_free (SetupDialog, dialog);
}
static void
start (const gchar *engine_name)
{
IBusBus *bus;
- gchar **strv, *lang, *name;
- GtkBuilder *builder;
- GtkWidget *dialog;
- GtkWidget *combobox_underline, *combobox_orientation;
- GtkWidget *checkbutton_foreground, *checkbutton_background;
- GtkWidget *treeview;
- GtkListStore *store;
+ IBusConfig *config;
+ gchar **strv, *lang, *name, *section;
+ SetupDialog *dialog;
GObject *object;
GError *error = NULL;
- GtkCellRenderer *renderer;
- ConfigContext context;
- gchar *color;
- gboolean is_foreground_set, is_background_set;
- GdkColor foreground, background;
- gint underline;
- gint orientation;
- gint index;
ibus_init ();
-
- bus = ibus_bus_new ();
- //g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL);
- ibus_m17n_init (bus);
+ ibus_m17n_init_common ();
strv = g_strsplit (engine_name, ":", 3);
@@ -386,150 +568,25 @@ start (const gchar *engine_name)
lang = strv[1];
name = strv[2];
- config = ibus_bus_get_config (bus);
- context.section = g_strdup_printf ("engine/M17N/%s/%s", lang, name);
-
- builder = gtk_builder_new ();
- gtk_builder_set_translation_domain (builder, "ibus-m17n");
- gtk_builder_add_from_file (builder,
- SETUPDIR "/ibus-m17n-preferences.ui",
- &error);
- object = gtk_builder_get_object (builder, "dialog");
- dialog = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "checkbutton_foreground");
- checkbutton_foreground = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "colorbutton_foreground");
- context.colorbutton_foreground = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "checkbutton_background");
- checkbutton_background = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "colorbutton_background");
- context.colorbutton_background = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "combobox_underline");
- combobox_underline = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "combobox_orientation");
- combobox_orientation = GTK_WIDGET(object);
- object = gtk_builder_get_object (builder, "treeviewMimConfig");
- treeview = GTK_WIDGET(object);
-
- /* General -> Pre-edit Appearance */
- /* foreground color of pre-edit buffer */
- is_foreground_set = FALSE;
- color_to_gdk (PREEDIT_FOREGROUND, &foreground);
- if (ibus_m17n_config_get_string (config,
- context.section,
- "preedit_foreground",
- &color)) {
- if (g_strcmp0 (color, "none") != 0 &&
- gdk_color_parse (color, &foreground))
- is_foreground_set = TRUE;
- g_free (color);
- }
+ bus = ibus_bus_new ();
+ //g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(checkbutton_foreground),
- is_foreground_set);
- g_signal_connect (checkbutton_foreground, "toggled",
- G_CALLBACK(on_foreground_toggled),
- &context);
- gtk_widget_set_sensitive (context.colorbutton_foreground,
- is_foreground_set);
- gtk_color_button_set_color
- (GTK_COLOR_BUTTON(context.colorbutton_foreground),
- &foreground);
- g_signal_connect (context.colorbutton_foreground, "color-set",
- G_CALLBACK(on_foreground_color_set), &context);
+ config = ibus_bus_get_config (bus);
+ dialog = setup_dialog_new (config, lang, name);
-
- /* background color of pre-edit buffer */
- is_background_set = FALSE;
- color_to_gdk (PREEDIT_BACKGROUND, &background);
- if (ibus_m17n_config_get_string (config,
- context.section,
- "preedit_background",
- &color)) {
- if (g_strcmp0 (color, "none") != 0 &&
- gdk_color_parse (color, &background))
- is_background_set = TRUE;
- g_debug ("preedit_background %d", is_background_set);
- g_free (color);
- }
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(checkbutton_background),
- is_background_set);
- g_signal_connect (checkbutton_background, "toggled",
- G_CALLBACK(on_background_toggled),
- &context);
- gtk_widget_set_sensitive (context.colorbutton_background,
- is_background_set);
- gtk_color_button_set_color
- (GTK_COLOR_BUTTON(context.colorbutton_background),
- &background);
- g_signal_connect (context.colorbutton_background, "color-set",
- G_CALLBACK(on_background_color_set), &context);
+ g_strfreev (strv);
- /* underline of pre-edit buffer */
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(combobox_underline),
- renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(combobox_underline),
- renderer, "text", 0, NULL);
- if (!ibus_m17n_config_get_int (config,
- context.section,
- "preedit_underline",
- &underline))
- underline = IBUS_ATTR_UNDERLINE_NONE;
+ setup_dialog_load_config (dialog);
- index = get_combo_box_index_by_value (GTK_COMBO_BOX(combobox_underline),
- underline);
- gtk_combo_box_set_active (GTK_COMBO_BOX(combobox_underline), index);
- g_signal_connect (combobox_underline, "changed",
- G_CALLBACK(on_underline_changed), &context);
+ gtk_widget_show_all (dialog->dialog);
+ gtk_dialog_run (GTK_DIALOG(dialog->dialog));
- /* General -> Other */
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(combobox_orientation),
- renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(combobox_orientation),
- renderer, "text", 0, NULL);
- if (!ibus_m17n_config_get_int (config,
- context.section,
- "lookup_table_orientation",
- &orientation))
- orientation = IBUS_ORIENTATION_SYSTEM;
-
- index = get_combo_box_index_by_value (GTK_COMBO_BOX(combobox_orientation),
- orientation);
- gtk_combo_box_set_active (GTK_COMBO_BOX(combobox_orientation), index);
- g_signal_connect (combobox_orientation, "changed",
- G_CALLBACK(on_orientation_changed), &context);
+ setup_dialog_save_config (dialog);
+ setup_dialog_free (dialog);
- /* Advanced -> m17n-lib configuration */
- store = gtk_list_store_new (NUM_COLS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING);
- insert_items (store, msymbol (lang), msymbol (name));
-
- gtk_tree_view_set_model (GTK_TREE_VIEW(treeview), GTK_TREE_MODEL (store));
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1,
- "Key",
- gtk_cell_renderer_text_new (),
- "text", COLUMN_KEY, NULL);
- g_object_set (treeview, "has-tooltip", TRUE, NULL);
- g_signal_connect (treeview, "query-tooltip", G_CALLBACK(on_query_tooltip),
- NULL);
-
- context.language = msymbol (lang);
- context.name = msymbol (name);
- context.store = store;
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1,
- "Value",
- renderer,
- "text", COLUMN_VALUE, NULL);
- g_object_set (renderer, "editable", TRUE, NULL);
- g_signal_connect (renderer, "edited", G_CALLBACK(on_edited), &context);
+ g_object_unref (bus);
- gtk_widget_show_all (dialog);
- gtk_dialog_run (GTK_DIALOG(dialog));
+ M17N_FINI ();
}
int
--
1.7.6.2

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
From 0cc2abaab50e6668e525da093ef12ed0277d5c21 Mon Sep 17 00:00:00 2001
From ab9d608fdb6054b4b135f891ad5fa1fa7ce27c7b Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Mon, 8 Aug 2011 09:59:28 +0900
Subject: [PATCH 3/6] Set XKB layout option via default.xml.
Subject: [PATCH 1/4] Set XKB layout option via default.xml.
---
src/default.xml.in.in | 9 +++++++++
@ -10,10 +10,10 @@ Subject: [PATCH 3/6] Set XKB layout option via default.xml.
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index dc93fd3..785ab05 100644
index 9f5a01e..beae494 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -157,6 +157,15 @@
@@ -158,6 +158,15 @@
<name>m17n:si:samanala</name>
<rank>0</rank>
</engine>
@ -30,39 +30,39 @@ index dc93fd3..785ab05 100644
<engine>
<name>m17n:zh:cangjie</name>
diff --git a/src/m17nutil.c b/src/m17nutil.c
index b06f71d..201c8b4 100644
index 51026b2..0b46531 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -15,7 +15,8 @@ static MConverter *utf8_converter = NULL;
typedef enum {
@@ -17,7 +17,8 @@ typedef enum {
ENGINE_CONFIG_RANK_MASK = 1 << 0,
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
+ ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 2
ENGINE_CONFIG_SYMBOL_MASK = 1 << 1,
ENGINE_CONFIG_LONGNAME_MASK = 1 << 2,
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 3
+ ENGINE_CONFIG_LAYOUT_MASK = 1 << 3,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4
} EngineConfigMask;
struct _EngineConfigNode {
@@ -130,7 +131,7 @@ ibus_m17n_engine_new (MSymbol lang,
@@ -133,7 +134,7 @@ ibus_m17n_engine_new (MSymbol lang,
"language", msymbol_name (lang),
"license", "GPL",
"icon", engine_icon ? engine_icon : "",
- "layout", "us",
+ "layout", config->layout ? config->layout : "us",
"rank", config->rank,
NULL);
#else
@@ -272,6 +273,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
if (g_pattern_match_simple (cnode->name, engine_name)) {
if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
config->rank = cnode->config.rank;
+ if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
+ config->layout = cnode->config.layout;
"symbol", config->symbol ? config->symbol : "",
"setup", engine_setup,
@@ -275,6 +276,8 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
config->longname = cnode->config.longname;
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
config->preedit_highlight = cnode->config.preedit_highlight;
+ if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
+ config->layout = cnode->config.layout;
}
@@ -304,6 +307,12 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
cnode->mask |= ENGINE_CONFIG_RANK_MASK;
}
return config;
@@ -315,6 +318,12 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
cnode->mask |= ENGINE_CONFIG_LONGNAME_MASK;
continue;
}
+ if (g_strcmp0 (sub_node->name , "layout") == 0) {
@ -75,12 +75,12 @@ index b06f71d..201c8b4 100644
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE;
diff --git a/src/m17nutil.h b/src/m17nutil.h
index 313e7bc..c7b283e 100644
index d790cf8..93faad4 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -14,6 +14,9 @@ struct _IBusM17NEngineConfig {
/* engine rank */
gint rank;
@@ -20,6 +20,9 @@ struct _IBusM17NEngineConfig {
/* overridding longname shown on panel */
gchar *longname;
+ /* keyboard layout */
+ gchar *layout;
@ -89,5 +89,5 @@ index 313e7bc..c7b283e 100644
gboolean preedit_highlight;
};
--
1.7.6.2
1.7.7.6

View File

@ -1,390 +0,0 @@
From 0f9cea9b0d4c9ce3519a8d1e93977e16e6f2185e Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 31 Aug 2011 11:44:46 +0900
Subject: [PATCH 4/6] Supply hotkeys and symbol in engine desc.
---
configure.ac | 3 +
m4/.gitignore | 2 +
m4/ibus.m4 | 52 ++++++++++++
src/default.xml.in.in | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
src/m17nutil.c | 20 +++++-
src/m17nutil.h | 6 ++
6 files changed, 289 insertions(+), 1 deletions(-)
create mode 100644 m4/ibus.m4
diff --git a/configure.ac b/configure.ac
index 927d382..23102c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.16.1)
+# hotkeys in component xml
+IBUS_WITH_HOTKEYS
+
# OUTPUT files
AC_CONFIG_FILES([ po/Makefile.in
diff --git a/m4/.gitignore b/m4/.gitignore
index 0f4126c..e28d185 100644
#--- a/m4/.gitignore
#+++ b/m4/.gitignore
@@ -1 +1,3 @@
*.m4
+!ibus.m4
+
diff --git a/m4/ibus.m4 b/m4/ibus.m4
new file mode 100644
index 0000000..f8f074a
--- /dev/null
+++ b/m4/ibus.m4
@@ -0,0 +1,52 @@
+# IBUS_WITH_HOTKEYS([DEFAULT])
+AC_DEFUN([IBUS_WITH_HOTKEYS], [
+ IBUS_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
+ IBUS_HOTKEYS_XML="<!-- <hotkeys>${IBUS_HOTKEYS_DEFAULT}</hotkeys> -->"
+ elif test x$with_hotkeys = xyes -o x$with_hotkeys = x; then
+ IBUS_HOTKEYS="$IBUS_HOTKEYS_DEFAULT"
+ IBUS_HOTKEYS_XML="<hotkeys>${IBUS_HOTKEYS}</hotkeys>"
+ else
+ IBUS_HOTKEYS="$with_hotkeys"
+ IBUS_HOTKEYS_XML="<hotkeys>${IBUS_HOTKEYS}</hotkeys>"
+ fi
+ if test x$IBUS_HOTKEYS != x; then
+ AC_DEFINE_UNQUOTED(IBUS_IBUS_HOTKEYS, ["$IBUS_HOTKEYS"],
+ [IME specific hotkeys for IBus])
+ AC_SUBST(IBUS_HOTKEYS)
+ fi
+ AC_SUBST(IBUS_HOTKEYS_XML)
+])
+
+# IBUS_SET_SYMBOL(SYMBOL)
+AC_DEFUN([IBUS_SET_SYMBOL], [
+ IBUS_SYMBOL="$1"
+ if test x$PYTHON = x; then
+ AM_PATH_PYTHON([2.5])
+ fi
+ AC_MSG_CHECKING([if ibus supports icon symbol])
+ $PYTHON <<_IBUS_SYMBOL_TEST
+import ibus
+engine = ibus.EngineDesc('test')
+exit(not hasattr(engine, 'symbol'))
+_IBUS_SYMBOL_TEST
+ if test $? -eq 0; then
+ IBUS_SYMBOL_XML="<symbol>${IBUS_SYMBOL}</symbol>"
+ AC_MSG_RESULT([yes])
+ else
+ IBUS_SYMBOL_XML="<!-- <symbol>${IBUS_SYMBOL}</symbol> -->"
+ IBUS_SYMBOL=
+ AC_MSG_RESULT([no])
+ fi
+ if test x$IBUS_SYMBOL != x; then
+ AC_DEFINE_UNQUOTED([IBUS_SYMBOL], ["$IBUS_SYMBOL"],
+ [Icon symbol string for IBus])
+ AC_SUBST(IBUS_SYMBOL)
+ fi
+ AC_SUBST(IBUS_SYMBOL_XML)
+])
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
index 785ab05..b1c77c5 100644
--- a/src/default.xml.in.in
+++ b/src/default.xml.in.in
@@ -10,6 +10,8 @@
<name>m17n:*</name>
<rank>0</rank>
<preedit-highlight>FALSE</preedit-highlight>
+ <symbol></symbol>
+ @IBUS_HOTKEYS_XML@
</engine>
<!-- Indic engines should be selected by default:
https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
@@ -203,4 +205,209 @@
<name>m17n:ja:anthy</name>
<preedit-highlight>TRUE</preedit-highlight>
</engine>
+ <!-- Set IME symbols. -->
+ <engine>
+ <name>m17n:as:*</name>
+ <symbol>অ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:bn:*</name>
+ <symbol>বা</symbol>
+ </engine>
+ <engine>
+ <name>m17n:gu:*</name>
+ <symbol>ગુ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:hi:*</name>
+ <symbol>हिं</symbol>
+ </engine>
+ <engine>
+ <name>m17n:kn:*</name>
+ <symbol>ಕ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ks:*</name>
+ <symbol>क</symbol>
+ </engine>
+ <engine>
+ <name>m17n:mai:*</name>
+ <symbol>मै</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ml:*</name>
+ <symbol>മ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:mr:*</name>
+ <symbol>म</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ne:*</name>
+ <symbol>ने</symbol>
+ </engine>
+ <engine>
+ <name>m17n:or:*</name>
+ <symbol>ଓ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:pa:*</name>
+ <symbol>ਪੰ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:sa:*</name>
+ <symbol>सं</symbol>
+ </engine>
+ <engine>
+ <name>m17n:sd:*</name>
+ <symbol>सिं</symbol>
+ </engine>
+ <engine>
+ <name>m17n:si:*</name>
+ <symbol>සි</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ta:*</name>
+ <symbol>த</symbol>
+ </engine>
+ <engine>
+ <name>m17n:te:*</name>
+ <symbol>తె</symbol>
+ </engine>
+ <engine>
+ <name>m17n:*:kbd</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:*:pre</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:*:post</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:am:sera</name>
+ <symbol>አ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:bo:*</name>
+ <symbol>ཀ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:cr:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:dv:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:eo:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:fa:*</name>
+ <symbol>ف</symbol>
+ </engine>
+ <engine>
+ <name>m17n:fr:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ii:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:iu:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ja:anthy</name>
+ <symbol>あ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:kk:*</name>
+ <symbol>قا</symbol>
+ </engine>
+ <engine>
+ <name>m17n:km:*</name>
+ <symbol>ក</symbol>
+ </engine>
+ <engine>
+ <name>m17n:lo:*</name>
+ <symbol>ກ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:nsk:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:oj:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ps:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:ru:*</name>
+ <symbol>Я</symbol>
+ </engine>
+ <engine>
+ <name>m17n:sv:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:syrc:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:tai:*</name>
+ <symbol>꫞</symbol>
+ </engine>
+ <engine>
+ <name>m17n:th:*</name>
+ <symbol>ท</symbol>
+ </engine>
+ <engine>
+ <name>m17n:ur:*</name>
+ <symbol>خ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:han</name>
+ <symbol>越</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:nom*</name>
+ <symbol>喃</symbol>
+ </engine>
+ <engine>
+ <name>m17n:vi:*</name>
+ <symbol>Ắ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:yi:*</name>
+ <symbol></symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:bopomofo</name>
+ <symbol>ㄅ</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:cangjie</name>
+ <symbol>倉</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:py*</name>
+ <symbol>拼</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:quick</name>
+ <symbol>簡</symbol>
+ </engine>
+ <engine>
+ <name>m17n:zh:tonepy*</name>
+ <symbol>调</symbol>
+ </engine>
</engines>
diff --git a/src/m17nutil.c b/src/m17nutil.c
index 201c8b4..94a6891 100644
--- a/src/m17nutil.c
+++ b/src/m17nutil.c
@@ -16,7 +16,9 @@ static MConverter *utf8_converter = NULL;
typedef enum {
ENGINE_CONFIG_RANK_MASK = 1 << 0,
ENGINE_CONFIG_LAYOUT_MASK = 1 << 1,
- ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 2
+ ENGINE_CONFIG_HOTKEYS_MASK = 1 << 2,
+ ENGINE_CONFIG_SYMBOL_MASK = 1 << 3,
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 4
} EngineConfigMask;
struct _EngineConfigNode {
@@ -133,6 +135,8 @@ ibus_m17n_engine_new (MSymbol lang,
"icon", engine_icon ? engine_icon : "",
"layout", config->layout ? config->layout : "us",
"rank", config->rank,
+ "hotkeys", config->hotkeys ? config->hotkeys : "",
+ "symbol", config->symbol ? config->symbol : "",
NULL);
#else
engine = ibus_engine_desc_new (engine_name,
@@ -275,6 +279,10 @@ ibus_m17n_get_engine_config (const gchar *engine_name)
config->rank = cnode->config.rank;
if (cnode->mask & ENGINE_CONFIG_LAYOUT_MASK)
config->layout = cnode->config.layout;
+ if (cnode->mask & ENGINE_CONFIG_HOTKEYS_MASK)
+ config->hotkeys = cnode->config.hotkeys;
+ if (cnode->mask & ENGINE_CONFIG_SYMBOL_MASK)
+ config->symbol = cnode->config.symbol;
if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
config->preedit_highlight = cnode->config.preedit_highlight;
}
@@ -313,6 +321,16 @@ ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
cnode->mask |= ENGINE_CONFIG_LAYOUT_MASK;
continue;
}
+ if (g_strcmp0 (sub_node->name , "hotkeys") == 0) {
+ cnode->config.hotkeys = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_HOTKEYS_MASK;
+ continue;
+ }
+ if (g_strcmp0 (sub_node->name , "symbol") == 0) {
+ cnode->config.symbol = g_strdup (sub_node->text);
+ cnode->mask |= ENGINE_CONFIG_SYMBOL_MASK;
+ continue;
+ }
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
if (g_ascii_strcasecmp ("TRUE", sub_node->text) == 0)
cnode->config.preedit_highlight = TRUE;
diff --git a/src/m17nutil.h b/src/m17nutil.h
index c7b283e..21b1bb9 100644
--- a/src/m17nutil.h
+++ b/src/m17nutil.h
@@ -17,6 +17,12 @@ struct _IBusM17NEngineConfig {
/* keyboard layout */
gchar *layout;
+ /* hotkeys */
+ gchar *hotkeys;
+
+ /* symbol */
+ gchar *symbol;
+
/* whether to highlight preedit */
gboolean preedit_highlight;
};
--
1.7.6.2

View File

@ -13,33 +13,24 @@
%global _with_gtk --with-gtk=2.0
%endif
%if %have_bridge_hotkey
%global _with_hotkeys --with-hotkeys
%endif
%if (0%{?fedora} > 16)
%global _enable_eekboard --enable-eekboard
%endif
Name: ibus-m17n
Version: 1.3.3
Release: 9%{?dist}
Release: 11%{?dist}
Summary: The M17N engine for IBus platform
License: GPLv2+
Group: System Environment/Libraries
URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
#Patch0: ibus-m17n-HEAD.patch
Patch1: ibus-m17n-default-xml-override.patch
Patch2: ibus-m17n-setup-refactor.patch
Patch3: ibus-m17n-xkb-options.patch
Patch4: ibus-m17n-xx-icon-symbol.patch
Patch5: ibus-m17n-virtkbd.patch
Patch6: ibus-m17n-iok.patch
Patch7: ibus-m17n-hide-title-status.patch
Patch8: ibus-m17n-blacklist-engines.patch
Patch9: ibus-m17n-custom-setup-element.patch
Patch0: ibus-m17n-HEAD.patch
Patch1: ibus-m17n-xkb-options.patch
Patch2: ibus-m17n-hide-title-status.patch
Patch3: ibus-m17n-blacklist-engines.patch
Patch4: ibus-m17n-virtkbd.patch
# The following BR is for autogen and not necessary when packging
# released tarballs.
@ -68,18 +59,13 @@ the input table maps from m17n-db.
%prep
%setup -q
#patch0 -p1 -b .HEAD
%patch1 -p1 -b .default-xml-override
%patch2 -p1 -b .setup-refactor
%patch3 -p1 -b .xkb-options
# do not apply patch to m4/.gitignore
sed -i 's!^[-+][-+][-+] .*/m4/\.gitignore!#\0!' %PATCH4
%patch4 -p1 -b .xx-icon-symbol
%patch5 -p1 -b .virtkbd
%patch6 -p1 -b .iok
%patch7 -p1 -b .hide-title-status
%patch8 -p1 -b .blacklist-engines
%patch9 -p1 -b .custom-setup-element
%patch0 -p1 -b .HEAD
%patch1 -p1 -b .xkb-options
%patch2 -p1 -b .hide-title-status
%patch3 -p1 -b .blacklist-engines
%patch4 -p1 -b .virtkbd
NOCONFIGURE=1 ./autogen.sh
%build
@ -101,6 +87,10 @@ make DESTDIR=${RPM_BUILD_ROOT} install
%{_datadir}/ibus/component/*
%changelog
* Fri Mar 30 2012 Daiki Ueno <dueno@redhat.com> - 1.3.3-11
- Revive m17n:zh:pinyin with a different label ("hanyu pinyin (m17n)")
- Rebase ibus-m17n-virtkbd.patch.
* Tue Mar 6 2012 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.3-9
- Rebuild for ibus 1.4.99.20120304