[PATCH 5/5] api: Added the method CaptivePortalState()
- From: Jonh Wendell <jonh wendell gmail com>
- To: networkmanager-list gnome org
- Cc: Jonh Wendell <jonh wendell oiwifi com br>
- Subject: [PATCH 5/5] api: Added the method CaptivePortalState()
- Date: Mon, 11 Feb 2013 12:09:17 -0200
From: Jonh Wendell <jonh wendell oiwifi com br>
It returns whether we are behind a captive portal and, if we are,
also returns the url to login at the hotspot.
Signed-off-by: Jonh Wendell <jonh wendell oiwifi com br>
---
introspection/nm-manager.xml | 20 ++++++++++++++++++++
src/nm-manager.c | 18 ++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/introspection/nm-manager.xml b/introspection/nm-manager.xml
index 6f3c8ca..cd3c902 100644
--- a/introspection/nm-manager.xml
+++ b/introspection/nm-manager.xml
@@ -253,6 +253,26 @@
<arg name="state" type="u" direction="out" tp:type="NM_STATE"/>
</method>
+ <method name="CaptivePortalState">
+ <tp:docstring>
+ Indicates whether we are behind a captive portal. If we are, it also gives
+ the login URL supplied by the captive portal. It only makes sense to call
+ this method when the State is NM_STATE_CONNECTED_SITE.
+ </tp:docstring>
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_captive_portal_state"/>
+ <arg name="behind_captive_portal" type="b" direction="out">
+ <tp:docstring>
+ The boolean value indicating whether we are behind a captive portal.
+ </tp:docstring>
+ </arg>
+ <arg name="login_url" type="s" direction="out">
+ <tp:docstring>
+ If we are behind a captive portal, this contains the URL used to login on it.
+ A NULL value is valid here, meaning we couldn't guess the login URL.
+ </tp:docstring>
+ </arg>
+ </method>
+
<property name="NetworkingEnabled" type="b" access="read">
<tp:docstring>
Indicates if overall networking is currently enabled or not. See the
diff --git a/src/nm-manager.c b/src/nm-manager.c
index eb7eb9a..feb618d 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -120,6 +120,10 @@ static gboolean impl_manager_get_state (NMManager *manager,
guint32 *state,
GError **error);
+static gboolean impl_manager_get_captive_portal_state (NMManager *manager,
+ gboolean *behind_captive_portal,
+ char **login_url);
+
static gboolean impl_manager_set_logging (NMManager *manager,
const char *level,
const char *domains,
@@ -3691,6 +3695,20 @@ impl_manager_get_state (NMManager *manager, guint32 *state, GError **error)
}
static gboolean
+impl_manager_get_captive_portal_state (NMManager *manager, gboolean *behind_captive_portal, char **login_url)
+{
+#if WITH_CONCHECK
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
+ *behind_captive_portal = nm_connectivity_get_state (priv->connectivity) == NM_CONNECTIVITY_STATE_BEHIND_CAPTIVE_PORTAL;
+ *login_url = g_strdup (nm_connectivity_get_login_url (priv->connectivity));
+#else
+ *behind_captive_portal = FALSE;
+ *login_url = NULL;
+#endif
+ return TRUE;
+}
+
+static gboolean
impl_manager_set_logging (NMManager *manager,
const char *level,
const char *domains,
--
1.8.1.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]