GTK UI move storage fixed. Was still not allowing moves.

This commit is contained in:
Pedro Algarvio 2011-05-10 20:13:26 +01:00
parent 0c110c2408
commit 74618d5a65

View File

@ -221,7 +221,9 @@ class MenuBar(component.Component):
def stop(self): def stop(self):
log.debug("MenuBar stopping") log.debug("MenuBar stopping")
self.menuitem_change_owner.remove_submenu() if client.get_auth_level() == deluge.common.AUTH_LEVEL_ADMIN:
# If not an admin, no submenu was added
self.menuitem_change_owner.remove_submenu()
for widget in self.change_sensitivity: for widget in self.change_sensitivity:
self.window.main_glade.get_widget(widget).set_sensitive(False) self.window.main_glade.get_widget(widget).set_sensitive(False)
@ -332,17 +334,21 @@ class MenuBar(component.Component):
def _on_torrent_status(status): def _on_torrent_status(status):
deluge.common.open_file(status["save_path"]) deluge.common.open_file(status["save_path"])
for torrent_id in component.get("TorrentView").get_selected_torrents(): for torrent_id in component.get("TorrentView").get_selected_torrents():
component.get("SessionProxy").get_torrent_status(torrent_id, ["save_path"]).addCallback(_on_torrent_status) component.get("SessionProxy").get_torrent_status(
torrent_id, ["save_path"]).addCallback(_on_torrent_status)
def on_menuitem_move_activate(self, data=None): def on_menuitem_move_activate(self, data=None):
log.debug("on_menuitem_move_activate") log.debug("on_menuitem_move_activate")
if client.is_localhost(): if client.is_localhost():
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
config = ConfigManager("gtkui.conf") config = ConfigManager("gtkui.conf")
chooser = gtk.FileChooserDialog(_("Choose a directory to move files to"\ chooser = gtk.FileChooserDialog(
) , component.get("MainWindow").window, \ _("Choose a directory to move files to"),
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, \ component.get("MainWindow").window,
gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK)
)
chooser.set_local_only(True) chooser.set_local_only(True)
if not deluge.common.windows_check(): if not deluge.common.windows_check():
chooser.set_icon(common.get_deluge_icon()) chooser.set_icon(common.get_deluge_icon())
@ -355,7 +361,9 @@ class MenuBar(component.Component):
component.get("TorrentView").get_selected_torrents(), result) component.get("TorrentView").get_selected_torrents(), result)
chooser.destroy() chooser.destroy()
else: else:
component.get("SessionProxy").get_torrent_status(component.get("TorrentView").get_selected_torrent(), ["save_path"]).addCallback(self.show_move_storage_dialog) component.get("SessionProxy").get_torrent_status(
component.get("TorrentView").get_selected_torrent(),
["save_path"]).addCallback(self.show_move_storage_dialog)
def show_move_storage_dialog(self, status): def show_move_storage_dialog(self, status):
log.debug("show_move_storage_dialog") log.debug("show_move_storage_dialog")
@ -377,7 +385,7 @@ class MenuBar(component.Component):
if response_id == gtk.RESPONSE_OK: if response_id == gtk.RESPONSE_OK:
log.debug("Moving torrents to %s", log.debug("Moving torrents to %s",
self.move_storage_dialog.get_text()) self.move_storage_dialog_entry.get_text())
path = self.move_storage_dialog_entry.get_text() path = self.move_storage_dialog_entry.get_text()
client.core.move_storage( client.core.move_storage(
component.get("TorrentView").get_selected_torrents(), path component.get("TorrentView").get_selected_torrents(), path