summaryrefslogtreecommitdiff
path: root/libnm/nm-ip4-config.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-08-25 15:25:27 -0400
committerDan Winship <danw@gnome.org>2014-09-04 09:21:05 -0400
commit98959d5432abfbc1ff77f9b3952ead019cba936b (patch)
tree319ed1dc4b7a04017dd3fe2288ade310c1ad3fc4 /libnm/nm-ip4-config.c
parent356fb7d77eef522767312a9a9fd8e2d2a2f77fd4 (diff)
downloadNetworkManager-98959d5432abfbc1ff77f9b3952ead019cba936b.tar.gz
libnm: fix NMIP4Config/NMIP6Config addresses/routes properties
The docs for NMIP4Config:addresses and NMIP4Config:routes claimed that they were GPtrArrays of NMIP4Address/NMIP4Route, but get_property() was actually trying to set them the D-Bus representation type, and it was failing anyway because it used g_value_set_boxed() on a parameter that was declared GParamSpecPointer. Fix it to use a GPtrArray-valued property, and set it to the right thing. NMIP6Config did the right thing with its :addresses and :routes properties, but was using custom types (NM_TYPE_IP6_ADDRESS_OBJECT_ARRAY and NM_TYPE_IP6_ROUTE_OBJECT_ARRAY). Make it use G_TYPE_PTR_ARRAY instead. nm-types.c, nm-types.h, and nm-types-private.h are now empty, and so can be dropped.
Diffstat (limited to 'libnm/nm-ip4-config.c')
-rw-r--r--libnm/nm-ip4-config.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/libnm/nm-ip4-config.c b/libnm/nm-ip4-config.c
index 39a9b6b4dc..b469a63bfc 100644
--- a/libnm/nm-ip4-config.c
+++ b/libnm/nm-ip4-config.c
@@ -24,9 +24,9 @@
#include <nm-setting-ip4-config.h>
#include "nm-ip4-config.h"
#include "nm-dbus-interface.h"
-#include "nm-types-private.h"
#include "nm-object-private.h"
#include "nm-utils.h"
+#include "nm-core-internal.h"
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_OBJECT)
@@ -183,10 +183,14 @@ get_property (GObject *object,
g_value_set_string (value, nm_ip4_config_get_gateway (self));
break;
case PROP_ADDRESSES:
- nm_utils_ip4_addresses_to_gvalue (priv->addresses, value);
+ g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->addresses,
+ (NMUtilsCopyFunc) nm_ip4_address_dup,
+ (GDestroyNotify) nm_ip4_address_unref));
break;
case PROP_ROUTES:
- nm_utils_ip4_routes_to_gvalue (priv->routes, value);
+ g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->routes,
+ (NMUtilsCopyFunc) nm_ip4_route_dup,
+ (GDestroyNotify) nm_ip4_route_unref));
break;
case PROP_NAMESERVERS:
g_value_set_boxed (value, (char **) nm_ip4_config_get_nameservers (self));
@@ -237,24 +241,26 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
/**
* NMIP4Config:addresses:
*
- * The #GPtrArray containing #NMIP4Address<!-- -->es of the configuration.
+ * A #GPtrArray containing the addresses (#NMIP4Address) of the configuration.
**/
g_object_class_install_property
(object_class, PROP_ADDRESSES,
- g_param_spec_pointer (NM_IP4_CONFIG_ADDRESSES, "", "",
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ g_param_spec_boxed (NM_IP4_CONFIG_ADDRESSES, "", "",
+ G_TYPE_PTR_ARRAY,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
/**
* NMIP4Config:routes:
*
- * The #GPtrArray containing #NMSettingIP4Routes of the configuration.
+ * A #GPtrArray containing the routes (#NMIP4Route) of the configuration.
**/
g_object_class_install_property
(object_class, PROP_ROUTES,
- g_param_spec_pointer (NM_IP4_CONFIG_ROUTES, "", "",
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ g_param_spec_boxed (NM_IP4_CONFIG_ROUTES, "", "",
+ G_TYPE_PTR_ARRAY,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
/**
* NMIP4Config:nameservers: