Updated ibus-xx-bridge-hotkey.patch

Updated transitional ibus-gnome3 package.
- Identified XKB keymaps by engines.
- Fixed Bug 726289 - no candidates with ibus-mozc.
- Triaged Bug 707370 SetEngine timeout
This commit is contained in:
Takao Fujiwara 2011-08-07 00:54:54 +09:00
parent 2ff6178f73
commit 095f9c1f6a
8 changed files with 1632 additions and 500 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ ibus-1.3.6.tar.gz
/ibus-1.3.99.20110419.tar.gz
/ibus_master_da.po
/ibus-gjs-1.3.99.20110720.tar.gz
/ibus-gjs-1.3.99.20110806.tar.gz

View File

@ -1,6 +1,6 @@
From 14986cb38f431d132332b2e8f9da1ca2b8a5d10e Mon Sep 17 00:00:00 2001
From a253acde0935efae4bbc8aa59ca47ab273b9907b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 29 Jun 2011 16:52:08 +0900
Date: Fri, 5 Aug 2011 20:22:42 +0900
Subject: [PATCH] Add XKB layouts
---
@ -12,8 +12,8 @@ Subject: [PATCH] Add XKB layouts
ibus/__init__.py | 2 +
ibus/bus.py | 3 +
ibus/interface/iibus.py | 3 +
ibus/xkblayout.py.in | 215 ++++++++++++++++
ibus/xkbxml.py.in | 413 ++++++++++++++++++++++++++++++
ibus/xkblayout.py.in | 230 +++++++++++++++++
ibus/xkbxml.py.in | 416 ++++++++++++++++++++++++++++++
setup/Makefile.am | 1 +
setup/enginecombobox.py | 7 +-
setup/main.py | 3 +
@ -21,22 +21,20 @@ Subject: [PATCH] Add XKB layouts
setup/xkbsetup.py | 454 +++++++++++++++++++++++++++++++++
src/Makefile.am | 5 +
src/ibus.h | 1 +
src/ibusfactory.c | 21 ++-
src/ibusfactory.h | 5 +-
src/ibusxkbxml.c | 440 ++++++++++++++++++++++++++++++++
src/ibusxkbxml.h | 172 +++++++++++++
ui/gtk/panel.py | 39 +++
ui/gtk/panel.py | 41 +++
xkb/Makefile.am | 104 ++++++++
xkb/ibus-engine-xkb-main.c | 397 +++++++++++++++++++++++++++++
xkb/ibus-engine-xkb-main.c | 413 ++++++++++++++++++++++++++++++
xkb/ibus-engine-xkb-main.h | 46 ++++
xkb/ibus-xkb-main.c | 112 ++++++++
xkb/xkblayout.xml.in | 16 ++
xkb/xkblayoutconfig.xml.in | 6 +
xkb/xkblib.c | 327 ++++++++++++++++++++++++
xkb/xkblib.h | 41 +++
xkb/xkbxml.c | 335 ++++++++++++++++++++++++
xkb/xkbxml.h | 110 ++++++++
32 files changed, 4008 insertions(+), 6 deletions(-)
xkb/xkbxml.c | 339 ++++++++++++++++++++++++
xkb/xkbxml.h | 113 ++++++++
30 files changed, 4027 insertions(+), 4 deletions(-)
create mode 100644 ibus/xkblayout.py.in
create mode 100644 ibus/xkbxml.py.in
create mode 100644 setup/xkbsetup.py
@ -54,7 +52,7 @@ Subject: [PATCH] Add XKB layouts
create mode 100644 xkb/xkbxml.h
diff --git a/Makefile.am b/Makefile.am
index 7be558b..59fbabb 100644
index ff0fabc..056ddfc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,12 @@ DAEMON_DIRS = \
@ -79,7 +77,7 @@ index 7be558b..59fbabb 100644
$(NULL)
diff --git a/configure.ac b/configure.ac
index 5544dfa..85e5e30 100644
index c3bd423..4c20ae7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,60 @@ else
@ -143,7 +141,7 @@ index 5544dfa..85e5e30 100644
# GObject introspection
GOBJECT_INTROSPECTION_CHECK([0.6.8])
@@ -430,6 +484,7 @@ gconf/Makefile
@@ -451,6 +505,7 @@ bindings/Makefile
gconf/gconf.xml.in
bindings/Makefile
bindings/vala/Makefile
@ -151,7 +149,7 @@ index 5544dfa..85e5e30 100644
])
AC_OUTPUT
@@ -445,6 +500,7 @@ Build options:
@@ -466,6 +521,7 @@ Build options:
Build gtk2 immodule $enable_gtk2
Build gtk3 immodule $enable_gtk3
Build XIM agent server $enable_xim
@ -160,10 +158,10 @@ index 5544dfa..85e5e30 100644
Build gconf modules $enable_gconf
Build memconf modules $enable_memconf
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index b75295e..7ca4899 100644
index 663358c..8979515 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -190,6 +190,42 @@
@@ -191,6 +191,42 @@
</locale>
</schema>
<schema>
@ -303,10 +301,10 @@ index 678d517..7de56fc 100644
diff --git a/ibus/xkblayout.py.in b/ibus/xkblayout.py.in
new file mode 100644
index 0000000..4cb3ffd
index 0000000..11fce12
--- /dev/null
+++ b/ibus/xkblayout.py.in
@@ -0,0 +1,215 @@
@@ -0,0 +1,230 @@
+# vim:set et sts=4 sw=4:
+#
+# ibus - The Input Bus
@ -331,7 +329,7 @@ index 0000000..4cb3ffd
+# Boston, MA 02111-1307 USA
+
+__all__ = (
+ "XKBLayout",
+ 'XKBLayout',
+ )
+
+import os, sys, time
@ -354,8 +352,8 @@ index 0000000..4cb3ffd
+ self.__time_lag_session_xkb_timer = time.time()
+ self.__xkb_latin_layouts = []
+ if config != None:
+ self.__xkb_latin_layouts = list(self.__config.get_value("general",
+ "xkb_latin_layouts",
+ self.__xkb_latin_layouts = list(self.__config.get_value('general',
+ 'xkb_latin_layouts',
+ []))
+
+
@ -363,12 +361,20 @@ index 0000000..4cb3ffd
+ left_bracket = layout.find('(')
+ right_bracket = layout.find(')')
+ if left_bracket >= 0 and right_bracket > left_bracket:
+ return (layout[:left_bracket], \
+ return (layout[:left_bracket] + layout[right_bracket + 1:], \
+ layout[left_bracket + 1:right_bracket])
+ return (layout, "default")
+ return (layout, 'default')
+
+ def __get_option_from_layout(self, layout):
+ left_bracket = layout.find('[')
+ right_bracket = layout.find(']')
+ if left_bracket >= 0 and right_bracket > left_bracket:
+ return (layout[:left_bracket] + layout[right_bracket + 1:], \
+ layout[left_bracket + 1:right_bracket])
+ return (layout, 'default')
+
+ def __get_output_from_cmdline(self, arg, string):
+ exec_command = "%s %s" % (self.__command, arg)
+ exec_command = '%s %s' % (self.__command, arg)
+ retval = None
+ for line in os.popen(exec_command).readlines():
+ line = line.strip()
@ -385,24 +391,24 @@ index 0000000..4cb3ffd
+ def get_layout(self):
+ if not self.__use_xkb:
+ return None
+ return self.__get_output_from_cmdline("--get", "layout: ")
+ return self.__get_output_from_cmdline('--get', 'layout: ')
+
+ def get_model(self):
+ if not self.__use_xkb:
+ return None
+ return self.__get_output_from_cmdline("--get", "model: ")
+ return self.__get_output_from_cmdline('--get', 'model: ')
+
+ def get_option(self):
+ if not self.__use_xkb:
+ return None
+ return self.__get_output_from_cmdline("--get", "option: ")
+ return self.__get_output_from_cmdline('--get', 'option: ')
+
+ def get_group(self):
+ if not self.__use_xkb:
+ return 0
+ return int(self.__get_output_from_cmdline("--get-group", "group: "))
+ return int(self.__get_output_from_cmdline('--get-group', 'group: '))
+
+ def set_layout(self, layout="default", model="default", option="default"):
+ def set_layout(self, layout='default', model='default', option='default'):
+ if not self.__use_xkb:
+ return
+ if layout == None:
@ -427,24 +433,31 @@ index 0000000..4cb3ffd
+ > XKB_SESSION_TIME_OUT):
+ self.__time_lag_session_xkb_layout = False
+ self.__time_lag_session_xkb_option = False
+ if layout == "default":
+ if layout == 'default':
+ layout = self.__default_layout
+ else:
+ self.__time_lag_session_xkb_layout = False
+ if model != None:
+ model = str(model)
+ if model == "default":
+ if model == 'default':
+ (layout, model) = self.__get_model_from_layout(layout)
+ if model == "default":
+ if model == 'default':
+ model = self.__default_model
+ else:
+ self.__time_lag_session_xkb_layout = False
+ if option != None:
+ option = str(option)
+ if option == "default":
+ if option == 'default':
+ (layout, engine_option) = self.__get_option_from_layout(layout)
+ if engine_option != None and engine_option != 'default':
+ option = self.__default_option
+ if option == None:
+ option = engine_option
+ else:
+ option = '%s,%s' % (option, engine_option)
+ self.__time_lag_session_xkb_option = False
+ if option == 'default':
+ option = self.__default_option
+ else:
+ self.__time_lag_session_xkb_option = False
+ need_us_layout = False
+ for latin_layout in self.__xkb_latin_layouts:
+ latin_layout = str(latin_layout)
@ -455,9 +468,9 @@ index 0000000..4cb3ffd
+ need_us_layout = True
+ break
+ if need_us_layout:
+ layout = layout + ",us"
+ layout = layout + ',us'
+ if model != None:
+ model = model + ","
+ model = model + ','
+ if layout == self.get_layout() and \
+ model == self.get_model() and \
+ option == self.get_option():
@ -465,25 +478,25 @@ index 0000000..4cb3ffd
+ args = []
+ args.append(self.__command)
+ args.append(os.path.basename(self.__command))
+ args.append("--layout")
+ args.append('--layout')
+ args.append(layout)
+ if model != None:
+ args.append("--model")
+ args.append('--model')
+ args.append(model)
+ if option != None:
+ args.append("--option")
+ args.append('--option')
+ args.append(option)
+ pid = os.spawnl(os.P_NOWAIT, *args)
+ os.waitpid(pid, 0)
+
+ def set_default_layout(self, layout="default", model="default"):
+ def set_default_layout(self, layout='default', model='default'):
+ if not self.__use_xkb:
+ return
+ if layout == None:
+ print >> sys.stderr, "ibus.xkblayout: None layout"
+ print >> sys.stderr, 'ibus.xkblayout: None layout'
+ return
+ if model == None:
+ print >> sys.stderr, "ibus.xkblayout: None model"
+ print >> sys.stderr, 'ibus.xkblayout: None model'
+ return
+ if layout == 'default':
+ self.__default_layout = self.get_layout()
@ -498,11 +511,11 @@ index 0000000..4cb3ffd
+ else:
+ self.__default_model = model
+
+ def set_default_option(self, option="default"):
+ def set_default_option(self, option='default'):
+ if not self.__use_xkb:
+ return
+ if option == None:
+ print >> sys.stderr, "ibus.xkblayout: None option"
+ print >> sys.stderr, 'ibus.xkblayout: None option'
+ return
+ if option == 'default':
+ self.__default_option = self.get_option()
@ -524,10 +537,10 @@ index 0000000..4cb3ffd
+ self.__default_option = self.get_option()
diff --git a/ibus/xkbxml.py.in b/ibus/xkbxml.py.in
new file mode 100644
index 0000000..7e5a44e
index 0000000..16f47df
--- /dev/null
+++ b/ibus/xkbxml.py.in
@@ -0,0 +1,413 @@
@@ -0,0 +1,416 @@
+# vim:set et sts=4 sw=4:
+#
+# ibus - The Input Bus
@ -552,8 +565,8 @@ index 0000000..7e5a44e
+# Boston, MA 02111-1307 USA
+
+__all__ = (
+ "XKBConfigRegistry",
+ "XKBLayoutConfig",
+ 'XKBConfigRegistry',
+ 'XKBLayoutConfig',
+ )
+
+import os
@ -569,7 +582,7 @@ index 0000000..7e5a44e
+except ImportError:
+ get_user_config_dir = lambda : None
+
+XKB_RULES_XML_FILE = "@XKB_RULES_XML_FILE@"
+XKB_RULES_XML_FILE = '@XKB_RULES_XML_FILE@'
+
+class XKBConfigRegistryHandler(XMLFilterBase):
+ def __init__(self, parser=None, root='root'):
@ -599,18 +612,18 @@ index 0000000..7e5a44e
+ if not self.__layout:
+ return
+ if self.__variant:
+ if self.__current_node == "name":
+ if self.__current_node == 'name':
+ self.__variant_label = text
+ if self.__layout_label != None and \
+ self.__layout_label in self.__layoutlist_array:
+ self.__layoutlist_array[self.__layout_label].append(text)
+ elif self.__current_node == "description":
+ label = "%s(%s)" % (self.__layout_label, self.__variant_label)
+ elif self.__current_node == 'description':
+ label = '%s(%s)' % (self.__layout_label, self.__variant_label)
+ self.__variant_desc[label] = text
+ elif self.__current_node == "iso639Id":
+ elif self.__current_node == 'iso639Id':
+ label = self.__layout_label
+ if label != None:
+ label = "%s(%s)" % (label, self.__variant_label)
+ label = '%s(%s)' % (label, self.__variant_label)
+ else:
+ label = self.__variant_label
+ if label not in self.__layout_lang:
@ -619,12 +632,12 @@ index 0000000..7e5a44e
+ else:
+ pass
+ else:
+ if self.__current_node == "name":
+ if self.__current_node == 'name':
+ self.__layout_label = text
+ self.__layoutlist_array[self.__layout_label] = []
+ elif self.__current_node == "description":
+ elif self.__current_node == 'description':
+ self.__layout_desc[self.__layout_label] = text
+ elif self.__current_node == "iso639Id":
+ elif self.__current_node == 'iso639Id':
+ if self.__layout_label not in self.__layout_lang:
+ self.__layout_lang[self.__layout_label] = []
+ self.__layout_lang[self.__layout_label].append(text)
@ -635,60 +648,60 @@ index 0000000..7e5a44e
+ if not self.__group:
+ return
+ if self.__option:
+ if self.__current_node == "name":
+ if self.__current_node == 'name':
+ self.__option_label = text
+ if self.__group_label != None and \
+ self.__group_label in self.__optionlist_array:
+ self.__optionlist_array[self.__group_label].append(text)
+ elif self.__current_node == "description":
+ elif self.__current_node == 'description':
+ self.__option_desc[self.__option_label] = text
+ else:
+ pass
+ else:
+ if self.__current_node == "name":
+ if self.__current_node == 'name':
+ self.__group_label = text
+ self.__optionlist_array[self.__group_label] = []
+ elif self.__current_node == "description":
+ elif self.__current_node == 'description':
+ self.__option_group_desc[self.__group_label] = text
+ else:
+ pass
+
+ def startElement(self, name, attrs):
+ self.__current_node = name
+ if name == "layoutList":
+ if name == 'layoutList':
+ self.__layoutlist = True
+ elif name == "layout":
+ elif name == 'layout':
+ self.__layout = True
+ self.__layout_label = None
+ elif name == "variantList":
+ elif name == 'variantList':
+ self.__variantlist = True
+ elif name == "variant":
+ elif name == 'variant':
+ self.__variant = True
+ self.__variant_label = None
+ elif name == "optionList":
+ elif name == 'optionList':
+ self.__optionlist = True
+ elif name == "option":
+ elif name == 'option':
+ self.__option = True
+ self.__option_label = None
+ elif name == "group":
+ elif name == 'group':
+ self.__group = True
+ self.__group_label = None
+
+ def endElement(self, name):
+ self.__current_node = self.__root
+ if name == "layoutList":
+ if name == 'layoutList':
+ self.__layoutlist = False
+ elif name == "layout":
+ elif name == 'layout':
+ self.__layout = False
+ elif name == "variantList":
+ elif name == 'variantList':
+ self.__variantlist = False
+ elif name == "variant":
+ elif name == 'variant':
+ self.__variant = False
+ elif name == "optionList":
+ elif name == 'optionList':
+ self.__optionlist = False
+ elif name == "option":
+ elif name == 'option':
+ self.__option = False
+ elif name == "group":
+ elif name == 'group':
+ self.__group = False
+
+ def characters(self, text):
@ -744,18 +757,18 @@ index 0000000..7e5a44e
+
+ def startElement(self, name, attrs):
+ self.__current_node = name
+ if name == "xkblayout":
+ if name == 'xkblayout':
+ self.__xkblayout = True
+ if name == "config":
+ if name == 'config':
+ self.__config = True
+ if self.__downstream != None:
+ self.__downstream.startElement(name, {})
+
+ def endElement(self, name):
+ self.__current_node = self.__root
+ if name == "xkblayout":
+ if name == 'xkblayout':
+ self.__xkblayout = False
+ if name == "config":
+ if name == 'config':
+ self.__config = False
+ if self.__downstream != None:
+ self.__downstream.endElement(name)
@ -765,7 +778,7 @@ index 0000000..7e5a44e
+ return
+ if not self.__xkblayout or not self.__config:
+ return
+ if self.__current_node == "preload_layouts":
+ if self.__current_node == 'preload_layouts':
+ if self.__preload_layouts == None:
+ self.__preload_layouts = text.split(',')
+ self.__preload_layouts.sort()
@ -787,7 +800,7 @@ index 0000000..7e5a44e
+ try:
+ parser.parse(f)
+ except SAXParseException:
+ print "ERROR: invalid file format", file_path
+ print 'ERROR: invalid file format', file_path
+ finally:
+ f.close()
+
@ -822,39 +835,42 @@ index 0000000..7e5a44e
+ layout,
+ layout_desc=None,
+ variant=None,
+ variant_desc=None):
+ variant_desc=None,
+ name_prefix='xkb:layout:'):
+ if variant_desc != None:
+ longname = variant_desc
+ elif layout != None and variant != None:
+ longname = layout + " - " + variant
+ longname = layout + ' - ' + variant
+ elif layout_desc != None:
+ longname = layout_desc
+ else:
+ longname = layout
+ if variant != None:
+ name = "xkb:layout:" + layout + ":" + variant
+ desc = "XKB " + layout + "(" + variant + ") keyboard layout"
+ engine_layout = layout + "(" + variant + ")"
+ name = name_prefix + layout + ':' + variant
+ desc = 'XKB ' + layout + '(' + variant + ') keyboard layout'
+ engine_layout = layout + '(' + variant + ')'
+ else:
+ name = "xkb:layout:" + layout
+ desc = "XKB " + layout + " keyboard layout"
+ name = name_prefix + layout
+ desc = 'XKB ' + layout + ' keyboard layout'
+ engine_layout = layout
+
+ icon = 'ibus-engine'
+
+ engine = enginedesc.EngineDesc(name, longname, desc, lang,
+ "LGPL2.1",
+ "Takao Fujiwara <takao.fujiwara1@gmail.com>",
+ "ibus-engine",
+ 'LGPL2.1',
+ 'Takao Fujiwara <takao.fujiwara1@gmail.com>',
+ icon,
+ engine_layout)
+ return engine
+
+class XKBLayoutConfig():
+ def __init__(self,
+ system_config="@datadir@/ibus/xkb/xkblayoutconfig.xml"):
+ system_config='@datadir@/ibus/xkb/xkblayoutconfig.xml'):
+ self.__user_config = get_user_config_dir()
+ if self.__user_config == None:
+ self.__user_config = os.environ['HOME'] + "/.config"
+ self.__user_config = os.environ['HOME'] + '/.config'
+ self.__user_config = self.__user_config + \
+ "/ibus/xkb/xkblayoutconfig.xml"
+ '/ibus/xkb/xkblayoutconfig.xml'
+ self.__system_config = system_config
+ self.__filter_handler = None
+ self.__load()
@ -876,7 +892,7 @@ index 0000000..7e5a44e
+ try:
+ parser.parse(f)
+ except SAXParseException:
+ print "ERROR: invalid file format", self.__user_config
+ print 'ERROR: invalid file format', self.__user_config
+ finally:
+ f.close()
+
@ -910,35 +926,35 @@ index 0000000..7e5a44e
+ variant_desc = xkbconfig.get_variant_desc()
+ for layout in layout_list.keys():
+ if layout not in layout_lang:
+ print "layout name:", layout, "NO-LANG description:", layout_desc[layout]
+ print 'layout name:', layout, 'NO-LANG description:', layout_desc[layout]
+ continue
+ lang = layout_lang[layout]
+ print "layout name:", layout, "lang:", lang, "description:", layout_desc[layout]
+ print 'layout name:', layout, 'lang:', lang, 'description:', layout_desc[layout]
+ for variant in layout_list[layout]:
+ label = "%s(%s)" % (layout, variant)
+ label = '%s(%s)' % (layout, variant)
+ if label in layout_lang:
+ lang = layout_lang[label]
+ print " variant name:", variant, "lang:", lang, "description:", variant_desc[variant]
+ print ' variant name:', variant, 'lang:', lang, 'description:', variant_desc[variant]
+
+ option_list = xkbconfig.get_option_list()
+ option_group_desc = xkbconfig.get_option_group_desc()
+ option_desc = xkbconfig.get_option_desc()
+ for option_group in option_list.keys():
+ print "option group name:", option_group, "description:", option_group_desc[option_group]
+ print 'option group name:', option_group, 'description:', option_group_desc[option_group]
+ for option in option_list[option_group]:
+ print " option name:", option, "description:", option_desc[option]
+ print ' option name:', option, 'description:', option_desc[option]
+
+def test2():
+ xkblayoutconfig = XKBLayoutConfig("../xkb/xkblayoutconfig.xml")
+ xkblayoutconfig = XKBLayoutConfig('../xkb/xkblayoutconfig.xml')
+ list = xkblayoutconfig.get_preload_layouts()
+ print list
+ if list == None:
+ list = []
+ list.append("gb(test)")
+ list.append('gb(test)')
+ list.sort()
+ #xkblayoutconfig.save_preload_layouts(list)
+
+if __name__ == "__main__":
+if __name__ == '__main__':
+ test()
+ test2()
diff --git a/setup/Makefile.am b/setup/Makefile.am
@ -2146,86 +2162,6 @@ index c408f3d..6bb9ff5 100644
#include <ibusxml.h>
#include <ibusenginedesc.h>
#include <ibusobservedpath.h>
diff --git a/src/ibusfactory.c b/src/ibusfactory.c
index 11d9a6d..7770216 100644
--- a/src/ibusfactory.c
+++ b/src/ibusfactory.c
@@ -21,6 +21,7 @@
*/
#include "ibusfactory.h"
#include "ibusengine.h"
+#include "ibusmarshalers.h"
#include "ibusshare.h"
#include "ibusinternal.h"
@@ -28,6 +29,7 @@
(G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_FACTORY, IBusFactoryPrivate))
enum {
+ LOOKUP_ENGINE_NAME,
LAST_SIGNAL,
};
@@ -42,6 +44,8 @@ struct _IBusFactoryPrivate {
GHashTable *engine_table;
};
+static guint factory_signals[LAST_SIGNAL] = { 0 };
+
/* functions prototype */
static void ibus_factory_destroy (IBusFactory *factory);
static void ibus_factory_set_property (IBusFactory *engine,
@@ -113,6 +117,17 @@ ibus_factory_class_init (IBusFactoryClass *class)
ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
g_type_class_add_private (class, sizeof (IBusFactoryPrivate));
+
+ factory_signals[LOOKUP_ENGINE_NAME] =
+ g_signal_new (I_("lookup-engine-name"),
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IBusFactoryClass, lookup_engine_name),
+ NULL, NULL,
+ _ibus_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
}
static void
@@ -190,8 +205,12 @@ ibus_factory_service_method_call (IBusService *service,
if (g_strcmp0 (method_name, "CreateEngine") == 0) {
gchar *engine_name = NULL;
+ GType engine_type;
+
g_variant_get (parameters, "(&s)", &engine_name);
- GType engine_type = (GType )g_hash_table_lookup (factory->priv->engine_table, engine_name);
+ g_signal_emit (factory, factory_signals[LOOKUP_ENGINE_NAME],
+ 0, engine_name);
+ engine_type = (GType) g_hash_table_lookup (factory->priv->engine_table, engine_name);
if (engine_type == G_TYPE_INVALID) {
gchar *error_message = g_strdup_printf ("Can not fond engine %s", engine_name);
diff --git a/src/ibusfactory.h b/src/ibusfactory.h
index 47c06e0..102081c 100644
--- a/src/ibusfactory.h
+++ b/src/ibusfactory.h
@@ -127,10 +127,13 @@ struct _IBusFactoryClass {
IBusServiceClass parent;
/* signals */
+ void (* lookup_engine_name)
+ (IBusFactory *factory,
+ const gchar *engine_name);
/*< private >*/
/* padding */
- gpointer pdummy[8];
+ gpointer pdummy[7];
};
/**
diff --git a/src/ibusxkbxml.c b/src/ibusxkbxml.c
new file mode 100644
index 0000000..c630eb9
@ -2851,7 +2787,7 @@ index 0000000..6986b5c
+G_END_DECLS
+#endif
diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py
index 90be1d5..de64920 100644
index 90be1d5..8804634 100644
--- a/ui/gtk/panel.py
+++ b/ui/gtk/panel.py
@@ -132,6 +132,22 @@ class Panel(ibus.PanelBase):
@ -2928,7 +2864,7 @@ index 90be1d5..de64920 100644
def reset(self):
@@ -542,3 +572,12 @@ class Panel(ibus.PanelBase):
@@ -542,3 +572,14 @@ class Panel(ibus.PanelBase):
flags=glib.SPAWN_DO_NOT_REAP_CHILD)[0]
self.__setup_pid = pid
glib.child_watch_add(self.__setup_pid, self.__child_watch_cb)
@ -2939,6 +2875,8 @@ index 90be1d5..de64920 100644
+ # to "default" layout?
+ if engine.name != None and engine.name.startswith("xkb:layout:"):
+ return engine.layout
+ elif engine.layout != None and engine.layout.startswith("default"):
+ return engine.layout
+ else:
+ return "default"
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
@ -3053,10 +2991,10 @@ index 0000000..ad9cdd9
+endif
diff --git a/xkb/ibus-engine-xkb-main.c b/xkb/ibus-engine-xkb-main.c
new file mode 100644
index 0000000..5d748cc
index 0000000..a2f131c
--- /dev/null
+++ b/xkb/ibus-engine-xkb-main.c
@@ -0,0 +1,397 @@
@@ -0,0 +1,413 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* vim:set et sts=4: */
+/* bus - The Input Bus
@ -3083,7 +3021,6 @@ index 0000000..5d748cc
+#include <config.h>
+#endif
+
+#include <gconf/gconf-client.h>
+#include <ibus.h>
+#include <stdlib.h>
+
@ -3210,34 +3147,48 @@ index 0000000..5d748cc
+ ibus_quit ();
+}
+
+static void
+_factory_lookup_engine_name_cb (IBusFactory *factory,
+ const gchar *engine_name,
+ gpointer data)
+IBusEngine *
+_factory_create_engine_cb (IBusFactory *factory,
+ const gchar *engine_name,
+ gpointer data)
+{
+ static GList *engine_list = NULL;
+ GList *list;
+ gboolean has_name = FALSE;
+#if 0
+ static GHashTable *engine_table = NULL;
+#endif
+ IBusEngine *engine = NULL;
+ gchar *object_path = NULL;
+ static int id = 0;
+
+ g_return_if_fail (engine_name != NULL);
+ g_return_val_if_fail (engine_name != NULL, NULL);
+
+ if (g_strcmp0 (engine_name, "xkb:layout:us") == 0) {
+ return;
+ }
+ list = engine_list;
+ while (list) {
+ if (g_strcmp0 (list->data, engine_name) == 0) {
+ has_name = TRUE;
+ break;
+ }
+ list = list->next;
+ }
+ if (has_name) {
+ return;
+ return NULL;
+ }
+
+ ibus_factory_add_engine (factory, engine_name, IBUS_TYPE_XKB_ENGINE);
+ engine_list = g_list_append (engine_list, (gpointer) g_strdup (engine_name));
+ /* FIXME: Do we always need a new object path for the same engine name? */
+#if 0
+ if (engine_table == NULL) {
+ engine_table = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+ }
+
+ if ((engine = (IBusEngine *) g_hash_table_lookup (engine_table,
+ engine_name))) {
+ return engine;
+ }
+#endif
+
+ object_path = g_strdup_printf ("/org/freedesktop/IBus/XKBEngine/%d",
+ ++id);
+ engine = ibus_engine_new (engine_name,
+ object_path,
+ ibus_service_get_connection (IBUS_SERVICE (factory)));
+#if 0
+ g_hash_table_insert (engine_table, g_strdup (engine_name), engine);
+#endif
+ return engine;
+}
+
+static void
@ -3263,14 +3214,15 @@ index 0000000..5d748cc
+ "us",
+ "USA",
+ NULL,
+ NULL,
+ NULL));
+
+ factory = ibus_factory_new (ibus_bus_get_connection (bus));
+
+ ibus_factory_add_engine (factory, "xkb:layout:us", IBUS_TYPE_XKB_ENGINE);
+
+ g_signal_connect (G_OBJECT (factory), "lookup-engine-name",
+ G_CALLBACK (_factory_lookup_engine_name_cb),
+ g_signal_connect (G_OBJECT (factory), "create-engine",
+ G_CALLBACK (_factory_create_engine_cb),
+ NULL);
+ if (ibus) {
+ ibus_bus_request_name (bus, "org.freedesktop.IBus.XKB", 0);
@ -3370,6 +3322,7 @@ index 0000000..5d748cc
+ (const gchar *) keys->data,
+ desc,
+ NULL,
+ NULL,
+ NULL);
+ ibus_component_add_engine (component, engine);
+ }
@ -3405,7 +3358,8 @@ index 0000000..5d748cc
+ (const gchar *) keys->data,
+ desc,
+ (const gchar *) variants->data,
+ (const gchar *) g_hash_table_lookup (variant_desc, variants->data));
+ (const gchar *) g_hash_table_lookup (variant_desc, variants->data),
+ NULL);
+ ibus_component_add_engine (component, engine);
+ }
+ }
@ -4040,10 +3994,10 @@ index 0000000..15e5d18
+#endif
diff --git a/xkb/xkbxml.c b/xkb/xkbxml.c
new file mode 100644
index 0000000..2ce7bcf
index 0000000..ad10c28
--- /dev/null
+++ b/xkb/xkbxml.c
@@ -0,0 +1,335 @@
@@ -0,0 +1,339 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* vim:set et sts=4: */
+/* bus - The Input Bus
@ -4312,7 +4266,8 @@ index 0000000..2ce7bcf
+ const gchar *layout,
+ const gchar *layout_desc,
+ const gchar *variant,
+ const gchar *variant_desc)
+ const gchar *variant_desc,
+ const gchar *name_prefix)
+{
+ IBusEngineDesc *engine;
+ gchar *name = NULL;
@ -4322,6 +4277,9 @@ index 0000000..2ce7bcf
+
+ g_return_val_if_fail (lang != NULL && layout != NULL, NULL);
+
+ if (name_prefix == NULL) {
+ name_prefix = "xkb:layout:";
+ }
+ if (variant_desc) {
+ longname = g_strdup (variant_desc);
+ } else if (layout && variant) {
@ -4332,11 +4290,11 @@ index 0000000..2ce7bcf
+ longname = g_strdup (layout);
+ }
+ if (variant) {
+ name = g_strdup_printf ("xkb:layout:%s:%s", layout, variant);
+ name = g_strdup_printf ("%s%s:%s", name_prefix, layout, variant);
+ desc = g_strdup_printf ("XKB %s(%s) keyboard layout", layout, variant);
+ engine_layout = g_strdup_printf ("%s(%s)", layout, variant);
+ } else {
+ name = g_strdup_printf ("xkb:layout:%s", layout);
+ name = g_strdup_printf ("%s%s", name_prefix, layout);
+ desc = g_strdup_printf ("XKB %s keyboard layout", layout);
+ engine_layout = g_strdup (layout);
+ }
@ -4381,10 +4339,10 @@ index 0000000..2ce7bcf
+}
diff --git a/xkb/xkbxml.h b/xkb/xkbxml.h
new file mode 100644
index 0000000..56811ef
index 0000000..6c00f1d
--- /dev/null
+++ b/xkb/xkbxml.h
@@ -0,0 +1,110 @@
@@ -0,0 +1,113 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* vim:set et sts=4: */
+/* bus - The Input Bus
@ -4462,6 +4420,8 @@ index 0000000..56811ef
+ * @layout_desc: Keyboard layout description for engine description
+ * @variant: Keyboard variant
+ * @variant_desc: Keyboard variant description for engine description
+ * @name_prefix: Name prefix for engine description, If NULL,
+ * the default is "xkb:layout:".
+ * @returns: A newly allocated IBusEngineDesc.
+ *
+ * New a IBusEngineDesc.
@ -4470,7 +4430,8 @@ index 0000000..56811ef
+ const gchar *layout,
+ const gchar *layout_desc,
+ const gchar *variant,
+ const gchar *variant_desc);
+ const gchar *variant_desc,
+ const gchar *name_prefix);
+
+GType ibus_xkb_layout_config_get_type (void);
+

View File

@ -1066,3 +1066,272 @@ index 1567c5f..2164e7c 100644
--
1.7.5.4
From 624c4451da2bd171bd8ac53a9b9dd2a4227ef67f Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Thu, 7 Jul 2011 12:42:52 -0400
Subject: [PATCH] Fix several GVariant related issues. And remove a wrong
unref.
BUG=None
TEST=Linux desktop
Review URL: http://codereview.appspot.com/4667067
---
bus/ibusimpl.c | 11 +++++------
bus/inputcontext.c | 1 -
src/ibusconfig.c | 8 ++------
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index b356b2c..42afeec 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -2183,8 +2183,8 @@ bus_ibus_impl_save_global_engine_name_to_config (BusIBusImpl *ibus)
ibus->use_global_engine &&
ibus->global_engine_name) {
ibus_config_set_value (ibus->config,
- "general", "global_engine",
- g_variant_new ("s", ibus->global_engine_name));
+ "general", "global_engine",
+ g_variant_new_string (ibus->global_engine_name));
}
}
@@ -2206,8 +2206,7 @@ bus_ibus_impl_load_global_previous_engine_name_from_config (BusIBusImpl *ibus)
GVariant *value = ibus_config_get_value (ibus->config, "general", "global_previous_engine");
if (value == NULL)
return NULL;
- gchar *engine_name = NULL;
- g_variant_get (value, "(s)", &engine_name);
+ gchar *engine_name = g_variant_dup_string (value, NULL);
g_variant_unref (value);
return engine_name;
}
@@ -2226,8 +2225,8 @@ bus_ibus_impl_save_global_previous_engine_name_to_config (BusIBusImpl *ibus)
ibus->use_global_engine &&
ibus->global_previous_engine_name) {
ibus_config_set_value (ibus->config,
- "general", "global_previous_engine",
- g_variant_new ("s", ibus->global_previous_engine_name));
+ "general", "global_previous_engine",
+ g_variant_new_string (ibus->global_previous_engine_name));
}
}
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
index 2164e7c..47ac9d5 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
@@ -1171,7 +1171,6 @@ bus_input_context_focus_in (BusInputContext *context)
NULL, /* we do not cancel the call. */
NULL, /* use the default callback function. */
NULL);
- g_object_unref (desc);
}
}
diff --git a/src/ibusconfig.c b/src/ibusconfig.c
index 36ef44b..b691277 100644
--- a/src/ibusconfig.c
+++ b/src/ibusconfig.c
@@ -191,7 +191,6 @@ ibus_config_get_value (IBusConfig *conf
GVariant *value = NULL;
g_variant_get (result, "(v)", &value);
- g_variant_ref (value);
g_variant_unref (result);
return value;
@@ -235,7 +234,6 @@ ibus_config_get_value_async_finish (IBus
error);
if (retval != NULL) {
g_variant_get (retval, "(v)", &value);
- g_variant_ref (value);
g_variant_unref (retval);
}
--
1.7.5.4
From 55a5652ac7d91fb319ef6576500e421eb53e80f4 Mon Sep 17 00:00:00 2001
From: Yusuke Sato <yusukes@chromium.org>
Date: Mon, 11 Jul 2011 11:55:19 +0900
Subject: [PATCH] Remove the callback on destroy.
BUG=crosbug.com/17293
TEST=src/tests/ibus-bus.c
Review URL: http://codereview.appspot.com/4675074
---
src/ibusbus.c | 4 ++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/ibusbus.c b/src/ibusbus.c
index 39ad784..2607448 100644
--- a/src/ibusbus.c
+++ b/src/ibusbus.c
@@ -398,8 +398,12 @@ ibus_bus_destroy (IBusObject *object)
}
if (bus->priv->connection) {
+ g_signal_handlers_disconnect_by_func (bus->priv->connection,
+ G_CALLBACK (_connection_closed_cb),
+ bus);
/* FIXME should use async close function */
g_dbus_connection_close_sync (bus->priv->connection, NULL, NULL);
+ g_object_unref (bus->priv->connection);
bus->priv->connection = NULL;
}
--
1.7.5.4
From 290a37e1d4e3ec44dfea4b99744520f781c92592 Mon Sep 17 00:00:00 2001
From: Yusuke Sato <yusukes@chromium.org>
Date: Tue, 12 Jul 2011 14:04:30 +0900
Subject: [PATCH] Use g_variant_dup_string for consistency.
This fix is similar to https://github.com/ibus/ibus/commit/624c4451da2bd171bd8ac53a9b9dd2a4227ef67f .
BUG=None
TEST=None
Review URL: http://codereview.appspot.com/4641101
---
bus/ibusimpl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 42afeec..b6b2441 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -2163,7 +2163,7 @@ bus_ibus_impl_load_global_engine_name_from_config (BusIBusImpl *ibus)
GVariant *variant = ibus_config_get_value (ibus->config, "general", "global_engine");
gchar *engine_name = NULL;
if (variant != NULL) {
- g_variant_get (variant, "s", &engine_name);
+ engine_name = g_variant_dup_string (variant, NULL);
g_variant_unref (variant);
}
return engine_name;
--
1.7.5.4
From 48cc200d7dbe999f92b05507a7c59bea42ac6f1c Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 12 Jul 2011 15:14:59 +0900
Subject: [PATCH] Fixed an error in IBus.Bus.register_component
TEST=Linux desktop
Review URL: http://codereview.appspot.com/4668060
---
ibus/component.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ibus/component.py b/ibus/component.py
index 12f593d..7255ee1 100644
--- a/ibus/component.py
+++ b/ibus/component.py
@@ -94,6 +94,11 @@ class Component(Serializable):
engine = EngineDesc(name, longname, description, language, license, author, icon, layout, hotkeys)
self.__engines.append(engine)
+ def add_engines(self, engines):
+ if not isinstance(engines, list):
+ raise TypeError("engines must be an instance of list")
+ self.__engines.extend(engines)
+
def serialize(self, struct):
super(Component, self).serialize(struct)
struct.append (dbus.String(self.__name))
@@ -106,8 +111,6 @@ class Component(Serializable):
struct.append (dbus.String(self.__textdomain))
struct.append (dbus.Array(map(serialize_object,self.__observed_paths), signature="v"))
struct.append (dbus.Array(map(serialize_object,self.__engines), signature="v"))
- # New properties of Component will use dict for serialize
- struct.append(dbus.Array({}, signature=None))
def deserialize(self, struct):
super(Component, self).deserialize(struct)
@@ -123,8 +126,6 @@ class Component(Serializable):
self.__observed_paths = map(deserialize_object, struct.pop(0))
self.__engines = map(deserialize_object, struct.pop(0))
- # New properties of Component will use dict for serialize
- #value = struct.pop(0)
def test():
text = Component("Hello", "", "", "", "", "", "", "")
--
1.7.5.4
From 88a44759ce5d3d785c7be96525130c67e8c63e1e Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Fri, 15 Jul 2011 09:51:07 +0900
Subject: [PATCH] Fix GObject ref/unref issues.
BUG=none
TEST=manual
Review URL: http://codereview.appspot.com/4700048
---
bus/registry.c | 5 +++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bus/registry.c b/bus/registry.c
index bc6680d..7b74781 100644
--- a/bus/registry.c
+++ b/bus/registry.c
@@ -424,7 +424,9 @@ bus_registry_load_in_dir (BusRegistry *registry,
if (component != NULL) {
BusComponent *buscomp = bus_component_new (component,
NULL /* factory */);
- registry->components = g_list_append (registry->components, buscomp);
+ g_object_ref_sink (buscomp);
+ registry->components =
+ g_list_append (registry->components, buscomp);
}
g_free (path);
@@ -654,7 +656,6 @@ bus_registry_name_owner_changed (BusRegistry *registry,
factory = bus_factory_proxy_new (connection);
if (factory == NULL)
return;
- g_object_ref_sink (factory);
bus_component_set_factory (component, factory);
g_object_unref (factory);
}
--
1.7.5.4
From 0cb912cfe5664714e612206d955d458532adc707 Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Sat, 23 Jul 2011 09:23:41 +0800
Subject: [PATCH] Always enable the new focused BusInputContext
BUG=http://crosbug.com/17013
TEST=On ChromeOS
Review URL: http://codereview.appspot.com/4816047
---
bus/ibusimpl.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index b6b2441..853465c 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -1203,8 +1203,7 @@ bus_ibus_impl_set_focused_context (BusIBusImpl *ibus,
/* attach engine to the focused context */
if (engine != NULL) {
bus_input_context_set_engine (context, engine);
- if (bus_engine_proxy_is_enabled (engine))
- bus_input_context_enable (context);
+ bus_input_context_enable (context);
g_object_unref (engine);
}
--
1.7.5.4

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
From ff5db39a4651f4ecd3c2ba19dd315ed7b83662f4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 5 Aug 2011 20:21:14 +0900
Subject: [PATCH] Add create-engine signal in IBusFactory for non-C
applications.
---
bus/ibusimpl.c | 6 +++-
bus/inputcontext.c | 5 ++++
src/ibusfactory.c | 54 ++++++++++++++++++++++++++++++++++++++++-------
src/ibusfactory.h | 7 +++++-
src/ibusmarshalers.list | 1 +
src/ibusservice.h | 5 +--
6 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 853465c..f13d8e0 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -1604,8 +1604,10 @@ _ibus_register_component (BusIBusImpl *ibus,
g_object_ref_sink (buscomp));
GList *engines = bus_component_get_engines (buscomp);
g_list_foreach (engines, (GFunc) g_object_ref, NULL);
- ibus->register_engine_list = g_list_concat (ibus->register_engine_list,
- engines);
+ /* We always override the register_engine_list or need to prepare
+ * unregister_component() method so that both ibus gtk and gnome-shell
+ * can call register_component. */
+ ibus->register_engine_list = engines;
g_signal_connect (buscomp, "destroy", G_CALLBACK (_component_destroy_cb), ibus);
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
index 47ac9d5..4e8cdc5 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
@@ -2285,6 +2285,11 @@ new_engine_cb (GObject *obj,
"Opertation was cancelled");
}
else {
+ if (data->context->engine != NULL) {
+ /* Send a Disabled signal. */
+ bus_input_context_unset_engine (data->context);
+ bus_input_context_disable (data->context);
+ }
bus_input_context_set_engine (data->context, engine);
g_object_unref (engine);
bus_input_context_enable (data->context);
diff --git a/src/ibusfactory.c b/src/ibusfactory.c
index 11d9a6d..f72f51e 100644
--- a/src/ibusfactory.c
+++ b/src/ibusfactory.c
@@ -21,6 +21,7 @@
*/
#include "ibusfactory.h"
#include "ibusengine.h"
+#include "ibusmarshalers.h"
#include "ibusshare.h"
#include "ibusinternal.h"
@@ -28,6 +29,7 @@
(G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_TYPE_FACTORY, IBusFactoryPrivate))
enum {
+ CREATE_ENGINE,
LAST_SIGNAL,
};
@@ -42,6 +44,8 @@ struct _IBusFactoryPrivate {
GHashTable *engine_table;
};
+static guint factory_signals[LAST_SIGNAL] = { 0 };
+
/* functions prototype */
static void ibus_factory_destroy (IBusFactory *factory);
static void ibus_factory_set_property (IBusFactory *engine,
@@ -113,6 +117,17 @@ ibus_factory_class_init (IBusFactoryClass *class)
ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
g_type_class_add_private (class, sizeof (IBusFactoryPrivate));
+
+ factory_signals[CREATE_ENGINE] =
+ g_signal_new (I_("create-engine"),
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IBusFactoryClass, create_engine),
+ NULL, NULL,
+ _ibus_marshal_OBJECT__STRING,
+ IBUS_TYPE_ENGINE,
+ 1,
+ G_TYPE_STRING);
}
static void
@@ -190,8 +205,20 @@ ibus_factory_service_method_call (IBusService *service,
if (g_strcmp0 (method_name, "CreateEngine") == 0) {
gchar *engine_name = NULL;
+ GType engine_type;
+ IBusEngine *engine = NULL;
+
g_variant_get (parameters, "(&s)", &engine_name);
- GType engine_type = (GType )g_hash_table_lookup (factory->priv->engine_table, engine_name);
+ engine_type = (GType) g_hash_table_lookup (factory->priv->engine_table, engine_name);
+
+ if (engine_type == G_TYPE_INVALID) {
+ g_signal_emit (factory, factory_signals[CREATE_ENGINE],
+ 0, engine_name, &engine);
+
+ if (engine != NULL && IBUS_IS_ENGINE (engine)) {
+ engine_type = G_OBJECT_TYPE (engine);
+ }
+ }
if (engine_type == G_TYPE_INVALID) {
gchar *error_message = g_strdup_printf ("Can not fond engine %s", engine_name);
@@ -201,14 +228,25 @@ ibus_factory_service_method_call (IBusService *service,
error_message);
g_free (error_message);
}
- else {
- gchar *object_path = g_strdup_printf ("/org/freedesktop/IBus/Engine/%d",
- ++factory->priv->id);
- IBusEngine *engine = ibus_engine_new_type (engine_type,
- engine_name,
- object_path,
- ibus_service_get_connection ((IBusService *)factory));
+ else {
+ gchar *object_path = NULL;
+ if (engine == NULL) {
+ object_path = g_strdup_printf ("/org/freedesktop/IBus/Engine/%d",
+ ++factory->priv->id);
+ engine = ibus_engine_new_type (engine_type,
+ engine_name,
+ object_path,
+ ibus_service_get_connection ((IBusService *)factory));
+ } else {
+ GValue value = { 0, };
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (engine), "object-path", &value);
+ object_path = g_value_dup_string (&value);
+ g_value_unset (&value);
+ }
+
g_assert (engine != NULL);
+ g_assert (object_path != NULL);
g_object_ref_sink (engine);
factory->priv->engine_list = g_list_append (factory->priv->engine_list, engine);
g_signal_connect (engine,
diff --git a/src/ibusfactory.h b/src/ibusfactory.h
index 47c06e0..03d1dea 100644
--- a/src/ibusfactory.h
+++ b/src/ibusfactory.h
@@ -42,6 +42,7 @@
#include "ibusservice.h"
#include "ibusserializable.h"
+#include "ibusengine.h"
G_BEGIN_DECLS
@@ -127,10 +128,14 @@ struct _IBusFactoryClass {
IBusServiceClass parent;
/* signals */
+ IBusEngine *
+ (* create_engine)
+ (IBusFactory *factory,
+ const gchar *engine_name);
/*< private >*/
/* padding */
- gpointer pdummy[8];
+ gpointer pdummy[7];
};
/**
diff --git a/src/ibusmarshalers.list b/src/ibusmarshalers.list
index c073c6e..82b4aea 100644
--- a/src/ibusmarshalers.list
+++ b/src/ibusmarshalers.list
@@ -23,3 +23,4 @@ VOID:STRING,STRING,VARIANT
VOID:STRING,STRING,STRING
VOID:UINT
VOID:UINT,POINTER
+OBJECT:STRING
diff --git a/src/ibusservice.h b/src/ibusservice.h
index 7a3fea7..94f9bb7 100644
--- a/src/ibusservice.h
+++ b/src/ibusservice.h
@@ -135,9 +135,9 @@ IBusService *ibus_service_new (GDBusConnection *connection,
const gchar *ibus_service_get_object_path (IBusService *service);
/**
- * ibus_service_get_connections:
+ * ibus_service_get_connection:
* @service: An IBusService.
- * @returns: (transfer all) (element-type GDBusConnection): A newly allocated list of connections.
+ * @returns: (transfer none): A #GDBusConnection of an #IBusService instance.
*
* Returns a connections.
*/
@@ -190,7 +190,6 @@ gboolean ibus_service_emit_signal (IBusService *service,
* ibus_service_class_add_interfaces:
* @klass: An IBusServiceClass.
* @xml_data: The introspection xml data.
- * @error: Error.
*
* Set the interface introspection information with the service class.
*/
--
1.7.5.4

View File

@ -1,20 +1,20 @@
From 735a4d98ac057ded317dae9b85777ce56d8af0fd Mon Sep 17 00:00:00 2001
From 6937ff7453a352dc63a6487c7726acdb8942f8c9 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 20 Jun 2011 19:04:51 +0900
Date: Fri, 5 Aug 2011 20:23:07 +0900
Subject: [PATCH] Enable ibus-setup to show the frequently used languages
only in IME list.
---
data/ibus.schemas.in | 168 +++++++++++++++++++++++++++++++++++++++++++++++
data/ibus.schemas.in.in | 168 +++++++++++++++++++++++++++++++++++++++++++++++
setup/enginecombobox.py | 153 ++++++++++++++++++++++++++++++++++++------
setup/main.py | 1 +
3 files changed, 300 insertions(+), 22 deletions(-)
diff --git a/data/ibus.schemas.in.in b/data/ibus.schemas.in.in
index d4334e1..5ef2ac2 100644
index 2df4f19..692664b 100644
--- a/data/ibus.schemas.in.in
+++ b/data/ibus.schemas.in.in
@@ -239,6 +239,174 @@
@@ -240,6 +240,174 @@
</locale>
</schema>
<schema>
@ -210,18 +210,6 @@ index 7383177..bff2407 100644
- def set_engines(self, engines):
- self.__model = gtk.TreeStore(gobject.TYPE_PYOBJECT)
-
- iter1 = self.__model.append(None)
- self.__model.set(iter1, 0, 0)
- lang = {}
- for e in engines:
- if ibus.use_bridge_hotkey() and \
- e.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME:
- continue
- l = ibus.get_language_name(e.language)
- if l not in lang:
- lang[l] = []
- lang[l].append(e)
+ def __gconf_get_lang_list_from_locale(self):
+ common_list = ['en', 'Other']
+ if self.__config == None:
@ -256,7 +244,18 @@ index 7383177..bff2407 100644
+ if lang_list == None:
+ return [loc] + common_list
+ return lang_list + common_list
+
- iter1 = self.__model.append(None)
- self.__model.set(iter1, 0, 0)
- lang = {}
- for e in engines:
- if ibus.use_bridge_hotkey() and \
- e.name.startswith(ibus.DEFAULT_BRIDGE_ENGINE_NAME):
- continue
- l = ibus.get_language_name(e.language)
- if l not in lang:
- lang[l] = []
- lang[l].append(e)
+ def __has_engine_in_lang_list(self, engine, lang_list):
+ retval = False
+ for lang in lang_list:
@ -270,7 +269,7 @@ index 7383177..bff2407 100644
keys = lang.keys()
keys.sort(locale.strcoll)
#add "Others" to the end of the combo box
@@ -79,29 +112,89 @@ class EngineComboBox(gtk.ComboBox):
@@ -76,29 +112,89 @@ class EngineComboBox(gtk.ComboBox):
keys.remove(ibus.get_language_name("Other"))
keys += [ibus.get_language_name("Other")]
for l in keys:
@ -291,8 +290,7 @@ index 7383177..bff2407 100644
+
+ def set_engines(self, engines):
+ self.__model = gtk.TreeStore(gobject.TYPE_PYOBJECT)
- self.set_model(self.__model)
+
+ iter1 = self.__model.append(None)
+ self.__model.set(iter1, 0, 0)
+ lang_list = self.__gconf_get_lang_list_from_locale()
@ -300,7 +298,7 @@ index 7383177..bff2407 100644
+ sub_lang = {}
+ for e in engines:
+ if ibus.use_bridge_hotkey() and \
+ e.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME:
+ e.name.startswith(ibus.DEFAULT_BRIDGE_ENGINE_NAME):
+ continue
+ l = ibus.get_language_name(e.language)
+ if lang_list == None or \
@ -326,7 +324,8 @@ index 7383177..bff2407 100644
+ self.__model_append_langs(self.__all_model, sub_lang, False)
+
+ self.__toggle_sub_lang()
+
- self.set_model(self.__model)
+ def __toggle_sub_lang(self):
+ self.set_model(None)
+ if self.__show_sub_lang:
@ -368,7 +367,7 @@ index 7383177..bff2407 100644
else:
renderer.set_property("visible", True)
renderer.set_property("sensitive", True)
@@ -113,7 +206,8 @@ class EngineComboBox(gtk.ComboBox):
@@ -110,7 +203,8 @@ class EngineComboBox(gtk.ComboBox):
renderer.set_property("pixbuf", pixbuf)
def __name_cell_data_cb(self, celllayout, renderer, model, iter):
@ -378,7 +377,7 @@ index 7383177..bff2407 100644
if isinstance (engine, str) or isinstance (engine, unicode):
renderer.set_property("sensitive", False)
@@ -121,8 +215,15 @@ class EngineComboBox(gtk.ComboBox):
@@ -118,8 +212,15 @@ class EngineComboBox(gtk.ComboBox):
renderer.set_property("weight", pango.WEIGHT_NORMAL)
elif isinstance(engine, int):
renderer.set_property("sensitive", True)
@ -396,7 +395,7 @@ index 7383177..bff2407 100644
else:
renderer.set_property("sensitive", True)
renderer.set_property("text", engine.longname)
@@ -137,13 +238,21 @@ class EngineComboBox(gtk.ComboBox):
@@ -134,13 +235,21 @@ class EngineComboBox(gtk.ComboBox):
if i == 0 or i == -1:
return None
iter = self.get_active_iter()
@ -432,5 +431,5 @@ index 192fb88..5a0170d 100644
engines = self.__bus.list_active_engines()
--
1.7.4.4
1.7.5.4

View File

@ -20,7 +20,7 @@
Name: ibus
Version: 1.3.99.20110419
Release: 12%{?dist}
Release: 13%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -28,15 +28,16 @@ URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Source1: xinput-ibus
%if %have_gjsfile
Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/ibus-gjs-1.3.99.20110720.tar.gz
Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/ibus-gjs-1.3.99.20110806.tar.gz
%endif
Source3: https://www.transifex.net/projects/p/ibus/resource/master/l/da/download/ibus_master_da.po
Patch0: ibus-HEAD.patch
Patch1: ibus-530711-preload-sys.patch
Patch2: ibus-xx-icon-symbol.patch
Patch3: ibus-541492-xkb.patch
Patch4: ibus-xx-bridge-hotkey.patch
Patch5: ibus-xx-setup-frequent-lang.patch
Patch3: ibus-xx-factory-signal.patch
Patch4: ibus-541492-xkb.patch
Patch5: ibus-xx-bridge-hotkey.patch
Patch6: ibus-xx-setup-frequent-lang.patch
# Workaround for oxygen-gtk icon theme until bug 699103 is fixed.
Patch91: ibus-711632-fedora-fallback-icon.patch
@ -172,12 +173,13 @@ cp %SOURCE3 po/da.po
cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c
%patch1 -p1 -b .preload-sys
%patch2 -p1 -b .icon-symbol
%patch3 -p1 -b .factory
%if %have_libxkbfile
%patch3 -p1 -b .xkb
%patch4 -p1 -b .xkb
%endif
mv data/ibus.schemas.in data/ibus.schemas.in.in
%patch4 -p1 -b .bridge-key
%patch5 -p1 -b .setup-frequent-lang
%patch5 -p1 -b .bridge-key
%patch6 -p1 -b .setup-frequent-lang
%patch91 -p1 -b .fallback-icon
@ -362,14 +364,17 @@ fi
%{_datadir}/gtk-doc/html/*
%changelog
* Wed Jul 20 2011 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.99.20110419-12
* Fri Aug 05 2011 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.99.20110419-13
- Updated ibus-HEAD.patch for upstream.
- Removed ibus-435880-surrounding-text.patch as upstream.
- Added ibus-711632-fedora-fallback-icon.patch
Fixed SEGV with no icon in oxygen-gtk icon theme.
- Added ibus-xx-icon-symbol.patch
Fixed Bug 700472 Use a symbol icon instead of an image icon.
- Added ibus-xx-bridge-hotkey.patch
Triaged Bug 707370 SetEngine timeout
- Added transitional ibus-gnome3 package.
Fixed Bug 718110 Use a shell icon instead of pygtk2 icon.
* Thu May 26 2011 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.99.20110419-1
- Updated to 1.3.99.20110419

View File

@ -1,3 +1,3 @@
d4f2729fecb92ae6b41f26c770b1a772 ibus-1.3.99.20110419.tar.gz
41915a2dc5ed10c23a47e901611ac54a ibus-gjs-1.3.99.20110720.tar.gz
b2214490304ab89d599cf72d012fde3c ibus-gjs-1.3.99.20110806.tar.gz
698c90edf0f037488e1aa969804e891f ibus_master_da.po