Top |
TeplSettingsTeplSettings — Singleton class containing GSettings objects |
TeplSettings is a singleton class to have a central access to some GSettings objects and having convenience features that are useful for a text editor.
The central access permits to:
GSettings *
tepl_settings_peek_desktop_interface_settings
(TeplSettings *self
);
Since: 6.2
void tepl_settings_provide_font_settings (TeplSettings *self
,GSettings *font_settings
,const gchar *use_default_font_key
,const gchar *editor_font_key
);
This function can only be called once, to provide two keys:
use_default_font_key
: must be of type boolean, to know whether to use the
system's font (the default font), or the editor font.
editor_font_key
: must be of type string, containing the font name to have
a different font for the text editor, rather than using the system's font.
See tepl_settings_get_selected_font()
.
self |
the TeplSettings instance. |
|
font_settings |
the GSettings object containing the keys. |
|
use_default_font_key |
a key of type boolean. |
|
editor_font_key |
a key of type string. |
Since: 6.2
gchar *
tepl_settings_get_selected_font (TeplSettings *self
);
If tepl_settings_provide_font_settings()
has *not* been called, this function
always returns the current value of the system's fixed width (monospace)
font.
If tepl_settings_provide_font_settings()
*has* been called, this function
returns the font name depending on the boolean value of
use_default_font_key
.
See also the “font-changed” signal,
tepl_utils_override_font_string()
and tepl_prefs_create_font_component()
.
Since: 6.2
void tepl_settings_handle_theme_variant (TeplSettings *self
,GSettings *theme_variant_settings
,const gchar *theme_variant_setting_key
);
This function permits to setup correctly the GTK theme variant to use.
If theme_variant_settings
and theme_variant_setting_key
are NULL
, only the
system's settings will be taken into account.
If theme_variant_settings
and theme_variant_setting_key
are provided, they
are taken into account according to TeplSettingsThemeVariant.
You should call this function only once, as subsequent calls are ignored (the setting used cannot be reconfigured).
self |
the TeplSettings instance. |
|
theme_variant_settings |
[nullable] | |
theme_variant_setting_key |
a GSettings key of type enum
TeplSettingsThemeVariant, or |
[nullable] |
Since: 6.10
void tepl_settings_provide_style_scheme_settings (TeplSettings *self
,GSettings *style_scheme_settings
,const gchar *key_for_light_theme_variant
,const gchar *key_for_dark_theme_variant
);
This function can only be called once, to provide two keys:
key_for_light_theme_variant
: must be of type string, containing the ID of
a GtkSourceStyleScheme that should be used when the GTK theme variant is
light.
key_for_dark_theme_variant
: the same, but when the GTK theme variant is
dark.
See tepl_settings_get_style_scheme_id()
.
self |
the TeplSettings instance. |
|
style_scheme_settings |
the GSettings object containing the keys. |
|
key_for_light_theme_variant |
a key of type string. |
|
key_for_dark_theme_variant |
a key of type string. |
Since: 6.11
gchar *
tepl_settings_get_style_scheme_id (TeplSettings *self
);
Since: 6.11
gboolean tepl_settings_get_range_uint (GSettings *settings
,const gchar *key
,guint32 *min
,guint32 *max
);
This function introspects a GSettings key to get its range, if the key as a
"u" type (unsigned integer). FALSE
is returned if the introspection failed.
See g_settings_schema_key_get_range()
for more flexibility.
settings |
a GSettings. |
|
key |
a key part of |
|
min |
the minimum value allowed by the range. |
[out] |
max |
the maximum value allowed by the range. |
[out] |
Since: 6.2
This enum is intended to be used for controlling the GTK theme preference.
Since: 6.10
“style-scheme-id”
property “style-scheme-id” char *
See tepl_settings_provide_style_scheme_settings()
.
The value of this property depends on whether the GTK theme is light or dark, and uses the corresponding GSettings key.
Owner: TeplSettings
Flags: Read
Default value: NULL
Since: 6.11
“font-changed”
signalvoid user_function (TeplSettings *settings, gpointer user_data)
The ::font-changed signal is emitted when the return value of
tepl_settings_get_selected_font()
has potentially changed.
It takes into account the use_default_font_key
provided with
tepl_settings_provide_font_settings()
to avoid unnecessary signal
emission. In other words, for example if use_default_font_key
is
FALSE
, the signal is not emitted even if the default (system's) font
has been modified.
The relation between this signal and a potential zoom in and zoom out feature, to temporarily make the font larger or smaller (so the zoom level not being stored in GSettings): when this signal is emitted, it means that the user has explicitly changed the font setting, and as such he or she probably wants to use that font instead. So the expected behavior in that case is to reset the zoom level. But it's left as an exercise for another class, since TeplSettings is only for GSettings.
settings |
the TeplSettings emitting the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
Since: 6.2