diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-24 17:41:32 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-25 11:38:56 +0200 |
commit | f895fa4f28b1f317ea3dabbc2dcf9441fe24cc57 (patch) | |
tree | 616d4bd77b74049b2cdba32e7cb74fa0193f46c3 /libnm-core/nm-utils.c | |
parent | 39bd2e1f1542a8bf30d11dd8444685f596d86a87 (diff) | |
download | NetworkManager-th/libnm-setting-cleanup.tar.gz |
libnm: unify property-to-dbus handling of NMSettingth/libnm-setting-cleanup
Merge the function pointer get_func() into to_dbus_fcn().
Previously, get_func() as handled separately from to_dbus_fnc()
(formerly synth_func()). The notion was that synth-func would syntetize
properties that are D-Bus only. But that distinction does not seem
very helpful to me.
Instaed, we want to convert a property to D-Bus. Period. The
implementation should be handled uniformly. Hence, now that is
all done by property_to_dbus().
Note that property_to_dbus() is also called as default implementation
for compare-property. At least, for properties that are backed by a
GObject property.
Diffstat (limited to 'libnm-core/nm-utils.c')
-rw-r--r-- | libnm-core/nm-utils.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 9a1430f6c7..55206e6bf3 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -4256,12 +4256,15 @@ _nm_utils_hwaddr_to_dbus_impl (const char *str) } GVariant * -_nm_utils_hwaddr_cloned_get (NMSetting *setting, - const char *property) +_nm_utils_hwaddr_cloned_get (const NMSettInfoSetting *sett_info, + guint property_idx, + NMConnection *connection, + NMSetting *setting, + NMConnectionSerializationFlags flags) { gs_free char *addr = NULL; - nm_assert (nm_streq0 (property, "cloned-mac-address")); + nm_assert (nm_streq (sett_info->property_infos[property_idx].name, "cloned-mac-address")); g_object_get (setting, "cloned-mac-address", &addr, NULL); return _nm_utils_hwaddr_to_dbus_impl (addr); @@ -6766,13 +6769,20 @@ nm_utils_base64secret_normalize (const char *base64_key, } GVariant * -_nm_utils_bridge_vlans_to_dbus (NMSetting *setting, const char *property) +_nm_utils_bridge_vlans_to_dbus (const NMSettInfoSetting *sett_info, + guint property_idx, + NMConnection *connection, + NMSetting *setting, + NMConnectionSerializationFlags flags) { gs_unref_ptrarray GPtrArray *vlans = NULL; GVariantBuilder builder; guint i; + const char *property_name = sett_info->property_infos[property_idx].name; + + nm_assert (property_name); - g_object_get (setting, property, &vlans, NULL); + g_object_get (setting, property_name, &vlans, NULL); g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}")); if (vlans) { |