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

Proposed by Rodrigo Moya
Status: Merged
Approved by: Neil J. Patel
Approved revision: no longer in the source branch.
Merged at revision: 858
Proposed branch: lp:~rodrigo-moya/unity/panel-a11y
Merge into: lp:unity
Diff against target: 627 lines (+425/-52)
13 files modified
src/PanelHomeButton.cpp (+2/-0)
src/PanelHomeButton.h (+1/-0)
src/PanelView.cpp (+2/-0)
src/PanelView.h (+1/-0)
src/WindowButtons.h (+1/-0)
src/unity-launcher-accessible.cpp (+3/-3)
src/unity-panel-home-button-accessible.cpp (+92/-0)
src/unity-panel-home-button-accessible.h (+57/-0)
src/unity-panel-view-accessible.cpp (+145/-0)
src/unity-panel-view-accessible.h (+57/-0)
src/unity-util-accessible.cpp (+49/-49)
src/unitya11y.cpp (+9/-0)
src/unityshell.cpp (+6/-0)
To merge this branch: bzr merge lp:~rodrigo-moya/unity/panel-a11y
Reviewer Review Type Date Requested Status
Alejandro Piñeiro (community) Approve
Review via email: mp+49387@code.launchpad.net

Description of the change

Resurrect this branch to fix bug #715295 ("expose panel home button as the only child for the panel in unity". This adds ATK support for the PanelView and PanelHomeButton classes, which need to be exposed on a "mini-panel" object, given the rest of the contents in the panel (i.e. indicators) are exposed in the panel service process, which doesn't have access to the PanelView and PanelHomeButton objects in unity.

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

21 + NUX_DECLARE_OBJECT_TYPE (Launcher, nux::TextureArea);

You mean NUX_DECLARE_OBJECT_TYPE (PanelHomeButton, nux::TextureArea)?

46 + NUX_DECLARE_OBJECT_TYPE (LauncherIcon, nux::View);

You mean NUX_DECLARE_OBJECT_TYPE (PanelView, nux::View) ?

69 /**
70 - * SECTION:nux-view-accessible
71 - * @Title: NuxViewAccessible
72 + * SECTION:unity-launcher-accessible
73 + * @Title: UnityLauncherAccessible
74 * @short_description: Implementation of the ATK interfaces for #Launcher
75 * @see_also: Launcher
76 *
77 - * #NuxViewAccessible implements the required ATK interfaces for
78 + * #UnityLauncherAccessible implements the required ATK interfaces for
79 * #Launcher, ie: exposing the different LauncherIcon on the model as
80 * #child of the object.

I would prefer to fix this launcher related task in a launcher related merge. But not a big deal anyway.

149 + atk_class->get_n_children = unity_panel_home_button_accessible_get_n_children;
150 + atk_class->ref_child = unity_panel_home_button_accessible_ref_child;

I don't understand why you provide a dummy implementation for these methods. AFAIK, the home button will not have any child, but probably I'm wrong. What missed object(s) will be the children of the panel home button?

For the same, I wouldn't include those changes on root-accessible and util-accessible here (they add noise here)

357 + atk_object_set_name (accessible, _("Panel"));

This is a useless name, taking into account that the role is ATK_ROLE_PANEL

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

BTW, one of the interfaces that fits here is AtkAction, as it is a button. Something like actions "press", "release", "click", although probably it would be good to implement that on other bug/merge

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

> 21 + NUX_DECLARE_OBJECT_TYPE (Launcher, nux::TextureArea);
>
> You mean NUX_DECLARE_OBJECT_TYPE (PanelHomeButton, nux::TextureArea)?
>
> 46 + NUX_DECLARE_OBJECT_TYPE (LauncherIcon, nux::View);
>
> You mean NUX_DECLARE_OBJECT_TYPE (PanelView, nux::View) ?
>
right, C&P problem, fixed now

>
> 69 /**
> 70 - * SECTION:nux-view-accessible
> 71 - * @Title: NuxViewAccessible
> 72 + * SECTION:unity-launcher-accessible
> 73 + * @Title: UnityLauncherAccessible
> 74 * @short_description: Implementation of the ATK interfaces for
> #Launcher
> 75 * @see_also: Launcher
> 76 *
> 77 - * #NuxViewAccessible implements the required ATK interfaces for
> 78 + * #UnityLauncherAccessible implements the required ATK interfaces
> for
> 79 * #Launcher, ie: exposing the different LauncherIcon on the model as
> 80 * #child of the object.
>
> I would prefer to fix this launcher related task in a launcher related merge.
> But not a big deal anyway.
>
yes, might make sense in a launcher branch, but not a big deal, as you said.

> 149 + atk_class->get_n_children =
> unity_panel_home_button_accessible_get_n_children;
> 150 + atk_class->ref_child = unity_panel_home_button_accessible_ref_child;
>
> I don't understand why you provide a dummy implementation for these methods.
> AFAIK, the home button will not have any child, but probably I'm wrong. What
> missed object(s) will be the children of the panel home button?
>
no children for the home button. I added the 2 methods because I thought it was going to return the NuxViewAccessible children, but that's not the case, so removed those 2 methods

> For the same, I wouldn't include those changes on root-accessible and util-
> accessible here (they add noise here)
>
> 357 + atk_object_set_name (accessible, _("Panel"));
>
> This is a useless name, taking into account that the role is ATK_ROLE_PANEL
>
ok, changed it to "Unity Panel", is that ok?

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

Code seems OK, and I have just tested it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelHomeButton.cpp'
2--- src/PanelHomeButton.cpp 2011-02-02 23:14:25 +0000
3+++ src/PanelHomeButton.cpp 2011-02-14 16:44:32 +0000
4@@ -35,6 +35,8 @@
5 #define PANEL_HEIGHT 24
6 #define BUTTON_WIDTH 66
7
8+NUX_IMPLEMENT_OBJECT_TYPE (PanelHomeButton);
9+
10 PanelHomeButton::PanelHomeButton ()
11 : TextureArea (NUX_TRACKER_LOCATION),
12 _util_cg (CAIRO_FORMAT_ARGB32, BUTTON_WIDTH, PANEL_HEIGHT)
13
14=== modified file 'src/PanelHomeButton.h'
15--- src/PanelHomeButton.h 2011-02-02 23:14:25 +0000
16+++ src/PanelHomeButton.h 2011-02-14 16:44:32 +0000
17@@ -29,6 +29,7 @@
18
19 class PanelHomeButton : public nux::TextureArea, public Introspectable
20 {
21+ NUX_DECLARE_OBJECT_TYPE (PanelHomeButton, nux::TextureArea);
22 public:
23 PanelHomeButton ();
24 ~PanelHomeButton ();
25
26=== modified file 'src/PanelView.cpp'
27--- src/PanelView.cpp 2011-01-20 17:32:47 +0000
28+++ src/PanelView.cpp 2011-02-14 16:44:32 +0000
29@@ -36,6 +36,8 @@
30 #include "IndicatorObjectFactoryRemote.h"
31 #include "PanelIndicatorObjectView.h"
32
33+NUX_IMPLEMENT_OBJECT_TYPE (PanelView);
34+
35 PanelView::PanelView (NUX_FILE_LINE_DECL)
36 : View (NUX_FILE_LINE_PARAM)
37 {
38
39=== modified file 'src/PanelView.h'
40--- src/PanelView.h 2010-12-17 14:07:11 +0000
41+++ src/PanelView.h 2011-02-14 16:44:32 +0000
42@@ -31,6 +31,7 @@
43
44 class PanelView : public Introspectable, public nux::View
45 {
46+ NUX_DECLARE_OBJECT_TYPE (PanelView, nux::View);
47 public:
48 PanelView (NUX_FILE_LINE_PROTO);
49 ~PanelView ();
50
51=== modified file 'src/WindowButtons.h'
52--- src/WindowButtons.h 2010-12-17 08:14:30 +0000
53+++ src/WindowButtons.h 2011-02-14 16:44:32 +0000
54@@ -19,6 +19,7 @@
55 #ifndef WINDOW_BUTTONS_H
56 #define WINDOW_BUTTONS_H
57
58+#include <Nux/HLayout.h>
59 #include <Nux/View.h>
60
61 #include "Introspectable.h"
62
63=== modified file 'src/unity-launcher-accessible.cpp'
64--- src/unity-launcher-accessible.cpp 2011-01-13 01:59:18 +0000
65+++ src/unity-launcher-accessible.cpp 2011-02-14 16:44:32 +0000
66@@ -17,12 +17,12 @@
67 */
68
69 /**
70- * SECTION:nux-view-accessible
71- * @Title: NuxViewAccessible
72+ * SECTION:unity-launcher-accessible
73+ * @Title: UnityLauncherAccessible
74 * @short_description: Implementation of the ATK interfaces for #Launcher
75 * @see_also: Launcher
76 *
77- * #NuxViewAccessible implements the required ATK interfaces for
78+ * #UnityLauncherAccessible implements the required ATK interfaces for
79 * #Launcher, ie: exposing the different LauncherIcon on the model as
80 * #child of the object.
81 *
82
83=== added file 'src/unity-panel-home-button-accessible.cpp'
84--- src/unity-panel-home-button-accessible.cpp 1970-01-01 00:00:00 +0000
85+++ src/unity-panel-home-button-accessible.cpp 2011-02-14 16:44:32 +0000
86@@ -0,0 +1,92 @@
87+/*
88+ * Copyright (C) 2011 Canonical Ltd
89+ *
90+ * This program is free software: you can redistribute it and/or modify
91+ * it under the terms of the GNU General Public License version 3 as
92+ * published by the Free Software Foundation.
93+ *
94+ * This program is distributed in the hope that it will be useful,
95+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
96+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97+ * GNU General Public License for more details.
98+ *
99+ * You should have received a copy of the GNU General Public License
100+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
101+ *
102+ * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
103+ */
104+
105+/**
106+ * SECTION:unity-panel-home-button-accessible
107+ * @Title: UnityPanelHomeButtonAccessible
108+ * @short_description: Implementation of the ATK interfaces for #PanelHomeButton
109+ * @see_also: PanelHomeButton
110+ *
111+ * #UnityPanelHomeButtonAccessible implements the required ATK interfaces for
112+ * #PanelHomeButton.
113+ *
114+ */
115+
116+#include <glib/gi18n-lib.h>
117+#include <Nux/Nux.h>
118+#include "PanelHomeButton.h"
119+#include "unity-panel-home-button-accessible.h"
120+
121+#include "unitya11y.h"
122+
123+/* GObject */
124+static void unity_panel_home_button_accessible_class_init (UnityPanelHomeButtonAccessibleClass *klass);
125+static void unity_panel_home_button_accessible_init (UnityPanelHomeButtonAccessible *self);
126+
127+/* AtkObject */
128+static void unity_panel_home_button_accessible_initialize (AtkObject *accessible, gpointer data);
129+
130+#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_PRIVATE(obj) \
131+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessiblePrivate))
132+
133+G_DEFINE_TYPE (UnityPanelHomeButtonAccessible, unity_panel_home_button_accessible, NUX_TYPE_VIEW_ACCESSIBLE)
134+
135+struct _UnityPanelHomeButtonAccessiblePrivate
136+{
137+};
138+
139+static void
140+unity_panel_home_button_accessible_class_init (UnityPanelHomeButtonAccessibleClass *klass)
141+{
142+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
143+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
144+
145+ /* AtkObject */
146+ atk_class->initialize = unity_panel_home_button_accessible_initialize;
147+
148+ g_type_class_add_private (gobject_class, sizeof (UnityPanelHomeButtonAccessiblePrivate));
149+}
150+
151+static void
152+unity_panel_home_button_accessible_init (UnityPanelHomeButtonAccessible *self)
153+{
154+ self->priv = UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_PRIVATE (self);
155+}
156+
157+AtkObject *
158+unity_panel_home_button_accessible_new (nux::Object *object)
159+{
160+ AtkObject *accessible;
161+
162+ g_return_val_if_fail (dynamic_cast<PanelHomeButton *>(object), NULL);
163+
164+ accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, NULL));
165+
166+ atk_object_initialize (accessible, object);
167+
168+ return accessible;
169+}
170+
171+static void
172+unity_panel_home_button_accessible_initialize (AtkObject *accessible, gpointer data)
173+{
174+ ATK_OBJECT_CLASS (unity_panel_home_button_accessible_parent_class)->initialize (accessible, data);
175+
176+ accessible->role = ATK_ROLE_PUSH_BUTTON;
177+ atk_object_set_name (accessible, _("Home Button"));
178+}
179
180=== added file 'src/unity-panel-home-button-accessible.h'
181--- src/unity-panel-home-button-accessible.h 1970-01-01 00:00:00 +0000
182+++ src/unity-panel-home-button-accessible.h 2011-02-14 16:44:32 +0000
183@@ -0,0 +1,57 @@
184+/*
185+ * Copyright (C) 2011 Canonical Ltd
186+ *
187+ * This program is free software: you can redistribute it and/or modify
188+ * it under the terms of the GNU General Public License version 3 as
189+ * published by the Free Software Foundation.
190+ *
191+ * This program is distributed in the hope that it will be useful,
192+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
193+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194+ * GNU General Public License for more details.
195+ *
196+ * You should have received a copy of the GNU General Public License
197+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
198+ *
199+ * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
200+ */
201+
202+#ifndef UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_H
203+#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_H
204+
205+#include <atk/atk.h>
206+
207+#include "nux-view-accessible.h"
208+
209+G_BEGIN_DECLS
210+
211+#define UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE (unity_panel_home_button_accessible_get_type ())
212+#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessible))
213+#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessibleClass))
214+#define UNITY_IS_PANEL_HOME_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE))
215+#define UNITY_IS_PANEL_HOME_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE))
216+#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessibleClass))
217+
218+typedef struct _UnityPanelHomeButtonAccessible UnityPanelHomeButtonAccessible;
219+typedef struct _UnityPanelHomeButtonAccessibleClass UnityPanelHomeButtonAccessibleClass;
220+typedef struct _UnityPanelHomeButtonAccessiblePrivate UnityPanelHomeButtonAccessiblePrivate;
221+
222+struct _UnityPanelHomeButtonAccessible
223+{
224+ NuxViewAccessible parent;
225+
226+ /* < private > */
227+ UnityPanelHomeButtonAccessiblePrivate *priv;
228+};
229+
230+struct _UnityPanelHomeButtonAccessibleClass
231+{
232+ NuxViewAccessibleClass parent_class;
233+};
234+
235+GType unity_panel_home_button_accessible_get_type (void);
236+AtkObject *unity_panel_home_button_accessible_new (nux::Object *object);
237+
238+G_END_DECLS
239+
240+#endif
241
242=== added file 'src/unity-panel-view-accessible.cpp'
243--- src/unity-panel-view-accessible.cpp 1970-01-01 00:00:00 +0000
244+++ src/unity-panel-view-accessible.cpp 2011-02-14 16:44:32 +0000
245@@ -0,0 +1,145 @@
246+/*
247+ * Copyright (C) 2011 Canonical Ltd
248+ *
249+ * This program is free software: you can redistribute it and/or modify
250+ * it under the terms of the GNU General Public License version 3 as
251+ * published by the Free Software Foundation.
252+ *
253+ * This program is distributed in the hope that it will be useful,
254+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
255+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
256+ * GNU General Public License for more details.
257+ *
258+ * You should have received a copy of the GNU General Public License
259+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
260+ *
261+ * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
262+ */
263+
264+/**
265+ * SECTION:unity-panel-view-accessible
266+ * @Title: UnityPanelViewAccessible
267+ * @short_description: Implementation of the ATK interfaces for #PanelView
268+ * @see_also: PanelView
269+ *
270+ * #UnityPanelViewAccessible implements the required ATK interfaces for
271+ * #PanelView, ie: exposing the different items contained in the panel
272+ * as children.
273+ *
274+ */
275+
276+#include <glib/gi18n-lib.h>
277+#include <Nux/Nux.h>
278+#include "PanelView.h"
279+#include "unity-panel-view-accessible.h"
280+
281+#include "unitya11y.h"
282+
283+/* GObject */
284+static void unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass);
285+static void unity_panel_view_accessible_init (UnityPanelViewAccessible *self);
286+
287+/* AtkObject */
288+static void unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data);
289+static gint unity_panel_view_accessible_get_n_children (AtkObject *accessible);
290+static AtkObject *unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i);
291+
292+#define UNITY_PANEL_VIEW_ACCESSIBLE_GET_PRIVATE(obj) \
293+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessiblePrivate))
294+
295+G_DEFINE_TYPE (UnityPanelViewAccessible, unity_panel_view_accessible, NUX_TYPE_VIEW_ACCESSIBLE)
296+
297+struct _UnityPanelViewAccessiblePrivate
298+{
299+};
300+
301+static void
302+unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass)
303+{
304+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
305+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
306+
307+ /* AtkObject */
308+ atk_class->initialize = unity_panel_view_accessible_initialize;
309+ atk_class->get_n_children = unity_panel_view_accessible_get_n_children;
310+ atk_class->ref_child = unity_panel_view_accessible_ref_child;
311+
312+ g_type_class_add_private (gobject_class, sizeof (UnityPanelViewAccessiblePrivate));
313+}
314+
315+static void
316+unity_panel_view_accessible_init (UnityPanelViewAccessible *self)
317+{
318+ self->priv = UNITY_PANEL_VIEW_ACCESSIBLE_GET_PRIVATE (self);
319+}
320+
321+AtkObject *
322+unity_panel_view_accessible_new (nux::Object *object)
323+{
324+ AtkObject *accessible;
325+
326+ g_return_val_if_fail (dynamic_cast<PanelView *>(object), NULL);
327+
328+ accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, NULL));
329+
330+ atk_object_initialize (accessible, object);
331+
332+ return accessible;
333+}
334+
335+static void
336+unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data)
337+{
338+ ATK_OBJECT_CLASS (unity_panel_view_accessible_parent_class)->initialize (accessible, data);
339+
340+ accessible->role = ATK_ROLE_PANEL;
341+}
342+
343+static gint
344+unity_panel_view_accessible_get_n_children (AtkObject *accessible)
345+{
346+ nux::Object *nux_object = NULL;
347+ PanelView *panel;
348+ PanelHomeButton *home_button;
349+ gint rc = 0;
350+
351+ g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), 0);
352+
353+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible));
354+ if (!nux_object) /* state is defunct */
355+ return 0;
356+
357+ panel = dynamic_cast<PanelView *>(nux_object);
358+ if ((home_button = panel->HomeButton ()) != NULL)
359+ rc = 1;
360+
361+ return rc;
362+}
363+
364+static AtkObject *
365+unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i)
366+{
367+ nux::Object *nux_object = NULL;
368+ PanelView *panel;
369+ PanelHomeButton *home_button;
370+ AtkObject *child_accessible = NULL;
371+
372+ g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), NULL);
373+
374+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible));
375+ if (!nux_object) /* state is defunct */
376+ return NULL;
377+
378+ panel = dynamic_cast<PanelView *>(nux_object);
379+ if ((home_button = panel->HomeButton ()) != NULL)
380+ {
381+ nux::Object *child = NULL;
382+
383+ child = dynamic_cast<nux::Object *>(home_button);
384+ child_accessible = unity_a11y_get_accessible (child);
385+ if (child_accessible != NULL)
386+ g_object_ref (child_accessible);
387+ }
388+
389+ return child_accessible;
390+}
391
392=== added file 'src/unity-panel-view-accessible.h'
393--- src/unity-panel-view-accessible.h 1970-01-01 00:00:00 +0000
394+++ src/unity-panel-view-accessible.h 2011-02-14 16:44:32 +0000
395@@ -0,0 +1,57 @@
396+/*
397+ * Copyright (C) 2011 Canonical Ltd
398+ *
399+ * This program is free software: you can redistribute it and/or modify
400+ * it under the terms of the GNU General Public License version 3 as
401+ * published by the Free Software Foundation.
402+ *
403+ * This program is distributed in the hope that it will be useful,
404+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
405+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
406+ * GNU General Public License for more details.
407+ *
408+ * You should have received a copy of the GNU General Public License
409+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
410+ *
411+ * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
412+ */
413+
414+#ifndef UNITY_PANEL_VIEW_ACCESSIBLE_H
415+#define UNITY_PANEL_VIEW_ACCESSIBLE_H
416+
417+#include <atk/atk.h>
418+
419+#include "nux-view-accessible.h"
420+
421+G_BEGIN_DECLS
422+
423+#define UNITY_TYPE_PANEL_VIEW_ACCESSIBLE (unity_panel_view_accessible_get_type ())
424+#define UNITY_PANEL_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessible))
425+#define UNITY_PANEL_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessibleClass))
426+#define UNITY_IS_PANEL_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE))
427+#define UNITY_IS_PANEL_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE))
428+#define UNITY_PANEL_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessibleClass))
429+
430+typedef struct _UnityPanelViewAccessible UnityPanelViewAccessible;
431+typedef struct _UnityPanelViewAccessibleClass UnityPanelViewAccessibleClass;
432+typedef struct _UnityPanelViewAccessiblePrivate UnityPanelViewAccessiblePrivate;
433+
434+struct _UnityPanelViewAccessible
435+{
436+ NuxViewAccessible parent;
437+
438+ /* < private > */
439+ UnityPanelViewAccessiblePrivate *priv;
440+};
441+
442+struct _UnityPanelViewAccessibleClass
443+{
444+ NuxViewAccessibleClass parent_class;
445+};
446+
447+GType unity_panel_view_accessible_get_type (void);
448+AtkObject *unity_panel_view_accessible_new (nux::Object *object);
449+
450+G_END_DECLS
451+
452+#endif
453
454=== modified file 'src/unity-util-accessible.cpp'
455--- src/unity-util-accessible.cpp 2011-01-26 19:46:30 +0000
456+++ src/unity-util-accessible.cpp 2011-02-14 16:44:32 +0000
457@@ -109,27 +109,27 @@
458
459 type = g_type_from_name (object_type);
460 if (type)
461- {
462- signal_id = g_signal_lookup (signal_name, type);
463- if (signal_id > 0)
464 {
465- UnityUtilListenerInfo *listener_info;
466-
467- rc = listener_idx;
468- listener_info = g_new0 (UnityUtilListenerInfo, 1);
469- listener_info->idx = listener_idx;
470- listener_info->hook_id = g_signal_add_emission_hook (signal_id, 0, listener,
471- g_strdup (hook_data),
472- (GDestroyNotify) g_free);
473- listener_info->signal_id = signal_id;
474-
475- g_hash_table_insert (listener_list, &(listener_info->idx), listener_info);
476-
477- listener_idx++;
478+ signal_id = g_signal_lookup (signal_name, type);
479+ if (signal_id > 0)
480+ {
481+ UnityUtilListenerInfo *listener_info;
482+
483+ rc = listener_idx;
484+ listener_info = g_new0 (UnityUtilListenerInfo, 1);
485+ listener_info->idx = listener_idx;
486+ listener_info->hook_id = g_signal_add_emission_hook (signal_id, 0, listener,
487+ g_strdup (hook_data),
488+ (GDestroyNotify) g_free);
489+ listener_info->signal_id = signal_id;
490+
491+ g_hash_table_insert (listener_list, &(listener_info->idx), listener_info);
492+
493+ listener_idx++;
494+ }
495+ else
496+ g_debug ("Signal type %s not supported\n", signal_name);
497 }
498- else
499- g_debug ("Signal type %s not supported\n", signal_name);
500- }
501 else
502 g_warning ("Invalid object type %s\n", object_type);
503
504@@ -145,19 +145,19 @@
505
506 split_string = g_strsplit (event_type, ":", 3);
507 if (split_string)
508- {
509- if (g_str_equal ("window", split_string[0]))
510- {
511- /* FIXME: need to specifically process window: events (create, destroy,
512- minimize, maximize, restore, activate, deactivate) */
513- }
514- else
515- {
516- rc = add_listener (listener, split_string[1], split_string[2], event_type);
517- }
518+ {
519+ if (g_str_equal ("window", split_string[0]))
520+ {
521+ /* FIXME: need to specifically process window: events (create, destroy,
522+ minimize, maximize, restore, activate, deactivate) */
523+ }
524+ else
525+ {
526+ rc = add_listener (listener, split_string[1], split_string[2], event_type);
527+ }
528
529- g_strfreev (split_string);
530- }
531+ g_strfreev (split_string);
532+ }
533
534 return rc;
535 }
536@@ -166,27 +166,27 @@
537 unity_util_accessible_remove_global_event_listener (guint remove_listener)
538 {
539 if (remove_listener > 0)
540- {
541- UnityUtilListenerInfo *listener_info;
542+ {
543+ UnityUtilListenerInfo *listener_info;
544
545- listener_info = (UnityUtilListenerInfo *) g_hash_table_lookup (listener_list, &remove_listener);
546- if (listener_info != NULL)
547- {
548- if (listener_info->hook_id != 0 && listener_info->signal_id != 0)
549- {
550- g_signal_remove_emission_hook (listener_info->signal_id,
551- listener_info->hook_id);
552- g_hash_table_remove (listener_list, &remove_listener);
553- }
554+ listener_info = (UnityUtilListenerInfo *) g_hash_table_lookup (listener_list, &remove_listener);
555+ if (listener_info != NULL)
556+ {
557+ if (listener_info->hook_id != 0 && listener_info->signal_id != 0)
558+ {
559+ g_signal_remove_emission_hook (listener_info->signal_id,
560+ listener_info->hook_id);
561+ g_hash_table_remove (listener_list, &remove_listener);
562+ }
563+ else
564+ {
565+ g_warning ("Invalid listener hook_id %ld or signal_id %d",
566+ listener_info->hook_id, listener_info->signal_id);
567+ }
568+ }
569 else
570- {
571- g_warning ("Invalid listener hook_id %ld or signal_id %d",
572- listener_info->hook_id, listener_info->signal_id);
573- }
574+ g_warning ("No listener with the specified ID: %d", remove_listener);
575 }
576- else
577- g_warning ("No listener with the specified ID: %d", remove_listener);
578- }
579 else
580 g_warning ("Invalid listener_id: %d", remove_listener);
581 }
582
583=== modified file 'src/unitya11y.cpp'
584--- src/unitya11y.cpp 2011-01-31 13:38:14 +0000
585+++ src/unitya11y.cpp 2011-02-14 16:44:32 +0000
586@@ -32,8 +32,11 @@
587 /* unity accessible objects */
588 #include "Launcher.h"
589 #include "LauncherIcon.h"
590+#include "PanelView.h"
591 #include "unity-launcher-accessible.h"
592 #include "unity-launcher-icon-accessible.h"
593+#include "unity-panel-view-accessible.h"
594+#include "unity-panel-home-button-accessible.h"
595
596 static GHashTable *accessible_table = NULL;
597 /* FIXME: remove accessible objects when not required anymore */
598@@ -243,6 +246,12 @@
599 if (object->Type().IsDerivedFromType (LauncherIcon::StaticObjectType))
600 return unity_launcher_icon_accessible_new (object);
601
602+ if (object->Type().IsDerivedFromType (PanelView::StaticObjectType))
603+ return unity_panel_view_accessible_new (object);
604+
605+ if (object->Type().IsDerivedFromType (PanelHomeButton::StaticObjectType))
606+ return unity_panel_home_button_accessible_new (object);
607+
608 /* NUX classes */
609 if (object->Type().IsDerivedFromType (nux::BaseWindow::StaticObjectType))
610 return nux_base_window_accessible_new (object);
611
612=== modified file 'src/unityshell.cpp'
613--- src/unityshell.cpp 2011-02-13 00:46:10 +0000
614+++ src/unityshell.cpp 2011-02-14 16:44:32 +0000
615@@ -636,6 +636,12 @@
616 self->panelWindow->ShowWindow(true);
617 self->panelWindow->EnableInputWindow(true, "panel");
618 self->panelWindow->InputWindowEnableStruts(true);
619+
620+ /* FIXME: this should not be manual, should be managed with a
621+ show/hide callback like in GAIL*/
622+ if (unity_a11y_initialized () == TRUE)
623+ unity_util_accessible_add_window (self->panelWindow);
624+
625 LOGGER_END_PROCESS ("initLauncher-Panel");
626
627 /* Setup Places */