Skip to content

Commit

Permalink
New bundle_icons syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dastansam committed Aug 27, 2024
1 parent c2462be commit 7ef4d74
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
51 changes: 22 additions & 29 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use fluent_static_codegen::{generate, MessageBundleCodeGenerator};
use relm4_icons_build::Config;
use std::path::Path;
use std::{env, fs};

Expand Down Expand Up @@ -30,32 +29,26 @@ fn main() {
res.compile().unwrap();
}

let config = Config {
icons: Some(
vec![
"ssd",
"size-horizontally",
"cross",
"checkmark",
"wallet2",
"warning",
"puzzle-piece",
"pause",
"menu-large",
"processor",
"speedometer2",
"speedometer3",
"speedometer4",
"grid-filled",
]
.iter()
.map(|s| s.to_string())
.collect(),
),
app_id: Some("com.github.autonomys.space-acres".to_string()),
base_resource_path: None,
icons_folder: None,
};

relm4_icons_build::bundle_icons(config);
relm4_icons_build::bundle_icons(
"icon_names.rs",
Some("com.github.autonomys.space-acres"),
None::<&str>,
None::<&str>,
[
"ssd",
"size-horizontally",
"cross",
"checkmark",
"wallet2",
"warning",
"puzzle-piece",
"pause",
"menu-large",
"processor",
"speedometer2",
"speedometer3",
"speedometer4",
"grid-filled",
]
);
}
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use tracing_subscriber::EnvFilter;
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
mod icon_names {
include!(concat!(env!("OUT_DIR"), "/icon_names.rs"));
pub(crate) const GRESOURCE_BYTES: &'static [u8] = include_bytes!(concat!(env!("OUT_DIR"), "/resources.gresource"));
}

/// Number of log files to keep
Expand Down Expand Up @@ -227,7 +228,7 @@ impl Cli {
});

app.set_global_css(GLOBAL_CSS);
relm4_icons::initialize_icons!(icon_names::BASE_RESOURCE_PATH, icon_names::APP_ID);
relm4_icons::initialize_icons(icon_names::GRESOURCE_BYTES, icon_names::APP_ID, Some(icon_names::BASE_RESOURCE_PATH));

// Prefer dark theme in cross-platform way if environment is configured that way
if let Some(settings) = gtk::Settings::default() {
Expand Down

0 comments on commit 7ef4d74

Please sign in to comment.