Fix #2100 : Add option not to bring main window to front when adding torrents through ipcinterface

This commit is contained in:
Calum Lind 2012-09-27 23:44:38 +01:00
parent 5d43c2ac94
commit 582c6735d0
4 changed files with 20 additions and 1 deletions

View File

@ -1900,6 +1900,19 @@ Disabled</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkCheckButton" id="chk_focus_main_window_on_add">
<property name="label" translatable="yes">Focus window when adding torrent</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>

View File

@ -166,6 +166,7 @@ DEFAULT_PREFS = {
"sidebar_show_trackers": True, "sidebar_show_trackers": True,
"sidebar_position": 170, "sidebar_position": 170,
"show_rate_in_title": False, "show_rate_in_title": False,
"focus_main_window_on_add": True,
"createtorrent.trackers": [] "createtorrent.trackers": []
} }

View File

@ -58,7 +58,8 @@ import twisted.internet.error
class IPCProtocolServer(Protocol): class IPCProtocolServer(Protocol):
def dataReceived(self, data): def dataReceived(self, data):
data = rencode.loads(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) process_args(data)
class IPCProtocolClient(Protocol): class IPCProtocolClient(Protocol):

View File

@ -479,6 +479,8 @@ class Preferences(component.Component):
self.gtkui_config["classic_mode"]) self.gtkui_config["classic_mode"])
self.glade.get_widget("chk_show_rate_in_title").set_active( self.glade.get_widget("chk_show_rate_in_title").set_active(
self.gtkui_config["show_rate_in_title"]) 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 ## ## Other tab ##
self.glade.get_widget("chk_show_new_releases").set_active( 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() self.glade.get_widget("chk_classic_mode").get_active()
new_gtkui_config["show_rate_in_title"] = \ new_gtkui_config["show_rate_in_title"] = \
self.glade.get_widget("chk_show_rate_in_title").get_active() 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 ## ## Other tab ##
new_gtkui_config["show_new_releases"] = \ new_gtkui_config["show_new_releases"] = \