Compare commits

..

No commits in common. "cc2f9f14667e5a2109d34e0dff5db94fd07ce6c4" and "ba1a5f3f3972ec271c12606939f0099bd7d573dd" have entirely different histories.

6 changed files with 7 additions and 104 deletions

View file

@ -63,15 +63,6 @@ public class Playbin : GLib.Object {
(position+i).to_string (),
}) >= 0);
}
if (this.play_queue_position == position && removed > 0) {
if (this.play_queue_position < this.play_queue.get_n_items ()) {
// edge case: new track plays, playlist-pos doesn't change, so now_playing never n gets triggered
this.now_playing (
(Subsonic.Song) this.play_queue.get_item (this.play_queue_position),
(Subsonic.Song?) this.play_queue.get_item (this.play_queue_position+1));
}
}
}
public Playbin () {

View file

@ -10,7 +10,3 @@
min-width: 15px;
min-height: 15px;
}
.playing .title-label {
font-weight: bold;
}

View file

@ -27,7 +27,6 @@ template $UiPlayQueue: Adw.NavigationPage {
factory: SignalListItemFactory {
setup => $on_song_list_setup ();
bind => $on_song_list_bind ();
unbind => $on_song_list_unbind ();
};
}
}

View file

@ -1,50 +1,8 @@
[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue_song.ui")]
class Ui.PlayQueueSong : Gtk.ListBoxRow {
public bool current {
set {
if (value) {
this.play_icon_name = "media-playback-start";
this.add_css_class ("playing");
} else {
this.play_icon_name = "";
this.remove_css_class ("playing");
}
}
}
public uint displayed_position { get; set; }
public uint position { get; set; }
public Subsonic.Song song { get; set; }
public string play_icon_name { get; set; default = ""; }
private Playbin playbin;
public PlayQueueSong (Playbin playbin) {
this.playbin = playbin;
var action_group = new SimpleActionGroup ();
var remove = new SimpleAction ("remove", null);
remove.activate.connect (() => {
this.playbin.play_queue.remove (this.displayed_position-1);
});
action_group.add_action (remove);
this.insert_action_group ("song", action_group);
}
private ulong connection;
public void bind (uint position, Subsonic.Song song) {
this.displayed_position = position+1;
this.song = song;
this.current = this.playbin.play_queue_position == position;
this.connection = this.playbin.notify["play-queue-position"].connect (() => {
this.current = this.playbin.play_queue_position == position;
});
}
public void unbind () {
this.playbin.disconnect (this.connection);
}
[GtkCallback] private string format_duration (int duration) {
return "%02d:%02d".printf(duration/60, duration%60);
}
@ -52,16 +10,6 @@ class Ui.PlayQueueSong : Gtk.ListBoxRow {
[GtkCallback] private string star_button_icon_name (DateTime? starred) {
return starred == null ? "non-starred" : "starred";
}
[GtkCallback] private Gdk.ContentProvider? on_drag_prepare (double x, double y) {
return new Gdk.ContentProvider.for_value (this);
}
[GtkCallback] private bool on_drop (Value value, double x, double y) {
var source = value as PlayQueueSong;
print ("dropped %u on %u", source.displayed_position, this.displayed_position);
return false;
}
}
[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")]
@ -93,7 +41,7 @@ public class Ui.PlayQueue : Adw.NavigationPage {
[GtkCallback] private void on_song_list_setup (Gtk.SignalListItemFactory factory, Object object) {
var item = object as Gtk.ListItem;
var child = new PlayQueueSong (this.playbin);
var child = new PlayQueueSong ();
item.child = child;
}
@ -102,14 +50,8 @@ public class Ui.PlayQueue : Adw.NavigationPage {
var item = object as Gtk.ListItem;
var child = item.child as PlayQueueSong;
child.bind (item.position, item.item as Subsonic.Song);
}
[GtkCallback] private void on_song_list_unbind (Gtk.SignalListItemFactory factory, Object object) {
var item = object as Gtk.ListItem;
var child = item.child as PlayQueueSong;
child.unbind ();
child.position = item.position+1;
child.song = item.item as Subsonic.Song;
}
[GtkCallback] private void on_row_activated (uint position) {

View file

@ -8,7 +8,7 @@ template $UiPlayQueueSong: ListBoxRow {
spacing: 6;
Image {
//visible: false;
visible: false;
icon-name: "list-drag-handle";
styles [ "drag-handle" ]
}
@ -21,7 +21,7 @@ template $UiPlayQueueSong: ListBoxRow {
Image {
focusable: false;
icon-size: normal;
icon-name: bind template.play-icon-name;
//icon-name: "media-playback-start";
}
Label {
@ -30,7 +30,7 @@ template $UiPlayQueueSong: ListBoxRow {
justify: right;
styles [ "dim-label", "numeric" ]
label: bind template.displayed_position;
label: bind template.position;
}
}
@ -49,7 +49,6 @@ template $UiPlayQueueSong: ListBoxRow {
margin-start: 9;
label: bind template.song as <$SubsonicSong>.title;
styles [ "title-label" ]
}
}
@ -112,34 +111,11 @@ template $UiPlayQueueSong: ListBoxRow {
focusable: true;
icon-name: "view-more";
styles [ "flat" ]
popover: PopoverMenu {
menu-model: song-menu;
};
}
}
DragSource {
actions: move;
propagation-phase: capture;
prepare => $on_drag_prepare ();
}
DropTarget {
actions: move;
formats: UiPlayQueueSong;
preload: true;
drop => $on_drop ();
}
}
SizeGroup {
mode: horizontal;
widgets [title_box, artist_box, album_duration_box]
}
menu song-menu {
item ("Remove", "song.remove")
}

View file

@ -83,7 +83,6 @@ class Ui.Window : Adw.ApplicationWindow {
this.playbin.stopped.connect (() => {
this.playing_cover_art = Gdk.Paintable.empty (1, 1);
this.song = null;
});
this.shuffle_all_tracks.sensitive = true;