diff --git a/gtk/DetailsDialog.cc b/gtk/DetailsDialog.cc index e4fdbbf73..c31cba0f3 100644 --- a/gtk/DetailsDialog.cc +++ b/gtk/DetailsDialog.cc @@ -76,6 +76,7 @@ private: void refreshInfo(std::vector const& torrents); void refreshPeers(std::vector const& torrents); void refreshTracker(std::vector const& torrents); + void refreshFiles(std::vector const& torrents); void refreshOptions(std::vector const& torrents); void refreshPeerList(std::vector const& torrents); @@ -2111,6 +2112,22 @@ void DetailsDialog::Impl::refreshTracker(std::vector const& torrent edit_trackers_button_->set_sensitive(tracker_list_get_current_torrent_id() > 0); } +void DetailsDialog::Impl::refreshFiles(std::vector const& torrents) +{ + if (torrents.size() == 1) + { + file_list_->set_torrent(tr_torrentId(torrents.front())); + file_list_->show(); + file_label_->hide(); + } + else + { + file_list_->clear(); + file_list_->hide(); + file_label_->show(); + } +} + void DetailsDialog::Impl::onScrapeToggled() { tr_quark const key = TR_KEY_show_tracker_scrapes; @@ -2442,6 +2459,7 @@ void DetailsDialog::Impl::refresh() refreshInfo(torrents); refreshPeers(torrents); refreshTracker(torrents); + refreshFiles(torrents); refreshOptions(torrents); if (torrents.empty()) @@ -2578,20 +2596,12 @@ void DetailsDialog::Impl::set_torrents(std::vector const& ids) int const id = ids.front(); auto const* tor = core_->find_torrent(id); title = fmt::format(_("{torrent_name} Properties"), fmt::arg("torrent_name", tr_torrentName(tor))); - - file_list_->set_torrent(id); - file_list_->show(); - file_label_->hide(); } else { title = fmt::format( ngettext("Properties - {torrent_count:L} Torrent", "Properties - {torrent_count:L} Torrents", len), fmt::arg("torrent_count", len)); - - file_list_->clear(); - file_list_->hide(); - file_label_->show(); } dialog_.set_title(title); diff --git a/gtk/FileList.cc b/gtk/FileList.cc index 06974567e..a821d8ecd 100644 --- a/gtk/FileList.cc +++ b/gtk/FileList.cc @@ -492,6 +492,11 @@ struct PairHash void FileList::Impl::set_torrent(tr_torrent_id_t tor_id) { + if (torrent_id_ == tor_id && store_ != nullptr && store_->children().size() != 0) + { + return; + } + /* unset the old fields */ clearData();