diff options
author | Dan Williams <dcbw@redhat.com> | 2012-10-22 12:36:09 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-10-29 15:12:58 -0500 |
commit | 38e3819b4ee9b68e877e0452875ab6d5cbcfdff5 (patch) | |
tree | b4bf46e86c57a47c0232226be8aea025264a1d02 /libnm-util/nm-setting-private.h | |
parent | 1277f9986c83594faba4dd305678a27db1c7c9d1 (diff) | |
download | NetworkManager-38e3819b4ee9b68e877e0452875ab6d5cbcfdff5.tar.gz |
libnm-util: clean up setting registration
Make setting type registration less icky; instead of having the
connection register all the settings, have the settings themselves
register that information at library load time. Putting this sort
of thing in G_DEFINE_TYPE_WITH_CODE is apparently more standard
than the home-rolled stuff we had before. Also document the
priority stuff so when adding new settings, people know what
priority to use.
(cleanups by jklimes)
Diffstat (limited to 'libnm-util/nm-setting-private.h')
-rw-r--r-- | libnm-util/nm-setting-private.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h index 5c4e0a5ede..1460841c97 100644 --- a/libnm-util/nm-setting-private.h +++ b/libnm-util/nm-setting-private.h @@ -21,11 +21,23 @@ #ifndef NM_SETTING_PRIVATE_H #define NM_SETTING_PRIVATE_H +#include "nm-glib-compat.h" + #define NM_SETTING_SECRET_FLAGS_ALL \ (NM_SETTING_SECRET_FLAG_NONE | \ NM_SETTING_SECRET_FLAG_AGENT_OWNED | \ NM_SETTING_SECRET_FLAG_NOT_SAVED | \ NM_SETTING_SECRET_FLAG_NOT_REQUIRED) +void _nm_register_setting (const char *name, + const GType type, + const guint32 priority, + const GQuark error_quark); + +/* Ensure the setting's GType is registered at library load time */ +#define NM_SETTING_REGISTER_TYPE(x) \ +static void __attribute__((constructor)) register_setting (void) \ +{ g_type_init (); g_type_ensure (x); } + #endif /* NM_SETTING_PRIVATE_H */ |