Commit e5727be6 authored by Jean Felder's avatar Jean Felder Committed by Marinus Schraal

artistsview: Select first artist on start

parent 6187d739
......@@ -32,6 +32,7 @@ from gnomemusic.widgets.songwidget import SongWidget
class CoreModel(GObject.GObject):
__gsignals__ = {
"artists-loaded": (GObject.SignalFlags.RUN_FIRST, None, ()),
"playlist-loaded": (GObject.SignalFlags.RUN_FIRST, None, ()),
"playlists-loaded": (GObject.SignalFlags.RUN_FIRST, None, ()),
}
......
......@@ -336,6 +336,7 @@ class GrlTrackerSource(GObject.GObject):
if not media:
print("NO MEDIA", source, op_id, media, error)
self._coremodel.emit("artists-loaded")
return
artist = CoreArtist(media, self._coremodel)
......
......@@ -61,8 +61,11 @@ class ArtistsView(BaseView):
self._artists = {}
self._window = window
self._model = window._app.props.coremodel.props.artists_sort
self._coremodel = window._app.props.coremodel
self._model = self._coremodel.props.artists_sort
self._sidebar.bind_model(self._model, self._create_widget)
self._loaded_id = self._coremodel.connect(
"artists-loaded", self._on_artists_loaded)
sidebar_container.props.width_request = 220
sidebar_container.get_style_context().add_class('sidebar')
......@@ -84,6 +87,12 @@ class ArtistsView(BaseView):
return row
def _on_artists_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")
@log
def _setup_view(self):
view_container = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
......
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