Ticket #2047: 0001-Edit-trackers-for-all-selected-torrents.patch

File 0001-Edit-trackers-for-all-selected-torrents.patch, 2.7 KB (added by aberaud, 4 years ago)

Patch rebased on 1.3-stable

  • deluge/ui/gtkui/edittrackersdialog.py

    From d021f2ee1e76f8573ac75576db689da351985ace Mon Sep 17 00:00:00 2001
    From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
    Date: Wed, 17 May 2017 01:51:08 -0400
    Subject: [PATCH] Edit trackers for all selected torrents
    
    ---
     deluge/ui/gtkui/edittrackersdialog.py | 11 ++++++-----
     deluge/ui/gtkui/menubar.py            |  2 +-
     2 files changed, 7 insertions(+), 6 deletions(-)
    
    diff --git a/deluge/ui/gtkui/edittrackersdialog.py b/deluge/ui/gtkui/edittrackersdialog.py
    index c95de1c08..1e141f300 100644
    a b  
    4444from deluge.log import LOG as log 
    4545 
    4646class EditTrackersDialog: 
    47     def __init__(self, torrent_id, parent=None): 
    48         self.torrent_id = torrent_id 
     47    def __init__(self, torrent_ids, parent=None): 
     48        self.torrent_ids = torrent_ids 
    4949        self.glade = gtk.glade.XML( 
    5050                    pkg_resources.resource_filename("deluge.ui.gtkui", 
    5151                                            "glade/edit_trackers.glade")) 
    def __init__(self, torrent_id, parent=None): 
    9090 
    9191    def run(self): 
    9292        # Make sure we have a torrent_id.. if not just return 
    93         if self.torrent_id == None: 
     93        if not self.torrent_ids: 
    9494            return 
    9595 
    9696        # Get the trackers for this torrent 
    9797        session = component.get("SessionProxy") 
    98         session.get_torrent_status(self.torrent_id, ["trackers"]).addCallback(self._on_get_torrent_status) 
     98        session.get_torrent_status(self.torrent_ids[0], ["trackers"]).addCallback(self._on_get_torrent_status) 
    9999        client.force_call() 
    100100 
    101101    def _on_get_torrent_status(self, status): 
    def each(model, path, iter, data): 
    181181            self.trackers.append(tracker) 
    182182        self.liststore.foreach(each, None) 
    183183        # Set the torrens trackers 
    184         client.core.set_torrent_trackers(self.torrent_id, self.trackers) 
     184        for torrent_id in self.torrent_ids: 
     185            client.core.set_torrent_trackers(torrent_id, self.trackers) 
    185186        self.dialog.destroy() 
    186187 
    187188    def on_button_cancel_clicked(self, widget): 
  • deluge/ui/gtkui/menubar.py

    diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
    index 08729c884..1376509a5 100644
    a b def on_menuitem_edittrackers_activate(self, data=None): 
    288288        log.debug("on_menuitem_edittrackers_activate") 
    289289        from edittrackersdialog import EditTrackersDialog 
    290290        dialog = EditTrackersDialog( 
    291             component.get("TorrentView").get_selected_torrent(), 
     291            component.get("TorrentView").get_selected_torrents(), 
    292292            component.get("MainWindow").window) 
    293293        dialog.run() 
    294294