mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: show kernel version
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use std::process::Command;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SoftwarePage {
|
||||
pub container: Grid,
|
||||
lact_version_label: Label,
|
||||
}
|
||||
|
||||
impl SoftwarePage {
|
||||
@@ -16,12 +16,12 @@ impl SoftwarePage {
|
||||
container.set_margin_bottom(5);
|
||||
container.set_margin_top(5);
|
||||
|
||||
container.set_column_spacing(10);
|
||||
container.set_column_spacing(5);
|
||||
|
||||
container.attach(
|
||||
&{
|
||||
let label = Label::new(None);
|
||||
label.set_markup("<b>LACT Version:</b>");
|
||||
label.set_markup("LACT Version:");
|
||||
label.set_halign(Align::End);
|
||||
label.set_hexpand(true);
|
||||
label
|
||||
@@ -39,16 +39,40 @@ impl SoftwarePage {
|
||||
false => "release",
|
||||
};
|
||||
|
||||
lact_version_label.set_markup(&format!("{}-{}", lact_version, lact_release_type));
|
||||
lact_version_label.set_markup(&format!("<b>{}-{}</b>", lact_version, lact_release_type));
|
||||
|
||||
lact_version_label.set_hexpand(true);
|
||||
lact_version_label.set_halign(Align::Start);
|
||||
|
||||
container.attach(&lact_version_label, 1, 0, 1, 1);
|
||||
|
||||
Self {
|
||||
container,
|
||||
lact_version_label,
|
||||
}
|
||||
container.attach(
|
||||
&Label::builder()
|
||||
.label("Kernel version:")
|
||||
.halign(Align::End)
|
||||
.hexpand(true)
|
||||
.build(),
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
);
|
||||
let kernel_version_label = Label::builder()
|
||||
.use_markup(true)
|
||||
.label(&format!("<b>{}</b>", get_kernel_version().trim()))
|
||||
.hexpand(true)
|
||||
.halign(Align::Start)
|
||||
.build();
|
||||
container.attach(&kernel_version_label, 1, 1, 1, 1);
|
||||
|
||||
Self { container }
|
||||
}
|
||||
}
|
||||
|
||||
fn get_kernel_version() -> String {
|
||||
let output = Command::new("uname")
|
||||
.arg("-r")
|
||||
.output()
|
||||
.expect("Could not run uname");
|
||||
String::from_utf8(output.stdout).expect("Invalid uname output")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user