diff options
-rw-r--r-- | introspection/nm-active-connection.xml | 5 | ||||
-rw-r--r-- | libnm-glib/Makefile.am | 2 | ||||
-rw-r--r-- | libnm-glib/libnm-glib.ver | 1 | ||||
-rw-r--r-- | libnm-glib/nm-active-connection.c | 62 | ||||
-rw-r--r-- | libnm-glib/nm-active-connection.h | 4 |
5 files changed, 63 insertions, 11 deletions
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml index ff55f63885..765830a1dc 100644 --- a/introspection/nm-active-connection.xml +++ b/introspection/nm-active-connection.xml @@ -18,7 +18,10 @@ <tp:docstring>The state of this active connection.</tp:docstring> </property> <property name="Default" type="b" access="read"> - <tp:docstring>Whether this active connection is the default connection, i.e. whether it currently owns the default route.</tp:docstring> + <tp:docstring>Whether this active connection is the default IPv4 connection, i.e. whether it currently owns the default IPv4 route.</tp:docstring> + </property> + <property name="Default6" type="b" access="read"> + <tp:docstring>Whether this active connection is the default IPv6 connection, i.e. whether it currently owns the default IPv6 route.</tp:docstring> </property> <property name="Vpn" type="b" access="read"> <tp:docstring>Whether this active connection is also a VPN connection.</tp:docstring> diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index 58b5bc559e..8f03b0abda 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -132,7 +132,7 @@ libnm_glib_la_LIBADD = \ $(GUDEV_LIBS) libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib.ver \ - -version-info "4:1:2" + -version-info "4:2:2" noinst_PROGRAMS = libnm-glib-test diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver index 1caa2d42ba..46051e8784 100644 --- a/libnm-glib/libnm-glib.ver +++ b/libnm-glib/libnm-glib.ver @@ -18,6 +18,7 @@ global: nm_access_point_new; nm_active_connection_get_connection; nm_active_connection_get_default; + nm_active_connection_get_default6; nm_active_connection_get_devices; nm_active_connection_get_scope; nm_active_connection_get_service_name; diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index df8bb98271..2468da099f 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright (C) 2007 - 2008 Red Hat, Inc. + * Copyright (C) 2007 - 2010 Red Hat, Inc. * Copyright (C) 2008 Novell, Inc. */ @@ -50,6 +50,7 @@ typedef struct { GPtrArray *devices; NMActiveConnectionState state; gboolean is_default; + gboolean is_default6; } NMActiveConnectionPrivate; enum { @@ -60,6 +61,7 @@ enum { PROP_DEVICES, PROP_STATE, PROP_DEFAULT, + PROP_DEFAULT6, LAST_PROP }; @@ -70,6 +72,7 @@ enum { #define DBUS_PROP_DEVICES "Devices" #define DBUS_PROP_STATE "State" #define DBUS_PROP_DEFAULT "Default" +#define DBUS_PROP_DEFAULT6 "Default6" /** * nm_active_connection_new: @@ -263,10 +266,10 @@ nm_active_connection_get_state (NMActiveConnection *connection) * nm_active_connection_get_default: * @connection: a #NMActiveConnection * - * Whether the active connection is the default one (that is, is used for the default route - * and DNS information). + * Whether the active connection is the default IPv4 one (that is, is used for + * the default IPv4 route and DNS information). * - * Returns: %TRUE if the active connection is the default one + * Returns: %TRUE if the active connection is the default IPv4 connection **/ gboolean nm_active_connection_get_default (NMActiveConnection *connection) @@ -278,13 +281,39 @@ nm_active_connection_get_default (NMActiveConnection *connection) priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection); if (!priv->is_default) { priv->is_default = _nm_object_get_boolean_property (NM_OBJECT (connection), - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - DBUS_PROP_DEFAULT); + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + DBUS_PROP_DEFAULT); } return priv->is_default; } +/** + * nm_active_connection_get_default6: + * @connection: a #NMActiveConnection + * + * Whether the active connection is the default IPv6 one (that is, is used for + * the default IPv6 route and DNS information). + * + * Returns: %TRUE if the active connection is the default IPv6 connection + **/ +gboolean +nm_active_connection_get_default6 (NMActiveConnection *connection) +{ + NMActiveConnectionPrivate *priv; + + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), FALSE); + + priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection); + if (!priv->is_default6) { + priv->is_default6 = _nm_object_get_boolean_property (NM_OBJECT (connection), + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + DBUS_PROP_DEFAULT6); + } + + return priv->is_default6; +} + static void nm_active_connection_init (NMActiveConnection *ap) { @@ -350,6 +379,9 @@ get_property (GObject *object, case PROP_DEFAULT: g_value_set_boolean (value, nm_active_connection_get_default (self)); break; + case PROP_DEFAULT6: + g_value_set_boolean (value, nm_active_connection_get_default6 (self)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -392,6 +424,7 @@ register_for_property_changed (NMActiveConnection *connection) { NM_ACTIVE_CONNECTION_DEVICES, demarshal_devices, &priv->devices }, { NM_ACTIVE_CONNECTION_STATE, _nm_object_demarshal_generic, &priv->state }, { NM_ACTIVE_CONNECTION_DEFAULT, _nm_object_demarshal_generic, &priv->is_default }, + { NM_ACTIVE_CONNECTION_DEFAULT6, _nm_object_demarshal_generic, &priv->is_default6 }, { NULL }, }; @@ -512,13 +545,26 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) /** * NMActiveConnection:default: * - * Whether the active connection is the default one. + * Whether the active connection is the default IPv4 one. **/ g_object_class_install_property (object_class, PROP_DEFAULT, g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "Default", - "Is the default active connection", + "Is the default IPv4 active connection", + FALSE, + G_PARAM_READABLE)); + + /** + * NMActiveConnection:default6: + * + * Whether the active connection is the default IPv6 one. + **/ + g_object_class_install_property + (object_class, PROP_DEFAULT6, + g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, + "Default6", + "Is the default IPv6 active connection", FALSE, G_PARAM_READABLE)); } diff --git a/libnm-glib/nm-active-connection.h b/libnm-glib/nm-active-connection.h index f717c055ef..30edf047a0 100644 --- a/libnm-glib/nm-active-connection.h +++ b/libnm-glib/nm-active-connection.h @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright (C) 2007 - 2008 Red Hat, Inc. + * Copyright (C) 2007 - 2010 Red Hat, Inc. * Copyright (C) 2008 Novell, Inc. */ @@ -45,6 +45,7 @@ G_BEGIN_DECLS #define NM_ACTIVE_CONNECTION_DEVICES "devices" #define NM_ACTIVE_CONNECTION_STATE "state" #define NM_ACTIVE_CONNECTION_DEFAULT "default" +#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6" typedef struct { NMObject parent; @@ -73,6 +74,7 @@ const char * nm_active_connection_get_specific_object (NMActiveConnection *c const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection); NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection); gboolean nm_active_connection_get_default (NMActiveConnection *connection); +gboolean nm_active_connection_get_default6 (NMActiveConnection *connection); G_END_DECLS |