diff options
author | Jan-Michael Brummer <jan.brummer@tabos.org> | 2020-07-10 21:02:50 +0200 |
---|---|---|
committer | Jan-Michael Brummer <jan.brummer@tabos.org> | 2020-07-11 10:43:02 +0200 |
commit | bc312dbad8a9936b45626458f0c8bcee7e392bde (patch) | |
tree | 022efdcc9e4169dd11de8b60dd51da59eeccdef3 /src | |
parent | bd291c90a0b8f7122eaade1367d0256b6f07f8eb (diff) | |
download | epiphany-bc312dbad8a9936b45626458f0c8bcee7e392bde.tar.gz |
Add captive portal helper
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1061
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-shell.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c index d850b3f49..5558ea6d4 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -587,11 +587,32 @@ session_load_cb (GObject *object, } static void +portal_check (EphyShell *shell) +{ + if (g_network_monitor_get_connectivity (ephy_shell_get_net_monitor (shell)) == G_NETWORK_CONNECTIVITY_PORTAL) { + EphyWindow *window = EPHY_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (shell))); + + ephy_window_load_url (window, "http://nmcheck.gnome.org/"); + } +} + +static void +connectivity_changed (GNetworkMonitor *monitor, + GParamSpec *pspec, + EphyShell *shell) +{ + portal_check (shell); +} + +static void ephy_shell_activate (GApplication *application) { EphyShell *shell = EPHY_SHELL (application); EphyEmbedShell *embed_shell = EPHY_EMBED_SHELL (shell); + g_signal_connect (ephy_shell_get_net_monitor (shell), "notify::connectivity", G_CALLBACK (connectivity_changed), shell); + portal_check (shell); + if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_AUTOMATION) { WebKitWebContext *web_context = ephy_embed_shell_get_web_context (embed_shell); g_signal_connect (web_context, "automation-started", G_CALLBACK (automation_started_cb), shell); |