Merge lp:~rodrigo-moya/unity/sync-geometries into lp:unity
- sync-geometries
- Merge into trunk
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Rodrigo Moya | ||||||||||||
Approved revision: | no longer in the source branch. | ||||||||||||
Merged at revision: | 965 | ||||||||||||
Proposed branch: | lp:~rodrigo-moya/unity/sync-geometries | ||||||||||||
Merge into: | lp:unity | ||||||||||||
Diff against target: |
962 lines (+414/-100) 16 files modified
po/unity.pot (+0/-69) services/CMakeLists.txt (+25/-15) services/panel-a11y.c (+6/-0) services/panel-indicator-accessible.c (+111/-4) services/panel-indicator-entry-accessible.c (+85/-7) services/panel-main.c (+31/-3) services/panel-marshal.list (+1/-0) services/panel-service.c (+28/-0) services/panel-service.h (+7/-0) src/IndicatorObjectFactory.h (+1/-0) src/IndicatorObjectFactoryRemote.cpp (+3/-0) src/PanelIndicatorObjectView.cpp (+2/-1) src/PanelIndicatorObjectView.h (+1/-1) src/PanelView.cpp (+101/-0) src/PanelView.h (+3/-0) tests/CMakeLists.txt (+9/-0) |
||||||||||||
To merge this branch: | bzr merge lp:~rodrigo-moya/unity/sync-geometries | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rodrigo Moya (community) | Approve | ||
Neil J. Patel (community) | Approve | ||
Alejandro Piñeiro (community) | Approve | ||
Review via email: mp+51929@code.launchpad.net |
Commit message
Description of the change
Sync geometries of the indicators from unity to the panel service, so that that information can be used to implement AtkComponent for both PanelIndicatorA
Rodrigo Moya (rodrigo-moya) wrote : | # |
Alejandro Piñeiro (apinheiro) wrote : | # |
I have tested it with accerciser, and about this comment:
"Note that there's something wrong with the geometries, and not all indicator objects/entries get highlighted in the correct position when selected in accerciser"
I only got one indicator object/entry having the proper position.
About the code, in general seems good, although it would be required a review of the non accessibility related code (the methods and signals used by the AtkComponent implementation) except in one detail:
149 +panel_
150 + gint *x,
151 + gint *y,
152 + gint *width,
153 + gint *height,
154 + AtkCoordType coord_type)
309 +panel_
310 + gint *x,
311 + gint *y,
312 + gint *width,
313 + gint *height,
314 + AtkCoordType coord_type)
You don't check coord_type at all. Take into account that the data that you return are totally different depending on coord_type. As far as I see, in both cases you try to return the result assuming global screen positions (ATK_XY_SCREEN), so it is missing the ATK_XY_WINDOW
In the same way, taking into account that you are already using the signal geometries_changed, I think that it would be easy to also emit the signal "bounds-changed":
http://
BTW, about the signals. Each time that you receive this signal the size is updated, but, what happen with the initial state? Initially this is set to zero. That means that if the indicators/entry has already his position/size set before the accessible object is created, it will have a wrong position/size value? (as it is not updated by the signal)?
Alejandro Piñeiro (apinheiro) wrote : | # |
BTW, although we already commented that via IRC, just to comment that the gen-marshal addition on cmake seems to not work properly, as I needed to execute it by hand.
Rodrigo Moya (rodrigo-moya) wrote : | # |
All issues fixed, so please review again
Alejandro Piñeiro (apinheiro) wrote : | # |
519 + root = atk_get_root ();
520 +
521 gtk_main ();
This get_root could mean a crash if the a11y is not enabled. So options:
a) Add a method on panel-a11y to check if the accessibility is enabled.
b) Move this call inside panel_a11y_init. As it is required that the service is created to this root, that would mean move panel_a11y_init to the line of this atk_get_root
Alejandro Piñeiro (apinheiro) wrote : | # |
Code seems ok, and I tested it and the position is more accurate.
Anyway:
* Be careful with the .pot file included on this branch
* I'm not used to cmake and you modify non-a11y related code, so it would be good to have a second opinion here
Neil J. Patel (njpatel) wrote : | # |
Looks good, approved.
Rodrigo Moya (rodrigo-moya) wrote : | # |
Neil gave his +1 on irc
Preview Diff
1 | === added file 'po/unity.pot' | |||
2 | --- po/unity.pot 1970-01-01 00:00:00 +0000 | |||
3 | +++ po/unity.pot 2011-03-17 12:04:28 +0000 | |||
4 | @@ -0,0 +1,69 @@ | |||
5 | 1 | # SOME DESCRIPTIVE TITLE. | ||
6 | 2 | # Copyright (C) YEAR Canonical\ Ltd | ||
7 | 3 | # This file is distributed under the same license as the PACKAGE package. | ||
8 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
9 | 5 | # | ||
10 | 6 | #, fuzzy | ||
11 | 7 | msgid "" | ||
12 | 8 | msgstr "" | ||
13 | 9 | "Project-Id-Version: PACKAGE VERSION\n" | ||
14 | 10 | "Report-Msgid-Bugs-To: ayatana-dev@lists.launchpad.net\n" | ||
15 | 11 | "POT-Creation-Date: 2011-02-21 19:06+0100\n" | ||
16 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
17 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
18 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ||
19 | 15 | "Language: \n" | ||
20 | 16 | "MIME-Version: 1.0\n" | ||
21 | 17 | "Content-Type: text/plain; charset=CHARSET\n" | ||
22 | 18 | "Content-Transfer-Encoding: 8bit\n" | ||
23 | 19 | |||
24 | 20 | msgid "Keep In Launcher" | ||
25 | 21 | msgstr "" | ||
26 | 22 | |||
27 | 23 | msgid "Quit" | ||
28 | 24 | msgstr "" | ||
29 | 25 | |||
30 | 26 | msgid "Open" | ||
31 | 27 | msgstr "" | ||
32 | 28 | |||
33 | 29 | msgid "Eject" | ||
34 | 30 | msgstr "" | ||
35 | 31 | |||
36 | 32 | msgid "Workspace Switcher" | ||
37 | 33 | msgstr "" | ||
38 | 34 | |||
39 | 35 | msgid "Find Media Apps" | ||
40 | 36 | msgstr "" | ||
41 | 37 | |||
42 | 38 | msgid "Find Internet Apps" | ||
43 | 39 | msgstr "" | ||
44 | 40 | |||
45 | 41 | msgid "Find More Apps" | ||
46 | 42 | msgstr "" | ||
47 | 43 | |||
48 | 44 | msgid "Find Files" | ||
49 | 45 | msgstr "" | ||
50 | 46 | |||
51 | 47 | msgid "Browse the Web" | ||
52 | 48 | msgstr "" | ||
53 | 49 | |||
54 | 50 | msgid "View Photos" | ||
55 | 51 | msgstr "" | ||
56 | 52 | |||
57 | 53 | msgid "Check Email" | ||
58 | 54 | msgstr "" | ||
59 | 55 | |||
60 | 56 | msgid "Listen to Music" | ||
61 | 57 | msgstr "" | ||
62 | 58 | |||
63 | 59 | msgid "Trash" | ||
64 | 60 | msgstr "" | ||
65 | 61 | |||
66 | 62 | msgid "Empty Trash" | ||
67 | 63 | msgstr "" | ||
68 | 64 | |||
69 | 65 | msgid "Empty all items from Trash?" | ||
70 | 66 | msgstr "" | ||
71 | 67 | |||
72 | 68 | msgid "All items in the Trash will be permanently deleted." | ||
73 | 69 | msgstr "" | ||
74 | 0 | 70 | ||
75 | === removed file 'po/unity.pot' | |||
76 | --- po/unity.pot 2011-02-22 13:14:15 +0000 | |||
77 | +++ po/unity.pot 1970-01-01 00:00:00 +0000 | |||
78 | @@ -1,69 +0,0 @@ | |||
79 | 1 | # SOME DESCRIPTIVE TITLE. | ||
80 | 2 | # Copyright (C) YEAR Canonical\ Ltd | ||
81 | 3 | # This file is distributed under the same license as the PACKAGE package. | ||
82 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
83 | 5 | # | ||
84 | 6 | #, fuzzy | ||
85 | 7 | msgid "" | ||
86 | 8 | msgstr "" | ||
87 | 9 | "Project-Id-Version: PACKAGE VERSION\n" | ||
88 | 10 | "Report-Msgid-Bugs-To: ayatana-dev@lists.launchpad.net\n" | ||
89 | 11 | "POT-Creation-Date: 2011-02-21 19:06+0100\n" | ||
90 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
91 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
92 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ||
93 | 15 | "Language: \n" | ||
94 | 16 | "MIME-Version: 1.0\n" | ||
95 | 17 | "Content-Type: text/plain; charset=CHARSET\n" | ||
96 | 18 | "Content-Transfer-Encoding: 8bit\n" | ||
97 | 19 | |||
98 | 20 | msgid "Keep In Launcher" | ||
99 | 21 | msgstr "" | ||
100 | 22 | |||
101 | 23 | msgid "Quit" | ||
102 | 24 | msgstr "" | ||
103 | 25 | |||
104 | 26 | msgid "Open" | ||
105 | 27 | msgstr "" | ||
106 | 28 | |||
107 | 29 | msgid "Eject" | ||
108 | 30 | msgstr "" | ||
109 | 31 | |||
110 | 32 | msgid "Workspace Switcher" | ||
111 | 33 | msgstr "" | ||
112 | 34 | |||
113 | 35 | msgid "Find Media Apps" | ||
114 | 36 | msgstr "" | ||
115 | 37 | |||
116 | 38 | msgid "Find Internet Apps" | ||
117 | 39 | msgstr "" | ||
118 | 40 | |||
119 | 41 | msgid "Find More Apps" | ||
120 | 42 | msgstr "" | ||
121 | 43 | |||
122 | 44 | msgid "Find Files" | ||
123 | 45 | msgstr "" | ||
124 | 46 | |||
125 | 47 | msgid "Browse the Web" | ||
126 | 48 | msgstr "" | ||
127 | 49 | |||
128 | 50 | msgid "View Photos" | ||
129 | 51 | msgstr "" | ||
130 | 52 | |||
131 | 53 | msgid "Check Email" | ||
132 | 54 | msgstr "" | ||
133 | 55 | |||
134 | 56 | msgid "Listen to Music" | ||
135 | 57 | msgstr "" | ||
136 | 58 | |||
137 | 59 | msgid "Trash" | ||
138 | 60 | msgstr "" | ||
139 | 61 | |||
140 | 62 | msgid "Empty Trash" | ||
141 | 63 | msgstr "" | ||
142 | 64 | |||
143 | 65 | msgid "Empty all items from Trash?" | ||
144 | 66 | msgstr "" | ||
145 | 67 | |||
146 | 68 | msgid "All items in the Trash will be permanently deleted." | ||
147 | 69 | msgstr "" | ||
148 | 70 | 0 | ||
149 | === modified file 'services/CMakeLists.txt' | |||
150 | --- services/CMakeLists.txt 2011-02-24 14:51:30 +0000 | |||
151 | +++ services/CMakeLists.txt 2011-03-17 12:04:28 +0000 | |||
152 | @@ -7,6 +7,30 @@ | |||
153 | 7 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE) | 7 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE) |
154 | 8 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE) | 8 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE) |
155 | 9 | 9 | ||
156 | 10 | set(PANEL_SOURCES | ||
157 | 11 | panel-a11y.c | ||
158 | 12 | panel-a11y.h | ||
159 | 13 | panel-indicator-accessible.c | ||
160 | 14 | panel-indicator-accessible.h | ||
161 | 15 | panel-indicator-entry-accessible.c | ||
162 | 16 | panel-indicator-entry-accessible.h | ||
163 | 17 | panel-main.c | ||
164 | 18 | ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
165 | 19 | panel-root-accessible.c | ||
166 | 20 | panel-root-accessible.h | ||
167 | 21 | panel-service.c | ||
168 | 22 | panel-service.h | ||
169 | 23 | panel-util-accessible.c | ||
170 | 24 | panel-util-accessible.h) | ||
171 | 25 | |||
172 | 26 | find_program(GLIB_GENMARSHAL glib-genmarshal) | ||
173 | 27 | add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
174 | 28 | COMMAND ${GLIB_GENMARSHAL} ARGS panel-marshal.list --body --prefix=panel_marshal > ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
175 | 29 | COMMAND ${GLIB_GENMARSHAL} ARGS panel-marshal.list --header --prefix=panel_marshal > ${CMAKE_SOURCE_DIR}/services/panel-marshal.h | ||
176 | 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
177 | 31 | DEPENDS panel-marshal.list | ||
178 | 32 | COMMENT "Generating marshallers") | ||
179 | 33 | |||
180 | 10 | set(CFLAGS | 34 | set(CFLAGS |
181 | 11 | ${SERVICE_DEPS_CFLAGS} | 35 | ${SERVICE_DEPS_CFLAGS} |
182 | 12 | ${SERVICE_DEPS_CFLAGS_OTHER} | 36 | ${SERVICE_DEPS_CFLAGS_OTHER} |
183 | @@ -24,21 +48,7 @@ | |||
184 | 24 | set(LIB_PATHS ${SERVICE_DEPS_LIBRARY_DIRS}) | 48 | set(LIB_PATHS ${SERVICE_DEPS_LIBRARY_DIRS}) |
185 | 25 | link_directories(${LIB_PATHS}) | 49 | link_directories(${LIB_PATHS}) |
186 | 26 | 50 | ||
202 | 27 | add_executable(unity-panel-service | 51 | add_executable(unity-panel-service ${PANEL_SOURCES}) |
188 | 28 | panel-a11y.c | ||
189 | 29 | panel-a11y.h | ||
190 | 30 | panel-indicator-accessible.c | ||
191 | 31 | panel-indicator-accessible.h | ||
192 | 32 | panel-indicator-entry-accessible.c | ||
193 | 33 | panel-indicator-entry-accessible.h | ||
194 | 34 | panel-main.c | ||
195 | 35 | panel-root-accessible.c | ||
196 | 36 | panel-root-accessible.h | ||
197 | 37 | panel-service.c | ||
198 | 38 | panel-service.h | ||
199 | 39 | panel-util-accessible.c | ||
200 | 40 | panel-util-accessible.h | ||
201 | 41 | ) | ||
203 | 42 | install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/) | 52 | install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/) |
204 | 43 | 53 | ||
205 | 44 | configure_file(com.canonical.Unity.Panel.Service.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/com.canonical.Unity.Panel.Service.service) | 54 | configure_file(com.canonical.Unity.Panel.Service.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/com.canonical.Unity.Panel.Service.service) |
206 | 45 | 55 | ||
207 | === modified file 'services/panel-a11y.c' | |||
208 | --- services/panel-a11y.c 2011-02-28 15:51:27 +0000 | |||
209 | +++ services/panel-a11y.c 2011-03-17 12:04:28 +0000 | |||
210 | @@ -127,6 +127,7 @@ | |||
211 | 127 | void | 127 | void |
212 | 128 | panel_a11y_init (void) | 128 | panel_a11y_init (void) |
213 | 129 | { | 129 | { |
214 | 130 | AtkObject *root; | ||
215 | 130 | gchar *bridge_path = NULL; | 131 | gchar *bridge_path = NULL; |
216 | 131 | 132 | ||
217 | 132 | if (a11y_initialized) | 133 | if (a11y_initialized) |
218 | @@ -150,5 +151,10 @@ | |||
219 | 150 | 151 | ||
220 | 151 | g_free (bridge_path); | 152 | g_free (bridge_path); |
221 | 152 | 153 | ||
222 | 154 | /* There might be cases when we start signalling about change of geometries but the | ||
223 | 155 | accessible objects are not yet created, so to avoid that, instantiate here the | ||
224 | 156 | A11Y root object, which will create them all */ | ||
225 | 157 | root = atk_get_root (); | ||
226 | 158 | |||
227 | 153 | a11y_initialized = TRUE; | 159 | a11y_initialized = TRUE; |
228 | 154 | } | 160 | } |
229 | 155 | 161 | ||
230 | === modified file 'services/panel-indicator-accessible.c' | |||
231 | --- services/panel-indicator-accessible.c 2011-03-14 17:01:34 +0000 | |||
232 | +++ services/panel-indicator-accessible.c 2011-03-17 12:04:28 +0000 | |||
233 | @@ -19,12 +19,11 @@ | |||
234 | 19 | #include <glib/gi18n.h> | 19 | #include <glib/gi18n.h> |
235 | 20 | #include "panel-indicator-accessible.h" | 20 | #include "panel-indicator-accessible.h" |
236 | 21 | #include "panel-indicator-entry-accessible.h" | 21 | #include "panel-indicator-entry-accessible.h" |
241 | 22 | 22 | #include "panel-service.h" | |
238 | 23 | G_DEFINE_TYPE(PanelIndicatorAccessible, panel_indicator_accessible, ATK_TYPE_OBJECT) | ||
239 | 24 | |||
240 | 25 | #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessiblePrivate)) | ||
242 | 26 | 23 | ||
243 | 27 | /* AtkObject methods */ | 24 | /* AtkObject methods */ |
244 | 25 | static void pia_component_interface_init (AtkComponentIface *iface); | ||
245 | 26 | |||
246 | 28 | static void panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data); | 27 | static void panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data); |
247 | 29 | static gint panel_indicator_accessible_get_n_children (AtkObject *accessible); | 28 | static gint panel_indicator_accessible_get_n_children (AtkObject *accessible); |
248 | 30 | static AtkObject *panel_indicator_accessible_ref_child (AtkObject *accessible, gint i); | 29 | static AtkObject *panel_indicator_accessible_ref_child (AtkObject *accessible, gint i); |
249 | @@ -33,9 +32,21 @@ | |||
250 | 33 | struct _PanelIndicatorAccessiblePrivate | 32 | struct _PanelIndicatorAccessiblePrivate |
251 | 34 | { | 33 | { |
252 | 35 | IndicatorObject *indicator; | 34 | IndicatorObject *indicator; |
253 | 35 | PanelService *service; | ||
254 | 36 | GSList *a11y_children; | 36 | GSList *a11y_children; |
255 | 37 | gint x; | ||
256 | 38 | gint y; | ||
257 | 39 | gint width; | ||
258 | 40 | gint height; | ||
259 | 37 | }; | 41 | }; |
260 | 38 | 42 | ||
261 | 43 | G_DEFINE_TYPE_WITH_CODE(PanelIndicatorAccessible, | ||
262 | 44 | panel_indicator_accessible, | ||
263 | 45 | ATK_TYPE_OBJECT, | ||
264 | 46 | G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, pia_component_interface_init)) | ||
265 | 47 | |||
266 | 48 | #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_INDICATOR_ACCESSIBLE, PanelIndicatorAccessiblePrivate)) | ||
267 | 49 | |||
268 | 39 | /* Indicator callbacks */ | 50 | /* Indicator callbacks */ |
269 | 40 | 51 | ||
270 | 41 | static void | 52 | static void |
271 | @@ -100,6 +111,64 @@ | |||
272 | 100 | } | 111 | } |
273 | 101 | 112 | ||
274 | 102 | static void | 113 | static void |
275 | 114 | on_geometries_changed_cb (PanelService *service, | ||
276 | 115 | IndicatorObject *object, | ||
277 | 116 | IndicatorObjectEntry *entry, | ||
278 | 117 | gint x, | ||
279 | 118 | gint y, | ||
280 | 119 | gint width, | ||
281 | 120 | gint height, | ||
282 | 121 | gpointer user_data) | ||
283 | 122 | { | ||
284 | 123 | PanelIndicatorAccessible *pia; | ||
285 | 124 | AtkRectangle rect; | ||
286 | 125 | GSList *l; | ||
287 | 126 | gboolean minimum_set = FALSE; | ||
288 | 127 | |||
289 | 128 | pia = PANEL_INDICATOR_ACCESSIBLE (user_data); | ||
290 | 129 | |||
291 | 130 | g_return_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (pia)); | ||
292 | 131 | |||
293 | 132 | if (object != pia->priv->indicator) | ||
294 | 133 | return; | ||
295 | 134 | |||
296 | 135 | /* Iterate over all children to get width and height */ | ||
297 | 136 | pia->priv->width = pia->priv->height = 0; | ||
298 | 137 | |||
299 | 138 | for (l = pia->priv->a11y_children; l != NULL; l = l->next) | ||
300 | 139 | { | ||
301 | 140 | gint e_x, e_y, e_width, e_height; | ||
302 | 141 | AtkObject *accessible = ATK_OBJECT (l->data); | ||
303 | 142 | |||
304 | 143 | atk_component_get_extents (ATK_COMPONENT (accessible), &e_x, &e_y, &e_width, &e_height, ATK_XY_SCREEN); | ||
305 | 144 | if (minimum_set) | ||
306 | 145 | { | ||
307 | 146 | if (e_x < pia->priv->x) | ||
308 | 147 | pia->priv->x = e_x; | ||
309 | 148 | if (e_y < pia->priv->y) | ||
310 | 149 | pia->priv->y = e_y; | ||
311 | 150 | } | ||
312 | 151 | else | ||
313 | 152 | { | ||
314 | 153 | pia->priv->x = e_x; | ||
315 | 154 | pia->priv->y = e_y; | ||
316 | 155 | minimum_set = TRUE; | ||
317 | 156 | } | ||
318 | 157 | |||
319 | 158 | pia->priv->width += e_width; | ||
320 | 159 | if (e_height > pia->priv->height) | ||
321 | 160 | pia->priv->height = e_height; | ||
322 | 161 | } | ||
323 | 162 | |||
324 | 163 | /* Notify ATK objects of change of coordinates */ | ||
325 | 164 | rect.x = pia->priv->x; | ||
326 | 165 | rect.y = pia->priv->y; | ||
327 | 166 | rect.width = pia->priv->width; | ||
328 | 167 | rect.height = pia->priv->height; | ||
329 | 168 | g_signal_emit_by_name (ATK_COMPONENT (pia), "bounds-changed", &rect); | ||
330 | 169 | } | ||
331 | 170 | |||
332 | 171 | static void | ||
333 | 103 | panel_indicator_accessible_finalize (GObject *object) | 172 | panel_indicator_accessible_finalize (GObject *object) |
334 | 104 | { | 173 | { |
335 | 105 | PanelIndicatorAccessible *pia = PANEL_INDICATOR_ACCESSIBLE (object); | 174 | PanelIndicatorAccessible *pia = PANEL_INDICATOR_ACCESSIBLE (object); |
336 | @@ -122,6 +191,8 @@ | |||
337 | 122 | pia->priv->a11y_children = g_slist_remove (pia->priv->a11y_children, accessible); | 191 | pia->priv->a11y_children = g_slist_remove (pia->priv->a11y_children, accessible); |
338 | 123 | g_object_unref (accessible); | 192 | g_object_unref (accessible); |
339 | 124 | } | 193 | } |
340 | 194 | |||
341 | 195 | g_signal_handlers_disconnect_by_func (pia->priv->service, on_geometries_changed_cb, pia); | ||
342 | 125 | } | 196 | } |
343 | 126 | 197 | ||
344 | 127 | G_OBJECT_CLASS (panel_indicator_accessible_parent_class)->finalize (object); | 198 | G_OBJECT_CLASS (panel_indicator_accessible_parent_class)->finalize (object); |
345 | @@ -152,6 +223,12 @@ | |||
346 | 152 | { | 223 | { |
347 | 153 | pia->priv = GET_PRIVATE (pia); | 224 | pia->priv = GET_PRIVATE (pia); |
348 | 154 | pia->priv->a11y_children = NULL; | 225 | pia->priv->a11y_children = NULL; |
349 | 226 | pia->priv->x = pia->priv->y = pia->priv->width = pia->priv->height = 0; | ||
350 | 227 | |||
351 | 228 | /* Set up signals for listening to service changes */ | ||
352 | 229 | pia->priv->service = panel_service_get_default (); | ||
353 | 230 | g_signal_connect (pia->priv->service, "geometries-changed", | ||
354 | 231 | G_CALLBACK (on_geometries_changed_cb), pia); | ||
355 | 155 | } | 232 | } |
356 | 156 | 233 | ||
357 | 157 | AtkObject * | 234 | AtkObject * |
358 | @@ -168,6 +245,36 @@ | |||
359 | 168 | /* Implementation of AtkObject methods */ | 245 | /* Implementation of AtkObject methods */ |
360 | 169 | 246 | ||
361 | 170 | static void | 247 | static void |
362 | 248 | panel_indicator_accessible_get_extents (AtkComponent *component, | ||
363 | 249 | gint *x, | ||
364 | 250 | gint *y, | ||
365 | 251 | gint *width, | ||
366 | 252 | gint *height, | ||
367 | 253 | AtkCoordType coord_type) | ||
368 | 254 | { | ||
369 | 255 | PanelIndicatorAccessible *pia; | ||
370 | 256 | |||
371 | 257 | g_return_if_fail (PANEL_IS_INDICATOR_ACCESSIBLE (component)); | ||
372 | 258 | |||
373 | 259 | pia = PANEL_INDICATOR_ACCESSIBLE (component); | ||
374 | 260 | |||
375 | 261 | /* We ignore AtkCoordType for now, as the panel is always at the top left | ||
376 | 262 | corner and so relative and absolute coordinates are the same */ | ||
377 | 263 | *x = pia->priv->x; | ||
378 | 264 | *y = pia->priv->y; | ||
379 | 265 | *width = pia->priv->width; | ||
380 | 266 | *height = pia->priv->height; | ||
381 | 267 | } | ||
382 | 268 | |||
383 | 269 | static void | ||
384 | 270 | pia_component_interface_init (AtkComponentIface *iface) | ||
385 | 271 | { | ||
386 | 272 | g_return_if_fail (iface != NULL); | ||
387 | 273 | |||
388 | 274 | iface->get_extents = panel_indicator_accessible_get_extents; | ||
389 | 275 | } | ||
390 | 276 | |||
391 | 277 | static void | ||
392 | 171 | panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data) | 278 | panel_indicator_accessible_initialize (AtkObject *accessible, gpointer data) |
393 | 172 | { | 279 | { |
394 | 173 | PanelIndicatorAccessible *pia; | 280 | PanelIndicatorAccessible *pia; |
395 | 174 | 281 | ||
396 | === modified file 'services/panel-indicator-entry-accessible.c' | |||
397 | --- services/panel-indicator-entry-accessible.c 2011-03-14 16:46:04 +0000 | |||
398 | +++ services/panel-indicator-entry-accessible.c 2011-03-17 12:04:28 +0000 | |||
399 | @@ -19,11 +19,9 @@ | |||
400 | 19 | #include "panel-indicator-entry-accessible.h" | 19 | #include "panel-indicator-entry-accessible.h" |
401 | 20 | #include "panel-service.h" | 20 | #include "panel-service.h" |
402 | 21 | 21 | ||
403 | 22 | G_DEFINE_TYPE(PanelIndicatorEntryAccessible, panel_indicator_entry_accessible, ATK_TYPE_OBJECT) | ||
404 | 23 | |||
405 | 24 | #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_INDICATOR_ENTRY_ACCESSIBLE, PanelIndicatorEntryAccessiblePrivate)) | ||
406 | 25 | |||
407 | 26 | /* AtkObject methods */ | 22 | /* AtkObject methods */ |
408 | 23 | static void piea_component_interface_init (AtkComponentIface *iface); | ||
409 | 24 | |||
410 | 27 | static void panel_indicator_entry_accessible_initialize (AtkObject *accessible, gpointer data); | 25 | static void panel_indicator_entry_accessible_initialize (AtkObject *accessible, gpointer data); |
411 | 28 | static gint panel_indicator_entry_accessible_get_n_children (AtkObject *accessible); | 26 | static gint panel_indicator_entry_accessible_get_n_children (AtkObject *accessible); |
412 | 29 | static AtkObject *panel_indicator_entry_accessible_ref_child (AtkObject *accessible, gint i); | 27 | static AtkObject *panel_indicator_entry_accessible_ref_child (AtkObject *accessible, gint i); |
413 | @@ -33,17 +31,30 @@ | |||
414 | 33 | { | 31 | { |
415 | 34 | IndicatorObjectEntry *entry; | 32 | IndicatorObjectEntry *entry; |
416 | 35 | PanelService *service; | 33 | PanelService *service; |
417 | 34 | gint x; | ||
418 | 35 | gint y; | ||
419 | 36 | gint width; | ||
420 | 37 | gint height; | ||
421 | 36 | gboolean active; | 38 | gboolean active; |
422 | 37 | }; | 39 | }; |
423 | 38 | 40 | ||
424 | 41 | G_DEFINE_TYPE_WITH_CODE(PanelIndicatorEntryAccessible, | ||
425 | 42 | panel_indicator_entry_accessible, | ||
426 | 43 | ATK_TYPE_OBJECT, | ||
427 | 44 | G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, piea_component_interface_init)) | ||
428 | 45 | |||
429 | 46 | #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_INDICATOR_ENTRY_ACCESSIBLE, PanelIndicatorEntryAccessiblePrivate)) | ||
430 | 47 | |||
431 | 39 | static void | 48 | static void |
432 | 40 | on_entry_activated_cb (PanelService *service, const gchar *entry_id, gpointer user_data) | 49 | on_entry_activated_cb (PanelService *service, const gchar *entry_id, gpointer user_data) |
433 | 41 | { | 50 | { |
434 | 42 | gchar *s; | 51 | gchar *s; |
435 | 43 | gboolean adding = FALSE; | 52 | gboolean adding = FALSE; |
439 | 44 | PanelIndicatorEntryAccessible *piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (user_data); | 53 | PanelIndicatorEntryAccessible *piea; |
440 | 45 | 54 | ||
441 | 46 | g_return_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (piea)); | 55 | g_return_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (user_data)); |
442 | 56 | |||
443 | 57 | piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (user_data); | ||
444 | 47 | 58 | ||
445 | 48 | /* The PanelService sends us a string containing the pointer to the IndicatorObjectEntry */ | 59 | /* The PanelService sends us a string containing the pointer to the IndicatorObjectEntry */ |
446 | 49 | s = g_strdup_printf ("%p", piea->priv->entry); | 60 | s = g_strdup_printf ("%p", piea->priv->entry); |
447 | @@ -66,6 +77,39 @@ | |||
448 | 66 | } | 77 | } |
449 | 67 | 78 | ||
450 | 68 | static void | 79 | static void |
451 | 80 | on_geometries_changed_cb (PanelService *service, | ||
452 | 81 | IndicatorObject *object, | ||
453 | 82 | IndicatorObjectEntry *entry, | ||
454 | 83 | gint x, | ||
455 | 84 | gint y, | ||
456 | 85 | gint width, | ||
457 | 86 | gint height, | ||
458 | 87 | gpointer user_data) | ||
459 | 88 | { | ||
460 | 89 | PanelIndicatorEntryAccessible *piea; | ||
461 | 90 | AtkRectangle rect; | ||
462 | 91 | |||
463 | 92 | piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (user_data); | ||
464 | 93 | |||
465 | 94 | g_return_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (piea)); | ||
466 | 95 | |||
467 | 96 | if (entry != piea->priv->entry) | ||
468 | 97 | return; | ||
469 | 98 | |||
470 | 99 | piea->priv->x = x; | ||
471 | 100 | piea->priv->y = y; | ||
472 | 101 | piea->priv->width = width; | ||
473 | 102 | piea->priv->height = height; | ||
474 | 103 | |||
475 | 104 | /* Notify ATK objects of change of coordinates */ | ||
476 | 105 | rect.x = piea->priv->x; | ||
477 | 106 | rect.y = piea->priv->y; | ||
478 | 107 | rect.width = piea->priv->width; | ||
479 | 108 | rect.height = piea->priv->height; | ||
480 | 109 | g_signal_emit_by_name (ATK_COMPONENT (piea), "bounds-changed", &rect); | ||
481 | 110 | } | ||
482 | 111 | |||
483 | 112 | static void | ||
484 | 69 | panel_indicator_entry_accessible_finalize (GObject *object) | 113 | panel_indicator_entry_accessible_finalize (GObject *object) |
485 | 70 | { | 114 | { |
486 | 71 | PanelIndicatorEntryAccessible *piea; | 115 | PanelIndicatorEntryAccessible *piea; |
487 | @@ -77,6 +121,7 @@ | |||
488 | 77 | if (piea->priv != NULL) | 121 | if (piea->priv != NULL) |
489 | 78 | { | 122 | { |
490 | 79 | g_signal_handlers_disconnect_by_func (piea->priv->service, on_entry_activated_cb, piea); | 123 | g_signal_handlers_disconnect_by_func (piea->priv->service, on_entry_activated_cb, piea); |
491 | 124 | g_signal_handlers_disconnect_by_func (piea->priv->service, on_geometries_changed_cb, piea); | ||
492 | 80 | } | 125 | } |
493 | 81 | 126 | ||
494 | 82 | G_OBJECT_CLASS (panel_indicator_entry_accessible_parent_class)->finalize (object); | 127 | G_OBJECT_CLASS (panel_indicator_entry_accessible_parent_class)->finalize (object); |
495 | @@ -106,10 +151,13 @@ | |||
496 | 106 | panel_indicator_entry_accessible_init (PanelIndicatorEntryAccessible *piea) | 151 | panel_indicator_entry_accessible_init (PanelIndicatorEntryAccessible *piea) |
497 | 107 | { | 152 | { |
498 | 108 | piea->priv = GET_PRIVATE (piea); | 153 | piea->priv = GET_PRIVATE (piea); |
499 | 154 | piea->priv->x = piea->priv->y = piea->priv->width = piea->priv->height = 0; | ||
500 | 109 | 155 | ||
501 | 110 | /* Set up signals for listening to service changes */ | 156 | /* Set up signals for listening to service changes */ |
502 | 111 | piea->priv->active = FALSE; | 157 | piea->priv->active = FALSE; |
503 | 112 | piea->priv->service = panel_service_get_default (); | 158 | piea->priv->service = panel_service_get_default (); |
504 | 159 | g_signal_connect (piea->priv->service, "geometries-changed", | ||
505 | 160 | G_CALLBACK (on_geometries_changed_cb), piea); | ||
506 | 113 | g_signal_connect (piea->priv->service, "entry-activated", | 161 | g_signal_connect (piea->priv->service, "entry-activated", |
507 | 114 | G_CALLBACK (on_entry_activated_cb), piea); | 162 | G_CALLBACK (on_entry_activated_cb), piea); |
508 | 115 | } | 163 | } |
509 | @@ -136,6 +184,36 @@ | |||
510 | 136 | /* Implementation of AtkObject methods */ | 184 | /* Implementation of AtkObject methods */ |
511 | 137 | 185 | ||
512 | 138 | static void | 186 | static void |
513 | 187 | panel_indicator_entry_accessible_get_extents (AtkComponent *component, | ||
514 | 188 | gint *x, | ||
515 | 189 | gint *y, | ||
516 | 190 | gint *width, | ||
517 | 191 | gint *height, | ||
518 | 192 | AtkCoordType coord_type) | ||
519 | 193 | { | ||
520 | 194 | PanelIndicatorEntryAccessible *piea; | ||
521 | 195 | |||
522 | 196 | g_return_if_fail (PANEL_IS_INDICATOR_ENTRY_ACCESSIBLE (component)); | ||
523 | 197 | |||
524 | 198 | piea = PANEL_INDICATOR_ENTRY_ACCESSIBLE (component); | ||
525 | 199 | |||
526 | 200 | /* We ignore AtkCoordType for now, as the panel is always at the top left | ||
527 | 201 | corner and so relative and absolute coordinates are the same */ | ||
528 | 202 | *x = piea->priv->x; | ||
529 | 203 | *y = piea->priv->y; | ||
530 | 204 | *width = piea->priv->width; | ||
531 | 205 | *height = piea->priv->height; | ||
532 | 206 | } | ||
533 | 207 | |||
534 | 208 | static void | ||
535 | 209 | piea_component_interface_init (AtkComponentIface *iface) | ||
536 | 210 | { | ||
537 | 211 | g_return_if_fail (iface != NULL); | ||
538 | 212 | |||
539 | 213 | iface->get_extents = panel_indicator_entry_accessible_get_extents; | ||
540 | 214 | } | ||
541 | 215 | |||
542 | 216 | static void | ||
543 | 139 | panel_indicator_entry_accessible_initialize (AtkObject *accessible, gpointer data) | 217 | panel_indicator_entry_accessible_initialize (AtkObject *accessible, gpointer data) |
544 | 140 | { | 218 | { |
545 | 141 | PanelIndicatorEntryAccessible *piea; | 219 | PanelIndicatorEntryAccessible *piea; |
546 | 142 | 220 | ||
547 | === modified file 'services/panel-main.c' | |||
548 | --- services/panel-main.c 2011-01-31 21:52:38 +0000 | |||
549 | +++ services/panel-main.c 2011-03-17 12:04:28 +0000 | |||
550 | @@ -55,6 +55,10 @@ | |||
551 | 55 | " <arg type='a(sssbbusbb)' name='state' direction='out'/>" | 55 | " <arg type='a(sssbbusbb)' name='state' direction='out'/>" |
552 | 56 | " </method>" | 56 | " </method>" |
553 | 57 | "" | 57 | "" |
554 | 58 | " <method name='SyncGeometries'>" | ||
555 | 59 | " <arg type='a(ssiiii)' name='geometries' direction='in'/>" | ||
556 | 60 | " </method>" | ||
557 | 61 | "" | ||
558 | 58 | " <method name='ShowEntry'>" | 62 | " <method name='ShowEntry'>" |
559 | 59 | " <arg type='s' name='entry_id' direction='in'/>" | 63 | " <arg type='s' name='entry_id' direction='in'/>" |
560 | 60 | " <arg type='u' name='timestamp' direction='in'/>" | 64 | " <arg type='u' name='timestamp' direction='in'/>" |
561 | @@ -140,6 +144,29 @@ | |||
562 | 140 | id)); | 144 | id)); |
563 | 141 | g_free (id); | 145 | g_free (id); |
564 | 142 | } | 146 | } |
565 | 147 | else if (g_strcmp0 (method_name, "SyncGeometries") == 0) | ||
566 | 148 | { | ||
567 | 149 | GVariantIter *iter; | ||
568 | 150 | gchar *indicator_id, *entry_id; | ||
569 | 151 | gint x, y, width, height; | ||
570 | 152 | |||
571 | 153 | g_variant_get (parameters, "(a(ssiiii))", &iter); | ||
572 | 154 | while (g_variant_iter_loop (iter, "(ssiiii)", | ||
573 | 155 | &indicator_id, | ||
574 | 156 | &entry_id, | ||
575 | 157 | &x, | ||
576 | 158 | &y, | ||
577 | 159 | &width, | ||
578 | 160 | &height)) | ||
579 | 161 | { | ||
580 | 162 | panel_service_sync_geometry (service, indicator_id, | ||
581 | 163 | entry_id, x, y, width, height); | ||
582 | 164 | } | ||
583 | 165 | |||
584 | 166 | g_variant_iter_free (iter); | ||
585 | 167 | |||
586 | 168 | g_dbus_method_invocation_return_value (invocation, NULL); | ||
587 | 169 | } | ||
588 | 143 | else if (g_strcmp0 (method_name, "ShowEntry") == 0) | 170 | else if (g_strcmp0 (method_name, "ShowEntry") == 0) |
589 | 144 | { | 171 | { |
590 | 145 | gchar *entry_id; | 172 | gchar *entry_id; |
591 | @@ -309,13 +336,11 @@ | |||
592 | 309 | gtk_icon_theme_append_search_path (gtk_icon_theme_get_default(), | 336 | gtk_icon_theme_append_search_path (gtk_icon_theme_get_default(), |
593 | 310 | INDICATORICONDIR); | 337 | INDICATORICONDIR); |
594 | 311 | 338 | ||
595 | 312 | panel_a11y_init (); | ||
596 | 313 | |||
597 | 314 | introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); | 339 | introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); |
598 | 315 | g_assert (introspection_data != NULL); | 340 | g_assert (introspection_data != NULL); |
599 | 316 | 341 | ||
600 | 317 | service = panel_service_get_default (); | 342 | service = panel_service_get_default (); |
602 | 318 | 343 | ||
603 | 319 | owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, | 344 | owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, |
604 | 320 | S_NAME, | 345 | S_NAME, |
605 | 321 | G_BUS_NAME_OWNER_FLAGS_NONE, | 346 | G_BUS_NAME_OWNER_FLAGS_NONE, |
606 | @@ -324,6 +349,9 @@ | |||
607 | 324 | on_name_lost, | 349 | on_name_lost, |
608 | 325 | service, | 350 | service, |
609 | 326 | NULL); | 351 | NULL); |
610 | 352 | |||
611 | 353 | panel_a11y_init (); | ||
612 | 354 | |||
613 | 327 | gtk_main (); | 355 | gtk_main (); |
614 | 328 | 356 | ||
615 | 329 | g_bus_unown_name (owner_id); | 357 | g_bus_unown_name (owner_id); |
616 | 330 | 358 | ||
617 | === added file 'services/panel-marshal.list' | |||
618 | --- services/panel-marshal.list 1970-01-01 00:00:00 +0000 | |||
619 | +++ services/panel-marshal.list 2011-03-17 12:04:28 +0000 | |||
620 | @@ -0,0 +1,1 @@ | |||
621 | 1 | NONE:OBJECT,POINTER,INT,INT,INT,INT | ||
622 | 0 | 2 | ||
623 | === modified file 'services/panel-service.c' | |||
624 | --- services/panel-service.c 2011-03-09 00:11:25 +0000 | |||
625 | +++ services/panel-service.c 2011-03-17 12:04:28 +0000 | |||
626 | @@ -21,6 +21,7 @@ | |||
627 | 21 | #include <config.h> | 21 | #include <config.h> |
628 | 22 | #endif | 22 | #endif |
629 | 23 | 23 | ||
630 | 24 | #include "panel-marshal.h" | ||
631 | 24 | #include "panel-service.h" | 25 | #include "panel-service.h" |
632 | 25 | 26 | ||
633 | 26 | #include <stdlib.h> | 27 | #include <stdlib.h> |
634 | @@ -67,6 +68,7 @@ | |||
635 | 67 | RE_SYNC, | 68 | RE_SYNC, |
636 | 68 | ACTIVE_MENU_POINTER_MOTION, | 69 | ACTIVE_MENU_POINTER_MOTION, |
637 | 69 | ENTRY_ACTIVATE_REQUEST, | 70 | ENTRY_ACTIVATE_REQUEST, |
638 | 71 | GEOMETRIES_CHANGED, | ||
639 | 70 | 72 | ||
640 | 71 | LAST_SIGNAL | 73 | LAST_SIGNAL |
641 | 72 | }; | 74 | }; |
642 | @@ -179,6 +181,16 @@ | |||
643 | 179 | NULL, NULL, | 181 | NULL, NULL, |
644 | 180 | g_cclosure_marshal_VOID__STRING, | 182 | g_cclosure_marshal_VOID__STRING, |
645 | 181 | G_TYPE_NONE, 1, G_TYPE_STRING); | 183 | G_TYPE_NONE, 1, G_TYPE_STRING); |
646 | 184 | _service_signals[GEOMETRIES_CHANGED] = | ||
647 | 185 | g_signal_new ("geometries-changed", | ||
648 | 186 | G_OBJECT_CLASS_TYPE (obj_class), | ||
649 | 187 | G_SIGNAL_RUN_LAST, | ||
650 | 188 | 0, | ||
651 | 189 | NULL, NULL, | ||
652 | 190 | panel_marshal_VOID__OBJECT_POINTER_INT_INT_INT_INT, | ||
653 | 191 | G_TYPE_NONE, 6, | ||
654 | 192 | G_TYPE_OBJECT, G_TYPE_POINTER, | ||
655 | 193 | G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); | ||
656 | 182 | 194 | ||
657 | 183 | 195 | ||
658 | 184 | g_type_class_add_private (obj_class, sizeof (PanelServicePrivate)); | 196 | g_type_class_add_private (obj_class, sizeof (PanelServicePrivate)); |
659 | @@ -861,6 +873,22 @@ | |||
660 | 861 | return g_variant_builder_end (&b); | 873 | return g_variant_builder_end (&b); |
661 | 862 | } | 874 | } |
662 | 863 | 875 | ||
663 | 876 | void | ||
664 | 877 | panel_service_sync_geometry (PanelService *self, | ||
665 | 878 | const gchar *indicator_id, | ||
666 | 879 | const gchar *entry_id, | ||
667 | 880 | gint x, | ||
668 | 881 | gint y, | ||
669 | 882 | gint width, | ||
670 | 883 | gint height) | ||
671 | 884 | { | ||
672 | 885 | PanelServicePrivate *priv = self->priv; | ||
673 | 886 | IndicatorObjectEntry *entry = g_hash_table_lookup (priv->id2entry_hash, entry_id); | ||
674 | 887 | IndicatorObject *object = g_hash_table_lookup (priv->entry2indicator_hash, entry); | ||
675 | 888 | |||
676 | 889 | g_signal_emit (self, _service_signals[GEOMETRIES_CHANGED], 0, object, entry, x, y, width, height); | ||
677 | 890 | } | ||
678 | 891 | |||
679 | 864 | static void | 892 | static void |
680 | 865 | activate_next_prev_menu (PanelService *self, | 893 | activate_next_prev_menu (PanelService *self, |
681 | 866 | IndicatorObject *object, | 894 | IndicatorObject *object, |
682 | 867 | 895 | ||
683 | === modified file 'services/panel-service.h' | |||
684 | --- services/panel-service.h 2011-02-23 16:49:18 +0000 | |||
685 | +++ services/panel-service.h 2011-03-17 12:04:28 +0000 | |||
686 | @@ -80,6 +80,13 @@ | |||
687 | 80 | 80 | ||
688 | 81 | GVariant * panel_service_sync_one (PanelService *self, | 81 | GVariant * panel_service_sync_one (PanelService *self, |
689 | 82 | const gchar *indicator_id); | 82 | const gchar *indicator_id); |
690 | 83 | void panel_service_sync_geometry (PanelService *self, | ||
691 | 84 | const gchar *indicator_id, | ||
692 | 85 | const gchar *entry_id, | ||
693 | 86 | gint x, | ||
694 | 87 | gint y, | ||
695 | 88 | gint width, | ||
696 | 89 | gint height); | ||
697 | 83 | 90 | ||
698 | 84 | void panel_service_show_entry (PanelService *self, | 91 | void panel_service_show_entry (PanelService *self, |
699 | 85 | const gchar *entry_id, | 92 | const gchar *entry_id, |
700 | 86 | 93 | ||
701 | === modified file 'src/IndicatorObjectFactory.h' | |||
702 | --- src/IndicatorObjectFactory.h 2010-12-17 14:07:11 +0000 | |||
703 | +++ src/IndicatorObjectFactory.h 2011-03-17 12:04:28 +0000 | |||
704 | @@ -47,6 +47,7 @@ | |||
705 | 47 | sigc::signal<void, int, int> OnMenuPointerMoved; | 47 | sigc::signal<void, int, int> OnMenuPointerMoved; |
706 | 48 | sigc::signal<void, const char *> OnEntryActivateRequest; | 48 | sigc::signal<void, const char *> OnEntryActivateRequest; |
707 | 49 | sigc::signal<void, const char *> OnEntryActivated; | 49 | sigc::signal<void, const char *> OnEntryActivated; |
708 | 50 | sigc::signal<void> OnSynced; | ||
709 | 50 | 51 | ||
710 | 51 | protected: | 52 | protected: |
711 | 52 | std::vector<IndicatorObjectProxy *>_indicators; | 53 | std::vector<IndicatorObjectProxy *>_indicators; |
712 | 53 | 54 | ||
713 | === modified file 'src/IndicatorObjectFactoryRemote.cpp' | |||
714 | --- src/IndicatorObjectFactoryRemote.cpp 2011-01-11 15:48:03 +0000 | |||
715 | +++ src/IndicatorObjectFactoryRemote.cpp 2011-03-17 12:04:28 +0000 | |||
716 | @@ -358,6 +358,9 @@ | |||
717 | 358 | 358 | ||
718 | 359 | g_free (current_proxy_id); | 359 | g_free (current_proxy_id); |
719 | 360 | g_variant_iter_free (iter); | 360 | g_variant_iter_free (iter); |
720 | 361 | |||
721 | 362 | /* Notify listeners we have new data */ | ||
722 | 363 | OnSynced.emit (); | ||
723 | 361 | } | 364 | } |
724 | 362 | 365 | ||
725 | 363 | void | 366 | void |
726 | 364 | 367 | ||
727 | === modified file 'src/PanelIndicatorObjectView.cpp' | |||
728 | --- src/PanelIndicatorObjectView.cpp 2011-02-22 23:11:20 +0000 | |||
729 | +++ src/PanelIndicatorObjectView.cpp 2011-03-17 12:04:28 +0000 | |||
730 | @@ -18,6 +18,7 @@ | |||
731 | 18 | */ | 18 | */ |
732 | 19 | 19 | ||
733 | 20 | #include "Nux/Nux.h" | 20 | #include "Nux/Nux.h" |
734 | 21 | #include "Nux/Area.h" | ||
735 | 21 | #include "Nux/HLayout.h" | 22 | #include "Nux/HLayout.h" |
736 | 22 | #include "Nux/VLayout.h" | 23 | #include "Nux/VLayout.h" |
737 | 23 | 24 | ||
738 | @@ -75,7 +76,6 @@ | |||
739 | 75 | void | 76 | void |
740 | 76 | PanelIndicatorObjectView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw) | 77 | PanelIndicatorObjectView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw) |
741 | 77 | { | 78 | { |
742 | 78 | |||
743 | 79 | } | 79 | } |
744 | 80 | 80 | ||
745 | 81 | void | 81 | void |
746 | @@ -153,3 +153,4 @@ | |||
747 | 153 | g_variant_builder_add (builder, "{sv}", "width", g_variant_new_int32 (geo.width)); | 153 | g_variant_builder_add (builder, "{sv}", "width", g_variant_new_int32 (geo.width)); |
748 | 154 | g_variant_builder_add (builder, "{sv}", "height", g_variant_new_int32 (geo.height)); | 154 | g_variant_builder_add (builder, "{sv}", "height", g_variant_new_int32 (geo.height)); |
749 | 155 | } | 155 | } |
750 | 156 | |||
751 | 156 | 157 | ||
752 | === modified file 'src/PanelIndicatorObjectView.h' | |||
753 | --- src/PanelIndicatorObjectView.h 2011-01-25 15:45:12 +0000 | |||
754 | +++ src/PanelIndicatorObjectView.h 2011-03-17 12:04:28 +0000 | |||
755 | @@ -43,7 +43,7 @@ | |||
756 | 43 | void OnEntryAdded (IndicatorObjectEntryProxy *proxy); | 43 | void OnEntryAdded (IndicatorObjectEntryProxy *proxy); |
757 | 44 | void OnEntryMoved (IndicatorObjectEntryProxy *proxy); | 44 | void OnEntryMoved (IndicatorObjectEntryProxy *proxy); |
758 | 45 | void OnEntryRemoved (IndicatorObjectEntryProxy *proxy); | 45 | void OnEntryRemoved (IndicatorObjectEntryProxy *proxy); |
760 | 46 | 46 | ||
761 | 47 | nux::HLayout *_layout; | 47 | nux::HLayout *_layout; |
762 | 48 | 48 | ||
763 | 49 | protected: | 49 | protected: |
764 | 50 | 50 | ||
765 | === modified file 'src/PanelView.cpp' | |||
766 | --- src/PanelView.cpp 2011-03-16 09:45:39 +0000 | |||
767 | +++ src/PanelView.cpp 2011-03-17 12:04:28 +0000 | |||
768 | @@ -37,6 +37,10 @@ | |||
769 | 37 | #include "IndicatorObjectFactoryRemote.h" | 37 | #include "IndicatorObjectFactoryRemote.h" |
770 | 38 | #include "PanelIndicatorObjectView.h" | 38 | #include "PanelIndicatorObjectView.h" |
771 | 39 | 39 | ||
772 | 40 | #define S_NAME "com.canonical.Unity.Panel.Service" | ||
773 | 41 | #define S_PATH "/com/canonical/Unity/Panel/Service" | ||
774 | 42 | #define S_IFACE "com.canonical.Unity.Panel.Service" | ||
775 | 43 | |||
776 | 40 | NUX_IMPLEMENT_OBJECT_TYPE (PanelView); | 44 | NUX_IMPLEMENT_OBJECT_TYPE (PanelView); |
777 | 41 | 45 | ||
778 | 42 | PanelView::PanelView (NUX_FILE_LINE_DECL) | 46 | PanelView::PanelView (NUX_FILE_LINE_DECL) |
779 | @@ -44,6 +48,7 @@ | |||
780 | 44 | _is_dirty (true), | 48 | _is_dirty (true), |
781 | 45 | _opacity (1.0f) | 49 | _opacity (1.0f) |
782 | 46 | { | 50 | { |
783 | 51 | _needs_geo_sync = false; | ||
784 | 47 | _style = new PanelStyle (); | 52 | _style = new PanelStyle (); |
785 | 48 | _style->changed.connect (sigc::mem_fun (this, &PanelView::ForceUpdateBackground)); | 53 | _style->changed.connect (sigc::mem_fun (this, &PanelView::ForceUpdateBackground)); |
786 | 49 | 54 | ||
787 | @@ -70,6 +75,7 @@ | |||
788 | 70 | _remote->OnMenuPointerMoved.connect (sigc::mem_fun (this, &PanelView::OnMenuPointerMoved)); | 75 | _remote->OnMenuPointerMoved.connect (sigc::mem_fun (this, &PanelView::OnMenuPointerMoved)); |
789 | 71 | _remote->OnEntryActivateRequest.connect (sigc::mem_fun (this, &PanelView::OnEntryActivateRequest)); | 76 | _remote->OnEntryActivateRequest.connect (sigc::mem_fun (this, &PanelView::OnEntryActivateRequest)); |
790 | 72 | _remote->IndicatorObjectFactory::OnEntryActivated.connect (sigc::mem_fun (this, &PanelView::OnEntryActivated)); | 77 | _remote->IndicatorObjectFactory::OnEntryActivated.connect (sigc::mem_fun (this, &PanelView::OnEntryActivated)); |
791 | 78 | _remote->IndicatorObjectFactory::OnSynced.connect (sigc::mem_fun (this, &PanelView::OnSynced)); | ||
792 | 73 | } | 79 | } |
793 | 74 | 80 | ||
794 | 75 | PanelView::~PanelView () | 81 | PanelView::~PanelView () |
795 | @@ -122,6 +128,12 @@ | |||
796 | 122 | gPainter.PopBackground (); | 128 | gPainter.PopBackground (); |
797 | 123 | 129 | ||
798 | 124 | GfxContext.PopClippingRectangle (); | 130 | GfxContext.PopClippingRectangle (); |
799 | 131 | |||
800 | 132 | if (_needs_geo_sync) | ||
801 | 133 | { | ||
802 | 134 | SyncGeometries (); | ||
803 | 135 | _needs_geo_sync = false; | ||
804 | 136 | } | ||
805 | 125 | } | 137 | } |
806 | 126 | 138 | ||
807 | 127 | void | 139 | void |
808 | @@ -333,6 +345,12 @@ | |||
809 | 333 | _menu_view->AllMenusClosed (); | 345 | _menu_view->AllMenusClosed (); |
810 | 334 | } | 346 | } |
811 | 335 | 347 | ||
812 | 348 | void | ||
813 | 349 | PanelView::OnSynced () | ||
814 | 350 | { | ||
815 | 351 | _needs_geo_sync = true; | ||
816 | 352 | } | ||
817 | 353 | |||
818 | 336 | // | 354 | // |
819 | 337 | // Useful Public Methods | 355 | // Useful Public Methods |
820 | 338 | // | 356 | // |
821 | @@ -390,3 +408,86 @@ | |||
822 | 390 | 408 | ||
823 | 391 | ForceUpdateBackground (); | 409 | ForceUpdateBackground (); |
824 | 392 | } | 410 | } |
825 | 411 | |||
826 | 412 | static void | ||
827 | 413 | on_sync_geometries_done_cb (GObject *source, | ||
828 | 414 | GAsyncResult *res, | ||
829 | 415 | gpointer data) | ||
830 | 416 | { | ||
831 | 417 | GVariant *args; | ||
832 | 418 | GError *error = NULL; | ||
833 | 419 | |||
834 | 420 | args = g_dbus_proxy_call_finish ((GDBusProxy*) source, res, &error); | ||
835 | 421 | if (error != NULL) | ||
836 | 422 | { | ||
837 | 423 | g_warning ("Error when calling SyncGeometries: %s", error->message); | ||
838 | 424 | g_error_free (error); | ||
839 | 425 | } | ||
840 | 426 | } | ||
841 | 427 | |||
842 | 428 | void | ||
843 | 429 | PanelView::SyncGeometries () | ||
844 | 430 | { | ||
845 | 431 | GVariantBuilder b; | ||
846 | 432 | GDBusProxy *bus_proxy; | ||
847 | 433 | GVariant *method_args; | ||
848 | 434 | std::list<Area *>::iterator it; | ||
849 | 435 | |||
850 | 436 | g_variant_builder_init (&b, G_VARIANT_TYPE ("(a(ssiiii))")); | ||
851 | 437 | g_variant_builder_open (&b, G_VARIANT_TYPE ("a(ssiiii)")); | ||
852 | 438 | |||
853 | 439 | std::list<Area *> my_children = _layout->GetChildren (); | ||
854 | 440 | for (it = my_children.begin(); it != my_children.end(); it++) | ||
855 | 441 | { | ||
856 | 442 | PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it); | ||
857 | 443 | |||
858 | 444 | if (view->_layout == NULL) | ||
859 | 445 | continue; | ||
860 | 446 | |||
861 | 447 | std::list<Area *>::iterator it2; | ||
862 | 448 | |||
863 | 449 | std::list<Area *> its_children = view->_layout->GetChildren (); | ||
864 | 450 | for (it2 = its_children.begin (); it2 != its_children.end (); it2++) | ||
865 | 451 | { | ||
866 | 452 | nux::Geometry geo; | ||
867 | 453 | PanelIndicatorObjectEntryView *entry = static_cast<PanelIndicatorObjectEntryView *> (*it2); | ||
868 | 454 | |||
869 | 455 | if (entry == NULL) | ||
870 | 456 | continue; | ||
871 | 457 | |||
872 | 458 | geo = entry->GetAbsoluteGeometry (); | ||
873 | 459 | g_variant_builder_add (&b, "(ssiiii)", | ||
874 | 460 | GetName (), | ||
875 | 461 | entry->_proxy->GetId (), | ||
876 | 462 | geo.x, | ||
877 | 463 | geo.y, | ||
878 | 464 | geo.GetWidth (), | ||
879 | 465 | geo.GetHeight ()); | ||
880 | 466 | } | ||
881 | 467 | } | ||
882 | 468 | |||
883 | 469 | g_variant_builder_close (&b); | ||
884 | 470 | method_args = g_variant_builder_end (&b); | ||
885 | 471 | |||
886 | 472 | // Send geometries to the panel service | ||
887 | 473 | bus_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, | ||
888 | 474 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | ||
889 | 475 | NULL, | ||
890 | 476 | S_NAME, | ||
891 | 477 | S_PATH, | ||
892 | 478 | S_IFACE, | ||
893 | 479 | NULL, | ||
894 | 480 | NULL); | ||
895 | 481 | if (bus_proxy != NULL) | ||
896 | 482 | { | ||
897 | 483 | g_dbus_proxy_call (bus_proxy, "SyncGeometries", method_args, | ||
898 | 484 | G_DBUS_CALL_FLAGS_NONE, | ||
899 | 485 | -1, | ||
900 | 486 | NULL, | ||
901 | 487 | on_sync_geometries_done_cb, | ||
902 | 488 | this); | ||
903 | 489 | g_object_unref (bus_proxy); | ||
904 | 490 | } | ||
905 | 491 | |||
906 | 492 | g_variant_unref (method_args); | ||
907 | 493 | } | ||
908 | 393 | 494 | ||
909 | === modified file 'src/PanelView.h' | |||
910 | --- src/PanelView.h 2011-03-16 09:45:39 +0000 | |||
911 | +++ src/PanelView.h 2011-03-17 12:04:28 +0000 | |||
912 | @@ -51,6 +51,7 @@ | |||
913 | 51 | void OnMenuPointerMoved (int x, int y); | 51 | void OnMenuPointerMoved (int x, int y); |
914 | 52 | void OnEntryActivateRequest (const char *entry_id); | 52 | void OnEntryActivateRequest (const char *entry_id); |
915 | 53 | void OnEntryActivated (const char *entry_id); | 53 | void OnEntryActivated (const char *entry_id); |
916 | 54 | void OnSynced (); | ||
917 | 54 | 55 | ||
918 | 55 | PanelHomeButton * HomeButton (); | 56 | PanelHomeButton * HomeButton (); |
919 | 56 | 57 | ||
920 | @@ -70,6 +71,7 @@ | |||
921 | 70 | private: | 71 | private: |
922 | 71 | void UpdateBackground (); | 72 | void UpdateBackground (); |
923 | 72 | void ForceUpdateBackground (); | 73 | void ForceUpdateBackground (); |
924 | 74 | void SyncGeometries (); | ||
925 | 73 | 75 | ||
926 | 74 | private: | 76 | private: |
927 | 75 | IndicatorObjectFactoryRemote *_remote; | 77 | IndicatorObjectFactoryRemote *_remote; |
928 | @@ -86,6 +88,7 @@ | |||
929 | 86 | PanelStyle *_style; | 88 | PanelStyle *_style; |
930 | 87 | bool _is_dirty; | 89 | bool _is_dirty; |
931 | 88 | float _opacity; | 90 | float _opacity; |
932 | 91 | bool _needs_geo_sync; | ||
933 | 89 | }; | 92 | }; |
934 | 90 | 93 | ||
935 | 91 | #endif // PANEL_VIEW_H | 94 | #endif // PANEL_VIEW_H |
936 | 92 | 95 | ||
937 | === modified file 'tests/CMakeLists.txt' | |||
938 | --- tests/CMakeLists.txt 2011-03-11 14:43:50 +0000 | |||
939 | +++ tests/CMakeLists.txt 2011-03-17 12:04:28 +0000 | |||
940 | @@ -30,6 +30,14 @@ | |||
941 | 30 | 30 | ||
942 | 31 | include_directories (. .. ../services ${CMAKE_BINARY_DIR}) | 31 | include_directories (. .. ../services ${CMAKE_BINARY_DIR}) |
943 | 32 | 32 | ||
944 | 33 | find_program(GLIB_GENMARSHAL glib-genmarshal) | ||
945 | 34 | add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
946 | 35 | COMMAND ${GLIB_GENMARSHAL} ARGS ${CMAKE_SOURCE_DIR}/services/panel-marshal.list --body --prefix=panel_marshal > ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
947 | 36 | COMMAND ${GLIB_GENMARSHAL} ARGS ${CMAKE_SOURCE_DIR}/services/panel-marshal.list --header --prefix=panel_marshal > ${CMAKE_SOURCE_DIR}/services/panel-marshal.h | ||
948 | 37 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
949 | 38 | DEPENDS ../services/panel-marshal.list | ||
950 | 39 | COMMENT "Generating marshallers") | ||
951 | 40 | |||
952 | 33 | # We can't have convenience libs so we need to rebuild with what we need | 41 | # We can't have convenience libs so we need to rebuild with what we need |
953 | 34 | # Please keep actual test files alphabetically at top and then files | 42 | # Please keep actual test files alphabetically at top and then files |
954 | 35 | # from ../../src or ../../services in alphabetically after that | 43 | # from ../../src or ../../services in alphabetically after that |
955 | @@ -44,6 +52,7 @@ | |||
956 | 44 | ../src/ubus-server.h | 52 | ../src/ubus-server.h |
957 | 45 | ../services/panel-service.c | 53 | ../services/panel-service.c |
958 | 46 | ../services/panel-service.h | 54 | ../services/panel-service.h |
959 | 55 | ${CMAKE_SOURCE_DIR}/services/panel-marshal.c | ||
960 | 47 | ../src/FavoriteStore.cpp | 56 | ../src/FavoriteStore.cpp |
961 | 48 | ../src/FavoriteStore.h | 57 | ../src/FavoriteStore.h |
962 | 49 | ../src/FavoriteStoreGSettings.cpp | 58 | ../src/FavoriteStoreGSettings.cpp |
Note that there's something wrong with the geometries, and not all indicator objects/entries get highlighted in the correct position when selected in accerciser