Commit 6187d739 authored by Jean Felder's avatar Jean Felder Committed by Marinus Schraal

playlistsview: Select first playlist on start

parent 94e78dbe
......@@ -32,7 +32,8 @@ from gnomemusic.widgets.songwidget import SongWidget
class CoreModel(GObject.GObject):
__gsignals__ = {
"playlist-loaded": (GObject.SignalFlags.RUN_FIRST, None, ())
"playlist-loaded": (GObject.SignalFlags.RUN_FIRST, None, ()),
"playlists-loaded": (GObject.SignalFlags.RUN_FIRST, None, ()),
}
@log
......
......@@ -101,6 +101,7 @@ class GrlTrackerPlaylists(GObject.GObject):
print("ERROR", error)
return
if not media:
self._coremodel.emit("playlists-loaded")
return
playlist = Playlist(
......
......@@ -124,6 +124,9 @@ class PlaylistsView(BaseView):
self._coremodel.props.playlists_sort,
self._add_playlist_to_sidebar)
self._loaded_id = self._coremodel.connect(
"playlists-loaded", self._on_playlists_loaded)
self.show_all()
@log
......@@ -158,6 +161,12 @@ class PlaylistsView(BaseView):
return row
def _on_playlists_loaded(self, klass):
self._coremodel.disconnect(self._loaded_id)
first_row = self._sidebar.get_row_at_index(0)
self._sidebar.select_row(first_row)
first_row.emit("activate")
def _on_playlists_model_changed(self, model, position, removed, added):
if removed == 0:
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment