summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2014-08-25 00:09:58 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2014-08-25 16:33:47 +0100
commit4e77c46694ddc790d42c3decd1178dc9bca4ec04 (patch)
treecf6d78ff5942f5a1505d405b19ffe7bfc4f77a5d
parent3f8526160d9e801256d04108f1f0639d317c57a9 (diff)
downloaddeluge-4e77c46694ddc790d42c3decd1178dc9bca4ec04.tar.gz
deluge-4e77c46694ddc790d42c3decd1178dc9bca4ec04.tar.bz2
deluge-4e77c46694ddc790d42c3decd1178dc9bca4ec04.zip
[#2493] [GTKUI] Fix TypeError if active workspace is None
-rw-r--r--deluge/ui/gtkui/mainwindow.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py
index 60b92bfd0..86b95a5fd 100644
--- a/deluge/ui/gtkui/mainwindow.py
+++ b/deluge/ui/gtkui/mainwindow.py
@@ -306,9 +306,17 @@ class MainWindow(component.Component):
Notification().notify(torrent_id)
def is_on_active_workspace(self):
- # Returns True if mainwindow is on active workspace or wnck module not available
+ """Determines if MainWindow is on the active workspace.
+
+ Returns:
+ bool: True if on active workspace (or wnck module not available), otherwise False.
+
+ """
if not wnck:
return True
- for win in self.screen.get_windows():
- if win.get_xid() == self.window.window.xid:
- return win.is_on_workspace(win.get_screen().get_active_workspace())
+ win = wnck.window_get(self.window.window.xid)
+ active_wksp = win.get_screen().get_active_workspace()
+ if active_wksp:
+ return win.is_on_workspace(active_wksp)
+ else:
+ return False