[gnome-control-center/wip/exalm/appearance: 76/82] ua: Use the new high contrast key
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/exalm/appearance: 76/82] ua: Use the new high contrast key
- Date: Sun, 19 Dec 2021 16:22:55 +0000 (UTC)
commit cfa2a01f05297dfd972a2937ec6b8ef4f4716913
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Dec 12 22:52:50 2021 +0500
ua: Use the new high contrast key
Keep setting gtk theme, but use the new boolean as the source of truth.
panels/universal-access/cc-ua-panel.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 45b968b74..b734f3884 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -44,9 +44,13 @@
#define HIGH_CONTRAST_THEME "HighContrast"
/* shell settings */
-#define A11Y_SETTINGS "org.gnome.desktop.a11y"
+#define A11Y_SETTINGS "org.gnome.desktop.a11y"
#define KEY_ALWAYS_SHOW_STATUS "always-show-universal-access-status"
+/* a11y interface settings */
+#define A11Y_INTERFACE_SETTINGS "org.gnome.desktop.a11y.interface"
+#define KEY_HIGH_CONTRAST "high-contrast"
+
/* interface settings */
#define INTERFACE_SETTINGS "org.gnome.desktop.interface"
#define KEY_TEXT_SCALING_FACTOR "text-scaling-factor"
@@ -149,6 +153,7 @@ struct _CcUaPanel
GSettings *wm_settings;
GSettings *a11y_settings;
+ GSettings *a11y_interface_settings;
GSettings *interface_settings;
GSettings *kb_settings;
GSettings *mouse_settings;
@@ -169,6 +174,7 @@ cc_ua_panel_dispose (GObject *object)
g_clear_object (&self->wm_settings);
g_clear_object (&self->a11y_settings);
+ g_clear_object (&self->a11y_interface_settings);
g_clear_object (&self->interface_settings);
g_clear_object (&self->kb_settings);
g_clear_object (&self->mouse_settings);
@@ -284,11 +290,9 @@ get_contrast_mapping (GValue *value,
GVariant *variant,
gpointer user_data)
{
- const char *theme;
gboolean hc;
- theme = g_variant_get_string (variant, NULL);
- hc = (g_strcmp0 (theme, HIGH_CONTRAST_THEME) == 0);
+ hc = g_variant_get_boolean (variant);
g_value_set_boolean (value, hc);
return TRUE;
@@ -301,12 +305,11 @@ set_contrast_mapping (const GValue *value,
{
gboolean hc;
CcUaPanel *self = user_data;
- GVariant *ret = NULL;
hc = g_value_get_boolean (value);
if (hc)
{
- ret = g_variant_new_string (HIGH_CONTRAST_THEME);
+ g_settings_set_string (self->interface_settings, KEY_GTK_THEME, HIGH_CONTRAST_THEME);
g_settings_set_string (self->interface_settings, KEY_ICON_THEME, HIGH_CONTRAST_THEME);
g_settings_set_string (self->wm_settings, KEY_WM_THEME, HIGH_CONTRAST_THEME);
@@ -319,7 +322,7 @@ set_contrast_mapping (const GValue *value,
g_settings_reset (self->wm_settings, KEY_WM_THEME);
}
- return ret;
+ return g_variant_new_boolean (hc);
}
static gboolean
@@ -516,7 +519,7 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
g_signal_connect_object (self->seeing_listbox, "row-activated",
G_CALLBACK (activate_row), self, G_CONNECT_SWAPPED);
- g_settings_bind_with_mapping (self->interface_settings, KEY_GTK_THEME,
+ g_settings_bind_with_mapping (self->a11y_interface_settings, KEY_HIGH_CONTRAST,
self->highcontrast_enable_switch,
"active", G_SETTINGS_BIND_DEFAULT,
get_contrast_mapping,
@@ -700,6 +703,7 @@ cc_ua_panel_init (CcUaPanel *self)
gtk_widget_init_template (GTK_WIDGET (self));
self->interface_settings = g_settings_new (INTERFACE_SETTINGS);
+ self->a11y_interface_settings = g_settings_new (A11Y_INTERFACE_SETTINGS);
self->a11y_settings = g_settings_new (A11Y_SETTINGS);
self->wm_settings = g_settings_new (WM_SETTINGS);
self->kb_settings = g_settings_new (KEYBOARD_SETTINGS);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]