libnm-glib: add NMActiveConnection:vpn property
It is mainly useful for GObject introspection users helping them to find out whether the connection is VPN easier.
This commit is contained in:
@@ -32,6 +32,7 @@ global:
|
|||||||
nm_active_connection_get_state;
|
nm_active_connection_get_state;
|
||||||
nm_active_connection_get_type;
|
nm_active_connection_get_type;
|
||||||
nm_active_connection_get_uuid;
|
nm_active_connection_get_uuid;
|
||||||
|
nm_active_connection_get_vpn;
|
||||||
nm_active_connection_new;
|
nm_active_connection_new;
|
||||||
nm_client_activate_connection;
|
nm_client_activate_connection;
|
||||||
nm_client_add_and_activate_connection;
|
nm_client_add_and_activate_connection;
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301 USA.
|
* Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2011 Red Hat, Inc.
|
* Copyright (C) 2007 - 2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2008 Novell, Inc.
|
* Copyright (C) 2008 Novell, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ typedef struct {
|
|||||||
gboolean is_default6;
|
gboolean is_default6;
|
||||||
NMIP6Config *ip6_config;
|
NMIP6Config *ip6_config;
|
||||||
NMDHCP6Config *dhcp6_config;
|
NMDHCP6Config *dhcp6_config;
|
||||||
|
gboolean is_vpn;
|
||||||
char *master;
|
char *master;
|
||||||
} NMActiveConnectionPrivate;
|
} NMActiveConnectionPrivate;
|
||||||
|
|
||||||
@@ -79,6 +80,7 @@ enum {
|
|||||||
PROP_DEFAULT6,
|
PROP_DEFAULT6,
|
||||||
PROP_IP6_CONFIG,
|
PROP_IP6_CONFIG,
|
||||||
PROP_DHCP6_CONFIG,
|
PROP_DHCP6_CONFIG,
|
||||||
|
PROP_VPN,
|
||||||
PROP_MASTER,
|
PROP_MASTER,
|
||||||
|
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
@@ -410,6 +412,25 @@ nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
|
|||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
|
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nm_active_connection_get_vpn:
|
||||||
|
* @connection: a #NMActiveConnection
|
||||||
|
*
|
||||||
|
* Whether the active connection is a VPN connection.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the active connection is a VPN connection
|
||||||
|
*
|
||||||
|
* Since: 0.9.10
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
nm_active_connection_get_vpn (NMActiveConnection *connection)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), FALSE);
|
||||||
|
|
||||||
|
_nm_object_ensure_inited (NM_OBJECT (connection));
|
||||||
|
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_vpn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_active_connection_get_master:
|
* nm_active_connection_get_master:
|
||||||
* @connection: a #NMActiveConnection
|
* @connection: a #NMActiveConnection
|
||||||
@@ -511,6 +532,9 @@ get_property (GObject *object,
|
|||||||
case PROP_DHCP6_CONFIG:
|
case PROP_DHCP6_CONFIG:
|
||||||
g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
|
g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
|
||||||
break;
|
break;
|
||||||
|
case PROP_VPN:
|
||||||
|
g_value_set_boolean (value, nm_active_connection_get_vpn (self));
|
||||||
|
break;
|
||||||
case PROP_MASTER:
|
case PROP_MASTER:
|
||||||
g_value_set_string (value, nm_active_connection_get_master (self));
|
g_value_set_string (value, nm_active_connection_get_master (self));
|
||||||
break;
|
break;
|
||||||
@@ -536,11 +560,9 @@ register_properties (NMActiveConnection *connection)
|
|||||||
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
|
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
|
||||||
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
|
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
|
||||||
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
|
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
|
||||||
|
{ NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn },
|
||||||
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
|
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
|
||||||
|
|
||||||
/* not tracked after construction time */
|
|
||||||
{ "vpn", NULL },
|
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -729,6 +751,21 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
|||||||
NM_TYPE_DHCP6_CONFIG,
|
NM_TYPE_DHCP6_CONFIG,
|
||||||
G_PARAM_READABLE));
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NMActiveConnection:vpn:
|
||||||
|
*
|
||||||
|
* Whether the active connection is a VPN connection.
|
||||||
|
*
|
||||||
|
* Since: 0.9.10
|
||||||
|
**/
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_VPN,
|
||||||
|
g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
|
||||||
|
"VPN",
|
||||||
|
"Is a VPN connection",
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMActiveConnection:master:
|
* NMActiveConnection:master:
|
||||||
*
|
*
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301 USA.
|
* Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2011 Red Hat, Inc.
|
* Copyright (C) 2007 - 2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2008 Novell, Inc.
|
* Copyright (C) 2008 Novell, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -54,6 +54,7 @@ G_BEGIN_DECLS
|
|||||||
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
|
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
|
||||||
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
|
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
|
||||||
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
|
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
|
||||||
|
#define NM_ACTIVE_CONNECTION_VPN "vpn"
|
||||||
#define NM_ACTIVE_CONNECTION_MASTER "master"
|
#define NM_ACTIVE_CONNECTION_MASTER "master"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -88,6 +89,7 @@ NMDHCP4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *c
|
|||||||
gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
|
gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
|
||||||
NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
|
NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
|
||||||
NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
|
NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
|
||||||
|
gboolean nm_active_connection_get_vpn (NMActiveConnection *connection);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user