Skip to content

Commit

Permalink
fix: update the config template (#79)
Browse files Browse the repository at this point in the history
Now, the config template is
in the respect of the current afrim data.
  • Loading branch information
pythonbrad authored Aug 19, 2024
1 parent 764124a commit 0f03598
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
Empty file modified data/blank_sample.toml
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions data/full_sample.toml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[info]
name = "Sample config"
maintainors = ["test"]
input_method = "test"
homepage = "example.com"
authors = ["test"]
description = "test"
website = "example.com"
version = "2024-08-19"

[core]
buffer_size = 20
Expand Down
7 changes: 4 additions & 3 deletions data/sample.toml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[info]
name = "Sample config"
maintainors = ["test"]
input_method = "test"
homepage = "example.com"
authors = ["test"]
description = "test"
website = "example.com"
version = "2024-08-19"
16 changes: 9 additions & 7 deletions src/config.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ pub struct Core {
#[derive(Clone, Deserialize, Debug)]
pub struct Info {
pub name: String,
pub maintainors: Vec<String>,
pub input_method: String,
pub homepage: String,
pub description: String,
pub authors: Vec<String>,
pub website: String,
pub version: String,
}

#[derive(Clone, Deserialize, Debug)]
Expand Down Expand Up @@ -87,10 +88,11 @@ impl Default for Theme {
impl Default for Info {
fn default() -> Self {
Self {
name: "Unknown".to_owned(),
input_method: "Unknow".to_owned(),
homepage: "Unknow".to_owned(),
maintainors: vec!["Unknow".to_owned()],
name: "Unknow".to_owned(),
description: "".to_owned(),
authors: vec!["Unknow".to_owned()],
website: "".to_owned(),
version: "Unknow".to_owned(),
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions src/window/toolkit.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ impl ToolKit {
let core = self.config.core.to_owned().unwrap_or_default();
make_page!(
"Details",
"IME:" => &info.input_method => {
"IME:" => &info.name => {
let window = window.clone();
let config_name = info.name.to_owned();
let config_maintainors = info.maintainors.join(", ");
let config_homepage = info.homepage.clone();
let config_authors = info.authors.join(", ");
let config_description = info.description.clone();
let config_website = info.website.clone();
let config_version = info.version.clone();

move || {
rstk::message_box()
Expand All @@ -208,9 +210,11 @@ impl ToolKit {
.title("Configuration file")
.message(&config_name)
.detail(&format!(
"{}\n\nby {}",
&config_homepage,
&config_maintainors,
"{}\n{}\n{}\n{}",
&config_version,
&config_description,
&config_website,
&config_authors,
))
.show();
}
Expand Down

0 comments on commit 0f03598

Please sign in to comment.