Compare commits

..

No commits in common. "dee32826ecbf80ceaedbf5e2e86b29ac78134b20" and "6c12828e3108a3722fbd0bb10563fd277154c3af" have entirely different histories.

4 changed files with 6 additions and 31 deletions

View file

@ -35,7 +35,6 @@ class Playbin : GLib.Object {
// sent when a new song starts playing
// continues: whether the track is a gapless continuation
public signal void now_playing (bool continues, uint index, Song song);
public signal void stopped ();
// the index of the track in the play queue that is currently playing
// must equal play queue len iff state is STOPPED
@ -137,8 +136,7 @@ class Playbin : GLib.Object {
if (this.update_position) {
int64 new_position;
if (this.playbin.query_position (Gst.Format.TIME, out new_position)) {
if (new_position > this.duration) this.position = this.duration;
else this.position = new_position;
this.position = new_position;
} else {
this.position = 0;
}
@ -209,7 +207,7 @@ class Playbin : GLib.Object {
});
bus.message["eos"].connect ((message) => {
this.stop ();
assert (false); // TODO
});
}
@ -259,9 +257,5 @@ class Playbin : GLib.Object {
this.playbin.set_state (Gst.State.READY);
this.state = PlaybinState.STOPPED;
this.current_position = this.play_queue.get_n_items ();
this.stopped ();
this.position = 0;
this.duration = 1;
}
}

View file

@ -85,7 +85,7 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
if (this.current_position >= position) {
if (this.current_position < position+removed && added == 0) {
if (position < this.get_n_items ()) emit_signal = true;
emit_signal = true;
this.current_position = position;
} else {
this.current_position += added;
@ -154,7 +154,6 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
// GLib.ListModel methods
Object? get_item (uint position) {
if (this.model == null) return null;
return this.model.get_item (position);
}
@ -163,7 +162,6 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
}
uint get_n_items () {
if (this.model == null) return 0;
return this.model.get_n_items ();
}
}

View file

@ -103,21 +103,21 @@ template $UiWindow: Adw.ApplicationWindow {
styles [ "heading" ]
xalign: 0;
halign: start;
label: bind $song_title (template.song) as <string>;
label: bind template.song as <$Song>.title;
ellipsize: end;
}
Label {
styles [ "caption" ]
xalign: 0;
label: bind $song_artist (template.song) as <string>;
label: bind template.song as <$Song>.artist;
ellipsize: end;
}
Label {
styles [ "caption" ]
xalign: 0;
label: bind $song_album (template.song) as <string>;
label: bind template.song as <$Song>.album;
ellipsize: end;
}
}
@ -144,7 +144,6 @@ template $UiWindow: Adw.ApplicationWindow {
name: "seek-scale";
orientation: horizontal;
width-request: 400;
sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
adjustment: Adjustment {
lower: 0;

View file

@ -65,10 +65,6 @@ class Ui.Window : Adw.ApplicationWindow {
api.scrobble.begin (song.id);
this.play_queue.selection.playbin_select (position);
});
this.playbin.stopped.connect (() => {
this.song = null;
this.play_queue.selection.playbin_select (this.play_queue_store.get_n_items ());
});
this.play_queue.selection.user_selected.connect ((position) => {
this.playbin.select_track (position);
@ -219,16 +215,4 @@ class Ui.Window : Adw.ApplicationWindow {
if (new_position > this.playbin.duration) new_position = this.playbin.duration;
this.seek_impl (new_position);
}
[GtkCallback] private string song_title (Song? song) {
return song == null ? "" : song.title;
}
[GtkCallback] private string song_artist (Song? song) {
return song == null ? "" : song.artist;
}
[GtkCallback] private string song_album (Song? song) {
return song == null ? "" : song.album;
}
}