[fractal] app: Disable new-login action without network
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] app: Disable new-login action without network
- Date: Tue, 16 Aug 2022 10:54:08 +0000 (UTC)
commit 2b707c94df0df13abbb47c9e0c3572378be8d610
Author: Julian Sparber <julian sparber net>
Date: Fri Jul 22 21:28:34 2022 +0200
app: Disable new-login action without network
We only disable the new-login action when there is no network since the
user may have the homeserver in the local network or internet connection
dedection may be broken. (currently the case on my system).
src/application.rs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/src/application.rs b/src/application.rs
index 846bff75a..038d6278c 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -56,6 +56,21 @@ mod imp {
app.setup_gactions();
app.setup_accels();
+ let monitor = gio::NetworkMonitor::default();
+ monitor.connect_network_changed(clone!(@weak app => move |monitor, _| {
+ app.lookup_action("show-login")
+ .unwrap()
+ .downcast::<gio::SimpleAction>()
+ .unwrap()
+ .set_enabled(monitor.is_network_available());
+ }));
+
+ app.lookup_action("show-login")
+ .unwrap()
+ .downcast::<gio::SimpleAction>()
+ .unwrap()
+ .set_enabled(monitor.is_network_available());
+
app.get_main_window().present();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]