From ef2be0415bbe948ce4be39b8a5d2bc60c3384bb2 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 29 Mar 2011 09:39:44 -0400 Subject: [PATCH] Use gtk_status_icon_set_name() only if it is available. gtk_status_icon_set_name() is not exported to python through pygtk2 <= 2.17, which is the version from Debian sid and Fedora 14. >>> import gtk >>> gtk.pygtk_version (2, 17, 0) >>> hasattr(gtk.StatusIcon, 'set_name') False This patch checks the availability. BUG=none TEST=manual Review URL: http://codereview.appspot.com/4327042 Patch from Daiki Ueno . --- ui/gtk/panel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py index 9d63a17..752a26a 100644 --- a/ui/gtk/panel.py +++ b/ui/gtk/panel.py @@ -110,7 +110,9 @@ class Panel(ibus.PanelBase): # so that gtk_window_realize() is called later again. # set_title is for gnome-shell notificationDaemon in bottom right. self.__status_icon.set_visible(False) - self.__status_icon.set_name('ibus-ui-gtk') + # gtk_status_icon_set_name() is not available in pygtk2 2.17 + if hasattr(self.__status_icon, 'set_name'): + self.__status_icon.set_name('ibus-ui-gtk') self.__status_icon.set_title(_("IBus Panel")) self.__status_icon.set_visible(True) self.__status_icon.connect("popup-menu", self.__status_icon_popup_menu_cb) -- 2.7.4