return;
}
+ if ((flags & G_SETTINGS_BIND_GET) && (binding->property->flags & G_PARAM_WRITABLE) == 0)
+ {
+ g_critical ("g_settings_bind: property '%s' on class '%s' is not writable",
+ property, G_OBJECT_TYPE_NAME (object));
+ return;
+ }
+ if ((flags & G_SETTINGS_BIND_SET) && (binding->property->flags & G_PARAM_READABLE) == 0)
+ {
+ g_critical ("g_settings_bind: property '%s' on class '%s' is not readable",
+ property, G_OBJECT_TYPE_NAME (object));
+ return;
+ }
+
{
GVariant *value;
sensitive = g_object_class_find_property (objectclass, "sensitive");
- if (sensitive && sensitive->value_type == G_TYPE_BOOLEAN)
+ if (sensitive && sensitive->value_type == G_TYPE_BOOLEAN &&
+ (sensitive->flags & G_PARAM_WRITABLE))
g_settings_bind_writable (settings, binding->key,
object, "sensitive", FALSE);
}
{
GSettingsWritableBinding *binding;
gchar *detailed_signal;
+ GParamSpec *pspec;
+
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), property);
+ if (pspec == NULL)
+ {
+ g_critical ("g_settings_bind_writable: no property '%s' on class '%s'",
+ property, G_OBJECT_TYPE_NAME (object));
+ return;
+ }
+ if ((pspec->flags & G_PARAM_WRITABLE) == 0)
+ {
+ g_critical ("g_settings_bind_writable: property '%s' on class '%s' is not writable",
+ property, G_OBJECT_TYPE_NAME (object));
+ return;
+ }
binding = g_slice_new (GSettingsWritableBinding);
binding->settings = g_object_ref (settings);
/**
* GSettingsBindFlags:
* @G_SETTINGS_BIND_DEFAULT: Equivalent to <literal>G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET</literal>
- * @G_SETTINGS_BIND_GET: Update the #GObject property when the setting changes
- * @G_SETTINGS_BIND_SET: Update the setting when the #GObject property changes
+ * @G_SETTINGS_BIND_GET: Update the #GObject property when the setting changes.
+ * It is an error to use this flag if the property is not writable.
+ * @G_SETTINGS_BIND_SET: Update the setting when the #GObject property changes.
+ * It is an error to use this flag if the property is not readable.
* @G_SETTINGS_BIND_NO_SENSITIVITY: Do not try to bind a "sensitivity" property to the writability of the setting
* @G_SETTINGS_BIND_GET_NO_CHANGES: When set in addition to #G_SETTINGS_BIND_GET, set the #GObject property
* value initially from the setting, but do not listen for changes of the setting