[gnome-music/wip/jfelder/open-audio-files: 12/16] coremodel: Add a model to store opened files
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/open-audio-files: 12/16] coremodel: Add a model to store opened files
- Date: Wed, 2 Feb 2022 10:37:36 +0000 (UTC)
commit 72d3c81eb18d2f8b14b66c42b201ff564f882723
Author: Jean Felder <jfelder src gnome org>
Date: Thu Dec 2 18:04:37 2021 +0100
coremodel: Add a model to store opened files
This will be used in the next commit by the grilo filesystem wrapper
to store the audio files received from command line.
gnomemusic/coremodel.py | 16 ++++++++++++++++
gnomemusic/player.py | 1 +
2 files changed, 17 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index b9110a8d4..bde917717 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -166,6 +166,8 @@ class CoreModel(GObject.GObject):
self._user_playlists_model_sort.set_sort_func(
utils.wrap_list_store_sort_func(self._playlists_sort))
+ self._files_model: Gio.ListStore = Gio.ListStore.new(CoreSong)
+
self._search: Search = application.props.search
self._songs_model.connect(
@@ -300,6 +302,12 @@ class CoreModel(GObject.GObject):
for song in self._songs_search_flatten:
songs_added.append(song)
+ elif playlist_type == PlayerPlaylist.Type.FILES:
+ self._current_playlist_model = model
+
+ for song in model:
+ songs_added.append(song)
+
elif playlist_type == PlayerPlaylist.Type.PLAYLIST:
self._current_playlist_model = model
@@ -351,6 +359,9 @@ class CoreModel(GObject.GObject):
elif self._search.props.search_mode_active:
playlist_type = PlayerPlaylist.Type.SEARCH_RESULT
model = self._songs_search_flatten
+ elif self._active_core_object.props.is_filesystem:
+ playlist_type = PlayerPlaylist.Type.FILES
+ model = self._files_model
else:
playlist_type = PlayerPlaylist.Type.SONGS
model = self._songs_model
@@ -504,3 +515,8 @@ class CoreModel(GObject.GObject):
flags=GObject.ParamFlags.READABLE)
def user_playlists_filter(self):
return self._user_playlists_model_filter
+
+ @GObject.Property(
+ type=Gio.ListStore, default=None, flags=GObject.ParamFlags.READABLE)
+ def files(self):
+ return self._files_model
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 372d30103..9b80a9159 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -76,6 +76,7 @@ class PlayerPlaylist(GObject.GObject):
ARTIST = 2
PLAYLIST = 3
SEARCH_RESULT = 4
+ FILES = 5
repeat_mode = GObject.Property(type=object)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]