Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-welcome
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-welcome
Commits
97f35aff
Commit
97f35aff
authored
Jan 01, 2022
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move from embedded resources
makes iteration on the UI slower
parent
d39c8164
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
44 deletions
+7
-44
.gitignore
.gitignore
+0
-1
.gitlab-ci.yml
.gitlab-ci.yml
+0
-1
meson.build
data/meson.build
+3
-2
config.rs.in
src/config.rs.in
+1
-0
main.rs
src/main.rs
+3
-3
meson.build
src/meson.build
+0
-17
static_resources.rs.in
src/static_resources.rs.in
+0
-20
No files found.
.gitignore
View file @
97f35aff
...
...
@@ -4,7 +4,6 @@ _build/
build-aux/app
build-aux/.flatpak-builder/
src/config.rs
src/static_resources.rs
*.ui.in~
*.ui~
.flatpak
...
...
.gitlab-ci.yml
View file @
97f35aff
...
...
@@ -26,7 +26,6 @@ rustfmt:
# Create blank versions of our configured files
# so rustfmt does not yell about non-existent files or completely empty files
-
echo -e "" >> src/config.rs
-
echo -e "" >> src/static_resources.rs
-
rustc -Vv && cargo -Vv
-
cargo fmt --version
-
cargo fmt --all -- --color=always --check
data/meson.build
View file @
97f35aff
...
...
@@ -56,6 +56,7 @@ resources = gnome.compile_resources(
'resources',
'resources.gresource.xml',
gresource_bundle: true,
source_dir: meson.current_build_dir()
source_dir: meson.current_build_dir(),
install: true,
install_dir: pkgdatadir,
)
src/config.rs.in
View file @
97f35aff
...
...
@@ -4,5 +4,6 @@ pub static PROFILE: &str = @PROFILE@;
pub static VERSION: &str = @VERSION@;
pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
pub static LOCALEDIR: &str = @LOCALEDIR@;
pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/resources.gresource");
#[cfg(feature = "video")]
pub static VIDEO_PATH: &str = @VIDEO_PATH@;
src/main.rs
View file @
97f35aff
use
gettextrs
::
*
;
use
gtk
::
glib
;
use
gtk
::
{
gio
,
glib
}
;
mod
application
;
mod
config
;
mod
static_resources
;
mod
utils
;
mod
widgets
;
...
...
@@ -26,7 +25,8 @@ fn main() {
#[cfg(feature
=
"video"
)]
gst
::
init
()
.expect
(
"Unable to start gst"
);
static_resources
::
init
()
.expect
(
"Failed to initialize the resource file."
);
let
res
=
gio
::
Resource
::
load
(
config
::
RESOURCES_FILE
)
.expect
(
"Could not load resources"
);
gio
::
resources_register
(
&
res
);
Application
::
run
()
}
src/meson.build
View file @
97f35aff
...
...
@@ -19,22 +19,6 @@ run_command(
check: true
)
# include_bytes! only takes a string literal
resource_conf = configuration_data()
resource_conf.set_quoted('RESOURCEFILE', 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
)
sources = files(
'widgets/pages/image.rs',
'widgets/pages/mod.rs',
...
...
@@ -45,7 +29,6 @@ sources = files(
'application.rs',
'config.rs',
'main.rs',
'static_resources.rs',
'utils.rs',
)
...
...
src/static_resources.rs.in
deleted
100644 → 0
View file @
d39c8164
// Source: https://gitlab.gnome.org/World/podcasts/blob/master/podcasts-gtk/src/static_resource.rs
use gtk::gio::{resources_register, Resource};
use gtk::glib::{Bytes, Error};
pub(crate) fn init() -> Result<(), Error> {
// load the gresource binary at build time and include/link it into the final
// binary.
let res_bytes = include_bytes!(@RESOURCEFILE@);
// Create Resource it will live as long the value lives.
let gbytes = Bytes::from_static(res_bytes.as_ref());
let resource = Resource::from_data(&gbytes)?;
// Register the resource so it won't be dropped and will continue to live in
// memory.
resources_register(&resource);
Ok(())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment