diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-03-03 15:01:36 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-03-05 16:17:13 +0100 |
commit | 28bd3cab2838a8322f8b2a9bc95c4481a4fe8e1c (patch) | |
tree | dbc2a077b72e660f1b913bdb80dc0ffb3274bea4 | |
parent | eca6a49e2d91c21ff9f525dd34259e3ad6c12272 (diff) | |
download | NetworkManager-28bd3cab2838a8322f8b2a9bc95c4481a4fe8e1c.tar.gz |
core: add 'type' and 'id' property for NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
-rw-r--r-- | introspection/nm-active-connection.xml | 12 | ||||
-rw-r--r-- | libnm-util/libnm-util.ver | 1 | ||||
-rw-r--r-- | libnm-util/nm-connection.c | 23 | ||||
-rw-r--r-- | libnm-util/nm-connection.h | 7 | ||||
-rw-r--r-- | src/nm-active-connection.c | 24 | ||||
-rw-r--r-- | src/nm-active-connection.h | 6 |
6 files changed, 69 insertions, 4 deletions
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml index 56a10132a9..cbecdfcefe 100644 --- a/introspection/nm-active-connection.xml +++ b/introspection/nm-active-connection.xml @@ -22,12 +22,24 @@ not change over the lifetime of the ActiveConnection once set. </tp:docstring> </property> + <property name="Id" type="s" access="read"> + <tp:docstring> + The ID of the connection, provided as a convenience so that clients + do not have to retrieve all connection details. + </tp:docstring> + </property> <property name="Uuid" type="s" access="read"> <tp:docstring> The UUID of the connection, provided as a convenience so that clients do not have to retrieve all connection details. </tp:docstring> </property> + <property name="Type" type="s" access="read"> + <tp:docstring> + The type of the connection, provided as a convenience so that clients + do not have to retrieve all connection details. + </tp:docstring> + </property> <property name="Devices" type="ao" access="read"> <tp:docstring> Array of object paths representing devices which are part of this active diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver index 09f7c58f69..481de76c2a 100644 --- a/libnm-util/libnm-util.ver +++ b/libnm-util/libnm-util.ver @@ -11,6 +11,7 @@ global: nm_connection_error_get_type; nm_connection_error_quark; nm_connection_for_each_setting_value; + nm_connection_get_connection_type; nm_connection_get_id; nm_connection_get_path; nm_connection_get_setting; diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 213d715fba..8546d9bcb9 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -1244,6 +1244,29 @@ nm_connection_get_id (NMConnection *connection) } /** + * nm_connection_get_connection_type: + * @connection: the #NMConnection + * + * A shortcut to return the type from the connection's #NMSettingConnection. + * + * Returns: the type from the connection's 'connection' setting + * + * Since: 0.9.10 + **/ +const char * +nm_connection_get_connection_type (NMConnection *connection) +{ + NMSettingConnection *s_con; + + g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); + + s_con = nm_connection_get_setting_connection (connection); + g_return_val_if_fail (s_con != NULL, NULL); + + return nm_setting_connection_get_connection_type (s_con); +} + +/** * nm_connection_get_virtual_device_description: * @connection: an #NMConnection for a virtual device type * diff --git a/libnm-util/nm-connection.h b/libnm-util/nm-connection.h index c13f456897..4524c8f62d 100644 --- a/libnm-util/nm-connection.h +++ b/libnm-util/nm-connection.h @@ -197,9 +197,10 @@ GType nm_connection_lookup_setting_type (const char *name); GType nm_connection_lookup_setting_type_by_quark (GQuark error_quark); /* Helpers */ -const char * nm_connection_get_uuid (NMConnection *connection); - -const char * nm_connection_get_id (NMConnection *connection); +const char * nm_connection_get_uuid (NMConnection *connection); +const char * nm_connection_get_id (NMConnection *connection); +NM_AVAILABLE_IN_0_9_10 +const char * nm_connection_get_connection_type (NMConnection *connection); NM_AVAILABLE_IN_0_9_10 char * nm_connection_get_virtual_device_description (NMConnection *connection); diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index e8d07dd23a..792ec51a1a 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2012 Red Hat, Inc. + * Copyright (C) 2008 - 2014 Red Hat, Inc. */ #include <glib.h> @@ -68,7 +68,9 @@ typedef struct { enum { PROP_0, PROP_CONNECTION, + PROP_ID, PROP_UUID, + PROP_TYPE, PROP_SPECIFIC_OBJECT, PROP_DEVICES, PROP_STATE, @@ -714,9 +716,15 @@ get_property (GObject *object, guint prop_id, case PROP_CONNECTION: g_value_set_boxed (value, nm_connection_get_path (priv->connection)); break; + case PROP_ID: + g_value_set_string (value, nm_connection_get_id (priv->connection)); + break; case PROP_UUID: g_value_set_string (value, nm_connection_get_uuid (priv->connection)); break; + case PROP_TYPE: + g_value_set_string (value, nm_connection_get_connection_type (priv->connection)); + break; case PROP_SPECIFIC_OBJECT: g_value_set_boxed (value, priv->specific_object ? priv->specific_object : "/"); break; @@ -838,6 +846,13 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class) DBUS_TYPE_G_OBJECT_PATH, G_PARAM_READABLE)); + g_object_class_install_property (object_class, PROP_ID, + g_param_spec_string (NM_ACTIVE_CONNECTION_ID, + "Connection ID", + "Connection ID", + NULL, + G_PARAM_READABLE)); + g_object_class_install_property (object_class, PROP_UUID, g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "Connection UUID", @@ -845,6 +860,13 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class) NULL, G_PARAM_READABLE)); + g_object_class_install_property (object_class, PROP_TYPE, + g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, + "Connection Type", + "Connection Type", + NULL, + G_PARAM_READABLE)); + g_object_class_install_property (object_class, PROP_SPECIFIC_OBJECT, g_param_spec_boxed (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "Specific object", diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index 2a4df9705a..fac09e7c0b 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -35,7 +35,9 @@ /* D-Bus Exported Properties */ #define NM_ACTIVE_CONNECTION_CONNECTION "connection" +#define NM_ACTIVE_CONNECTION_ID "id" #define NM_ACTIVE_CONNECTION_UUID "uuid" +#define NM_ACTIVE_CONNECTION_TYPE "type" #define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object" #define NM_ACTIVE_CONNECTION_DEVICES "devices" #define NM_ACTIVE_CONNECTION_STATE "state" @@ -94,6 +96,10 @@ void nm_active_connection_set_connection (NMActiveConnection *self, const char * nm_active_connection_get_name (NMActiveConnection *self); +const char * nm_active_connection_get_uuid (NMActiveConnection *self); + +const char * nm_active_connection_get_connection_type (NMActiveConnection *self); + const char * nm_active_connection_get_path (NMActiveConnection *self); const char * nm_active_connection_get_specific_object (NMActiveConnection *self); |