[gnome-music/wip/mschraal/assorted-cleanups: 26/32] coremodel: Remove playlist manipulcation calls



commit 23002562906cfebbc81592dfa337899b1cc66ae3
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Mar 26 15:07:23 2020 +0100

    coremodel: Remove playlist manipulcation calls
    
    These can directly be called on CoreGrilo.

 gnomemusic/coremodel.py                  | 25 -------------------------
 gnomemusic/widgets/notificationspopup.py |  8 ++++----
 gnomemusic/widgets/playlistdialog.py     |  3 ++-
 3 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 88ae87a2..24effbd3 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -292,31 +292,6 @@ class CoreModel(GObject.GObject):
 
         self.emit("playlist-loaded", playlist_type)
 
-    def stage_playlist_deletion(self, playlist):
-        """Prepares playlist deletion.
-
-        :param Playlist playlist: playlist
-        """
-        self._application.props.coregrilo.stage_playlist_deletion(playlist)
-
-    def finish_playlist_deletion(self, playlist, deleted):
-        """Finishes playlist deletion.
-
-        :param Playlist playlist: playlist
-        :param bool deleted: indicates if the playlist has been deleted
-        """
-        self._application.props.coregrilo.finish_playlist_deletion(
-            playlist, deleted)
-
-    def create_playlist(self, playlist_title, callback):
-        """Creates a new user playlist.
-
-        :param str playlist_title: playlist title
-        :param callback: function to perform once, the playlist is created
-        """
-        self._application.props.coregrilo.create_playlist(
-            playlist_title, callback)
-
     def search(self, text):
         self._application.props.coregrilo.search(text)
 
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index 722029dc..76ee1e49 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -206,7 +206,7 @@ class PlaylistNotification(Gtk.Grid):
         """
         super().__init__(column_spacing=18)
         self._notifications_popup = notifications_popup
-        self._coremodel = application.props.coremodel
+        self._coregrilo = application.props.coregrilo
         self.type_ = type_
         self._playlist = playlist
         self._position = position
@@ -229,7 +229,7 @@ class PlaylistNotification(Gtk.Grid):
         self.show_all()
 
         if self.type_ == PlaylistNotification.Type.PLAYLIST:
-            self._coremodel.stage_playlist_deletion(self._playlist)
+            self._coregrilo.stage_playlist_deletion(self._playlist)
         else:
             playlist.stage_song_deletion(self._coresong, position)
 
@@ -255,7 +255,7 @@ class PlaylistNotification(Gtk.Grid):
 
         self._notifications_popup.remove_notification(self)
         if self.type_ == PlaylistNotification.Type.PLAYLIST:
-            self._coremodel.finish_playlist_deletion(self._playlist, False)
+            self._coregrilo.finish_playlist_deletion(self._playlist, False)
         else:
             self._playlist.undo_pending_song_deletion(
                 self._coresong, self._position)
@@ -270,6 +270,6 @@ class PlaylistNotification(Gtk.Grid):
     def _finish_deletion(self):
         self._notifications_popup.remove_notification(self)
         if self.type_ == PlaylistNotification.Type.PLAYLIST:
-            self._coremodel.finish_playlist_deletion(self._playlist, True)
+            self._coregrilo.finish_playlist_deletion(self._playlist, True)
         else:
             self._playlist.finish_song_deletion(self._coresong)
diff --git a/gnomemusic/widgets/playlistdialog.py b/gnomemusic/widgets/playlistdialog.py
index c94f3448..10a8f13b 100644
--- a/gnomemusic/widgets/playlistdialog.py
+++ b/gnomemusic/widgets/playlistdialog.py
@@ -59,6 +59,7 @@ class PlaylistDialog(Gtk.Dialog):
 
         self._user_playlists_available = False
         self._coremodel = parent._app.props.coremodel
+        self._coregrilo = parent._app.props.coregrilo
         self._listbox.bind_model(
             self._coremodel.props.user_playlists_sort,
             self._create_playlist_row)
@@ -117,7 +118,7 @@ class PlaylistDialog(Gtk.Dialog):
 
         text = self._add_playlist_entry.props.text
         if text:
-            self._coremodel.create_playlist(text, select_and_close_dialog)
+            self._coregrilo.create_playlist(text, select_and_close_dialog)
 
     @Gtk.Template.Callback()
     def _on_add_playlist_entry_changed(self, editable, data=None):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]