mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 11:47:25 +01:00
Replace most unnecessary frames with CSS classes
This commit is contained in:
parent
f2d99d2316
commit
3ae5727f39
24 changed files with 328 additions and 376 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkBox" id="widget">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
|
@ -41,14 +41,12 @@
|
|||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Matching metadata</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkStack" id="matching_stack">
|
||||
<property name="transition-type">crossfade</property>
|
||||
|
|
@ -71,6 +69,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
@ -94,6 +95,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
@ -110,6 +114,9 @@
|
|||
<property name="title" translatable="yes">No matching metadata found</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
@ -120,14 +127,15 @@
|
|||
<property name="child">
|
||||
<object class="GtkListBox" id="matching_list">
|
||||
<property name="selection-mode">none</property>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">start</property>
|
||||
|
|
@ -135,12 +143,10 @@
|
|||
<property name="margin-bottom">6</property>
|
||||
<property name="label" translatable="yes">Manually add metadata</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -170,8 +176,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkStack" id="widget">
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Import music</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<object class="GtkButton" id="done_button">
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -60,12 +60,10 @@
|
|||
<property name="margin-bottom">6</property>
|
||||
<property name="label" translatable="yes">Medium</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -82,8 +80,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -98,7 +97,7 @@
|
|||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Recordings</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -111,7 +110,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame"/>
|
||||
<object class="GtkFrame" id="frame" />
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkBox" id="widget">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Performance</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<property name="sensitive">False</property>
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -43,9 +43,6 @@
|
|||
<property name="margin-bottom">12</property>
|
||||
<property name="maximum-size">500</property>
|
||||
<property name="tightening-threshold">300</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -95,8 +92,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<property name="margin-bottom">12</property>
|
||||
<property name="maximum-size">800</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="content">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
|
|
@ -144,10 +144,6 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkStack" id="widget">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Recording</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<property name="sensitive">False</property>
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -64,12 +64,10 @@
|
|||
<property name="margin-bottom">6</property>
|
||||
<property name="label" translatable="yes">Overview</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -99,8 +97,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -115,7 +114,7 @@
|
|||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Performers</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -128,7 +127,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="performance_frame"/>
|
||||
<object class="GtkFrame" id="performance_frame" />
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -154,7 +153,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Recording</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -34,8 +34,5 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame"/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
|
|
@ -93,12 +93,9 @@
|
|||
<property name="height-request">200</property>
|
||||
<property name="vexpand">true</property>
|
||||
<child>
|
||||
<object class="AdwClamp">
|
||||
<object class="AdwClamp" id="clamp">
|
||||
<property name="maximum-size">500</property>
|
||||
<property name="tightening-threshold">300</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame">
|
||||
<property name="valign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="margin-top">12</property>
|
||||
|
|
@ -106,8 +103,6 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkBox" id="widget">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Track</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<object class="GtkButton" id="select_button">
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -35,10 +35,7 @@
|
|||
<object class="GtkScrolledWindow">
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
<object class="AdwClamp">
|
||||
<child>
|
||||
<object class="GtkFrame" id="parts_frame">
|
||||
<property name="valign">start</property>
|
||||
<object class="AdwClamp" id="clamp">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
|
|
@ -48,6 +45,4 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
|
|
@ -36,10 +36,7 @@
|
|||
<object class="GtkScrolledWindow">
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
<object class="AdwClamp">
|
||||
<child>
|
||||
<object class="GtkFrame" id="tracks_frame">
|
||||
<property name="valign">start</property>
|
||||
<object class="AdwClamp" id="clamp">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
|
|
@ -49,6 +46,4 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkBox" id="widget">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Import music</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<property name="icon-name">object-select-symbolic</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -50,12 +50,10 @@
|
|||
<property name="margin-bottom">6</property>
|
||||
<property name="label" translatable="yes">Recording</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -72,8 +70,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -88,7 +87,7 @@
|
|||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Tracks</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="weight" value="bold" />
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -101,7 +100,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="tracks_frame"/>
|
||||
<object class="GtkFrame" id="tracks_frame" />
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@
|
|||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -99,8 +97,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="libadwaita" version="1.0" />
|
||||
<object class="GtkBox" id="widget">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Work part</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
<class name="title" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<object class="GtkButton" id="save_button">
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -47,9 +47,6 @@
|
|||
<property name="margin-bottom">12</property>
|
||||
<property name="maximum-size">500</property>
|
||||
<property name="tightening-threshold">300</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
@ -66,8 +63,9 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ impl Screen<Option<Ensemble>, Ensemble> for EnsembleEditor {
|
|||
|
||||
let list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let name = EntryRow::new(&gettext("Name"));
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ impl Screen<Option<Instrument>, Instrument> for InstrumentEditor {
|
|||
|
||||
let list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let name = EntryRow::new(&gettext("Name"));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ impl Screen<Option<Performance>, Performance> for PerformanceEditor {
|
|||
|
||||
let performer_list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let person_row = ButtonRow::new("Person", "Select");
|
||||
|
|
@ -46,6 +47,7 @@ impl Screen<Option<Performance>, Performance> for PerformanceEditor {
|
|||
|
||||
let role_list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let reset_role_button = gtk::ButtonBuilder::new()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ impl Screen<Option<Person>, Person> for PersonEditor {
|
|||
|
||||
let list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let first_name = EntryRow::new(&gettext("First name"));
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ impl MediumPreview {
|
|||
|
||||
let list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.margin_bottom(12)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let header = adw::ActionRowBuilder::new()
|
||||
|
|
@ -152,10 +154,7 @@ impl MediumPreview {
|
|||
list.append(&header);
|
||||
|
||||
if let Some(list) = &last_list {
|
||||
let frame = gtk::FrameBuilder::new().margin_bottom(12).build();
|
||||
|
||||
frame.set_child(Some(list));
|
||||
self.medium_box.append(&frame);
|
||||
self.medium_box.append(list);
|
||||
}
|
||||
|
||||
last_list = Some(list);
|
||||
|
|
|
|||
|
|
@ -27,13 +27,14 @@ impl Screen<(Recording, Vec<usize>), Vec<usize>> for TrackEditor {
|
|||
get_widget!(builder, gtk::Box, widget);
|
||||
get_widget!(builder, gtk::Button, back_button);
|
||||
get_widget!(builder, gtk::Button, select_button);
|
||||
get_widget!(builder, gtk::Frame, parts_frame);
|
||||
get_widget!(builder, adw::Clamp, clamp);
|
||||
|
||||
let parts_list = gtk::ListBox::new();
|
||||
parts_list.set_selection_mode(gtk::SelectionMode::None);
|
||||
parts_list.set_vexpand(false);
|
||||
parts_list.show();
|
||||
parts_frame.set_child(Some(&parts_list));
|
||||
let parts_list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
clamp.set_child(Some(&parts_list));
|
||||
|
||||
let this = Rc::new(Self {
|
||||
handle,
|
||||
|
|
|
|||
|
|
@ -27,13 +27,14 @@ impl Screen<Arc<ImportSession>, Vec<usize>> for TrackSelector {
|
|||
get_widget!(builder, gtk::Box, widget);
|
||||
get_widget!(builder, gtk::Button, back_button);
|
||||
get_widget!(builder, gtk::Button, select_button);
|
||||
get_widget!(builder, gtk::Frame, tracks_frame);
|
||||
get_widget!(builder, adw::Clamp, clamp);
|
||||
|
||||
let track_list = gtk::ListBox::new();
|
||||
track_list.set_selection_mode(gtk::SelectionMode::None);
|
||||
track_list.set_vexpand(false);
|
||||
track_list.show();
|
||||
tracks_frame.set_child(Some(&track_list));
|
||||
let track_list = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
clamp.set_child(Some(&track_list));
|
||||
|
||||
let this = Rc::new(Self {
|
||||
handle,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl Screen<(), ()> for MainScreen {
|
|||
widget.insert_action_group("widget", Some(&actions));
|
||||
|
||||
let poe_list = List::new();
|
||||
poe_list.widget.add_css_class("navigation-sidebar");
|
||||
poe_list.widget.set_css_classes(&["navigation-sidebar"]);
|
||||
poe_list.enable_selection();
|
||||
|
||||
let navigator = Navigator::new(Rc::clone(&handle.backend), &handle.window, &empty_screen);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@ use musicus_backend::db::Track;
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
/// Elements for visually representing the playlist.
|
||||
/// A playable track within the playlist.
|
||||
#[derive(Clone)]
|
||||
enum ListItem {
|
||||
/// A playable track.
|
||||
Track {
|
||||
struct ListItem {
|
||||
/// Index within the playlist.
|
||||
index: usize,
|
||||
|
||||
|
|
@ -20,10 +18,6 @@ enum ListItem {
|
|||
|
||||
/// Whether this is the currently played track.
|
||||
playing: bool,
|
||||
},
|
||||
|
||||
/// A separator shown between recordings.
|
||||
Separator,
|
||||
}
|
||||
|
||||
pub struct PlayerScreen {
|
||||
|
|
@ -52,6 +46,7 @@ impl Screen<(), ()> for PlayerScreen {
|
|||
|
||||
get_widget!(builder, gtk::Box, widget);
|
||||
get_widget!(builder, gtk::Button, back_button);
|
||||
get_widget!(builder, gtk::Box, content);
|
||||
get_widget!(builder, gtk::Label, title_label);
|
||||
get_widget!(builder, gtk::Label, subtitle_label);
|
||||
get_widget!(builder, gtk::Button, previous_button);
|
||||
|
|
@ -64,10 +59,9 @@ impl Screen<(), ()> for PlayerScreen {
|
|||
get_widget!(builder, gtk::Label, duration_label);
|
||||
get_widget!(builder, gtk::Image, play_image);
|
||||
get_widget!(builder, gtk::Image, pause_image);
|
||||
get_widget!(builder, gtk::Frame, frame);
|
||||
|
||||
let list = List::new();
|
||||
frame.set_child(Some(&list.widget));
|
||||
content.append(&list.widget);
|
||||
|
||||
let event_controller = gtk::EventControllerLegacy::new();
|
||||
position_scale.add_controller(&event_controller);
|
||||
|
|
@ -209,22 +203,9 @@ impl Screen<(), ()> for PlayerScreen {
|
|||
|
||||
this.list
|
||||
.set_make_widget_cb(clone!(@weak this => @default-panic, move |index| {
|
||||
let widget = match this.items.borrow()[index] {
|
||||
ListItem::Track {index, first, playing} => {
|
||||
let track = &this.playlist.borrow()[index];
|
||||
TrackRow::new(track, first, playing).get_widget()
|
||||
}
|
||||
ListItem::Separator => {
|
||||
gtk::ListBoxRowBuilder::new()
|
||||
.selectable(false)
|
||||
.activatable(false)
|
||||
.child(>k::Separator::new(gtk::Orientation::Horizontal))
|
||||
.build()
|
||||
.upcast()
|
||||
}
|
||||
};
|
||||
|
||||
widget
|
||||
let item = &this.items.borrow()[index];
|
||||
let track = &this.playlist.borrow()[item.index];
|
||||
TrackRow::new(track, item.first, item.playing).get_widget()
|
||||
}));
|
||||
|
||||
this.list
|
||||
|
|
@ -232,9 +213,7 @@ impl Screen<(), ()> for PlayerScreen {
|
|||
.connect_row_activated(clone!(@weak this => move |_, row| {
|
||||
let list_index = row.index();
|
||||
let list_item = this.items.borrow()[list_index as usize].clone();
|
||||
if let ListItem::Track {index, ..} = list_item {
|
||||
this.handle.backend.pl().set_track(index).unwrap();
|
||||
};
|
||||
this.handle.backend.pl().set_track(list_item.index).unwrap();
|
||||
}));
|
||||
|
||||
player.send_data();
|
||||
|
|
@ -249,33 +228,22 @@ impl PlayerScreen {
|
|||
let playlist = self.playlist.borrow();
|
||||
let current_track = self.current_track.get();
|
||||
|
||||
let mut first = true;
|
||||
let mut items = Vec::new();
|
||||
|
||||
let mut last_recording_id = "";
|
||||
|
||||
for (index, track) in playlist.iter().enumerate() {
|
||||
let first_track = if track.recording.id != last_recording_id {
|
||||
last_recording_id = &track.recording.id;
|
||||
|
||||
if !first {
|
||||
items.push(ListItem::Separator);
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let item = ListItem::Track {
|
||||
items.push(ListItem {
|
||||
index,
|
||||
first: first_track,
|
||||
playing: index == current_track,
|
||||
};
|
||||
|
||||
items.push(item);
|
||||
});
|
||||
}
|
||||
|
||||
let length = items.len();
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ impl<T> Selector<T> {
|
|||
get_widget!(builder, gtk::Button, add_button);
|
||||
get_widget!(builder, gtk::SearchEntry, search_entry);
|
||||
get_widget!(builder, gtk::Stack, stack);
|
||||
get_widget!(builder, gtk::Frame, frame);
|
||||
get_widget!(builder, adw::Clamp, clamp);
|
||||
|
||||
let list = List::new();
|
||||
frame.set_child(Some(&list.widget));
|
||||
clamp.set_child(Some(&list.widget));
|
||||
|
||||
let this = Rc::new(Self {
|
||||
widget,
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ impl List {
|
|||
// let factory = gtk::SignalListItemFactory::new();
|
||||
// let widget = gtk::ListView::new(Some(&selection), Some(&factory));
|
||||
|
||||
let widget = gtk::ListBox::new();
|
||||
widget.set_selection_mode(gtk::SelectionMode::None);
|
||||
let widget = gtk::ListBoxBuilder::new()
|
||||
.selection_mode(gtk::SelectionMode::None)
|
||||
.css_classes(vec![String::from("boxed-list")])
|
||||
.build();
|
||||
|
||||
let this = Rc::new(Self {
|
||||
widget,
|
||||
|
|
|
|||
|
|
@ -24,10 +24,9 @@ impl Section {
|
|||
get_widget!(builder, gtk::Box, title_box);
|
||||
get_widget!(builder, gtk::Label, title_label);
|
||||
get_widget!(builder, gtk::Label, subtitle_label);
|
||||
get_widget!(builder, gtk::Frame, frame);
|
||||
|
||||
title_label.set_label(title);
|
||||
frame.set_child(Some(&content.get_widget()));
|
||||
widget.append(&content.get_widget());
|
||||
|
||||
Self {
|
||||
widget,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue