Class Settings.Builder<B extends Settings.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Settings

public static class Settings.Builder<B extends Settings.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Settings build()
      Finish building the Settings object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Settings.
      Overrides:
      build in class GObject.Builder<B extends Settings.Builder<B>>
      Returns:
      a new instance of Settings with the properties that were set in the Builder object.
    • setBackend

      public B setBackend(SettingsBackend backend)
      The name of the context that the settings are stored in.
      Parameters:
      backend - the value for the backend property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPath

      public B setPath(String path)
      The path within the backend where the settings are stored.
      Parameters:
      path - the value for the path property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSchema

      @Deprecated public B setSchema(String schema)
      Deprecated.
      Use the Gio.Settings:schema-id property instead. In a future version, this property may instead refer to a Gio.SettingsSchema.

      The name of the schema that describes the types of keys for this Settings object.

      The type of this property is not Gio.SettingsSchema. Gio.SettingsSchema has only existed since version 2.32 and unfortunately this name was used in previous versions to refer to the schema ID rather than the schema itself. Take care to use the Gio.Settings:settings-schema property if you wish to pass in a Gio.SettingsSchema.

      Parameters:
      schema - the value for the schema property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSchemaId

      public B setSchemaId(String schemaId)
      The name of the schema that describes the types of keys for this Settings object.
      Parameters:
      schemaId - the value for the schema-id property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSettingsSchema

      public B setSettingsSchema(SettingsSchema settingsSchema)

      The Gio.SettingsSchema describing the types of keys for this Settings object.

      Ideally, this property would be called Gio.Settings:schema. Gio.SettingsSchema has only existed since version 2.32, however, and before then the Gio.Settings:schema property was used to refer to the ID of the schema rather than the schema itself. Take care.

      Parameters:
      settingsSchema - the value for the settings-schema property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onChangeEvent

      public B onChangeEvent(Settings.ChangeEventCallback handler)

      Emitted once per change event that affects this settings object.

      You should connect to this signal only if you are interested in viewing groups of changes before they are split out into multiple emissions of the Gio.Settings::changed signal. For most use cases it is more appropriate to use the Gio.Settings::changed signal.

      In the event that the change event applies to one or more specified keys, keys will be an array of GLib.Quarks of length nKeys. In the event that the change event applies to the Settings object as a whole (ie: potentially every key has been changed) then keys will be NULL and nKeys will be 0.

      The default handler for this signal invokes the Gio.Settings::changed signal for each affected key. If any other connected handler returns true then this default functionality will be suppressed.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onChanged

      public B onChanged(@Nullable String detail, Settings.ChangedCallback handler)

      Emitted when a key has potentially changed.

      You should call one of the Settings.get(String, String, Object...) calls to check the new value.

      This signal supports detailed connections. You can connect to the detailed signal changed::x in order to only receive callbacks when key x changes.

      Note that settings only emits this signal if you have read key at least once while a signal handler was already connected for key.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onWritableChangeEvent

      public B onWritableChangeEvent(Settings.WritableChangeEventCallback handler)

      Emitted once per writability change event that affects this settings object.

      You should connect to this signal if you are interested in viewing groups of changes before they are split out into multiple emissions of the Gio.Settings::writable-changed signal. For most use cases it is more appropriate to use the Gio.Settings::writable-changed signal.

      In the event that the writability change applies only to a single key, key will be set to the GLib.Quark for that key. In the event that the writability change affects the entire settings object, key will be 0.

      The default handler for this signal invokes the Gio.Settings::writable-changed and Gio.Settings::changed signals for each affected key. This is done because changes in writability might also imply changes in value (if for example, a new mandatory setting is introduced). If any other connected handler returns true then this default functionality will be suppressed.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onWritableChanged

      public B onWritableChanged(@Nullable String detail, Settings.WritableChangedCallback handler)

      Emitted when the writability of a key has potentially changed.

      You should call Settings.isWritable(String) in order to determine the new status.

      This signal supports detailed connections. You can connect to the detailed signal writable-changed::x in order to only receive callbacks when the writability of x changes.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: