--- 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', ['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 =['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 @@ 6 - True + True The shortcut keys for switching to next input method in the list 0 Next input method: @@ -116,7 +116,7 @@ - True + True False The shortcut keys for switching to previous input method in the list 0 @@ -137,7 +137,7 @@ True True - False + 0 @@ -145,7 +145,9 @@ - ... + + gtk-apply + True True True False @@ -160,11 +162,12 @@ 1 2 + GTK_FILL - True + True 6 @@ -199,7 +202,7 @@ - True + True 6 @@ -248,7 +251,7 @@ - True + True 0 Enable: @@ -261,7 +264,7 @@ - True + True 6 @@ -296,7 +299,7 @@ - True + True 0 Disable: @@ -309,7 +312,7 @@ - True + True 6 @@ -406,7 +409,7 @@ - True + True Set the behavior of ibus how to show or hide language bar 0 Show language panel: @@ -433,7 +436,7 @@ - True + True model_panel_show_mode @@ -470,7 +473,7 @@ Show icon on system tray - True + True True False Show icon on system tray @@ -486,7 +489,7 @@ Show input method name on language bar - True + True True False Show input method's name on language bar when check the checkbox @@ -893,7 +896,7 @@ You may use up/down buttons to change it - True + True 0 none