Skip to content

[th/setting-direct-properties] introduce "direct" properties for handling standard NMSetting properties

Thomas Haller requested to merge th/setting-direct-properties into main

We have different manners and styles how to implement properties for NMSetting subclasses.

A popular one, is to have a GObject property, and mostly "generate" all the behaviors around that.

That makes some sense and has advantages and disadvantages:

  • (+) GObject properties behave well with introspection and a glib developer will be familiar with them.

  • (+) the provide some meta data, and we can handle those properties generically

  • (-) they require a lot of boiler plate code still

  • (-) the are based around GValue, which is not as efficient as it could be

  • (-) GObject properties in general are relatively heavy weight.

We can do better. We can have better meta-data beyond GObject properties and thereby even mostly get rid of the boilerplate that we need to ipmlement them.

In essense, introduce "direct" properties. These a a simple kind of properties, that we can implmenent in a generic way.

In general, we want that all our properties behave similar and in a familiar way, so there is a goal to have few property types. So, most properties should be implementable as such "direct" properties, with little special casing.

What we need for a direct property is really just the storage in the NMSetting_TYPE_Private field, where we can get and set the property. Also, we need a GParamSpec, which encodes some additional properties (like default value).

This branch introduces this concept, and shows it at some examples.

What this also gives, is efficient access to the property, without going through GValue. There are other things we could do, like improve our from_dbus_fcn(), comparing properties, and read/write from keyfile. This effort really finally brings a powerful and efficient way to handle meta-information about our GObject-property-based properties.

Merge request reports