Use blueprints directly

This commit is contained in:
Elias Projahn 2023-09-24 13:58:05 +02:00
parent d0cf77888c
commit e5bc2ede37
14 changed files with 7 additions and 35 deletions

View file

@ -1,122 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $MusicusHomePage : Adw.NavigationPage {
title: _("Musicus");
tag: "home";
Gtk.Overlay {
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {
[end]
MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
}
[top]
Adw.Clamp {
maximum-size: 1000;
tightening-threshold: 600;
Adw.Bin {
styles ["searchbar"]
Gtk.SearchEntry search_entry {
placeholder-text: _("Enter composers, performers, works…");
search-changed => $search() swapped;
}
}
}
Gtk.ScrolledWindow {
hscrollbar-policy: never;
Adw.Clamp {
maximum-size: 1000;
tightening-threshold: 600;
Gtk.Box {
orientation: vertical;
margin-start: 12;
margin-end: 12;
margin-top: 24;
margin-bottom: 68;
Gtk.Label {
styles ["heading"]
visible: bind persons_flow_box.visible;
halign: start;
label: _("Composers and performers");
}
Gtk.FlowBox persons_flow_box {
margin-top: 12;
margin-bottom: 24;
column-spacing: 12;
row-spacing: 12;
homogeneous: true;
selection-mode: none;
}
Gtk.Label {
styles ["heading"]
visible: bind works_flow_box.visible;
halign: start;
label: _("Works");
}
Gtk.FlowBox works_flow_box {
margin-top: 12;
margin-bottom: 24;
column-spacing: 12;
row-spacing: 12;
homogeneous: true;
selection-mode: none;
}
Gtk.Label {
styles ["heading"]
visible: bind recordings_flow_box.visible;
halign: start;
label: _("Recordings");
}
Gtk.FlowBox recordings_flow_box {
margin-top: 12;
margin-bottom: 24;
column-spacing: 12;
row-spacing: 12;
homogeneous: true;
selection-mode: none;
}
}
}
}
}
[overlay]
Gtk.Button play_button {
styles ["pill", "suggested-action"]
halign: end;
valign: end;
margin-end: 24;
margin-bottom: 24;
label: _("Play music");
clicked => $play() swapped;
}
}
}
menu primary_menu {
item {
label: _("_Preferences");
action: "app.preferences";
}
item {
label: _("_About Musicus");
action: "app.about";
}
}

View file

@ -1,21 +1,8 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
gnome = import('gnome')
blueprints = custom_target('blueprints',
input: files(
'home_page.blp',
'playlist_page.blp',
'tile.blp',
'welcome_page.blp',
'window.blp'
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
gnome.compile_resources('musicus',
'musicus.gresource.xml',
dependencies: blueprints,
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,

View file

@ -2,11 +2,6 @@
<gresources>
<gresource prefix="/de/johrpan/musicus">
<file preprocess="xml-stripblanks">icons/scalable/actions/playlist-symbolic.svg</file>
<file preprocess="xml-stripblanks">home_page.ui</file>
<file preprocess="xml-stripblanks">playlist_page.ui</file>
<file preprocess="xml-stripblanks">tile.ui</file>
<file preprocess="xml-stripblanks">welcome_page.ui</file>
<file preprocess="xml-stripblanks">window.ui</file>
<file compressed="true">style.css</file>
</gresource>
</gresources>

View file

@ -1,28 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $MusicusPlaylistPage : Adw.Bin {
Adw.ToolbarView {
[top]
Adw.HeaderBar {
title-widget: Adw.WindowTitle {
title: _("Playlist");
};
[start]
Gtk.Button close_button {
icon-name: "go-down-symbolic";
clicked => $close() swapped;
}
}
Gtk.ScrolledWindow {
hscrollbar-policy: never;
Adw.Clamp {
maximum-size: 1000;
tightening-threshold: 600;
}
}
}
}

View file

@ -1,39 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $MusicusTile : Gtk.FlowBoxChild {
styles ["card", "activatable"]
width-request: 200;
Gtk.Box {
orientation: vertical;
margin-start: 6;
margin-end: 6;
margin-top: 6;
margin-bottom: 6;
Gtk.Label title_label {
styles ["caption-heading"]
halign: start;
label: _("Title");
}
Gtk.Label subtitle_label {
styles ["caption"]
halign: start;
label: _("Subtitle");
}
}
}
menu item_menu {
item {
label: _("_Play");
}
item {
label: _("_Edit");
}
item {
label: _("_Delete");
}
}

View file

@ -1,41 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $MusicusWelcomePage : Adw.NavigationPage {
title: _("Welcome to Musicus");
tag: "welcome";
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {
[end]
MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
}
Adw.StatusPage {
icon-name: "de.johrpan.musicus";
title: _("Welcome to Musicus");
description: _("Get started by choosing where to store your music library. Is this your first time using Musicus? If so, create a new empty folder for your library. Musicus will use this location to manage your recordings. You can also select a folder that already contains a music library created by Musicus.");
child: Gtk.Button {
styles ["suggested-action", "pill"]
halign: center;
label: _("Choose library folder");
clicked => $choose_library_folder() swapped;
};
}
}
}
menu primary_menu {
item {
label: _("_Preferences");
action: "app.preferences";
}
item {
label: _("_About Musicus");
action: "app.about";
}
}

View file

@ -1,81 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $MusicusWindow : Adw.ApplicationWindow {
title: _("Musicus");
Adw.ToolbarView {
Gtk.Stack stack {
transition-type: over_up_down;
Gtk.StackPage {
name: "navigation";
child: Adw.NavigationView navigation_view {
$MusicusWelcomePage {
folder-selected => $set_library_folder() swapped;
}
$MusicusHomePage {}
};
}
Gtk.StackPage {
name: "playlist";
child: $MusicusPlaylistPage {
close => $hide_playlist() swapped;
};
}
}
[bottom]
Gtk.Revealer player_bar_revealer {
reveal-child: true;
transition-type: slide_up;
Gtk.Box {
margin-start: 6;
margin-end: 6;
margin-top: 6;
margin-bottom: 6;
spacing: 6;
Gtk.Button play_button {
styles ["circular"]
valign: center;
icon-name: "media-playback-start-symbolic";
}
Gtk.Box {
hexpand: true;
valign: center;
orientation: vertical;
Gtk.Label title_label {
styles ["caption-heading"]
halign: start;
label: _("Title");
}
Gtk.Label subtitle_label {
styles ["caption"]
halign: start;
label: _("Subtitle");
}
}
Gtk.Label {
styles ["caption", "numeric"]
valign: center;
label: "00:00 / 01:00";
}
Gtk.ToggleButton playlist_button {
styles ["flat"]
valign: center;
icon-name: "playlist-symbolic";
toggled => $show_playlist() swapped;
}
}
}
}
}