universal-access: Split visual alerts dialog into its own widget
This commit is contained in:
parent
828a2bee45
commit
9aaee503c9
8 changed files with 311 additions and 221 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include "cc-cursor-size-dialog.h"
|
#include "cc-cursor-size-dialog.h"
|
||||||
#include "cc-sound-keys-dialog.h"
|
#include "cc-sound-keys-dialog.h"
|
||||||
#include "cc-screen-reader-dialog.h"
|
#include "cc-screen-reader-dialog.h"
|
||||||
|
#include "cc-visual-alerts-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
|
||||||
|
@ -62,7 +63,6 @@
|
||||||
/* wm settings */
|
/* wm settings */
|
||||||
#define WM_SETTINGS "org.gnome.desktop.wm.preferences"
|
#define WM_SETTINGS "org.gnome.desktop.wm.preferences"
|
||||||
#define KEY_VISUAL_BELL_ENABLED "visual-bell"
|
#define KEY_VISUAL_BELL_ENABLED "visual-bell"
|
||||||
#define KEY_VISUAL_BELL_TYPE "visual-bell-type"
|
|
||||||
#define KEY_WM_THEME "theme"
|
#define KEY_WM_THEME "theme"
|
||||||
|
|
||||||
/* keyboard settings */
|
/* keyboard settings */
|
||||||
|
@ -173,11 +173,6 @@ struct _CcUaPanel
|
||||||
GtkWidget *value_sound_keys;
|
GtkWidget *value_sound_keys;
|
||||||
GtkWidget *value_visual_alerts;
|
GtkWidget *value_visual_alerts;
|
||||||
GtkWidget *value_zoom;
|
GtkWidget *value_zoom;
|
||||||
GtkDialog *visual_alerts_dialog;
|
|
||||||
GtkWidget *visual_alerts_screen_radio;
|
|
||||||
GtkWidget *visual_alerts_switch;
|
|
||||||
GtkWidget *visual_alerts_test_button;
|
|
||||||
GtkWidget *visual_alerts_window_radio;
|
|
||||||
|
|
||||||
GSettings *wm_settings;
|
GSettings *wm_settings;
|
||||||
GSettings *a11y_settings;
|
GSettings *a11y_settings;
|
||||||
|
@ -305,11 +300,6 @@ cc_ua_panel_class_init (CcUaPanelClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_sound_keys);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_sound_keys);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_visual_alerts);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_visual_alerts);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_zoom);
|
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, value_zoom);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_dialog);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_screen_radio);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_switch);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_test_button);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcUaPanel, visual_alerts_window_radio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* seeing section */
|
/* seeing section */
|
||||||
|
@ -577,7 +567,7 @@ activate_row (CcUaPanel *self, GtkListBoxRow *row)
|
||||||
}
|
}
|
||||||
else if (row == self->row_visual_alerts)
|
else if (row == self->row_visual_alerts)
|
||||||
{
|
{
|
||||||
show_dialog (self, self->visual_alerts_dialog);
|
run_dialog (self, GTK_DIALOG (cc_visual_alerts_dialog_new ()));
|
||||||
}
|
}
|
||||||
else if (row == self->row_repeat_keys)
|
else if (row == self->row_repeat_keys)
|
||||||
{
|
{
|
||||||
|
@ -659,44 +649,6 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hearing/sound section */
|
/* hearing/sound section */
|
||||||
static void
|
|
||||||
visual_bell_type_notify_cb (CcUaPanel *self)
|
|
||||||
{
|
|
||||||
GtkWidget *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->visual_alerts_window_radio;
|
|
||||||
else
|
|
||||||
widget = self->visual_alerts_screen_radio;
|
|
||||||
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
visual_bell_type_toggle_cb (CcUaPanel *self)
|
|
||||||
{
|
|
||||||
gboolean frame_flash;
|
|
||||||
GDesktopVisualBellType type;
|
|
||||||
|
|
||||||
frame_flash = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->visual_alerts_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 (GtkButton *button,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
|
||||||
gdk_window_beep (gtk_widget_get_window (toplevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cc_ua_panel_init_hearing (CcUaPanel *self)
|
cc_ua_panel_init_hearing (CcUaPanel *self)
|
||||||
|
@ -708,39 +660,11 @@ cc_ua_panel_init_hearing (CcUaPanel *self)
|
||||||
g_signal_connect_object (self->list_hearing, "row-activated",
|
g_signal_connect_object (self->list_hearing, "row-activated",
|
||||||
G_CALLBACK (activate_row), self, G_CONNECT_SWAPPED);
|
G_CALLBACK (activate_row), self, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
/* 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->visual_alerts_switch, "active",
|
|
||||||
G_SETTINGS_BIND_DEFAULT);
|
|
||||||
|
|
||||||
g_settings_bind_with_mapping (self->wm_settings, KEY_VISUAL_BELL_ENABLED,
|
g_settings_bind_with_mapping (self->wm_settings, KEY_VISUAL_BELL_ENABLED,
|
||||||
self->value_visual_alerts,
|
self->value_visual_alerts,
|
||||||
"label", G_SETTINGS_BIND_GET,
|
"label", G_SETTINGS_BIND_GET,
|
||||||
on_off_label_mapping_get,
|
on_off_label_mapping_get,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
g_object_bind_property (self->visual_alerts_switch, "active",
|
|
||||||
self->visual_alerts_window_radio, "sensitive",
|
|
||||||
G_BINDING_SYNC_CREATE);
|
|
||||||
g_object_bind_property (self->visual_alerts_switch, "active",
|
|
||||||
self->visual_alerts_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->visual_alerts_window_radio,
|
|
||||||
"toggled", G_CALLBACK (visual_bell_type_toggle_cb), self, G_CONNECT_SWAPPED);
|
|
||||||
|
|
||||||
self->toplevels = g_slist_prepend (self->toplevels, self->visual_alerts_dialog);
|
|
||||||
|
|
||||||
g_signal_connect (self->visual_alerts_dialog, "delete-event",
|
|
||||||
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
|
||||||
|
|
||||||
g_signal_connect (self->visual_alerts_test_button,
|
|
||||||
"clicked", G_CALLBACK (test_flash), NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* typing/keyboard section */
|
/* typing/keyboard section */
|
||||||
|
|
|
@ -1060,149 +1060,6 @@
|
||||||
<widget name="row_click_assist"/>
|
<widget name="row_click_assist"/>
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="visual_alerts_dialog">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="border_width">5</property>
|
|
||||||
<property name="resizable">False</property>
|
|
||||||
<property name="modal">True</property>
|
|
||||||
<property name="type_hint">dialog</property>
|
|
||||||
<property name="use_header_bar">1</property>
|
|
||||||
<child internal-child="headerbar">
|
|
||||||
<object class="GtkHeaderBar" id="visual_alerts_header_bar">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="title" translatable="yes">Visual Alerts</property>
|
|
||||||
<property name="show_close_button">True</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="visual_alerts_test_button">
|
|
||||||
<property name="label" translatable="yes">_Test flash</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<style>
|
|
||||||
<class name="text-button"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="pack_type">start</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child internal-child="vbox">
|
|
||||||
<object class="GtkBox" id="dialog-vbox4">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">2</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="visual_alerts_blurb">
|
|
||||||
<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">6</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes">Use a visual indication when an alert sound occurs.</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="GtkGrid" id="grid5">
|
|
||||||
<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="visual_alerts_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">_Visual Alerts</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="mnemonic_widget">visual_alerts_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="visual_alerts_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>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioButton" id="visual_alerts_window_radio">
|
|
||||||
<property name="label" translatable="yes">Flash the entire _window</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
<property name="width">2</property>
|
|
||||||
<property name="height">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioButton" id="visual_alerts_screen_radio">
|
|
||||||
<property name="label" translatable="yes">Flash the entire _screen</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<property name="group">visual_alerts_window_radio</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="width">2</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>
|
|
||||||
<action-widgets>
|
|
||||||
<action-widget response="0">visual_alerts_test_button</action-widget>
|
|
||||||
</action-widgets>
|
|
||||||
</object>
|
|
||||||
<object class="GtkAdjustment" id="typing_bouncekeys_delay_adjustment">
|
<object class="GtkAdjustment" id="typing_bouncekeys_delay_adjustment">
|
||||||
<property name="upper">900</property>
|
<property name="upper">900</property>
|
||||||
<property name="value">0.5</property>
|
<property name="value">0.5</property>
|
||||||
|
|
142
panels/universal-access/cc-visual-alerts-dialog.c
Normal file
142
panels/universal-access/cc-visual-alerts-dialog.c
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* 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 <gdesktop-enums.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
GtkRadioButton *screen_radio;
|
||||||
|
GtkButton *test_button;
|
||||||
|
GtkRadioButton *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)
|
||||||
|
{
|
||||||
|
GtkRadioButton *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_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
visual_bell_type_toggle_cb (CcVisualAlertsDialog *self)
|
||||||
|
{
|
||||||
|
gboolean frame_flash;
|
||||||
|
GDesktopVisualBellType type;
|
||||||
|
|
||||||
|
frame_flash = gtk_toggle_button_get_active (GTK_TOGGLE_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)
|
||||||
|
{
|
||||||
|
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
||||||
|
gdk_window_beep (gtk_widget_get_window (toplevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
29
panels/universal-access/cc-visual-alerts-dialog.h
Normal file
29
panels/universal-access/cc-visual-alerts-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 (CcVisualAlertsDialog, cc_visual_alerts_dialog, CC, VISUAL_ALERTS_DIALOG, GtkDialog)
|
||||||
|
|
||||||
|
CcVisualAlertsDialog *cc_visual_alerts_dialog_new (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
134
panels/universal-access/cc-visual-alerts-dialog.ui
Normal file
134
panels/universal-access/cc-visual-alerts-dialog.ui
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
|
<template class="CcVisualAlertsDialog" parent="GtkDialog">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="use_header_bar">1</property>
|
||||||
|
<child internal-child="headerbar">
|
||||||
|
<object class="GtkHeaderBar">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Visual Alerts</property>
|
||||||
|
<property name="show_close_button">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="test_button">
|
||||||
|
<property name="label" translatable="yes">_Test flash</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<style>
|
||||||
|
<class name="text-button"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="pack_type">start</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<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">6</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">Use a visual indication when an alert sound occurs.</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<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">_Visual Alerts</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>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="window_radio">
|
||||||
|
<property name="label" translatable="yes">Flash the entire _window</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">2</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="screen_radio">
|
||||||
|
<property name="label" translatable="yes">Flash the entire _screen</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">window_radio</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="width">2</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
|
@ -22,6 +22,7 @@ sources = files(
|
||||||
'cc-sound-keys-dialog.c',
|
'cc-sound-keys-dialog.c',
|
||||||
'cc-screen-reader-dialog.c',
|
'cc-screen-reader-dialog.c',
|
||||||
'cc-ua-panel.c',
|
'cc-ua-panel.c',
|
||||||
|
'cc-visual-alerts-dialog.c',
|
||||||
'cc-zoom-options-dialog.c'
|
'cc-zoom-options-dialog.c'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ resource_data = files(
|
||||||
'cc-cursor-size-dialog.ui',
|
'cc-cursor-size-dialog.ui',
|
||||||
'cc-sound-keys-dialog.ui',
|
'cc-sound-keys-dialog.ui',
|
||||||
'cc-screen-reader-dialog.ui',
|
'cc-screen-reader-dialog.ui',
|
||||||
|
'cc-visual-alerts-dialog.ui',
|
||||||
'cc-zoom-options-dialog.ui'
|
'cc-zoom-options-dialog.ui'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<file preprocess="xml-stripblanks">cc-sound-keys-dialog.ui</file>
|
<file preprocess="xml-stripblanks">cc-sound-keys-dialog.ui</file>
|
||||||
<file preprocess="xml-stripblanks">cc-screen-reader-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-visual-alerts-dialog.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>
|
||||||
<file>left_ptr_32px.png</file>
|
<file>left_ptr_32px.png</file>
|
||||||
|
|
|
@ -220,6 +220,7 @@ panels/universal-access/cc-sound-keys-dialog.ui
|
||||||
panels/universal-access/cc-screen-reader-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-visual-alerts-dialog.ui
|
||||||
panels/universal-access/cc-zoom-options-dialog.c
|
panels/universal-access/cc-zoom-options-dialog.c
|
||||||
panels/universal-access/cc-zoom-options-dialog.ui
|
panels/universal-access/cc-zoom-options-dialog.ui
|
||||||
panels/universal-access/gnome-universal-access-panel.desktop.in.in
|
panels/universal-access/gnome-universal-access-panel.desktop.in.in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue