fix update interval action
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 2m38s

This commit is contained in:
Ward from fusion-voyager-3 2024-10-05 15:51:20 +03:00
parent 0cea668b3c
commit 40c0a64c85
3 changed files with 39 additions and 33 deletions

View File

@ -1 +1 @@
10
11

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
pikman-update-manager (1.0.1-100pika1) pikauwu; urgency=medium
pikman-update-manager (1.0.1-100pika2) pikauwu; urgency=medium
* initial release

View File

@ -237,37 +237,6 @@ pub fn build_ui(app: &Application) {
let internet_connected_status = internet_connected.clone();
let constant_loop_context = MainContext::default();
// The main loop executes the asynchronous block
constant_loop_context.spawn_local(clone!(
#[weak]
window_banner,
#[weak]
refresh_button,
async move {
while let Ok(message) = constant_loop_receiver.recv().await {
let banner_text = t!("banner_text_no_internet").to_string();
match message {
ConstantLoopMessage::InternetStatus(state) => {
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;
window_banner.set_title(&banner_text);
window_banner.set_revealed(true)
}
}
ConstantLoopMessage::RefreshRequest => {
refresh_button.emit_clicked();
}
}
}
}
));
let window_headerbar = HeaderBar::builder()
.title_widget(&WindowTitle::builder().title(t!("application_name")).build())
.show_title(false)
@ -666,6 +635,43 @@ pub fn build_ui(app: &Application) {
}
}
));
let constant_loop_context = MainContext::default();
// The main loop executes the asynchronous block
constant_loop_context.spawn_local(clone!(
#[weak]
window_banner,
#[strong]
update_sys_tray,
#[strong]
apt_retry_signal_action,
#[strong]
flatpak_retry_signal_action,
async move {
while let Ok(message) = constant_loop_receiver.recv().await {
let banner_text = t!("banner_text_no_internet").to_string();
match message {
ConstantLoopMessage::InternetStatus(state) => {
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;
window_banner.set_title(&banner_text);
window_banner.set_revealed(true)
}
}
ConstantLoopMessage::RefreshRequest => {
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[-1, -1])));
apt_retry_signal_action.activate(None);
flatpak_retry_signal_action.activate(None);
}
}
}
}
));
}
fn add_content_button(