Merge lp:~apinheiro/unity/atk-selection into lp:unity

Proposed by Alejandro Piñeiro
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 897
Proposed branch: lp:~apinheiro/unity/atk-selection
Merge into: lp:unity
Diff against target: 640 lines (+392/-3)
9 files modified
src/Launcher.cpp (+22/-0)
src/Launcher.h (+3/-0)
src/LauncherIcon.h (+2/-0)
src/unity-launcher-accessible.cpp (+171/-1)
src/unity-launcher-accessible.h (+4/-0)
src/unity-launcher-icon-accessible.cpp (+129/-1)
src/unity-launcher-icon-accessible.h (+4/-0)
src/unity-root-accessible.cpp (+1/-1)
src/unitya11y.cpp (+56/-0)
To merge this branch: bzr merge lp:~apinheiro/unity/atk-selection
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Rodrigo Moya (community) Approve
Review via email: mp+51440@code.launchpad.net

Description of the change

This branch solves the problems with all the related bugs. All three were too tied to create three different branches, so I concluded that it was better to just work on a branch.

Anyway, I have a problem. I was not able to test it. On a normal run, it crashes when the launcher icon accessible object tries to connect to the new signal that I added to the Launcher. This is weird, as it works on the custom unit tests that I created (on unitya11y). This is the reason I added Mirco here, to check if the signal is wrong.

Anyway, I fear that it is a known bug. Using gdb on this crash I get this backtrace:
rogram received signal SIGSEGV, Segmentation fault.
0xb76070a9 in std::_List_node_base::_M_hook(std::_List_node_base*) () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0xb76070a9 in std::_List_node_base::_M_hook(std::_List_node_base*) () from /usr/lib/libstdc++.so.6
#1 0xb76d1c4d in sigc::internal::signal_impl::insert(std::_List_iterator<sigc::slot_base>, sigc::slot_base const&) () from /usr/lib/libsigc-2.0.so.0
#2 0xb76d1ce7 in sigc::internal::signal_impl::connect(sigc::slot_base const&) () from /usr/lib/libsigc-2.0.so.0
#3 0xb76d1f78 in sigc::signal_base::connect(sigc::slot_base const&) () from /usr/lib/libsigc-2.0.so.0
#4 0xb509fd4d in connect (accessible=0x8de9920, data=0x91efd0c) at /usr/include/sigc++-2.0/sigc++/signal.h:2659
#5 unity_launcher_icon_accessible_initialize (accessible=0x8de9920, data=0x91efd0c

And this _M_hook thing is a bug already reported:

https://bugs.launchpad.net/ubuntu/+source/nux/+bug/717600

So, if I'm proposing this merge, is more a gentle request to the people: could you review my code to discard any stupid mistake in my code? Could you test (Rodrigo?) this branch to discard something specific on my environment? Thanks

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

Well, finally I was able to solve that crashes. It seems that the real problem was with the casting. The last commit add more type checks, and it solves it.

I was able to test it, and also get a initial support with orca, although using this custom orca script:

https://bugzilla.gnome.org/show_bug.cgi?id=643419

For the moment it just expose the selection change on the Launcher.

So now, it is just a normal merge proposal.

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

Works as advertised

review: Approve
Revision history for this message
Mirco Müller (macslow) wrote :

Alejandro, what did you do to trigger the crash? Just switch to the launcher key-nav-mode with Alt-F1? I can easily use the launcher key-nav-mode here using your branch merged to trunk and don't get any crash. So I'd also approve it as I don't see a problem.

Revision history for this message
Mirco Müller (macslow) wrote :

Well then... approved :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2011-02-27 08:27:17 +0000
3+++ src/Launcher.cpp 2011-02-28 12:13:08 +0000
4@@ -507,6 +507,7 @@
5 ubus_server_send_message (ubus_server_get_default (),
6 UBUS_LAUNCHER_END_KEY_NAV,
7 NULL);
8+ selection_change.emit ();
9 }
10
11 void
12@@ -530,6 +531,7 @@
13 ubus_server_send_message (ubus_server_get_default (),
14 UBUS_LAUNCHER_END_KEY_NAV,
15 NULL);
16+ selection_change.emit ();
17 }
18
19 void
20@@ -2642,6 +2644,7 @@
21 // FIXME: switch to global-menu here still needs to be implemented
22 }
23 NeedRedraw ();
24+ selection_change.emit ();
25 break;
26
27 // down (move selection down and unfold launcher if needed)
28@@ -2650,6 +2653,7 @@
29 {
30 _current_icon_index++;
31 NeedRedraw ();
32+ selection_change.emit ();
33 }
34 break;
35
36@@ -3475,3 +3479,21 @@
37 // reset our shiz
38 ProcessDndLeave ();
39 }
40+
41+
42+/*
43+ * Returns the current selected icon if it is in keynavmode
44+ * It will return NULL if it is not on keynavmode
45+ */
46+LauncherIcon*
47+Launcher::GetSelectedMenuIcon ()
48+{
49+ LauncherModel::iterator it;
50+
51+ if (_current_icon_index == -1)
52+ return NULL;
53+
54+ it = _model->at (_current_icon_index);
55+
56+ return *it;
57+}
58
59=== modified file 'src/Launcher.h'
60--- src/Launcher.h 2011-02-25 15:41:25 +0000
61+++ src/Launcher.h 2011-02-28 12:13:08 +0000
62@@ -101,6 +101,8 @@
63 LauncherIcon* GetLastSpreadIcon() {return m_LastSpreadIcon;}
64 void SetLastSpreadIcon(LauncherIcon *i) {m_LastSpreadIcon = i;}
65
66+ LauncherIcon* GetSelectedMenuIcon ();
67+
68 void SetIconSize(int tile_size, int icon_size);
69
70 void SetModel (LauncherModel *model);
71@@ -153,6 +155,7 @@
72
73
74 sigc::signal<void, char *, LauncherIcon *> launcher_dropped;
75+ sigc::signal<void> selection_change;
76 protected:
77 // Introspectable methods
78 const gchar* GetName ();
79
80=== modified file 'src/LauncherIcon.h'
81--- src/LauncherIcon.h 2011-02-23 23:18:44 +0000
82+++ src/LauncherIcon.h 2011-02-28 12:13:08 +0000
83@@ -80,6 +80,8 @@
84 LauncherIcon(Launcher* launcher);
85 virtual ~LauncherIcon();
86
87+ Launcher* GetLauncher () {return _launcher;};
88+
89 void SetTooltipText (const TCHAR* text);
90
91 nux::NString GetTooltipText ();
92
93=== modified file 'src/unity-launcher-accessible.cpp'
94--- src/unity-launcher-accessible.cpp 2011-02-17 12:57:17 +0000
95+++ src/unity-launcher-accessible.cpp 2011-02-28 12:13:08 +0000
96@@ -37,6 +37,7 @@
97 /* GObject */
98 static void unity_launcher_accessible_class_init (UnityLauncherAccessibleClass *klass);
99 static void unity_launcher_accessible_init (UnityLauncherAccessible *self);
100+static void unity_launcher_accessible_finalize (GObject *object);
101
102 /* AtkObject.h */
103 static void unity_launcher_accessible_initialize (AtkObject *accessible,
104@@ -45,22 +46,64 @@
105 static AtkObject *unity_launcher_accessible_ref_child (AtkObject *obj,
106 gint i);
107
108-G_DEFINE_TYPE (UnityLauncherAccessible, unity_launcher_accessible, NUX_TYPE_VIEW_ACCESSIBLE)
109+/* AtkSelection */
110+static void atk_selection_interface_init (AtkSelectionIface *iface);
111+static AtkObject* unity_launcher_accessible_ref_selection (AtkSelection *selection,
112+ gint i);
113+static gint unity_launcher_accessible_get_selection_count (AtkSelection *selection);
114+static gboolean unity_launcher_accessible_is_child_selected (AtkSelection *selection,
115+ gint i);
116+
117+/* private */
118+static void on_selection_change_cb (UnityLauncherAccessible *launcher_accessible);
119+
120+
121+G_DEFINE_TYPE_WITH_CODE (UnityLauncherAccessible, unity_launcher_accessible, NUX_TYPE_VIEW_ACCESSIBLE,
122+ G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
123+
124+#define UNITY_LAUNCHER_ACCESSIBLE_GET_PRIVATE(obj) \
125+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_LAUNCHER_ACCESSIBLE, \
126+ UnityLauncherAccessiblePrivate))
127+
128+struct _UnityLauncherAccessiblePrivate
129+{
130+ sigc::connection on_selection_change_connection;
131+};
132+
133
134 static void
135 unity_launcher_accessible_class_init (UnityLauncherAccessibleClass *klass)
136 {
137+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
138 AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
139
140+ gobject_class->finalize = unity_launcher_accessible_finalize;
141+
142 /* AtkObject */
143 atk_class->get_n_children = unity_launcher_accessible_get_n_children;
144 atk_class->ref_child = unity_launcher_accessible_ref_child;
145 atk_class->initialize = unity_launcher_accessible_initialize;
146+
147+ g_type_class_add_private (gobject_class, sizeof (UnityLauncherAccessiblePrivate));
148 }
149
150 static void
151 unity_launcher_accessible_init (UnityLauncherAccessible *self)
152 {
153+ UnityLauncherAccessiblePrivate *priv =
154+ UNITY_LAUNCHER_ACCESSIBLE_GET_PRIVATE (self);
155+
156+ self->priv = priv;
157+}
158+
159+static void
160+unity_launcher_accessible_finalize (GObject *object)
161+{
162+ UnityLauncherAccessible *self = UNITY_LAUNCHER_ACCESSIBLE (object);
163+
164+ self->priv->on_selection_change_connection.disconnect ();
165+
166+ G_OBJECT_CLASS (unity_launcher_accessible_parent_class)->finalize (object);
167 }
168
169 AtkObject*
170@@ -82,9 +125,21 @@
171 unity_launcher_accessible_initialize (AtkObject *accessible,
172 gpointer data)
173 {
174+ Launcher *launcher = NULL;
175+ nux::Object *nux_object = NULL;
176+ UnityLauncherAccessible *self = NULL;
177+
178 ATK_OBJECT_CLASS (unity_launcher_accessible_parent_class)->initialize (accessible, data);
179
180 accessible->role = ATK_ROLE_TOOL_BAR;
181+
182+ self = UNITY_LAUNCHER_ACCESSIBLE (accessible);
183+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible));
184+
185+ launcher = dynamic_cast<Launcher *>(nux_object);
186+
187+ self->priv->on_selection_change_connection =
188+ launcher->selection_change.connect (sigc::bind (sigc::ptr_fun (on_selection_change_cb), self));
189 }
190
191 static gint
192@@ -122,6 +177,7 @@
193 nux::Object *child = NULL;
194 AtkObject *child_accessible = NULL;
195
196+ g_return_val_if_fail (UNITY_IS_LAUNCHER_ACCESSIBLE (obj), NULL);
197 num = atk_object_get_n_accessible_children (obj);
198 g_return_val_if_fail ((i < num)&&(i >= 0), NULL);
199
200@@ -130,6 +186,8 @@
201 return 0;
202
203 launcher = dynamic_cast<Launcher *>(nux_object);
204+ g_debug ("[Launcher] ref_child Launcher = %p", launcher);
205+
206 launcher_model = launcher->GetModel ();
207
208 it = launcher_model->begin ();
209@@ -142,3 +200,115 @@
210
211 return child_accessible;
212 }
213+
214+/* AtkSelection */
215+static void
216+atk_selection_interface_init (AtkSelectionIface *iface)
217+{
218+ iface->ref_selection = unity_launcher_accessible_ref_selection;
219+ iface->get_selection_count = unity_launcher_accessible_get_selection_count;
220+ iface->is_child_selected = unity_launcher_accessible_is_child_selected;
221+
222+ /* NOTE: for the moment we don't provide the implementation for the
223+ "interactable" methods, it is, the methods that allow to change
224+ the selected icon. The Launcher doesn't provide that API, and
225+ right now we are focusing on a normal user input.*/
226+ /* iface->add_selection = unity_launcher_accessible_add_selection; */
227+ /* iface->clear_selection = unity_launcher_accessible_clear_selection; */
228+ /* iface->remove_selection = unity_launcher_accessible_remove_selection; */
229+
230+ /* This method will never be implemented, as select all the launcher
231+ icons makes no sense */
232+ /* iface->select_all = unity_launcher_accessible_select_all_selection; */
233+}
234+
235+static AtkObject*
236+unity_launcher_accessible_ref_selection (AtkSelection *selection,
237+ gint i)
238+{
239+ Launcher *launcher = NULL;
240+ LauncherIcon *selected_icon = NULL;
241+ nux::Object *nux_object = NULL;
242+ AtkObject *accessible_selected = NULL;
243+
244+ g_return_val_if_fail (UNITY_IS_LAUNCHER_ACCESSIBLE (selection), 0);
245+ /* there can be only just item selected */
246+ g_return_val_if_fail (i == 0, NULL);
247+
248+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (selection));
249+ if (!nux_object) /* state is defunct */
250+ return 0;
251+
252+ launcher = dynamic_cast<Launcher *>(nux_object);
253+ selected_icon = launcher->GetSelectedMenuIcon ();
254+
255+ if (selected_icon != 0)
256+ {
257+ accessible_selected = unity_a11y_get_accessible (selected_icon);
258+ g_object_ref (accessible_selected);
259+ }
260+
261+ return accessible_selected;
262+}
263+
264+static gint
265+unity_launcher_accessible_get_selection_count (AtkSelection *selection)
266+{
267+ Launcher *launcher = NULL;
268+ LauncherIcon *selected_icon = NULL;
269+ nux::Object *nux_object = NULL;
270+
271+ g_return_val_if_fail (UNITY_IS_LAUNCHER_ACCESSIBLE (selection), 0);
272+
273+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (selection));
274+ if (!nux_object) /* state is defunct */
275+ return 0;
276+
277+ launcher = dynamic_cast<Launcher *>(nux_object);
278+ selected_icon = launcher->GetSelectedMenuIcon ();
279+
280+ if (selected_icon == 0)
281+ return 0;
282+ else
283+ return 1;
284+}
285+
286+static gboolean
287+unity_launcher_accessible_is_child_selected (AtkSelection *selection,
288+ gint i)
289+{
290+ Launcher *launcher = NULL;
291+ LauncherIcon *icon = NULL;
292+ LauncherIcon *selected_icon = NULL;
293+ LauncherModel *launcher_model = NULL;
294+ LauncherModel::iterator it;
295+ nux::Object *nux_object = NULL;
296+
297+ g_return_val_if_fail (UNITY_IS_LAUNCHER_ACCESSIBLE (selection), FALSE);
298+
299+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (selection));
300+ if (!nux_object) /* state is defunct */
301+ return 0;
302+
303+ launcher = dynamic_cast<Launcher *>(nux_object);
304+ launcher_model = launcher->GetModel ();
305+ it = launcher_model->begin ();
306+ std::advance (it, i);
307+ icon = dynamic_cast<LauncherIcon *>(*it);
308+
309+ selected_icon = launcher->GetSelectedMenuIcon ();
310+
311+ if (selected_icon == icon)
312+ return TRUE;
313+ else
314+ return FALSE;
315+}
316+
317+/* private */
318+static void on_selection_change_cb (UnityLauncherAccessible *launcher_accessible)
319+{
320+ g_debug ("[LAUNCHER]: selection changed");
321+
322+ g_signal_emit_by_name (ATK_OBJECT (launcher_accessible), "selection-changed");
323+}
324+
325
326=== modified file 'src/unity-launcher-accessible.h'
327--- src/unity-launcher-accessible.h 2011-02-17 12:57:17 +0000
328+++ src/unity-launcher-accessible.h 2011-02-28 12:13:08 +0000
329@@ -34,10 +34,14 @@
330
331 typedef struct _UnityLauncherAccessible UnityLauncherAccessible;
332 typedef struct _UnityLauncherAccessibleClass UnityLauncherAccessibleClass;
333+typedef struct _UnityLauncherAccessiblePrivate UnityLauncherAccessiblePrivate;
334
335 struct _UnityLauncherAccessible
336 {
337 NuxViewAccessible parent;
338+
339+ /*< private >*/
340+ UnityLauncherAccessiblePrivate *priv;
341 };
342
343 struct _UnityLauncherAccessibleClass
344
345=== modified file 'src/unity-launcher-icon-accessible.cpp'
346--- src/unity-launcher-icon-accessible.cpp 2011-02-17 12:57:17 +0000
347+++ src/unity-launcher-icon-accessible.cpp 2011-02-28 12:13:08 +0000
348@@ -34,29 +34,69 @@
349 /* GObject */
350 static void unity_launcher_icon_accessible_class_init (UnityLauncherIconAccessibleClass *klass);
351 static void unity_launcher_icon_accessible_init (UnityLauncherIconAccessible *launcher_icon_accessible);
352+static void unity_launcher_icon_accessible_finalize (GObject *object);
353+
354
355 /* AtkObject.h */
356 static void unity_launcher_icon_accessible_initialize (AtkObject *accessible,
357 gpointer data);
358+static AtkStateSet* unity_launcher_icon_accessible_ref_state_set (AtkObject *obj);
359 static const gchar * unity_launcher_icon_accessible_get_name (AtkObject *obj);
360
361+/* private/utility methods*/
362+static void check_selected (UnityLauncherIconAccessible *self);
363+static void on_selection_change_cb (UnityLauncherIconAccessible *icon_accessible);
364+
365
366 G_DEFINE_TYPE (UnityLauncherIconAccessible, unity_launcher_icon_accessible, NUX_TYPE_OBJECT_ACCESSIBLE)
367
368+#define UNITY_LAUNCHER_ICON_ACCESSIBLE_GET_PRIVATE(obj) \
369+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_LAUNCHER_ICON_ACCESSIBLE, \
370+ UnityLauncherIconAccessiblePrivate))
371+
372+struct _UnityLauncherIconAccessiblePrivate
373+{
374+ /* Cached values (used to avoid extra notifications) */
375+ gboolean selected;
376+
377+ sigc::connection on_selection_change_connection;
378+};
379+
380 static void
381 unity_launcher_icon_accessible_class_init (UnityLauncherIconAccessibleClass *klass)
382 {
383+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
384 AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
385
386+ gobject_class->finalize = unity_launcher_icon_accessible_finalize;
387+
388 /* AtkObject */
389 atk_class->initialize = unity_launcher_icon_accessible_initialize;
390 atk_class->get_name = unity_launcher_icon_accessible_get_name;
391+ atk_class->ref_state_set = unity_launcher_icon_accessible_ref_state_set;
392+
393+ g_type_class_add_private (gobject_class, sizeof (UnityLauncherIconAccessiblePrivate));
394 }
395
396 static void
397 unity_launcher_icon_accessible_init (UnityLauncherIconAccessible *launcher_icon_accessible)
398 {
399-}
400+ UnityLauncherIconAccessiblePrivate *priv =
401+ UNITY_LAUNCHER_ICON_ACCESSIBLE_GET_PRIVATE (launcher_icon_accessible);
402+
403+ launcher_icon_accessible->priv = priv;
404+}
405+
406+static void
407+unity_launcher_icon_accessible_finalize (GObject *object)
408+{
409+ UnityLauncherIconAccessible *self = UNITY_LAUNCHER_ICON_ACCESSIBLE (object);
410+
411+ self->priv->on_selection_change_connection.disconnect ();
412+
413+ G_OBJECT_CLASS (unity_launcher_icon_accessible_parent_class)->finalize (object);
414+}
415+
416
417 AtkObject*
418 unity_launcher_icon_accessible_new (nux::Object *object)
419@@ -77,9 +117,30 @@
420 unity_launcher_icon_accessible_initialize (AtkObject *accessible,
421 gpointer data)
422 {
423+ LauncherIcon *icon = NULL;
424+ Launcher *launcher = NULL;
425+ UnityLauncherIconAccessible *self = NULL;
426+ nux::Object *nux_object = NULL;
427+
428 ATK_OBJECT_CLASS (unity_launcher_icon_accessible_parent_class)->initialize (accessible, data);
429+ self = UNITY_LAUNCHER_ICON_ACCESSIBLE (accessible);
430
431 accessible->role = ATK_ROLE_PUSH_BUTTON;
432+
433+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible));
434+ icon = dynamic_cast<LauncherIcon *>(nux_object);
435+ launcher = icon->GetLauncher ();
436+
437+ if (launcher != NULL)
438+ {
439+ self->priv->on_selection_change_connection =
440+ launcher->selection_change.connect (sigc::bind (sigc::ptr_fun (on_selection_change_cb), self));
441+ }
442+
443+ /* Check the cached selected state and notify the first selection.
444+ * Ie: it is required to ensure a first notification
445+ */
446+ check_selected (UNITY_LAUNCHER_ICON_ACCESSIBLE (accessible));
447 }
448
449
450@@ -105,3 +166,70 @@
451
452 return name;
453 }
454+
455+static AtkStateSet*
456+unity_launcher_icon_accessible_ref_state_set (AtkObject *obj)
457+{
458+ AtkStateSet *state_set = NULL;
459+ UnityLauncherIconAccessible *self = NULL;
460+ nux::Object *nux_object = NULL;
461+
462+ g_return_val_if_fail (UNITY_IS_LAUNCHER_ICON_ACCESSIBLE (obj), NULL);
463+ self = UNITY_LAUNCHER_ICON_ACCESSIBLE (obj);
464+
465+ state_set = ATK_OBJECT_CLASS (unity_launcher_icon_accessible_parent_class)->ref_state_set (obj);
466+
467+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj));
468+
469+ if (nux_object == NULL) /* actor is defunct */
470+ return state_set;
471+
472+ if (self->priv->selected)
473+ atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
474+
475+ return state_set;
476+}
477+
478+/* private methods */
479+
480+/*
481+ * Checks if the current item is selected, and notify a selection
482+ * change if the selection has changed
483+ */
484+static void
485+check_selected (UnityLauncherIconAccessible *self)
486+{
487+ LauncherIcon *icon = NULL;
488+ LauncherIcon *selected_icon = NULL;
489+ Launcher *launcher = NULL;
490+ nux::Object *nux_object = NULL;
491+ gboolean found = FALSE;
492+
493+ nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (self));
494+ icon = dynamic_cast<LauncherIcon *>(nux_object);
495+ launcher = icon->GetLauncher ();
496+
497+ if (launcher == NULL)
498+ return;
499+
500+ selected_icon = launcher->GetSelectedMenuIcon ();
501+
502+ if (icon == selected_icon)
503+ found = TRUE;
504+
505+ if (found != self->priv->selected)
506+ {
507+ self->priv->selected = found;
508+ atk_object_notify_state_change (ATK_OBJECT (self),
509+ ATK_STATE_SELECTED,
510+ found);
511+ g_debug ("[LAUNCHER-ICON]: selected state changed (%p:%i)", self, found);
512+ }
513+}
514+
515+static void
516+on_selection_change_cb (UnityLauncherIconAccessible *icon_accessible)
517+{
518+ check_selected (icon_accessible);
519+}
520+
521
522=== modified file 'src/unity-launcher-icon-accessible.h'
523--- src/unity-launcher-icon-accessible.h 2011-02-17 12:57:17 +0000
524+++ src/unity-launcher-icon-accessible.h 2011-02-28 12:13:08 +0000
525@@ -34,10 +34,14 @@
526
527 typedef struct _UnityLauncherIconAccessible UnityLauncherIconAccessible;
528 typedef struct _UnityLauncherIconAccessibleClass UnityLauncherIconAccessibleClass;
529+typedef struct _UnityLauncherIconAccessiblePrivate UnityLauncherIconAccessiblePrivate;
530
531 struct _UnityLauncherIconAccessible
532 {
533 NuxObjectAccessible parent;
534+
535+ /*< private >*/
536+ UnityLauncherIconAccessiblePrivate *priv;
537 };
538
539 struct _UnityLauncherIconAccessibleClass
540
541=== modified file 'src/unity-root-accessible.cpp'
542--- src/unity-root-accessible.cpp 2011-02-14 16:40:11 +0000
543+++ src/unity-root-accessible.cpp 2011-02-28 12:13:08 +0000
544@@ -118,7 +118,7 @@
545 // FIXME: compiz doesn't set the program name using g_set_prgname,
546 // and AFAIK, there isn't a way to get it. Requires further investigation.
547 // accessible->name = g_get_prgname();
548- atk_object_set_name (accessible, "Unity");
549+ atk_object_set_name (accessible, "unity");
550 atk_object_set_parent (accessible, NULL);
551
552 ATK_OBJECT_CLASS (unity_root_accessible_parent_class)->initialize (accessible, data);
553
554=== modified file 'src/unitya11y.cpp'
555--- src/unitya11y.cpp 2011-02-23 17:22:58 +0000
556+++ src/unitya11y.cpp 2011-02-28 12:13:08 +0000
557@@ -33,6 +33,7 @@
558 /* unity accessible objects */
559 #include "Launcher.h"
560 #include "LauncherIcon.h"
561+#include "SimpleLauncherIcon.h"
562 #include "PanelView.h"
563 #include "unity-launcher-accessible.h"
564 #include "unity-launcher-icon-accessible.h"
565@@ -310,6 +311,53 @@
566 return TRUE;
567 }
568
569+/**
570+ * This unit test checks if the launcher connection process works
571+ */
572+static gboolean
573+a11y_unit_test_launcher_connection (void)
574+{
575+ Launcher *launcher = NULL;
576+ nux::BaseWindow *window = NULL;
577+ AtkObject *launcher_accessible = NULL;
578+ LauncherIcon *launcher_icon = NULL;
579+ AtkObject *launcher_icon_accessible = NULL;
580+
581+ window = new nux::BaseWindow (TEXT(""));
582+ launcher = new Launcher (window, NULL);
583+ launcher->SinkReference ();
584+ launcher_accessible = unity_a11y_get_accessible (launcher);
585+
586+ if (!UNITY_IS_LAUNCHER_ACCESSIBLE (launcher_accessible))
587+ {
588+ g_debug ("[a11y] wrong launcher accessible type");
589+ return FALSE;
590+ }
591+ else
592+ {
593+ g_debug ("[a11y] Launcher accessible created correctly");
594+ }
595+
596+ launcher_icon = new SimpleLauncherIcon (launcher);
597+ launcher_icon->SinkReference ();
598+ launcher_icon_accessible = unity_a11y_get_accessible (launcher_icon);
599+
600+ if (!UNITY_IS_LAUNCHER_ICON_ACCESSIBLE (launcher_icon_accessible))
601+ {
602+ g_debug ("[a11y] wrong launcher icon accessible type");
603+ return FALSE;
604+ }
605+ else
606+ {
607+ g_debug ("[a11y] LauncherIcon accessible created correctly");
608+ }
609+
610+ launcher->UnReference ();
611+ launcher_icon->UnReference ();
612+
613+ return TRUE;
614+}
615+
616 void
617 unity_run_a11y_unit_tests (void)
618 {
619@@ -322,6 +370,12 @@
620 g_debug ("[a11y] hash table destroy management unit test: SUCCESS");
621 else
622 g_debug ("[a11y] hash table destroy management unit test: FAIL");
623+
624+ if (a11y_unit_test_launcher_connection ())
625+ g_debug ("[a11y] launcher connection: SUCCESS");
626+ else
627+ g_debug ("[a11y] launcher connection: FAIL");
628+
629 }
630
631
632@@ -370,6 +424,8 @@
633 }
634
635 g_free (bridge_path);
636+
637+ // unity_run_a11y_unit_tests ();
638 }
639
640 /*