summary refs log tree commit diff
path: root/libnm-core/nm-setting.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-core/nm-setting.c')
-rw-r--r--libnm-core/nm-setting.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 82467c9c..e4be8706 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -147,6 +147,8 @@ _ensure_registered_constructor (void)
  * can be established, like PPP, PPPoE, etc.
  *
  * 4: IP-level stuff
+ *
+ * 10: NMSettingUser
  */
 void
 (_nm_register_setting) (const char *name,
@@ -158,7 +160,6 @@ void
 	g_return_if_fail (name != NULL && *name);
 	g_return_if_fail (type != G_TYPE_INVALID);
 	g_return_if_fail (type != G_TYPE_NONE);
-	g_return_if_fail (priority <= 4);
 
 	_ensure_registered ();
 
@@ -304,8 +305,8 @@ typedef struct {
 	NMSettingPropertyTransformFromFunc from_dbus;
 } NMSettingProperty;
 
-static GQuark setting_property_overrides_quark;
-static GQuark setting_properties_quark;
+static NM_CACHED_QUARK_FCN ("nm-setting-property-overrides", setting_property_overrides_quark)
+static NM_CACHED_QUARK_FCN ("nm-setting-properties", setting_properties_quark)
 
 static NMSettingProperty *
 find_property (GArray *properties, const char *name)
@@ -341,7 +342,7 @@ add_property_override (NMSettingClass *setting_class,
 	GArray *overrides;
 	NMSettingProperty override;
 
-	g_return_if_fail (g_type_get_qdata (setting_type, setting_properties_quark) == NULL);
+	g_return_if_fail (g_type_get_qdata (setting_type, setting_properties_quark ()) == NULL);
 
 	memset (&override, 0, sizeof (override));
 	override.name = property_name;
@@ -354,10 +355,10 @@ add_property_override (NMSettingClass *setting_class,
 	override.to_dbus = to_dbus;
 	override.from_dbus = from_dbus;
 
-	overrides = g_type_get_qdata (setting_type, setting_property_overrides_quark);
+	overrides = g_type_get_qdata (setting_type, setting_property_overrides_quark ());
 	if (!overrides) {
 		overrides = g_array_new (FALSE, FALSE, sizeof (NMSettingProperty));
-		g_type_set_qdata (setting_type, setting_property_overrides_quark, overrides);
+		g_type_set_qdata (setting_type, setting_property_overrides_quark (), overrides);
 	}
 	g_return_if_fail (find_property (overrides, property_name) == NULL);
 
@@ -530,14 +531,14 @@ nm_setting_class_ensure_properties (NMSettingClass *setting_class)
 	GParamSpec **property_specs;
 	guint n_property_specs, i;
 
-	properties = g_type_get_qdata (type, setting_properties_quark);
+	properties = g_type_get_qdata (type, setting_properties_quark ());
 	if (properties)
 		return properties;
 
 	/* Build overrides array from @setting_class and its superclasses */
 	overrides = g_array_new (FALSE, FALSE, sizeof (NMSettingProperty));
 	for (otype = type; otype != G_TYPE_OBJECT; otype = g_type_parent (otype)) {
-		type_overrides = g_type_get_qdata (otype, setting_property_overrides_quark);
+		type_overrides = g_type_get_qdata (otype, setting_property_overrides_quark ());
 		if (type_overrides)
 			g_array_append_vals (overrides, (NMSettingProperty *)type_overrides->data, type_overrides->len);
 	}
@@ -568,7 +569,7 @@ nm_setting_class_ensure_properties (NMSettingClass *setting_class)
 	}
 	g_array_unref (overrides);
 
-	g_type_set_qdata (type, setting_properties_quark, properties);
+	g_type_set_qdata (type, setting_properties_quark (), properties);
 	return properties;
 }
 
@@ -1995,11 +1996,6 @@ nm_setting_class_init (NMSettingClass *setting_class)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
 
-	if (!setting_property_overrides_quark)
-		setting_property_overrides_quark = g_quark_from_static_string ("nm-setting-property-overrides");
-	if (!setting_properties_quark)
-		setting_properties_quark = g_quark_from_static_string ("nm-setting-properties");
-
 	g_type_class_add_private (setting_class, sizeof (NMSettingPrivate));
 
 	/* virtual methods */