diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9875144..4bac60d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,7 +9,6 @@
-
@@ -112,7 +111,7 @@
-
+
diff --git a/src/apt_update_page/mod.rs b/src/apt_update_page/mod.rs
index fa0d8cd..2d2dbc6 100644
--- a/src/apt_update_page/mod.rs
+++ b/src/apt_update_page/mod.rs
@@ -1,3 +1,4 @@
+use std::rc::Rc;
use crate::apt_package_row::AptPackageRow;
use adw::gio::Action;
use adw::prelude::*;
@@ -15,6 +16,7 @@ use std::process::Command;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::{fs, thread};
+use std::ops::Deref;
use tokio::io::AsyncReadExt;
use tokio::net::{UnixListener, UnixStream};
use tokio::runtime::Runtime;
@@ -32,7 +34,7 @@ pub struct AptPackageSocket {
pub installed_size: u64,
pub is_last: bool,
}
-pub fn apt_update_page(window: adw::ApplicationWindow) -> gtk::Box {
+pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: >k::Button) -> gtk::Box {
let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::();
let update_percent_sender = update_percent_sender.clone();
let (update_status_sender, update_status_receiver) = async_channel::unbounded::();
@@ -135,6 +137,23 @@ pub fn apt_update_page(window: adw::ApplicationWindow) -> gtk::Box {
.width_request(500)
.build();
+ apt_update_dialog.add_response("apt_update_dialog_retry", &t!("apt_update_dialog_retry_label").to_string());
+
+ apt_update_dialog.set_response_appearance(
+ "apt_update_dialog_retry",
+ adw::ResponseAppearance::Suggested,
+ );
+
+ apt_update_dialog.set_response_enabled("apt_update_dialog_retry", false);
+
+ let retry_signal_action0 = retry_signal_action.clone();
+
+ apt_update_dialog.clone().choose(None::<&gio::Cancellable>, move |choice| {
+ if choice == "apt_update_dialog_retry" {
+ retry_signal_action0.emit_by_name("clicked", &[])
+ }
+ });
+
let bottom_bar = gtk::Box::builder()
.valign(Align::End)
.build();
@@ -219,8 +238,8 @@ pub fn apt_update_page(window: adw::ApplicationWindow) -> gtk::Box {
"FN_OVERRIDE_SUCCESSFUL" => {}
"FN_OVERRIDE_FAILED" => {
apt_update_dialog_child_box.set_visible(false);
- apt_update_dialog.set_title(Some(&t!("apt_update_dialog_status_failed").to_string()))
- //apt_update_dialog.add_response("apt_update_dialog_retry", &t!("apt_update_dialog_retry_label").to_string());
+ apt_update_dialog.set_title(Some(&t!("apt_update_dialog_status_failed").to_string()));
+ apt_update_dialog.set_response_enabled("apt_update_dialog_retry", true);
}
_ => apt_update_dialog.set_body(&state)
}
diff --git a/src/build_ui/mod.rs b/src/build_ui/mod.rs
index 0e7955f..4b4b12f 100644
--- a/src/build_ui/mod.rs
+++ b/src/build_ui/mod.rs
@@ -1,11 +1,13 @@
+use crate::glib::closure_local;
use crate::apt_update_page;
use crate::apt_update_page::apt_update_page;
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
use adw::prelude::*;
use adw::*;
use gtk::glib::{clone, MainContext};
-use gtk::{License, Orientation};
+use gtk::{License, Orientation, SignalAction};
use std::cell::RefCell;
+use std::ops::Deref;
use std::process::Command;
use std::rc::Rc;
use std::thread;
@@ -122,13 +124,21 @@ pub fn build_ui(app: &adw::Application) {
.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
// show the window
+
window.present();
// Apt Update Page
+
+ let apt_retry_signal_action = gtk::Button::builder().build();
+
let apt_update_view_stack_bin = adw::Bin::builder()
- .child(&apt_update_page::apt_update_page(window))
+ .child(&apt_update_page::apt_update_page(window.clone(), &apt_retry_signal_action))
.build();
+ apt_retry_signal_action.connect_clicked(clone!(@weak window, @strong apt_retry_signal_action, @strong apt_update_view_stack_bin => move |_| {
+ apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(window, &apt_retry_signal_action)));
+ }));
+
window_adw_view_stack.add_titled_with_icon(&apt_update_view_stack_bin, Some("apt_update_page"), &t!("apt_update_page_title"), "software-update-available-symbolic");
window_adw_view_stack.add_titled(>k::Image::builder().icon_name("firefox").build(), Some("apt_update_page2"), &t!("apt_update_page_title2"));
}