fix: remove hardcoded strings where generated constants can be used instead

This commit is contained in:
Gabriele Musco 2024-01-06 10:29:48 +00:00
commit a98345cd78
6 changed files with 8 additions and 9 deletions

View file

@ -61,6 +61,7 @@ meson.add_dist_script(
global_conf = configuration_data()
global_conf.set('APP_ID', application_id)
global_conf.set('RESOURCES_BASE_PATH', '/' + base_id.replace('.', '/'))
global_conf.set('PKGDATADIR', pkgdatadir)
global_conf.set('PROFILE', profile)
global_conf.set('VERSION', version + version_suffix)

View file

@ -2,6 +2,7 @@ use crate::paths::get_exec_prefix;
pub const APP_NAME: &str = "@PRETTY_NAME@";
pub const APP_ID: &str = "@APP_ID@";
pub const RESOURCES_BASE_PATH: &str = "@RESOURCES_BASE_PATH@";
pub const PKG_DATA_DIR: &str = "@PKGDATADIR@";
pub const RESOURCES: &str = concat!("@PKGDATADIR@", "/resources.gresource");
pub const CMD_NAME: &str = "@CMD_NAME@";

View file

@ -1,4 +1,4 @@
use crate::file_utils::get_writer;
use crate::{constants::APP_ID, file_utils::get_writer};
use reqwest::{
header::{HeaderMap, USER_AGENT},
Method,
@ -11,7 +11,7 @@ const CHUNK_SIZE: usize = 1024;
fn headers() -> HeaderMap {
let mut headers = HeaderMap::new();
headers.insert(USER_AGENT, "org.gabmus.envision/1.0".parse().unwrap());
headers.insert(USER_AGENT, format!("{}/1.0", APP_ID).parse().unwrap());
headers
}

View file

@ -1,13 +1,10 @@
use std::env;
use anyhow::Result;
use constants::{resources, APP_ID, APP_NAME, GETTEXT_PACKAGE, LOCALE_DIR};
use constants::{resources, APP_ID, APP_NAME, GETTEXT_PACKAGE, LOCALE_DIR, RESOURCES_BASE_PATH};
use file_builders::{
active_runtime_json::{get_current_active_runtime, set_current_active_runtime_to_steam},
openvrpaths_vrpath::{get_current_openvrpaths, set_current_openvrpaths_to_steam},
};
use gettextrs::LocaleCategory;
use gtk::prelude::ObjectExt;
use relm4::{
adw,
gtk::{self, gdk, gio, glib},
@ -82,7 +79,7 @@ fn main() -> Result<()> {
}
let provider = gtk::CssProvider::new();
provider.load_from_resource("/org/gabmus/envision/style.css");
provider.load_from_resource(&format!("{}/style.css", RESOURCES_BASE_PATH));
if let Some(display) = gdk::Display::default() {
gtk::style_context_add_provider_for_display(
&display,

View file

@ -61,7 +61,7 @@ impl SimpleComponent for DebugView {
menu! {
debug_menu: {
section! {
"Open Envision _Data Folder" => DebugOpenDataAction,
"Open _Data Folder" => DebugOpenDataAction,
"Open _Prefix Folder" => DebugOpenPrefixAction,
},
}

View file

@ -223,7 +223,7 @@ impl SimpleComponent for MainView {
set_label: concat!(
"Your current prefix is inside a partition ",
"mounted with the nosuid option. This will prevent ",
"the Envision runtime from acquiring certain privileges ",
"the XR runtime from acquiring certain privileges ",
"and will cause noticeable stutter when running XR ",
"applications."
),