Merge lp://qastaging/~rodrigo-moya/unity/ref-state-set-for-panel-service into lp://qastaging/unity

Proposed by Rodrigo Moya
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 899
Proposed branch: lp://qastaging/~rodrigo-moya/unity/ref-state-set-for-panel-service
Merge into: lp://qastaging/unity
To merge this branch: bzr merge lp://qastaging/~rodrigo-moya/unity/ref-state-set-for-panel-service
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Alejandro Piñeiro (community) Approve
Review via email: mp+50955@code.qastaging.launchpad.net

Description of the change

Implement ATK states for PanelIndicatorEntryAccessible

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Just talked with API, and this is missing the same for PanelIndicatorAccessible, so adding it now

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

Well, probably my mistake for not explaining it.

Normally you don't maintain a private state_set. Normally (except in very few cases) ref_state_set is implemented in a incremental way, to avoid each object providing all the states required, and just filled on the ref_state_set. Take into account that atk_object also have a ref_state_set adding some states, and you are not using it.

So, instead of having a private state_set, our custom ref_state_set should start calling the parent ref_state_set, and then just add the particular states for your object. I know that this means that the state_set can't be filled outside of the ref_state_set implementation, but that was made by purpose. Take a look to this bug [1] (that was more a discussion).

Then you use atk_object_notify_state_change to notify a change on any state. But you don't require to modify the state set on the method (normally a callback) doing that.

You can take a look to the implementation of ref_state_set on nux-object-accessible_ref_state_set

So:

40 + AtkStateSet *state_set;

Don't use a custom state_set, as if you do that, you are not getting the states that comes from the parent.

54 + atk_state_set_add_state (piea->priv->state_set, ATK_STATE_ACTIVE);
55 + atk_state_set_add_state (piea->priv->state_set, ATK_STATE_FOCUSED);

As I said, those calls out of ref_state_set are useless. This apply to all this calls, also on the initialize.

140 +panel_indicator_entry_accessible_ref_state_set (AtkObject *accessible)

Update this method, in order to get the state_set from the parent, and then add the proper states.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=635807

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

183 + else
184 + {
185 + atk_state_set_remove_state (state_set, ATK_STATE_ACTIVE);
186 + atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
187 + atk_state_set_remove_state (state_set, ATK_STATE_SHOWING);
188 + }

Why you need to remove it? As I said, normally the state_set is created new, and empty. This should be only required if you suspect that any of his parents is adding those states. This is really unlikely, as the parent is AtkObject.

Other than that, the code seems ok.

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

A sanity-check against NULL for user_data in on_entry_activated_cb() before doing PanelIndicatorEntryAccessible *piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (user_data); would be good.

Apart from that approved.

review: Approve