Don't wait for return of spawned commands
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 1m53s

This commit is contained in:
Ward from fusion-voyager-3 2024-10-12 00:17:02 +03:00
parent f6e0cc6750
commit 32489a54f5
10 changed files with 59 additions and 224 deletions

View File

@ -1 +1 @@
7 8

View File

@ -16,7 +16,7 @@
"icon": "pika-desktop", "icon": "pika-desktop",
"button": "launch-label", "button": "launch-label",
"onlyin": "gnome", "onlyin": "gnome",
"command": "/usr/bin/pika-gnome-layouts &" "command": "/usr/bin/pika-gnome-layouts"
}, },
{ {
"id": 2, "id": 2,

View File

@ -30,7 +30,7 @@
"subtitle": "open-kernel-manager-subtitle", "subtitle": "open-kernel-manager-subtitle",
"icon": "com.github.pikaos-linux.pika-kernel-manager", "icon": "com.github.pikaos-linux.pika-kernel-manager",
"button": "launch-label", "button": "launch-label",
"command": "pika-kernel-manager &" "command": "pika-kernel-manager"
}, },
{ {
"id": 3, "id": 3,

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
pika-welcome (5.0.0-101pika5) pika; urgency=low pika-welcome (5.0.0-101pika6) pika; urgency=low
* Port to PikaOS 4 * Port to PikaOS 4

View File

@ -1,11 +1,9 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use duct::cmd;
use glib::*; use glib::*;
use serde::Deserialize; use serde::Deserialize;
use std::fs; use std::fs;
use std::path::Path;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)] #[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)]
@ -20,7 +18,6 @@ struct community_entry {
pub fn community_page( pub fn community_page(
community_content_page_stack: &gtk::Stack, community_content_page_stack: &gtk::Stack,
window: &adw::ApplicationWindow,
) { ) {
let community_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build(); let community_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build();
@ -61,11 +58,6 @@ pub fn community_page(
let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
for community_entry in json_array { for community_entry in json_array {
let (entry_command_status_loop_sender, entry_command_status_loop_receiver) =
async_channel::unbounded();
let entry_command_status_loop_sender: async_channel::Sender<bool> =
entry_command_status_loop_sender.clone();
let entry_title = community_entry.title; let entry_title = community_entry.title;
let entry_subtitle = community_entry.subtitle; let entry_subtitle = community_entry.subtitle;
let entry_icon = community_entry.icon; let entry_icon = community_entry.icon;
@ -92,43 +84,18 @@ pub fn community_page(
entry_row.add_prefix(&entry_row_icon); entry_row.add_prefix(&entry_row_icon);
entry_row.add_suffix(&entry_row_button); entry_row.add_suffix(&entry_row_button);
entry_row_button.connect_clicked(clone!(@strong entry_command, @weak window => move |_| { entry_row_button.connect_clicked(clone!(@strong entry_command => move |_| {
gio::spawn_blocking(clone!(@strong entry_command_status_loop_sender, @strong entry_command => move || { let entry_command = entry_command.clone();
if Path::new("/tmp/pika-welcome-exec.sh").exists() { std::thread::spawn(move || {
if std::path::Path::new("/tmp/pika-welcome-exec.sh").exists() {
fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
} }
fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file"); fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file");
let _ = cmd!("chmod", "+x", "/tmp/pika-welcome-exec.sh").read(); std::process::Command::new("chmod").args(["+x", "/tmp/pika-welcome-exec.sh"]).status().unwrap();
let command = cmd!("/tmp/pika-welcome-exec.sh").run(); std::process::Command::new("/tmp/pika-welcome-exec.sh").spawn().unwrap();
if command.is_err() { });
entry_command_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
} else {
entry_command_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
}
}));
})); }));
let cmd_err_dialog = adw::MessageDialog::builder()
.body(t!("cmd_err_dialog_body"))
.heading(t!("cmd_err_dialog_heading"))
.transient_for(window)
.build();
cmd_err_dialog.add_response(
"cmd_err_dialog_ok",
&t!("cmd_err_dialog_ok_label").to_string(),
);
let entry_command_status_loop_context = MainContext::default();
// The main loop executes the asynchronous block
entry_command_status_loop_context.spawn_local(
clone!(@weak cmd_err_dialog, @strong entry_command_status_loop_receiver => async move {
while let Ok(state) = entry_command_status_loop_receiver.recv().await {
if state == false {
cmd_err_dialog.present();
}
}
}),
);
community_page_listbox.append(&entry_row) community_page_listbox.append(&entry_row)
} }

View File

@ -1,11 +1,9 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use duct::cmd;
use glib::*; use glib::*;
use serde::Deserialize; use serde::Deserialize;
use std::fs; use std::fs;
use std::path::Path;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)] #[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)]
@ -20,7 +18,6 @@ struct contribute_entry {
pub fn contribute_page( pub fn contribute_page(
contribute_content_page_stack: &gtk::Stack, contribute_content_page_stack: &gtk::Stack,
window: &adw::ApplicationWindow,
) { ) {
let contribute_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build(); let contribute_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build();
@ -61,11 +58,6 @@ pub fn contribute_page(
let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
for contribute_entry in json_array { for contribute_entry in json_array {
let (entry_command_status_loop_sender, entry_command_status_loop_receiver) =
async_channel::unbounded();
let entry_command_status_loop_sender: async_channel::Sender<bool> =
entry_command_status_loop_sender.clone();
let entry_title = contribute_entry.title; let entry_title = contribute_entry.title;
let entry_subtitle = contribute_entry.subtitle; let entry_subtitle = contribute_entry.subtitle;
let entry_icon = contribute_entry.icon; let entry_icon = contribute_entry.icon;
@ -92,43 +84,18 @@ pub fn contribute_page(
entry_row.add_prefix(&entry_row_icon); entry_row.add_prefix(&entry_row_icon);
entry_row.add_suffix(&entry_row_button); entry_row.add_suffix(&entry_row_button);
entry_row_button.connect_clicked(clone!(@strong entry_command, @weak window => move |_| { entry_row_button.connect_clicked(clone!(@strong entry_command => move |_| {
gio::spawn_blocking(clone!(@strong entry_command_status_loop_sender, @strong entry_command => move || { let entry_command = entry_command.clone();
if Path::new("/tmp/pika-welcome-exec.sh").exists() { std::thread::spawn(move || {
if std::path::Path::new("/tmp/pika-welcome-exec.sh").exists() {
fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
} }
fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file"); fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file");
let _ = cmd!("chmod", "+x", "/tmp/pika-welcome-exec.sh").read(); std::process::Command::new("chmod").args(["+x", "/tmp/pika-welcome-exec.sh"]).status().unwrap();
let command = cmd!("/tmp/pika-welcome-exec.sh").run(); std::process::Command::new("/tmp/pika-welcome-exec.sh").spawn().unwrap();
if command.is_err() { });
entry_command_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
} else {
entry_command_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
}
}));
})); }));
let cmd_err_dialog = adw::MessageDialog::builder()
.body(t!("cmd_err_dialog_body"))
.heading(t!("cmd_err_dialog_heading"))
.transient_for(window)
.build();
cmd_err_dialog.add_response(
"cmd_err_dialog_ok",
&t!("cmd_err_dialog_ok_label").to_string(),
);
let entry_command_status_loop_context = MainContext::default();
// The main loop executes the asynchronous block
entry_command_status_loop_context.spawn_local(
clone!(@weak cmd_err_dialog, @strong entry_command_status_loop_receiver => async move {
while let Ok(state) = entry_command_status_loop_receiver.recv().await {
if state == false {
cmd_err_dialog.present();
}
}
}),
);
contribute_page_listbox.append(&entry_row) contribute_page_listbox.append(&entry_row)
} }

View File

@ -1,10 +1,8 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use duct::cmd;
use glib::*; use glib::*;
use serde::Deserialize; use serde::Deserialize;
use std::path::Path;
use std::{env, fs}; use std::{env, fs};
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
@ -21,7 +19,6 @@ struct look_and_feel_entry {
pub fn look_and_feel_page( pub fn look_and_feel_page(
look_and_feel_content_page_stack: &gtk::Stack, look_and_feel_content_page_stack: &gtk::Stack,
window: &adw::ApplicationWindow,
) { ) {
let look_and_feel_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build(); let look_and_feel_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build();
@ -62,11 +59,6 @@ pub fn look_and_feel_page(
let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
for look_and_feel_entry in json_array { for look_and_feel_entry in json_array {
let (entry_command_status_loop_sender, entry_command_status_loop_receiver) =
async_channel::unbounded();
let entry_command_status_loop_sender: async_channel::Sender<bool> =
entry_command_status_loop_sender.clone();
let entry_title = look_and_feel_entry.title; let entry_title = look_and_feel_entry.title;
let entry_subtitle = look_and_feel_entry.subtitle; let entry_subtitle = look_and_feel_entry.subtitle;
let entry_icon = look_and_feel_entry.icon; let entry_icon = look_and_feel_entry.icon;
@ -95,43 +87,18 @@ pub fn look_and_feel_page(
entry_row.add_prefix(&entry_row_icon); entry_row.add_prefix(&entry_row_icon);
entry_row.add_suffix(&entry_row_button); entry_row.add_suffix(&entry_row_button);
entry_row_button.connect_clicked(clone!(@strong entry_command, @weak window => move |_| { entry_row_button.connect_clicked(clone!(@strong entry_command => move |_| {
gio::spawn_blocking(clone!(@strong entry_command_status_loop_sender, @strong entry_command => move || { let entry_command = entry_command.clone();
if Path::new("/tmp/pika-welcome-exec.sh").exists() { std::thread::spawn(move || {
if std::path::Path::new("/tmp/pika-welcome-exec.sh").exists() {
fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
} }
fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file"); fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file");
let _ = cmd!("chmod", "+x", "/tmp/pika-welcome-exec.sh").read(); std::process::Command::new("chmod").args(["+x", "/tmp/pika-welcome-exec.sh"]).status().unwrap();
let command = cmd!("/tmp/pika-welcome-exec.sh").run(); std::process::Command::new("/tmp/pika-welcome-exec.sh").spawn().unwrap();
if command.is_err() { });
entry_command_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
} else {
entry_command_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
}
}));
})); }));
let cmd_err_dialog = adw::MessageDialog::builder()
.body(t!("cmd_err_dialog_body"))
.heading(t!("cmd_err_dialog_heading"))
.transient_for(window)
.build();
cmd_err_dialog.add_response(
"cmd_err_dialog_ok",
&t!("cmd_err_dialog_ok_label").to_string(),
);
let entry_command_status_loop_context = MainContext::default();
// The main loop executes the asynchronous block
entry_command_status_loop_context.spawn_local(
clone!(@weak cmd_err_dialog, @strong entry_command_status_loop_receiver => async move {
while let Ok(state) = entry_command_status_loop_receiver.recv().await {
if state == false {
cmd_err_dialog.present();
}
}
}),
);
let current_desktop = match env::var_os("XDG_SESSION_DESKTOP") { let current_desktop = match env::var_os("XDG_SESSION_DESKTOP") {
Some(v) => v.into_string().unwrap(), Some(v) => v.into_string().unwrap(),
None => panic!("XDG_SESSION_DESKTOP is not set"), None => panic!("XDG_SESSION_DESKTOP is not set"),

View File

@ -213,10 +213,10 @@ pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: &gtk::
&window_banner, &window_banner,
&internet_connected, &internet_connected,
); );
setup_steps_page(&welcome_content_page_stack, &window); setup_steps_page(&welcome_content_page_stack);
recommended_addons_page(&welcome_content_page_stack, &window); recommended_addons_page(&welcome_content_page_stack, &window);
look_and_feel_page(&welcome_content_page_stack, &window); look_and_feel_page(&welcome_content_page_stack);
troubleshoot_page(&welcome_content_page_stack, &window); troubleshoot_page(&welcome_content_page_stack);
community_page(&welcome_content_page_stack, &window); community_page(&welcome_content_page_stack);
contribute_page(&welcome_content_page_stack, &window); contribute_page(&welcome_content_page_stack);
} }

View File

@ -1,11 +1,9 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use duct::cmd;
use glib::*; use glib::*;
use serde::Deserialize; use serde::Deserialize;
use std::fs; use std::fs;
use std::path::Path;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)] #[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)]
@ -20,7 +18,6 @@ struct setup_steps_entry {
pub fn setup_steps_page( pub fn setup_steps_page(
setup_steps_content_page_stack: &gtk::Stack, setup_steps_content_page_stack: &gtk::Stack,
window: &adw::ApplicationWindow,
) { ) {
let setup_steps_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build(); let setup_steps_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build();
@ -60,11 +57,6 @@ pub fn setup_steps_page(
let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
for setup_steps_entry in json_array { for setup_steps_entry in json_array {
let (entry_command_status_loop_sender, entry_command_status_loop_receiver) =
async_channel::unbounded();
let entry_command_status_loop_sender: async_channel::Sender<bool> =
entry_command_status_loop_sender.clone();
let entry_title = setup_steps_entry.title; let entry_title = setup_steps_entry.title;
let entry_subtitle = setup_steps_entry.subtitle; let entry_subtitle = setup_steps_entry.subtitle;
let entry_icon = setup_steps_entry.icon; let entry_icon = setup_steps_entry.icon;
@ -91,43 +83,18 @@ pub fn setup_steps_page(
entry_row.add_prefix(&entry_row_icon); entry_row.add_prefix(&entry_row_icon);
entry_row.add_suffix(&entry_row_button); entry_row.add_suffix(&entry_row_button);
entry_row_button.connect_clicked(clone!(@strong entry_command, @weak window => move |_| { entry_row_button.connect_clicked(clone!(@strong entry_command => move |_| {
gio::spawn_blocking(clone!(@strong entry_command_status_loop_sender, @strong entry_command => move || { let entry_command = entry_command.clone();
if Path::new("/tmp/pika-welcome-exec.sh").exists() { std::thread::spawn(move || {
if std::path::Path::new("/tmp/pika-welcome-exec.sh").exists() {
fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
} }
fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file"); fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file");
let _ = cmd!("chmod", "+x", "/tmp/pika-welcome-exec.sh").read(); std::process::Command::new("chmod").args(["+x", "/tmp/pika-welcome-exec.sh"]).status().unwrap();
let command = cmd!("/tmp/pika-welcome-exec.sh").run(); std::process::Command::new("/tmp/pika-welcome-exec.sh").spawn().unwrap();
if command.is_err() { });
entry_command_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
} else {
entry_command_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
}
}));
})); }));
let cmd_err_dialog = adw::MessageDialog::builder()
.body(t!("cmd_err_dialog_body"))
.heading(t!("cmd_err_dialog_heading"))
.transient_for(window)
.build();
cmd_err_dialog.add_response(
"cmd_err_dialog_ok",
&t!("cmd_err_dialog_ok_label").to_string(),
);
let entry_command_status_loop_context = MainContext::default();
// The main loop executes the asynchronous block
entry_command_status_loop_context.spawn_local(
clone!(@weak cmd_err_dialog, @strong entry_command_status_loop_receiver => async move {
while let Ok(state) = entry_command_status_loop_receiver.recv().await {
if state == false {
cmd_err_dialog.present();
}
}
}),
);
setup_steps_page_listbox.append(&entry_row) setup_steps_page_listbox.append(&entry_row)
} }

View File

@ -1,11 +1,9 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use duct::cmd;
use glib::*; use glib::*;
use serde::Deserialize; use serde::Deserialize;
use std::fs; use std::fs;
use std::path::Path;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)] #[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd, Deserialize)]
@ -20,7 +18,6 @@ struct troubleshoot_entry {
pub fn troubleshoot_page( pub fn troubleshoot_page(
troubleshoot_content_page_stack: &gtk::Stack, troubleshoot_content_page_stack: &gtk::Stack,
window: &adw::ApplicationWindow,
) { ) {
let troubleshoot_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build(); let troubleshoot_page_box = gtk::Box::builder().vexpand(true).hexpand(true).build();
@ -60,11 +57,6 @@ pub fn troubleshoot_page(
let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let entry_buttons_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
for troubleshoot_entry in json_array { for troubleshoot_entry in json_array {
let (entry_command_status_loop_sender, entry_command_status_loop_receiver) =
async_channel::unbounded();
let entry_command_status_loop_sender: async_channel::Sender<bool> =
entry_command_status_loop_sender.clone();
let entry_title = troubleshoot_entry.title; let entry_title = troubleshoot_entry.title;
let entry_subtitle = troubleshoot_entry.subtitle; let entry_subtitle = troubleshoot_entry.subtitle;
let entry_icon = troubleshoot_entry.icon; let entry_icon = troubleshoot_entry.icon;
@ -91,43 +83,18 @@ pub fn troubleshoot_page(
entry_row.add_prefix(&entry_row_icon); entry_row.add_prefix(&entry_row_icon);
entry_row.add_suffix(&entry_row_button); entry_row.add_suffix(&entry_row_button);
entry_row_button.connect_clicked(clone!(@strong entry_command, @weak window => move |_| { entry_row_button.connect_clicked(clone!(@strong entry_command => move |_| {
gio::spawn_blocking(clone!(@strong entry_command_status_loop_sender, @strong entry_command => move || { let entry_command = entry_command.clone();
if Path::new("/tmp/pika-welcome-exec.sh").exists() { std::thread::spawn(move || {
if std::path::Path::new("/tmp/pika-welcome-exec.sh").exists() {
fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); fs::remove_file("/tmp/pika-welcome-exec.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
} }
fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file"); fs::write("/tmp/pika-welcome-exec.sh", "#! /bin/bash\nset -e\n".to_owned() + &entry_command).expect("Unable to write file");
let _ = cmd!("chmod", "+x", "/tmp/pika-welcome-exec.sh").read(); std::process::Command::new("chmod").args(["+x", "/tmp/pika-welcome-exec.sh"]).status().unwrap();
let command = cmd!("/tmp/pika-welcome-exec.sh").run(); std::process::Command::new("/tmp/pika-welcome-exec.sh").spawn().unwrap();
if command.is_err() { });
entry_command_status_loop_sender.send_blocking(false).expect("The channel needs to be open.");
} else {
entry_command_status_loop_sender.send_blocking(true).expect("The channel needs to be open.");
}
}));
})); }));
let cmd_err_dialog = adw::MessageDialog::builder()
.body(t!("cmd_err_dialog_body"))
.heading(t!("cmd_err_dialog_heading"))
.transient_for(window)
.build();
cmd_err_dialog.add_response(
"cmd_err_dialog_ok",
&t!("cmd_err_dialog_ok_label").to_string(),
);
let entry_command_status_loop_context = MainContext::default();
// The main loop executes the asynchronous block
entry_command_status_loop_context.spawn_local(
clone!(@weak cmd_err_dialog, @strong entry_command_status_loop_receiver => async move {
while let Ok(state) = entry_command_status_loop_receiver.recv().await {
if state == false {
cmd_err_dialog.present();
}
}
}),
);
troubleshoot_page_listbox.append(&entry_row) troubleshoot_page_listbox.append(&entry_row)
} }