diff options
author | Dan Winship <danw@gnome.org> | 2012-01-19 18:23:28 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-02-03 10:33:43 -0600 |
commit | 5afcee46936ab547a95fdaa7e415aa3ba6de47d2 (patch) | |
tree | eeebe2e20e01b5bd99d8d1a32c06e8f3fc590d74 /libnm-glib/nm-dhcp6-config.c | |
parent | 2e48cc092c133ed3e10efcc00cf36b29c9d3efc8 (diff) | |
download | NetworkManager-5afcee46936ab547a95fdaa7e415aa3ba6de47d2.tar.gz |
libnm-glib: simplify property getter methods
Rather than having every property getter method have code to fetch
that specific property's value, just call the new
_nm_object_ensure_inited() (which makes sure that we've read all the
property values on the object at least once), and then return the
cached value. (After we've read the initial property values, the
PropertiesChanged signal handler will ensure that the values are kept
up to date, so we can always just return cached property values after
that point.)
This then lets us get rid of _nm_object_get_property() and its
wrappers.
Diffstat (limited to 'libnm-glib/nm-dhcp6-config.c')
-rw-r--r-- | libnm-glib/nm-dhcp6-config.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/libnm-glib/nm-dhcp6-config.c b/libnm-glib/nm-dhcp6-config.c index c282a279a9..84eb88fbd1 100644 --- a/libnm-glib/nm-dhcp6-config.c +++ b/libnm-glib/nm-dhcp6-config.c @@ -212,24 +212,10 @@ nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path) GHashTable * nm_dhcp6_config_get_options (NMDHCP6Config *config) { - NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (config); - GValue value = { 0, }; - - if (g_hash_table_size (priv->options)) - return priv->options; - - if (!_nm_object_get_property (NM_OBJECT (config), - NM_DBUS_INTERFACE_DHCP6_CONFIG, - "Options", - &value, - NULL)) - goto out; - - demarshal_dhcp6_options (NM_OBJECT (config), NULL, &value, &priv->options); - g_value_unset (&value); + g_return_val_if_fail (NM_IS_DHCP6_CONFIG (config), NULL); -out: - return priv->options; + _nm_object_ensure_inited (NM_OBJECT (config)); + return NM_DHCP6_CONFIG_GET_PRIVATE (config)->options; } /** |