Merge lp:~themuso/unity/keep-copy-of-session-button-label into lp:unity

Proposed by Luke Yelavich
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4009
Proposed branch: lp:~themuso/unity/keep-copy-of-session-button-label
Merge into: lp:unity
Diff against target: 106 lines (+39/-7)
2 files modified
plugins/unityshell/src/unity-session-button-accessible.cpp (+36/-7)
plugins/unityshell/src/unity-session-button-accessible.h (+3/-0)
To merge this branch: bzr merge lp:~themuso/unity/keep-copy-of-session-button-label
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+270922@code.launchpad.net

Commit message

Make a copy of a session button plain text label

Similar to the fix for quicklist menu items, keep a copy of the session
button label for a11y use to allow for the buttons in the session dialog
to be spoken by Orca.

Description of the change

Make a copy of a quicklist menu item plain text label

Similar to the fix for quicklist menu items, keep a copy of the session
button label for a11y use to allow for the buttons in the session dialog
to be spoken by Orca.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unity-session-button-accessible.cpp'
2--- plugins/unityshell/src/unity-session-button-accessible.cpp 2014-02-25 01:07:06 +0000
3+++ plugins/unityshell/src/unity-session-button-accessible.cpp 2015-09-14 02:11:45 +0000
4@@ -65,6 +65,15 @@
5 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
6 atk_action_interface_init))
7
8+#define UNITY_SESSION_BUTTON_ACCESSIBLE_GET_PRIVATE(obj) \
9+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_SESSION_BUTTON_ACCESSIBLE, \
10+ UnitySessionButtonAccessiblePrivate))
11+
12+struct _UnitySessionButtonAccessiblePrivate
13+{
14+ gchar *name;
15+};
16+
17 static void
18 unity_session_button_accessible_class_init(UnitySessionButtonAccessibleClass* klass)
19 {
20@@ -78,16 +87,30 @@
21 atk_class->initialize = unity_session_button_accessible_initialize;
22 atk_class->get_name = unity_session_button_accessible_get_name;
23 atk_class->ref_state_set = unity_session_button_accessible_ref_state_set;
24+
25+ g_type_class_add_private(gobject_class, sizeof(UnitySessionButtonAccessiblePrivate));
26 }
27
28 static void
29 unity_session_button_accessible_init(UnitySessionButtonAccessible* session_button_accessible)
30 {
31+ UnitySessionButtonAccessiblePrivate *priv =
32+ UNITY_SESSION_BUTTON_ACCESSIBLE_GET_PRIVATE(session_button_accessible);
33+
34+ session_button_accessible->priv = priv;
35+ session_button_accessible->priv->name = NULL;
36 }
37
38 static void
39 unity_session_button_accessible_dispose(GObject* object)
40 {
41+ UnitySessionButtonAccessible *self = UNITY_SESSION_BUTTON_ACCESSIBLE(object);
42+
43+ if (self->priv->name != NULL) {
44+ g_free(self->priv->name);
45+ self->priv->name = NULL;
46+ }
47+
48 G_OBJECT_CLASS(unity_session_button_accessible_parent_class)->dispose(object);
49 }
50
51@@ -139,24 +162,30 @@
52 static const gchar*
53 unity_session_button_accessible_get_name(AtkObject* obj)
54 {
55- const gchar* name;
56-
57 g_return_val_if_fail(UNITY_IS_SESSION_BUTTON_ACCESSIBLE(obj), NULL);
58
59- name = ATK_OBJECT_CLASS(unity_session_button_accessible_parent_class)->get_name(obj);
60- if (name == NULL)
61+ UnitySessionButtonAccessible *self = UNITY_SESSION_BUTTON_ACCESSIBLE(obj);
62+
63+ if (self->priv->name)
64+ {
65+ g_free(self->priv->name);
66+ self->priv->name = NULL;
67+ }
68+
69+ self->priv->name = g_strdup(ATK_OBJECT_CLASS(unity_session_button_accessible_parent_class)->get_name(obj));
70+ if (self->priv->name == NULL)
71 {
72 Button* button = NULL;
73
74 button = dynamic_cast<Button*>(nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj)));
75
76 if (button == NULL) /* State is defunct */
77- name = NULL;
78+ self->priv->name = NULL;
79 else
80- name = button->label().c_str();
81+ self->priv->name = g_strdup(button->label().c_str());
82 }
83
84- return name;
85+ return self->priv->name;
86 }
87
88 static AtkStateSet*
89
90=== modified file 'plugins/unityshell/src/unity-session-button-accessible.h'
91--- plugins/unityshell/src/unity-session-button-accessible.h 2014-02-25 01:07:06 +0000
92+++ plugins/unityshell/src/unity-session-button-accessible.h 2015-09-14 02:11:45 +0000
93@@ -34,10 +34,13 @@
94
95 typedef struct _UnitySessionButtonAccessible UnitySessionButtonAccessible;
96 typedef struct _UnitySessionButtonAccessibleClass UnitySessionButtonAccessibleClass;
97+typedef struct _UnitySessionButtonAccessiblePrivate UnitySessionButtonAccessiblePrivate;
98
99 struct _UnitySessionButtonAccessible
100 {
101 NuxObjectAccessible parent;
102+
103+ UnitySessionButtonAccessiblePrivate *priv;
104 };
105
106 struct _UnitySessionButtonAccessibleClass