[gnome-music/wip/jfelder/open-audio-files: 117/120] 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: 117/120] coremodel: Add a model to store opened files
- Date: Mon, 30 May 2022 09:19:02 +0000 (UTC)
commit fbbb0a8deece6bf43d7493f072c674b79f9ef75e
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 2ab5a59cf..7b1acab2a 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -168,6 +168,8 @@ class CoreModel(GObject.GObject):
user_playlists_sorter.set_sort_func(self._playlists_sort)
self._user_playlists_model_sort.set_sorter(user_playlists_sorter)
+ self._files_model: Gio.ListStore = Gio.ListStore.new(CoreSong)
+
self._search: Search = application.props.search
self._songs_model.connect(
@@ -321,6 +323,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
@@ -372,6 +380,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
@@ -520,3 +531,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 c0c2fa961..cea312a92 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -75,6 +75,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]