diff options
Diffstat (limited to 'libnm/nm-active-connection.c')
| -rw-r--r-- | libnm/nm-active-connection.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index a1636598..6a823403 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -28,7 +28,6 @@ #include "nm-object-private.h" #include "nm-core-internal.h" #include "nm-device.h" -#include "nm-device-private.h" #include "nm-connection.h" #include "nm-vpn-connection.h" #include "nm-dbus-helpers.h" @@ -38,14 +37,7 @@ #include "nm-ip6-config.h" #include "nm-remote-connection.h" -static GType _nm_active_connection_decide_type (GVariant *value); - -G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT, - _nm_object_register_type_func (g_define_type_id, - _nm_active_connection_decide_type, - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - "Vpn"); - ) +G_DEFINE_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT); #define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate)) @@ -88,16 +80,6 @@ enum { LAST_PROP }; -static GType -_nm_active_connection_decide_type (GVariant *value) -{ - /* @value is the value of the o.fd.NM.ActiveConnection property "VPN" */ - if (g_variant_get_boolean (value)) - return NM_TYPE_VPN_CONNECTION; - else - return NM_TYPE_ACTIVE_CONNECTION; -} - /** * nm_active_connection_get_connection: * @connection: a #NMActiveConnection @@ -129,7 +111,7 @@ nm_active_connection_get_id (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id); } /** @@ -146,7 +128,7 @@ nm_active_connection_get_uuid (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid); } /** @@ -163,7 +145,7 @@ nm_active_connection_get_connection_type (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type); } /** @@ -461,6 +443,7 @@ get_property (GObject *object, static gboolean demarshal_specific_object_path (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field) { + const char *v; char **param = (char **) field; /* We have to demarshal this manually, because the D-Bus property name @@ -471,8 +454,10 @@ demarshal_specific_object_path (NMObject *object, GParamSpec *pspec, GVariant *v if (!g_variant_is_of_type (value, G_VARIANT_TYPE_OBJECT_PATH)) return FALSE; + v = g_variant_get_string (value, NULL); + g_free (*param); - *param = g_variant_dup_string (value, NULL); + *param = nm_streq0 (v, "/") ? NULL : g_strdup (v); return TRUE; } @@ -516,8 +501,6 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_ACTIVE_CONNECTION); - /* virtual methods */ object_class->get_property = get_property; object_class->dispose = dispose; |