Package: mate-settings-daemon
Severity: important
Version: 1.8.2-1
Tags: patch

The accessibility key bindings do not enable/disable orca (screen
reader) and onboard (on screen keyboard). This is a serious usability
issue for visually impaired individuals.

The upstream MATE team have prepared a number of patches to correct this
issue.

  *
https://github.com/mate-desktop/mate-settings-daemon/commit/b8e3a26d0975cb43cb5a315bceaf581f6ea2a5a8
  *
https://github.com/mate-desktop/mate-settings-daemon/commit/b42e0ce69a7f232d4c29de284bd0b3ca4a38555d
  *
https://github.com/mate-desktop/mate-settings-daemon/commit/d0f277bf02655db7e35946b82176a1b5ffe6819b
  *
https://github.com/mate-desktop/mate-settings-daemon/commit/4cb2701b4996045171c4ba67400be0f528d76505

These patches are attached to this email as:

  * 0010_move_a11y_keybindings_to_media_keys.patch
  * 0011_add_a11y_settings_plugin.patch
  * 0012_use_gnome_a11y_schema_to_enable_applications.patch
  * 0013_monitor_gnome_schema_keys.patch

These patches have been tested on Arch Linux and Ubuntu MATE 14.04.
Please apply these patches to mate-settings-daemon so that MATE on
Debian Jesse is a viable platform for the visually impaired.

-- 
Regards, Martin.
From b8e3a26d0975cb43cb5a315bceaf581f6ea2a5a8 Mon Sep 17 00:00:00 2001
From: infirit <infi...@gmail.com>
Date: Sun, 2 Nov 2014 15:04:36 +0100
Subject: [PATCH] a11y-keybindings: Move to media-keys plugin

---
 data/50-accessibility.xml.in                       |  8 +--
 data/Makefile.am                                   |  5 +-
 ...ingsDaemon.plugins.media-keys.gschema.xml.in.in | 15 ++++++
 data/org.mate.keybindings.gschema.xml.in.in        | 58 ----------------------
 plugins/media-keys/acme.h                          |  6 +++
 plugins/media-keys/msd-media-keys-manager.c        | 39 +++++++++++++++
 po/POTFILES.in                                     |  1 -
 7 files changed, 66 insertions(+), 66 deletions(-)
 delete mode 100644 data/org.mate.keybindings.gschema.xml.in.in

diff --git a/data/50-accessibility.xml.in b/data/50-accessibility.xml.in
index 998ba17..89a9e6b 100644
--- a/data/50-accessibility.xml.in
+++ b/data/50-accessibility.xml.in
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<KeyListEntries _name="Accessibility">
+<KeyListEntries group="system" _name="Accessibility" schema="org.mate.SettingsDaemon.plugins.media-keys">
 
-	<KeyListEntry name="/desktop/mate/keybindings/magnifier/binding"/>
-	<KeyListEntry name="/desktop/mate/keybindings/screenreader/binding"/>
-	<KeyListEntry name="/desktop/mate/keybindings/onscreenkeyboard/binding"/>
+	<KeyListEntry name="magnifier" _description="Toggle magnifier"/>
+	<KeyListEntry name="screenreader" _description="Toggle screen reader"/>
+	<KeyListEntry name="on-screen-keyboard" _description="Toggle on-screen keyboard"/>
 
 </KeyListEntries>
diff --git a/data/Makefile.am b/data/Makefile.am
index 00bb02d..008061a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,7 +3,6 @@ NULL =
 msd_gschemas_in_in = \
 	org.mate.applications-at.gschema.xml.in.in \
 	org.mate.font-rendering.gschema.xml.in.in \
-	org.mate.keybindings.gschema.xml.in.in \
 	org.mate.peripherals-smartcard.gschema.xml.in.in \
 	org.mate.peripherals-touchpad.gschema.xml.in.in \
 	org.mate.SettingsDaemon.plugins.a11y-keyboard.gschema.xml.in.in \
@@ -57,9 +56,9 @@ man_MANS = mate-settings-daemon.1
 @INTLTOOL_XML_NOMERGE_RULE@
 
 #disabled until we support it
-#xmldir = @MATE_KEYBINDINGS_KEYSDIR@
+xmldir = @MATE_KEYBINDINGS_KEYSDIR@
 xml_in_files = 50-accessibility.xml.in
-#xml_DATA = $(xml_in_files:.xml.in=.xml)
+xml_DATA = $(xml_in_files:.xml.in=.xml)
 
 EXTRA_DIST = 				\
 	$(msd_gschemas_in_in)		\
diff --git a/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in.in b/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in.in
index f855cfd..3e0ee2c 100644
--- a/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in.in
+++ b/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in.in
@@ -110,5 +110,20 @@
       <_summary>Next track</_summary>
       <_description>Binding to skip to next track.</_description>
     </key>
+    <key name="magnifier" type="s">
+      <default>''</default>
+      <_summary>Toggle magnifier</_summary>
+      <_description>Binding to show the screen magnifier</_description>
+    </key>
+    <key name="screenreader" type="s">
+      <default>''</default>
+      <_summary>Toggle screen reader</_summary>
+      <_description>Binding to start the screen reader</_description>
+    </key>
+    <key name="on-screen-keyboard" type="s">
+      <default>''</default>
+      <_summary>Toggle on-screen keyboard</_summary>
+      <_description>Binding to show the on-screen keyboard</_description>
+    </key>
   </schema>
 </schemalist>
diff --git a/data/org.mate.keybindings.gschema.xml.in.in b/data/org.mate.keybindings.gschema.xml.in.in
deleted file mode 100644
index 9e3aca6..0000000
--- a/data/org.mate.keybindings.gschema.xml.in.in
+++ /dev/null
@@ -1,58 +0,0 @@
-<schemalist gettext-domain="@GETTEXT_PACKAGE@">
-  <schema id="org.mate.keybindings" path="/org/mate/desktop/keybindings/">
-    <child name="magnifier" schema="org.mate.keybindings.magnifier"/>
-    <child name="screenreader" schema="org.mate.keybindings.screenreader"/>
-    <child name="onscreenkeyboard" schema="org.mate.keybindings.onscreenkeyboard"/>
-  </schema>
-  <schema id="org.mate.keybindings.magnifier" path="/org/mate/desktop/keybindings/magnifier/">
-    <key name="binding" type="s">
-      <default>''</default>
-      <_summary>Toggle magnifier</_summary>
-      <_description>Binding to toggle the magnifier.</_description>
-    </key>
-    <key name="name" type="s">
-      <default context="name" l10n="messages">'Toggle magnifier'</default>
-      <_summary>The name of the keyboard shortcut to toggle the magnifier</_summary>
-      <_description>This is the name of the keyboard shortcut to toggle the magnifier. This name will be shown in the keyboard shortcut preferences dialog.</_description>
-    </key>
-    <key name="action" type="s">
-      <default>'mate-gsettings-toggle screen-keyboard-enabled'</default>
-      <_summary>Toggle magnifier</_summary>
-      <_description>Command used to turn the magnifier on or off.</_description>
-    </key>
-  </schema>
-  <schema id="org.mate.keybindings.screenreader" path="/org/mate/desktop/keybindings/screenreader/">
-    <key name="binding" type="s">
-      <default>''</default>
-      <_summary>Toggle screen reader</_summary>
-      <_description>Binding to toggle the screen reader.</_description>
-    </key>
-    <key name="name" type="s">
-      <default context="name" l10n="messages">'Toggle screen reader'</default>
-      <_summary>The name of the keyboard shortcut to toggle the screen reader</_summary>
-      <_description>This is the name of the keyboard shortcut to toggle the screen reader. This name will be shown in the keyboard shortcut preferences dialog.</_description>
-    </key>
-    <key name="action" type="s">
-      <default>'mate-gsettings-toggle screen-reader-enabled'</default>
-      <_summary>Toggle screen reader</_summary>
-      <_description>Command used to turn the screen reader on or off.</_description>
-    </key>
-  </schema>
-  <schema id="org.mate.keybindings.onscreenkeyboard" path="/org/mate/desktop/keybindings/onscreenkeyboard/">
-    <key name="name" type="s">
-      <default context="name" l10n="messages">'Toggle on-screen keyboard'</default>
-      <_summary>The name of the keyboard shortcut to toggle the on-screen keyboard</_summary>
-      <_description>This is the name of the keyboard shortcut to toggle the on-screen keyboard. This name will be shown in the keyboard shortcut preferences dialog.</_description>
-    </key>
-    <key name="binding" type="s">
-      <default>''</default>
-      <_summary>Toggle on-screen keyboard</_summary>
-      <_description>Binding to toggle the on-screen keyboard.</_description>
-    </key>
-    <key name="action" type="s">
-      <default>'mate-gsettings-toggle screen-keyboard-enabled'</default>
-      <_summary>Toggle on-screen keyboard</_summary>
-      <_description>Command used to turn the on-screen keyboard on or off.</_description>
-    </key>
-  </schema>
-</schemalist>
diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h
index 0f87bc6..17ce1ed 100644
--- a/plugins/media-keys/acme.h
+++ b/plugins/media-keys/acme.h
@@ -45,6 +45,9 @@ enum {
         STOP_KEY,
         PREVIOUS_KEY,
         NEXT_KEY,
+        MAGNIFIER_KEY,
+        SCREENREADER_KEY,
+        ON_SCREEN_KEYBOARD_KEY,
         HANDLED_KEYS
 };
 
@@ -72,6 +75,9 @@ static struct {
         { STOP_KEY, "stop", NULL },
         { PREVIOUS_KEY, "previous", NULL },
         { NEXT_KEY, "next", NULL },
+        { MAGNIFIER_KEY, "magnifier", NULL, NULL },
+        { SCREENREADER_KEY, "screenreader", NULL, NULL },
+        { ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL, NULL },
 };
 
 #endif /* __ACME_H__ */
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 1ff0291..f0b0229 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -880,6 +880,36 @@ do_multimedia_player_action (MsdMediaKeysManager *manager,
         return msd_media_player_key_pressed (manager, key);
 }
 
+static void
+do_toggle_accessibility_key (const char *key)
+{
+        GSettings *settings;
+        gboolean state;
+
+        settings = g_settings_new ("org.mate.applications-at");
+        state = g_settings_get_boolean (settings, key);
+        g_settings_set_boolean (settings, key, !state);
+        g_object_unref (settings);
+}
+
+static void
+do_magnifier_action (MsdMediaKeysManager *manager)
+{
+        do_toggle_accessibility_key ("screen-magnifier-enabled");
+}
+
+static void
+do_screenreader_action (MsdMediaKeysManager *manager)
+{
+        do_toggle_accessibility_key ("screen-reader-enabled");
+}
+
+static void
+do_on_screen_keyboard_action (MsdMediaKeysManager *manager)
+{
+        do_toggle_accessibility_key ("screen-keyboard-enabled");
+}
+
 static gboolean
 do_action (MsdMediaKeysManager *manager,
            int                  type)
@@ -969,6 +999,15 @@ do_action (MsdMediaKeysManager *manager,
         case NEXT_KEY:
                 return do_multimedia_player_action (manager, "Next");
                 break;
+        case MAGNIFIER_KEY:
+                do_magnifier_action (manager);
+                break;
+        case SCREENREADER_KEY:
+                do_screenreader_action (manager);
+                break;
+        case ON_SCREEN_KEYBOARD_KEY:
+                do_on_screen_keyboard_action (manager);
+                break;
         default:
                 g_assert_not_reached ();
         }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e7dec6a..f17b5f3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,7 +3,6 @@
 data/50-accessibility.xml.in
 data/org.mate.applications-at.gschema.xml.in.in
 data/org.mate.font-rendering.gschema.xml.in.in
-data/org.mate.keybindings.gschema.xml.in.in
 data/org.mate.peripherals-smartcard.gschema.xml.in.in
 data/org.mate.peripherals-touchpad.gschema.xml.in.in
 data/org.mate.SettingsDaemon.plugins.a11y-keyboard.gschema.xml.in.in
From b42e0ce69a7f232d4c29de284bd0b3ca4a38555d Mon Sep 17 00:00:00 2001
From: infirit <infi...@gmail.com>
Date: Sun, 2 Nov 2014 17:36:33 +0100
Subject: [PATCH] Add a11y-settings plugin

---
 configure.ac                                       |   1 +
 data/Makefile.am                                   |   1 +
 ...sDaemon.plugins.a11y-settings.gschema.xml.in.in |  14 ++
 plugins/Makefile.am                                |   1 +
 plugins/a11y-settings/Makefile.am                  |  42 +++++
 .../a11y-settings.mate-settings-plugin.in          |   8 +
 plugins/a11y-settings/msd-a11y-settings-manager.c  | 192 +++++++++++++++++++++
 plugins/a11y-settings/msd-a11y-settings-manager.h  |  57 ++++++
 plugins/a11y-settings/msd-a11y-settings-plugin.c   | 109 ++++++++++++
 plugins/a11y-settings/msd-a11y-settings-plugin.h   |  59 +++++++
 po/POTFILES.in                                     |   1 +
 11 files changed, 485 insertions(+)
 create mode 100644 data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in
 create mode 100644 plugins/a11y-settings/Makefile.am
 create mode 100644 plugins/a11y-settings/a11y-settings.mate-settings-plugin.in
 create mode 100644 plugins/a11y-settings/msd-a11y-settings-manager.c
 create mode 100644 plugins/a11y-settings/msd-a11y-settings-manager.h
 create mode 100644 plugins/a11y-settings/msd-a11y-settings-plugin.c
 create mode 100644 plugins/a11y-settings/msd-a11y-settings-plugin.h

diff --git a/configure.ac b/configure.ac
index 5bdeba9..e7b3adc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -484,6 +484,7 @@ Makefile
 mate-settings-daemon/Makefile
 plugins/Makefile
 plugins/a11y-keyboard/Makefile
+plugins/a11y-settings/Makefile
 plugins/background/Makefile
 plugins/clipboard/Makefile
 plugins/common/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 008061a..a44c910 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -6,6 +6,7 @@ msd_gschemas_in_in = \
 	org.mate.peripherals-smartcard.gschema.xml.in.in \
 	org.mate.peripherals-touchpad.gschema.xml.in.in \
 	org.mate.SettingsDaemon.plugins.a11y-keyboard.gschema.xml.in.in \
+	org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in \
 	org.mate.SettingsDaemon.plugins.background.gschema.xml.in.in \
 	org.mate.SettingsDaemon.plugins.clipboard.gschema.xml.in.in \
 	org.mate.SettingsDaemon.plugins.datetime.gschema.xml.in.in \
diff --git a/data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in b/data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in
new file mode 100644
index 0000000..26f97bc
--- /dev/null
+++ b/data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in
@@ -0,0 +1,14 @@
+<schemalist>
+  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.SettingsDaemon.plugins.a11y-settings" path="/org/mate/settings-daemon/plugins/a11y-settings/">
+    <key name="active" type="b">
+      <default>false</default>
+      <_summary>Activation of this plugin</_summary>
+      <_description>Whether this plugin would be activated by mate-settings-daemon or not</_description>
+    </key>
+    <key name="priority" type="i">
+      <default>7</default>
+      <_summary>Priority to use for this plugin</_summary>
+      <_description>Priority to use for this plugin in mate-settings-daemon startup queue</_description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c7ce7d6..05d04c7 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -2,6 +2,7 @@ NULL =
 
 enabled_plugins =	\
 	a11y-keyboard	\
+	a11y-settings	\
 	background	\
 	clipboard	\
 	datetime	\
diff --git a/plugins/a11y-settings/Makefile.am b/plugins/a11y-settings/Makefile.am
new file mode 100644
index 0000000..f557b0f
--- /dev/null
+++ b/plugins/a11y-settings/Makefile.am
@@ -0,0 +1,42 @@
+plugin_name = ally-settings
+
+plugin_LTLIBRARIES = \
+	liba11y-settings.la
+
+liba11y_settings_la_SOURCES = 		\
+	msd-a11y-settings-manager.c	\
+	msd-a11y-settings-manager.h	\
+	msd-a11y-settings-plugin.c	\
+	msd-a11y-settings-plugin.h
+
+liba11y_settings_la_CPPFLAGS = \
+	-I$(top_srcdir)/mate-settings-daemon		\
+	-DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+	$(AM_CPPFLAGS)
+
+liba11y_settings_la_CFLAGS = \
+	$(PLUGIN_CFLAGS)		\
+	$(SETTINGS_PLUGIN_CFLAGS)	\
+	$(AM_CFLAGS)
+
+liba11y_settings_la_LDFLAGS = 		\
+	$(MSD_PLUGIN_LDFLAGS)
+
+liba11y_settings_la_LIBADD  = 		\
+	$(SETTINGS_PLUGIN_LIBS)
+
+plugin_in_files = 		\
+	a11y-settings.mate-settings-plugin.in
+
+plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin)
+
+EXTRA_DIST = 			\
+	$(plugin_in_files)
+
+CLEANFILES = 			\
+	$(plugin_DATA)
+
+DISTCLEANFILES =		\
+	$(plugin_DATA)
+
+@MSD_INTLTOOL_PLUGIN_RULE@
diff --git a/plugins/a11y-settings/a11y-settings.mate-settings-plugin.in b/plugins/a11y-settings/a11y-settings.mate-settings-plugin.in
new file mode 100644
index 0000000..ecdd80d
--- /dev/null
+++ b/plugins/a11y-settings/a11y-settings.mate-settings-plugin.in
@@ -0,0 +1,8 @@
+[MATE Settings Plugin]
+Module=a11y-settings
+IAge=0
+_Name=Accessibility settings
+_Description=Accessibility settings plugin
+Authors=Bastien Nocera <had...@hadess.net>
+Copyright=Copyright © 2011 Red Hat Inc.
+Website=
diff --git a/plugins/a11y-settings/msd-a11y-settings-manager.c b/plugins/a11y-settings/msd-a11y-settings-manager.c
new file mode 100644
index 0000000..45469be
--- /dev/null
+++ b/plugins/a11y-settings/msd-a11y-settings-manager.c
@@ -0,0 +1,192 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mcc...@jhu.edu>
+ *
+ * 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 "mate-settings-profile.h"
+#include "msd-a11y-settings-manager.h"
+
+#define MSD_A11Y_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_A11Y_SETTINGS_MANAGER, MsdA11ySettingsManagerPrivate))
+
+struct MsdA11ySettingsManagerPrivate
+{
+        GSettings *interface_settings;
+        GSettings *a11y_apps_settings;
+};
+
+enum {
+        PROP_0,
+};
+
+static void     msd_a11y_settings_manager_class_init  (MsdA11ySettingsManagerClass *klass);
+static void     msd_a11y_settings_manager_init        (MsdA11ySettingsManager      *a11y_settings_manager);
+static void     msd_a11y_settings_manager_finalize    (GObject                     *object);
+
+G_DEFINE_TYPE (MsdA11ySettingsManager, msd_a11y_settings_manager, G_TYPE_OBJECT)
+
+static gpointer manager_object = NULL;
+
+static void
+apps_settings_changed (GSettings              *settings,
+		       const char             *key,
+		       MsdA11ySettingsManager *manager)
+{
+	gboolean screen_reader, keyboard;
+
+	if (g_str_equal (key, "screen-reader-enabled") == FALSE &&
+	    g_str_equal (key, "screen-keyboard-enabled") == FALSE)
+		return;
+
+	g_debug ("screen reader or OSK enablement changed");
+
+	screen_reader = g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-reader-enabled");
+	keyboard = g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-keyboard-enabled");
+
+	if (screen_reader || keyboard) {
+		g_debug ("Enabling accessibility, screen reader or OSK enabled");
+		g_settings_set_boolean (manager->priv->interface_settings, "accessibility", TRUE);
+	} else if (screen_reader == FALSE && keyboard == FALSE) {
+		g_debug ("Disabling accessibility, screen reader and OSK disabled");
+		g_settings_set_boolean (manager->priv->interface_settings, "accessibility", FALSE);
+	}
+}
+
+gboolean
+msd_a11y_settings_manager_start (MsdA11ySettingsManager *manager,
+                                 GError                **error)
+{
+        g_debug ("Starting a11y_settings manager");
+        mate_settings_profile_start (NULL);
+
+	manager->priv->interface_settings = g_settings_new ("org.mate.interface");
+	manager->priv->a11y_apps_settings = g_settings_new ("org.mate.applications-at");
+
+	g_signal_connect (G_OBJECT (manager->priv->a11y_apps_settings), "changed",
+			  G_CALLBACK (apps_settings_changed), manager);
+
+	/* If any of the screen reader or on-screen keyboard are enabled,
+	 * make sure a11y is enabled for the toolkits.
+	 * We don't do the same thing for the reverse so it's possible to
+	 * enable AT-SPI for the toolkits without using an a11y app */
+	if (g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-keyboard-enabled") ||
+	    g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-reader-enabled"))
+		g_settings_set_boolean (manager->priv->interface_settings, "accessibility", TRUE);
+
+        mate_settings_profile_end (NULL);
+        return TRUE;
+}
+
+void
+msd_a11y_settings_manager_stop (MsdA11ySettingsManager *manager)
+{
+	if (manager->priv->interface_settings) {
+		g_object_unref (manager->priv->interface_settings);
+		manager->priv->interface_settings = NULL;
+	}
+	if (manager->priv->a11y_apps_settings) {
+		g_object_unref (manager->priv->a11y_apps_settings);
+		manager->priv->a11y_apps_settings = NULL;
+	}
+        g_debug ("Stopping a11y_settings manager");
+}
+
+static GObject *
+msd_a11y_settings_manager_constructor (GType                  type,
+                                       guint                  n_construct_properties,
+                                       GObjectConstructParam *construct_properties)
+{
+        MsdA11ySettingsManager      *a11y_settings_manager;
+
+        a11y_settings_manager = MSD_A11Y_SETTINGS_MANAGER (G_OBJECT_CLASS (msd_a11y_settings_manager_parent_class)->constructor (type,
+                                                                                                                                 n_construct_properties,
+                                                                                                                                 construct_properties));
+
+        return G_OBJECT (a11y_settings_manager);
+}
+
+static void
+msd_a11y_settings_manager_dispose (GObject *object)
+{
+        G_OBJECT_CLASS (msd_a11y_settings_manager_parent_class)->dispose (object);
+}
+
+static void
+msd_a11y_settings_manager_class_init (MsdA11ySettingsManagerClass *klass)
+{
+        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+
+        object_class->constructor = msd_a11y_settings_manager_constructor;
+        object_class->dispose = msd_a11y_settings_manager_dispose;
+        object_class->finalize = msd_a11y_settings_manager_finalize;
+
+        g_type_class_add_private (klass, sizeof (MsdA11ySettingsManagerPrivate));
+}
+
+static void
+msd_a11y_settings_manager_init (MsdA11ySettingsManager *manager)
+{
+        manager->priv = MSD_A11Y_SETTINGS_MANAGER_GET_PRIVATE (manager);
+
+}
+
+static void
+msd_a11y_settings_manager_finalize (GObject *object)
+{
+        MsdA11ySettingsManager *a11y_settings_manager;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (MSD_IS_A11Y_SETTINGS_MANAGER (object));
+
+        a11y_settings_manager = MSD_A11Y_SETTINGS_MANAGER (object);
+
+        g_return_if_fail (a11y_settings_manager->priv != NULL);
+
+        G_OBJECT_CLASS (msd_a11y_settings_manager_parent_class)->finalize (object);
+}
+
+MsdA11ySettingsManager *
+msd_a11y_settings_manager_new (void)
+{
+        if (manager_object != NULL) {
+                g_object_ref (manager_object);
+        } else {
+                manager_object = g_object_new (MSD_TYPE_A11Y_SETTINGS_MANAGER, NULL);
+                g_object_add_weak_pointer (manager_object,
+                                           (gpointer *) &manager_object);
+        }
+
+        return MSD_A11Y_SETTINGS_MANAGER (manager_object);
+}
diff --git a/plugins/a11y-settings/msd-a11y-settings-manager.h b/plugins/a11y-settings/msd-a11y-settings-manager.h
new file mode 100644
index 0000000..9f6e3f7
--- /dev/null
+++ b/plugins/a11y-settings/msd-a11y-settings-manager.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mcc...@jhu.edu>
+ *
+ * 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 __MSD_A11Y_SETTINGS_MANAGER_H
+#define __MSD_A11Y_SETTINGS_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MSD_TYPE_A11Y_SETTINGS_MANAGER         (msd_a11y_settings_manager_get_type ())
+#define MSD_A11Y_SETTINGS_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_A11Y_SETTINGS_MANAGER, MsdA11ySettingsManager))
+#define MSD_A11Y_SETTINGS_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_A11Y_SETTINGS_MANAGER, MsdA11ySettingsManagerClass))
+#define MSD_IS_A11Y_SETTINGS_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_A11Y_SETTINGS_MANAGER))
+#define MSD_IS_A11Y_SETTINGS_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_A11Y_SETTINGS_MANAGER))
+#define MSD_A11Y_SETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_A11Y_SETTINGS_MANAGER, MsdA11ySettingsManagerClass))
+
+typedef struct MsdA11ySettingsManagerPrivate MsdA11ySettingsManagerPrivate;
+
+typedef struct
+{
+        GObject                        parent;
+        MsdA11ySettingsManagerPrivate *priv;
+} MsdA11ySettingsManager;
+
+typedef struct
+{
+        GObjectClass   parent_class;
+} MsdA11ySettingsManagerClass;
+
+GType                   msd_a11y_settings_manager_get_type            (void);
+
+MsdA11ySettingsManager *msd_a11y_settings_manager_new                 (void);
+gboolean                msd_a11y_settings_manager_start               (MsdA11ySettingsManager *manager,
+                                                                       GError         **error);
+void                    msd_a11y_settings_manager_stop                (MsdA11ySettingsManager *manager);
+
+G_END_DECLS
+
+#endif /* __MSD_A11Y_SETTINGS_MANAGER_H */
diff --git a/plugins/a11y-settings/msd-a11y-settings-plugin.c b/plugins/a11y-settings/msd-a11y-settings-plugin.c
new file mode 100644
index 0000000..9d206c8
--- /dev/null
+++ b/plugins/a11y-settings/msd-a11y-settings-plugin.c
@@ -0,0 +1,109 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mcc...@jhu.edu>
+ *
+ * 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 "msd-a11y-settings-plugin.h"
+#include "msd-a11y-settings-manager.h"
+
+struct MsdA11ySettingsPluginPrivate {
+        MsdA11ySettingsManager *manager;
+};
+
+#define MSD_A11Y_SETTINGS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_A11Y_SETTINGS_PLUGIN, MsdA11ySettingsPluginPrivate))
+
+MATE_SETTINGS_PLUGIN_REGISTER (MsdA11ySettingsPlugin, msd_a11y_settings_plugin)
+
+static void
+msd_a11y_settings_plugin_init (MsdA11ySettingsPlugin *plugin)
+{
+        plugin->priv = MSD_A11Y_SETTINGS_PLUGIN_GET_PRIVATE (plugin);
+
+        g_debug ("MsdA11ySettingsPlugin initializing");
+
+        plugin->priv->manager = msd_a11y_settings_manager_new ();
+}
+
+static void
+msd_a11y_settings_plugin_finalize (GObject *object)
+{
+        MsdA11ySettingsPlugin *plugin;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (MSD_IS_A11Y_SETTINGS_PLUGIN (object));
+
+        g_debug ("MsdA11ySettingsPlugin finalizing");
+
+        plugin = MSD_A11Y_SETTINGS_PLUGIN (object);
+
+        g_return_if_fail (plugin->priv != NULL);
+
+        if (plugin->priv->manager != NULL) {
+                g_object_unref (plugin->priv->manager);
+        }
+
+        G_OBJECT_CLASS (msd_a11y_settings_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (MateSettingsPlugin *plugin)
+{
+        gboolean res;
+        GError  *error;
+
+        g_debug ("Activating a11y-settings plugin");
+
+        error = NULL;
+        res = msd_a11y_settings_manager_start (MSD_A11Y_SETTINGS_PLUGIN (plugin)->priv->manager, &error);
+        if (! res) {
+                g_warning ("Unable to start a11y-settings manager: %s", error->message);
+                g_error_free (error);
+        }
+}
+
+static void
+impl_deactivate (MateSettingsPlugin *plugin)
+{
+        g_debug ("Deactivating a11y-settings plugin");
+        msd_a11y_settings_manager_stop (MSD_A11Y_SETTINGS_PLUGIN (plugin)->priv->manager);
+}
+
+static void
+msd_a11y_settings_plugin_class_init (MsdA11ySettingsPluginClass *klass)
+{
+        GObjectClass             *object_class = G_OBJECT_CLASS (klass);
+        MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass);
+
+        object_class->finalize = msd_a11y_settings_plugin_finalize;
+
+        plugin_class->activate = impl_activate;
+        plugin_class->deactivate = impl_deactivate;
+
+        g_type_class_add_private (klass, sizeof (MsdA11ySettingsPluginPrivate));
+}
+
+static void
+msd_a11y_settings_plugin_class_finalize (MsdA11ySettingsPluginClass *klass)
+{
+}
diff --git a/plugins/a11y-settings/msd-a11y-settings-plugin.h b/plugins/a11y-settings/msd-a11y-settings-plugin.h
new file mode 100644
index 0000000..a19c8a4
--- /dev/null
+++ b/plugins/a11y-settings/msd-a11y-settings-plugin.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 __MSD_A11Y_SETTINGS_PLUGIN_H__
+#define __MSD_A11Y_SETTINGS_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "mate-settings-plugin.h"
+
+G_BEGIN_DECLS
+
+#define MSD_TYPE_A11Y_SETTINGS_PLUGIN                (msd_a11y_settings_plugin_get_type ())
+#define MSD_A11Y_SETTINGS_PLUGIN(o)                  (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_A11Y_SETTINGS_PLUGIN, MsdA11ySettingsPlugin))
+#define MSD_A11Y_SETTINGS_PLUGIN_CLASS(k)            (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_A11Y_SETTINGS_PLUGIN, MsdA11ySettingsPluginClass))
+#define MSD_IS_A11Y_SETTINGS_PLUGIN(o)               (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_A11Y_SETTINGS_PLUGIN))
+#define MSD_IS_A11Y_SETTINGS_PLUGIN_CLASS(k)         (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_A11Y_SETTINGS_PLUGIN))
+#define MSD_A11Y_SETTINGS_PLUGIN_GET_CLASS(o)        (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_A11Y_SETTINGS_PLUGIN, MsdA11ySettingsPluginClass))
+
+typedef struct MsdA11ySettingsPluginPrivate MsdA11ySettingsPluginPrivate;
+
+typedef struct
+{
+        MateSettingsPlugin           parent;
+        MsdA11ySettingsPluginPrivate *priv;
+} MsdA11ySettingsPlugin;
+
+typedef struct
+{
+        MateSettingsPluginClass parent_class;
+} MsdA11ySettingsPluginClass;
+
+GType   msd_a11y_settings_plugin_get_type            (void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __MSD_A11Y_SETTINGS_PLUGIN_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f17b5f3..27080da 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ data/org.mate.font-rendering.gschema.xml.in.in
 data/org.mate.peripherals-smartcard.gschema.xml.in.in
 data/org.mate.peripherals-touchpad.gschema.xml.in.in
 data/org.mate.SettingsDaemon.plugins.a11y-keyboard.gschema.xml.in.in
+data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml.in.in
 data/org.mate.SettingsDaemon.plugins.background.gschema.xml.in.in
 data/org.mate.SettingsDaemon.plugins.clipboard.gschema.xml.in.in
 data/org.mate.SettingsDaemon.plugins.datetime.gschema.xml.in.in
From d0f277bf02655db7e35946b82176a1b5ffe6819b Mon Sep 17 00:00:00 2001
From: infirit <infi...@gmail.com>
Date: Mon, 3 Nov 2014 10:26:22 +0100
Subject: [PATCH] a11y: Use gnome a11y schema to enable applications

For example when we toggle screen-reader-enable in the gnome schema
orca will turn on and off even under MATE.
---
 plugins/media-keys/msd-media-keys-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index f0b0229..6feac04 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -886,7 +886,7 @@ do_toggle_accessibility_key (const char *key)
         GSettings *settings;
         gboolean state;
 
-        settings = g_settings_new ("org.mate.applications-at");
+        settings = g_settings_new ("org.gnome.desktop.a11y.applications");
         state = g_settings_get_boolean (settings, key);
         g_settings_set_boolean (settings, key, !state);
         g_object_unref (settings);
From 4cb2701b4996045171c4ba67400be0f528d76505 Mon Sep 17 00:00:00 2001
From: infirit <infi...@gmail.com>
Date: Mon, 3 Nov 2014 10:30:35 +0100
Subject: [PATCH] a11y-settings: Monitor gnome schema keys instead of MATE's

---
 plugins/a11y-settings/msd-a11y-settings-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/a11y-settings/msd-a11y-settings-manager.c b/plugins/a11y-settings/msd-a11y-settings-manager.c
index 45469be..09d7ba7 100644
--- a/plugins/a11y-settings/msd-a11y-settings-manager.c
+++ b/plugins/a11y-settings/msd-a11y-settings-manager.c
@@ -92,7 +92,7 @@ msd_a11y_settings_manager_start (MsdA11ySettingsManager *manager,
         mate_settings_profile_start (NULL);
 
 	manager->priv->interface_settings = g_settings_new ("org.mate.interface");
-	manager->priv->a11y_apps_settings = g_settings_new ("org.mate.applications-at");
+	manager->priv->a11y_apps_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
 
 	g_signal_connect (G_OBJECT (manager->priv->a11y_apps_settings), "changed",
 			  G_CALLBACK (apps_settings_changed), manager);

Reply via email to