bad :(
This commit is contained in:
parent
0f60c21e6b
commit
76766a4b48
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -572,6 +572,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"async-channel",
|
"async-channel",
|
||||||
"fragile",
|
"fragile",
|
||||||
|
"glib",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
"libadwaita",
|
"libadwaita",
|
||||||
"time",
|
"time",
|
||||||
|
@ -9,5 +9,6 @@ edition = "2021"
|
|||||||
adw = { version = "0.5.3", package = "libadwaita" }
|
adw = { version = "0.5.3", package = "libadwaita" }
|
||||||
async-channel = "2.1.1"
|
async-channel = "2.1.1"
|
||||||
fragile = "2.0.0"
|
fragile = "2.0.0"
|
||||||
|
glib = "0.18.5"
|
||||||
gtk = { version = "0.7.3", package = "gtk4" }
|
gtk = { version = "0.7.3", package = "gtk4" }
|
||||||
time = "0.3.31"
|
time = "0.3.31"
|
||||||
|
@ -139,25 +139,30 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
window.connect_hide(clone!(@weak window => move |_| save_window_size(&window, &glib_settings)));
|
window.connect_hide(clone!(@weak window => move |_| save_window_size(&window, &glib_settings)));
|
||||||
window.connect_hide(clone!(@weak window => move |_| window.destroy()));
|
window.connect_hide(clone!(@weak window => move |_| window.destroy()));
|
||||||
|
|
||||||
|
let (sender, receiver) = MainContext::channel(Priority::default());
|
||||||
|
window.connect_show(move |_| {
|
||||||
|
let sender = sender.clone();
|
||||||
|
// The long running operation runs now in a separate thread
|
||||||
|
thread::spawn(move || {
|
||||||
|
sender.send(false).expect("Could not send through channel");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
let bottom_box_clone = fragile::Fragile::new(bottom_box.clone());
|
receiver.attach(
|
||||||
let content_stack_clone = fragile::Fragile::new(content_stack.clone());
|
None,
|
||||||
|
clone!(@weak bottom_box => @default-return Continue(false),
|
||||||
gio::spawn_blocking(move || {
|
move |state| {
|
||||||
while gtk_loops == true {
|
bottom_box_loop(&bottom_box, state);
|
||||||
glib::MainContext::default().invoke( move || {
|
glib::ControlFlow::Continue
|
||||||
bottom_box_loop( &bottom_box_clone, &content_stack_clone)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
),
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bottom_box_loop(bottom_box: &Fragile<gtk::Box>, content_stack: &Fragile<Stack>) {
|
fn bottom_box_loop(bottom_box: >k::Box, state: bool) {
|
||||||
if content_stack.get().visible_child_name().expect("gstring to string").as_str() == "welcome_page" {
|
bottom_box.set_visible(state)
|
||||||
bottom_box.get().set_visible(false)
|
|
||||||
} else {
|
|
||||||
bottom_box.get().set_visible(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user