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

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
adw = { package = "libadwaita", version = "0.4", features = ["v1_4"]} adw = { package = "libadwaita", version = "0.4", features = ["v1_4"]}
gettext-rs = { version = "0.7", features = ["gettext-system"] } gettext-rs = { version = "0.7", features = ["gettext-system"] }
gtk = { package = "gtk4", version = "0.6", features = ["v4_10"]} gtk = { package = "gtk4", version = "0.6", features = ["v4_10", "blueprint"]}
log = "0.4" log = "0.4"
once_cell = "1" once_cell = "1"
tracing-subscriber = "0.3" tracing-subscriber = "0.3"

View file

@ -4,17 +4,7 @@ The classical music player and organizer.
## Hacking ## Hacking
## Blueprint files ### Internationalization
When adding a new Blueprint file in `data/res/`, remember to add it to the
following file lists:
- list of bluprint sources in `data/res/meson.build`
- list of resources in `data/res/musicus.gresource.xml` (`.blp` replaced with
`.ui`)
- list of translatable files in `po/POTFILES`
## Internationalization
Execute the following commands from the project root directory to update Execute the following commands from the project root directory to update
translation files whenever translatable strings have been changed. translation files whenever translatable strings have been changed.

View file

@ -1,21 +1,8 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
gnome = import('gnome') 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', gnome.compile_resources('musicus',
'musicus.gresource.xml', 'musicus.gresource.xml',
dependencies: blueprints,
gresource_bundle: true, gresource_bundle: true,
install: true, install: true,
install_dir: pkgdatadir, install_dir: pkgdatadir,

View file

@ -2,11 +2,6 @@
<gresources> <gresources>
<gresource prefix="/de/johrpan/musicus"> <gresource prefix="/de/johrpan/musicus">
<file preprocess="xml-stripblanks">icons/scalable/actions/playlist-symbolic.svg</file> <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> <file compressed="true">style.css</file>
</gresource> </gresource>
</gresources> </gresources>

View file

@ -7,7 +7,7 @@ mod imp {
use super::*; use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)] #[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/de/johrpan/musicus/home_page.ui")] #[template(file = "data/ui/home_page.blp")]
pub struct MusicusHomePage { pub struct MusicusHomePage {
#[template_child] #[template_child]
pub search_entry: TemplateChild<gtk::SearchEntry>, pub search_entry: TemplateChild<gtk::SearchEntry>,

View file

@ -6,7 +6,7 @@ mod imp {
use super::*; use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)] #[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/de/johrpan/musicus/playlist_page.ui")] #[template(file = "data/ui/playlist_page.blp")]
pub struct MusicusPlaylistPage {} pub struct MusicusPlaylistPage {}
#[glib::object_subclass] #[glib::object_subclass]

View file

@ -4,7 +4,7 @@ mod imp {
use super::*; use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)] #[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/de/johrpan/musicus/tile.ui")] #[template(file = "data/ui/tile.blp")]
pub struct MusicusTile {} pub struct MusicusTile {}
#[glib::object_subclass] #[glib::object_subclass]

View file

@ -7,7 +7,7 @@ mod imp {
use super::*; use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)] #[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/de/johrpan/musicus/welcome_page.ui")] #[template(file = "data/ui/welcome_page.blp")]
pub struct MusicusWelcomePage {} pub struct MusicusWelcomePage {}
#[glib::object_subclass] #[glib::object_subclass]

View file

@ -10,7 +10,7 @@ mod imp {
use super::*; use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)] #[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/de/johrpan/musicus/window.ui")] #[template(file = "data/ui/window.blp")]
pub struct MusicusWindow { pub struct MusicusWindow {
#[template_child] #[template_child]
pub stack: TemplateChild<gtk::Stack>, pub stack: TemplateChild<gtk::Stack>,