mirror of
https://git.deluge-torrent.org/deluge
synced 2025-07-18 23:11:40 +00:00
Fix #2260 : Add dialog pulling main window to active workspace
This commit is contained in:
parent
1f12bab923
commit
01c501b172
2 changed files with 20 additions and 2 deletions
|
@ -180,7 +180,11 @@ class AddTorrentDialog(component.Component):
|
||||||
self.builder.get_object("button_move_completed_location").hide()
|
self.builder.get_object("button_move_completed_location").hide()
|
||||||
self.builder.get_object("entry_move_completed_path").show()
|
self.builder.get_object("entry_move_completed_path").show()
|
||||||
|
|
||||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
if component.get("MainWindow").is_on_active_workspace():
|
||||||
|
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||||
|
else:
|
||||||
|
self.dialog.set_transient_for(None)
|
||||||
|
|
||||||
self.dialog.present()
|
self.dialog.present()
|
||||||
if focus:
|
if focus:
|
||||||
self.dialog.window.focus()
|
self.dialog.window.focus()
|
||||||
|
|
|
@ -42,6 +42,11 @@ import gtk
|
||||||
import logging
|
import logging
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
try:
|
||||||
|
import wnck
|
||||||
|
except ImportError:
|
||||||
|
wnck = None
|
||||||
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
|
@ -76,6 +81,8 @@ class _GtkBuilderSignalsHolder(object):
|
||||||
|
|
||||||
class MainWindow(component.Component):
|
class MainWindow(component.Component):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
if wnck:
|
||||||
|
self.screen = wnck.screen_get_default()
|
||||||
component.Component.__init__(self, "MainWindow", interval=2)
|
component.Component.__init__(self, "MainWindow", interval=2)
|
||||||
self.config = ConfigManager("gtkui.conf")
|
self.config = ConfigManager("gtkui.conf")
|
||||||
self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder()
|
self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder()
|
||||||
|
@ -167,7 +174,6 @@ class MainWindow(component.Component):
|
||||||
component.resume("TorrentDetails")
|
component.resume("TorrentDetails")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,3 +330,11 @@ class MainWindow(component.Component):
|
||||||
def on_torrentfinished_event(self, torrent_id):
|
def on_torrentfinished_event(self, torrent_id):
|
||||||
from deluge.ui.gtkui.notification import Notification
|
from deluge.ui.gtkui.notification import Notification
|
||||||
Notification().notify(torrent_id)
|
Notification().notify(torrent_id)
|
||||||
|
|
||||||
|
def is_on_active_workspace(self):
|
||||||
|
# Returns True if mainwindow is on active workspace or wnck module not available
|
||||||
|
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())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue