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 ffb902ba06
commit 7119e0d95f
4 changed files with 21 additions and 2 deletions

View File

@ -2465,6 +2465,19 @@ used sparingly.</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object 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>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="piecesbar_toggle"> <object class="GtkCheckButton" id="piecesbar_toggle">
<property name="visible">True</property> <property name="visible">True</property>
@ -2491,7 +2504,7 @@ status tab (&lt;b&gt;EXPERIMENTAL!!!&lt;/b&gt;)</property>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>

View File

@ -149,6 +149,7 @@ DEFAULT_PREFS = {
"pieces_color_waiting": [4874, 56494, 0], "pieces_color_waiting": [4874, 56494, 0],
"pieces_color_downloading": [65535, 55255, 0], "pieces_color_downloading": [65535, 55255, 0],
"pieces_color_completed": [4883, 26985, 56540], "pieces_color_completed": [4883, 26985, 56540],
"focus_main_window_on_add": True,
} }
class GtkUI(object): class GtkUI(object):

View File

@ -60,6 +60,7 @@ log = logging.getLogger(__name__)
class IPCProtocolServer(Protocol): class IPCProtocolServer(Protocol):
def dataReceived(self, data): def dataReceived(self, data):
data = rencode.loads(data) data = rencode.loads(data)
if not data or config["focus_main_window_on_add"]:
component.get("MainWindow").present() component.get("MainWindow").present()
process_args(data) process_args(data)

View File

@ -552,6 +552,8 @@ class Preferences(component.Component):
self.gtkui_config["classic_mode"]) self.gtkui_config["classic_mode"])
self.builder.get_object("chk_show_rate_in_title").set_active( self.builder.get_object("chk_show_rate_in_title").set_active(
self.gtkui_config["show_rate_in_title"]) self.gtkui_config["show_rate_in_title"])
self.builder.get_object("chk_focus_main_window_on_add").set_active(
self.gtkui_config["focus_main_window_on_add"])
self.builder.get_object("piecesbar_toggle").set_active( self.builder.get_object("piecesbar_toggle").set_active(
self.gtkui_config["show_piecesbar"] self.gtkui_config["show_piecesbar"]
) )
@ -739,6 +741,8 @@ class Preferences(component.Component):
new_gtkui_config["show_rate_in_title"] = \ new_gtkui_config["show_rate_in_title"] = \
self.builder.get_object("chk_show_rate_in_title").get_active() self.builder.get_object("chk_show_rate_in_title").get_active()
new_gtkui_config["focus_main_window_on_add"] = \
self.builder.get_object("chk_focus_main_window_on_add").get_active()
## Other tab ## ## Other tab ##
new_gtkui_config["show_new_releases"] = \ new_gtkui_config["show_new_releases"] = \