Merge lp:~unity-team/unity/unity.dbusmenu-quicklists into lp:unity
- unity.dbusmenu-quicklists
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~unity-team/unity/unity.dbusmenu-quicklists |
Merge into: | lp:unity |
Diff against target: |
2826 lines (+1733/-644) 25 files modified
configure.ac (+1/-0) targets/mutter/Makefile.am (+1/-0) targets/mutter/expose-manager.vala (+25/-23) targets/mutter/plugin.vala (+4/-3) targets/unity/Makefile.am (+1/-0) tests/ui/Makefile.am (+1/-0) tests/ui/test-automate.vala (+10/-9) tests/ui/test-quicklist.vala (+3/-1) tests/unit/Makefile.am (+1/-0) tests/unit/test-launcher.vala (+1/-1) unity-private/Makefile.am (+6/-1) unity-private/launcher/application-controller.vala (+166/-17) unity-private/launcher/quicklist-check-menu-item.vala (+228/-0) unity-private/launcher/quicklist-controller.vala (+294/-120) unity-private/launcher/quicklist-image-menu-item.vala (+23/-0) unity-private/launcher/quicklist-menu-item.vala (+225/-0) unity-private/launcher/quicklist-radio-menu-item.vala (+230/-0) unity-private/launcher/quicklist-seperator-menu-item.vala (+117/-0) unity-private/launcher/quicklist-view.vala (+0/-299) unity-private/launcher/scrollerchild-controller.vala (+28/-32) unity/Makefile.am (+1/-0) vapi/Bamf-0.2.vapi (+136/-135) vapi/Dbusmenu-Glib-0.2.vapi (+173/-0) vapi/clutk-0.3.vapi (+55/-1) vapi/indicator.vapi (+3/-2) |
To merge this branch: | bzr merge lp:~unity-team/unity/unity.dbusmenu-quicklists |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Abstain | ||
Review via email: mp+29457@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-07-15.
Commit message
Description of the change
builds quicklists based off dbusmenu's, namely one for the bottom half one for the top. top part of the menu is based on Indicator desktop shortcuts api. the only desktop shortcuts that should show up are those that use the Unity identifier so nothing is there right now until desktop files are modified.
Known issues:
Wrong rendering for the menu items, not using the unity menu item rendering because nothing shows up when i do, need Mirco to take a look at that. So its just using Ctk.MenuItem rendering
Menu's sometimes jump to the right, long time Unity.QuicklistView bug, not sure what is going on, need Mirco to take a look also.
Arrow is in the wrong position when menu is opened. Bug in the menu view rendering, hoping its fixed with mirco's resizing menus addition.]
Testing:
No tests right now, had to disable the previous tests built on quicklists (because the api changed). need to spend friday/thursday building new ones.
Gord Allott (gordallott) wrote : | # |
Neil J. Patel (njpatel) wrote : | # |
Code looks fine, but let's wait until the issues you've mentioned are fixed today/tomorrow and the clutk.menuitem branch is approved and merged.
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2010-07-13 15:04:53 +0000 |
3 | +++ configure.ac 2010-07-14 16:07:41 +0000 |
4 | @@ -97,6 +97,7 @@ |
5 | clutter-gtk-0.10 >= 0.10 |
6 | clutk-0.3 >= 0.3.26 |
7 | dbus-glib-1 |
8 | + dbusmenu-glib >= 0.3.4 |
9 | dee-1.0 >= 0.2.0 |
10 | glib-2.0 >= $GLIB_REQUIRED |
11 | gobject-2.0 >= $GLIB_REQUIRED |
12 | |
13 | === modified file 'targets/mutter/Makefile.am' |
14 | --- targets/mutter/Makefile.am 2010-06-21 07:33:51 +0000 |
15 | +++ targets/mutter/Makefile.am 2010-07-14 16:07:41 +0000 |
16 | @@ -39,6 +39,7 @@ |
17 | --pkg clutter-gtk-0.10 \ |
18 | --pkg clutk-0.3 \ |
19 | --pkg dbus-glib-1 \ |
20 | + --pkg Dbusmenu-Glib-0.2 \ |
21 | --pkg dee-1.0 \ |
22 | --pkg gtk+-2.0 \ |
23 | --pkg gee-1.0 \ |
24 | |
25 | === modified file 'targets/mutter/expose-manager.vala' |
26 | --- targets/mutter/expose-manager.vala 2010-06-10 20:47:05 +0000 |
27 | +++ targets/mutter/expose-manager.vala 2010-07-14 16:07:41 +0000 |
28 | @@ -132,11 +132,11 @@ |
29 | |
30 | public void start_expose (SList<Clutter.Actor> windows) |
31 | { |
32 | - var controller = Launcher.QuicklistController.get_default (); |
33 | - if (controller.menu_is_open ()) |
34 | + var controller = Launcher.QuicklistController.get_current_menu (); |
35 | + if (controller.is_menu_open ()) |
36 | { |
37 | - controller.menu.destroy.connect (this.end_expose); |
38 | - this.menu_in_hover_close_state = controller.menu.get_close_on_leave (); |
39 | + controller.get_view ().destroy.connect (this.end_expose); |
40 | + this.menu_in_hover_close_state = controller.get_view ().get_close_on_leave (); |
41 | } |
42 | exposed_windows = new List<ExposeClone> (); |
43 | |
44 | @@ -152,44 +152,46 @@ |
45 | |
46 | foreach (Clutter.Actor actor in windows) |
47 | { |
48 | - if (!(actor is Mutter.Window) || |
49 | + if (!(actor is Mutter.Window) || |
50 | ((actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.NORMAL && |
51 | (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.DIALOG && |
52 | (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG)) |
53 | continue; |
54 | - |
55 | + |
56 | ExposeClone clone = new ExposeClone (actor); |
57 | clone.set_position (actor.x, actor.y); |
58 | clone.set_size (actor.width, actor.height); |
59 | exposed_windows.append (clone); |
60 | clone.reactive = true; |
61 | - |
62 | + |
63 | expose_group.add_actor (clone); |
64 | - |
65 | + |
66 | clone.hovered_opacity = hovered_opacity; |
67 | clone.unhovered_opacity = unhovered_opacity; |
68 | clone.opacity = unhovered_opacity; |
69 | clone.darken = darken; |
70 | - |
71 | + |
72 | clone.enter_event.connect (() => { |
73 | - var ql_controller = Launcher.QuicklistController.get_default (); |
74 | - if (ql_controller.menu_is_open () && this.menu_in_hover_close_state) |
75 | + var ql_controller = Launcher.QuicklistController.get_current_menu (); |
76 | + if (ql_controller.state == Launcher.QuicklistControllerState.MENU |
77 | + && this.menu_in_hover_close_state) |
78 | { |
79 | - ql_controller.menu.set_close_on_leave (false); |
80 | + ql_controller.get_view ().set_close_on_leave (false); |
81 | } |
82 | return false; |
83 | }); |
84 | |
85 | clone.leave_event.connect (() => { |
86 | - var ql_controller = Launcher.QuicklistController.get_default (); |
87 | - if (ql_controller.menu_is_open () && this.menu_in_hover_close_state) |
88 | + var ql_controller = Launcher.QuicklistController.get_current_menu (); |
89 | + if (ql_controller.state == Launcher.QuicklistControllerState.MENU |
90 | + && this.menu_in_hover_close_state) |
91 | { |
92 | - ql_controller.menu.set_close_on_leave (true); |
93 | + ql_controller.get_view ().set_close_on_leave (true); |
94 | } |
95 | return false; |
96 | }); |
97 | } |
98 | - |
99 | + |
100 | unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows (); |
101 | foreach (Mutter.Window w in mutter_windows) |
102 | { |
103 | @@ -214,11 +216,11 @@ |
104 | |
105 | public void end_expose () |
106 | { |
107 | - var controller = Launcher.QuicklistController.get_default (); |
108 | - if (controller.menu_is_open ()) |
109 | + var controller = Launcher.QuicklistController.get_current_menu (); |
110 | + if (controller.is_menu_open ()) |
111 | { |
112 | - controller.menu.destroy.disconnect (this.end_expose); |
113 | - controller.close_menu (); |
114 | + controller.get_view ().destroy.disconnect (this.end_expose); |
115 | + controller.state = Launcher.QuicklistControllerState.CLOSED; |
116 | } |
117 | |
118 | unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows (); |
119 | @@ -521,9 +523,9 @@ |
120 | |
121 | unowned Clutter.Actor actor = this.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE, (int) x, (int) y); |
122 | |
123 | - unowned Clutter.Actor? menu = null; |
124 | - if (Unity.Launcher.QuicklistController.get_default ().menu_is_open ()) |
125 | - menu = Unity.Launcher.QuicklistController.get_default ().menu; |
126 | + Clutter.Actor? menu = null; |
127 | + if (Unity.Launcher.QuicklistController.get_current_menu ().is_menu_open ()) |
128 | + menu = Unity.Launcher.QuicklistController.get_current_menu ().get_view (); |
129 | if (menu != null) |
130 | { |
131 | if (x > menu.x && x < menu.x + menu.width && y > menu.y && y < menu.y + menu.height) |
132 | |
133 | === modified file 'targets/mutter/plugin.vala' |
134 | --- targets/mutter/plugin.vala 2010-07-08 13:48:39 +0000 |
135 | +++ targets/mutter/plugin.vala 2010-07-14 16:07:41 +0000 |
136 | @@ -318,9 +318,10 @@ |
137 | { |
138 | this.launcher.get_view ().hide (); |
139 | this.panel.hide (); |
140 | - var menu = Unity.Launcher.QuicklistController.get_default (); |
141 | - if (menu.menu_is_open ()) |
142 | - menu.close_menu (); |
143 | + var menu = Unity.Launcher.QuicklistController.get_current_menu (); |
144 | + if (menu.is_menu_open ()) |
145 | + menu.state = Unity.Launcher.QuicklistControllerState.CLOSED; |
146 | + |
147 | fullscreen_obstruction = true; |
148 | } |
149 | else |
150 | |
151 | === modified file 'targets/unity/Makefile.am' |
152 | --- targets/unity/Makefile.am 2010-06-10 00:17:10 +0000 |
153 | +++ targets/unity/Makefile.am 2010-07-14 16:07:41 +0000 |
154 | @@ -37,6 +37,7 @@ |
155 | --pkg config \ |
156 | --pkg dee-1.0 \ |
157 | --pkg dbus-glib-1 \ |
158 | + --pkg Dbusmenu-Glib-0.2 \ |
159 | --pkg gtk+-2.0 \ |
160 | --pkg gdk-2.0 \ |
161 | --pkg gee-1.0 \ |
162 | |
163 | === modified file 'tests/ui/Makefile.am' |
164 | --- tests/ui/Makefile.am 2010-06-10 00:17:10 +0000 |
165 | +++ tests/ui/Makefile.am 2010-07-14 16:07:41 +0000 |
166 | @@ -28,6 +28,7 @@ |
167 | --pkg clutter-1.0 \ |
168 | --pkg clutter-gtk-0.10 \ |
169 | --pkg dbus-glib-1 \ |
170 | + --pkg Dbusmenu-Glib-0.2 \ |
171 | --pkg dee-1.0 \ |
172 | --pkg gtk+-2.0 \ |
173 | --pkg gdk-2.0 \ |
174 | |
175 | === modified file 'tests/ui/test-automate.vala' |
176 | --- tests/ui/test-automate.vala 2010-06-08 22:55:07 +0000 |
177 | +++ tests/ui/test-automate.vala 2010-07-14 16:07:41 +0000 |
178 | @@ -74,13 +74,14 @@ |
179 | |
180 | private void test_automation () |
181 | { |
182 | +/* |
183 | ObjectRegistry registry = ObjectRegistry.get_default (); |
184 | |
185 | Logging.init_fatal_handler (); |
186 | |
187 | QuicklistController qlcontroller = QuicklistController.get_default (); |
188 | ScrollerModel scroller = registry.lookup ("UnityScrollerModel").get(0) as ScrollerModel; |
189 | - |
190 | + |
191 | gTimer = new GLib.Timer(); |
192 | int DT = 2500; |
193 | stdout.printf("\n"); |
194 | @@ -95,36 +96,36 @@ |
195 | Clutter.Animation? anim; |
196 | launcher.opacity = 255; |
197 | |
198 | - |
199 | + |
200 | gTimer.start (); |
201 | anim = launcher.animate (Clutter.AnimationMode.EASE_IN_SINE, 2500, "opacity", 0); |
202 | //anim.started.connect (on_animation_started); |
203 | anim.completed.connect (on_animation_completed); |
204 | dir.do_wait_for_animation (launcher); |
205 | - |
206 | + |
207 | float dt = (float)gTimer.elapsed (); |
208 | float dt0 = (float)DT/1000.0f; |
209 | stdout.printf("Expected Duration: %2.3f, Observed Duration: %2.3f, Error: %2.3f%%\n", dt0, dt, |
210 | (dt - dt0)*100.0f/dt0); |
211 | - |
212 | + |
213 | gTimer.start (); |
214 | anim = launcher.animate (Clutter.AnimationMode.EASE_IN_SINE, 2500, "opacity", 255); |
215 | //anim.started.connect (on_animation_started); |
216 | anim.completed.connect (on_animation_completed); |
217 | dir.do_wait_for_animation (launcher); |
218 | - |
219 | + |
220 | dt = (float)gTimer.elapsed (); |
221 | dt0 = (float)DT/1000.0f; |
222 | stdout.printf("Expected Duration: %2.3f, Observed Duration: %2.3f, Error: %2.3f%%\n", dt0, dt, |
223 | (dt - dt0)*100.0f/dt0); |
224 | |
225 | - |
226 | + |
227 | //dir.do_wait_for_timeout (5000); |
228 | } |
229 | - |
230 | - //debug ("After Animation"); |
231 | - /* Clean up */ |
232 | + |
233 | + //debug ("After Animation"); |
234 | qlcontroller.close_menu (); |
235 | +*/ |
236 | } |
237 | } |
238 | } |
239 | |
240 | === modified file 'tests/ui/test-quicklist.vala' |
241 | --- tests/ui/test-quicklist.vala 2010-06-03 13:14:06 +0000 |
242 | +++ tests/ui/test-quicklist.vala 2010-07-14 16:07:41 +0000 |
243 | @@ -60,6 +60,7 @@ |
244 | |
245 | private void test_controller_show_label () |
246 | { |
247 | +/* |
248 | string img = TESTDIR + "/data/quicklist_controller_show_label.png"; |
249 | ObjectRegistry registry = ObjectRegistry.get_default (); |
250 | |
251 | @@ -76,8 +77,9 @@ |
252 | |
253 | assert (Utils.compare_snapshot (stage, img, 54, 30, 200, 50)); |
254 | |
255 | - /* Clean up */ |
256 | qlcontroller.close_menu (); |
257 | + */ |
258 | } |
259 | + |
260 | } |
261 | } |
262 | |
263 | === modified file 'tests/unit/Makefile.am' |
264 | --- tests/unit/Makefile.am 2010-06-29 13:01:44 +0000 |
265 | +++ tests/unit/Makefile.am 2010-07-14 16:07:41 +0000 |
266 | @@ -30,6 +30,7 @@ |
267 | --pkg clutter-1.0 \ |
268 | --pkg clutter-gtk-0.10 \ |
269 | --pkg dbus-glib-1 \ |
270 | + --pkg Dbusmenu-Glib-0.2 \ |
271 | --pkg dee-1.0 \ |
272 | --pkg gtk+-2.0 \ |
273 | --pkg gdk-2.0 \ |
274 | |
275 | === modified file 'tests/unit/test-launcher.vala' |
276 | --- tests/unit/test-launcher.vala 2010-06-16 20:43:20 +0000 |
277 | +++ tests/unit/test-launcher.vala 2010-07-14 16:07:41 +0000 |
278 | @@ -101,7 +101,7 @@ |
279 | return test_user_visible; |
280 | } |
281 | |
282 | - public override string view_type () |
283 | + public override unowned string view_type () |
284 | { |
285 | return "test"; |
286 | } |
287 | |
288 | === modified file 'unity-private/Makefile.am' |
289 | --- unity-private/Makefile.am 2010-06-21 10:10:30 +0000 |
290 | +++ unity-private/Makefile.am 2010-07-14 16:07:41 +0000 |
291 | @@ -41,9 +41,9 @@ |
292 | --pkg clutter-1.0 \ |
293 | --pkg clutter-gtk-0.10 \ |
294 | --pkg config \ |
295 | - --pkg dbus-glib-1 \ |
296 | --pkg cogl-1.0 \ |
297 | --pkg dbus-glib-1 \ |
298 | + --pkg Dbusmenu-Glib-0.2\ |
299 | --pkg dee-1.0 \ |
300 | --pkg gconf-2.0 \ |
301 | --pkg gdk-2.0 \ |
302 | @@ -103,7 +103,12 @@ |
303 | launcher/application-controller.vala \ |
304 | launcher/launcher.vala \ |
305 | launcher/launcher-child.vala \ |
306 | + launcher/quicklist-check-menu-item.vala \ |
307 | launcher/quicklist-controller.vala \ |
308 | + launcher/quicklist-image-menu-item.vala \ |
309 | + launcher/quicklist-menu-item.vala \ |
310 | + launcher/quicklist-radio-menu-item.vala \ |
311 | + launcher/quicklist-seperator-menu-item.vala \ |
312 | launcher/quicklist-view.vala \ |
313 | launcher/scrollerchild-controller.vala \ |
314 | launcher/scrollerchild.vala \ |
315 | |
316 | === modified file 'unity-private/launcher/application-controller.vala' |
317 | --- unity-private/launcher/application-controller.vala 2010-07-08 13:48:39 +0000 |
318 | +++ unity-private/launcher/application-controller.vala 2010-07-14 16:07:41 +0000 |
319 | @@ -157,18 +157,21 @@ |
320 | public class ApplicationController : ScrollerChildController |
321 | { |
322 | public string desktop_file { get; private set; } |
323 | - |
324 | + |
325 | private KeyFile desktop_keyfile; |
326 | private string icon_name; |
327 | private Unity.ThemeFilePath theme_file_path; |
328 | private Bamf.Application? app = null; |
329 | + private Dbusmenu.Client menu_client; |
330 | + private Dbusmenu.Menuitem cached_menu; |
331 | + private int menu_items_realized_counter; |
332 | |
333 | private bool is_favorite = false; |
334 | |
335 | public ApplicationController (string? desktop_file_, ScrollerChild child_) |
336 | { |
337 | Object (child: child_); |
338 | - |
339 | + |
340 | if (desktop_file_ != null) |
341 | { |
342 | desktop_file = desktop_file_; |
343 | @@ -200,21 +203,25 @@ |
344 | } |
345 | } |
346 | |
347 | - //connect to our quicklist signals so that we can expose and de-expose |
348 | - // windows at the correct time |
349 | - var controller = QuicklistController.get_default (); |
350 | - controller.menu_state_changed.connect ((open) => { |
351 | - if (controller.get_attached_actor () == child && app != null) |
352 | - { |
353 | - // this is a menu relating to us |
354 | - if (open) |
355 | - { |
356 | - Unity.global_shell.expose_xids (app.get_xids ()); |
357 | - } |
358 | - else |
359 | - { |
360 | - Unity.global_shell.stop_expose (); |
361 | - } |
362 | + notify["menu"].connect (on_notify_menu); |
363 | + } |
364 | + |
365 | + public override QuicklistController get_menu_controller () |
366 | + { |
367 | + QuicklistController new_menu = new ApplicationQuicklistController (this); |
368 | + return new_menu; |
369 | + } |
370 | + |
371 | + private void on_notify_menu () |
372 | + { |
373 | + menu.notify["state"].connect (() => { |
374 | + if (menu.state == QuicklistControllerState.MENU) |
375 | + { |
376 | + Unity.global_shell.expose_xids (app.get_xids ()); |
377 | + } |
378 | + else |
379 | + { |
380 | + Unity.global_shell.stop_expose (); |
381 | } |
382 | }); |
383 | } |
384 | @@ -240,6 +247,19 @@ |
385 | } |
386 | } |
387 | |
388 | + public bool is_sticky () |
389 | + { |
390 | + if (desktop_file == "" || desktop_file == null) |
391 | + return false; |
392 | + |
393 | + var favorites = Unity.Favorites.get_default (); |
394 | + string uid = favorites.find_uid_for_desktop_file (desktop_file); |
395 | + if (uid != null && uid != "") |
396 | + return true; |
397 | + else |
398 | + return false; |
399 | + } |
400 | + |
401 | public void close_windows () |
402 | { |
403 | if (app is Bamf.Application) |
404 | @@ -295,6 +315,134 @@ |
405 | } |
406 | } |
407 | |
408 | + public override void get_menu_actions (ScrollerChildController.menu_cb callback) |
409 | + { |
410 | + |
411 | + // first check to see if we have a cached client, if we do, just re-use that |
412 | + if (menu_client is Dbusmenu.Client && cached_menu is Dbusmenu.Menuitem) |
413 | + { |
414 | + callback (cached_menu); |
415 | + } |
416 | + |
417 | + // check for a menu from bamf |
418 | + if (app is Bamf.Application) |
419 | + { |
420 | + GLib.List<Bamf.View> views = app.get_children (); |
421 | + foreach (Bamf.View view in views) |
422 | + { |
423 | + if (view is Bamf.Indicator) |
424 | + { |
425 | + string path = (view as Bamf.Indicator).get_dbus_menu_path (); |
426 | + string remote_address = (view as Bamf.Indicator).get_remote_address (); |
427 | + string remote_path = (view as Bamf.Indicator).get_remote_path (); |
428 | + |
429 | + // Yes, right here, i have lambda's inside lambda's... shutup. |
430 | + menu_client = new Dbusmenu.Client (remote_address, path); |
431 | + menu_client.layout_updated.connect (() => { |
432 | + var menu = menu_client.get_root (); |
433 | + cached_menu = menu; |
434 | + if (menu is Dbusmenu.Menuitem == false) |
435 | + warning (@"Didn't get a menu for path: $path - address: $remote_address"); |
436 | + |
437 | + unowned GLib.List<Dbusmenu.Menuitem> menu_items = menu.get_children (); |
438 | + menu_items_realized_counter = (int)menu_items.length (); |
439 | + foreach (Dbusmenu.Menuitem menuitem in menu_items) |
440 | + { |
441 | + menuitem.realized.connect (() => |
442 | + { |
443 | + menu_items_realized_counter -= 1; |
444 | + if (menu_items_realized_counter < 1) |
445 | + { |
446 | + callback (menu); |
447 | + } |
448 | + |
449 | + }); |
450 | + } |
451 | + }); |
452 | + } |
453 | + } |
454 | + } |
455 | + |
456 | + |
457 | + if (desktop_file == "" || desktop_file == null) |
458 | + { |
459 | + callback (null); |
460 | + } |
461 | + |
462 | + // find our desktop shortcuts |
463 | + Indicator.DesktopShortcuts shortcuts = new Indicator.DesktopShortcuts (desktop_file, "Unity"); |
464 | + unowned string [] nicks = shortcuts.get_nicks (); |
465 | + |
466 | + if (nicks.length < 1) |
467 | + callback (null); |
468 | + |
469 | + Dbusmenu.Menuitem root = new Dbusmenu.Menuitem (); |
470 | + root.set_root (true); |
471 | + |
472 | + foreach (string nick in nicks) |
473 | + { |
474 | + string local_nick = nick.dup (); |
475 | + unowned string name = shortcuts.nick_get_name (local_nick); |
476 | + string local_name = name.dup (); |
477 | + |
478 | + Dbusmenu.Menuitem shortcut_item = new Dbusmenu.Menuitem (); |
479 | + shortcut_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, local_name); |
480 | + shortcut_item.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, true); |
481 | + shortcut_item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); |
482 | + shortcut_item.item_activated.connect ((timestamp) => { |
483 | + shortcuts.nick_exec (local_nick); |
484 | + }); |
485 | + root.child_append (shortcut_item); |
486 | + |
487 | + } |
488 | + callback (root); |
489 | + } |
490 | + |
491 | + |
492 | + public override void get_menu_navigation (ScrollerChildController.menu_cb callback) |
493 | + { |
494 | + |
495 | + // build a dbusmenu that represents our generic application handling items |
496 | + Dbusmenu.Menuitem root = new Dbusmenu.Menuitem (); |
497 | + root.set_root (true); |
498 | + |
499 | + if (desktop_file != null) |
500 | + { |
501 | + Dbusmenu.Menuitem pinning_item = new Dbusmenu.Menuitem (); |
502 | + if (is_sticky ()) |
503 | + pinning_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Remove from launcher"); |
504 | + else |
505 | + pinning_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Add to launcher"); |
506 | + |
507 | + pinning_item.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, true); |
508 | + pinning_item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); |
509 | + pinning_item.item_activated.connect ((timestamp) => { |
510 | + set_sticky (!is_sticky ()); |
511 | + }); |
512 | + |
513 | + root.child_append (pinning_item); |
514 | + } |
515 | + |
516 | + if (app is Bamf.Application) |
517 | + { |
518 | + Dbusmenu.Menuitem app_item = new Dbusmenu.Menuitem (); |
519 | + app_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Quit..."); |
520 | + app_item.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, true); |
521 | + app_item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, true); |
522 | + |
523 | + app_item.item_activated.connect ((timestamp) => { |
524 | + if (app is Bamf.Application) |
525 | + { |
526 | + Array<uint32> xids = app.get_xids (); |
527 | + Unity.global_shell.close_xids (xids); |
528 | + } |
529 | + }); |
530 | + root.child_append (app_item); |
531 | + } |
532 | + |
533 | + callback (root); |
534 | + } |
535 | + |
536 | public override Gee.ArrayList<ShortcutItem> get_menu_shortcuts () |
537 | { |
538 | // get the desktop file |
539 | @@ -530,6 +678,7 @@ |
540 | Gtk.IconTheme theme = Gtk.IconTheme.get_default (); |
541 | theme_file_path.add_icon_theme (theme); |
542 | theme = new Gtk.IconTheme (); |
543 | + |
544 | theme.set_custom_theme ("unity-icon-theme"); |
545 | theme_file_path.add_icon_theme (theme); |
546 | theme.set_custom_theme ("Web"); |
547 | |
548 | === added file 'unity-private/launcher/quicklist-check-menu-item.vala' |
549 | --- unity-private/launcher/quicklist-check-menu-item.vala 1970-01-01 00:00:00 +0000 |
550 | +++ unity-private/launcher/quicklist-check-menu-item.vala 2010-07-14 16:07:41 +0000 |
551 | @@ -0,0 +1,228 @@ |
552 | +/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ |
553 | +/* |
554 | + * Copyright (C) 2010 Canonical Ltd |
555 | + * |
556 | + * This program is free software: you can redistribute it and/or modify |
557 | + * it under the terms of the GNU General Public License version 3 as |
558 | + * published by the Free Software Foundation. |
559 | + * |
560 | + * This program is distributed in the hope that it will be useful, |
561 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
562 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
563 | + * GNU General Public License for more details. |
564 | + * |
565 | + * You should have received a copy of the GNU General Public License |
566 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
567 | + * |
568 | + * Authored by Gordon Allott <gord.allott@canonical.com>, |
569 | + * |
570 | + */ |
571 | + |
572 | +namespace Unity.Launcher |
573 | +{ |
574 | + public class QuicklistCheckMenuItem : Ctk.CheckMenuItem |
575 | + { |
576 | + Ctk.LayerActor item_background; |
577 | + int old_width; |
578 | + int old_height; |
579 | + string old_label; |
580 | + |
581 | + private override void |
582 | + paint () |
583 | + { |
584 | + this.item_background.paint (); |
585 | + } |
586 | + |
587 | + |
588 | + public override void |
589 | + get_preferred_height (float for_width, |
590 | + out float min_height_p, |
591 | + out float natural_height_p) |
592 | + { |
593 | + min_height_p = (float) Ctk.em_to_pixel (ITEM_HEIGHT); |
594 | + natural_height_p = min_height_p; |
595 | + } |
596 | + |
597 | + public override void |
598 | + get_preferred_width (float for_height, |
599 | + out float min_width_p, |
600 | + out float natural_width_p) |
601 | + { |
602 | + int width; |
603 | + int height; |
604 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
605 | + Unity.QuicklistRendering.Item.get_text_extents (settings.gtk_font_name, |
606 | + this.label + " ☐", |
607 | + out width, |
608 | + out height); |
609 | + min_width_p = (float) width + (float) Ctk.em_to_pixel (2 * MARGIN); |
610 | + natural_width_p = min_width_p; |
611 | + } |
612 | + |
613 | + private override void |
614 | + allocate (Clutter.ActorBox box, |
615 | + Clutter.AllocationFlags flags) |
616 | + { |
617 | + int w; |
618 | + int h; |
619 | + Clutter.Color white_color = Clutter.Color () { |
620 | + red = 255, |
621 | + green = 255, |
622 | + blue = 255, |
623 | + alpha = 255 |
624 | + }; |
625 | + |
626 | + base.allocate (box, flags); |
627 | + |
628 | + w = (int) (box.x2 - box.x1); |
629 | + h = (int) (box.y2 - box.y1); |
630 | + |
631 | + // exit early if the allocation-width/height didn't change, this is needed |
632 | + // because clutter triggers calling allocate even if nothing changed |
633 | + if ((old_width == w) && (old_height == h)) |
634 | + return; |
635 | + |
636 | + // store the new width/height |
637 | + old_width = w; |
638 | + old_height = h; |
639 | + |
640 | + // before creating a new CtkLayerActor make sure we don't leak any memory |
641 | + if (this.item_background is Ctk.LayerActor) |
642 | + this.item_background.unparent (); |
643 | + this.item_background = new Ctk.LayerActor (w, h); |
644 | + |
645 | + Ctk.Layer normal_layer = new Ctk.Layer (w, |
646 | + h, |
647 | + Ctk.LayerRepeatMode.NONE, |
648 | + Ctk.LayerRepeatMode.NONE); |
649 | + Ctk.Layer selected_layer = new Ctk.Layer (w, |
650 | + h, |
651 | + Ctk.LayerRepeatMode.NONE, |
652 | + Ctk.LayerRepeatMode.NONE); |
653 | + |
654 | + Cairo.Surface normal_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
655 | + w, |
656 | + h); |
657 | + Cairo.Surface selected_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
658 | + w, |
659 | + h); |
660 | + |
661 | + Cairo.Context normal_cr = new Cairo.Context (normal_surf); |
662 | + Cairo.Context selected_cr = new Cairo.Context (selected_surf); |
663 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
664 | + |
665 | + string formatted_label = label; |
666 | + if (active) |
667 | + formatted_label = formatted_label + " ☑"; |
668 | + else |
669 | + formatted_label = formatted_label + " ☐"; |
670 | + |
671 | + Unity.QuicklistRendering.Item.normal_mask (normal_cr, |
672 | + w, |
673 | + h, |
674 | + settings.gtk_font_name, |
675 | + formatted_label); |
676 | + Unity.QuicklistRendering.Item.selected_mask (selected_cr, |
677 | + w, |
678 | + h, |
679 | + settings.gtk_font_name, |
680 | + formatted_label); |
681 | + |
682 | + normal_layer.set_mask_from_surface (normal_surf); |
683 | + normal_layer.set_color (white_color); |
684 | + |
685 | + selected_layer.set_mask_from_surface (selected_surf); |
686 | + selected_layer.set_color (white_color); |
687 | + |
688 | + this.item_background.add_layer (normal_layer); |
689 | + this.item_background.add_layer (selected_layer); |
690 | + |
691 | + this.item_background.get_layer(0).set_enabled (true); |
692 | + this.item_background.get_layer(1).set_enabled (false); |
693 | + this.item_background.do_queue_redraw (); |
694 | + |
695 | + this.item_background.set_parent (this); |
696 | + this.item_background.map (); |
697 | + this.item_background.show (); |
698 | + } |
699 | + |
700 | + private bool _on_enter (Clutter.Event event) |
701 | + { |
702 | + this.item_background.get_layer(0).set_enabled (false); |
703 | + this.item_background.get_layer(1).set_enabled (true); |
704 | + |
705 | + // Ensure we are associated with a stage before queuing a draw to |
706 | + // avoid a rather annoying (but rare) crash in clutter |
707 | + if (this.get_stage () is Clutter.Stage) |
708 | + this.do_queue_redraw (); |
709 | + return false; |
710 | + } |
711 | + |
712 | + private bool _on_leave (Clutter.Event event) |
713 | + { |
714 | + this.item_background.get_layer(0).set_enabled (true); |
715 | + this.item_background.get_layer(1).set_enabled (false); |
716 | + if (this.get_stage () is Clutter.Stage) |
717 | + this.do_queue_redraw (); |
718 | + return false; |
719 | + } |
720 | + |
721 | + private void _on_label_changed () |
722 | + { |
723 | + // if the contents of the label didn't really change exit early |
724 | + if (old_label == this.label) |
725 | + return; |
726 | + |
727 | + old_label = this.label; |
728 | + } |
729 | + |
730 | + private bool _on_mouse_down (Clutter.Event event) |
731 | + { |
732 | + this.notify["label"].disconnect (this._on_label_changed); |
733 | + this.enter_event.disconnect (this._on_enter); |
734 | + this.leave_event.disconnect (this._on_leave); |
735 | + this.button_press_event.disconnect (this._on_mouse_down); |
736 | + this.activated (); |
737 | + return true; |
738 | + } |
739 | + |
740 | + ~QuicklistMenuItem () |
741 | + { |
742 | + this.notify["label"].disconnect (this._on_label_changed); |
743 | + this.enter_event.disconnect (this._on_enter); |
744 | + this.leave_event.disconnect (this._on_leave); |
745 | + this.button_press_event.disconnect (this._on_mouse_down); |
746 | + } |
747 | + |
748 | + construct |
749 | + { |
750 | + Ctk.Padding padding = Ctk.Padding () { |
751 | + left = (int) Ctk.em_to_pixel (MARGIN), |
752 | + right = (int) Ctk.em_to_pixel (MARGIN), |
753 | + top = (int) Ctk.em_to_pixel (MARGIN), |
754 | + bottom = (int) Ctk.em_to_pixel (MARGIN) |
755 | + }; |
756 | + this.set_padding (padding); |
757 | + this.notify["label"].connect (this._on_label_changed); |
758 | + this.enter_event.connect (this._on_enter); |
759 | + this.leave_event.connect (this._on_leave); |
760 | + this.button_press_event.connect (this._on_mouse_down); |
761 | + |
762 | + this.reactive = true; |
763 | + |
764 | + old_width = 0; |
765 | + old_height = 0; |
766 | + old_label = ""; |
767 | + } |
768 | + |
769 | + public QuicklistCheckMenuItem () |
770 | + { |
771 | + Object (label: ""); |
772 | + } |
773 | + |
774 | + public QuicklistCheckMenuItem.with_label (string label) |
775 | + { |
776 | + Object (label: label); |
777 | + } |
778 | + } |
779 | +} |
780 | |
781 | === modified file 'unity-private/launcher/quicklist-controller.vala' |
782 | --- unity-private/launcher/quicklist-controller.vala 2010-06-04 13:39:25 +0000 |
783 | +++ unity-private/launcher/quicklist-controller.vala 2010-07-14 16:07:41 +0000 |
784 | @@ -19,134 +19,308 @@ |
785 | */ |
786 | namespace Unity.Launcher |
787 | { |
788 | - public static QuicklistController? ql_controler_singleton; |
789 | - |
790 | - public class QuicklistController : Object |
791 | - { |
792 | - |
793 | - public static unowned QuicklistController get_default () |
794 | - { |
795 | - if (Unity.Launcher.ql_controler_singleton == null) { |
796 | - Unity.Launcher.ql_controler_singleton= new QuicklistController (); |
797 | - } |
798 | - return Unity.Launcher.ql_controler_singleton; |
799 | - } |
800 | - |
801 | - public weak Ctk.Menu menu; |
802 | - public bool is_in_label = false; |
803 | - public bool is_in_menu = false; |
804 | - |
805 | - public signal void menu_state_changed (bool open); |
806 | - |
807 | - public QuicklistController () |
808 | + public static QuicklistController? ql_controller_singleton; |
809 | + |
810 | + public enum QuicklistControllerState { |
811 | + LABEL, |
812 | + MENU, |
813 | + CLOSED |
814 | + } |
815 | + |
816 | + public abstract class QuicklistController : Object |
817 | + { |
818 | + protected Ctk.Menu? menu; |
819 | + public ScrollerChildController attached_controller {get; construct;} |
820 | + private QuicklistControllerState _state; |
821 | + public QuicklistControllerState state { |
822 | + get { return _state; } |
823 | + set |
824 | + { |
825 | + if (value == QuicklistControllerState.LABEL || |
826 | + value == QuicklistControllerState.MENU) |
827 | + { |
828 | + // check our singleton for a previous menu |
829 | + if (ql_controller_singleton != this && ql_controller_singleton != null) |
830 | + { |
831 | + var tmp_qlc = ql_controller_singleton; //ref the controller |
832 | + tmp_qlc.state = QuicklistControllerState.CLOSED; |
833 | + if (tmp_qlc.get_view () != null) |
834 | + warning ("old menu not destroyed when opening new menu"); |
835 | + } |
836 | + |
837 | + ql_controller_singleton = this; |
838 | + } |
839 | + |
840 | + if (value == QuicklistControllerState.CLOSED) |
841 | + { |
842 | + if (menu is Ctk.Menu) |
843 | + { |
844 | + menu.destroy (); |
845 | + menu = null; |
846 | + |
847 | + } |
848 | + ql_controller_singleton = null; |
849 | + } |
850 | + |
851 | + _state = value; |
852 | + } |
853 | + } |
854 | + |
855 | + public abstract Ctk.Menu? get_view (); |
856 | + |
857 | + public static unowned QuicklistController get_current_menu () |
858 | + { |
859 | + // returns the current controller, thou does not own this! |
860 | + return ql_controller_singleton; |
861 | + } |
862 | + |
863 | + |
864 | + public static bool is_menu_open () |
865 | + { |
866 | + // returns true if a menu is open |
867 | + if (ql_controller_singleton is QuicklistController) |
868 | + return ql_controller_singleton.state == QuicklistControllerState.MENU; |
869 | + |
870 | + return false; |
871 | + } |
872 | + |
873 | + public static bool do_menus_match (QuicklistController menu) |
874 | + { |
875 | + // returns true if the given menu matches ql_controller_singleton |
876 | + return menu == ql_controller_singleton; |
877 | + } |
878 | + } |
879 | + |
880 | + |
881 | + public class ApplicationQuicklistController : QuicklistController |
882 | + { |
883 | + public ApplicationQuicklistController (ApplicationController scroller_child) |
884 | + { |
885 | + Object (attached_controller: scroller_child); |
886 | + } |
887 | + |
888 | + construct |
889 | { |
890 | Unity.Testing.ObjectRegistry.get_default ().register ("QuicklistController", |
891 | this); |
892 | - } |
893 | - |
894 | - construct |
895 | - { |
896 | - var drag_controller = Drag.Controller.get_default (); |
897 | - drag_controller.drag_start.connect (this.on_unity_drag_start); |
898 | - } |
899 | - |
900 | - private void on_unity_drag_start (Drag.Model model) |
901 | - { |
902 | - if (this.menu_is_open ()) |
903 | - this.menu.destroy (); |
904 | - } |
905 | - |
906 | - public void show_label (string label, Ctk.Actor attached_widget) |
907 | - { |
908 | - if (this.menu_is_open ()) |
909 | - this.menu.destroy (); |
910 | - |
911 | - var menu = new QuicklistMenu () as Ctk.Menu; |
912 | + |
913 | + new_menu (); |
914 | + notify["state"].connect (on_state_change); |
915 | + state = QuicklistControllerState.LABEL; |
916 | + } |
917 | + |
918 | + private void new_menu () |
919 | + { |
920 | + menu = new QuicklistMenu () as Ctk.Menu; |
921 | menu.destroy.connect (() => { |
922 | - if (is_in_menu) |
923 | - menu_state_changed (false); |
924 | - }); |
925 | - this.menu = menu; |
926 | - this.menu.destroy.connect (() => { |
927 | Unity.global_shell.remove_fullscreen_request (this); |
928 | }); |
929 | - this.menu.set_swallow_clicks (Unity.global_shell.menus_swallow_events); |
930 | - this.menu.set_detect_clicks (false); |
931 | - |
932 | - //make label |
933 | - var menuitem = new QuicklistMenuItem (label); |
934 | - menuitem.activated.connect (this.close_menu); |
935 | - menuitem.reactive = true; |
936 | - this.menu.append (menuitem, true); |
937 | - this.menu.attach_to_actor (attached_widget); |
938 | - (attached_widget.get_stage () as Clutter.Stage).add_actor (this.menu); |
939 | + menu.set_swallow_clicks (Unity.global_shell.menus_swallow_events); |
940 | + menu.set_detect_clicks (false); |
941 | + menu.attach_to_actor (attached_controller.child as Ctk.Actor); |
942 | + ((attached_controller).child.get_stage () as Clutter.Stage).add_actor (menu); |
943 | |
944 | float x; |
945 | float y; |
946 | - this.menu.get_position (out x, out y); |
947 | - this.menu.set_position (x - (float) 22.0f, y - 1.0f); |
948 | - this.is_in_label = true; |
949 | - } |
950 | - |
951 | - private Gee.ArrayList<ShortcutItem> prefix_cache; |
952 | - private Gee.ArrayList<ShortcutItem> affix_cache; |
953 | - |
954 | - public void show_menu (Gee.ArrayList<ShortcutItem> prefix_shortcuts, |
955 | - Gee.ArrayList<ShortcutItem> affix_shortcuts, |
956 | - bool hide_on_leave) |
957 | - { |
958 | - this.prefix_cache = prefix_shortcuts; |
959 | - this.affix_cache = affix_shortcuts; |
960 | - |
961 | - this.is_in_label = false; |
962 | - Unity.global_shell.add_fullscreen_request (this); |
963 | - this.menu.close_on_leave = hide_on_leave; |
964 | - foreach (ShortcutItem shortcut in prefix_shortcuts) |
965 | - { |
966 | - var label = shortcut.get_name (); |
967 | - var menuitem = new QuicklistMenuItem (label); |
968 | - this.menu.prepend (menuitem, false); |
969 | - menuitem.activated.connect (shortcut.activated); |
970 | - menuitem.activated.connect (this.close_menu); |
971 | - } |
972 | - |
973 | - /* Only add the separator if there are shortcuts beneath */ |
974 | - if (affix_shortcuts.size > 0) |
975 | - { |
976 | - Unity.Launcher.QuicklistMenuSeperator separator = new Unity.Launcher.QuicklistMenuSeperator (); |
977 | - this.menu.append (separator, false); |
978 | - } |
979 | - |
980 | - foreach (ShortcutItem shortcut in affix_shortcuts) |
981 | - { |
982 | - var label = shortcut.get_name (); |
983 | - var menuitem = new QuicklistMenuItem (label); |
984 | - this.menu.append (menuitem, false); |
985 | - menuitem.activated.connect (shortcut.activated); |
986 | - menuitem.activated.connect (this.close_menu); |
987 | - } |
988 | - this.menu.set_detect_clicks (true); |
989 | - menu_state_changed (true); |
990 | - } |
991 | - |
992 | - public void close_menu () |
993 | - { |
994 | - if (this.menu is Ctk.Menu) |
995 | - { |
996 | - this.menu.destroy (); |
997 | - } |
998 | - this.is_in_label = false; |
999 | - this.is_in_menu = false; |
1000 | - } |
1001 | - |
1002 | - public bool menu_is_open () |
1003 | - { |
1004 | - return this.menu is Ctk.Menu; |
1005 | - } |
1006 | - |
1007 | - public Ctk.Actor get_attached_actor () |
1008 | - { |
1009 | - return this.menu.get_attached_actor (); |
1010 | - } |
1011 | + menu.get_position (out x, out y); |
1012 | + menu.set_position (x - (float) 22.0f, y - 1.0f); |
1013 | + } |
1014 | + |
1015 | + private void on_state_change () |
1016 | + { |
1017 | + if (state == QuicklistControllerState.CLOSED) return; |
1018 | + if (menu == null) |
1019 | + { |
1020 | + new_menu (); |
1021 | + warning ("state change called on menu when menu does not exist"); |
1022 | + } |
1023 | + if (state == QuicklistControllerState.LABEL) |
1024 | + { |
1025 | + // just build a menu with a label for the name |
1026 | + menu.remove_all (); |
1027 | + string label = attached_controller.name; |
1028 | + |
1029 | + var menuitem = new QuicklistMenuItem.with_label (label); |
1030 | + menuitem.activated.connect (() => { |
1031 | + state = QuicklistControllerState.CLOSED; |
1032 | + }); |
1033 | + |
1034 | + menu.append (menuitem, true); |
1035 | + } |
1036 | + else if (state == QuicklistControllerState.MENU) |
1037 | + { |
1038 | + |
1039 | + // grab the top menu |
1040 | + attached_controller.get_menu_actions ((top_menu) => { |
1041 | + if (top_menu is Dbusmenu.Menuitem) |
1042 | + if (top_menu.get_root ()) |
1043 | + { |
1044 | + //returns a correct root menu |
1045 | + unowned GLib.List<Dbusmenu.Menuitem> menu_items = top_menu.get_children (); |
1046 | + if (menu_items != null) |
1047 | + { |
1048 | + var separator = new Unity.Launcher.QuicklistMenuSeperator (); |
1049 | + menu.prepend (separator, false); |
1050 | + } |
1051 | + menu_items.reverse (); |
1052 | + foreach (Dbusmenu.Menuitem menuitem in menu_items) |
1053 | + { |
1054 | + var view_menuitem = menu_item_from_dbusmenuitem (menuitem); |
1055 | + if (view_menuitem != null) |
1056 | + menu.prepend (view_menuitem, false); |
1057 | + } |
1058 | + menu_items.reverse (); |
1059 | + } |
1060 | + else |
1061 | + { |
1062 | + warning ("menu given not a root item"); |
1063 | + } |
1064 | + }); |
1065 | + |
1066 | + // grab the bottom menu |
1067 | + attached_controller.get_menu_navigation ((bottom_menu) => { |
1068 | + if (bottom_menu is Dbusmenu.Menuitem) |
1069 | + if (bottom_menu.get_root ()) |
1070 | + { |
1071 | + // add a separator for funsies, also because its in the spec (but mostly the fun part) |
1072 | + var separator = new Unity.Launcher.QuicklistMenuSeperator (); |
1073 | + menu.append (separator, false); |
1074 | + //returns a correct root menu |
1075 | + unowned GLib.List<Dbusmenu.Menuitem> menu_items = bottom_menu.get_children (); |
1076 | + foreach (Dbusmenu.Menuitem menuitem in menu_items) |
1077 | + { |
1078 | + var view_menuitem = menu_item_from_dbusmenuitem (menuitem); |
1079 | + if (view_menuitem != null) |
1080 | + menu.append (view_menuitem, false); |
1081 | + } |
1082 | + } |
1083 | + else |
1084 | + { |
1085 | + warning ("menu given not a root item"); |
1086 | + } |
1087 | + }); |
1088 | + |
1089 | + float x; |
1090 | + float y; |
1091 | + menu.get_position (out x, out y); |
1092 | + if (x > 60-22) |
1093 | + menu.set_position (x - (float) 22.0f, y - 1.0f); |
1094 | + } |
1095 | + } |
1096 | + |
1097 | + public override Ctk.Menu? get_view () |
1098 | + { |
1099 | + return menu; |
1100 | + } |
1101 | + |
1102 | + private Ctk.MenuItem? menu_item_from_dbusmenuitem (Dbusmenu.Menuitem dbusmenuitem) |
1103 | + { |
1104 | + string label = "UNDEFINED"; |
1105 | + label = dbusmenuitem.property_get (Dbusmenu.MENUITEM_PROP_LABEL); |
1106 | + string type = "label"; |
1107 | + string check_type = dbusmenuitem.property_get (Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE); |
1108 | + |
1109 | + if (check_type == Dbusmenu.MENUITEM_TOGGLE_CHECK) |
1110 | + { |
1111 | + type = "check"; |
1112 | + } |
1113 | + |
1114 | + if (check_type == Dbusmenu.MENUITEM_TOGGLE_RADIO) |
1115 | + { |
1116 | + type = "radio"; |
1117 | + } |
1118 | + |
1119 | + if (dbusmenuitem.property_get ("type") == Dbusmenu.CLIENT_TYPES_SEPARATOR) |
1120 | + { |
1121 | + type = "seperator"; |
1122 | + } |
1123 | + |
1124 | + if (dbusmenuitem.property_get (Dbusmenu.MENUITEM_PROP_ICON_NAME) != null) |
1125 | + { |
1126 | + type = "stock_image"; |
1127 | + } |
1128 | + |
1129 | + Ctk.MenuItem menuitem; |
1130 | + |
1131 | + if (type == "label") |
1132 | + { |
1133 | + menuitem = new QuicklistMenuItem.with_label (label); |
1134 | + } |
1135 | + |
1136 | + else if (type == "check" || type == "radio") |
1137 | + { |
1138 | + if (type == "check") |
1139 | + menuitem = new QuicklistCheckMenuItem.with_label (label); |
1140 | + else |
1141 | + menuitem = new QuicklistRadioMenuItem.with_label (null, label); |
1142 | + |
1143 | + int checked = dbusmenuitem.property_get_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE); |
1144 | + if (checked == Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED) |
1145 | + (menuitem as Ctk.CheckMenuItem).set_active (true); |
1146 | + |
1147 | + (menuitem as Ctk.CheckMenuItem).toggled.connect (() => |
1148 | + { |
1149 | + int is_checked = ((menuitem as Ctk.CheckMenuItem).get_active ()) ? |
1150 | + Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED : Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED; |
1151 | + |
1152 | + dbusmenuitem.property_set_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, is_checked); |
1153 | + }); |
1154 | + |
1155 | + dbusmenuitem.property_changed.connect ((property_name, value) => { |
1156 | + if (property_name == Dbusmenu.MENUITEM_PROP_TOGGLE_STATE) |
1157 | + { |
1158 | + int* value_weak = (int*)(value); |
1159 | + (menuitem as Ctk.CheckMenuItem).set_active ( |
1160 | + (*value_weak == Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED) ? true : false |
1161 | + ); |
1162 | + } |
1163 | + }); |
1164 | + } |
1165 | + |
1166 | + else if (type == "seperator") |
1167 | + { |
1168 | + menuitem = new QuicklistMenuSeperator (); |
1169 | + } |
1170 | + |
1171 | + else |
1172 | + { |
1173 | + warning ("not a menu item we understand (yet)"); |
1174 | + return null; |
1175 | + } |
1176 | + |
1177 | + //connect to property changes* |
1178 | + dbusmenuitem.property_changed.connect ((property_name, value) => { |
1179 | + if (property_name == Dbusmenu.MENUITEM_PROP_LABEL) |
1180 | + { |
1181 | + string* value_weak = (string*)value; |
1182 | + menuitem.set_label (value_weak); |
1183 | + } |
1184 | + else if (property_name == Dbusmenu.MENUITEM_PROP_ENABLED) |
1185 | + { |
1186 | + bool* value_weak = (bool*)value; |
1187 | + menuitem.set_reactive (*value_weak); |
1188 | + } |
1189 | + }); |
1190 | + |
1191 | + menuitem.reactive = dbusmenuitem.property_get_bool (Dbusmenu.MENUITEM_PROP_ENABLED); |
1192 | + menuitem.activated.connect (() => { |
1193 | + debug ("item was activated..."); |
1194 | + dbusmenuitem.handle_event ("clicked", null, Clutter.get_current_event_time ()); |
1195 | + //dbusmenuitem.item_activated (Clutter.get_current_event_time ()); |
1196 | + }); |
1197 | + |
1198 | + menuitem.activated.connect (() => { |
1199 | + Idle.add (() => { |
1200 | + state = QuicklistControllerState.CLOSED; |
1201 | + return false; |
1202 | + }); |
1203 | + }); |
1204 | + |
1205 | + // add more menu item types here (check, radio, image) as views are made |
1206 | + // right now we can just represent all menuitems as labels |
1207 | + |
1208 | + return menuitem as Ctk.MenuItem; |
1209 | + } |
1210 | + |
1211 | } |
1212 | } |
1213 | |
1214 | === added file 'unity-private/launcher/quicklist-image-menu-item.vala' |
1215 | --- unity-private/launcher/quicklist-image-menu-item.vala 1970-01-01 00:00:00 +0000 |
1216 | +++ unity-private/launcher/quicklist-image-menu-item.vala 2010-07-14 16:07:41 +0000 |
1217 | @@ -0,0 +1,23 @@ |
1218 | +/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ |
1219 | +/* |
1220 | + * Copyright (C) 2010 Canonical Ltd |
1221 | + * |
1222 | + * This program is free software: you can redistribute it and/or modify |
1223 | + * it under the terms of the GNU General Public License version 3 as |
1224 | + * published by the Free Software Foundation. |
1225 | + * |
1226 | + * This program is distributed in the hope that it will be useful, |
1227 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1228 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1229 | + * GNU General Public License for more details. |
1230 | + * |
1231 | + * You should have received a copy of the GNU General Public License |
1232 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1233 | + * |
1234 | + * Authored by Gordon Allott <gord.allott@canonical.com>, |
1235 | + * |
1236 | + */ |
1237 | + |
1238 | +namespace Unity.Launcher |
1239 | +{ |
1240 | +} |
1241 | |
1242 | === added file 'unity-private/launcher/quicklist-menu-item.vala' |
1243 | --- unity-private/launcher/quicklist-menu-item.vala 1970-01-01 00:00:00 +0000 |
1244 | +++ unity-private/launcher/quicklist-menu-item.vala 2010-07-14 16:07:41 +0000 |
1245 | @@ -0,0 +1,225 @@ |
1246 | +/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ |
1247 | +/* |
1248 | + * Copyright (C) 2010 Canonical Ltd |
1249 | + * |
1250 | + * This program is free software: you can redistribute it and/or modify |
1251 | + * it under the terms of the GNU General Public License version 3 as |
1252 | + * published by the Free Software Foundation. |
1253 | + * |
1254 | + * This program is distributed in the hope that it will be useful, |
1255 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1256 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1257 | + * GNU General Public License for more details. |
1258 | + * |
1259 | + * You should have received a copy of the GNU General Public License |
1260 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1261 | + * |
1262 | + * Authored by Gordon Allott <gord.allott@canonical.com>, |
1263 | + * Mirco "MacSlow" Müller <mirco.mueller@canonical.com> |
1264 | + * |
1265 | + */ |
1266 | + |
1267 | +namespace Unity.Launcher |
1268 | +{ |
1269 | + // we subclass Ctk.MenuItem here because we need to adapt it's appearance |
1270 | + public class QuicklistMenuItem : Ctk.MenuItem |
1271 | + { |
1272 | + Ctk.LayerActor item_background; |
1273 | + int old_width; |
1274 | + int old_height; |
1275 | + string old_label; |
1276 | + |
1277 | + private override void |
1278 | + paint () |
1279 | + { |
1280 | + this.item_background.paint (); |
1281 | + } |
1282 | + |
1283 | + |
1284 | + public override void |
1285 | + get_preferred_height (float for_width, |
1286 | + out float min_height_p, |
1287 | + out float natural_height_p) |
1288 | + { |
1289 | + min_height_p = (float) Ctk.em_to_pixel (ITEM_HEIGHT); |
1290 | + natural_height_p = min_height_p; |
1291 | + } |
1292 | + |
1293 | + public override void |
1294 | + get_preferred_width (float for_height, |
1295 | + out float min_width_p, |
1296 | + out float natural_width_p) |
1297 | + { |
1298 | + int width; |
1299 | + int height; |
1300 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
1301 | + Unity.QuicklistRendering.Item.get_text_extents (settings.gtk_font_name, |
1302 | + this.label, |
1303 | + out width, |
1304 | + out height); |
1305 | + min_width_p = (float) width + (float) Ctk.em_to_pixel (2 * MARGIN); |
1306 | + natural_width_p = min_width_p; |
1307 | + } |
1308 | + |
1309 | + private override void |
1310 | + allocate (Clutter.ActorBox box, |
1311 | + Clutter.AllocationFlags flags) |
1312 | + { |
1313 | + int w; |
1314 | + int h; |
1315 | + Clutter.Color white_color = Clutter.Color () { |
1316 | + red = 255, |
1317 | + green = 255, |
1318 | + blue = 255, |
1319 | + alpha = 255 |
1320 | + }; |
1321 | + |
1322 | + base.allocate (box, flags); |
1323 | + |
1324 | + w = (int) (box.x2 - box.x1); |
1325 | + h = (int) (box.y2 - box.y1); |
1326 | + |
1327 | + // exit early if the allocation-width/height didn't change, this is needed |
1328 | + // because clutter triggers calling allocate even if nothing changed |
1329 | + if ((old_width == w) && (old_height == h)) |
1330 | + return; |
1331 | + |
1332 | + // store the new width/height |
1333 | + old_width = w; |
1334 | + old_height = h; |
1335 | + |
1336 | + // before creating a new CtkLayerActor make sure we don't leak any memory |
1337 | + if (this.item_background is Ctk.LayerActor) |
1338 | + this.item_background.unparent (); |
1339 | + this.item_background = new Ctk.LayerActor (w, h); |
1340 | + |
1341 | + Ctk.Layer normal_layer = new Ctk.Layer (w, |
1342 | + h, |
1343 | + Ctk.LayerRepeatMode.NONE, |
1344 | + Ctk.LayerRepeatMode.NONE); |
1345 | + Ctk.Layer selected_layer = new Ctk.Layer (w, |
1346 | + h, |
1347 | + Ctk.LayerRepeatMode.NONE, |
1348 | + Ctk.LayerRepeatMode.NONE); |
1349 | + |
1350 | + Cairo.Surface normal_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1351 | + w, |
1352 | + h); |
1353 | + Cairo.Surface selected_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1354 | + w, |
1355 | + h); |
1356 | + |
1357 | + Cairo.Context normal_cr = new Cairo.Context (normal_surf); |
1358 | + Cairo.Context selected_cr = new Cairo.Context (selected_surf); |
1359 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
1360 | + |
1361 | + Unity.QuicklistRendering.Item.normal_mask (normal_cr, |
1362 | + w, |
1363 | + h, |
1364 | + settings.gtk_font_name, |
1365 | + this.label); |
1366 | + Unity.QuicklistRendering.Item.selected_mask (selected_cr, |
1367 | + w, |
1368 | + h, |
1369 | + settings.gtk_font_name, |
1370 | + this.label); |
1371 | + |
1372 | + normal_layer.set_mask_from_surface (normal_surf); |
1373 | + normal_layer.set_color (white_color); |
1374 | + |
1375 | + selected_layer.set_mask_from_surface (selected_surf); |
1376 | + selected_layer.set_color (white_color); |
1377 | + |
1378 | + this.item_background.add_layer (normal_layer); |
1379 | + this.item_background.add_layer (selected_layer); |
1380 | + |
1381 | + this.item_background.get_layer(0).set_enabled (true); |
1382 | + this.item_background.get_layer(1).set_enabled (false); |
1383 | + this.item_background.do_queue_redraw (); |
1384 | + |
1385 | + this.item_background.set_parent (this); |
1386 | + this.item_background.map (); |
1387 | + this.item_background.show (); |
1388 | + } |
1389 | + |
1390 | + private bool _on_enter (Clutter.Event event) |
1391 | + { |
1392 | + this.item_background.get_layer(0).set_enabled (false); |
1393 | + this.item_background.get_layer(1).set_enabled (true); |
1394 | + |
1395 | + // Ensure we are associated with a stage before queuing a draw to |
1396 | + // avoid a rather annoying (but rare) crash in clutter |
1397 | + if (this.get_stage () is Clutter.Stage) |
1398 | + this.do_queue_redraw (); |
1399 | + return false; |
1400 | + } |
1401 | + |
1402 | + private bool _on_leave (Clutter.Event event) |
1403 | + { |
1404 | + this.item_background.get_layer(0).set_enabled (true); |
1405 | + this.item_background.get_layer(1).set_enabled (false); |
1406 | + if (this.get_stage () is Clutter.Stage) |
1407 | + this.do_queue_redraw (); |
1408 | + return false; |
1409 | + } |
1410 | + |
1411 | + private void _on_label_changed () |
1412 | + { |
1413 | + // if the contents of the label didn't really change exit early |
1414 | + if (old_label == this.label) |
1415 | + return; |
1416 | + |
1417 | + old_label = this.label; |
1418 | + } |
1419 | + |
1420 | + private bool _on_mouse_down (Clutter.Event event) |
1421 | + { |
1422 | + this.notify["label"].disconnect (this._on_label_changed); |
1423 | + this.enter_event.disconnect (this._on_enter); |
1424 | + this.leave_event.disconnect (this._on_leave); |
1425 | + this.button_press_event.disconnect (this._on_mouse_down); |
1426 | + this.activated (); |
1427 | + return true; |
1428 | + } |
1429 | + |
1430 | + ~QuicklistMenuItem () |
1431 | + { |
1432 | + this.notify["label"].disconnect (this._on_label_changed); |
1433 | + this.enter_event.disconnect (this._on_enter); |
1434 | + this.leave_event.disconnect (this._on_leave); |
1435 | + this.button_press_event.disconnect (this._on_mouse_down); |
1436 | + } |
1437 | + |
1438 | + construct |
1439 | + { |
1440 | + Ctk.Padding padding = Ctk.Padding () { |
1441 | + left = (int) Ctk.em_to_pixel (MARGIN), |
1442 | + right = (int) Ctk.em_to_pixel (MARGIN), |
1443 | + top = (int) Ctk.em_to_pixel (MARGIN), |
1444 | + bottom = (int) Ctk.em_to_pixel (MARGIN) |
1445 | + }; |
1446 | + this.set_padding (padding); |
1447 | + |
1448 | + this.notify["label"].connect (this._on_label_changed); |
1449 | + this.enter_event.connect (this._on_enter); |
1450 | + this.leave_event.connect (this._on_leave); |
1451 | + this.button_press_event.connect (this._on_mouse_down); |
1452 | + |
1453 | + this.reactive = true; |
1454 | + |
1455 | + old_width = 0; |
1456 | + old_height = 0; |
1457 | + old_label = ""; |
1458 | + } |
1459 | + |
1460 | + public QuicklistMenuItem () |
1461 | + { |
1462 | + Object (label: ""); |
1463 | + } |
1464 | + |
1465 | + public QuicklistMenuItem.with_label (string label) |
1466 | + { |
1467 | + Object (label: label); |
1468 | + } |
1469 | + } |
1470 | +} |
1471 | |
1472 | === added file 'unity-private/launcher/quicklist-radio-menu-item.vala' |
1473 | --- unity-private/launcher/quicklist-radio-menu-item.vala 1970-01-01 00:00:00 +0000 |
1474 | +++ unity-private/launcher/quicklist-radio-menu-item.vala 2010-07-14 16:07:41 +0000 |
1475 | @@ -0,0 +1,230 @@ |
1476 | +/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ |
1477 | +/* |
1478 | + * Copyright (C) 2010 Canonical Ltd |
1479 | + * |
1480 | + * This program is free software: you can redistribute it and/or modify |
1481 | + * it under the terms of the GNU General Public License version 3 as |
1482 | + * published by the Free Software Foundation. |
1483 | + * |
1484 | + * This program is distributed in the hope that it will be useful, |
1485 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1486 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1487 | + * GNU General Public License for more details. |
1488 | + * |
1489 | + * You should have received a copy of the GNU General Public License |
1490 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1491 | + * |
1492 | + * Authored by Gordon Allott <gord.allott@canonical.com>, |
1493 | + * |
1494 | + */ |
1495 | + |
1496 | +namespace Unity.Launcher |
1497 | +{ |
1498 | + public class QuicklistRadioMenuItem : Ctk.RadioMenuItem |
1499 | + { |
1500 | + Ctk.LayerActor item_background; |
1501 | + int old_width; |
1502 | + int old_height; |
1503 | + string old_label; |
1504 | + |
1505 | + private override void |
1506 | + paint () |
1507 | + { |
1508 | + this.item_background.paint (); |
1509 | + } |
1510 | + |
1511 | + |
1512 | + public override void |
1513 | + get_preferred_height (float for_width, |
1514 | + out float min_height_p, |
1515 | + out float natural_height_p) |
1516 | + { |
1517 | + min_height_p = (float) Ctk.em_to_pixel (ITEM_HEIGHT); |
1518 | + natural_height_p = min_height_p; |
1519 | + } |
1520 | + |
1521 | + public override void |
1522 | + get_preferred_width (float for_height, |
1523 | + out float min_width_p, |
1524 | + out float natural_width_p) |
1525 | + { |
1526 | + int width; |
1527 | + int height; |
1528 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
1529 | + Unity.QuicklistRendering.Item.get_text_extents (settings.gtk_font_name, |
1530 | + this.label + " ☐", |
1531 | + out width, |
1532 | + out height); |
1533 | + min_width_p = (float) width + (float) Ctk.em_to_pixel (2 * MARGIN); |
1534 | + natural_width_p = min_width_p; |
1535 | + } |
1536 | + |
1537 | + private override void |
1538 | + allocate (Clutter.ActorBox box, |
1539 | + Clutter.AllocationFlags flags) |
1540 | + { |
1541 | + int w; |
1542 | + int h; |
1543 | + Clutter.Color white_color = Clutter.Color () { |
1544 | + red = 255, |
1545 | + green = 255, |
1546 | + blue = 255, |
1547 | + alpha = 255 |
1548 | + }; |
1549 | + |
1550 | + base.allocate (box, flags); |
1551 | + |
1552 | + w = (int) (box.x2 - box.x1); |
1553 | + h = (int) (box.y2 - box.y1); |
1554 | + |
1555 | + // exit early if the allocation-width/height didn't change, this is needed |
1556 | + // because clutter triggers calling allocate even if nothing changed |
1557 | + if ((old_width == w) && (old_height == h)) |
1558 | + return; |
1559 | + |
1560 | + // store the new width/height |
1561 | + old_width = w; |
1562 | + old_height = h; |
1563 | + |
1564 | + // before creating a new CtkLayerActor make sure we don't leak any memory |
1565 | + if (this.item_background is Ctk.LayerActor) |
1566 | + this.item_background.unparent (); |
1567 | + this.item_background = new Ctk.LayerActor (w, h); |
1568 | + |
1569 | + Ctk.Layer normal_layer = new Ctk.Layer (w, |
1570 | + h, |
1571 | + Ctk.LayerRepeatMode.NONE, |
1572 | + Ctk.LayerRepeatMode.NONE); |
1573 | + Ctk.Layer selected_layer = new Ctk.Layer (w, |
1574 | + h, |
1575 | + Ctk.LayerRepeatMode.NONE, |
1576 | + Ctk.LayerRepeatMode.NONE); |
1577 | + |
1578 | + Cairo.Surface normal_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1579 | + w, |
1580 | + h); |
1581 | + Cairo.Surface selected_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1582 | + w, |
1583 | + h); |
1584 | + |
1585 | + Cairo.Context normal_cr = new Cairo.Context (normal_surf); |
1586 | + Cairo.Context selected_cr = new Cairo.Context (selected_surf); |
1587 | + Gtk.Settings settings = Gtk.Settings.get_default (); |
1588 | + |
1589 | + string formatted_label = label; |
1590 | + if (active) |
1591 | + formatted_label = formatted_label + " ◉"; |
1592 | + else |
1593 | + formatted_label = formatted_label + " ○"; |
1594 | + |
1595 | + Unity.QuicklistRendering.Item.normal_mask (normal_cr, |
1596 | + w, |
1597 | + h, |
1598 | + settings.gtk_font_name, |
1599 | + formatted_label); |
1600 | + Unity.QuicklistRendering.Item.selected_mask (selected_cr, |
1601 | + w, |
1602 | + h, |
1603 | + settings.gtk_font_name, |
1604 | + formatted_label); |
1605 | + |
1606 | + normal_layer.set_mask_from_surface (normal_surf); |
1607 | + normal_layer.set_color (white_color); |
1608 | + |
1609 | + selected_layer.set_mask_from_surface (selected_surf); |
1610 | + selected_layer.set_color (white_color); |
1611 | + |
1612 | + this.item_background.add_layer (normal_layer); |
1613 | + this.item_background.add_layer (selected_layer); |
1614 | + |
1615 | + this.item_background.get_layer(0).set_enabled (true); |
1616 | + this.item_background.get_layer(1).set_enabled (false); |
1617 | + this.item_background.do_queue_redraw (); |
1618 | + |
1619 | + this.item_background.set_parent (this); |
1620 | + this.item_background.map (); |
1621 | + this.item_background.show (); |
1622 | + } |
1623 | + |
1624 | + private bool _on_enter (Clutter.Event event) |
1625 | + { |
1626 | + this.item_background.get_layer(0).set_enabled (false); |
1627 | + this.item_background.get_layer(1).set_enabled (true); |
1628 | + |
1629 | + // Ensure we are associated with a stage before queuing a draw to |
1630 | + // avoid a rather annoying (but rare) crash in clutter |
1631 | + if (this.get_stage () is Clutter.Stage) |
1632 | + this.do_queue_redraw (); |
1633 | + return false; |
1634 | + } |
1635 | + |
1636 | + private bool _on_leave (Clutter.Event event) |
1637 | + { |
1638 | + this.item_background.get_layer(0).set_enabled (true); |
1639 | + this.item_background.get_layer(1).set_enabled (false); |
1640 | + if (this.get_stage () is Clutter.Stage) |
1641 | + this.do_queue_redraw (); |
1642 | + return false; |
1643 | + } |
1644 | + |
1645 | + private void _on_label_changed () |
1646 | + { |
1647 | + // if the contents of the label didn't really change exit early |
1648 | + if (old_label == this.label) |
1649 | + return; |
1650 | + |
1651 | + old_label = this.label; |
1652 | + } |
1653 | + |
1654 | + private bool _on_mouse_down (Clutter.Event event) |
1655 | + { |
1656 | + this.notify["label"].disconnect (this._on_label_changed); |
1657 | + this.enter_event.disconnect (this._on_enter); |
1658 | + this.leave_event.disconnect (this._on_leave); |
1659 | + this.button_press_event.disconnect (this._on_mouse_down); |
1660 | + this.activated (); |
1661 | + return true; |
1662 | + } |
1663 | + |
1664 | + ~QuicklistMenuItem () |
1665 | + { |
1666 | + this.notify["label"].disconnect (this._on_label_changed); |
1667 | + this.enter_event.disconnect (this._on_enter); |
1668 | + this.leave_event.disconnect (this._on_leave); |
1669 | + this.button_press_event.disconnect (this._on_mouse_down); |
1670 | + } |
1671 | + |
1672 | + construct |
1673 | + { |
1674 | + Ctk.Padding padding = Ctk.Padding () { |
1675 | + left = (int) Ctk.em_to_pixel (MARGIN), |
1676 | + right = (int) Ctk.em_to_pixel (MARGIN), |
1677 | + top = (int) Ctk.em_to_pixel (MARGIN), |
1678 | + bottom = (int) Ctk.em_to_pixel (MARGIN) |
1679 | + }; |
1680 | + this.set_padding (padding); |
1681 | + this.notify["label"].connect (this._on_label_changed); |
1682 | + this.enter_event.connect (this._on_enter); |
1683 | + this.leave_event.connect (this._on_leave); |
1684 | + this.button_press_event.connect (this._on_mouse_down); |
1685 | + |
1686 | + this.reactive = true; |
1687 | + |
1688 | + old_width = 0; |
1689 | + old_height = 0; |
1690 | + old_label = ""; |
1691 | + } |
1692 | + |
1693 | + public QuicklistRadioMenuItem (GLib.SList? group) |
1694 | + { |
1695 | + Object (label: "", |
1696 | + group: group); |
1697 | + } |
1698 | + |
1699 | + public QuicklistRadioMenuItem.with_label (GLib.SList? group, string label) |
1700 | + { |
1701 | + Object (label: label, |
1702 | + group: group); |
1703 | + } |
1704 | + } |
1705 | +} |
1706 | |
1707 | === added file 'unity-private/launcher/quicklist-seperator-menu-item.vala' |
1708 | --- unity-private/launcher/quicklist-seperator-menu-item.vala 1970-01-01 00:00:00 +0000 |
1709 | +++ unity-private/launcher/quicklist-seperator-menu-item.vala 2010-07-14 16:07:41 +0000 |
1710 | @@ -0,0 +1,117 @@ |
1711 | +/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ |
1712 | +/* |
1713 | + * Copyright (C) 2010 Canonical Ltd |
1714 | + * |
1715 | + * This program is free software: you can redistribute it and/or modify |
1716 | + * it under the terms of the GNU General Public License version 3 as |
1717 | + * published by the Free Software Foundation. |
1718 | + * |
1719 | + * This program is distributed in the hope that it will be useful, |
1720 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1721 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1722 | + * GNU General Public License for more details. |
1723 | + * |
1724 | + * You should have received a copy of the GNU General Public License |
1725 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1726 | + * |
1727 | + * Authored by Gordon Allott <gord.allott@canonical.com>, |
1728 | + * Mirco "MacSlow" Müller <mirco.mueller@canonical.com> |
1729 | + * |
1730 | + */ |
1731 | + |
1732 | +namespace Unity.Launcher |
1733 | +{ |
1734 | + // we subclass Ctk.MenuSeperator here because we need to adapt it's appearance |
1735 | + public class QuicklistMenuSeperator : Ctk.MenuSeperator |
1736 | + { |
1737 | + Ctk.LayerActor seperator_background; |
1738 | + int old_width; |
1739 | + int old_height; |
1740 | + |
1741 | + private override void |
1742 | + paint () |
1743 | + { |
1744 | + this.seperator_background.paint (); |
1745 | + } |
1746 | + |
1747 | + public override void |
1748 | + get_preferred_height (float for_width, |
1749 | + out float min_height_p, |
1750 | + out float natural_height_p) |
1751 | + { |
1752 | + min_height_p = (float) Ctk.em_to_pixel (GAP); |
1753 | + natural_height_p = min_height_p; |
1754 | + } |
1755 | + |
1756 | + public override void |
1757 | + get_preferred_width (float for_height, |
1758 | + out float min_width_p, |
1759 | + out float natural_width_p) |
1760 | + { |
1761 | + min_width_p = (float) Ctk.em_to_pixel (2 * MARGIN); |
1762 | + natural_width_p = min_width_p; |
1763 | + } |
1764 | + |
1765 | + private override void |
1766 | + allocate (Clutter.ActorBox box, |
1767 | + Clutter.AllocationFlags flags) |
1768 | + { |
1769 | + int w; |
1770 | + int h; |
1771 | + |
1772 | + base.allocate (box, flags); |
1773 | + w = (int) (box.x2 - box.x1); |
1774 | + h = (int) (box.y2 - box.y1); |
1775 | + |
1776 | + // exit early if the allocation-width/height didn't change, this is needed |
1777 | + // because clutter triggers calling allocate even if nothing changed |
1778 | + if ((old_width == w) && (old_height == h)) |
1779 | + return; |
1780 | + |
1781 | + this.seperator_background = new Ctk.LayerActor (w, h); |
1782 | + |
1783 | + Ctk.Layer layer = new Ctk.Layer (w, |
1784 | + h, |
1785 | + Ctk.LayerRepeatMode.NONE, |
1786 | + Ctk.LayerRepeatMode.NONE); |
1787 | + Cairo.Surface fill_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1788 | + w, |
1789 | + h); |
1790 | + Cairo.Surface image_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1791 | + w, |
1792 | + h); |
1793 | + Cairo.Context fill_cr = new Cairo.Context (fill_surf); |
1794 | + Cairo.Context image_cr = new Cairo.Context (image_surf); |
1795 | + |
1796 | + Unity.QuicklistRendering.Seperator.fill_mask (fill_cr); |
1797 | + Unity.QuicklistRendering.Seperator.image_background (image_cr, w, h); |
1798 | + |
1799 | + layer.set_mask_from_surface (fill_surf); |
1800 | + layer.set_image_from_surface (image_surf); |
1801 | + layer.set_opacity (255); |
1802 | + |
1803 | + this.seperator_background.add_layer (layer); |
1804 | + |
1805 | + //this.set_background (this.seperator_background); |
1806 | + this.seperator_background.set_opacity (255); |
1807 | + |
1808 | + this.seperator_background.set_parent (this); |
1809 | + this.seperator_background.map (); |
1810 | + this.seperator_background.show (); |
1811 | + } |
1812 | + |
1813 | + construct |
1814 | + { |
1815 | + Ctk.Padding padding = Ctk.Padding () { |
1816 | + left = (int) Ctk.em_to_pixel (MARGIN), |
1817 | + right = (int) Ctk.em_to_pixel (MARGIN), |
1818 | + top = (int) Ctk.em_to_pixel (MARGIN), |
1819 | + bottom = (int) Ctk.em_to_pixel (MARGIN) |
1820 | + }; |
1821 | + this.set_padding (padding); |
1822 | + |
1823 | + old_width = 0; |
1824 | + old_height = 0; |
1825 | + } |
1826 | + } |
1827 | +} |
1828 | |
1829 | === modified file 'unity-private/launcher/quicklist-view.vala' |
1830 | --- unity-private/launcher/quicklist-view.vala 2010-06-30 14:23:06 +0000 |
1831 | +++ unity-private/launcher/quicklist-view.vala 2010-07-14 16:07:41 +0000 |
1832 | @@ -39,305 +39,6 @@ |
1833 | const float ANCHOR_WIDTH = 0.75f; |
1834 | const float ANCHOR_WIDTH_ABS = 10.0f; |
1835 | |
1836 | - // we subclass Ctk.MenuSeperator here because we need to adapt it's appearance |
1837 | - public class QuicklistMenuSeperator : Ctk.MenuSeperator |
1838 | - { |
1839 | - Ctk.LayerActor seperator_background; |
1840 | - int old_width; |
1841 | - int old_height; |
1842 | - |
1843 | - private override void |
1844 | - paint () |
1845 | - { |
1846 | - this.seperator_background.paint (); |
1847 | - } |
1848 | - |
1849 | - public override void |
1850 | - get_preferred_height (float for_width, |
1851 | - out float min_height_p, |
1852 | - out float natural_height_p) |
1853 | - { |
1854 | - min_height_p = (float) Ctk.em_to_pixel (GAP); |
1855 | - natural_height_p = min_height_p; |
1856 | - } |
1857 | - |
1858 | - public override void |
1859 | - get_preferred_width (float for_height, |
1860 | - out float min_width_p, |
1861 | - out float natural_width_p) |
1862 | - { |
1863 | - min_width_p = (float) Ctk.em_to_pixel (2 * MARGIN); |
1864 | - natural_width_p = min_width_p; |
1865 | - } |
1866 | - |
1867 | - private override void |
1868 | - allocate (Clutter.ActorBox box, |
1869 | - Clutter.AllocationFlags flags) |
1870 | - { |
1871 | - int w; |
1872 | - int h; |
1873 | - |
1874 | - base.allocate (box, flags); |
1875 | - w = (int) (box.x2 - box.x1); |
1876 | - h = (int) (box.y2 - box.y1); |
1877 | - |
1878 | - // exit early if the allocation-width/height didn't change, this is needed |
1879 | - // because clutter triggers calling allocate even if nothing changed |
1880 | - if ((old_width == w) && (old_height == h)) |
1881 | - return; |
1882 | - |
1883 | - // before creating a new CtkLayerActor make sure we don't leak any memory |
1884 | - if (this.seperator_background is Ctk.LayerActor) |
1885 | - this.seperator_background.destroy (); |
1886 | - |
1887 | - this.seperator_background = new Ctk.LayerActor (w, h); |
1888 | - |
1889 | - Ctk.Layer layer = new Ctk.Layer (w, |
1890 | - h, |
1891 | - Ctk.LayerRepeatMode.NONE, |
1892 | - Ctk.LayerRepeatMode.NONE); |
1893 | - Cairo.Surface fill_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1894 | - w, |
1895 | - h); |
1896 | - Cairo.Surface image_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
1897 | - w, |
1898 | - h); |
1899 | - Cairo.Context fill_cr = new Cairo.Context (fill_surf); |
1900 | - Cairo.Context image_cr = new Cairo.Context (image_surf); |
1901 | - |
1902 | - Unity.QuicklistRendering.Seperator.fill_mask (fill_cr); |
1903 | - Unity.QuicklistRendering.Seperator.image_background (image_cr, w, h); |
1904 | - |
1905 | - layer.set_mask_from_surface (fill_surf); |
1906 | - layer.set_image_from_surface (image_surf); |
1907 | - layer.set_opacity (255); |
1908 | - |
1909 | - this.seperator_background.add_layer (layer); |
1910 | - |
1911 | - //this.set_background (this.seperator_background); |
1912 | - this.seperator_background.set_opacity (255); |
1913 | - |
1914 | - this.seperator_background.set_parent (this); |
1915 | - this.seperator_background.map (); |
1916 | - this.seperator_background.show (); |
1917 | - } |
1918 | - |
1919 | - construct |
1920 | - { |
1921 | - Ctk.Padding padding = Ctk.Padding () { |
1922 | - left = (int) Ctk.em_to_pixel (MARGIN), |
1923 | - right = (int) Ctk.em_to_pixel (MARGIN), |
1924 | - top = (int) Ctk.em_to_pixel (MARGIN), |
1925 | - bottom = (int) Ctk.em_to_pixel (MARGIN) |
1926 | - }; |
1927 | - this.set_padding (padding); |
1928 | - |
1929 | - old_width = 0; |
1930 | - old_height = 0; |
1931 | - } |
1932 | - } |
1933 | - |
1934 | - // we subclass Ctk.MenuItem here because we need to adapt it's appearance |
1935 | - public class QuicklistMenuItem : Ctk.Actor |
1936 | - { |
1937 | - Ctk.LayerActor item_background; |
1938 | - int old_width; |
1939 | - int old_height; |
1940 | - string old_label; |
1941 | - |
1942 | - private override void |
1943 | - paint () |
1944 | - { |
1945 | - this.item_background.paint (); |
1946 | - } |
1947 | - |
1948 | - public override void |
1949 | - get_preferred_height (float for_width, |
1950 | - out float min_height_p, |
1951 | - out float natural_height_p) |
1952 | - { |
1953 | - min_height_p = (float) Ctk.em_to_pixel (ITEM_HEIGHT); |
1954 | - natural_height_p = min_height_p; |
1955 | - } |
1956 | - |
1957 | - public override void |
1958 | - get_preferred_width (float for_height, |
1959 | - out float min_width_p, |
1960 | - out float natural_width_p) |
1961 | - { |
1962 | - int width; |
1963 | - int height; |
1964 | - Gtk.Settings settings = Gtk.Settings.get_default (); |
1965 | - Unity.QuicklistRendering.Item.get_text_extents (settings.gtk_font_name, |
1966 | - this.label, |
1967 | - out width, |
1968 | - out height); |
1969 | - min_width_p = (float) width + (float) Ctk.em_to_pixel (2 * MARGIN); |
1970 | - natural_width_p = min_width_p; |
1971 | - } |
1972 | - |
1973 | - private override void |
1974 | - allocate (Clutter.ActorBox box, |
1975 | - Clutter.AllocationFlags flags) |
1976 | - { |
1977 | - int w; |
1978 | - int h; |
1979 | - Clutter.Color white_color = Clutter.Color () { |
1980 | - red = 255, |
1981 | - green = 255, |
1982 | - blue = 255, |
1983 | - alpha = 255 |
1984 | - }; |
1985 | - |
1986 | - base.allocate (box, flags); |
1987 | - |
1988 | - w = (int) (box.x2 - box.x1); |
1989 | - h = (int) (box.y2 - box.y1); |
1990 | - |
1991 | - // exit early if the allocation-width/height didn't change, this is needed |
1992 | - // because clutter triggers calling allocate even if nothing changed |
1993 | - if ((old_width == w) && (old_height == h)) |
1994 | - return; |
1995 | - |
1996 | - // store the new width/height |
1997 | - old_width = w; |
1998 | - old_height = h; |
1999 | - |
2000 | - // before creating a new CtkLayerActor make sure we don't leak any memory |
2001 | - if (this.item_background is Ctk.LayerActor) |
2002 | - this.item_background.unparent (); |
2003 | - this.item_background = new Ctk.LayerActor (w, h); |
2004 | - |
2005 | - Ctk.Layer normal_layer = new Ctk.Layer (w, |
2006 | - h, |
2007 | - Ctk.LayerRepeatMode.NONE, |
2008 | - Ctk.LayerRepeatMode.NONE); |
2009 | - Ctk.Layer selected_layer = new Ctk.Layer (w, |
2010 | - h, |
2011 | - Ctk.LayerRepeatMode.NONE, |
2012 | - Ctk.LayerRepeatMode.NONE); |
2013 | - |
2014 | - Cairo.Surface normal_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
2015 | - w, |
2016 | - h); |
2017 | - Cairo.Surface selected_surf = new Cairo.ImageSurface (Cairo.Format.ARGB32, |
2018 | - w, |
2019 | - h); |
2020 | - |
2021 | - Cairo.Context normal_cr = new Cairo.Context (normal_surf); |
2022 | - Cairo.Context selected_cr = new Cairo.Context (selected_surf); |
2023 | - Gtk.Settings settings = Gtk.Settings.get_default (); |
2024 | - |
2025 | - Unity.QuicklistRendering.Item.normal_mask (normal_cr, |
2026 | - w, |
2027 | - h, |
2028 | - settings.gtk_font_name, |
2029 | - this.label); |
2030 | - Unity.QuicklistRendering.Item.selected_mask (selected_cr, |
2031 | - w, |
2032 | - h, |
2033 | - settings.gtk_font_name, |
2034 | - this.label); |
2035 | - |
2036 | - normal_layer.set_mask_from_surface (normal_surf); |
2037 | - normal_layer.set_color (white_color); |
2038 | - |
2039 | - selected_layer.set_mask_from_surface (selected_surf); |
2040 | - selected_layer.set_color (white_color); |
2041 | - |
2042 | - this.item_background.add_layer (normal_layer); |
2043 | - this.item_background.add_layer (selected_layer); |
2044 | - |
2045 | - this.item_background.get_layer(0).set_enabled (true); |
2046 | - this.item_background.get_layer(1).set_enabled (false); |
2047 | - this.item_background.do_queue_redraw (); |
2048 | - |
2049 | - this.item_background.set_parent (this); |
2050 | - this.item_background.map (); |
2051 | - this.item_background.show (); |
2052 | - } |
2053 | - |
2054 | - private bool _on_enter (Clutter.Event event) |
2055 | - requires (this is QuicklistMenuItem) |
2056 | - { |
2057 | - this.item_background.get_layer(0).set_enabled (false); |
2058 | - this.item_background.get_layer(1).set_enabled (true); |
2059 | - |
2060 | - // Ensure we are associated with a stage before queuing a draw to |
2061 | - // avoid a rather annoying (but rare) crash in clutter |
2062 | - if (this.get_stage () is Clutter.Stage) |
2063 | - this.do_queue_redraw (); |
2064 | - return false; |
2065 | - } |
2066 | - |
2067 | - private bool _on_leave (Clutter.Event event) |
2068 | - requires (this is QuicklistMenuItem) |
2069 | - { |
2070 | - this.item_background.get_layer(0).set_enabled (true); |
2071 | - this.item_background.get_layer(1).set_enabled (false); |
2072 | - if (this.get_stage () is Clutter.Stage) |
2073 | - this.do_queue_redraw (); |
2074 | - return false; |
2075 | - } |
2076 | - |
2077 | - private void _on_label_changed () |
2078 | - { |
2079 | - // if the contents of the label didn't really change exit early |
2080 | - if (old_label == this.label) |
2081 | - return; |
2082 | - |
2083 | - old_label = this.label; |
2084 | - } |
2085 | - |
2086 | - public signal void activated (); |
2087 | - public string label {get; construct;} |
2088 | - |
2089 | - private bool _on_mouse_down (Clutter.Event event) |
2090 | - { |
2091 | - this.notify["label"].disconnect (this._on_label_changed); |
2092 | - this.enter_event.disconnect (this._on_enter); |
2093 | - this.leave_event.disconnect (this._on_leave); |
2094 | - this.button_press_event.disconnect (this._on_mouse_down); |
2095 | - this.activated (); |
2096 | - return true; |
2097 | - } |
2098 | - |
2099 | - public QuicklistMenuItem (string label) |
2100 | - { |
2101 | - Object (label:label); |
2102 | - } |
2103 | - |
2104 | - ~QuicklistMenuItem () |
2105 | - { |
2106 | - this.notify["label"].disconnect (this._on_label_changed); |
2107 | - this.enter_event.disconnect (this._on_enter); |
2108 | - this.leave_event.disconnect (this._on_leave); |
2109 | - this.button_press_event.disconnect (this._on_mouse_down); |
2110 | - } |
2111 | - |
2112 | - construct |
2113 | - { |
2114 | - Ctk.Padding padding = Ctk.Padding () { |
2115 | - left = (int) Ctk.em_to_pixel (MARGIN), |
2116 | - right = (int) Ctk.em_to_pixel (MARGIN), |
2117 | - top = (int) Ctk.em_to_pixel (MARGIN), |
2118 | - bottom = (int) Ctk.em_to_pixel (MARGIN) |
2119 | - }; |
2120 | - this.set_padding (padding); |
2121 | - |
2122 | - this.notify["label"].connect (this._on_label_changed); |
2123 | - this.enter_event.connect (this._on_enter); |
2124 | - this.leave_event.connect (this._on_leave); |
2125 | - this.button_press_event.connect (this._on_mouse_down); |
2126 | - |
2127 | - this.reactive = true; |
2128 | - |
2129 | - old_width = 0; |
2130 | - old_height = 0; |
2131 | - old_label = ""; |
2132 | - } |
2133 | - } |
2134 | - |
2135 | // we call this instead of Ctk.Menu so you can alter this to look right |
2136 | public class QuicklistMenu : Ctk.Menu |
2137 | { |
2138 | |
2139 | === modified file 'unity-private/launcher/scrollerchild-controller.vala' |
2140 | --- unity-private/launcher/scrollerchild-controller.vala 2010-06-24 11:22:50 +0000 |
2141 | +++ unity-private/launcher/scrollerchild-controller.vala 2010-07-14 16:07:41 +0000 |
2142 | @@ -47,6 +47,8 @@ |
2143 | protected float click_start_pos = 0.0f; |
2144 | protected int drag_sensitivity = 7; |
2145 | |
2146 | + protected QuicklistController? menu {get; set;} |
2147 | + |
2148 | public ScrollerChildController (ScrollerChild child_) |
2149 | { |
2150 | Object (child: child_); |
2151 | @@ -70,7 +72,13 @@ |
2152 | |
2153 | public abstract Gee.ArrayList<ShortcutItem> get_menu_shortcuts (); |
2154 | public abstract Gee.ArrayList<ShortcutItem> get_menu_shortcut_actions (); |
2155 | + |
2156 | + public delegate void menu_cb (Dbusmenu.Menuitem? menu); |
2157 | + public abstract void get_menu_actions (menu_cb callback); |
2158 | + public abstract void get_menu_navigation (menu_cb callback); |
2159 | + |
2160 | public abstract void activate (); |
2161 | + public abstract QuicklistController get_menu_controller (); |
2162 | |
2163 | private bool on_leave_event (Clutter.Event event) |
2164 | { |
2165 | @@ -110,11 +118,14 @@ |
2166 | button_down == true && |
2167 | event.button.time - last_press_time < 500) |
2168 | { |
2169 | - var controller = QuicklistController.get_default (); |
2170 | - if (controller.is_in_label || controller.menu_is_open ()) |
2171 | - { |
2172 | - controller.close_menu (); |
2173 | - } |
2174 | + if (menu is QuicklistController) |
2175 | + { |
2176 | + if (menu.state == QuicklistControllerState.LABEL || |
2177 | + menu.state == QuicklistControllerState.MENU) |
2178 | + { |
2179 | + menu.state = QuicklistControllerState.CLOSED; |
2180 | + } |
2181 | + } |
2182 | |
2183 | activate (); |
2184 | } |
2185 | @@ -134,49 +145,34 @@ |
2186 | //no tooltips on drag |
2187 | if (Unity.Drag.Controller.get_default ().is_dragging) return; |
2188 | |
2189 | - var controller = QuicklistController.get_default (); |
2190 | - if (controller.menu_is_open () && controller.get_attached_actor () != child) |
2191 | + if (menu is QuicklistController == false) |
2192 | + { |
2193 | + menu = get_menu_controller (); |
2194 | + } |
2195 | + |
2196 | + if (menu.state == QuicklistControllerState.MENU |
2197 | + && QuicklistController.is_menu_open () |
2198 | + && QuicklistController.do_menus_match (menu)) |
2199 | { |
2200 | // there is a menu open already, attach to the destroy so we can |
2201 | // re-ensure later |
2202 | - controller.menu.destroy.connect (ensure_menu_state); |
2203 | + QuicklistController.get_current_menu ().get_view ().destroy.connect (ensure_menu_state); |
2204 | return; |
2205 | } |
2206 | |
2207 | if (menu_state == ScrollerChildControllerMenuState.NO_MENU) |
2208 | { |
2209 | - if (controller.is_in_label || controller.menu_is_open ()) |
2210 | - { |
2211 | - controller.close_menu (); |
2212 | - } |
2213 | + menu.state = QuicklistControllerState.CLOSED; |
2214 | } |
2215 | |
2216 | if (menu_state == ScrollerChildControllerMenuState.LABEL) |
2217 | { |
2218 | - if (!controller.menu_is_open ()) |
2219 | - { |
2220 | - if(Unity.Panel.search_entry_has_focus == false) |
2221 | - controller.show_label (name, child); |
2222 | - } |
2223 | + menu.state = QuicklistControllerState.LABEL; |
2224 | } |
2225 | |
2226 | if (menu_state == ScrollerChildControllerMenuState.MENU) |
2227 | { |
2228 | - if (controller.is_in_label) |
2229 | - { |
2230 | - Gee.ArrayList<ShortcutItem> shortcuts = get_menu_shortcuts (); |
2231 | - Gee.ArrayList<ShortcutItem> actions = get_menu_shortcut_actions (); |
2232 | - if (shortcuts.size > 0 || actions.size > 0) |
2233 | - { |
2234 | - controller.show_menu (shortcuts, |
2235 | - actions, |
2236 | - false); |
2237 | - } |
2238 | - else |
2239 | - { |
2240 | - menu_state = ScrollerChildControllerMenuState.LABEL; |
2241 | - } |
2242 | - } |
2243 | + menu.state = QuicklistControllerState.MENU; |
2244 | } |
2245 | } |
2246 | |
2247 | |
2248 | === modified file 'unity/Makefile.am' |
2249 | --- unity/Makefile.am 2010-07-05 21:46:45 +0000 |
2250 | +++ unity/Makefile.am 2010-07-14 16:07:41 +0000 |
2251 | @@ -44,6 +44,7 @@ |
2252 | --pkg clutter-1.0 \ |
2253 | --pkg clutk-0.3 \ |
2254 | --pkg dbus-glib-1 \ |
2255 | + --pkg Dbusmenu-Glib-0.2 \ |
2256 | --pkg dee-1.0 \ |
2257 | --pkg gconf-2.0 \ |
2258 | --pkg gtk+-2.0 \ |
2259 | |
2260 | === modified file 'vapi/Bamf-0.2.vapi' |
2261 | --- vapi/Bamf-0.2.vapi 2010-06-17 11:18:16 +0000 |
2262 | +++ vapi/Bamf-0.2.vapi 2010-07-14 16:07:41 +0000 |
2263 | @@ -2,139 +2,140 @@ |
2264 | |
2265 | [CCode (cprefix = "Bamf", lower_case_cprefix = "bamf_")] |
2266 | namespace Bamf { |
2267 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2268 | - public class Application : Bamf.View { |
2269 | - public weak Bamf.View parent; |
2270 | - public Bamf.ApplicationPrivate priv; |
2271 | - public unowned string get_application_type (); |
2272 | - public unowned string get_desktop_file (); |
2273 | - public unowned GLib.List get_windows (); |
2274 | - public GLib.Array get_xids (); |
2275 | - public signal void window_added (Bamf.View object); |
2276 | - public signal void window_removed (Bamf.View object); |
2277 | - } |
2278 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2279 | - public class Control : GLib.Object { |
2280 | - public weak GLib.Object parent; |
2281 | - public Bamf.ControlPrivate priv; |
2282 | - public static Bamf.Control get_default (); |
2283 | - public void insert_desktop_file (string desktop_file); |
2284 | - public void register_application_for_pid (string application, int32 pid); |
2285 | - public void register_tab_provider (string path); |
2286 | - } |
2287 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2288 | - public class Factory : GLib.Object { |
2289 | - public weak GLib.Object parent; |
2290 | - public Bamf.FactoryPrivate priv; |
2291 | - public static Bamf.Factory get_default (); |
2292 | - public Bamf.View view_for_path (string path); |
2293 | - } |
2294 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2295 | - public class Matcher : GLib.Object { |
2296 | - public weak GLib.Object parent; |
2297 | - public Bamf.MatcherPrivate priv; |
2298 | - public bool application_is_running (string application); |
2299 | - public Bamf.Application get_active_application (); |
2300 | - public Bamf.Window get_active_window (); |
2301 | - public unowned Bamf.Application get_application_for_xid (uint32 xid); |
2302 | - public unowned GLib.List get_applications (); |
2303 | - public static unowned Bamf.Matcher get_default (); |
2304 | - public unowned GLib.List get_running_applications (); |
2305 | - public unowned GLib.List get_tabs (); |
2306 | - public GLib.Array get_xids_for_application (string application); |
2307 | - public signal void active_application_changed (GLib.Object object, GLib.Object p0); |
2308 | - public signal void active_window_changed (GLib.Object object, GLib.Object p0); |
2309 | - public signal void view_closed (GLib.Object object); |
2310 | - public signal void view_opened (GLib.Object object); |
2311 | - } |
2312 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2313 | - public class Tab : Bamf.View { |
2314 | - public weak Bamf.View parent; |
2315 | - public Bamf.TabPrivate priv; |
2316 | - [CCode (has_construct_function = false)] |
2317 | - public Tab (owned string id, owned string uri); |
2318 | - public string get_id (); |
2319 | - public string get_preview (); |
2320 | - public string get_uri (); |
2321 | - public void set_preview (owned string uri); |
2322 | - public void set_uri (owned string uri); |
2323 | - public virtual void show (); |
2324 | - public string id { get; set construct; } |
2325 | - public string preview { get; set; } |
2326 | - public string uri { get; set construct; } |
2327 | - public signal void preview_updated (); |
2328 | - public signal void uri_changed (string object, string p0); |
2329 | - } |
2330 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2331 | - public class TabSource : GLib.Object { |
2332 | - public weak GLib.Object parent; |
2333 | - public Bamf.TabSourcePrivate priv; |
2334 | - public string[] get_tab_ids (); |
2335 | - public GLib.Array get_tab_preview (owned string tab_id); |
2336 | - public string get_tab_uri (owned string tab_id); |
2337 | - public uint32 get_tab_xid (owned string tab_id); |
2338 | - public virtual void show_tab (owned string tab_id); |
2339 | - public virtual string[] tab_ids (); |
2340 | - public virtual GLib.Array tab_preview (owned string tab_id); |
2341 | - public virtual string tab_uri (owned string tab_id); |
2342 | - public virtual uint32 tab_xid (owned string tab_id); |
2343 | - public string id { get; set construct; } |
2344 | - public signal void tab_closed (string object); |
2345 | - public signal void tab_opened (string object); |
2346 | - public signal void tab_uri_changed (string object, string p0, string p1); |
2347 | - } |
2348 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2349 | - public class View : GLib.Object { |
2350 | - public weak GLib.Object parent; |
2351 | - public Bamf.ViewPrivate priv; |
2352 | - public virtual GLib.List get_children (); |
2353 | - public virtual string get_icon (); |
2354 | - public virtual string get_name (); |
2355 | - public string get_view_type (); |
2356 | - public virtual bool is_active (); |
2357 | - public virtual bool is_running (); |
2358 | - public virtual bool is_urgent (); |
2359 | - public bool user_visible (); |
2360 | - public virtual string view_type (); |
2361 | - public string path { get; set construct; } |
2362 | - public signal void active_changed (bool object); |
2363 | - public signal void child_added (Bamf.View object); |
2364 | - public signal void child_removed (Bamf.View object); |
2365 | - public signal void closed (); |
2366 | - public signal void running_changed (bool object); |
2367 | - public signal void urgent_changed (bool object); |
2368 | - public signal void user_visible_changed (bool object); |
2369 | - } |
2370 | - [CCode (cheader_filename = "libbamf/libbamf.h")] |
2371 | - public class Window : Bamf.View { |
2372 | - public weak Bamf.View parent; |
2373 | - public Bamf.WindowPrivate priv; |
2374 | - public Bamf.Window get_transient (); |
2375 | - public uint32 get_xid (); |
2376 | - public time_t last_active (); |
2377 | - } |
2378 | - [CCode (type_id = "BAMF_TYPE_APPLICATION_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2379 | - public struct ApplicationPrivate { |
2380 | - } |
2381 | - [CCode (type_id = "BAMF_TYPE_CONTROL_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2382 | - public struct ControlPrivate { |
2383 | - } |
2384 | - [CCode (type_id = "BAMF_TYPE_FACTORY_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2385 | - public struct FactoryPrivate { |
2386 | - } |
2387 | - [CCode (type_id = "BAMF_TYPE_MATCHER_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2388 | - public struct MatcherPrivate { |
2389 | - } |
2390 | - [CCode (type_id = "BAMF_TYPE_TAB_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2391 | - public struct TabPrivate { |
2392 | - } |
2393 | - [CCode (type_id = "BAMF_TYPE_TAB_SOURCE_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2394 | - public struct TabSourcePrivate { |
2395 | - } |
2396 | - [CCode (type_id = "BAMF_TYPE_VIEW_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2397 | - public struct ViewPrivate { |
2398 | - } |
2399 | - [CCode (type_id = "BAMF_TYPE_WINDOW_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2400 | - public struct WindowPrivate { |
2401 | - } |
2402 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2403 | + public class Application : Bamf.View { |
2404 | + public weak Bamf.View parent; |
2405 | + public Bamf.ApplicationPrivate priv; |
2406 | + public unowned string get_application_type (); |
2407 | + public unowned string get_desktop_file (); |
2408 | + public unowned GLib.List<weak Bamf.Window> get_windows (); |
2409 | + public GLib.Array get_xids (); |
2410 | + public signal void window_added (Bamf.View object); |
2411 | + public signal void window_removed (Bamf.View object); |
2412 | + } |
2413 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2414 | + public class Control : GLib.Object { |
2415 | + public weak GLib.Object parent; |
2416 | + public Bamf.ControlPrivate priv; |
2417 | + public static Bamf.Control get_default (); |
2418 | + public void insert_desktop_file (string desktop_file); |
2419 | + public void register_application_for_pid (string application, int32 pid); |
2420 | + public void register_tab_provider (string path); |
2421 | + } |
2422 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2423 | + public class Indicator : Bamf.View { |
2424 | + public weak Bamf.View parent; |
2425 | + public Bamf.IndicatorPrivate priv; |
2426 | + public unowned string get_dbus_menu_path (); |
2427 | + public unowned string get_remote_address (); |
2428 | + public unowned string get_remote_path (); |
2429 | + } |
2430 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2431 | + public class Matcher : GLib.Object { |
2432 | + public weak GLib.Object parent; |
2433 | + public Bamf.MatcherPrivate priv; |
2434 | + public bool application_is_running (string application); |
2435 | + public Bamf.Application get_active_application (); |
2436 | + public Bamf.Window get_active_window (); |
2437 | + public Bamf.Application get_application_for_xid (uint32 xid); |
2438 | + public GLib.List<weak uint32> get_applications (); |
2439 | + public static unowned Bamf.Matcher get_default (); |
2440 | + public GLib.List<weak Bamf.Application> get_running_applications (); |
2441 | + public GLib.List<weak Bamf.View> get_tabs (); |
2442 | + public GLib.Array get_xids_for_application (string application); |
2443 | + public signal void active_application_changed (GLib.Object object, GLib.Object p0); |
2444 | + public signal void active_window_changed (GLib.Object object, GLib.Object p0); |
2445 | + public signal void view_closed (GLib.Object object); |
2446 | + public signal void view_opened (GLib.Object object); |
2447 | + } |
2448 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2449 | + public class Tab : Bamf.View { |
2450 | + public weak Bamf.View parent; |
2451 | + public Bamf.TabPrivate priv; |
2452 | + [CCode (has_construct_function = false)] |
2453 | + public Tab (owned string id, owned string uri); |
2454 | + public string get_id (); |
2455 | + public string get_preview (); |
2456 | + public string get_uri (); |
2457 | + public void set_preview (owned string uri); |
2458 | + public void set_uri (owned string uri); |
2459 | + public virtual void show (); |
2460 | + public string id { get; set construct; } |
2461 | + public string preview { get; set; } |
2462 | + public string uri { get; set construct; } |
2463 | + public signal void preview_updated (); |
2464 | + public signal void uri_changed (string object, string p0); |
2465 | + } |
2466 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2467 | + public class TabSource : GLib.Object { |
2468 | + public weak GLib.Object parent; |
2469 | + public Bamf.TabSourcePrivate priv; |
2470 | + public string[] get_tab_ids (); |
2471 | + public GLib.Array get_tab_preview (owned string tab_id); |
2472 | + public string get_tab_uri (owned string tab_id); |
2473 | + public uint32 get_tab_xid (owned string tab_id); |
2474 | + public virtual void show_tab (owned string tab_id); |
2475 | + public virtual string[] tab_ids (); |
2476 | + public virtual GLib.Array tab_preview (owned string tab_id); |
2477 | + public virtual string tab_uri (owned string tab_id); |
2478 | + public virtual uint32 tab_xid (owned string tab_id); |
2479 | + public string id { get; set construct; } |
2480 | + public signal void tab_closed (string object); |
2481 | + public signal void tab_opened (string object); |
2482 | + public signal void tab_uri_changed (string object, string p0, string p1); |
2483 | + } |
2484 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2485 | + public class View : GLib.Object { |
2486 | + public weak GLib.Object parent; |
2487 | + public Bamf.ViewPrivate priv; |
2488 | + public virtual GLib.List get_children (); |
2489 | + public virtual string get_icon (); |
2490 | + public virtual string get_name (); |
2491 | + public string get_view_type (); |
2492 | + public virtual bool is_active (); |
2493 | + public virtual bool is_running (); |
2494 | + public virtual bool is_urgent (); |
2495 | + public bool user_visible (); |
2496 | + public virtual unowned string view_type (); |
2497 | + public string path { get; set construct; } |
2498 | + public signal void active_changed (bool object); |
2499 | + public signal void child_added (Bamf.View object); |
2500 | + public signal void child_removed (Bamf.View object); |
2501 | + public signal void closed (); |
2502 | + public signal void running_changed (bool object); |
2503 | + public signal void urgent_changed (bool object); |
2504 | + public signal void user_visible_changed (bool object); |
2505 | + } |
2506 | + [CCode (cheader_filename = "libbamf/libbamf.h")] |
2507 | + public class Window : Bamf.View { |
2508 | + public weak Bamf.View parent; |
2509 | + public Bamf.WindowPrivate priv; |
2510 | + public Bamf.Window get_transient (); |
2511 | + public uint32 get_xid (); |
2512 | + public time_t last_active (); |
2513 | + } |
2514 | + [CCode (type_id = "BAMF_TYPE_APPLICATION_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2515 | + public struct ApplicationPrivate { |
2516 | + } |
2517 | + [CCode (type_id = "BAMF_TYPE_CONTROL_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2518 | + public struct ControlPrivate { |
2519 | + } |
2520 | + [CCode (type_id = "BAMF_TYPE_INDICATOR_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2521 | + public struct IndicatorPrivate { |
2522 | + } |
2523 | + [CCode (type_id = "BAMF_TYPE_MATCHER_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2524 | + public struct MatcherPrivate { |
2525 | + } |
2526 | + [CCode (type_id = "BAMF_TYPE_TAB_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2527 | + public struct TabPrivate { |
2528 | + } |
2529 | + [CCode (type_id = "BAMF_TYPE_TAB_SOURCE_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2530 | + public struct TabSourcePrivate { |
2531 | + } |
2532 | + [CCode (type_id = "BAMF_TYPE_VIEW_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2533 | + public struct ViewPrivate { |
2534 | + } |
2535 | + [CCode (type_id = "BAMF_TYPE_WINDOW_PRIVATE", cheader_filename = "libbamf/libbamf.h")] |
2536 | + public struct WindowPrivate { |
2537 | + } |
2538 | } |
2539 | |
2540 | === added file 'vapi/Dbusmenu-Glib-0.2.vapi' |
2541 | --- vapi/Dbusmenu-Glib-0.2.vapi 1970-01-01 00:00:00 +0000 |
2542 | +++ vapi/Dbusmenu-Glib-0.2.vapi 2010-07-14 16:07:41 +0000 |
2543 | @@ -0,0 +1,173 @@ |
2544 | +/* Dbusmenu-Glib-0.2.vapi generated by vapigen, do not modify. */ |
2545 | + |
2546 | +[CCode (cprefix = "Dbusmenu", lower_case_cprefix = "dbusmenu_")] |
2547 | +namespace Dbusmenu { |
2548 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2549 | + public class Client : GLib.Object { |
2550 | + public weak GLib.Object parent; |
2551 | + [CCode (has_construct_function = false)] |
2552 | + public Client (string name, string object); |
2553 | + public bool add_type_handler (string type, Dbusmenu.ClientTypeHandler newfunc); |
2554 | + public Dbusmenu.Menuitem get_root (); |
2555 | + public void send_about_to_show (int id, void* cb, void* cb_data); |
2556 | + public void send_event (int id, string name, GLib.Value value, uint timestamp); |
2557 | + public string dbus_name { get; construct; } |
2558 | + public string dbus_object { get; construct; } |
2559 | + public signal void layout_updated (); |
2560 | + public signal void new_menuitem (GLib.Object object); |
2561 | + public signal void root_changed (GLib.Object object); |
2562 | + } |
2563 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2564 | + public class Menuitem : GLib.Object { |
2565 | + public weak GLib.Object parent; |
2566 | + [CCode (has_construct_function = false)] |
2567 | + public Menuitem (); |
2568 | + public bool child_add_position (Dbusmenu.Menuitem child, uint position); |
2569 | + public bool child_append (Dbusmenu.Menuitem child); |
2570 | + public bool child_delete (Dbusmenu.Menuitem child); |
2571 | + public Dbusmenu.Menuitem child_find (int id); |
2572 | + public bool child_prepend (Dbusmenu.Menuitem child); |
2573 | + public bool child_reorder (Dbusmenu.Menuitem child, uint position); |
2574 | + public Dbusmenu.Menuitem find_id (int id); |
2575 | + public void @foreach (void* func, void* data); |
2576 | + public unowned GLib.List get_children (); |
2577 | + public int get_id (); |
2578 | + public uint get_position (Dbusmenu.Menuitem parent); |
2579 | + public uint get_position_realized (Dbusmenu.Menuitem parent); |
2580 | + public bool get_root (); |
2581 | + public virtual void handle_event (string name, GLib.Value? value, uint timestamp); |
2582 | + public GLib.HashTable properties_copy (); |
2583 | + public GLib.List properties_list (); |
2584 | + public bool property_exist (string property); |
2585 | + public unowned string property_get (string property); |
2586 | + public bool property_get_bool (string property); |
2587 | + public int property_get_int (string property); |
2588 | + public GLib.Value property_get_value (string property); |
2589 | + public void property_remove (string property); |
2590 | + public bool property_set (string property, string value); |
2591 | + public bool property_set_bool (string property, bool value); |
2592 | + public bool property_set_int (string property, int value); |
2593 | + public bool property_set_value (string property, GLib.Value value); |
2594 | + public virtual void send_about_to_show (Dbusmenu.menuitem_about_to_show_cb cb, void* cb_data); |
2595 | + public void set_root (bool root); |
2596 | + public GLib.List take_children (); |
2597 | + [CCode (has_construct_function = false)] |
2598 | + public Menuitem.with_id (int id); |
2599 | + public int id { get; construct; } |
2600 | + public signal void child_added (GLib.Object object, uint p0); |
2601 | + public signal void child_moved (GLib.Object object, uint p0, uint p1); |
2602 | + public signal void child_removed (GLib.Object object); |
2603 | + public signal void item_activated (uint object); |
2604 | + public signal void property_changed (string property_name, void* value); |
2605 | + public signal void realized (); |
2606 | + } |
2607 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2608 | + public class MenuitemProxy : Dbusmenu.Menuitem { |
2609 | + public weak Dbusmenu.Menuitem parent; |
2610 | + [CCode (has_construct_function = false)] |
2611 | + public MenuitemProxy (Dbusmenu.Menuitem mi); |
2612 | + public Dbusmenu.Menuitem get_wrapped (); |
2613 | + public Dbusmenu.Menuitem menu_item { get; construct; } |
2614 | + } |
2615 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2616 | + public class Server : GLib.Object { |
2617 | + public weak GLib.Object parent; |
2618 | + [CCode (has_construct_function = false)] |
2619 | + public Server (string object); |
2620 | + public void set_root (Dbusmenu.Menuitem root); |
2621 | + public string dbus_object { get; construct; } |
2622 | + public Dbusmenu.Menuitem root_node { get; set; } |
2623 | + public uint version { get; } |
2624 | + public signal void item_property_updated (int object, string p0, GLib.Value p1); |
2625 | + public signal void item_updated (int object); |
2626 | + public signal void layout_updated (uint object, int p0); |
2627 | + } |
2628 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h", has_target = false)] |
2629 | + public delegate bool ClientTypeHandler (Dbusmenu.Menuitem newitem, Dbusmenu.Menuitem parent, Dbusmenu.Client client); |
2630 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h", has_target = false)] |
2631 | + public delegate void menuitem_about_to_show_cb (Dbusmenu.Menuitem mi, void* user_data); |
2632 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h", has_target = false)] |
2633 | + public delegate void menuitem_buildxml_slot_t (Dbusmenu.Menuitem mi, ref unowned string[] stringarray); |
2634 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2635 | + public const string CLIENT_PROP_DBUS_NAME; |
2636 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2637 | + public const string CLIENT_PROP_DBUS_OBJECT; |
2638 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2639 | + public const string CLIENT_SIGNAL_LAYOUT_UPDATED; |
2640 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2641 | + public const string CLIENT_SIGNAL_NEW_MENUITEM; |
2642 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2643 | + public const string CLIENT_SIGNAL_ROOT_CHANGED; |
2644 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2645 | + public const string CLIENT_TYPES_DEFAULT; |
2646 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2647 | + public const string CLIENT_TYPES_IMAGE; |
2648 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2649 | + public const string CLIENT_TYPES_SEPARATOR; |
2650 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2651 | + public const string MENUITEM_CHILD_DISPLAY_SUBMENU; |
2652 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2653 | + public const string MENUITEM_ICON_NAME_BLANK; |
2654 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2655 | + public const string MENUITEM_PROP_CHILD_DISPLAY; |
2656 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2657 | + public const string MENUITEM_PROP_ENABLED; |
2658 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2659 | + public const string MENUITEM_PROP_ICON_DATA; |
2660 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2661 | + public const string MENUITEM_PROP_ICON_NAME; |
2662 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2663 | + public const string MENUITEM_PROP_LABEL; |
2664 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2665 | + public const string MENUITEM_PROP_SHORTCUT; |
2666 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2667 | + public const string MENUITEM_PROP_TOGGLE_STATE; |
2668 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2669 | + public const string MENUITEM_PROP_TOGGLE_TYPE; |
2670 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2671 | + public const string MENUITEM_PROP_TYPE; |
2672 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2673 | + public const string MENUITEM_PROP_VISIBLE; |
2674 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2675 | + public const string MENUITEM_SHORTCUT_ALT; |
2676 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2677 | + public const string MENUITEM_SHORTCUT_CONTROL; |
2678 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2679 | + public const string MENUITEM_SHORTCUT_SHIFT; |
2680 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2681 | + public const string MENUITEM_SHORTCUT_SUPER; |
2682 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2683 | + public const string MENUITEM_SIGNAL_CHILD_ADDED; |
2684 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2685 | + public const string MENUITEM_SIGNAL_CHILD_MOVED; |
2686 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2687 | + public const string MENUITEM_SIGNAL_CHILD_REMOVED; |
2688 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2689 | + public const string MENUITEM_SIGNAL_ITEM_ACTIVATED; |
2690 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2691 | + public const string MENUITEM_SIGNAL_PROPERTY_CHANGED; |
2692 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2693 | + public const string MENUITEM_SIGNAL_REALIZED; |
2694 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2695 | + public const string MENUITEM_TOGGLE_CHECK; |
2696 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2697 | + public const string MENUITEM_TOGGLE_RADIO; |
2698 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2699 | + public const int MENUITEM_TOGGLE_STATE_CHECKED; |
2700 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2701 | + public const int MENUITEM_TOGGLE_STATE_UNCHECKED; |
2702 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2703 | + public const int MENUITEM_TOGGLE_STATE_UNKNOWN; |
2704 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2705 | + public const string SERVER_PROP_DBUS_OBJECT; |
2706 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2707 | + public const string SERVER_PROP_ROOT_NODE; |
2708 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2709 | + public const string SERVER_PROP_VERSION; |
2710 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2711 | + public const string SERVER_SIGNAL_ID_PROP_UPDATE; |
2712 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2713 | + public const string SERVER_SIGNAL_ID_UPDATE; |
2714 | + [CCode (cheader_filename = "libdbusmenu-glib/client.h,libdbusmenu-glib/menuitem-proxy.h,libdbusmenu-glib/menuitem.h,libdbusmenu-glib/server.h")] |
2715 | + public const string SERVER_SIGNAL_LAYOUT_UPDATED; |
2716 | +} |
2717 | |
2718 | === modified file 'vapi/clutk-0.3.vapi' |
2719 | --- vapi/clutk-0.3.vapi 2010-07-06 16:13:23 +0000 |
2720 | +++ vapi/clutk-0.3.vapi 2010-07-14 16:07:41 +0000 |
2721 | @@ -85,6 +85,20 @@ |
2722 | public virtual signal void show_context_menu (uint event_time); |
2723 | } |
2724 | [CCode (cheader_filename = "clutk/clutk.h")] |
2725 | + public class CheckMenuItem : Ctk.MenuItem, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { |
2726 | + [CCode (has_construct_function = false)] |
2727 | + public CheckMenuItem (); |
2728 | + public bool get_active (); |
2729 | + public bool get_inconsistent (); |
2730 | + public void set_active (bool is_active); |
2731 | + public void set_inconsistent (bool setting); |
2732 | + [CCode (has_construct_function = false)] |
2733 | + public CheckMenuItem.with_label (string label); |
2734 | + public bool active { get; set; } |
2735 | + public bool inconsistent { get; set; } |
2736 | + public virtual signal void toggled (); |
2737 | + } |
2738 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2739 | public class Effect : GLib.InitiallyUnowned { |
2740 | public unowned Clutter.Animation animate (ulong mode, uint duration, ...); |
2741 | public unowned Clutter.Actor get_actor (); |
2742 | @@ -212,6 +226,16 @@ |
2743 | public string stock_id { owned get; set; } |
2744 | } |
2745 | [CCode (cheader_filename = "clutk/clutk.h")] |
2746 | + public class ImageMenuItem : Ctk.MenuItem, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { |
2747 | + [CCode (has_construct_function = false)] |
2748 | + public ImageMenuItem (); |
2749 | + public unowned Gdk.Pixbuf get_image (); |
2750 | + public void set_image (Gdk.Pixbuf pixbuf); |
2751 | + [CCode (has_construct_function = false)] |
2752 | + public ImageMenuItem.with_label (string label); |
2753 | + public Gdk.Pixbuf image { get; set; } |
2754 | + } |
2755 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2756 | public class Layer : GLib.Object { |
2757 | [CCode (has_construct_function = false)] |
2758 | public Layer (uint width, uint height, Ctk.LayerRepeatMode image_repeat, Ctk.LayerRepeatMode mask_repeat); |
2759 | @@ -318,11 +342,39 @@ |
2760 | public virtual signal void activated (); |
2761 | } |
2762 | [CCode (cheader_filename = "clutk/clutk.h")] |
2763 | - public class MenuSeperator : Ctk.Actor, Clutter.Scriptable, Ctk.Focusable { |
2764 | + public class MenuSeperator : Ctk.MenuItem, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { |
2765 | [CCode (has_construct_function = false)] |
2766 | public MenuSeperator (); |
2767 | } |
2768 | [Compact] |
2769 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2770 | + public class ProjectedTextureVertex { |
2771 | + public Cogl.Color color; |
2772 | + public float q; |
2773 | + public float r; |
2774 | + public float s; |
2775 | + public float t; |
2776 | + public float w; |
2777 | + public float x; |
2778 | + public float y; |
2779 | + public float z; |
2780 | + } |
2781 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2782 | + public class RadioMenuItem : Ctk.CheckMenuItem, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { |
2783 | + [CCode (has_construct_function = false)] |
2784 | + public RadioMenuItem (GLib.SList group); |
2785 | + public unowned GLib.SList get_group (); |
2786 | + public void set_group (GLib.SList group); |
2787 | + [CCode (has_construct_function = false)] |
2788 | + public RadioMenuItem.with_label (GLib.SList group, string label); |
2789 | + public void* group { get; set; } |
2790 | + public virtual signal void group_changed (); |
2791 | + } |
2792 | + [Compact] |
2793 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2794 | + public class RadioMenuItemClass { |
2795 | + } |
2796 | + [Compact] |
2797 | [CCode (type_id = "CTK_TYPE_RENDER_TARGET", cheader_filename = "clutk/clutk.h")] |
2798 | public class RenderTarget { |
2799 | [CCode (has_construct_function = false)] |
2800 | @@ -511,5 +563,7 @@ |
2801 | [CCode (cheader_filename = "clutk/clutk.h")] |
2802 | public static double pixel_to_em (int pixel_value); |
2803 | [CCode (cheader_filename = "clutk/clutk.h")] |
2804 | + public static void render_projected_polygon (Ctk.ProjectedTextureVertex V, uint tex_id, int window_w, int window_h); |
2805 | + [CCode (cheader_filename = "clutk/clutk.h")] |
2806 | public static void surface_blur (Cairo.Surface surface, uint radius); |
2807 | } |
2808 | |
2809 | === modified file 'vapi/indicator.vapi' |
2810 | --- vapi/indicator.vapi 2010-06-03 17:13:55 +0000 |
2811 | +++ vapi/indicator.vapi 2010-07-14 16:07:41 +0000 |
2812 | @@ -2,11 +2,12 @@ |
2813 | |
2814 | [CCode (cprefix = "Indicator", lower_case_cprefix = "indicator_")] |
2815 | namespace Indicator { |
2816 | - [CCode (cheader_filename = "gtk/gtk.h,libindicator/indicator.h,libindicator/indicator-object.h,libindicator/indicator-service.h,libindicator/indicator-service-manager.h")] |
2817 | + [CCode (cheader_filename = "gtk/gtk.h,libindicator/indicator.h,libindicator/indicator-object.h,libindicator/indicator-service.h,libindicator/indicator-service-manager.h,libindicator/indicator-desktop-shortcuts.h")] |
2818 | public class DesktopShortcuts : GLib.Object { |
2819 | [CCode (has_construct_function = false)] |
2820 | public DesktopShortcuts (string file, string identity); |
2821 | - public unowned string get_nicks (); |
2822 | + [CCode (array_length = false, array_null_terminated = true)] |
2823 | + public unowned string[] get_nicks (); |
2824 | public bool nick_exec (string nick); |
2825 | public unowned string nick_get_name (string nick); |
2826 | public string desktop_file { construct; } |
requires lp:~unity-team/clutk/clutk.menuitems now, some ctk menu bugfixes in there