fix kernel parse timeout
This commit is contained in:
parent
fd1fac0bec
commit
596bed8f4b
@ -36,6 +36,8 @@
|
||||
"kernel_install_dialog_reboot_label": "Reboot Now (Optional)",
|
||||
"kernel_install_dialog_body_successful": "Kernel installation was successful!",
|
||||
"kernel_install_dialog_body_failed": "Kernel installation failed!",
|
||||
"parse_loading_dialog_heading": "Please Wait!",
|
||||
"parse_loading_dialog_body": "Loading Kernel Repo Data....",
|
||||
"log_status_kernel_modify_successful": "Status: kernel modify Successful",
|
||||
"log_status_kernel_modify_failed": "Status: kernel modify Failed",
|
||||
"scx_sched_expander_row_subtitle": "Select Sched-EXT SCX Scheduler",
|
||||
|
Binary file not shown.
@ -133,10 +133,7 @@ pub fn content(
|
||||
|
||||
browse_kernels_button.connect_clicked(
|
||||
clone!(@weak window, @weak content_stack, @strong selected_kernel_branch => move |_| {
|
||||
content_stack.add_named(
|
||||
&kernel_pkg::kernel_pkg_page(&content_stack, &window, &selected_kernel_branch),
|
||||
Some("kernel_pkg_page"),
|
||||
);
|
||||
kernel_pkg::kernel_pkg_page(&content_stack, &window, &selected_kernel_branch);
|
||||
content_stack.set_visible_child_name("kernel_pkg_page")
|
||||
}),
|
||||
);
|
||||
@ -164,10 +161,10 @@ pub fn content(
|
||||
}
|
||||
|
||||
config_kernel_button.connect_clicked(clone!(@weak content_stack, @weak window, @weak sched_ext_badge_box => move |_| {
|
||||
content_stack.add_named(
|
||||
content_stack.add_named(
|
||||
&sched_ext::sched_ext_page(&content_stack, &window, &sched_ext_badge_box),
|
||||
Some("sched_ext_page"),
|
||||
);
|
||||
);
|
||||
content_stack.set_visible_child_name("sched_ext_page")
|
||||
}));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{kernel_package_row, KernelBranch};
|
||||
use crate::{kernel_package_row, KernelBranch, KernelPackage};
|
||||
use adw::prelude::*;
|
||||
use duct::cmd;
|
||||
use glib::*;
|
||||
@ -16,9 +16,25 @@ pub fn kernel_pkg_page(
|
||||
content_stack: >k::Stack,
|
||||
window: &adw::ApplicationWindow,
|
||||
selected_kernel_branch: &Rc<RefCell<KernelBranch>>,
|
||||
) -> gtk::Box {
|
||||
) {
|
||||
let selected_kernel_branch_clone0 = selected_kernel_branch.borrow().clone();
|
||||
|
||||
let parse_loading_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(window)
|
||||
.extra_child(>k::Spinner::builder()
|
||||
.hexpand(true)
|
||||
.valign(Align::Start)
|
||||
.halign(Align::Center)
|
||||
.spinning(true)
|
||||
.height_request(128)
|
||||
.width_request(128)
|
||||
.build())
|
||||
.heading(t!("parse_loading_dialog_heading"))
|
||||
.body(t!("parse_loading_dialog_body"))
|
||||
.build();
|
||||
|
||||
parse_loading_dialog.present();
|
||||
|
||||
let main_box = gtk::Box::builder()
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
@ -66,6 +82,11 @@ pub fn kernel_pkg_page(
|
||||
.build();
|
||||
searchbar.add_css_class("rounded-all-25");
|
||||
|
||||
content_stack.add_named(
|
||||
&main_box,
|
||||
Some("kernel_pkg_page"),
|
||||
);
|
||||
|
||||
let packages_boxedlist = gtk::ListBox::builder()
|
||||
.selection_mode(SelectionMode::None)
|
||||
.margin_bottom(15)
|
||||
@ -77,10 +98,11 @@ pub fn kernel_pkg_page(
|
||||
let rows_size_group = gtk::SizeGroup::new(SizeGroupMode::Both);
|
||||
add_package_rows(
|
||||
&packages_boxedlist,
|
||||
&selected_kernel_branch_clone0.db,
|
||||
selected_kernel_branch_clone0.db,
|
||||
&window,
|
||||
&rows_size_group,
|
||||
&searchbar,
|
||||
&parse_loading_dialog
|
||||
);
|
||||
|
||||
let packages_viewport = gtk::ScrolledWindow::builder()
|
||||
@ -125,15 +147,16 @@ pub fn kernel_pkg_page(
|
||||
main_box.append(&packages_viewport);
|
||||
main_box.append(&window_bottombar);
|
||||
|
||||
main_box
|
||||
//parse_loading_dialog.close();
|
||||
}
|
||||
|
||||
fn add_package_rows(
|
||||
boxedlist: >k::ListBox,
|
||||
data: &str,
|
||||
data: String,
|
||||
window: &adw::ApplicationWindow,
|
||||
rows_size_group: >k::SizeGroup,
|
||||
searchbar: >k::SearchEntry,
|
||||
parse_loading_dialog: &adw::MessageDialog
|
||||
) {
|
||||
let cpu_feature_level: u32 = match get_cpu_feature_level().as_str() {
|
||||
"x86-64-v4" => 4,
|
||||
@ -141,40 +164,72 @@ fn add_package_rows(
|
||||
"x86-64-v2" => 2,
|
||||
_ => 1,
|
||||
};
|
||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||
if let serde_json::Value::Array(kernels) = &res["kernels"] {
|
||||
for kernel in kernels {
|
||||
let kernel_name = kernel["name"].as_str().to_owned().unwrap().to_string();
|
||||
let kernel_main_package = kernel["main_package"]
|
||||
.as_str()
|
||||
.to_owned()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
let kernel_packages = kernel["packages"].as_str().to_owned().unwrap().to_string();
|
||||
let kernel_min_x86_march = kernel["min_x86_march"]
|
||||
.as_str()
|
||||
.to_owned()
|
||||
.unwrap()
|
||||
.parse::<u32>()
|
||||
.unwrap();
|
||||
let kernel_package_version = match Command::new(
|
||||
"/usr/lib/fedora-kernel-manager/scripts/generate_package_info.sh",
|
||||
)
|
||||
.args(["description", &kernel_main_package])
|
||||
.output()
|
||||
{
|
||||
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||
_ => "Error".to_owned(),
|
||||
};
|
||||
let kernel_description = match Command::new(
|
||||
"/usr/lib/fedora-kernel-manager/scripts/generate_package_info.sh",
|
||||
)
|
||||
.args(["description", &kernel_main_package])
|
||||
.output()
|
||||
{
|
||||
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||
_ => "Error".to_owned(),
|
||||
};
|
||||
|
||||
let (kernel_package_sender, kernel_package_receiver) = async_channel::unbounded();
|
||||
let kernel_package_sender = kernel_package_sender.clone();
|
||||
|
||||
let (kernel_package_done_sender, kernel_package_done_receiver) = async_channel::unbounded();
|
||||
let kernel_package_done_sender = kernel_package_done_sender.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||
if let serde_json::Value::Array(kernels) = &res["kernels"] {
|
||||
for kernel in kernels {
|
||||
let kernel_name = kernel["name"].as_str().to_owned().unwrap().to_string();
|
||||
let kernel_main_package = kernel["main_package"]
|
||||
.as_str()
|
||||
.to_owned()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
let kernel_packages = kernel["packages"].as_str().to_owned().unwrap().to_string();
|
||||
let kernel_min_x86_march = kernel["min_x86_march"]
|
||||
.as_str()
|
||||
.to_owned()
|
||||
.unwrap()
|
||||
.parse::<u32>()
|
||||
.unwrap();
|
||||
let kernel_package_version = match Command::new(
|
||||
"/usr/lib/fedora-kernel-manager/scripts/generate_package_info.sh",
|
||||
)
|
||||
.args(["description", &kernel_main_package])
|
||||
.output()
|
||||
{
|
||||
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||
_ => "Error".to_owned(),
|
||||
};
|
||||
let kernel_description = match Command::new(
|
||||
"/usr/lib/fedora-kernel-manager/scripts/generate_package_info.sh",
|
||||
)
|
||||
.args(["description", &kernel_main_package])
|
||||
.output()
|
||||
{
|
||||
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||
_ => "Error".to_owned(),
|
||||
};
|
||||
|
||||
let kernel_package = KernelPackage{
|
||||
name: kernel_name,
|
||||
main_package: kernel_main_package,
|
||||
packages: kernel_packages,
|
||||
min_x86_march: kernel_min_x86_march,
|
||||
package_version: kernel_package_version,
|
||||
description: kernel_description
|
||||
};
|
||||
kernel_package_sender.send_blocking(kernel_package).expect("Kernel Package sender channel closed")
|
||||
}};
|
||||
kernel_package_done_sender.send_blocking(true).expect("Kernel Package done sender channel closed")
|
||||
});
|
||||
|
||||
let kernel_package_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
kernel_package_context.spawn_local(clone!(@strong boxedlist, @strong window, @strong rows_size_group => async move {
|
||||
while let Ok(kernel_pkg_status) = kernel_package_receiver.recv().await {
|
||||
let kernel_name = kernel_pkg_status.name;
|
||||
let kernel_main_package = kernel_pkg_status.main_package;
|
||||
let kernel_packages = kernel_pkg_status.packages;
|
||||
let kernel_min_x86_march = kernel_pkg_status.min_x86_march;
|
||||
let kernel_package_version = kernel_pkg_status.package_version;
|
||||
let kernel_description = kernel_pkg_status.description;
|
||||
|
||||
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
||||
let log_loop_sender: async_channel::Sender<String> = log_loop_sender.clone();
|
||||
@ -207,204 +262,209 @@ fn add_package_rows(
|
||||
std::thread::sleep(Duration::from_secs(6));
|
||||
});
|
||||
|
||||
let kernel_main_package_clone0 = kernel_main_package.clone();
|
||||
|
||||
let kernel_expander_row = kernel_package_row::KernelPackageRow::new();
|
||||
kernel_expander_row.set_package(kernel_main_package_clone0);
|
||||
let kernel_status_icon = gtk::Image::builder()
|
||||
.icon_name("emblem-default")
|
||||
.pixel_size(24)
|
||||
.valign(Align::Center)
|
||||
.visible(false)
|
||||
.tooltip_text(t!("Installed"))
|
||||
.build();
|
||||
let kernel_description_label = gtk::Label::builder()
|
||||
.label(&kernel_description)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
let kernel_content_row = adw::ActionRow::builder().build();
|
||||
let kernel_install_button = gtk::Button::builder()
|
||||
.margin_start(5)
|
||||
.margin_top(5)
|
||||
.margin_bottom(5)
|
||||
.valign(gtk::Align::Center)
|
||||
.label(t!("kernel_install_button_label"))
|
||||
.tooltip_text(t!("kernel_install_button_tooltip_text"))
|
||||
.sensitive(false)
|
||||
.build();
|
||||
kernel_install_button.add_css_class("suggested-action");
|
||||
let kernel_remove_button = gtk::Button::builder()
|
||||
.margin_end(5)
|
||||
.margin_top(5)
|
||||
.margin_bottom(5)
|
||||
.valign(gtk::Align::Center)
|
||||
.label(t!("kernel_uninstall_button_label"))
|
||||
.tooltip_text(t!("kernel_uninstall_button_tooltip_text"))
|
||||
.sensitive(false)
|
||||
.build();
|
||||
let kernel_action_box = gtk::Box::builder().homogeneous(true).build();
|
||||
kernel_remove_button.add_css_class("destructive-action");
|
||||
kernel_expander_row.add_suffix(&kernel_status_icon);
|
||||
kernel_expander_row.set_title(&kernel_name);
|
||||
kernel_expander_row.set_subtitle(&kernel_package_version);
|
||||
kernel_content_row.add_prefix(&kernel_description_label);
|
||||
kernel_action_box.append(&kernel_remove_button);
|
||||
kernel_action_box.append(&kernel_install_button);
|
||||
kernel_content_row.add_suffix(&kernel_action_box);
|
||||
kernel_expander_row.add_row(&kernel_content_row);
|
||||
rows_size_group.add_widget(&kernel_action_box);
|
||||
//
|
||||
let kernel_status_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
kernel_status_loop_context.spawn_local(clone!(@weak kernel_remove_button, @weak kernel_install_button, @strong kernel_status_loop_receiver => async move {
|
||||
while let Ok(kernel_status_state) = kernel_status_loop_receiver.recv().await {
|
||||
if kernel_status_state == true {
|
||||
kernel_status_icon.set_visible(true);
|
||||
kernel_install_button.set_sensitive(false);
|
||||
kernel_remove_button.set_sensitive(true);
|
||||
} else {
|
||||
kernel_status_icon.set_visible(false);
|
||||
kernel_remove_button.set_sensitive(false);
|
||||
kernel_install_button.set_sensitive(true);
|
||||
let kernel_expander_row = kernel_package_row::KernelPackageRow::new();
|
||||
kernel_expander_row.set_package(kernel_main_package);
|
||||
let kernel_status_icon = gtk::Image::builder()
|
||||
.icon_name("emblem-default")
|
||||
.pixel_size(24)
|
||||
.valign(Align::Center)
|
||||
.visible(false)
|
||||
.tooltip_text(t!("Installed"))
|
||||
.build();
|
||||
let kernel_description_label = gtk::Label::builder()
|
||||
.label(&kernel_description)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
let kernel_content_row = adw::ActionRow::builder().build();
|
||||
let kernel_install_button = gtk::Button::builder()
|
||||
.margin_start(5)
|
||||
.margin_top(5)
|
||||
.margin_bottom(5)
|
||||
.valign(gtk::Align::Center)
|
||||
.label(t!("kernel_install_button_label"))
|
||||
.tooltip_text(t!("kernel_install_button_tooltip_text"))
|
||||
.sensitive(false)
|
||||
.build();
|
||||
kernel_install_button.add_css_class("suggested-action");
|
||||
let kernel_remove_button = gtk::Button::builder()
|
||||
.margin_end(5)
|
||||
.margin_top(5)
|
||||
.margin_bottom(5)
|
||||
.valign(gtk::Align::Center)
|
||||
.label(t!("kernel_uninstall_button_label"))
|
||||
.tooltip_text(t!("kernel_uninstall_button_tooltip_text"))
|
||||
.sensitive(false)
|
||||
.build();
|
||||
let kernel_action_box = gtk::Box::builder().homogeneous(true).build();
|
||||
kernel_remove_button.add_css_class("destructive-action");
|
||||
kernel_expander_row.add_suffix(&kernel_status_icon);
|
||||
kernel_expander_row.set_title(&kernel_name);
|
||||
kernel_expander_row.set_subtitle(&kernel_package_version);
|
||||
kernel_content_row.add_prefix(&kernel_description_label);
|
||||
kernel_action_box.append(&kernel_remove_button);
|
||||
kernel_action_box.append(&kernel_install_button);
|
||||
kernel_content_row.add_suffix(&kernel_action_box);
|
||||
kernel_expander_row.add_row(&kernel_content_row);
|
||||
rows_size_group.add_widget(&kernel_action_box);
|
||||
//
|
||||
let kernel_status_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
kernel_status_loop_context.spawn_local(clone!(@weak kernel_remove_button, @weak kernel_install_button, @strong kernel_status_loop_receiver => async move {
|
||||
while let Ok(kernel_status_state) = kernel_status_loop_receiver.recv().await {
|
||||
if kernel_status_state == true {
|
||||
kernel_status_icon.set_visible(true);
|
||||
kernel_install_button.set_sensitive(false);
|
||||
kernel_remove_button.set_sensitive(true);
|
||||
} else {
|
||||
kernel_status_icon.set_visible(false);
|
||||
kernel_remove_button.set_sensitive(false);
|
||||
kernel_install_button.set_sensitive(true);
|
||||
}
|
||||
}
|
||||
}));
|
||||
//
|
||||
let kernel_install_log_terminal_buffer = gtk::TextBuffer::builder().build();
|
||||
|
||||
let kernel_install_log_terminal = gtk::TextView::builder()
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.editable(false)
|
||||
.buffer(&kernel_install_log_terminal_buffer)
|
||||
.build();
|
||||
|
||||
let kernel_install_log_terminal_scroll = gtk::ScrolledWindow::builder()
|
||||
.width_request(400)
|
||||
.height_request(200)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.child(&kernel_install_log_terminal)
|
||||
.build();
|
||||
|
||||
let kernel_install_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(&window)
|
||||
.hide_on_close(true)
|
||||
.extra_child(&kernel_install_log_terminal_scroll)
|
||||
.width_request(400)
|
||||
.height_request(200)
|
||||
.heading(t!("kernel_install_dialog_heading"))
|
||||
.build();
|
||||
kernel_install_dialog.add_response("kernel_install_dialog_ok", &t!("kernel_install_dialog_ok_label").to_string());
|
||||
kernel_install_dialog
|
||||
.add_response("kernel_install_dialog_reboot", &t!("kernel_install_dialog_reboot_label").to_string());
|
||||
kernel_install_dialog.set_response_appearance(
|
||||
"kernel_install_dialog_reboot",
|
||||
adw::ResponseAppearance::Suggested,
|
||||
);
|
||||
//
|
||||
|
||||
//
|
||||
let log_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
log_loop_context.spawn_local(clone!(@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_receiver => async move {
|
||||
while let Ok(state) = log_loop_receiver.recv().await {
|
||||
kernel_install_log_terminal_buffer.insert(&mut kernel_install_log_terminal_buffer.end_iter(), &("\n".to_string() + &state))
|
||||
}
|
||||
}));
|
||||
|
||||
let log_status_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
log_status_loop_context.spawn_local(clone!(@weak kernel_install_dialog, @strong log_status_loop_receiver => async move {
|
||||
while let Ok(state) = log_status_loop_receiver.recv().await {
|
||||
if state == true {
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true);
|
||||
//if get_current_username().unwrap() == "pikaos" {
|
||||
// kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
//} else {
|
||||
// kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
|
||||
//}
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
|
||||
kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_successful").to_string());
|
||||
} else {
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true);
|
||||
kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_failed").to_string());
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
}
|
||||
}
|
||||
}));
|
||||
//
|
||||
kernel_install_log_terminal_buffer.connect_changed(clone!(@weak kernel_install_log_terminal, @weak kernel_install_log_terminal_buffer,@weak kernel_install_log_terminal_scroll => move |_|{
|
||||
if kernel_install_log_terminal_scroll.vadjustment().upper() - kernel_install_log_terminal_scroll.vadjustment().value() > 100.0 {
|
||||
kernel_install_log_terminal_scroll.vadjustment().set_value(kernel_install_log_terminal_scroll.vadjustment().upper())
|
||||
}
|
||||
}));
|
||||
//
|
||||
let kernel_install_log_terminal_buffer = gtk::TextBuffer::builder().build();
|
||||
|
||||
let kernel_install_log_terminal = gtk::TextView::builder()
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.editable(false)
|
||||
.buffer(&kernel_install_log_terminal_buffer)
|
||||
.build();
|
||||
|
||||
let kernel_install_log_terminal_scroll = gtk::ScrolledWindow::builder()
|
||||
.width_request(400)
|
||||
.height_request(200)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.child(&kernel_install_log_terminal)
|
||||
.build();
|
||||
|
||||
let kernel_install_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(window)
|
||||
.hide_on_close(true)
|
||||
.extra_child(&kernel_install_log_terminal_scroll)
|
||||
.width_request(400)
|
||||
.height_request(200)
|
||||
.heading(t!("kernel_install_dialog_heading"))
|
||||
.build();
|
||||
kernel_install_dialog.add_response("kernel_install_dialog_ok", &t!("kernel_install_dialog_ok_label").to_string());
|
||||
kernel_install_dialog
|
||||
.add_response("kernel_install_dialog_reboot", &t!("kernel_install_dialog_reboot_label").to_string());
|
||||
kernel_install_dialog.set_response_appearance(
|
||||
"kernel_install_dialog_reboot",
|
||||
adw::ResponseAppearance::Suggested,
|
||||
);
|
||||
//
|
||||
|
||||
//
|
||||
let log_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
log_loop_context.spawn_local(clone!(@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_receiver => async move {
|
||||
while let Ok(state) = log_loop_receiver.recv().await {
|
||||
kernel_install_log_terminal_buffer.insert(&mut kernel_install_log_terminal_buffer.end_iter(), &("\n".to_string() + &state))
|
||||
}
|
||||
}));
|
||||
|
||||
let log_status_loop_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
log_status_loop_context.spawn_local(clone!(@weak kernel_install_dialog, @strong log_status_loop_receiver => async move {
|
||||
while let Ok(state) = log_status_loop_receiver.recv().await {
|
||||
if state == true {
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true);
|
||||
//if get_current_username().unwrap() == "pikaos" {
|
||||
// kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
//} else {
|
||||
// kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
|
||||
//}
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
|
||||
kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_successful").to_string());
|
||||
} else {
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true);
|
||||
kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_failed").to_string());
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
}
|
||||
//
|
||||
kernel_install_button.connect_clicked(clone!(@weak kernel_install_log_terminal,@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong kernel_packages => move |_| {
|
||||
kernel_install_log_terminal_buffer.delete(&mut kernel_install_log_terminal_buffer.bounds().0, &mut kernel_install_log_terminal_buffer.bounds().1);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", false);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
kernel_install_dialog.set_body("");
|
||||
kernel_install_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "kernel_install_dialog_reboot" {
|
||||
Command::new("systemctl")
|
||||
.arg("reboot")
|
||||
.spawn()
|
||||
.expect("systemctl reboot failed to start");
|
||||
}
|
||||
}));
|
||||
//
|
||||
kernel_install_log_terminal_buffer.connect_changed(clone!(@weak kernel_install_log_terminal, @weak kernel_install_log_terminal_buffer,@weak kernel_install_log_terminal_scroll => move |_|{
|
||||
if kernel_install_log_terminal_scroll.vadjustment().upper() - kernel_install_log_terminal_scroll.vadjustment().value() > 100.0 {
|
||||
kernel_install_log_terminal_scroll.vadjustment().set_value(kernel_install_log_terminal_scroll.vadjustment().upper())
|
||||
});
|
||||
let log_status_loop_sender_clone = log_status_loop_sender.clone();
|
||||
let log_loop_sender_clone= log_loop_sender.clone();
|
||||
let kernel_packages_clone = kernel_packages.clone();
|
||||
std::thread::spawn(move || {
|
||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
||||
match command {
|
||||
Ok(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_failed"));
|
||||
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
kernel_remove_button.connect_clicked(clone!(@weak kernel_install_log_terminal,@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong kernel_packages => move |_| {
|
||||
kernel_install_log_terminal_buffer.delete(&mut kernel_install_log_terminal_buffer.bounds().0, &mut kernel_install_log_terminal_buffer.bounds().1);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", false);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
kernel_install_dialog.set_body("");
|
||||
kernel_install_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "kernel_install_dialog_reboot" {
|
||||
Command::new("systemctl")
|
||||
.arg("reboot")
|
||||
.spawn()
|
||||
.expect("systemctl reboot failed to start");
|
||||
}
|
||||
});
|
||||
let log_status_loop_sender_clone = log_status_loop_sender.clone();
|
||||
let log_loop_sender_clone= log_loop_sender.clone();
|
||||
let kernel_packages_clone = kernel_packages.clone();
|
||||
std::thread::spawn(move || {
|
||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
||||
match command {
|
||||
Ok(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_failed"));
|
||||
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
if cpu_feature_level >= kernel_min_x86_march {
|
||||
boxedlist.append(&kernel_expander_row);
|
||||
}
|
||||
}));
|
||||
//
|
||||
kernel_install_button.connect_clicked(clone!(@weak kernel_install_log_terminal,@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong kernel_packages => move |_| {
|
||||
kernel_install_log_terminal_buffer.delete(&mut kernel_install_log_terminal_buffer.bounds().0, &mut kernel_install_log_terminal_buffer.bounds().1);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", false);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
kernel_install_dialog.set_body("");
|
||||
kernel_install_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "kernel_install_dialog_reboot" {
|
||||
Command::new("systemctl")
|
||||
.arg("reboot")
|
||||
.spawn()
|
||||
.expect("systemctl reboot failed to start");
|
||||
}
|
||||
});
|
||||
let log_status_loop_sender_clone = log_status_loop_sender.clone();
|
||||
let log_loop_sender_clone= log_loop_sender.clone();
|
||||
let kernel_packages_clone = kernel_packages.clone();
|
||||
std::thread::spawn(move || {
|
||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
||||
match command {
|
||||
Ok(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_failed"));
|
||||
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
kernel_remove_button.connect_clicked(clone!(@weak kernel_install_log_terminal,@weak kernel_install_log_terminal_buffer, @weak kernel_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong kernel_packages => move |_| {
|
||||
kernel_install_log_terminal_buffer.delete(&mut kernel_install_log_terminal_buffer.bounds().0, &mut kernel_install_log_terminal_buffer.bounds().1);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", false);
|
||||
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
|
||||
kernel_install_dialog.set_body("");
|
||||
kernel_install_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "kernel_install_dialog_reboot" {
|
||||
Command::new("systemctl")
|
||||
.arg("reboot")
|
||||
.spawn()
|
||||
.expect("systemctl reboot failed to start");
|
||||
}
|
||||
});
|
||||
let log_status_loop_sender_clone = log_status_loop_sender.clone();
|
||||
let log_loop_sender_clone= log_loop_sender.clone();
|
||||
let kernel_packages_clone = kernel_packages.clone();
|
||||
std::thread::spawn(move || {
|
||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
||||
match command {
|
||||
Ok(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("{}", t!("log_status_kernel_modify_failed"));
|
||||
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
if cpu_feature_level >= kernel_min_x86_march {
|
||||
boxedlist.append(&kernel_expander_row);
|
||||
}
|
||||
}
|
||||
};
|
||||
}));
|
||||
|
||||
let kernel_package_done_context = MainContext::default();
|
||||
kernel_package_done_context.spawn_local(clone!(@weak parse_loading_dialog => async move {
|
||||
while let Ok(_state) = kernel_package_done_receiver.recv().await {
|
||||
parse_loading_dialog.close();
|
||||
}
|
||||
}));
|
||||
|
||||
searchbar.connect_search_changed(clone!(@weak searchbar, @weak boxedlist => move |_| {
|
||||
let mut counter = boxedlist.first_child();
|
||||
|
@ -69,6 +69,15 @@ struct KernelBranch {
|
||||
init_script: String,
|
||||
}
|
||||
|
||||
struct KernelPackage {
|
||||
name: String,
|
||||
main_package: String,
|
||||
packages: String,
|
||||
min_x86_march: u32,
|
||||
package_version: String,
|
||||
description: String
|
||||
}
|
||||
|
||||
fn main() -> glib::ExitCode {
|
||||
let current_locale = match env::var_os("LANG") {
|
||||
Some(v) => v.into_string().unwrap().chars()
|
||||
|
Loading…
Reference in New Issue
Block a user