Re: [PATCH 5/5] api: Added the method CaptivePortalState()
- From: Dan Williams <dcbw redhat com>
- To: Jonh Wendell <jonh wendell gmail com>
- Cc: Jonh Wendell <jonh wendell oiwifi com br>, networkmanager-list gnome org
- Subject: Re: [PATCH 5/5] api: Added the method CaptivePortalState()
- Date: Mon, 11 Feb 2013 10:01:48 -0600
On Mon, 2013-02-11 at 12:09 -0200, Jonh Wendell wrote:
> 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.
Any particular reason this is a method and not a property? Also I think
we may want more properties available later in which case it might be
better to have a dict instead of a hard method signature. There are a
number of different portal types, and I think in the future we may want
to have NM store some of the credentials for user login too. Also,
stuff like Hotspot 2.0 can use a SIM card on your WWAN modem to perform
authentication and log into the hotspot automatically; we might need to
pass more information to whatever actually handles the login stuff.
Dan
> 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]