Hi,

Let's move this to BTS so anyone can read this.

On Sat, Nov 29, 2014 at 03:04:16PM +0800, Keng-Yu Lin wrote:
> Thanks for explaining this to me. I understand now. :-)

So let's think how to get these fixes accepted to jessie.

Basic rule:
Make it easy for the release manager to declare this is
matching their announced release policy with no efforts on their part.
  https://release.debian.org/jessie/freeze_policy.html

| There are some packages we know we won't approve. So as not to have
| everyone contact us at once about such packages, here are the guidelines
| for changes that will be accepting into testing during the freeze:
| 
| * targeted fixes for release critical bugs (i.e., bugs of severity
|   critical, grave, and serious) in all packages (applies during the entire
|   freeze (ok for TPU));
If you raise bug severity of #771390, you can do it anytime.  (But let's
not do it now)

| * fixes for severity: important bugs in packages of priority: optional or
|   extra, only when this can be done via unstable (until the 5th of
|   December 2014);
OK we still have few days to fix bug #771390 (important) for
introspection.

| * translation updates and documentation fixes that are included with fixes
|   for the above criteria (until the 5th of January 2015);
OK your PO and related updates fit into this even in December.

|   translation updates and documentation fixes, via TPU when included with
| * other TPU-applicable fixes. (until the 5th of January 2015)
|   pre-approved fixes (until the 5th of January 2015);
Let's not do TPU for now.

> > Let's discuss positive side.
> >
> > Am I correct to described this situation as follows:
> >
> > 1. Although ibus-array 0.0.4-1 has no bug reported, ibus-array  setup is
> >    completely broken due to missing support for "import ibus".
> >    important or grave bug (maintainer's call)  This needs to be fixed by
> >    supporting gnome introspection for ibus.
> Yes. setup.py is broken in ibus-array 0.0.4-1.
Bug #771390 filed.

> > 2. Although this is new upstream, diff is very small.  (It could have
> >    been smaller if there were not some formatting changes.)  The changes
> >    are practically all focused on gnome introspection for ibus and new
> >    translation which is sure to be OK under current freeze policy.
> Yes too. ibus-array 0.1.0 fixes
>   (1) Add GTK introspection support for setup.py
>   (2) Made all conf keys in lowercase because ibus-config always uses
>       the lowercase
>   (3) Add gettext support and new translation

Release team does not like a big patch.  You have been using subversion.

For the ease of tracking changes, I exported it to git and did few
manual tagging.  Its tar.xz can be found at:
 https://people.debian.org/~osamu/ibus-array.tar.xz (7MB)
 (If you do not mind, moving code to github etc. like other ibus modules
  may be an idea using this git repo as the base.)

$ git shortlog 0.0.4.. # highligts by me
lexic...@gmail.com (10):
      Use Gobject introspection in the setup dialog
      Fixed main setup ui due to ibus_config API changes
      Fixed ibus array engine due to ibus config API changes
      IBusText is not a gboject now; no need to unref it
      ibus config seems to save all the keys in the lowercase
      reformat the coding style *******
      reformat the coding style *******
      Add gettext support
      Fix typo in zh_TW.po
      update the copyright      *******

The last one is not in 0.1.0.  So except 2 commits with "reformat the
coding style", these are very much targeted fixes.

I have made a set of patches using "git format-patch" for these 9 patches.
(attached)

As for Debian revision, you only changed translation support.
$ git diff HEAD~
diff --git a/debian/changelog b/debian/changelog
index 9fb3fd8..42a7f3c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ibus-array (0.1.0-1) unstable; urgency=low
+
+  * Imported Upstream version 0.1.0
+
+ -- Keng-Yu Lin <ken...@lexical.tw>  Sat, 01 Nov 2014 20:48:51 +0800
+
 ibus-array (0.0.4-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/control b/debian/control
index a69b427..f3a7494 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Build-Depends: autoconf (>= 2.5),
                libsqlite3-dev,
                libtool (>= 2.2),
                pkg-config,
+               intltool,
                python-all (>= 2.6.6-3~)
 Standards-Version: 3.9.6
 Homepage: http://code.google.com/p/ibus-array/

Hmmmm... I think we have a case where we may get OK by the release
manager.  If not we can update introspection fix via TPU.

Osamu


>From 59d32e9a8e8c9ca48d6f02e0382755e6cca02411 Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Fri, 31 Oct 2014 14:50:40 +0000
Subject: [PATCH 01/10] Use Gobject introspection in the setup dialog

Both GTK and ibus should use this. dependency on ibus-python is dropped


git-svn-id: http://ibus-array.googlecode.com/svn/trunk@38 06f26268-b6d7-11de-ba48-051263943efc
---
 setup/main.py | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/setup/main.py b/setup/main.py
index cca5428..496b112 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -23,30 +23,30 @@
  
 import sys
 import os
-import gobject
-import gtk
-import ibus
+from gi.repository import GLib
+from gi.repository import Gtk
+from gi.repository import IBus
 import gettext
 import config
 
 class Setup:
-    def __init__(self):
-        self.__bus = ibus.Bus()
+    def __init__(self, bus):
+        self.__bus = bus 
         self.__config = self.__bus.get_config()
         self.__config.connect("value-changed", self.on_value_changed, None)
         self.__create_ui()
 
     def __create_ui(self):
-        self.__window = gtk.Dialog('ibus-array setup', None, 
-                                    gtk.DIALOG_MODAL, 
-                                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, 
-                                     gtk.STOCK_OK, gtk.RESPONSE_OK)
+        self.__window = Gtk.Dialog('ibus-array setup', None, 
+                                    Gtk.DialogFlags.MODAL, 
+                                    (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 
+                                     Gtk.STOCK_OK, Gtk.ResponseType.OK)
                                   )
         icon_file = os.path.join(config.datadir, "ibus-array", "icons", "ibus-array.png")
         self.__window.set_icon_from_file(icon_file)
-        self.__special_notify_button = gtk.CheckButton("Special Code Notification")
+        self.__special_notify_button = Gtk.CheckButton("Special Code Notification")
         self.__window.vbox.pack_start(self.__special_notify_button, True, True, 10)
-        self.__special_only_button = gtk.CheckButton("Speical Code Only Mode")
+        self.__special_only_button = Gtk.CheckButton("Speical Code Only Mode")
         self.__window.vbox.pack_start(self.__special_only_button, True, True ,10)
 
         current_special_mode = self.__read("SpecialOnly", "0")
@@ -61,7 +61,7 @@ class Setup:
 
     def run(self):
         res = self.__window.run()
-        if res == gtk.RESPONSE_OK:
+        if res == Gtk.ResponseType.OK:
             self.apply()
         self.__window.destroy()
 
@@ -70,13 +70,13 @@ class Setup:
         select_special_mode = self.__special_only_button.get_active()
 
         if select_special_notify:
-            self.__write("SpecialNotify", "1")
+            self.__write("SpecialNotify", GLib.Variant.new_string("1"))
         else:
-            self.__write("SpecialNotify", "0")
+            self.__write("SpecialNotify", GLib.Variant.new_string("0"))
         if select_special_mode:
-            self.__write("SpecialOnly", "1")
+            self.__write("SpecialOnly", GLib.Variant.new_string("1"))
         else:
-            self.__write("SpecialOnly", "0")
+            self.__write("SpecialOnly", GLib.Variant.new_string("0"))
 
     def on_value_changed(self, config, section, name, value, data):
         if section == 'engine/Array':
@@ -92,10 +92,15 @@ class Setup:
                     self.__special_notify_button.set_active(False)
 
     def __read(self, name, v):
-        return self.__config.get_value("engine/Array", name, v)
+	value = self.__config.get_value("engine/Array", name)
+	if value is None:
+		return v
+        return value
 
     def __write(self, name, v):
         return self.__config.set_value("engine/Array", name, v)
 
 if __name__ == '__main__':
-    Setup().run()
+    bus = IBus.Bus()
+    if bus.is_connected():
+        Setup(bus).run()
-- 
2.1.3

>From 015f7bcdc3a07cbb2d1ac99f2bb420383459eaa7 Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Fri, 31 Oct 2014 16:17:53 +0000
Subject: [PATCH 02/10] Fixed main setup ui due to ibus_config API changes

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@39 06f26268-b6d7-11de-ba48-051263943efc
---
 setup/main.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/setup/main.py b/setup/main.py
index 496b112..5f0b7c1 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -49,12 +49,12 @@ class Setup:
         self.__special_only_button = Gtk.CheckButton("Speical Code Only Mode")
         self.__window.vbox.pack_start(self.__special_only_button, True, True ,10)
 
-        current_special_mode = self.__read("SpecialOnly", "0")
-        current_special_notify = self.__read("SpecialNotify", "0")
+        current_special_mode = self.__read("SpecialOnly", False)
+        current_special_notify = self.__read("SpecialNotify", False)
 
-        if current_special_notify == "1":
+        if current_special_notify:
             self.__special_notify_button.set_active(True)
-        if current_special_mode == "1":
+        if current_special_mode:
             self.__special_only_button.set_active(True)
 
         self.__window.show_all()
@@ -70,23 +70,25 @@ class Setup:
         select_special_mode = self.__special_only_button.get_active()
 
         if select_special_notify:
-            self.__write("SpecialNotify", GLib.Variant.new_string("1"))
+            self.__write("SpecialNotify", GLib.Variant.new_boolean(True))
         else:
-            self.__write("SpecialNotify", GLib.Variant.new_string("0"))
+            self.__write("SpecialNotify", GLib.Variant.new_boolean(False))
+
         if select_special_mode:
-            self.__write("SpecialOnly", GLib.Variant.new_string("1"))
+            self.__write("SpecialOnly", GLib.Variant.new_boolean(True))
         else:
-            self.__write("SpecialOnly", GLib.Variant.new_string("0"))
+            self.__write("SpecialOnly", GLib.Variant.new_boolean(False))
 
     def on_value_changed(self, config, section, name, value, data):
         if section == 'engine/Array':
             if name == 'SpecialNotify':
-                if value == '1':
+                if value:
                     self.__special_notify_button.set_active(True)
                 else:
                     self.__special_notify_button.set_active(False)
+
             elif name == 'SpecialOnly':
-                if value == '1':
+                if value:
                     self.__special_notify_button.set_active(True)
                 else:
                     self.__special_notify_button.set_active(False)
-- 
2.1.3

>From 95570a573bfc69cef55fb9b460285de32a1d98c6 Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Fri, 31 Oct 2014 16:19:10 +0000
Subject: [PATCH 03/10] Fixed ibus array engine due to ibus config API changes

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@40 06f26268-b6d7-11de-ba48-051263943efc
---
 src/engine.c | 105 ++++++++++++-----------------------------------------------
 1 file changed, 21 insertions(+), 84 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 95fb540..2ae446c 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -68,15 +68,7 @@ static void ibus_array_engine_update_auxiliary_text (IBusArrayEngine *arrayeng,
 static void ibus_array_engine_show_special_code(IBusArrayEngine *arrayeng);
 static void ibus_array_engine_show_special_code_for_char(IBusArrayEngine *arrayeng, gchar *ch);
 
-static void ibus_config_value_changed (IBusConfig *config, const gchar *section, const gchar *name, 
-#if IBUS_CHECK_VERSION(1,3,99)
-                                        GVariant *value,
-#else
-                                        GValue *value, 
-#endif /* !IBUS_CHECK_VERSION(1,3,99) */
-                                        gpointer user_data);
-
-static gboolean config_get_string (IBusConfig *config, const gchar *section, const gchar *name, gchar **result);
+static void ibus_config_value_changed_cb (IBusConfig *config, const gchar *section, const gchar *name, GVariant *value, gpointer unused);
 
 static IBusEngineClass *parent_class = NULL;
 static IBusConfig *config = NULL;
@@ -86,8 +78,7 @@ static gboolean is_aux_shown = FALSE;
 
 static ArrayContext *array_context = NULL;
 
-GType
-ibus_array_engine_get_type (void)
+GType ibus_array_engine_get_type (void)
 {
 	static GType type = 0;
 
@@ -123,22 +114,16 @@ void ibus_array_init (IBusBus *bus)
     is_special_notify = FALSE;
     is_special_only = FALSE;
 
-    str = NULL;
-    res = config_get_string (config, "engine/Array", "SpecialNotify", &str);
-    if (res)
-    {
-        if (g_strcmp0(str, "1") == 0)
-            is_special_notify = TRUE;
-        g_free (str);
-    }
+    /* load config */
+    GVariant* value;
 
-    res = config_get_string (config, "engine/Array", "SpecialOnly", &str);
-    if (res)
-    {
-        if (g_strcmp0(str, "1") == 0)
-            is_special_only = TRUE;
-        g_free (str);
-    }
+    value = ibus_config_get_value (config, "engine/Array", "SpecialNotify");
+    if (value && g_variant_classify(value) == G_VARIANT_CLASS_BOOLEAN)
+        is_special_notify = g_variant_get_boolean(value);
+
+    value = ibus_config_get_value (config, "engine/Array", "SpecialOnly");
+    if (value && g_variant_classify(value) == G_VARIANT_CLASS_BOOLEAN)
+            is_special_only = g_variant_get_boolean(value);
 }
 
 void ibus_array_exit (void) 
@@ -147,7 +132,6 @@ void ibus_array_exit (void)
 
     if (g_object_is_floating (config))
         g_object_unref(config);
-    config = NULL;
 }
 
 static void ibus_array_engine_class_init (IBusArrayEngineClass *klass)
@@ -193,7 +177,7 @@ static void ibus_array_engine_init (IBusArrayEngine *arrayeng)
 
     ibus_prop_list_append(arrayeng->prop_list, setup_prop);
 
-    g_signal_connect (config, "value-changed", G_CALLBACK(ibus_config_value_changed), arrayeng);
+    g_signal_connect (config, "value-changed", G_CALLBACK(ibus_config_value_changed_cb), arrayeng);
 }
 
 static void ibus_array_engine_destroy (IBusArrayEngine *arrayeng)
@@ -717,70 +701,23 @@ static void ibus_array_engine_property_activate (IBusEngine *engine, const gchar
     }
 }
 
-static gboolean config_get_string (IBusConfig  *config, const gchar *section, const gchar *name, gchar **result)
+static void ibus_config_value_changed_cb (IBusConfig *config, const gchar *section,  const gchar *name, GVariant *value, gpointer unused)
 {
-#if IBUS_CHECK_VERSION(1,3,99)
-    GVariant *value = NULL;
-
-    g_return_val_if_fail (result != NULL, FALSE);
-
-    value = ibus_config_get_value (config, section, name);
-    if (value)
-    {
-        *result = g_strdup (g_variant_get_string (value, NULL));
-        g_variant_unref (value);
-        return TRUE;
-    }
-    return FALSE;
-#else
-    GValue value = { 0 };
-
-    g_return_val_if_fail (result != NULL, FALSE);
-
-    if (ibus_config_get_value (config, section, name, &value)) {
-        *result = g_strdup (g_value_get_string (&value));
-        g_value_unset (&value);
-        return TRUE;
-    }
-    return FALSE;
-#endif  /* !IBUS_CHECK_VERSION(1,3,99) */
-}
-
-#if IBUS_CHECK_VERSION(1,3,99)
-#define _g_variant_get_string g_variant_get_string
-#else
-#define _g_variant_get_string(value, length) g_value_get_string(value)
-#endif  /* !IBUS_CHECK_VERSION(1,3,99) */
-
-static void ibus_config_value_changed (IBusConfig *config, const gchar *section,  const gchar *name, 
-#if IBUS_CHECK_VERSION(1,3,99)
-                                        GVariant *value,
-#else
-                                        GValue *value, 
-#endif /* !IBUS_CHECK_VERSION(1,3,99) */
-                                        gpointer user_data)
-{
-    IBusArrayEngine *arrayeng = (IBusArrayEngine*)user_data;
-
     if (g_strcmp0(section, "engine/Array") == 0)
     {
-        if (g_strcmp0(name, "SpecialNotify") == 0) {
-            const gchar* str = _g_variant_get_string(value, NULL);
-            if (g_strcmp0(str, "1") == 0) {
+        if (g_strcmp0(name, "SpecialNotify") == 0)
+        {
+            if (g_variant_get_boolean (value)) 
                 is_special_notify = TRUE;
-            }
-            else {
+            else
                 is_special_notify = FALSE;
-            }
         }
-        else if (g_strcmp0(name, "SpecialOnly") == 0) {
-            const gchar* str = _g_variant_get_string(value, NULL);
-            if (g_strcmp0(str, "1") == 0) {
+        else if (g_strcmp0(name, "SpecialOnly") == 0)
+        {
+            if (g_variant_get_boolean (value))
                 is_special_only = TRUE;
-            }
-            else {
+            else
                 is_special_only = FALSE;
-            }
         }
     }
 }
-- 
2.1.3

>From 09d08c05340e15540d63770048eb08cb96b3de83 Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Fri, 31 Oct 2014 17:11:02 +0000
Subject: [PATCH 04/10] IBusText is not a gboject now; no need to unref it

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@41 06f26268-b6d7-11de-ba48-051263943efc
---
 src/engine.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 2ae446c..554eea9 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -616,9 +616,6 @@ static void ibus_array_engine_update_auxiliary_text(IBusArrayEngine *arrayeng, g
     {
         text = ibus_text_new_from_string(aux_string);
         ibus_engine_update_auxiliary_text((IBusEngine*)arrayeng, text, TRUE);
-
-    if (g_object_is_floating (text))
-        g_object_unref (text);
     }
 }
 
-- 
2.1.3

>From 34ab164ed5eb92ecc4b9137f821e284d9ed0376d Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Sat, 1 Nov 2014 05:07:37 +0000
Subject: [PATCH 05/10] ibus config seems to save all the keys in the lowercase

so in ibus-array, use the lowercase when fetching the config.


git-svn-id: http://ibus-array.googlecode.com/svn/trunk@42 06f26268-b6d7-11de-ba48-051263943efc
---
 src/engine.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 554eea9..060e965 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -110,6 +110,8 @@ void ibus_array_init (IBusBus *bus)
     array_context = array_create_context();
 
     config = ibus_bus_get_config (bus);
+    if (config)
+        g_object_ref_sink (config);
 
     is_special_notify = FALSE;
     is_special_only = FALSE;
@@ -177,7 +179,7 @@ static void ibus_array_engine_init (IBusArrayEngine *arrayeng)
 
     ibus_prop_list_append(arrayeng->prop_list, setup_prop);
 
-    g_signal_connect (config, "value-changed", G_CALLBACK(ibus_config_value_changed_cb), arrayeng);
+    g_signal_connect (config, "value-changed", G_CALLBACK(ibus_config_value_changed_cb), NULL);
 }
 
 static void ibus_array_engine_destroy (IBusArrayEngine *arrayeng)
@@ -700,21 +702,9 @@ static void ibus_array_engine_property_activate (IBusEngine *engine, const gchar
 
 static void ibus_config_value_changed_cb (IBusConfig *config, const gchar *section,  const gchar *name, GVariant *value, gpointer unused)
 {
-    if (g_strcmp0(section, "engine/Array") == 0)
-    {
-        if (g_strcmp0(name, "SpecialNotify") == 0)
-        {
-            if (g_variant_get_boolean (value)) 
-                is_special_notify = TRUE;
-            else
-                is_special_notify = FALSE;
-        }
-        else if (g_strcmp0(name, "SpecialOnly") == 0)
-        {
-            if (g_variant_get_boolean (value))
-                is_special_only = TRUE;
-            else
-                is_special_only = FALSE;
-        }
-    }
+    if (g_strcmp0(section, "engine/array") == 0)
+        if (g_strcmp0(name, "specialnotify") == 0)
+            is_special_notify = g_variant_get_boolean (value);
+        else if (g_strcmp0(name, "specialonly") == 0)
+            is_special_only = g_variant_get_boolean (value);
 }
-- 
2.1.3

>From ac736c1428f48429a8d297937d9cf2bf257b3f3b Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Sat, 1 Nov 2014 06:08:07 +0000
Subject: [PATCH 06/10] reformat the coding style

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@43 06f26268-b6d7-11de-ba48-051263943efc
---
 src/engine.c | 58 ++++++++++++++++------------------------------------------
 1 file changed, 16 insertions(+), 42 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 060e965..d11a012 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -8,7 +8,8 @@
 typedef struct _IBusArrayEngine IBusArrayEngine;
 typedef struct _IBusArrayEngineClass IBusArrayEngineClass;
 
-struct _IBusArrayEngine {
+struct _IBusArrayEngine
+{
     IBusEngine parent;
 
     /* members */
@@ -20,7 +21,8 @@ struct _IBusArrayEngine {
     IBusPropList *prop_list;
 };
 
-struct _IBusArrayEngineClass {
+struct _IBusArrayEngineClass
+{
     IBusEngineClass parent;
 };
 
@@ -75,7 +77,6 @@ static IBusConfig *config = NULL;
 static gboolean is_special_notify;
 static gboolean is_special_only;
 static gboolean is_aux_shown = FALSE;
-
 static ArrayContext *array_context = NULL;
 
 GType ibus_array_engine_get_type (void)
@@ -95,9 +96,7 @@ GType ibus_array_engine_get_type (void)
 	};
 
 	if (type == 0)
-        {
 		type = g_type_register_static (IBUS_TYPE_ENGINE, "IBusArrayEngine", &type_info, (GTypeFlags) 0);
-	}
 
 	return type;
 }
@@ -105,7 +104,6 @@ GType ibus_array_engine_get_type (void)
 void ibus_array_init (IBusBus *bus) 
 {
     gboolean res;
-    gchar *str;
 
     array_context = array_create_context();
 
@@ -188,6 +186,7 @@ static void ibus_array_engine_destroy (IBusArrayEngine *arrayeng)
         g_object_unref(arrayeng->prop_list);
         arrayeng->prop_list = NULL;
     }
+
     if (arrayeng->preedit) {
         g_string_free (arrayeng->preedit, TRUE);
         arrayeng->preedit = NULL;
@@ -207,10 +206,10 @@ static void ibus_array_engine_reset(IBusEngine *engine)
     g_string_assign (arrayeng->preedit, "");
     arrayeng->cursor_pos = 0;
     arrayeng->space_press_count = 0;
+
     ibus_array_engine_update_preedit (arrayeng);
     ibus_engine_hide_lookup_table (engine);
     ibus_engine_hide_auxiliary_text (engine);
-
     parent_class->reset(engine);
 }
 
@@ -227,9 +226,7 @@ static void ibus_array_engine_page_down (IBusEngine *engine)
 static void ibus_array_engine_focus_in (IBusEngine *engine)
 {
     IBusArrayEngine *arrayeng = (IBusArrayEngine*)engine;
-
     ibus_engine_register_properties (engine, arrayeng->prop_list);
-
     parent_class->focus_in (engine);
 }
 
@@ -254,19 +251,13 @@ static void ibus_array_engine_update_lookup_table (IBusArrayEngine *arrayeng)
     GArray *candidates = NULL;
 
     if (arrayeng->preedit->len <= 2 && arrayeng->space_press_count == 0)
-    {
         candidates = array_get_candidates_from_short(array_context, arrayeng->preedit->str);
-    }
     else
-    {
         candidates = array_get_candidates_from_main(array_context, arrayeng->preedit->str);
-    }
     
     if (candidates == NULL)
-    {
         ibus_engine_hide_lookup_table ((IBusEngine *) arrayeng);
         return;
-    }
     else if (candidates->len == 0)
     {
         array_release_candidates(candidates);
@@ -275,9 +266,7 @@ static void ibus_array_engine_update_lookup_table (IBusArrayEngine *arrayeng)
     }
 
     for (i = 0; i < candidates->len; i++)
-    {
         ibus_lookup_table_append_candidate (arrayeng->table, ibus_text_new_from_string (g_array_index(candidates, gchar*, i)));
-    }
 
     array_release_candidates(candidates);
 
@@ -302,13 +291,11 @@ static void ibus_array_engine_update_preedit (IBusArrayEngine *arrayeng)
     {
         retval = 0;
         if (retval != 0)
-        {
-            ibus_attr_list_append (text->attrs,
-                               ibus_attr_foreground_new (0xff0000, 0, array_preedit->len));
-        }
+            ibus_attr_list_append (text->attrs, ibus_attr_foreground_new (0xff0000, 0, array_preedit->len));
     }
     
     ibus_engine_update_preedit_text ((IBusEngine *)arrayeng, text, array_preedit->len, TRUE);
+
     if (G_IS_OBJECT (text) && g_object_is_floating (text))
     	g_object_unref (text);
 
@@ -345,9 +332,7 @@ static gboolean ibus_array_engine_update_symbol_lookup_table (IBusArrayEngine *a
     }
 
     for (i = 0; i < candidates->len; i++)
-    {
         ibus_lookup_table_append_candidate (arrayeng->table, ibus_text_new_from_string (g_array_index(candidates, gchar*, i)));
-    }
 
     array_release_candidates(candidates);
 
@@ -375,12 +360,10 @@ static gboolean ibus_array_engine_commit_current_candidate (IBusArrayEngine *arr
             if (check_special)
             {
                 if (is_special_notify)
-                {
                     ibus_array_engine_show_special_code_for_char (arrayeng, text->text);
-                }
-                if (is_special_only) {
+
+                if (is_special_only)
                     return FALSE;
-                }
             }
         }
         ibus_engine_commit_text((IBusEngine*)arrayeng, text);
@@ -388,9 +371,7 @@ static gboolean ibus_array_engine_commit_current_candidate (IBusArrayEngine *arr
         ibus_array_engine_reset((IBusEngine*)arrayeng);
 
         if (is_special_notify && check_special)
-        {
             ibus_array_engine_show_special_code_for_char(arrayeng, temptext);
-        }
 
         g_free(temptext);
 
@@ -447,12 +428,14 @@ static gboolean  ibus_array_engine_process_key_event (IBusEngine *engine, guint
         return FALSE;
 
 
-    switch (keyval) {
+    switch (keyval)
+    {
     case IBUS_space:
         if (arrayeng->preedit->len == 0)
             return FALSE;
         ibus_array_engine_space_press(arrayeng);
         return TRUE;
+
     case IBUS_Return:
         if (arrayeng->preedit->len == 0)
             return FALSE;
@@ -510,7 +493,7 @@ static gboolean  ibus_array_engine_process_key_event (IBusEngine *engine, guint
 
     if (is_alpha (keyval) || keyval == IBUS_period || keyval == IBUS_comma || keyval == IBUS_slash || keyval == IBUS_semicolon)
     {
-        if (arrayeng->space_press_count == 1) {
+        if (arrayeng->space_press_count == 1)
             if (arrayeng->table->candidates->len > 0)
             {
                 gboolean commit_rev;
@@ -521,12 +504,9 @@ static gboolean  ibus_array_engine_process_key_event (IBusEngine *engine, guint
             } else {
 		ibus_array_engine_reset((IBusEngine*)arrayeng);
             }
-        }
 
         if (arrayeng->preedit->len >= 5)
-        {
                 return TRUE;
-        }
 
         g_string_insert_c (arrayeng->preedit, arrayeng->cursor_pos, keyval);
 
@@ -598,15 +578,11 @@ static void ibus_array_engine_space_press (IBusArrayEngine *arrayeng)
 
         if (arrayeng->table->candidates->len > 0)
         {
-
             ibus_lookup_table_set_cursor_pos (arrayeng->table, 0);
-
             commit_rev = ibus_array_engine_commit_current_candidate(arrayeng);
         }
         else
-        {
             ibus_array_engine_reset((IBusEngine*)arrayeng);
-        }
     }
 }
 
@@ -644,9 +620,8 @@ static void ibus_array_engine_show_special_code(IBusArrayEngine *arrayeng)
         g_string_free(keystr, TRUE);
         g_free(show_str);
     }
-    else {
+    else
         ibus_engine_hide_auxiliary_text((IBusEngine*)arrayeng);
-    }
 
     array_release_candidates(candidates);
 }
@@ -671,9 +646,7 @@ static void ibus_array_engine_show_special_code_for_char (IBusArrayEngine *array
         g_free(show_str);
     }
     else
-    {
         ibus_engine_hide_auxiliary_text((IBusEngine*)arrayeng);
-    }
 
     array_release_candidates(candidates);
 }
@@ -708,3 +681,4 @@ static void ibus_config_value_changed_cb (IBusConfig *config, const gchar *secti
         else if (g_strcmp0(name, "specialonly") == 0)
             is_special_only = g_variant_get_boolean (value);
 }
+
-- 
2.1.3

>From b3855dba429d90d614343269a11a7d9b2cc7d31a Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Sat, 1 Nov 2014 06:09:57 +0000
Subject: [PATCH 07/10] reformat the coding style

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@44 06f26268-b6d7-11de-ba48-051263943efc
---
 src/engine.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/engine.c b/src/engine.c
index d11a012..71526fc 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -256,8 +256,10 @@ static void ibus_array_engine_update_lookup_table (IBusArrayEngine *arrayeng)
         candidates = array_get_candidates_from_main(array_context, arrayeng->preedit->str);
     
     if (candidates == NULL)
+    {
         ibus_engine_hide_lookup_table ((IBusEngine *) arrayeng);
         return;
+    }
     else if (candidates->len == 0)
     {
         array_release_candidates(candidates);
-- 
2.1.3

From b5f2659c3c11230ad6ab9aab62352e8d9c96498b Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Sat, 1 Nov 2014 10:22:23 +0000
Subject: [PATCH 08/10] Add gettext support

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@45 06f26268-b6d7-11de-ba48-051263943efc
---
 Makefile.am     |  4 ++--
 po/LINGUAS      |  2 +-
 po/Makevars     |  2 +-
 po/POTFILES.in  |  2 ++
 po/zh_TW.po     | 43 +++++++++++++++++++++++++++++++++++++++++++
 setup/main.py   |  9 ++++++---
 src/Makefile.am |  8 +++++---
 src/engine.c    | 15 ++++++++++++---
 8 files changed, 72 insertions(+), 13 deletions(-)
 create mode 100644 po/zh_TW.po

diff --git a/Makefile.am b/Makefile.am
index 1eac525..f8f5dd2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,9 +20,9 @@
 
 SUBDIRS = \
 	src \
-    setup \
+	setup \
 	icons \
-    data \
+	data \
 	m4 \
 	po \
 	$(NULL)
diff --git a/po/LINGUAS b/po/LINGUAS
index 8b13789..dad8857 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -1 +1 @@
-
+zh_TW
diff --git a/po/Makevars b/po/Makevars
index 7d73dbd..0b161c2 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -18,7 +18,7 @@ XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
 # or entity, or to disclaim their copyright.  The empty string stands for
 # the public domain; in this case the translators are expected to disclaim
 # their copyright.
-COPYRIGHT_HOLDER = Huang Peng <shawn.p.hu...@gmail.com>
+COPYRIGHT_HOLDER = Keng-Yu Lin <ken...@lexical.tw>
 
 # This is the email address or URL to which the translators shall report
 # bugs in the untranslated strings:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e69de29..b38cc71 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -0,0 +1,2 @@
+src/engine.c
+setup/main.py
diff --git a/po/zh_TW.po b/po/zh_TW.po
new file mode 100644
index 0000000..f970772
--- /dev/null
+++ b/po/zh_TW.po
@@ -0,0 +1,43 @@
+# ibus-array Traditional Chinese Translation
+# Copyright (C) 2014 Keng-Yu Lin <ken...@lexical.tw>
+# This file is distributed under the same license as the ibus-package package.
+# Keng-Yu Lin <ken...@lexical.tw>, 2014
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.0.4\n"
+"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n";
+"POT-Creation-Date: 2014-11-01 18:21+0800\n"
+"PO-Revision-Date: 2014-11-01 16:44+0800\n"
+"Last-Translator: Keng-Yu Lin <ken...@lexical.tw>\n"
+"Language-Team: Chinese (traditional)\n"
+"Language: zh_TW\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/engine.c:179
+msgid "Setup"
+msgstr "設定"
+
+#: src/engine.c:180
+msgid "Configure Array 30 engine"
+msgstr "設定行列輸入法"
+
+#: src/engine.c:422
+msgid ""
+"1.comma 2.bracket 3.symbol 4.math 5.arrow 6.unit 7.table 8.roman 9.greek 0."
+"bopomo"
+msgstr "1.標點 2.括弧 3.符號 4.數學 5.箭頭 6.單位 7.圖表 8.羅馬 9.希臘 0.注音"
+
+#: setup/main.py:43
+msgid "ibus-array setup"
+msgstr "行列輸入法設定"
+
+#: setup/main.py:50
+msgid "Special Code Notification"
+msgstr "當有特別碼時,顯示提示"
+
+#: setup/main.py:52
+msgid "Speical Code Only Mode"
+msgstr "當有特別碼時,只能用特別碼輸入 (特別碼練習模試)"
diff --git a/setup/main.py b/setup/main.py
index 5f0b7c1..8e41355 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -26,6 +26,7 @@ import os
 from gi.repository import GLib
 from gi.repository import Gtk
 from gi.repository import IBus
+from gettext import gettext as _
 import gettext
 import config
 
@@ -37,16 +38,18 @@ class Setup:
         self.__create_ui()
 
     def __create_ui(self):
-        self.__window = Gtk.Dialog('ibus-array setup', None, 
+	gettext.bindtextdomain("ibus-array")
+	gettext.textdomain("ibus-array")
+        self.__window = Gtk.Dialog(_('ibus-array setup'), None, 
                                     Gtk.DialogFlags.MODAL, 
                                     (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 
                                      Gtk.STOCK_OK, Gtk.ResponseType.OK)
                                   )
         icon_file = os.path.join(config.datadir, "ibus-array", "icons", "ibus-array.png")
         self.__window.set_icon_from_file(icon_file)
-        self.__special_notify_button = Gtk.CheckButton("Special Code Notification")
+        self.__special_notify_button = Gtk.CheckButton(_("Special Code Notification"))
         self.__window.vbox.pack_start(self.__special_notify_button, True, True, 10)
-        self.__special_only_button = Gtk.CheckButton("Speical Code Only Mode")
+        self.__special_only_button = Gtk.CheckButton(_("Speical Code Only Mode"))
         self.__window.vbox.pack_start(self.__special_only_button, True, True ,10)
 
         current_special_mode = self.__read("SpecialOnly", False)
diff --git a/src/Makefile.am b/src/Makefile.am
index 51cb61b..89a5e55 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,18 +25,20 @@ ibus_engine_array_SOURCES = \
 	main.c \
 	engine.c \
 	engine.h \
-    array.c \
-    array.h \
+	array.c \
+	array.h \
 	$(NULL)
 ibus_engine_array_CFLAGS = \
 	@IBUS_CFLAGS@ \
 	@SQLITE3_CFLAGS@ \
+	-DLOCALEDIR=\"$(localedir)\" \
 	-DPKGDATADIR=\"$(pkgdatadir)\" \
-    -DLIBEXECDIR=\"$(libexecdir)\" \
+	-DLIBEXECDIR=\"$(libexecdir)\" \
 	$(NULL)
 ibus_engine_array_LDFLAGS = \
 	@IBUS_LIBS@ \
 	@SQLITE3_LIBS@ \
+	@LIBINTL@ \
 	$(NULL)
 
 component_DATA = \
diff --git a/src/engine.c b/src/engine.c
index 71526fc..81becb3 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1,8 +1,12 @@
 /* vim:set et sts=4: */
 
+#include <locale.h>
+#include <libintl.h>
 #include "engine.h"
 #include "array.h"
+#include "config.h"
 
+#define _(String) gettext(String)
 #define ARRAY_SHORT_CODE_EMPTY_STRING "⎔"
 
 typedef struct _IBusArrayEngine IBusArrayEngine;
@@ -124,6 +128,11 @@ void ibus_array_init (IBusBus *bus)
     value = ibus_config_get_value (config, "engine/Array", "SpecialOnly");
     if (value && g_variant_classify(value) == G_VARIANT_CLASS_BOOLEAN)
             is_special_only = g_variant_get_boolean(value);
+
+    /* gettext preparation */
+    setlocale (LC_ALL, "");
+    bindtextdomain (PACKAGE, LOCALEDIR);
+    textdomain (PACKAGE);
 }
 
 void ibus_array_exit (void) 
@@ -167,8 +176,8 @@ static void ibus_array_engine_init (IBusArrayEngine *arrayeng)
 
     arrayeng->table = ibus_lookup_table_new (10, 0, FALSE, TRUE);
     g_object_ref_sink (arrayeng->table);
-    setup_label = ibus_text_new_from_string("Setup");
-    setup_tooltip = ibus_text_new_from_string("Configure Array 30 engine");
+    setup_label = ibus_text_new_from_string (_("Setup"));
+    setup_tooltip = ibus_text_new_from_string (_("Configure Array 30 engine"));
     setup_prop = ibus_property_new("setup", PROP_TYPE_NORMAL, setup_label, "gtk-preferences", setup_tooltip, TRUE, TRUE, 0, NULL);
     g_object_ref_sink (setup_prop);
 
@@ -410,7 +419,7 @@ static gboolean  ibus_array_engine_process_key_event (IBusEngine *engine, guint
 
     if (g_strcmp0(arrayeng->preedit->str, "w") == 0)
     {
-        ibus_array_engine_update_auxiliary_text(arrayeng, "1.標點 2.括弧 3.符號 4.數學 5.方向 6.單位 7.圖表 8.羅馬 9.希臘 0.注音");
+        ibus_array_engine_update_auxiliary_text(arrayeng, _("1.comma 2.bracket 3.symbol 4.math 5.arrow 6.unit 7.table 8.roman 9.greek 0.bopomo"));
         is_aux_shown = TRUE;
     }
     else if (is_aux_shown)
-- 
2.1.3

>From 6bb5c4aebb86ff438d30f89d12e93cf0ce9c86a5 Mon Sep 17 00:00:00 2001
From: "lexic...@gmail.com"
 <lexic...@gmail.com@06f26268-b6d7-11de-ba48-051263943efc>
Date: Sat, 1 Nov 2014 10:25:05 +0000
Subject: [PATCH 09/10] Fix typo in zh_TW.po

git-svn-id: http://ibus-array.googlecode.com/svn/trunk@46 06f26268-b6d7-11de-ba48-051263943efc
---
 po/zh_TW.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/po/zh_TW.po b/po/zh_TW.po
index f970772..523204f 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -40,4 +40,4 @@ msgstr "當有特別碼時,顯示提示"
 
 #: setup/main.py:52
 msgid "Speical Code Only Mode"
-msgstr "當有特別碼時,只能用特別碼輸入 (特別碼練習模試)"
+msgstr "當有特別碼時,只能用特別碼輸入 (特別碼練習模式)"
-- 
2.1.3

Reply via email to