From ae1c76ff830d146d41e88d6fba724c0a54bce868 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:45:20 +0200 Subject: Adding upstream version 1:43.6. Signed-off-by: Daniel Baumann --- .../universal-access/cc-cursor-blinking-dialog.c | 83 +++ .../universal-access/cc-cursor-blinking-dialog.h | 29 + .../universal-access/cc-cursor-blinking-dialog.ui | 103 ++++ panels/universal-access/cc-cursor-size-dialog.c | 121 ++++ panels/universal-access/cc-cursor-size-dialog.h | 29 + panels/universal-access/cc-cursor-size-dialog.ui | 40 ++ panels/universal-access/cc-pointing-dialog.c | 123 ++++ panels/universal-access/cc-pointing-dialog.h | 29 + panels/universal-access/cc-pointing-dialog.ui | 306 +++++++++ panels/universal-access/cc-repeat-keys-dialog.c | 108 ++++ panels/universal-access/cc-repeat-keys-dialog.h | 29 + panels/universal-access/cc-repeat-keys-dialog.ui | 179 ++++++ panels/universal-access/cc-typing-dialog.c | 185 ++++++ panels/universal-access/cc-typing-dialog.h | 29 + panels/universal-access/cc-typing-dialog.ui | 381 ++++++++++++ panels/universal-access/cc-ua-panel.c | 574 +++++++++++++++++ panels/universal-access/cc-ua-panel.h | 31 + panels/universal-access/cc-ua-panel.ui | 308 +++++++++ panels/universal-access/cc-visual-alerts-dialog.c | 144 +++++ panels/universal-access/cc-visual-alerts-dialog.h | 29 + panels/universal-access/cc-visual-alerts-dialog.ui | 101 +++ panels/universal-access/cc-zoom-options-dialog.c | 553 +++++++++++++++++ panels/universal-access/cc-zoom-options-dialog.h | 31 + panels/universal-access/cc-zoom-options-dialog.ui | 686 +++++++++++++++++++++ .../gnome-universal-access-panel.desktop.in.in | 18 + panels/universal-access/icons/meson.build | 4 + .../org.gnome.Settings-accessibility-symbolic.svg | 7 + panels/universal-access/left_ptr_24px.png | Bin 0 -> 762 bytes panels/universal-access/left_ptr_32px.png | Bin 0 -> 1081 bytes panels/universal-access/left_ptr_48px.png | Bin 0 -> 1766 bytes panels/universal-access/left_ptr_64px.png | Bin 0 -> 2447 bytes panels/universal-access/left_ptr_96px.png | Bin 0 -> 3995 bytes panels/universal-access/meson.build | 64 ++ .../universal-access.gresource.xml | 18 + 34 files changed, 4342 insertions(+) create mode 100644 panels/universal-access/cc-cursor-blinking-dialog.c create mode 100644 panels/universal-access/cc-cursor-blinking-dialog.h create mode 100644 panels/universal-access/cc-cursor-blinking-dialog.ui create mode 100644 panels/universal-access/cc-cursor-size-dialog.c create mode 100644 panels/universal-access/cc-cursor-size-dialog.h create mode 100644 panels/universal-access/cc-cursor-size-dialog.ui create mode 100644 panels/universal-access/cc-pointing-dialog.c create mode 100644 panels/universal-access/cc-pointing-dialog.h create mode 100644 panels/universal-access/cc-pointing-dialog.ui create mode 100644 panels/universal-access/cc-repeat-keys-dialog.c create mode 100644 panels/universal-access/cc-repeat-keys-dialog.h create mode 100644 panels/universal-access/cc-repeat-keys-dialog.ui create mode 100644 panels/universal-access/cc-typing-dialog.c create mode 100644 panels/universal-access/cc-typing-dialog.h create mode 100644 panels/universal-access/cc-typing-dialog.ui create mode 100644 panels/universal-access/cc-ua-panel.c create mode 100644 panels/universal-access/cc-ua-panel.h create mode 100644 panels/universal-access/cc-ua-panel.ui create mode 100644 panels/universal-access/cc-visual-alerts-dialog.c create mode 100644 panels/universal-access/cc-visual-alerts-dialog.h create mode 100644 panels/universal-access/cc-visual-alerts-dialog.ui create mode 100644 panels/universal-access/cc-zoom-options-dialog.c create mode 100644 panels/universal-access/cc-zoom-options-dialog.h create mode 100644 panels/universal-access/cc-zoom-options-dialog.ui create mode 100644 panels/universal-access/gnome-universal-access-panel.desktop.in.in create mode 100644 panels/universal-access/icons/meson.build create mode 100644 panels/universal-access/icons/scalable/org.gnome.Settings-accessibility-symbolic.svg create mode 100644 panels/universal-access/left_ptr_24px.png create mode 100644 panels/universal-access/left_ptr_32px.png create mode 100644 panels/universal-access/left_ptr_48px.png create mode 100644 panels/universal-access/left_ptr_64px.png create mode 100644 panels/universal-access/left_ptr_96px.png create mode 100644 panels/universal-access/meson.build create mode 100644 panels/universal-access/universal-access.gresource.xml (limited to 'panels/universal-access') diff --git a/panels/universal-access/cc-cursor-blinking-dialog.c b/panels/universal-access/cc-cursor-blinking-dialog.c new file mode 100644 index 0000000..1cb9e91 --- /dev/null +++ b/panels/universal-access/cc-cursor-blinking-dialog.c @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cc-cursor-blinking-dialog.h" + +#define INTERFACE_SETTINGS "org.gnome.desktop.interface" +#define KEY_CURSOR_BLINKING "cursor-blink" +#define KEY_CURSOR_BLINKING_TIME "cursor-blink-time" + +struct _CcCursorBlinkingDialog +{ + GtkDialog parent; + + GtkScale *blink_time_scale; + GtkSwitch *enable_switch; + + GSettings *interface_settings; +}; + +G_DEFINE_TYPE (CcCursorBlinkingDialog, cc_cursor_blinking_dialog, GTK_TYPE_DIALOG); + +static void +cc_cursor_blinking_dialog_dispose (GObject *object) +{ + CcCursorBlinkingDialog *self = CC_CURSOR_BLINKING_DIALOG (object); + + g_clear_object (&self->interface_settings); + + G_OBJECT_CLASS (cc_cursor_blinking_dialog_parent_class)->dispose (object); +} + +static void +cc_cursor_blinking_dialog_class_init (CcCursorBlinkingDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_cursor_blinking_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-cursor-blinking-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcCursorBlinkingDialog, blink_time_scale); + gtk_widget_class_bind_template_child (widget_class, CcCursorBlinkingDialog, enable_switch); +} + +static void +cc_cursor_blinking_dialog_init (CcCursorBlinkingDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->interface_settings = g_settings_new (INTERFACE_SETTINGS); + + g_settings_bind (self->interface_settings, KEY_CURSOR_BLINKING, + self->enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->interface_settings, KEY_CURSOR_BLINKING_TIME, + gtk_range_get_adjustment (GTK_RANGE (self->blink_time_scale)), "value", + G_SETTINGS_BIND_DEFAULT); +} + +CcCursorBlinkingDialog * +cc_cursor_blinking_dialog_new (void) +{ + return g_object_new (cc_cursor_blinking_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-cursor-blinking-dialog.h b/panels/universal-access/cc-cursor-blinking-dialog.h new file mode 100644 index 0000000..46d5a05 --- /dev/null +++ b/panels/universal-access/cc-cursor-blinking-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcCursorBlinkingDialog, cc_cursor_blinking_dialog, CC, CURSOR_BLINKING_DIALOG, GtkDialog) + +CcCursorBlinkingDialog *cc_cursor_blinking_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-cursor-blinking-dialog.ui b/panels/universal-access/cc-cursor-blinking-dialog.ui new file mode 100644 index 0000000..e31e612 --- /dev/null +++ b/panels/universal-access/cc-cursor-blinking-dialog.ui @@ -0,0 +1,103 @@ + + + + + + 100 + 2500 + 1000 + 200 + 200 + + diff --git a/panels/universal-access/cc-cursor-size-dialog.c b/panels/universal-access/cc-cursor-size-dialog.c new file mode 100644 index 0000000..cfd8378 --- /dev/null +++ b/panels/universal-access/cc-cursor-size-dialog.c @@ -0,0 +1,121 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cc-cursor-size-dialog.h" + +#define INTERFACE_SETTINGS "org.gnome.desktop.interface" +#define KEY_MOUSE_CURSOR_SIZE "cursor-size" + +struct _CcCursorSizeDialog +{ + GtkDialog parent; + + GtkGrid *size_grid; + + GSettings *interface_settings; +}; + +G_DEFINE_TYPE (CcCursorSizeDialog, cc_cursor_size_dialog, GTK_TYPE_DIALOG); + +static void +cursor_size_toggled (CcCursorSizeDialog *self, GtkWidget *button) +{ + guint cursor_size; + + if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) + return; + + cursor_size = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (button), "cursor-size")); + g_settings_set_int (self->interface_settings, KEY_MOUSE_CURSOR_SIZE, cursor_size); + g_debug ("Setting cursor size to %d", cursor_size); +} + +static void +cc_cursor_size_dialog_dispose (GObject *object) +{ + CcCursorSizeDialog *self = CC_CURSOR_SIZE_DIALOG (object); + + g_clear_object (&self->interface_settings); + + G_OBJECT_CLASS (cc_cursor_size_dialog_parent_class)->dispose (object); +} + +static void +cc_cursor_size_dialog_class_init (CcCursorSizeDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_cursor_size_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-cursor-size-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcCursorSizeDialog, size_grid); +} + +static void +cc_cursor_size_dialog_init (CcCursorSizeDialog *self) +{ + guint cursor_sizes[] = { 24, 32, 48, 64, 96 }; + guint current_cursor_size, i; + GtkSizeGroup *size_group; + GtkWidget *last_radio_button = NULL; + + gtk_widget_init_template (GTK_WIDGET (self)); + + self->interface_settings = g_settings_new (INTERFACE_SETTINGS); + + current_cursor_size = g_settings_get_int (self->interface_settings, + KEY_MOUSE_CURSOR_SIZE); + size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH); + + for (i = 0; i < G_N_ELEMENTS(cursor_sizes); i++) + { + GtkWidget *image, *button; + g_autofree gchar *cursor_image_name = NULL; + + cursor_image_name = g_strdup_printf ("/org/gnome/control-center/universal-access/left_ptr_%dpx.png", cursor_sizes[i]); + image = gtk_image_new_from_resource (cursor_image_name); + gtk_image_set_pixel_size (GTK_IMAGE (image), cursor_sizes[i]); + gtk_widget_set_halign (image, GTK_ALIGN_CENTER); + gtk_widget_set_valign (image, GTK_ALIGN_CENTER); + + button = gtk_toggle_button_new (); + gtk_toggle_button_set_group (GTK_TOGGLE_BUTTON (button), GTK_TOGGLE_BUTTON (last_radio_button)); + last_radio_button = button; + g_object_set_data (G_OBJECT (button), "cursor-size", GUINT_TO_POINTER (cursor_sizes[i])); + + gtk_button_set_child (GTK_BUTTON (button), image); + gtk_grid_attach (GTK_GRID (self->size_grid), button, i, 0, 1, 1); + gtk_size_group_add_widget (size_group, button); + + g_signal_connect_object (button, "toggled", + G_CALLBACK (cursor_size_toggled), self, G_CONNECT_SWAPPED); + + if (current_cursor_size == cursor_sizes[i]) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + } +} + +CcCursorSizeDialog * +cc_cursor_size_dialog_new (void) +{ + return g_object_new (cc_cursor_size_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-cursor-size-dialog.h b/panels/universal-access/cc-cursor-size-dialog.h new file mode 100644 index 0000000..29d2b1e --- /dev/null +++ b/panels/universal-access/cc-cursor-size-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcCursorSizeDialog, cc_cursor_size_dialog, CC, CURSOR_SIZE_DIALOG, GtkDialog) + +CcCursorSizeDialog *cc_cursor_size_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-cursor-size-dialog.ui b/panels/universal-access/cc-cursor-size-dialog.ui new file mode 100644 index 0000000..37f10a3 --- /dev/null +++ b/panels/universal-access/cc-cursor-size-dialog.ui @@ -0,0 +1,40 @@ + + + + + diff --git a/panels/universal-access/cc-pointing-dialog.c b/panels/universal-access/cc-pointing-dialog.c new file mode 100644 index 0000000..145867b --- /dev/null +++ b/panels/universal-access/cc-pointing-dialog.c @@ -0,0 +1,123 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cc-pointing-dialog.h" + +#define MOUSE_SETTINGS "org.gnome.desktop.a11y.mouse" +#define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" +#define KEY_SECONDARY_CLICK_TIME "secondary-click-time" +#define KEY_DWELL_CLICK_ENABLED "dwell-click-enabled" +#define KEY_DWELL_TIME "dwell-time" +#define KEY_DWELL_THRESHOLD "dwell-threshold" + +#define KEY_DOUBLE_CLICK_DELAY "double-click" + +struct _CcPointingDialog +{ + GtkDialog parent; + + GtkBox *dwell_delay_box; + GtkScale *dwell_delay_scale; + GtkBox *dwell_threshold_box; + GtkScale *dwell_threshold_scale; + GtkSwitch *hover_click_switch; + GtkBox *secondary_click_delay_box; + GtkScale *secondary_click_delay_scale; + GtkSwitch *secondary_click_switch; + + GSettings *mouse_settings; +}; + +G_DEFINE_TYPE (CcPointingDialog, cc_pointing_dialog, GTK_TYPE_DIALOG); + +static void +cc_pointing_dialog_dispose (GObject *object) +{ + CcPointingDialog *self = CC_POINTING_DIALOG (object); + + g_clear_object (&self->mouse_settings); + + G_OBJECT_CLASS (cc_pointing_dialog_parent_class)->dispose (object); +} + +static void +cc_pointing_dialog_class_init (CcPointingDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_pointing_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-pointing-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, dwell_delay_box); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, dwell_delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, dwell_threshold_box); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, dwell_threshold_scale); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, hover_click_switch); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, secondary_click_delay_box); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, secondary_click_delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcPointingDialog, secondary_click_switch); +} + +static void +cc_pointing_dialog_init (CcPointingDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->mouse_settings = g_settings_new (MOUSE_SETTINGS); + + /* simulated secondary click */ + g_settings_bind (self->mouse_settings, KEY_SECONDARY_CLICK_ENABLED, + self->secondary_click_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->mouse_settings, KEY_SECONDARY_CLICK_TIME, + gtk_range_get_adjustment (GTK_RANGE (self->secondary_click_delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->secondary_click_switch, "active", + self->secondary_click_delay_box, "sensitive", + G_BINDING_SYNC_CREATE); + + /* dwell click */ + g_settings_bind (self->mouse_settings, KEY_DWELL_CLICK_ENABLED, + self->hover_click_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->mouse_settings, KEY_DWELL_TIME, + gtk_range_get_adjustment (GTK_RANGE (self->dwell_delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->hover_click_switch, "active", + self->dwell_delay_box, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->mouse_settings, KEY_DWELL_THRESHOLD, + gtk_range_get_adjustment (GTK_RANGE (self->dwell_threshold_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->hover_click_switch, "active", + self->dwell_threshold_box, "sensitive", + G_BINDING_SYNC_CREATE); +} + +CcPointingDialog * +cc_pointing_dialog_new (void) +{ + return g_object_new (cc_pointing_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-pointing-dialog.h b/panels/universal-access/cc-pointing-dialog.h new file mode 100644 index 0000000..c2754aa --- /dev/null +++ b/panels/universal-access/cc-pointing-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcPointingDialog, cc_pointing_dialog, CC, POINTING_DIALOG, GtkDialog) + +CcPointingDialog *cc_pointing_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-pointing-dialog.ui b/panels/universal-access/cc-pointing-dialog.ui new file mode 100644 index 0000000..e35fade --- /dev/null +++ b/panels/universal-access/cc-pointing-dialog.ui @@ -0,0 +1,306 @@ + + + + + + + + + + + + + 0.5 + 3 + 1.2 + 0.1 + 0.1 + + + 30 + 15 + 1 + 1 + + + 0.2 + 3 + 1.2 + 0.1 + 0.1 + + diff --git a/panels/universal-access/cc-repeat-keys-dialog.c b/panels/universal-access/cc-repeat-keys-dialog.c new file mode 100644 index 0000000..4a65399 --- /dev/null +++ b/panels/universal-access/cc-repeat-keys-dialog.c @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cc-repeat-keys-dialog.h" + +#define KEYBOARD_SETTINGS "org.gnome.desktop.peripherals.keyboard" +#define KEY_REPEAT_KEYS "repeat" +#define KEY_DELAY "delay" +#define KEY_REPEAT_INTERVAL "repeat-interval" + +struct _CcRepeatKeysDialog +{ + GtkDialog parent; + + GtkSwitch *enable_switch; + GtkGrid *delay_grid; + GtkScale *delay_scale; + GtkGrid *speed_grid; + GtkScale *speed_scale; + + GSettings *keyboard_settings; +}; + +G_DEFINE_TYPE (CcRepeatKeysDialog, cc_repeat_keys_dialog, GTK_TYPE_DIALOG); + +static void +on_repeat_keys_toggled (CcRepeatKeysDialog *self) +{ + gboolean on; + + on = g_settings_get_boolean (self->keyboard_settings, KEY_REPEAT_KEYS); + + gtk_widget_set_sensitive (GTK_WIDGET (self->delay_grid), on); + gtk_widget_set_sensitive (GTK_WIDGET (self->speed_grid), on); +} + +static void +cc_repeat_keys_dialog_dispose (GObject *object) +{ + CcRepeatKeysDialog *self = CC_REPEAT_KEYS_DIALOG (object); + + g_clear_object (&self->keyboard_settings); + + G_OBJECT_CLASS (cc_repeat_keys_dialog_parent_class)->dispose (object); +} + +static void +cc_repeat_keys_dialog_class_init (CcRepeatKeysDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_repeat_keys_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-repeat-keys-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcRepeatKeysDialog, enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcRepeatKeysDialog, delay_grid); + gtk_widget_class_bind_template_child (widget_class, CcRepeatKeysDialog, delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcRepeatKeysDialog, speed_grid); + gtk_widget_class_bind_template_child (widget_class, CcRepeatKeysDialog, speed_scale); +} + +static void +cc_repeat_keys_dialog_init (CcRepeatKeysDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->keyboard_settings = g_settings_new (KEYBOARD_SETTINGS); + + g_signal_connect_object (self->keyboard_settings, "changed", + G_CALLBACK (on_repeat_keys_toggled), self, G_CONNECT_SWAPPED); + on_repeat_keys_toggled (self); + + g_settings_bind (self->keyboard_settings, KEY_REPEAT_KEYS, + self->enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->keyboard_settings, KEY_DELAY, + gtk_range_get_adjustment (GTK_RANGE (self->delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (self->keyboard_settings, KEY_REPEAT_INTERVAL, + gtk_range_get_adjustment (GTK_RANGE (self->speed_scale)), "value", + G_SETTINGS_BIND_DEFAULT); +} + +CcRepeatKeysDialog * +cc_repeat_keys_dialog_new (void) +{ + return g_object_new (cc_repeat_keys_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-repeat-keys-dialog.h b/panels/universal-access/cc-repeat-keys-dialog.h new file mode 100644 index 0000000..ebc1a76 --- /dev/null +++ b/panels/universal-access/cc-repeat-keys-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcRepeatKeysDialog, cc_repeat_keys_dialog, CC, REPEAT_KEYS_DIALOG, GtkDialog) + +CcRepeatKeysDialog *cc_repeat_keys_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-repeat-keys-dialog.ui b/panels/universal-access/cc-repeat-keys-dialog.ui new file mode 100644 index 0000000..78fa550 --- /dev/null +++ b/panels/universal-access/cc-repeat-keys-dialog.ui @@ -0,0 +1,179 @@ + + + + + + 100 + 2000 + 500 + 10 + 10 + + + 0.5 + 110 + 33.3 + 1 + 1 + + + + + + + + + + + + + + diff --git a/panels/universal-access/cc-typing-dialog.c b/panels/universal-access/cc-typing-dialog.c new file mode 100644 index 0000000..35004d4 --- /dev/null +++ b/panels/universal-access/cc-typing-dialog.c @@ -0,0 +1,185 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cc-typing-dialog.h" + +#define KEYBOARD_SETTINGS "org.gnome.desktop.a11y.keyboard" +#define KEY_KEYBOARD_TOGGLE "enable" +#define KEY_STICKYKEYS_ENABLED "stickykeys-enable" +#define KEY_STICKYKEYS_TWO_KEY_OFF "stickykeys-two-key-off" +#define KEY_STICKYKEYS_MODIFIER_BEEP "stickykeys-modifier-beep" +#define KEY_SLOWKEYS_ENABLED "slowkeys-enable" +#define KEY_SLOWKEYS_DELAY "slowkeys-delay" +#define KEY_SLOWKEYS_BEEP_PRESS "slowkeys-beep-press" +#define KEY_SLOWKEYS_BEEP_ACCEPT "slowkeys-beep-accept" +#define KEY_SLOWKEYS_BEEP_REJECT "slowkeys-beep-reject" +#define KEY_BOUNCEKEYS_ENABLED "bouncekeys-enable" +#define KEY_BOUNCEKEYS_DELAY "bouncekeys-delay" +#define KEY_BOUNCEKEYS_BEEP_REJECT "bouncekeys-beep-reject" + +struct _CcTypingDialog +{ + GtkDialog parent; + + GtkCheckButton *bouncekeys_beep_rejected_check; + GtkBox *bouncekeys_delay_box; + GtkScale *bouncekeys_delay_scale; + GtkSwitch *bouncekeys_switch; + GtkSwitch *keyboard_toggle_switch; + GtkCheckButton *slowkeys_beep_accepted_check; + GtkCheckButton *slowkeys_beep_pressed_check; + GtkCheckButton *slowkeys_beep_rejected_check; + GtkBox *slowkeys_delay_box; + GtkScale *slowkeys_delay_scale; + GtkSwitch *slowkeys_switch; + GtkCheckButton *stickykeys_beep_modifier_check; + GtkCheckButton *stickykeys_disable_two_keys_check; + GtkSwitch *stickykeys_switch; + + GSettings *keyboard_settings; +}; + +G_DEFINE_TYPE (CcTypingDialog, cc_typing_dialog, GTK_TYPE_DIALOG); + +static void +cc_typing_dialog_dispose (GObject *object) +{ + CcTypingDialog *self = CC_TYPING_DIALOG (object); + + g_clear_object (&self->keyboard_settings); + + G_OBJECT_CLASS (cc_typing_dialog_parent_class)->dispose (object); +} + +static void +cc_typing_dialog_class_init (CcTypingDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_typing_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-typing-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, bouncekeys_beep_rejected_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, bouncekeys_delay_box); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, bouncekeys_delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, bouncekeys_switch); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, keyboard_toggle_switch); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_beep_accepted_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_beep_pressed_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_beep_rejected_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_delay_box); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, slowkeys_switch); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, stickykeys_beep_modifier_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, stickykeys_disable_two_keys_check); + gtk_widget_class_bind_template_child (widget_class, CcTypingDialog, stickykeys_switch); +} + +static void +cc_typing_dialog_init (CcTypingDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->keyboard_settings = g_settings_new (KEYBOARD_SETTINGS); + + /* enable shortcuts */ + g_settings_bind (self->keyboard_settings, KEY_KEYBOARD_TOGGLE, + self->keyboard_toggle_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + /* sticky keys */ + g_settings_bind (self->keyboard_settings, KEY_STICKYKEYS_ENABLED, + self->stickykeys_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->keyboard_settings, KEY_STICKYKEYS_TWO_KEY_OFF, + self->stickykeys_disable_two_keys_check, "active", + G_SETTINGS_BIND_NO_SENSITIVITY); + g_object_bind_property (self->stickykeys_switch, "active", + self->stickykeys_disable_two_keys_check, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->keyboard_settings, KEY_STICKYKEYS_MODIFIER_BEEP, + self->stickykeys_beep_modifier_check, "active", + G_SETTINGS_BIND_NO_SENSITIVITY); + g_object_bind_property (self->stickykeys_switch, "active", + self->stickykeys_beep_modifier_check, "sensitive", + G_BINDING_SYNC_CREATE); + + /* slow keys */ + g_settings_bind (self->keyboard_settings, KEY_SLOWKEYS_ENABLED, + self->slowkeys_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->keyboard_settings, KEY_SLOWKEYS_DELAY, + gtk_range_get_adjustment (GTK_RANGE (self->slowkeys_delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->slowkeys_switch, "active", + self->slowkeys_delay_box, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->keyboard_settings, KEY_SLOWKEYS_BEEP_PRESS, + self->slowkeys_beep_pressed_check, "active", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->slowkeys_switch, "active", + self->slowkeys_beep_pressed_check, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->keyboard_settings, KEY_SLOWKEYS_BEEP_ACCEPT, + self->slowkeys_beep_accepted_check, "active", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->slowkeys_switch, "active", + self->slowkeys_beep_accepted_check, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->keyboard_settings, KEY_SLOWKEYS_BEEP_REJECT, + self->slowkeys_beep_rejected_check, "active", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->slowkeys_switch, "active", + self->slowkeys_beep_rejected_check, "sensitive", + G_BINDING_SYNC_CREATE); + + /* bounce keys */ + g_settings_bind (self->keyboard_settings, KEY_BOUNCEKEYS_ENABLED, + self->bouncekeys_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->keyboard_settings, KEY_BOUNCEKEYS_DELAY, + gtk_range_get_adjustment (GTK_RANGE (self->bouncekeys_delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + g_object_bind_property (self->bouncekeys_switch, "active", + self->bouncekeys_delay_box, "sensitive", + G_BINDING_SYNC_CREATE); + + g_settings_bind (self->keyboard_settings, KEY_BOUNCEKEYS_BEEP_REJECT, + self->bouncekeys_beep_rejected_check, "active", + G_SETTINGS_BIND_NO_SENSITIVITY); + g_object_bind_property (self->bouncekeys_switch, "active", + self->bouncekeys_beep_rejected_check, "sensitive", + G_BINDING_SYNC_CREATE); +} + +CcTypingDialog * +cc_typing_dialog_new (void) +{ + return g_object_new (cc_typing_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-typing-dialog.h b/panels/universal-access/cc-typing-dialog.h new file mode 100644 index 0000000..dfe0498 --- /dev/null +++ b/panels/universal-access/cc-typing-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcTypingDialog, cc_typing_dialog, CC, TYPING_DIALOG, GtkDialog) + +CcTypingDialog *cc_typing_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-typing-dialog.ui b/panels/universal-access/cc-typing-dialog.ui new file mode 100644 index 0000000..cf1ee25 --- /dev/null +++ b/panels/universal-access/cc-typing-dialog.ui @@ -0,0 +1,381 @@ + + + + + 900 + 0.5 + 10 + 10 + + + 500 + 0.5 + 10 + 10 + + diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c new file mode 100644 index 0000000..75cf893 --- /dev/null +++ b/panels/universal-access/cc-ua-panel.c @@ -0,0 +1,574 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2010 Intel, Inc + * Copyright (C) 2008 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Authors: Thomas Wood + * Rodrigo Moya + * + */ + +#include + +#include +#include +#include + +#include "cc-ua-panel.h" +#include "cc-ua-resources.h" +#include "cc-cursor-blinking-dialog.h" +#include "cc-cursor-size-dialog.h" +#include "cc-pointing-dialog.h" +#include "cc-repeat-keys-dialog.h" +#include "cc-typing-dialog.h" +#include "cc-visual-alerts-dialog.h" +#include "cc-zoom-options-dialog.h" + +#define DPI_FACTOR_LARGE 1.25 +#define DPI_FACTOR_NORMAL 1.0 +#define HIGH_CONTRAST_THEME "HighContrast" + +/* shell settings */ +#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" +#define KEY_GTK_THEME "gtk-theme" +#define KEY_ICON_THEME "icon-theme" +#define KEY_CURSOR_BLINKING "cursor-blink" +#define KEY_CURSOR_BLINKING_TIME "cursor-blink-time" +#define KEY_MOUSE_CURSOR_SIZE "cursor-size" +#define KEY_LOCATE_POINTER "locate-pointer" +#define KEY_ENABLE_ANIMATIONS "enable-animations" + +/* application settings */ +#define APPLICATION_SETTINGS "org.gnome.desktop.a11y.applications" +#define KEY_SCREEN_KEYBOARD_ENABLED "screen-keyboard-enabled" +#define KEY_SCREEN_MAGNIFIER_ENABLED "screen-magnifier-enabled" +#define KEY_SCREEN_READER_ENABLED "screen-reader-enabled" + +/* wm settings */ +#define WM_SETTINGS "org.gnome.desktop.wm.preferences" +#define KEY_VISUAL_BELL_ENABLED "visual-bell" + +/* keyboard settings */ +#define KEYBOARD_SETTINGS "org.gnome.desktop.a11y.keyboard" +#define KEY_KEYBOARD_TOGGLE "enable" +#define KEY_STICKYKEYS_ENABLED "stickykeys-enable" +#define KEY_STICKYKEYS_TWO_KEY_OFF "stickykeys-two-key-off" +#define KEY_STICKYKEYS_MODIFIER_BEEP "stickykeys-modifier-beep" +#define KEY_SLOWKEYS_ENABLED "slowkeys-enable" +#define KEY_SLOWKEYS_DELAY "slowkeys-delay" +#define KEY_SLOWKEYS_BEEP_PRESS "slowkeys-beep-press" +#define KEY_SLOWKEYS_BEEP_ACCEPT "slowkeys-beep-accept" +#define KEY_SLOWKEYS_BEEP_REJECT "slowkeys-beep-reject" +#define KEY_BOUNCEKEYS_ENABLED "bouncekeys-enable" +#define KEY_BOUNCEKEYS_DELAY "bouncekeys-delay" +#define KEY_BOUNCEKEYS_BEEP_REJECT "bouncekeys-beep-reject" +#define KEY_MOUSEKEYS_ENABLED "mousekeys-enable" +#define KEY_TOGGLEKEYS_ENABLED "togglekeys-enable" + +/* keyboard desktop settings */ +#define KEYBOARD_DESKTOP_SETTINGS "org.gnome.desktop.peripherals.keyboard" +#define KEY_REPEAT_KEYS "repeat" + +/* mouse settings */ +#define MOUSE_SETTINGS "org.gnome.desktop.a11y.mouse" +#define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" +#define KEY_SECONDARY_CLICK_TIME "secondary-click-time" +#define KEY_DWELL_CLICK_ENABLED "dwell-click-enabled" +#define KEY_DWELL_TIME "dwell-time" +#define KEY_DWELL_THRESHOLD "dwell-threshold" + +#define MOUSE_PERIPHERAL_SETTINGS "org.gnome.desktop.peripherals.mouse" +#define KEY_DOUBLE_CLICK_DELAY "double-click" + +struct _CcUaPanel +{ + CcPanel parent_instance; + + GtkLabel *accessx_label; + AdwActionRow *accessx_row; + GtkLabel *click_assist_label; + AdwActionRow *click_assist_row; + GtkLabel *cursor_blinking_label; + AdwActionRow *cursor_blinking_row; + GtkLabel *cursor_size_label; + AdwActionRow *cursor_size_row; + GtkScale *double_click_delay_scale; + GtkSwitch *enable_animations_switch; + GtkSwitch *highcontrast_enable_switch; + GtkSwitch *large_text_enable_switch; + GtkSwitch *locate_pointer_enable_switch; + GtkSwitch *mouse_keys_enable_switch; + GtkLabel *repeat_keys_label; + AdwActionRow *repeat_keys_row; + GtkSwitch *screen_keyboard_enable_switch; + GtkSwitch *screen_reader_switch; + AdwActionRow *screen_reader_row; + GtkSwitch *show_status_switch; + GtkSwitch *sound_keys_switch; + AdwActionRow *sound_keys_row; + GtkLabel *visual_alerts_label; + AdwActionRow *visual_alerts_row; + GtkLabel *zoom_label; + AdwActionRow *zoom_row; + + GSettings *wm_settings; + GSettings *a11y_settings; + GSettings *a11y_interface_settings; + GSettings *interface_settings; + GSettings *kb_settings; + GSettings *mouse_settings; + GSettings *kb_desktop_settings; + GSettings *application_settings; + GSettings *gds_mouse_settings; +}; + +CC_PANEL_REGISTER (CcUaPanel, cc_ua_panel) + +static void +run_dialog (CcUaPanel *self, GtkDialog *dialog) +{ + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self)); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (native)); + gtk_window_present (GTK_WINDOW (dialog)); +} + +static void +activate_row (CcUaPanel *self, AdwActionRow *row) +{ + if (row == self->zoom_row) + { + run_dialog (self, GTK_DIALOG (cc_zoom_options_dialog_new ())); + } + else if (row == self->cursor_size_row) + { + run_dialog (self, GTK_DIALOG (cc_cursor_size_dialog_new ())); + } + else if (row == self->visual_alerts_row) + { + run_dialog (self, GTK_DIALOG (cc_visual_alerts_dialog_new ())); + } + else if (row == self->repeat_keys_row) + { + run_dialog (self, GTK_DIALOG (cc_repeat_keys_dialog_new ())); + } + else if (row == self->cursor_blinking_row) + { + run_dialog (self, GTK_DIALOG (cc_cursor_blinking_dialog_new ())); + } + else if (row == self->accessx_row) + { + run_dialog (self, GTK_DIALOG (cc_typing_dialog_new ())); + } + else if (row == self->click_assist_row) + { + run_dialog (self, GTK_DIALOG (cc_pointing_dialog_new ())); + } +} + +static void +cc_ua_panel_dispose (GObject *object) +{ + CcUaPanel *self = CC_UA_PANEL (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); + g_clear_object (&self->kb_desktop_settings); + g_clear_object (&self->application_settings); + g_clear_object (&self->gds_mouse_settings); + + G_OBJECT_CLASS (cc_ua_panel_parent_class)->dispose (object); +} + +static const char * +cc_ua_panel_get_help_uri (CcPanel *panel) +{ + return "help:gnome-help/a11y"; +} + +static void +cc_ua_panel_class_init (CcUaPanelClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + CcPanelClass *panel_class = CC_PANEL_CLASS (klass); + + panel_class->get_help_uri = cc_ua_panel_get_help_uri; + + object_class->dispose = cc_ua_panel_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-ua-panel.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, accessx_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, accessx_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, click_assist_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, click_assist_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, cursor_blinking_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, cursor_blinking_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, cursor_size_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, cursor_size_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, double_click_delay_scale); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, enable_animations_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, highcontrast_enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, large_text_enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, locate_pointer_enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, mouse_keys_enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, repeat_keys_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, repeat_keys_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_keyboard_enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, show_status_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_switch); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_row); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, zoom_label); + gtk_widget_class_bind_template_child (widget_class, CcUaPanel, zoom_row); + gtk_widget_class_bind_template_callback (widget_class, activate_row); +} + +/* seeing section */ + +static gboolean +is_large_factor (gdouble factor) +{ + return (factor > DPI_FACTOR_NORMAL); +} + +static gboolean +get_large_text_mapping (GValue *value, + GVariant *variant, + gpointer user_data) +{ + gdouble factor; + + factor = g_variant_get_double (variant); + g_value_set_boolean (value, is_large_factor (factor)); + + return TRUE; +} + +static GVariant * +set_large_text_mapping (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) +{ + gboolean large; + GSettings *settings = user_data; + GVariant *ret = NULL; + + large = g_value_get_boolean (value); + if (large) + ret = g_variant_new_double (DPI_FACTOR_LARGE); + else + g_settings_reset (settings, KEY_TEXT_SCALING_FACTOR); + + return ret; +} + +static gboolean +get_contrast_mapping (GValue *value, + GVariant *variant, + gpointer user_data) +{ + gboolean hc; + + hc = g_variant_get_boolean (variant); + g_value_set_boolean (value, hc); + + return TRUE; +} + +static GVariant * +set_contrast_mapping (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) +{ + gboolean hc; + CcUaPanel *self = user_data; + + hc = g_value_get_boolean (value); + if (hc) + { + g_settings_set_string (self->interface_settings, KEY_GTK_THEME, HIGH_CONTRAST_THEME); + } + else + { + g_settings_reset (self->interface_settings, KEY_GTK_THEME); + g_settings_reset (self->interface_settings, KEY_ICON_THEME); + } + + return g_variant_new_boolean (hc); +} + +static gboolean +on_off_label_mapping_get (GValue *value, + GVariant *variant, + gpointer user_data) +{ + g_value_set_string (value, g_variant_get_boolean (variant) ? _("On") : _("Off")); + + return TRUE; +} + +static gboolean +cursor_size_label_mapping_get (GValue *value, + GVariant *variant, + gpointer user_data) +{ + char *label; + int cursor_size; + + cursor_size = g_variant_get_int32 (variant); + + switch (cursor_size) + { + case 24: + /* translators: the labels will read: + * Cursor Size: Default */ + label = g_strdup (C_("cursor size", "Default")); + break; + case 32: + label = g_strdup (C_("cursor size", "Medium")); + break; + case 48: + label = g_strdup (C_("cursor size", "Large")); + break; + case 64: + label = g_strdup (C_("cursor size", "Larger")); + break; + case 96: + label = g_strdup (C_("cursor size", "Largest")); + break; + default: + label = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, + "%d pixel", + "%d pixels", + cursor_size), + cursor_size); + break; + } + + g_value_take_string (value, label); + + return TRUE; +} + +static void +cc_ua_panel_init_status (CcUaPanel *self) +{ + g_settings_bind (self->a11y_settings, KEY_ALWAYS_SHOW_STATUS, + self->show_status_switch, "active", + G_SETTINGS_BIND_DEFAULT); +} + +static void +cc_ua_panel_init_seeing (CcUaPanel *self) +{ + g_settings_bind_with_mapping (self->a11y_interface_settings, KEY_HIGH_CONTRAST, + self->highcontrast_enable_switch, + "active", G_SETTINGS_BIND_DEFAULT, + get_contrast_mapping, + set_contrast_mapping, + self, + NULL); + + /* enable animation */ + g_settings_bind (self->interface_settings, KEY_ENABLE_ANIMATIONS, + self->enable_animations_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + + /* large text */ + + g_settings_bind_with_mapping (self->interface_settings, KEY_TEXT_SCALING_FACTOR, + self->large_text_enable_switch, + "active", G_SETTINGS_BIND_DEFAULT, + get_large_text_mapping, + set_large_text_mapping, + self->interface_settings, + NULL); + + /* screen reader */ + + g_settings_bind (self->application_settings, "screen-reader-enabled", + self->screen_reader_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + /* sound keys */ + + g_settings_bind (self->kb_settings, KEY_TOGGLEKEYS_ENABLED, + self->sound_keys_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + /* cursor size */ + + g_settings_bind_with_mapping (self->interface_settings, KEY_MOUSE_CURSOR_SIZE, // FIXME + self->cursor_size_label, + "label", G_SETTINGS_BIND_GET, + cursor_size_label_mapping_get, + NULL, NULL, NULL); + + /* zoom */ + + g_settings_bind_with_mapping (self->application_settings, "screen-magnifier-enabled", + self->zoom_label, + "label", G_SETTINGS_BIND_GET, + on_off_label_mapping_get, + NULL, NULL, NULL); +} + +/* hearing/sound section */ + +static void +cc_ua_panel_init_hearing (CcUaPanel *self) +{ + g_settings_bind_with_mapping (self->wm_settings, KEY_VISUAL_BELL_ENABLED, + self->visual_alerts_label, + "label", G_SETTINGS_BIND_GET, + on_off_label_mapping_get, + NULL, NULL, NULL); +} + +/* typing/keyboard section */ +static void +on_repeat_keys_toggled (CcUaPanel *self) +{ + gboolean on; + + on = g_settings_get_boolean (self->kb_desktop_settings, KEY_REPEAT_KEYS); + + gtk_label_set_text (self->repeat_keys_label, on ? _("On") : _("Off")); +} + +static void +on_cursor_blinking_toggled (CcUaPanel *self) +{ + gboolean on; + + on = g_settings_get_boolean (self->interface_settings, KEY_CURSOR_BLINKING); + + gtk_label_set_text (self->cursor_blinking_label, on ? _("On") : _("Off")); +} + +static void +update_accessx_label (CcUaPanel *self) +{ + gboolean on; + + on = g_settings_get_boolean (self->kb_settings, KEY_STICKYKEYS_ENABLED) || + g_settings_get_boolean (self->kb_settings, KEY_SLOWKEYS_ENABLED) || + g_settings_get_boolean (self->kb_settings, KEY_BOUNCEKEYS_ENABLED); + + gtk_label_set_text (self->accessx_label, on ? _("On") : _("Off")); +} + +static void +cc_ua_panel_init_keyboard (CcUaPanel *self) +{ + /* on-screen keyboard */ + g_settings_bind (self->application_settings, KEY_SCREEN_KEYBOARD_ENABLED, + self->screen_keyboard_enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + /* Repeat keys */ + g_signal_connect_object (self->kb_desktop_settings, "changed", + G_CALLBACK (on_repeat_keys_toggled), self, G_CONNECT_SWAPPED); + on_repeat_keys_toggled (self); + + /* Cursor Blinking */ + g_signal_connect_object (self->interface_settings, "changed", + G_CALLBACK (on_cursor_blinking_toggled), self, G_CONNECT_SWAPPED); + on_cursor_blinking_toggled (self); + + /* accessx */ + g_signal_connect_object (self->kb_settings, "changed", + G_CALLBACK (update_accessx_label), self, G_CONNECT_SWAPPED); + update_accessx_label (self); +} + +/* mouse/pointing & clicking section */ +static void +update_click_assist_label (CcUaPanel *self) +{ + gboolean on; + + on = g_settings_get_boolean (self->mouse_settings, KEY_SECONDARY_CLICK_ENABLED) || + g_settings_get_boolean (self->mouse_settings, KEY_DWELL_CLICK_ENABLED); + + gtk_label_set_text (self->click_assist_label, on ? _("On") : _("Off")); +} + + +static void +cc_ua_panel_init_mouse (CcUaPanel *self) +{ + g_settings_bind (self->kb_settings, KEY_MOUSEKEYS_ENABLED, + self->mouse_keys_enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->interface_settings, KEY_LOCATE_POINTER, + self->locate_pointer_enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_signal_connect_object (self->mouse_settings, "changed", + G_CALLBACK (update_click_assist_label), self, G_CONNECT_SWAPPED); + update_click_assist_label (self); + + g_settings_bind (self->gds_mouse_settings, "double-click", + gtk_range_get_adjustment (GTK_RANGE (self->double_click_delay_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + + gtk_scale_add_mark (GTK_SCALE (self->double_click_delay_scale), 400, GTK_POS_BOTTOM, NULL); +} + +static void +cc_ua_panel_init (CcUaPanel *self) +{ + g_resources_register (cc_universal_access_get_resource ()); + + 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); + self->kb_desktop_settings = g_settings_new (KEYBOARD_DESKTOP_SETTINGS); + self->mouse_settings = g_settings_new (MOUSE_SETTINGS); + self->gds_mouse_settings = g_settings_new (MOUSE_PERIPHERAL_SETTINGS); + self->application_settings = g_settings_new (APPLICATION_SETTINGS); + + cc_ua_panel_init_status (self); + cc_ua_panel_init_seeing (self); + cc_ua_panel_init_hearing (self); + cc_ua_panel_init_keyboard (self); + cc_ua_panel_init_mouse (self); +} diff --git a/panels/universal-access/cc-ua-panel.h b/panels/universal-access/cc-ua-panel.h new file mode 100644 index 0000000..6d925fa --- /dev/null +++ b/panels/universal-access/cc-ua-panel.h @@ -0,0 +1,31 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2010 Intel, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Author: Thomas Wood + * + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define CC_TYPE_UA_PANEL (cc_ua_panel_get_type ()) +G_DECLARE_FINAL_TYPE (CcUaPanel, cc_ua_panel, CC, UA_PANEL, CcPanel) + +G_END_DECLS diff --git a/panels/universal-access/cc-ua-panel.ui b/panels/universal-access/cc-ua-panel.ui new file mode 100644 index 0000000..fb01d98 --- /dev/null +++ b/panels/universal-access/cc-ua-panel.ui @@ -0,0 +1,308 @@ + + + + 100 + 1000 + 400 + 100 + 100 + + + diff --git a/panels/universal-access/cc-visual-alerts-dialog.c b/panels/universal-access/cc-visual-alerts-dialog.c new file mode 100644 index 0000000..398753d --- /dev/null +++ b/panels/universal-access/cc-visual-alerts-dialog.c @@ -0,0 +1,144 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "cc-visual-alerts-dialog.h" + +#define WM_SETTINGS "org.gnome.desktop.wm.preferences" +#define KEY_VISUAL_BELL_ENABLED "visual-bell" +#define KEY_VISUAL_BELL_TYPE "visual-bell-type" + +struct _CcVisualAlertsDialog +{ + GtkDialog parent; + + GtkSwitch *enable_switch; + GtkCheckButton *screen_radio; + GtkButton *test_button; + GtkCheckButton *window_radio; + + GSettings *wm_settings; +}; + +G_DEFINE_TYPE (CcVisualAlertsDialog, cc_visual_alerts_dialog, GTK_TYPE_DIALOG); + +static void +visual_bell_type_notify_cb (CcVisualAlertsDialog *self) +{ + GtkCheckButton *widget; + GDesktopVisualBellType type; + + type = g_settings_get_enum (self->wm_settings, KEY_VISUAL_BELL_TYPE); + + if (type == G_DESKTOP_VISUAL_BELL_FRAME_FLASH) + widget = self->window_radio; + else + widget = self->screen_radio; + + gtk_check_button_set_active (widget, TRUE); +} + +static void +visual_bell_type_toggle_cb (CcVisualAlertsDialog *self) +{ + gboolean frame_flash; + GDesktopVisualBellType type; + + frame_flash = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->window_radio)); + + if (frame_flash) + type = G_DESKTOP_VISUAL_BELL_FRAME_FLASH; + else + type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH; + g_settings_set_enum (self->wm_settings, KEY_VISUAL_BELL_TYPE, type); +} + +static void +test_flash (CcVisualAlertsDialog *self) +{ + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self)); + GdkSurface *surface = gtk_native_get_surface (native); + + gdk_surface_beep (surface); +} + +static void +cc_visual_alerts_dialog_dispose (GObject *object) +{ + CcVisualAlertsDialog *self = CC_VISUAL_ALERTS_DIALOG (object); + + g_clear_object (&self->wm_settings); + + G_OBJECT_CLASS (cc_visual_alerts_dialog_parent_class)->dispose (object); +} + +static void +cc_visual_alerts_dialog_class_init (CcVisualAlertsDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = cc_visual_alerts_dialog_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-visual-alerts-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcVisualAlertsDialog, enable_switch); + gtk_widget_class_bind_template_child (widget_class, CcVisualAlertsDialog, screen_radio); + gtk_widget_class_bind_template_child (widget_class, CcVisualAlertsDialog, test_button); + gtk_widget_class_bind_template_child (widget_class, CcVisualAlertsDialog, window_radio); +} + +static void +cc_visual_alerts_dialog_init (CcVisualAlertsDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->wm_settings = g_settings_new (WM_SETTINGS); + + /* set the initial visual bell values */ + visual_bell_type_notify_cb (self); + + /* and listen */ + g_settings_bind (self->wm_settings, KEY_VISUAL_BELL_ENABLED, + self->enable_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + g_object_bind_property (self->enable_switch, "active", + self->window_radio, "sensitive", + G_BINDING_SYNC_CREATE); + + g_object_bind_property (self->enable_switch, "active", + self->screen_radio, "sensitive", + G_BINDING_SYNC_CREATE); + g_signal_connect_object (self->wm_settings, "changed::" KEY_VISUAL_BELL_TYPE, + G_CALLBACK (visual_bell_type_notify_cb), self, G_CONNECT_SWAPPED); + g_signal_connect_object (self->window_radio, + "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self, G_CONNECT_SWAPPED); + + g_signal_connect_object (self->test_button, + "clicked", G_CALLBACK (test_flash), self, G_CONNECT_SWAPPED); +} + +CcVisualAlertsDialog * +cc_visual_alerts_dialog_new (void) +{ + return g_object_new (cc_visual_alerts_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-visual-alerts-dialog.h b/panels/universal-access/cc-visual-alerts-dialog.h new file mode 100644 index 0000000..49add84 --- /dev/null +++ b/panels/universal-access/cc-visual-alerts-dialog.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcVisualAlertsDialog, cc_visual_alerts_dialog, CC, VISUAL_ALERTS_DIALOG, GtkDialog) + +CcVisualAlertsDialog *cc_visual_alerts_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-visual-alerts-dialog.ui b/panels/universal-access/cc-visual-alerts-dialog.ui new file mode 100644 index 0000000..a162190 --- /dev/null +++ b/panels/universal-access/cc-visual-alerts-dialog.ui @@ -0,0 +1,101 @@ + + + + + diff --git a/panels/universal-access/cc-zoom-options-dialog.c b/panels/universal-access/cc-zoom-options-dialog.c new file mode 100644 index 0000000..1f06aa8 --- /dev/null +++ b/panels/universal-access/cc-zoom-options-dialog.c @@ -0,0 +1,553 @@ +/* + * Copyright 2011 Inclusive Design Research Centre, OCAD University. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: Joseph Scheuhammer + */ + +#include "cc-zoom-options-dialog.h" +#include +#include +#include + +#define POSITION_MODEL_VALUE_COLUMN 2 +#define FONT_SCALE 1.25 + +struct _CcZoomOptionsDialog +{ + GtkDialog parent; + + GSettings *settings; + GSettings *application_settings; + + GtkWidget *screen_position_combobox; + GtkWidget *follow_mouse_radio; + GtkWidget *screen_part_radio; + GtkWidget *centered_radio; + GtkWidget *push_radio; + GtkWidget *proportional_radio; + GtkWidget *extend_beyond_checkbox; + GtkWidget *brightness_slider; + GtkWidget *contrast_slider; + GtkWidget *crosshair_picker_color_button; + GtkWidget *magnifier_factor_spin; + GtkWidget *seeing_zoom_switch; + GtkWidget *crosshair_thickness_scale; + GtkWidget *grayscale_slider; + GtkWidget *crosshair_clip_checkbox; + GtkWidget *crosshair_length_slider; + GtkWidget *crosshair_enabled_switcher; + GtkWidget *inverse_enabled_switch; +}; + +G_DEFINE_TYPE (CcZoomOptionsDialog, cc_zoom_options_dialog, GTK_TYPE_DIALOG); + +static gchar *brightness_keys[] = { + "brightness-red", + "brightness-green", + "brightness-blue", + NULL +}; + +static gchar *contrast_keys[] = { + "contrast-red", + "contrast-green", + "contrast-blue", + NULL +}; + +static void set_enable_screen_part_ui (CcZoomOptionsDialog *self); +static void scale_label (GtkWidget *check, PangoAttrList *attrs); +static void xhairs_length_add_marks (CcZoomOptionsDialog *self, GtkScale *scale); +static void effects_slider_set_value (GtkRange *slider, GSettings *settings); +static void brightness_slider_notify_cb (CcZoomOptionsDialog *self, const gchar *key); +static void contrast_slider_notify_cb (CcZoomOptionsDialog *self, const gchar *key); +static void effects_slider_changed (CcZoomOptionsDialog *self, GtkRange *slider); + +static void +mouse_tracking_radio_toggled_cb (CcZoomOptionsDialog *self, GtkWidget *widget) +{ + if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) + return; + + if (widget == self->centered_radio) + g_settings_set_string (self->settings, "mouse-tracking", "centered"); + else if (widget == self->proportional_radio) + g_settings_set_string (self->settings, "mouse-tracking", "proportional"); + else if (widget == self->push_radio) + g_settings_set_string (self->settings, "mouse-tracking", "push"); +} + +static void +mouse_tracking_notify_cb (CcZoomOptionsDialog *self) +{ + g_autofree gchar *tracking = NULL; + + tracking = g_settings_get_string (self->settings, "mouse-tracking"); + if (g_strcmp0 (tracking, "centered") == 0) + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->centered_radio), TRUE); + else if (g_strcmp0 (tracking, "proportional") == 0) + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->proportional_radio), TRUE); + else + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->push_radio), TRUE); +} + +static void +init_screen_part_section (CcZoomOptionsDialog *self, PangoAttrList *pango_attrs) +{ + gboolean lens_mode; + + /* Scale the labels of the toggles */ + scale_label (self->follow_mouse_radio, pango_attrs); + scale_label (self->screen_part_radio, pango_attrs); + scale_label (self->centered_radio, pango_attrs); + scale_label (self->push_radio, pango_attrs); + scale_label (self->proportional_radio, pango_attrs); + scale_label (self->extend_beyond_checkbox, pango_attrs); + + lens_mode = g_settings_get_boolean (self->settings, "lens-mode"); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->follow_mouse_radio), lens_mode); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->screen_part_radio), !lens_mode); + + set_enable_screen_part_ui (self); + + g_settings_bind (self->settings, "lens-mode", + self->follow_mouse_radio, "active", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (self->settings, "scroll-at-edges", + self->extend_beyond_checkbox, "active", + G_SETTINGS_BIND_DEFAULT); + + g_signal_connect_object (G_OBJECT (self->screen_part_radio), "toggled", + G_CALLBACK (set_enable_screen_part_ui), self, G_CONNECT_SWAPPED); + + mouse_tracking_notify_cb (self); + g_signal_connect_object (G_OBJECT (self->settings), "changed::mouse-tracking", + G_CALLBACK (mouse_tracking_notify_cb), self, G_CONNECT_SWAPPED); +} + +static void +set_enable_screen_part_ui (CcZoomOptionsDialog *self) +{ + gboolean screen_part; + + /* If the "screen part" radio is not checked, then the "follow mouse" radio + * is checked (== lens mode). Set mouse tracking back to the default. + */ + screen_part = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->screen_part_radio)); + if (!screen_part) + { + g_settings_set_string (self->settings, + "mouse-tracking", "proportional"); + } + + gtk_widget_set_sensitive (self->centered_radio, screen_part); + gtk_widget_set_sensitive (self->push_radio, screen_part); + gtk_widget_set_sensitive (self->proportional_radio, screen_part); + gtk_widget_set_sensitive (self->extend_beyond_checkbox, screen_part); +} + +static void +scale_label (GtkWidget *check, PangoAttrList *attrs) +{ + GtkWidget *label; + + label = gtk_widget_get_first_child (check); + label = gtk_widget_get_next_sibling (label); + gtk_label_set_attributes (GTK_LABEL (label), attrs); +} + +static void +screen_position_combo_changed_cb (CcZoomOptionsDialog *self) +{ + g_autofree gchar *combo_value = NULL; + GtkTreeIter iter; + + gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self->screen_position_combobox), &iter); + + gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (self->screen_position_combobox)), &iter, + POSITION_MODEL_VALUE_COLUMN, &combo_value, + -1); + + if (g_strcmp0 (combo_value, "")) + { + g_settings_set_string (self->settings, "screen-position", combo_value); + } +} + +static void +screen_position_notify_cb (CcZoomOptionsDialog *self, + const gchar *key) +{ + g_autofree gchar *position = NULL; + GtkTreeIter iter; + GtkTreeModel *model; + GtkComboBox *combobox; + gboolean valid; + + position = g_settings_get_string (self->settings, key); + combobox = GTK_COMBO_BOX (self->screen_position_combobox); + model = gtk_combo_box_get_model (combobox); + + /* Find the matching screen position value in the combobox model. If nothing + * matches, leave the combobox as is. + */ + valid = gtk_tree_model_get_iter_first (model, &iter); + while (valid) + { + g_autofree gchar *combo_value = NULL; + + gtk_tree_model_get (model, &iter, + POSITION_MODEL_VALUE_COLUMN, &combo_value, + -1); + if (!g_strcmp0 (combo_value, position)) + { + g_signal_handlers_block_by_func (combobox, screen_position_combo_changed_cb, self); + gtk_combo_box_set_active_iter (combobox, &iter); + g_signal_handlers_unblock_by_func (combobox, screen_position_combo_changed_cb, self); + break; + } + + valid = gtk_tree_model_iter_next (model, &iter); + } +} + +static void +init_xhairs_color_opacity (GtkColorButton *color_button, GSettings *settings) +{ + g_autofree gchar *color_setting = NULL; + GdkRGBA rgba; + + color_setting = g_settings_get_string (settings, "cross-hairs-color"); + gdk_rgba_parse (&rgba, color_setting); + + rgba.alpha = g_settings_get_double (settings, "cross-hairs-opacity"); + gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (color_button), &rgba); +} + +static void +xhairs_color_notify_cb (CcZoomOptionsDialog *self) +{ + init_xhairs_color_opacity (GTK_COLOR_BUTTON (self->crosshair_picker_color_button), self->settings); +} + +static void +xhairs_opacity_notify_cb (CcZoomOptionsDialog *self, gchar *key) +{ + GdkRGBA rgba; + gdouble opacity; + + opacity = g_settings_get_double (self->settings, key); + gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (self->crosshair_picker_color_button), &rgba); + rgba.alpha = opacity * 65535; + gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (self->crosshair_picker_color_button), &rgba); +} + +#define TO_HEX(x) (int) ((gdouble) x * 255.0) +static void +xhairs_color_opacity_changed (CcZoomOptionsDialog *self) +{ + GdkRGBA rgba; + g_autofree gchar *color_string = NULL; + + gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (self->crosshair_picker_color_button), &rgba); + color_string = g_strdup_printf ("#%02x%02x%02x", + TO_HEX(rgba.red), + TO_HEX(rgba.green), + TO_HEX(rgba.blue)); + + g_settings_set_string (self->settings, "cross-hairs-color", color_string); + + g_settings_set_double (self->settings, "cross-hairs-opacity", rgba.alpha); +} + +static void xhairs_length_add_marks (CcZoomOptionsDialog *self, GtkScale *scale) +{ + GtkAdjustment *scale_model; + GdkRectangle rect; + GdkMonitor *monitor; + GdkDisplay *display; + GdkSurface *surface; + GtkWindow *transient_for; + gint length, quarter_length; + + /* Get maximum dimension of the monitor */ + transient_for = gtk_window_get_transient_for (GTK_WINDOW (self)); + display = gtk_widget_get_display (GTK_WIDGET (transient_for)); + surface = gtk_native_get_surface (GTK_NATIVE (transient_for)); + monitor = gdk_display_get_monitor_at_surface (display, surface); + gdk_monitor_get_geometry (monitor, &rect); + + length = MAX (rect.width, rect.height); + scale_model = gtk_range_get_adjustment (GTK_RANGE (scale)); + + if (length < gtk_adjustment_get_upper (scale_model)) + gtk_adjustment_set_upper (scale_model, length); + + /* The crosshair is made up of four lines in pairs (top, bottom) and + (left, right). Stipulating: "quarter of the screen" means that the + length of one hair is 25% of the screen. */ + quarter_length = length / 4; + + gtk_scale_add_mark (scale, 0, GTK_POS_BOTTOM, C_("Distance", "Short")); + gtk_scale_add_mark (scale, quarter_length, GTK_POS_BOTTOM, C_("Distance", "¼ Screen")); + gtk_scale_add_mark (scale, quarter_length * 2 , GTK_POS_BOTTOM, C_("Distance", "½ Screen")); + gtk_scale_add_mark (scale, quarter_length * 3, GTK_POS_BOTTOM, C_("Distance", "¾ Screen")); + gtk_scale_add_mark (scale, length, GTK_POS_BOTTOM, C_("Distance", "Long")); +} + +static void +init_effects_slider (GtkRange *slider, + CcZoomOptionsDialog *self, + gchar **keys, + GCallback notify_cb) +{ + gchar **key; + + g_object_set_data (G_OBJECT (slider), "settings-keys", keys); + effects_slider_set_value (slider, self->settings); + + for (key = keys; *key; key++) + { + g_autofree gchar *signal = g_strdup_printf ("changed::%s", *key); + g_signal_connect_object (G_OBJECT (self->settings), signal, notify_cb, self, G_CONNECT_SWAPPED); + } + g_signal_connect_object (G_OBJECT (slider), "value-changed", + G_CALLBACK (effects_slider_changed), + self, G_CONNECT_SWAPPED); + gtk_scale_add_mark (GTK_SCALE (slider), 0, GTK_POS_BOTTOM, NULL); +} + +static void +effects_slider_set_value (GtkRange *slider, GSettings *settings) +{ + gchar **keys; + gdouble red, green, blue; + gdouble value; + + keys = g_object_get_data (G_OBJECT (slider), "settings-keys"); + + red = g_settings_get_double (settings, keys[0]); + green = g_settings_get_double (settings, keys[1]); + blue = g_settings_get_double (settings, keys[2]); + + if (red == green && green == blue) + value = red; + else + /* use NTSC conversion weights for reasonable average */ + value = 0.299 * red + 0.587 * green + 0.114 * blue; + + gtk_range_set_value (slider, value); +} + +static void +brightness_slider_notify_cb (CcZoomOptionsDialog *self, + const gchar *key) +{ + GtkRange *slider = GTK_RANGE (self->brightness_slider); + + g_signal_handlers_block_by_func (slider, effects_slider_changed, self); + effects_slider_set_value (slider, self->settings); + g_signal_handlers_unblock_by_func (slider, effects_slider_changed, self); +} + +static void +contrast_slider_notify_cb (CcZoomOptionsDialog *self, + const gchar *key) +{ + GtkRange *slider = GTK_RANGE (self->contrast_slider); + + g_signal_handlers_block_by_func (slider, effects_slider_changed, self); + effects_slider_set_value (slider, self->settings); + g_signal_handlers_unblock_by_func (slider, effects_slider_changed, self); +} + +static void +effects_slider_changed (CcZoomOptionsDialog *self, GtkRange *slider) +{ + gchar **keys, **key; + gdouble value; + + keys = g_object_get_data (G_OBJECT (slider), "settings-keys"); + value = gtk_range_get_value (slider); + + for (key = keys; *key; key++) + { + g_settings_set_double (self->settings, *key, value); + } +} + +static void +cc_zoom_options_dialog_constructed (GObject *object) +{ + PangoAttribute *attr; + PangoAttrList *pango_attrs; + CcZoomOptionsDialog *self; + + self = CC_ZOOM_OPTIONS_DIALOG (object); + + G_OBJECT_CLASS (cc_zoom_options_dialog_parent_class)->constructed (object); + + pango_attrs = pango_attr_list_new (); + attr = pango_attr_scale_new (FONT_SCALE); + pango_attr_list_insert (pango_attrs, attr); + + /* Zoom switch */ + g_settings_bind (self->application_settings, "screen-magnifier-enabled", + self->seeing_zoom_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + /* Magnification factor */ + g_settings_bind (self->settings, "mag-factor", + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (self->magnifier_factor_spin)), + "value", G_SETTINGS_BIND_DEFAULT); + + /* Screen position combo */ + screen_position_notify_cb (self, "screen-position"); + g_signal_connect_object (self->settings, "changed::screen-position", + G_CALLBACK (screen_position_notify_cb), self, G_CONNECT_SWAPPED); + g_signal_connect_object (self->screen_position_combobox, "changed", + G_CALLBACK (screen_position_combo_changed_cb), self, G_CONNECT_SWAPPED); + + /* Screen part section */ + init_screen_part_section (self, pango_attrs); + + /* Cross hairs: show/hide ... */ + g_settings_bind (self->settings, "show-cross-hairs", + self->crosshair_enabled_switcher, "active", + G_SETTINGS_BIND_DEFAULT); + + /* ... Cross hairs: color and opacity */ + init_xhairs_color_opacity (GTK_COLOR_BUTTON (self->crosshair_picker_color_button), self->settings); + g_signal_connect_object (self->settings, "changed::cross-hairs-color", + G_CALLBACK (xhairs_color_notify_cb), self, G_CONNECT_SWAPPED); + g_signal_connect_object (self->settings, "changed::cross-hairs-opacity", + G_CALLBACK (xhairs_opacity_notify_cb), self, G_CONNECT_SWAPPED); + g_signal_connect_object (self->crosshair_picker_color_button, "color-set", + G_CALLBACK (xhairs_color_opacity_changed), + self, G_CONNECT_SWAPPED); + + /* ... Cross hairs: thickness ... */ + g_settings_bind (self->settings, "cross-hairs-thickness", + gtk_range_get_adjustment (GTK_RANGE (self->crosshair_thickness_scale)), "value", + G_SETTINGS_BIND_DEFAULT); + + /* ... Cross hairs: clip ... */ + scale_label (self->crosshair_clip_checkbox, pango_attrs); + g_settings_bind (self->settings, "cross-hairs-clip", + self->crosshair_clip_checkbox, "active", + G_SETTINGS_BIND_INVERT_BOOLEAN); + + /* ... Cross hairs: length ... */ + g_settings_bind (self->settings, "cross-hairs-length", + gtk_range_get_adjustment (GTK_RANGE (self->crosshair_length_slider)), "value", + G_SETTINGS_BIND_DEFAULT); + + /* ... Color effects ... */ + g_settings_bind (self->settings, "invert-lightness", self->inverse_enabled_switch, "active", + G_SETTINGS_BIND_DEFAULT); + + init_effects_slider (GTK_RANGE (self->brightness_slider), + self, + brightness_keys, + G_CALLBACK (brightness_slider_notify_cb)); + + init_effects_slider (GTK_RANGE (self->contrast_slider), + self, + contrast_keys, + G_CALLBACK (contrast_slider_notify_cb)); + + g_settings_bind (self->settings, "color-saturation", + gtk_range_get_adjustment (GTK_RANGE (self->grayscale_slider)), "value", + G_SETTINGS_BIND_DEFAULT); + gtk_scale_add_mark (GTK_SCALE(self->grayscale_slider), 1.0, GTK_POS_BOTTOM, NULL); + + pango_attr_list_unref (pango_attrs); +} + +static void +cc_zoom_options_dialog_realize (GtkWidget *widget) +{ + CcZoomOptionsDialog *self = CC_ZOOM_OPTIONS_DIALOG (widget); + + GTK_WIDGET_CLASS (cc_zoom_options_dialog_parent_class)->realize (widget); + + xhairs_length_add_marks (self, GTK_SCALE (self->crosshair_length_slider)); +} + +static void +cc_zoom_options_dialog_finalize (GObject *object) +{ + CcZoomOptionsDialog *self = CC_ZOOM_OPTIONS_DIALOG (object); + + g_clear_object (&self->settings); + g_clear_object (&self->application_settings); + + G_OBJECT_CLASS (cc_zoom_options_dialog_parent_class)->finalize (object); +} + +static void +cc_zoom_options_dialog_class_init (CcZoomOptionsDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->finalize = cc_zoom_options_dialog_finalize; + object_class->constructed = cc_zoom_options_dialog_constructed; + + widget_class->realize = cc_zoom_options_dialog_realize; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-zoom-options-dialog.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, brightness_slider); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, centered_radio); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, contrast_slider); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, crosshair_clip_checkbox); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, crosshair_enabled_switcher); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, crosshair_length_slider); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, crosshair_picker_color_button); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, crosshair_thickness_scale); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, extend_beyond_checkbox); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, follow_mouse_radio); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, grayscale_slider); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, inverse_enabled_switch); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, magnifier_factor_spin); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, proportional_radio); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, push_radio); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, screen_part_radio); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, screen_position_combobox); + gtk_widget_class_bind_template_child (widget_class, CcZoomOptionsDialog, seeing_zoom_switch); + + gtk_widget_class_bind_template_callback (widget_class, mouse_tracking_radio_toggled_cb); +} + +static void +cc_zoom_options_dialog_init (CcZoomOptionsDialog *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + + self->settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + self->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications"); +} + +CcZoomOptionsDialog * +cc_zoom_options_dialog_new (void) +{ + return g_object_new (cc_zoom_options_dialog_get_type (), + "use-header-bar", TRUE, + NULL); +} diff --git a/panels/universal-access/cc-zoom-options-dialog.h b/panels/universal-access/cc-zoom-options-dialog.h new file mode 100644 index 0000000..de15aa8 --- /dev/null +++ b/panels/universal-access/cc-zoom-options-dialog.h @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Inclusive Design Research Centre, OCAD University. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: Joseph Scheuhammer + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE (CcZoomOptionsDialog, cc_zoom_options_dialog, CC, ZOOM_OPTIONS_DIALOG, GtkDialog) + +CcZoomOptionsDialog *cc_zoom_options_dialog_new (void); + +G_END_DECLS diff --git a/panels/universal-access/cc-zoom-options-dialog.ui b/panels/universal-access/cc-zoom-options-dialog.ui new file mode 100644 index 0000000..e212b85 --- /dev/null +++ b/panels/universal-access/cc-zoom-options-dialog.ui @@ -0,0 +1,686 @@ + + + + + -0.75 + 0.75 + 0.10000000000000001 + 0.10000000000000001 + + + -0.75 + 0.75 + 0.10000000000000001 + 0.10000000000000001 + + + 1 + 1 + 0.10000000000000001 + 0.20000000000000001 + + + 1 + 20 + 2 + 0.25 + 1 + + + + + + + + + + + + + Full Screen + 1.25 + full-screen + + + Top Half + 1.25 + top-half + + + Bottom Half + 1.25 + bottom-half + + + Left Half + 1.25 + left-half + + + Right Half + 1.25 + right-half + + + + + + 1 + 100 + 8 + 1 + 10 + + + 20 + 4096 + 4096 + 1 + 100 + + diff --git a/panels/universal-access/gnome-universal-access-panel.desktop.in.in b/panels/universal-access/gnome-universal-access-panel.desktop.in.in new file mode 100644 index 0000000..ef770fe --- /dev/null +++ b/panels/universal-access/gnome-universal-access-panel.desktop.in.in @@ -0,0 +1,18 @@ +[Desktop Entry] +Name=Accessibility +Comment=Make it easier to see, hear, type, point and click +Exec=gnome-control-center universal-access +# Translators: Do NOT translate or transliterate this text (this is an icon file name)! +Icon=org.gnome.Settings-accessibility +Terminal=false +Type=Application +NoDisplay=true +StartupNotify=true +Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-DetailsSettings; +OnlyShowIn=GNOME;Unity; +X-GNOME-Bugzilla-Bugzilla=GNOME +X-GNOME-Bugzilla-Product=gnome-control-center +X-GNOME-Bugzilla-Component=Universal Access +X-GNOME-Bugzilla-Version=@VERSION@ +# Translators: Search terms to find the Accessibility panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +Keywords=Keyboard;Mouse;a11y;Accessibility;Universal Access;Contrast;Cursor;Sound;Zoom;Screen;Reader;big;high;large;text;font;size;AccessX;Sticky;Keys;Slow;Bounce;Mouse;Double;click;Delay;Speed;Assist;Repeat;Blink;visual;hearing;audio;typing;animations; diff --git a/panels/universal-access/icons/meson.build b/panels/universal-access/icons/meson.build new file mode 100644 index 0000000..68f02a9 --- /dev/null +++ b/panels/universal-access/icons/meson.build @@ -0,0 +1,4 @@ +install_data( + 'scalable/org.gnome.Settings-accessibility-symbolic.svg', + install_dir: join_paths(control_center_icondir, 'hicolor', 'scalable', 'apps') +) diff --git a/panels/universal-access/icons/scalable/org.gnome.Settings-accessibility-symbolic.svg b/panels/universal-access/icons/scalable/org.gnome.Settings-accessibility-symbolic.svg new file mode 100644 index 0000000..b7efb64 --- /dev/null +++ b/panels/universal-access/icons/scalable/org.gnome.Settings-accessibility-symbolic.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/panels/universal-access/left_ptr_24px.png b/panels/universal-access/left_ptr_24px.png new file mode 100644 index 0000000..46f7760 Binary files /dev/null and b/panels/universal-access/left_ptr_24px.png differ diff --git a/panels/universal-access/left_ptr_32px.png b/panels/universal-access/left_ptr_32px.png new file mode 100644 index 0000000..5d9ba96 Binary files /dev/null and b/panels/universal-access/left_ptr_32px.png differ diff --git a/panels/universal-access/left_ptr_48px.png b/panels/universal-access/left_ptr_48px.png new file mode 100644 index 0000000..51b1dc2 Binary files /dev/null and b/panels/universal-access/left_ptr_48px.png differ diff --git a/panels/universal-access/left_ptr_64px.png b/panels/universal-access/left_ptr_64px.png new file mode 100644 index 0000000..4cf77a4 Binary files /dev/null and b/panels/universal-access/left_ptr_64px.png differ diff --git a/panels/universal-access/left_ptr_96px.png b/panels/universal-access/left_ptr_96px.png new file mode 100644 index 0000000..5897a7c Binary files /dev/null and b/panels/universal-access/left_ptr_96px.png differ diff --git a/panels/universal-access/meson.build b/panels/universal-access/meson.build new file mode 100644 index 0000000..b86b8c3 --- /dev/null +++ b/panels/universal-access/meson.build @@ -0,0 +1,64 @@ +panels_list += cappletname +desktop = 'gnome-@0@-panel.desktop'.format(cappletname) + +desktop_in = configure_file( + input: desktop + '.in.in', + output: desktop + '.in', + configuration: desktop_conf +) + +i18n.merge_file( + type: 'desktop', + input: desktop_in, + output: desktop, + po_dir: po_dir, + install: true, + install_dir: control_center_desktopdir +) + +sources = files( + 'cc-cursor-blinking-dialog.c', + 'cc-cursor-size-dialog.c', + 'cc-pointing-dialog.c', + 'cc-repeat-keys-dialog.c', + 'cc-typing-dialog.c', + 'cc-ua-panel.c', + 'cc-visual-alerts-dialog.c', + 'cc-zoom-options-dialog.c' +) + +resource_data = files( + 'cc-ua-panel.ui', + 'left_ptr_24px.png', + 'left_ptr_32px.png', + 'left_ptr_48px.png', + 'left_ptr_64px.png', + 'left_ptr_96px.png', + 'cc-cursor-blinking-dialog.ui', + 'cc-cursor-size-dialog.ui', + 'cc-pointing-dialog.ui', + 'cc-repeat-keys-dialog.ui', + 'cc-typing-dialog.ui', + 'cc-visual-alerts-dialog.ui', + 'cc-zoom-options-dialog.ui' +) + +sources += gnome.compile_resources( + 'cc-ua-resources', + cappletname + '.gresource.xml', + c_name: 'cc_' + cappletname.underscorify(), + dependencies: resource_data, + export: true +) + +deps = common_deps + [m_dep] + +panels_libs += static_library( + cappletname, + sources: sources, + include_directories: [ top_inc, common_inc ], + dependencies: deps, + c_args: cflags +) + +subdir('icons') diff --git a/panels/universal-access/universal-access.gresource.xml b/panels/universal-access/universal-access.gresource.xml new file mode 100644 index 0000000..713ef3d --- /dev/null +++ b/panels/universal-access/universal-access.gresource.xml @@ -0,0 +1,18 @@ + + + + cc-cursor-blinking-dialog.ui + cc-cursor-size-dialog.ui + cc-pointing-dialog.ui + cc-repeat-keys-dialog.ui + cc-typing-dialog.ui + cc-ua-panel.ui + cc-visual-alerts-dialog.ui + cc-zoom-options-dialog.ui + left_ptr_24px.png + left_ptr_32px.png + left_ptr_48px.png + left_ptr_64px.png + left_ptr_96px.png + + -- cgit v1.2.3