fixup! Port UI to GTK 4
This commit is contained in:
parent
8359143663
commit
15f8f67de9
11 changed files with 642 additions and 145 deletions
|
|
@ -28,7 +28,10 @@ class PlaylistPanel(Adw.Bin):
|
|||
'remove-album': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'remove-multiple-albums': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'play': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,))
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
|
||||
|
||||
'select': (GObject.SIGNAL_RUN_FIRST, None, (bool,)),
|
||||
'clear-playlist': (GObject.SIGNAL_RUN_FIRST, None, ())
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,9 +69,9 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._is_selected = False
|
||||
|
||||
# Widgets
|
||||
self._toolbar = PlaylistToolbar()
|
||||
self._toolbar.connect('select', self.on_toolbar_select)
|
||||
self._toolbar.connect('clear-playlist', self.on_toolbar_clear)
|
||||
# FIXME Toolbar signals
|
||||
#self._toolbar.connect('select', self.on_toolbar_select)
|
||||
#self._toolbar.connect('clear-playlist', self.on_toolbar_clear)
|
||||
# Header bar
|
||||
self._headerbar_standalone = AlbumHeaderbar()
|
||||
self._headerbar_standalone.connect('close', self.on_headerbar_close_clicked)
|
||||
|
|
@ -106,6 +109,19 @@ class PlaylistPanel(Adw.Bin):
|
|||
self.emit('clear-playlist')
|
||||
|
||||
|
||||
# FIXME on_select_toggled()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_select_toggled(self, widget):
|
||||
self.emit('select', widget.get_active())
|
||||
|
||||
|
||||
# FIXME on_clear_clicked()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_clear_clicked(self, widget):
|
||||
if widget is self.playlist_clear_button:
|
||||
self.emit('clear-playlist')
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def on_playlist_grid_clicked(self, widget, position):
|
||||
# Get selected album
|
||||
|
|
@ -115,7 +131,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._selected_albums = [album]
|
||||
self.emit('albumart', id)
|
||||
|
||||
# Show standalone album
|
||||
# FIXME Show standalone album
|
||||
return
|
||||
if widget.get_selection_mode() == Gtk.SelectionMode.SINGLE:
|
||||
# Set labels
|
||||
self._headerbar_standalone.set_album(album)
|
||||
|
|
@ -128,7 +145,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
self.standalone_spinner.start()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_playlist_grid_selection_changed()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_playlist_grid_selection_changed(self, widget):
|
||||
self._selected_albums = []
|
||||
for path in widget.get_selected_items():
|
||||
|
|
@ -137,18 +155,19 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._selected_albums.append(self._playlist_albums[hash])
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_cancel_clicked(self, widget):
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_selection_remove_clicked(self, widget):
|
||||
self.emit('remove-multiple-albums', self._selected_albums)
|
||||
self._toolbar.exit_selection()
|
||||
self.select_button.set_active(False)
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
# FIXME on_standalone_scroll_size_allocate()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_scroll_size_allocate(self, widget, allocation):
|
||||
self._resize_standalone_image()
|
||||
|
||||
|
|
@ -157,13 +176,13 @@ class PlaylistPanel(Adw.Bin):
|
|||
self._close_standalone()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_remove_clicked(self, widget):
|
||||
self.emit('remove-album', self._selected_albums[0])
|
||||
self._close_standalone()
|
||||
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
#@Gtk.Template.Callback()
|
||||
def on_standalone_play_clicked(self, widget):
|
||||
self.emit('play', self._selected_albums[0])
|
||||
self._close_standalone()
|
||||
|
|
@ -205,6 +224,7 @@ class PlaylistPanel(Adw.Bin):
|
|||
|
||||
|
||||
def _set_playlist(self, host, playlist, size):
|
||||
"""
|
||||
if not self._is_selected and self._playlist != playlist:
|
||||
GObject.idle_add(
|
||||
self.get_parent().child_set_property,
|
||||
|
|
@ -212,6 +232,7 @@ class PlaylistPanel(Adw.Bin):
|
|||
'needs-attention',
|
||||
True
|
||||
)
|
||||
"""
|
||||
self._playlist_lock.acquire()
|
||||
self._playlist_stop.clear()
|
||||
self._playlist = playlist
|
||||
|
|
@ -219,6 +240,8 @@ class PlaylistPanel(Adw.Bin):
|
|||
for album in playlist:
|
||||
self._playlist_albums[album.get_id()] = album
|
||||
self._playlist_grid_model.remove_all()
|
||||
# FIXME Set item padding dynamically?
|
||||
#GObject.idle_add(self.playlist_grid.set_item_padding, size / 100)
|
||||
|
||||
cache = client.MCGCache(host, size)
|
||||
for album in playlist:
|
||||
|
|
@ -248,8 +271,6 @@ class PlaylistPanel(Adw.Bin):
|
|||
return
|
||||
|
||||
self.playlist_grid.set_model(self._playlist_grid_selection)
|
||||
# TODO why set_columns()?
|
||||
#self.playlist_grid.set_columns(len(playlist))
|
||||
self._playlist_lock.release()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue