Browse Source

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).
merge-requests/1327/merge
Julian Sparber 4 years ago
parent
commit
2b707c94df
  1. 15
      src/application.rs

15
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();
}

Loading…
Cancel
Save