[fractal] fractal-gtk: Remove static_resources.rs.in
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] fractal-gtk: Remove static_resources.rs.in
- Date: Fri, 6 Nov 2020 08:11:57 +0000 (UTC)
commit 52beef4b78cf983a3c8539b9dae8b6815a7d9c3c
Author: Christopher Davis <brainblasted disroot org>
Date: Sat Oct 31 13:42:51 2020 -0700
fractal-gtk: Remove static_resources.rs.in
Instead of using static_resources, we can simply
load the gresource from the PKGDATADIR. This makes
iterating on UI-only changes much faster.
fractal-gtk/res/meson.build | 4 +++-
fractal-gtk/src/config.rs.in | 1 +
fractal-gtk/src/main.rs | 5 +++--
fractal-gtk/src/meson.build | 19 +------------------
fractal-gtk/src/static_resources.rs.in | 20 --------------------
meson.build | 1 +
6 files changed, 9 insertions(+), 41 deletions(-)
---
diff --git a/fractal-gtk/res/meson.build b/fractal-gtk/res/meson.build
index b269e723..7a7a7d65 100644
--- a/fractal-gtk/res/meson.build
+++ b/fractal-gtk/res/meson.build
@@ -54,5 +54,7 @@ fractal_resources = gnome.compile_resources(
'resources',
'resources.xml',
gresource_bundle: true,
- source_dir: meson.current_build_dir()
+ source_dir: meson.current_build_dir(),
+ install: true,
+ install_dir: fractal_pkgdatadir
)
diff --git a/fractal-gtk/src/config.rs.in b/fractal-gtk/src/config.rs.in
index ad17596e..9af5e2ab 100644
--- a/fractal-gtk/src/config.rs.in
+++ b/fractal-gtk/src/config.rs.in
@@ -21,3 +21,4 @@ pub static LOCALEDIR: &str = @LOCALEDIR@;
pub static APP_ID: &str = @APP_ID@;
pub static NAME_SUFFIX: &str = @NAME_SUFFIX@;
pub static VERSION: &str = @VERSION@;
+pub static PKGDATADIR: &str = @PKGDATADIR@;
diff --git a/fractal-gtk/src/main.rs b/fractal-gtk/src/main.rs
index 4d8244c2..7f4f9849 100644
--- a/fractal-gtk/src/main.rs
+++ b/fractal-gtk/src/main.rs
@@ -12,7 +12,6 @@ mod util;
mod cache;
mod model;
mod passwd;
-mod static_resources;
mod uibuilder;
mod uitypes;
#[macro_use]
@@ -59,7 +58,9 @@ fn main() -> Result<(), Box<dyn Error>> {
.expect("Failed to initialize logger");
}
- static_resources::init().expect("GResource initialization failed.");
+ let res = gio::Resource::load(config::PKGDATADIR.to_owned() + "/resources.gresource")
+ .expect("Could not load gresource file");
+ gio::resources_register(&res);
// Initialize GStreamer. This checks, among other things, what plugins are available
gst::init()?;
diff --git a/fractal-gtk/src/meson.build b/fractal-gtk/src/meson.build
index 4909c1bb..6b548a1c 100644
--- a/fractal-gtk/src/meson.build
+++ b/fractal-gtk/src/meson.build
@@ -2,6 +2,7 @@ global_conf = configuration_data()
global_conf.set_quoted('APP_ID', application_id)
global_conf.set_quoted('VERSION', fractal_version + version_suffix)
global_conf.set_quoted('LOCALEDIR', fractal_localedir)
+global_conf.set_quoted('PKGDATADIR', fractal_pkgdatadir)
global_conf.set_quoted('NAME_SUFFIX', name_suffix)
config_rs = configure_file(
input: 'config.rs.in',
@@ -16,22 +17,6 @@ run_command(
check: true
)
-# include_bytes! only takes a string literal
-resource_conf = configuration_data()
-resource_conf.set_quoted('RESOURCEFILE', fractal_resources.full_path())
-resource_rs = configure_file(
- input: 'static_resources.rs.in',
- output: 'static_resources.rs',
- configuration: resource_conf
-)
-
-run_command(
- 'cp',
- resource_rs,
- meson.current_source_dir(),
- check: true
-)
-
run_target(
'doc',
command: [
@@ -136,8 +121,6 @@ app_sources = files(
'globals.rs',
'main.rs',
'passwd.rs',
- 'static_resources.rs',
- 'static_resources.rs.in',
'types.rs',
'uibuilder.rs',
'uitypes.rs'
diff --git a/meson.build b/meson.build
index 4b6420c3..027f94f3 100644
--- a/meson.build
+++ b/meson.build
@@ -55,6 +55,7 @@ fractal_bindir = join_paths(fractal_prefix, get_option('bindir'))
fractal_localedir = join_paths(fractal_prefix, get_option('localedir'))
datadir = get_option('datadir')
+fractal_pkgdatadir = join_paths(fractal_prefix, datadir, meson.project_name())
i18n = import('i18n')
gnome = import('gnome')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]