Add scaffold for home page

This commit is contained in:
Elias Projahn 2023-09-20 13:49:02 +02:00
parent 8c56e90994
commit 3ef0fe960b
11 changed files with 266 additions and 1 deletions

107
data/res/home_page.blp Normal file
View file

@ -0,0 +1,107 @@
using Gtk 4.0;
using Adw 1;
template $MusicusHomePage : Adw.NavigationPage {
title: _("Musicus");
tag: "home";
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…");
}
}
}
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;
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: 14;
row-spacing: 14;
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: 14;
row-spacing: 14;
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: 14;
row-spacing: 14;
homogeneous: true;
selection-mode: none;
}
}
}
}
}
}
menu primary_menu {
item {
label: _("_Preferences");
action: "app.preferences";
}
item {
label: _("_About Musicus");
action: "app.about";
}
}

View file

@ -3,6 +3,8 @@ gnome = import('gnome')
blueprints = custom_target('blueprints',
input: files(
'home_page.blp',
'tile.blp',
'welcome_page.blp',
'window.blp'
),

View file

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/de/johrpan/musicus">
<file preprocess="xml-stripblanks">home_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>

3
data/res/style.css Normal file
View file

@ -0,0 +1,3 @@
.searchbar {
padding: 6px 6px 7px 6px;
}

39
data/res/tile.blp Normal file
View file

@ -0,0 +1,39 @@
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

@ -10,5 +10,7 @@ template $MusicusWindow : Adw.ApplicationWindow {
$MusicusWelcomePage {
folder-selected => $set_library_folder() swapped;
}
$MusicusHomePage {}
}
}