use crate::design::dialogs::dialogs_spinner::show_spinner_dialog;
use crate::design::dialogs::dialogs_spinner::IndicatorType;
pub fn command_pkexec_spinner(
parent: &adw::ApplicationWindow,
command: Vec<String>,
title: &str,
text: &str
) {
if command.is_empty() { return; }
let mut full_command = vec!["pkexec".to_string()];
full_command.extend(command);
show_spinner_dialog(
parent,
title,
text,
vec![full_command],
IndicatorType::Spinner,
None
);
}
pub fn commands_pkexec_spinner(
parent: &adw::ApplicationWindow,
commands: Vec<Vec<String>>,
title: &str,
text: &str
) {
let full_commands: Vec<Vec<String>> = commands
.into_iter()
.filter(|cmd| !cmd.is_empty())
.map(|cmd| {
let mut pkexec_cmd = vec!["pkexec".to_string()];
pkexec_cmd.extend(cmd);
pkexec_cmd
})
.collect();
show_spinner_dialog(
parent,
title,
text,
full_commands,
IndicatorType::Spinner,
None
);
}
pub fn command_pkexec_progressbar(
parent: &adw::ApplicationWindow,
command: Vec<String>,
title: &str,
text: &str
) {
if command.is_empty() { return; }
let mut full_command = vec!["pkexec".to_string()];
full_command.extend(command);
show_spinner_dialog(
parent,
title,
text,
vec![full_command],
IndicatorType::ProgressBar,
None
);
}
pub fn commands_pkexec_progressbar(
parent: &adw::ApplicationWindow,
commands: Vec<Vec<String>>,
title: &str,
text: &str
) {
let full_commands: Vec<Vec<String>> = commands
.into_iter()
.filter(|cmd| !cmd.is_empty())
.map(|cmd| {
let mut pkexec_cmd = vec!["pkexec".to_string()];
pkexec_cmd.extend(cmd);
pkexec_cmd
})
.collect();
show_spinner_dialog(
parent,
title,
text,
full_commands,
IndicatorType::ProgressBar,
None
);
}