diff options
author | Thomas Haller <thaller@redhat.com> | 2018-07-27 14:08:14 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-08-10 10:38:19 +0200 |
commit | 9c47e2ce30e7b1f78c59fc72edca2def935261e0 (patch) | |
tree | 5ee11cbf4631b9680be84282af419fa3e4d28c76 /libnm-core/nm-setting-wimax.c | |
parent | d70dcb16da42edcc8541f3816c45c181cd1d6947 (diff) | |
download | NetworkManager-9c47e2ce30e7b1f78c59fc72edca2def935261e0.tar.gz |
libnm: use NMMetaSettingInfo for tracking setting priority
Previously, each (non abstract) NMSetting class had to register
its name and priority via _nm_register_setting().
Note, that libnm-core.la already links against "nm-meta-setting.c",
which also redundantly keeps track of the settings name and gtype
as well.
Re-use NMMetaSettingInfo also in libnm-core.la, to track this meta
data.
The goal is to get rid of private data structures that track
meta data about NMSetting classes. In this case, "registered_settings"
hash. Instead, we should have one place where all this meta data
is tracked. This was, it is also accessible as internal API,
which can be useful (for keyfile).
Note that NMSettingClass has some overlap with NMMetaSettingInfo.
One difference is, that NMMetaSettingInfo is const, while NMSettingClass
is only initialized during the class_init() method. Appart from that,
it's mostly a matter of taste, whether we attach meta data to
NMSettingClass, to NMMetaSettingInfo, or to a static-array indexed
by NMMetaSettingType.
Note, that previously, _nm_register_setting() was private API. That
means, no user could subclass a functioning NMSetting instance. The same
is still true: NMMetaSettingInfo is internal API and users cannot access
it to create their own NMSetting subclasses. But that is almost desired.
libnm is not designed, to be extensible via subclassing, nor is it
clear why that would be a useful thing to do. One day, we should remove
the NMSetting and NMSettingClass definitions from public headers. Their
only use is subclassing the types, which however does not work.
While libnm-core was linking already against nm-meta-setting.c,
nm_meta_setting_infos was unreferenced. So, this change increases
the binary size of libnm and NetworkManager (1032 bytes). Note however
that roughly the same information was previously allocated at runtime.
Diffstat (limited to 'libnm-core/nm-setting-wimax.c')
-rw-r--r-- | libnm-core/nm-setting-wimax.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libnm-core/nm-setting-wimax.c b/libnm-core/nm-setting-wimax.c index 852ba755ec..12ab0da374 100644 --- a/libnm-core/nm-setting-wimax.c +++ b/libnm-core/nm-setting-wimax.c @@ -42,8 +42,7 @@ * connections cannot be activated. **/ -G_DEFINE_TYPE_WITH_CODE (NMSettingWimax, nm_setting_wimax, NM_TYPE_SETTING, - _nm_register_setting (WIMAX, NM_SETTING_PRIORITY_HW_BASE)) +G_DEFINE_TYPE (NMSettingWimax, nm_setting_wimax, NM_TYPE_SETTING) #define NM_SETTING_WIMAX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_WIMAX, NMSettingWimaxPrivate)) @@ -217,7 +216,8 @@ nm_setting_wimax_class_init (NMSettingWimaxClass *klass) object_class->get_property = get_property; object_class->finalize = finalize; - setting_class->verify = verify; + setting_class->setting_info = &nm_meta_setting_infos[NM_META_SETTING_TYPE_WIMAX]; + setting_class->verify = verify; /** * NMSettingWimax:network-name: |