Merge lp:~apinheiro/unity/Bug723699 into lp:unity

Proposed by Alejandro Piñeiro
Status: Merged
Merged at revision: 886
Proposed branch: lp:~apinheiro/unity/Bug723699
Merge into: lp:unity
Diff against target: 144 lines (+34/-35)
3 files modified
services/CMakeLists.txt (+1/-1)
services/panel-a11y.c (+15/-11)
src/unitya11y.cpp (+18/-23)
To merge this branch: bzr merge lp:~apinheiro/unity/Bug723699
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Rodrigo Moya (community) Approve
Alex Launi Pending
Review via email: mp+50963@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Looks good

review: Approve
Revision history for this message
David Barth (dbarth) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'services/CMakeLists.txt'
--- services/CMakeLists.txt 2011-02-17 13:03:25 +0000
+++ services/CMakeLists.txt 2011-02-23 17:33:03 +0000
@@ -2,7 +2,7 @@
2# Panel Service2# Panel Service
3#3#
4find_package(PkgConfig)4find_package(PkgConfig)
5pkg_check_modules(SERVICE_DEPS REQUIRED gobject-2.0 gio-2.0 gtk+-2.0 gthread-2.0 indicator x11)5pkg_check_modules(SERVICE_DEPS REQUIRED gobject-2.0 gio-2.0 gtk+-2.0 gthread-2.0 indicator x11 gconf-2.0)
66
7execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)7execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)
8execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)8execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)
99
=== modified file 'services/panel-a11y.c'
--- services/panel-a11y.c 2011-01-30 17:46:02 +0000
+++ services/panel-a11y.c 2011-02-23 17:33:03 +0000
@@ -16,15 +16,16 @@
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */17 */
1818
19#include <gconf/gconf-client.h>
19#include <gio/gio.h>20#include <gio/gio.h>
21
20#include "panel-a11y.h"22#include "panel-a11y.h"
21#include "panel-util-accessible.h"23#include "panel-util-accessible.h"
2224
23static gboolean a11y_initialized = FALSE;25static gboolean a11y_initialized = FALSE;
2426
25#define INIT_METHOD "gnome_accessibility_module_init"27#define INIT_METHOD "gnome_accessibility_module_init"
26#define DESKTOP_SCHEMA "org.gnome.desktop.interface"28#define A11Y_GCONF_KEY "/desktop/gnome/interface/accessibility"
27#define ACCESSIBILITY_ENABLED_KEY "accessibility"
28#define AT_SPI_SCHEMA "org.a11y.atspi"29#define AT_SPI_SCHEMA "org.a11y.atspi"
29#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"30#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
3031
@@ -53,16 +54,19 @@
53static gboolean54static gboolean
54should_enable_a11y (void)55should_enable_a11y (void)
55{56{
56 GSettings *desktop_settings = NULL;57 GConfClient *client = NULL;
57 gboolean value = FALSE;58 gboolean value = FALSE;
5859 GError *error = NULL;
59 if (!has_gsettings_schema (DESKTOP_SCHEMA))60
60 return FALSE;61 client = gconf_client_get_default ();
6162 value = gconf_client_get_bool (client, A11Y_GCONF_KEY, &error);
62 desktop_settings = g_settings_new (DESKTOP_SCHEMA);63 if (error != NULL)
63 value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);64 {
6465 g_warning ("Error getting gconf variable %s, a11y disabled by default",
65 g_object_unref (desktop_settings);66 A11Y_GCONF_KEY);
67 g_error_free (error);
68 }
69 g_object_unref (client);
6670
67 return value;71 return value;
68}72}
6973
=== modified file 'src/unitya11y.cpp'
--- src/unitya11y.cpp 2011-02-23 12:03:48 +0000
+++ src/unitya11y.cpp 2011-02-23 17:33:03 +0000
@@ -20,6 +20,7 @@
20#include <gio/gio.h>20#include <gio/gio.h>
21#include <gmodule.h>21#include <gmodule.h>
22#include <stdio.h>22#include <stdio.h>
23#include <gconf/gconf-client.h>
2324
24#include "unitya11y.h"25#include "unitya11y.h"
25#include "unity-util-accessible.h"26#include "unity-util-accessible.h"
@@ -43,6 +44,11 @@
4344
44static gboolean a11y_initialized = FALSE;45static gboolean a11y_initialized = FALSE;
4546
47#define INIT_METHOD "gnome_accessibility_module_init"
48#define A11Y_GCONF_KEY "/desktop/gnome/interface/accessibility"
49#define AT_SPI_SCHEMA "org.a11y.atspi"
50#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
51
46static void52static void
47unity_a11y_restore_environment (void)53unity_a11y_restore_environment (void)
48{54{
@@ -56,12 +62,6 @@
56 g_type_class_unref (g_type_class_ref (UNITY_TYPE_UTIL_ACCESSIBLE));62 g_type_class_unref (g_type_class_ref (UNITY_TYPE_UTIL_ACCESSIBLE));
57}63}
5864
59#define INIT_METHOD "gnome_accessibility_module_init"
60#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
61#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
62#define AT_SPI_SCHEMA "org.a11y.atspi"
63#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
64
65static gboolean65static gboolean
66has_gsettings_schema (const gchar *schema)66has_gsettings_schema (const gchar *schema)
67{67{
@@ -87,19 +87,19 @@
87static gboolean87static gboolean
88should_enable_a11y (void)88should_enable_a11y (void)
89{89{
90 GSettings *desktop_settings = NULL;90 GConfClient *client = NULL;
91 gboolean value = FALSE;91 gboolean value = FALSE;
9292 GError *error = NULL;
93 if (g_getenv ("UNITY_A11Y_DISABLE"))93
94 return FALSE;94 client = gconf_client_get_default ();
9595 value = gconf_client_get_bool (client, A11Y_GCONF_KEY, &error);
96 if (!has_gsettings_schema (DESKTOP_SCHEMA))96 if (error != NULL)
97 return FALSE;97 {
98 98 g_warning ("Error getting gconf variable %s, a11y disabled by default",
99 desktop_settings = g_settings_new (DESKTOP_SCHEMA);99 A11Y_GCONF_KEY);
100 value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);100 g_error_free (error);
101101 }
102 g_object_unref (desktop_settings);102 g_object_unref (client);
103103
104 return value;104 return value;
105}105}
@@ -355,11 +355,6 @@
355355
356 unity_a11y_restore_environment ();356 unity_a11y_restore_environment ();
357357
358 /* FIXME: gsettings is causing some crashes checking if a11y is
359 enabled, so we are move to gconf, meanwhile we require a sanity
360 commit. */
361 return;
362
363 if (!should_enable_a11y ())358 if (!should_enable_a11y ())
364 return;359 return;
365360