feishinize more the play queue

and also readd the drag widget i guess
This commit is contained in:
Erica Z 2024-10-27 21:39:29 +01:00
parent 6a2b157c7d
commit 77f9d70d29
3 changed files with 74 additions and 118 deletions

View file

@ -19,10 +19,6 @@
min-height: 15px; min-height: 15px;
} }
#play-queue .playing .title-label { #play-queue .playing label.title {
font-weight: bold; font-weight: bold;
} }
.drag-handle {
color: color-mix(in srgb, currentColor 40%, transparent);
}

View file

@ -7,13 +7,14 @@ class Ui.PlayQueueSong : Gtk.Box {
public bool show_artist { get; set; default = false; } public bool show_artist { get; set; default = false; }
public bool show_album { get; set; default = false; } public bool show_album { get; set; default = false; }
private bool _current = false;
public bool current { public bool current {
get { return _current; }
set { set {
this._current = value;
if (value) { if (value) {
this.play_icon_name = "media-playback-start";
this.add_css_class ("playing"); this.add_css_class ("playing");
} else { } else {
this.play_icon_name = "";
this.remove_css_class ("playing"); this.remove_css_class ("playing");
} }
} }
@ -21,8 +22,6 @@ class Ui.PlayQueueSong : Gtk.Box {
public uint displayed_position { get; set; } public uint displayed_position { get; set; }
public Subsonic.Song song { get; set; } public Subsonic.Song song { get; set; }
public string play_icon_name { get; set; default = ""; }
private weak Playbin playbin; private weak Playbin playbin;
public PlayQueueSong (Playbin playbin) { public PlayQueueSong (Playbin playbin) {
this.playbin = playbin; this.playbin = playbin;
@ -75,25 +74,28 @@ class Ui.PlayQueueSong : Gtk.Box {
private Gtk.ListBox? drag_widget; private Gtk.ListBox? drag_widget;
[GtkCallback] private void on_drag_begin (Gtk.DragSource source, Gdk.Drag drag) { [GtkCallback] private void on_drag_begin (Gtk.DragSource source, Gdk.Drag drag) {
/* FIXME
this.drag_widget = new Gtk.ListBox (); this.drag_widget = new Gtk.ListBox ();
this.drag_widget.set_size_request (this.get_width (), this.get_height ());
var drag_row = new PlayQueueSong (this.playbin); var drag_row = new PlayQueueSong (this.playbin);
drag_row.draggable = false; drag_row.draggable = false;
drag_row.show_position = this.show_position;
drag_row.show_artist = this.show_artist; drag_row.show_artist = this.show_artist;
drag_row.show_album = this.show_album; drag_row.show_album = this.show_album;
drag_row.current = false; drag_row.current = this.current;
drag_row.displayed_position = this.displayed_position; drag_row.displayed_position = this.displayed_position;
drag_row.song = this.song; drag_row.song = this.song;
drag_row.play_icon_name = this.play_icon_name; drag_row.set_size_request (this.get_width (), this.get_height ());
this.drag_widget.append (drag_row); var drag_row_real = new Gtk.ListBoxRow ();
this.drag_widget.drag_highlight_row (drag_row); drag_row_real.child = drag_row;
this.drag_widget.append (drag_row_real);
this.drag_widget.drag_highlight_row (drag_row_real);
this.drag_widget.add_css_class ("rich-list");
var drag_icon = Gtk.DragIcon.get_for_drag (drag); var drag_icon = Gtk.DragIcon.get_for_drag (drag);
drag_icon.set("child", this.drag_widget); drag_icon.set("child", this.drag_widget);
drag.set_hotspot ((int) this.drag_x, (int) this.drag_y); */ drag.set_hotspot ((int) this.drag_x, (int) this.drag_y);
} }
[GtkCallback] private bool on_drop (Value value, double x, double y) { [GtkCallback] private bool on_drop (Value value, double x, double y) {

View file

@ -2,28 +2,20 @@ using Gtk 4.0;
template $UiPlayQueueSong: Box { template $UiPlayQueueSong: Box {
Box { Box {
focusable: false; width-request: 24;
spacing: 6;
Image {
visible: bind template.draggable;
icon-name: "list-drag-handle";
styles [ "drag-handle" ]
}
Box {
width-request: 48;
focusable: false; focusable: false;
homogeneous: true; homogeneous: true;
Image { Image {
visible: bind template.current;
focusable: false; focusable: false;
halign: end;
icon-size: normal; icon-size: normal;
icon-name: bind template.play-icon-name; icon-name: "media-playback-start";
} }
Label { Label {
visible: bind template.show_position; visible: bind template.current inverted;
focusable: false; focusable: false;
halign: end; halign: end;
justify: right; justify: right;
@ -34,13 +26,16 @@ template $UiPlayQueueSong: Box {
} }
Box title_box { Box title_box {
styles [ "header"]
focusable: false; focusable: false;
hexpand: true; hexpand: true;
Box { Box {
styles [ "title" ]
orientation: vertical; orientation: vertical;
Label { Label {
styles [ "title" ]
focusable: false; focusable: false;
xalign: 0; xalign: 0;
halign: start; halign: start;
@ -54,6 +49,7 @@ template $UiPlayQueueSong: Box {
} }
Label { Label {
styles [ "subtitle" ]
focusable: false; focusable: false;
xalign: 0; xalign: 0;
halign: start; halign: start;
@ -64,49 +60,19 @@ template $UiPlayQueueSong: Box {
margin-start: 9; margin-start: 9;
label: bind template.song as <$SubsonicSong>.artist; label: bind template.song as <$SubsonicSong>.artist;
styles [ "dim-label" ]
} }
} }
} }
Box artist_box {
visible: bind template.show_artist;
focusable: false;
hexpand: true;
}
Box album_duration_box {
focusable: false;
hexpand: true;
spacing: 6;
/*
Label {
visible: bind template.show_album;
focusable: false;
xalign: 0;
halign: start;
hexpand: true;
ellipsize: end;
max-width-chars: 90;
justify: fill;
label: bind template.song as <$SubsonicSong>.album;
}
*/
Label { Label {
focusable: false; focusable: false;
halign: end; halign: end;
hexpand: true; hexpand: true;
single-line-mode: true; single-line-mode: true;
styles [ "numeric" ] styles [ "numeric", "dim-label" ]
label: bind $format_duration (template.song as <$SubsonicSong>.duration) as <string>; label: bind $format_duration (template.song as <$SubsonicSong>.duration) as <string>;
} }
}
Button { Button {
focusable: true; focusable: true;
@ -124,7 +90,6 @@ template $UiPlayQueueSong: Box {
menu-model: song-menu; menu-model: song-menu;
}; };
} }
}
DragSource { DragSource {
actions: move; actions: move;
@ -143,13 +108,6 @@ template $UiPlayQueueSong: Box {
} }
} }
/*
SizeGroup {
mode: horizontal;
widgets [title_box, artist_box, album_duration_box]
}
*/
menu song-menu { menu song-menu {
item ("View song", "song.view") item ("View song", "song.view")
item ("View artist", "song.view-artist") item ("View artist", "song.view-artist")