From e10aff2bd97dee1cdbc738500936ef2e39132702 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Wed, 26 Aug 2009 15:53:29 +0800 Subject: [PATCH] Use icon name instead of the icon path in source code. --- data/icons/Makefile.am | 17 +++-------- .../{engine-default.svg => ibus-engine.svg} | 0 ui/gtk/panel.py | 28 ++++++++++--------- 3 files changed, 19 insertions(+), 26 deletions(-) rename data/icons/{engine-default.svg => ibus-engine.svg} (100%) diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 5a6617c9..e50d5dbb 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -20,12 +20,6 @@ # Boston, MA 02111-1307 USA icons_DATA = \ - engine-default.svg \ - ibus-help.png \ - ibus-keyboard.svg \ - ibus-locale.svg \ - ibus-zh.svg \ - ibus.svg \ $(NULL) iconsdir = $(pkgdatadir)/icons @@ -33,16 +27,13 @@ iconsdir = $(pkgdatadir)/icons sysicons_DATA = \ ibus.svg \ ibus-setup.svg \ + ibus-keyboard.svg \ + ibus-engine.svg \ $(NULL) sysiconsdir = $(datadir)/pixmaps EXTRA_DIST = \ - engine-default.svg \ - ibus-help.png \ - ibus-keyboard.svg \ - ibus-locale.svg \ - ibus-zh.svg \ - ibus-setup.svg \ - ibus.svg \ + $(icons_DATA) \ + $(sysicons_DATA) \ $(NULL) diff --git a/data/icons/engine-default.svg b/data/icons/ibus-engine.svg similarity index 100% rename from data/icons/engine-default.svg rename to data/icons/ibus-engine.svg diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py index b0970619..38ea8e86 100644 --- a/ui/gtk/panel.py +++ b/ui/gtk/panel.py @@ -37,6 +37,9 @@ from gettext import dgettext _ = lambda a : dgettext("ibus", a) N_ = lambda a : a +ICON_KEYBOARD = "ibus-keyboard" +ICON_ENGINE = "ibus-engine" + def show_uri(screen, link): try: gtk.show_uri(screen, link, 0) @@ -62,8 +65,7 @@ class Panel(ibus.PanelBase): self.__setup_pid = 0 self.__prefix = os.getenv("IBUS_PREFIX") self.__data_dir = path.join(self.__prefix, "share", "ibus") - self.__icons_dir = path.join(self.__data_dir, "icons") - self.__ibus_icon = path.join(self.__icons_dir, "ibus.svg") + # self.__icons_dir = path.join(self.__data_dir, "icons") self.__setup_cmd = path.join(self.__prefix, "bin", "ibus-setup") # hanlder signal @@ -75,8 +77,8 @@ class Panel(ibus.PanelBase): # self.__bus.config_add_watch("panel") # add icon search path - icon_theme = gtk.icon_theme_get_default() - icon_theme.prepend_search_path(self.__icons_dir) + # icon_theme = gtk.icon_theme_get_default() + # icon_theme.prepend_search_path(self.__icons_dir) self.__language_bar = LanguageBar() self.__language_bar.connect("property-activate", @@ -104,7 +106,7 @@ class Panel(ibus.PanelBase): self.__status_icon = gtk.StatusIcon() self.__status_icon.connect("popup-menu", self.__status_icon_popup_menu_cb) self.__status_icon.connect("activate", self.__status_icon_activate_cb) - self.__status_icon.set_from_file(self.__ibus_icon) + self.__status_icon.set_from_icon_name(ICON_KEYBOARD) self.__status_icon.set_tooltip(_("IBus input method framework")) self.__status_icon.set_visible(True) @@ -179,7 +181,7 @@ class Panel(ibus.PanelBase): def __set_im_icon(self, icon_name): if not icon_name: - icon_name = "engine-default" + icon_name = ICON_ENGINE self.__language_bar.set_im_icon(icon_name) if icon_name.startswith("/"): self.__status_icon.set_from_file(icon_name) @@ -196,7 +198,7 @@ class Panel(ibus.PanelBase): self.__language_bar.set_enabled(enabled) if not enabled: - self.__set_im_icon(self.__ibus_icon) + self.__set_im_icon(ICON_KEYBOARD) self.__set_im_name(None) else: engine = self.__focus_ic.get_engine() @@ -204,7 +206,7 @@ class Panel(ibus.PanelBase): self.__set_im_icon(engine.icon) self.__set_im_name(engine.longname) else: - self.__set_im_icon(self.__ibus_icon) + self.__set_im_icon(ICON_KEYBOARD) self.__set_im_name(None) self.__language_bar.focus_in() @@ -213,7 +215,7 @@ class Panel(ibus.PanelBase): self.__focus_ic = None self.__language_bar.set_enabled(False) self.__language_bar.focus_out() - self.__set_im_icon(self.__ibus_icon) + self.__set_im_icon(ICON_KEYBOARD) self.__set_im_name(None) def state_changed(self): @@ -225,7 +227,7 @@ class Panel(ibus.PanelBase): if enabled == False: self.reset() - self.__set_im_icon(self.__ibus_icon) + self.__set_im_icon(ICON_KEYBOARD) self.__set_im_name(None) else: engine = self.__focus_ic.get_engine() @@ -233,7 +235,7 @@ class Panel(ibus.PanelBase): self.__set_im_icon(engine.icon) self.__set_im_name(engine.longname) else: - self.__set_im_icon(self.__ibus_icon) + self.__set_im_icon(ICON_KEYBOARD) self.__set_im_name(None) @@ -347,7 +349,7 @@ class Panel(ibus.PanelBase): if engine.icon: item.set_image(_icon.IconWidget(engine.icon, size[0])) else: - item.set_image(_icon.IconWidget("engine-default", size[0])) + item.set_image(_icon.IconWidget(ICON_ENGINE, size[0])) item.connect("activate", self.__im_menu_item_activate_cb, engine) menu.add(item) else: @@ -360,7 +362,7 @@ class Panel(ibus.PanelBase): if engine.icon: item.set_image(_icon.IconWidget(engine.icon, size[0])) else: - item.set_image(_icon.IconWidget("engine-default", size[0])) + item.set_image(_icon.IconWidget(ICON_ENGINE, size[0])) item.connect("activate", self.__im_menu_item_activate_cb, engine) submenu.add(item) -- 2.34.1