This commit is contained in:
Erica Z 2024-10-20 12:02:06 +02:00
parent eec61c8ed0
commit 35394d74ac

View file

@ -22,10 +22,10 @@ class Ui.Window : Adw.ApplicationWindow {
} }
public Subsonic.Song? song { get; private set; } public Subsonic.Song? song { get; private set; }
public Gdk.Paintable? playing_cover_art { get; set; default = null; }
private Cancellable cancel_loading_art; private Cancellable cancel_loading_art;
public bool cover_art_loading { get; set; default = false; } public bool cover_art_loading { get; set; default = false; }
public Gdk.Paintable playing_cover_art { get; set; }
public Playbin playbin { get; private set; default = new Playbin (); } public Playbin playbin { get; private set; default = new Playbin (); }
@ -53,6 +53,10 @@ class Ui.Window : Adw.ApplicationWindow {
this.setup.connected.connect ((api) => { this.setup.connected.connect ((api) => {
this.api = api; this.api = api;
this.playbin.api = api; this.playbin.api = api;
});
this.setup.load ();
this.sidebar.select_row (this.sidebar.get_row_at_index (0));
this.playbin.now_playing.connect ((playbin, now, next) => { this.playbin.now_playing.connect ((playbin, now, next) => {
this.song = now; this.song = now;
@ -63,7 +67,6 @@ class Ui.Window : Adw.ApplicationWindow {
} }
this.cancel_loading_art = new GLib.Cancellable (); this.cancel_loading_art = new GLib.Cancellable ();
this.playing_cover_art = Gdk.Paintable.empty (1, 1);
if (this.song != null) { if (this.song != null) {
this.cover_art_loading = true; this.cover_art_loading = true;
@ -104,10 +107,6 @@ class Ui.Window : Adw.ApplicationWindow {
this.playbin.select_track (0); this.playbin.select_track (0);
}); });
}); });
});
this.setup.load ();
this.sidebar.select_row (this.sidebar.get_row_at_index (0));
} }
[GtkCallback] private void on_sidebar_row_activated (Gtk.ListBoxRow row) { [GtkCallback] private void on_sidebar_row_activated (Gtk.ListBoxRow row) {