universal-access: Split screen reader dialog into its own widget
This commit is contained in:
parent
12a19878a6
commit
9a6631a31d
8 changed files with 194 additions and 103 deletions
76
panels/universal-access/cc-screen-reader-dialog.c
Normal file
76
panels/universal-access/cc-screen-reader-dialog.c
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* 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-screen-reader-dialog.h"
|
||||||
|
|
||||||
|
#define APPLICATION_SETTINGS "org.gnome.desktop.a11y.applications"
|
||||||
|
#define KEY_SCREEN_READER_ENABLED "screen-reader-enabled"
|
||||||
|
|
||||||
|
struct _CcScreenReaderDialog
|
||||||
|
{
|
||||||
|
GtkDialog parent;
|
||||||
|
|
||||||
|
GtkSwitch *enable_switch;
|
||||||
|
|
||||||
|
GSettings *application_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (CcScreenReaderDialog, cc_screen_reader_dialog, GTK_TYPE_DIALOG);
|
||||||
|
|
||||||
|
static void
|
||||||
|
cc_screen_reader_dialog_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
CcScreenReaderDialog *self = CC_SCREEN_READER_DIALOG (object);
|
||||||
|
|
||||||
|
g_clear_object (&self->application_settings);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (cc_screen_reader_dialog_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cc_screen_reader_dialog_class_init (CcScreenReaderDialogClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = cc_screen_reader_dialog_dispose;
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/universal-access/cc-screen-reader-dialog.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CcScreenReaderDialog, enable_switch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cc_screen_reader_dialog_init (CcScreenReaderDialog *self)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
|
self->application_settings = g_settings_new (APPLICATION_SETTINGS);
|
||||||
|
|
||||||
|
g_settings_bind (self->application_settings, KEY_SCREEN_READER_ENABLED,
|
||||||
|
self->enable_switch, "active",
|
||||||
|
G_SETTINGS_BIND_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcScreenReaderDialog *
|
||||||
|
cc_screen_reader_dialog_new (void)
|
||||||
|
{
|
||||||
|
return g_object_new (cc_screen_reader_dialog_get_type (),
|
||||||
|
"use-header-bar", TRUE,
|
||||||
|
NULL);
|
||||||
|
}
|
29
panels/universal-access/cc-screen-reader-dialog.h
Normal file
29
panels/universal-access/cc-screen-reader-dialog.h
Normal file
|
@ -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 <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (CcScreenReaderDialog, cc_screen_reader_dialog, CC, SCREEN_READER_DIALOG, GtkDialog)
|
||||||
|
|
||||||
|
CcScreenReaderDialog *cc_screen_reader_dialog_new (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
83
panels/universal-access/cc-screen-reader-dialog.ui
Normal file
83
panels/universal-access/cc-screen-reader-dialog.ui
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
|
<template class="CcScreenReaderDialog" parent="GtkDialog">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<property name="title" translatable="yes">Screen Reader</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="use_header_bar">1</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<property name="margin">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="max_width_chars">45</property>
|
||||||
|
<property name="label" translatable="yes">The screen reader reads displayed text as you move the focus.</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<style>
|
||||||
|
<class name="frame"/>
|
||||||
|
<class name="view"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_start">12</property>
|
||||||
|
<property name="margin_end">6</property>
|
||||||
|
<property name="margin_top">12</property>
|
||||||
|
<property name="margin_bottom">12</property>
|
||||||
|
<property name="row_spacing">12</property>
|
||||||
|
<property name="column_spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">_Screen Reader</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">enable_switch</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="enable_switch">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
|
@ -31,6 +31,7 @@
|
||||||
#include "cc-ua-panel.h"
|
#include "cc-ua-panel.h"
|
||||||
#include "cc-ua-resources.h"
|
#include "cc-ua-resources.h"
|
||||||
#include "cc-cursor-size-dialog.h"
|
#include "cc-cursor-size-dialog.h"
|
||||||
|
#include "cc-screen-reader-dialog.h"
|
||||||
#include "cc-zoom-options-dialog.h"
|
#include "cc-zoom-options-dialog.h"
|
||||||
|
|
||||||
#define DPI_FACTOR_LARGE 1.25
|
#define DPI_FACTOR_LARGE 1.25
|
||||||
|
@ -141,8 +142,6 @@ struct _CcUaPanel
|
||||||
GtkListBoxRow *row_zoom;
|
GtkListBoxRow *row_zoom;
|
||||||
GtkWidget *scale_double_click_delay;
|
GtkWidget *scale_double_click_delay;
|
||||||
GtkWidget *screen_keyboard_switch;
|
GtkWidget *screen_keyboard_switch;
|
||||||
GtkDialog *screen_reader_dialog;
|
|
||||||
GtkWidget *screen_reader_switch;
|
|
||||||
GtkWidget *section_status;
|
GtkWidget *section_status;
|
||||||
GtkDialog *sound_keys_dialog;
|
GtkDialog *sound_keys_dialog;
|
||||||
GtkWidget *sound_keys_switch;
|
GtkWidget *sound_keys_switch;
|
||||||
|
@ -277,8 +276,6 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, row_zoom);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, row_zoom);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, scale_double_click_delay);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, scale_double_click_delay);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_keyboard_switch);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_keyboard_switch);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_dialog);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, screen_reader_switch);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, section_status);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, section_status);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_dialog);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_dialog);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_switch);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, sound_keys_switch);
|
||||||
|
@ -575,7 +572,7 @@ activate_row (CcUaPanel *self, GtkListBoxRow *row)
|
||||||
}
|
}
|
||||||
else if (row == self->row_screen_reader)
|
else if (row == self->row_screen_reader)
|
||||||
{
|
{
|
||||||
show_dialog (self, self->screen_reader_dialog);
|
run_dialog (self, GTK_DIALOG (cc_screen_reader_dialog_new ()));
|
||||||
}
|
}
|
||||||
else if (row == self->row_sound_keys)
|
else if (row == self->row_sound_keys)
|
||||||
{
|
{
|
||||||
|
@ -655,15 +652,6 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
|
||||||
on_off_label_mapping_get,
|
on_off_label_mapping_get,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
g_settings_bind (self->application_settings, "screen-reader-enabled",
|
|
||||||
self->screen_reader_switch, "active",
|
|
||||||
G_SETTINGS_BIND_DEFAULT);
|
|
||||||
|
|
||||||
self->toplevels = g_slist_prepend (self->toplevels, self->screen_reader_dialog);
|
|
||||||
|
|
||||||
g_signal_connect (self->screen_reader_dialog, "delete-event",
|
|
||||||
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
|
||||||
|
|
||||||
/* sound keys */
|
/* sound keys */
|
||||||
|
|
||||||
g_settings_bind_with_mapping (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
|
g_settings_bind_with_mapping (self->kb_settings, KEY_TOGGLEKEYS_ENABLED,
|
||||||
|
|
|
@ -1060,95 +1060,6 @@
|
||||||
<widget name="row_click_assist"/>
|
<widget name="row_click_assist"/>
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="screen_reader_dialog">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="border_width">5</property>
|
|
||||||
<property name="title" translatable="yes">Screen Reader</property>
|
|
||||||
<property name="type_hint">dialog</property>
|
|
||||||
<property name="resizable">False</property>
|
|
||||||
<property name="modal">True</property>
|
|
||||||
<property name="use_header_bar">1</property>
|
|
||||||
<child internal-child="vbox">
|
|
||||||
<object class="GtkBox" id="dialog-vbox2">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">12</property>
|
|
||||||
<property name="margin">12</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="screen_reader_blurb">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="max_width_chars">45</property>
|
|
||||||
<property name="label" translatable="yes">The screen reader reads displayed text as you move the focus.</property>
|
|
||||||
<property name="wrap">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<style>
|
|
||||||
<class name="frame"/>
|
|
||||||
<class name="view"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
|
||||||
<object class="GtkGrid" id="grid3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="margin_start">12</property>
|
|
||||||
<property name="margin_end">6</property>
|
|
||||||
<property name="margin_top">12</property>
|
|
||||||
<property name="margin_bottom">12</property>
|
|
||||||
<property name="row_spacing">12</property>
|
|
||||||
<property name="column_spacing">6</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="screen_reader_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes">_Screen Reader</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="mnemonic_widget">screen_reader_switch</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="width">1</property>
|
|
||||||
<property name="height">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSwitch" id="screen_reader_switch">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="width">1</property>
|
|
||||||
<property name="height">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<object class="GtkDialog" id="sound_keys_dialog">
|
<object class="GtkDialog" id="sound_keys_dialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
|
|
|
@ -19,6 +19,7 @@ i18n.merge_file(
|
||||||
|
|
||||||
sources = files(
|
sources = files(
|
||||||
'cc-cursor-size-dialog.c',
|
'cc-cursor-size-dialog.c',
|
||||||
|
'cc-screen-reader-dialog.c',
|
||||||
'cc-ua-panel.c',
|
'cc-ua-panel.c',
|
||||||
'cc-zoom-options-dialog.c'
|
'cc-zoom-options-dialog.c'
|
||||||
)
|
)
|
||||||
|
@ -31,6 +32,7 @@ resource_data = files(
|
||||||
'left_ptr_64px.png',
|
'left_ptr_64px.png',
|
||||||
'left_ptr_96px.png',
|
'left_ptr_96px.png',
|
||||||
'cc-cursor-size-dialog.ui',
|
'cc-cursor-size-dialog.ui',
|
||||||
|
'cc-screen-reader-dialog.ui',
|
||||||
'cc-zoom-options-dialog.ui'
|
'cc-zoom-options-dialog.ui'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/control-center/universal-access">
|
<gresource prefix="/org/gnome/control-center/universal-access">
|
||||||
<file preprocess="xml-stripblanks">cc-cursor-size-dialog.ui</file>
|
<file preprocess="xml-stripblanks">cc-cursor-size-dialog.ui</file>
|
||||||
|
<file preprocess="xml-stripblanks">cc-screen-reader-dialog.ui</file>
|
||||||
<file preprocess="xml-stripblanks">cc-ua-panel.ui</file>
|
<file preprocess="xml-stripblanks">cc-ua-panel.ui</file>
|
||||||
<file preprocess="xml-stripblanks">cc-zoom-options-dialog.ui</file>
|
<file preprocess="xml-stripblanks">cc-zoom-options-dialog.ui</file>
|
||||||
<file>left_ptr_24px.png</file>
|
<file>left_ptr_24px.png</file>
|
||||||
|
|
|
@ -216,6 +216,7 @@ panels/thunderbolt/cc-bolt-panel.c
|
||||||
panels/thunderbolt/cc-bolt-panel.ui
|
panels/thunderbolt/cc-bolt-panel.ui
|
||||||
panels/thunderbolt/gnome-thunderbolt-panel.desktop.in.in
|
panels/thunderbolt/gnome-thunderbolt-panel.desktop.in.in
|
||||||
panels/universal-access/cc-cursor-size-dialog.ui
|
panels/universal-access/cc-cursor-size-dialog.ui
|
||||||
|
panels/universal-access/cc-screen-reader-dialog.ui
|
||||||
panels/universal-access/cc-ua-panel.c
|
panels/universal-access/cc-ua-panel.c
|
||||||
panels/universal-access/cc-ua-panel.ui
|
panels/universal-access/cc-ua-panel.ui
|
||||||
panels/universal-access/cc-zoom-options-dialog.c
|
panels/universal-access/cc-zoom-options-dialog.c
|
||||||
|
|
Loading…
Add table
Reference in a new issue