}
static IBusMessage *
+_ic_enable (BusInputContext *context,
+ IBusMessage *message,
+ BusConnection *connection)
+{
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+ g_assert (message != NULL);
+ g_assert (BUS_IS_CONNECTION (connection));
+
+ IBusMessage *reply;
+
+ bus_input_context_enable (context);
+
+ reply = ibus_message_new_method_return (message);
+ return reply;
+}
+
+static IBusMessage *
+_ic_disable (BusInputContext *context,
+ IBusMessage *message,
+ BusConnection *connection)
+{
+ g_assert (BUS_IS_INPUT_CONTEXT (context));
+ g_assert (message != NULL);
+ g_assert (BUS_IS_CONNECTION (connection));
+
+ IBusMessage *reply;
+
+ bus_input_context_disable (context);
+
+ reply = ibus_message_new_method_return (message);
+ return reply;
+}
+
+static IBusMessage *
_ic_is_enabled (BusInputContext *context,
IBusMessage *message,
BusConnection *connection)
{ IBUS_INTERFACE_INPUT_CONTEXT, "FocusOut", _ic_focus_out },
{ IBUS_INTERFACE_INPUT_CONTEXT, "Reset", _ic_reset },
{ IBUS_INTERFACE_INPUT_CONTEXT, "SetCapabilities", _ic_set_capabilities },
+ { IBUS_INTERFACE_INPUT_CONTEXT, "Enable", _ic_enable },
+ { IBUS_INTERFACE_INPUT_CONTEXT, "Disable", _ic_disable },
{ IBUS_INTERFACE_INPUT_CONTEXT, "IsEnabled", _ic_is_enabled },
{ IBUS_INTERFACE_INPUT_CONTEXT, "SetEngine", _ic_set_engine },
{ IBUS_INTERFACE_INPUT_CONTEXT, "GetEngine", _ic_get_engine },
langs.remove(_("Other"))
langs.append(_("Other"))
+ size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
for lang in langs:
if len(tmp[lang]) == 1:
engine = tmp[lang][0]
item = gtk.ImageMenuItem("%s - %s" % (lang, engine.longname))
- size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
if engine.icon:
item.set_image (_icon.IconWidget(engine.icon, size[0]))
else:
item.set_submenu(submenu)
for engine in tmp[lang]:
item = gtk.ImageMenuItem(engine.longname)
- size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
if engine.icon:
item.set_image (_icon.IconWidget(engine.icon, size[0]))
else:
item.connect("activate", self.__im_menu_item_activate_cb, engine)
submenu.add(item)
+ item = gtk.ImageMenuItem(_("Disable"))
+ item.set_image (_icon.IconWidget("gtk-close", size[0]))
+ item.connect("activate", self.__im_menu_item_activate_cb, None)
+ menu.add (item)
+
menu.show_all()
menu.set_take_focus(False)
return menu
self.__status_icon)
def __im_menu_item_activate_cb(self, item, engine):
- self.__focus_ic.set_engine(engine)
+ if engine:
+ self.__focus_ic.set_engine(engine)
+ else:
+ self.__focus_ic.disable()
def __sys_menu_item_activate_cb(self, item, command):
if command == gtk.STOCK_PREFERENCES: