diff --git a/deluge/core/core.py b/deluge/core/core.py index 88eda2e13..0fb9203c3 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -599,6 +599,13 @@ class Core(component.Component): self.torrentmanager[torrent_id].set_owner(username) return None + @export + def set_torrents_shared(self, torrent_ids, shared): + if isinstance(torrent_ids, basestring): + torrent_ids = [torrent_ids] + for torrent_id in torrent_ids: + self.torrentmanager[torrent_id].set_options({"shared": shared}) + @export def get_path_size(self, path): """Returns the size of the file or folder 'path' and -1 if the path is diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index bc108c007..e22e9cfe5 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -142,7 +142,7 @@ DEFAULT_PREFS = { "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat", "cache_size": 512, "cache_expiry": 60, - "public": False + "shared": False } class PreferencesManager(component.Component): @@ -150,6 +150,11 @@ class PreferencesManager(component.Component): component.Component.__init__(self, "PreferencesManager") self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS) + if 'public' in self.config: + log.debug("Updating configuration file: Renamed torrent's public " + "attribute to shared.") + self.config["shared"] = self.config["public"] + del self.config["public"] def start(self): self.core = component.get("Core") diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index b3a2564cc..0ca8df1be 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -69,7 +69,7 @@ class TorrentOptions(dict): "move_completed": "move_completed", "move_completed_path": "move_completed_path", "add_paused": "add_paused", - "public": "public" + "shared": "shared" } for opt_k, conf_k in options_conf_map.iteritems(): self[opt_k] = config[conf_k] @@ -610,7 +610,7 @@ class Torrent(object): "paused": self.status.paused, "prioritize_first_last": self.options["prioritize_first_last_pieces"], "progress": progress, - "public": self.options["public"], + "shared": self.options["shared"], "remove_at_ratio": self.options["remove_at_ratio"], "save_path": self.options["download_location"], "seeding_time": self.status.seeding_time, diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 5eb6268c2..aeb5068f9 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -86,7 +86,7 @@ class TorrentState: magnet=None, time_added=-1, owner="", - public=False + shared=False ): self.torrent_id = torrent_id self.filename = filename @@ -114,7 +114,7 @@ class TorrentState: self.remove_at_ratio = remove_at_ratio self.move_completed = move_completed self.move_completed_path = move_completed_path - self.public = public + self.shared = shared class TorrentManagerState: def __init__(self): @@ -286,8 +286,8 @@ class TorrentManager(component.Component): current_user = component.get("RPCServer").get_session_user() for torrent_id in torrent_ids[:]: - torrent_status = self[torrent_id].get_status(["owner", "public"]) - if torrent_status["owner"] != current_user and torrent_status["public"] == False: + torrent_status = self[torrent_id].get_status(["owner", "shared"]) + if torrent_status["owner"] != current_user and torrent_status["shared"] == False: torrent_ids.pop(torrent_ids.index(torrent_id)) return torrent_ids @@ -368,7 +368,7 @@ class TorrentManager(component.Component): options["move_completed"] = state.move_completed options["move_completed_path"] = state.move_completed_path options["add_paused"] = state.paused - options["public"] = state.public + options["shared"] = state.shared ti = self.get_torrent_info_from_file( os.path.join(get_config_dir(), @@ -662,7 +662,7 @@ class TorrentManager(component.Component): torrent.magnet, torrent.time_added, torrent.owner, - torrent.options["public"] + torrent.options["shared"] ) state.torrents.append(torrent_state) diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index 96f39cfbf..4a79f21fc 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -66,7 +66,7 @@ class DetailsTab(Tab): (glade.get_widget("summary_hash"), str, ("hash",)), (glade.get_widget("summary_comments"), str, ("comment",)), (glade.get_widget("summary_owner"), str, ("owner",)), - (glade.get_widget("summary_public"), str, ("public",)) + (glade.get_widget("summary_shared"), str, ("shared",)) ] def update(self): @@ -82,9 +82,9 @@ class DetailsTab(Tab): return # Get the torrent status - status_keys = ["name", "total_size", "num_files", - "tracker", "save_path", "message", "hash", "comment", "owner", - "public"] + status_keys = ["name", "total_size", "num_files", "tracker", + "save_path", "message", "hash", "comment", "owner", + "shared"] session = component.get("SessionProxy") session.get_torrent_status(selected, status_keys).addCallback(self._on_get_torrent_status) diff --git a/deluge/ui/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index 73928a31b..633ac3e64 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -223,6 +223,7 @@ class AuthenticationDialog(BaseDialog): self.password_label.set_padding(5, 5) self.password_entry = gtk.Entry() self.password_entry.set_visibility(False) + self.password_entry.connect("activate", self.on_password_activate) table.attach(self.password_label, 0, 1, 1, 2) table.attach(self.password_entry, 1, 2, 1, 2) @@ -241,3 +242,6 @@ class AuthenticationDialog(BaseDialog): def get_password(self): return self.password_entry.get_text() + + def on_password_activate(self, widget): + self.response(gtk.RESPONSE_OK) diff --git a/deluge/ui/gtkui/edittrackersdialog.py b/deluge/ui/gtkui/edittrackersdialog.py index 2c9dc73a6..ba39dcbb3 100644 --- a/deluge/ui/gtkui/edittrackersdialog.py +++ b/deluge/ui/gtkui/edittrackersdialog.py @@ -39,6 +39,7 @@ import gtk.glade import logging import pkg_resources +from twisted.internet import defer import deluge.common import common from deluge.ui.client import client @@ -91,6 +92,10 @@ class EditTrackersDialog: self.treeview.set_model(self.liststore) self.liststore.set_sort_column_id(0, gtk.SORT_ASCENDING) + self.dialog.connect("delete-event", self._on_delete_event) + self.dialog.connect("response", self._on_response) + self.changed = False + def run(self): # Make sure we have a torrent_id.. if not just return if self.torrent_id == None: @@ -101,6 +106,18 @@ class EditTrackersDialog: session.get_torrent_status(self.torrent_id, ["trackers"]).addCallback(self._on_get_torrent_status) client.force_call() + self.deferred = defer.Deferred() + return self.deferred + + + def _on_delete_event(self, widget, event): + self.deferred.callback(gtk.RESPONSE_DELETE_EVENT) + self.dialog.destroy() + + def _on_response(self, widget, response): + self.deferred.callback(response) + self.dialog.destroy() + def _on_get_torrent_status(self, status): """Display trackers dialog""" for tracker in status["trackers"]: @@ -111,6 +128,7 @@ class EditTrackersDialog: def add_tracker(self, tier, url): """Adds a tracker to the list""" self.liststore.append([tier, url]) + self.changed = True def get_selected(self): """Returns the selected tracker""" @@ -125,18 +143,21 @@ class EditTrackersDialog: new_tier = tier + 1 # Now change the tier for this tracker self.liststore.set_value(selected, 0, new_tier) + self.changed = True def on_button_add_clicked(self, widget): log.debug("on_button_add_clicked") # Show the add tracker dialog self.add_tracker_dialog.show() self.glade.get_widget("textview_trackers").grab_focus() + self.changed = True def on_button_remove_clicked(self, widget): log.debug("on_button_remove_clicked") selected = self.get_selected() if selected != None: self.liststore.remove(selected) + self.changed = True def on_button_edit_clicked(self, widget): """edits an existing tracker""" @@ -158,6 +179,7 @@ class EditTrackersDialog: tracker = self.glade.get_widget("entry_edit_tracker").get_text() self.liststore.set_value(selected, 1, tracker) self.edit_tracker_entry.hide() + self.changed = True def on_button_down_clicked(self, widget): log.debug("on_button_down_clicked") @@ -170,6 +192,7 @@ class EditTrackersDialog: new_tier = tier - 1 # Now change the tier for this tracker self.liststore.set_value(selected, 0, new_tier) + self.changed = True def on_button_ok_clicked(self, widget): log.debug("on_button_ok_clicked") @@ -182,11 +205,14 @@ class EditTrackersDialog: self.liststore.foreach(each, None) # Set the torrens trackers client.core.set_torrent_trackers(self.torrent_id, self.trackers) - self.dialog.destroy() + if self.changed: + self.dialog.response(gtk.RESPONSE_OK) + else: + self.dialog.response(gtk.RESPONSE_CANCEL) def on_button_cancel_clicked(self, widget): log.debug("on_button_cancel_clicked") - self.dialog.destroy() + self.dialog.response(gtk.RESPONSE_CANCEL) def on_button_add_ok_clicked(self, widget): log.debug("on_button_add_ok_clicked") diff --git a/deluge/ui/gtkui/glade/edit_trackers.glade b/deluge/ui/gtkui/glade/edit_trackers.glade index 2a6269196..14d802a21 100644 --- a/deluge/ui/gtkui/glade/edit_trackers.glade +++ b/deluge/ui/gtkui/glade/edit_trackers.glade @@ -1,16 +1,16 @@ - - - + + + 400 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 Edit Trackers - GTK_WIN_POS_CENTER_ON_PARENT + center-on-parent 400 True - GDK_WINDOW_TYPE_HINT_DIALOG + dialog False @@ -36,6 +36,7 @@ False False + 0 @@ -57,6 +58,7 @@ False False + 0 @@ -69,9 +71,9 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN + automatic + automatic + in True @@ -80,81 +82,92 @@ + + 0 + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 1 - GTK_BUTTONBOX_CENTER + center + gtk-go-up True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-go-up True - 0 + + False + False + 0 + + gtk-add True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-add True - 0 + False + False 1 + gtk-edit True True True - gtk-edit True - 0 + False + False 2 + gtk-remove True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-remove True - 0 + False + False 3 + gtk-go-down True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-go-down True - 0 + False + False 4 @@ -179,38 +192,45 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_END + end + gtk-cancel True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel True - 0 + + False + False + 0 + + gtk-ok + 1 True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok True - 0 + False + False 1 False - GTK_PACK_END + end + 0 @@ -222,9 +242,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 Add Tracker - GTK_WIN_POS_CENTER_ON_PARENT + center-on-parent True - GDK_WINDOW_TYPE_HINT_DIALOG + dialog False False @@ -251,6 +271,7 @@ False False + 0 @@ -270,6 +291,7 @@ False False + 0 @@ -297,15 +319,16 @@ False + 0 True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN + automatic + automatic + in True @@ -334,40 +357,48 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_END + end + gtk-cancel + -6 True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel True - -6 + + False + False + 0 + + gtk-ok + -5 True True True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok True - -5 + False + False 1 False - GTK_PACK_END + end + 0 @@ -378,9 +409,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 Edit Tracker - GTK_WIN_POS_CENTER_ON_PARENT + center-on-parent True - GDK_WINDOW_TYPE_HINT_DIALOG + dialog False False @@ -407,6 +438,7 @@ False False + 0 @@ -426,6 +458,7 @@ False False + 0 @@ -452,6 +485,7 @@ False False + 0 @@ -483,40 +517,47 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_END + end + gtk-cancel True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel True - 0 + + False + False + 0 + + gtk-ok + 1 True True True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok True - 0 + False + False 1 False - GTK_PACK_END + end + 0 diff --git a/deluge/ui/gtkui/glade/main_window.glade b/deluge/ui/gtkui/glade/main_window.glade index c4ab57cfb..a426b9620 100644 --- a/deluge/ui/gtkui/glade/main_window.glade +++ b/deluge/ui/gtkui/glade/main_window.glade @@ -11,7 +11,6 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical True @@ -470,7 +469,6 @@ True - vertical True @@ -674,7 +672,6 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical 5 @@ -1561,9 +1558,10 @@ True + Torrent is shared between other Deluge users or not. 0 1 - <b>Public:</b> + <b>Shared:</b> True @@ -1589,32 +1587,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + True + Torrent is shared between other Deluge users or not. 0 char True @@ -1627,6 +1602,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -1990,7 +1989,6 @@ True - vertical Auto Managed @@ -2008,7 +2006,6 @@ True - vertical True @@ -2149,7 +2146,6 @@ True - vertical True @@ -2165,7 +2161,6 @@ True - vertical Private @@ -2173,6 +2168,7 @@ False True False + If checked this torrent won't be shared among trackers, DHT nodes, etc... True @@ -2195,6 +2191,20 @@ 1 + + + Shared + True + True + False + Torrent is shared between other Deluge users or not. + True + + + + 2 + + True @@ -2236,7 +2246,7 @@ False False - 2 + 3 @@ -2275,6 +2285,7 @@ gtk-apply True + False True True True @@ -2357,13 +2368,11 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical 2 True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical 5 @@ -2555,13 +2564,11 @@ True - vertical 2 True 10 - vertical 5 diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index 35c7b7655..d4741b319 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -427,7 +427,7 @@ class ListView: def add_column(self, header, render, col_types, hidden, position, status_field, sortid, text=0, value=0, pixbuf=0, function=None, - column_type=None, sort_func=None): + column_type=None, sort_func=None, tooltip=None): """Adds a column to the ListView""" # Add the column types to liststore_columns column_indices = [] @@ -504,6 +504,9 @@ class ListView: column.connect('button-press-event', self.on_treeview_header_right_clicked) + if tooltip: + column.get_widget().set_tooltip_markup(tooltip) + # Check for loaded state and apply if self.state != None: for column_state in self.state: @@ -514,7 +517,9 @@ class ListView: column.set_fixed_width(column_state.width) if column_state.sort is not None and column_state.sort > -1: - self.model_filter.set_sort_column_id(column_state.sort, column_state.sort_order) + self.model_filter.set_sort_column_id( + column_state.sort, column_state.sort_order + ) column.set_visible(column_state.visible) position = column_state.position @@ -531,76 +536,66 @@ class ListView: return True - def add_text_column(self, header, col_type=str, hidden=False, - position=None, - status_field=None, - sortid=0, - column_type="text", - sort_func=None): + def add_text_column(self, header, col_type=str, hidden=False, position=None, + status_field=None, sortid=0, column_type="text", + sort_func=None, tooltip=None): """Add a text column to the listview. Only the header name is required. """ render = gtk.CellRendererText() self.add_column(header, render, col_type, hidden, position, - status_field, sortid, column_type=column_type, sort_func=sort_func) + status_field, sortid, column_type=column_type, + sort_func=sort_func, tooltip=tooltip) return True def add_bool_column(self, header, col_type=bool, hidden=False, - position=None, - status_field=None, - sortid=0, - column_type="bool"): + position=None, status_field=None, sortid=0, + column_type="bool", tooltip=None): """Add a bool column to the listview""" render = gtk.CellRendererToggle() self.add_column(header, render, col_type, hidden, position, - status_field, sortid, column_type=column_type) + status_field, sortid, column_type=column_type, + tooltip=tooltip) def add_func_column(self, header, function, col_types, sortid=0, - hidden=False, position=None, status_field=None, - column_type="func", sort_func=None): + hidden=False, position=None, status_field=None, + column_type="func", sort_func=None, tooltip=None): """Add a function column to the listview. Need a header name, the function and the column types.""" render = gtk.CellRendererText() self.add_column(header, render, col_types, hidden, position, - status_field, sortid, column_type=column_type, - function=function, sort_func=sort_func) + status_field, sortid, column_type=column_type, + function=function, sort_func=sort_func, tooltip=tooltip) return True - def add_progress_column(self, header, col_types=[float, str], - sortid=0, - hidden=False, - position=None, - status_field=None, - function=None, - column_type="progress"): + def add_progress_column(self, header, col_types=[float, str], sortid=0, + hidden=False, position=None, status_field=None, + function=None, column_type="progress", + tooltip=None): """Add a progress column to the listview.""" render = gtk.CellRendererProgress() self.add_column(header, render, col_types, hidden, position, - status_field, sortid, function=function, - column_type=column_type, - value=0, text=1) + status_field, sortid, function=function, + column_type=column_type, value=0, text=1, + tooltip=tooltip) return True - def add_texticon_column(self, header, col_types=[str, str], - sortid=1, - hidden=False, - position=None, - status_field=None, - column_type="texticon", - function=None): + def add_texticon_column(self, header, col_types=[str, str], sortid=1, + hidden=False, position=None, status_field=None, + column_type="texticon", function=None, + tooltip=None): """Adds a texticon column to the listview.""" render1 = gtk.CellRendererPixbuf() render2 = gtk.CellRendererText() - self.add_column(header, (render1, render2), col_types, hidden, - position, status_field, sortid, - column_type=column_type, function=function, - pixbuf=0, text=1) + self.add_column(header, (render1, render2), col_types, hidden, position, + status_field, sortid, column_type=column_type, + function=function, pixbuf=0, text=1, tooltip=tooltip) return True diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py index 6ea769171..8f4d5bffa 100644 --- a/deluge/ui/gtkui/options_tab.py +++ b/deluge/ui/gtkui/options_tab.py @@ -60,6 +60,8 @@ class OptionsTab(Tab): self.chk_move_completed = glade.get_widget("chk_move_completed") self.filechooser_move_completed = glade.get_widget("filechooser_move_completed") self.entry_move_completed = glade.get_widget("entry_move_completed") + self.chk_shared = glade.get_widget("chk_shared") + self.button_apply = glade.get_widget("button_apply") self.prev_torrent_id = None self.prev_status = None @@ -68,7 +70,8 @@ class OptionsTab(Tab): "on_button_apply_clicked": self._on_button_apply_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled, - "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled + "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled, + "on_chk_shared_toggled": self._on_chk_shared_toggled }) def start(self): @@ -98,8 +101,8 @@ class OptionsTab(Tab): if torrent_id != self.prev_torrent_id: self.prev_status = None - component.get("SessionProxy").get_torrent_status(torrent_id, - ["max_download_speed", + component.get("SessionProxy").get_torrent_status(torrent_id, [ + "max_download_speed", "max_upload_speed", "max_connections", "max_upload_slots", @@ -110,7 +113,9 @@ class OptionsTab(Tab): "stop_ratio", "remove_at_ratio", "move_on_completed", - "move_on_completed_path"]).addCallback(self._on_get_torrent_status) + "move_on_completed_path", + "shared" + ]).addCallback(self._on_get_torrent_status) self.prev_torrent_id = torrent_id def clear(self): @@ -153,6 +158,11 @@ class OptionsTab(Tab): self.filechooser_move_completed.set_current_folder(status["move_on_completed_path"]) else: self.entry_move_completed.set_text(status["move_on_completed_path"]) + if status["shared"] != self.prev_status["shared"]: + self.chk_shared.set_active(status["shared"]) + + if self.button_apply.is_sensitive(): + self.button_apply.set_sensitive(False) self.prev_status = status @@ -183,14 +193,21 @@ class OptionsTab(Tab): else: path = self.entry_move_completed.get_text() client.core.set_torrent_move_completed_path(self.prev_torrent_id, path) - + if self.chk_shared.get_active() != self.prev_status["shared"]: + client.core.set_torrents_shared(self.prev_torrent_id, self.chk_shared.get_active()) + self.button_apply.set_sensitive(False) def _on_button_edit_trackers_clicked(self, button): from edittrackersdialog import EditTrackersDialog dialog = EditTrackersDialog( self.prev_torrent_id, component.get("MainWindow").window) - dialog.run() + + def on_response(result): + if result: + self.button_apply.set_sensitive(True) + dialog.run().addCallback(on_response) + def _on_chk_move_completed_toggled(self, widget): value = self.chk_move_completed.get_active() @@ -201,8 +218,18 @@ class OptionsTab(Tab): widget.set_sensitive(value) + if not self.button_apply.is_sensitive(): + self.button_apply.set_sensitive(True) + def _on_chk_stop_at_ratio_toggled(self, widget): value = widget.get_active() self.spin_stop_ratio.set_sensitive(value) self.chk_remove_at_ratio.set_sensitive(value) + + if not self.button_apply.is_sensitive(): + self.button_apply.set_sensitive(True) + + def _on_chk_shared_toggled(self, widget): + if not self.button_apply.is_sensitive(): + self.button_apply.set_sensitive(True) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 0393325cd..2e3a02838 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -247,6 +247,9 @@ class TorrentView(listview.ListView, component.Component): self.add_text_column(_("Owner"), status_field=["owner"]) self.add_bool_column(_("Public"), status_field=["public"]) self.restore_columns_order_from_state() + self.add_bool_column(_("Shared"), status_field=["shared"], + tooltip=_("Torrent is shared between other Deluge " + "users or not.")) # Set filter to None for now self.filter = None