Merge lp:~themuso/indicator-application/a11y-desc into lp:indicator-application/0.4
- a11y-desc
- Merge into trunk
Proposed by
Luke Yelavich
Status: | Merged |
---|---|
Merged at revision: | 184 |
Proposed branch: | lp:~themuso/indicator-application/a11y-desc |
Merge into: | lp:indicator-application/0.4 |
Diff against target: |
327 lines (+121/-17) 3 files modified
src/application-service-appstore.c (+54/-7) src/application-service.xml (+6/-1) src/indicator-application.c (+61/-9) |
To merge this branch: | bzr merge lp:~themuso/indicator-application/a11y-desc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Indicator Applet Developers | Pending | ||
Review via email: mp+49583@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : | # |
Revision history for this message
Eric Green (sir-erok-deactivatedaccount) wrote : | # |
--- On Wed, 2/16/11, Ted Gould <email address hidden> wrote:
From: Ted Gould <email address hidden>
Subject: Re: [Merge] lp:~themuso/indicator-application/a11y-desc into lp:indicator-application
To: "Luke Yelavich" <email address hidden>
Date: Wednesday, February 16, 2011, 3:58 PM
This is blocked on getting agreement with KDE on the properties names
and signals on KSNI.
--
https:/
You are subscribed to branch lp:indicator-application.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/application-service-appstore.c' |
2 | --- src/application-service-appstore.c 2011-02-07 18:01:11 +0000 |
3 | +++ src/application-service-appstore.c 2011-02-14 02:53:52 +0000 |
4 | @@ -49,12 +49,14 @@ |
5 | #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" |
6 | #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" |
7 | #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" |
8 | +#define NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC "AccessibleDesc" |
9 | |
10 | #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" |
11 | #define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" |
12 | #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" |
13 | #define NOTIFICATION_ITEM_SIG_NEW_LABEL "XAyatanaNewLabel" |
14 | #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" |
15 | +#define NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC "NewAccessibleDesc" |
16 | |
17 | #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" |
18 | #define OVERRIDE_FILE_NAME "ordering-override.keyfile" |
19 | @@ -104,6 +106,7 @@ |
20 | gchar * icon_theme_path; |
21 | gchar * label; |
22 | gchar * guide; |
23 | + gchar * accessible_desc; |
24 | gboolean currently_free; |
25 | guint ordering_index; |
26 | GList * approved_by; |
27 | @@ -431,7 +434,7 @@ |
28 | GVariant * menu = NULL, * id = NULL, * category = NULL, |
29 | * status = NULL, * icon_name = NULL, * aicon_name = NULL, |
30 | * icon_theme_path = NULL, * index = NULL, * label = NULL, |
31 | - * guide = NULL; |
32 | + * guide = NULL, * accessible_desc = NULL; |
33 | |
34 | GVariant * properties = g_dbus_proxy_call_finish(app->props, res, &error); |
35 | |
36 | @@ -474,6 +477,8 @@ |
37 | label = g_variant_ref(value); |
38 | } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { |
39 | guide = g_variant_ref(value); |
40 | + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC) == 0) { |
41 | + accessible_desc = g_variant_ref(value); |
42 | } /* else ignore */ |
43 | } |
44 | g_variant_iter_free (iter); |
45 | @@ -528,6 +533,12 @@ |
46 | app->guide = g_strdup(""); |
47 | } |
48 | |
49 | + if (accessible_desc != NULL) { |
50 | + app->accessible_desc = g_variant_dup_string(accessible_desc, NULL); |
51 | + } else { |
52 | + app->accessible_desc = g_strdup(""); |
53 | + } |
54 | + |
55 | g_list_foreach(priv->approvers, check_with_old_approver, app); |
56 | |
57 | apply_status(app); |
58 | @@ -548,6 +559,7 @@ |
59 | if (index) g_variant_unref (index); |
60 | if (label) g_variant_unref (label); |
61 | if (guide) g_variant_unref (guide); |
62 | + if (accessible_desc) g_variant_unref (accessible_desc); |
63 | |
64 | return; |
65 | } |
66 | @@ -725,6 +737,9 @@ |
67 | if (app->approved_by != NULL) { |
68 | g_list_free(app->approved_by); |
69 | } |
70 | + if (app->accessible_desc != NULL) { |
71 | + g_free(app->accessible_desc); |
72 | + } |
73 | |
74 | g_free(app); |
75 | return; |
76 | @@ -833,11 +848,12 @@ |
77 | if (app->visible_state == VISIBLE_STATE_HIDDEN) { |
78 | /* Put on panel */ |
79 | emit_signal (appstore, "ApplicationAdded", |
80 | - g_variant_new ("(sisosss)", newicon, |
81 | + g_variant_new ("(sisossss)", newicon, |
82 | get_position(app), |
83 | app->dbus_name, app->menu, |
84 | app->icon_theme_path, |
85 | - app->label, app->guide)); |
86 | + app->label, app->guide, |
87 | + app->accessible_desc)); |
88 | } else { |
89 | /* Icon update */ |
90 | gint position = get_position(app); |
91 | @@ -926,6 +942,32 @@ |
92 | return; |
93 | } |
94 | |
95 | +static void |
96 | +new_accessible_desc (Application * app, const gchar * accessible_desc) |
97 | +{ |
98 | + gboolean changed = FALSE; |
99 | + |
100 | + if (g_strcmp0(app->accessible_desc, accessible_desc) != 0) { |
101 | + changed = TRUE; |
102 | + if (app->accessible_desc != NULL) { |
103 | + g_free(app->accessible_desc); |
104 | + app->accessible_desc = NULL; |
105 | + } |
106 | + app->accessible_desc = g_strdup(accessible_desc); |
107 | + } |
108 | + |
109 | + if (changed) { |
110 | + gint position = get_position(app); |
111 | + if (position == -1) return; |
112 | + |
113 | + emit_signal (app->appstore, "ApplicationAccessibleNameChanged", |
114 | + g_variant_new ("(is)", position, |
115 | + app->accessible_desc != NULL ? app->accessible_desc : "")); |
116 | + } |
117 | + |
118 | + return; |
119 | +} |
120 | + |
121 | /* Adding a new NotificationItem object from DBus in to the |
122 | appstore. First, we need to get the information on it |
123 | though. */ |
124 | @@ -1124,6 +1166,11 @@ |
125 | g_variant_get(parameters, "(&s&s)", &label, &guide); |
126 | new_label(app, label, guide); |
127 | } |
128 | + else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC) == 0) { |
129 | + const gchar * accessible_desc; |
130 | + g_variant_get(parameters, "(&s)", &accessible_desc); |
131 | + new_accessible_desc(app, accessible_desc); |
132 | + } |
133 | |
134 | return; |
135 | } |
136 | @@ -1212,18 +1259,18 @@ |
137 | continue; |
138 | } |
139 | |
140 | - g_variant_builder_add (&builder, "(sisosss)", app->icon, |
141 | + g_variant_builder_add (&builder, "(sisossss)", app->icon, |
142 | position++, app->dbus_name, app->menu, |
143 | app->icon_theme_path, app->label, |
144 | - app->guide); |
145 | + app->guide, app->accessible_desc); |
146 | } |
147 | |
148 | out = g_variant_builder_end(&builder); |
149 | } else { |
150 | GError * error = NULL; |
151 | - out = g_variant_parse(g_variant_type_new("a(sisosss)"), "[]", NULL, NULL, &error); |
152 | + out = g_variant_parse(g_variant_type_new("a(sisossss)"), "[]", NULL, NULL, &error); |
153 | if (error != NULL) { |
154 | - g_warning("Unable to parse '[]' as a 'a(sisosss)': %s", error->message); |
155 | + g_warning("Unable to parse '[]' as a 'a(sisossss)': %s", error->message); |
156 | out = NULL; |
157 | g_error_free(error); |
158 | } |
159 | |
160 | === modified file 'src/application-service.xml' |
161 | --- src/application-service.xml 2011-01-29 02:25:32 +0000 |
162 | +++ src/application-service.xml 2011-02-14 02:53:52 +0000 |
163 | @@ -26,7 +26,7 @@ |
164 | |
165 | <!-- Methods --> |
166 | <method name="GetApplications"> |
167 | - <arg type="a(sisosss)" name="applications" direction="out" /> |
168 | + <arg type="a(sisossss)" name="applications" direction="out" /> |
169 | </method> |
170 | <method name="ApplicationScrollEvent"> |
171 | <arg type="s" name="dbusaddress" direction="in" /> |
172 | @@ -44,6 +44,7 @@ |
173 | <arg type="s" name="iconpath" direction="out" /> |
174 | <arg type="s" name="label" direction="out" /> |
175 | <arg type="s" name="labelguide" direction="out" /> |
176 | + <arg type="s" name="accessibledesc" direction="out" /> |
177 | </signal> |
178 | <signal name="ApplicationRemoved"> |
179 | <arg type="i" name="position" direction="out" /> |
180 | @@ -61,5 +62,9 @@ |
181 | <arg type="s" name="label" direction="out" /> |
182 | <arg type="s" name="guide" direction="out" /> |
183 | </signal> |
184 | + <signal name="ApplicationAccessibleDescChanged"> |
185 | + <arg type="i" name="position" direction="out" /> |
186 | + <arg type="s" name="accessible_desc" direction="out" /> |
187 | + </signal> |
188 | </interface> |
189 | </node> |
190 | |
191 | === modified file 'src/indicator-application.c' |
192 | --- src/indicator-application.c 2011-01-29 02:25:32 +0000 |
193 | +++ src/indicator-application.c 2011-02-14 02:53:52 +0000 |
194 | @@ -115,11 +115,12 @@ |
195 | static void disconnected_helper (gpointer data, gpointer user_data); |
196 | static gboolean disconnected_kill (gpointer user_data); |
197 | static void disconnected_kill_helper (gpointer data, gpointer user_data); |
198 | -static void application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide); |
199 | +static void application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_desc); |
200 | static void application_removed (IndicatorApplication * application, gint position); |
201 | static void application_label_changed (IndicatorApplication * application, gint position, const gchar * label, const gchar * guide); |
202 | static void application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname); |
203 | static void application_icon_theme_path_changed (IndicatorApplication * application, gint position, const gchar * icon_theme_path); |
204 | +static void application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc); |
205 | static void get_applications (GObject * obj, GAsyncResult * res, gpointer user_data); |
206 | static void get_applications_helper (IndicatorApplication * self, GVariant * variant); |
207 | static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir); |
208 | @@ -450,7 +451,7 @@ |
209 | ApplicationEntry and signaling the indicator host that |
210 | we've got a new indicator. */ |
211 | static void |
212 | -application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide) |
213 | +application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_desc) |
214 | { |
215 | g_return_if_fail(IS_INDICATOR_APPLICATION(application)); |
216 | g_debug("Building new application entry: %s with icon: %s at position %i", dbusaddress, iconname, position); |
217 | @@ -499,6 +500,12 @@ |
218 | guess_label_size(app); |
219 | } |
220 | |
221 | + if (accessible_desc == NULL || accessible_desc[0] == '\0') { |
222 | + app->entry.accessible_desc = NULL; |
223 | + } else { |
224 | + app->entry.accessible_desc = g_strdup(accessible_desc); |
225 | + } |
226 | + |
227 | app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); |
228 | |
229 | /* Keep copies of these for ourself, just in case. */ |
230 | @@ -700,6 +707,41 @@ |
231 | return; |
232 | } |
233 | |
234 | +/* The callback for the signal that the accessible description for |
235 | + an application has changed. */ |
236 | +static void |
237 | +application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc) |
238 | +{ |
239 | + IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); |
240 | + ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position); |
241 | + gboolean signal_reload = FALSE; |
242 | + |
243 | + if (app == NULL) { |
244 | + g_warning("Unable to find application at position: %d", position); |
245 | + return; |
246 | + } |
247 | + |
248 | + if (accessible_desc == NULL || accessible_desc[0] == '\0') { |
249 | + /* No accessible_desc, let's see if we need to delete the old one */ |
250 | + if (app->entry.accessible_desc != NULL) { |
251 | + app->entry.accessible_desc = NULL; |
252 | + signal_reload = TRUE; |
253 | + } |
254 | + } else { |
255 | + app->entry.accessible_desc = g_strdup(accessible_desc); |
256 | + |
257 | + signal_reload = TRUE; |
258 | + } |
259 | + |
260 | + if (signal_reload) { |
261 | + /* Unlike the label change, we don't need to remove and re-add |
262 | + the indicator to update the accessible description. */ |
263 | + g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(app->entry), TRUE); |
264 | + |
265 | + return; |
266 | + |
267 | +} |
268 | + |
269 | /* Receives all signals from the service, routed to the appropriate functions */ |
270 | static void |
271 | receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, |
272 | @@ -715,11 +757,14 @@ |
273 | const gchar * icon_theme_path; |
274 | const gchar * label; |
275 | const gchar * guide; |
276 | - g_variant_get (parameters, "(&si&s&o&s&s&s)", &iconname, |
277 | + const gchar * accessible_desc; |
278 | + g_variant_get (parameters, "(&si&s&o&s&s&s&s)", &iconname, |
279 | &position, &dbusaddress, &dbusobject, |
280 | - &icon_theme_path, &label, &guide); |
281 | + &icon_theme_path, &label, &guide, |
282 | + &accessible_desc); |
283 | application_added(self, iconname, position, dbusaddress, |
284 | - dbusobject, icon_theme_path, label, guide); |
285 | + dbusobject, icon_theme_path, label, guide, |
286 | + accessible_desc); |
287 | } |
288 | else if (g_strcmp0(signal_name, "ApplicationRemoved") == 0) { |
289 | gint position; |
290 | @@ -745,6 +790,12 @@ |
291 | g_variant_get (parameters, "(i&s&s)", &position, &label, &guide); |
292 | application_label_changed(self, position, label, guide); |
293 | } |
294 | + else if (g_strcmp0(signal_name, "ApplicationAccessibleDescChanged") == 0) { |
295 | + gint position; |
296 | + const gchar * accessible_desc; |
297 | + g_variant_get (parameters, "(i&s)", &position, &accessible_desc); |
298 | + application_accessible_desc_changed(self, position, accessible_desc); |
299 | + } |
300 | |
301 | return; |
302 | } |
303 | @@ -768,7 +819,7 @@ |
304 | return; |
305 | } |
306 | |
307 | - g_variant_get(result, "(a(sisosss))", &iter); |
308 | + g_variant_get(result, "(a(sisossss))", &iter); |
309 | while ((child = g_variant_iter_next_value (iter))) |
310 | get_applications_helper(self, child); |
311 | g_variant_iter_free (iter); |
312 | @@ -788,11 +839,12 @@ |
313 | const gchar * icon_theme_path; |
314 | const gchar * label; |
315 | const gchar * guide; |
316 | - g_variant_get(variant, "(sisosss)", &icon_name, &position, |
317 | + const gchar * accessible_desc; |
318 | + g_variant_get(variant, "(sisossss)", &icon_name, &position, |
319 | &dbus_address, &dbus_object, &icon_theme_path, &label, |
320 | - &guide); |
321 | + &guide, &accessible_desc); |
322 | |
323 | - return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide); |
324 | + return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc); |
325 | } |
326 | |
327 | /* Unrefs a theme directory. This may involve removing it from |
This is blocked on getting agreement with KDE on the properties names
and signals on KSNI.