[gnome-music/wip/jfelder/smartplaylists-ui-v2: 22/29] coremodel: Add support for a smart playlists model
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/smartplaylists-ui-v2: 22/29] coremodel: Add support for a smart playlists model
- Date: Sat, 1 Feb 2020 16:24:01 +0000 (UTC)
commit 7e682734bf43899755ebc025ec99e0277668c55c
Author: Jean Felder <jfelder src gnome org>
Date: Fri Jan 17 15:19:55 2020 +0100
coremodel: Add support for a smart playlists model
gnomemusic/coremodel.py | 19 +++++++++++++++++++
gnomemusic/grilowrappers/grltrackerplaylists.py | 5 +++++
2 files changed, 24 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 37c8f230..1866e578 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -136,6 +136,13 @@ class CoreModel(GObject.GObject):
self._user_playlists_model_sort.set_sort_func(
self._wrap_list_store_sort_func(self._playlists_sort))
+ self._smart_playlists_model_filter = Gfm.FilterListModel.new(
+ self._playlists_model)
+ self._smart_playlists_model_sort = Gfm.SortListModel.new(
+ self._smart_playlists_model_filter)
+ self._smart_playlists_model_sort.set_sort_func(
+ self._wrap_list_store_sort_func(self._playlists_sort))
+
self.props.grilo = CoreGrilo(self, application)
# FIXME: Not all instances of internal _grilo use have been
# fixed.
@@ -503,3 +510,15 @@ class CoreModel(GObject.GObject):
flags=GObject.ParamFlags.READABLE)
def user_playlists_filter(self):
return self._user_playlists_model_filter
+
+ @GObject.Property(
+ type=Gfm.SortListModel, default=None,
+ flags=GObject.ParamFlags.READABLE)
+ def smart_playlists_sort(self):
+ return self._smart_playlists_model_sort
+
+ @GObject.Property(
+ type=Gfm.SortListModel, default=None,
+ flags=GObject.ParamFlags.READABLE)
+ def smart_playlists_filter(self):
+ return self._smart_playlists_model_filter
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index cf537276..e968f188 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -83,11 +83,13 @@ class GrlTrackerPlaylists(GObject.GObject):
self._model = self._coremodel.props.playlists
self._model_filter = self._coremodel.props.playlists_filter
self._user_model_filter = self._coremodel.props.user_playlists_filter
+ self._smart_model_filter = self._coremodel.props.smart_playlists_filter
self._pls_todelete = []
self._tracker = tracker_wrapper.props.tracker
self._window = application.props.window
self._user_model_filter.set_filter_func(self._user_playlists_filter)
+ self._smart_model_filter.set_filter_func(self._smart_playlists_filter)
self._fast_options = Grl.OperationOptions()
self._fast_options.set_resolution_flags(
@@ -168,6 +170,9 @@ class GrlTrackerPlaylists(GObject.GObject):
return (playlist not in self._pls_todelete
and playlist.props.is_smart is False)
+ def _smart_playlists_filter(self, playlist):
+ return playlist.props.is_smart is True
+
def stage_playlist_deletion(self, playlist):
"""Adds playlist to the list of playlists to delete
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]