add strfmt

This commit is contained in:
Ward from fusion-voyager-3 2024-10-02 18:12:03 +03:00
parent afb52f4eab
commit b74cf0673e
4 changed files with 40 additions and 6 deletions

7
Cargo.lock generated
View File

@ -1682,6 +1682,7 @@ dependencies = [
"rust-i18n",
"serde",
"serde_json",
"strfmt",
"tokio",
"tokio-uds",
]
@ -2184,6 +2185,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "strfmt"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a8348af2d9fc3258c8733b8d9d8db2e56f54b2363a4b5b81585c7875ed65e65"
[[package]]
name = "syn"
version = "1.0.109"

View File

@ -42,5 +42,6 @@ libflatpak = { version = "0.5.0", package = "libflatpak", features = ["v1_11_1"]
regex = "1.10.6"
duct = "0.13.7"
reqwest = { version = "0.11", features = ["blocking"] }
strfmt = "0.2.4"
configparser = "3.1.0"

View File

@ -149,5 +149,6 @@
"flatpak_ref_install_flatref_path_file_dialog_title": "Open a Flatpak Repository Referance File",
"flatpak_ref_install_flatref_path_file_dialog_accept_label": "Open",
"flatpak_ref_install_flatref_path_file_dialog_cancel_label": "Cancel",
"flatpak_ref_install_flatref_path_entry_open_file_dialog_text": "Open File Chooser"
"flatpak_ref_install_flatref_path_entry_open_file_dialog_text": "Open File Chooser",
"flatpak_ref_install_label": "{NAME} Will be Installed and It Uses The remote \"{REMOTE}\" Which Will Be Installed\nOn Your System If It Isn't Already"
}

View File

@ -112,6 +112,9 @@ pub fn install_ref_dialog_fn(
.spacing(5)
.build();
let flatpak_ref_install_label0 = gtk::Label::builder()
.build();
let flatpak_remote_user_togglebutton = gtk::ToggleButton::builder()
.valign(Align::Center)
.hexpand(true)
@ -175,7 +178,7 @@ pub fn install_ref_dialog_fn(
let flatpak_ref_install_dialog_clone0 = flatpak_ref_install_dialog.clone();
let flatpak_ref_install_flatref_path_entry_clone0 = flatpak_ref_install_flatref_path_entry.clone();
let flatpak_ref_install_label0_clone0 = flatpak_ref_install_label0.clone();
let add_button_update_state = move || {
if
@ -188,23 +191,44 @@ pub fn install_ref_dialog_fn(
Ok(_) => {
let ref_name = flatref_file.get("Flatpak Ref", "Name");
let ref_remote_name = flatref_file.get("Flatpak Ref", "SuggestRemoteName");
//Write text
match (ref_name, ref_remote_name) {
(Some(name), Some(remote_name)) => {
flatpak_ref_install_label0_clone0.set_label(&strfmt::strfmt(
&t!("flatpak_ref_install_label").to_string(),
&std::collections::HashMap::from([
(
"NAME".to_string(),
name,
),
(
"REMOTE".to_string(),
remote_name,
),
]),
)
.unwrap());
}
(_, _) => {
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
flatpak_ref_install_label0_clone0.set_label("");
}
}
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", true);
}
Err(_) => {
// Delete Text
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
flatpak_ref_install_label0_clone0.set_label("");
}
}
}
Err(_) => {
// Delete Text
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
flatpak_ref_install_label0_clone0.set_label("");
}
}
// Write Text
} else {
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
flatpak_ref_install_label0_clone0.set_label("");
}
};
@ -231,6 +255,7 @@ pub fn install_ref_dialog_fn(
flatpak_ref_install_dialog_child_box.append(&flatpak_ref_install_flatref_path_prefrencesgroup);
flatpak_ref_install_dialog_child_box.append(&flatpak_ref_install_box2);
flatpak_ref_install_dialog_child_box.append(&flatpak_ref_install_label0);
let reload_action_clone0 = reload_action.clone();
//let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();