#endif
}
+/**
+ * bus_ibus_impl_set_enable_unconditional:
+ *
+ * A function to be called when "enable_unconditional" config is updated.
+ */
+static void
+bus_ibus_impl_set_enable_unconditional (BusIBusImpl *ibus,
+ GVariant *value)
+{
+ GQuark hotkey = g_quark_from_static_string ("enable-unconditional");
+ bus_ibus_impl_set_hotkey (ibus, hotkey, value);
+}
+
+/**
+ * bus_ibus_impl_set_disable_unconditional:
+ *
+ * A function to be called when "disable_unconditional" config is updated.
+ */
+static void
+bus_ibus_impl_set_disable_unconditional (BusIBusImpl *ibus,
+ GVariant *value)
+{
+ GQuark hotkey = g_quark_from_static_string ("disable-unconditional");
+ bus_ibus_impl_set_hotkey (ibus, hotkey, value);
+}
+
/**
* bus_ibus_impl_set_next_engine_in_menu:
*
gchar *key;
void (*func) (BusIBusImpl *, GVariant *);
} bus_ibus_impl_config_items [] = {
- { "general/hotkey", "trigger", bus_ibus_impl_set_trigger },
- { "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", "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 },
- { "general", "enable_by_default", bus_ibus_impl_set_enable_by_default },
+ { "general/hotkey", "trigger", bus_ibus_impl_set_trigger },
+ { "general/hotkey", "enable_unconditional", bus_ibus_impl_set_enable_unconditional },
+ { "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", "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 },
+ { "general", "embed_preedit_text", bus_ibus_impl_set_embed_preedit_text },
+ { "general", "enable_by_default", bus_ibus_impl_set_enable_by_default },
};
/**
guint prev_modifiers)
{
static GQuark trigger = 0;
+ static GQuark enable_unconditional = 0;
+ static GQuark disable_unconditional = 0;
static GQuark next = 0;
static GQuark previous = 0;
if (trigger == 0) {
trigger = g_quark_from_static_string ("trigger");
+ enable_unconditional = g_quark_from_static_string ("enable-unconditional");
+ disable_unconditional = g_quark_from_static_string ("disable-unconditional");
next = g_quark_from_static_string ("next-engine-in-menu");
previous = g_quark_from_static_string ("previous-engine");
}
}
return (enabled != bus_input_context_is_enabled (context));
}
+ if (event == enable_unconditional) {
+ gboolean enabled = bus_input_context_is_enabled (context);
+ if (!enabled) {
+ bus_input_context_enable (context);
+ }
+ return bus_input_context_is_enabled (context);
+ }
+ if (event == disable_unconditional) {
+ gboolean enabled = bus_input_context_is_enabled (context);
+ if (enabled) {
+ bus_input_context_disable (context);
+ }
+ return !bus_input_context_is_enabled (context);
+ }
if (event == next) {
if (bus_input_context_is_enabled (context)) {
bus_ibus_impl_context_request_next_engine_in_menu (ibus, context);
"default_reply_handler",
"default_error_handler",
"DEFAULT_ASYNC_HANDLERS",
- "CONFIG_GENERAL_SHORTCUT_TRIGGER",
- "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE",
- "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE",
"CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT",
"CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT",
"CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT",
"main",
"error_handler" : default_error_handler
}
-CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT = [
"Control+space",
"Zenkaku_Hankaku",
"Hangul"]
-CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
+CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT = []
+CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT = []
CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = []
-CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
__mainloop = None
button.connect("clicked", self.__shortcut_button_clicked_cb,
N_("trigger"), "general/hotkey", "trigger", entry)
+ # enable (unconditional)
+ shortcuts = self.__config.get_value(
+ "general/hotkey", "enable_unconditional",
+ ibus.CONFIG_GENERAL_SHORTCUT_ENABLE_DEFAULT)
+ button = self.__builder.get_object("button_enable")
+ entry = self.__builder.get_object("entry_enable")
+ entry.set_text("; ".join(shortcuts))
+ entry.set_tooltip_text("\n".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("enable"), "general/hotkey", "enable_unconditional", entry)
+
+ # disable (unconditional)
+ shortcuts = self.__config.get_value(
+ "general/hotkey", "disable_unconditional",
+ ibus.CONFIG_GENERAL_SHORTCUT_DISABLE_DEFAULT)
+ button = self.__builder.get_object("button_disable")
+ entry = self.__builder.get_object("entry_disable")
+ entry.set_text("; ".join(shortcuts))
+ entry.set_tooltip_text("\n".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("disable"), "general/hotkey", "disable_unconditional", entry)
+
# next engine
shortcuts = self.__config.get_value(
"general/hotkey", "next_engine_in_menu",
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">The shortcut keys for turning input method on or off</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Enable or disable:</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">Next input method:</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
<property name="label" translatable="yes">Previous input method:</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
</packing>
</child>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">The shortcut keys for turning input method on or off</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Enable or disable:</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Enable:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="entry_enable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_enable">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Disable:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="entry_disable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_disable">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>