summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-10-22 12:36:09 -0500
committerDan Williams <dcbw@redhat.com>2012-10-29 15:12:58 -0500
commit38e3819b4ee9b68e877e0452875ab6d5cbcfdff5 (patch)
treeb4bf46e86c57a47c0232226be8aea025264a1d02 /include
parent1277f9986c83594faba4dd305678a27db1c7c9d1 (diff)
downloadNetworkManager-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 'include')
-rw-r--r--include/nm-glib-compat.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h
index f9c1ae495d..63d9598dfc 100644
--- a/include/nm-glib-compat.h
+++ b/include/nm-glib-compat.h
@@ -74,4 +74,13 @@ p##_get_type (void) \
}
#endif
+#if !GLIB_CHECK_VERSION(2,34,0)
+static inline void
+g_type_ensure (GType type)
+{
+ if (G_UNLIKELY (type == (GType)-1))
+ g_error ("can't happen");
+}
+#endif
+
#endif /* NM_GLIB_COMPAT_H */