diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ede3b6e..673adb0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,8 +9,9 @@
-
+
+
@@ -109,7 +110,8 @@
-
+
+
diff --git a/src/apt_update/main.rs b/src/apt_update/main.rs
index c493cc1..8d53a83 100644
--- a/src/apt_update/main.rs
+++ b/src/apt_update/main.rs
@@ -52,7 +52,7 @@ impl<'a> DynAcquireProgress for AptUpdateProgressSocket<'a> {
println!("{}", message);
Runtime::new()
.unwrap()
- .block_on(send_progress_status(message, self.status_socket_path));
+ .block_on(send_progress_status(&message, self.status_socket_path));
}
/// Called when an Item has started to download
@@ -63,7 +63,7 @@ impl<'a> DynAcquireProgress for AptUpdateProgressSocket<'a> {
println!("{}", message);
Runtime::new()
.unwrap()
- .block_on(send_progress_status(message, self.status_socket_path));
+ .block_on(send_progress_status(&message, self.status_socket_path));
}
/// Called when an item is successfully and completely fetched.
@@ -74,7 +74,7 @@ impl<'a> DynAcquireProgress for AptUpdateProgressSocket<'a> {
println!("{}", message);
Runtime::new()
.unwrap()
- .block_on(send_progress_status(message, self.status_socket_path));
+ .block_on(send_progress_status(&message, self.status_socket_path));
}
/// Called when progress has started.
@@ -96,14 +96,21 @@ impl<'a> DynAcquireProgress for AptUpdateProgressSocket<'a> {
/// Print out the ErrorText for the Item.
fn fail(&mut self, item: &ItemDesc) {
let message = format!(
- "Download Failed!: {} {}",
+ "Download Failed: {} {}",
item.description(),
item.short_desc()
);
- eprintln!("{}", message);
+ eprintln!("{}", &message);
Runtime::new()
.unwrap()
- .block_on(send_progress_status(message, self.status_socket_path));
+ .block_on(send_progress_status(&message, self.status_socket_path));
+ Runtime::new()
+ .unwrap()
+ .block_on(send_failed_to_socket(self.percent_socket_path));
+ Runtime::new()
+ .unwrap()
+ .block_on(send_failed_to_socket(self.status_socket_path));
+ panic!("{}", message.to_string())
}
/// Called periodically to provide the overall progress information
@@ -163,7 +170,7 @@ async fn send_progress_percent(progress_f32: f32, socket_path: &str) {
.expect("Failed to write to stream");
}
-async fn send_progress_status(message: String, socket_path: &str) {
+async fn send_progress_status(message: &str, socket_path: &str) {
// Connect to the Unix socket
let mut stream = UnixStream::connect(socket_path)
.await
diff --git a/src/apt_update_page/mod.rs b/src/apt_update_page/mod.rs
index ed5391e..4f647d6 100644
--- a/src/apt_update_page/mod.rs
+++ b/src/apt_update_page/mod.rs
@@ -33,7 +33,13 @@ pub struct AptPackageSocket {
pub is_last: bool,
}
-pub fn apt_update_page(window: adw::ApplicationWindow) -> gtk::Box {
+pub fn apt_update_page(window: adw::ApplicationWindow) -> adw::Bin {
+ adw::Bin::builder()
+ .child(&create_bin_content(window))
+ .build()
+}
+
+fn create_bin_content(window: adw::ApplicationWindow) -> 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::();
@@ -204,6 +210,7 @@ pub fn apt_update_page(window: adw::ApplicationWindow) -> gtk::Box {
update_status_server_context.spawn_local(
clone!(@weak apt_update_dialog, @weak apt_update_dialog_spinner => async move {
while let Ok(state) = update_status_receiver.recv().await {
+ println!("egg: {}", state);
match state.as_ref() {
"FN_OVERRIDE_SUCCESSFUL" => {}
"FN_OVERRIDE_FAILED" => {
diff --git a/src/build_ui/mod.rs b/src/build_ui/mod.rs
index 66a76f5..aaa3c25 100644
--- a/src/build_ui/mod.rs
+++ b/src/build_ui/mod.rs
@@ -41,16 +41,16 @@ pub fn build_ui(app: &adw::Application) {
while let Ok(state) = internet_loop_receiver.recv().await {
let banner_text = t!("banner_text_no_internet").to_string();
if state == true {
- *internet_connected_status.borrow_mut()=true;
- if window_banner.title() == banner_text {
- window_banner.set_revealed(false)
- }
- } else {
- *internet_connected_status.borrow_mut()=false;
- if window_banner.title() != t!("banner_text_url_error").to_string() {
- window_banner.set_title(&banner_text);
- window_banner.set_revealed(true)
+ *internet_connected_status.borrow_mut()=true;
+ if window_banner.title() == banner_text {
+ window_banner.set_revealed(false)
}
+ } else {
+ *internet_connected_status.borrow_mut()=false;
+ if window_banner.title() != t!("banner_text_url_error").to_string() {
+ window_banner.set_title(&banner_text);
+ window_banner.set_revealed(true)
+ }
}
}
}));
@@ -63,7 +63,23 @@ pub fn build_ui(app: &adw::Application) {
)
.build();
- let window_toolbar = adw::ToolbarView::builder().build();
+ let window_adw_view_stack = adw::ViewStack::builder()
+ .hhomogeneous(true)
+ .vhomogeneous(true)
+ .build();
+
+ let window_toolbar = adw::ToolbarView::builder()
+ .content(&window_adw_view_stack)
+ .top_bar_style(ToolbarStyle::Flat)
+ .bottom_bar_style(ToolbarStyle::Flat)
+ .build();
+
+ let window_adw_view_switcher_bar = adw::ViewSwitcherBar::builder()
+ .stack(&window_adw_view_stack)
+ .reveal(true)
+ .build();
+
+ window_headerbar.pack_start(&window_adw_view_switcher_bar);
window_toolbar.add_top_bar(&window_headerbar);
window_toolbar.add_top_bar(&window_banner);
@@ -108,5 +124,6 @@ pub fn build_ui(app: &adw::Application) {
// show the window
window.present();
- window_toolbar.set_content(Some(&apt_update_page::apt_update_page(window)));
+ window_adw_view_stack.add_titled_with_icon(&apt_update_page::apt_update_page(window), 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"));
}