From 879820ccd54be34deda42791f45ab2b284281425 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 20 Jan 2019 14:01:24 +0100 Subject: [PATCH] libnm: emit "notify:name" signal when changing gendata property (NMSettingEthtool) We want to emit a change notification when gendata-based settings (like NMSettingEthtool) change. But instead of adding a separate signal, just emit a fake "notify:name" notification. --- libnm-core/nm-setting.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index 73f94a9628..b26ab6b3d2 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -1111,6 +1111,8 @@ duplicate_copy_properties (const NMSettInfoSetting *sett_info, if (sett_info->detail.gendata_info) { GenData *gendata = _gendata_hash (src, FALSE); + nm_assert (!_gendata_hash (dst, FALSE)); + if ( gendata && g_hash_table_size (gendata->hash) > 0) { GHashTableIter iter; @@ -2322,7 +2324,7 @@ _nm_setting_gendata_notify (NMSetting *setting, gendata = _gendata_hash (setting, FALSE); if (!gendata) - return; + goto out; nm_clear_g_free (&gendata->values); @@ -2332,7 +2334,7 @@ _nm_setting_gendata_notify (NMSetting *setting, nm_clear_g_free (&gendata->names); } - /* Note, that currently there is now way to notify the subclass when gendata changed. + /* Note, currently there is no way to notify the subclass when gendata changed. * gendata is only changed in two situations: * 1) from within NMSetting itself, for example when creating a NMSetting instance * from keyfile or a D-Bus GVariant. @@ -2345,6 +2347,9 @@ _nm_setting_gendata_notify (NMSetting *setting, * * If we ever need it, then we would need to call a virtual function to notify the subclass * that gendata changed. */ + +out: + _nm_setting_emit_property_changed (setting); } GVariant * @@ -2467,7 +2472,7 @@ nm_setting_gendata_get_all_values (NMSetting *setting) void _nm_setting_gendata_to_gvalue (NMSetting *setting, - GValue *value) + GValue *value) { GenData *gendata; GHashTable *new;