Merge lp:~elementary-pantheon/wingpanel/background-opacity-gala into lp:~elementary-pantheon/wingpanel/old-trunk

Proposed by Tom Beckmann
Status: Superseded
Proposed branch: lp:~elementary-pantheon/wingpanel/background-opacity-gala
Merge into: lp:~elementary-pantheon/wingpanel/old-trunk
Diff against target: 1076 lines (+449/-267) (has conflicts)
14 files modified
CMakeLists.txt (+31/-3)
org.pantheon.desktop.wingpanel.gschema.xml (+11/-1)
src/Indicator/IndicatorFactory.vala (+72/-16)
src/Indicator/IndicatorFileModel.vala (+0/-94)
src/Indicator/IndicatorObject.vala (+7/-7)
src/Indicator/IndicatorObjectEntry.vala (+7/-30)
src/Services/BackgroundManager.vala (+110/-0)
src/Services/IndicatorSorter.vala (+8/-1)
src/Services/Settings.vala (+2/-0)
src/Widgets/BasePanel.vala (+102/-2)
src/Widgets/Panel.vala (+19/-3)
src/WingpanelApp.vala (+54/-56)
vapi/indicator3-0.4.vapi (+22/-54)
vapi/libido3-0.1.vapi (+4/-0)
Text conflict in CMakeLists.txt
Text conflict in vapi/indicator3-0.4.vapi
To merge this branch: bzr merge lp:~elementary-pantheon/wingpanel/background-opacity-gala
Reviewer Review Type Date Requested Status
elementary UX Pending
Review via email: mp+210083@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-11.

Description of the change

This is a new version of the branch written by Jacob Parker, which uses the proposed gala dbus API to get the alpha value of the background. It also adds a transition when changing alpha and uses wnck to check for maximized windows on the current screen as requested in https://bugs.launchpad.net/wingpanel/+bug/1011830.

We may want to consider checking the area which is filled with windows instead of just if there's a maximized one, but that's up to the designers to decide.

To post a comment you must log in.
Revision history for this message
Victor Martinez (victored) wrote :

is lp:wingpanel intentionally the target branch?

(instead of lp:wingpanel/0.3.x, which would make the diff much smaller)

157. By Tom Beckmann

use 0.3 as min alpha value, go fully opaque when there is a maximized window

158. By Victor Martinez

Fix null Settings instance in BasePanel and correct coding style issues

159. By Victor Martinez

replace tabs by four spaces

Unmerged revisions

159. By Victor Martinez

replace tabs by four spaces

158. By Victor Martinez

Fix null Settings instance in BasePanel and correct coding style issues

157. By Tom Beckmann

use 0.3 as min alpha value, go fully opaque when there is a maximized window

156. By Tom Beckmann

make use of gala's dbus to get the alpha value, animate alpha, use wnck to look for maximized windows and adjust alpha accordingly

155. By Jacob Parker

Redone straight from 0.3.x

154. By Rico Tzschichholz

vapi: Update indicator3-0.4 bindings

153. By Victor Martinez

Support newer valac versions (>= 0.16)

- Remove duplicate code from IndicatorFileModel.vala and move it to IndicatorFactory.vala to avoid copying data structures
- Update WingpanelApp.vala to make proper use of GLib.Application.startup and GLib.Application.activate
- Update respective license formats
- CMake corrections

152. By David Gomes

Fixed code style.

151. By Tom Beckmann

replace tabs with spaces, adding credit here: indicator vapi is from unity-greeter

150. By Tom Beckmann

add support for the new indicator files

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 2014-01-24 17:27:31 +0000
3+++ CMakeLists.txt 2014-03-09 12:44:07 +0000
4@@ -1,6 +1,6 @@
5 # Check http://webdev.elementaryos.org/docs/developer-guide/cmake for documentation
6
7-project (wingpanel)
8+project (wingpanel C)
9 cmake_minimum_required (VERSION 2.8)
10 cmake_policy (VERSION 2.8)
11
12@@ -33,8 +33,29 @@
13 add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
14
15 # Set dependencies
16+<<<<<<< TREE
17 set (WINGPANEL_DEPS "gobject-2.0;glib-2.0;gio-2.0;gee-0.8;gdk-x11-3.0;x11;gtk+-3.0;granite")
18 set (WINGPANEL_DEPS_NOVALA "gthread-2.0;indicator3-0.4")
19+=======
20+set (WINGPANEL_DEPS
21+ gobject-2.0
22+ glib-2.0
23+ gio-2.0
24+ gee-0.8
25+ gdk-x11-3.0
26+ x11
27+ gtk+-3.0
28+ granite
29+ indicator3-0.4
30+ libido3-0.1
31+ libwnck-3.0
32+)
33+
34+set (WINGPANEL_DEPS_NOVALA
35+ gthread-2.0
36+)
37+
38+>>>>>>> MERGE-SOURCE
39 find_package (PkgConfig)
40 pkg_check_modules (DEPS REQUIRED ${WINGPANEL_DEPS})
41 pkg_check_modules (DEPS_NOVALA REQUIRED ${WINGPANEL_DEPS_NOVALA})
42@@ -57,6 +78,8 @@
43 link_libraries(${DEPS_LIBRARIES} ${DEPS_NOVALA_LIBRARIES})
44 link_directories(${DEPS_LIBRARY_DIRS} ${DEPS_NOVALA_DIRS})
45
46+add_definitions (-DWNCK_I_KNOW_THIS_IS_UNSTABLE)
47+
48 # Handle Vala Compilation
49 find_package(Vala REQUIRED)
50 include(ValaVersion)
51@@ -69,7 +92,6 @@
52 src/IndicatorIface.vala
53 src/IndicatorLoader.vala
54
55- src/Indicator/IndicatorFileModel.vala
56 src/Indicator/IndicatorObjectEntry.vala
57 src/Indicator/IndicatorObject.vala
58 src/Indicator/IndicatorFactory.vala
59@@ -87,14 +109,19 @@
60 src/Services/AppLauncherService.vala
61 src/Services/LauncherRunner.vala
62 src/Services/IndicatorSorter.vala
63+ src/Services/BackgroundManager.vala
64 PACKAGES
65 ${WINGPANEL_DEPS}
66 CUSTOM_VAPIS
67 vapi/config.vapi
68- vapi/indicator-0.4.vapi
69 OPTIONS
70+ -g
71 --thread
72+<<<<<<< TREE
73 -g
74+=======
75+ --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/
76+>>>>>>> MERGE-SOURCE
77 )
78
79 # Settings Schema
80@@ -106,6 +133,7 @@
81
82 # Create the Executable
83 add_executable(${EXEC_NAME} ${VALA_C})
84+target_link_libraries(${EXEC_NAME} m)
85
86 # Installation
87 install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin)
88
89=== modified file 'org.pantheon.desktop.wingpanel.gschema.xml'
90--- org.pantheon.desktop.wingpanel.gschema.xml 2012-07-08 03:02:36 +0000
91+++ org.pantheon.desktop.wingpanel.gschema.xml 2014-03-09 12:44:07 +0000
92@@ -13,7 +13,17 @@
93 <key type="s" name="default-launcher">
94 <default>"slingshot-launcher"</default>
95 <summary>The default program to use as App launcher.</summary>
96- <description>Description</description>
97+ <description>The default program to use as App launcher.</description>
98+ </key>
99+ <key type="d" name="background-alpha">
100+ <default>0.8</default>
101+ <summary>Background opacity variable.</summary>
102+ <description>Background opacity variable (must be between zero and one).</description>
103+ </key>
104+ <key type="b" name="auto-adjust-alpha">
105+ <default>true</default>
106+ <summary>Automatically update background alpha.</summary>
107+ <description>Automatically update the background alpha to zero if it will be readable, else 0.8.</description>
108 </key>
109 </schema>
110 </schemalist>
111
112=== modified file 'src/Indicator/IndicatorFactory.vala'
113--- src/Indicator/IndicatorFactory.vala 2013-04-14 17:37:10 +0000
114+++ src/Indicator/IndicatorFactory.vala 2014-03-09 12:44:07 +0000
115@@ -1,45 +1,101 @@
116 // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
117-//
118+//
119 // Copyright (C) 2013 Wingpanel Developers
120-//
121+//
122 // This program is free software: you can redistribute it and/or modify
123 // it under the terms of the GNU General Public License as published by
124 // the Free Software Foundation, either version 3 of the License, or
125 // (at your option) any later version.
126-//
127+//
128 // This program is distributed in the hope that it will be useful,
129 // but WITHOUT ANY WARRANTY; without even the implied warranty of
130 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131 // GNU General Public License for more details.
132-//
133+//
134 // You should have received a copy of the GNU General Public License
135 // along with this program. If not, see <http://www.gnu.org/licenses/>.
136
137 public class Wingpanel.Backend.IndicatorFactory : Object, IndicatorLoader {
138- private IndicatorFileModel model;
139 private Gee.Collection<IndicatorIface> indicators;
140- private bool initted = false;
141+ private string[] settings_blacklist;
142
143- public IndicatorFactory (Services.Settings settings) {
144- model = new IndicatorFileModel (settings);
145+ public IndicatorFactory (string[] settings_blacklist) {
146+ this.settings_blacklist = settings_blacklist;
147 }
148
149 public Gee.Collection<IndicatorIface> get_indicators () {
150- if (!initted) {
151+ if (indicators == null) {
152+ indicators = new Gee.LinkedList<IndicatorIface> ();
153 load_indicators ();
154- initted = true;
155 }
156
157 return indicators.read_only_view;
158 }
159
160 private void load_indicators () {
161- indicators = new Gee.LinkedList<IndicatorIface> ();
162- var indicators_list = model.get_indicators ();
163-
164- foreach (var indicator in indicators_list) {
165- string name = model.get_indicator_name (indicator);
166- indicators.add (new IndicatorObject (indicator, name));
167+ // Fetch list of indicators that should not be loaded
168+ string skip_list = Environment.get_variable ("UNITY_PANEL_INDICATORS_SKIP") ?? "";
169+
170+ if (skip_list == "all") {
171+ warning ("Skipping all indicator loading");
172+ return;
173+ }
174+
175+ foreach (string blocked_indicator in settings_blacklist)
176+ skip_list += "," + blocked_indicator;
177+
178+ debug ("Blacklisted Indicators: %s", skip_list);
179+
180+ // Legacy indicator libraries
181+ load_indicators_from_dir (Build.INDICATORDIR, true, skip_list);
182+
183+ // Ng indicators
184+ load_indicators_from_dir ("/usr/share/unity/indicators", false, skip_list);
185+ }
186+
187+ private void load_indicators_from_dir (string dir_path, bool legacy_libs_only, string skip_list) {
188+ try {
189+ var dir = File.new_for_path (dir_path);
190+ var enumerator = dir.enumerate_children (FileAttribute.STANDARD_NAME,
191+ FileQueryInfoFlags.NONE, null);
192+ FileInfo file_info;
193+
194+ while ((file_info = enumerator.next_file (null)) != null) {
195+ string name = file_info.get_name ();
196+
197+ if (name in skip_list)
198+ continue;
199+
200+ load_indicator (dir, legacy_libs_only, name);
201+ }
202+ } catch (Error err) {
203+ warning ("Unable to read indicators: %s", err.message);
204+ }
205+ }
206+
207+ private void load_indicator (File parent_dir, bool legacy_lib, string name) {
208+ string indicator_path = parent_dir.get_child (name).get_path ();
209+
210+ try {
211+ Indicator.Object indicator = null;
212+
213+ if (legacy_lib) {
214+ if (!name.has_suffix (".so"))
215+ return;
216+
217+ debug ("Loading Indicator Library: %s", name);
218+ indicator = new Indicator.Object.from_file (indicator_path);
219+ } else {
220+ debug ("Loading Indicator File: %s", name);
221+ indicator = new Indicator.Ng.for_profile (indicator_path, "desktop");
222+ }
223+
224+ if (indicator != null)
225+ indicators.add (new IndicatorObject (indicator, name));
226+ else
227+ critical ("Unable to load %s: invalid object.", name);
228+ } catch (Error err) {
229+ warning ("Could not load indicator at %s: %s", indicator_path, err.message);
230 }
231 }
232 }
233
234=== removed file 'src/Indicator/IndicatorFileModel.vala'
235--- src/Indicator/IndicatorFileModel.vala 2013-04-14 17:31:20 +0000
236+++ src/Indicator/IndicatorFileModel.vala 1970-01-01 00:00:00 +0000
237@@ -1,94 +0,0 @@
238-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
239-/***
240- BEGIN LICENSE
241-
242- Copyright (C) 2010-2012 Canonical Ltd
243- This program is free software: you can redistribute it and/or modify it
244- under the terms of the GNU Lesser General Public License version 3, as published
245- by the Free Software Foundation.
246-
247- This program is distributed in the hope that it will be useful, but
248- WITHOUT ANY WARRANTY; without even the implied warranties of
249- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
250- PURPOSE. See the GNU General Public License for more details.
251-
252- You should have received a copy of the GNU General Public License along
253- with this program. If not, see <http://www.gnu.org/licenses/>
254-
255- END LICENSE
256-
257- Authored by canonical.com
258-***/
259-
260-namespace Wingpanel.Backend {
261-
262- public class IndicatorFileModel {
263- private Gee.HashMap<Indicator.Object, string> indicator_map;
264-
265- public IndicatorFileModel (Services.Settings settings) {
266- indicator_map = new Gee.HashMap<Indicator.Object, string> ();
267-
268- // Indicators we don't want to load
269- string skip_list = Environment.get_variable ("UNITY_PANEL_INDICATORS_SKIP") ?? "";
270-
271- if (skip_list == "all") {
272- warning ("Skipping all indicator loading");
273- return;
274- }
275-
276- foreach (string blocked_indicator in settings.blacklist) {
277- skip_list += "," + blocked_indicator;
278- debug ("Blacklisting %s", blocked_indicator);
279- }
280-
281- debug ("Blacklisted Indicators: %s", skip_list);
282-
283- var indicators_to_load = new Gee.ArrayList<string> ();
284- var dir = File.new_for_path (Build.INDICATORDIR);
285- debug ("Indicator Directory: %s", dir.get_path ());
286-
287- try {
288- var enumerator = dir.enumerate_children (FileAttribute.STANDARD_NAME,
289- FileQueryInfoFlags.NONE, null);
290-
291- FileInfo file_info;
292-
293- while ((file_info = enumerator.next_file (null)) != null) {
294- string leaf = file_info.get_name ();
295-
296- if (leaf in skip_list) {
297- warning ("SKIP LOADING: %s", leaf);
298- continue;
299- }
300-
301- if (leaf.has_suffix (".so"))
302- indicators_to_load.add (leaf);
303- }
304- } catch (Error err) {
305- error ("Unable to read indicators: %s", err.message);
306- }
307-
308- foreach (string leaf in indicators_to_load)
309- load_indicator (dir.get_child (leaf).get_path (), leaf);
310- }
311-
312- public Gee.Collection<Indicator.Object> get_indicators () {
313- return indicator_map.keys;
314- }
315-
316- public string get_indicator_name (Indicator.Object indicator) {
317- return indicator_map.get (indicator);
318- }
319-
320- private void load_indicator (string filename, string leaf) {
321- debug ("LOADING: %s", leaf);
322-
323- var indicator = new Indicator.Object.from_file (filename);
324-
325- if (indicator is Indicator.Object)
326- indicator_map.set (indicator, leaf);
327- else
328- critical ("Unable to load %s", filename);
329- }
330- }
331-}
332
333=== modified file 'src/Indicator/IndicatorObject.vala'
334--- src/Indicator/IndicatorObject.vala 2013-04-14 17:39:47 +0000
335+++ src/Indicator/IndicatorObject.vala 2014-03-09 12:44:07 +0000
336@@ -1,17 +1,17 @@
337 // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
338-//
339+//
340 // Copyright (C) 2013 Wingpanel Developers
341-//
342+//
343 // This program is free software: you can redistribute it and/or modify
344 // it under the terms of the GNU General Public License as published by
345 // the Free Software Foundation, either version 3 of the License, or
346 // (at your option) any later version.
347-//
348+//
349 // This program is distributed in the hope that it will be useful,
350 // but WITHOUT ANY WARRANTY; without even the implied warranty of
351 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352 // GNU General Public License for more details.
353-//
354+//
355 // You should have received a copy of the GNU General Public License
356 // along with this program. If not, see <http://www.gnu.org/licenses/>.
357
358@@ -63,14 +63,14 @@
359
360 private void on_entry_removed (Indicator.Object object, Indicator.ObjectEntry entry) {
361 assert (this.object == object);
362-
363+
364 var entry_widget = entries.get (entry);
365 entries.unset (entry);
366-
367+
368 entry_removed (entry_widget);
369 }
370
371 private IndicatorWidget create_entry (Indicator.ObjectEntry entry) {
372- return new IndicatorObjectEntry (entry, this);
373+ return new IndicatorObjectEntry (entry, object, this);
374 }
375 }
376
377=== modified file 'src/Indicator/IndicatorObjectEntry.vala'
378--- src/Indicator/IndicatorObjectEntry.vala 2013-08-25 14:47:58 +0000
379+++ src/Indicator/IndicatorObjectEntry.vala 2014-03-09 12:44:07 +0000
380@@ -18,10 +18,11 @@
381 END LICENSE
382 ***/
383
384-namespace Wingpanel.Backend
385-{
386+namespace Wingpanel.Backend {
387+
388 public class IndicatorObjectEntry: Widgets.IndicatorButton, IndicatorWidget {
389 private unowned Indicator.ObjectEntry entry;
390+ private unowned Indicator.Object parent_object;
391 private IndicatorIface indicator;
392
393 // used for drawing
394@@ -37,17 +38,18 @@
395 .menu {
396 background-color:@transparent;
397 border-color:@transparent;
398- -unico-inner-stroke-width: 0;
399 background-image:none;
400+ border-width:0;
401 }
402 .popover_bg {
403 background-color:#fff;
404 }
405 """;
406
407- public IndicatorObjectEntry (Indicator.ObjectEntry entry, IndicatorIface indicator) {
408+ public IndicatorObjectEntry (Indicator.ObjectEntry entry, Indicator.Object obj, IndicatorIface indicator) {
409 this.entry = entry;
410 this.indicator = indicator;
411+ parent_object = obj;
412
413 var image = entry.image;
414 if (image != null && image is Gtk.Image)
415@@ -218,32 +220,7 @@
416 }
417
418 public override bool scroll_event (Gdk.EventScroll event) {
419- var direction = Indicator.ScrollDirection.UP;
420- double delta = 0;
421-
422- switch (event.direction) {
423- case Gdk.ScrollDirection.UP:
424- delta = event.delta_y;
425- direction = Indicator.ScrollDirection.UP;
426- break;
427- case Gdk.ScrollDirection.DOWN:
428- delta = event.delta_y;
429- direction = Indicator.ScrollDirection.DOWN;
430- break;
431- case Gdk.ScrollDirection.LEFT:
432- delta = event.delta_x;
433- direction = Indicator.ScrollDirection.LEFT;
434- break;
435- case Gdk.ScrollDirection.RIGHT:
436- delta = event.delta_x;
437- direction = Indicator.ScrollDirection.RIGHT;
438- break;
439- default:
440- break;
441- }
442-
443- entry.parent_object.entry_scrolled (entry, (uint) delta, direction);
444-
445+ parent_object.entry_scrolled (entry, 1, (Indicator.ScrollDirection) event.direction);
446 return false;
447 }
448 }
449
450=== added file 'src/Services/BackgroundManager.vala'
451--- src/Services/BackgroundManager.vala 1970-01-01 00:00:00 +0000
452+++ src/Services/BackgroundManager.vala 2014-03-09 12:44:07 +0000
453@@ -0,0 +1,110 @@
454+// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
455+//
456+// Copyright (C) 2013 Wingpanel Developers
457+//
458+// This program is free software: you can redistribute it and/or modify
459+// it under the terms of the GNU General Public License as published by
460+// the Free Software Foundation, either version 3 of the License, or
461+// (at your option) any later version.
462+//
463+// This program is distributed in the hope that it will be useful,
464+// but WITHOUT ANY WARRANTY; without even the implied warranty of
465+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
466+// GNU General Public License for more details.
467+//
468+// You should have received a copy of the GNU General Public License
469+// along with this program. If not, see <http://www.gnu.org/licenses/>.
470+
471+namespace Wingpanel.Services {
472+ struct ColorInformation
473+ {
474+ double average_red;
475+ double average_green;
476+ double average_blue;
477+ double mean;
478+ double variance;
479+ }
480+
481+ [DBus (name = "org.pantheon.gala")]
482+ interface GalaDBus : Object {
483+ public signal void background_changed ();
484+ public async abstract ColorInformation get_background_color_information (int monitor,
485+ int x, int y, int width, int height) throws IOError;
486+ }
487+
488+ public class BackgroundManager : Object {
489+ public static const double MIN_ALPHA = 0.7;
490+
491+ const int HEIGHT = 50;
492+ const double MIN_VARIANCE = 50;
493+ const double MIN_LUM = 25;
494+
495+ /**
496+ * Emitted when the background changed. It supplies the alpha value that
497+ * can be used with this wallpaper while maintining legibility
498+ */
499+ public signal void update_background_alpha (double legible_alpha_value);
500+
501+ public Services.Settings settings { get; construct set; }
502+ public Gdk.Screen screen { get; construct set; }
503+
504+ GalaDBus? gala_dbus = null;
505+
506+ public BackgroundManager (Services.Settings settings, Gdk.Screen screen) {
507+ Object (settings: settings, screen: screen);
508+ }
509+
510+ construct {
511+ try {
512+ gala_dbus = Bus.get_proxy_sync (BusType.SESSION, "org.pantheon.gala",
513+ "/org/pantheon/gala");
514+
515+ gala_dbus.background_changed.connect (background_changed);
516+
517+ background_changed ();
518+ } catch (Error e) {
519+ gala_dbus = null;
520+ warning ("Auto-adjustment of background opacity not available, " +
521+ "connecting to gala dbus failed: %s", e.message);
522+ }
523+ }
524+
525+ private void background_changed ()
526+ {
527+ if (settings.auto_adjust_alpha) {
528+ calculate_alpha.begin ((obj, res) => {
529+ var alpha = calculate_alpha.end (res);
530+ update_background_alpha (alpha);
531+ });
532+ }
533+ }
534+
535+ private async double calculate_alpha () {
536+ double alpha = 0;
537+ Gdk.Rectangle monitor_geometry;
538+ ColorInformation? color_info = null;
539+
540+ var primary = screen.get_primary_monitor ();
541+ screen.get_monitor_geometry (primary, out monitor_geometry);
542+
543+ try {
544+ color_info = yield gala_dbus.get_background_color_information (
545+ primary, // monitor index
546+ 0, // x of reference rect
547+ 0, // y of rect
548+ monitor_geometry.width, // width of rect
549+ HEIGHT); // height of rect
550+ } catch (Error e) {
551+ warning (e.message);
552+ alpha = MIN_ALPHA;
553+ }
554+
555+ if (color_info != null
556+ && (color_info.mean > MIN_LUM
557+ || color_info.variance > MIN_VARIANCE))
558+ alpha = MIN_ALPHA;
559+
560+ return alpha;
561+ }
562+ }
563+}
564
565=== modified file 'src/Services/IndicatorSorter.vala'
566--- src/Services/IndicatorSorter.vala 2013-04-14 10:19:10 +0000
567+++ src/Services/IndicatorSorter.vala 2014-03-09 12:44:07 +0000
568@@ -23,6 +23,7 @@
569 * be passed as CompareFuncs.
570 */
571 public class Wingpanel.Services.IndicatorSorter {
572+
573 private struct IndicatorOrderNode {
574 public string name; // name of indicator (library)
575 public string? entry_name; // name of entry (menu item)
576@@ -32,19 +33,25 @@
577 { "libapplication.so", null }, // indicator-application (App indicators)
578 { "libapplication.so", "keyboard" }, // Keyboard layout selector (old)
579 { "libapplication.so", "gsd-keyboard-xkb" }, // keyboard layout selector
580+ { "com.canonical.indicator.keyboard", null },
581 { "libsoundmenu.so", null }, // indicator-sound
582+ { "com.canonical.indicator.sound", null },
583 { "libnetwork.so", null }, // indicator-network
584 { "libnetworkmenu.so", null }, // indicator-network
585 { "libapplication.so", "nm-applet" }, // network manager
586 { "libbluetooth.so", null }, // indicator-bluetooth
587 { "libapplication.so", "bluetooth-manager" }, // indicator-gnome-bluetooth (old)
588+ { "com.canonical.indicator.bluetooth", null },
589 { "libprintersmenu.so", null }, // indicator-printers
590 { "libsyncindicator.so", null }, // indicator-sync
591 { "libpower.so", null }, // indicator-power
592+ { "com.canonical.indicator.power", null },
593 { "libmessaging.so", null }, // indicator-messages
594+ { "com.canonical.indicator.messages", null },
595 { "libsession.so", null }, // indicator-session
596 { "libsession.so", "indicator-session-users" }, // indicator-session
597- { "libsession.so", "indicator-session-devices" } // indicator-session
598+ { "libsession.so", "indicator-session-devices" },// indicator-session
599+ { "com.canonical.indicator.session", null }
600 };
601
602 public static int compare_func (IndicatorWidget? a, IndicatorWidget? b) {
603
604=== modified file 'src/Services/Settings.vala'
605--- src/Services/Settings.vala 2013-04-14 07:54:25 +0000
606+++ src/Services/Settings.vala 2014-03-09 12:44:07 +0000
607@@ -23,6 +23,8 @@
608 public string[] blacklist { get; set; }
609 public bool show_launcher { get; set; }
610 public string default_launcher { get; set; }
611+ public double background_alpha { get; set; }
612+ public bool auto_adjust_alpha { get; set; }
613
614 public Settings () {
615 base ("org.pantheon.desktop.wingpanel");
616
617=== modified file 'src/Widgets/BasePanel.vala'
618--- src/Widgets/BasePanel.vala 2013-08-07 10:18:24 +0000
619+++ src/Widgets/BasePanel.vala 2014-03-09 12:44:07 +0000
620@@ -41,7 +41,23 @@
621 private int panel_displacement = -40;
622 private uint animation_timer = 0;
623
624+ private double legible_alpha_value = -1.0;
625+ private double panel_alpha = 0.0;
626+ private double panel_current_alpha = 0.0;
627+ private uint panel_alpha_timer = 0;
628+ const int FPS = 60;
629+ const double ALPHA_ANIMATION_STEP = 0.05;
630+
631 private PanelShadow shadow = new PanelShadow ();
632+
633+ private Services.Settings _settings;
634+
635+ private Wnck.Screen wnck_screen;
636+
637+ public Services.Settings settings {
638+ get { return _settings; }
639+ set { _settings = value; }
640+ }
641
642 public BasePanel () {
643 decorated = false;
644@@ -58,6 +74,28 @@
645 screen.monitors_changed.connect (on_monitors_changed);
646
647 destroy.connect (Gtk.main_quit);
648+
649+ wnck_screen = Wnck.Screen.get_default ();
650+ wnck_screen.active_workspace_changed.connect (update_panel_alpha);
651+ wnck_screen.window_opened.connect ((window) => {
652+ if (window.get_window_type () == Wnck.WindowType.NORMAL)
653+ window.state_changed.connect (window_state_changed);
654+ });
655+ wnck_screen.window_closed.connect ((window) => {
656+ if (window.get_window_type () == Wnck.WindowType.NORMAL)
657+ window.state_changed.disconnect (window_state_changed);
658+ });
659+
660+ update_panel_alpha ();
661+ }
662+
663+ private void window_state_changed (Wnck.Window window,
664+ Wnck.WindowState changed_mask, Wnck.WindowState new_state) {
665+ if ((changed_mask & Wnck.WindowState.MAXIMIZED_HORIZONTALLY) != 0
666+ || (changed_mask & Wnck.WindowState.MAXIMIZED_VERTICALLY) != 0
667+ && (window.get_workspace () == wnck_screen.get_active_workspace ()
668+ || window.is_sticky ()))
669+ update_panel_alpha ();
670 }
671
672 protected abstract Gtk.StyleContext get_draw_style_context ();
673@@ -79,7 +117,11 @@
674 }
675
676 var ctx = get_draw_style_context ();
677- ctx.render_background (cr, size.x, size.y, size.width, size.height);
678+ var background_color = ctx.get_background_color (Gtk.StateFlags.NORMAL);
679+ background_color.alpha = panel_current_alpha;
680+ Gdk.cairo_set_source_rgba (cr, background_color);
681+ cr.rectangle (size.x, size.y, size.width, size.height);
682+ cr.fill ();
683
684 // Slide in
685 if (animation_timer == 0) {
686@@ -92,12 +134,57 @@
687 if (child != null)
688 propagate_draw (child, cr);
689
690- if (!shadow.visible)
691+ if (settings.background_alpha > 1E-3) {
692+ shadow.show ();
693 shadow.show_all ();
694+ } else
695+ shadow.hide ();
696
697 return true;
698 }
699
700+ public void update_opacity (double alpha) {
701+ legible_alpha_value = alpha;
702+ update_panel_alpha ();
703+ }
704+
705+ private void update_panel_alpha ()
706+ {
707+ panel_alpha = settings.background_alpha;
708+ if (!active_workspace_has_maximized_window ()
709+ && legible_alpha_value >= 0
710+ && settings.auto_adjust_alpha) {
711+ panel_alpha = legible_alpha_value;
712+ }
713+
714+ if (panel_current_alpha != panel_alpha) {
715+ panel_alpha_timer = Gdk.threads_add_timeout (1000 / FPS, draw_timeout);
716+ }
717+ }
718+
719+ private bool draw_timeout ()
720+ {
721+ queue_draw ();
722+
723+ if (panel_current_alpha > panel_alpha) {
724+ panel_current_alpha -= ALPHA_ANIMATION_STEP;
725+ panel_current_alpha = double.max (panel_current_alpha, panel_alpha);
726+ } else if (panel_current_alpha < panel_alpha) {
727+ panel_current_alpha += ALPHA_ANIMATION_STEP;
728+ panel_current_alpha = double.min (panel_current_alpha, panel_alpha);
729+ }
730+
731+ if (panel_current_alpha != panel_alpha)
732+ return true;
733+
734+ if (panel_alpha_timer > 0) {
735+ Source.remove (panel_alpha_timer);
736+ panel_alpha_timer = 0;
737+ }
738+
739+ return false;
740+ }
741+
742 private bool animation_callback () {
743 if (panel_displacement >= 0 ) {
744 return false;
745@@ -109,6 +196,19 @@
746 }
747 }
748
749+ private bool active_workspace_has_maximized_window ()
750+ {
751+ var workspace = wnck_screen.get_active_workspace ();
752+ foreach (var window in wnck_screen.get_windows ()) {
753+ if ((window.is_pinned () || window.get_workspace () == workspace)
754+ && window.is_maximized ()) {
755+ return true;
756+ }
757+ }
758+
759+ return false;
760+ }
761+
762 private void on_monitors_changed () {
763 panel_resize (true);
764 }
765
766=== modified file 'src/Widgets/Panel.vala'
767--- src/Widgets/Panel.vala 2013-04-14 07:54:25 +0000
768+++ src/Widgets/Panel.vala 2014-03-09 12:44:07 +0000
769@@ -31,8 +31,10 @@
770
771 private IndicatorLoader indicator_loader;
772
773- public Panel (WingpanelApp app, Services.Settings settings, IndicatorLoader indicator_loader) {
774- set_application (app as Gtk.Application);
775+ public Panel (Gtk.Application app, Services.Settings _settings, IndicatorLoader indicator_loader) {
776+ set_application (app);
777+
778+ settings = _settings;
779
780 this.indicator_loader = indicator_loader;
781
782@@ -77,7 +79,9 @@
783 }
784
785 private void create_entry (IndicatorWidget entry) {
786- if (entry.get_indicator ().get_name () == "libdatetime.so")
787+ string entry_name = entry.get_indicator ().get_name ();
788+
789+ if (entry_name == "libdatetime.so" || entry_name == "com.canonical.indicator.datetime")
790 clock.prepend (entry);
791 else
792 menubar.insert_sorted (entry);
793@@ -110,6 +114,18 @@
794 var gpr = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
795 gpr.add_widget (left_wrapper);
796 gpr.add_widget (right_wrapper);
797+
798+ // make sure those are all transparent when we later adjust the transparency
799+ // in the panel's draw callback
800+ clock.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
801+ red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
802+ });
803+ menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
804+ red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
805+ });
806+ apps_menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
807+ red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
808+ });
809 }
810 }
811 }
812
813=== modified file 'src/WingpanelApp.vala'
814--- src/WingpanelApp.vala 2013-04-14 07:54:25 +0000
815+++ src/WingpanelApp.vala 2014-03-09 12:44:07 +0000
816@@ -1,59 +1,57 @@
817 // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
818-/***
819- BEGIN LICENSE
820-
821- Copyright (C) 2011-2012 Wingpanel Developers
822- This program is free software: you can redistribute it and/or modify it
823- under the terms of the GNU Lesser General Public License version 3, as published
824- by the Free Software Foundation.
825-
826- This program is distributed in the hope that it will be useful, but
827- WITHOUT ANY WARRANTY; without even the implied warranties of
828- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
829- PURPOSE. See the GNU General Public License for more details.
830-
831- You should have received a copy of the GNU General Public License along
832- with this program. If not, see <http://www.gnu.org/licenses/>
833-
834- END LICENSE
835-***/
836-
837-namespace Wingpanel {
838-
839- public class WingpanelApp : Granite.Application {
840- private IndicatorLoader indicator_loader;
841- private Services.Settings settings;
842- private Widgets.BasePanel panel;
843-
844- construct {
845- build_data_dir = Build.DATADIR;
846- build_pkg_data_dir = Build.PKGDATADIR;
847- build_release_name = Build.RELEASE_NAME;
848- build_version = Build.VERSION;
849- build_version_info = Build.VERSION_INFO;
850-
851- program_name = "Wingpanel";
852- exec_name = "wingpanel";
853- application_id = "net.launchpad.wingpanel";
854- }
855-
856- protected override void activate () {
857- debug ("Activating");
858-
859- if (get_windows () == null)
860- init ();
861- }
862-
863- private void init () {
864- settings = new Services.Settings ();
865- indicator_loader = new Backend.IndicatorFactory (settings);
866- panel = new Widgets.Panel (this, settings, indicator_loader);
867-
868- panel.show_all ();
869- }
870-
871- public static int main (string[] args) {
872- return new WingpanelApp ().run (args);
873- }
874+//
875+// Copyright (C) 2013 Wingpanel Developers
876+//
877+// This program is free software: you can redistribute it and/or modify
878+// it under the terms of the GNU General Public License as published by
879+// the Free Software Foundation, either version 3 of the License, or
880+// (at your option) any later version.
881+//
882+// This program is distributed in the hope that it will be useful,
883+// but WITHOUT ANY WARRANTY; without even the implied warranty of
884+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
885+// GNU General Public License for more details.
886+//
887+// You should have received a copy of the GNU General Public License
888+// along with this program. If not, see <http://www.gnu.org/licenses/>.
889+
890+public class Wingpanel.App : Granite.Application {
891+ private IndicatorLoader indicator_loader;
892+ private Widgets.BasePanel panel;
893+ private Services.BackgroundManager background_manager;
894+
895+ construct {
896+ build_data_dir = Build.DATADIR;
897+ build_pkg_data_dir = Build.PKGDATADIR;
898+ build_release_name = Build.RELEASE_NAME;
899+ build_version = Build.VERSION;
900+ build_version_info = Build.VERSION_INFO;
901+
902+ program_name = "Wingpanel";
903+ exec_name = "wingpanel";
904+ application_id = "net.launchpad.wingpanel";
905+ }
906+
907+ protected override void startup () {
908+ base.startup ();
909+
910+ Ido.init ();
911+
912+ var settings = new Services.Settings ();
913+ indicator_loader = new Backend.IndicatorFactory (settings.blacklist);
914+ panel = new Widgets.Panel (this, settings, indicator_loader);
915+
916+ panel.show_all ();
917+
918+ background_manager = new Services.BackgroundManager (settings, panel.get_screen ());
919+ background_manager.update_background_alpha.connect (panel.update_opacity);
920+ }
921+
922+ protected override void activate () {
923+ panel.present ();
924+ }
925+
926+ public static int main (string[] args) {
927+ return new Wingpanel.App ().run (args);
928 }
929 }
930
931=== renamed file 'vapi/indicator-0.4.vapi' => 'vapi/indicator3-0.4.vapi'
932--- vapi/indicator-0.4.vapi 2013-10-15 20:44:53 +0000
933+++ vapi/indicator3-0.4.vapi 2014-03-09 12:44:07 +0000
934@@ -1,4 +1,4 @@
935-/* indicator-0.4.vapi generated by vapigen, do not modify. */
936+/* indicator3-0.4.vapi generated by vapigen, do not modify. */
937
938 namespace Indicator {
939 [CCode (cheader_filename = "libindicator/indicator-desktop-shortcuts.h", type_check_function = "INDICATOR_IS_DESKTOP_SHORTCUTS", type_id = "indicator_desktop_shortcuts_get_type ()")]
940@@ -7,12 +7,28 @@
941 public DesktopShortcuts (string file, string identity);
942 public unowned string get_nicks ();
943 public bool nick_exec (string nick);
944+ public bool nick_exec_with_context (string nick, GLib.AppLaunchContext launch_context);
945 public unowned string nick_get_name (string nick);
946 public string desktop_file { construct; }
947 [NoAccessorMethod]
948 public string identity { owned get; construct; }
949 }
950- [CCode (cheader_filename = "libindicator/indicator-object.h", type_check_function = "INDICATOR_IS_OBJECT", type_id = "indicator_object_get_type ()")]
951+<<<<<<< TREE
952+ [CCode (cheader_filename = "libindicator/indicator-object.h", type_check_function = "INDICATOR_IS_OBJECT", type_id = "indicator_object_get_type ()")]
953+=======
954+ [CCode (cheader_filename = "libindicator/indicator-ng.h", type_check_function = "INDICATOR_IS_NG", type_id = "indicator_ng_get_type ()")]
955+ public class Ng : Indicator.Object, GLib.Initable {
956+ [CCode (has_construct_function = false)]
957+ public Ng (string service_file) throws GLib.Error;
958+ [CCode (has_construct_function = false)]
959+ public Ng.for_profile (string service_file, string profile) throws GLib.Error;
960+ public unowned string get_profile ();
961+ public unowned string get_service_file ();
962+ public string profile { get; construct; }
963+ public string service_file { get; construct; }
964+ }
965+ [CCode (cheader_filename = "libindicator/indicator-object.h", type_check_function = "INDICATOR_IS_OBJECT", type_id = "indicator_object_get_type ()")]
966+>>>>>>> MERGE-SOURCE
967 public class Object : GLib.Object {
968 [CCode (has_construct_function = false)]
969 protected Object ();
970@@ -42,17 +58,8 @@
971 public virtual unowned Gtk.Menu get_menu ();
972 [NoWrapper]
973 public virtual unowned string get_name_hint ();
974+ public virtual int get_position ();
975 public virtual bool get_show_now (Indicator.ObjectEntry entry);
976- [NoWrapper]
977- public virtual void reserved1 ();
978- [NoWrapper]
979- public virtual void reserved2 ();
980- [NoWrapper]
981- public virtual void reserved3 ();
982- [NoWrapper]
983- public virtual void reserved4 ();
984- [NoWrapper]
985- public virtual void reserved5 ();
986 public void set_environment (string[] env);
987 public void set_visible (bool visible);
988 [NoAccessorMethod]
989@@ -75,26 +82,15 @@
990 public weak Gtk.Menu menu;
991 public weak string name_hint;
992 public weak Indicator.Object parent_object;
993- public weak GLib.Callback reserved1;
994- public weak GLib.Callback reserved2;
995- public weak GLib.Callback reserved3;
996- public weak GLib.Callback reserved4;
997 public static void activate (Indicator.Object io, Indicator.ObjectEntry entry, uint timestamp);
998 public static void activate_window (Indicator.Object io, Indicator.ObjectEntry entry, uint windowid, uint timestamp);
999 public static void close (Indicator.Object io, Indicator.ObjectEntry entry, uint timestamp);
1000+ public static bool is_visible (Indicator.Object io, Indicator.ObjectEntry entry);
1001 }
1002 [CCode (cheader_filename = "libindicator/indicator-service.h", type_check_function = "INDICATOR_IS_SERVICE", type_id = "indicator_service_get_type ()")]
1003 public class Service : GLib.Object {
1004 [CCode (has_construct_function = false)]
1005 public Service (string name);
1006- [NoWrapper]
1007- public virtual void indicator_service_reserved1 ();
1008- [NoWrapper]
1009- public virtual void indicator_service_reserved2 ();
1010- [NoWrapper]
1011- public virtual void indicator_service_reserved3 ();
1012- [NoWrapper]
1013- public virtual void indicator_service_reserved4 ();
1014 [CCode (cname = "indicator_service_new_version", has_construct_function = false)]
1015 public Service.with_version (string name, uint version);
1016 [NoAccessorMethod]
1017@@ -108,14 +104,6 @@
1018 [CCode (has_construct_function = false)]
1019 public ServiceManager (string dbus_name);
1020 public bool connected ();
1021- [NoWrapper]
1022- public virtual void indicator_service_manager_reserved1 ();
1023- [NoWrapper]
1024- public virtual void indicator_service_manager_reserved2 ();
1025- [NoWrapper]
1026- public virtual void indicator_service_manager_reserved3 ();
1027- [NoWrapper]
1028- public virtual void indicator_service_manager_reserved4 ();
1029 public void set_refresh (uint time_in_ms);
1030 [CCode (cname = "indicator_service_manager_new_version", has_construct_function = false)]
1031 public ServiceManager.with_version (string dbus_name, uint version);
1032@@ -140,28 +128,6 @@
1033 public const string GET_TYPE_S;
1034 [CCode (cheader_filename = "libindicator/indicator.h")]
1035 public const string GET_VERSION_S;
1036- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1037- public const string OBJECT_DEFAULT_VISIBILITY;
1038- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1039- public const string OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE;
1040- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1041- public const string OBJECT_SIGNAL_ENTRY_ADDED;
1042- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1043- public const string OBJECT_SIGNAL_ENTRY_MOVED;
1044- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1045- public const string OBJECT_SIGNAL_ENTRY_REMOVED;
1046- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1047- public const string OBJECT_SIGNAL_ENTRY_SCROLLED;
1048- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1049- public const string OBJECT_SIGNAL_MENU_SHOW;
1050- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1051- public const string OBJECT_SIGNAL_SECONDARY_ACTIVATE;
1052- [CCode (cheader_filename = "libindicator/indicator-gobject.h")]
1053- public const string OBJECT_SIGNAL_SHOW_NOW_CHANGED;
1054- [CCode (cheader_filename = "libindicator/indicator-service-manager.h")]
1055- public const string SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE;
1056- [CCode (cheader_filename = "libindicator/indicator-service.h")]
1057- public const string SERVICE_SIGNAL_SHUTDOWN;
1058 [CCode (cheader_filename = "libindicator/indicator.h")]
1059 public const int SET_VERSION;
1060 [CCode (cheader_filename = "libindicator/indicator.h")]
1061@@ -172,4 +138,6 @@
1062 public static unowned Gtk.Image image_helper (string name);
1063 [CCode (cheader_filename = "libindicator/indicator-image-helper.h")]
1064 public static void image_helper_update (Gtk.Image image, string name);
1065+ [CCode (cheader_filename = "libindicator/indicator-image-helper.h")]
1066+ public static void image_helper_update_from_gicon (Gtk.Image image, GLib.Icon icon);
1067 }
1068
1069=== added file 'vapi/libido3-0.1.vapi'
1070--- vapi/libido3-0.1.vapi 1970-01-01 00:00:00 +0000
1071+++ vapi/libido3-0.1.vapi 2014-03-09 12:44:07 +0000
1072@@ -0,0 +1,4 @@
1073+[CCode (cheader_filename="libido/libido.h", lower_case_cprefix = "ido_")]
1074+namespace Ido {
1075+ public void init ();
1076+}

Subscribers

People subscribed via source and target branches