libnm: hide NMSetting types from public headers

When subclassing a GObject type, the class and object structs
must be available and defined in the header.

For libnm, and in particular for NMSetting classes, we don't want
users to subclass NMSetting. It also doesn't work, because libnm
has internal code that is necessary to hook up the NMSetting class.
You cannot define your own type and make it work together with
libnm.

Having the structs in public headers limits what we can do with them.
For example, we could embed the private data directly in the structures
and avoid the additional indirection.

This is an API break, but for something that most likely nobody cares
about. Or better, nobody should care about. API is not what is
accidentally defined in a header, API was the library provides to
meaningfully use. Subclassing these types is not meaningful and was
only accidentally possible so far.

Only hide the structs for now. More cleanup is possible later. We shall
however aim to keep the padding and struct layout to not also break ABI.

(cherry picked from commit e46d484fae)
This commit is contained in:
Thomas Haller
2021-06-11 00:27:31 +02:00
parent f07c135c42
commit 65278461a3
70 changed files with 674 additions and 583 deletions

View File

@@ -35,6 +35,21 @@ typedef struct {
bool browser_only : 1;
} NMSettingProxyPrivate;
/**
* NMSettingProxy:
*
* WWW Proxy Settings
*/
struct _NMSettingProxy {
NMSetting parent;
};
struct _NMSettingProxyClass {
NMSettingClass parent;
gpointer padding[4];
};
G_DEFINE_TYPE(NMSettingProxy, nm_setting_proxy, NM_TYPE_SETTING)
#define NM_SETTING_PROXY_GET_PRIVATE(o) \