add proper preferences for selection popup

This commit is contained in:
Marcos Pinto 2007-11-18 22:57:10 +00:00
parent 06e8a0c6b9
commit 5a01eec297
4 changed files with 54 additions and 4 deletions

View File

@ -289,12 +289,34 @@
<property name="label" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle_ui"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment39">
<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="left_padding">10</property>
<child>
<widget class="GtkCheckButton" id="chk_enable_multi_only">
<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="tooltip" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="label" translatable="yes">Only show if torrent has more than 1 file</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_prioritize_first_last_pieces">
<property name="visible">True</property>
@ -307,7 +329,7 @@
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -320,7 +342,7 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
</widget>

View File

@ -126,6 +126,7 @@ class PreferencesDlg:
self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path"))
self.glade.get_widget("torrent_path_button").set_filename(self.preferences.get("default_torrent_path"))
self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog"))
self.glade.get_widget("chk_enable_multi_only").set_active(self.preferences.get("enable_multi_only"))
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(self.preferences.get("prioritize_first_last_pieces"))
self.glade.get_widget("radio_compact_allocation").set_active(self.preferences.get("use_compact_storage"))
self.glade.get_widget("radio_full_allocation").set_active(not self.preferences.get("use_compact_storage"))
@ -164,6 +165,8 @@ class PreferencesDlg:
self.glade.get_widget('chk_min_on_close').set_sensitive(
self.glade.get_widget('chk_use_tray').get_active())
self.glade.get_widget('chk_enable_multi_only').set_sensitive(
self.glade.get_widget('chk_enable_files_dialog').get_active())
self.glade.get_widget('chk_start_in_tray').set_sensitive(
self.glade.get_widget('chk_use_tray').get_active())
self.glade.get_widget('chk_lock_tray').set_sensitive(
@ -249,6 +252,7 @@ class PreferencesDlg:
self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename())
self.preferences.set("default_torrent_path", self.glade.get_widget("torrent_path_button").get_filename())
self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active())
self.preferences.set("enable_multi_only", self.glade.get_widget("chk_enable_multi_only").get_active())
self.preferences.set("prioritize_first_last_pieces", self.glade.get_widget("chk_prioritize_first_last_pieces").get_active())
self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active())
self.preferences.set("auto_seed_ratio", self.glade.get_widget("ratio_spinner").get_value())
@ -339,6 +343,8 @@ class PreferencesDlg:
self.glade.get_widget('chk_clear_max_ratio_torrents').set_sensitive(value)
elif widget == self.glade.get_widget('chk_seedbottom'):
self.glade.get_widget('chk_queue_above_completed').set_sensitive(value)
elif widget == self.glade.get_widget('chk_enable_files_dialog'):
self.glade.get_widget('chk_enable_multi_only').set_sensitive(value)
elif widget == self.glade.get_widget('chk_peer_proxy'):
value = self.glade.get_widget('chk_peer_proxy').get_active()
for x in ['combo_peer_proxy_type', 'txt_peer_proxy_hostname',

View File

@ -1309,7 +1309,8 @@ window, please enter your password"))
try:
dumped_torrent = self.manager.dump_torrent_file_info(torrent)
if (self.config.get('enable_files_dialog')) and (len(dumped_torrent) > 1):
if self.config.get('enable_files_dialog') and not \
self.config.get('enable_multi_only'):
files_dialog = dialogs.FilesDlg(dumped_torrent)
if files_dialog.show(self.window) == 1:
unique_id = self.manager.add_torrent(torrent, path,
@ -1321,7 +1322,26 @@ window, please enter your password"))
self.manager.set_priv(unique_id, True)
else:
return False
else:
elif self.config.get('enable_files_dialog') and \
self.config.get('enable_multi_only') and (len(dumped_torrent) > 1):
files_dialog = dialogs.FilesDlg(dumped_torrent)
if files_dialog.show(self.window) == 1:
unique_id = self.manager.add_torrent(torrent, path,
self.config.get('use_compact_storage'), \
self.config.get('start_paused'))
self.manager.prioritize_files(unique_id,
files_dialog.get_priorities())
if files_dialog.is_private_flag_checked():
self.manager.set_priv(unique_id, True)
else:
return False
elif self.config.get('enable_files_dialog') and \
self.config.get('enable_multi_only') and not (len(dumped_torrent) > 1):
unique_id = self.manager.add_torrent(torrent, path,
self.config.get('use_compact_storage'), \
self.config.get('start_paused'))
elif not self.config.get('enable_files_dialog'):
unique_id = self.manager.add_torrent(torrent, path,
self.config.get('use_compact_storage'), \
self.config.get('start_paused'))

View File

@ -51,6 +51,7 @@ if common.windows_check():
"auto_seed_ratio" : 0,
"close_to_tray" : False,
"enable_files_dialog" : False,
"enable_multi_only" : True,
"queue_above_completed" : False,
"clear_max_ratio_torrents" : False,
"default_autoload_path" : os.path.expanduser("~"),
@ -162,6 +163,7 @@ else:
"auto_seed_ratio" : 0,
"close_to_tray" : False,
"enable_files_dialog" : False,
"enable_multi_only" : True,
"queue_above_completed" : False,
"clear_max_ratio_torrents" : False,
"default_autoload_path" : os.path.expanduser("~"),