Bumped to 1.4.99.20120317

This commit is contained in:
Takao Fujiwara 2012-03-18 18:41:41 +09:00
parent 936f5059a5
commit 19c65a7542
8 changed files with 817 additions and 820 deletions

2
.gitignore vendored
View File

@ -17,6 +17,7 @@ ibus-1.3.6.tar.gz
/ibus-1.3.99.20110817.tar.gz
/ibus-1.4.99.20120203.tar.gz
/ibus-1.4.99.20120304.tar.gz
/ibus-1.4.99.20120317.tar.gz
/ibus-gjs-3.0.2.20110823.tar.gz
/ibus-gjs-3.1.4.20110823.tar.gz
/ibus-gjs-3.0.2.20110908.tar.gz
@ -37,3 +38,4 @@ ibus-1.3.6.tar.gz
/ibus-gjs-3.2.1.20111230.tar.gz
/ibus-gjs-3.3.3.20120203.tar.gz
/ibus-gjs-3.3.90.20120308.tar.gz
/ibus-gjs-3.3.90.20120317.tar.gz

View File

@ -1,6 +1,6 @@
From 8f5bb828744532bcfded7e92f3a1db1f26e567e8 Mon Sep 17 00:00:00 2001
From 38cfe0622ece31d4aff2827a7d67f7250f0e0d5e Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 30 Dec 2011 15:46:56 +0900
Date: Fri, 16 Mar 2012 20:47:35 +0900
Subject: [PATCH] Reload preload engines until users customize the list.
The idea is, if users don't customize the preload_engines with ibus-setup,
@ -17,507 +17,20 @@ on ibus-setup, ibus-setup sets 'preload_engine_mode' as
IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
'preload_engines'.
---
bus/ibusimpl.c | 412 +++++++++++++++++++++++++++++++++++++++-----------
data/ibus.schemas.in | 15 ++-
ibus/common.py | 6 +
setup/main.py | 73 ++++++++-
setup/setup.ui | 21 +++-
src/ibustypes.h | 10 ++
6 files changed, 440 insertions(+), 97 deletions(-)
data/ibus.schemas.in | 24 +++++++++
setup/main.py | 61 +++++++++++++++++++++--
setup/setup.ui | 21 +++++++-
src/ibustypes.h | 10 ++++
ui/gtk3/panel.vala | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 245 insertions(+), 7 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 059d660..bba9353 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -142,6 +142,9 @@ static void bus_ibus_impl_set_previous_engine
static void bus_ibus_impl_set_preload_engines
(BusIBusImpl *ibus,
GVariant *value);
+static void bus_ibus_impl_set_preload_engine_mode
+ (BusIBusImpl *ibus,
+ GVariant *value);
static void bus_ibus_impl_set_use_sys_layout
(BusIBusImpl *ibus,
GVariant *value);
@@ -283,6 +286,269 @@ _panel_destroy_cb (BusPanelProxy *panel,
}
static void
+_config_set_value_done (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ IBusConfig *config = (IBusConfig *) object;
+ GVariant *value = (GVariant *) user_data;
+ GError *error = NULL;
+
+ g_assert (IBUS_IS_CONFIG (config));
+
+ if (!ibus_config_set_value_async_finish (config, res, &error)) {
+ if (error) {
+ g_error_free (error);
+ }
+ }
+ g_variant_unref (value);
+}
+
+#ifndef OS_CHROMEOS
+static gint
+_engine_desc_cmp (IBusEngineDesc *desc1,
+ IBusEngineDesc *desc2)
+{
+ return - ((gint) ibus_engine_desc_get_rank (desc1)) +
+ ((gint) ibus_engine_desc_get_rank (desc2));
+}
+#endif
+
+#ifndef OS_CHROMEOS
+static gint
+_get_config_preload_engine_mode (BusIBusImpl *ibus)
+{
+ GVariant *variant = NULL;
+ gint preload_engine_mode = IBUS_PRELOAD_ENGINE_MODE_USER;
+
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+
+ if (ibus->config == NULL) {
+ return preload_engine_mode;
+ }
+
+ variant = ibus_config_get_value (ibus->config, "general",
+ "preload_engines");
+ if (variant != NULL && g_variant_classify (variant) == G_VARIANT_CLASS_ARRAY) {
+ GVariantIter iter;
+ const gchar *engine_name = NULL;
+ g_variant_iter_init (&iter, variant);
+ g_variant_iter_loop (&iter, "&s", &engine_name);
+ if (g_strcmp0 (engine_name, "ibus_null_engine") == 0) {
+ g_variant_unref (variant);
+ variant = NULL;
+ }
+ }
+ if (variant == NULL) {
+ /* Set LANG_RELATIVE mode for the initial login */
+ preload_engine_mode = IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE;
+ variant = g_variant_ref_sink (g_variant_new ("i", preload_engine_mode));
+ ibus_config_set_value_async (ibus->config, "general",
+ "preload_engine_mode", variant,
+ -1,
+ NULL,
+ _config_set_value_done,
+ variant);
+ return preload_engine_mode;
+ } else {
+ g_variant_unref (variant);
+ }
+
+ variant = ibus_config_get_value (ibus->config, "general",
+ "preload_engine_mode");
+ if (variant != NULL) {
+ if (g_variant_classify (variant) == G_VARIANT_CLASS_INT32) {
+ preload_engine_mode = g_variant_get_int32 (variant);
+ }
+ g_variant_unref (variant);
+ }
+
+ return preload_engine_mode;
+}
+#endif
+
+static int
+_compare_engine_list_value (GVariant *value_a, GVariant *value_b)
+{
+ GVariant *value;
+ GVariantIter iter;
+ const gchar *engine_name = NULL;
+ gchar *concat_engine_names;
+ gchar *concat_engine_names_a = NULL;
+ gchar *concat_engine_names_b = NULL;
+ int retval = 0;
+
+ value = value_a;
+ concat_engine_names = NULL;
+ if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
+ g_variant_iter_init (&iter, value);
+ while (g_variant_iter_loop (&iter, "&s", &engine_name)) {
+ gchar *tmp = g_strdup_printf ("%s::%s",
+ concat_engine_names ? concat_engine_names : "",
+ engine_name ? engine_name : "");
+ g_free (concat_engine_names);
+ concat_engine_names = tmp;
+ }
+ }
+ concat_engine_names_a = concat_engine_names;
+
+ value = value_b;
+ concat_engine_names = NULL;
+ if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
+ g_variant_iter_init (&iter, value);
+ while (g_variant_iter_loop (&iter, "&s", &engine_name)) {
+ gchar *tmp = g_strdup_printf ("%s::%s",
+ concat_engine_names ? concat_engine_names : "",
+ engine_name ? engine_name : "");
+ g_free (concat_engine_names);
+ concat_engine_names = tmp;
+ }
+ }
+ concat_engine_names_b = concat_engine_names;
+
+ retval = g_strcmp0 (concat_engine_names_a, concat_engine_names_b);
+ g_free (concat_engine_names_a);
+ g_free (concat_engine_names_b);
+ return retval;
+}
+
+static void
+_preload_engines_config_get_value_done (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ IBusConfig *config = (IBusConfig *) object;
+ GVariant *new_value = (GVariant *) user_data;
+ GVariant *value = NULL;
+ GError *error = NULL;
+
+ g_assert (IBUS_IS_CONFIG (config));
+
+ value = ibus_config_get_value_async_finish (config, res, &error);
+ if (error) {
+ g_error_free (error);
+ }
+ if (_compare_engine_list_value (value, new_value) != 0) {
+ ibus_config_set_value_async (config, "general",
+ "preload_engines", new_value,
+ -1,
+ NULL,
+ _config_set_value_done,
+ new_value);
+ } else if (new_value) {
+ g_variant_unref (new_value);
+ }
+ if (value) {
+ g_variant_unref (value);
+ }
+}
+
+static void
+_set_preload_engines (BusIBusImpl *ibus,
+ GVariant *value)
+{
+ GList *engine_list = NULL;
+
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+
+ g_list_foreach (ibus->engine_list, (GFunc) g_object_unref, NULL);
+ g_list_free (ibus->engine_list);
+
+ if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
+ GVariantIter iter;
+ g_variant_iter_init (&iter, value);
+ const gchar *engine_name = NULL;
+ while (g_variant_iter_loop (&iter, "&s", &engine_name)) {
+ IBusEngineDesc *engine = bus_registry_find_engine_by_name (ibus->registry, engine_name);
+ if (engine == NULL || g_list_find (engine_list, engine) != NULL)
+ continue;
+ engine_list = g_list_append (engine_list, engine);
+ }
+
+ if (engine_list != NULL &&
+ ibus->config != NULL) {
+ /* sync function will effects the startup performance.
+ * We'd always like to save the value so that ibus-setup
+ * get the updated engine list. */
+ ibus_config_get_value_async (ibus->config, "general",
+ "preload_engines",
+ -1,
+ NULL,
+ _preload_engines_config_get_value_done,
+ g_variant_ref_sink (value));
+ } else {
+ /* We don't update preload_engines with an empty string for safety.
+ * Just unref the floating value. */
+ g_variant_unref (value);
+ }
+ } else if (value != NULL) {
+ g_variant_unref (value);
+ }
+
+ g_list_foreach (engine_list, (GFunc) g_object_ref, NULL);
+ ibus->engine_list = engine_list;
+
+ if (ibus->engine_list) {
+ BusComponent *component = bus_component_from_engine_desc ((IBusEngineDesc *) ibus->engine_list->data);
+ if (component && !bus_component_is_running (component)) {
+ bus_component_start (component, g_verbose);
+ }
+ }
+
+ bus_ibus_impl_check_global_engine (ibus);
+ bus_ibus_impl_update_engines_hotkey_profile (ibus);
+}
+
+#ifndef OS_CHROMEOS
+static void
+_set_language_relative_preload_engines (BusIBusImpl *ibus)
+{
+ gchar *lang = NULL;
+ gchar *p = NULL;
+ GList *engines = NULL;
+ GList *list;
+ GVariantBuilder builder;
+
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+
+ /* The setlocale call first checks LC_ALL. If it's not available, checks
+ * LC_CTYPE. If it's also not available, checks LANG. */
+ lang = g_strdup (setlocale (LC_CTYPE, NULL));
+ if (lang == NULL) {
+ return;
+ }
+
+ p = index (lang, '.');
+ if (p) {
+ *p = '\0';
+ }
+
+ engines = bus_registry_get_engines_by_language (ibus->registry, lang);
+ if (engines == NULL) {
+ p = index (lang, '_');
+ if (p) {
+ *p = '\0';
+ engines = bus_registry_get_engines_by_language (ibus->registry, lang);
+ }
+ }
+ g_free (lang);
+
+ /* sort engines by rank */
+ engines = g_list_sort (engines, (GCompareFunc) _engine_desc_cmp);
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
+ for (list = engines; list != NULL; list = list->next) {
+ IBusEngineDesc *desc = (IBusEngineDesc *)list->data;
+ /* ignore engines with rank <== 0 */
+ if (ibus_engine_desc_get_rank (desc) > 0)
+ g_variant_builder_add (&builder, "s", ibus_engine_desc_get_name (desc));
+ }
+ _set_preload_engines (ibus, g_variant_builder_end (&builder));
+ g_list_free (engines);
+}
+#endif
+
+static void
bus_ibus_impl_set_hotkey (BusIBusImpl *ibus,
GQuark hotkey,
GVariant *value)
@@ -392,35 +658,50 @@ static void
bus_ibus_impl_set_preload_engines (BusIBusImpl *ibus,
GVariant *value)
{
- GList *engine_list = NULL;
-
- g_list_foreach (ibus->engine_list, (GFunc) g_object_unref, NULL);
- g_list_free (ibus->engine_list);
+#ifndef OS_CHROMEOS
+ gint preload_engine_mode = _get_config_preload_engine_mode (ibus);
- if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
- GVariantIter iter;
- g_variant_iter_init (&iter, value);
- const gchar *engine_name = NULL;
- while (g_variant_iter_loop (&iter, "&s", &engine_name)) {
- IBusEngineDesc *engine = bus_registry_find_engine_by_name (ibus->registry, engine_name);
- if (engine == NULL || g_list_find (engine_list, engine) != NULL)
- continue;
- engine_list = g_list_append (engine_list, engine);
+ if (preload_engine_mode == IBUS_PRELOAD_ENGINE_MODE_USER) {
+ if (value == NULL) {
+ _set_language_relative_preload_engines (ibus);
+ } else {
+ _set_preload_engines (ibus, value);
}
}
+#else
+ _set_preload_engines (ibus, value);
+#endif
+}
- g_list_foreach (engine_list, (GFunc) g_object_ref, NULL);
- ibus->engine_list = engine_list;
+/**
+ * bus_ibus_impl_set_preload_engine_mode:
+ *
+ * A function to be called when "preload_engine_mode" config is updated.
+ */
+static void
+bus_ibus_impl_set_preload_engine_mode (BusIBusImpl *ibus,
+ GVariant *value)
+{
+#ifndef OS_CHROMEOS
+ gint preload_engine_mode = IBUS_PRELOAD_ENGINE_MODE_USER;
- if (ibus->engine_list) {
- BusComponent *component = bus_component_from_engine_desc ((IBusEngineDesc *) ibus->engine_list->data);
- if (component && !bus_component_is_running (component)) {
- bus_component_start (component, g_verbose);
- }
+ /* bus_ibus_impl_reload_config() sets value = NULL.
+ * bus_ibus_impl_reload_config() is always called when
+ * RequestName signal is sent so it is good to get the gconf value
+ * again when value == NULL.
+ */
+ if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_INT32) {
+ preload_engine_mode = g_variant_get_int32 (value);
+ } else {
+ preload_engine_mode = _get_config_preload_engine_mode (ibus);
}
- bus_ibus_impl_check_global_engine (ibus);
- bus_ibus_impl_update_engines_hotkey_profile (ibus);
+ if (preload_engine_mode == IBUS_PRELOAD_ENGINE_MODE_USER) {
+ return;
+ }
+
+ _set_language_relative_preload_engines (ibus);
+#endif
}
/**
@@ -501,89 +782,47 @@ bus_ibus_impl_set_use_global_engine (BusIBusImpl *ibus,
}
}
-#ifndef OS_CHROMEOS
-static gint
-_engine_desc_cmp (IBusEngineDesc *desc1,
- IBusEngineDesc *desc2)
-{
- return - ((gint) ibus_engine_desc_get_rank (desc1)) +
- ((gint) ibus_engine_desc_get_rank (desc2));
-}
-#endif
-
/**
* bus_ibus_impl_set_default_preload_engines:
*
- * If the "preload_engines" config variable is not set yet, set the default value which is determined based on a current locale.
+ * bus_ibus_impl_set_default_preload_engines handles the gconf value
+ * /desktop/ibus/general/preload_engines and preload_engine_mode.
+ * The idea is, if users don't customize the preload_engines with ibus-setup,
+ * users would prefer to load the system default engines again by login.
+ * The gconf value 'preload_engine_mode' is
+ * IBUS_PRELOAD_ENGINE_MODE_USER by default but set
+ * IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE for the initial login.
+ * If preload_engine_mode is IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE,
+ * ibus-daemon loads the system preload engines by langs.
+ * If preload_engine_mode is IBUS_PRELOAD_ENGINE_MODE_USER,
+ * ibus-daemon do not update the gconf value preload_engines.
+ * On the other hand, if users enable the customized engine checkbutton
+ * on ibus-setup, ibus-setup sets 'preload_engine_mode' as
+ * IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
+ * 'preload_engines'.
*/
static void
bus_ibus_impl_set_default_preload_engines (BusIBusImpl *ibus)
{
#ifndef OS_CHROMEOS
- g_assert (BUS_IS_IBUS_IMPL (ibus));
-
static gboolean done = FALSE;
+ gint preload_engine_mode = IBUS_PRELOAD_ENGINE_MODE_USER;
+
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
if (done || ibus->config == NULL) {
return;
}
- GVariant *variant = ibus_config_get_value (ibus->config, "general", "preload_engines");
- if (variant != NULL) {
+ preload_engine_mode = _get_config_preload_engine_mode (ibus);
+
+ if (preload_engine_mode == IBUS_PRELOAD_ENGINE_MODE_USER) {
done = TRUE;
- g_variant_unref (variant);
return;
}
done = TRUE;
-
- /* The setlocale call first checks LC_ALL. If it's not available, checks
- * LC_CTYPE. If it's also not available, checks LANG. */
- gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL));
- if (lang == NULL) {
- return;
- }
-
- gchar *p = index (lang, '.');
- if (p) {
- *p = '\0';
- }
-
- GList *engines = bus_registry_get_engines_by_language (ibus->registry, lang);
- if (engines == NULL) {
- p = index (lang, '_');
- if (p) {
- *p = '\0';
- engines = bus_registry_get_engines_by_language (ibus->registry, lang);
- }
- }
- g_free (lang);
-
- /* sort engines by rank */
- engines = g_list_sort (engines, (GCompareFunc) _engine_desc_cmp);
-
- GVariantBuilder builder;
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
- GList *list;
- for (list = engines; list != NULL; list = list->next) {
- IBusEngineDesc *desc = (IBusEngineDesc *) list->data;
- /* ignore engines with rank <= 0 */
- if (ibus_engine_desc_get_rank (desc) > 0)
- g_variant_builder_add (&builder, "s", ibus_engine_desc_get_name (desc));
- }
-
- GVariant *value = g_variant_builder_end (&builder);
- if (value != NULL) {
- if (g_variant_n_children (value) > 0) {
- ibus_config_set_value (ibus->config,
- "general", "preload_engines", value);
- } else {
- /* We don't update preload_engines with an empty string for safety.
- * Just unref the floating value. */
- g_variant_unref (value);
- }
- }
- g_list_free (engines);
+ _set_language_relative_preload_engines (ibus);
#endif
}
@@ -599,6 +838,7 @@ const static struct {
{ "general/hotkey", "next_engine_in_menu", bus_ibus_impl_set_next_engine_in_menu },
{ "general/hotkey", "previous_engine", bus_ibus_impl_set_previous_engine },
{ "general", "preload_engines", bus_ibus_impl_set_preload_engines },
+ { "general", "preload_engine_mode", bus_ibus_impl_set_preload_engine_mode },
{ "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
{ "general", "use_global_engine", bus_ibus_impl_set_use_global_engine },
{ "general", "embed_preedit_text", bus_ibus_impl_set_embed_preedit_text },
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index e0a6a37..2418c95 100644
index 05c0174..8ca33ac 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -6,7 +6,7 @@
<applyto>/desktop/ibus/general/preload_engines</applyto>
<owner>ibus</owner>
<type>list</type>
- <default>[]</default>
+ <default>[ibus_null_engine]</default>
<list_type>string</list_type>
<locale name="C">
<short>Preload engines</short>
@@ -14,6 +14,19 @@
</locale>
</schema>
@@ -2,6 +2,30 @@
<gconfschemafile>
<schemalist>
<schema>
+ <key>/schemas/desktop/ibus/general/preload_engine_mode</key>
+ <applyto>/desktop/ibus/general/preload_engine_mode</applyto>
@ -526,125 +39,80 @@ index e0a6a37..2418c95 100644
+ <default>0</default>
+ <locale name="C">
+ <short>Preload engine mode</short>
+ <long>Preload engines are loaded with this mode.
+ 0 = user customized engines.
+ 1 = language related engines.</long>
+ <long>Preload engines are loaded with this mode.
+ 0 = user customized engines.
+ 1 = language related engines.</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/ibus/general/hotkey/trigger</key>
<applyto>/desktop/ibus/general/hotkey/trigger</applyto>
+ <key>/schemas/desktop/ibus/general/preload_engines_inited</key>
+ <applyto>/desktop/ibus/general/preload_engines_inited</applyto>
+ <owner>ibus</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>The key preload_engines is initialized</short>
+ <long>The key preload_engines is initialized</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/ibus/general/preload_engines</key>
<applyto>/desktop/ibus/general/preload_engines</applyto>
<owner>ibus</owner>
diff --git a/ibus/common.py b/ibus/common.py
index 6483aae..127ed93 100644
--- a/ibus/common.py
+++ b/ibus/common.py
@@ -40,6 +40,8 @@ __all__ = (
"BUS_REQUEST_NAME_REPLY_IN_QUEUE",
"BUS_REQUEST_NAME_REPLY_EXISTS",
"BUS_REQUEST_NAME_REPLY_ALREADY_OWNER",
+ "PRELOAD_ENGINE_MODE_USER",
+ "PRELOAD_ENGINE_MODE_LANG_RELATIVE",
"default_reply_handler",
"default_error_handler",
"DEFAULT_ASYNC_HANDLERS",
@@ -150,6 +152,10 @@ BUS_REQUEST_NAME_REPLY_IN_QUEUE = 2
BUS_REQUEST_NAME_REPLY_EXISTS = 3
BUS_REQUEST_NAME_REPLY_ALREADY_OWNER = 4
+# define preload engine mode
+PRELOAD_ENGINE_MODE_USER = 0
+PRELOAD_ENGINE_MODE_LANG_RELATIVE = 1
+
def default_reply_handler( *args):
pass
diff --git a/setup/main.py b/setup/main.py
index 97e05a4..7d734ae 100644
index 9638da0..132e9f4 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -92,6 +92,7 @@ class Setup(object):
# keyboard shortcut
# trigger
self.__config = self.__bus.get_config()
+ self.__config.connect("value-changed", self.__config_value_changed_cb)
shortcuts = self.__config.get_value(
"general/hotkey", "trigger",
ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT)
@@ -213,15 +214,22 @@ class Setup(object):
self.__checkbutton_use_global_engine.connect("toggled", self.__checkbutton_use_global_engine_toggled_cb)
@@ -181,6 +181,20 @@ class Setup(object):
self.__checkbutton_use_global_engine.connect("toggled",
self.__checkbutton_use_global_engine_toggled_cb)
# init engine page
+ preload_engine_mode = self.__config.get_value("general",
+ "preload_engine_mode",
+ ibus.common.PRELOAD_ENGINE_MODE_USER)
+ # set preload mode
+ preload_engine_mode = IBus.PreloadEngineMode.USER
+ variant = self.__config.get_value("general", "preload_engine_mode")
+ if variant != None:
+ preload_engine_mode = variant.get_int32()
+ button = self.__builder.get_object("checkbutton_preload_engine_mode")
+ if preload_engine_mode == ibus.common.PRELOAD_ENGINE_MODE_USER:
+ if preload_engine_mode == IBus.PreloadEngineMode.USER:
+ button.set_active(True)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
+ else:
+ button.set_active(False)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(False)
+ button.connect("toggled", self.__checkbutton_preload_engine_mode_toggled_cb)
+
# init engine page
self.__engines = self.__bus.list_engines()
self.__combobox = self.__builder.get_object("combobox_engines")
self.__combobox.set_engines(self.__engines)
value = self.__config.get_value("general", "load_xkb_layouts")
@@ -245,6 +259,7 @@ class Setup(object):
self.__checkbutton_auto_start_toggled_cb)
- tmp_dict = {}
- for e in self.__engines:
- tmp_dict[e.name] = e
- engine_names = self.__config.get_value("general", "preload_engines", [])
- engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ engines = self.__bus.list_active_engines()
self.__config = self.__bus.get_config()
+ self.__config.connect("value-changed", self.__config_value_changed_cb)
self.__treeview = self.__builder.get_object("treeview_engines")
self.__treeview.set_engines(engines)
@@ -251,7 +259,8 @@ class Setup(object):
self.__init_hotkey()
self.__init_panel()
@@ -253,8 +268,8 @@ class Setup(object):
def __combobox_notify_active_engine_cb(self, combobox, property):
engine = self.__combobox.get_active_engine()
button = self.__builder.get_object("button_engine_add")
- button.set_sensitive(engine != None and engine not in self.__treeview.get_engines())
- button.set_sensitive(
- engine != None and engine not in self.__treeview.get_engines())
+ button.set_sensitive(engine != None and \
+ engine.name not in map(lambda e: e.name, self.__treeview.get_engines()))
+ engine.get_name() not in map(lambda e: e.get_name(), self.__treeview.get_engines()))
def __get_engine_setup_exec_args(self, engine):
args = []
@@ -293,6 +302,26 @@ class Setup(object):
engine_names = map(lambda e: e.name, engines)
self.__config.set_list("general", "preload_engines", engine_names, "s")
+ def __get_engine_descs_from_names(self, engine_names):
+ tmp_dict = {}
+ for e in self.__engines:
+ tmp_dict[e.name] = e
+ engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ return engines
+
+ def __compare_descs(self, engines_a, engines_b):
+ engines = engines_a
+ concat_engine_names = ""
+ for engine in engines:
+ concat_engine_names = "%s::%s" % (concat_engine_names, engine.name)
+ concat_engine_names_a = concat_engine_names
+ engines = engines_b
+ concat_engine_names = ""
+ for engine in engines:
+ concat_engine_names = "%s::%s" % (concat_engine_names, engine.name)
+ concat_engine_names_b = concat_engine_names
+ return concat_engine_names_a == concat_engine_names_b
+
def __button_engine_add_cb(self, button):
engine = self.__combobox.get_active_engine()
self.__treeview.append_engine(engine)
@@ -322,6 +351,32 @@ class Setup(object):
@@ -333,6 +348,34 @@ class Setup(object):
del self.__engine_setup_exec_list[name]
self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
+ def __checkbutton_preload_engine_mode_toggled_cb(self, button):
+ if button.get_active():
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.USER)
+ self.__config.set_value("general",
+ "preload_engine_mode",
+ ibus.common.PRELOAD_ENGINE_MODE_USER)
+ variant)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
+ self.__treeview.notify("engines")
+ else:
@ -652,41 +120,50 @@ index 97e05a4..7d734ae 100644
+ "cleared immediately and the list will be " \
+ "configured by the login language every time. " \
+ "Do you agree with this?")
+ dlg = gtk.MessageDialog(type = gtk.MESSAGE_QUESTION,
+ buttons = gtk.BUTTONS_YES_NO,
+ dlg = Gtk.MessageDialog(type = Gtk.MessageType.QUESTION,
+ buttons = Gtk.ButtonsType.YES_NO,
+ message_format = message)
+ id = dlg.run()
+ dlg.destroy()
+ self.__flush_gtk_events()
+ if id != gtk.RESPONSE_YES:
+ if id != Gtk.ResponseType.YES:
+ button.set_active(True)
+ return
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.LANG_RELATIVE)
+ self.__config.set_value("general",
+ "preload_engine_mode",
+ ibus.common.PRELOAD_ENGINE_MODE_LANG_RELATIVE)
+ variant)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(False)
+
def __init_bus(self):
try:
self.__bus = ibus.Bus()
@@ -512,7 +567,11 @@ class Setup(object):
self.__bus = IBus.Bus()
if self.__bus.is_connected():
@@ -543,8 +586,18 @@ class Setup(object):
value = GLib.Variant.new_boolean(value)
self.__config.set_value("general", "use_global_engine", value)
def __config_value_changed_cb(self, bus, section, name, value):
- def __config_value_changed_cb(self, bus, section, name, value):
- pass
+ def __config_value_changed_cb(self, bus, section, name, variant):
+ if section == 'general' and name == 'preload_engines':
+ value = []
+ if variant != None:
+ value = variant.dup_strv()[0]
+ engines = self.__get_engine_descs_from_names(value)
+ current_engines = self.__treeview.get_engines()
+ if self.__compare_descs(engines, current_engines) == False:
+ engines_csv = str.join(',', map(lambda e: e.get_name(), engines))
+ current_engines_csv = \
+ str.join(',', map(lambda e: e.get_name(), current_engines))
+ if engines_csv != current_engines_csv:
+ self.__treeview.set_engines(engines)
def __config_reloaded_cb(self, bus):
pass
diff --git a/setup/setup.ui b/setup/setup.ui
index 57cb597..b2ceef2 100644
index e37cb32..fec1646 100644
--- a/setup/setup.ui
+++ b/setup/setup.ui
@@ -582,7 +582,22 @@
@@ -585,7 +585,22 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
@ -710,7 +187,7 @@ index 57cb597..b2ceef2 100644
<property name="visible">True</property>
<child>
<object class="GtkAlignment" id="alignment6">
@@ -749,7 +764,7 @@
@@ -752,7 +767,7 @@
</child>
</object>
<packing>
@ -719,7 +196,7 @@ index 57cb597..b2ceef2 100644
</packing>
</child>
<child>
@@ -788,7 +803,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
@@ -791,7 +806,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
</object>
<packing>
<property name="expand">False</property>
@ -749,6 +226,168 @@ index d916265..422eb84 100644
* IBusRectangle:
* @x: x coordinate.
* @y: y coordinate.
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index f8805e0..7bd0d93 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -187,6 +187,8 @@ class Panel : IBus.PanelService {
if (m_config != null) {
m_config.value_changed.connect(config_value_changed_cb);
m_config.watch("general", "preload_engines");
+ m_config.watch("general", "preload_engines_inited");
+ m_config.watch("general", "preload_engine_mode");
m_config.watch("general", "engines_order");
m_config.watch("panel", "custom_font");
m_config.watch("panel", "use_custom_font");
@@ -246,7 +248,136 @@ class Panel : IBus.PanelService {
init_gkbd();
}
+ GLib.Variant var_engines =
+ m_config.get_value("general", "preload_engines");
+ string[] preload_engines = {};
+
+ if (var_engines != null) {
+ preload_engines = var_engines.dup_strv();
+ }
+
+ bool preload_engines_inited = false;
+ GLib.Variant var_preload_engines_inited =
+ m_config.get_value("general", "preload_engines_inited");
+
+ if (var_preload_engines_inited != null) {
+ preload_engines_inited = var_preload_engines_inited.get_boolean();
+ }
+
+ // Set preload_engines_inited = true for back compatibility
+ if (preload_engines.length != 0 && !preload_engines_inited) {
+ preload_engines_inited = true;
+ m_config.set_value("general",
+ "preload_engines_inited",
+ new GLib.Variant.boolean(true));
+ }
+
update_xkb_engines();
+
+ // Before update preload_engine_mode, update_xkb_engines() is called
+ // because config_value_changed_cb() calls update_im_engines().
+ if (!preload_engines_inited) {
+ GLib.Variant variant = new GLib.Variant.int32(
+ IBus.PreloadEngineMode.LANG_RELATIVE);
+ m_config.set_value("general",
+ "preload_engine_mode",
+ variant);
+ }
+
+ update_im_engines();
+
+ if (!preload_engines_inited) {
+ m_config.set_value("general",
+ "preload_engines_inited",
+ new GLib.Variant.boolean(true));
+ }
+ }
+
+ private bool set_lang_relative_preload_engines() {
+ string locale = Intl.setlocale(LocaleCategory.CTYPE, null);
+
+ if (locale == null) {
+ locale = "C";
+ }
+
+ string lang = locale.split(".")[0];
+ GLib.List<IBus.EngineDesc> engines = m_bus.list_engines();
+ string[] im_engines = {};
+
+ for (unowned GLib.List<IBus.EngineDesc> p = engines;
+ p != null;
+ p = p.next) {
+ unowned IBus.EngineDesc engine = p.data;
+ if (engine.get_language() == lang &&
+ engine.get_rank() > 0) {
+ im_engines += engine.get_name();
+ }
+ }
+
+ lang = lang.split("_")[0];
+ if (im_engines.length == 0) {
+ for (unowned GLib.List<IBus.EngineDesc> p = engines;
+ p != null;
+ p = p.next) {
+ unowned IBus.EngineDesc engine = p.data;
+ if (engine.get_language() == lang &&
+ engine.get_rank() > 0) {
+ im_engines += engine.get_name();
+ }
+ }
+ }
+
+ if (im_engines.length == 0) {
+ return false;
+ }
+
+ GLib.Variant var_engines =
+ m_config.get_value("general", "preload_engines");
+ string[] orig_preload_engines = {};
+ string[] preload_engines = {};
+
+ if (var_engines != null) {
+ orig_preload_engines = var_engines.dup_strv();
+ }
+
+ // clear input method engines
+ foreach (string name in orig_preload_engines) {
+ if (name.ascii_ncasecmp("xkb:", 4) != 0) {
+ continue;
+ }
+ preload_engines += name;
+ }
+
+ foreach (string name in im_engines) {
+ if (!(name in preload_engines)) {
+ preload_engines += name;
+ }
+ }
+
+ if ("".joinv(",", orig_preload_engines) !=
+ "".joinv(",", preload_engines)) {
+ m_config.set_value("general",
+ "preload_engines",
+ new GLib.Variant.strv(preload_engines));
+ }
+
+ return true;
+ }
+
+ private void update_im_engines() {
+ int preload_engine_mode = IBus.PreloadEngineMode.USER;
+ GLib.Variant var_preload_engine_mode =
+ m_config.get_value("general", "preload_engine_mode");
+
+ if (var_preload_engine_mode != null) {
+ preload_engine_mode = var_preload_engine_mode.get_int32();
+ }
+
+ if (preload_engine_mode == IBus.PreloadEngineMode.USER) {
+ return;
+ }
+
+ set_lang_relative_preload_engines();
}
private void update_xkb_engines() {
@@ -421,6 +552,11 @@ class Panel : IBus.PanelService {
string section,
string name,
Variant variant) {
+ if (section == "general" && name == "preload_engine_mode") {
+ update_im_engines();
+ return;
+ }
+
if (section == "general" && name == "preload_engines") {
update_engines(variant, null);
return;
--
1.7.7.4
1.7.9.1

View File

@ -1,11 +1,11 @@
From 571e4ab3e28acb90466ac58e3fe9f4efc4b8ba0e Mon Sep 17 00:00:00 2001
From c58730dd0d9c161a7824105d320f60af769e1f05 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sun, 4 Mar 2012 22:16:01 +0900
Date: Fri, 16 Mar 2012 20:45:03 +0900
Subject: [PATCH] Add ibus-xkb and libgnomekbd.
---
configure.ac | 59 +++++
data/ibus.schemas.in | 58 +++++
data/ibus.schemas.in | 60 +++++-
engine/Makefile.am | 22 ++
engine/ibus-xkb-main.c | 111 +++++++++
engine/main.vala | 86 +++++++
@ -14,30 +14,32 @@ Subject: [PATCH] Add ibus-xkb and libgnomekbd.
engine/xkblib.h | 41 ++++
ibus-1.0.pc.in | 4 +
setup/enginecombobox.py | 6 +-
setup/main.py | 17 ++-
setup/main.py | 28 ++-
src/Makefile.am | 5 +
src/ibus.h | 1 +
src/ibusxkbxml.c | 466 ++++++++++++++++++++++++++++++++++++
src/ibusxkbxml.h | 187 +++++++++++++++
ui/gtk3/Gkbd-3.0.metadata | 1 +
ui/gtk3/Makefile.am | 45 ++++
ui/gtk3/Makefile.am | 48 ++++
ui/gtk3/Xkl-1.0.metadata | 3 +
ui/gtk3/gkbdlayout.vala.false | 63 +++++
ui/gtk3/gkbdlayout.vala.true | 111 +++++++++
ui/gtk3/panel.vala | 275 ++++++++++++++++++++--
ui/gtk3/xkblayout.vala | 466 ++++++++++++++++++++++++++++++++++++
21 files changed, 2331 insertions(+), 551 deletions(-)
22 files changed, 2346 insertions(+), 555 deletions(-)
create mode 100644 engine/ibus-xkb-main.c
create mode 100644 engine/xkblib.c
create mode 100644 engine/xkblib.h
create mode 100644 src/ibusxkbxml.c
create mode 100644 src/ibusxkbxml.h
create mode 100644 ui/gtk3/Gkbd-3.0.metadata
create mode 100644 ui/gtk3/Xkl-1.0.metadata
create mode 100644 ui/gtk3/gkbdlayout.vala.false
create mode 100644 ui/gtk3/gkbdlayout.vala.true
create mode 100644 ui/gtk3/xkblayout.vala
diff --git a/configure.ac b/configure.ac
index aeb22b4..a516c94 100644
index 1c4b283..596b30e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,6 +249,63 @@ else
@ -113,28 +115,30 @@ index aeb22b4..a516c94 100644
])
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index 53ba05c..3ca0fbc 100644
index 53ba05c..05c0174 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -38,6 +38,18 @@
</locale>
</schema>
<schema>
+ <key>/schemas/desktop/ibus/general/hotkey/trigger-accel</key>
+ <applyto>/desktop/ibus/general/hotkey/trigger-accel</applyto>
@@ -34,7 +34,19 @@
<default>[Control+space,Zenkaku_Hankaku,Alt+Kanji,Alt+grave,Hangul,Alt+Release+Alt_R]</default>
<locale name="C">
<short>Trigger shortcut keys</short>
- <long>The shortcut keys for turning input method on or off</long>
+ <long>The shortcut keys for turning input method on or off</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/hotkey/trigger_accel</key>
+ <applyto>/desktop/ibus/general/hotkey/trigger_accel</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <default>[&lt;Control&gt;space]</default>
+ <locale name="C">
+ <short>Trigger shortcut keys for gtk_accelerator_parse</short>
+ <long>The shortcut keys for turning input method on or off</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/ibus/general/hotkey/enable_unconditional</key>
<applyto>/desktop/ibus/general/hotkey/enable_unconditional</applyto>
<owner>ibus</owner>
+ <long>The shortcut keys for turning input method on or off</long>
</locale>
</schema>
<schema>
@@ -203,6 +215,52 @@
</locale>
</schema>
@ -1405,42 +1409,59 @@ index 8d1424b..0ac7368 100644
if current_lang in keys:
keys.remove(current_lang)
diff --git a/setup/main.py b/setup/main.py
index 274b25a..e3027a5 100644
index fdfb33a..9638da0 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -182,12 +182,25 @@ class Setup(object):
self.__checkbutton_use_global_engine_toggled_cb)
@@ -183,14 +183,25 @@ class Setup(object):
# init engine page
- self.__engines = self.__bus.list_engines()
+ self.__engines = []
self.__engines = self.__bus.list_engines()
+ value = self.__config.get_value("general", "load_xkb_layouts")
+ load_layouts = []
+ if value != None:
+ load_layouts = map(lambda l: str(l), list(value))
+ load_layouts = value.dup_strv()[0]
+ if len(load_layouts) == 0:
+ self.__engines = self.__bus.list_engines()
+ engines = self.__engines
+ else:
+ for engine in self.__bus.list_engines():
+ if not engine.props.name.startswith('xkb:'):
+ self.__engines.append(engine)
+ elif engine.props.layout in load_layouts:
+ self.__engines.append(engine)
+ engines = []
+ for engine in self.__engines:
+ if not engine.get_name().startswith('xkb:'):
+ engines.append(engine)
+ elif engine.get_layout() in load_layouts:
+ engines.append(engine)
+
self.__combobox = self.__builder.get_object("combobox_engines")
self.__combobox.set_engines(self.__engines)
- self.__combobox.set_engines(self.__engines)
+ self.__combobox.set_engines(engines)
tmp_dict = {}
- tmp_dict = {}
- for e in self.__engines:
+ for e in self.__bus.list_engines():
tmp_dict[e.get_name()] = e
- tmp_dict[e.get_name()] = e
engine_names = values.get("preload_engines", [])
engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
- engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ engines = self.__get_engine_descs_from_names(engine_names)
self.__treeview = self.__builder.get_object("treeview_engines")
self.__treeview.set_engines(engines)
@@ -263,6 +274,13 @@ class Setup(object):
args.append(path.basename(setup_path))
return args
+ def __get_engine_descs_from_names(self, engine_names):
+ tmp_dict = {}
+ for e in self.__engines:
+ tmp_dict[e.get_name()] = e
+ engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ return engines
+
def __treeview_notify_cb(self, treeview, prop):
if prop.name not in ("active-engine", "engines"):
return
diff --git a/src/Makefile.am b/src/Makefile.am
index b4d0dcf..1631cae 100644
index b1d1766..29f0d58 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -190,6 +190,11 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
@@ -194,6 +194,11 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA)
endif
@ -2137,7 +2158,7 @@ index 0000000..661e6fd
@@ -0,0 +1 @@
+Configuration cheader_filename="libgnomekbd/gkbd-configuration.h"
diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am
index 0fb9d3c..33aaaa3 100644
index 0fb9d3c..5ccf8b0 100644
--- a/ui/gtk3/Makefile.am
+++ b/ui/gtk3/Makefile.am
@@ -42,6 +42,9 @@ INCLUDES = \
@ -2161,7 +2182,7 @@ index 0fb9d3c..33aaaa3 100644
-Wno-unused-variable \
-Wno-unused-but-set-variable \
-Wno-unused-function \
@@ -86,6 +93,7 @@ ibus_ui_gtk3_valas = \
@@ -86,6 +93,7 @@ ibus_ui_gtk3_SOURCES = \
application.vala \
candidatearea.vala \
candidatepanel.vala \
@ -2169,15 +2190,15 @@ index 0fb9d3c..33aaaa3 100644
handle.vala \
iconwidget.vala \
keybindingmanager.vala \
@@ -94,6 +102,7 @@ ibus_ui_gtk3_valas = \
@@ -94,6 +102,7 @@ ibus_ui_gtk3_SOURCES = \
property.vala \
separator.vala \
switcher.vala \
+ xkblayout.vala \
grabkeycode.c \
$(NULL)
ibus_ui_gtk3_vala_cfiles = $(ibus_ui_gtk3_valas:.vala=.c)
@@ -106,12 +115,48 @@ ibus_ui_gtk3_LDADD = \
@@ -101,12 +110,51 @@ ibus_ui_gtk3_LDADD = \
$(AM_LDADD) \
$(NULL)
@ -2194,9 +2215,11 @@ index 0fb9d3c..33aaaa3 100644
+
+AM_VALAFLAGS += \
+ --vapidir=. \
+ --metadatadir=. \
+ --pkg=glib-2.0 \
+ --pkg=gmodule-2.0 \
+ --pkg=gkbd \
+ --pkg=Xkl-1.0 \
+ $(NULL)
+
+$(srcdir)/gkbd.vapi:
@ -2216,7 +2239,6 @@ index 0fb9d3c..33aaaa3 100644
+ gkbd.vapi \
+ gkbdlayout.vala \
gtkpanel.xml \
$(ibus_ui_gtk3_vala_cfiles) \
$(NULL)
EXTRA_DIST = \
@ -2224,8 +2246,19 @@ index 0fb9d3c..33aaaa3 100644
+ gkbdlayout.vala.false \
+ gkbdlayout.vala.true \
gtkpanel.xml.in.in \
+ Xkl-1.0.metadata \
$(NULL)
diff --git a/ui/gtk3/Xkl-1.0.metadata b/ui/gtk3/Xkl-1.0.metadata
new file mode 100644
index 0000000..4961d0c
--- /dev/null
+++ b/ui/gtk3/Xkl-1.0.metadata
@@ -0,0 +1,3 @@
+Xkl cheader_filename="libxklavier/xklavier.h"
+Engine
+ .filter_events.evt ref type="X.Event"
diff --git a/ui/gtk3/gkbdlayout.vala.false b/ui/gtk3/gkbdlayout.vala.false
new file mode 100644
index 0000000..a387de9
@ -2413,7 +2446,7 @@ index 0000000..adacd81
+ */
+}
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index b83d7e3..2a386a0 100644
index d927491..f8805e0 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -40,8 +40,16 @@ class Panel : IBus.PanelService {
@ -2515,20 +2548,24 @@ index b83d7e3..2a386a0 100644
+ }
}
public void set_config(IBus.Config config) {
@@ -93,8 +152,10 @@ class Panel : IBus.PanelService {
private void set_custom_font() {
@@ -124,12 +183,14 @@ class Panel : IBus.PanelService {
}
m_config = config;
+ set_keybinding();
if (m_config != null) {
m_config.value_changed.connect(config_value_changed_cb);
m_config.watch("general", "preload_engines");
m_config.watch("general", "engines_order");
m_config.watch("panel", "custom_font");
m_config.watch("panel", "use_custom_font");
+ init_engines_order();
update_engines(m_config.get_value("general", "preload_engines"),
m_config.get_value("general", "engines_order"));
} else {
@@ -102,6 +163,192 @@ class Panel : IBus.PanelService {
}
@@ -139,6 +200,192 @@ class Panel : IBus.PanelService {
set_custom_font();
}
+ private void gkbdlayout_changed_cb() {
@ -2720,7 +2757,7 @@ index b83d7e3..2a386a0 100644
private void switch_engine(int i, bool force = false) {
GLib.assert(i >= 0 && i < m_engines.length);
@@ -121,15 +368,7 @@ class Panel : IBus.PanelService {
@@ -158,15 +405,7 @@ class Panel : IBus.PanelService {
return;
}
// set xkb layout

View File

@ -1,91 +1,201 @@
From 35f6353b89726878fa99de2588fb6be5aef8686c Mon Sep 17 00:00:00 2001
From fe1ec8a1b6f56ceda1f3f4bbb931cce29d946ed9 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 5 Mar 2012 11:16:23 +0900
Subject: [PATCH] Fix python library to load libibus.so.Y
Date: Fri, 16 Mar 2012 21:00:28 +0900
Subject: [PATCH] Set the custom font in ui.gtk3.CandidatePanel.
---
ibus/_config.py.in | 2 ++
ibus/common.py | 3 ++-
2 files changed, 4 insertions(+), 1 deletions(-)
ui/gtk3/candidatearea.vala | 23 +++++++++++++++++++++++
ui/gtk3/candidatepanel.vala | 19 +++++++++++++++++++
ui/gtk3/panel.vala | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/ibus/_config.py.in b/ibus/_config.py.in
index 098d805..c9d11bb 100644
--- a/ibus/_config.py.in
+++ b/ibus/_config.py.in
@@ -25,6 +25,7 @@ __all__ = (
"get_copyright",
"get_license",
"get_ICON_KEYBOARD",
+ "LIBIBUS_SONAME",
"ISOCODES_PREFIX",
"_"
)
@@ -55,4 +56,5 @@ def get_ICON_KEYBOARD():
return fallback_icon
return icon
diff --git a/ui/gtk3/candidatearea.vala b/ui/gtk3/candidatearea.vala
index 85a830d..5d0e8f7 100644
--- a/ui/gtk3/candidatearea.vala
+++ b/ui/gtk3/candidatearea.vala
@@ -33,6 +33,7 @@ class CandidateArea : Gtk.Box {
private IBus.Text[] m_ibus_candidates;
private uint m_focus_candidate;
private bool m_show_cursor;
+ private Pango.FontDescription m_font_desc;
+LIBIBUS_SONAME='libibus-@IBUS_API_VERSION@.so.@LT_CURRENT_MINUS_AGE@'
ISOCODES_PREFIX='@ISOCODES_PREFIX@'
diff --git a/ibus/common.py b/ibus/common.py
index 6483aae..fb39d56 100644
--- a/ibus/common.py
+++ b/ibus/common.py
@@ -59,6 +59,7 @@ import os
import sys
from xdg import BaseDirectory
import ctypes
+import _config
# __display = os.environ["DISPLAY"]
# __hostname, __display_screen = __display.split(":", 1)
@@ -104,7 +105,7 @@ import ctypes
# return None
# return address
-libibus = ctypes.CDLL("libibus-1.0.so.0")
+libibus = ctypes.CDLL(_config.LIBIBUS_SONAME)
get_address = libibus.ibus_get_address
get_address.restype=ctypes.c_char_p
--
1.7.9.1
From 401f881314abce57a0979aa4ef08fc5462dfe3ca Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 10 Mar 2012 09:45:07 +0900
Subject: [PATCH] Fix to ungrab ui/gtk3/switcher for GTK 3.3.18 and GLib
2.31.20
---
ui/gtk3/switcher.vala | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index 76c67ec..131cad5 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -127,6 +127,9 @@ class Switcher : Gtk.Window {
m_loop.run();
m_loop = null;
+ keyboard.ungrab(Gdk.CURRENT_TIME);
+ pointer.ungrab(Gdk.CURRENT_TIME);
+
hide();
// Make sure the switcher is hidden before returning from this function.
while (Gtk.events_pending())
@@ -239,6 +242,11 @@ class Switcher : Gtk.Window {
return true;
private const string LABELS[] = {
"1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.",
@@ -240,6 +241,28 @@ class CandidateArea : Gtk.Box {
hbox.pack_start(prev_button, false, false, 0);
hbox.pack_start(next_button, false, false, 0);
}
+ // if e.type == Gdk.EventType.KEY_RELEASE, m_loop is already null.
+ if (m_loop == null) {
+ return false;
+
+ udpate_label_font ();
+ }
+
+ private void udpate_label_font () {
+ for (int i = 0; i < m_labels.length; i++) {
+ m_labels[i].override_font(m_font_desc);
+ }
+
m_loop.quit();
m_result = (int)m_selected_engine;
return true;
+ for (int i = 0; i < m_candidates.length; i++) {
+ m_candidates[i].override_font(m_font_desc);
+ }
+ }
+
+ public void set_custom_font(string? font_name) {
+ if (font_name == null) {
+ m_font_desc = null;
+ } else {
+ m_font_desc = Pango.FontDescription.from_string (font_name);
+ }
+
+ udpate_label_font ();
}
}
diff --git a/ui/gtk3/candidatepanel.vala b/ui/gtk3/candidatepanel.vala
index a029e8f..721db18 100644
--- a/ui/gtk3/candidatepanel.vala
+++ b/ui/gtk3/candidatepanel.vala
@@ -32,6 +32,7 @@ public class CandidatePanel : Gtk.HBox{
private Gtk.Label m_aux_label;
private CandidateArea m_candidate_area;
private HSeparator m_hseparator;
+ private Pango.FontDescription m_font_desc;
private Gdk.Rectangle m_cursor_location;
@@ -268,4 +269,22 @@ public class CandidatePanel : Gtk.HBox{
move(x, y);
}
+
+ public void set_custom_font(string? font_name) {
+ if (font_name == null) {
+ m_font_desc = null;
+ } else {
+ m_font_desc = Pango.FontDescription.from_string (font_name);
+ }
+
+ if (m_preedit_label != null) {
+ m_preedit_label.override_font(m_font_desc);
+ }
+
+ if (m_aux_label != null) {
+ m_aux_label.override_font(m_font_desc);
+ }
+
+ m_candidate_area.set_custom_font(font_name);
+ }
}
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 53789d2..d927491 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -86,6 +86,36 @@ class Panel : IBus.PanelService {
keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
}
+ private void set_custom_font() {
+ bool use_custom_font = false;
+ GLib.Variant var_use_custom_font = m_config.get_value("panel",
+ "use_custom_font");
+
+ if (var_use_custom_font != null) {
+ use_custom_font = var_use_custom_font.get_boolean();
+ }
+
+ if (use_custom_font == false) {
+ m_candidate_panel.set_custom_font(null);
+ return;
+ }
+
+ string font_name = null;
+ GLib.Variant var_custom_font = m_config.get_value("panel",
+ "custom_font");
+ if (var_custom_font != null) {
+ font_name = var_custom_font.dup_string();
+ }
+
+ if (font_name == null) {
+ GLib.Value value = GLib.Value(typeof(string));
+ Gtk.Settings.get_default().get_property("gtk-font-name", ref value);
+ font_name = value.dup_string();
+ }
+
+ m_candidate_panel.set_custom_font(font_name);
+ }
+
public void set_config(IBus.Config config) {
if (m_config != null) {
m_config.value_changed.disconnect(config_value_changed_cb);
@@ -98,11 +128,15 @@ class Panel : IBus.PanelService {
m_config.value_changed.connect(config_value_changed_cb);
m_config.watch("general", "preload_engines");
m_config.watch("general", "engines_order");
+ m_config.watch("panel", "custom_font");
+ m_config.watch("panel", "use_custom_font");
update_engines(m_config.get_value("general", "preload_engines"),
m_config.get_value("general", "engines_order"));
} else {
update_engines(null, null);
}
+
+ set_custom_font();
}
private void switch_engine(int i, bool force = false) {
@@ -150,6 +184,13 @@ class Panel : IBus.PanelService {
Variant variant) {
if (section == "general" && name == "preload_engines") {
update_engines(variant, null);
+ return;
+ }
+
+ if (section == "panel" && (name == "custom_font" ||
+ name == "use_custom_font")) {
+ set_custom_font();
+ return;
}
}
--
1.7.9.1
From 2ce9e82bd492d6addbd629955f9c0399753e8fa2 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sun, 18 Mar 2012 18:14:06 +0900
Subject: [PATCH] Show language id on ibus-ui-gtk3.switcher window.
---
ui/gtk3/switcher.vala | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index 131cad5..73b58d2 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -155,9 +155,22 @@ class Switcher : Gtk.Window {
for (int i = 0; i < m_engines.length; i++) {
var index = i;
var engine = m_engines[i];
- var button = new Gtk.Button.with_label(engine.get_longname());
+ var longname = engine.get_longname();
+ var language = engine.get_language();
+ var symbol = engine.get_symbol();
+ var id = language;
+
+ if (id.length > 2) {
+ id = id[0:2];
+ }
+ if (symbol.length != 0) {
+ id = symbol;
+ }
+ var label = "%-15s %s".printf(longname, id);
+ var button = new Gtk.Button.with_label(label);
button.set_image(new IconWidget(engine.get_icon(), width));
button.set_relief(Gtk.ReliefStyle.NONE);
+ button.set_alignment(1.0f, 0.0f);
button.show();
button.enter_notify_event.connect((e) => {
--
1.7.9.1

221
ibus-xx-no-use.diff Normal file
View File

@ -0,0 +1,221 @@
--- ibus-1.4.99.20120317/setup/main.py.orig 2012-03-16 14:58:17.228279261 +0900
+++ ibus-1.4.99.20120317/setup/main.py 2012-03-16 14:58:50.316202253 +0900
@@ -75,22 +75,30 @@ class Setup(object):
self.__init_ui()
def __init_hotkey(self):
+ '''
default_values = {
"trigger" : (N_("trigger"), ["Control+space"]),
"enable_unconditional" : (N_("enable"), []),
"disable_unconditional" : (N_("disable"), [])
}
+ '''
+ default_values = {
+ 'trigger_accel' : ('trigger', ['<Control>space']),
+ }
values = dict(self.__config.get_values("general/hotkey"))
- for name, (label, shortcuts) in default_values.items():
+ for name, (id, shortcuts) in default_values.items():
shortcuts = values.get(name, shortcuts)
- button = self.__builder.get_object("button_%s" % name)
- entry = self.__builder.get_object("entry_%s" % name)
+ button = self.__builder.get_object("button_%s" % id)
+ entry = self.__builder.get_object("entry_%s" % id)
entry.set_text("; ".join(shortcuts))
- entry.set_tooltip_text("\n".join(shortcuts))
- button.connect("clicked", self.__shortcut_button_clicked_cb,
- label, "general/hotkey", name, entry)
+ text = '\n'.join(shortcuts)
+ text = "Use ';' separated values\n" + text
+ entry.set_tooltip_text(text)
+ button.connect("clicked", self.__shortcut_button_clicked_cb2,
+ name, "general/hotkey", id, entry)
+ button.set_tooltip_text("Save the left entry string")
def __init_panel(self):
values = dict(self.__config.get_values("panel"))
@@ -446,6 +454,37 @@ class Setup(object):
entry.set_text(text)
entry.set_tooltip_text(text)
+ def __shortcut_button_clicked_cb2(self, button, name, section, id, entry):
+ text = entry.get_text()
+ if text:
+ text = text.replace(' ', '')
+ shortcuts = text.split(';')
+ else:
+ shortcuts = []
+ orig_list =['<Control>space']
+ variant = self.__config.get_value(section, name)
+ if variant != None:
+ orig_list = variant.dup_strv()[0]
+ orig_text = ';'.join(orig_list)
+ if text == orig_text:
+ return
+ is_valid = True
+ for shortcut in shortcuts:
+ (key, mods) = Gtk.accelerator_parse(shortcut)
+ if not Gtk.accelerator_valid(key, mods):
+ is_valid = False
+ dlg = Gtk.MessageDialog(type = Gtk.MessageType.ERROR,
+ buttons = Gtk.ButtonsType.CLOSE,
+ message_format = "Invalid key %s" % shortcut)
+ dlg.run()
+ dlg.destroy()
+ break
+ if not is_valid:
+ return
+ self.__config.set_value(section, name, GLib.Variant.new_strv(shortcuts))
+ text = '\n'.join(shortcuts)
+ text = "Use ';' separated values\n" + text
+ entry.set_tooltip_text(text)
def __item_started_column_toggled_cb(self, cell, path_str, model):
--- ibus-1.4.99.20120317/setup/setup.ui.orig 2012-03-16 14:58:23.948466373 +0900
+++ ibus-1.4.99.20120317/setup/setup.ui 2012-03-16 14:59:22.242094469 +0900
@@ -102,7 +102,7 @@
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label8">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="tooltip_text" translatable="yes">The shortcut keys for switching to next input method in the list</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Next input method:</property>
@@ -116,7 +116,7 @@
</child>
<child>
<object class="GtkLabel" id="label9">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="sensitive">False</property>
<property name="tooltip_text" translatable="yes">The shortcut keys for switching to previous input method in the list</property>
<property name="xalign">0</property>
@@ -137,7 +137,7 @@
<object class="GtkEntry" id="entry_trigger">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="editable">False</property>
+ <!-- property name="editable">False</property -->
</object>
<packing>
<property name="position">0</property>
@@ -145,7 +145,9 @@
</child>
<child>
<object class="GtkButton" id="button_trigger">
- <property name="label" translatable="yes">...</property>
+ <!-- property name="label" translatable="yes">...</property -->
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -160,11 +162,12 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="entry_next_engine">
@@ -199,7 +202,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="entry_prev_engine">
@@ -248,7 +251,7 @@
</child>
<child>
<object class="GtkLabel" id="label18">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Enable:</property>
</object>
@@ -261,7 +264,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="entry_enable_unconditional">
@@ -296,7 +299,7 @@
</child>
<child>
<object class="GtkLabel" id="label19">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Disable:</property>
</object>
@@ -309,7 +312,7 @@
</child>
<child>
<object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="entry_disable_unconditional">
@@ -406,7 +409,7 @@
</child>
<child>
<object class="GtkLabel" id="label10">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="tooltip_text" translatable="yes">Set the behavior of ibus how to show or hide language bar</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Show language panel:</property>
@@ -433,7 +436,7 @@
</child>
<child>
<object class="GtkComboBox" id="combobox_panel_show">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="model">model_panel_show_mode</property>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
@@ -470,7 +473,7 @@
<child>
<object class="GtkCheckButton" id="checkbutton_show_icon_on_systray">
<property name="label" translatable="yes">Show icon on system tray</property>
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show icon on system tray</property>
@@ -486,7 +489,7 @@
<child>
<object class="GtkCheckButton" id="checkbutton_show_im_name">
<property name="label" translatable="yes">Show input method name on language bar</property>
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show input method's name on language bar when check the checkbox</property>
@@ -893,7 +896,7 @@ You may use up/down buttons to change it
</child>
<child>
<object class="GtkFrame" id="frame5">
- <property name="visible">True</property>
+ <property name="no_show_all">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>

View File

@ -1,6 +1,6 @@
From fc525080c668267339baef480f53bdb8256f3239 Mon Sep 17 00:00:00 2001
From cad2c8af84966ab88822c834bd5547067307b35d Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sun, 4 Mar 2012 20:18:30 +0900
Date: Fri, 16 Mar 2012 20:48:10 +0900
Subject: [PATCH] Enable ibus-setup to show the frequently used languages
only in IME list.
@ -11,10 +11,10 @@ Subject: [PATCH] Enable ibus-setup to show the frequently used languages
3 files changed, 300 insertions(+), 25 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index 3ca0fbc..a3a9a5f 100644
index 8ca33ac..7420a35 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -272,6 +272,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
@@ -296,6 +296,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
</locale>
</schema>
<schema>
@ -190,7 +190,7 @@ index 3ca0fbc..a3a9a5f 100644
<applyto>/desktop/ibus/panel/custom_font</applyto>
<owner>ibus</owner>
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
index 0ac7368..9af2651 100644
index 0ac7368..578098c 100644
--- a/setup/enginecombobox.py
+++ b/setup/enginecombobox.py
@@ -45,6 +45,9 @@ class EngineComboBox(Gtk.ComboBox):
@ -347,9 +347,9 @@ index 0ac7368..9af2651 100644
+ renderer.set_property("pixbuf", None)
+ elif engine < 0:
+ if not self.__show_sub_lang:
+ pixbuf = load_icon("list-add", Gtk.IconSize.LARGE_TOOLBAR)
+ pixbuf = load_icon("go-bottom", Gtk.IconSize.LARGE_TOOLBAR)
+ else:
+ pixbuf = load_icon("list-remove", Gtk.IconSize.LARGE_TOOLBAR)
+ pixbuf = load_icon("go-up", Gtk.IconSize.LARGE_TOOLBAR)
+ if pixbuf == None:
+ pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
+ Gtk.IconSize.LARGE_TOOLBAR)
@ -412,17 +412,17 @@ index 0ac7368..9af2651 100644
return self.get_property("active-engine")
diff --git a/setup/main.py b/setup/main.py
index e3027a5..614737f 100644
index 132e9f4..367cea8 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -197,6 +197,7 @@ class Setup(object):
self.__engines.append(engine)
@@ -212,6 +212,7 @@ class Setup(object):
engines.append(engine)
self.__combobox = self.__builder.get_object("combobox_engines")
+ self.__combobox.set_config(self.__config)
self.__combobox.set_engines(self.__engines)
self.__combobox.set_engines(engines)
tmp_dict = {}
engine_names = values.get("preload_engines", [])
--
1.7.9.1

136
ibus.spec
View File

@ -2,21 +2,19 @@
%{!?gtk2_binary_version: %define gtk2_binary_version %(pkg-config --variable=gtk_binary_version gtk+-2.0)}
%{!?gtk3_binary_version: %define gtk3_binary_version %(pkg-config --variable=gtk_binary_version gtk+-3.0)}
%define have_libxkbfile 1
%define have_dconf 1
%define have_pygobject2 1
%define have_pygobject3 1
%define vala_build_failure 1
%define with_xkbfile 1
%define with_dconf 1
%define with_pygobject2 1
%define with_pygobject3 1
%ifarch ppc ppc64 s390 s390x
%define have_gjsfile 0
%define with_gjs 0
%else
%define have_gjsfile 1
%define with_gjs 1
%endif
%if 0%{?fedora} > 16
%define ibus_gjs_version 3.3.90.20120308
%define ibus_gjs_version 3.3.90.20120317
%define ibus_gjs_build_failure 1
%else
%define ibus_gjs_version 3.2.1.20111230
@ -31,8 +29,8 @@
%define gnome_icon_theme_legacy_version 2.91.6
Name: ibus
Version: 1.4.99.20120304
Release: 3%{?dist}
Version: 1.4.99.20120317
Release: 1%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -40,26 +38,18 @@ URL: http://code.google.com/p/ibus/
# Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Source0: http://fujiwara.fedorapeople.org/ibus/gnome-shell/%{name}-%{version}.tar.gz
Source1: xinput-ibus
%if %have_gjsfile
Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/ibus-gjs-%{ibus_gjs_version}.tar.gz
%endif
Patch0: ibus-HEAD.patch
Patch1: ibus-541492-xkb.patch
Patch2: ibus-xx-setup-frequent-lang.patch
# Patch3: ibus-530711-preload-sys.patch
Patch2: ibus-530711-preload-sys.patch
Patch3: ibus-xx-setup-frequent-lang.patch
# Workaround gnome-shell build failure
# http://koji.fedoraproject.org/koji/getfile?taskID=3317917&name=root.log
# Patch91: ibus-gjs-xx-gnome-shell-3.1.4-build-failure.patch
# Workaround to disable preedit on gnome-shell until bug 658420 is fixed.
# https://bugzilla.gnome.org/show_bug.cgi?id=658420
Patch92: ibus-xx-g-s-disable-preedit.patch
Patch93: ibus-771115-property-compatible.patch
%if %vala_build_failure
# Xkl-1.0.gir cannot be converted to vapi.
# https://bugs.freedesktop.org/show_bug.cgi?id=47141
Patch94: ibus-xx-vapi-build-failure.diff
%endif
# Hide no nused properties in f17.
Patch94: ibus-xx-no-use.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -74,7 +64,7 @@ BuildRequires: dbus-glib-devel
BuildRequires: dbus-python-devel >= %{dbus_python_version}
BuildRequires: desktop-file-utils
BuildRequires: gtk-doc
%if %have_dconf
%if %with_dconf
BuildRequires: dconf-devel
BuildRequires: dbus-x11
BuildRequires: vala
@ -82,12 +72,12 @@ BuildRequires: vala-tools
%endif
# for AM_GCONF_SOURCE_2 in configure.ac
BuildRequires: GConf2-devel
%if %have_pygobject3
%if %with_pygobject3
BuildRequires: gobject-introspection-devel
%endif
BuildRequires: intltool
BuildRequires: iso-codes-devel
%if %have_libxkbfile
%if %with_xkbfile
BuildRequires: libxkbfile-devel
BuildRequires: libgnomekbd-devel
%endif
@ -103,10 +93,10 @@ Requires: %{name}-gtk2 = %{version}-%{release}
Requires: %{name}-gtk3 = %{version}-%{release}
%endif
%if %have_pygobject2
%if %with_pygobject2
Requires: pygtk2
%endif
%if %have_pygobject3
%if %with_pygobject3
Requires: pygobject3
%endif
Requires: pyxdg
@ -114,7 +104,7 @@ Requires: iso-codes
Requires: dbus-python >= %{dbus_python_version}
Requires: dbus-x11
Requires: im-chooser
%if %have_dconf
%if %with_dconf
Requires: dconf
%else
Requires: GConf2
@ -174,7 +164,7 @@ Requires(post): glib2 >= %{glib_ver}
%description gtk3
This package contains ibus im module for gtk3
%if %have_gjsfile
%if %with_gjs
%package gnome3
Summary: IBus gnome-shell-extension for GNOME3
Group: System Environment/Libraries
@ -211,35 +201,28 @@ The ibus-devel-docs package contains developer documentation for ibus
%prep
%setup -q
%if %have_gjsfile
%if %with_gjs
zcat %SOURCE2 | tar xf -
%if %ibus_gjs_build_failure
d=`basename %SOURCE2 .tar.gz`
cd $d
#%patch91 -p1 -b .fail-g-s
cd ..
%endif
%endif
%patch0 -p1
%patch92 -p1 -b .g-s-preedit
cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c ||
%if %have_libxkbfile
%if %with_xkbfile
%patch1 -p1 -b .xkb
%if %vala_build_failure
%patch94 -p1 -b .vala-fail
%endif
rm -f bindings/vala/ibus-1.0.vapi
%endif
%patch2 -p1 -b .setup-frequent-lang
# %patch3 -p1 -b .preload-sys
%patch2 -p1 -b .preload-sys
%patch3 -p1 -b .setup-frequent-lang
%if 0%{?fedora} <= 16
%patch93 -p1 -b .compat
%endif
%patch94 -p1 -b .no-used
%build
%if %have_libxkbfile
%if %with_xkbfile
XKB_PRELOAD_LAYOUTS=\
"us,us(chr),us(dvorak),ad,al,am,ara,az,ba,bd,be,bg,br,bt,by,"\
"de,dk,ca,ch,cn(tib),cz,ee,epo,es,et,fi,fo,fr,"\
@ -261,41 +244,33 @@ autoreconf -f -i
--enable-gtk-doc \
--with-no-snooper-apps='gnome-do,Do.*,firefox.*,.*chrome.*,.*chromium.*' \
--enable-surrounding-text \
%if %have_libxkbfile
%if %with_xkbfile
--with-xkb-preload-layouts=$XKB_PRELOAD_LAYOUTS \
--enable-xkb \
--enable-libgnomekbd \
%endif
%if %have_dconf
%if %with_dconf
--enable-dconf \
--disable-gconf \
%endif
%if %have_pygobject2
%if %with_pygobject2
--enable-python-library \
%endif
--enable-introspection
%if %vala_build_failure
touch ui/gtk3/ibus_ui_gtk3_vala.stamp
touch ui/gtk3/*.c
cp ui/gtk3/gkbdlayout.c.true ui/gtk3/gkbdlayout.c
%if %with_xkbfile
make -C ui/gtk3 maintainer-clean-generic
%endif
# make -C po update-gmo
make %{?_smp_mflags} \
AM_DEFAULT_VERBOSITY=1 \
PKG_CONFIG_PATH=..:/usr/lib64/pkgconfig:/usr/lib/pkgconfig
make %{?_smp_mflags}
%if %have_gjsfile
%if %with_gjs
d=`basename %SOURCE2 .tar.gz`
cd $d
%if %ibus_gjs_build_failure
autoreconf
%endif
export PKG_CONFIG_PATH=..:/usr/lib64/pkgconfig:/usr/lib/pkgconfig
%configure \
--with-gnome-shell-version="3.3.90,3.3.5,3.3.4,3.3.3,3.2" \
--with-gjs-version="1.31.20,1.31.10,1.31.6,1.31.11,1.30"
--with-gnome-shell-version="3.4,3.3.90,3.3.5,3.3.4,3.3.3,3.2" \
--with-gjs-version="1.32,1.31.20,1.31.10,1.31.6,1.31.11,1.30"
make %{?_smp_mflags}
cd ..
%endif
@ -329,7 +304,7 @@ desktop-file-install --delete-original \
--dir $RPM_BUILD_ROOT%{_datadir}/applications \
$RPM_BUILD_ROOT%{_datadir}/applications/*
%if %have_gjsfile
%if %with_gjs
# https://bugzilla.redhat.com/show_bug.cgi?id=657165
d=`basename %SOURCE2 .tar.gz`
cd $d
@ -352,13 +327,13 @@ touch --no-create %{_datadir}/icons/hicolor || :
%{_sbindir}/alternatives --install %{_sysconfdir}/X11/xinit/xinputrc xinputrc %{_xinputconf} 83 || :
%if !%have_dconf
%if !%with_dconf
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/ibus.schemas > /dev/null 2>&1 || :
%endif
%pre
%if !%have_dconf
%if !%with_dconf
if [ "$1" -gt 1 ]; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/ibus.schemas > /dev/null 2>&1 || :
@ -366,7 +341,7 @@ fi
%endif
%preun
%if !%have_dconf
%if !%with_dconf
if [ "$1" -eq 0 ]; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/ibus.schemas > /dev/null 2>&1 || :
@ -384,14 +359,14 @@ if [ "$1" = "0" ]; then
# if alternative was set to manual, reset to auto
[ -L %{_sysconfdir}/alternatives/xinputrc -a "`readlink %{_sysconfdir}/alternatives/xinputrc`" = "%{_xinputconf}" ] && %{_sbindir}/alternatives --auto xinputrc || :
fi
%if %have_dconf
%if %with_dconf
if [ $1 -eq 0 ]; then
glib-compile-schemas %{_datadir}/glib-2.0/schemas
fi
%endif
%posttrans
%if %have_dconf
%if %with_dconf
if [ $1 -eq 0 ]; then
glib-compile-schemas %{_datadir}/glib-2.0/schemas
fi
@ -417,7 +392,7 @@ fi
%files -f %{name}10.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%if %have_pygobject2
%if %with_pygobject2
%dir %{python_sitelib}/ibus
%{python_sitelib}/ibus/*
%endif
@ -425,12 +400,12 @@ fi
%{_bindir}/ibus
%{_bindir}/ibus-daemon
%{_bindir}/ibus-setup
%if %have_pygobject3
%if %with_pygobject3
%{_datadir}/ibus/*
%endif
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/*/apps/*
%if %have_dconf
%if %with_dconf
%{_datadir}/GConf/gsettings/*
%{_datadir}/glib-2.0/schemas/*.xml
%{_libexecdir}/ibus-engine-simple
@ -442,21 +417,21 @@ fi
%{_libexecdir}/ibus-x11
# %{_sysconfdir}/xdg/autostart/ibus.desktop
%{_sysconfdir}/bash_completion.d/ibus.bash
%if %have_dconf
%if %with_dconf
%{_sysconfdir}/dconf/db/ibus
%{_sysconfdir}/dconf/profile/ibus
%else
%{_sysconfdir}/gconf/schemas/ibus.schemas
%endif
%config %{_xinputconf}
%if %have_libxkbfile
%if %with_xkbfile
%{_libexecdir}/ibus-xkb
%endif
%files libs
%defattr(-,root,root,-)
%{_libdir}/libibus-%{ibus_api_version}.so.*
%if %have_pygobject3
%if %with_pygobject3
%{_libdir}/girepository-1.0/IBus-1.0.typelib
%endif
@ -468,7 +443,7 @@ fi
%defattr(-,root,root,-)
%{_libdir}/gtk-3.0/%{gtk3_binary_version}/immodules/im-ibus.so
%if %have_gjsfile
%if %with_gjs
%files gnome3
%defattr(-,root,root,-)
%{_datadir}/gnome-shell/js/ui/status/ibus
@ -489,6 +464,19 @@ fi
%{_datadir}/gtk-doc/html/*
%changelog
* Sat Mar 17 2012 Takao Fujiwara <tfujiwar@redhat.com> - 1.4.99.20120317-1
- Bumped to 1.4.99.20120317
Fixed Bug 718668 - focus move is slow with ibus-gnome3
Fixed Bug 749497 - Enhance IME descriptions in status icon active menu
- Bumped to ibus-gjs 3.3.90.20120317
- Added ibus-xx-no-use.diff
Fixed Bug 803260 - Disable non-global input method mode
- Updated ibus-HEAD.patch
Fixed Bug 803250 - ibus lookup window font customization
Fixed Bug 803177 - language id on ibus-ui-gtk3 switcher
- Update ibus-530711-preload-sys.patch
Fixed Bug 797023 - port preload engines
* Thu Mar 08 2012 Takao Fujiwara <tfujiwar@redhat.com> - 1.4.99.20120303-3
- Bumped to ibus-gjs 3.3.90.20120308 to work with gnome-shell 3.3.90
- Fixed Bug 786906 - Added ifnarch ppc ppc64 s390 s390x

View File

@ -1,3 +1,3 @@
28c77ed889dbe25525fde12e58f1402b ibus-1.4.99.20120304.tar.gz
11274193093c9d729187bdcea6e85442 ibus-gjs-3.3.90.20120308.tar.gz
3517bf2fff8a1d9bfb55e10674d79859 ibus-1.4.99.20120317.tar.gz
9810fabca2c4c1080da91f82a2ec7684 ibus-gjs-3.3.90.20120317.tar.gz
2d2ad58e3e41429dbd883ba7e501c9b2 ibus-gjs-3.2.1.20111230.tar.gz