SettingsProtocol

public protocol SettingsProtocol : ObjectProtocol, StyleProviderProtocol

GtkSettings provide a mechanism to share global settings between applications.

On the X window system, this sharing is realized by an XSettings manager that is usually part of the desktop environment, along with utilities that let the user change these settings. In the absence of an Xsettings manager, GTK+ reads default values for settings from settings.ini files in /etc/gtk-3.0, $XDG_CONFIG_DIRS/gtk-3.0 and $XDG_CONFIG_HOME/gtk-3.0. These files must be valid key files (see GKeyFile), and have a section called Settings. Themes can also provide default values for settings by installing a settings.ini file next to their gtk.css file.

Applications can override system-wide settings by setting the property of the GtkSettings object with g_object_set(). This should be restricted to special cases though; GtkSettings are not meant as an application configuration facility. When doing so, you need to be aware that settings that are specific to individual widgets may not be available before the widget type has been realized at least once. The following example demonstrates a way to do this: (C Language Example):

  gtk_init (&argc, &argv);

  // make sure the type is realized
  g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));

  g_object_set (gtk_settings_get_default (), "gtk-enable-animations", FALSE, NULL);

There is one GtkSettings instance per screen. It can be obtained with gtk_settings_get_for_screen(), but in many cases, it is more convenient to use gtk_widget_get_settings(). gtk_settings_get_default() returns the GtkSettings instance for the default screen.

The SettingsProtocol protocol exposes the methods and properties of an underlying GtkSettings instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Settings. Alternatively, use SettingsRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkSettings instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • settings_ptr Default implementation

    Typed pointer to the underlying GtkSettings instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkSettings instance.

    Declaration

    Swift

    var settings_ptr: UnsafeMutablePointer<GtkSettings>! { get }
  • Required Initialiser for types conforming to SettingsProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Settings Class

  • Bind a SettingsPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: SettingsPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Settings property

    Declaration

    Swift

    @inlinable
    func get(property: SettingsPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a Settings property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: SettingsPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Settings Class: SettingsProtocol extension (methods and fields)

  • resetProperty(name:) Extension method

    Undoes the effect of calling g_object_set() to install an application-specific value for a setting. After this call, the setting will again follow the session-wide value for this setting.

    Declaration

    Swift

    @inlinable
    func resetProperty(name: UnsafePointer<gchar>!)
  • set_double_property is deprecated: Use g_object_set() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setDoubleProperty(name: UnsafePointer<gchar>!, vDouble: Double, origin: UnsafePointer<gchar>!)
  • set_long_property is deprecated: Use g_object_set() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setLongProperty(name: UnsafePointer<gchar>!, vLong: Int, origin: UnsafePointer<gchar>!)
  • set_property_value is deprecated: Use g_object_set() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setPropertyValue<SettingsValueT>(name: UnsafePointer<gchar>!, svalue: SettingsValueT) where SettingsValueT : SettingsValueProtocol
  • set_string_property is deprecated: Use g_object_set() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setStringProperty(name: UnsafePointer<gchar>!, vString: UnsafePointer<gchar>!, origin: UnsafePointer<gchar>!)
  • Obtains the pixel size of a semantic icon size, possibly modified by user preferences for a particular GtkSettings. Normally size would be GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_BUTTON, etc. This function isn’t normally needed, gtk_widget_render_icon_pixbuf() is the usual way to get an icon for rendering, then just look at the size of the rendered pixbuf. The rendered pixbuf may not even correspond to the width/height returned by gtk_icon_size_lookup(), because themes are free to render the pixbuf however they like, including changing the usual size.

    icon_size_lookup_for_settings is deprecated: Use gtk_icon_size_lookup() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func iconSizeLookupForSettings(size: GtkIconSize, width: UnsafeMutablePointer<gint>! = nil, height: UnsafeMutablePointer<gint>! = nil) -> Bool
  • Looks up a file in pixmap path for the specified GtkSettings. If the file is not found, it outputs a warning message using g_warning() and returns nil.

    rc_find_pixmap_in_path is deprecated: Use #GtkCssProvider instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func rcFindPixmapInPath<ScannerT>(scanner: ScannerT, pixmapFile: UnsafePointer<gchar>!) -> String! where ScannerT : ScannerProtocol
  • Creates up a GtkStyle from styles defined in a RC file by providing the raw components used in matching. This function may be useful when creating pseudo-widgets that should be themed like widgets but don’t actually have corresponding GTK+ widgets. An example of this would be items inside a GNOME canvas widget.

    The action of gtk_rc_get_style() is similar to: (C Language Example):

     gtk_widget_path (widget, NULL, &path, NULL);
     gtk_widget_class_path (widget, NULL, &class_path, NULL);
     gtk_rc_get_style_by_paths (gtk_widget_get_settings (widget),
                                path, class_path,
                                G_OBJECT_TYPE (widget));
    

    rc_get_style_by_paths is deprecated: Use #GtkStyleContext instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func rcGetStyleByPaths(widgetPath: UnsafePointer<CChar>? = nil, classPath: UnsafePointer<CChar>? = nil, type: GType) -> StyleRef!
  • If the modification time on any previously read file for the given GtkSettings has changed, discard all style information and then reread all previously read RC files.

    rc_reparse_all_for_settings is deprecated: Use #GtkCssProvider instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func rcReparseAllForSettings(forceLoad: Bool) -> Bool
  • rcResetStyles() Extension method

    This function recomputes the styles for all widgets that use a particular GtkSettings object. (There is one GtkSettings object per GdkScreen, see gtk_settings_get_for_screen()); It is useful when some global parameter has changed that affects the appearance of all widgets, because when a widget gets a new style, it will both redraw and recompute any cached information about its appearance. As an example, it is used when the default font size set by the operating system changes. Note that this function doesn’t affect widgets that have a style set explicitly on them with gtk_widget_set_style().

    rc_reset_styles is deprecated: Use #GtkCssProvider instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func rcResetStyles()
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GObject { get }