fix apt double run
This commit is contained in:
parent
0a4ff5d59b
commit
d24efe2f8c
@ -19,7 +19,8 @@ use tokio::runtime::Runtime;
|
||||
|
||||
pub fn add_dialog_fn(
|
||||
window: adw::ApplicationWindow,
|
||||
reload_action: &gio::SimpleAction
|
||||
reload_action: &gio::SimpleAction,
|
||||
apt_retry_signal_action: &gio::SimpleAction,
|
||||
)
|
||||
{
|
||||
let unofficial_source_add_dialog_child_box = Box::builder()
|
||||
@ -283,6 +284,7 @@ pub fn add_dialog_fn(
|
||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
||||
|
||||
let reload_action_clone0 = reload_action.clone();
|
||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||
|
||||
unofficial_source_add_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
@ -326,6 +328,8 @@ pub fn add_dialog_fn(
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move_with_wget", &repo_file_name, &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", &repo_file_name)).run() {
|
||||
Ok(_) => {
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
@ -338,6 +342,7 @@ pub fn add_dialog_fn(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -359,6 +364,7 @@ pub fn add_dialog_fn(
|
||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", repo_file_name).run() {
|
||||
Ok(_) => {
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
@ -371,6 +377,7 @@ pub fn add_dialog_fn(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -385,6 +392,7 @@ pub fn add_dialog_fn(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn deb822_edit_dialog_fn(
|
||||
window: adw::ApplicationWindow,
|
||||
deb822_repo: &Deb822Repository,
|
||||
reload_action: &gio::SimpleAction,
|
||||
apt_retry_signal_action: &SimpleAction,
|
||||
) {
|
||||
let repofile_path = Path::new(&deb822_repo.filepath);
|
||||
let repo_file_name = repofile_path
|
||||
@ -342,6 +343,8 @@ pub fn deb822_edit_dialog_fn(
|
||||
let deb822_repo_clone0 = deb822_repo.clone();
|
||||
|
||||
let reload_action_clone0 = reload_action.clone();
|
||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||
|
||||
|
||||
unofficial_source_add_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
@ -395,6 +398,7 @@ pub fn deb822_edit_dialog_fn(
|
||||
}
|
||||
}
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
@ -407,6 +411,7 @@ pub fn deb822_edit_dialog_fn(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub fn legacy_edit_dialog_fn(
|
||||
window: adw::ApplicationWindow,
|
||||
legacy_repo: &LegacyAptSource,
|
||||
reload_action: &gio::SimpleAction,
|
||||
apt_retry_signal_action: &SimpleAction,
|
||||
) {
|
||||
let repofile_path = Path::new(&legacy_repo.filepath);
|
||||
let repo_file_name = repofile_path
|
||||
@ -217,6 +218,7 @@ pub fn legacy_edit_dialog_fn(
|
||||
let legacy_repo_clone0 = legacy_repo.clone();
|
||||
|
||||
let reload_action_clone0 = reload_action.clone();
|
||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||
|
||||
unofficial_source_add_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
@ -251,6 +253,7 @@ pub fn legacy_edit_dialog_fn(
|
||||
}
|
||||
}
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
@ -263,6 +266,7 @@ pub fn legacy_edit_dialog_fn(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
reload_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,9 @@ enum AptSourceConfig {
|
||||
|
||||
pub fn apt_manage_page(
|
||||
window: adw::ApplicationWindow,
|
||||
retry_signal_action: &SimpleAction,
|
||||
apt_retry_signal_action: &SimpleAction,
|
||||
) -> gtk::Box {
|
||||
let retry_signal_action = gio::SimpleAction::new("apt_manage_retry", None);
|
||||
|
||||
let deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
|
||||
|
||||
@ -395,12 +396,15 @@ pub fn apt_manage_page(
|
||||
window,
|
||||
#[strong]
|
||||
retry_signal_action,
|
||||
#[strong]
|
||||
apt_retry_signal_action,
|
||||
move
|
||||
|_|
|
||||
{
|
||||
add_dialog::add_dialog_fn(
|
||||
window.clone(),
|
||||
&retry_signal_action
|
||||
&retry_signal_action,
|
||||
&apt_retry_signal_action
|
||||
);
|
||||
}
|
||||
)
|
||||
@ -413,6 +417,8 @@ pub fn apt_manage_page(
|
||||
unofficial_sources_selection_model_rc,
|
||||
#[strong]
|
||||
retry_signal_action,
|
||||
#[strong]
|
||||
apt_retry_signal_action,
|
||||
move
|
||||
|_|
|
||||
{
|
||||
@ -422,10 +428,10 @@ pub fn apt_manage_page(
|
||||
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
||||
match apt_src.deref() {
|
||||
AptSourceConfig::DEB822(src) => {
|
||||
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &retry_signal_action);
|
||||
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &retry_signal_action, &apt_retry_signal_action);
|
||||
}
|
||||
AptSourceConfig::Legacy(list) => {
|
||||
legacy_edit_dialog::legacy_edit_dialog_fn(window.clone(), list, &retry_signal_action)
|
||||
legacy_edit_dialog::legacy_edit_dialog_fn(window.clone(), list, &retry_signal_action, &apt_retry_signal_action)
|
||||
}
|
||||
};
|
||||
|
||||
@ -440,6 +446,8 @@ pub fn apt_manage_page(
|
||||
unofficial_sources_selection_model_rc,
|
||||
#[strong]
|
||||
retry_signal_action,
|
||||
#[strong]
|
||||
apt_retry_signal_action,
|
||||
move
|
||||
|_|
|
||||
{
|
||||
@ -475,6 +483,7 @@ pub fn apt_manage_page(
|
||||
);
|
||||
apt_src_remove_warning_dialog.set_response_appearance("apt_src_remove_warning_dialog_ok", adw::ResponseAppearance::Destructive);
|
||||
let retry_signal_action_clone0 = retry_signal_action.clone();
|
||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||
apt_src_remove_warning_dialog.clone()
|
||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
match choice.as_str() {
|
||||
@ -482,6 +491,7 @@ pub fn apt_manage_page(
|
||||
match command.run() {
|
||||
Ok(_) => {
|
||||
retry_signal_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None)
|
||||
}
|
||||
Err(e) => {
|
||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||
@ -494,6 +504,7 @@ pub fn apt_manage_page(
|
||||
);
|
||||
apt_src_create_error_dialog.present();
|
||||
retry_signal_action_clone0.activate(None);
|
||||
apt_retry_signal_action_clone0.activate(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user