From 7eac7f7367a926c24461a6185d70b744c764aaa2 Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Sat, 30 Aug 2008 07:51:11 +0800 Subject: [PATCH] Translate im menu. --- client/qt4/ibus-input-context.cpp | 10 ++++++++++ client/qt4/ibus-input-context.h | 2 ++ panel/panel.py | 5 ++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/client/qt4/ibus-input-context.cpp b/client/qt4/ibus-input-context.cpp index d120f1e..1afa426 100644 --- a/client/qt4/ibus-input-context.cpp +++ b/client/qt4/ibus-input-context.cpp @@ -140,6 +140,11 @@ IBusInputContext::setFocusWidget (QWidget *widget) has_focus = true; client->focusIn (this); update (); + QObject::connect ( + widget, + SLOT(setFocus()), + this, + SLOT(setFocus())); } } @@ -252,3 +257,8 @@ IBusInputContext::hidePreedit () updatePreedit (preedit_string, preedit_attrs, preedit_cursor_pos, FALSE); } +void +IBusInputContext::setFocus () +{ + qDebug() << "setFocus"; +} diff --git a/client/qt4/ibus-input-context.h b/client/qt4/ibus-input-context.h index 2fd3e56..f616ce6 100644 --- a/client/qt4/ibus-input-context.h +++ b/client/qt4/ibus-input-context.h @@ -55,6 +55,8 @@ public: void showPreedit (); void hidePreedit (); +private slots: + void setFocus (); private: IBusClient *client; diff --git a/panel/panel.py b/panel/panel.py index 645e85e..7647acf 100644 --- a/panel/panel.py +++ b/panel/panel.py @@ -270,13 +270,13 @@ class Panel(ibus.PanelBase): for lang in langs: if len(tmp[lang]) == 1: name, lang, icon, authors, credits, factory = tmp[lang][0] - item = gtk.ImageMenuItem("%s - %s" % (lang, name)) + item = gtk.ImageMenuItem("%s - %s" % (_(lang), name)) size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) item.set_image (_icon.IconWidget(icon, size[0])) item.connect("activate", self.__im_menu_item_activate_cb, factory) menu.add(item) else: - item = gtk.MenuItem(lang) + item = gtk.MenuItem(_(lang)) menu.add(item) submenu = gtk.Menu() item.set_submenu(submenu) @@ -287,7 +287,6 @@ class Panel(ibus.PanelBase): item.connect("activate", self.__im_menu_item_activate_cb, factory) submenu.add(item) - menu.show_all() menu.set_take_focus(False) return menu -- 2.7.4