about summary refs log tree commit diff
path: root/libnm-glib/nm-active-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-glib/nm-active-connection.c')
-rw-r--r--libnm-glib/nm-active-connection.c118
1 files changed, 17 insertions, 101 deletions
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index 2468da09..64d265ae 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 - 2010 Red Hat, Inc.
+ * Copyright (C) 2007 - 2011 Red Hat, Inc.
  * Copyright (C) 2008 Novell, Inc.
  */
 
@@ -43,8 +43,6 @@ typedef struct {
 	gboolean disposed;
 	DBusGProxy *proxy;
 
-	char *service_name;
-	NMConnectionScope scope;
 	char *connection;
 	char *specific_object;
 	GPtrArray *devices;
@@ -55,7 +53,6 @@ typedef struct {
 
 enum {
 	PROP_0,
-	PROP_SERVICE_NAME,
 	PROP_CONNECTION,
 	PROP_SPECIFIC_OBJECT,
 	PROP_DEVICES,
@@ -66,7 +63,6 @@ enum {
 	LAST_PROP
 };
 
-#define DBUS_PROP_SERVICE_NAME "ServiceName"
 #define DBUS_PROP_CONNECTION "Connection"
 #define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
 #define DBUS_PROP_DEVICES "Devices"
@@ -81,7 +77,7 @@ enum {
  *
  * Creates a new #NMActiveConnection.
  *
- * Returns: a new active connection
+ * Returns: (transfer full): a new active connection
  **/
 GObject *
 nm_active_connection_new (DBusGConnection *connection, const char *path)
@@ -95,62 +91,6 @@ nm_active_connection_new (DBusGConnection *connection, const char *path)
 						 NULL);
 }
 
-static NMConnectionScope
-get_scope_for_service_name (const char *service_name)
-{
-	if (service_name && !strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS))
-		return NM_CONNECTION_SCOPE_USER;
-	else if (service_name && !strcmp (service_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS))
-		return NM_CONNECTION_SCOPE_SYSTEM;
-
-	return NM_CONNECTION_SCOPE_UNKNOWN;
-}
-
-/**
- * nm_active_connection_get_service_name:
- * @connection: a #NMActiveConnection
- *
- * Gets the service name of the active connection.
- *
- * Returns: the service name. This is the internal string used by the
- * connection, and must not be modified.
- **/
-const char *
-nm_active_connection_get_service_name (NMActiveConnection *connection)
-{
-	NMActiveConnectionPrivate *priv;
-
-	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
-
-	priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
-	if (!priv->service_name) {
-		priv->service_name = _nm_object_get_string_property (NM_OBJECT (connection),
-		                                                    NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                                    DBUS_PROP_SERVICE_NAME);
-		priv->scope = get_scope_for_service_name (priv->service_name);
-	}
-
-	return priv->service_name;
-}
-
-/**
- * nm_active_connection_get_scope:
- * @connection: a #NMActiveConnection
- *
- * Gets the scope of the active connection.
- *
- * Returns: the connection's scope
- **/
-NMConnectionScope
-nm_active_connection_get_scope (NMActiveConnection *connection)
-{
-	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NM_CONNECTION_SCOPE_UNKNOWN);
-
-	/* Make sure service_name and scope are up-to-date */
-	nm_active_connection_get_service_name (connection);
-	return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->scope;
-}
-
 /**
  * nm_active_connection_get_connection:
  * @connection: a #NMActiveConnection
@@ -171,7 +111,8 @@ nm_active_connection_get_connection (NMActiveConnection *connection)
 	if (!priv->connection) {
 		priv->connection = _nm_object_get_string_property (NM_OBJECT (connection),
 		                                                  NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                                  DBUS_PROP_CONNECTION);
+		                                                  DBUS_PROP_CONNECTION,
+		                                                  NULL);
 	}
 
 	return priv->connection;
@@ -197,7 +138,8 @@ nm_active_connection_get_specific_object (NMActiveConnection *connection)
 	if (!priv->specific_object) {
 		priv->specific_object = _nm_object_get_string_property (NM_OBJECT (connection),
 		                                                       NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                                       DBUS_PROP_SPECIFIC_OBJECT);
+		                                                       DBUS_PROP_SPECIFIC_OBJECT,
+		                                                       NULL);
 	}
 
 	return priv->specific_object;
@@ -209,7 +151,7 @@ nm_active_connection_get_specific_object (NMActiveConnection *connection)
  *
  * Gets the #NMDevice<!-- -->s used for the active connections.
  *
- * Returns: the #GPtrArray containing #NMDevice<!-- -->s.
+ * Returns: (element-type NMClient.Device): the #GPtrArray containing #NMDevice<!-- -->s.
  * This is the internal copy used by the connection, and must not be modified.
  **/
 const GPtrArray *
@@ -227,7 +169,8 @@ nm_active_connection_get_devices (NMActiveConnection *connection)
 	if (!_nm_object_get_property (NM_OBJECT (connection),
 	                             NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
 	                             DBUS_PROP_DEVICES,
-	                             &value)) {
+	                             &value,
+	                             NULL)) {
 		return NULL;
 	}
 
@@ -256,7 +199,8 @@ nm_active_connection_get_state (NMActiveConnection *connection)
 	if (!priv->state) {
 		priv->state = _nm_object_get_uint_property (NM_OBJECT (connection),
 		                                           NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                           DBUS_PROP_STATE);
+		                                           DBUS_PROP_STATE,
+		                                           NULL);
 	}
 
 	return priv->state;
@@ -282,7 +226,8 @@ nm_active_connection_get_default (NMActiveConnection *connection)
 	if (!priv->is_default) {
 		priv->is_default = _nm_object_get_boolean_property (NM_OBJECT (connection),
 		                                                    NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                                    DBUS_PROP_DEFAULT);
+		                                                    DBUS_PROP_DEFAULT,
+		                                                    NULL);
 	}
 
 	return priv->is_default;
@@ -308,7 +253,8 @@ nm_active_connection_get_default6 (NMActiveConnection *connection)
 	if (!priv->is_default6) {
 		priv->is_default6 = _nm_object_get_boolean_property (NM_OBJECT (connection),
 		                                                     NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
-		                                                     DBUS_PROP_DEFAULT6);
+		                                                     DBUS_PROP_DEFAULT6,
+		                                                     NULL);
 	}
 
 	return priv->is_default6;
@@ -345,7 +291,6 @@ finalize (GObject *object)
 {
 	NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
 
-	g_free (priv->service_name);
 	g_free (priv->connection);
 	g_free (priv->specific_object);
 
@@ -361,11 +306,8 @@ get_property (GObject *object,
 	NMActiveConnection *self = NM_ACTIVE_CONNECTION (object);
 
 	switch (prop_id) {
-	case PROP_SERVICE_NAME:
-		g_value_set_string (value, nm_active_connection_get_service_name (self));
-		break;
 	case PROP_CONNECTION:
-		g_value_set_boxed (value, nm_active_connection_get_connection (self));
+		g_value_set_string (value, nm_active_connection_get_connection (self));
 		break;
 	case PROP_SPECIFIC_OBJECT:
 		g_value_set_boxed (value, nm_active_connection_get_specific_object (self));
@@ -401,24 +343,11 @@ demarshal_devices (NMObject *object, GParamSpec *pspec, GValue *value, gpointer
 	return TRUE;
 }
 
-static gboolean
-demarshal_service (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
-{
-	NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
-
-	if (_nm_object_demarshal_generic (object, pspec, value, field)) {
-		priv->scope = get_scope_for_service_name (priv->service_name);
-		return TRUE;
-	}
-	return FALSE;
-}
-
 static void
 register_for_property_changed (NMActiveConnection *connection)
 {
 	NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
 	const NMPropertiesChangedInfo property_changed_info[] = {
-		{ NM_ACTIVE_CONNECTION_SERVICE_NAME,        demarshal_service,           &priv->service_name },
 		{ NM_ACTIVE_CONNECTION_CONNECTION,          _nm_object_demarshal_generic, &priv->connection },
 		{ NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT,     _nm_object_demarshal_generic, &priv->specific_object },
 		{ NM_ACTIVE_CONNECTION_DEVICES,             demarshal_devices,           &priv->devices },
@@ -476,19 +405,6 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
 	/* properties */
 
 	/**
-	 * NMActiveConnection:service-name:
-	 *
-	 * The service name of the active connection.
-	 **/
-	g_object_class_install_property
-		(object_class, PROP_SERVICE_NAME,
-		 g_param_spec_string (NM_ACTIVE_CONNECTION_SERVICE_NAME,
-						  "Service Name",
-						  "Service Name",
-						  NULL,
-						  G_PARAM_READABLE));
-
-	/**
 	 * NMActiveConnection:connection:
 	 *
 	 * The connection's path of the active connection.
@@ -538,7 +454,7 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
 							  "State",
 							  "State",
 							  NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
-							  NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
+							  NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
 							  NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
 							  G_PARAM_READABLE));