Compare commits
No commits in common. "dee32826ecbf80ceaedbf5e2e86b29ac78134b20" and "6c12828e3108a3722fbd0bb10563fd277154c3af" have entirely different histories.
dee32826ec
...
6c12828e31
4 changed files with 6 additions and 31 deletions
|
@ -35,7 +35,6 @@ class Playbin : GLib.Object {
|
||||||
// sent when a new song starts playing
|
// sent when a new song starts playing
|
||||||
// continues: whether the track is a gapless continuation
|
// continues: whether the track is a gapless continuation
|
||||||
public signal void now_playing (bool continues, uint index, Song song);
|
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
|
// the index of the track in the play queue that is currently playing
|
||||||
// must equal play queue len iff state is STOPPED
|
// must equal play queue len iff state is STOPPED
|
||||||
|
@ -137,8 +136,7 @@ class Playbin : GLib.Object {
|
||||||
if (this.update_position) {
|
if (this.update_position) {
|
||||||
int64 new_position;
|
int64 new_position;
|
||||||
if (this.playbin.query_position (Gst.Format.TIME, out new_position)) {
|
if (this.playbin.query_position (Gst.Format.TIME, out new_position)) {
|
||||||
if (new_position > this.duration) this.position = this.duration;
|
this.position = new_position;
|
||||||
else this.position = new_position;
|
|
||||||
} else {
|
} else {
|
||||||
this.position = 0;
|
this.position = 0;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +207,7 @@ class Playbin : GLib.Object {
|
||||||
});
|
});
|
||||||
|
|
||||||
bus.message["eos"].connect ((message) => {
|
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.playbin.set_state (Gst.State.READY);
|
||||||
this.state = PlaybinState.STOPPED;
|
this.state = PlaybinState.STOPPED;
|
||||||
this.current_position = this.play_queue.get_n_items ();
|
this.current_position = this.play_queue.get_n_items ();
|
||||||
this.stopped ();
|
|
||||||
|
|
||||||
this.position = 0;
|
|
||||||
this.duration = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
|
||||||
|
|
||||||
if (this.current_position >= position) {
|
if (this.current_position >= position) {
|
||||||
if (this.current_position < position+removed && added == 0) {
|
if (this.current_position < position+removed && added == 0) {
|
||||||
if (position < this.get_n_items ()) emit_signal = true;
|
emit_signal = true;
|
||||||
this.current_position = position;
|
this.current_position = position;
|
||||||
} else {
|
} else {
|
||||||
this.current_position += added;
|
this.current_position += added;
|
||||||
|
@ -154,7 +154,6 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
|
||||||
// GLib.ListModel methods
|
// GLib.ListModel methods
|
||||||
|
|
||||||
Object? get_item (uint position) {
|
Object? get_item (uint position) {
|
||||||
if (this.model == null) return null;
|
|
||||||
return this.model.get_item (position);
|
return this.model.get_item (position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +162,6 @@ public class PlayQueueSelection : GLib.Object, GLib.ListModel, Gtk.SelectionMode
|
||||||
}
|
}
|
||||||
|
|
||||||
uint get_n_items () {
|
uint get_n_items () {
|
||||||
if (this.model == null) return 0;
|
|
||||||
return this.model.get_n_items ();
|
return this.model.get_n_items ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,21 +103,21 @@ template $UiWindow: Adw.ApplicationWindow {
|
||||||
styles [ "heading" ]
|
styles [ "heading" ]
|
||||||
xalign: 0;
|
xalign: 0;
|
||||||
halign: start;
|
halign: start;
|
||||||
label: bind $song_title (template.song) as <string>;
|
label: bind template.song as <$Song>.title;
|
||||||
ellipsize: end;
|
ellipsize: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
styles [ "caption" ]
|
styles [ "caption" ]
|
||||||
xalign: 0;
|
xalign: 0;
|
||||||
label: bind $song_artist (template.song) as <string>;
|
label: bind template.song as <$Song>.artist;
|
||||||
ellipsize: end;
|
ellipsize: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
styles [ "caption" ]
|
styles [ "caption" ]
|
||||||
xalign: 0;
|
xalign: 0;
|
||||||
label: bind $song_album (template.song) as <string>;
|
label: bind template.song as <$Song>.album;
|
||||||
ellipsize: end;
|
ellipsize: end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,6 @@ template $UiWindow: Adw.ApplicationWindow {
|
||||||
name: "seek-scale";
|
name: "seek-scale";
|
||||||
orientation: horizontal;
|
orientation: horizontal;
|
||||||
width-request: 400;
|
width-request: 400;
|
||||||
sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
|
|
||||||
|
|
||||||
adjustment: Adjustment {
|
adjustment: Adjustment {
|
||||||
lower: 0;
|
lower: 0;
|
||||||
|
|
|
@ -65,10 +65,6 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
api.scrobble.begin (song.id);
|
api.scrobble.begin (song.id);
|
||||||
this.play_queue.selection.playbin_select (position);
|
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.play_queue.selection.user_selected.connect ((position) => {
|
||||||
this.playbin.select_track (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;
|
if (new_position > this.playbin.duration) new_position = this.playbin.duration;
|
||||||
this.seek_impl (new_position);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue