Bug 1542691 - [Linux] Replace nsGConfService by GSettingsService in accessible/atk/Platform.cpp, r=karlt
authorMartin Stransky <stransky@redhat.com>
Tue, 09 Apr 2019 20:47:45 +0000
changeset 468735 caff7c30502713c949800eb950d836e3f55e5a65
parent 468734 c2b1753a416b3201552108700ecd3d17686d5d4f
child 468736 384cdd1ee833dfa72b957072651c1bde10dacf7c
push id35850
push userdvarga@mozilla.com
push dateWed, 10 Apr 2019 21:52:56 +0000
treeherdermozilla-central@9d3dbe3fef26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1542691
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542691 - [Linux] Replace nsGConfService by GSettingsService in accessible/atk/Platform.cpp, r=karlt Differential Revision: https://phabricator.services.mozilla.com/D26477
accessible/atk/Platform.cpp
--- a/accessible/atk/Platform.cpp
+++ b/accessible/atk/Platform.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Platform.h"
 
 #include "nsIAccessibleEvent.h"
-#include "nsIGConfService.h"
+#include "nsIGSettingsService.h"
 #include "nsIServiceManager.h"
 #include "nsMai.h"
 #include "AtkSocketAccessible.h"
 #include "prenv.h"
 #include "prlink.h"
 
 #ifdef MOZ_ENABLE_DBUS
 #  include <dbus/dbus.h>
@@ -303,18 +303,26 @@ bool a11y::ShouldA11yBeEnabled() {
   }
 
 dbus_done:
   if (reply) dbus_message_unref(reply);
 
   if (dbusSuccess) return sShouldEnable;
 #endif
 
-    // check gconf-2 setting
-#define GCONF_A11Y_KEY "/desktop/gnome/interface/accessibility"
-  nsresult rv = NS_OK;
-  nsCOMPtr<nsIGConfService> gconf =
-      do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
-  if (NS_SUCCEEDED(rv) && gconf)
-    gconf->GetBool(NS_LITERAL_CSTRING(GCONF_A11Y_KEY), &sShouldEnable);
+// check GSettings
+#define GSETINGS_A11Y_INTERFACE "org.gnome.desktop.interface"
+#define GSETINGS_A11Y_KEY       "toolkit-accessibility"
+  nsCOMPtr<nsIGSettingsService> gsettings =
+      do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
+  nsCOMPtr<nsIGSettingsCollection> a11y_settings;
+
+  if (gsettings) {
+    gsettings->GetCollectionForSchema(NS_LITERAL_CSTRING(GSETINGS_A11Y_INTERFACE),
+                                      getter_AddRefs(a11y_settings));
+    if (a11y_settings) {
+      a11y_settings->GetBoolean(NS_LITERAL_CSTRING(GSETINGS_A11Y_KEY),
+                                &sShouldEnable);
+    }
+  }
 
   return sShouldEnable;
 }