Merge lp:~rodrigo-moya/unity/add-panel-service-a11y into lp:unity

Proposed by Rodrigo Moya
Status: Merged
Approved by: Rodrigo Moya
Approved revision: no longer in the source branch.
Merged at revision: 812
Proposed branch: lp:~rodrigo-moya/unity/add-panel-service-a11y
Merge into: lp:unity
Diff against target: 718 lines (+633/-3)
10 files modified
services/CMakeLists.txt (+9/-1)
services/panel-a11y.c (+150/-0)
services/panel-a11y.h (+30/-0)
services/panel-indicator-accessible.c (+98/-0)
services/panel-indicator-accessible.h (+53/-0)
services/panel-main.c (+9/-2)
services/panel-root-accessible.c (+123/-0)
services/panel-root-accessible.h (+51/-0)
services/panel-util-accessible.c (+59/-0)
services/panel-util-accessible.h (+51/-0)
To merge this branch: bzr merge lp:~rodrigo-moya/unity/add-panel-service-a11y
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Alejandro Piñeiro (community) Approve
Review via email: mp+47840@code.launchpad.net

Description of the change

Add Util, Root and (beginning of) Indicators A11Y to panel service

To post a comment you must log in.
Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

154 + if (!a11y_initialized)
155 + {

I think that it is worth to check the opposite, return if a11y_initialized. That would avoid a indentation level (IMHO, code would be clearer).

164 + /* Restore environment to load AT bridge */
165 + g_unsetenv ("NO_AT_BRIDGE");
166 + g_unsetenv ("NO_GAIL");

Take into account that there are one case (!should_enable_a11y) where you don't restore the environment, *but*, you modify the environment alway. Sorry, I was the one that suggested to move that to just before the load bridge, but probably this should be done as the first thing, to ensure that you always restore the environment (although this would only be a problem if there are a process child of this service, unlikely).

299 + atk_object_set_name (accessible, _("An indicator")); /* FIXME */

Do you really thing that worths to add this temporal names. Are useful for testing during development, but not sure if it is worth on have that on the actual code. If in the end you remove it, you will not require this include:
240 +#include <glib/gi18n.h>

294 +static void
295 +panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data)
296 +{
297 + g_return_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (accessible));
298 +
299 + atk_object_set_name (accessible, _("An indicator")); /* FIXME */
300 + atk_object_set_role (accessible, ATK_ROLE_LABEL);
301 +
302 + ATK_OBJECT_CLASS (panel_indicator_accessible_parent_class)->initialize (accessible, data);

Although cally-root also calls the parent class initialize as the last thing, by default this should be done as the first thing of the initialize. Ie: imagine that the parent class also set a role, in that case that ATK_ROLE_LABEL would be unused.

508 + accessible->role = ATK_ROLE_APPLICATION;
509 + atk_object_set_name (accessible, _("Unity Panel Service"));

As the root represents the application I think that you should use the application name. Here you can use g_get_prgname(), like in gail or cally. I couldn't use that on Unity because I didn't found a equivalent to g_get_prgname to be used there (anyway, this is FIXME).

Some extra comments:

  * The indentation is somewhat weird. It seems that in some cases you have spaces and in other you have tabs, ie:
475 + atk_class->initialize = panel_root_accessible_initialize;
476 + atk_class->get_n_children = panel_root_accessible_get_n_children;
477 + atk_class->ref_child = panel_root_accessible_ref_child;
478 + atk_class->get_parent = panel_root_accessible_get_parent;

  * The way we reuse gail here is allow gtk_init to load gail but not the bridge, and then load the bridge. I don't like too much this mixed approach, as it could be prone-error (what would happen if for any reason gtk_init doesn't load the accessibility but panel-service yes, or the opposite). Taking into account the current wisdom (firefox and so on), probably we should do all the work. That means setting both NO_GAIL and NO_AT_BRIDGE, and then load by hand both gail and the bridge. But this could be done in a posterior task, but take that into account if you want to do that while solving the other issues.

review: Needs Fixing
Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

BTW, as this also touch panel-main.c code, probably you would require to add someone else to review the code.

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :
Download full text (3.7 KiB)

> 154 + if (!a11y_initialized)
> 155 + {
>
> I think that it is worth to check the opposite, return if a11y_initialized.
> That would avoid a indentation level (IMHO, code would be clearer).
>
fixed

> 164 + /* Restore environment to load AT bridge */
> 165 + g_unsetenv ("NO_AT_BRIDGE");
> 166 + g_unsetenv ("NO_GAIL");
>
> Take into account that there are one case (!should_enable_a11y) where you
> don't restore the environment, *but*, you modify the environment alway. Sorry,
> I was the one that suggested to move that to just before the load bridge, but
> probably this should be done as the first thing, to ensure that you always
> restore the environment (although this would only be a problem if there are a
> process child of this service, unlikely).
>
done

>
> 299 + atk_object_set_name (accessible, _("An indicator")); /* FIXME */
>
> Do you really thing that worths to add this temporal names. Are useful for
> testing during development, but not sure if it is worth on have that on the
> actual code. If in the end you remove it, you will not require this include:
> 240 +#include <glib/gi18n.h>
>
in the next branch I will remove that temporary code, with real code to return the indicators. So just added this so that it shows something in accerciser.

>
> 294 +static void
> 295 +panel_indicator_accessible_initialize (AtkObject *accessible,
> gpointer data)
> 296 +{
> 297 + g_return_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (accessible));
> 298 +
> 299 + atk_object_set_name (accessible, _("An indicator")); /* FIXME */
> 300 + atk_object_set_role (accessible, ATK_ROLE_LABEL);
> 301 +
> 302 + ATK_OBJECT_CLASS
> (panel_indicator_accessible_parent_class)->initialize (accessible, data);
>
> Although cally-root also calls the parent class initialize as the last thing,
> by default this should be done as the first thing of the initialize. Ie:
> imagine that the parent class also set a role, in that case that
> ATK_ROLE_LABEL would be unused.
>
right, fixed

>
> 508 + accessible->role = ATK_ROLE_APPLICATION;
> 509 + atk_object_set_name (accessible, _("Unity Panel Service"));
>
> As the root represents the application I think that you should use the
> application name. Here you can use g_get_prgname(), like in gail or cally. I
> couldn't use that on Unity because I didn't found a equivalent to
> g_get_prgname to be used there (anyway, this is FIXME).
>
ok, fixed

> Some extra comments:
>
> * The indentation is somewhat weird. It seems that in some cases you have
> spaces and in other you have tabs, ie:
> 475 + atk_class->initialize = panel_root_accessible_initialize;
> 476 + atk_class->get_n_children = panel_root_accessible_get_n_children;
> 477 + atk_class->ref_child = panel_root_accessible_ref_child;
> 478 + atk_class->get_parent = panel_root_accessible_get_parent;
>
yes, seems I got the format header wrong, so I've removed it from all the files and fixed (hopefully) all TABs

>
> * The way we reuse gail here is allow gtk_init to load gail but not the
> bridge, and then load the bridge. I don't like too much this mixed approach,
> as it could be pron...

Read more...

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> BTW, as this also touch panel-main.c code, probably you would require to add
> someone else to review the code.

yes, as soon as you approve all the A11Y part, I'll ask for a 2nd approval, so yeah, any other unity developer can have a look at this branch, please?

Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> > * The way we reuse gail here is allow gtk_init to load gail but not the
> > bridge, and then load the bridge. I don't like too much this mixed approach,
> > as it could be prone-error (what would happen if for any reason gtk_init
> > doesn't load the accessibility but panel-service yes, or the opposite).
> Taking
> > into account the current wisdom (firefox and so on), probably we should do
> all
> > the work. That means setting both NO_GAIL and NO_AT_BRIDGE, and then load by
> > hand both gail and the bridge. But this could be done in a posterior task,
> but
> > take that into account if you want to do that while solving the other
> issues.
> >
> ok, file a bug for that and assign it to me and I'll work on that on another
> branch

Ok, I will do that.

And as you changed the rest of the things, and I have just tested it, it seems ok for me.

Just a nitpick:

390 +#include <string.h>

Why do you require this new include?

review: Approve
Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> > BTW, as this also touch panel-main.c code, probably you would require to add
> > someone else to review the code.
>
> yes, as soon as you approve all the A11Y part, I'll ask for a 2nd approval, so
> yeah, any other unity developer can have a look at this branch, please?

Alex Launi were reviewing my branches, although these days Loïc Molinari was also helping me with this kind of things.

You could try to ask them, or just ask David.

Revision history for this message
Alex Launi (alexlauni) wrote :

This looks pretty good to me.
But same question as Alejandro, why the added #include <string.h>. It doesn't look you add anything that uses string.h.

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 2010-11-29 12:02:39 +0000
+++ services/CMakeLists.txt 2011-01-31 21:55:43 +0000
@@ -24,9 +24,17 @@
24link_directories(${LIB_PATHS})24link_directories(${LIB_PATHS})
2525
26add_executable(unity-panel-service26add_executable(unity-panel-service
27 panel-a11y.c
28 panel-a11y.h
29 panel-indicator-accessible.c
30 panel-indicator-accessible.h
27 panel-main.c31 panel-main.c
32 panel-root-accessible.c
33 panel-root-accessible.h
28 panel-service.c34 panel-service.c
29 panel-service.h 35 panel-service.h
36 panel-util-accessible.c
37 panel-util-accessible.h
30 )38 )
31install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/)39install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/)
3240
3341
=== added file 'services/panel-a11y.c'
--- services/panel-a11y.c 1970-01-01 00:00:00 +0000
+++ services/panel-a11y.c 2011-01-31 21:55:43 +0000
@@ -0,0 +1,150 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#include <gio/gio.h>
20#include "panel-a11y.h"
21#include "panel-util-accessible.h"
22
23static gboolean a11y_initialized = FALSE;
24
25#define INIT_METHOD "gnome_accessibility_module_init"
26#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
27#define ACCESSIBILITY_ENABLED_KEY "accessibility"
28#define AT_SPI_SCHEMA "org.a11y.atspi"
29#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
30
31static gboolean
32has_gsettings_schema (const gchar *schema)
33{
34 const char * const *list_schemas = NULL;
35 gboolean found = FALSE;
36 int i = 0;
37
38 /* we need to check if AT_SPI_SCHEMA is present as g_settings_new
39 could abort if the schema is not here*/
40 list_schemas = g_settings_list_schemas ();
41 for (i = 0; list_schemas [i]; i++)
42 {
43 if (!g_strcmp0 (list_schemas[i], schema))
44 {
45 found = TRUE;
46 break;
47 }
48 }
49
50 return found;
51}
52
53static gboolean
54should_enable_a11y (void)
55{
56 GSettings *desktop_settings = NULL;
57 gboolean value = FALSE;
58
59 if (!has_gsettings_schema (DESKTOP_SCHEMA))
60 return FALSE;
61
62 desktop_settings = g_settings_new (DESKTOP_SCHEMA);
63 value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
64
65 g_object_unref (desktop_settings);
66
67 return value;
68}
69
70static gchar*
71get_atk_bridge_path (void)
72{
73 GSettings *atspi_settings = NULL;
74 char *value = NULL;
75
76 if (!has_gsettings_schema (AT_SPI_SCHEMA))
77 return NULL;
78
79 atspi_settings = g_settings_new (AT_SPI_SCHEMA);
80 value = g_settings_get_string (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
81
82 g_object_unref (atspi_settings);
83
84 return value;
85}
86
87static gboolean
88a11y_invoke_module (const char *module_path)
89{
90 GModule *handle;
91 void (*invoke_fn) (void);
92
93 if (!module_path)
94 {
95 g_warning ("Accessibility: invalid module path (NULL)");
96
97 return FALSE;
98 }
99
100 if (!(handle = g_module_open (module_path, (GModuleFlags)0)))
101 {
102 g_warning ("Accessibility: failed to load module '%s': '%s'",
103 module_path, g_module_error ());
104
105 return FALSE;
106 }
107
108 if (!g_module_symbol (handle, INIT_METHOD, (gpointer *)&invoke_fn))
109 {
110 g_warning ("Accessibility: error library '%s' does not include "
111 "method '%s' required for accessibility support",
112 module_path, INIT_METHOD);
113 g_module_close (handle);
114
115 return FALSE;
116 }
117
118 invoke_fn ();
119
120 return TRUE;
121}
122
123void
124panel_a11y_init (void)
125{
126 gchar *bridge_path = NULL;
127
128 if (a11y_initialized)
129 return;
130
131 /* Restore environment to load AT bridge */
132 g_unsetenv ("NO_AT_BRIDGE");
133 g_unsetenv ("NO_GAIL");
134
135 if (!should_enable_a11y ())
136 return;
137
138 /* Load PanelUtilAccessible class */
139 g_type_class_unref (g_type_class_ref (PANEL_TYPE_UTIL_ACCESSIBLE));
140
141 bridge_path = get_atk_bridge_path ();
142 if (a11y_invoke_module (bridge_path))
143 {
144 g_debug ("Unity accessibility started, using bridge on %s", bridge_path);
145 }
146
147 g_free (bridge_path);
148
149 a11y_initialized = TRUE;
150}
0151
=== added file 'services/panel-a11y.h'
--- services/panel-a11y.h 1970-01-01 00:00:00 +0000
+++ services/panel-a11y.h 2011-01-31 21:55:43 +0000
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#ifndef _PANEL_A11Y_H_
20#define _PANEL_A11Y_H_
21
22#include <glib-object.h>
23
24G_BEGIN_DECLS
25
26void panel_a11y_init (void);
27
28G_END_DECLS
29
30#endif
031
=== added file 'services/panel-indicator-accessible.c'
--- services/panel-indicator-accessible.c 1970-01-01 00:00:00 +0000
+++ services/panel-indicator-accessible.c 2011-01-31 21:55:43 +0000
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#include <glib/gi18n.h>
20#include "panel-indicator-accessible.h"
21
22G_DEFINE_TYPE(PanelIndicatorAccessible, panel_indicator_accessible, ATK_TYPE_OBJECT)
23
24#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessiblePrivate))
25
26/* AtkObject methods */
27static void panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data);
28static gint panel_indicator_accessible_get_n_children (AtkObject *accessible);
29static AtkObject *panel_indicator_accessible_ref_child (AtkObject *accessible, gint i);
30
31struct _PanelIndicatorAccessiblePrivate
32{
33};
34
35static void
36panel_indicator_accessible_class_init (PanelIndicatorAccessibleClass *klass)
37{
38 GObjectClass *object_class;
39 AtkObjectClass *atk_class;
40
41 /* GObject */
42 object_class = G_OBJECT_CLASS (klass);
43
44 /* AtkObject */
45 atk_class = ATK_OBJECT_CLASS (klass);
46 atk_class->initialize = panel_indicator_accessible_initialize;
47 atk_class->get_n_children = panel_indicator_accessible_get_n_children;
48 atk_class->ref_child = panel_indicator_accessible_ref_child;
49
50 g_type_class_add_private (object_class, sizeof (PanelIndicatorAccessiblePrivate));
51}
52
53static void
54panel_indicator_accessible_init (PanelIndicatorAccessible *pia)
55{
56 pia->priv = GET_PRIVATE (pia);
57}
58
59AtkObject *
60panel_indicator_accessible_new (void)
61{
62 AtkObject *accessible;
63
64 accessible = ATK_OBJECT (g_object_new (PANEL_TYPE_INDICATOR_ACCESSIBLE, NULL));
65
66 atk_object_initialize (accessible, NULL);
67
68 return accessible;
69}
70
71/* Implementation of AtkObject methods */
72
73static void
74panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data)
75{
76 g_return_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (accessible));
77
78 ATK_OBJECT_CLASS (panel_indicator_accessible_parent_class)->initialize (accessible, data);
79
80 atk_object_set_name (accessible, _("An indicator")); /* FIXME */
81 atk_object_set_role (accessible, ATK_ROLE_LABEL);
82}
83
84static gint
85panel_indicator_accessible_get_n_children (AtkObject *accessible)
86{
87 g_return_val_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (accessible), 0);
88
89 return 0;
90}
91
92static AtkObject *
93panel_indicator_accessible_ref_child (AtkObject *accessible, gint i)
94{
95 g_return_val_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (accessible), NULL);
96
97 return NULL;
98}
099
=== added file 'services/panel-indicator-accessible.h'
--- services/panel-indicator-accessible.h 1970-01-01 00:00:00 +0000
+++ services/panel-indicator-accessible.h 2011-01-31 21:55:43 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#ifndef _PANEL_INDICATOR_ACCESSIBLE_H_
20#define _PANEL_INDICATOR_ACCESSIBLE_H_
21
22#include <atk/atk.h>
23
24G_BEGIN_DECLS
25
26#define PANEL_TYPE_INDICATOR_ACCESSIBLE (panel_indicator_accessible_get_type ())
27#define PANEL_INDICATOR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessible))
28#define PANEL_INDICATOR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessibleClass))
29#define PANEL_IS_INDICATOR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANEL_TYPE_INDICATOR_ACCESSIBLE))
30#define PANEL_IS_INDICATOR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_INDICATOR_ACCESSIBLE))
31#define PANEL_INDICATOR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessibleClass))
32
33typedef struct _PanelIndicatorAccessible PanelIndicatorAccessible;
34typedef struct _PanelIndicatorAccessibleClass PanelIndicatorAccessibleClass;
35typedef struct _PanelIndicatorAccessiblePrivate PanelIndicatorAccessiblePrivate;
36
37struct _PanelIndicatorAccessible
38{
39 AtkObject parent;
40 PanelIndicatorAccessiblePrivate *priv;
41};
42
43struct _PanelIndicatorAccessibleClass
44{
45 AtkObjectClass parent_class;
46};
47
48GType panel_indicator_accessible_get_type (void);
49AtkObject *panel_indicator_accessible_new (void);
50
51G_END_DECLS
52
53#endif
054
=== modified file 'services/panel-main.c'
--- services/panel-main.c 2011-01-11 15:48:03 +0000
+++ services/panel-main.c 2011-01-31 21:55:43 +0000
@@ -1,3 +1,4 @@
1// -*- Mode: C; tab-width:2; indent-tabs-mode: t; c-basic-offset: 2 -*-
1/*2/*
2 * Copyright (C) 2010 Canonical Ltd3 * Copyright (C) 2010 Canonical Ltd
3 *4 *
@@ -14,12 +15,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *16 *
16 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>17 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
18 * Rodrigo Moya <rodrigo.moya@canonical.com>
17 */19 */
1820
19#include <glib.h>21#include <glib.h>
20#include <gio/gio.h>22#include <gio/gio.h>
21#include <gtk/gtk.h>23#include <gtk/gtk.h>
2224
25#include "panel-a11y.h"
23#include "panel-service.h"26#include "panel-service.h"
2427
25static GDBusNodeInfo *introspection_data = NULL;28static GDBusNodeInfo *introspection_data = NULL;
@@ -299,10 +302,14 @@
299 guint owner_id;302 guint owner_id;
300303
301 g_unsetenv("UBUNTU_MENUPROXY");304 g_unsetenv("UBUNTU_MENUPROXY");
305 g_setenv ("NO_AT_BRIDGE", "1", TRUE);
306 g_unsetenv ("NO_GAIL");
302307
303 gtk_init (&argc, &argv);308 gtk_init (&argc, &argv);
304 gtk_icon_theme_append_search_path (gtk_icon_theme_get_default(),309 gtk_icon_theme_append_search_path (gtk_icon_theme_get_default(),
305 INDICATORICONDIR);310 INDICATORICONDIR);
311
312 panel_a11y_init ();
306313
307 introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);314 introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
308 g_assert (introspection_data != NULL);315 g_assert (introspection_data != NULL);
309316
=== added file 'services/panel-root-accessible.c'
--- services/panel-root-accessible.c 1970-01-01 00:00:00 +0000
+++ services/panel-root-accessible.c 2011-01-31 21:55:43 +0000
@@ -0,0 +1,123 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#include <glib/gi18n.h>
20#include "panel-indicator-accessible.h"
21#include "panel-root-accessible.h"
22#include "panel-service.h"
23
24G_DEFINE_TYPE(PanelRootAccessible, panel_root_accessible, ATK_TYPE_OBJECT)
25
26#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_ROOT_ACCESSIBLE, PanelRootAccessiblePrivate))
27
28/* AtkObject methods */
29static void panel_root_accessible_initialize (AtkObject *accessible, gpointer data);
30static gint panel_root_accessible_get_n_children (AtkObject *accessible);
31static AtkObject *panel_root_accessible_ref_child (AtkObject *accessible, gint i);
32static AtkObject *panel_root_accessible_get_parent (AtkObject *accessible);
33
34struct _PanelRootAccessiblePrivate
35{
36};
37
38static void
39panel_root_accessible_class_init (PanelRootAccessibleClass *klass)
40{
41 GObjectClass *object_class;
42 AtkObjectClass *atk_class;
43
44 /* GObject */
45 object_class = G_OBJECT_CLASS (klass);
46
47 /* AtkObject */
48 atk_class = ATK_OBJECT_CLASS (klass);
49 atk_class->initialize = panel_root_accessible_initialize;
50 atk_class->get_n_children = panel_root_accessible_get_n_children;
51 atk_class->ref_child = panel_root_accessible_ref_child;
52 atk_class->get_parent = panel_root_accessible_get_parent;
53
54 g_type_class_add_private (object_class, sizeof (PanelRootAccessiblePrivate));
55}
56
57static void
58panel_root_accessible_init (PanelRootAccessible *root)
59{
60 root->priv = GET_PRIVATE (root);
61}
62
63AtkObject *
64panel_root_accessible_new (void)
65{
66 AtkObject *accessible;
67
68 accessible = ATK_OBJECT (g_object_new (PANEL_TYPE_ROOT_ACCESSIBLE, NULL));
69 atk_object_initialize (accessible, NULL);
70
71 return accessible;
72}
73
74/* Implementation of AtkObject methods */
75
76static void
77panel_root_accessible_initialize (AtkObject *accessible, gpointer data)
78{
79 g_return_if_fail (PANEL_IS_ROOT_ACCESSIBLE (accessible));
80
81 ATK_OBJECT_CLASS (panel_root_accessible_parent_class)->initialize (accessible, data);
82
83 accessible->role = ATK_ROLE_APPLICATION;
84 atk_object_set_name (accessible, g_get_prgname ());
85 atk_object_set_parent (accessible, NULL);
86}
87
88static gint
89panel_root_accessible_get_n_children (AtkObject *accessible)
90{
91 guint n_children;
92
93 g_return_val_if_fail (PANEL_IS_ROOT_ACCESSIBLE (accessible), 0);
94
95 n_children = panel_service_get_n_indicators (panel_service_get_default ());
96
97 g_debug ("PanelRootAccessible has %d children", n_children);
98
99 return n_children;
100}
101
102static AtkObject *
103panel_root_accessible_ref_child (AtkObject *accessible, gint i)
104{
105 AtkObject *child;
106
107 g_return_val_if_fail (PANEL_IS_ROOT_ACCESSIBLE (accessible), NULL);
108
109 child = panel_indicator_accessible_new (); /* FIXME */
110 atk_object_set_parent (child, accessible);
111
112 g_debug ("Returning ATK child %p", child);
113
114 return child;
115}
116
117static AtkObject *
118panel_root_accessible_get_parent (AtkObject *accessible)
119{
120 g_return_val_if_fail (PANEL_IS_ROOT_ACCESSIBLE (accessible), NULL);
121
122 return NULL;
123}
0124
=== added file 'services/panel-root-accessible.h'
--- services/panel-root-accessible.h 1970-01-01 00:00:00 +0000
+++ services/panel-root-accessible.h 2011-01-31 21:55:43 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#ifndef _PANEL_ROOT_ACCESSIBLE_H_
20#define _PANEL_ROOT_ACCESSIBLE_H_
21
22#include <atk/atk.h>
23
24G_BEGIN_DECLS
25
26#define PANEL_TYPE_ROOT_ACCESSIBLE (panel_root_accessible_get_type ())
27#define PANEL_ROOT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_ROOT_ACCESSIBLE, PanelRootAccessible))
28#define PANEL_ROOT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANEL_TYPE_ROOT_ACCESSIBLE, PanelRootAccessibleClass))
29#define PANEL_IS_ROOT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANEL_TYPE_ROOT_ACCESSIBLE))
30#define PANEL_IS_ROOT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_ROOT_ACCESSIBLE))
31#define PANEL_ROOT_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_ROOT_ACCESSIBLE, PanelRootAccessibleClass))
32
33typedef struct _PanelRootAccessible PanelRootAccessible;
34typedef struct _PanelRootAccessibleClass PanelRootAccessibleClass;
35typedef struct _PanelRootAccessiblePrivate PanelRootAccessiblePrivate;
36
37struct _PanelRootAccessible
38{
39 AtkObject parent;
40 PanelRootAccessiblePrivate *priv;
41};
42
43struct _PanelRootAccessibleClass
44{
45 AtkObjectClass parent_class;
46};
47
48GType panel_root_accessible_get_type (void);
49AtkObject *panel_root_accessible_new (void);
50
51#endif
052
=== added file 'services/panel-util-accessible.c'
--- services/panel-util-accessible.c 1970-01-01 00:00:00 +0000
+++ services/panel-util-accessible.c 2011-01-31 21:55:43 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#include "panel-root-accessible.h"
20#include "panel-util-accessible.h"
21
22G_DEFINE_TYPE(PanelUtilAccessible, panel_util_accessible, ATK_TYPE_UTIL)
23
24/* AtkUtil methods */
25static AtkObject *panel_util_accessible_get_root (void);
26
27static AtkObject *root = NULL;
28
29/* GObject methods implementation */
30
31static void
32panel_util_accessible_class_init (PanelUtilAccessibleClass *klass)
33{
34 AtkUtilClass *atk_class;
35
36 g_debug ("Initializing PanelUtilAccessible class");
37
38 /* AtkUtil */
39 atk_class = g_type_class_peek (ATK_TYPE_UTIL);
40 atk_class->get_root = panel_util_accessible_get_root;
41}
42
43static void
44panel_util_accessible_init (PanelUtilAccessible *panel_util)
45{
46}
47
48/* AtkUtil methods implementation */
49
50static AtkObject *
51panel_util_accessible_get_root (void)
52{
53 if (!root)
54 root = panel_root_accessible_new ();
55
56 g_debug ("Returning root A11Y object at %p", root);
57
58 return root;
59}
060
=== added file 'services/panel-util-accessible.h'
--- services/panel-util-accessible.h 1970-01-01 00:00:00 +0000
+++ services/panel-util-accessible.h 2011-01-31 21:55:43 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17 */
18
19#ifndef _PANEL_UTIL_ACCESSIBLE_H_
20#define _PANEL_UTIL_ACCESSIBLE_H_
21
22#include <atk/atk.h>
23
24G_BEGIN_DECLS
25
26#define PANEL_TYPE_UTIL_ACCESSIBLE (panel_util_accessible_get_type ())
27
28#define PANEL_UTIL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_UTIL_ACCESSIBLE, PanelUtilAccessible))
29#define PANEL_UTIL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANEL_TYPE_UTIL_ACCESSIBLE, PanelUtilAccessibleClass))
30#define PANEL_IS_UTIL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANEL_TYPE_UTIL_ACCESSIBLE))
31#define PANEL_IS_UTIL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_UTIL_ACCESSIBLE))
32#define PANEL_UTIL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_UTIL_ACCESSIBLE, PanelUtilAccessibleClass))
33
34typedef struct _PanelUtilAccessible PanelUtilAccessible;
35typedef struct _PanelUtilAccessibleClass PanelUtilAccessibleClass;
36
37struct _PanelUtilAccessible
38{
39 AtkUtil parent;
40};
41
42struct _PanelUtilAccessibleClass
43{
44 AtkUtilClass parent_class;
45};
46
47GType panel_util_accessible_get_type (void);
48
49G_END_DECLS
50
51#endif