package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Settings/index.html

Module Wrappers.Settings

type t = [ `settings | `object_ ] Gobject.obj
val new_ : string -> t

Create a new Settings

val new_with_path : string -> string -> t

Create a new Settings

val set_value : t -> string -> Gvariant.t -> bool

Sets @key in @settings to @value.

It is a programmer error to give a @key that isn't contained in the schema for @settings or for @value to have the incorrect type, per the schema.

If @value is floating then this function consumes the reference.

val set_uint64 : t -> string -> UInt64.t -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for 64-bit unsigned integers.

It is a programmer error to give a @key that isn't specified as having a uint64 type in the schema for @settings.

val set_uint : t -> string -> int -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for 32-bit unsigned integers.

It is a programmer error to give a @key that isn't specified as having a uint32 type in the schema for @settings.

val set_strv : t -> string -> string array option -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for string arrays. If @value is %NULL, then @key is set to be the empty array.

It is a programmer error to give a @key that isn't specified as having an array of strings type in the schema for @settings.

val set_string : t -> string -> string -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for strings.

It is a programmer error to give a @key that isn't specified as having a string type in the schema for @settings.

val set_int64 : t -> string -> int64 -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for 64-bit integers.

It is a programmer error to give a @key that isn't specified as having a int64 type in the schema for @settings.

val set_int : t -> string -> int -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for 32-bit integers.

It is a programmer error to give a @key that isn't specified as having a int32 type in the schema for @settings.

val set_flags : t -> string -> int -> bool

Looks up the flags type nicks for the bits specified by @value, puts them in an array of strings and writes the array to @key, within @settings.

It is a programmer error to give a @key that isn't contained in the schema for @settings or is not marked as a flags type, or for @value to contain any bits that are not value for the named type.

After performing the write, accessing @key directly with g_settings_get_strv() will return an array of 'nicks'; one for each bit in @value.

val set_enum : t -> string -> int -> bool

Looks up the enumerated type nick for @value and writes it to @key, within @settings.

It is a programmer error to give a @key that isn't contained in the schema for @settings or is not marked as an enumerated type, or for @value not to be a valid value for the named type.

After performing the write, accessing @key directly with g_settings_get_string() will return the 'nick' associated with @value.

val set_double : t -> string -> float -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for doubles.

It is a programmer error to give a @key that isn't specified as having a 'double' type in the schema for @settings.

val set_boolean : t -> string -> bool -> bool

Sets @key in @settings to @value.

A convenience variant of g_settings_set() for booleans.

It is a programmer error to give a @key that isn't specified as having a boolean type in the schema for @settings.

val revert : t -> unit

Reverts all non-applied changes to the settings. This function does nothing unless @settings is in 'delay-apply' mode; see g_settings_delay(). In the normal case settings are always applied immediately.

Change notifications will be emitted for affected keys.

val reset : t -> string -> unit

Resets @key to its default value.

This call resets the key, as much as possible, to its default value. That might be the value specified in the schema or the one set by the administrator.

val range_check : t -> string -> Gvariant.t -> bool

Checks if the given @value is of the correct type and within the permitted range for @key.

val list_keys : t -> string array

Introspects the list of keys on @settings.

You should probably not be calling this function from "normal" code (since you should already know what keys are in your schema). This function is intended for introspection reasons.

You should free the return value with g_strfreev() when you are done with it.

val list_children : t -> string array

Gets the list of children on @settings.

The list is exactly the list of strings for which it is not an error to call g_settings_get_child().

There is little reason to call this function from "normal" code, since you should already know what children are in your schema. This function may still be useful there for introspection reasons, however.

You should free the return value with g_strfreev() when you are done with it.

val is_writable : t -> string -> bool

Finds out if a key can be written or not

val get_value : t -> string -> Gvariant.t

Gets the value that is stored in @settings for @key.

It is a programmer error to give a @key that isn't contained in the schema for @settings.

val get_user_value : t -> string -> Gvariant.t option

Checks the "user value" of a key, if there is one.

The user value of a key is the last value that was set by the user.

After calling g_settings_reset() this function should always return %NULL (assuming something is not wrong with the system configuration).

It is possible that g_settings_get_value() will return a different value than this function. This can happen in the case that the user set a value for a key that was subsequently locked down by the system administrator -- this function will return the user's old value.

This function may be useful for adding a "reset" option to a UI or for providing indication that a particular value has been changed.

It is a programmer error to give a @key that isn't contained in the schema for @settings.

val get_uint64 : t -> string -> UInt64.t

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for 64-bit unsigned integers.

It is a programmer error to give a @key that isn't specified as having a uint64 type in the schema for @settings.

val get_uint : t -> string -> int

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for 32-bit unsigned integers.

It is a programmer error to give a @key that isn't specified as having a uint32 type in the schema for @settings.

val get_strv : t -> string -> string array

A convenience variant of g_settings_get() for string arrays.

It is a programmer error to give a @key that isn't specified as having an array of strings type in the schema for @settings.

val get_string : t -> string -> string

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for strings.

It is a programmer error to give a @key that isn't specified as having a string type in the schema for @settings.

val get_range : t -> string -> Gvariant.t

Queries the range of a key.

val get_int64 : t -> string -> int64

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for 64-bit integers.

It is a programmer error to give a @key that isn't specified as having a int64 type in the schema for @settings.

val get_int : t -> string -> int

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for 32-bit integers.

It is a programmer error to give a @key that isn't specified as having a int32 type in the schema for @settings.

val get_has_unapplied : t -> bool

Returns whether the #GSettings object has any unapplied changes. This can only be the case if it is in 'delayed-apply' mode.

val get_flags : t -> string -> int

Gets the value that is stored in @settings for @key and converts it to the flags value that it represents.

In order to use this function the type of the value must be an array of strings and it must be marked in the schema file as a flags type.

It is a programmer error to give a @key that isn't contained in the schema for @settings or is not marked as a flags type.

If the value stored in the configuration database is not a valid value for the flags type then this function will return the default value.

val get_enum : t -> string -> int

Gets the value that is stored in @settings for @key and converts it to the enum value that it represents.

In order to use this function the type of the value must be a string and it must be marked in the schema file as an enumerated type.

It is a programmer error to give a @key that isn't contained in the schema for @settings or is not marked as an enumerated type.

If the value stored in the configuration database is not a valid value for the enumerated type then this function will return the default value.

val get_double : t -> string -> float

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for doubles.

It is a programmer error to give a @key that isn't specified as having a 'double' type in the schema for @settings.

val get_default_value : t -> string -> Gvariant.t option

Gets the "default value" of a key.

This is the value that would be read if g_settings_reset() were to be called on the key.

Note that this may be a different value than returned by g_settings_schema_key_get_default_value() if the system administrator has provided a default value.

Comparing the return values of g_settings_get_default_value() and g_settings_get_value() is not sufficient for determining if a value has been set because the user may have explicitly set the value to something that happens to be equal to the default. The difference here is that if the default changes in the future, the user's key will still be set.

This function may be useful for adding an indication to a UI of what the default value was before the user set it.

It is a programmer error to give a @key that isn't contained in the schema for @settings.

val get_child : t -> string -> t

Creates a child settings object which has a base path of `base-path/@name`, where `base-path` is the base path of @settings.

The schema for the child settings object must have been declared in the schema of @settings using a `<child>` element.

The created child settings object will inherit the #GSettings:delay-apply mode from @settings.

val get_boolean : t -> string -> bool

Gets the value that is stored at @key in @settings.

A convenience variant of g_settings_get() for booleans.

It is a programmer error to give a @key that isn't specified as having a boolean type in the schema for @settings.

val delay : t -> unit

Changes the #GSettings object into 'delay-apply' mode. In this mode, changes to @settings are not immediately propagated to the backend, but kept locally until g_settings_apply() is called.

val create_action : t -> string -> [ `action ] Gobject.obj

Creates a #GAction corresponding to a given #GSettings key.

The action has the same name as the key.

The value of the key becomes the state of the action and the action is enabled when the key is writable. Changing the state of the action results in the key being written to. Changes to the value or writability of the key cause appropriate change notifications to be emitted for the action.

For boolean-valued keys, action activations take no parameter and result in the toggling of the value. For all other types, activations take the new value for the key (which must have the correct type).

val bind_writable : t -> string -> [ `object_ ] Gobject.obj -> string -> bool -> unit

Create a binding between the writability of @key in the @settings object and the property @property of @object. The property must be boolean; "sensitive" or "visible" properties of widgets are the most likely candidates.

Writable bindings are always uni-directional; changes of the writability of the setting will be propagated to the object property, not the other way.

When the @inverted argument is %TRUE, the binding inverts the value as it passes from the setting to the object, i.e. @property will be set to %TRUE if the key is not writable.

Note that the lifecycle of the binding is tied to @object, and that you can have only one binding per object property. If you bind the same property twice on the same object, the second binding overrides the first one.

val bind : t -> string -> [ `object_ ] Gobject.obj -> string -> Gio_enums.settingsbindflags -> unit

Create a binding between the @key in the @settings object and the property @property of @object.

The binding uses the default GIO mapping functions to map between the settings and property values. These functions handle booleans, numeric types and string types in a straightforward way. Use g_settings_bind_with_mapping() if you need a custom mapping, or map between types that are not supported by the default mapping functions.

Unless the @flags include %G_SETTINGS_BIND_NO_SENSITIVITY, this function also establishes a binding between the writability of @key and the "sensitive" property of @object (if @object has a boolean property by that name). See g_settings_bind_writable() for more details about writable bindings.

Note that the lifecycle of the binding is tied to @object, and that you can have only one binding per object property. If you bind the same property twice on the same object, the second binding overrides the first one.

val apply : t -> unit

Applies any changes that have been made to the settings. This function does nothing unless @settings is in 'delay-apply' mode; see g_settings_delay(). In the normal case settings are always applied immediately.

val get_delay_apply : t -> bool

Get property: delay-apply

val get_path : t -> string

Get property: path

val get_schema : t -> string

Get property: schema

val get_schema_id : t -> string

Get property: schema-id

val get_settings_schema : t -> [ `settings_schema ] Gobject.obj

Get property: settings-schema

val on_changed : ?after:bool -> t -> callback:(key:string -> unit) -> Gobject.Signal.handler_id
val on_writable_change_event : ?after:bool -> t -> callback:(key:int -> bool) -> Gobject.Signal.handler_id
val on_writable_changed : ?after:bool -> t -> callback:(key:string -> unit) -> Gobject.Signal.handler_id