Load about window info from appstream metadata
This commit is contained in:
6
data/cafe.avery.Delfin.gresource.xml.in
Normal file
6
data/cafe.avery.Delfin.gresource.xml.in
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/cafe/avery/Delfin/">
|
||||
<file compressed="true" preprocess="xml-stripblanks" alias="@APP_ID@.metainfo.xml">@APP_ID@.metainfo.xml</file>
|
||||
</gresource>
|
||||
</gresources>
|
@@ -5,15 +5,6 @@
|
||||
<name>Delfin</name>
|
||||
<summary>Stream movies and TV shows from Jellyfin</summary>
|
||||
|
||||
<metadata_license>CC-BY-SA-4.0</metadata_license>
|
||||
<project_license>GPL-3.0-only</project_license>
|
||||
|
||||
<content_rating type="oars-1.1" />
|
||||
|
||||
<recommends>
|
||||
<display_length compare="ge">600</display_length>
|
||||
</recommends>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
TODO - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
@@ -21,6 +12,25 @@
|
||||
</p>
|
||||
</description>
|
||||
|
||||
<metadata_license>CC-BY-SA-4.0</metadata_license>
|
||||
<project_license>GPL-3.0</project_license>
|
||||
|
||||
<url type="homepage">https://delfin.avery.cafe/</url>
|
||||
|
||||
<!-- Deprecated field - keep until libadwaita and flatpak updated -->
|
||||
<developer_name>Avery</developer_name>
|
||||
|
||||
<content_rating type="oars-1.1" />
|
||||
|
||||
<recommends>
|
||||
<display_length compare="ge">600</display_length>
|
||||
<control>pointing</control>
|
||||
</recommends>
|
||||
|
||||
<supports>
|
||||
<internet>always</internet>
|
||||
</supports>
|
||||
|
||||
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
|
||||
|
||||
<icon type="stock">@APP_ID@</icon>
|
||||
|
@@ -1,3 +1,5 @@
|
||||
gnome = import('gnome')
|
||||
|
||||
subdir('icons')
|
||||
|
||||
ascli_exe = find_program('appstreamcli')
|
||||
@@ -36,3 +38,21 @@ custom_target('gen-desktop-entry',
|
||||
install: true,
|
||||
install_dir: appsdir,
|
||||
)
|
||||
|
||||
resources_file = configure_file(
|
||||
input: 'cafe.avery.Delfin.gresource.xml.in',
|
||||
output: '@0@.gresource.xml'.format(app_id),
|
||||
configuration: {
|
||||
'APP_ID': app_id,
|
||||
},
|
||||
)
|
||||
|
||||
# Compile and install resources
|
||||
resources = gnome.compile_resources(
|
||||
'resources',
|
||||
resources_file,
|
||||
gresource_bundle: true,
|
||||
source_dir: meson.current_build_dir(),
|
||||
install: true,
|
||||
install_dir: pkgdatadir,
|
||||
)
|
||||
|
@@ -3,6 +3,8 @@ config = configure_file(
|
||||
output: 'meson_config.rs',
|
||||
configuration: {
|
||||
'APP_ID': app_id,
|
||||
'BUILDDIR': meson.project_build_root(),
|
||||
'PKGDATADIR': pkgdatadir,
|
||||
},
|
||||
)
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use gtk::prelude::*;
|
||||
use relm4::{prelude::*, ComponentParts, SimpleComponent};
|
||||
|
||||
use crate::{meson_config::APP_ID, tr};
|
||||
use crate::meson_config::APP_ID;
|
||||
|
||||
pub(crate) struct About;
|
||||
|
||||
@@ -12,17 +12,13 @@ impl SimpleComponent for About {
|
||||
type Output = ();
|
||||
|
||||
view! {
|
||||
// TODO: Load from appstream
|
||||
adw::AboutWindow {
|
||||
adw::AboutWindow::from_appdata(
|
||||
&format!("/cafe/avery/Delfin/{}.metainfo.xml", APP_ID),
|
||||
None,
|
||||
) {
|
||||
set_modal: true,
|
||||
set_visible: true,
|
||||
|
||||
set_application_name: tr!("app-name"),
|
||||
set_application_icon: APP_ID,
|
||||
set_developer_name: "Avery ❤️",
|
||||
set_version: "0.0",
|
||||
set_license_type: gtk::License::Agpl30,
|
||||
set_website: "https://codeberg.org/avery42/delfin",
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,12 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::{bail, Context, Result};
|
||||
use delfin::{
|
||||
app::{App, APP_BROKER},
|
||||
meson_config::APP_ID,
|
||||
meson_config::{APP_ID, BUILDDIR, RESOURCES_FILE},
|
||||
};
|
||||
use relm4::RelmApp;
|
||||
use gtk::gio;
|
||||
use relm4::{gtk, RelmApp};
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
@@ -12,6 +16,8 @@ fn main() {
|
||||
video_player_gst::init_gst();
|
||||
}
|
||||
|
||||
load_resources().expect("Error loading resources");
|
||||
|
||||
let app = RelmApp::new(APP_ID);
|
||||
|
||||
relm4_icons::initialize_icons();
|
||||
@@ -40,3 +46,17 @@ fn load_css() {
|
||||
|
||||
relm4::set_global_css(&css);
|
||||
}
|
||||
|
||||
fn load_resources() -> Result<()> {
|
||||
let res = match gio::Resource::load(RESOURCES_FILE) {
|
||||
Ok(res) => res,
|
||||
Err(_) if cfg!(debug_assertions) => {
|
||||
gio::Resource::load(PathBuf::from(BUILDDIR).join("data/resources.gresource"))
|
||||
.context("Could not load fallback gresource file")?
|
||||
}
|
||||
Err(_) => bail!("Could not load gresource file"),
|
||||
};
|
||||
|
||||
gio::resources_register(&res);
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -1,2 +1,5 @@
|
||||
// Generated by Meson from meson_config.rs.in - do not modify
|
||||
|
||||
pub const APP_ID: &str = "@APP_ID@";
|
||||
pub const BUILDDIR: &str = "@BUILDDIR@";
|
||||
pub const RESOURCES_FILE: &str = concat!("@PKGDATADIR@", "/resources.gresource");
|
||||
|
@@ -29,6 +29,7 @@ endif
|
||||
prefix = get_option('prefix')
|
||||
bindir = prefix / get_option('bindir')
|
||||
datadir = prefix / get_option('datadir')
|
||||
pkgdatadir = datadir / meson.project_name()
|
||||
appsdir = datadir / 'applications'
|
||||
iconsdir = datadir / 'icons'
|
||||
|
||||
|
Reference in New Issue
Block a user