diff --git a/src/delugegtk.py b/src/delugegtk.py index 44a0d00e1..07b9edc57 100644 --- a/src/delugegtk.py +++ b/src/delugegtk.py @@ -67,7 +67,15 @@ class DelugeGTK: ## Construct the Interface - self.build_tray_icon() + try: + self.build_tray_icon() + except AttributeError: + #python-pygtk is < 2.9 + self.tray_icon = dgtk.StupidTray() + self.has_tray = False + else: + self.has_tray = True + self.build_about_dialog() self.build_pref_dialog() self.build_torrent_table() @@ -77,8 +85,6 @@ class DelugeGTK: self.connect_signals() - - try: self.load_window_settings() except KeyError: @@ -153,7 +159,6 @@ class DelugeGTK: item_clear.set_image(gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU)) item_plug.set_image(gtk.image_new_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU)) - item_show.connect("activate", self.force_show_hide) item_add.connect("activate", self.add_torrent_clicked) item_clear.connect("activate", self.clear_finished) @@ -193,9 +198,6 @@ class DelugeGTK: else: self.window.show() - - - def build_about_dialog(self): gtk.about_dialog_set_url_hook(dcommon.open_url_in_browser) self.abt = gtk.glade.XML(dcommon.get_glade_file("aboutdialog.glade")).get_widget("aboutdialog") @@ -959,7 +961,7 @@ class DelugeGTK: def close(self, widget, event): - if self.config.get("close_to_tray", bool, default=False) and self.config.get("enable_system_tray", bool, default=True): + if self.config.get("close_to_tray", bool, default=False) and self.config.get("enable_system_tray", bool, default=True) and self.has_tray: self.save_window_geometry() self.window.hide() return True diff --git a/src/dgtk.py b/src/dgtk.py index ef89f4c76..6f33a35df 100644 --- a/src/dgtk.py +++ b/src/dgtk.py @@ -28,6 +28,16 @@ pygtk.require('2.0') import gtk import gtk.glade +# This is a dummy tray object to allow Deluge to run on PyGTK < 2.9 +class StupidTray: + def __init__(self): + pass + def set_visible(self, value): + pass + def set_tooltip(self, value): + pass + + ## Browse for .torrent files def show_file_open_dialog(parent=None): chooser = gtk.FileChooserDialog(_("Choose a .torrent file"), parent, gtk.FILE_CHOOSER_ACTION_OPEN,