From 582c6735d0387d599daba4811cd9da90a7e01dc0 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 27 Sep 2012 23:44:38 +0100 Subject: Fix #2100 : Add option not to bring main window to front when adding torrents through ipcinterface --- deluge/ui/gtkui/glade/preferences_dialog.glade | 13 +++++++++++++ deluge/ui/gtkui/gtkui.py | 1 + deluge/ui/gtkui/ipcinterface.py | 3 ++- deluge/ui/gtkui/preferences.py | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'deluge/ui/gtkui') diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 9fd34fa71..b2189d409 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.glade +++ b/deluge/ui/gtkui/glade/preferences_dialog.glade @@ -1900,6 +1900,19 @@ Disabled 0 + + + Focus window when adding torrent + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + 1 + + diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index dea68fdfe..ba859d6b6 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -166,6 +166,7 @@ DEFAULT_PREFS = { "sidebar_show_trackers": True, "sidebar_position": 170, "show_rate_in_title": False, + "focus_main_window_on_add": True, "createtorrent.trackers": [] } diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py index 610b4fcb5..4a8915047 100644 --- a/deluge/ui/gtkui/ipcinterface.py +++ b/deluge/ui/gtkui/ipcinterface.py @@ -58,7 +58,8 @@ import twisted.internet.error class IPCProtocolServer(Protocol): def dataReceived(self, data): data = rencode.loads(data) - component.get("MainWindow").present() + if not data or config["focus_main_window_on_add"]: + component.get("MainWindow").present() process_args(data) class IPCProtocolClient(Protocol): diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index a76261aed..712cbd62d 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -479,6 +479,8 @@ class Preferences(component.Component): self.gtkui_config["classic_mode"]) self.glade.get_widget("chk_show_rate_in_title").set_active( self.gtkui_config["show_rate_in_title"]) + self.glade.get_widget("chk_focus_main_window_on_add").set_active( + self.gtkui_config["focus_main_window_on_add"]) ## Other tab ## self.glade.get_widget("chk_show_new_releases").set_active( @@ -651,6 +653,8 @@ class Preferences(component.Component): self.glade.get_widget("chk_classic_mode").get_active() new_gtkui_config["show_rate_in_title"] = \ self.glade.get_widget("chk_show_rate_in_title").get_active() + new_gtkui_config["focus_main_window_on_add"] = \ + self.glade.get_widget("chk_focus_main_window_on_add").get_active() ## Other tab ## new_gtkui_config["show_new_releases"] = \ -- cgit