diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade
index 56840914d..fada4236c 100644
--- a/glade/preferences_dialog.glade
+++ b/glade/preferences_dialog.glade
@@ -56,13 +56,15 @@
2
2
-
+
True
- Ask me where to save each download
- True
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ 1
2
+ 1
+ 2
@@ -78,15 +80,13 @@
-
+
True
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ Ask me where to save each download
+ True
- 1
2
- 1
- 2
@@ -126,14 +126,6 @@
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
1
2
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 0
- Maximum simultaneous active torrents:
-
-
True
@@ -150,6 +142,14 @@
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ 0
+ Maximum simultaneous active torrents:
+
+
@@ -224,29 +224,6 @@
True
2
2
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Queue torrents to bottom when they begin seeding
- True
-
-
- 2
-
-
-
-
- True
- Stop seeding torrents when their share ratio reaches:
- True
-
-
- 1
- 2
-
-
True
@@ -265,6 +242,29 @@
+
+
+ True
+ Stop seeding torrents when their share ratio reaches:
+ True
+
+
+ 1
+ 2
+
+
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ Queue torrents to bottom when they begin seeding
+ True
+
+
+ 2
+
+
@@ -360,13 +360,53 @@
-
+
True
- Test Port
+ Try from:
+
+
+
+
+ True
+ to:
+
+
+ 2
+ 3
+
+
+
+
+ True
+ True
+ 0.5
+ 0 0 65535 1 10 10
+
+
+ 1
+ 2
+
+
+
+
+ True
+ True
+ 0.5
+ 0 0 65535 1 10 10
3
4
+
+
+
+
+ True
+ Active port:
+
+
+ 1
+ 2
1
2
@@ -384,57 +424,17 @@
-
+
True
- Active port:
-
-
- 1
- 2
- 1
- 2
-
-
-
-
- True
- True
- 0.5
- 0 0 65535 1 10 10
+ Test Port
3
4
+ 1
+ 2
-
-
- True
- True
- 0.5
- 0 0 65535 1 10 10
-
-
- 1
- 2
-
-
-
-
- True
- to:
-
-
- 2
- 3
-
-
-
-
- True
- Try from:
-
-
@@ -513,15 +513,19 @@
2
2
-
+
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Enable Mainline DHT
- True
+ 1
+ 0 0 100 1 10 10
+ 1
2
+ 1
+ 2
+ GTK_FILL
@@ -536,19 +540,15 @@
-
+
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 1
- 0 0 100 1 10 10
+ Enable Mainline DHT
+ True
- 1
2
- 1
- 2
- GTK_FILL
@@ -635,129 +635,25 @@
5
3
-
+
True
+ <i>(-1 is unlimited)</i>
+ True
- 2
3
- 2
- 3
-
- True
-
-
- 2
- 3
- 1
- 2
-
-
-
-
+
True
KB/s
2
3
- 4
- 5
-
-
-
-
-
- True
- True
- 10
- 1
- -1 -1 1024 1 10 10
-
-
- 1
- 2
- 4
- 5
-
-
-
-
-
- True
- 0
- Maximum Upload Rate:
-
-
- 4
- 5
-
-
-
-
- True
- True
- 10
- 1
- -1 -1 100 1 10 10
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- 0
- Maximum Connections
-
-
- 1
- 2
-
-
-
-
- True
- 0
- Upload Slots
-
-
- 2
- 3
-
-
-
-
- True
- 0
- Maximum Download Rate:
-
-
3
4
-
-
-
-
- True
- True
- 10
- 1
- -1 -1 100 1 10 10
-
-
- 1
- 2
- 2
- 3
@@ -778,26 +674,130 @@
-
+
+ True
+ True
+ 10
+ 1
+ -1 -1 100 1 10 10
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
+
+
+ True
+ 0
+ Maximum Download Rate:
+
+
+ 3
+ 4
+
+
+
+
+ True
+ 0
+ Upload Slots
+
+
+ 2
+ 3
+
+
+
+
+ True
+ 0
+ Maximum Connections
+
+
+ 1
+ 2
+
+
+
+
+ True
+ True
+ 10
+ 1
+ -1 -1 100 1 10 10
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+
+ True
+ 0
+ Maximum Upload Rate:
+
+
+ 4
+ 5
+
+
+
+
+ True
+ True
+ 10
+ 1
+ -1 -1 1024 1 10 10
+
+
+ 1
+ 2
+ 4
+ 5
+
+
+
+
+
True
KB/s
2
3
- 3
- 4
+ 4
+ 5
-
+
True
- <i>(-1 is unlimited)</i>
- True
+ 2
3
+ 1
+ 2
+
+
+
+
+ True
+
+
+ 2
+ 3
+ 2
+ 3
@@ -880,19 +880,32 @@
True
- 2
+ 3
2
-
+
True
- Minimize to tray on close
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ Password protect system tray
True
- 2
- 1
- 2
- 12
+ 2
+ 3
@@ -906,6 +919,19 @@
2
+
+
+ True
+ Minimize to tray on close
+ True
+
+
+ 2
+ 1
+ 2
+ 12
+
+
@@ -944,12 +970,16 @@
1
3
-
+
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 0
- GUI update interval
+ seconds
+
+ 2
+ 3
+
+
@@ -968,16 +998,12 @@
-
+
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- seconds
+ 0
+ GUI update interval
-
- 2
- 3
-
-
@@ -1064,4 +1090,3 @@
-
diff --git a/src/dialogs.py b/src/dialogs.py
index fd31fdeef..d3e8c2c46 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -40,6 +40,8 @@ class PreferencesDlg:
try:
self.glade.get_widget("chk_use_tray").set_active(self.preferences.get("enable_system_tray", bool, default=True))
self.glade.get_widget("chk_min_on_close").set_active(self.preferences.get("close_to_tray", bool, default=False))
+ self.glade.get_widget("chk_lock_tray").set_active(self.preferences.get("lock_tray", bool, default=False))
+ self.glade.get_widget("txt_tray_passwd").set_text(self.preferences.get("tray_passwd", default=""))
if(self.preferences.get("use_default_dir", bool, False)):
self.glade.get_widget("radio_save_all_to").set_active(True)
else:
@@ -72,6 +74,8 @@ class PreferencesDlg:
if r == 1:
self.preferences.set("enable_system_tray", self.glade.get_widget("chk_use_tray").get_active())
self.preferences.set("close_to_tray", self.glade.get_widget("chk_min_on_close").get_active())
+ self.preferences.set("lock_tray", self.glade.get_widget("chk_lock_tray").get_active())
+ self.preferences.set("tray_passwd", self.glade.get_widget("txt_tray_passwd").get_text())
self.preferences.set("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active())
self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename())
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
diff --git a/src/interface.py b/src/interface.py
index 4226fbcf0..f407c18dc 100644
--- a/src/interface.py
+++ b/src/interface.py
@@ -32,6 +32,9 @@ import gettext, locale
DEFAULT_PREFS = {
"auto_end_seeding" : False,
"close_to_tray" : False,
+ "lock_tray" : False,
+ "tray_passwd" : "",
+ "default_download_path" : "",
"default_download_path" : "",
"dht_connections" : 80,
"enable_dht" : True,
@@ -230,7 +233,41 @@ class DelugeGTK:
def tray_popup(self, status_icon, button, activate_time):
self.tray_menu.popup(None, None, gtk.status_icon_position_menu,
button, activate_time, status_icon)
-
+
+ def unlock_tray(self,comingnext):
+ entered_pass = gtk.Entry(25)
+ entered_pass.set_activates_default(True)
+ entered_pass.set_width_chars(25)
+ entered_pass.set_visibility(False)
+ entered_pass.show()
+ tray_lock = gtk.Dialog(title=_("Deluge is locked"), parent=self.window,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+ label = gtk.Label(_("Deluge is password protected.\nTo show the Deluge window, please enter your password"))
+ label.set_line_wrap(True)
+ label.set_justify(gtk.JUSTIFY_CENTER)
+ tray_lock.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+ tray_lock.set_size_request(400, 200)
+ tray_lock.set_default_response(gtk.RESPONSE_ACCEPT)
+ tray_lock.vbox.pack_start(label)
+ tray_lock.vbox.pack_start(entered_pass)
+ tray_lock.show_all()
+ if tray_lock.run() == gtk.RESPONSE_ACCEPT:
+ if self.config.get("tray_passwd", default="") == entered_pass.get_text():
+ if comingnext == "mainwinshow":
+ self.window.show()
+ elif comingnext == "prefwinshow":
+ self.preferences_dialog.show()
+ self.apply_prefs()
+ self.config.save_to_file()
+ elif comingnext == "quitus":
+ self.save_window_geometry()
+ self.window.hide()
+ self.shutdown()
+
+ tray_lock.destroy()
+ return True
+
+
def tray_clicked(self, status_icon):
if self.window.get_property("visible"):
if self.window.is_active():
@@ -238,13 +275,19 @@ class DelugeGTK:
else:
self.window.present()
else:
- self.window.show()
+ if self.config.get("lock_tray", bool, default=False) == True:
+ self.unlock_tray("mainwinshow")
+ else:
+ self.window.show()
def force_show_hide(self, arg=None):
if self.window.get_property("visible"):
self.window.hide()
else:
- self.window.show()
+ if self.config.get("lock_tray", bool, default=False) == True:
+ self.unlock_tray("mainwinshow")
+ else:
+ self.window.show()
def build_torrent_table(self):
## Create the torrent listview
@@ -460,9 +503,19 @@ class DelugeGTK:
dialogs.show_about_dialog()
def show_pref_dialog(self, arg=None):
- self.preferences_dialog.show()
- self.apply_prefs()
- self.config.save_to_file()
+ if self.window.get_property("visible"):
+ self.preferences_dialog.show()
+ self.apply_prefs()
+ self.config.save_to_file()
+
+ else:
+ if self.config.get("lock_tray", bool, default=False) == True:
+ self.unlock_tray("prefwinshow")
+ else:
+ self.preferences_dialog.show()
+ self.apply_prefs()
+ self.config.save_to_file()
+
def show_plugin_dialog(self, arg=None):
self.plugin_dialog.show()
@@ -988,9 +1041,18 @@ class DelugeGTK:
self.quit()
def quit(self, widget=None):
- self.save_window_geometry()
- self.window.hide()
- self.shutdown()
+ if self.window.get_property("visible"):
+ self.save_window_geometry()
+ self.window.hide()
+ self.shutdown()
+
+ else:
+ if self.config.get("lock_tray", bool, default=False) == True:
+ self.unlock_tray("quitus")
+ else:
+ self.save_window_geometry()
+ self.window.hide()
+ self.shutdown()
def shutdown(self):
enabled_plugins = ':'.join(self.plugins.get_enabled_plugins())
@@ -1003,7 +1065,6 @@ class DelugeGTK:
-
## For testing purposes, create a copy of the interface
if __name__ == "__main__":
interface = DelugeGTK()