add db data to kernel branch struct
This commit is contained in:
parent
b219774cb7
commit
373a34434a
877
Cargo.lock
generated
877
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ glib = "0.19.7"
|
|||||||
gtk = { version = "0.8.2", package = "gtk4", features = ["v4_14"] }
|
gtk = { version = "0.8.2", package = "gtk4", features = ["v4_14"] }
|
||||||
homedir = "0.2.1"
|
homedir = "0.2.1"
|
||||||
linux-version = "0.1.1"
|
linux-version = "0.1.1"
|
||||||
|
reqwest = { version = "0.11", features = ["blocking"] }
|
||||||
serde_json = "1.0.117"
|
serde_json = "1.0.117"
|
||||||
version-compare = "0.2.0"
|
version-compare = "0.2.0"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"branches": [
|
"branches": [
|
||||||
{
|
{
|
||||||
"name": "kernel-cachyos",
|
"name": "kernel-cachyos",
|
||||||
"db": "https://raw.githubusercontent.com/CosmicFusion/fedora-kernel-manager/main/data/db_kernel_cachy.json"
|
"db_url": "https://raw.githubusercontent.com/CosmicFusion/fedora-kernel-manager/main/data/db_kernel_cachy.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ use glib::property::PropertyGet;
|
|||||||
|
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
let internet_connected = Rc::new(RefCell::new(false));
|
let internet_connected = Rc::new(RefCell::new(false));
|
||||||
let selected_kernel_branch: Rc<RefCell<KernelBranch>> = Rc::new(RefCell::new(KernelBranch{name: "?".to_owned(), db:"?".to_owned()}));
|
let selected_kernel_branch: Rc<RefCell<KernelBranch>> = Rc::new(RefCell::new(KernelBranch{name: "?".to_owned(), db_url:"?".to_owned() , db:"?".to_owned()}));
|
||||||
|
|
||||||
let (internet_loop_sender, internet_loop_receiver) = async_channel::unbounded();
|
let (internet_loop_sender, internet_loop_receiver) = async_channel::unbounded();
|
||||||
let internet_loop_sender = internet_loop_sender.clone();
|
let internet_loop_sender = internet_loop_sender.clone();
|
||||||
|
@ -284,9 +284,12 @@ fn get_kernel_branches() -> Vec<KernelBranch> {
|
|||||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||||
if let serde_json::Value::Array(branches) = &res["branches"] {
|
if let serde_json::Value::Array(branches) = &res["branches"] {
|
||||||
for branch in branches {
|
for branch in branches {
|
||||||
|
|
||||||
|
println!("Downloading & Parsing package DB for {}.", branch.name);
|
||||||
let branch = KernelBranch {
|
let branch = KernelBranch {
|
||||||
name: branch["name"].as_str().to_owned().unwrap().to_string(),
|
name: branch["name"].as_str().to_owned().unwrap().to_string(),
|
||||||
db: branch["db"].as_str().to_owned().unwrap().to_string(),
|
db_url: branch["db_url"].as_str().to_owned().unwrap().to_string(),
|
||||||
|
db: reqwest::blocking::get(branch["db_url"].as_str().to_owned().unwrap().to_string(),).unwrap().text().unwrap()
|
||||||
};
|
};
|
||||||
kernel_branches_array.push(branch)
|
kernel_branches_array.push(branch)
|
||||||
}};
|
}};
|
||||||
|
@ -20,6 +20,7 @@ struct RunningKernelInfo {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct KernelBranch {
|
struct KernelBranch {
|
||||||
name: String,
|
name: String,
|
||||||
|
db_url: String,
|
||||||
db: String,
|
db: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user