grey out icons if no torrent is selected ticket #360 - benmat
This commit is contained in:
parent
41c4669149
commit
c642991d9f
File diff suppressed because it is too large
Load Diff
|
@ -98,6 +98,7 @@ class DelugeGTK:
|
||||||
|
|
||||||
# Set the Torrent menu bar sub-menu to the same as the right-click Torrent pop-up menu
|
# Set the Torrent menu bar sub-menu to the same as the right-click Torrent pop-up menu
|
||||||
self.wtree.get_widget("menu_torrent").set_submenu(self.torrent_menu)
|
self.wtree.get_widget("menu_torrent").set_submenu(self.torrent_menu)
|
||||||
|
self.wtree.get_widget("menu_torrent").set_sensitive(False)
|
||||||
|
|
||||||
self.connect_signals()
|
self.connect_signals()
|
||||||
|
|
||||||
|
@ -538,6 +539,8 @@ class DelugeGTK:
|
||||||
|
|
||||||
# Get the selected torrent state so we can check if the torrent is paused.
|
# Get the selected torrent state so we can check if the torrent is paused.
|
||||||
unique_id = self.get_selected_torrent()
|
unique_id = self.get_selected_torrent()
|
||||||
|
if unique_id is None:
|
||||||
|
return
|
||||||
torrent_state = self.manager.get_torrent_state(unique_id)
|
torrent_state = self.manager.get_torrent_state(unique_id)
|
||||||
if torrent_state["is_paused"]:
|
if torrent_state["is_paused"]:
|
||||||
menuitem.set_image(gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU))
|
menuitem.set_image(gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU))
|
||||||
|
@ -896,6 +899,17 @@ class DelugeGTK:
|
||||||
self.torrent_model.remove(itr)
|
self.torrent_model.remove(itr)
|
||||||
if not self.torrent_model.iter_is_valid(itr):
|
if not self.torrent_model.iter_is_valid(itr):
|
||||||
itr = None
|
itr = None
|
||||||
|
|
||||||
|
has_selected_torrents = self.torrent_view.get_selection().count_selected_rows() > 0
|
||||||
|
self.wtree.get_widget("menu_torrent").set_sensitive(has_selected_torrents)
|
||||||
|
self.wtree.get_widget("toolbutton_remove").set_sensitive(has_selected_torrents)
|
||||||
|
self.wtree.get_widget("toolbutton_pause").set_sensitive(has_selected_torrents)
|
||||||
|
self.wtree.get_widget("toolbutton_up").set_sensitive(has_selected_torrents)
|
||||||
|
self.wtree.get_widget("toolbutton_down").set_sensitive(has_selected_torrents)
|
||||||
|
|
||||||
|
if not has_selected_torrents:
|
||||||
|
return True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.manager.get_torrent_state(self.get_selected_torrent())["is_paused"]:
|
if self.manager.get_torrent_state(self.get_selected_torrent())["is_paused"]:
|
||||||
self.wtree.get_widget("toolbutton_pause").set_stock_id(gtk.STOCK_MEDIA_PLAY)
|
self.wtree.get_widget("toolbutton_pause").set_stock_id(gtk.STOCK_MEDIA_PLAY)
|
||||||
|
@ -1127,8 +1141,6 @@ class DelugeGTK:
|
||||||
|
|
||||||
|
|
||||||
def remove_torrent_clicked(self, obj=None):
|
def remove_torrent_clicked(self, obj=None):
|
||||||
torrent_list = self.get_selected_torrent_rows()
|
|
||||||
|
|
||||||
glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"), domain='deluge')
|
glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"), domain='deluge')
|
||||||
asker = glade.get_widget("remove_torrent_dlg")
|
asker = glade.get_widget("remove_torrent_dlg")
|
||||||
|
|
||||||
|
@ -1144,17 +1156,11 @@ class DelugeGTK:
|
||||||
response = asker.run()
|
response = asker.run()
|
||||||
asker.destroy()
|
asker.destroy()
|
||||||
if response == 1:
|
if response == 1:
|
||||||
for torrent in torrent_list:
|
torrent_list = self.get_selected_torrent_rows()
|
||||||
if torrent is not None:
|
|
||||||
if torrent == self.get_selected_torrent():
|
|
||||||
first = self.torrent_model.get_iter_first()
|
|
||||||
if first:
|
|
||||||
self.torrent_view.get_selection().select_path("0")
|
|
||||||
else:
|
|
||||||
self.torrent_selected = None
|
|
||||||
|
|
||||||
self.manager.remove_torrent(torrent, data_also.get_active(), torrent_also.get_active())
|
|
||||||
self.clear_details_pane()
|
self.clear_details_pane()
|
||||||
|
self.torrent_selected = None
|
||||||
|
for torrent in torrent_list:
|
||||||
|
self.manager.remove_torrent(torrent, data_also.get_active(), torrent_also.get_active())
|
||||||
|
|
||||||
def clear_details_pane(self):
|
def clear_details_pane(self):
|
||||||
self.wtree.get_widget("progressbar").set_text("")
|
self.wtree.get_widget("progressbar").set_text("")
|
||||||
|
|
Loading…
Reference in New Issue