passwd lock for real this time

This commit is contained in:
Marcos Pinto 2007-05-25 08:17:22 +00:00
parent 6425b94d7a
commit 9c57852f89
3 changed files with 327 additions and 237 deletions

View File

@ -56,13 +56,15 @@
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkRadioButton" id="radio_ask_save">
<widget class="GtkFileChooserButton" id="download_path_button">
<property name="visible">True</property>
<property name="label" translatable="yes">Ask me where to save each download</property>
<property name="draw_indicator">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
@ -78,15 +80,13 @@
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="download_path_button">
<widget class="GtkRadioButton" id="radio_ask_save">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="label" translatable="yes">Ask me where to save each download</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</widget>
@ -126,14 +126,6 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">1</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label33">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum simultaneous active torrents:</property>
</widget>
</child>
<child>
<widget class="GtkSpinButton" id="spin_torrents">
<property name="visible">True</property>
@ -150,6 +142,14 @@
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label33">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum simultaneous active torrents:</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -224,29 +224,6 @@
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkCheckButton" id="chk_seedbottom">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Queue torrents to bottom when they begin seeding</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_autoseed">
<property name="visible">True</property>
<property name="label" translatable="yes">Stop seeding torrents when their share ratio reaches:</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="ratio_spinner">
<property name="visible">True</property>
@ -265,6 +242,29 @@
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_autoseed">
<property name="visible">True</property>
<property name="label" translatable="yes">Stop seeding torrents when their share ratio reaches:</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_seedbottom">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Queue torrents to bottom when they begin seeding</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
</packing>
</child>
</widget>
</child>
</widget>
@ -360,13 +360,53 @@
<placeholder/>
</child>
<child>
<widget class="GtkButton" id="btn_test_port">
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="label" translatable="yes">Test Port</property>
<property name="label" translatable="yes">Try from:</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="label" translatable="yes">to:</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_min">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_max">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="label" translatable="yes">Active port:</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
@ -384,57 +424,17 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label26">
<widget class="GtkButton" id="btn_test_port">
<property name="visible">True</property>
<property name="label" translatable="yes">Active port:</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_max">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
<property name="label" translatable="yes">Test Port</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_min">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="label" translatable="yes">to:</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="label" translatable="yes">Try from:</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -513,15 +513,19 @@
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkCheckButton" id="chk_dht">
<widget class="GtkSpinButton" id="spin_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Enable Mainline DHT</property>
<property name="draw_indicator">True</property>
<property name="xalign">1</property>
<property name="adjustment">0 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
@ -536,19 +540,15 @@
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_dht">
<widget class="GtkCheckButton" id="chk_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">1</property>
<property name="adjustment">0 0 100 1 10 10</property>
<property name="label" translatable="yes">Enable Mainline DHT</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
@ -635,129 +635,25 @@
<property name="n_rows">5</property>
<property name="n_columns">3</property>
<child>
<widget class="GtkLabel" id="label1">
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;(-1 is unlimited)&lt;/i&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">KB/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1024 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Rate:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Slots</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Download Rate:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
@ -778,26 +674,130 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<widget class="GtkSpinButton" id="spin_num_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Download Rate:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Slots</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Rate:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 1024 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">KB/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label9">
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;(-1 is unlimited)&lt;/i&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</widget>
@ -880,19 +880,32 @@
<child>
<widget class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkCheckButton" id="chk_min_on_close">
<widget class="GtkEntry" id="txt_tray_passwd">
<property name="visible">True</property>
<property name="label" translatable="yes">Minimize to tray on close</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_lock_tray">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Password protect system tray</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">12</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
@ -906,6 +919,19 @@
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_min_on_close">
<property name="visible">True</property>
<property name="label" translatable="yes">Minimize to tray on close</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">12</property>
</packing>
</child>
</widget>
</child>
</widget>
@ -944,12 +970,16 @@
<property name="n_rows">1</property>
<property name="n_columns">3</property>
<child>
<widget class="GtkLabel" id="label28">
<widget class="GtkLabel" id="label30">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">GUI update interval</property>
<property name="label" translatable="yes">seconds</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_gui">
@ -968,16 +998,12 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label30">
<widget class="GtkLabel" id="label28">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">seconds</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">GUI update interval</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
</widget>
</child>
@ -1064,4 +1090,3 @@
</child>
</widget>
</glade-interface>

View File

@ -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())

View File

@ -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()