Merge lp:~rodrigo-moya/unity/panel-a11y into lp:unity
- panel-a11y
- Merge into trunk
| Status: | Rejected | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Rejected by: | Alex Launi | ||||||||
| Proposed branch: | lp:~rodrigo-moya/unity/panel-a11y | ||||||||
| Merge into: | lp:unity | ||||||||
| Diff against target: |
672 lines (+446/-53) 14 files modified
src/PanelHomeButton.cpp (+2/-0) src/PanelHomeButton.h (+1/-0) src/PanelView.cpp (+8/-0) src/PanelView.h (+2/-0) src/WindowButtons.h (+1/-0) src/unity-launcher-accessible.cpp (+3/-3) src/unity-panel-home-button-accessible.cpp (+106/-0) src/unity-panel-home-button-accessible.h (+57/-0) src/unity-panel-view-accessible.cpp (+144/-0) src/unity-panel-view-accessible.h (+57/-0) src/unity-root-accessible.cpp (+1/-1) 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 | ||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Alejandro Piñeiro (community) | Needs Information | ||
|
Review via email:
|
|||
Commit message
Description of the change
Implement A11Y objects for PanelView and PanelHomeButton
| Rodrigo Moya (rodrigo-moya) wrote : | # |
> It seems to work for me, but I have some questions:
>
> 211 +static const gchar *
> 212 +unity_
> 213 +{
> 214 + return "UnityPanelAcce
> 215 +}
>
> I'm not sure about it. Why redefine the get_name here?
> * It totally overrides the get/set name methods, so if anyone wants to set
> the name with atk_object_
> LauncherIconAcc
> name.
> * This name is meaningless for any AT point of view, as it gets the
> information from the role (already set on the initialize).
>
right, we discussed it before, but forgot to remove it, so now it's removed
>
> 225 +static gint
> 226 +unity_
> ...
> 251 +static AtkObject *
> 252 +unity_
>
> You are exposing here as direct children of PanelView the objects that belong
> to the internal Layout. But take into account that other approach would be
> expose just one child, the layout. After all we already have a
> NuxLayoutAccessible object. That would allow to not replicate the "get the
> children code". I used that approach on BaseWindow. Is there any reason to
> expose the children in this way? (Please take into account that I'm not saying
> that it is wrong, just asking if there is a reason).
>
right, not sure though if we would need all the children, so I will be making it more selective if needed in the upcoming branches
> Probably offtopic: it is normal all those lines related to the global
> listeners, or is just that you used as base an old branch? AFAIK, this global
> event listeners are already merged.
>
I fixed the code styling, as we discussed. That's the only change, sorry to include it here, but didn't want to just submit a merge proposal just for that. I can though if you want
| Alejandro Piñeiro (apinheiro) wrote : | # |
> right, we discussed it before, but forgot to remove it, so now it's removed
Ok.
> > 225 +static gint
> > 226 +unity_
> > ...
> > 251 +static AtkObject *
> > 252 +unity_
> >
> > You are exposing here as direct children of PanelView the objects that
> belong
> > to the internal Layout. But take into account that other approach would be
> > expose just one child, the layout. After all we already have a
> > NuxLayoutAccessible object. That would allow to not replicate the "get the
> > children code". I used that approach on BaseWindow. Is there any reason to
> > expose the children in this way? (Please take into account that I'm not
> saying
> > that it is wrong, just asking if there is a reason).
> >
> right, not sure though if we would need all the children, so I will be making
> it more selective if needed in the upcoming branches
Sorry I didn't explain myself properly. I'm not saying that we shouldn't expose all the children, I'm just saying if there is any reason to expose the children in other way. With the implementation way I proposed, we are also exposing all the children:
* Your hierarchy:
- PanelViewAccessible
- LayoutChild1
- LayoutChild2
And you add Layout code related on PanelViewAccessible
* The other option:
- PanelViewAccessible
- LayoutAccessible
- LayoutChild1
- LayoutChild2
Technically PanelView only have one child, the layout, and this is the one that have several children. If we expose the layout on the PanelView, in the end we would get all the children.
But yes, we could avoid the LayoutAccessible and expose the children directly as PanelViewAccessible children, but, is there any reason to do that?
> > Probably offtopic: it is normal all those lines related to the global
> > listeners, or is just that you used as base an old branch? AFAIK, this
> global
> > event listeners are already merged.
> >
> I fixed the code styling, as we discussed. That's the only change, sorry to
> include it here, but didn't want to just submit a merge proposal just for
> that. I can though if you want
Ah ok, sorry, I didn't realize that it were for that. As far as this code review gets included on a different commit, I don't see any problem to include that on this merge.
Preview Diff
| 1 | === modified file 'src/PanelHomeButton.cpp' |
| 2 | --- src/PanelHomeButton.cpp 2011-01-11 21:03:44 +0000 |
| 3 | +++ src/PanelHomeButton.cpp 2011-01-27 12:40:59 +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 2010-12-13 20:10:14 +0000 |
| 16 | +++ src/PanelHomeButton.h 2011-01-27 12:40:59 +0000 |
| 17 | @@ -29,6 +29,7 @@ |
| 18 | |
| 19 | class PanelHomeButton : public nux::TextureArea, public Introspectable |
| 20 | { |
| 21 | + NUX_DECLARE_OBJECT_TYPE (Launcher, nux::TextureArea); |
| 22 | public: |
| 23 | PanelHomeButton (); |
| 24 | ~PanelHomeButton (); |
| 25 | |
| 26 | === modified file 'src/PanelView.cpp' |
| 27 | --- src/PanelView.cpp 2011-01-13 15:54:59 +0000 |
| 28 | +++ src/PanelView.cpp 2011-01-27 12:40:59 +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 | @@ -72,6 +74,12 @@ |
| 39 | return _home_button; |
| 40 | } |
| 41 | |
| 42 | +nux::HLayout * |
| 43 | +PanelView::Layout () |
| 44 | +{ |
| 45 | + return _layout; |
| 46 | +} |
| 47 | + |
| 48 | const gchar* PanelView::GetName () |
| 49 | { |
| 50 | return "Panel"; |
| 51 | |
| 52 | === modified file 'src/PanelView.h' |
| 53 | --- src/PanelView.h 2010-12-17 14:07:11 +0000 |
| 54 | +++ src/PanelView.h 2011-01-27 12:40:59 +0000 |
| 55 | @@ -31,6 +31,7 @@ |
| 56 | |
| 57 | class PanelView : public Introspectable, public nux::View |
| 58 | { |
| 59 | + NUX_DECLARE_OBJECT_TYPE (LauncherIcon, nux::View); |
| 60 | public: |
| 61 | PanelView (NUX_FILE_LINE_PROTO); |
| 62 | ~PanelView (); |
| 63 | @@ -48,6 +49,7 @@ |
| 64 | void OnEntryActivated (const char *entry_id); |
| 65 | |
| 66 | PanelHomeButton * HomeButton (); |
| 67 | + nux::HLayout * Layout (); |
| 68 | |
| 69 | protected: |
| 70 | // Introspectable methods |
| 71 | |
| 72 | === modified file 'src/WindowButtons.h' |
| 73 | --- src/WindowButtons.h 2010-12-17 08:14:30 +0000 |
| 74 | +++ src/WindowButtons.h 2011-01-27 12:40:59 +0000 |
| 75 | @@ -19,6 +19,7 @@ |
| 76 | #ifndef WINDOW_BUTTONS_H |
| 77 | #define WINDOW_BUTTONS_H |
| 78 | |
| 79 | +#include <Nux/HLayout.h> |
| 80 | #include <Nux/View.h> |
| 81 | |
| 82 | #include "Introspectable.h" |
| 83 | |
| 84 | === modified file 'src/unity-launcher-accessible.cpp' |
| 85 | --- src/unity-launcher-accessible.cpp 2011-01-13 01:59:18 +0000 |
| 86 | +++ src/unity-launcher-accessible.cpp 2011-01-27 12:40:59 +0000 |
| 87 | @@ -17,12 +17,12 @@ |
| 88 | */ |
| 89 | |
| 90 | /** |
| 91 | - * SECTION:nux-view-accessible |
| 92 | - * @Title: NuxViewAccessible |
| 93 | + * SECTION:unity-launcher-accessible |
| 94 | + * @Title: UnityLauncherAccessible |
| 95 | * @short_description: Implementation of the ATK interfaces for #Launcher |
| 96 | * @see_also: Launcher |
| 97 | * |
| 98 | - * #NuxViewAccessible implements the required ATK interfaces for |
| 99 | + * #UnityLauncherAccessible implements the required ATK interfaces for |
| 100 | * #Launcher, ie: exposing the different LauncherIcon on the model as |
| 101 | * #child of the object. |
| 102 | * |
| 103 | |
| 104 | === added file 'src/unity-panel-home-button-accessible.cpp' |
| 105 | --- src/unity-panel-home-button-accessible.cpp 1970-01-01 00:00:00 +0000 |
| 106 | +++ src/unity-panel-home-button-accessible.cpp 2011-01-27 12:40:59 +0000 |
| 107 | @@ -0,0 +1,106 @@ |
| 108 | +/* |
| 109 | + * Copyright (C) 2011 Canonical Ltd |
| 110 | + * |
| 111 | + * This program is free software: you can redistribute it and/or modify |
| 112 | + * it under the terms of the GNU General Public License version 3 as |
| 113 | + * published by the Free Software Foundation. |
| 114 | + * |
| 115 | + * This program is distributed in the hope that it will be useful, |
| 116 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 117 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 118 | + * GNU General Public License for more details. |
| 119 | + * |
| 120 | + * You should have received a copy of the GNU General Public License |
| 121 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 122 | + * |
| 123 | + * Authored by: Rodrigo Moya <[email protected]> |
| 124 | + */ |
| 125 | + |
| 126 | +/** |
| 127 | + * SECTION:unity-panel-home-button-accessible |
| 128 | + * @Title: UnityPanelHomeButtonAccessible |
| 129 | + * @short_description: Implementation of the ATK interfaces for #PanelHomeButton |
| 130 | + * @see_also: PanelHomeButton |
| 131 | + * |
| 132 | + * #UnityPanelHomeButtonAccessible implements the required ATK interfaces for |
| 133 | + * #PanelHomeButton. |
| 134 | + * |
| 135 | + */ |
| 136 | + |
| 137 | +#include <Nux/Nux.h> |
| 138 | +#include "PanelHomeButton.h" |
| 139 | +#include "unity-panel-home-button-accessible.h" |
| 140 | + |
| 141 | +#include "unitya11y.h" |
| 142 | + |
| 143 | +/* GObject */ |
| 144 | +static void unity_panel_home_button_accessible_class_init (UnityPanelHomeButtonAccessibleClass *klass); |
| 145 | +static void unity_panel_home_button_accessible_init (UnityPanelHomeButtonAccessible *self); |
| 146 | + |
| 147 | +/* AtkObject */ |
| 148 | +static void unity_panel_home_button_accessible_initialize (AtkObject *accessible, gpointer data); |
| 149 | +static gint unity_panel_home_button_accessible_get_n_children (AtkObject *accessible); |
| 150 | +static AtkObject *unity_panel_home_button_accessible_ref_child (AtkObject *accessible, gint i); |
| 151 | + |
| 152 | +#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_PRIVATE(obj) \ |
| 153 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessiblePrivate)) |
| 154 | + |
| 155 | +G_DEFINE_TYPE (UnityPanelHomeButtonAccessible, unity_panel_home_button_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
| 156 | + |
| 157 | +struct _UnityPanelHomeButtonAccessiblePrivate |
| 158 | +{ |
| 159 | +}; |
| 160 | + |
| 161 | +static void |
| 162 | +unity_panel_home_button_accessible_class_init (UnityPanelHomeButtonAccessibleClass *klass) |
| 163 | +{ |
| 164 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 165 | + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
| 166 | + |
| 167 | + /* AtkObject */ |
| 168 | + atk_class->initialize = unity_panel_home_button_accessible_initialize; |
| 169 | + atk_class->get_n_children = unity_panel_home_button_accessible_get_n_children; |
| 170 | + atk_class->ref_child = unity_panel_home_button_accessible_ref_child; |
| 171 | + |
| 172 | + g_type_class_add_private (gobject_class, sizeof (UnityPanelHomeButtonAccessiblePrivate)); |
| 173 | +} |
| 174 | + |
| 175 | +static void |
| 176 | +unity_panel_home_button_accessible_init (UnityPanelHomeButtonAccessible *self) |
| 177 | +{ |
| 178 | + self->priv = UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_PRIVATE (self); |
| 179 | +} |
| 180 | + |
| 181 | +AtkObject * |
| 182 | +unity_panel_home_button_accessible_new (nux::Object *object) |
| 183 | +{ |
| 184 | + AtkObject *accessible; |
| 185 | + |
| 186 | + g_return_val_if_fail (dynamic_cast<PanelHomeButton *>(object), NULL); |
| 187 | + |
| 188 | + accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, NULL)); |
| 189 | + |
| 190 | + atk_object_initialize (accessible, object); |
| 191 | + |
| 192 | + return accessible; |
| 193 | +} |
| 194 | + |
| 195 | +static void |
| 196 | +unity_panel_home_button_accessible_initialize (AtkObject *accessible, gpointer data) |
| 197 | +{ |
| 198 | + ATK_OBJECT_CLASS (unity_panel_home_button_accessible_parent_class)->initialize (accessible, data); |
| 199 | + |
| 200 | + accessible->role = ATK_ROLE_PUSH_BUTTON; |
| 201 | +} |
| 202 | + |
| 203 | +static gint |
| 204 | +unity_panel_home_button_accessible_get_n_children (AtkObject *accessible) |
| 205 | +{ |
| 206 | + return 0; |
| 207 | +} |
| 208 | + |
| 209 | +static AtkObject * |
| 210 | +unity_panel_home_button_accessible_ref_child (AtkObject *accessible, gint i) |
| 211 | +{ |
| 212 | + return NULL; |
| 213 | +} |
| 214 | |
| 215 | === added file 'src/unity-panel-home-button-accessible.h' |
| 216 | --- src/unity-panel-home-button-accessible.h 1970-01-01 00:00:00 +0000 |
| 217 | +++ src/unity-panel-home-button-accessible.h 2011-01-27 12:40:59 +0000 |
| 218 | @@ -0,0 +1,57 @@ |
| 219 | +/* |
| 220 | + * Copyright (C) 2011 Canonical Ltd |
| 221 | + * |
| 222 | + * This program is free software: you can redistribute it and/or modify |
| 223 | + * it under the terms of the GNU General Public License version 3 as |
| 224 | + * published by the Free Software Foundation. |
| 225 | + * |
| 226 | + * This program is distributed in the hope that it will be useful, |
| 227 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 228 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 229 | + * GNU General Public License for more details. |
| 230 | + * |
| 231 | + * You should have received a copy of the GNU General Public License |
| 232 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 233 | + * |
| 234 | + * Authored by: Rodrigo Moya <[email protected]> |
| 235 | + */ |
| 236 | + |
| 237 | +#ifndef UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_H |
| 238 | +#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_H |
| 239 | + |
| 240 | +#include <atk/atk.h> |
| 241 | + |
| 242 | +#include "nux-view-accessible.h" |
| 243 | + |
| 244 | +G_BEGIN_DECLS |
| 245 | + |
| 246 | +#define UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE (unity_panel_home_button_accessible_get_type ()) |
| 247 | +#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessible)) |
| 248 | +#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessibleClass)) |
| 249 | +#define UNITY_IS_PANEL_HOME_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE)) |
| 250 | +#define UNITY_IS_PANEL_HOME_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE)) |
| 251 | +#define UNITY_PANEL_HOME_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PANEL_HOME_BUTTON_ACCESSIBLE, UnityPanelHomeButtonAccessibleClass)) |
| 252 | + |
| 253 | +typedef struct _UnityPanelHomeButtonAccessible UnityPanelHomeButtonAccessible; |
| 254 | +typedef struct _UnityPanelHomeButtonAccessibleClass UnityPanelHomeButtonAccessibleClass; |
| 255 | +typedef struct _UnityPanelHomeButtonAccessiblePrivate UnityPanelHomeButtonAccessiblePrivate; |
| 256 | + |
| 257 | +struct _UnityPanelHomeButtonAccessible |
| 258 | +{ |
| 259 | + NuxViewAccessible parent; |
| 260 | + |
| 261 | + /* < private > */ |
| 262 | + UnityPanelHomeButtonAccessiblePrivate *priv; |
| 263 | +}; |
| 264 | + |
| 265 | +struct _UnityPanelHomeButtonAccessibleClass |
| 266 | +{ |
| 267 | + NuxViewAccessibleClass parent_class; |
| 268 | +}; |
| 269 | + |
| 270 | +GType unity_panel_home_button_accessible_get_type (void); |
| 271 | +AtkObject *unity_panel_home_button_accessible_new (nux::Object *object); |
| 272 | + |
| 273 | +G_END_DECLS |
| 274 | + |
| 275 | +#endif |
| 276 | |
| 277 | === added file 'src/unity-panel-view-accessible.cpp' |
| 278 | --- src/unity-panel-view-accessible.cpp 1970-01-01 00:00:00 +0000 |
| 279 | +++ src/unity-panel-view-accessible.cpp 2011-01-27 12:40:59 +0000 |
| 280 | @@ -0,0 +1,144 @@ |
| 281 | +/* |
| 282 | + * Copyright (C) 2011 Canonical Ltd |
| 283 | + * |
| 284 | + * This program is free software: you can redistribute it and/or modify |
| 285 | + * it under the terms of the GNU General Public License version 3 as |
| 286 | + * published by the Free Software Foundation. |
| 287 | + * |
| 288 | + * This program is distributed in the hope that it will be useful, |
| 289 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 290 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 291 | + * GNU General Public License for more details. |
| 292 | + * |
| 293 | + * You should have received a copy of the GNU General Public License |
| 294 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 295 | + * |
| 296 | + * Authored by: Rodrigo Moya <[email protected]> |
| 297 | + */ |
| 298 | + |
| 299 | +/** |
| 300 | + * SECTION:unity-panel-view-accessible |
| 301 | + * @Title: UnityPanelViewAccessible |
| 302 | + * @short_description: Implementation of the ATK interfaces for #PanelView |
| 303 | + * @see_also: PanelView |
| 304 | + * |
| 305 | + * #UnityPanelViewAccessible implements the required ATK interfaces for |
| 306 | + * #PanelView, ie: exposing the different items contained in the panel |
| 307 | + * as children. |
| 308 | + * |
| 309 | + */ |
| 310 | + |
| 311 | +#include <Nux/Nux.h> |
| 312 | +#include "PanelView.h" |
| 313 | +#include "unity-panel-view-accessible.h" |
| 314 | + |
| 315 | +#include "unitya11y.h" |
| 316 | + |
| 317 | +/* GObject */ |
| 318 | +static void unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass); |
| 319 | +static void unity_panel_view_accessible_init (UnityPanelViewAccessible *self); |
| 320 | + |
| 321 | +/* AtkObject */ |
| 322 | +static void unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data); |
| 323 | +static gint unity_panel_view_accessible_get_n_children (AtkObject *accessible); |
| 324 | +static AtkObject *unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i); |
| 325 | + |
| 326 | +#define UNITY_PANEL_VIEW_ACCESSIBLE_GET_PRIVATE(obj) \ |
| 327 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessiblePrivate)) |
| 328 | + |
| 329 | +G_DEFINE_TYPE (UnityPanelViewAccessible, unity_panel_view_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
| 330 | + |
| 331 | +struct _UnityPanelViewAccessiblePrivate |
| 332 | +{ |
| 333 | +}; |
| 334 | + |
| 335 | +static void |
| 336 | +unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass) |
| 337 | +{ |
| 338 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 339 | + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
| 340 | + |
| 341 | + /* AtkObject */ |
| 342 | + atk_class->initialize = unity_panel_view_accessible_initialize; |
| 343 | + atk_class->get_n_children = unity_panel_view_accessible_get_n_children; |
| 344 | + atk_class->ref_child = unity_panel_view_accessible_ref_child; |
| 345 | + |
| 346 | + g_type_class_add_private (gobject_class, sizeof (UnityPanelViewAccessiblePrivate)); |
| 347 | +} |
| 348 | + |
| 349 | +static void |
| 350 | +unity_panel_view_accessible_init (UnityPanelViewAccessible *self) |
| 351 | +{ |
| 352 | + self->priv = UNITY_PANEL_VIEW_ACCESSIBLE_GET_PRIVATE (self); |
| 353 | +} |
| 354 | + |
| 355 | +AtkObject * |
| 356 | +unity_panel_view_accessible_new (nux::Object *object) |
| 357 | +{ |
| 358 | + AtkObject *accessible; |
| 359 | + |
| 360 | + g_return_val_if_fail (dynamic_cast<PanelView *>(object), NULL); |
| 361 | + |
| 362 | + accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, NULL)); |
| 363 | + |
| 364 | + atk_object_initialize (accessible, object); |
| 365 | + |
| 366 | + return accessible; |
| 367 | +} |
| 368 | + |
| 369 | +static void |
| 370 | +unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data) |
| 371 | +{ |
| 372 | + ATK_OBJECT_CLASS (unity_panel_view_accessible_parent_class)->initialize (accessible, data); |
| 373 | + |
| 374 | + accessible->role = ATK_ROLE_PANEL; |
| 375 | +} |
| 376 | + |
| 377 | +static gint |
| 378 | +unity_panel_view_accessible_get_n_children (AtkObject *accessible) |
| 379 | +{ |
| 380 | + nux::Object *nux_object = NULL; |
| 381 | + PanelView *panel; |
| 382 | + nux::HLayout *layout; |
| 383 | + gint rc = 0; |
| 384 | + |
| 385 | + g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), 0); |
| 386 | + |
| 387 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
| 388 | + if (!nux_object) /* state is defunct */ |
| 389 | + return 0; |
| 390 | + |
| 391 | + panel = dynamic_cast<PanelView *>(nux_object); |
| 392 | + if ((layout = panel->Layout ()) != NULL) |
| 393 | + rc = 1; |
| 394 | + |
| 395 | + return rc; |
| 396 | +} |
| 397 | + |
| 398 | +static AtkObject * |
| 399 | +unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i) |
| 400 | +{ |
| 401 | + nux::Object *nux_object = NULL; |
| 402 | + PanelView *panel; |
| 403 | + nux::HLayout *layout; |
| 404 | + AtkObject *child_accessible = NULL; |
| 405 | + |
| 406 | + g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), NULL); |
| 407 | + |
| 408 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
| 409 | + if (!nux_object) /* state is defunct */ |
| 410 | + return NULL; |
| 411 | + |
| 412 | + panel = dynamic_cast<PanelView *>(nux_object); |
| 413 | + if ((layout = panel->Layout ()) != NULL) |
| 414 | + { |
| 415 | + nux::Object *child = NULL; |
| 416 | + |
| 417 | + child = dynamic_cast<nux::Object *>(layout); |
| 418 | + child_accessible = unity_a11y_get_accessible (child); |
| 419 | + if (child_accessible != NULL) |
| 420 | + g_object_ref (child_accessible); |
| 421 | + } |
| 422 | + |
| 423 | + return child_accessible; |
| 424 | +} |
| 425 | |
| 426 | === added file 'src/unity-panel-view-accessible.h' |
| 427 | --- src/unity-panel-view-accessible.h 1970-01-01 00:00:00 +0000 |
| 428 | +++ src/unity-panel-view-accessible.h 2011-01-27 12:40:59 +0000 |
| 429 | @@ -0,0 +1,57 @@ |
| 430 | +/* |
| 431 | + * Copyright (C) 2011 Canonical Ltd |
| 432 | + * |
| 433 | + * This program is free software: you can redistribute it and/or modify |
| 434 | + * it under the terms of the GNU General Public License version 3 as |
| 435 | + * published by the Free Software Foundation. |
| 436 | + * |
| 437 | + * This program is distributed in the hope that it will be useful, |
| 438 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 439 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 440 | + * GNU General Public License for more details. |
| 441 | + * |
| 442 | + * You should have received a copy of the GNU General Public License |
| 443 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 444 | + * |
| 445 | + * Authored by: Rodrigo Moya <[email protected]> |
| 446 | + */ |
| 447 | + |
| 448 | +#ifndef UNITY_PANEL_VIEW_ACCESSIBLE_H |
| 449 | +#define UNITY_PANEL_VIEW_ACCESSIBLE_H |
| 450 | + |
| 451 | +#include <atk/atk.h> |
| 452 | + |
| 453 | +#include "nux-view-accessible.h" |
| 454 | + |
| 455 | +G_BEGIN_DECLS |
| 456 | + |
| 457 | +#define UNITY_TYPE_PANEL_VIEW_ACCESSIBLE (unity_panel_view_accessible_get_type ()) |
| 458 | +#define UNITY_PANEL_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessible)) |
| 459 | +#define UNITY_PANEL_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessibleClass)) |
| 460 | +#define UNITY_IS_PANEL_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE)) |
| 461 | +#define UNITY_IS_PANEL_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE)) |
| 462 | +#define UNITY_PANEL_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, UnityPanelViewAccessibleClass)) |
| 463 | + |
| 464 | +typedef struct _UnityPanelViewAccessible UnityPanelViewAccessible; |
| 465 | +typedef struct _UnityPanelViewAccessibleClass UnityPanelViewAccessibleClass; |
| 466 | +typedef struct _UnityPanelViewAccessiblePrivate UnityPanelViewAccessiblePrivate; |
| 467 | + |
| 468 | +struct _UnityPanelViewAccessible |
| 469 | +{ |
| 470 | + NuxViewAccessible parent; |
| 471 | + |
| 472 | + /* < private > */ |
| 473 | + UnityPanelViewAccessiblePrivate *priv; |
| 474 | +}; |
| 475 | + |
| 476 | +struct _UnityPanelViewAccessibleClass |
| 477 | +{ |
| 478 | + NuxViewAccessibleClass parent_class; |
| 479 | +}; |
| 480 | + |
| 481 | +GType unity_panel_view_accessible_get_type (void); |
| 482 | +AtkObject *unity_panel_view_accessible_new (nux::Object *object); |
| 483 | + |
| 484 | +G_END_DECLS |
| 485 | + |
| 486 | +#endif |
| 487 | |
| 488 | === modified file 'src/unity-root-accessible.cpp' |
| 489 | --- src/unity-root-accessible.cpp 2011-01-13 17:40:05 +0000 |
| 490 | +++ src/unity-root-accessible.cpp 2011-01-27 12:40:59 +0000 |
| 491 | @@ -182,5 +182,5 @@ |
| 492 | unity_a11y_get_accessible (window); |
| 493 | |
| 494 | self->priv->window_list = |
| 495 | - g_slist_append (self->priv->window_list, window_accessible); |
| 496 | + g_slist_append (self->priv->window_list, window_accessible); |
| 497 | } |
| 498 | |
| 499 | === modified file 'src/unity-util-accessible.cpp' |
| 500 | --- src/unity-util-accessible.cpp 2011-01-26 19:46:30 +0000 |
| 501 | +++ src/unity-util-accessible.cpp 2011-01-27 12:40:59 +0000 |
| 502 | @@ -109,27 +109,27 @@ |
| 503 | |
| 504 | type = g_type_from_name (object_type); |
| 505 | if (type) |
| 506 | - { |
| 507 | - signal_id = g_signal_lookup (signal_name, type); |
| 508 | - if (signal_id > 0) |
| 509 | { |
| 510 | - UnityUtilListenerInfo *listener_info; |
| 511 | - |
| 512 | - rc = listener_idx; |
| 513 | - listener_info = g_new0 (UnityUtilListenerInfo, 1); |
| 514 | - listener_info->idx = listener_idx; |
| 515 | - listener_info->hook_id = g_signal_add_emission_hook (signal_id, 0, listener, |
| 516 | - g_strdup (hook_data), |
| 517 | - (GDestroyNotify) g_free); |
| 518 | - listener_info->signal_id = signal_id; |
| 519 | - |
| 520 | - g_hash_table_insert (listener_list, &(listener_info->idx), listener_info); |
| 521 | - |
| 522 | - listener_idx++; |
| 523 | + signal_id = g_signal_lookup (signal_name, type); |
| 524 | + if (signal_id > 0) |
| 525 | + { |
| 526 | + UnityUtilListenerInfo *listener_info; |
| 527 | + |
| 528 | + rc = listener_idx; |
| 529 | + listener_info = g_new0 (UnityUtilListenerInfo, 1); |
| 530 | + listener_info->idx = listener_idx; |
| 531 | + listener_info->hook_id = g_signal_add_emission_hook (signal_id, 0, listener, |
| 532 | + g_strdup (hook_data), |
| 533 | + (GDestroyNotify) g_free); |
| 534 | + listener_info->signal_id = signal_id; |
| 535 | + |
| 536 | + g_hash_table_insert (listener_list, &(listener_info->idx), listener_info); |
| 537 | + |
| 538 | + listener_idx++; |
| 539 | + } |
| 540 | + else |
| 541 | + g_debug ("Signal type %s not supported\n", signal_name); |
| 542 | } |
| 543 | - else |
| 544 | - g_debug ("Signal type %s not supported\n", signal_name); |
| 545 | - } |
| 546 | else |
| 547 | g_warning ("Invalid object type %s\n", object_type); |
| 548 | |
| 549 | @@ -145,19 +145,19 @@ |
| 550 | |
| 551 | split_string = g_strsplit (event_type, ":", 3); |
| 552 | if (split_string) |
| 553 | - { |
| 554 | - if (g_str_equal ("window", split_string[0])) |
| 555 | - { |
| 556 | - /* FIXME: need to specifically process window: events (create, destroy, |
| 557 | - minimize, maximize, restore, activate, deactivate) */ |
| 558 | - } |
| 559 | - else |
| 560 | - { |
| 561 | - rc = add_listener (listener, split_string[1], split_string[2], event_type); |
| 562 | - } |
| 563 | + { |
| 564 | + if (g_str_equal ("window", split_string[0])) |
| 565 | + { |
| 566 | + /* FIXME: need to specifically process window: events (create, destroy, |
| 567 | + minimize, maximize, restore, activate, deactivate) */ |
| 568 | + } |
| 569 | + else |
| 570 | + { |
| 571 | + rc = add_listener (listener, split_string[1], split_string[2], event_type); |
| 572 | + } |
| 573 | |
| 574 | - g_strfreev (split_string); |
| 575 | - } |
| 576 | + g_strfreev (split_string); |
| 577 | + } |
| 578 | |
| 579 | return rc; |
| 580 | } |
| 581 | @@ -166,27 +166,27 @@ |
| 582 | unity_util_accessible_remove_global_event_listener (guint remove_listener) |
| 583 | { |
| 584 | if (remove_listener > 0) |
| 585 | - { |
| 586 | - UnityUtilListenerInfo *listener_info; |
| 587 | + { |
| 588 | + UnityUtilListenerInfo *listener_info; |
| 589 | |
| 590 | - listener_info = (UnityUtilListenerInfo *) g_hash_table_lookup (listener_list, &remove_listener); |
| 591 | - if (listener_info != NULL) |
| 592 | - { |
| 593 | - if (listener_info->hook_id != 0 && listener_info->signal_id != 0) |
| 594 | - { |
| 595 | - g_signal_remove_emission_hook (listener_info->signal_id, |
| 596 | - listener_info->hook_id); |
| 597 | - g_hash_table_remove (listener_list, &remove_listener); |
| 598 | - } |
| 599 | + listener_info = (UnityUtilListenerInfo *) g_hash_table_lookup (listener_list, &remove_listener); |
| 600 | + if (listener_info != NULL) |
| 601 | + { |
| 602 | + if (listener_info->hook_id != 0 && listener_info->signal_id != 0) |
| 603 | + { |
| 604 | + g_signal_remove_emission_hook (listener_info->signal_id, |
| 605 | + listener_info->hook_id); |
| 606 | + g_hash_table_remove (listener_list, &remove_listener); |
| 607 | + } |
| 608 | + else |
| 609 | + { |
| 610 | + g_warning ("Invalid listener hook_id %ld or signal_id %d", |
| 611 | + listener_info->hook_id, listener_info->signal_id); |
| 612 | + } |
| 613 | + } |
| 614 | else |
| 615 | - { |
| 616 | - g_warning ("Invalid listener hook_id %ld or signal_id %d", |
| 617 | - listener_info->hook_id, listener_info->signal_id); |
| 618 | - } |
| 619 | + g_warning ("No listener with the specified ID: %d", remove_listener); |
| 620 | } |
| 621 | - else |
| 622 | - g_warning ("No listener with the specified ID: %d", remove_listener); |
| 623 | - } |
| 624 | else |
| 625 | g_warning ("Invalid listener_id: %d", remove_listener); |
| 626 | } |
| 627 | |
| 628 | === modified file 'src/unitya11y.cpp' |
| 629 | --- src/unitya11y.cpp 2011-01-26 19:46:30 +0000 |
| 630 | +++ src/unitya11y.cpp 2011-01-27 12:40:59 +0000 |
| 631 | @@ -32,8 +32,11 @@ |
| 632 | /* unity accessible objects */ |
| 633 | #include "Launcher.h" |
| 634 | #include "LauncherIcon.h" |
| 635 | +#include "PanelView.h" |
| 636 | #include "unity-launcher-accessible.h" |
| 637 | #include "unity-launcher-icon-accessible.h" |
| 638 | +#include "unity-panel-view-accessible.h" |
| 639 | +#include "unity-panel-home-button-accessible.h" |
| 640 | |
| 641 | static GHashTable *accessible_table = NULL; |
| 642 | /* FIXME: remove accessible objects when not required anymore */ |
| 643 | @@ -239,6 +242,12 @@ |
| 644 | if (object->Type().IsDerivedFromType (LauncherIcon::StaticObjectType)) |
| 645 | return unity_launcher_icon_accessible_new (object); |
| 646 | |
| 647 | + if (object->Type().IsDerivedFromType (PanelView::StaticObjectType)) |
| 648 | + return unity_panel_view_accessible_new (object); |
| 649 | + |
| 650 | + if (object->Type().IsDerivedFromType (PanelHomeButton::StaticObjectType)) |
| 651 | + return unity_panel_home_button_accessible_new (object); |
| 652 | + |
| 653 | /* NUX classes */ |
| 654 | if (object->Type().IsDerivedFromType (nux::BaseWindow::StaticObjectType)) |
| 655 | return nux_base_window_accessible_new (object); |
| 656 | |
| 657 | === modified file 'src/unityshell.cpp' |
| 658 | --- src/unityshell.cpp 2011-01-27 09:51:04 +0000 |
| 659 | +++ src/unityshell.cpp 2011-01-27 12:40:59 +0000 |
| 660 | @@ -581,6 +581,12 @@ |
| 661 | self->panelWindow->ShowWindow(true); |
| 662 | self->panelWindow->EnableInputWindow(true); |
| 663 | self->panelWindow->InputWindowEnableStruts(true); |
| 664 | + |
| 665 | + /* FIXME: this should not be manual, should be managed with a |
| 666 | + show/hide callback like in GAIL*/ |
| 667 | + if (unity_a11y_initialized () == TRUE) |
| 668 | + unity_util_accessible_add_window (self->panelWindow); |
| 669 | + |
| 670 | LOGGER_END_PROCESS ("initLauncher-Panel"); |
| 671 | |
| 672 | /* Setup Places */ |

It seems to work for me, but I have some questions:
211 +static const gchar * panel_accessibl e_get_name (AtkObject *accessible) ssible" ;
212 +unity_
213 +{
214 + return "UnityPanelAcce
215 +}
I'm not sure about it. Why redefine the get_name here? set_name, that would be useless. Take a look to LauncherIconAcc essible, it checks first if parent implementation provides a name.
* It totally overrides the get/set name methods, so if anyone wants to set the name with atk_object_
* This name is meaningless for any AT point of view, as it gets the information from the role (already set on the initialize).
225 +static gint panel_accessibl e_get_n_ children (AtkObject *accessible) panel_accessibl e_ref_child (AtkObject *accessible, gint i)
226 +unity_
...
251 +static AtkObject *
252 +unity_
You are exposing here as direct children of PanelView the objects that belong to the internal Layout. But take into account that other approach would be expose just one child, the layout. After all we already have a NuxLayoutAccessible object. That would allow to not replicate the "get the children code". I used that approach on BaseWindow. Is there any reason to expose the children in this way? (Please take into account that I'm not saying that it is wrong, just asking if there is a reason).
Probably offtopic: it is normal all those lines related to the global listeners, or is just that you used as base an old branch? AFAIK, this global event listeners are already merged.