[epiphany] Add captive portal helper
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add captive portal helper
- Date: Sat, 11 Jul 2020 08:52:31 +0000 (UTC)
commit bc312dbad8a9936b45626458f0c8bcee7e392bde
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Fri Jul 10 21:02:50 2020 +0200
Add captive portal helper
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1061
src/ephy-shell.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
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
@@ -586,12 +586,33 @@ session_load_cb (GObject *object,
ephy_shell_startup_continue (ephy_shell_get_default (), ctx);
}
+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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]