fix 2 flatpak runs

This commit is contained in:
Ward from fusion-voyager-3 2024-10-02 00:00:40 +03:00
parent d24efe2f8c
commit 23fc06078e
2 changed files with 15 additions and 3 deletions

View File

@ -22,7 +22,8 @@ use libflatpak::InstalledRef;
pub fn add_dialog_fn( pub fn add_dialog_fn(
window: adw::ApplicationWindow, window: adw::ApplicationWindow,
reload_action: &gio::SimpleAction reload_action: &gio::SimpleAction,
flatpak_retry_signal_action: &SimpleAction,
) )
{ {
let flatpak_remote_add_dialog_child_box = Box::builder() let flatpak_remote_add_dialog_child_box = Box::builder()
@ -159,6 +160,7 @@ pub fn add_dialog_fn(
flatpak_remote_add_dialog_child_box.append(&flatpak_remote_add_box2); flatpak_remote_add_dialog_child_box.append(&flatpak_remote_add_box2);
let reload_action_clone0 = reload_action.clone(); let reload_action_clone0 = reload_action.clone();
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
flatpak_remote_add_dialog.clone() flatpak_remote_add_dialog.clone()
.choose(None::<&gio::Cancellable>, move |choice| { .choose(None::<&gio::Cancellable>, move |choice| {
@ -210,6 +212,7 @@ pub fn add_dialog_fn(
match duct::cmd!("flatpak", "remote-add", "--if-not-exists", &flatpak_installation, &flatpak_remote_add_name_entry.text(), &flatpak_remote_add_url_entry.text()).run() { match duct::cmd!("flatpak", "remote-add", "--if-not-exists", &flatpak_installation, &flatpak_remote_add_name_entry.text(), &flatpak_remote_add_url_entry.text()).run() {
Ok(_) => { Ok(_) => {
reload_action_clone0.activate(None); reload_action_clone0.activate(None);
flatpak_retry_signal_action_clone0.activate(None);
} }
Err(e) => { Err(e) => {
let flatpak_remote_add_error_dialog = adw::MessageDialog::builder() let flatpak_remote_add_error_dialog = adw::MessageDialog::builder()

View File

@ -32,8 +32,9 @@ enum FlatpakRemote {
pub fn flatpak_manage_page( pub fn flatpak_manage_page(
window: adw::ApplicationWindow, window: adw::ApplicationWindow,
retry_signal_action: &SimpleAction, flatpak_retry_signal_action: &SimpleAction,
) -> gtk::Box { ) -> gtk::Box {
let retry_signal_action = gio::SimpleAction::new("flatpak_manage_action", None);
let cancellable_no = libflatpak::gio::Cancellable::NONE; let cancellable_no = libflatpak::gio::Cancellable::NONE;
let main_box = Box::builder() let main_box = Box::builder()
@ -304,12 +305,15 @@ pub fn flatpak_manage_page(
window, window,
#[strong] #[strong]
retry_signal_action, retry_signal_action,
#[strong]
flatpak_retry_signal_action,
move move
|_| |_|
{ {
add_dialog::add_dialog_fn( add_dialog::add_dialog_fn(
window.clone(), window.clone(),
&retry_signal_action &retry_signal_action,
&flatpak_retry_signal_action,
); );
} }
) )
@ -323,6 +327,8 @@ pub fn flatpak_manage_page(
#[strong] #[strong]
retry_signal_action, retry_signal_action,
#[strong] #[strong]
flatpak_retry_signal_action,
#[strong]
cancellable_no, cancellable_no,
move move
|_| |_|
@ -346,6 +352,7 @@ pub fn flatpak_manage_page(
match libflatpak::Installation::remove_remote(&installation, &remote_name, cancellable_no) { match libflatpak::Installation::remove_remote(&installation, &remote_name, cancellable_no) {
Ok(_) => { Ok(_) => {
retry_signal_action.activate(None); retry_signal_action.activate(None);
flatpak_retry_signal_action.activate(None);
} }
Err(e) => { Err(e) => {
match e.matches(libflatpak::Error::RemoteUsed) { match e.matches(libflatpak::Error::RemoteUsed) {
@ -367,6 +374,7 @@ pub fn flatpak_manage_page(
adw::ResponseAppearance::Destructive, adw::ResponseAppearance::Destructive,
); );
let retry_signal_action_clone0 = retry_signal_action.clone(); let retry_signal_action_clone0 = retry_signal_action.clone();
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
flatpak_remote_add_error_dialog.clone() flatpak_remote_add_error_dialog.clone()
.choose(None::<&gio::Cancellable>, move |choice| { .choose(None::<&gio::Cancellable>, move |choice| {
match choice.as_str() { match choice.as_str() {
@ -374,6 +382,7 @@ pub fn flatpak_manage_page(
match duct::cmd!("flatpak", "remote-delete", "--force", "--noninteractive", &cmd_installation, &remote_name).run() { match duct::cmd!("flatpak", "remote-delete", "--force", "--noninteractive", &cmd_installation, &remote_name).run() {
Ok(_) => { Ok(_) => {
retry_signal_action_clone0.activate(None); retry_signal_action_clone0.activate(None);
flatpak_retry_signal_action_clone0.activate(None);
} }
Err(e) => { Err(e) => {
let flatpak_remote_add_error_dialog = adw::MessageDialog::builder() let flatpak_remote_add_error_dialog = adw::MessageDialog::builder()