diff --git a/src/playbin.vala b/src/playbin.vala index a8b7a58..1f2b143 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -101,16 +101,18 @@ class Playbin : Object { bus.message["stream-start"].connect ((message) => { this.stream_counter += 1; - int64 new_duration; - assert (this.playbin.query_duration (Gst.Format.TIME, out new_duration)); - this.duration = new_duration; - if (notify_next_transition) { this.song_transition ((string) this.playbin.current_uri); } else { notify_next_transition = true; } }); + + bus.message["async-done"].connect ((message) => { + int64 new_duration; + assert (this.playbin.query_duration (Gst.Format.TIME, out new_duration)); + this.duration = new_duration; + }); bus.message["eos"].connect ((message) => { assert (notify_next_transition); diff --git a/src/ui/play_queue.blp b/src/ui/play_queue.blp index 342df32..adf41d8 100644 --- a/src/ui/play_queue.blp +++ b/src/ui/play_queue.blp @@ -18,11 +18,11 @@ template $UiPlayQueue: Adw.NavigationPage { ColumnView view { styles [ "data-table" ] - ColumnViewColumn { - factory: SignalListItemFactory { - setup => $on_delete_cell_setup (); - }; - } + //ColumnViewColumn { + // factory: SignalListItemFactory { + // setup => $on_delete_cell_setup (); + // }; + //} ColumnViewColumn { title: _("Title"); @@ -59,4 +59,3 @@ template $UiPlayQueue: Adw.NavigationPage { } } } - diff --git a/src/ui/play_queue.vala b/src/ui/play_queue.vala index 38524df..b6c4049 100644 --- a/src/ui/play_queue.vala +++ b/src/ui/play_queue.vala @@ -74,9 +74,14 @@ class Ui.PlayQueueStore : Object, ListModel, Gtk.SelectionModel { this.playing_index = position; if (previous < this.inner.get_n_items ()) { - this.selection_changed (previous, 1); + if (previous < position) { + this.selection_changed (previous, position-previous+1); + } else if (previous > position) { + this.selection_changed (position, previous-position+1); + } + } else { + this.selection_changed (position, 1); } - this.selection_changed (position, 1); this.begin_playback ((Song) this.inner.get_item (this.playing_index)); this.prepare_next ((Song) this.inner.get_item (this.playing_index+1)); @@ -168,14 +173,14 @@ public class Ui.PlayQueue : Adw.NavigationPage { this.store.select_item (this.store.playing_index-1, true); } } - +/* [GtkCallback] private void on_delete_cell_setup (Object object) { var cell = (Gtk.ColumnViewCell) object; var button = new Gtk.Button.from_icon_name ("edit-delete"); button.add_css_class ("flat"); button.clicked.connect (() => { - this.store.inner.remove (cell.position); + //this.store.inner.remove (cell.position); }); cell.child = button; - } + }*/ }