Include revised AT startup dialog as per discussions with JRB and Jody.
This commit is contained in:
parent
9a9dd67234
commit
4e66e604e9
12 changed files with 864 additions and 2 deletions
|
@ -3,7 +3,7 @@ always_built_SUBDIRS = \
|
|||
default-applications desktop-links font \
|
||||
background keyboard mouse sound \
|
||||
file-types theme-switcher ui-properties \
|
||||
keybindings network windows
|
||||
keybindings network windows
|
||||
|
||||
if HAVE_RANDR
|
||||
randr_SUBDIRS = display
|
||||
|
|
|
@ -1 +1 @@
|
|||
SUBDIRS = keyboard
|
||||
SUBDIRS = keyboard at-properties
|
||||
|
|
36
capplets/accessibility/at-properties/Makefile.am
Normal file
36
capplets/accessibility/at-properties/Makefile.am
Normal file
|
@ -0,0 +1,36 @@
|
|||
bin_PROGRAMS = gnome-at-properties
|
||||
|
||||
gnome_at_properties_LDADD = $(AT_CAPPLET_LIBS) $(top_builddir)/capplets/common/libcommon.la
|
||||
gnome_at_properties_SOURCES = \
|
||||
main.c \
|
||||
at-startup-session.h \
|
||||
at-startup-session.c
|
||||
gnome_at_properties_LDFLAGS = -export-dynamic
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
iconsdir = $(GNOMECC_ICONS_DIR)
|
||||
icons_DATA = at-enable-capplet.png
|
||||
|
||||
desktopdir = $(GNOMECC_DESKTOP_DIR)
|
||||
Desktop_in_files = at-properties.desktop.in
|
||||
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
|
||||
pixmap_DATA = \
|
||||
at-enable-capplet.png \
|
||||
at-startup.png \
|
||||
at-support.png
|
||||
|
||||
desktop_iconsdir = $(datadir)/pixmaps
|
||||
desktop_icons_DATA = at-enable-capplet.png
|
||||
|
||||
gladedir = $(GNOMECC_GLADE_DIR)
|
||||
glade_DATA = at-enable-dialog.glade
|
||||
|
||||
INCLUDES = $(AT_CAPPLET_CFLAGS) \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DPIXMAPDIR=\""$(pixmapdir)"\"
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
|
||||
EXTRA_DIST = $(icons_DATA) $(glade_DATA) $(pixmap_DATA) $(Desktop_in_files)
|
BIN
capplets/accessibility/at-properties/at-enable-capplet.png
Normal file
BIN
capplets/accessibility/at-properties/at-enable-capplet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
383
capplets/accessibility/at-properties/at-enable-dialog.glade
Normal file
383
capplets/accessibility/at-properties/at-enable-dialog.glade
Normal file
|
@ -0,0 +1,383 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkDialog" id="dlgATPrefs">
|
||||
<property name="title" translatable="yes">Assitive Technology Preferences</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="has_separator">True</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnHelp">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-11</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnCloseLogout">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Close and _Log Out</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="btnClose">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-7</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="fraSupport">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="lblNote">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><small><i><b>Note:</b> Changes to this setting will not take effect until you next log in.</i></small></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkEnableAT">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Enable assistive technologies</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">6</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_padding">6</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Support</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="fraApps">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table2">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Start these assistive technologies every time you log in:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">6</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkScreenreader">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Screenreader</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkMagnifier">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Magnifier</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chkKeyboard">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_On-screen keyboard</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">6</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_padding">6</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Applications</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -0,0 +1,13 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
_Name=Assistive Technology Support
|
||||
_Comment=Enable support for GNOME assistive technologies at login
|
||||
Exec=gnome-at-properties
|
||||
Icon=at-enable-capplet.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;Settings;Accessibility;
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=control-center
|
||||
X-GNOME-Bugzilla-Component=Assistive Technology Support
|
139
capplets/accessibility/at-properties/at-startup-session.c
Normal file
139
capplets/accessibility/at-properties/at-startup-session.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include <glib-object.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include "at-startup-session.h"
|
||||
|
||||
#define AT_STARTUP_KEY "/desktop/gnome/accessibility/startup/exec_ats"
|
||||
|
||||
#define GNOPERNICUS_MAGNIFIER_KEY "/apps/gnopernicus/srcore/mag_active"
|
||||
#define GNOPERNICUS_SPEECH_KEY "/apps/gnopernicus/srcore/sp_active"
|
||||
#define GNOPERNICUS_BRAILLE_KEY "/apps/gnopernicus/srcore/br_active"
|
||||
|
||||
static AtStartupState at_startup_state_recent;
|
||||
|
||||
static GSList *
|
||||
at_startup_get_list (GConfClient *client)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSList *at_list = gconf_client_get_list (client, AT_STARTUP_KEY, GCONF_VALUE_STRING, &error);
|
||||
if (error) {
|
||||
g_warning ("Error getting value of " AT_STARTUP_KEY ": %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
return at_list;
|
||||
}
|
||||
|
||||
gint
|
||||
at_startup_string_compare (gconstpointer s1, gconstpointer s2)
|
||||
{
|
||||
if (s1 && s2) {
|
||||
return strcmp (s1, s2);
|
||||
}
|
||||
else
|
||||
return (s2-s1);
|
||||
}
|
||||
|
||||
static GSList *
|
||||
at_startup_list_add (GSList *list, const gchar *exec_name)
|
||||
{
|
||||
GSList *l = g_slist_find_custom (list, exec_name, at_startup_string_compare);
|
||||
if (!l) {
|
||||
list = g_slist_append (list, g_strdup (exec_name));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
at_startup_list_remove (GSList *list, const gchar *exec_name)
|
||||
{
|
||||
GSList *l = g_slist_find_custom (list, exec_name, at_startup_string_compare);
|
||||
if (l) {
|
||||
g_free (l->data);
|
||||
list = g_slist_delete_link (list, l);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
at_startup_state_init (AtStartupState *startup_state)
|
||||
{
|
||||
gboolean mag_active, speech_active, braille_active;
|
||||
GSList *l;
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
GSList *at_list = at_startup_get_list (client);
|
||||
for (l = at_list; l; l = l->next) {
|
||||
gchar *exec_name = (char *) l->data;
|
||||
if (exec_name && !strcmp (exec_name, "gnopernicus")) {
|
||||
braille_active = gconf_client_get_bool (client,
|
||||
GNOPERNICUS_BRAILLE_KEY,
|
||||
NULL);
|
||||
mag_active = gconf_client_get_bool (client,
|
||||
GNOPERNICUS_MAGNIFIER_KEY,
|
||||
NULL);
|
||||
speech_active = gconf_client_get_bool (client,
|
||||
GNOPERNICUS_SPEECH_KEY,
|
||||
NULL);
|
||||
|
||||
startup_state->enabled.screenreader = (braille_active || speech_active);
|
||||
startup_state->enabled.magnifier = mag_active;
|
||||
}
|
||||
else if (exec_name && !strcmp(exec_name, "gok")) {
|
||||
startup_state->enabled.osk = TRUE;
|
||||
}
|
||||
g_free (exec_name);
|
||||
}
|
||||
g_slist_free (at_list);
|
||||
g_object_unref (client);
|
||||
at_startup_state_recent.flags = startup_state->flags;
|
||||
}
|
||||
|
||||
void
|
||||
at_startup_state_update (AtStartupState *startup_state)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
GSList *at_list = at_startup_get_list (client);
|
||||
|
||||
if (startup_state->enabled.screenreader != at_startup_state_recent.enabled.screenreader) {
|
||||
gconf_client_set_bool (client, GNOPERNICUS_SPEECH_KEY,
|
||||
startup_state->enabled.screenreader, NULL);
|
||||
gconf_client_set_bool (client, GNOPERNICUS_BRAILLE_KEY,
|
||||
startup_state->enabled.screenreader, NULL);
|
||||
}
|
||||
|
||||
if (startup_state->enabled.magnifier != at_startup_state_recent.enabled.magnifier) {
|
||||
gconf_client_set_bool (client, GNOPERNICUS_MAGNIFIER_KEY,
|
||||
startup_state->enabled.magnifier, NULL);
|
||||
}
|
||||
|
||||
if (startup_state->enabled.screenreader || startup_state->enabled.magnifier) {
|
||||
if (!(at_startup_state_recent.enabled.screenreader ||
|
||||
at_startup_state_recent.enabled.magnifier))
|
||||
/* new state includes SR or magnifier, initial one did not */
|
||||
at_list = at_startup_list_add (at_list, "gnopernicus");
|
||||
}
|
||||
else {
|
||||
if (at_startup_state_recent.enabled.screenreader ||
|
||||
at_startup_state_recent.enabled.magnifier)
|
||||
at_list = at_startup_list_remove (at_list, "gnopernicus");
|
||||
}
|
||||
if (startup_state->enabled.osk) {
|
||||
if (!at_startup_state_recent.enabled.osk)
|
||||
at_list = at_startup_list_add (at_list, "gok");
|
||||
}
|
||||
else {
|
||||
if (at_startup_state_recent.enabled.osk)
|
||||
at_list = at_startup_list_remove (at_list, "gok");
|
||||
}
|
||||
if (at_startup_state_recent.flags != startup_state->flags) {
|
||||
at_startup_state_recent.flags = startup_state->flags;
|
||||
gconf_client_set_list (client, AT_STARTUP_KEY, GCONF_VALUE_STRING, at_list, &error);
|
||||
}
|
||||
g_object_unref (client);
|
||||
g_slist_free (at_list);
|
||||
}
|
||||
|
||||
|
16
capplets/accessibility/at-properties/at-startup-session.h
Normal file
16
capplets/accessibility/at-properties/at-startup-session.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef union {
|
||||
guint flags;
|
||||
struct {
|
||||
guint support:1;
|
||||
guint osk:1;
|
||||
guint magnifier:1;
|
||||
guint screenreader:1;
|
||||
} enabled;
|
||||
} AtStartupState;
|
||||
|
||||
void at_startup_state_init (AtStartupState *startup_state);
|
||||
|
||||
void at_startup_state_update (AtStartupState *startup_state);
|
BIN
capplets/accessibility/at-properties/at-startup.png
Normal file
BIN
capplets/accessibility/at-properties/at-startup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
capplets/accessibility/at-properties/at-support.png
Normal file
BIN
capplets/accessibility/at-properties/at-support.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
269
capplets/accessibility/at-properties/main.c
Normal file
269
capplets/accessibility/at-properties/main.c
Normal file
|
@ -0,0 +1,269 @@
|
|||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
#include "capplet-util.h"
|
||||
#include "gconf-property-editor.h"
|
||||
#include "activate-settings-daemon.h"
|
||||
#include "at-startup-session.h"
|
||||
|
||||
#define ACCESSIBILITY_KEY "/desktop/gnome/interface/accessibility"
|
||||
#define ACCESSIBILITY_KEY_DIR "/desktop/gnome/interface"
|
||||
#define AT_STARTUP_DIR "/desktop/gnome/accessibility/startup"
|
||||
#define AT_STARTUP_KEY "/desktop/gnome/accessibility/startup/exec_ats"
|
||||
#define SR_PREFS_DIR "/apps/gnopernicus/srcore"
|
||||
|
||||
static AtStartupState at_startup_state, at_startup_state_initial;
|
||||
|
||||
static void
|
||||
init_startup_state (GladeXML *dialog)
|
||||
{
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
|
||||
at_startup_state.flags = (gconf_client_get_bool (client,
|
||||
ACCESSIBILITY_KEY,
|
||||
NULL)) ? 1 : 0;
|
||||
|
||||
at_startup_state_init (&at_startup_state);
|
||||
|
||||
at_startup_state_initial.flags = at_startup_state.flags;
|
||||
g_object_unref (client);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkKeyboard")),
|
||||
at_startup_state.enabled.osk);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkScreenreader")),
|
||||
at_startup_state.enabled.screenreader);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkMagnifier")),
|
||||
at_startup_state.enabled.magnifier);
|
||||
}
|
||||
|
||||
static GladeXML *
|
||||
create_dialog (void)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
|
||||
dialog = glade_xml_new (GLADEDIR "/at-enable-dialog.glade", "dlgATPrefs", NULL);
|
||||
|
||||
gtk_image_set_from_stock (GTK_IMAGE (WID ("image1")),
|
||||
GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
gtk_image_set_from_file (GTK_IMAGE (WID ("image2")),
|
||||
PIXMAPDIR "/at-support.png");
|
||||
|
||||
gtk_image_set_from_file (GTK_IMAGE (WID ("image3")),
|
||||
PIXMAPDIR "/at-startup.png");
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_dialog_response (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
GnomeClient *client;
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
capplet_help (GTK_WINDOW (dialog),
|
||||
"foo.xml",
|
||||
"bar");
|
||||
else if (response_id == GTK_RESPONSE_CLOSE)
|
||||
gtk_main_quit ();
|
||||
else {
|
||||
g_message ("CLOSE AND LOGOUT!");
|
||||
if (!(client = gnome_master_client ())) {
|
||||
|
||||
gtk_main_quit ();
|
||||
}
|
||||
gnome_client_request_save (client, GNOME_SAVE_GLOBAL, TRUE,
|
||||
GNOME_INTERACT_ANY, FALSE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
close_logout_update (GladeXML *dialog)
|
||||
{
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
gboolean has_changed =
|
||||
(at_startup_state.flags != at_startup_state_initial.flags) &&
|
||||
gconf_client_get_bool (client, ACCESSIBILITY_KEY, NULL);
|
||||
|
||||
gtk_widget_set_sensitive (WID ("btnCloseLogout"), has_changed);
|
||||
g_object_unref (client);
|
||||
}
|
||||
|
||||
static void
|
||||
at_startup_toggled (GtkToggleButton *toggle_button,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
if (toggle_button == GTK_TOGGLE_BUTTON (WID ("chkKeyboard"))) {
|
||||
at_startup_state.enabled.osk = gtk_toggle_button_get_active (toggle_button);
|
||||
}
|
||||
else if (toggle_button == GTK_TOGGLE_BUTTON (WID ("chkMagnifier"))) {
|
||||
at_startup_state.enabled.magnifier = gtk_toggle_button_get_active (toggle_button);
|
||||
}
|
||||
else if (toggle_button == GTK_TOGGLE_BUTTON (WID ("chkScreenreader"))) {
|
||||
at_startup_state.enabled.screenreader = gtk_toggle_button_get_active (toggle_button);
|
||||
}
|
||||
|
||||
at_startup_state_update (&at_startup_state);
|
||||
close_logout_update (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
at_enable_toggled (GtkToggleButton *toggle_button,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
gboolean is_enabled = gtk_toggle_button_get_active (toggle_button);
|
||||
|
||||
gconf_client_set_bool (client, ACCESSIBILITY_KEY,
|
||||
is_enabled,
|
||||
NULL);
|
||||
at_startup_state.enabled.support = is_enabled;
|
||||
g_object_unref (client);
|
||||
}
|
||||
|
||||
static void
|
||||
at_startup_update_ui (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
at_startup_state_init (&at_startup_state);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkKeyboard")),
|
||||
at_startup_state.enabled.osk);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkScreenreader")),
|
||||
at_startup_state.enabled.screenreader);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkMagnifier")),
|
||||
at_startup_state.enabled.magnifier);
|
||||
}
|
||||
|
||||
static void
|
||||
at_enable_update (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
gboolean is_enabled = gconf_client_get_bool (client, ACCESSIBILITY_KEY, NULL);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chkEnableAT")),
|
||||
is_enabled);
|
||||
|
||||
gtk_widget_set_sensitive (WID ("fraApps"), is_enabled);
|
||||
gtk_widget_set_sensitive (WID ("chkKeyboard"), is_enabled);
|
||||
gtk_widget_set_sensitive (WID ("chkMagnifier"), is_enabled);
|
||||
gtk_widget_set_sensitive (WID ("chkScreenreader"), is_enabled);
|
||||
}
|
||||
|
||||
static void
|
||||
at_startup_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
at_startup_state_init (&at_startup_state);
|
||||
at_startup_update_ui (client, user_data);
|
||||
close_logout_update (user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
at_enable_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
at_enable_update (client, user_data);
|
||||
close_logout_update (user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dialog (GladeXML *dialog)
|
||||
{
|
||||
GConfClient *client;
|
||||
GtkWidget *widget;
|
||||
GObject *peditor;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (client, ACCESSIBILITY_KEY_DIR,
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
widget = WID ("chkEnableAT");
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (at_enable_toggled),
|
||||
dialog);
|
||||
|
||||
peditor = gconf_peditor_new_boolean (NULL, ACCESSIBILITY_KEY,
|
||||
widget,
|
||||
NULL);
|
||||
|
||||
at_enable_update (client, dialog);
|
||||
|
||||
gconf_client_notify_add (client, ACCESSIBILITY_KEY_DIR,
|
||||
at_enable_changed,
|
||||
dialog, NULL, NULL);
|
||||
|
||||
gconf_client_add_dir (client, AT_STARTUP_DIR,
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
gconf_client_add_dir (client, SR_PREFS_DIR,
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
gconf_client_notify_add (client, AT_STARTUP_DIR,
|
||||
at_startup_changed,
|
||||
dialog, NULL, NULL);
|
||||
|
||||
gconf_client_notify_add (client, SR_PREFS_DIR,
|
||||
at_startup_changed,
|
||||
dialog, NULL, NULL);
|
||||
|
||||
widget = WID ("chkKeyboard");
|
||||
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (at_startup_toggled),
|
||||
dialog);
|
||||
|
||||
widget = WID ("chkMagnifier");
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (at_startup_toggled),
|
||||
dialog);
|
||||
|
||||
widget = WID ("chkScreenreader");
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (at_startup_toggled),
|
||||
dialog);
|
||||
|
||||
widget = WID ("dlgATPrefs");
|
||||
capplet_set_icon (widget, "at-enable-capplet.png");
|
||||
|
||||
g_signal_connect (G_OBJECT (widget),
|
||||
"response",
|
||||
G_CALLBACK (cb_dialog_response), NULL);
|
||||
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_unref (client);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GladeXML *dialog;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
gnome_program_init ("gnome-at-properties", VERSION,
|
||||
LIBGNOMEUI_MODULE, argc, argv,
|
||||
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
|
||||
NULL);
|
||||
|
||||
activate_settings_daemon ();
|
||||
|
||||
dialog = create_dialog ();
|
||||
|
||||
init_startup_state (dialog);
|
||||
|
||||
setup_dialog (dialog);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -82,6 +82,8 @@ if $PKG_CONFIG --exists xft ; then
|
|||
fi
|
||||
|
||||
PKG_CHECK_MODULES(FONT_CAPPLET, $COMMON_MODULES $xft_modules)
|
||||
|
||||
PKG_CHECK_MODULES(AT_CAPPLET, $COMMON_MODULES)
|
||||
|
||||
dnl
|
||||
dnl Check for XRandR, needed for display capplet
|
||||
|
@ -262,6 +264,9 @@ AC_SUBST(SOUND_CAPPLET_LIBS)
|
|||
AC_SUBST(FONT_CAPPLET_CFLAGS)
|
||||
AC_SUBST(FONT_CAPPLET_LIBS)
|
||||
|
||||
AC_SUBST(AT_CAPPLET_CFLAGS)
|
||||
AC_SUBST(AT_CAPPLET_LIBS)
|
||||
|
||||
AC_SUBST(DISPLAY_CAPPLET_CFLAGS)
|
||||
AC_SUBST(DISPLAY_CAPPLET_LIBS)
|
||||
|
||||
|
@ -362,6 +367,7 @@ capplets/theme-switcher/Makefile
|
|||
capplets/ui-properties/Makefile
|
||||
capplets/accessibility/Makefile
|
||||
capplets/accessibility/keyboard/Makefile
|
||||
capplets/accessibility/at-properties/Makefile
|
||||
capplets/network/Makefile
|
||||
capplets/windows/Makefile
|
||||
schemas/Makefile
|
||||
|
|
Loading…
Add table
Reference in a new issue