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
=== modified file 'libindicator/indicator-object.c'
--- libindicator/indicator-object.c 2011-01-26 23:12:42 +0000
+++ libindicator/indicator-object.c 2011-02-14 02:38:08 +0000
@@ -61,6 +61,7 @@
61 SCROLL_ENTRY,61 SCROLL_ENTRY,
62 MENU_SHOW,62 MENU_SHOW,
63 SHOW_NOW_CHANGED,63 SHOW_NOW_CHANGED,
64 ACCESSIBLE_DESC_UPDATE,
64 LAST_SIGNAL65 LAST_SIGNAL
65};66};
6667
@@ -91,6 +92,7 @@
91 klass->get_label = NULL;92 klass->get_label = NULL;
92 klass->get_menu = NULL;93 klass->get_menu = NULL;
93 klass->get_image = NULL;94 klass->get_image = NULL;
95 klass->get_accessible_desc = NULL;
9496
95 klass->get_entries = get_entries_default;97 klass->get_entries = get_entries_default;
96 klass->get_location = NULL;98 klass->get_location = NULL;
@@ -221,6 +223,24 @@
221 _indicator_object_marshal_VOID__POINTER_BOOLEAN,223 _indicator_object_marshal_VOID__POINTER_BOOLEAN,
222 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN);224 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN);
223225
226 /**
227 IndicatorObject::accessible-desc-update::
228 @arg0: The #IndicatorObject object
229 @arg1: A pointer to the #IndicatorObjectEntry whos
230 accessible description has been updated.
231
232 Signaled when an indicator's accessible description
233 has been updated, so that the displayer of the
234 indicator can fetch the new description.
235 */
236 signals[ACCESSIBLE_DESC_UPDATE] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE,
237 G_TYPE_FROM_CLASS(klass),
238 G_SIGNAL_RUN_LAST,
239 G_STRUCT_OFFSET (IndicatorObjectClass, accessible_desc_update),
240 NULL, NULL,
241 g_cclosure_marshal_VOID__POINTER,
242 G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE);
243
224244
225 return;245 return;
226}246}
@@ -236,6 +256,7 @@
236 self->priv->entry.menu = NULL;256 self->priv->entry.menu = NULL;
237 self->priv->entry.label = NULL;257 self->priv->entry.label = NULL;
238 self->priv->entry.image = NULL;258 self->priv->entry.image = NULL;
259 self->priv->entry.accessible_desc = NULL;
239260
240 self->priv->gotten_entries = FALSE;261 self->priv->gotten_entries = FALSE;
241262
@@ -416,6 +437,14 @@
416 return NULL;437 return NULL;
417 }438 }
418439
440 if (class->get_accessible_desc) {
441 priv->entry.accessible_desc = class->get_accessible_desc(io);
442 }
443
444 if (priv->entry.accessible_desc == NULL) {
445 g_warning("IndicatorObject class does not have an accessible description.");
446 }
447
419 priv->gotten_entries = TRUE;448 priv->gotten_entries = TRUE;
420 }449 }
421450
422451
=== modified file 'libindicator/indicator-object.h'
--- libindicator/indicator-object.h 2011-01-27 11:24:00 +0000
+++ libindicator/indicator-object.h 2011-02-14 02:38:08 +0000
@@ -57,6 +57,8 @@
57#define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE))57#define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE))
58#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed"58#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed"
59#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED, INDICATOR_OBJECT_TYPE))59#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED, INDICATOR_OBJECT_TYPE))
60#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE "accessible-desc-update"
61#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, INDICATOR_OBJECT_TYPE))
6062
61typedef struct _IndicatorObject IndicatorObject;63typedef struct _IndicatorObject IndicatorObject;
62typedef struct _IndicatorObjectClass IndicatorObjectClass;64typedef struct _IndicatorObjectClass IndicatorObjectClass;
@@ -75,6 +77,8 @@
75 @get_menu: Gets the image for this object. Should be set77 @get_menu: Gets the image for this object. Should be set
76 to #NULL if @get_entries is set. Should NOT ref the78 to #NULL if @get_entries is set. Should NOT ref the
77 object.79 object.
80 @get_accessible_desc: Gets the accessible descriptionfor this
81 object.
78 @get_entries: Gets all of the entires for this object returning82 @get_entries: Gets all of the entires for this object returning
79 a #GList of #IndicatorObjectEntries. The list should be83 a #GList of #IndicatorObjectEntries. The list should be
80 under the ownership of the caller but the entires will84 under the ownership of the caller but the entires will
@@ -93,6 +97,7 @@
93 @entry_moved: Slot for #IndicatorObject::entry-moved97 @entry_moved: Slot for #IndicatorObject::entry-moved
94 @menu_show: Slot for #IndicatorObject::menu-show98 @menu_show: Slot for #IndicatorObject::menu-show
95 @show_now_changed: Slot for #IndicatorObject::show-now-changed99 @show_now_changed: Slot for #IndicatorObject::show-now-changed
100 @accessible_desc_update: Slot for #IndicatorObject::accessible-desc-update
96*/101*/
97struct _IndicatorObjectClass {102struct _IndicatorObjectClass {
98 GObjectClass parent_class;103 GObjectClass parent_class;
@@ -101,6 +106,7 @@
101 GtkLabel * (*get_label) (IndicatorObject * io);106 GtkLabel * (*get_label) (IndicatorObject * io);
102 GtkImage * (*get_image) (IndicatorObject * io);107 GtkImage * (*get_image) (IndicatorObject * io);
103 GtkMenu * (*get_menu) (IndicatorObject * io);108 GtkMenu * (*get_menu) (IndicatorObject * io);
109 const gchar * (*get_accessible_desc) (IndicatorObject * io);
104110
105 GList * (*get_entries) (IndicatorObject * io);111 GList * (*get_entries) (IndicatorObject * io);
106 guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);112 guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
@@ -117,6 +123,7 @@
117 void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);123 void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
118 void (*show_now_changed) (IndicatorObject * io, IndicatorObjectEntry * entry, gboolean show_now_state, gpointer user_data);124 void (*show_now_changed) (IndicatorObject * io, IndicatorObjectEntry * entry, gboolean show_now_state, gpointer user_data);
119 void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);125 void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);
126 void (*accessible_desc_update) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
120127
121 /* Reserved */128 /* Reserved */
122 void (*reserved1) (void);129 void (*reserved1) (void);
@@ -142,11 +149,14 @@
142 @label: The label to be shown on the panel149 @label: The label to be shown on the panel
143 @image: The image to be shown on the panel150 @image: The image to be shown on the panel
144 @menu: The menu to be added to the menubar151 @menu: The menu to be added to the menubar
152 @accessible_desc: The accessible description
153 of the indicator
145*/154*/
146struct _IndicatorObjectEntry {155struct _IndicatorObjectEntry {
147 GtkLabel * label;156 GtkLabel * label;
148 GtkImage * image;157 GtkImage * image;
149 GtkMenu * menu;158 GtkMenu * menu;
159 const gchar * accessible_desc;
150};160};
151161
152GType indicator_object_get_type (void);162GType indicator_object_get_type (void);
153163
=== modified file 'tests/dummy-indicator-null.c'
--- tests/dummy-indicator-null.c 2009-11-04 03:31:04 +0000
+++ tests/dummy-indicator-null.c 2011-02-14 02:38:08 +0000
@@ -46,6 +46,11 @@
46{46{
47 return NULL;47 return NULL;
48}48}
49const gchar *
50get_accessible_desc (IndicatorObject * io)
51{
52 return NULL;
53}
4954
50static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass);55static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass);
51static void dummy_indicator_null_init (DummyIndicatorNull *self);56static void dummy_indicator_null_init (DummyIndicatorNull *self);
@@ -67,6 +72,7 @@
67 io_class->get_label = get_label;72 io_class->get_label = get_label;
68 io_class->get_image = get_icon;73 io_class->get_image = get_icon;
69 io_class->get_menu = get_menu;74 io_class->get_menu = get_menu;
75 io_class->get_accessible_desc = get_accessible_desc;
7076
71 return;77 return;
72}78}
7379
=== modified file 'tests/dummy-indicator-signaler.c'
--- tests/dummy-indicator-signaler.c 2010-01-15 22:11:42 +0000
+++ tests/dummy-indicator-signaler.c 2011-02-14 02:38:08 +0000
@@ -50,6 +50,12 @@
50 return main_menu;50 return main_menu;
51}51}
5252
53const gchar *
54get_accessible_desc (IndicatorObject * io)
55{
56 return "Signaler Item";
57}
58
53static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass);59static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass);
54static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self);60static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self);
55static void dummy_indicator_signaler_dispose (GObject *object);61static void dummy_indicator_signaler_dispose (GObject *object);
@@ -70,6 +76,7 @@
70 io_class->get_label = get_label;76 io_class->get_label = get_label;
71 io_class->get_image = get_icon;77 io_class->get_image = get_icon;
72 io_class->get_menu = get_menu;78 io_class->get_menu = get_menu;
79 io_class->get_accessible_desc = get_accessible_desc;
7380
74 return;81 return;
75}82}
7683
=== modified file 'tests/dummy-indicator-simple.c'
--- tests/dummy-indicator-simple.c 2009-11-04 03:31:04 +0000
+++ tests/dummy-indicator-simple.c 2011-02-14 02:38:08 +0000
@@ -50,6 +50,12 @@
50 return main_menu;50 return main_menu;
51}51}
5252
53const gchar *
54get_accessible_desc (IndicatorObject * io)
55{
56 return "Simple Item";
57}
58
53static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass);59static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass);
54static void dummy_indicator_simple_init (DummyIndicatorSimple *self);60static void dummy_indicator_simple_init (DummyIndicatorSimple *self);
55static void dummy_indicator_simple_dispose (GObject *object);61static void dummy_indicator_simple_dispose (GObject *object);
@@ -70,6 +76,7 @@
70 io_class->get_label = get_label;76 io_class->get_label = get_label;
71 io_class->get_image = get_icon;77 io_class->get_image = get_icon;
72 io_class->get_menu = get_menu;78 io_class->get_menu = get_menu;
79 io_class->get_accessible_desc = get_accessible_desc;
7380
74 return;81 return;
75}82}

Subscribers

People subscribed via source and target branches