make list reload on edit

This commit is contained in:
Ward from fusion-voyager-3 2024-09-24 21:10:10 +03:00
parent bc6838097e
commit 3e211fd094
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@ use std::path::Path;
pub fn deb822_edit_dialog_fn( pub fn deb822_edit_dialog_fn(
window: adw::ApplicationWindow, window: adw::ApplicationWindow,
deb822_repo: &Deb822Repository, deb822_repo: &Deb822Repository,
reload_action: &gio::SimpleAction,
) { ) {
let repofile_path = Path::new(&deb822_repo.filepath); let repofile_path = Path::new(&deb822_repo.filepath);
let repo_file_name = repofile_path let repo_file_name = repofile_path
@ -340,6 +341,8 @@ pub fn deb822_edit_dialog_fn(
// //
let deb822_repo_clone0 = deb822_repo.clone(); let deb822_repo_clone0 = deb822_repo.clone();
let reload_action_clone0 = reload_action.clone();
unofficial_source_add_dialog.clone() unofficial_source_add_dialog.clone()
.choose(None::<&gio::Cancellable>, move |choice| { .choose(None::<&gio::Cancellable>, move |choice| {
match choice.as_str() { match choice.as_str() {
@ -391,6 +394,7 @@ pub fn deb822_edit_dialog_fn(
apt_src_create_error_dialog.present(); apt_src_create_error_dialog.present();
} }
} }
reload_action_clone0.activate(None);
} }
Err(e) => { Err(e) => {
let apt_src_create_error_dialog = adw::MessageDialog::builder() let apt_src_create_error_dialog = adw::MessageDialog::builder()
@ -402,6 +406,7 @@ pub fn deb822_edit_dialog_fn(
&t!("apt_src_create_error_dialog_ok_label").to_string(), &t!("apt_src_create_error_dialog_ok_label").to_string(),
); );
apt_src_create_error_dialog.present(); apt_src_create_error_dialog.present();
reload_action_clone0.activate(None);
} }
} }
} }

View File

@ -347,7 +347,7 @@ pub fn apt_manage_page(
let apt_src: Ref<AptSourceConfig> = item.borrow(); let apt_src: Ref<AptSourceConfig> = item.borrow();
match apt_src.deref() { match apt_src.deref() {
AptSourceConfig::DEB822(src) => { AptSourceConfig::DEB822(src) => {
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src); deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &reload_unofficial_action);
} }
AptSourceConfig::Legacy(list) => {} AptSourceConfig::Legacy(list) => {}
}; };