[gnome-music/wip/mschraal/assorted-cleanups] playlistdialog: Pass application to init
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/assorted-cleanups] playlistdialog: Pass application to init
- Date: Thu, 26 Mar 2020 20:11:22 +0000 (UTC)
commit 68aa90467df2afc9f8f5d8415d8fd8cccc027ff6
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Mar 26 16:54:47 2020 +0100
playlistdialog: Pass application to init
gnomemusic/widgets/playlistdialog.py | 16 ++++++++++------
gnomemusic/widgets/playlistswidget.py | 3 ++-
gnomemusic/window.py | 3 ++-
3 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/widgets/playlistdialog.py b/gnomemusic/widgets/playlistdialog.py
index 10a8f13b..2c67defb 100644
--- a/gnomemusic/widgets/playlistdialog.py
+++ b/gnomemusic/widgets/playlistdialog.py
@@ -48,21 +48,25 @@ class PlaylistDialog(Gtk.Dialog):
_first_playlist_button = Gtk.Template.Child()
_first_playlist_entry = Gtk.Template.Child()
- def __init__(self, parent):
+ def __init__(self, application):
+ """Initialize PlaylistDialog
+
+ :param Application application: The application object
+ """
super().__init__()
+ self._coregrilo = application.props.coregrilo
+
self._add_playlist_button = None
self._add_playlist_entry = None
- self.props.transient_for = parent
self.set_titlebar(self._title_bar)
self._user_playlists_available = False
- self._coremodel = parent._app.props.coremodel
- self._coregrilo = parent._app.props.coregrilo
+
+ coremodel = application.props.coremodel
self._listbox.bind_model(
- self._coremodel.props.user_playlists_sort,
- self._create_playlist_row)
+ coremodel.props.user_playlists_sort, self._create_playlist_row)
self._set_view()
diff --git a/gnomemusic/widgets/playlistswidget.py b/gnomemusic/widgets/playlistswidget.py
index cd71a1ae..084b42e7 100644
--- a/gnomemusic/widgets/playlistswidget.py
+++ b/gnomemusic/widgets/playlistswidget.py
@@ -160,7 +160,8 @@ class PlaylistsWidget(Gtk.Box):
song_widget = selected_row.get_child()
coresong = song_widget.props.coresong
- playlist_dialog = PlaylistDialog(self._window)
+ playlist_dialog = PlaylistDialog(self._application)
+ playlist_dialog.props.transient_for = self._window
if playlist_dialog.run() == Gtk.ResponseType.ACCEPT:
playlist = playlist_dialog.props.selected_playlist
playlist.add_songs([coresong])
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index be58acaf..a88c29ec 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -461,7 +461,8 @@ class Window(Gtk.ApplicationWindow):
if len(selected_songs) < 1:
return
- playlist_dialog = PlaylistDialog(self)
+ playlist_dialog = PlaylistDialog(self._app)
+ playlist_dialog.props.transient_for = self
if playlist_dialog.run() == Gtk.ResponseType.ACCEPT:
playlist = playlist_dialog.props.selected_playlist
playlist.add_songs(selected_songs)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]