Merge lp:~themuso/libindicator/accessible-name into lp:libindicator/0.4

Proposed by Luke Yelavich
Status: Merged
Merged at revision: 398
Proposed branch: lp:~themuso/libindicator/accessible-name
Merge into: lp:libindicator/0.4
Diff against target: 202 lines (+59/-0)
5 files modified
libindicator/indicator-object.c (+29/-0)
libindicator/indicator-object.h (+10/-0)
tests/dummy-indicator-null.c (+6/-0)
tests/dummy-indicator-signaler.c (+7/-0)
tests/dummy-indicator-simple.c (+7/-0)
To merge this branch: bzr merge lp:~themuso/libindicator/accessible-name
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+46699@code.launchpad.net

Description of the change

Accessible name support. Still not sure whether the documentatino formatting is right, or whether it needs more elaboration.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Probably should make the function prototype and struct property const so that users know they shouldn't free them. Otherwise looks good.

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

Luke, Ted told me you didn't want to merge this in before you got other pieces. So, what is blocking this? I have a branch (https://code.launchpad.net/~rodrigo-moya/unity/indicators-a11y/+merge/48943) that is missing something like this to provide a good description for the indicator objects.

Some comments though:

The get_accessible_name seems to be related to the IndicatorObject, not the IndicatorObjectEntry's, so why do you have this:

62 struct _IndicatorObjectEntry {
63 GtkLabel * label;
64 GtkImage * image;
65 GtkMenu * menu;
66 + gchar * accessible_name;
67 };

wouldn't it be better to just have a indicator_object_get_accessible_name function for the IndicatorObject? Also, maybe just call it get_description, instead of get_accessible_name?

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2011-02-08 at 17:26 +0000, Rodrigo Moya wrote:
> The get_accessible_name seems to be related to the IndicatorObject,
> not the IndicatorObjectEntry's, so why do you have this:

It needs to be related to the entires as those each represent an item on
the panel. The object represents a collection of items on the panel.
So for things like the sound menu there is a 1:1 ratio of objects to
entries, but for application indicators it's 1:n.

Revision history for this message
Luke Yelavich (themuso) wrote :

On Wed, Feb 09, 2011 at 04:26:52AM EST, Rodrigo Moya wrote:
> wouldn't it be better to just have a indicator_object_get_accessible_name function for the IndicatorObject? Also, maybe just call it get_description, instead of get_accessible_name?

Yes, I have actually renamed it in my code, now called accessible_desc, and related changes in indicator-application/libappindicator.

In terms of readiness, I was almost there, till I realised that we will likely have to add another signal, because even if an indicator updates the information that get_accessible_desc harvists, the unity panel and indicator applet still won't know something has changed, short of being signaled. Using such a signal is not a problem for indicator-application, because indicator-application sends an indicator entry pointer through to the displayer, i.e the applet/unity panel.

My problem that I am running into with this new signal is with the system indicators, as they don't deal with constructing their own IndicatorObjectEntry structure, i.e they use the default get_entries method from indicator-object, get_entries_default(Indicator Object * io). Even if another method is added to indicator-object allowing this to be worked around somehow, some indicators like indicator-sound are modular to the point where its not possible to call the accessibility description update signal from particular objects that make up the indicator, short of extending method calls to pass the indicator object pointer through to where its needed etc.

I hope what I have written above makes sense, I know what i mean in my head of course, but explaining it is something else :) so let me know if you need me to clarrify anything above. Of course I could extend the indicators as necessary to make sure the indicator object pointer is where it is needed, but I don't want to do that until I know there is no other way of doing it. If either of you have any suggestions, I'm all ears.

Luke

396. By Luke Yelavich

Merge from trunk

397. By Luke Yelavich

use const gchar for variable and prototype

398. By Luke Yelavich

* accessible_name -> accessible_desc to better reflect the use of the content.
* Add accessible-desc-update signal so that indicators can tell
  indicator-applet/unity that the accessible description has changed

399. By Luke Yelavich

accessible_name -> accessible_desc in tests as well

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicator/indicator-object.c'
2--- libindicator/indicator-object.c 2011-01-26 23:12:42 +0000
3+++ libindicator/indicator-object.c 2011-02-14 02:38:08 +0000
4@@ -61,6 +61,7 @@
5 SCROLL_ENTRY,
6 MENU_SHOW,
7 SHOW_NOW_CHANGED,
8+ ACCESSIBLE_DESC_UPDATE,
9 LAST_SIGNAL
10 };
11
12@@ -91,6 +92,7 @@
13 klass->get_label = NULL;
14 klass->get_menu = NULL;
15 klass->get_image = NULL;
16+ klass->get_accessible_desc = NULL;
17
18 klass->get_entries = get_entries_default;
19 klass->get_location = NULL;
20@@ -221,6 +223,24 @@
21 _indicator_object_marshal_VOID__POINTER_BOOLEAN,
22 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN);
23
24+ /**
25+ IndicatorObject::accessible-desc-update::
26+ @arg0: The #IndicatorObject object
27+ @arg1: A pointer to the #IndicatorObjectEntry whos
28+ accessible description has been updated.
29+
30+ Signaled when an indicator's accessible description
31+ has been updated, so that the displayer of the
32+ indicator can fetch the new description.
33+ */
34+ signals[ACCESSIBLE_DESC_UPDATE] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE,
35+ G_TYPE_FROM_CLASS(klass),
36+ G_SIGNAL_RUN_LAST,
37+ G_STRUCT_OFFSET (IndicatorObjectClass, accessible_desc_update),
38+ NULL, NULL,
39+ g_cclosure_marshal_VOID__POINTER,
40+ G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE);
41+
42
43 return;
44 }
45@@ -236,6 +256,7 @@
46 self->priv->entry.menu = NULL;
47 self->priv->entry.label = NULL;
48 self->priv->entry.image = NULL;
49+ self->priv->entry.accessible_desc = NULL;
50
51 self->priv->gotten_entries = FALSE;
52
53@@ -416,6 +437,14 @@
54 return NULL;
55 }
56
57+ if (class->get_accessible_desc) {
58+ priv->entry.accessible_desc = class->get_accessible_desc(io);
59+ }
60+
61+ if (priv->entry.accessible_desc == NULL) {
62+ g_warning("IndicatorObject class does not have an accessible description.");
63+ }
64+
65 priv->gotten_entries = TRUE;
66 }
67
68
69=== modified file 'libindicator/indicator-object.h'
70--- libindicator/indicator-object.h 2011-01-27 11:24:00 +0000
71+++ libindicator/indicator-object.h 2011-02-14 02:38:08 +0000
72@@ -57,6 +57,8 @@
73 #define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE))
74 #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed"
75 #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED, INDICATOR_OBJECT_TYPE))
76+#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE "accessible-desc-update"
77+#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, INDICATOR_OBJECT_TYPE))
78
79 typedef struct _IndicatorObject IndicatorObject;
80 typedef struct _IndicatorObjectClass IndicatorObjectClass;
81@@ -75,6 +77,8 @@
82 @get_menu: Gets the image for this object. Should be set
83 to #NULL if @get_entries is set. Should NOT ref the
84 object.
85+ @get_accessible_desc: Gets the accessible descriptionfor this
86+ object.
87 @get_entries: Gets all of the entires for this object returning
88 a #GList of #IndicatorObjectEntries. The list should be
89 under the ownership of the caller but the entires will
90@@ -93,6 +97,7 @@
91 @entry_moved: Slot for #IndicatorObject::entry-moved
92 @menu_show: Slot for #IndicatorObject::menu-show
93 @show_now_changed: Slot for #IndicatorObject::show-now-changed
94+ @accessible_desc_update: Slot for #IndicatorObject::accessible-desc-update
95 */
96 struct _IndicatorObjectClass {
97 GObjectClass parent_class;
98@@ -101,6 +106,7 @@
99 GtkLabel * (*get_label) (IndicatorObject * io);
100 GtkImage * (*get_image) (IndicatorObject * io);
101 GtkMenu * (*get_menu) (IndicatorObject * io);
102+ const gchar * (*get_accessible_desc) (IndicatorObject * io);
103
104 GList * (*get_entries) (IndicatorObject * io);
105 guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
106@@ -117,6 +123,7 @@
107 void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
108 void (*show_now_changed) (IndicatorObject * io, IndicatorObjectEntry * entry, gboolean show_now_state, gpointer user_data);
109 void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);
110+ void (*accessible_desc_update) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
111
112 /* Reserved */
113 void (*reserved1) (void);
114@@ -142,11 +149,14 @@
115 @label: The label to be shown on the panel
116 @image: The image to be shown on the panel
117 @menu: The menu to be added to the menubar
118+ @accessible_desc: The accessible description
119+ of the indicator
120 */
121 struct _IndicatorObjectEntry {
122 GtkLabel * label;
123 GtkImage * image;
124 GtkMenu * menu;
125+ const gchar * accessible_desc;
126 };
127
128 GType indicator_object_get_type (void);
129
130=== modified file 'tests/dummy-indicator-null.c'
131--- tests/dummy-indicator-null.c 2009-11-04 03:31:04 +0000
132+++ tests/dummy-indicator-null.c 2011-02-14 02:38:08 +0000
133@@ -46,6 +46,11 @@
134 {
135 return NULL;
136 }
137+const gchar *
138+get_accessible_desc (IndicatorObject * io)
139+{
140+ return NULL;
141+}
142
143 static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass);
144 static void dummy_indicator_null_init (DummyIndicatorNull *self);
145@@ -67,6 +72,7 @@
146 io_class->get_label = get_label;
147 io_class->get_image = get_icon;
148 io_class->get_menu = get_menu;
149+ io_class->get_accessible_desc = get_accessible_desc;
150
151 return;
152 }
153
154=== modified file 'tests/dummy-indicator-signaler.c'
155--- tests/dummy-indicator-signaler.c 2010-01-15 22:11:42 +0000
156+++ tests/dummy-indicator-signaler.c 2011-02-14 02:38:08 +0000
157@@ -50,6 +50,12 @@
158 return main_menu;
159 }
160
161+const gchar *
162+get_accessible_desc (IndicatorObject * io)
163+{
164+ return "Signaler Item";
165+}
166+
167 static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass);
168 static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self);
169 static void dummy_indicator_signaler_dispose (GObject *object);
170@@ -70,6 +76,7 @@
171 io_class->get_label = get_label;
172 io_class->get_image = get_icon;
173 io_class->get_menu = get_menu;
174+ io_class->get_accessible_desc = get_accessible_desc;
175
176 return;
177 }
178
179=== modified file 'tests/dummy-indicator-simple.c'
180--- tests/dummy-indicator-simple.c 2009-11-04 03:31:04 +0000
181+++ tests/dummy-indicator-simple.c 2011-02-14 02:38:08 +0000
182@@ -50,6 +50,12 @@
183 return main_menu;
184 }
185
186+const gchar *
187+get_accessible_desc (IndicatorObject * io)
188+{
189+ return "Simple Item";
190+}
191+
192 static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass);
193 static void dummy_indicator_simple_init (DummyIndicatorSimple *self);
194 static void dummy_indicator_simple_dispose (GObject *object);
195@@ -70,6 +76,7 @@
196 io_class->get_label = get_label;
197 io_class->get_image = get_icon;
198 io_class->get_menu = get_menu;
199+ io_class->get_accessible_desc = get_accessible_desc;
200
201 return;
202 }

Subscribers

People subscribed via source and target branches