Closes #221: deselect selected items on download deletion when in offline mode
This commit is contained in:
@@ -857,6 +857,12 @@ class PlaylistDetailPanel(Gtk.Overlay):
|
|||||||
tree,
|
tree,
|
||||||
self.offline_mode,
|
self.offline_mode,
|
||||||
on_download_state_change=on_download_state_change,
|
on_download_state_change=on_download_state_change,
|
||||||
|
on_remove_downloads_click=(
|
||||||
|
lambda: (
|
||||||
|
self.offline_mode
|
||||||
|
and self.playlist_songs.get_selection().unselect_all()
|
||||||
|
)
|
||||||
|
),
|
||||||
extra_menu_items=[
|
extra_menu_items=[
|
||||||
(
|
(
|
||||||
Gtk.ModelButton(
|
Gtk.ModelButton(
|
||||||
|
@@ -190,6 +190,7 @@ def show_song_popover(
|
|||||||
offline_mode: bool,
|
offline_mode: bool,
|
||||||
position: Gtk.PositionType = Gtk.PositionType.BOTTOM,
|
position: Gtk.PositionType = Gtk.PositionType.BOTTOM,
|
||||||
on_download_state_change: Callable[[str], None] = lambda _: None,
|
on_download_state_change: Callable[[str], None] = lambda _: None,
|
||||||
|
on_remove_downloads_click: Callable[[], Any] = lambda: None,
|
||||||
on_playlist_state_change: Callable[[], None] = lambda: None,
|
on_playlist_state_change: Callable[[], None] = lambda: None,
|
||||||
show_remove_from_playlist_button: bool = False,
|
show_remove_from_playlist_button: bool = False,
|
||||||
extra_menu_items: List[Tuple[Gtk.ModelButton, Any]] = None,
|
extra_menu_items: List[Tuple[Gtk.ModelButton, Any]] = None,
|
||||||
@@ -201,11 +202,12 @@ def show_song_popover(
|
|||||||
on_song_download_complete=on_download_state_change,
|
on_song_download_complete=on_download_state_change,
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_remove_downloads_click(_: Any):
|
def do_on_remove_downloads_click(_: Any):
|
||||||
AdapterManager.cancel_download_songs(song_ids)
|
AdapterManager.cancel_download_songs(song_ids)
|
||||||
AdapterManager.batch_delete_cached_songs(
|
AdapterManager.batch_delete_cached_songs(
|
||||||
song_ids, on_song_delete=on_download_state_change,
|
song_ids, on_song_delete=on_download_state_change,
|
||||||
)
|
)
|
||||||
|
on_remove_downloads_click()
|
||||||
|
|
||||||
def on_add_to_playlist_click(_: Any, playlist: Playlist):
|
def on_add_to_playlist_click(_: Any, playlist: Playlist):
|
||||||
update_playlist_result = AdapterManager.update_playlist(
|
update_playlist_result = AdapterManager.update_playlist(
|
||||||
@@ -304,7 +306,7 @@ def show_song_popover(
|
|||||||
browse_to_song,
|
browse_to_song,
|
||||||
Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL),
|
Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL),
|
||||||
(download_song_button, on_download_songs_click),
|
(download_song_button, on_download_songs_click),
|
||||||
(remove_download_button, on_remove_downloads_click),
|
(remove_download_button, do_on_remove_downloads_click),
|
||||||
Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL),
|
Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL),
|
||||||
Gtk.ModelButton(
|
Gtk.ModelButton(
|
||||||
text=f"Add {pluralize('song', song_count)} to playlist",
|
text=f"Add {pluralize('song', song_count)} to playlist",
|
||||||
|
Reference in New Issue
Block a user