Merge lp:~themuso/indicator-applet/accessible-desc into lp:indicator-applet/0.4

Proposed by Luke Yelavich
Status: Merged
Merged at revision: 381
Proposed branch: lp:~themuso/indicator-applet/accessible-desc
Merge into: lp:indicator-applet/0.4
Diff against target: 73 lines (+41/-0)
1 file modified
src/applet-main.c (+41/-0)
To merge this branch: bzr merge lp:~themuso/indicator-applet/accessible-desc
Reviewer Review Type Date Requested Status
Ted Gould (community) Needs Information
Review via email: mp+49586@code.launchpad.net
To post a comment you must log in.
382. By Luke Yelavich

menuitem is already a GtkWidget

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

On Mon, 2011-02-14 at 03:46 +0000, Luke Yelavich wrote:
> + /* Not all indicator entries have a get_accessible_desc method, such as
> + indicator-application entries */
> + if (class->get_accessible_desc != NULL) {
> + entry->accessible_desc = class->get_accessible_desc(io);
> + }

I'm not sure why we need to update the entry here, it seems that should
be done internally in the IndicatorObject no?

  review needsinformation

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

On Thu, Feb 17, 2011 at 10:01:20AM EST, Ted Gould wrote:
> I'm not sure why we need to update the entry here, it seems that should
> be done internally in the IndicatorObject no?

Not all indicators have their own get_entries method, i.e messages, sound, session, me, datetime, and they don't even deal with their entry data directly, rather the get_ methods are used to retrieve that info for libindicator to fill in.

On the above understanding, I am trying to take care of the cases where indicators that have a get_entries method and do not have a get_accessible_desc method, ala indicator-application, can still get the accessible_desc variable updated.

If its better that indicator-application also be extended to have a get_accessible_desc method, then I can do that too, and that code can be changed.

Luke

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

On Thu, 2011-02-17 at 00:21 +0000, Luke Yelavich wrote:
> On Thu, Feb 17, 2011 at 10:01:20AM EST, Ted Gould wrote:
> > I'm not sure why we need to update the entry here, it seems that should
> > be done internally in the IndicatorObject no?
>
> Not all indicators have their own get_entries method, i.e messages, sound, session, me, datetime, and they don't even deal with their entry data directly, rather the get_ methods are used to retrieve that info for libindicator to fill in.
>
> On the above understanding, I am trying to take care of the cases where indicators that have a get_entries method and do not have a get_accessible_desc method, ala indicator-application, can still get the accessible_desc variable updated.
>
> If its better that indicator-application also be extended to have a get_accessible_desc method, then I can do that too, and that code can be changed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/applet-main.c'
2--- src/applet-main.c 2011-01-31 20:27:31 +0000
3+++ src/applet-main.c 2011-02-16 00:47:11 +0000
4@@ -55,6 +55,7 @@
5 GdkColor *colour,
6 GdkPixmap *pixmap,
7 GtkWidget *menubar);
8+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
9
10 /*************
11 * main
12@@ -243,6 +244,24 @@
13 }
14
15 static void
16+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menuitem)
17+{
18+ g_return_if_fail(GTK_IS_WIDGET(menuitem));
19+
20+ IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
21+
22+ /* Not all indicator entries have a get_accessible_desc method, such as
23+ indicator-application entries */
24+ if (class->get_accessible_desc != NULL) {
25+ entry->accessible_desc = class->get_accessible_desc(io);
26+ }
27+
28+ update_accessible_desc(entry, menuitem);
29+
30+ return;
31+}
32+
33+static void
34 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
35 {
36 g_debug("Signal: Entry Added");
37@@ -319,7 +338,12 @@
38
39 gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
40
41+ g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menuitem);
42+
43 if (something_visible) {
44+ if (entry->accessible_desc != NULL) {
45+ update_accessible_desc(entry, menuitem);
46+ }
47 gtk_widget_show(menuitem);
48 }
49 gtk_widget_set_sensitive(menuitem, something_sensitive);
50@@ -443,6 +467,23 @@
51 // TODO: do something sensible here
52 }
53
54+static void
55+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
56+{
57+ /* FIXME: We need to deal with the use case where the contents of the
58+ label overrides what is found in the atk object's name, or at least
59+ orca speaks the label instead of the atk object name.
60+ */
61+ AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
62+ if (entry->accessible_desc != NULL) {
63+ atk_object_set_name(menuitem_obj, entry->accessible_desc);
64+ } else {
65+ atk_object_set_name(menuitem_obj, "");
66+ }
67+ return;
68+}
69+
70+
71 static gboolean
72 load_module (const gchar * name, GtkWidget * menubar)
73 {

Subscribers

People subscribed via source and target branches

to status/vote changes: