diff options
Diffstat (limited to 'plugins/a11y-keyboard')
-rw-r--r-- | plugins/a11y-keyboard/Makefile.am | 87 | ||||
-rw-r--r-- | plugins/a11y-keyboard/Makefile.in | 809 | ||||
-rw-r--r-- | plugins/a11y-keyboard/a11y-keyboard.mate-settings-plugin.in | 8 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c | 1347 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h | 61 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c | 104 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h | 63 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c | 975 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h | 59 | ||||
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui | 199 | ||||
-rw-r--r-- | plugins/a11y-keyboard/test-a11y-preferences-dialog.c | 64 |
11 files changed, 3776 insertions, 0 deletions
diff --git a/plugins/a11y-keyboard/Makefile.am b/plugins/a11y-keyboard/Makefile.am new file mode 100644 index 0000000..8396513 --- /dev/null +++ b/plugins/a11y-keyboard/Makefile.am @@ -0,0 +1,87 @@ +NULL = + +gtkbuilderdir = $(pkgdatadir) +gtkbuilder_DATA = \ + gsd-a11y-preferences-dialog.ui \ + $(NULL) + +noinst_PROGRAMS = \ + test-a11y-preferences-dialog \ + $(NULL) + +test_a11y_preferences_dialog_SOURCES = \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-preferences-dialog.c \ + $(NULL) + +test_a11y_preferences_dialog_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_a11y_preferences_dialog_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_a11y_preferences_dialog_LDADD = \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + liba11y-keyboard.la \ + $(NULL) + +liba11y_keyboard_la_SOURCES = \ + gsd-a11y-keyboard-plugin.h \ + gsd-a11y-keyboard-plugin.c \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.h \ + gsd-a11y-preferences-dialog.c \ + $(NULL) + +liba11y_keyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \ + $(AM_CPPFLAGS) + +liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBMATENOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_keyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +liba11y_keyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBMATENOTIFY_LIBS) \ + $(NULL) + +plugin_in_files = \ + a11y-keyboard.mate-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gtkbuilder_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/a11y-keyboard/Makefile.in b/plugins/a11y-keyboard/Makefile.in new file mode 100644 index 0000000..e0d9429 --- /dev/null +++ b/plugins/a11y-keyboard/Makefile.in @@ -0,0 +1,809 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = test-a11y-preferences-dialog$(EXEEXT) \ + $(am__EXEEXT_1) +subdir = plugins/a11y-keyboard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(plugindir)" \ + "$(DESTDIR)$(gtkbuilderdir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +liba11y_keyboard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_liba11y_keyboard_la_OBJECTS = \ + liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo \ + liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo \ + liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo \ + $(am__objects_1) +liba11y_keyboard_la_OBJECTS = $(am_liba11y_keyboard_la_OBJECTS) +liba11y_keyboard_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) \ + $(liba11y_keyboard_la_LDFLAGS) $(LDFLAGS) -o $@ +am__EXEEXT_1 = +PROGRAMS = $(noinst_PROGRAMS) +am_test_a11y_preferences_dialog_OBJECTS = test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.$(OBJEXT) \ + test_a11y_preferences_dialog-test-a11y-preferences-dialog.$(OBJEXT) \ + $(am__objects_1) +test_a11y_preferences_dialog_OBJECTS = \ + $(am_test_a11y_preferences_dialog_OBJECTS) +test_a11y_preferences_dialog_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +test_a11y_preferences_dialog_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(liba11y_keyboard_la_SOURCES) \ + $(test_a11y_preferences_dialog_SOURCES) +DIST_SOURCES = $(liba11y_keyboard_la_SOURCES) \ + $(test_a11y_preferences_dialog_SOURCES) +DATA = $(gtkbuilder_DATA) $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXECDIR = @LIBEXECDIR@ +LIBMATEKBDUI_CFLAGS = @LIBMATEKBDUI_CFLAGS@ +LIBMATEKBDUI_LIBS = @LIBMATEKBDUI_LIBS@ +LIBMATENOTIFY_CFLAGS = @LIBMATENOTIFY_CFLAGS@ +LIBMATENOTIFY_LIBS = @LIBMATENOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATECONFTOOL = @MATECONFTOOL@ +MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@ +MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@ +MATE_KEYBINDINGS_KEYSDIR = @MATE_KEYBINDINGS_KEYSDIR@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PULSE_CFLAGS = @PULSE_CFLAGS@ +PULSE_LIBS = @PULSE_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +X11_LIBS = @X11_LIBS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XGETTEXT = @XGETTEXT@ +XINPUT_LIBS = @XINPUT_LIBS@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +gtkbuilderdir = $(pkgdatadir) +gtkbuilder_DATA = \ + gsd-a11y-preferences-dialog.ui \ + $(NULL) + +test_a11y_preferences_dialog_SOURCES = \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-preferences-dialog.c \ + $(NULL) + +test_a11y_preferences_dialog_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_a11y_preferences_dialog_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_a11y_preferences_dialog_LDADD = \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + liba11y-keyboard.la \ + $(NULL) + +liba11y_keyboard_la_SOURCES = \ + gsd-a11y-keyboard-plugin.h \ + gsd-a11y-keyboard-plugin.c \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.h \ + gsd-a11y-preferences-dialog.c \ + $(NULL) + +liba11y_keyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \ + $(AM_CPPFLAGS) + +liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBMATENOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_keyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +liba11y_keyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBMATENOTIFY_LIBS) \ + $(NULL) + +plugin_in_files = \ + a11y-keyboard.mate-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gtkbuilder_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/a11y-keyboard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/a11y-keyboard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liba11y-keyboard.la: $(liba11y_keyboard_la_OBJECTS) $(liba11y_keyboard_la_DEPENDENCIES) + $(liba11y_keyboard_la_LINK) -rpath $(plugindir) $(liba11y_keyboard_la_OBJECTS) $(liba11y_keyboard_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +test-a11y-preferences-dialog$(EXEEXT): $(test_a11y_preferences_dialog_OBJECTS) $(test_a11y_preferences_dialog_DEPENDENCIES) + @rm -f test-a11y-preferences-dialog$(EXEEXT) + $(test_a11y_preferences_dialog_LINK) $(test_a11y_preferences_dialog_OBJECTS) $(test_a11y_preferences_dialog_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo: gsd-a11y-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Tpo -c -o liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo `test -f 'gsd-a11y-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-a11y-keyboard-plugin.c' object='liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo `test -f 'gsd-a11y-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-plugin.c + +liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo: gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Tpo -c -o liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-a11y-keyboard-manager.c' object='liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c + +liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Tpo -c -o liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-a11y-preferences-dialog.c' object='liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c + +test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c + +test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` + +test_a11y_preferences_dialog-test-a11y-preferences-dialog.o: test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-test-a11y-preferences-dialog.o -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.o `test -f 'test-a11y-preferences-dialog.c' || echo '$(srcdir)/'`test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-test-a11y-preferences-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.o `test -f 'test-a11y-preferences-dialog.c' || echo '$(srcdir)/'`test-a11y-preferences-dialog.c + +test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj: test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj `if test -f 'test-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'test-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-preferences-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj `if test -f 'test-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'test-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-preferences-dialog.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-gtkbuilderDATA: $(gtkbuilder_DATA) + @$(NORMAL_INSTALL) + test -z "$(gtkbuilderdir)" || $(MKDIR_P) "$(DESTDIR)$(gtkbuilderdir)" + @list='$(gtkbuilder_DATA)'; test -n "$(gtkbuilderdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gtkbuilderdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(gtkbuilderdir)" || exit $$?; \ + done + +uninstall-gtkbuilderDATA: + @$(NORMAL_UNINSTALL) + @list='$(gtkbuilder_DATA)'; test -n "$(gtkbuilderdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(gtkbuilderdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(gtkbuilderdir)" && rm -f $$files +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(plugindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(plugindir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(gtkbuilderdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-gtkbuilderDATA install-pluginDATA \ + install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-gtkbuilderDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS clean-pluginLTLIBRARIES \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-gtkbuilderDATA install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-gtkbuilderDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/a11y-keyboard/a11y-keyboard.mate-settings-plugin.in b/plugins/a11y-keyboard/a11y-keyboard.mate-settings-plugin.in new file mode 100644 index 0000000..4909948 --- /dev/null +++ b/plugins/a11y-keyboard/a11y-keyboard.mate-settings-plugin.in @@ -0,0 +1,8 @@ +[MATE Settings Plugin] +Module=a11y-keyboard +IAge=0 +_Name=Accessibility Keyboard +_Description=Accessibility keyboard plugin +Authors=Jody Goldberg +Copyright=Copyright © 2001 Ximian, Inc. +Website= diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c new file mode 100644 index 0000000..ac75491 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c @@ -0,0 +1,1347 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann <[email protected]> + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include <sys/types.h> +#include <sys/wait.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <locale.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <gtk/gtk.h> +#include <mateconf/mateconf-client.h> + +#include <X11/XKBlib.h> +#include <X11/extensions/XKBstr.h> + +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H +#include <X11/extensions/XInput.h> +#include <X11/extensions/XIproto.h> +#endif + +#ifdef HAVE_LIBMATENOTIFY +#include <libmatenotify/notify.h> +#endif /* HAVE_LIBMATENOTIFY */ + +#include "mate-settings-profile.h" +#include "gsd-a11y-keyboard-manager.h" +#include "gsd-a11y-preferences-dialog.h" + +#define CONFIG_ROOT "/desktop/mate/accessibility/keyboard" +#define NOTIFICATION_TIMEOUT 30 + +#define GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerPrivate)) + +struct GsdA11yKeyboardManagerPrivate +{ + int xkbEventBase; + gboolean stickykeys_shortcut_val; + gboolean slowkeys_shortcut_val; + GtkWidget *stickykeys_alert; + GtkWidget *slowkeys_alert; + GtkWidget *preferences_dialog; + GtkStatusIcon *status_icon; + XkbDescRec *original_xkb_desc; + + guint mateconf_notify; + +#ifdef HAVE_LIBMATENOTIFY + NotifyNotification *notification; +#endif /* HAVE_LIBMATENOTIFY */ +}; + +static void gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass); +static void gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *a11y_keyboard_manager); +static void gsd_a11y_keyboard_manager_finalize (GObject *object); +static void gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager); +static void set_server_from_mateconf (GsdA11yKeyboardManager *manager, + MateConfClient *client); + +G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#undef DEBUG_ACCESSIBILITY +#ifdef DEBUG_ACCESSIBILITY +#define d(str) g_debug (str) +#else +#define d(str) do { } while (0) +#endif + +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H +static GdkFilterReturn +devicepresence_filter (GdkXEvent *xevent, + GdkEvent *event, + gpointer data) +{ + XEvent *xev = (XEvent *) xevent; + XEventClass class_presence; + int xi_presence; + + DevicePresence (gdk_x11_get_default_xdisplay (), xi_presence, class_presence); + + if (xev->type == xi_presence) + { + XDevicePresenceNotifyEvent *dpn = (XDevicePresenceNotifyEvent *) xev; + if (dpn->devchange == DeviceEnabled) { + MateConfClient *client; + client = mateconf_client_get_default (); + set_server_from_mateconf (data, client); + g_object_unref (client); + } + } + return GDK_FILTER_CONTINUE; +} + +static gboolean +supports_xinput_devices (void) +{ + gint op_code, event, error; + + return XQueryExtension (GDK_DISPLAY (), + "XInputExtension", + &op_code, + &event, + &error); +} + +static void +set_devicepresence_handler (GsdA11yKeyboardManager *manager) +{ + Display *display; + XEventClass class_presence; + int xi_presence; + + if (!supports_xinput_devices ()) + return; + + display = gdk_x11_get_default_xdisplay (); + + gdk_error_trap_push (); + DevicePresence (display, xi_presence, class_presence); + /* FIXME: + * Note that this might overwrite other events, see: + * https://bugzilla.gnome.org/show_bug.cgi?id=610245#c2 + **/ + XSelectExtensionEvent (display, + RootWindow (display, DefaultScreen (display)), + &class_presence, 1); + + gdk_flush (); + if (!gdk_error_trap_pop ()) + gdk_window_add_filter (NULL, devicepresence_filter, manager); +} +#endif + +static gboolean +xkb_enabled (GsdA11yKeyboardManager *manager) +{ + gboolean have_xkb; + int opcode, errorBase, major, minor; + + have_xkb = XkbQueryExtension (GDK_DISPLAY (), + &opcode, + &manager->priv->xkbEventBase, + &errorBase, + &major, + &minor) + && XkbUseExtension (GDK_DISPLAY (), &major, &minor); + + return have_xkb; +} + +static XkbDescRec * +get_xkb_desc_rec (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + Status status = Success; + + gdk_error_trap_push (); + desc = XkbGetMap (GDK_DISPLAY (), XkbAllMapComponentsMask, XkbUseCoreKbd); + if (desc != NULL) { + desc->ctrls = NULL; + status = XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc); + } + gdk_error_trap_pop (); + + g_return_val_if_fail (desc != NULL, NULL); + g_return_val_if_fail (desc->ctrls != NULL, NULL); + g_return_val_if_fail (status == Success, NULL); + + return desc; +} + +static int +get_int (MateConfClient *client, + char const *key) +{ + int res = mateconf_client_get_int (client, key, NULL); + if (res <= 0) { + res = 1; + } + return res; +} + +static gboolean +set_int (MateConfClient *client, + MateConfChangeSet *cs, + char const *key, + int val) +{ + mateconf_change_set_set_int (cs, key, val); +#ifdef DEBUG_ACCESSIBILITY + if (val != mateconf_client_get_int (client, key, NULL)) { + g_warning ("%s changed", key); + } +#endif + return val != mateconf_client_get_int (client, key, NULL); +} + +static gboolean +set_bool (MateConfClient *client, + MateConfChangeSet *cs, + char const *key, + int val) +{ + gboolean bval = (val != 0); + + mateconf_change_set_set_bool (cs, key, bval ? TRUE : FALSE); +#ifdef DEBUG_ACCESSIBILITY + if (bval != mateconf_client_get_bool (client, key, NULL)) { + d ("%s changed", key); + return TRUE; + } +#endif + return (bval != mateconf_client_get_bool (client, key, NULL)); +} + +static unsigned long +set_clear (gboolean flag, + unsigned long value, + unsigned long mask) +{ + if (flag) { + return value | mask; + } + return value & ~mask; +} + +static gboolean +set_ctrl_from_mateconf (XkbDescRec *desc, + MateConfClient *client, + char const *key, + unsigned long mask) +{ + gboolean result = mateconf_client_get_bool (client, key, NULL); + desc->ctrls->enabled_ctrls = set_clear (result, desc->ctrls->enabled_ctrls, mask); + return result; +} + +static void +set_server_from_mateconf (GsdA11yKeyboardManager *manager, + MateConfClient *client) +{ + XkbDescRec *desc; + gboolean enable_accessX; + + mate_settings_profile_start (NULL); + + desc = get_xkb_desc_rec (manager); + if (!desc) { + return; + } + + /* general */ + enable_accessX = mateconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL); + + desc->ctrls->enabled_ctrls = set_clear (enable_accessX, + desc->ctrls->enabled_ctrls, + XkbAccessXKeysMask); + + if (set_ctrl_from_mateconf (desc, client, CONFIG_ROOT "/timeout_enable", + XkbAccessXTimeoutMask)) { + desc->ctrls->ax_timeout = get_int (client, + CONFIG_ROOT "/timeout"); + /* disable only the master flag via the server we will disable + * the rest on the rebound without affecting mateconf state + * don't change the option flags at all. + */ + desc->ctrls->axt_ctrls_mask = XkbAccessXKeysMask | XkbAccessXFeedbackMask; + desc->ctrls->axt_ctrls_values = 0; + desc->ctrls->axt_opts_mask = 0; + } + + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/feature_state_change_beep", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask); + + /* bounce keys */ + if (set_ctrl_from_mateconf (desc, + client, + CONFIG_ROOT "/bouncekeys_enable", + XkbBounceKeysMask)) { + desc->ctrls->debounce_delay = get_int (client, + CONFIG_ROOT "/bouncekeys_delay"); + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask); + } + + /* mouse keys */ + if (set_ctrl_from_mateconf (desc, + client, + CONFIG_ROOT "/mousekeys_enable", + XkbMouseKeysMask | XkbMouseKeysAccelMask)) { + desc->ctrls->mk_interval = 100; /* msec between mousekey events */ + desc->ctrls->mk_curve = 50; + + /* We store pixels / sec, XKB wants pixels / event */ + desc->ctrls->mk_max_speed = get_int (client, + CONFIG_ROOT "/mousekeys_max_speed") / (1000 / desc->ctrls->mk_interval); + if (desc->ctrls->mk_max_speed <= 0) + desc->ctrls->mk_max_speed = 1; + + desc->ctrls->mk_time_to_max = get_int (client, /* events before max */ + CONFIG_ROOT "/mousekeys_accel_time") / desc->ctrls->mk_interval; + if (desc->ctrls->mk_time_to_max <= 0) + desc->ctrls->mk_time_to_max = 1; + + desc->ctrls->mk_delay = get_int (client, /* ms before 1st event */ + CONFIG_ROOT "/mousekeys_init_delay"); + } + + /* slow keys */ + if (set_ctrl_from_mateconf (desc, + client, + CONFIG_ROOT "/slowkeys_enable", + XkbSlowKeysMask)) { + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_press", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKPressFBMask); + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask); + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKRejectFBMask); + desc->ctrls->slow_keys_delay = get_int (client, + CONFIG_ROOT "/slowkeys_delay"); + /* anything larger than 500 seems to loose all keyboard input */ + if (desc->ctrls->slow_keys_delay > 500) + desc->ctrls->slow_keys_delay = 500; + } + + /* sticky keys */ + if (set_ctrl_from_mateconf (desc, + client, + CONFIG_ROOT "/stickykeys_enable", + XkbStickyKeysMask)) { + desc->ctrls->ax_options |= XkbAX_LatchToLockMask; + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_TwoKeysMask); + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask); + } + + /* toggle keys */ + desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/togglekeys_enable", NULL), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask); + + /* + g_debug ("CHANGE to : 0x%x", desc->ctrls->enabled_ctrls); + g_debug ("CHANGE to : 0x%x (2)", desc->ctrls->ax_options); + */ + + gdk_error_trap_push (); + XkbSetControls (GDK_DISPLAY (), + XkbSlowKeysMask | + XkbBounceKeysMask | + XkbStickyKeysMask | + XkbMouseKeysMask | + XkbMouseKeysAccelMask | + XkbAccessXKeysMask | + XkbAccessXTimeoutMask | + XkbAccessXFeedbackMask | + XkbControlsEnabledMask, + desc); + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + XSync (GDK_DISPLAY (), FALSE); + gdk_error_trap_pop (); + + mate_settings_profile_end (NULL); +} + +static gboolean +ax_response_callback (GsdA11yKeyboardManager *manager, + GtkWindow *parent, + gint response_id, + guint revert_controls_mask, + gboolean enabled) +{ + MateConfClient *client; + GdkScreen *screen; + GError *err; + + switch (response_id) { + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_REJECT: + case GTK_RESPONSE_CANCEL: + + client = mateconf_client_get_default (); + + /* we're reverting, so we invert sense of 'enabled' flag */ + d ("cancelling AccessX request"); + if (revert_controls_mask == XkbStickyKeysMask) { + mateconf_client_set_bool (client, + CONFIG_ROOT "/stickykeys_enable", + !enabled, + NULL); + } + else if (revert_controls_mask == XkbSlowKeysMask) { + mateconf_client_set_bool (client, + CONFIG_ROOT "/slowkeys_enable", + !enabled, + NULL); + } + mateconf_client_suggest_sync (client, NULL); + set_server_from_mateconf (manager, client); + + g_object_unref (client); + + break; + + case GTK_RESPONSE_HELP: + if (!parent) + screen = gdk_screen_get_default (); + else + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + + err = NULL; + if (!gtk_show_uri (screen, + "ghelp:user-guide#goscustaccess-6", + gtk_get_current_event_time(), + &err)) { + GtkWidget *error_dialog = gtk_message_dialog_new (parent, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("There was an error displaying help: %s"), + err->message); + g_signal_connect (error_dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE); + gtk_widget_show (error_dialog); + g_error_free (err); + } + return FALSE; + default: + break; + } + return TRUE; +} + +static void +ax_stickykeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +ax_slowkeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +maybe_show_status_icon (GsdA11yKeyboardManager *manager) +{ + gboolean show; + MateConfClient *client; + + /* for now, show if accessx is enabled */ + client = mateconf_client_get_default (); + show = mateconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL); + g_object_unref (client); + + if (!show && manager->priv->status_icon == NULL) + return; + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, show); +} + +#ifdef HAVE_LIBMATENOTIFY +static void +on_notification_closed (NotifyNotification *notification, + GsdA11yKeyboardManager *manager) +{ + g_object_unref (manager->priv->notification); + manager->priv->notification = NULL; +} + +static void +on_slow_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +static void +on_sticky_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +#endif /* HAVE_LIBMATENOTIFY */ + +static gboolean +ax_slowkeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ +#ifdef HAVE_LIBMATENOTIFY + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Do you want to activate Slow Keys?") : + _("Do you want to deactivate Slow Keys?"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility", + NULL); + notify_notification_attach_to_status_icon (manager->priv->notification, manager->priv->status_icon); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Don't activate") : _("Don't deactivate"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Activate") : _("Deactivate"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +#else + return FALSE; +#endif /* HAVE_LIBMATENOTIFY */ +} + + +static void +ax_slowkeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Do you want to activate Slow Keys?") : + _("Do you want to deactivate Slow Keys?"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_show (manager->priv->slowkeys_alert); + return; + } + + manager->priv->slowkeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->slowkeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("Do_n't activate") : _("Do_n't deactivate"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("_Activate") : _("_Deactivate"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->slowkeys_alert), + _("Slow Keys Alert")); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->slowkeys_alert), + "input-keyboard"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->slowkeys_alert, + "response", + G_CALLBACK (ax_slowkeys_response), + manager); + gtk_widget_show (manager->priv->slowkeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->slowkeys_alert), + (gpointer*) &manager->priv->slowkeys_alert); +} + +static void +ax_slowkeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->slowkeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_slowkeys_warning_post_bubble (manager, enabled)) { + ax_slowkeys_warning_post_dialog (manager, enabled); + } +} + +static gboolean +ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ +#ifdef HAVE_LIBMATENOTIFY + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Do you want to activate Sticky Keys?") : + _("Do you want to deactivate Sticky Keys?"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility", + NULL); + notify_notification_attach_to_status_icon (manager->priv->notification, manager->priv->status_icon); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Don't activate") : _("Don't deactivate"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Activate") : _("Deactivate"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +#else + return FALSE; +#endif /* HAVE_LIBMATENOTIFY */ +} + +static void +ax_stickykeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Do you want to activate Sticky Keys?") : + _("Do you want to deactivate Sticky Keys?"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + + if (manager->priv->stickykeys_alert != NULL) { + gtk_widget_show (manager->priv->stickykeys_alert); + return; + } + + manager->priv->stickykeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("Do_n't activate") : _("Do_n't deactivate"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("_Activate") : _("_Deactivate"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->stickykeys_alert), + _("Sticky Keys Alert")); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->stickykeys_alert), + "input-keyboard"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->stickykeys_alert, + "response", + G_CALLBACK (ax_stickykeys_response), + manager); + gtk_widget_show (manager->priv->stickykeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->stickykeys_alert), + (gpointer*) &manager->priv->stickykeys_alert); +} + +static void +ax_stickykeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->stickykeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_stickykeys_warning_post_bubble (manager, enabled)) { + ax_stickykeys_warning_post_dialog (manager, enabled); + } +} + +static void +set_mateconf_from_server (GsdA11yKeyboardManager *manager) +{ + MateConfClient *client; + MateConfChangeSet *cs; + XkbDescRec *desc; + gboolean changed = FALSE; + gboolean slowkeys_changed; + gboolean stickykeys_changed; + + cs = mateconf_change_set_new (); + desc = get_xkb_desc_rec (manager); + if (! desc) { + return; + } + + client = mateconf_client_get_default (); + + /* + fprintf (stderr, "changed to : 0x%x\n", desc->ctrls->enabled_ctrls); + fprintf (stderr, "changed to : 0x%x (2)\n", desc->ctrls->ax_options); + */ + + changed |= set_bool (client, + cs, + CONFIG_ROOT "/enable", + desc->ctrls->enabled_ctrls & XkbAccessXKeysMask); + + changed |= set_bool (client, + cs, + CONFIG_ROOT "/feature_state_change_beep", + desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask)); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/timeout_enable", + desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask); + changed |= set_int (client, + cs, + CONFIG_ROOT "/timeout", + desc->ctrls->ax_timeout); + + changed |= set_bool (client, + cs, + CONFIG_ROOT "/bouncekeys_enable", + desc->ctrls->enabled_ctrls & XkbBounceKeysMask); + changed |= set_int (client, + cs, + CONFIG_ROOT "/bouncekeys_delay", + desc->ctrls->debounce_delay); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/bouncekeys_beep_reject", + desc->ctrls->ax_options & XkbAX_BKRejectFBMask); + + changed |= set_bool (client, + cs, + CONFIG_ROOT "/mousekeys_enable", + desc->ctrls->enabled_ctrls & XkbMouseKeysMask); + changed |= set_int (client, + cs, + CONFIG_ROOT "/mousekeys_max_speed", + desc->ctrls->mk_max_speed * (1000 / desc->ctrls->mk_interval)); + /* NOTE : mk_time_to_max is measured in events not time */ + changed |= set_int (client, + cs, + CONFIG_ROOT "/mousekeys_accel_time", + desc->ctrls->mk_time_to_max * desc->ctrls->mk_interval); + changed |= set_int (client, + cs, + CONFIG_ROOT "/mousekeys_init_delay", + desc->ctrls->mk_delay); + + slowkeys_changed = set_bool (client, + cs, + CONFIG_ROOT "/slowkeys_enable", + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/slowkeys_beep_press", + desc->ctrls->ax_options & XkbAX_SKPressFBMask); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/slowkeys_beep_accept", + desc->ctrls->ax_options & XkbAX_SKAcceptFBMask); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/slowkeys_beep_reject", + desc->ctrls->ax_options & XkbAX_SKRejectFBMask); + changed |= set_int (client, + cs, + CONFIG_ROOT "/slowkeys_delay", + desc->ctrls->slow_keys_delay); + + stickykeys_changed = set_bool (client, + cs, + CONFIG_ROOT "/stickykeys_enable", + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/stickykeys_two_key_off", + desc->ctrls->ax_options & XkbAX_TwoKeysMask); + changed |= set_bool (client, + cs, + CONFIG_ROOT "/stickykeys_modifier_beep", + desc->ctrls->ax_options & XkbAX_StickyKeysFBMask); + + changed |= set_bool (client, + cs, + CONFIG_ROOT "/togglekeys_enable", + desc->ctrls->ax_options & XkbAX_IndicatorFBMask); + + if (!changed && stickykeys_changed ^ slowkeys_changed) { + /* + * sticky or slowkeys has changed, singly, without our intervention. + * 99% chance this is due to a keyboard shortcut being used. + * we need to detect via this hack until we get + * XkbAXN_AXKWarning notifications working (probable XKB bug), + * at which time we can directly intercept such shortcuts instead. + * See cb_xkb_event_filter () below. + */ + + /* sanity check: are keyboard shortcuts available? */ + if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask) { + if (slowkeys_changed) { + ax_slowkeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + } else { + ax_stickykeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + } + } + } + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + changed |= (stickykeys_changed | slowkeys_changed); + + if (changed) { + mateconf_client_commit_change_set (client, cs, FALSE, NULL); + mateconf_client_suggest_sync (client, NULL); + } + mateconf_change_set_unref (cs); + + g_object_unref (client); +} + +static GdkFilterReturn +cb_xkb_event_filter (GdkXEvent *xevent, + GdkEvent *ignored1, + GsdA11yKeyboardManager *manager) +{ + XEvent *xev = (XEvent *) xevent; + XkbEvent *xkbEv = (XkbEvent *) xevent; + + if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbControlsNotify) { + d ("XKB state changed"); + set_mateconf_from_server (manager); + } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbAccessXNotify) { + if (xkbEv->accessx.detail == XkbAXN_AXKWarning) { + d ("About to turn on an AccessX feature from the keyboard!"); + /* + * TODO: when XkbAXN_AXKWarnings start working, we need to + * invoke ax_keys_warning_dialog_run here instead of in + * set_mateconf_from_server(). + */ + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +keyboard_callback (MateConfClient *client, + guint cnxn_id, + MateConfEntry *entry, + GsdA11yKeyboardManager *manager) +{ + set_server_from_mateconf (manager, client); + maybe_show_status_icon (manager); +} + +static void +register_config_callback (GsdA11yKeyboardManager *manager, + MateConfClient *client, + const char *path, + MateConfClientNotifyFunc func, + guint *notify) +{ + mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); + *notify = mateconf_client_notify_add (client, path, func, manager, NULL, NULL); +} + +static gboolean +start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager) +{ + guint event_mask; + MateConfClient *client; + + g_debug ("Starting a11y_keyboard manager"); + mate_settings_profile_start (NULL); + + if (!xkb_enabled (manager)) + goto out; + + client = mateconf_client_get_default (); + + register_config_callback (manager, + client, + CONFIG_ROOT, + (MateConfClientNotifyFunc) keyboard_callback, + &manager->priv->mateconf_notify); + +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H + set_devicepresence_handler (manager); +#endif + + /* Save current xkb state so we can restore it on exit + */ + manager->priv->original_xkb_desc = get_xkb_desc_rec (manager); + + event_mask = XkbControlsNotifyMask; +#ifdef DEBUG_ACCESSIBILITY + event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */ +#endif + + /* be sure to init before starting to monitor the server */ + set_server_from_mateconf (manager, client); + g_object_unref (client); + + XkbSelectEvents (GDK_DISPLAY (), + XkbUseCoreKbd, + event_mask, + event_mask); + + gdk_window_add_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + maybe_show_status_icon (manager); + + out: + mate_settings_profile_end (NULL); + + return FALSE; +} + + +gboolean +gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager, + GError **error) +{ + mate_settings_profile_start (NULL); + + g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager); + + mate_settings_profile_end (NULL); + + return TRUE; +} + +static void +restore_server_xkb_config (GsdA11yKeyboardManager *manager) +{ + gdk_error_trap_push (); + XkbSetControls (GDK_DISPLAY (), + XkbSlowKeysMask | + XkbBounceKeysMask | + XkbStickyKeysMask | + XkbMouseKeysMask | + XkbMouseKeysAccelMask | + XkbAccessXKeysMask | + XkbAccessXTimeoutMask | + XkbAccessXFeedbackMask | + XkbControlsEnabledMask, + manager->priv->original_xkb_desc); + + XkbFreeKeyboard (manager->priv->original_xkb_desc, + XkbAllComponentsMask, True); + + XSync (GDK_DISPLAY (), FALSE); + gdk_error_trap_pop (); + + manager->priv->original_xkb_desc = NULL; +} + +void +gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager) +{ + GsdA11yKeyboardManagerPrivate *p = manager->priv; + + g_debug ("Stopping a11y_keyboard manager"); + +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H + gdk_window_remove_filter (NULL, devicepresence_filter, manager); +#endif + + if (p->status_icon) + gtk_status_icon_set_visible (p->status_icon, FALSE); + + if (p->mateconf_notify != 0) { + MateConfClient *client = mateconf_client_get_default (); + mateconf_client_remove_dir (client, CONFIG_ROOT, NULL); + mateconf_client_notify_remove (client, p->mateconf_notify); + g_object_unref (client); + p->mateconf_notify = 0; + } + + gdk_window_remove_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + /* Disable all the AccessX bits + */ + restore_server_xkb_config (manager); + + if (p->slowkeys_alert != NULL) + gtk_widget_destroy (p->slowkeys_alert); + + if (p->stickykeys_alert != NULL) + gtk_widget_destroy (p->stickykeys_alert); + + p->slowkeys_shortcut_val = FALSE; + p->stickykeys_shortcut_val = FALSE; +} + +static void +gsd_a11y_keyboard_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GsdA11yKeyboardManager *self; + + self = GSD_A11Y_KEYBOARD_MANAGER (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_a11y_keyboard_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsdA11yKeyboardManager *self; + + self = GSD_A11Y_KEYBOARD_MANAGER (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gsd_a11y_keyboard_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + GsdA11yKeyboardManagerClass *klass; + + klass = GSD_A11Y_KEYBOARD_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_A11Y_KEYBOARD_MANAGER)); + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_keyboard_manager); +} + +static void +gsd_a11y_keyboard_manager_dispose (GObject *object) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (object); + + G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->dispose (object); +} + +static void +gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gsd_a11y_keyboard_manager_get_property; + object_class->set_property = gsd_a11y_keyboard_manager_set_property; + object_class->constructor = gsd_a11y_keyboard_manager_constructor; + object_class->dispose = gsd_a11y_keyboard_manager_dispose; + object_class->finalize = gsd_a11y_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11yKeyboardManagerPrivate)); +} + +static void +on_preferences_dialog_response (GtkDialog *dialog, + int response, + GsdA11yKeyboardManager *manager) +{ + g_signal_handlers_disconnect_by_func (dialog, + on_preferences_dialog_response, + manager); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + manager->priv->preferences_dialog = NULL; +} + +static void +on_status_icon_activate (GtkStatusIcon *status_icon, + GsdA11yKeyboardManager *manager) +{ + if (manager->priv->preferences_dialog == NULL) { + manager->priv->preferences_dialog = gsd_a11y_preferences_dialog_new (); + g_signal_connect (manager->priv->preferences_dialog, + "response", + G_CALLBACK (on_preferences_dialog_response), + manager); + + gtk_window_present (GTK_WINDOW (manager->priv->preferences_dialog)); + } else { + g_signal_handlers_disconnect_by_func (manager->priv->preferences_dialog, + on_preferences_dialog_response, + manager); + gtk_widget_destroy (GTK_WIDGET (manager->priv->preferences_dialog)); + manager->priv->preferences_dialog = NULL; + } +} + +static void +gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager) +{ + mate_settings_profile_start (NULL); + + if (!manager->priv->status_icon) { + + manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility"); + g_signal_connect (manager->priv->status_icon, + "activate", + G_CALLBACK (on_status_icon_activate), + manager); + } + + mate_settings_profile_end (NULL); +} + +static void +gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *manager) +{ + manager->priv = GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE (manager); + +#ifdef HAVE_LIBMATENOTIFY + notify_init ("mate-settings-daemon"); +#endif /* HAVE_LIBMATENOTIFY */ +} + +static void +gsd_a11y_keyboard_manager_finalize (GObject *object) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_KEYBOARD_MANAGER (object)); + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (object); + + g_return_if_fail (a11y_keyboard_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->finalize (object); +} + +GsdA11yKeyboardManager * +gsd_a11y_keyboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_A11Y_KEYBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_A11Y_KEYBOARD_MANAGER (manager_object); +} diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h new file mode 100644 index 0000000..4fb817f --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <[email protected]> + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef __GSD_A11Y_KEYBOARD_MANAGER_H +#define __GSD_A11Y_KEYBOARD_MANAGER_H + +#include <glib-object.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSD_TYPE_A11Y_KEYBOARD_MANAGER (gsd_a11y_keyboard_manager_get_type ()) +#define GSD_A11Y_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManager)) +#define GSD_A11Y_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerClass)) +#define GSD_IS_A11Y_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER)) +#define GSD_IS_A11Y_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_KEYBOARD_MANAGER)) +#define GSD_A11Y_KEYBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerClass)) + +typedef struct GsdA11yKeyboardManagerPrivate GsdA11yKeyboardManagerPrivate; + +typedef struct +{ + GObject parent; + GsdA11yKeyboardManagerPrivate *priv; +} GsdA11yKeyboardManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdA11yKeyboardManagerClass; + +GType gsd_a11y_keyboard_manager_get_type (void); + +GsdA11yKeyboardManager *gsd_a11y_keyboard_manager_new (void); +gboolean gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager, + GError **error); +void gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager); + +#ifdef __cplusplus +} +#endif + +#endif /* __GSD_A11Y_KEYBOARD_MANAGER_H */ diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c new file mode 100644 index 0000000..7846ba6 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <[email protected]> + * + * 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, 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include <glib/gi18n-lib.h> +#include <gmodule.h> + +#include "mate-settings-plugin.h" +#include "gsd-a11y-keyboard-plugin.h" +#include "gsd-a11y-keyboard-manager.h" + +struct GsdA11yKeyboardPluginPrivate { + GsdA11yKeyboardManager *manager; +}; + +#define GSD_A11Y_KEYBOARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginPrivate)) + +MATE_SETTINGS_PLUGIN_REGISTER (GsdA11yKeyboardPlugin, gsd_a11y_keyboard_plugin) + +static void +gsd_a11y_keyboard_plugin_init (GsdA11yKeyboardPlugin *plugin) +{ + plugin->priv = GSD_A11Y_KEYBOARD_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdA11yKeyboardPlugin initializing"); + + plugin->priv->manager = gsd_a11y_keyboard_manager_new (); +} + +static void +gsd_a11y_keyboard_plugin_finalize (GObject *object) +{ + GsdA11yKeyboardPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_KEYBOARD_PLUGIN (object)); + + g_debug ("GsdA11yKeyboardPlugin finalizing"); + + plugin = GSD_A11Y_KEYBOARD_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_a11y_keyboard_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (MateSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating a11y_keyboard plugin"); + + error = NULL; + res = gsd_a11y_keyboard_manager_start (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start a11y_keyboard manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (MateSettingsPlugin *plugin) +{ + g_debug ("Deactivating a11y_keyboard plugin"); + gsd_a11y_keyboard_manager_stop (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_a11y_keyboard_plugin_class_init (GsdA11yKeyboardPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_a11y_keyboard_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdA11yKeyboardPluginPrivate)); +} diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h new file mode 100644 index 0000000..ebf246c --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h @@ -0,0 +1,63 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <[email protected]> + * + * 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, 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef __GSD_A11Y_KEYBOARD_PLUGIN_H__ +#define __GSD_A11Y_KEYBOARD_PLUGIN_H__ + +#include <glib.h> +#include <glib-object.h> +#include <gmodule.h> + +#include "mate-settings-plugin.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSD_TYPE_A11Y_KEYBOARD_PLUGIN (gsd_a11y_keyboard_plugin_get_type ()) +#define GSD_A11Y_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPlugin)) +#define GSD_A11Y_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginClass)) +#define GSD_IS_A11Y_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN)) +#define GSD_IS_A11Y_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_KEYBOARD_PLUGIN)) +#define GSD_A11Y_KEYBOARD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginClass)) + +typedef struct GsdA11yKeyboardPluginPrivate GsdA11yKeyboardPluginPrivate; + +typedef struct +{ + MateSettingsPlugin parent; + GsdA11yKeyboardPluginPrivate *priv; +} GsdA11yKeyboardPlugin; + +typedef struct +{ + MateSettingsPluginClass parent_class; +} GsdA11yKeyboardPluginClass; + +GType gsd_a11y_keyboard_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module); + +#ifdef __cplusplus +} +#endif + +#endif /* __GSD_A11Y_KEYBOARD_PLUGIN_H__ */ diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c new file mode 100644 index 0000000..752ee18 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c @@ -0,0 +1,975 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <[email protected]> + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +#include <dbus/dbus-glib.h> + +#include <mateconf/mateconf-client.h> + +#include "gsd-a11y-preferences-dialog.h" + +#define SM_DBUS_NAME "org.mate.SessionManager" +#define SM_DBUS_PATH "/org/mate/SessionManager" +#define SM_DBUS_INTERFACE "org.mate.SessionManager" + + +#define GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogPrivate)) + +#define GTKBUILDER_UI_FILE "gsd-a11y-preferences-dialog.ui" + +#define KEY_A11Y_DIR "/desktop/mate/accessibility" +#define KEY_STICKY_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/stickykeys_enable" +#define KEY_BOUNCE_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/bouncekeys_enable" +#define KEY_SLOW_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/slowkeys_enable" +#define KEY_MOUSE_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/mousekeys_enable" + +#define KEY_AT_DIR "/desktop/mate/applications/at" +#define KEY_AT_SCREEN_KEYBOARD_ENABLED KEY_AT_DIR "/screen_keyboard_enabled" +#define KEY_AT_SCREEN_MAGNIFIER_ENABLED KEY_AT_DIR "/screen_magnifier_enabled" +#define KEY_AT_SCREEN_READER_ENABLED KEY_AT_DIR "/screen_reader_enabled" + +#define FONT_RENDER_DIR "/desktop/mate/font_rendering" +#define KEY_FONT_DPI FONT_RENDER_DIR "/dpi" +/* X servers sometimes lie about the screen's physical dimensions, so we cannot + * compute an accurate DPI value. When this happens, the user gets fonts that + * are too huge or too tiny. So, we see what the server returns: if it reports + * something outside of the range [DPI_LOW_REASONABLE_VALUE, + * DPI_HIGH_REASONABLE_VALUE], then we assume that it is lying and we use + * DPI_FALLBACK instead. + * + * See get_dpi_from_mateconf_or_server() below, and also + * https://bugzilla.novell.com/show_bug.cgi?id=217790 + */ +#define DPI_LOW_REASONABLE_VALUE 50 +#define DPI_HIGH_REASONABLE_VALUE 500 + +#define DPI_FACTOR_LARGE 1.25 +#define DPI_FACTOR_LARGER 1.5 +#define DPI_FACTOR_LARGEST 2.0 +#define DPI_DEFAULT 96 + +#define KEY_GTK_THEME "/desktop/mate/interface/gtk_theme" +#define KEY_COLOR_SCHEME "/desktop/mate/interface/gtk_color_scheme" +#define KEY_MARCO_THEME "/apps/marco/general/theme" +#define KEY_ICON_THEME "/desktop/mate/interface/icon_theme" + +#define HIGH_CONTRAST_THEME "HighContrast" + +struct GsdA11yPreferencesDialogPrivate +{ + GtkWidget *sticky_keys_checkbutton; + GtkWidget *slow_keys_checkbutton; + GtkWidget *bounce_keys_checkbutton; + + GtkWidget *large_print_checkbutton; + GtkWidget *high_contrast_checkbutton; + + GtkWidget *screen_reader_checkbutton; + GtkWidget *screen_keyboard_checkbutton; + GtkWidget *screen_magnifier_checkbutton; + + guint a11y_dir_cnxn; + guint gsd_a11y_dir_cnxn; +}; + +enum { + PROP_0, +}; + +static void gsd_a11y_preferences_dialog_class_init (GsdA11yPreferencesDialogClass *klass); +static void gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *a11y_preferences_dialog); +static void gsd_a11y_preferences_dialog_finalize (GObject *object); + +G_DEFINE_TYPE (GsdA11yPreferencesDialog, gsd_a11y_preferences_dialog, GTK_TYPE_DIALOG) + +static void +gsd_a11y_preferences_dialog_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_a11y_preferences_dialog_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gsd_a11y_preferences_dialog_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11yPreferencesDialog *a11y_preferences_dialog; + + a11y_preferences_dialog = GSD_A11Y_PREFERENCES_DIALOG (G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_preferences_dialog); +} + +static void +gsd_a11y_preferences_dialog_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->dispose (object); +} + +static void +gsd_a11y_preferences_dialog_class_init (GsdA11yPreferencesDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gsd_a11y_preferences_dialog_get_property; + object_class->set_property = gsd_a11y_preferences_dialog_set_property; + object_class->constructor = gsd_a11y_preferences_dialog_constructor; + object_class->dispose = gsd_a11y_preferences_dialog_dispose; + object_class->finalize = gsd_a11y_preferences_dialog_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11yPreferencesDialogPrivate)); +} + +static void +on_response (GsdA11yPreferencesDialog *dialog, + gint response_id) +{ + switch (response_id) { + default: + break; + } +} + +static char * +config_get_string (const char *key, + gboolean *is_writable) +{ + char *str; + MateConfClient *client; + + client = mateconf_client_get_default (); + + if (is_writable) { + *is_writable = mateconf_client_key_is_writable (client, + key, + NULL); + } + + str = mateconf_client_get_string (client, key, NULL); + + g_object_unref (client); + + return str; +} + +static gboolean +config_get_bool (const char *key, + gboolean *is_writable) +{ + int enabled; + MateConfClient *client; + + client = mateconf_client_get_default (); + + if (is_writable) { + *is_writable = mateconf_client_key_is_writable (client, + key, + NULL); + } + + enabled = mateconf_client_get_bool (client, key, NULL); + + g_object_unref (client); + + return enabled; +} + +static double +dpi_from_pixels_and_mm (int pixels, + int mm) +{ + double dpi; + + if (mm >= 1) { + dpi = pixels / (mm / 25.4); + } else { + dpi = 0; + } + + return dpi; +} + +static double +get_dpi_from_x_server (void) +{ + GdkScreen *screen; + double dpi; + + screen = gdk_screen_get_default (); + if (screen != NULL) { + double width_dpi; + double height_dpi; + + width_dpi = dpi_from_pixels_and_mm (gdk_screen_get_width (screen), + gdk_screen_get_width_mm (screen)); + height_dpi = dpi_from_pixels_and_mm (gdk_screen_get_height (screen), + gdk_screen_get_height_mm (screen)); + if (width_dpi < DPI_LOW_REASONABLE_VALUE + || width_dpi > DPI_HIGH_REASONABLE_VALUE + || height_dpi < DPI_LOW_REASONABLE_VALUE + || height_dpi > DPI_HIGH_REASONABLE_VALUE) { + dpi = DPI_DEFAULT; + } else { + dpi = (width_dpi + height_dpi) / 2.0; + } + } else { + /* Huh!? No screen? */ + dpi = DPI_DEFAULT; + } + + return dpi; +} + +static gboolean +config_get_large_print (gboolean *is_writable) +{ + gboolean ret; + MateConfClient *client; + MateConfValue *value; + gdouble x_dpi; + gdouble u_dpi; + + client = mateconf_client_get_default (); + value = mateconf_client_get_without_default (client, KEY_FONT_DPI, NULL); + + if (value != NULL) { + u_dpi = mateconf_value_get_float (value); + mateconf_value_free (value); + } else { + u_dpi = DPI_DEFAULT; + } + + x_dpi = get_dpi_from_x_server (); + + g_object_unref (client); + + g_debug ("GsdA11yPreferences: got x-dpi=%f user-dpi=%f", x_dpi, u_dpi); + + ret = (((double)DPI_FACTOR_LARGE * x_dpi) < u_dpi); + + return ret; +} + +static void +config_set_large_print (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + + if (enabled) { + gdouble x_dpi; + gdouble u_dpi; + + x_dpi = get_dpi_from_x_server (); + u_dpi = (double)DPI_FACTOR_LARGER * x_dpi; + + g_debug ("GsdA11yPreferences: setting x-dpi=%f user-dpi=%f", x_dpi, u_dpi); + + mateconf_client_set_float (client, KEY_FONT_DPI, u_dpi, NULL); + } else { + mateconf_client_unset (client, KEY_FONT_DPI, NULL); + } + + g_object_unref (client); +} + +static gboolean +config_get_high_contrast (gboolean *is_writable) +{ + gboolean ret; + char *gtk_theme; + + ret = FALSE; + + gtk_theme = config_get_string (KEY_GTK_THEME, is_writable); + if (gtk_theme != NULL && strcmp (gtk_theme, HIGH_CONTRAST_THEME) == 0) { + ret = TRUE; + } + g_free (gtk_theme); + + return ret; +} + +static void +config_set_high_contrast (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + + if (enabled) { + mateconf_client_set_string (client, KEY_GTK_THEME, HIGH_CONTRAST_THEME, NULL); + mateconf_client_set_string (client, KEY_ICON_THEME, HIGH_CONTRAST_THEME, NULL); + /* there isn't a high contrast marco theme afaik */ + } else { + mateconf_client_unset (client, KEY_GTK_THEME, NULL); + mateconf_client_unset (client, KEY_ICON_THEME, NULL); + mateconf_client_unset (client, KEY_MARCO_THEME, NULL); + } + + g_object_unref (client); +} + +static gboolean +config_get_sticky_keys (gboolean *is_writable) +{ + return config_get_bool (KEY_STICKY_KEYS_ENABLED, is_writable); +} + +static void +config_set_sticky_keys (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_STICKY_KEYS_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static gboolean +config_get_bounce_keys (gboolean *is_writable) +{ + return config_get_bool (KEY_BOUNCE_KEYS_ENABLED, is_writable); +} + +static void +config_set_bounce_keys (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_BOUNCE_KEYS_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static gboolean +config_get_slow_keys (gboolean *is_writable) +{ + return config_get_bool (KEY_SLOW_KEYS_ENABLED, is_writable); +} + +static void +config_set_slow_keys (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_SLOW_KEYS_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static gboolean +config_have_at_mateconf_condition (const char *condition) +{ + DBusGProxy *sm_proxy; + DBusGConnection *connection; + GError *error; + gboolean res; + gboolean is_handled; + + error = NULL; + connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (connection == NULL) { + g_warning ("Unable to connect to session bus: %s", error->message); + return FALSE; + } + sm_proxy = dbus_g_proxy_new_for_name (connection, + SM_DBUS_NAME, + SM_DBUS_PATH, + SM_DBUS_INTERFACE); + if (sm_proxy == NULL) { + return FALSE; + } + + is_handled = FALSE; + res = dbus_g_proxy_call (sm_proxy, + "IsAutostartConditionHandled", + &error, + G_TYPE_STRING, condition, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &is_handled, + G_TYPE_INVALID); + if (! res) { + g_warning ("Unable to call IsAutostartConditionHandled (%s): %s", + condition, + error->message); + } + + g_object_unref (sm_proxy); + + return is_handled; +} + +static gboolean +config_get_at_screen_reader (gboolean *is_writable) +{ + return config_get_bool (KEY_AT_SCREEN_READER_ENABLED, is_writable); +} + +static gboolean +config_get_at_screen_keyboard (gboolean *is_writable) +{ + return config_get_bool (KEY_AT_SCREEN_KEYBOARD_ENABLED, is_writable); +} + +static gboolean +config_get_at_screen_magnifier (gboolean *is_writable) +{ + return config_get_bool (KEY_AT_SCREEN_MAGNIFIER_ENABLED, is_writable); +} + +static void +config_set_at_screen_reader (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_AT_SCREEN_READER_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static void +config_set_at_screen_keyboard (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_AT_SCREEN_KEYBOARD_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static void +config_set_at_screen_magnifier (gboolean enabled) +{ + MateConfClient *client; + + client = mateconf_client_get_default (); + mateconf_client_set_bool (client, KEY_AT_SCREEN_MAGNIFIER_ENABLED, enabled, NULL); + g_object_unref (client); +} + +static void +on_sticky_keys_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_sticky_keys (gtk_toggle_button_get_active (button)); +} + +static void +on_bounce_keys_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_bounce_keys (gtk_toggle_button_get_active (button)); +} + +static void +on_slow_keys_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_slow_keys (gtk_toggle_button_get_active (button)); +} + +static void +on_high_contrast_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_high_contrast (gtk_toggle_button_get_active (button)); +} + +static void +on_at_screen_reader_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_at_screen_reader (gtk_toggle_button_get_active (button)); +} + +static void +on_at_screen_keyboard_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_at_screen_keyboard (gtk_toggle_button_get_active (button)); +} + +static void +on_at_screen_magnifier_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_at_screen_magnifier (gtk_toggle_button_get_active (button)); +} + +static void +on_large_print_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_large_print (gtk_toggle_button_get_active (button)); +} + +static void +ui_set_sticky_keys (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->sticky_keys_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->sticky_keys_checkbutton), enabled); + } +} + +static void +ui_set_bounce_keys (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->bounce_keys_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->bounce_keys_checkbutton), enabled); + } +} + +static void +ui_set_slow_keys (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->slow_keys_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->slow_keys_checkbutton), enabled); + } +} + +static void +ui_set_high_contrast (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->high_contrast_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->high_contrast_checkbutton), enabled); + } +} + +static void +ui_set_at_screen_reader (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_reader_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_reader_checkbutton), enabled); + } +} + +static void +ui_set_at_screen_keyboard (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_keyboard_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_keyboard_checkbutton), enabled); + } +} + +static void +ui_set_at_screen_magnifier (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_magnifier_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_magnifier_checkbutton), enabled); + } +} + +static void +ui_set_large_print (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->large_print_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->large_print_checkbutton), enabled); + } +} + +static void +key_changed_cb (MateConfClient *client, + guint cnxn_id, + MateConfEntry *entry, + GsdA11yPreferencesDialog *dialog) +{ + const char *key; + MateConfValue *value; + + key = mateconf_entry_get_key (entry); + value = mateconf_entry_get_value (entry); + + if (strcmp (key, KEY_STICKY_KEYS_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_sticky_keys (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else if (strcmp (key, KEY_BOUNCE_KEYS_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_bounce_keys (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else if (strcmp (key, KEY_SLOW_KEYS_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_slow_keys (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else if (strcmp (key, KEY_AT_SCREEN_READER_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_at_screen_reader (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else if (strcmp (key, KEY_AT_SCREEN_KEYBOARD_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_at_screen_keyboard (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else if (strcmp (key, KEY_AT_SCREEN_MAGNIFIER_ENABLED) == 0) { + if (value->type == MATECONF_VALUE_BOOL) { + gboolean enabled; + + enabled = mateconf_value_get_bool (value); + ui_set_at_screen_magnifier (dialog, enabled); + } else { + g_warning ("Error retrieving configuration key '%s': Invalid type", + key); + } + } else { + g_debug ("Config key not handled: %s", key); + } +} + +static void +setup_dialog (GsdA11yPreferencesDialog *dialog, + GtkBuilder *builder) +{ + GtkWidget *widget; + gboolean enabled; + gboolean is_writable; + MateConfClient *client; + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "sticky_keys_checkbutton")); + dialog->priv->sticky_keys_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_sticky_keys_checkbutton_toggled), + NULL); + enabled = config_get_sticky_keys (&is_writable); + ui_set_sticky_keys (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "bounce_keys_checkbutton")); + dialog->priv->bounce_keys_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_bounce_keys_checkbutton_toggled), + NULL); + enabled = config_get_bounce_keys (&is_writable); + ui_set_bounce_keys (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "slow_keys_checkbutton")); + dialog->priv->slow_keys_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_slow_keys_checkbutton_toggled), + NULL); + enabled = config_get_slow_keys (&is_writable); + ui_set_slow_keys (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "high_contrast_checkbutton")); + dialog->priv->high_contrast_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_high_contrast_checkbutton_toggled), + NULL); + enabled = config_get_high_contrast (&is_writable); + ui_set_high_contrast (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "at_screen_keyboard_checkbutton")); + dialog->priv->screen_keyboard_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_at_screen_keyboard_checkbutton_toggled), + NULL); + enabled = config_get_at_screen_keyboard (&is_writable); + ui_set_at_screen_keyboard (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_KEYBOARD_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "at_screen_reader_checkbutton")); + dialog->priv->screen_reader_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_at_screen_reader_checkbutton_toggled), + NULL); + enabled = config_get_at_screen_reader (&is_writable); + ui_set_at_screen_reader (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_READER_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "at_screen_magnifier_checkbutton")); + dialog->priv->screen_magnifier_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_at_screen_magnifier_checkbutton_toggled), + NULL); + enabled = config_get_at_screen_magnifier (&is_writable); + ui_set_at_screen_magnifier (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "large_print_checkbutton")); + dialog->priv->large_print_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_large_print_checkbutton_toggled), + NULL); + enabled = config_get_large_print (&is_writable); + ui_set_large_print (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } + + + client = mateconf_client_get_default (); + mateconf_client_add_dir (client, + KEY_A11Y_DIR, + MATECONF_CLIENT_PRELOAD_ONELEVEL, + NULL); + dialog->priv->a11y_dir_cnxn = mateconf_client_notify_add (client, + KEY_A11Y_DIR, + (MateConfClientNotifyFunc)key_changed_cb, + dialog, + NULL, + NULL); + + mateconf_client_add_dir (client, + KEY_AT_DIR, + MATECONF_CLIENT_PRELOAD_ONELEVEL, + NULL); + dialog->priv->gsd_a11y_dir_cnxn = mateconf_client_notify_add (client, + KEY_AT_DIR, + (MateConfClientNotifyFunc)key_changed_cb, + dialog, + NULL, + NULL); + + g_object_unref (client); +} + +static void +gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *dialog) +{ + static const gchar *ui_file_path = GTKBUILDERDIR "/" GTKBUILDER_UI_FILE; + gchar *objects[] = {"main_box", NULL}; + GError *error = NULL; + GtkBuilder *builder; + + dialog->priv = GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE (dialog); + + builder = gtk_builder_new (); + gtk_builder_set_translation_domain (builder, PACKAGE); + if (gtk_builder_add_objects_from_file (builder, ui_file_path, objects, + &error) == 0) { + g_warning ("Could not load A11Y-UI: %s", error->message); + g_error_free (error); + } else { + GtkWidget *widget; + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "main_box")); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + widget); + gtk_container_set_border_width (GTK_CONTAINER (widget), 12); + setup_dialog (dialog, builder); + } + + g_object_unref (builder); + + gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access Preferences")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-accessibility"); + g_object_set (dialog, + "allow-shrink", FALSE, + "allow-grow", FALSE, + NULL); + + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); + g_signal_connect (dialog, + "response", + G_CALLBACK (on_response), + dialog); + + + gtk_widget_show_all (GTK_WIDGET (dialog)); +} + +static void +gsd_a11y_preferences_dialog_finalize (GObject *object) +{ + GsdA11yPreferencesDialog *dialog; + MateConfClient *client; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_PREFERENCES_DIALOG (object)); + + dialog = GSD_A11Y_PREFERENCES_DIALOG (object); + + g_return_if_fail (dialog->priv != NULL); + + client = mateconf_client_get_default (); + + if (dialog->priv->a11y_dir_cnxn > 0) { + mateconf_client_notify_remove (client, dialog->priv->a11y_dir_cnxn); + } + if (dialog->priv->gsd_a11y_dir_cnxn > 0) { + mateconf_client_notify_remove (client, dialog->priv->gsd_a11y_dir_cnxn); + } + + g_object_unref (client); + + G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->finalize (object); +} + +GtkWidget * +gsd_a11y_preferences_dialog_new (void) +{ + GObject *object; + + object = g_object_new (GSD_TYPE_A11Y_PREFERENCES_DIALOG, + NULL); + + return GTK_WIDGET (object); +} diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h new file mode 100644 index 0000000..2be096a --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <[email protected]> + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef __GSD_A11Y_PREFERENCES_DIALOG_H +#define __GSD_A11Y_PREFERENCES_DIALOG_H + +#include <glib-object.h> +#include <gtk/gtk.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSD_TYPE_A11Y_PREFERENCES_DIALOG (gsd_a11y_preferences_dialog_get_type ()) +#define GSD_A11Y_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialog)) +#define GSD_A11Y_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogClass)) +#define GSD_IS_A11Y_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG)) +#define GSD_IS_A11Y_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_PREFERENCES_DIALOG)) +#define GSD_A11Y_PREFERENCES_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogClass)) + +typedef struct GsdA11yPreferencesDialogPrivate GsdA11yPreferencesDialogPrivate; + +typedef struct +{ + GtkDialog parent; + GsdA11yPreferencesDialogPrivate *priv; +} GsdA11yPreferencesDialog; + +typedef struct +{ + GtkDialogClass parent_class; +} GsdA11yPreferencesDialogClass; + +GType gsd_a11y_preferences_dialog_get_type (void); + +GtkWidget * gsd_a11y_preferences_dialog_new (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __GSD_A11Y_PREFERENCES_DIALOG_H */ diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui new file mode 100644 index 0000000..6a0fcb0 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui @@ -0,0 +1,199 @@ +<?xml version="1.0"?> +<interface> + <!-- interface-requires gtk+ 2.6 --> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkDialog" id="dialog1"> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Universal Access Preferences</property> + <property name="window_position">center-on-parent</property> + <property name="icon_name">preferences-desktop-accessibility</property> + <property name="type_hint">dialog</property> + <property name="has_separator">False</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">2</property> + <child> + <object class="GtkHBox" id="main_box"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="spacing">10</property> + <child> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="yalign">0</property> + <property name="icon_name">preferences-desktop-accessibility</property> + <property name="icon-size">6</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="at_screen_keyboard_checkbutton"> + <property name="label" translatable="yes">Use on-screen _keyboard</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="at_screen_reader_checkbutton"> + <property name="label" translatable="yes">Use screen _reader</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="at_screen_magnifier_checkbutton"> + <property name="label" translatable="yes">Use screen _magnifier</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="high_contrast_checkbutton"> + <property name="label" translatable="yes">Enhance _contrast in colors</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="large_print_checkbutton"> + <property name="label" translatable="yes">Make _text larger and easier to read</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="sticky_keys_checkbutton"> + <property name="label" translatable="yes">_Press keyboard shortcuts one key at a time (Sticky Keys)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="bounce_keys_checkbutton"> + <property name="label" translatable="yes">_Ignore duplicate keypresses (Bounce Keys)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">6</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="slow_keys_checkbutton"> + <property name="label" translatable="yes">Press and _hold keys to accept them (Slow Keys)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">7</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="button1"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">button1</action-widget> + </action-widgets> + </object> +</interface> diff --git a/plugins/a11y-keyboard/test-a11y-preferences-dialog.c b/plugins/a11y-keyboard/test-a11y-preferences-dialog.c new file mode 100644 index 0000000..343f61c --- /dev/null +++ b/plugins/a11y-keyboard/test-a11y-preferences-dialog.c @@ -0,0 +1,64 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <[email protected]> + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * + */ + +#include "config.h" + +#include <stdlib.h> + +#include <glib/gi18n.h> +#include <gtk/gtk.h> + +#include "gsd-a11y-preferences-dialog.h" + +static void +test_window (void) +{ + GtkWidget *window; + + window = gsd_a11y_preferences_dialog_new (); + gtk_dialog_run (GTK_DIALOG (window)); +} + +int +main (int argc, + char **argv) +{ + GError *error = NULL; + +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); +# ifdef HAVE_BIND_TEXTDOMAIN_CODESET + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +# endif + textdomain (GETTEXT_PACKAGE); +#endif + + if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) { + fprintf (stderr, "%s", error->message); + g_error_free (error); + exit (1); + } + + test_window (); + + return 0; +} |