mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-03-15 06:28:27 +03:00
Updated modules; fixed thread issues when calling MainApp::update_state
This commit is contained in:
parent
8a62ed5674
commit
79d63a174e
3 changed files with 26 additions and 23 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 50e612c865eef41076ba70d153051b63ff4ecc1e
|
||||
Subproject commit 2206e00a963a3e1421a9d45d8f71f32a5c9b7acb
|
|
@ -1 +1 @@
|
|||
Subproject commit e87f17c4085ca3617c9673b1139f622b88f8ab20
|
||||
Subproject commit 9f2247a8200add10b7da738c257bd824832fa3c6
|
|
@ -880,35 +880,38 @@ impl App {
|
|||
self.widgets.status_page.show();
|
||||
self.widgets.launcher_content.hide();
|
||||
|
||||
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
|
||||
let (send, recv) = std::sync::mpsc::channel();
|
||||
|
||||
receiver.attach(None, clone!(@strong self.widgets.status_page as status_page => move |description| {
|
||||
status_page.set_description(Some(&description));
|
||||
|
||||
glib::Continue(true)
|
||||
}));
|
||||
|
||||
let this = self.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
match LauncherState::get(move |status| sender.send(status.to_string()).unwrap()) {
|
||||
Ok(state) => {
|
||||
this.set_state(state.clone());
|
||||
glib::MainContext::default().invoke(move || {
|
||||
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
|
||||
|
||||
this.widgets.status_page.hide();
|
||||
this.widgets.launcher_content.show();
|
||||
receiver.attach(None, clone!(@strong this.widgets.status_page as status_page => move |description| {
|
||||
status_page.set_description(Some(&description));
|
||||
|
||||
send.send(Ok(state)).unwrap();
|
||||
},
|
||||
Err(err) => {
|
||||
send.send(Err(err.to_string())).unwrap();
|
||||
glib::Continue(true)
|
||||
}));
|
||||
|
||||
glib::MainContext::default().invoke(move || {
|
||||
this.toast("Failed to get initial launcher state", err);
|
||||
});
|
||||
std::thread::spawn(move || {
|
||||
match LauncherState::get(move |status| sender.send(status.to_string()).unwrap()) {
|
||||
Ok(state) => {
|
||||
this.set_state(state.clone());
|
||||
|
||||
this.widgets.status_page.hide();
|
||||
this.widgets.launcher_content.show();
|
||||
|
||||
send.send(Ok(state)).unwrap();
|
||||
},
|
||||
Err(err) => {
|
||||
send.send(Err(err.to_string())).unwrap();
|
||||
|
||||
glib::MainContext::default().invoke(move || {
|
||||
this.toast("Failed to get initial launcher state", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Await::new(move || {
|
||||
|
|
Loading…
Add table
Reference in a new issue