Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Naur ibus-1.4.2/bus/ibusimpl.c my-ibus/bus/ibusimpl.c
- --- ibus-1.4.2/bus/ibusimpl.c 2012-08-22 14:16:51.000000000 +0000
- +++ my-ibus/bus/ibusimpl.c 2012-09-04 09:42:47.349180087 +0000
- @@ -77,6 +77,7 @@
- gchar *global_previous_engine_name;
- /* engine-specific hotkeys */
- + GVariant *saved_dynamic_hotkeys;
- IBusHotkeyProfile *engines_hotkey_profile;
- GHashTable *hotkey_to_engines_map;
- };
- @@ -139,6 +140,9 @@
- static void bus_ibus_impl_set_previous_engine
- (BusIBusImpl *ibus,
- GVariant *value);
- +static void bus_ibus_impl_set_dynamic_engine
- + (BusIBusImpl *ibus,
- + GVariant *value);
- static void bus_ibus_impl_set_preload_engines
- (BusIBusImpl *ibus,
- GVariant *value);
- @@ -384,6 +388,22 @@
- }
- /**
- + * bus_ibus_impl_set_dynamic_engine:
- + *
- + * A function to be called when "dynamic_engine" config is updated.
- + */
- +static void
- +bus_ibus_impl_set_dynamic_engine (BusIBusImpl *ibus,
- + GVariant *value)
- +{
- + if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
- + g_variant_ref (value);
- + ibus->saved_dynamic_hotkeys = value;
- + bus_ibus_impl_update_engines_hotkey_profile (ibus);
- + }
- +}
- +
- +/**
- * bus_ibus_impl_set_preload_engines:
- *
- * A function to be called when "preload_engines" config is updated.
- @@ -598,6 +618,7 @@
- { "general/hotkey", "disable_unconditional", bus_ibus_impl_set_disable_unconditional },
- { "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/hotkey", "dynamic_engine", bus_ibus_impl_set_dynamic_engine },
- { "general", "preload_engines", bus_ibus_impl_set_preload_engines },
- { "general", "use_system_keyboard_layout", bus_ibus_impl_set_use_sys_layout },
- { "general", "use_global_engine", bus_ibus_impl_set_use_global_engine },
- @@ -2337,6 +2358,39 @@
- static void
- bus_ibus_impl_update_engines_hotkey_profile (BusIBusImpl *ibus)
- {
- + GVariantIter iter;
- + g_variant_iter_init (&iter, ibus->saved_dynamic_hotkeys);
- + const gchar *dynamic_string = NULL;
- + gchar **dynamic_string_list;
- +
- + while (g_variant_iter_loop (&iter, "&s", &dynamic_string)) {
- + GList *eng;
- + const gchar *engine_to_change_name, *hotkeys;
- +
- + dynamic_string_list = g_strsplit_set (dynamic_string, "=", 2);
- + //Checks for illegal strings
- + if ((! dynamic_string_list[0]) || (! dynamic_string_list[1])) {
- + g_strfreev (dynamic_string_list);
- + continue;
- + }
- +
- + engine_to_change_name = g_strstrip (dynamic_string_list[0]);
- + hotkeys = g_strstrip (dynamic_string_list[1]);
- +
- + for (eng = ibus->engine_list; eng; eng = eng->next) {
- + IBusEngineDesc *engine;
- + const gchar *engine_name;
- +
- + engine = eng->data;
- + engine_name = ibus_engine_desc_get_name(engine);
- + if (g_strcmp0 (engine_to_change_name, engine_name) == 0) {
- + g_object_set (G_OBJECT (engine), "hotkeys", hotkeys);
- + }
- + }
- +
- + g_strfreev (dynamic_string_list);
- + }
- +
- if (ibus->engines_hotkey_profile) {
- g_object_unref (ibus->engines_hotkey_profile);
- }
- diff -Naur ibus-1.4.2/data/ibus.schemas.in my-ibus/data/ibus.schemas.in
- --- ibus-1.4.2/data/ibus.schemas.in 2012-08-22 14:16:51.000000000 +0000
- +++ my-ibus/data/ibus.schemas.in 2012-09-04 08:34:53.449056392 +0000
- @@ -102,6 +102,20 @@
- <long>The shortcut keys for switching to the previous input method</long>
- </locale>
- </schema>
- +
- + <schema>
- + <key>/schemas/desktop/ibus/general/hotkey/dynamic_engine</key>
- + <applyto>/desktop/ibus/general/hotkey/dynamic_engine</applyto>
- + <owner>ibus</owner>
- + <type>list</type>
- + <list_type>string</list_type>
- + <default>[]</default>
- + <locale name="C">
- + <short>Dynamic engine shortcut keys</short>
- + <long>The shortcut keys of individual IMEs, of format "IME name = shortcut; shortcut..."</long>
- + </locale>
- + </schema>
- +
- <schema>
- <key>/schemas/desktop/ibus/panel/show</key>
- <applyto>/desktop/ibus/panel/show</applyto>
- diff -Naur ibus-1.4.2/setup/enginetreeview.py my-ibus/setup/enginetreeview.py
- --- ibus-1.4.2/setup/enginetreeview.py 2012-08-22 14:16:51.000000000 +0000
- +++ my-ibus/setup/enginetreeview.py 2012-09-03 18:04:56.898908273 +0000
- @@ -127,7 +127,10 @@
- engine = self.__model.get_value(iter, 0)
- renderer.set_property("sensitive", True)
- language = ibus.get_language_name(engine.language)
- - renderer.set_property("text", "%s - %s" % (language, engine.longname))
- + if (engine.hotkeys):
- + renderer.set_property("text", "%s - %s (%s)" % (language, engine.longname, engine.hotkeys))
- + else:
- + renderer.set_property("text", "%s - %s" % (language, engine.longname))
- if self.__model.get_path(iter)[0] == 0:
- # default engine
- renderer.set_property("weight", pango.WEIGHT_BOLD)
- diff -Naur ibus-1.4.2/setup/main.py my-ibus/setup/main.py
- --- ibus-1.4.2/setup/main.py 2012-08-22 14:16:51.000000000 +0000
- +++ my-ibus/setup/main.py 2012-09-04 08:58:07.962432065 +0000
- @@ -238,6 +238,9 @@
- button = self.__builder.get_object("button_engine_about")
- button.connect("clicked", self.__button_engine_about_cb)
- + button = self.__builder.get_object("button_engine_hotkeys")
- + button.connect("clicked", self.__button_engine_hotkeys_cb)
- +
- self.__engine_setup_exec_list = {}
- button = self.__builder.get_object("button_engine_preferences")
- button.connect("clicked", self.__button_engine_preferences_cb)
- @@ -277,6 +280,7 @@
- self.__builder.get_object("button_engine_remove").set_sensitive(engine != None)
- self.__builder.get_object("button_engine_about").set_sensitive(engine != None)
- + self.__builder.get_object("button_engine_hotkeys").set_sensitive(engine != None)
- self.__builder.get_object("button_engine_up").set_sensitive(engine not in engines[:1])
- self.__builder.get_object("button_engine_down").set_sensitive(engine not in engines[-1:])
- @@ -301,6 +305,45 @@
- about.run()
- about.destroy()
- + def __button_engine_hotkeys_cb(self, button):
- + engine = self.__treeview.get_active_engine()
- + buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)
- + title = _("Select keyboard shortcut for %s") % _(engine.name)
- + dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title)
- + text = engine.hotkeys
- + if text:
- + shortcuts = text.split("; ")
- + else:
- + shortcuts = None
- + dialog.set_shortcuts(shortcuts)
- + id = dialog.run()
- + shortcuts = dialog.get_shortcuts()
- + dialog.destroy()
- + if id != gtk.RESPONSE_OK:
- + return
- + text = "; ".join(shortcuts)
- +
- + existing = self.__config.get_value(
- + "general/hotkey", "dynamic_engine",
- + [])
- +
- + existing_dict = {}
- + for item in existing:
- + l = item.split('=', 1)
- + if len(l) == 1: # illegal format
- + continue
- + name = l[0].strip()
- + hot = l[1].strip()
- + existing_dict[name] = hot
- +
- + existing_dict[engine.name] = text
- +
- + new = []
- + for name, hot in existing_dict.items():
- + new.append(name + " = " + hot)
- +
- + self.__config.set_list("general/hotkey", "dynamic_engine", new, "s")
- +
- def __button_engine_preferences_cb(self, button):
- engine = self.__treeview.get_active_engine()
- args = self.__get_engine_setup_exec_args(engine)
- diff -Naur ibus-1.4.2/setup/setup.ui my-ibus/setup/setup.ui
- --- ibus-1.4.2/setup/setup.ui 2012-08-22 14:16:51.000000000 +0000
- +++ my-ibus/setup/setup.ui 2012-09-03 19:53:40.669106347 +0000
- @@ -727,6 +727,22 @@
- </packing>
- </child>
- <child>
- + <object class="GtkButton" id="button_engine_hotkeys">
- + <property name="label">Hotkeys</property>
- + <property name="visible">True</property>
- + <property name="sensitive">False</property>
- + <property name="can_focus">True</property>
- + <property name="receives_default">True</property>
- + <property name="tooltip_text" translatable="yes">Show information of the selected input method</property>
- + <property name="use_stock">True</property>
- + </object>
- + <packing>
- + <property name="expand">False</property>
- + <property name="fill">False</property>
- + <property name="position">5</property>
- + </packing>
- + </child>
- + <child>
- <object class="GtkButton" id="button_engine_preferences">
- <property name="label">gtk-preferences</property>
- <property name="visible">True</property>
- @@ -739,7 +755,7 @@
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- - <property name="position">5</property>
- + <property name="position">6</property>
- </packing>
- </child>
- </object>
- diff -Naur ibus-1.4.2/src/ibusenginedesc.c my-ibus/src/ibusenginedesc.c
- --- ibus-1.4.2/src/ibusenginedesc.c 2012-03-06 15:34:36.000000000 +0000
- +++ my-ibus/src/ibusenginedesc.c 2012-09-04 09:37:35.392503948 +0000
- @@ -235,7 +235,7 @@
- "description hotkeys",
- "The hotkeys of engine description",
- "",
- - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- + G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- /**
- * IBusEngineDesc:symbol:
- @@ -344,7 +344,6 @@
- desc->priv->rank = g_value_get_uint (value);
- break;
- case PROP_HOTKEYS:
- - g_assert (desc->priv->hotkeys == NULL);
- desc->priv->hotkeys = g_value_dup_string (value);
- break;
- case PROP_SYMBOL:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement