Skip to content
  • Thomas Haller's avatar
    libnm: use NMMetaSettingInfo for tracking setting priority · 9c47e2ce
    Thomas Haller authored
    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.
    9c47e2ce