No drivers detected page
This commit is contained in:
parent
1e8a55ff1e
commit
73e3c6da53
@ -112,7 +112,7 @@ pub fn build_ui(app: &adw::Application) {
|
||||
window.connect_hide(clone!(@weak window => move |_| save_window_size(&window, &glib_settings)));
|
||||
window.connect_hide(clone!(@weak window => move |_| window.destroy()));
|
||||
|
||||
credits_button.connect_clicked(clone!(@weak credits_button => move |_| credits_window.show()));
|
||||
credits_button.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
|
||||
|
||||
let (drive_hws_sender, drive_hws_receiver) = async_channel::unbounded();
|
||||
let drive_hws_sender = drive_hws_sender.clone();
|
||||
@ -124,10 +124,10 @@ pub fn build_ui(app: &adw::Application) {
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
|
||||
let ubuntu_drivers_list_utf8 = String::from_utf8(ubuntu_drivers_list_cli.stdout).unwrap();
|
||||
let ubuntu_drivers_list_utf8 = String::from_utf8(ubuntu_drivers_list_cli.stdout).unwrap_or_default();
|
||||
drive_hws_sender
|
||||
.send_blocking(ubuntu_drivers_list_utf8)
|
||||
.expect("The channel needs to be open.");
|
||||
.expect("channel needs to be open.")
|
||||
});
|
||||
|
||||
window.present();
|
||||
@ -245,6 +245,7 @@ fn get_drivers(
|
||||
driver_array.sort_by(|a, b| b.cmp(a))
|
||||
}
|
||||
|
||||
if !driver_array.is_empty() {
|
||||
driver_array.into_iter().for_each(|driver_package| {
|
||||
let group = device_groups
|
||||
.entry(driver_package.clone().device.to_owned())
|
||||
@ -400,11 +401,7 @@ fn get_drivers(
|
||||
} else {
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_ok", true);
|
||||
driver_install_dialog.set_body(&t!("driver_install_dialog_success_false"));
|
||||
if get_current_username().unwrap() == "pikaos" {
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_reboot", false);
|
||||
} else {
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_reboot", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
@ -415,7 +412,34 @@ fn get_drivers(
|
||||
}
|
||||
}));
|
||||
//
|
||||
driver_install_button.connect_clicked(clone!(@weak driver_install_log_terminal,@weak driver_install_log_terminal_buffer, @weak driver_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender => move |_| {
|
||||
driver_install_button.connect_clicked(clone!(@weak driver_install_log_terminal,@weak driver_install_log_terminal_buffer, @weak driver_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong driver_package_ind => move |_| {
|
||||
driver_install_log_terminal_buffer.delete(&mut driver_install_log_terminal_buffer.bounds().0, &mut driver_install_log_terminal_buffer.bounds().1);
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_ok", false);
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_reboot", false);
|
||||
driver_install_dialog.set_body("");
|
||||
driver_install_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "driver_install_dialog_reboot" {
|
||||
Command::new("systemctl")
|
||||
.arg("reboot")
|
||||
.spawn()
|
||||
.expect("systemctl reboot failed to start");
|
||||
}
|
||||
});
|
||||
gio::spawn_blocking(clone!(@strong log_loop_sender, @strong log_status_loop_sender, @strong driver_package_ind => move || {
|
||||
let command = driver_modify(log_loop_sender, &driver_package_ind);
|
||||
match command {
|
||||
Ok(_) => {
|
||||
println!("Status: Driver modify Successful");
|
||||
log_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("Status: Driver modify Failed");
|
||||
log_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
driver_remove_button.connect_clicked(clone!(@weak driver_install_log_terminal,@weak driver_install_log_terminal_buffer, @weak driver_install_dialog, @strong log_loop_sender, @strong log_status_loop_sender, @strong driver_package_ind => move |_| {
|
||||
driver_install_log_terminal_buffer.delete(&mut driver_install_log_terminal_buffer.bounds().0, &mut driver_install_log_terminal_buffer.bounds().1);
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_ok", false);
|
||||
driver_install_dialog.set_response_enabled("driver_install_dialog_reboot", false);
|
||||
@ -446,6 +470,17 @@ fn get_drivers(
|
||||
drivers_list_row.append(&driver_expander_row);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let window_no_drivers_box_text = adw::StatusPage::builder()
|
||||
.icon_name("face-cool")
|
||||
.title(t!("first_setup_gameutils_box_text_title"))
|
||||
.description(t!("first_setup_gameutils_box_text_description"))
|
||||
.build();
|
||||
window_no_drivers_box_text.add_css_class("compact");
|
||||
|
||||
window_box.append(&window_no_drivers_box_text);
|
||||
}
|
||||
|
||||
main_window.remove(loading_box);
|
||||
main_window.append(&window_box);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user