Replaced icon_symbol property with symbol.
- Use separated keyboard engines for xkb group layouts. - Hide xkb default layout from ibus-setup.
This commit is contained in:
parent
577a9816b5
commit
47affbc629
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,6 +11,6 @@ ibus-1.3.6.tar.gz
|
||||
/ibus-1.3.99.20110228.tar.gz
|
||||
/ibus-1.3.99.20110408.tar.gz
|
||||
/ibus-1.3.99.20110419.tar.gz
|
||||
/gnome-shell-ibus-plugins-20110622.tar.bz2
|
||||
/gnome-shell-ibus-plugins-20110629.tar.bz2
|
||||
/ibus_master_da.po
|
||||
/ibus-indicator.tar.bz2
|
||||
|
@ -1,6 +1,6 @@
|
||||
From 7fab90a9962d3b4f8eff40cf08939873575d153e Mon Sep 17 00:00:00 2001
|
||||
From 14986cb38f431d132332b2e8f9da1ca2b8a5d10e Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Tue, 21 Jun 2011 11:34:52 +0900
|
||||
Date: Wed, 29 Jun 2011 16:52:08 +0900
|
||||
Subject: [PATCH] Add XKB layouts
|
||||
|
||||
---
|
||||
@ -12,7 +12,7 @@ Subject: [PATCH] Add XKB layouts
|
||||
ibus/__init__.py | 2 +
|
||||
ibus/bus.py | 3 +
|
||||
ibus/interface/iibus.py | 3 +
|
||||
ibus/xkblayout.py.in | 225 ++++++++++++++++
|
||||
ibus/xkblayout.py.in | 215 ++++++++++++++++
|
||||
ibus/xkbxml.py.in | 413 ++++++++++++++++++++++++++++++
|
||||
setup/Makefile.am | 1 +
|
||||
setup/enginecombobox.py | 7 +-
|
||||
@ -36,7 +36,7 @@ Subject: [PATCH] Add XKB layouts
|
||||
xkb/xkblib.h | 41 +++
|
||||
xkb/xkbxml.c | 335 ++++++++++++++++++++++++
|
||||
xkb/xkbxml.h | 110 ++++++++
|
||||
32 files changed, 4018 insertions(+), 6 deletions(-)
|
||||
32 files changed, 4008 insertions(+), 6 deletions(-)
|
||||
create mode 100644 ibus/xkblayout.py.in
|
||||
create mode 100644 ibus/xkbxml.py.in
|
||||
create mode 100644 setup/xkbsetup.py
|
||||
@ -303,10 +303,10 @@ index 678d517..7de56fc 100644
|
||||
|
||||
diff --git a/ibus/xkblayout.py.in b/ibus/xkblayout.py.in
|
||||
new file mode 100644
|
||||
index 0000000..637f6c1
|
||||
index 0000000..4cb3ffd
|
||||
--- /dev/null
|
||||
+++ b/ibus/xkblayout.py.in
|
||||
@@ -0,0 +1,225 @@
|
||||
@@ -0,0 +1,215 @@
|
||||
+# vim:set et sts=4 sw=4:
|
||||
+#
|
||||
+# ibus - The Input Bus
|
||||
@ -360,22 +360,12 @@ index 0000000..637f6c1
|
||||
+
|
||||
+
|
||||
+ def __get_model_from_layout(self, layout):
|
||||
+ layout_array = layout.split(',')
|
||||
+ option_array = []
|
||||
+ is_bracket = False
|
||||
+ for i, l in enumerate(layout_array):
|
||||
+ option_array.append("")
|
||||
+ left_bracket = l.find('(')
|
||||
+ right_bracket = l.find(')')
|
||||
+ if left_bracket >= 0 and right_bracket > left_bracket:
|
||||
+ is_bracket = True
|
||||
+ layout_array[i] = l[:left_bracket]
|
||||
+ option_array[i] = l[left_bracket + 1:right_bracket]
|
||||
+ if is_bracket == False:
|
||||
+ return (layout, "default")
|
||||
+ layout = ','.join(layout_array)
|
||||
+ option = ','.join(option_array)
|
||||
+ return (layout, option)
|
||||
+ left_bracket = layout.find('(')
|
||||
+ right_bracket = layout.find(')')
|
||||
+ if left_bracket >= 0 and right_bracket > left_bracket:
|
||||
+ return (layout[:left_bracket], \
|
||||
+ layout[left_bracket + 1:right_bracket])
|
||||
+ return (layout, "default")
|
||||
+
|
||||
+ def __get_output_from_cmdline(self, arg, string):
|
||||
+ exec_command = "%s %s" % (self.__command, arg)
|
||||
@ -4506,5 +4496,5 @@ index 0000000..56811ef
|
||||
+G_END_DECLS
|
||||
+#endif
|
||||
--
|
||||
1.7.4.4
|
||||
1.7.5.4
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
From faaea227c58ec17d392ec4ecdf3851e1a52ecd00 Mon Sep 17 00:00:00 2001
|
||||
From b58e9d7673d255f86f5224b527457c0132eea3c8 Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Wed, 22 Jun 2011 19:26:21 +0900
|
||||
Date: Wed, 29 Jun 2011 16:54:45 +0900
|
||||
Subject: [PATCH] Add a bridge hotkey which use prev-next engines instead
|
||||
of on-off.
|
||||
|
||||
---
|
||||
bus/Makefile.am | 20 ++--
|
||||
bus/ibusimpl.c | 250 +++++++++++++++++++++++++++++----------
|
||||
bus/ibusimpl.c | 255 ++++++++++++++++++++++++++++++----------
|
||||
bus/registry.c | 35 ++++++
|
||||
configure.ac | 31 +++++
|
||||
data/Makefile.am | 6 +-
|
||||
@ -14,18 +14,19 @@ Subject: [PATCH] Add a bridge hotkey which use prev-next engines instead
|
||||
data/ibus.schemas.in.in | 286 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
ibus/_config.py.in | 6 +
|
||||
ibus/inputcontext.py | 4 +
|
||||
setup/enginetreeview.py | 3 +
|
||||
src/Makefile.am | 1 +
|
||||
src/ibusbus.c | 6 +
|
||||
src/ibusbus.h | 9 ++
|
||||
setup/enginecombobox.py | 3 +
|
||||
setup/enginetreeview.py | 16 ++-
|
||||
src/Makefile.am | 18 ++--
|
||||
src/ibusbus.c | 12 ++
|
||||
src/ibusbus.h | 18 +++
|
||||
src/ibusenginedesc.c | 4 +
|
||||
src/ibushotkey.c | 11 ++
|
||||
src/ibushotkey.h | 11 ++
|
||||
ui/gtk/panel.py | 60 +++++++++-
|
||||
ui/gtk/panel.py | 151 ++++++++++++++++++++---
|
||||
xkb/Makefile.am | 2 +
|
||||
xkb/ibus-engine-xkb-main.c | 8 ++
|
||||
xkb/xkbxml.c | 8 +-
|
||||
20 files changed, 686 insertions(+), 361 deletions(-)
|
||||
21 files changed, 804 insertions(+), 387 deletions(-)
|
||||
delete mode 100644 data/ibus.schemas.in
|
||||
create mode 100644 data/ibus.schemas.in.in
|
||||
|
||||
@ -61,7 +62,7 @@ index 074b456..0efaa1b 100644
|
||||
AM_LDADD = \
|
||||
@GOBJECT2_LIBS@ \
|
||||
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
|
||||
index 38d6d11..65a034b 100644
|
||||
index b356b2c..f3ca330 100644
|
||||
--- a/bus/ibusimpl.c
|
||||
+++ b/bus/ibusimpl.c
|
||||
@@ -20,6 +20,10 @@
|
||||
@ -75,16 +76,18 @@ index 38d6d11..65a034b 100644
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -79,6 +83,8 @@ struct _BusIBusImpl {
|
||||
@@ -79,6 +83,10 @@ struct _BusIBusImpl {
|
||||
/* engine-specific hotkeys */
|
||||
IBusHotkeyProfile *engines_hotkey_profile;
|
||||
GHashTable *hotkey_to_engines_map;
|
||||
+
|
||||
+#if USE_BRIDGE_HOTKEY
|
||||
+ IBusEngineDesc *prev_hotkey_engine;
|
||||
+#endif
|
||||
};
|
||||
|
||||
struct _BusIBusImplClass {
|
||||
@@ -285,6 +291,30 @@ _panel_destroy_cb (BusPanelProxy *panel,
|
||||
@@ -285,6 +293,30 @@ _panel_destroy_cb (BusPanelProxy *panel,
|
||||
g_object_unref (panel);
|
||||
}
|
||||
|
||||
@ -115,7 +118,7 @@ index 38d6d11..65a034b 100644
|
||||
static void
|
||||
_config_set_value_done (GObject *object,
|
||||
GAsyncResult *res,
|
||||
@@ -475,8 +505,21 @@ _set_preload_engines (BusIBusImpl *ibus,
|
||||
@@ -475,8 +507,21 @@ _set_preload_engines (BusIBusImpl *ibus,
|
||||
g_variant_unref (value);
|
||||
}
|
||||
|
||||
@ -138,7 +141,7 @@ index 38d6d11..65a034b 100644
|
||||
|
||||
if (ibus->engine_list) {
|
||||
BusComponent *component = bus_component_from_engine_desc ((IBusEngineDesc *) ibus->engine_list->data);
|
||||
@@ -573,7 +616,9 @@ bus_ibus_impl_set_trigger (BusIBusImpl *
|
||||
@@ -573,7 +618,9 @@ bus_ibus_impl_set_trigger (BusIBusImpl *
|
||||
{
|
||||
GQuark hotkey = g_quark_from_static_string ("trigger");
|
||||
if (value != NULL) {
|
||||
@ -148,7 +151,7 @@ index 38d6d11..65a034b 100644
|
||||
}
|
||||
#ifndef OS_CHROMEOS
|
||||
else {
|
||||
@@ -1182,28 +1227,110 @@ _ibus_get_address (BusIBusImpl
|
||||
@@ -1182,28 +1229,110 @@ _ibus_get_address (BusIBusImpl
|
||||
g_variant_new ("(s)", bus_server_get_address ()));
|
||||
}
|
||||
|
||||
@ -276,7 +279,7 @@ index 38d6d11..65a034b 100644
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1216,7 +1343,39 @@ _context_request_engine_cb (BusInputCont
|
||||
@@ -1216,7 +1345,39 @@ _context_request_engine_cb (BusInputCont
|
||||
const gchar *engine_name,
|
||||
BusIBusImpl *ibus)
|
||||
{
|
||||
@ -317,7 +320,7 @@ index 38d6d11..65a034b 100644
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2357,6 +2516,11 @@ bus_ibus_impl_filter_keyboard_shortcuts
|
||||
@@ -2357,6 +2518,11 @@ bus_ibus_impl_filter_keyboard_shortcuts
|
||||
* the same hotkey, then we should switch to the next engine with the
|
||||
* same hotkey in the list. Otherwise, we just switch to the first
|
||||
* engine in the list. */
|
||||
@ -329,22 +332,24 @@ index 38d6d11..65a034b 100644
|
||||
GList *p = engine_list;
|
||||
for (; p->next != NULL; p = p->next) {
|
||||
if (current_engine_desc == (IBusEngineDesc *) p->data) {
|
||||
@@ -2364,9 +2528,14 @@ bus_ibus_impl_filter_keyboard_shortcuts
|
||||
@@ -2364,8 +2530,16 @@ bus_ibus_impl_filter_keyboard_shortcuts
|
||||
break;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (current_engine_desc != new_engine_desc) {
|
||||
+#if USE_BRIDGE_HOTKEY
|
||||
+ if (current_engine_desc != new_engine_desc ||
|
||||
+ g_strcmp0 (ibus_engine_desc_get_name (new_engine_desc),
|
||||
+ DEFAULT_BRIDGE_ENGINE_NAME) == 0) {
|
||||
+ ibus->prev_hotkey_engine = current_engine_desc;
|
||||
+#else
|
||||
if (current_engine_desc != new_engine_desc) {
|
||||
+#endif
|
||||
bus_ibus_impl_set_context_engine_from_desc (ibus, context, new_engine_desc);
|
||||
+ } else {
|
||||
+ g_warning ("The engine %s is registered twice in hotkeys",
|
||||
+ ibus_engine_desc_get_name (current_engine_desc));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2470,14 +2639,6 @@ static void
|
||||
@@ -2470,14 +2644,6 @@ static void
|
||||
_add_engine_hotkey (IBusEngineDesc *engine, BusIBusImpl *ibus)
|
||||
{
|
||||
const gchar *hotkeys;
|
||||
@ -359,7 +364,7 @@ index 38d6d11..65a034b 100644
|
||||
|
||||
if (!engine) {
|
||||
return;
|
||||
@@ -2489,40 +2650,7 @@ _add_engine_hotkey (IBusEngineDesc *engi
|
||||
@@ -2489,40 +2655,7 @@ _add_engine_hotkey (IBusEngineDesc *engi
|
||||
return;
|
||||
}
|
||||
|
||||
@ -607,37 +612,88 @@ index ceeb56d..2694fa3 100644
|
||||
def introspect(self):
|
||||
return self.__context.Introspect()
|
||||
|
||||
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
|
||||
index 7383177..247facc 100644
|
||||
--- a/setup/enginecombobox.py
|
||||
+++ b/setup/enginecombobox.py
|
||||
@@ -64,6 +64,9 @@ class EngineComboBox(gtk.ComboBox):
|
||||
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] = []
|
||||
diff --git a/setup/enginetreeview.py b/setup/enginetreeview.py
|
||||
index f620361..727cf89 100644
|
||||
index f620361..0e50ad5 100644
|
||||
--- a/setup/enginetreeview.py
|
||||
+++ b/setup/enginetreeview.py
|
||||
@@ -210,6 +210,9 @@ class EngineTreeView(gtk.TreeView):
|
||||
return
|
||||
row = self.__model[iter]
|
||||
engine = row[0]
|
||||
+ if ibus.use_bridge_hotkey() and \
|
||||
+ ibus.DEFAULT_BRIDGE_ENGINE_NAME == engine.name:
|
||||
+ return
|
||||
self.__engines.remove(engine)
|
||||
index = row.path[0]
|
||||
self.__model.remove(iter)
|
||||
@@ -162,6 +162,14 @@ class EngineTreeView(gtk.TreeView):
|
||||
return row[0]
|
||||
elif property.name == "engines":
|
||||
engines = [ r[0] for r in self.__model if r[0] != None]
|
||||
+ for i, e in enumerate(self.__engines):
|
||||
+ if ibus.use_bridge_hotkey() and \
|
||||
+ e.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME:
|
||||
+ if i < len(engines):
|
||||
+ engines.insert(i, e)
|
||||
+ else:
|
||||
+ engines.append(e)
|
||||
+ break
|
||||
return engines
|
||||
else:
|
||||
raise AttributeError, 'unknown property %s' % property.name
|
||||
@@ -172,8 +180,12 @@ class EngineTreeView(gtk.TreeView):
|
||||
for e in engines:
|
||||
if e in self.__engines:
|
||||
continue
|
||||
- iter = self.__model.append(None)
|
||||
- self.__model.set(iter, 0, e)
|
||||
+ if ibus.use_bridge_hotkey() and \
|
||||
+ e.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME:
|
||||
+ pass
|
||||
+ else:
|
||||
+ iter = self.__model.append(None)
|
||||
+ self.__model.set(iter, 0, e)
|
||||
self.__engines.add(e)
|
||||
self.__emit_changed()
|
||||
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 6454522..443b0db 100644
|
||||
index 6454522..319df3c 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -46,6 +46,7 @@ AM_CPPFLAGS = \
|
||||
-DIBUS_DATA_DIR=\"$(pkgdatadir)\" \
|
||||
-DIBUS_COMPILATION \
|
||||
-DISOCODES_PREFIX=\"$(ISOCODES_PREFIX)\" \
|
||||
+ -DUSE_BRIDGE_HOTKEY=$(USE_BRIDGE_HOTKEY) \
|
||||
@@ -38,14 +38,16 @@ INTROSPECTION_GIRS =
|
||||
CLEANFILES =
|
||||
|
||||
# C preprocessor flags
|
||||
-AM_CPPFLAGS = \
|
||||
- -DG_LOG_DOMAIN=\"IBUS\" \
|
||||
- @GLIB2_CFLAGS@ \
|
||||
- @GOBJECT2_CFLAGS@ \
|
||||
- @GIO2_CFLAGS@ \
|
||||
- -DIBUS_DATA_DIR=\"$(pkgdatadir)\" \
|
||||
- -DIBUS_COMPILATION \
|
||||
- -DISOCODES_PREFIX=\"$(ISOCODES_PREFIX)\" \
|
||||
+AM_CPPFLAGS = \
|
||||
+ -DG_LOG_DOMAIN=\"IBUS\" \
|
||||
+ @GLIB2_CFLAGS@ \
|
||||
+ @GOBJECT2_CFLAGS@ \
|
||||
+ @GIO2_CFLAGS@ \
|
||||
+ -DIBUS_DATA_DIR=\"$(pkgdatadir)\" \
|
||||
+ -DIBUS_COMPILATION \
|
||||
+ -DISOCODES_PREFIX=\"$(ISOCODES_PREFIX)\" \
|
||||
+ -DUSE_BRIDGE_HOTKEY=$(USE_BRIDGE_HOTKEY) \
|
||||
+ -DDEFAULT_BRIDGE_ENGINE_NAME=\"$(DEFAULT_BRIDGE_ENGINE_NAME)\" \
|
||||
$(NULL)
|
||||
|
||||
# ibus library
|
||||
diff --git a/src/ibusbus.c b/src/ibusbus.c
|
||||
index 39ad784..5a8f9a9 100644
|
||||
index 39ad784..abc4331 100644
|
||||
--- a/src/ibusbus.c
|
||||
+++ b/src/ibusbus.c
|
||||
@@ -1902,3 +1902,9 @@ ibus_bus_call_async (IBusBus *bus,
|
||||
@@ -1902,3 +1902,15 @@ ibus_bus_call_async (IBusBus *bus,
|
||||
(GAsyncReadyCallback) ibus_bus_call_async_done,
|
||||
simple);
|
||||
}
|
||||
@ -647,11 +703,17 @@ index 39ad784..5a8f9a9 100644
|
||||
+{
|
||||
+ return (USE_BRIDGE_HOTKEY == 1) ? TRUE : FALSE;
|
||||
+}
|
||||
+
|
||||
+gchar *
|
||||
+ibus_bus_get_default_bridge_engine_name (IBusBus *bus)
|
||||
+{
|
||||
+ return g_strdup (DEFAULT_BRIDGE_ENGINE_NAME);
|
||||
+}
|
||||
diff --git a/src/ibusbus.h b/src/ibusbus.h
|
||||
index 77d3916..4bdf760 100644
|
||||
index 77d3916..f560671 100644
|
||||
--- a/src/ibusbus.h
|
||||
+++ b/src/ibusbus.h
|
||||
@@ -971,5 +971,14 @@ void ibus_bus_set_watch_ibus_signal
|
||||
@@ -971,5 +971,23 @@ void ibus_bus_set_watch_ibus_signal
|
||||
*/
|
||||
IBusConfig *ibus_bus_get_config (IBusBus *bus);
|
||||
|
||||
@ -663,14 +725,23 @@ index 77d3916..4bdf760 100644
|
||||
+ * Return %TRUE if @bus use bridge hotkey.
|
||||
+ */
|
||||
+gboolean ibus_bus_use_bridge_hotkey (IBusBus *bus);
|
||||
+
|
||||
+/**
|
||||
+ * ibus_bus_get_default_bridge_engine_name:
|
||||
+ * @bus: An #IBusBus.
|
||||
+ * @returns: A default bridge engine name.
|
||||
+ *
|
||||
+ * Return A default bridge engine name. Need to be freed.
|
||||
+ */
|
||||
+gchar *ibus_bus_get_default_bridge_engine_name (IBusBus *bus);
|
||||
+
|
||||
G_END_DECLS
|
||||
#endif
|
||||
diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c
|
||||
index d3800e1..a9e68be 100644
|
||||
index fa3a768..3d6100e 100644
|
||||
--- a/src/ibusenginedesc.c
|
||||
+++ b/src/ibusenginedesc.c
|
||||
@@ -233,7 +233,11 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
|
||||
@@ -232,7 +232,11 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
|
||||
g_param_spec_string ("hotkeys",
|
||||
"description hotkeys",
|
||||
"The hotkeys of engine description",
|
||||
@ -723,22 +794,25 @@ index 9a341f6..92ec6af 100644
|
||||
G_END_DECLS
|
||||
#endif
|
||||
diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py
|
||||
index de64920..7f2edcd 100644
|
||||
index de64920..1dae2b1 100644
|
||||
--- a/ui/gtk/panel.py
|
||||
+++ b/ui/gtk/panel.py
|
||||
@@ -133,6 +133,11 @@ class Panel(ibus.PanelBase):
|
||||
@@ -133,6 +133,14 @@ class Panel(ibus.PanelBase):
|
||||
# self.__bus.request_name(ibus.panel.IBUS_SERVICE_PANEL, 0)
|
||||
|
||||
# init xkb
|
||||
+ self.__default_layout = 'default'
|
||||
+ self.__default_model = 'default'
|
||||
+ self.__default_option = 'default'
|
||||
+ self.__disabled_engine = None
|
||||
+ self.__disabled_engines = None
|
||||
+ self.__disabled_engines_id = -1
|
||||
+ self.__disabled_engines_prev_id = -1
|
||||
+ self.__disabled_engines_swapped = 0
|
||||
+
|
||||
self.__xkblayout = ibus.XKBLayout(self.__config)
|
||||
use_xkb = self.__config.get_value("general", "use_system_keyboard_layout", False)
|
||||
if not use_xkb:
|
||||
@@ -142,11 +147,18 @@ class Panel(ibus.PanelBase):
|
||||
@@ -142,11 +150,18 @@ class Panel(ibus.PanelBase):
|
||||
value = 'default'
|
||||
if value != 'default':
|
||||
self.__xkblayout.set_default_layout(value)
|
||||
@ -757,7 +831,7 @@ index de64920..7f2edcd 100644
|
||||
|
||||
def set_cursor_location(self, x, y, w, h):
|
||||
self.__candidate_panel.set_cursor_location(x, y, w, h)
|
||||
@@ -233,6 +245,41 @@ class Panel(ibus.PanelBase):
|
||||
@@ -233,12 +248,57 @@ class Panel(ibus.PanelBase):
|
||||
def __set_im_name(self, name):
|
||||
self.__language_bar.set_im_name(name)
|
||||
|
||||
@ -766,64 +840,131 @@ index de64920..7f2edcd 100644
|
||||
+ default_model = self.__default_model
|
||||
+ if default_layout == 'default':
|
||||
+ default_layout = self.__xkblayout.get_default_layout()[0]
|
||||
+ default_model = None
|
||||
+ default_model = self.__xkblayout.get_default_layout()[1]
|
||||
+ if default_model == 'default':
|
||||
+ default_model = self.__xkblayout.get_default_layout()[1]
|
||||
+ layouts = default_layout.split(',')
|
||||
+ group = self.__xkblayout.get_group()
|
||||
+ layout = layouts[group]
|
||||
+ model = None
|
||||
+ models = None
|
||||
+ if default_model != None and default_model != '':
|
||||
+ models = default_model.split(',')
|
||||
+ if group < models.length:
|
||||
+ model = models[group]
|
||||
+ registry = ibus.XKBConfigRegistry()
|
||||
+ langs = registry.get_layout_lang()[layout]
|
||||
+ lang = 'en'
|
||||
+ im_icon = layout[:2]
|
||||
+ if langs != None:
|
||||
+ im_icon = langs[0][:2]
|
||||
+ lang = str(langs[0])
|
||||
+ if self.__disabled_engine == None:
|
||||
+ self.__disabled_engine = registry.engine_desc_new(lang,
|
||||
+ self.__default_layout,
|
||||
+ 'Default Layout',
|
||||
+ default_model,
|
||||
+ None)
|
||||
+ if self.__focus_ic != None:
|
||||
+ prev_engine = self.__focus_ic.get_engine()
|
||||
+ if prev_engine == None or \
|
||||
+ prev_engine.name != self.__disabled_engine.name:
|
||||
+ if self.__disabled_engines == None or self.__disabled_engines == []:
|
||||
+ self.__disabled_engines = []
|
||||
+ for i, layout in enumerate(layouts):
|
||||
+ registry = ibus.XKBConfigRegistry()
|
||||
+ langs = registry.get_layout_lang()[layout]
|
||||
+ lang = 'en'
|
||||
+ if langs != None:
|
||||
+ lang = str(langs[0])
|
||||
+ model = None
|
||||
+ if i == 0:
|
||||
+ layout = default_layout
|
||||
+ model = default_model
|
||||
+ elif i < len(models):
|
||||
+ model = models[i]
|
||||
+ if model == '':
|
||||
+ model = None
|
||||
+ model_desc = _("Default Layout")
|
||||
+ if model != None:
|
||||
+ model_desc = model_desc + " (" + model + ")"
|
||||
+ engine = registry.engine_desc_new(lang,
|
||||
+ layout,
|
||||
+ _("Default Layout"),
|
||||
+ model,
|
||||
+ model_desc)
|
||||
+ self.__disabled_engines.append(engine)
|
||||
+ self.__disabled_engines_id = self.__xkblayout.get_group()
|
||||
+ if self.__focus_ic == None:
|
||||
+ return
|
||||
+ if not self.__focus_ic.is_enabled():
|
||||
+ self.__focus_ic.set_bridge_engine()
|
||||
+
|
||||
def focus_in(self, ic):
|
||||
self.reset()
|
||||
self.__focus_ic = ibus.InputContext(self.__bus, ic)
|
||||
@@ -240,6 +287,9 @@ class Panel(ibus.PanelBase):
|
||||
enabled = self.__focus_ic.is_enabled()
|
||||
self.__language_bar.set_enabled(enabled)
|
||||
|
||||
+ if ibus.use_bridge_hotkey():
|
||||
+ self.__set_default_layout_engine()
|
||||
if not enabled:
|
||||
+ if ibus.use_bridge_hotkey():
|
||||
+ self.__set_default_layout_engine()
|
||||
+
|
||||
self.__set_im_icon(ICON_KEYBOARD)
|
||||
self.__set_im_name(None)
|
||||
if self.__bus.get_use_sys_layout():
|
||||
@@ -453,7 +503,12 @@ class Panel(ibus.PanelBase):
|
||||
@@ -250,7 +310,7 @@ class Panel(ibus.PanelBase):
|
||||
self.__set_im_icon(engine.icon)
|
||||
self.__set_im_name(engine.longname)
|
||||
if self.__bus.get_use_sys_layout():
|
||||
- self.__xkblayout.set_layout(self.__engine_get_layout_wrapper(engine))
|
||||
+ self.__xkblayout.set_layout(self.__engine_get_layout_wrapper(engine, False))
|
||||
else:
|
||||
self.__set_im_icon(ICON_KEYBOARD)
|
||||
self.__set_im_name(None)
|
||||
@@ -287,7 +347,7 @@ class Panel(ibus.PanelBase):
|
||||
self.__set_im_icon(engine.icon)
|
||||
self.__set_im_name(engine.longname)
|
||||
if self.__bus.get_use_sys_layout():
|
||||
- self.__xkblayout.set_layout(self.__engine_get_layout_wrapper(engine))
|
||||
+ self.__xkblayout.set_layout(self.__engine_get_layout_wrapper(engine, True))
|
||||
else:
|
||||
self.__set_im_icon(ICON_KEYBOARD)
|
||||
self.__set_im_name(None)
|
||||
@@ -443,6 +503,21 @@ class Panel(ibus.PanelBase):
|
||||
# menu.set_take_focus(False)
|
||||
# return menu
|
||||
|
||||
+ def __add_engine_in_menu(self, menu, engine, is_bold, size):
|
||||
+ language = engine.language
|
||||
+ lang = ibus.get_language_name(language)
|
||||
+ item = gtk.ImageMenuItem("%s - %s" % (lang, engine.longname))
|
||||
+ if is_bold:
|
||||
+ for widget in item.get_children():
|
||||
+ if isinstance(widget, gtk.Label):
|
||||
+ widget.set_markup("<b>%s</b>" % widget.get_text())
|
||||
+ if engine.icon:
|
||||
+ item.set_image(_icon.IconWidget(engine.icon, size[0]))
|
||||
+ else:
|
||||
+ item.set_image(_icon.IconWidget(ICON_ENGINE, size[0]))
|
||||
+ item.connect("activate", self.__im_menu_item_activate_cb, engine)
|
||||
+ menu.add(item)
|
||||
+
|
||||
def __create_im_menu(self):
|
||||
engines = self.__bus.list_active_engines()
|
||||
current_engine = \
|
||||
@@ -453,25 +528,31 @@ class Panel(ibus.PanelBase):
|
||||
size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
|
||||
menu = gtk.Menu()
|
||||
for i, engine in enumerate(engines):
|
||||
- lang = ibus.get_language_name(engine.language)
|
||||
+ language = engine.language
|
||||
- item = gtk.ImageMenuItem("%s - %s" % (lang, engine.longname))
|
||||
- if current_engine and current_engine.name == engine.name:
|
||||
- for widget in item.get_children():
|
||||
- if isinstance(widget, gtk.Label):
|
||||
- widget.set_markup("<b>%s</b>" % widget.get_text())
|
||||
- if engine.icon:
|
||||
- item.set_image(_icon.IconWidget(engine.icon, size[0]))
|
||||
- else:
|
||||
- item.set_image(_icon.IconWidget(ICON_ENGINE, size[0]))
|
||||
- item.connect("activate", self.__im_menu_item_activate_cb, engine)
|
||||
- menu.add(item)
|
||||
+ if ibus.use_bridge_hotkey() and \
|
||||
+ engine.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME and \
|
||||
+ self.__disabled_engine != None:
|
||||
+ language = self.__disabled_engine.language
|
||||
+ lang = ibus.get_language_name(language)
|
||||
item = gtk.ImageMenuItem("%s - %s" % (lang, engine.longname))
|
||||
if current_engine and current_engine.name == engine.name:
|
||||
for widget in item.get_children():
|
||||
@@ -471,7 +526,8 @@ class Panel(ibus.PanelBase):
|
||||
+ self.__disabled_engines != None:
|
||||
+ for j, kb_engine in enumerate(self.__disabled_engines):
|
||||
+ kb_engine.is_bridge = True
|
||||
+ kb_engine.disabled_engines_id = j
|
||||
+ is_bold = True if (current_engine != None and \
|
||||
+ current_engine.name == engine.name and \
|
||||
+ j == self.__disabled_engines_id) else False
|
||||
+ self.__add_engine_in_menu(menu, kb_engine,
|
||||
+ is_bold,
|
||||
+ size)
|
||||
+ continue
|
||||
+ engine.is_bridge = False
|
||||
+ is_bold = True if (current_engine != None and \
|
||||
+ current_engine.name == engine.name) else False
|
||||
+ self.__add_engine_in_menu(menu, engine, is_bold, size)
|
||||
|
||||
item = gtk.ImageMenuItem(_("Turn off input method"))
|
||||
item.set_image(_icon.IconWidget("gtk-close", size[0]))
|
||||
item.connect("activate", self.__im_menu_item_activate_cb, None)
|
||||
if self.__focus_ic == None or not self.__focus_ic.is_enabled():
|
||||
item.set_sensitive(False)
|
||||
@ -833,6 +974,64 @@ index de64920..7f2edcd 100644
|
||||
|
||||
menu.show_all()
|
||||
menu.set_take_focus(False)
|
||||
@@ -523,8 +604,25 @@ class Panel(ibus.PanelBase):
|
||||
if not self.__focus_ic:
|
||||
return
|
||||
if engine:
|
||||
- self.__focus_ic.set_engine(engine)
|
||||
+ if ibus.use_bridge_hotkey() and engine.is_bridge:
|
||||
+ engines = self.__bus.list_active_engines()
|
||||
+ current_engine = \
|
||||
+ (self.__focus_ic != None and self.__focus_ic.get_engine()) or \
|
||||
+ (engines and engines[0]) or \
|
||||
+ None
|
||||
+ if current_engine and \
|
||||
+ current_engine.name == ibus.DEFAULT_BRIDGE_ENGINE_NAME:
|
||||
+ self.__disabled_engines_prev_id = self.__disabled_engines_id
|
||||
+ self.__disabled_engines_swapped = 0
|
||||
+ else:
|
||||
+ self.__disabled_engines_prev_id = -1
|
||||
+ self.__disabled_engines_id = engine.disabled_engines_id
|
||||
+ self.__focus_ic.set_bridge_engine()
|
||||
+ else:
|
||||
+ self.__disabled_engines_prev_id = -1
|
||||
+ self.__focus_ic.set_engine(engine)
|
||||
else:
|
||||
+ self.__disabled_engines_prev_id = -1
|
||||
self.__focus_ic.disable()
|
||||
|
||||
def __sys_menu_item_activate_cb(self, item, command):
|
||||
@@ -573,11 +671,28 @@ class Panel(ibus.PanelBase):
|
||||
self.__setup_pid = pid
|
||||
glib.child_watch_add(self.__setup_pid, self.__child_watch_cb)
|
||||
|
||||
- def __engine_get_layout_wrapper(self, engine):
|
||||
+ def __engine_get_layout_wrapper(self, engine, changed_state):
|
||||
+ if ibus.use_bridge_hotkey() and \
|
||||
+ self.__disabled_engines_id >= 0 and \
|
||||
+ self.__disabled_engines != None and \
|
||||
+ self.__disabled_engines_id < len(self.__disabled_engines):
|
||||
+ if changed_state and self.__disabled_engines_prev_id != -1:
|
||||
+ # state_changed is always called twice because we change
|
||||
+ # the engine. So the first two calls are ignored here.
|
||||
+ if self.__disabled_engines_swapped < 2:
|
||||
+ self.__disabled_engines_swapped = \
|
||||
+ self.__disabled_engines_swapped + 1
|
||||
+ else:
|
||||
+ x = self.__disabled_engines_prev_id
|
||||
+ self.__disabled_engines_prev_id = self.__disabled_engines_id
|
||||
+ self.__disabled_engines_id = x
|
||||
+ self.__disabled_engines_swapped = 1
|
||||
+ retval = self.__disabled_engines[self.__disabled_engines_id].layout
|
||||
+ return retval
|
||||
# This code is for the back compatibility.
|
||||
# Should we remove the codes after all IM engines are changed
|
||||
# to "default" layout?
|
||||
- if engine.name != None and engine.name.startswith("xkb:layout:"):
|
||||
+ elif engine.name != None and engine.name.startswith("xkb:layout:"):
|
||||
return engine.layout
|
||||
else:
|
||||
return "default"
|
||||
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
|
||||
index ad9cdd9..c4d5afb 100644
|
||||
--- a/xkb/Makefile.am
|
||||
@ -899,5 +1098,5 @@ index 2ce7bcf..de6648f 100644
|
||||
|
||||
g_free (name);
|
||||
--
|
||||
1.7.4.4
|
||||
1.7.5.4
|
||||
|
||||
|
@ -1,124 +1,16 @@
|
||||
From 1a7d35e5a29bec75dcc98e934d39cfdb3950ae48 Mon Sep 17 00:00:00 2001
|
||||
From cf1fa1bc72d6d7ad71e928df1c3aa938069cfd9e Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Wed, 22 Jun 2011 12:21:55 +0900
|
||||
Subject: [PATCH] Add icon_symbol property in IBusEngineDesc.
|
||||
Date: Wed, 29 Jun 2011 16:50:51 +0900
|
||||
Subject: [PATCH] Add symbol property in IBusEngineDesc.
|
||||
|
||||
---
|
||||
bus/engineproxy.c | 22 +++++++++++++++
|
||||
bus/ibusimpl.c | 33 ++++++++++++++++++++++
|
||||
bus/ibusimpl.h | 4 +++
|
||||
ibus/engine.py | 3 ++
|
||||
ibus/enginedesc.py | 18 +++++++++---
|
||||
ibus/interface/iengine.py | 3 ++
|
||||
src/ibusenginedesc.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/ibusenginedesc.h | 10 +++++++
|
||||
8 files changed, 155 insertions(+), 4 deletions(-)
|
||||
ibus/enginedesc.py | 15 +++++++++------
|
||||
src/ibusenginedesc.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
src/ibusenginedesc.h | 10 ++++++++++
|
||||
3 files changed, 59 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
|
||||
index f74af12..5c0cbb2 100644
|
||||
--- a/bus/engineproxy.c
|
||||
+++ b/bus/engineproxy.c
|
||||
@@ -591,6 +591,28 @@ bus_engine_proxy_g_signal (GDBusProxy *proxy,
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (g_strcmp0 (signal_name, "SetIconSymbol") == 0) {
|
||||
+ const gchar *name = NULL;
|
||||
+ gchar *icon_symbol = NULL;
|
||||
+ GValue value = { 0, };
|
||||
+
|
||||
+ name = ibus_engine_desc_get_name (engine->desc);
|
||||
+ g_return_if_fail (name != NULL);
|
||||
+ g_variant_get (parameters, "(s)", &icon_symbol);
|
||||
+ g_return_if_fail (icon_symbol != NULL);
|
||||
+
|
||||
+ g_value_init (&value, G_TYPE_STRING);
|
||||
+ g_value_set_string (&value, icon_symbol);
|
||||
+ g_object_set_property (G_OBJECT (engine->desc), "icon_symbol", &value);
|
||||
+ g_value_unset (&value);
|
||||
+
|
||||
+ bus_ibus_impl_set_icon_symbol_with_engine_name (BUS_DEFAULT_IBUS,
|
||||
+ name,
|
||||
+ icon_symbol);
|
||||
+ g_free (icon_symbol);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
|
||||
index b356b2c..38d6d11 100644
|
||||
--- a/bus/ibusimpl.c
|
||||
+++ b/bus/ibusimpl.c
|
||||
@@ -2342,3 +2342,36 @@ bus_ibus_impl_get_focused_input_context (BusIBusImpl *ibus)
|
||||
|
||||
return ibus->focused_context;
|
||||
}
|
||||
+
|
||||
+void
|
||||
+bus_ibus_impl_set_icon_symbol_with_engine_name (BusIBusImpl *ibus,
|
||||
+ const gchar *name,
|
||||
+ const gchar *icon_symbol)
|
||||
+{
|
||||
+ IBusEngineDesc *desc = NULL;
|
||||
+ GValue value = { 0, };
|
||||
+
|
||||
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
|
||||
+ g_assert (name != NULL);
|
||||
+ g_assert (icon_symbol != NULL);
|
||||
+
|
||||
+ desc = bus_ibus_impl_get_engine_desc (ibus, name);
|
||||
+
|
||||
+ if (desc == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ g_value_init (&value, G_TYPE_STRING);
|
||||
+ g_value_set_string (&value, icon_symbol);
|
||||
+ g_object_set_property (G_OBJECT (desc), "icon_symbol", &value);
|
||||
+ g_value_unset (&value);
|
||||
+
|
||||
+ /* Update status icon.
|
||||
+ * "enabled" signal is caught by ibus->panel and ibus->panel calls
|
||||
+ * StateChanged dbus method. */
|
||||
+ if (ibus->panel && ibus->focused_context) {
|
||||
+ if (bus_input_context_is_enabled (ibus->focused_context)) {
|
||||
+ bus_input_context_enable (ibus->focused_context);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/bus/ibusimpl.h b/bus/ibusimpl.h
|
||||
index 42edbf8..4f37cbc 100644
|
||||
--- a/bus/ibusimpl.h
|
||||
+++ b/bus/ibusimpl.h
|
||||
@@ -99,6 +99,10 @@ gboolean bus_ibus_impl_is_embed_preedit_text
|
||||
(BusIBusImpl *ibus);
|
||||
BusInputContext *bus_ibus_impl_get_focused_input_context
|
||||
(BusIBusImpl *ibus);
|
||||
+void bus_ibus_impl_set_icon_symbol_with_engine_name
|
||||
+ (BusIBusImpl *ibus,
|
||||
+ const gchar *name,
|
||||
+ const gchar *icon_symbol);
|
||||
|
||||
G_END_DECLS
|
||||
#endif
|
||||
diff --git a/ibus/engine.py b/ibus/engine.py
|
||||
index fe5dd98..e827408 100644
|
||||
--- a/ibus/engine.py
|
||||
+++ b/ibus/engine.py
|
||||
@@ -176,6 +176,9 @@ class EngineBase(object.Object):
|
||||
self.__proxy = None
|
||||
super(EngineBase,self).do_destroy()
|
||||
|
||||
+ def set_icon_symbol(self, icon_symbol):
|
||||
+ return self.__proxy.SetIconSymbol(icon_symbol)
|
||||
+
|
||||
|
||||
class EngineProxy(interface.IEngine):
|
||||
def __init__(self, engine, conn, object_path):
|
||||
diff --git a/ibus/enginedesc.py b/ibus/enginedesc.py
|
||||
index e8a8982..f6b4110 100644
|
||||
index e8a8982..3ca7f24 100644
|
||||
--- a/ibus/enginedesc.py
|
||||
+++ b/ibus/enginedesc.py
|
||||
@@ -31,7 +31,7 @@ from serializable import *
|
||||
@ -126,7 +18,7 @@ index e8a8982..f6b4110 100644
|
||||
__gtype_name__ = "PYIBusEngineDesc"
|
||||
__NAME__ = "IBusEngineDesc"
|
||||
- def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0):
|
||||
+ def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0, icon_symbol=""):
|
||||
+ def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0, symbol=""):
|
||||
super(EngineDesc, self).__init__()
|
||||
self.__name = name
|
||||
self.__longname = longname
|
||||
@ -134,7 +26,7 @@ index e8a8982..f6b4110 100644
|
||||
self.__layout = layout
|
||||
self.__rank = rank
|
||||
self.__hotkeys = hotkeys
|
||||
+ self.__icon_symbol = icon_symbol
|
||||
+ self.__symbol = symbol
|
||||
|
||||
def get_name(self):
|
||||
return self.__name
|
||||
@ -142,8 +34,8 @@ index e8a8982..f6b4110 100644
|
||||
def get_hotkeys(self):
|
||||
return self.__hotkeys
|
||||
|
||||
+ def get_icon_symbol(self):
|
||||
+ return self.__icon_symbol
|
||||
+ def get_symbol(self):
|
||||
+ return self.__symbol
|
||||
+
|
||||
name = property(get_name)
|
||||
longname = property(get_longname)
|
||||
@ -152,30 +44,27 @@ index e8a8982..f6b4110 100644
|
||||
layout = property(get_layout)
|
||||
rank = property(get_rank)
|
||||
hotkeys = property(get_hotkeys)
|
||||
+ icon_symbol = property(get_icon_symbol)
|
||||
+ symbol = property(get_symbol)
|
||||
|
||||
def serialize(self, struct):
|
||||
super(EngineDesc, self).serialize(struct)
|
||||
@@ -98,7 +103,9 @@ class EngineDesc(Serializable):
|
||||
@@ -97,8 +102,7 @@ class EngineDesc(Serializable):
|
||||
struct.append(dbus.String(self.__layout))
|
||||
struct.append(dbus.UInt32(self.__rank))
|
||||
struct.append(dbus.String(self.__hotkeys))
|
||||
# New properties of EngineDesc will use dict for serialize
|
||||
- # New properties of EngineDesc will use dict for serialize
|
||||
- struct.append(dbus.Array({}, signature=None))
|
||||
+ extension = dbus.Dictionary(signature="sv")
|
||||
+ extension[dbus.String('icon_symbol')] = dbus.String(self.__icon_symbol)
|
||||
+ struct.append(extension)
|
||||
+ struct.append(dbus.String(self.__symbol))
|
||||
|
||||
def deserialize(self, struct):
|
||||
super(EngineDesc, self).deserialize(struct)
|
||||
@@ -113,10 +120,13 @@ class EngineDesc(Serializable):
|
||||
@@ -112,11 +116,10 @@ class EngineDesc(Serializable):
|
||||
self.__layout = struct.pop(0)
|
||||
self.__rank = struct.pop(0)
|
||||
self.__hotkeys = struct.pop(0)
|
||||
# New properties of EngineDesc will use dict for serialize
|
||||
- # New properties of EngineDesc will use dict for serialize
|
||||
- #value = struct.pop(0)
|
||||
+ l = struct.pop(0)
|
||||
+ for key, value in l.items():
|
||||
+ if key == 'icon_symbol':
|
||||
+ self.__icon_symbol= unicode(value)
|
||||
+ self.__symbol = struct.pop(0)
|
||||
|
||||
def test():
|
||||
- engine = EngineDesc("Hello", "", "", "", "", "", "", "", "")
|
||||
@ -183,210 +72,178 @@ index e8a8982..f6b4110 100644
|
||||
value = serialize_object(engine)
|
||||
engine = deserialize_object(value)
|
||||
|
||||
diff --git a/ibus/interface/iengine.py b/ibus/interface/iengine.py
|
||||
index 9e0d981..7cefcdf 100644
|
||||
--- a/ibus/interface/iengine.py
|
||||
+++ b/ibus/interface/iengine.py
|
||||
@@ -157,3 +157,6 @@ class IEngine(dbus.service.Object):
|
||||
|
||||
@signal()
|
||||
def RequireSurroundingText(self): pass
|
||||
+
|
||||
+ @signal(signature="s")
|
||||
+ def SetIconSymbol(self, icon_symbol): pass
|
||||
diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c
|
||||
index ca5ef60..d3800e1 100644
|
||||
index ca5ef60..fa3a768 100644
|
||||
--- a/src/ibusenginedesc.c
|
||||
+++ b/src/ibusenginedesc.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "ibusenginedesc.h"
|
||||
#include "ibusxml.h"
|
||||
+#include "ibusenumtypes.h"
|
||||
|
||||
enum {
|
||||
LAST_SIGNAL,
|
||||
@@ -39,6 +40,7 @@ enum {
|
||||
@@ -39,6 +39,7 @@ enum {
|
||||
PROP_LAYOUT,
|
||||
PROP_RANK,
|
||||
PROP_HOTKEYS,
|
||||
+ PROP_ICON_SYMBOL,
|
||||
+ PROP_SYMBOL,
|
||||
};
|
||||
|
||||
|
||||
@@ -54,6 +56,7 @@ struct _IBusEngineDescPrivate {
|
||||
@@ -54,6 +55,7 @@ struct _IBusEngineDescPrivate {
|
||||
gchar *layout;
|
||||
guint rank;
|
||||
gchar *hotkeys;
|
||||
+ gchar *icon_symbol;
|
||||
+ gchar *symbol;
|
||||
};
|
||||
|
||||
#define IBUS_ENGINE_DESC_GET_PRIVATE(o) \
|
||||
@@ -232,6 +235,19 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
|
||||
@@ -232,6 +234,19 @@ ibus_engine_desc_class_init (IBusEngineDescClass *class)
|
||||
"The hotkeys of engine description",
|
||||
"",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
+
|
||||
+ /**
|
||||
+ * IBusEngineDesc:icon_symbol:
|
||||
+ * IBusEngineDesc:symbol:
|
||||
+ *
|
||||
+ * The symbol chars of engine description instead of icon image
|
||||
+ */
|
||||
+ g_object_class_install_property (gobject_class,
|
||||
+ PROP_ICON_SYMBOL,
|
||||
+ g_param_spec_string ("icon_symbol",
|
||||
+ "description icon_symbol",
|
||||
+ PROP_SYMBOL,
|
||||
+ g_param_spec_string ("symbol",
|
||||
+ "description symbol",
|
||||
+ "The icon symbol chars of engine description",
|
||||
+ "",
|
||||
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -249,6 +265,7 @@ ibus_engine_desc_init (IBusEngineDesc *desc)
|
||||
@@ -249,6 +264,7 @@ ibus_engine_desc_init (IBusEngineDesc *desc)
|
||||
desc->priv->layout = NULL;
|
||||
desc->priv->rank = 0;
|
||||
desc->priv->hotkeys = NULL;
|
||||
+ desc->priv->icon_symbol = NULL;
|
||||
+ desc->priv->symbol = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -263,6 +280,7 @@ ibus_engine_desc_destroy (IBusEngineDesc *desc)
|
||||
@@ -263,6 +279,7 @@ ibus_engine_desc_destroy (IBusEngineDesc *desc)
|
||||
g_free (desc->priv->icon);
|
||||
g_free (desc->priv->layout);
|
||||
g_free (desc->priv->hotkeys);
|
||||
+ g_free (desc->priv->icon_symbol);
|
||||
+ g_free (desc->priv->symbol);
|
||||
|
||||
IBUS_OBJECT_CLASS (ibus_engine_desc_parent_class)->destroy (IBUS_OBJECT (desc));
|
||||
}
|
||||
@@ -313,6 +331,10 @@ ibus_engine_desc_set_property (IBusEngineDesc *desc,
|
||||
@@ -313,6 +330,10 @@ ibus_engine_desc_set_property (IBusEngineDesc *desc,
|
||||
g_assert (desc->priv->hotkeys == NULL);
|
||||
desc->priv->hotkeys = g_value_dup_string (value);
|
||||
break;
|
||||
+ case PROP_ICON_SYMBOL:
|
||||
+ g_free (desc->priv->icon_symbol);
|
||||
+ desc->priv->icon_symbol = g_value_dup_string (value);
|
||||
+ case PROP_SYMBOL:
|
||||
+ g_assert (desc->priv->symbol == NULL);
|
||||
+ desc->priv->symbol = g_value_dup_string (value);
|
||||
+ break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (desc, prop_id, pspec);
|
||||
}
|
||||
@@ -355,6 +377,9 @@ ibus_engine_desc_get_property (IBusEngineDesc *desc,
|
||||
@@ -355,6 +376,9 @@ ibus_engine_desc_get_property (IBusEngineDesc *desc,
|
||||
case PROP_HOTKEYS:
|
||||
g_value_set_string (value, ibus_engine_desc_get_hotkeys (desc));
|
||||
break;
|
||||
+ case PROP_ICON_SYMBOL:
|
||||
+ g_value_set_string (value, ibus_engine_desc_get_icon_symbol (desc));
|
||||
+ case PROP_SYMBOL:
|
||||
+ g_value_set_string (value, ibus_engine_desc_get_symbol (desc));
|
||||
+ break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (desc, prop_id, pspec);
|
||||
}
|
||||
@@ -382,9 +407,28 @@ ibus_engine_desc_serialize (IBusEngineDesc *desc,
|
||||
@@ -371,6 +395,10 @@ ibus_engine_desc_serialize (IBusEngineDesc *desc,
|
||||
/* End dict iter */
|
||||
|
||||
#define NOTNULL(s) ((s) != NULL ? (s) : "")
|
||||
+ /* If you will add a new property, you can append it at the end and
|
||||
+ * you should not change the serialized order of name, longname,
|
||||
+ * description, ... because the order is also used in other applications
|
||||
+ * likes ibus-qt. */
|
||||
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->name));
|
||||
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->longname));
|
||||
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->description));
|
||||
@@ -381,7 +409,9 @@ ibus_engine_desc_serialize (IBusEngineDesc *desc,
|
||||
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->layout));
|
||||
g_variant_builder_add (builder, "u", desc->priv->rank);
|
||||
g_variant_builder_add (builder, "s", NOTNULL (desc->priv->hotkeys));
|
||||
+ g_variant_builder_add (builder, "s", NOTNULL (desc->priv->symbol));
|
||||
#undef NOTNULL
|
||||
+
|
||||
+ /* append extra properties */
|
||||
+ GVariantBuilder array;
|
||||
+ g_variant_builder_init (&array, G_VARIANT_TYPE ("a{sv}"));
|
||||
+ g_variant_builder_add (&array, "{sv}", "icon_symbol", g_variant_new_string (desc->priv->icon_symbol));
|
||||
+ g_variant_builder_add (builder, "v", g_variant_builder_end (&array));
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+ibus_engine_desc_deserialize_property (IBusEngineDesc *desc,
|
||||
+ const gchar *name,
|
||||
+ GVariant *variant)
|
||||
+{
|
||||
+ if (g_strcmp0 (name, "icon_symbol") == 0) {
|
||||
+ g_variant_get (variant, "s", &desc->priv->icon_symbol);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
static gint
|
||||
ibus_engine_desc_deserialize (IBusEngineDesc *desc,
|
||||
GVariant *variant)
|
||||
@@ -405,6 +449,23 @@ ibus_engine_desc_deserialize (IBusEngineDesc *desc,
|
||||
@@ -394,6 +424,10 @@ ibus_engine_desc_deserialize (IBusEngineDesc *desc,
|
||||
retval = IBUS_SERIALIZABLE_CLASS (ibus_engine_desc_parent_class)->deserialize ((IBusSerializable *)desc, variant);
|
||||
g_return_val_if_fail (retval, 0);
|
||||
|
||||
+ /* If you will add a new property, you can append it at the end and
|
||||
+ * you should not change the serialized order of name, longname,
|
||||
+ * description, ... because the order is also used in other applications
|
||||
+ * likes ibus-qt. */
|
||||
g_variant_get_child (variant, retval++, "s", &desc->priv->name);
|
||||
g_variant_get_child (variant, retval++, "s", &desc->priv->longname);
|
||||
g_variant_get_child (variant, retval++, "s", &desc->priv->description);
|
||||
@@ -404,6 +438,7 @@ ibus_engine_desc_deserialize (IBusEngineDesc *desc,
|
||||
g_variant_get_child (variant, retval++, "s", &desc->priv->layout);
|
||||
g_variant_get_child (variant, retval++, "u", &desc->priv->rank);
|
||||
g_variant_get_child (variant, retval++, "s", &desc->priv->hotkeys);
|
||||
+ g_variant_get_child (variant, retval++, "s", &desc->priv->symbol);
|
||||
|
||||
+ /* extract extra properties */
|
||||
+ GVariantIter iter;
|
||||
+ GVariant *child, *array;
|
||||
+
|
||||
+ g_variant_get_child (variant, retval++, "v", &array);
|
||||
+ g_variant_iter_init (&iter, array);
|
||||
+ while ((child = g_variant_iter_next_value (&iter))) {
|
||||
+ gchar *name;
|
||||
+ GVariant *value;
|
||||
+ g_variant_get (child, "{sv}", &name, &value);
|
||||
+ if (ibus_engine_desc_deserialize_property (desc, name, value))
|
||||
+ retval++;
|
||||
+ g_free (name);
|
||||
+ g_variant_unref (value);
|
||||
+ g_variant_unref (child);
|
||||
+ }
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -428,6 +489,7 @@ ibus_engine_desc_copy (IBusEngineDesc *dest,
|
||||
@@ -428,6 +463,7 @@ ibus_engine_desc_copy (IBusEngineDesc *dest,
|
||||
dest->priv->layout = g_strdup (src->priv->layout);
|
||||
dest->priv->rank = src->priv->rank;
|
||||
dest->priv->hotkeys = g_strdup (src->priv->hotkeys);
|
||||
+ dest->priv->icon_symbol = g_strdup (src->priv->icon_symbol);
|
||||
+ dest->priv->symbol = g_strdup (src->priv->symbol);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -465,6 +527,7 @@ ibus_engine_desc_output (IBusEngineDesc *desc,
|
||||
@@ -465,6 +501,7 @@ ibus_engine_desc_output (IBusEngineDesc *desc,
|
||||
OUTPUT_ENTRY_1(icon);
|
||||
OUTPUT_ENTRY_1(layout);
|
||||
OUTPUT_ENTRY_1(hotkeys);
|
||||
+ OUTPUT_ENTRY_1(icon_symbol);
|
||||
+ OUTPUT_ENTRY_1(symbol);
|
||||
g_string_append_indent (output, indent + 1);
|
||||
g_string_append_printf (output, "<rank>%u</rank>\n", desc->priv->rank);
|
||||
#undef OUTPUT_ENTRY
|
||||
@@ -498,6 +561,7 @@ ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc,
|
||||
@@ -498,6 +535,7 @@ ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc,
|
||||
PARSE_ENTRY_1(icon);
|
||||
PARSE_ENTRY_1(layout);
|
||||
PARSE_ENTRY_1(hotkeys);
|
||||
+ PARSE_ENTRY_1(icon_symbol);
|
||||
+ PARSE_ENTRY_1(symbol);
|
||||
#undef PARSE_ENTRY
|
||||
#undef PARSE_ENTRY_1
|
||||
if (g_strcmp0 (sub_node->name , "rank") == 0) {
|
||||
@@ -526,6 +590,7 @@ IBUS_ENGINE_DESC_GET_PROPERTY (icon, const gchar *)
|
||||
@@ -526,6 +564,7 @@ IBUS_ENGINE_DESC_GET_PROPERTY (icon, const gchar *)
|
||||
IBUS_ENGINE_DESC_GET_PROPERTY (layout, const gchar *)
|
||||
IBUS_ENGINE_DESC_GET_PROPERTY (rank, guint)
|
||||
IBUS_ENGINE_DESC_GET_PROPERTY (hotkeys, const gchar *)
|
||||
+IBUS_ENGINE_DESC_GET_PROPERTY (icon_symbol, const gchar *)
|
||||
+IBUS_ENGINE_DESC_GET_PROPERTY (symbol, const gchar *)
|
||||
#undef IBUS_ENGINE_DESC_GET_PROPERTY
|
||||
|
||||
IBusEngineDesc *
|
||||
@@ -573,6 +638,7 @@ ibus_engine_desc_new_varargs (const gchar *first_property_name, ...)
|
||||
@@ -573,6 +612,7 @@ ibus_engine_desc_new_varargs (const gchar *first_property_name, ...)
|
||||
g_assert (desc->priv->icon);
|
||||
g_assert (desc->priv->layout);
|
||||
g_assert (desc->priv->hotkeys);
|
||||
+ g_assert (desc->priv->icon_symbol);
|
||||
+ g_assert (desc->priv->symbol);
|
||||
|
||||
return desc;
|
||||
}
|
||||
diff --git a/src/ibusenginedesc.h b/src/ibusenginedesc.h
|
||||
index 9718b15..e3194c3 100644
|
||||
index 9718b15..76a7adc 100644
|
||||
--- a/src/ibusenginedesc.h
|
||||
+++ b/src/ibusenginedesc.h
|
||||
@@ -249,6 +249,16 @@ guint ibus_engine_desc_get_rank (IBusEngineDesc *info);
|
||||
const gchar *ibus_engine_desc_get_hotkeys (IBusEngineDesc *info);
|
||||
|
||||
/**
|
||||
+ * ibus_engine_desc_get_icon_symbol:
|
||||
+ * ibus_engine_desc_get_symbol:
|
||||
+ * @info: An IBusEngineDesc
|
||||
+ * @returns: icon_symbol property in IBusEngineDesc
|
||||
+ * @returns: symbol property in IBusEngineDesc
|
||||
+ *
|
||||
+ * Return the icon_symbol property in IBusEngineDesc. It should not be freed.
|
||||
+ * Return the symbol property in IBusEngineDesc. It should not be freed.
|
||||
+ */
|
||||
+const gchar *ibus_engine_desc_get_icon_symbol
|
||||
+const gchar *ibus_engine_desc_get_symbol
|
||||
+ (IBusEngineDesc *info);
|
||||
+
|
||||
+/**
|
||||
@ -394,5 +251,5 @@ index 9718b15..e3194c3 100644
|
||||
* @info: An IBusEngineDesc
|
||||
* @output: XML-formatted Input method engine description.
|
||||
--
|
||||
1.7.4.4
|
||||
1.7.5.4
|
||||
|
||||
|
@ -204,12 +204,24 @@ index 7383177..bff2407 100644
|
||||
|
||||
renderer = gtk.CellRendererPixbuf()
|
||||
renderer.set_property("xalign", 0)
|
||||
@@ -57,18 +60,51 @@ class EngineComboBox(gtk.ComboBox):
|
||||
@@ -57,21 +60,51 @@ class EngineComboBox(gtk.ComboBox):
|
||||
self.pack_start(renderer, True)
|
||||
self.set_cell_data_func(renderer, self.__name_cell_data_cb)
|
||||
|
||||
- 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:
|
||||
@ -244,15 +256,7 @@ 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:
|
||||
- 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:
|
||||
@ -266,7 +270,7 @@ index 7383177..bff2407 100644
|
||||
keys = lang.keys()
|
||||
keys.sort(locale.strcoll)
|
||||
#add "Others" to the end of the combo box
|
||||
@@ -76,29 +112,86 @@ class EngineComboBox(gtk.ComboBox):
|
||||
@@ -79,29 +112,89 @@ class EngineComboBox(gtk.ComboBox):
|
||||
keys.remove(ibus.get_language_name("Other"))
|
||||
keys += [ibus.get_language_name("Other")]
|
||||
for l in keys:
|
||||
@ -287,13 +291,17 @@ 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()
|
||||
+ lang = {}
|
||||
+ sub_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 lang_list == None or \
|
||||
+ self.__has_engine_in_lang_list(e, lang_list):
|
||||
@ -318,8 +326,7 @@ 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:
|
||||
@ -361,7 +368,7 @@ index 7383177..bff2407 100644
|
||||
else:
|
||||
renderer.set_property("visible", True)
|
||||
renderer.set_property("sensitive", True)
|
||||
@@ -110,7 +203,8 @@ class EngineComboBox(gtk.ComboBox):
|
||||
@@ -113,7 +206,8 @@ class EngineComboBox(gtk.ComboBox):
|
||||
renderer.set_property("pixbuf", pixbuf)
|
||||
|
||||
def __name_cell_data_cb(self, celllayout, renderer, model, iter):
|
||||
@ -371,7 +378,7 @@ index 7383177..bff2407 100644
|
||||
|
||||
if isinstance (engine, str) or isinstance (engine, unicode):
|
||||
renderer.set_property("sensitive", False)
|
||||
@@ -118,8 +212,15 @@ class EngineComboBox(gtk.ComboBox):
|
||||
@@ -121,8 +215,15 @@ class EngineComboBox(gtk.ComboBox):
|
||||
renderer.set_property("weight", pango.WEIGHT_NORMAL)
|
||||
elif isinstance(engine, int):
|
||||
renderer.set_property("sensitive", True)
|
||||
@ -389,7 +396,7 @@ index 7383177..bff2407 100644
|
||||
else:
|
||||
renderer.set_property("sensitive", True)
|
||||
renderer.set_property("text", engine.longname)
|
||||
@@ -134,13 +235,21 @@ class EngineComboBox(gtk.ComboBox):
|
||||
@@ -137,13 +238,21 @@ class EngineComboBox(gtk.ComboBox):
|
||||
if i == 0 or i == -1:
|
||||
return None
|
||||
iter = self.get_active_iter()
|
||||
|
13
ibus.spec
13
ibus.spec
@ -13,7 +13,7 @@
|
||||
|
||||
Name: ibus
|
||||
Version: 1.3.99.20110419
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Summary: Intelligent Input Bus for Linux OS
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -21,7 +21,7 @@ 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/gnome-shell-ibus-plugins-20110622.tar.bz2
|
||||
Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/gnome-shell-ibus-plugins-20110629.tar.bz2
|
||||
%endif
|
||||
Source3: https://www.transifex.net/projects/p/ibus/resource/master/l/da/download/ibus_master_da.po
|
||||
Source4: http://ueno.fedorapeople.org/ibus-indicator/ibus-indicator.tar.bz2
|
||||
@ -135,9 +135,6 @@ This is a transitional package which allows users to try out new IBus
|
||||
GUI for GNOME3 in development. Note that this package will be marked
|
||||
as obsolete once the integration has completed in the GNOME3 upstream.
|
||||
|
||||
%description gnome3
|
||||
This package contains ibus im module for gtk3
|
||||
|
||||
%package devel
|
||||
Summary: Development tools for ibus
|
||||
Group: Development/Libraries
|
||||
@ -167,6 +164,10 @@ sed -i \
|
||||
-e "s|Config.IBUS_XKB|'/usr/libexec/ibus-xkb'|" \
|
||||
-e "s|Config.HAVE_IBUS_XKB|true|" \
|
||||
js/ui/status/ibus/xkbLayout.js
|
||||
sed -i \
|
||||
-e "s|imports.misc.config.IBUS_PREFIX|'/usr'|" \
|
||||
-e "s|imports.misc.config.IBUS_PKGDATADIR|'/usr/share/ibus'|" \
|
||||
js/ui/status/ibus/panel.js
|
||||
bzcat %SOURCE4 | tar xf -
|
||||
%endif
|
||||
cp %SOURCE3 po/da.po
|
||||
@ -353,7 +354,7 @@ fi
|
||||
%{_datadir}/gtk-doc/html/*
|
||||
|
||||
%changelog
|
||||
* Mon Jun 20 2011 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.99.20110419-5
|
||||
* Mon Jun 20 2011 Takao Fujiwara <tfujiwar@redhat.com> - 1.3.99.20110419-6
|
||||
- Updated ibus-HEAD.patch for upstream.
|
||||
- Removed ibus-435880-surrounding-text.patch as upstream.
|
||||
- Added ibus-711632-fedora-fallback-icon.patch
|
||||
|
2
sources
2
sources
@ -1,4 +1,4 @@
|
||||
d4f2729fecb92ae6b41f26c770b1a772 ibus-1.3.99.20110419.tar.gz
|
||||
645ed3dd02f663589cdad28e57c25486 gnome-shell-ibus-plugins-20110622.tar.bz2
|
||||
3d3ba1c988a81f483785c1eac4b00532 gnome-shell-ibus-plugins-20110629.tar.bz2
|
||||
698c90edf0f037488e1aa969804e891f ibus_master_da.po
|
||||
23756d25109745bdc1c3a54db370d210 ibus-indicator.tar.bz2
|
||||
|
Loading…
Reference in New Issue
Block a user