Merge lp:~l-admin-3/pantheon-greeter/indicator-api-integration into lp:~elementary-pantheon/pantheon-greeter/trunk
- indicator-api-integration
- Merge into trunk
Proposed by
Cody Garver
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Danielle Foré | ||||||||
Approved revision: | 372 | ||||||||
Merged at revision: | 406 | ||||||||
Proposed branch: | lp:~l-admin-3/pantheon-greeter/indicator-api-integration | ||||||||
Merge into: | lp:~elementary-pantheon/pantheon-greeter/trunk | ||||||||
Diff against target: |
1345 lines (+439/-777) 13 files modified
CMakeLists.txt (+2/-2) src/Indicators/AccessibilityMenu.vala (+0/-108) src/Indicators/EntryList.vala (+70/-0) src/Indicators/IndicatorBar.vala (+124/-0) src/Indicators/IndicatorEntry.vala (+131/-0) src/Indicators/IndicatorPopover.vala (+34/-0) src/Indicators/Indicators.vala (+0/-233) src/Indicators/KeyboardLayoutMenu.vala (+0/-199) src/Indicators/PopoverManager.vala (+45/-0) src/Indicators/PowerMenu.vala (+0/-47) src/Indicators/StyleClass.vala (+25/-0) src/PantheonGreeter.vala (+8/-13) vapi/indicator-0.4.vapi (+0/-175) |
||||||||
To merge this branch: | bzr merge lp:~l-admin-3/pantheon-greeter/indicator-api-integration | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
elementary Pantheon team | Pending | ||
Review via email: mp+263979@code.launchpad.net |
Commit message
Use new indicator API to show LibWingpanel indicators
Description of the change
To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) wrote : | # |
Revision history for this message
Danielle Foré (danrabbit) wrote : | # |
I'm going to merge this as we're already using it in Loki
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-07-20 11:24:02 +0000 |
3 | +++ CMakeLists.txt 2015-08-03 22:34:06 +0000 |
4 | @@ -28,7 +28,7 @@ |
5 | add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) |
6 | |
7 | find_package (PkgConfig) |
8 | -pkg_check_modules (DEPS REQUIRED granite liblightdm-gobject-1>=1.2.1 gdk-x11-3.0 clutter-gtk-1.0 indicator3-0.4 gdk-pixbuf-2.0 gl) |
9 | +pkg_check_modules (DEPS REQUIRED granite liblightdm-gobject-1>=1.2.1 gdk-x11-3.0 clutter-gtk-1.0 gdk-pixbuf-2.0 gl wingpanel-2.0) |
10 | add_definitions (${DEPS_CFLAGS}) |
11 | link_libraries (${DEPS_LIBRARIES}) |
12 | link_directories (${DEPS_LIBRARY_DIRS}) |
13 | @@ -51,8 +51,8 @@ |
14 | gdk-x11-3.0 |
15 | x11 |
16 | clutter-gtk-1.0 |
17 | - indicator-0.4 |
18 | gl |
19 | + wingpanel-2.0 |
20 | OPTIONS |
21 | --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi |
22 | ) |
23 | |
24 | === removed file 'src/Indicators/AccessibilityMenu.vala' |
25 | --- src/Indicators/AccessibilityMenu.vala 2015-01-17 06:55:55 +0000 |
26 | +++ src/Indicators/AccessibilityMenu.vala 1970-01-01 00:00:00 +0000 |
27 | @@ -1,108 +0,0 @@ |
28 | - |
29 | - |
30 | -public class AccessibilityMenu : Gtk.MenuItem { |
31 | - |
32 | - int onboard_stdout_fd; |
33 | - Gtk.Window keyboard_window; |
34 | - unowned KeyFile settings; |
35 | - int keyboard_pid; |
36 | - |
37 | - public AccessibilityMenu (KeyFile _settings) { |
38 | - this.settings = _settings; |
39 | - try { |
40 | - add (new Gtk.Image.from_pixbuf (Gtk.IconTheme.get_default ().lookup_by_gicon ( |
41 | - new GLib.ThemedIcon.with_default_fallbacks ("preferences-desktop-accessibility-symbolic"), |
42 | - 16, 0).load_symbolic ({1,1,1,1}))); |
43 | - } catch (Error e) { |
44 | - warning (e.message); |
45 | - } |
46 | - |
47 | - submenu = new Gtk.Menu (); |
48 | - |
49 | - var keyboard = new Gtk.CheckMenuItem.with_label (_("Onscreen Keyboard")); |
50 | - try { |
51 | - keyboard.active = settings.get_boolean ("greeter", "onscreen-keyboard"); |
52 | - } catch (Error e) { |
53 | - warning (e.message); |
54 | - } |
55 | - |
56 | - keyboard.toggled.connect ((e) => { |
57 | - toggle_keyboard (e.active); |
58 | - }); |
59 | - submenu.append (keyboard); |
60 | - |
61 | - var high_contrast = new Gtk.CheckMenuItem.with_label (_("HighContrast")); |
62 | - high_contrast.toggled.connect (() => { |
63 | - Gtk.Settings.get_default ().gtk_theme_name = high_contrast.active ? "HighContrastInverse" : "elementary"; |
64 | - settings.set_boolean ("greeter", "high-contrast", high_contrast.active); |
65 | - }); |
66 | - |
67 | - try { |
68 | - high_contrast.active = settings.get_boolean ("greeter", "high-contrast"); |
69 | - } catch (Error e) { |
70 | - warning (e.message); |
71 | - } |
72 | - |
73 | - submenu.append (high_contrast); |
74 | - |
75 | - try { |
76 | - if (settings.get_boolean ("greeter", "onscreen-keyboard")) { |
77 | - toggle_keyboard (true); |
78 | - } |
79 | - } catch (Error e) { |
80 | - warning (e.message); |
81 | - } |
82 | - } |
83 | - |
84 | - ~AccessibilityMenu () { |
85 | - if (keyboard_pid != 0) { |
86 | - Posix.kill (keyboard_pid, Posix.SIGKILL); |
87 | - |
88 | - int status; |
89 | - Posix.waitpid (keyboard_pid, out status, 0); |
90 | - keyboard_pid = 0; |
91 | - } |
92 | - } |
93 | - |
94 | - public void toggle_keyboard (bool active) { |
95 | - if (keyboard_window != null) { |
96 | - keyboard_window.visible = active; |
97 | - settings.set_boolean ("greeter", "onscreen-keyboard", active); |
98 | - return; |
99 | - } |
100 | - |
101 | - int id = 0; |
102 | - |
103 | - try { |
104 | - string [] argv; |
105 | - Shell.parse_argv ("onboard --xid", out argv); |
106 | - Process.spawn_async_with_pipes (null, argv, null, SpawnFlags.SEARCH_PATH, null, out keyboard_pid, null, out onboard_stdout_fd, null); |
107 | - |
108 | - var f = FileStream.fdopen (onboard_stdout_fd, "r"); |
109 | - var stdout_text = new char[1024]; |
110 | - f.gets (stdout_text); |
111 | - id = int.parse ((string)stdout_text); |
112 | - } catch (Error e) { |
113 | - warning (e.message); |
114 | - } |
115 | - |
116 | - var keyboard_socket = new Gtk.Socket (); |
117 | - keyboard_window = new Gtk.Window (); |
118 | - keyboard_window.accept_focus = false; |
119 | - keyboard_window.focus_on_map = false; |
120 | - keyboard_window.add (keyboard_socket); |
121 | - keyboard_socket.add_id (id); |
122 | - |
123 | - var screen = Gdk.Screen.get_default (); |
124 | - var monitor = screen.get_primary_monitor (); |
125 | - Gdk.Rectangle geom; |
126 | - screen.get_monitor_geometry (monitor, out geom); |
127 | - keyboard_window.move (geom.x, geom.y + geom.height - 200); |
128 | - keyboard_window.resize (geom.width, 200); |
129 | - keyboard_window.set_keep_above (true); |
130 | - |
131 | - keyboard_window.show_all (); |
132 | - settings.set_boolean ("greeter", "onscreen-keyboard", true); |
133 | - } |
134 | - |
135 | -} |
136 | |
137 | === added file 'src/Indicators/EntryList.vala' |
138 | --- src/Indicators/EntryList.vala 1970-01-01 00:00:00 +0000 |
139 | +++ src/Indicators/EntryList.vala 2015-08-03 22:34:06 +0000 |
140 | @@ -0,0 +1,70 @@ |
141 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
142 | +/*** |
143 | + BEGIN LICENSE |
144 | + |
145 | + Copyright (C) 2011-2015 elementary Developers |
146 | + |
147 | + This program is free software: you can redistribute it and/or modify it |
148 | + under the terms of the GNU Lesser General Public License version 3, as published |
149 | + by the Free Software Foundation. |
150 | + |
151 | + This program is distributed in the hope that it will be useful, but |
152 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
153 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
154 | + PURPOSE. See the GNU General Public License for more details. |
155 | + |
156 | + You should have received a copy of the GNU General Public License along |
157 | + with this program. If not, see <http://www.gnu.org/licenses/> |
158 | + |
159 | + END LICENSE |
160 | +***/ |
161 | + |
162 | +public class Indicators.EntryList : Gee.ArrayList<IndicatorEntry> { |
163 | + // The order in which the indicators are shown from left to right. |
164 | + private const string[] INDICATOR_ORDER = { |
165 | + Wingpanel.Indicator.KEYBOARD, |
166 | + Wingpanel.Indicator.SOUND, |
167 | + Wingpanel.Indicator.NETWORK, |
168 | + Wingpanel.Indicator.BLUETOOTH, |
169 | + Wingpanel.Indicator.PRINTER, |
170 | + Wingpanel.Indicator.SYNC, |
171 | + Wingpanel.Indicator.POWER, |
172 | + Wingpanel.Indicator.MESSAGES, |
173 | + Wingpanel.Indicator.SESSION |
174 | + }; |
175 | + |
176 | + public signal void list_changed (); |
177 | + |
178 | + public async void resort () { |
179 | + message ("Resorting indicators..."); |
180 | + |
181 | + this.sort ((a, b) => { |
182 | + if (a == null) |
183 | + return (b == null) ? 0 : -1; |
184 | + |
185 | + if (b == null) |
186 | + return 1; |
187 | + |
188 | + string a_name = a.get_code_name ().down (); |
189 | + string b_name = b.get_code_name ().down (); |
190 | + |
191 | + int order = get_item_index (a_name) - get_item_index (b_name); |
192 | + |
193 | + if (order == 0) |
194 | + order = strcmp (a_name, b_name); |
195 | + |
196 | + return order.clamp (-1, 1); |
197 | + }); |
198 | + |
199 | + list_changed (); |
200 | + } |
201 | + |
202 | + private int get_item_index (string item) { |
203 | + for (int i = 0; i < INDICATOR_ORDER.length; i++) { |
204 | + if (INDICATOR_ORDER[i].down () == item) |
205 | + return i; |
206 | + } |
207 | + |
208 | + return 0; |
209 | + } |
210 | +} |
211 | |
212 | === added file 'src/Indicators/IndicatorBar.vala' |
213 | --- src/Indicators/IndicatorBar.vala 1970-01-01 00:00:00 +0000 |
214 | +++ src/Indicators/IndicatorBar.vala 2015-08-03 22:34:06 +0000 |
215 | @@ -0,0 +1,124 @@ |
216 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
217 | +/*** |
218 | + BEGIN LICENSE |
219 | + |
220 | + Copyright (C) 2011-2015 elementary Developers |
221 | + |
222 | + This program is free software: you can redistribute it and/or modify it |
223 | + under the terms of the GNU Lesser General Public License version 3, as published |
224 | + by the Free Software Foundation. |
225 | + |
226 | + This program is distributed in the hope that it will be useful, but |
227 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
228 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
229 | + PURPOSE. See the GNU General Public License for more details. |
230 | + |
231 | + You should have received a copy of the GNU General Public License along |
232 | + with this program. If not, see <http://www.gnu.org/licenses/> |
233 | + |
234 | + END LICENSE |
235 | +***/ |
236 | + |
237 | +public class Indicators.IndicatorBar : GtkClutter.Actor { |
238 | + private EntryList entry_list; |
239 | + |
240 | + private PopoverManager popover_manager; |
241 | + |
242 | + private Gtk.MenuBar menu_bar; |
243 | + |
244 | + public IndicatorBar () { |
245 | + Wingpanel.IndicatorManager.get_default ().initialize (Wingpanel.IndicatorManager.ServerType.GREETER); |
246 | + |
247 | + entry_list = new EntryList (); |
248 | + popover_manager = new PopoverManager (); |
249 | + |
250 | + build_ui (); |
251 | + |
252 | + if (Wingpanel.IndicatorManager.get_default ().has_indicators ()) { |
253 | + load_indicators.begin (() => { |
254 | + entry_list.resort.begin (() => { |
255 | + update_bar (); |
256 | + |
257 | + connect_signals (); |
258 | + }); |
259 | + }); |
260 | + } |
261 | + } |
262 | + |
263 | + private void build_ui () { |
264 | + var container_widget = (Gtk.Container)this.get_widget (); |
265 | + |
266 | + menu_bar = new Gtk.MenuBar (); |
267 | + menu_bar.can_focus = true; |
268 | + menu_bar.border_width = 0; |
269 | + menu_bar.override_background_color (Gtk.StateFlags.NORMAL, {0, 0, 0, 0}); |
270 | + menu_bar.get_style_context ().add_class (StyleClass.PANEL); |
271 | + menu_bar.halign = Gtk.Align.END; |
272 | + |
273 | + container_widget.add (menu_bar); |
274 | + } |
275 | + |
276 | + private async void load_indicators () { |
277 | + message ("Loading indicators..."); |
278 | + |
279 | + var indicators = Wingpanel.IndicatorManager.get_default ().get_indicators (); |
280 | + |
281 | + foreach (Wingpanel.Indicator indicator in indicators) { |
282 | + register_indicator (indicator); |
283 | + } |
284 | + } |
285 | + |
286 | + private bool register_indicator (Wingpanel.Indicator indicator) { |
287 | + message ("Loading indicator %s...", indicator.code_name); |
288 | + |
289 | + var indicator_entry = new IndicatorEntry (indicator); |
290 | + indicator_entry.visibility_changed.connect (update_bar); |
291 | + |
292 | + if (!entry_list.add (indicator_entry)) { |
293 | + warning ("Registering entry for indicator %s failed.", indicator.code_name); |
294 | + |
295 | + return false; |
296 | + } |
297 | + |
298 | + var indicator_popover = indicator_entry.get_popover (); |
299 | + |
300 | + if (!popover_manager.add (indicator_popover)) { |
301 | + warning ("Registering popover for indicator %s failed.", indicator.code_name); |
302 | + |
303 | + return false; |
304 | + } |
305 | + |
306 | + return true; |
307 | + } |
308 | + |
309 | + private void update_bar () { |
310 | + clear_bar (); |
311 | + |
312 | + foreach (IndicatorEntry entry in entry_list) { |
313 | + if (entry.get_is_visible ()) |
314 | + menu_bar.append (entry); |
315 | + } |
316 | + |
317 | + menu_bar.show_all (); |
318 | + } |
319 | + |
320 | + private void connect_signals () { |
321 | + entry_list.list_changed.connect (update_bar); |
322 | + |
323 | + Wingpanel.IndicatorManager.get_default ().indicator_added.connect ((indicator) => { |
324 | + if (!register_indicator (indicator)) |
325 | + return; |
326 | + |
327 | + message ("Requesting resort because indicator %s has been added.", indicator.code_name); |
328 | + |
329 | + entry_list.resort.begin (); |
330 | + }); |
331 | + } |
332 | + |
333 | + private void clear_bar () { |
334 | + var children = menu_bar.get_children (); |
335 | + |
336 | + foreach (var child in children) |
337 | + menu_bar.remove (child); |
338 | + } |
339 | +} |
340 | |
341 | === added file 'src/Indicators/IndicatorEntry.vala' |
342 | --- src/Indicators/IndicatorEntry.vala 1970-01-01 00:00:00 +0000 |
343 | +++ src/Indicators/IndicatorEntry.vala 2015-08-03 22:34:06 +0000 |
344 | @@ -0,0 +1,131 @@ |
345 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
346 | +/*** |
347 | + BEGIN LICENSE |
348 | + |
349 | + Copyright (C) 2011-2015 elementary Developers |
350 | + |
351 | + This program is free software: you can redistribute it and/or modify it |
352 | + under the terms of the GNU Lesser General Public License version 3, as published |
353 | + by the Free Software Foundation. |
354 | + |
355 | + This program is distributed in the hope that it will be useful, but |
356 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
357 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
358 | + PURPOSE. See the GNU General Public License for more details. |
359 | + |
360 | + You should have received a copy of the GNU General Public License along |
361 | + with this program. If not, see <http://www.gnu.org/licenses/> |
362 | + |
363 | + END LICENSE |
364 | +***/ |
365 | + |
366 | +public class Indicators.IndicatorEntry : Gtk.MenuItem { |
367 | + private Gtk.Widget display_widget; |
368 | + private Gtk.Widget? indicator_widget = null; |
369 | + |
370 | + private Gtk.Revealer revealer; |
371 | + |
372 | + private IndicatorPopover popover; |
373 | + private Wingpanel.Indicator base_indicator; |
374 | + |
375 | + public signal void visibility_changed (); |
376 | + |
377 | + public IndicatorEntry (Wingpanel.Indicator base_indicator) { |
378 | + this.base_indicator = base_indicator; |
379 | + this.add_events (Gdk.EventMask.SCROLL_MASK); |
380 | + this.get_style_context ().add_class (StyleClass.COMPOSITED_INDICATOR); |
381 | + this.can_focus = false; |
382 | + |
383 | + display_widget = base_indicator.get_display_widget (); |
384 | + display_widget.margin_start = 4; |
385 | + display_widget.margin_end = 4; |
386 | + |
387 | + if (display_widget == null) |
388 | + return; |
389 | + |
390 | + revealer = new Gtk.Revealer (); |
391 | + revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_RIGHT; |
392 | + |
393 | + revealer.add (display_widget); |
394 | + |
395 | + indicator_widget = base_indicator.get_widget (); |
396 | + |
397 | + if (indicator_widget != null) { |
398 | + popover = new IndicatorPopover (indicator_widget); |
399 | + popover.relative_to = this; |
400 | + } |
401 | + |
402 | + this.add (revealer); |
403 | + |
404 | + set_reveal (base_indicator.visible); |
405 | + |
406 | + connect_signals (); |
407 | + } |
408 | + |
409 | + public string get_code_name () { |
410 | + return base_indicator.code_name; |
411 | + } |
412 | + |
413 | + public bool get_is_visible () { |
414 | + return base_indicator.visible; |
415 | + } |
416 | + |
417 | + public IndicatorPopover get_popover () { |
418 | + return popover; |
419 | + } |
420 | + |
421 | + private void connect_signals () { |
422 | + base_indicator.notify["visible"].connect (() => { |
423 | + request_resort (); |
424 | + |
425 | + set_reveal (base_indicator.visible); |
426 | + }); |
427 | + |
428 | + base_indicator.close.connect (() => { |
429 | + if (indicator_widget != null) |
430 | + popover.hide (); |
431 | + }); |
432 | + |
433 | + this.scroll_event.connect ((e) => { |
434 | + display_widget.scroll_event (e); |
435 | + |
436 | + return Gdk.EVENT_STOP; |
437 | + }); |
438 | + |
439 | + this.button_press_event.connect ((e) => { |
440 | + if (indicator_widget != null) { |
441 | + if ((e.button == Gdk.BUTTON_PRIMARY || e.button == Gdk.BUTTON_SECONDARY) && e.type == Gdk.EventType.BUTTON_PRESS) { |
442 | + if (popover.get_visible ()) |
443 | + popover.hide (); |
444 | + else |
445 | + popover.show_all (); |
446 | + |
447 | + return Gdk.EVENT_STOP; |
448 | + } |
449 | + } |
450 | + |
451 | + display_widget.button_press_event (e); |
452 | + |
453 | + return Gdk.EVENT_PROPAGATE; |
454 | + }); |
455 | + } |
456 | + |
457 | + private void set_reveal (bool reveal) { |
458 | + if (!reveal && popover.get_visible ()) |
459 | + popover.hide (); |
460 | + |
461 | + revealer.set_reveal_child (reveal); |
462 | + } |
463 | + |
464 | + private void request_resort () { |
465 | + if (base_indicator.visible) { |
466 | + visibility_changed (); |
467 | + } else { |
468 | + Timeout.add (revealer.transition_duration, () => { |
469 | + visibility_changed (); |
470 | + |
471 | + return false; |
472 | + }); |
473 | + } |
474 | + } |
475 | +} |
476 | |
477 | === added file 'src/Indicators/IndicatorPopover.vala' |
478 | --- src/Indicators/IndicatorPopover.vala 1970-01-01 00:00:00 +0000 |
479 | +++ src/Indicators/IndicatorPopover.vala 2015-08-03 22:34:06 +0000 |
480 | @@ -0,0 +1,34 @@ |
481 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
482 | +/*** |
483 | + BEGIN LICENSE |
484 | + |
485 | + Copyright (C) 2011-2015 elementary Developers |
486 | + |
487 | + This program is free software: you can redistribute it and/or modify it |
488 | + under the terms of the GNU Lesser General Public License version 3, as published |
489 | + by the Free Software Foundation. |
490 | + |
491 | + This program is distributed in the hope that it will be useful, but |
492 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
493 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
494 | + PURPOSE. See the GNU General Public License for more details. |
495 | + |
496 | + You should have received a copy of the GNU General Public License along |
497 | + with this program. If not, see <http://www.gnu.org/licenses/> |
498 | + |
499 | + END LICENSE |
500 | +***/ |
501 | + |
502 | +public class Indicators.IndicatorPopover : Gtk.Popover { |
503 | + private Gtk.Widget content; |
504 | + |
505 | + public IndicatorPopover (Gtk.Widget indicator_widget) { |
506 | + this.set_size_request (220, -1); |
507 | + |
508 | + content = indicator_widget; |
509 | + content.margin_top = 3; |
510 | + content.margin_bottom = 3; |
511 | + |
512 | + this.add (content); |
513 | + } |
514 | +} |
515 | |
516 | === removed file 'src/Indicators/Indicators.vala' |
517 | --- src/Indicators/Indicators.vala 2015-01-17 06:55:55 +0000 |
518 | +++ src/Indicators/Indicators.vala 1970-01-01 00:00:00 +0000 |
519 | @@ -1,233 +0,0 @@ |
520 | -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
521 | -/*** |
522 | - BEGIN LICENSE |
523 | - |
524 | - Copyright (C) 2011-2014 elementary Developers |
525 | - |
526 | - This program is free software: you can redistribute it and/or modify it |
527 | - under the terms of the GNU Lesser General Public License version 3, as published |
528 | - by the Free Software Foundation. |
529 | - |
530 | - This program is distributed in the hope that it will be useful, but |
531 | - WITHOUT ANY WARRANTY; without even the implied warranties of |
532 | - MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
533 | - PURPOSE. See the GNU General Public License for more details. |
534 | - |
535 | - You should have received a copy of the GNU General Public License along |
536 | - with this program. If not, see <http://www.gnu.org/licenses/> |
537 | - |
538 | - END LICENSE |
539 | -***/ |
540 | - |
541 | -/*big parts stolen from unity-greeter ;) */ |
542 | - |
543 | -public class IndicatorMenuItem : Gtk.MenuItem { |
544 | - |
545 | - public unowned Indicator.ObjectEntry entry; |
546 | - private Gtk.Box hbox; |
547 | - |
548 | - public IndicatorMenuItem (Indicator.ObjectEntry _entry) { |
549 | - entry = _entry; |
550 | - hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); |
551 | - add (this.hbox); |
552 | - hbox.show (); |
553 | - |
554 | - if (entry.image != null) { |
555 | - var img = entry.image; |
556 | - |
557 | - img.show.connect (visibility_changed_cb); |
558 | - img.hide.connect (visibility_changed_cb); |
559 | - hbox.pack_start (img, false, false, 0); |
560 | - img.show (); |
561 | - } |
562 | - |
563 | - if (entry.accessible_desc != null) |
564 | - get_accessible ().set_name (entry.accessible_desc); |
565 | - |
566 | - if (entry.menu != null) |
567 | - submenu = entry.menu; |
568 | - |
569 | - if (has_visible_child ()) |
570 | - show (); |
571 | - } |
572 | - |
573 | - public bool has_visible_child () { |
574 | - return (entry.image != null && entry.image.get_visible ()) || |
575 | - (entry.label != null && entry.label.get_visible ()); |
576 | - } |
577 | - |
578 | - public void visibility_changed_cb (Gtk.Widget widget) { |
579 | - visible = has_visible_child (); |
580 | - } |
581 | -} |
582 | - |
583 | -public class Indicators : GtkClutter.Actor { |
584 | - int margin_to_right = 5; |
585 | - |
586 | - PowerMenu power; |
587 | - |
588 | - unowned KeyFile settings; |
589 | - |
590 | - public KeyboardLayoutMenu keyboard_menu { get; private set; } |
591 | - |
592 | - public Gtk.MenuBar bar; |
593 | - private List<Indicator.Object> indicator_objects; |
594 | - |
595 | - public async void start () { |
596 | - string[] disabled = {"org.gnome.settings-daemon.plugins.background", |
597 | - "org.gnome.settings-daemon.plugins.clipboard", |
598 | - "org.gnome.settings-daemon.plugins.font", |
599 | - "org.gnome.settings-daemon.plugins.gconf", |
600 | - "org.gnome.settings-daemon.plugins.gsdwacom", |
601 | - "org.gnome.settings-daemon.plugins.housekeeping", |
602 | - "org.gnome.settings-daemon.plugins.keybindings", |
603 | - "org.gnome.settings-daemon.plugins.keyboard", |
604 | - "org.gnome.settings-daemon.plugins.media-keys", |
605 | - "org.gnome.settings-daemon.plugins.mouse", |
606 | - "org.gnome.settings-daemon.plugins.print-notifications", |
607 | - "org.gnome.settings-daemon.plugins.smartcard", |
608 | - "org.gnome.settings-daemon.plugins.sound", |
609 | - "org.gnome.settings-daemon.plugins.wacom", |
610 | - "org.gnome.settings-daemon.plugins.xsettings"}; |
611 | - |
612 | - string[] enabled = {"org.gnome.settings-daemon.plugins.a11y-keyboard", |
613 | - "org.gnome.settings-daemon.plugins.a11y-settings", |
614 | - "org.gnome.settings-daemon.plugins.color", |
615 | - "org.gnome.settings-daemon.plugins.cursor", |
616 | - "org.gnome.settings-daemon.plugins.power", |
617 | - "org.gnome.settings-daemon.plugins.xrandr"}; |
618 | - |
619 | - foreach (var schema in disabled) { |
620 | - toggle_schema (schema, false); |
621 | - } |
622 | - |
623 | - foreach (var schema in enabled) { |
624 | - toggle_schema (schema, true); |
625 | - } |
626 | - |
627 | - GLib.Bus.own_name (GLib.BusType.SESSION, "org.gnome.ScreenSaver", |
628 | - GLib.BusNameOwnerFlags.NONE); |
629 | - yield run (); |
630 | - } |
631 | - |
632 | - private async void run () { |
633 | - try { |
634 | - var proxy = new GLib.DBusProxy.for_bus_sync (GLib.BusType.SESSION, |
635 | - GLib.DBusProxyFlags.NONE, null, |
636 | - "org.gnome.SettingsDaemon", |
637 | - "/org/gnome/SettingsDaemon", |
638 | - "org.gnome.SettingsDaemon", |
639 | - null); |
640 | - |
641 | - yield proxy.call ("Awake", null, GLib.DBusCallFlags.NONE, -1, null); |
642 | - } catch (Error e) { |
643 | - warning ("Could not start gnome-settings-daemon: %s", e.message); |
644 | - } |
645 | - } |
646 | - |
647 | - |
648 | - public Indicators (KeyFile _settings) { |
649 | - settings = _settings; |
650 | - bar = new Gtk.MenuBar (); |
651 | - (get_widget () as Gtk.Container).add (bar); |
652 | - |
653 | - bar.pack_direction = Gtk.PackDirection.RTL; |
654 | - height = 26; |
655 | - bar.show_all (); |
656 | - |
657 | - var transp = new Gtk.CssProvider (); |
658 | - try { |
659 | - transp.load_from_data ("*{background-color:@transparent;-GtkWidget-window-dragging:false;}", -1); |
660 | - } catch (Error e) { warning (e.message); } |
661 | - bar.get_style_context ().add_provider (transp, 20000); |
662 | - |
663 | - |
664 | - this.get_widget ().draw.connect ((ctx) => { |
665 | - ctx.rectangle (0, 0, bar.get_allocated_width (), bar.get_allocated_height ()); |
666 | - ctx.set_operator (Cairo.Operator.SOURCE); |
667 | - ctx.set_source_rgba (0, 0, 0, 0); |
668 | - ctx.fill (); |
669 | - |
670 | - return false; |
671 | - }); |
672 | - |
673 | - greeter_set_env ("INDICATOR_GREETER_MODE", "1"); |
674 | - greeter_set_env ("GIO_USE_VFS", "local"); |
675 | - greeter_set_env ("GVFS_DISABLE_FUSE", "1"); |
676 | - greeter_set_env ("RUNNING_UNDER_GDM", "1"); |
677 | - |
678 | - var INDICATORDIR = "/usr/lib/indicators3/7"; |
679 | - string[] filenames = {Path.build_filename (INDICATORDIR, "libpower.so"), |
680 | - Path.build_filename (INDICATORDIR, "libsoundmenu.so")}; |
681 | - |
682 | - foreach (var filename in filenames) { |
683 | - var io = new Indicator.Object.from_file (filename); |
684 | - if (io == null) |
685 | - continue; |
686 | - |
687 | - indicator_objects.append (io); |
688 | - io.entry_added.connect ((object, entry) => { |
689 | - bar.append (new IndicatorMenuItem (entry)); |
690 | - }); |
691 | - |
692 | - io.entry_removed.connect ((object, entry) => { |
693 | - for (var i = 1; i < bar.get_children ().length (); i++) { |
694 | - if (bar.get_children ().nth_data (i) is IndicatorMenuItem) |
695 | - if (entry == (bar.get_children ().nth_data (i) as IndicatorMenuItem).entry) |
696 | - bar.remove (bar.get_children ().nth_data (i)); |
697 | - } |
698 | - }); |
699 | - |
700 | - foreach (var entry in io.get_entries ()) { |
701 | - var widget = new IndicatorMenuItem (entry); |
702 | - bar.append (widget); |
703 | - widget.margin_right = margin_to_right; |
704 | - } |
705 | - |
706 | - } |
707 | - |
708 | - start.begin (); |
709 | - |
710 | - //keyboard layout menu |
711 | - keyboard_menu = new KeyboardLayoutMenu (); |
712 | - bar.append (keyboard_menu); |
713 | - keyboard_menu.margin_right = margin_to_right; |
714 | - keyboard_menu.show_all (); |
715 | - |
716 | - power = new PowerMenu (); |
717 | - power.margin_right = margin_to_right; |
718 | - bar.insert (power, 0); |
719 | - power.show_all (); |
720 | - |
721 | - var accessibility = new AccessibilityMenu (settings); |
722 | - accessibility.margin_right = margin_to_right; |
723 | - bar.append (accessibility); |
724 | - |
725 | - accessibility.show_all (); |
726 | - } |
727 | - |
728 | - private void greeter_set_env (string key, string val) { |
729 | - GLib.Environment.set_variable (key, val, true); |
730 | - try { |
731 | - var proxy = new GLib.DBusProxy.for_bus_sync (GLib.BusType.SESSION, |
732 | - GLib.DBusProxyFlags.NONE, null, |
733 | - "org.freedesktop.DBus", |
734 | - "/org/freedesktop/DBus", |
735 | - "org.freedesktop.DBus", |
736 | - null); |
737 | - |
738 | - var builder = new GLib.VariantBuilder (GLib.VariantType.ARRAY); |
739 | - builder.add ("{ss}", key, val); |
740 | - proxy.call.begin ("UpdateActivationEnvironment", new Variant ("(a{ss})", builder), DBusCallFlags.NONE, -1, null); |
741 | - } catch (Error e) { |
742 | - warning ("Could not get set environment for indicators: %s", e.message); |
743 | - } |
744 | - } |
745 | - |
746 | - private void toggle_schema (string name, bool active) { |
747 | - var schema = SettingsSchemaSource.get_default ().lookup (name, false); |
748 | - |
749 | - if (schema != null) |
750 | - new Settings (name).set_boolean ("active", active); |
751 | - } |
752 | -} |
753 | |
754 | === removed file 'src/Indicators/KeyboardLayoutMenu.vala' |
755 | --- src/Indicators/KeyboardLayoutMenu.vala 2014-10-21 20:20:45 +0000 |
756 | +++ src/Indicators/KeyboardLayoutMenu.vala 1970-01-01 00:00:00 +0000 |
757 | @@ -1,199 +0,0 @@ |
758 | -public class KeyboardLayoutMenu : Gtk.MenuItem { |
759 | - |
760 | - const string pantheon_greeter_layout_string = "pgl"; |
761 | - |
762 | - Gtk.Label keyboard_label; |
763 | - |
764 | - LayoutItemNode[] layout_item_nodes = {}; |
765 | - |
766 | - Gtk.RadioMenuItem no_other_entries_item; |
767 | - |
768 | - public KeyboardLayoutMenu () { |
769 | - |
770 | - var keyboard_hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 3); |
771 | - |
772 | - try { |
773 | - add (new Gtk.Image.from_pixbuf (Gtk.IconTheme.get_default ().lookup_by_gicon ( |
774 | - new GLib.ThemedIcon.with_default_fallbacks ("input-keyboard-symbolic"), |
775 | - 16, 0).load_symbolic ({1,1,1,1}))); |
776 | - } catch (Error e) { |
777 | - warning (e.message); |
778 | - } |
779 | - |
780 | - keyboard_label = new Gtk.Label (""); |
781 | - keyboard_label.set_use_markup (true); |
782 | - keyboard_label.width_chars = 2; |
783 | - keyboard_hbox.add (keyboard_label); |
784 | - |
785 | - add (keyboard_hbox); |
786 | - create_menu (); |
787 | - } |
788 | - |
789 | - private void create_menu () { |
790 | - var submenu = new Gtk.Menu (); |
791 | - set_submenu (submenu as Gtk.Widget); |
792 | - |
793 | - var layouts = LightDM.get_layouts ().copy (); |
794 | - layouts.sort (cmp_layout); |
795 | - |
796 | - layout_item_nodes.resize ((int) layouts.length ()); |
797 | - |
798 | - int i = 0; |
799 | - |
800 | - Gtk.RadioMenuItem? default_item = null; |
801 | - Gtk.RadioMenuItem? last_item = null; |
802 | - foreach (var layout in layouts) { |
803 | - var item = new Gtk.RadioMenuItem.with_label (last_item == null ? null : last_item.get_group (), layout.description); |
804 | - last_item = item; |
805 | - |
806 | - if (i == 0) |
807 | - default_item = item; |
808 | - |
809 | - /* LightDM does not change its layout list during its lifetime, so this is safe */ |
810 | - item.set_data (pantheon_greeter_layout_string, layout); |
811 | - |
812 | - item.toggled.connect (layout_toggled_cb); |
813 | - |
814 | - submenu.append (item); |
815 | - layout_item_nodes[i] = new LayoutItemNode (layout, item, false); |
816 | - i++; |
817 | - } |
818 | - no_other_entries_item = new Gtk.RadioMenuItem.with_label (null, _("No other keyboard layouts available")); |
819 | - submenu.append (no_other_entries_item); |
820 | - } |
821 | - |
822 | - public void user_changed_cb (LoginOption user) { |
823 | - |
824 | - var layouts = new List <LightDM.Layout> (); |
825 | - UserLogin user_login = user as UserLogin; |
826 | - if (user_login != null) { |
827 | - foreach (var name in user_login.lightdm_user.get_layouts ()) { |
828 | - var layout = get_layout_by_name (name); |
829 | - if (layout != null) |
830 | - layouts.append (layout); |
831 | - } |
832 | - } |
833 | - set_layouts (layouts); |
834 | - update_layout_visibility (); |
835 | - } |
836 | - |
837 | - private void update_layout_visibility () { |
838 | - foreach (var n in layout_item_nodes) { |
839 | - if (n.visible) { |
840 | - n.item.show (); |
841 | - } else { |
842 | - n.item.hide (); |
843 | - } |
844 | - } |
845 | - } |
846 | - |
847 | - static LightDM.Layout? get_layout_by_name (string name) { |
848 | - foreach (var layout in LightDM.get_layouts ()) { |
849 | - if (layout.name == name) |
850 | - return layout; |
851 | - } |
852 | - return null; |
853 | - } |
854 | - |
855 | - private void set_layouts (List<LightDM.Layout> layouts) |
856 | - { |
857 | - if (layouts == null || layouts.length () == 0) { |
858 | - foreach (var n in layout_item_nodes) { |
859 | - n.visible = false; |
860 | - } |
861 | - no_other_entries_item.show (); |
862 | - return; |
863 | - } |
864 | - else { |
865 | - foreach (var n in layout_item_nodes) { |
866 | - n.visible = false; |
867 | - } |
868 | - foreach (var layout in layouts) { |
869 | - get_node_for_layout (layout).visible = true; |
870 | - } |
871 | - no_other_entries_item.hide (); |
872 | - } |
873 | - |
874 | - var default_layout = layouts.data; |
875 | - if (default_layout == null) { |
876 | - default_layout = layout_item_nodes[0].layout; |
877 | - } |
878 | - var default_item = get_node_for_layout (default_layout).item; |
879 | - |
880 | - /* Activate first item */ |
881 | - if (default_item != null) { |
882 | - if (default_item.active) /* Started active, have to manually trigger callback */ |
883 | - layout_toggled_cb (default_item); |
884 | - else |
885 | - default_item.active = true; /* will trigger callback to do rest of work */ |
886 | - } |
887 | - } |
888 | - |
889 | - private LayoutItemNode? get_node_for_layout (LightDM.Layout layout) { |
890 | - foreach (var n in layout_item_nodes) { |
891 | - if (cmp_layout (layout, n.layout) == 0) { |
892 | - return n; |
893 | - } |
894 | - } |
895 | - warning ("Couldn't find a layout that matches: " + layout.name); |
896 | - return null; |
897 | - } |
898 | - |
899 | - private void layout_toggled_cb (Gtk.CheckMenuItem item) { |
900 | - if (!item.active) |
901 | - return; |
902 | - |
903 | - var layout = item.get_data<LightDM.Layout> (pantheon_greeter_layout_string); |
904 | - if (layout == null) |
905 | - return; |
906 | - |
907 | - var desc = layout.short_description; |
908 | - if (desc == null || desc == "") { |
909 | - var parts = layout.name.split ("\t", 2); |
910 | - if (parts[0] == layout.name) { |
911 | - desc = layout.name; |
912 | - } else { |
913 | - /* Lookup parent layout, get its short_description */ |
914 | - var parent_layout = get_layout_by_name (parts[0]); |
915 | - if (parent_layout.short_description == null || |
916 | - parent_layout.short_description == "") { |
917 | - desc = parts[0]; |
918 | - } else { |
919 | - desc = parent_layout.short_description; |
920 | - } |
921 | - } |
922 | - } |
923 | - keyboard_label.label = "<span foreground=\"white\">"+desc+"</span>"; |
924 | - |
925 | - LightDM.set_layout (layout); |
926 | - } |
927 | - |
928 | - private static int cmp_layout (LightDM.Layout? a, LightDM.Layout? b) |
929 | - { |
930 | - if (a == null && b == null) |
931 | - return 0; |
932 | - else if (a == null) |
933 | - return 1; |
934 | - else if (b == null) |
935 | - return -1; |
936 | - else { |
937 | - /* Use a dumb, ascii comparison for now. If it turns out that some |
938 | - descriptions can be in unicode, we'll have to use libicu's collation |
939 | - algorithms. */ |
940 | - return strcmp (a.name, b.name); |
941 | - } |
942 | - } |
943 | - |
944 | - class LayoutItemNode { |
945 | - public LightDM.Layout layout { get; set; } |
946 | - public Gtk.RadioMenuItem item { get; set; } |
947 | - public bool visible { get; set; } |
948 | - |
949 | - public LayoutItemNode (LightDM.Layout layout, Gtk.RadioMenuItem item, bool visible) { |
950 | - this.layout = layout; |
951 | - this.item = item; |
952 | - this.visible = visible; |
953 | - } |
954 | - } |
955 | - |
956 | -} |
957 | \ No newline at end of file |
958 | |
959 | === added file 'src/Indicators/PopoverManager.vala' |
960 | --- src/Indicators/PopoverManager.vala 1970-01-01 00:00:00 +0000 |
961 | +++ src/Indicators/PopoverManager.vala 2015-08-03 22:34:06 +0000 |
962 | @@ -0,0 +1,45 @@ |
963 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
964 | +/*** |
965 | + BEGIN LICENSE |
966 | + |
967 | + Copyright (C) 2011-2015 elementary Developers |
968 | + |
969 | + This program is free software: you can redistribute it and/or modify it |
970 | + under the terms of the GNU Lesser General Public License version 3, as published |
971 | + by the Free Software Foundation. |
972 | + |
973 | + This program is distributed in the hope that it will be useful, but |
974 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
975 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
976 | + PURPOSE. See the GNU General Public License for more details. |
977 | + |
978 | + You should have received a copy of the GNU General Public License along |
979 | + with this program. If not, see <http://www.gnu.org/licenses/> |
980 | + |
981 | + END LICENSE |
982 | +***/ |
983 | + |
984 | +public class Indicators.PopoverManager : Gee.ArrayList<IndicatorPopover> { |
985 | + public PopoverManager () { |
986 | + connect_signals (); |
987 | + } |
988 | + |
989 | + public override bool add (IndicatorPopover popover) { |
990 | + bool added = base.add (popover); |
991 | + |
992 | + if (!added) |
993 | + return false; |
994 | + |
995 | + register_popover (popover); |
996 | + |
997 | + return true; |
998 | + } |
999 | + |
1000 | + private void connect_signals () { |
1001 | + // TODO |
1002 | + } |
1003 | + |
1004 | + private void register_popover (IndicatorPopover popover) { |
1005 | + // TODO: Connect to popover signals |
1006 | + } |
1007 | +} |
1008 | |
1009 | === removed file 'src/Indicators/PowerMenu.vala' |
1010 | --- src/Indicators/PowerMenu.vala 2014-03-13 15:17:03 +0000 |
1011 | +++ src/Indicators/PowerMenu.vala 1970-01-01 00:00:00 +0000 |
1012 | @@ -1,47 +0,0 @@ |
1013 | - |
1014 | - |
1015 | -public class PowerMenu : Gtk.MenuItem { |
1016 | - |
1017 | - public PowerMenu () { |
1018 | - try { |
1019 | - add (new Gtk.Image.from_pixbuf (Gtk.IconTheme.get_default ().lookup_by_gicon ( |
1020 | - new GLib.ThemedIcon.with_default_fallbacks ("system-shutdown-symbolic"), 16, 0) |
1021 | - .load_symbolic ({1,1,1,1}))); |
1022 | - } catch (Error e) { |
1023 | - warning (e.message); |
1024 | - } |
1025 | - |
1026 | - submenu = new Gtk.Menu (); |
1027 | - |
1028 | - var poweroff = new Gtk.MenuItem.with_label (_("Shutdown")); |
1029 | - var suspend = new Gtk.MenuItem.with_label (_("Suspend")); |
1030 | - var restart = new Gtk.MenuItem.with_label (_("Restart")); |
1031 | - var hibernate = new Gtk.MenuItem.with_label (_("Hibernate")); |
1032 | - |
1033 | - if (LightDM.get_can_hibernate ()) |
1034 | - submenu.append (hibernate); |
1035 | - |
1036 | - if (LightDM.get_can_suspend ()) |
1037 | - submenu.append (suspend); |
1038 | - |
1039 | - if (LightDM.get_can_restart ()) |
1040 | - submenu.append (restart); |
1041 | - |
1042 | - if (LightDM.get_can_shutdown ()) |
1043 | - submenu.append (poweroff); |
1044 | - |
1045 | - poweroff.activate.connect (() => { |
1046 | - try { LightDM.shutdown (); } catch (Error e) { warning (e.message); } |
1047 | - }); |
1048 | - suspend.activate.connect (() => { |
1049 | - try { LightDM.suspend (); } catch (Error e) { warning (e.message); } |
1050 | - }); |
1051 | - restart.activate.connect (() => { |
1052 | - try { LightDM.restart (); } catch (Error e) { warning (e.message); } |
1053 | - }); |
1054 | - hibernate.activate.connect (() => { |
1055 | - try { LightDM.hibernate (); } catch (Error e) { warning (e.message); } |
1056 | - }); |
1057 | - } |
1058 | - |
1059 | -} |
1060 | \ No newline at end of file |
1061 | |
1062 | === added file 'src/Indicators/StyleClass.vala' |
1063 | --- src/Indicators/StyleClass.vala 1970-01-01 00:00:00 +0000 |
1064 | +++ src/Indicators/StyleClass.vala 2015-08-03 22:34:06 +0000 |
1065 | @@ -0,0 +1,25 @@ |
1066 | +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
1067 | +/*** |
1068 | + BEGIN LICENSE |
1069 | + |
1070 | + Copyright (C) 2011-2015 elementary Developers |
1071 | + |
1072 | + This program is free software: you can redistribute it and/or modify it |
1073 | + under the terms of the GNU Lesser General Public License version 3, as published |
1074 | + by the Free Software Foundation. |
1075 | + |
1076 | + This program is distributed in the hope that it will be useful, but |
1077 | + WITHOUT ANY WARRANTY; without even the implied warranties of |
1078 | + MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1079 | + PURPOSE. See the GNU General Public License for more details. |
1080 | + |
1081 | + You should have received a copy of the GNU General Public License along |
1082 | + with this program. If not, see <http://www.gnu.org/licenses/> |
1083 | + |
1084 | + END LICENSE |
1085 | +***/ |
1086 | + |
1087 | +namespace Indicators.StyleClass { |
1088 | + public const string PANEL = "panel"; |
1089 | + public const string COMPOSITED_INDICATOR = "composited-indicator"; |
1090 | +} |
1091 | |
1092 | === modified file 'src/PantheonGreeter.vala' |
1093 | --- src/PantheonGreeter.vala 2015-04-23 06:09:09 +0000 |
1094 | +++ src/PantheonGreeter.vala 2015-08-03 22:34:06 +0000 |
1095 | @@ -18,6 +18,7 @@ |
1096 | |
1097 | END LICENSE |
1098 | ***/ |
1099 | + |
1100 | public class PantheonGreeter : Gtk.Window { |
1101 | |
1102 | public static LoginGateway login_gateway { get; private set; } |
1103 | @@ -29,7 +30,7 @@ |
1104 | UserList userlist; |
1105 | |
1106 | TimeLabel time; |
1107 | - Indicators indicators; |
1108 | + Indicators.IndicatorBar indicator_bar; |
1109 | Wallpaper wallpaper; |
1110 | |
1111 | int timeout; |
1112 | @@ -122,9 +123,9 @@ |
1113 | userlist_actor = new UserListActor (userlist); |
1114 | |
1115 | time = new TimeLabel (); |
1116 | - if (!TEST_MODE) { |
1117 | - indicators = new Indicators (settings); |
1118 | - } |
1119 | + |
1120 | + indicator_bar = new Indicators.IndicatorBar (); |
1121 | + |
1122 | wallpaper = new Wallpaper (); |
1123 | |
1124 | message ("Connecting signals..."); |
1125 | @@ -149,9 +150,6 @@ |
1126 | |
1127 | userlist.current_user_changed.connect ((user) => { |
1128 | wallpaper.set_wallpaper (user.background); |
1129 | - if (!TEST_MODE) { |
1130 | - indicators.keyboard_menu.user_changed_cb (user); |
1131 | - } |
1132 | }); |
1133 | |
1134 | /*activate the numlock if needed*/ |
1135 | @@ -192,9 +190,7 @@ |
1136 | greeterbox.add_child (wallpaper); |
1137 | greeterbox.add_child (time); |
1138 | greeterbox.add_child (userlist_actor); |
1139 | - if (!TEST_MODE) { |
1140 | - greeterbox.add_child (indicators); |
1141 | - } |
1142 | + greeterbox.add_child (indicator_bar); |
1143 | |
1144 | greeterbox.opacity = 0; |
1145 | |
1146 | @@ -203,8 +199,7 @@ |
1147 | greeterbox.add_constraint (new Clutter.BindConstraint (stage, Clutter.BindCoordinate.WIDTH, 0)); |
1148 | greeterbox.add_constraint (new Clutter.BindConstraint (stage, Clutter.BindCoordinate.HEIGHT, 0)); |
1149 | |
1150 | - if (!TEST_MODE) |
1151 | - indicators.add_constraint (new Clutter.BindConstraint (greeterbox, Clutter.BindCoordinate.WIDTH, 0)); |
1152 | + indicator_bar.add_constraint (new Clutter.BindConstraint (greeterbox, Clutter.BindCoordinate.WIDTH, 0)); |
1153 | |
1154 | clutter.key_press_event.connect (keyboard_navigation); |
1155 | |
1156 | @@ -266,7 +261,7 @@ |
1157 | var anim = fade_out_actor (time); |
1158 | fade_out_actor (userlist_actor); |
1159 | if (!TEST_MODE) |
1160 | - fade_out_actor (indicators); |
1161 | + fade_out_actor (indicator_bar); |
1162 | |
1163 | anim.completed.connect (() => { |
1164 | login_gateway.start_session (); |
1165 | |
1166 | === removed file 'vapi/indicator-0.4.vapi' |
1167 | --- vapi/indicator-0.4.vapi 2012-11-26 20:14:01 +0000 |
1168 | +++ vapi/indicator-0.4.vapi 1970-01-01 00:00:00 +0000 |
1169 | @@ -1,175 +0,0 @@ |
1170 | -/* indicator-0.4.vapi generated by vapigen, do not modify. */ |
1171 | - |
1172 | -namespace Indicator { |
1173 | - [CCode (cheader_filename = "libindicator/indicator-desktop-shortcuts.h", type_check_function = "INDICATOR_IS_DESKTOP_SHORTCUTS", type_id = "indicator_desktop_shortcuts_get_type")] |
1174 | - public class DesktopShortcuts : GLib.Object { |
1175 | - [CCode (has_construct_function = false)] |
1176 | - public DesktopShortcuts (string file, string identity); |
1177 | - public unowned string get_nicks (); |
1178 | - public bool nick_exec (string nick); |
1179 | - public unowned string nick_get_name (string nick); |
1180 | - public string desktop_file { construct; } |
1181 | - [NoAccessorMethod] |
1182 | - public string identity { owned get; construct; } |
1183 | - } |
1184 | - [CCode (cheader_filename = "libindicator/indicator-object.h", type_check_function = "INDICATOR_IS_OBJECT", type_id = "indicator_object_get_type")] |
1185 | - public class Object : GLib.Object { |
1186 | - [CCode (has_construct_function = false)] |
1187 | - protected Object (); |
1188 | - public bool check_environment (string env); |
1189 | - [NoWrapper] |
1190 | - public virtual void entry_activate (Indicator.ObjectEntry entry, uint timestamp); |
1191 | - [NoWrapper] |
1192 | - public virtual void entry_activate_window (Indicator.ObjectEntry entry, uint windowid, uint timestamp); |
1193 | - [NoWrapper] |
1194 | - public virtual void entry_being_removed (Indicator.ObjectEntry entry); |
1195 | - [NoWrapper] |
1196 | - public virtual void entry_close (Indicator.ObjectEntry entry, uint timestamp); |
1197 | - [NoWrapper] |
1198 | - public virtual void entry_was_added (Indicator.ObjectEntry entry); |
1199 | - [CCode (has_construct_function = false)] |
1200 | - public Object.from_file (string file); |
1201 | - [NoWrapper] |
1202 | - public virtual unowned string get_accessible_desc (); |
1203 | - public virtual GLib.List<weak Indicator.ObjectEntry> get_entries (); |
1204 | - public unowned string[] get_environment (); |
1205 | - [NoWrapper] |
1206 | - public virtual unowned Gtk.Image get_image (); |
1207 | - [NoWrapper] |
1208 | - public virtual unowned Gtk.Label get_label (); |
1209 | - public virtual uint get_location (Indicator.ObjectEntry entry); |
1210 | - [NoWrapper] |
1211 | - public virtual unowned Gtk.Menu get_menu (); |
1212 | - [NoWrapper] |
1213 | - public virtual unowned string get_name_hint (); |
1214 | - public virtual bool get_show_now (Indicator.ObjectEntry entry); |
1215 | - [NoWrapper] |
1216 | - public virtual void reserved1 (); |
1217 | - [NoWrapper] |
1218 | - public virtual void reserved2 (); |
1219 | - [NoWrapper] |
1220 | - public virtual void reserved3 (); |
1221 | - [NoWrapper] |
1222 | - public virtual void reserved4 (); |
1223 | - [NoWrapper] |
1224 | - public virtual void reserved5 (); |
1225 | - public void set_environment (string[] env); |
1226 | - public void set_visible (bool visible); |
1227 | - [NoAccessorMethod] |
1228 | - public bool indicator_object_default_visibility { get; set; } |
1229 | - public virtual signal void accessible_desc_update (Indicator.ObjectEntry entry); |
1230 | - public virtual signal void entry_added (Indicator.ObjectEntry entry); |
1231 | - public virtual signal void entry_moved (Indicator.ObjectEntry entry, uint old_pos, uint new_pos); |
1232 | - public virtual signal void entry_removed (Indicator.ObjectEntry entry); |
1233 | - public virtual signal void entry_scrolled (Indicator.ObjectEntry entry, uint delta, Indicator.ScrollDirection direction); |
1234 | - public virtual signal void menu_show (Indicator.ObjectEntry entry, uint timestamp); |
1235 | - public virtual signal void secondary_activate (Indicator.ObjectEntry entry, uint timestamp); |
1236 | - public virtual signal void show_now_changed (Indicator.ObjectEntry entry, bool show_now_state); |
1237 | - } |
1238 | - [CCode (cheader_filename = "libindicator/indicator-object.h")] |
1239 | - [Compact] |
1240 | - public class ObjectEntry { |
1241 | - public weak string accessible_desc; |
1242 | - public weak Gtk.Image image; |
1243 | - public weak Gtk.Label label; |
1244 | - public weak Gtk.Menu menu; |
1245 | - public weak string name_hint; |
1246 | - public weak Indicator.Object parent_object; |
1247 | - public weak GLib.Callback reserved1; |
1248 | - public weak GLib.Callback reserved2; |
1249 | - public weak GLib.Callback reserved3; |
1250 | - public weak GLib.Callback reserved4; |
1251 | - public static void activate (Indicator.Object io, Indicator.ObjectEntry entry, uint timestamp); |
1252 | - public static void activate_window (Indicator.Object io, Indicator.ObjectEntry entry, uint windowid, uint timestamp); |
1253 | - public static void close (Indicator.Object io, Indicator.ObjectEntry entry, uint timestamp); |
1254 | - } |
1255 | - [CCode (cheader_filename = "libindicator/indicator-service.h", type_check_function = "INDICATOR_IS_SERVICE", type_id = "indicator_service_get_type")] |
1256 | - public class Service : GLib.Object { |
1257 | - [CCode (has_construct_function = false)] |
1258 | - public Service (string name); |
1259 | - [NoWrapper] |
1260 | - public virtual void indicator_service_reserved1 (); |
1261 | - [NoWrapper] |
1262 | - public virtual void indicator_service_reserved2 (); |
1263 | - [NoWrapper] |
1264 | - public virtual void indicator_service_reserved3 (); |
1265 | - [NoWrapper] |
1266 | - public virtual void indicator_service_reserved4 (); |
1267 | - [CCode (cname = "indicator_service_new_version", has_construct_function = false)] |
1268 | - public Service.with_version (string name, uint version); |
1269 | - [NoAccessorMethod] |
1270 | - public string name { owned get; set; } |
1271 | - [NoAccessorMethod] |
1272 | - public uint version { get; set; } |
1273 | - public virtual signal void shutdown (); |
1274 | - } |
1275 | - [CCode (cheader_filename = "libindicator/indicator-service-manager.h", type_check_function = "INDICATOR_IS_SERVICE_MANAGER", type_id = "indicator_service_manager_get_type")] |
1276 | - public class ServiceManager : GLib.Object { |
1277 | - [CCode (has_construct_function = false)] |
1278 | - public ServiceManager (string dbus_name); |
1279 | - public bool connected (); |
1280 | - [NoWrapper] |
1281 | - public virtual void indicator_service_manager_reserved1 (); |
1282 | - [NoWrapper] |
1283 | - public virtual void indicator_service_manager_reserved2 (); |
1284 | - [NoWrapper] |
1285 | - public virtual void indicator_service_manager_reserved3 (); |
1286 | - [NoWrapper] |
1287 | - public virtual void indicator_service_manager_reserved4 (); |
1288 | - public void set_refresh (uint time_in_ms); |
1289 | - [CCode (cname = "indicator_service_manager_new_version", has_construct_function = false)] |
1290 | - public ServiceManager.with_version (string dbus_name, uint version); |
1291 | - [NoAccessorMethod] |
1292 | - public string name { owned get; set; } |
1293 | - [NoAccessorMethod] |
1294 | - public uint version { get; set; } |
1295 | - public virtual signal void connection_change (bool connected); |
1296 | - } |
1297 | - [CCode (cheader_filename = "libindicator/indicator-object.h", cprefix = "INDICATOR_OBJECT_SCROLL_", has_type_id = false)] |
1298 | - public enum ScrollDirection { |
1299 | - UP, |
1300 | - DOWN, |
1301 | - LEFT, |
1302 | - RIGHT |
1303 | - } |
1304 | - [CCode (cheader_filename = "libindicator/indicator.h", has_target = false)] |
1305 | - public delegate GLib.Type get_type_t (); |
1306 | - [CCode (cheader_filename = "libindicator/indicator.h", has_target = false)] |
1307 | - public delegate unowned string get_version_t (); |
1308 | - [CCode (cheader_filename = "libindicator/indicator.h")] |
1309 | - public const string GET_TYPE_S; |
1310 | - [CCode (cheader_filename = "libindicator/indicator.h")] |
1311 | - public const string GET_VERSION_S; |
1312 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1313 | - public const string OBJECT_DEFAULT_VISIBILITY; |
1314 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1315 | - public const string OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE; |
1316 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1317 | - public const string OBJECT_SIGNAL_ENTRY_ADDED; |
1318 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1319 | - public const string OBJECT_SIGNAL_ENTRY_MOVED; |
1320 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1321 | - public const string OBJECT_SIGNAL_ENTRY_REMOVED; |
1322 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1323 | - public const string OBJECT_SIGNAL_ENTRY_SCROLLED; |
1324 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1325 | - public const string OBJECT_SIGNAL_MENU_SHOW; |
1326 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1327 | - public const string OBJECT_SIGNAL_SECONDARY_ACTIVATE; |
1328 | - [CCode (cheader_filename = "libindicator/indicator-gobject.h")] |
1329 | - public const string OBJECT_SIGNAL_SHOW_NOW_CHANGED; |
1330 | - [CCode (cheader_filename = "libindicator/indicator-service-manager.h")] |
1331 | - public const string SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE; |
1332 | - [CCode (cheader_filename = "libindicator/indicator-service.h")] |
1333 | - public const string SERVICE_SIGNAL_SHUTDOWN; |
1334 | - [CCode (cheader_filename = "libindicator/indicator.h")] |
1335 | - public const int SET_VERSION; |
1336 | - [CCode (cheader_filename = "libindicator/indicator.h")] |
1337 | - public const string VERSION; |
1338 | - [CCode (cheader_filename = "libindicator/indicator.h", cname = "get_version")] |
1339 | - public static unowned string get_version (); |
1340 | - [CCode (cheader_filename = "libindicator/indicator-image-helper.h")] |
1341 | - public static unowned Gtk.Image image_helper (string name); |
1342 | - [CCode (cheader_filename = "libindicator/indicator-image-helper.h")] |
1343 | - public static void image_helper_update (Gtk.Image image, string name); |
1344 | -} |
1345 | \ No newline at end of file |
Looks and works pretty good! Just one nitpic: We've changed to using braces even if there's only one line of code on if blocks: https:/ /elementary. io/docs/ code/reference# indentation