From 7d2356c8f2994cc7d563f49d040421b0a83eb564 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Fri, 17 Jan 2025 18:33:31 +0100 Subject: [PATCH] editor: Use AdwButtonRow --- data/res/style.css | 7 ------- data/ui/ensemble_editor.blp | 13 ++++++++----- data/ui/instrument_editor.blp | 13 ++++++++----- data/ui/person_editor.blp | 13 ++++++++----- data/ui/recording_editor.blp | 13 ++++++++----- data/ui/role_editor.blp | 13 ++++++++----- data/ui/work_editor.blp | 13 ++++++++----- src/editor/ensemble_editor.rs | 4 ++-- src/editor/instrument_editor.rs | 4 ++-- src/editor/person_editor.rs | 4 ++-- src/editor/recording_editor.rs | 4 ++-- src/editor/role_editor.rs | 4 ++-- src/editor/work_editor.rs | 6 +++--- 13 files changed, 61 insertions(+), 50 deletions(-) diff --git a/data/res/style.css b/data/res/style.css index c780662..0a701b6 100644 --- a/data/res/style.css +++ b/data/res/style.css @@ -118,11 +118,4 @@ .selector-list>row { padding: 6px; border-radius: 6px; -} - -button.save { - min-height: 48px; - font-weight: 700; - font-size: 11pt; - color: var(--accent-color); } \ No newline at end of file diff --git a/data/ui/ensemble_editor.blp b/data/ui/ensemble_editor.blp index 947f59e..67732ff 100644 --- a/data/ui/ensemble_editor.blp +++ b/data/ui/ensemble_editor.blp @@ -26,15 +26,18 @@ template $MusicusEnsembleEditor: Adw.NavigationPage { margin-top: 12; } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create ensemble"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create ensemble"); + activated => $save() swapped; + } } } } diff --git a/data/ui/instrument_editor.blp b/data/ui/instrument_editor.blp index 93c36f8..5ad9928 100644 --- a/data/ui/instrument_editor.blp +++ b/data/ui/instrument_editor.blp @@ -26,15 +26,18 @@ template $MusicusInstrumentEditor: Adw.NavigationPage { margin-top: 12; } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create instrument"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create instrument"); + activated => $save() swapped; + } } } } diff --git a/data/ui/person_editor.blp b/data/ui/person_editor.blp index 0bb8078..9ef311d 100644 --- a/data/ui/person_editor.blp +++ b/data/ui/person_editor.blp @@ -26,15 +26,18 @@ template $MusicusPersonEditor: Adw.NavigationPage { margin-top: 12; } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create person"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create person"); + activated => $save() swapped; + } } } } diff --git a/data/ui/recording_editor.blp b/data/ui/recording_editor.blp index ce943f4..bda02a3 100644 --- a/data/ui/recording_editor.blp +++ b/data/ui/recording_editor.blp @@ -124,15 +124,18 @@ template $MusicusRecordingEditor: Adw.NavigationPage { } } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create recording"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create recording"); + activated => $save() swapped; + } } } } diff --git a/data/ui/role_editor.blp b/data/ui/role_editor.blp index 69429fe..2e01fe1 100644 --- a/data/ui/role_editor.blp +++ b/data/ui/role_editor.blp @@ -26,15 +26,18 @@ template $MusicusRoleEditor: Adw.NavigationPage { margin-top: 12; } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create role"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create role"); + activated => $save() swapped; + } } } } diff --git a/data/ui/work_editor.blp b/data/ui/work_editor.blp index 34d6110..cf16bca 100644 --- a/data/ui/work_editor.blp +++ b/data/ui/work_editor.blp @@ -125,15 +125,18 @@ template $MusicusWorkEditor: Adw.NavigationPage { } } - Gtk.Button save_button { + Gtk.ListBox { + selection-mode: none; margin-top: 24; - label: _("Create work"); - clicked => $save() swapped; styles [ - "card", - "save" + "boxed-list" ] + + Adw.ButtonRow save_row { + title: _("Create work"); + activated => $save() swapped; + } } } } diff --git a/src/editor/ensemble_editor.rs b/src/editor/ensemble_editor.rs index 44332bc..db28df4 100644 --- a/src/editor/ensemble_editor.rs +++ b/src/editor/ensemble_editor.rs @@ -24,7 +24,7 @@ mod imp { #[template_child] pub name_editor: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -78,7 +78,7 @@ impl MusicusEnsembleEditor { obj.imp().library.set(library.to_owned()).unwrap(); if let Some(ensemble) = ensemble { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp().ensemble_id.set(ensemble.ensemble_id.clone()).unwrap(); obj.imp().name_editor.set_translation(&ensemble.name); } diff --git a/src/editor/instrument_editor.rs b/src/editor/instrument_editor.rs index 59e6265..1a144d7 100644 --- a/src/editor/instrument_editor.rs +++ b/src/editor/instrument_editor.rs @@ -24,7 +24,7 @@ mod imp { #[template_child] pub name_editor: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -78,7 +78,7 @@ impl MusicusInstrumentEditor { obj.imp().library.set(library.to_owned()).unwrap(); if let Some(instrument) = instrument { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp().instrument_id.set(instrument.instrument_id.clone()).unwrap(); obj.imp().name_editor.set_translation(&instrument.name); } diff --git a/src/editor/person_editor.rs b/src/editor/person_editor.rs index f127145..884a183 100644 --- a/src/editor/person_editor.rs +++ b/src/editor/person_editor.rs @@ -24,7 +24,7 @@ mod imp { #[template_child] pub name_editor: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -78,7 +78,7 @@ impl MusicusPersonEditor { obj.imp().library.set(library.to_owned()).unwrap(); if let Some(person) = person { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp().person_id.set(person.person_id.clone()).unwrap(); obj.imp().name_editor.set_translation(&person.name); } diff --git a/src/editor/recording_editor.rs b/src/editor/recording_editor.rs index f4afe85..dd4b9ee 100644 --- a/src/editor/recording_editor.rs +++ b/src/editor/recording_editor.rs @@ -58,7 +58,7 @@ mod imp { #[template_child] pub select_ensemble_box: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -195,7 +195,7 @@ impl MusicusRecordingEditor { .build(); if let Some(recording) = recording { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp() .recording_id .set(recording.recording_id.clone()) diff --git a/src/editor/role_editor.rs b/src/editor/role_editor.rs index 6557388..2e82791 100644 --- a/src/editor/role_editor.rs +++ b/src/editor/role_editor.rs @@ -22,7 +22,7 @@ mod imp { #[template_child] pub name_editor: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -76,7 +76,7 @@ impl MusicusRoleEditor { obj.imp().library.set(library.to_owned()).unwrap(); if let Some(role) = role { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp().role_id.set(role.role_id.clone()).unwrap(); obj.imp().name_editor.set_translation(&role.name); } diff --git a/src/editor/work_editor.rs b/src/editor/work_editor.rs index 14ddda3..3146c8c 100644 --- a/src/editor/work_editor.rs +++ b/src/editor/work_editor.rs @@ -64,7 +64,7 @@ mod imp { #[template_child] pub select_instrument_box: TemplateChild, #[template_child] - pub save_button: TemplateChild, + pub save_row: TemplateChild, } #[glib::object_subclass] @@ -176,12 +176,12 @@ impl MusicusWorkEditor { if is_part_editor { obj.set_title(&gettext("Work part")); - obj.imp().save_button.set_label(&gettext("Add work part")); + obj.imp().save_row.set_title(&gettext("Add work part")); obj.imp().is_part_editor.set(true); } if let Some(work) = work { - obj.imp().save_button.set_label(&gettext("Save changes")); + obj.imp().save_row.set_title(&gettext("Save changes")); obj.imp().work_id.set(work.work_id.clone()).unwrap(); obj.imp().name_editor.set_translation(&work.name);