Merge lp:~themuso/notify-osd/fix-accessibility into lp:notify-osd/oneiric

Proposed by Luke Yelavich on 2011-11-25
Status: Merged
Approved by: Mirco Müller on 2012-01-30
Approved revision: 446
Merge reported by: Mirco Müller
Merged at revision: not available
Proposed branch: lp:~themuso/notify-osd/fix-accessibility
Merge into: lp:notify-osd/oneiric
Diff against target: 146 lines (+27/-81)
2 files modified
src/bubble-window-accessible.c (+4/-64)
src/bubble-window.c (+23/-17)
To merge this branch: bzr merge lp:~themuso/notify-osd/fix-accessibility
Reviewer Review Type Date Requested Status
Mirco Müller (community) 2011-11-25 Approve on 2012-01-30
Luke Yelavich Resubmit on 2012-01-09
Review via email: mp+83356@code.launchpad.net
To post a comment you must log in.
Mirco Müller (macslow) wrote :

Mostly ok, but please always initialize every variable declared.

122 + AtkRegistry *default_registry = atk_get_default_registry ();
123 + AtkObjectFactory *factory;
124 + AtkObject *accessible;

review: Needs Fixing
446. By Luke Yelavich on 2012-01-05

Initialize declared variables

Luke Yelavich (themuso) wrote :

Done.

review: Resubmit
Mirco Müller (macslow) wrote :

All fine now. Passes also "make check" and all stand-alone tests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bubble-window-accessible.c'
2--- src/bubble-window-accessible.c 2010-10-05 17:54:42 +0000
3+++ src/bubble-window-accessible.c 2012-01-05 00:37:29 +0000
4@@ -63,70 +63,9 @@
5
6 static void* bubble_window_accessible_parent_class;
7
8-GType
9-bubble_window_accessible_get_type (void)
10-{
11- static GType type = 0;
12-
13- if (!type)
14- {
15- GTypeInfo tinfo =
16- {
17- sizeof (BubbleWindowAccessibleClass),
18- (GBaseInitFunc) bubble_window_accessible_init, /* base init */
19- (GBaseFinalizeFunc) bubble_window_accessible_finalize, /* base finalize */
20- (GClassInitFunc) bubble_window_accessible_class_init, /* class init */
21- (GClassFinalizeFunc) NULL, /* class finalize */
22- NULL, /* class data */
23- sizeof (BubbleWindowAccessible), /* instance size */
24- 0, /* nb preallocs */
25- NULL, /* instance init */
26- NULL /* value table */
27- };
28-
29- const GInterfaceInfo atk_value_info =
30- {
31- (GInterfaceInitFunc) atk_value_interface_init,
32- (GInterfaceFinalizeFunc) NULL,
33- NULL
34- };
35-
36- const GInterfaceInfo atk_text_info =
37- {
38- (GInterfaceInitFunc) atk_text_interface_init,
39- (GInterfaceFinalizeFunc) NULL,
40- NULL
41- };
42-
43- /*
44- * Figure out the size of the class and instance
45- * we are deriving from
46- */
47- AtkObjectFactory *factory;
48- GType derived_type;
49- GTypeQuery query;
50- GType derived_atk_type;
51-
52- derived_type = g_type_parent (BUBBLE_TYPE_WINDOW);
53-
54- factory = atk_registry_get_factory (atk_get_default_registry (),
55- derived_type);
56- derived_atk_type = atk_object_factory_get_accessible_type (factory);
57-
58- g_type_query (derived_atk_type, &query);
59- tinfo.class_size = query.class_size;
60- tinfo.instance_size = query.instance_size;
61-
62- type = g_type_register_static (derived_atk_type,
63- "BubbleWindowAccessible", &tinfo, 0);
64-
65- g_type_add_interface_static (type, ATK_TYPE_VALUE, &atk_value_info);
66-
67- g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
68- }
69-
70- return type;
71-}
72+G_DEFINE_TYPE_WITH_CODE (BubbleWindowAccessible, bubble_window_accessible, GTK_TYPE_ACCESSIBLE,
73+ G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)
74+ G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
75
76 static void
77 atk_value_interface_init (AtkValueIface* iface)
78@@ -204,6 +143,7 @@
79 G_CALLBACK (bubble_message_body_inserted_event),
80 obj);
81
82+ atk_object_set_role (obj, ATK_ROLE_NOTIFICATION);
83 }
84
85 AtkObject*
86
87=== modified file 'src/bubble-window.c'
88--- src/bubble-window.c 2009-02-27 20:00:53 +0000
89+++ src/bubble-window.c 2012-01-05 00:37:29 +0000
90@@ -72,13 +72,14 @@
91 bubble_window_get_accessible (GtkWidget *widget)
92 {
93 static gboolean first_time = TRUE;
94+ static GQuark quark_accessible_object;
95
96 if (first_time)
97 {
98- AtkObjectFactory *factory;
99- AtkRegistry *registry;
100- GType derived_type;
101- GType derived_atk_type;
102+ AtkObjectFactory *factory = NULL;
103+ AtkRegistry *registry = NULL;
104+ GType derived_type = NULL;
105+ GType derived_atk_type = NULL;
106
107 /*
108 * Figure out whether accessibility is enabled by looking at the
109@@ -91,19 +92,24 @@
110 factory = atk_registry_get_factory (registry,
111 derived_type);
112 derived_atk_type = atk_object_factory_get_accessible_type (factory);
113-
114- if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
115- {
116- /*
117- * Specify what factory to use to create accessible
118- * objects
119- */
120- atk_registry_set_factory_type (registry,
121- BUBBLE_TYPE_WINDOW,
122- BUBBLE_WINDOW_TYPE_ACCESSIBLE_FACTORY);
123-
124- }
125+ atk_registry_set_factory_type (registry,
126+ BUBBLE_TYPE_WINDOW,
127+ BUBBLE_WINDOW_TYPE_ACCESSIBLE_FACTORY);
128+ quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
129 first_time = FALSE;
130 }
131- return GTK_WIDGET_CLASS (bubble_window_parent_class)->get_accessible (widget);
132+
133+ AtkRegistry *default_registry = atk_get_default_registry ();
134+ AtkObjectFactory *factory = NULL;
135+ AtkObject *accessible = g_object_get_qdata (G_OBJECT (widget),
136+ quark_accessible_object);
137+ if (accessible)
138+ return accessible;
139+ factory = atk_registry_get_factory (default_registry,
140+ G_TYPE_FROM_INSTANCE (widget));
141+ accessible = atk_object_factory_create_accessible (factory,
142+ G_OBJECT (widget));
143+ g_object_set_qdata (G_OBJECT (widget), quark_accessible_object,
144+ accessible);
145+ return accessible;
146 }

Subscribers

People subscribed via source and target branches