Merge lp:~themuso/libindicator/accessible-name into lp:libindicator/0.4
- accessible-name
- Merge into trunk
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 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Approve | ||
Review via email: mp+46699@code.launchpad.net |
Commit message
Description of the change
Accessible name support. Still not sure whether the documentatino formatting is right, or whether it needs more elaboration.
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:/
Some comments though:
The get_accessible_name seems to be related to the IndicatorObject, not the IndicatorObject
62 struct _IndicatorObjec
63 GtkLabel * label;
64 GtkImage * image;
65 GtkMenu * menu;
66 + gchar * accessible_name;
67 };
wouldn't it be better to just have a indicator_
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 IndicatorObject
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.
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_
Yes, I have actually renamed it in my code, now called accessible_desc, and related changes in indicator-
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-
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 IndicatorObject
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
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 | 61 | SCROLL_ENTRY, | 61 | SCROLL_ENTRY, |
6 | 62 | MENU_SHOW, | 62 | MENU_SHOW, |
7 | 63 | SHOW_NOW_CHANGED, | 63 | SHOW_NOW_CHANGED, |
8 | 64 | ACCESSIBLE_DESC_UPDATE, | ||
9 | 64 | LAST_SIGNAL | 65 | LAST_SIGNAL |
10 | 65 | }; | 66 | }; |
11 | 66 | 67 | ||
12 | @@ -91,6 +92,7 @@ | |||
13 | 91 | klass->get_label = NULL; | 92 | klass->get_label = NULL; |
14 | 92 | klass->get_menu = NULL; | 93 | klass->get_menu = NULL; |
15 | 93 | klass->get_image = NULL; | 94 | klass->get_image = NULL; |
16 | 95 | klass->get_accessible_desc = NULL; | ||
17 | 94 | 96 | ||
18 | 95 | klass->get_entries = get_entries_default; | 97 | klass->get_entries = get_entries_default; |
19 | 96 | klass->get_location = NULL; | 98 | klass->get_location = NULL; |
20 | @@ -221,6 +223,24 @@ | |||
21 | 221 | _indicator_object_marshal_VOID__POINTER_BOOLEAN, | 223 | _indicator_object_marshal_VOID__POINTER_BOOLEAN, |
22 | 222 | G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN); | 224 | G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN); |
23 | 223 | 225 | ||
24 | 226 | /** | ||
25 | 227 | IndicatorObject::accessible-desc-update:: | ||
26 | 228 | @arg0: The #IndicatorObject object | ||
27 | 229 | @arg1: A pointer to the #IndicatorObjectEntry whos | ||
28 | 230 | accessible description has been updated. | ||
29 | 231 | |||
30 | 232 | Signaled when an indicator's accessible description | ||
31 | 233 | has been updated, so that the displayer of the | ||
32 | 234 | indicator can fetch the new description. | ||
33 | 235 | */ | ||
34 | 236 | signals[ACCESSIBLE_DESC_UPDATE] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, | ||
35 | 237 | G_TYPE_FROM_CLASS(klass), | ||
36 | 238 | G_SIGNAL_RUN_LAST, | ||
37 | 239 | G_STRUCT_OFFSET (IndicatorObjectClass, accessible_desc_update), | ||
38 | 240 | NULL, NULL, | ||
39 | 241 | g_cclosure_marshal_VOID__POINTER, | ||
40 | 242 | G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE); | ||
41 | 243 | |||
42 | 224 | 244 | ||
43 | 225 | return; | 245 | return; |
44 | 226 | } | 246 | } |
45 | @@ -236,6 +256,7 @@ | |||
46 | 236 | self->priv->entry.menu = NULL; | 256 | self->priv->entry.menu = NULL; |
47 | 237 | self->priv->entry.label = NULL; | 257 | self->priv->entry.label = NULL; |
48 | 238 | self->priv->entry.image = NULL; | 258 | self->priv->entry.image = NULL; |
49 | 259 | self->priv->entry.accessible_desc = NULL; | ||
50 | 239 | 260 | ||
51 | 240 | self->priv->gotten_entries = FALSE; | 261 | self->priv->gotten_entries = FALSE; |
52 | 241 | 262 | ||
53 | @@ -416,6 +437,14 @@ | |||
54 | 416 | return NULL; | 437 | return NULL; |
55 | 417 | } | 438 | } |
56 | 418 | 439 | ||
57 | 440 | if (class->get_accessible_desc) { | ||
58 | 441 | priv->entry.accessible_desc = class->get_accessible_desc(io); | ||
59 | 442 | } | ||
60 | 443 | |||
61 | 444 | if (priv->entry.accessible_desc == NULL) { | ||
62 | 445 | g_warning("IndicatorObject class does not have an accessible description."); | ||
63 | 446 | } | ||
64 | 447 | |||
65 | 419 | priv->gotten_entries = TRUE; | 448 | priv->gotten_entries = TRUE; |
66 | 420 | } | 449 | } |
67 | 421 | 450 | ||
68 | 422 | 451 | ||
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 | 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)) |
74 | 58 | #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed" | 58 | #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed" |
75 | 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)) |
76 | 60 | #define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE "accessible-desc-update" | ||
77 | 61 | #define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, INDICATOR_OBJECT_TYPE)) | ||
78 | 60 | 62 | ||
79 | 61 | typedef struct _IndicatorObject IndicatorObject; | 63 | typedef struct _IndicatorObject IndicatorObject; |
80 | 62 | typedef struct _IndicatorObjectClass IndicatorObjectClass; | 64 | typedef struct _IndicatorObjectClass IndicatorObjectClass; |
81 | @@ -75,6 +77,8 @@ | |||
82 | 75 | @get_menu: Gets the image for this object. Should be set | 77 | @get_menu: Gets the image for this object. Should be set |
83 | 76 | to #NULL if @get_entries is set. Should NOT ref the | 78 | to #NULL if @get_entries is set. Should NOT ref the |
84 | 77 | object. | 79 | object. |
85 | 80 | @get_accessible_desc: Gets the accessible descriptionfor this | ||
86 | 81 | object. | ||
87 | 78 | @get_entries: Gets all of the entires for this object returning | 82 | @get_entries: Gets all of the entires for this object returning |
88 | 79 | a #GList of #IndicatorObjectEntries. The list should be | 83 | a #GList of #IndicatorObjectEntries. The list should be |
89 | 80 | under the ownership of the caller but the entires will | 84 | under the ownership of the caller but the entires will |
90 | @@ -93,6 +97,7 @@ | |||
91 | 93 | @entry_moved: Slot for #IndicatorObject::entry-moved | 97 | @entry_moved: Slot for #IndicatorObject::entry-moved |
92 | 94 | @menu_show: Slot for #IndicatorObject::menu-show | 98 | @menu_show: Slot for #IndicatorObject::menu-show |
93 | 95 | @show_now_changed: Slot for #IndicatorObject::show-now-changed | 99 | @show_now_changed: Slot for #IndicatorObject::show-now-changed |
94 | 100 | @accessible_desc_update: Slot for #IndicatorObject::accessible-desc-update | ||
95 | 96 | */ | 101 | */ |
96 | 97 | struct _IndicatorObjectClass { | 102 | struct _IndicatorObjectClass { |
97 | 98 | GObjectClass parent_class; | 103 | GObjectClass parent_class; |
98 | @@ -101,6 +106,7 @@ | |||
99 | 101 | GtkLabel * (*get_label) (IndicatorObject * io); | 106 | GtkLabel * (*get_label) (IndicatorObject * io); |
100 | 102 | GtkImage * (*get_image) (IndicatorObject * io); | 107 | GtkImage * (*get_image) (IndicatorObject * io); |
101 | 103 | GtkMenu * (*get_menu) (IndicatorObject * io); | 108 | GtkMenu * (*get_menu) (IndicatorObject * io); |
102 | 109 | const gchar * (*get_accessible_desc) (IndicatorObject * io); | ||
103 | 104 | 110 | ||
104 | 105 | GList * (*get_entries) (IndicatorObject * io); | 111 | GList * (*get_entries) (IndicatorObject * io); |
105 | 106 | guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); | 112 | guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); |
106 | @@ -117,6 +123,7 @@ | |||
107 | 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); |
108 | 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); |
109 | 119 | void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction); | 125 | void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction); |
110 | 126 | void (*accessible_desc_update) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); | ||
111 | 120 | 127 | ||
112 | 121 | /* Reserved */ | 128 | /* Reserved */ |
113 | 122 | void (*reserved1) (void); | 129 | void (*reserved1) (void); |
114 | @@ -142,11 +149,14 @@ | |||
115 | 142 | @label: The label to be shown on the panel | 149 | @label: The label to be shown on the panel |
116 | 143 | @image: The image to be shown on the panel | 150 | @image: The image to be shown on the panel |
117 | 144 | @menu: The menu to be added to the menubar | 151 | @menu: The menu to be added to the menubar |
118 | 152 | @accessible_desc: The accessible description | ||
119 | 153 | of the indicator | ||
120 | 145 | */ | 154 | */ |
121 | 146 | struct _IndicatorObjectEntry { | 155 | struct _IndicatorObjectEntry { |
122 | 147 | GtkLabel * label; | 156 | GtkLabel * label; |
123 | 148 | GtkImage * image; | 157 | GtkImage * image; |
124 | 149 | GtkMenu * menu; | 158 | GtkMenu * menu; |
125 | 159 | const gchar * accessible_desc; | ||
126 | 150 | }; | 160 | }; |
127 | 151 | 161 | ||
128 | 152 | GType indicator_object_get_type (void); | 162 | GType indicator_object_get_type (void); |
129 | 153 | 163 | ||
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 | 46 | { | 46 | { |
135 | 47 | return NULL; | 47 | return NULL; |
136 | 48 | } | 48 | } |
137 | 49 | const gchar * | ||
138 | 50 | get_accessible_desc (IndicatorObject * io) | ||
139 | 51 | { | ||
140 | 52 | return NULL; | ||
141 | 53 | } | ||
142 | 49 | 54 | ||
143 | 50 | static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass); | 55 | static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass); |
144 | 51 | static void dummy_indicator_null_init (DummyIndicatorNull *self); | 56 | static void dummy_indicator_null_init (DummyIndicatorNull *self); |
145 | @@ -67,6 +72,7 @@ | |||
146 | 67 | io_class->get_label = get_label; | 72 | io_class->get_label = get_label; |
147 | 68 | io_class->get_image = get_icon; | 73 | io_class->get_image = get_icon; |
148 | 69 | io_class->get_menu = get_menu; | 74 | io_class->get_menu = get_menu; |
149 | 75 | io_class->get_accessible_desc = get_accessible_desc; | ||
150 | 70 | 76 | ||
151 | 71 | return; | 77 | return; |
152 | 72 | } | 78 | } |
153 | 73 | 79 | ||
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 | 50 | return main_menu; | 50 | return main_menu; |
159 | 51 | } | 51 | } |
160 | 52 | 52 | ||
161 | 53 | const gchar * | ||
162 | 54 | get_accessible_desc (IndicatorObject * io) | ||
163 | 55 | { | ||
164 | 56 | return "Signaler Item"; | ||
165 | 57 | } | ||
166 | 58 | |||
167 | 53 | static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass); | 59 | static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass); |
168 | 54 | static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self); | 60 | static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self); |
169 | 55 | static void dummy_indicator_signaler_dispose (GObject *object); | 61 | static void dummy_indicator_signaler_dispose (GObject *object); |
170 | @@ -70,6 +76,7 @@ | |||
171 | 70 | io_class->get_label = get_label; | 76 | io_class->get_label = get_label; |
172 | 71 | io_class->get_image = get_icon; | 77 | io_class->get_image = get_icon; |
173 | 72 | io_class->get_menu = get_menu; | 78 | io_class->get_menu = get_menu; |
174 | 79 | io_class->get_accessible_desc = get_accessible_desc; | ||
175 | 73 | 80 | ||
176 | 74 | return; | 81 | return; |
177 | 75 | } | 82 | } |
178 | 76 | 83 | ||
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 | 50 | return main_menu; | 50 | return main_menu; |
184 | 51 | } | 51 | } |
185 | 52 | 52 | ||
186 | 53 | const gchar * | ||
187 | 54 | get_accessible_desc (IndicatorObject * io) | ||
188 | 55 | { | ||
189 | 56 | return "Simple Item"; | ||
190 | 57 | } | ||
191 | 58 | |||
192 | 53 | static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass); | 59 | static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass); |
193 | 54 | static void dummy_indicator_simple_init (DummyIndicatorSimple *self); | 60 | static void dummy_indicator_simple_init (DummyIndicatorSimple *self); |
194 | 55 | static void dummy_indicator_simple_dispose (GObject *object); | 61 | static void dummy_indicator_simple_dispose (GObject *object); |
195 | @@ -70,6 +76,7 @@ | |||
196 | 70 | io_class->get_label = get_label; | 76 | io_class->get_label = get_label; |
197 | 71 | io_class->get_image = get_icon; | 77 | io_class->get_image = get_icon; |
198 | 72 | io_class->get_menu = get_menu; | 78 | io_class->get_menu = get_menu; |
199 | 79 | io_class->get_accessible_desc = get_accessible_desc; | ||
200 | 73 | 80 | ||
201 | 74 | return; | 81 | return; |
202 | 75 | } | 82 | } |
Probably should make the function prototype and struct property const so that users know they shouldn't free them. Otherwise looks good.