Merge lp:~fboucault/unity-2d/dash_lenses_view_loader_camelify into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Superseded
Proposed branch: lp:~fboucault/unity-2d/dash_lenses_view_loader_camelify
Merge into: lp:unity-2d/3.0
Diff against target: 12020 lines (+4264/-3629)
238 files modified
.bzrignore (+2/-0)
CMakeLists.txt (+6/-3)
data/com.canonical.Unity2d.gschema.xml (+1/-1)
data/unity-2d.convert (+0/-2)
debian/20_ubuntu-2d-gconf-default (+0/-8)
debian/20_ubuntu-2d-gconf-mandatory (+0/-1)
debian/changelog (+110/-17)
debian/control (+16/-12)
debian/gconf/ubuntu-2d.default.path (+2/-2)
debian/gconf/ubuntu-2d.mandatory.path (+2/-2)
debian/unity-2d-panel.install (+1/-3)
debian/unity-2d.gconf-defaults (+4/-0)
debian/unity-2d.install (+2/-4)
debian/unity-2d.postinst (+12/-15)
debian/unity-2d.postrm (+11/-14)
debian/unity-2d.preinst (+16/-0)
launcher/Launcher.qml (+14/-12)
launcher/LauncherItem.qml (+2/-0)
launcher/LauncherList.qml (+11/-0)
launcher/app/launcher.cpp (+2/-0)
launcher/app/launcherview.cpp (+5/-7)
launcher/app/launcherview.h (+1/-1)
libunity-2d-private/CMakeLists.txt (+3/-1)
libunity-2d-private/Unity2d/CMakeLists.txt (+3/-0)
libunity-2d-private/Unity2d/GnomeBackground.qml (+12/-22)
libunity-2d-private/Unity2d/plugin.cpp (+10/-4)
libunity-2d-private/src/CMakeLists.txt (+23/-0)
libunity-2d-private/src/bfb.cpp (+119/-0)
libunity-2d-private/src/bfb.h (+75/-0)
libunity-2d-private/src/cairoutils.cpp (+42/-0)
libunity-2d-private/src/cairoutils.h (+47/-0)
libunity-2d-private/src/dashclient.cpp (+155/-0)
libunity-2d-private/src/dashclient.h (+68/-0)
libunity-2d-private/src/debug.cpp (+23/-0)
libunity-2d-private/src/debug_p.h (+6/-0)
libunity-2d-private/src/filter.cpp (+92/-0)
libunity-2d-private/src/filter.h (+74/-0)
libunity-2d-private/src/gimageutils.cpp (+102/-0)
libunity-2d-private/src/gimageutils.h (+46/-0)
libunity-2d-private/src/iconimageprovider.cpp (+4/-56)
libunity-2d-private/src/indicatorentrywidget.cpp (+378/-0)
libunity-2d-private/src/indicatorentrywidget.h (+90/-0)
libunity-2d-private/src/indicatorsmanager.cpp (+206/-0)
libunity-2d-private/src/indicatorsmanager.h (+72/-0)
libunity-2d-private/src/indicatorwidget.cpp (+53/-0)
libunity-2d-private/src/indicatorwidget.h (+52/-0)
libunity-2d-private/src/launcherapplication.cpp (+4/-6)
libunity-2d-private/src/launcherapplicationslist.cpp (+20/-2)
libunity-2d-private/src/launcherapplicationslist.h (+2/-1)
libunity-2d-private/src/launcherdevice.cpp (+73/-21)
libunity-2d-private/src/launcherdevice.h (+4/-0)
libunity-2d-private/src/launchermenu.cpp (+1/-0)
libunity-2d-private/src/lens.cpp (+272/-0)
libunity-2d-private/src/lens.h (+130/-0)
libunity-2d-private/src/lenses.cpp (+123/-0)
libunity-2d-private/src/lenses.h (+73/-0)
libunity-2d-private/src/panelapplet.cpp (+21/-3)
libunity-2d-private/src/panelapplet.h (+9/-1)
libunity-2d-private/src/panelappletproviderinterface.h (+1/-1)
libunity-2d-private/src/panelstyle.cpp (+201/-0)
libunity-2d-private/src/panelstyle.h (+72/-0)
libunity-2d-private/src/placeentry.cpp (+14/-80)
libunity-2d-private/src/placeentry.h (+2/-8)
libunity-2d-private/src/ratingsfilter.cpp (+46/-0)
libunity-2d-private/src/ratingsfilter.h (+56/-0)
libunity-2d-private/src/screeninfo.cpp (+3/-4)
libunity-2d-private/src/unity-2d-private.pc.cmake (+1/-1)
libunity-2d-private/src/unity2dapplication.cpp (+83/-1)
libunity-2d-private/src/unity2dapplication.h (+3/-0)
libunity-2d-private/src/unity2dpanel.cpp (+12/-0)
libunity-2d-private/src/unity2dpanel.h (+3/-0)
libunity-2d-private/src/windowinfo.cpp (+1/-3)
libunity-2d-private/src/workspacesinfo.cpp (+8/-4)
panel/CMakeLists.txt (+3/-5)
panel/app/CMakeLists.txt (+3/-1)
panel/app/main.cpp (+5/-2)
panel/app/panelmanager.cpp (+23/-36)
panel/app/panelmanager.h (+2/-0)
panel/app/unity2dstyle.cpp (+0/-98)
panel/app/unity2dstyle.h (+0/-44)
panel/applets/appindicator/appindicatorapplet.cpp (+2/-1)
panel/applets/appindicator/appindicatorapplet.h (+1/-1)
panel/applets/appindicator/plugin.cpp (+2/-2)
panel/applets/appindicator/plugin.h (+1/-1)
panel/applets/appname/CMakeLists.txt (+8/-8)
panel/applets/appname/appnameapplet.cpp (+52/-85)
panel/applets/appname/appnameapplet.h (+4/-3)
panel/applets/appname/com.canonical.AppMenu.Registrar.xml (+0/-82)
panel/applets/appname/croppedlabel.cpp (+140/-0)
panel/applets/appname/croppedlabel.h (+45/-0)
panel/applets/appname/menubarwidget.cpp (+78/-279)
panel/applets/appname/menubarwidget.h (+25/-66)
panel/applets/appname/plugin.cpp (+2/-2)
panel/applets/appname/plugin.h (+1/-1)
panel/applets/appname/registrar.cpp (+0/-138)
panel/applets/appname/registrar.h (+0/-85)
panel/applets/homebutton/homebutton.cpp (+0/-61)
panel/applets/homebutton/homebutton.h (+0/-43)
panel/applets/homebutton/homebuttonapplet.cpp (+0/-111)
panel/applets/homebutton/homebuttonapplet.h (+0/-55)
panel/applets/homebutton/plugin.cpp (+2/-2)
panel/applets/homebutton/plugin.h (+1/-1)
panel/applets/indicator/CMakeLists.txt (+0/-61)
panel/applets/indicator/abstractindicator.cpp (+0/-43)
panel/applets/indicator/abstractindicator.h (+0/-53)
panel/applets/indicator/datetimeindicator.cpp (+0/-94)
panel/applets/indicator/datetimeindicator.h (+0/-53)
panel/applets/indicator/indicator-config.h.in (+0/-7)
panel/applets/indicator/indicator.c (+0/-525)
panel/applets/indicator/indicator.h (+0/-45)
panel/applets/indicator/indicatorapplet.cpp (+0/-114)
panel/applets/indicator/indicatorapplet.h (+0/-60)
panel/applets/indicator/indicatorservicemanager.cpp (+0/-120)
panel/applets/indicator/indicatorservicemanager.h (+0/-54)
panel/applets/indicator/plugin.cpp (+0/-39)
panel/applets/indicator/plugin.h (+0/-40)
panel/applets/legacytray/legacytrayapplet.cpp (+3/-2)
panel/applets/legacytray/legacytrayapplet.h (+1/-1)
panel/applets/legacytray/plugin.cpp (+2/-2)
panel/applets/legacytray/plugin.h (+1/-1)
panel/applets/separator/plugin.cpp (+2/-2)
panel/applets/separator/plugin.h (+1/-1)
panel/applets/separator/separatorapplet.cpp (+3/-2)
panel/applets/separator/separatorapplet.h (+1/-1)
panel/tests/CMakeLists.txt (+2/-3)
panel/tests/homebuttonapplettest.cpp (+0/-41)
places/AbstractButton.qml (+2/-0)
places/CategoryHeader.qml (+8/-6)
places/Home.qml (+29/-27)
places/HomeButton.qml (+2/-0)
places/HomeShortcuts.qml (+15/-11)
places/LensBar.qml (+117/-0)
places/LensButton.qml (+80/-0)
places/LensView.qml (+47/-46)
places/PageModel.qml (+1/-1)
places/Renderer.qml (+8/-8)
places/RendererGrid.qml (+5/-12)
places/SearchEntry.qml (+9/-1)
places/SearchRefine.qml (+4/-2)
places/SearchRefineOption.qml (+1/-1)
places/SearchRefineOptionType.qml (+9/-6)
places/TickBox.qml (+3/-0)
places/TileVertical.qml (+3/-1)
places/UnityEmptySearchRenderer.qml (+0/-80)
places/UnityEmptySectionRenderer.qml (+0/-22)
places/UnityFileInfoRenderer.qml (+0/-117)
places/UnityHorizontalTileRenderer.qml (+0/-138)
places/UnityShowcaseRenderer.qml (+0/-22)
places/app/dash.xml (+10/-16)
places/app/dashdeclarativeview.cpp (+9/-11)
places/app/dashdeclarativeview.h (+6/-6)
places/app/places.cpp (+2/-0)
places/artwork/lens-nav-home.svg (+9/-0)
places/dash.qml (+55/-24)
places/utils.js (+29/-0)
po/af.po (+2/-2)
po/am.po (+2/-2)
po/an.po (+2/-2)
po/ar.po (+2/-2)
po/ast.po (+2/-2)
po/az.po (+2/-2)
po/be.po (+2/-2)
po/bem.po (+2/-2)
po/bg.po (+2/-2)
po/bn.po (+2/-2)
po/bs.po (+3/-3)
po/ca.po (+2/-2)
po/ca@valencia.po (+3/-3)
po/crh.po (+2/-2)
po/cs.po (+2/-2)
po/cy.po (+2/-2)
po/da.po (+2/-2)
po/de.po (+2/-2)
po/el.po (+2/-2)
po/en_AU.po (+4/-4)
po/en_GB.po (+4/-4)
po/eo.po (+2/-2)
po/es.po (+2/-2)
po/et.po (+3/-3)
po/eu.po (+2/-2)
po/fa.po (+2/-2)
po/fi.po (+2/-2)
po/fil.po (+2/-2)
po/fr.po (+2/-2)
po/fy.po (+2/-2)
po/gd.po (+2/-2)
po/gl.po (+2/-2)
po/gv.po (+2/-2)
po/he.po (+2/-2)
po/hi.po (+2/-2)
po/hr.po (+2/-2)
po/hu.po (+2/-2)
po/hy.po (+2/-2)
po/id.po (+2/-2)
po/is.po (+2/-2)
po/it.po (+2/-2)
po/ja.po (+2/-2)
po/ka.po (+2/-2)
po/kk.po (+2/-2)
po/ko.po (+2/-2)
po/ku.po (+2/-2)
po/ky.po (+2/-2)
po/lb.po (+2/-2)
po/lt.po (+2/-2)
po/lv.po (+2/-2)
po/mg.po (+2/-2)
po/ml.po (+2/-2)
po/ms.po (+2/-2)
po/nb.po (+2/-2)
po/nl.po (+2/-2)
po/nn.po (+2/-2)
po/oc.po (+2/-2)
po/pa.po (+2/-2)
po/pl.po (+2/-2)
po/pt.po (+2/-2)
po/pt_BR.po (+2/-2)
po/ro.po (+2/-2)
po/ru.po (+2/-2)
po/si.po (+2/-2)
po/sk.po (+2/-2)
po/sl.po (+2/-2)
po/sq.po (+2/-2)
po/sr.po (+2/-2)
po/sv.po (+2/-2)
po/ta.po (+2/-2)
po/te.po (+2/-2)
po/th.po (+2/-2)
po/tr.po (+2/-2)
po/tt.po (+2/-2)
po/ug.po (+2/-2)
po/uk.po (+2/-2)
po/unity-2d.pot (+2/-2)
po/ur.po (+2/-2)
po/vi.po (+2/-2)
po/zh_CN.po (+2/-2)
po/zh_HK.po (+2/-2)
po/zh_TW.po (+2/-2)
spread/app/spread.cpp (+1/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/dash_lenses_view_loader_camelify
Reviewer Review Type Date Requested Status
Gerry Boland Pending
Review via email: mp+72709@code.launchpad.net

Description of the change

[dash] Removed unused tile renderers and simplified conversion of renderer name to QML file name.

To post a comment you must log in.

Unmerged revisions

661. By Florian Boucault

[dash] Removed unused tile renderers and simplified conversion of renderer name to QML file name.

660. By Florian Boucault

Merged lp:unity-2d

659. By Florian Boucault

Merged lp:unity-2d

658. By Ugo Riboni

[panel] Dynamically load applets

Each applet is now a plugin implementing the PanelAppletProviderInterface.
In addition to porting the existing applets as plugins, the Homebutton and
Separator applets have been brought back as optional panel applets.

657. By Florian Boucault

[dash] Collapse categories by default.

656. By Alberto Mardegan

Add missing initializations of member variables

These were reported by valgrind complaining about "jump depends on value of uninitialized variable".

655. By Gerry Boland

[dash] (Unity 4.0) Update Toggle buttons to latest design spec

654. By Florian Boucault

* No change rebuild for the nux update abi break
* debian/control: update the nux requirement to be sure to pick the new one

653. By Florian Boucault

Merged lp:unity-2d

652. By Gerry Boland

[dash] Fix Lens bar icons so they scale correctly. Use correct Home lens icon.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-08-19 10:38:19 +0000
3+++ .bzrignore 2011-08-24 12:47:31 +0000
4@@ -18,6 +18,8 @@
5 panel/applets/appname/registraradaptor.*
6 panel/applets/indicator/indicator-config.h
7 panel/applets/libpanelplugin-*.so.*
8+panel/lib/libuqpanel.so*
9+panel/tests/Testing
10 panel/tests/homebuttonapplettest
11
12 libunity-2d-private/src/libunity-2d-private.so.*
13
14=== modified file 'CMakeLists.txt'
15--- CMakeLists.txt 2011-07-27 09:42:32 +0000
16+++ CMakeLists.txt 2011-08-24 12:47:31 +0000
17@@ -25,10 +25,13 @@
18 find_package(X11 REQUIRED)
19 find_package(Gettext REQUIRED)
20 pkg_check_modules(GLIB REQUIRED glib-2.0)
21-pkg_check_modules(GDK REQUIRED gdk-2.0)
22-pkg_check_modules(GTK REQUIRED gtk+-2.0)
23+pkg_check_modules(GDK REQUIRED gdk-3.0)
24+pkg_check_modules(GTK REQUIRED gtk+-3.0)
25 pkg_check_modules(GIO REQUIRED gio-2.0)
26-pkg_check_modules(WNCK REQUIRED libwnck-1.0)
27+pkg_check_modules(WNCK REQUIRED libwnck-3.0)
28+pkg_check_modules(QTGCONF REQUIRED libqtgconf)
29+pkg_check_modules(NUXCORE REQUIRED nux-core-1.0)
30+pkg_check_modules(PANGO REQUIRED pango)
31
32
33 # GSettings schemas
34
35=== modified file 'data/com.canonical.Unity2d.gschema.xml'
36--- data/com.canonical.Unity2d.gschema.xml 2011-08-17 09:21:18 +0000
37+++ data/com.canonical.Unity2d.gschema.xml 2011-08-24 12:47:31 +0000
38@@ -18,7 +18,7 @@
39 </schema>
40 <schema path="/com/canonical/unity-2d/panel/" id="com.canonical.Unity2d.Panel" gettext-domain="unity-2d">
41 <key type="as" name="applets">
42- <default>["!homebutton", "!separator", "appname", "!legacytray", "indicator"]</default>
43+ <default>["appname", "!legacytray", "indicator"]</default>
44 <summary>Applets to display in the panel</summary>
45 <description>
46 List of panel applets that should be displayed, in order, in the panel.
47
48=== modified file 'data/unity-2d.convert'
49--- data/unity-2d.convert 2011-07-25 11:56:59 +0000
50+++ data/unity-2d.convert 2011-08-24 12:47:31 +0000
51@@ -3,5 +3,3 @@
52 hide-mode = /desktop/unity-2d/launcher/hide_mode
53 use-strut = /desktop/unity-2d/launcher/use_strut
54
55-[com.canonical.Unity.Launcher]
56-favorites = /desktop/unity-2d/launcher/favorites
57
58=== renamed file 'debian/20_unity-2d-gconf-default' => 'debian/20_ubuntu-2d-gconf-default'
59--- debian/20_unity-2d-gconf-default 2011-07-25 11:56:59 +0000
60+++ debian/20_ubuntu-2d-gconf-default 2011-08-24 12:47:31 +0000
61@@ -1,13 +1,5 @@
62-/apps/gnome-power-manager/lock/use_screensaver_settings true
63-/apps/gnome-power-manager/general/use_time_for_policy false
64-/desktop/gnome/applications/window_manager/default /usr/bin/metacity
65-/desktop/gnome/applications/window_manager/current /usr/bin/metacity
66 /apps/metacity/general/show_maximized_titlebars false
67 /apps/metacity/general/auto_maximize_windows true
68 /apps/metacity/general/capture_before_unmap true
69 /apps/metacity/general/compositing_manager true
70 /apps/metacity/general/compositor_effects false
71-/apps/metacity/general/theme Ambiance
72-/desktop/gnome/interface/gtk_theme Ambiance
73-/desktop/gnome/interface/icon_theme ubuntu-mono-dark
74-/desktop/gnome/peripherals/mouse/cursor_theme DMZ-White
75
76=== renamed file 'debian/20_unity-2d-gconf-mandatory' => 'debian/20_ubuntu-2d-gconf-mandatory'
77--- debian/20_unity-2d-gconf-mandatory 2011-06-15 13:05:38 +0000
78+++ debian/20_ubuntu-2d-gconf-mandatory 2011-08-24 12:47:31 +0000
79@@ -1,3 +1,2 @@
80-/apps/nautilus/preferences/exit_with_last_window false
81 /apps/metacity/global_keybindings/panel_main_menu disabled
82 /apps/metacity/global_keybindings/panel_run_dialog disabled
83
84=== modified file 'debian/changelog'
85--- debian/changelog 2011-07-29 14:05:54 +0000
86+++ debian/changelog 2011-08-24 12:47:31 +0000
87@@ -1,20 +1,65 @@
88-unity-2d (3.8.14-0ubuntu1) UNRELEASED; urgency=low
89-
90- *
91-
92- -- Florian Boucault <florian.boucault@canonical.com> Fri, 29 Jul 2011 16:05:25 +0200
93-
94-unity-2d (3.8.12-0ubuntu2) natty; urgency=low
95+unity-2d (4.0.0-0ubuntu2) oneiric; urgency=low
96+
97+ * No change rebuild for the nux update abi break
98+ * debian/control: update the nux requirement to be sure to pick the new one
99+
100+ -- Sebastien Bacher <seb128@ubuntu.com> Fri, 19 Aug 2011 11:25:56 +0200
101+
102+unity-2d (4.0.0-0ubuntu1) oneiric; urgency=low
103+
104+ * New upstream release:
105+ - [launcher] Impossible to keep KDE Apps in Launcher (LP: #741129)
106+ - [dash] Background should be blurred (LP: #823326)
107+ - No 'safely remove' option is present in the unity menu when a usb disk
108+ is inserted (LP: #660010)
109+ - Quicklist item "Keep In Launcher" should be "Keep in launcher" as design
110+ (LP: #795422)
111+ - [launcher] ESC doesn't dismiss launcher when activated with Alt+F1
112+ (LP: #812792)
113+ - [dash] Background wallpaper shifted when using a non compositing window
114+ manager (LP: #823295)
115+ - [launcher] Bottom gradient appears too early (LP: #823877)
116+ - mute/unmute sound when user clicks on sound applet using scroll button
117+ or middle mouse button (LP: #609860)
118+ - Secondary activate (i.e. middle click) support for indicators advanced
119+ usage (LP: #812933)
120+ - Unused GConfItemQmlWrapper dep found (LP: #821880)
121+ * debian/control:
122+ - bump libunity-core-4.0-dev, libnux-1.0-dev
123+ - recommends lenses and not places anymore. Adding music lens
124+
125+ -- Didier Roche <didrocks@ubuntu.com> Thu, 11 Aug 2011 21:22:18 +0200
126+
127+unity-2d (3.8.14.1-0ubuntu1) oneiric; urgency=low
128+
129+ * Few upstream fixes:
130+ - unity-2d-places crashed with SIGSEGV in
131+ QDeclarativePropertyPrivate::initProperty() (LP: #817896)
132+ - update resets unity launcher favorites (LP: #817954)
133+
134+ -- Didier Roche <didrocks@ubuntu.com> Tue, 02 Aug 2011 16:08:27 +0200
135+
136+unity-2d (3.8.14-0ubuntu1) oneiric; urgency=low
137+
138+ * New upstream release:
139+ - [launcher] Need to press Alt+F1 twice to show launcher (LP: #812787)
140+ * debian/control:
141+ - build on latest libunity-core-4.0-dev and latest libnux-1.0-dev
142+
143+ -- Didier Roche <didrocks@ubuntu.com> Mon, 01 Aug 2011 19:53:40 +0200
144+
145+unity-2d (3.8.12-0ubuntu2) oneiric; urgency=low
146
147 * debian/control:
148 - enforcing latest libunity-private0 to be installed for each local
149 consumer
150+ - don't recommends indicator-me, it's deprecated
151 * debian/libunity-2d-private0.lintian-overrides:
152 - remove a qml-related exported symbol warning wrongly detected
153
154- -- Didier Roche <didrocks@ubuntu.com> Fri, 29 Jul 2011 08:01:51 +0200
155+ -- Didier Roche <didrocks@ubuntu.com> Fri, 29 Jul 2011 15:19:11 +0200
156
157-unity-2d (3.8.12-0ubuntu1) natty; urgency=low
158+unity-2d (3.8.12-0ubuntu1) oneiric; urgency=low
159
160 [ Florian Boucault ]
161 * Upstreamed patch 01_build_with_new_indicator.patch
162@@ -32,6 +77,7 @@
163 - remove default value for /desktop/unity-2d/launcher/favorites
164 * debian/control:
165 - add dependency on libdconf-qt-dev
166+ - add dependency on libnux-1.0-dev
167
168 [ Didier Roche ]
169 * New upstream release:
170@@ -73,13 +119,27 @@
171 * Fix typo in trigger (debian/unity-2d.triggers): (LP: #807358)
172 * Install the apport hook in the right directory so that it's not launched
173 unconditionally (LP: #712343)
174+ * debian/control:
175+ - dep on latest libqtdee-dev
176+ - dep now on gtk3 indicator version
177+ - dep on versionned libnux-1.0-dev
178+ - dep on versionned libunity-core-4.0-dev
179 * debian/control, debian/rules, debian/libunity-2d-private-dev:
180 - add new -dev project (LP: #814709)
181 - add an upstream pc file
182
183- -- Florian Boucault <florian.boucault@canonical.com> Thu, 28 Jul 2011 12:05:05 +0200
184-
185-unity-2d (3.8.10-0ubuntu1) natty; urgency=low
186+ -- Didier Roche <didrocks@ubuntu.com> Thu, 28 Jul 2011 12:05:38 +0200
187+
188+unity-2d (3.8.10-0ubuntu2) oneiric; urgency=low
189+
190+ * debian/control:
191+ - rebuild with new indicator 0.4
192+ * 01_build_with_new_indicator.patch:
193+ - patch to build with the new indicator 0.4 stack
194+
195+ -- Didier Roche <didrocks@ubuntu.com> Sun, 10 Jul 2011 23:48:01 +0200
196+
197+unity-2d (3.8.10-0ubuntu1) oneiric; urgency=low
198
199 [ Florian Boucault ]
200 * debian/unity-2d-launcher.install:
201@@ -102,10 +162,17 @@
202 - Missing a GConf schema file for the /desktop/unity-2d/… keys
203 (LP: #750303)
204 - [dash] home screen search hint should be 'Search' (LP: #797825)
205-
206- -- Florian Boucault <florian.boucault@canonical.com> Wed, 13 Jul 2011 11:59:29 +0200
207-
208-unity-2d (3.8.8-0ubuntu1) natty; urgency=low
209+ * debian/unity-2d.gconf-defaults,
210+ debian/20_ubuntu-2d-gconf-default:
211+ - transition some gconf keys from session-wide to system-wide
212+ (LP: #797672, #797676)
213+ * debian/control:
214+ - ensure we are still using gtk2 indicator for alpha2 (LP: #804938)
215+ - bump standards-version
216+
217+ -- Didier Roche <didrocks@ubuntu.com> Mon, 04 Jul 2011 11:05:54 +0200
218+
219+unity-2d (3.8.8-0ubuntu1) oneiric; urgency=low
220
221 [ Didier Roche ]
222 * new upstream release:
223@@ -152,7 +219,21 @@
224
225 -- Didier Roche <didrocks@ubuntu.com> Tue, 14 Jun 2011 16:14:18 +0200
226
227-unity-2d (3.8.6-0ubuntu1) natty; urgency=low
228+unity-2d (3.8.6-0ubuntu3~ppa1) oneiric; urgency=low
229+
230+ * Rebuild with new gcc
231+
232+ -- Didier Roche <didrocks@ubuntu.com> Tue, 07 Jun 2011 15:00:32 +0200
233+
234+unity-2d (3.8.6-0ubuntu2) oneiric; urgency=low
235+
236+ * debian/unity-2d.postinst, debian/unity-2d.postrm:
237+ - remove the magic to set unity-2d in oneiric as the default session in gdm
238+ as it's now installed on the ubuntu CD.
239+
240+ -- Didier Roche <didrocks@ubuntu.com> Wed, 01 Jun 2011 09:42:21 +0200
241+
242+unity-2d (3.8.6-0ubuntu1) oneiric; urgency=low
243
244 * New upstream release:
245 - [launcher] Support static shortcuts in the quicklists. (LP: #669923)
246@@ -196,6 +277,18 @@
247 * debian/libunity-2d-private0.post*
248 - removed: ldconfig is generated directly by dh_makeshlibs as we don't pass
249 -n anymore
250+ * don't install unity-2d session as it's in gnome-session now
251+ * debian/unity-2d.install
252+ debian/20_ubuntu-2d-gconf-default
253+ debian/20_ubuntu-2d-gconf-mandatory
254+ debian/gconf/ubuntu-2d.default.path
255+ debian/gconf/ubuntu-2d.mandatory.path:
256+ - remove uneeded defaults and mandatory
257+ - remove some deprecated keys
258+ - the session is now called ubuntu-2d and not unity-2d anymore
259+ * debian/unity-2d.preinst, debian/unity-2d.postinst
260+ debian/unity-2d.postrm:
261+ - take into account the natty -> oneiric migration with session name change
262
263 -- Didier Roche <didrocks@ubuntu.com> Wed, 25 May 2011 12:19:25 +0200
264
265
266=== modified file 'debian/control'
267--- debian/control 2011-07-29 11:55:03 +0000
268+++ debian/control 2011-08-24 12:47:31 +0000
269@@ -10,19 +10,22 @@
270 libqt4-dev,
271 libqt4-opengl-dev,
272 libglib2.0-dev,
273- libwnck-dev,
274+ libwnck-3-dev,
275+ libpango1.0-dev,
276 libqtgconf-dev,
277 libdconf-qt-dev,
278 libqtbamf-dev,
279- libqtdee-dev,
280+ libqtdee-dev (>= 0.2.3),
281 libdbusmenu-qt-dev,
282 libx11-dev,
283- libindicator-dev,
284- libgtk2.0-dev,
285+ libindicator3-dev,
286+ libgtk-3-dev,
287 libutouch-geis-dev,
288- libstartup-notification0-dev
289-Standards-Version: 3.9.1
290-Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/unity-2d/trunk
291+ libstartup-notification0-dev,
292+ libunity-core-4.0-dev (>= 4.8.0),
293+ libnux-1.0-dev (>= 1.2.2),
294+Standards-Version: 3.9.2
295+Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/unity-2d/oneiric
296
297 Package: unity-2d
298 Architecture: all
299@@ -56,9 +59,10 @@
300 Depends: ${shlibs:Depends},
301 ${misc:Depends},
302 libunity-2d-private0 (= ${binary:Version}),
303- libgtk2.0-dev,
304- libwnck-dev,
305+ libgtk-3-dev,
306+ libwnck-3-dev,
307 libglib2.0-dev,
308+ libpango1.0-dev,
309 Description: Unity 2D shared library - development files
310 This library is used to host common code used by several Unity 2D components
311 It is only used internally, there is no use case for it outside of the unity-2d
312@@ -73,8 +77,9 @@
313 unity-asset-pool,
314 libunity-2d-private0 (= ${binary:Version}),
315 libqt4-svg,
316-Recommends: unity-place-files,
317- unity-place-applications
318+Recommends: unity-lens-files,
319+ unity-lens-applications,
320+ unity-lens-music,
321 Description: Unity 2D Launcher
322 The Unity 2D launcher displays a list of running applications as well as a
323 list of favorite applications in a panel at the left of the screen.
324@@ -90,7 +95,6 @@
325 Recommends: indicator-application,
326 indicator-appmenu,
327 indicator-datetime,
328- indicator-me,
329 indicator-messages,
330 indicator-session,
331 indicator-sound,
332
333=== renamed file 'debian/gconf/unity-2d.default.path' => 'debian/gconf/ubuntu-2d.default.path'
334--- debian/gconf/unity-2d.default.path 2011-06-15 13:05:38 +0000
335+++ debian/gconf/ubuntu-2d.default.path 2011-08-24 12:47:31 +0000
336@@ -1,3 +1,3 @@
337-# Additional mandatory path for unity-2d experience
338-xml:readonly:/var/lib/gconf/unity-2d.default
339+# Additional mandatory path for ubuntu-2d experience
340+xml:readonly:/var/lib/gconf/ubuntu-2d.default
341
342
343=== renamed file 'debian/gconf/unity-2d.mandatory.path' => 'debian/gconf/ubuntu-2d.mandatory.path'
344--- debian/gconf/unity-2d.mandatory.path 2011-06-15 13:05:38 +0000
345+++ debian/gconf/ubuntu-2d.mandatory.path 2011-08-24 12:47:31 +0000
346@@ -1,3 +1,3 @@
347-# Additional mandatory path for unity-2d experience
348-xml:readonly:/var/lib/gconf/unity-2d.mandatory
349+# Additional mandatory path for ubuntu-2d experience
350+xml:readonly:/var/lib/gconf/ubuntu-2d.mandatory
351
352
353=== modified file 'debian/unity-2d-panel.install'
354--- debian/unity-2d-panel.install 2011-08-12 15:23:04 +0000
355+++ debian/unity-2d-panel.install 2011-08-24 12:47:31 +0000
356@@ -1,5 +1,3 @@
357 usr/bin/unity-2d-panel
358+usr/lib/unity-2d/plugins/panel/libpanelplugin-*.so*
359 usr/share/applications/unity-2d-panel.desktop
360-usr/share/unity-2d/panel/artwork/background.png
361-usr/share/unity-2d/panel/artwork/divider.png
362-usr/lib/unity-2d/plugins/panel/libpanelplugin-*.so*
363
364=== added file 'debian/unity-2d.gconf-defaults'
365--- debian/unity-2d.gconf-defaults 1970-01-01 00:00:00 +0000
366+++ debian/unity-2d.gconf-defaults 2011-08-24 12:47:31 +0000
367@@ -0,0 +1,4 @@
368+/desktop/unity-2d/launcher/favorites [ubiquity-gtkui.desktop,nautilus-home.desktop,firefox.desktop,libreoffice-writer.desktop,libreoffice-calc.desktop,libreoffice-impress.desktop,ubuntu-software-center.desktop,ubuntuone-control-panel-gtk.desktop]
369+/desktop/unity-2d/launcher/hide_mode 2
370+/desktop/unity-2d/launcher/use_strut false
371+/desktop/unity-2d/launcher/super_key_enable true
372
373=== modified file 'debian/unity-2d.install'
374--- debian/unity-2d.install 2011-07-22 14:44:57 +0000
375+++ debian/unity-2d.install 2011-08-24 12:47:31 +0000
376@@ -1,9 +1,7 @@
377 debian/unity-2d.py /usr/share/apport/package-hooks
378 debian/gconf/* /usr/share/gconf
379-session/unity-2d.desktop /usr/share/xsessions
380-session/2d-ubuntu.session /usr/share/gnome-session/sessions
381-debian/20_unity-2d-gconf-mandatory /usr/share/gconf/unity-2d/mandatory
382-debian/20_unity-2d-gconf-default /usr/share/gconf/unity-2d/default
383+debian/20_ubuntu-2d-gconf-mandatory /usr/share/gconf/ubuntu-2d/mandatory
384+debian/20_ubuntu-2d-gconf-default /usr/share/gconf/ubuntu-2d/default
385 usr/share/locale/*/LC_MESSAGES/unity-2d.mo
386 usr/share/glib-2.0/schemas/com.canonical.Unity2d.gschema.xml
387 usr/share/GConf/gsettings
388
389=== modified file 'debian/unity-2d.postinst'
390--- debian/unity-2d.postinst 2011-06-15 13:05:38 +0000
391+++ debian/unity-2d.postinst 2011-08-24 12:47:31 +0000
392@@ -9,24 +9,21 @@
393
394 case "$1" in
395 configure|upgrade)
396- if [ -x /usr/lib/gdm/gdm-set-default-session ] ; then
397- /usr/lib/gdm/gdm-set-default-session --keep-old unity-2d || true
398- fi
399 if which update-gconf-defaults >/dev/null 2>&1 ; then
400- mkdir -p /var/lib/gconf/unity-2d.mandatory
401- mkdir -p /var/lib/gconf/unity-2d.default
402+ mkdir -p /var/lib/gconf/ubuntu-2d.mandatory
403+ mkdir -p /var/lib/gconf/ubuntu-2d.default
404 fi
405 ;;
406 triggered)
407 for trigger in $2; do
408 case $trigger in
409- /usr/share/gconf/unity-2d/mandatory)
410- update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \
411- --destination /var/lib/gconf/unity-2d.mandatory --no-signal
412+ /usr/share/gconf/ubuntu-2d/mandatory)
413+ update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
414+ --destination /var/lib/gconf/ubuntu-2d.mandatory --no-signal
415 ;;
416- /usr/share/gconf/unity-2d/default)
417- update-gconf-defaults --source /usr/share/gconf/unity-2d/default \
418- --destination /var/lib/gconf/unity-2d.default --no-signal
419+ /usr/share/gconf/ubuntu-2d/default)
420+ update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
421+ --destination /var/lib/gconf/ubuntu-2d.default --no-signal
422 ;;
423 esac
424 done
425@@ -39,9 +36,9 @@
426
427 # Upon installation/upgrade, regenerate all databases, because in this case
428 # there will be no trigger run
429-update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \
430- --destination /var/lib/gconf/unity-2d.mandatory --no-signal
431-update-gconf-defaults --source /usr/share/gconf/unity-2d/default \
432- --destination /var/lib/gconf/unity-2d.default --no-signal
433+update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
434+ --destination /var/lib/gconf/ubuntu-2d.mandatory --no-signal
435+update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
436+ --destination /var/lib/gconf/ubuntu-2d.default --no-signal
437 signal_daemons
438
439
440=== modified file 'debian/unity-2d.postrm'
441--- debian/unity-2d.postrm 2011-06-15 13:05:38 +0000
442+++ debian/unity-2d.postrm 2011-08-24 12:47:31 +0000
443@@ -3,20 +3,17 @@
444
445 case "$1" in
446 remove|purge)
447- if which update-gconf-defaults >/dev/null 2>&1 && [ -d /usr/share/gconf/mandatory/unity-2d ]; then
448- update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \
449- --destination /var/lib/gconf/unity-2d.mandatory
450- update-gconf-defaults --source /usr/share/gconf/unity-2d/default \
451- --destination /var/lib/gconf/unity-2d.default
452- fi
453- if [ -d /var/lib/gconf/unity-2d.mandatory ]; then
454- rm -rf /var/lib/gconf/unity-2d.mandatory
455- fi
456- if [ -d /var/lib/gconf/unity-2d.default ]; then
457- rm -rf /var/lib/gconf/unity-2d.default
458- fi
459- if [ -x /usr/lib/gdm/gdm-set-default-session ] ; then
460- /usr/lib/gdm/gdm-set-default-session --remove unity-2d || true
461+ if which update-gconf-defaults >/dev/null 2>&1 && [ -d /usr/share/gconf/mandatory/ubuntu-2d ]; then
462+ update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
463+ --destination /var/lib/gconf/ubuntu-2d.mandatory
464+ update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
465+ --destination /var/lib/gconf/ubuntu-2d.default
466+ fi
467+ if [ -d /var/lib/gconf/ubuntu-2d.mandatory ]; then
468+ rm -rf /var/lib/gconf/ubuntu-2d.mandatory
469+ fi
470+ if [ -d /var/lib/gconf/ubuntu-2d.default ]; then
471+ rm -rf /var/lib/gconf/ubuntu-2d.default
472 fi
473 ;;
474 esac
475
476=== added file 'debian/unity-2d.preinst'
477--- debian/unity-2d.preinst 1970-01-01 00:00:00 +0000
478+++ debian/unity-2d.preinst 2011-08-24 12:47:31 +0000
479@@ -0,0 +1,16 @@
480+#!/bin/sh
481+set -e
482+
483+case "$1" in
484+ install|upgrade)
485+ if dpkg --compare-versions "$2" le "3.8.6-0ubuntu1"; then
486+ if [ -d /var/lib/gconf/unity-2d.mandatory ]; then
487+ mv /var/lib/gconf/unity-2d.mandatory /var/lib/gconf/ubuntu-2d.mandatory || true
488+ mv /var/lib/gconf/unity-2d.default /var/lib/gconf/ubuntu-2d.default || true
489+ fi
490+ fi
491+ ;;
492+esac
493+
494+#DEBHELPER#
495+
496
497=== modified file 'launcher/Launcher.qml'
498--- launcher/Launcher.qml 2011-08-01 11:58:35 +0000
499+++ launcher/Launcher.qml 2011-08-24 12:47:31 +0000
500@@ -22,7 +22,10 @@
501 LauncherDropItem {
502 id: launcher
503
504+ Accessible.name: "root"
505+
506 GnomeBackground {
507+ Accessible.name: "background"
508 anchors.fill: parent
509 overlay_color: "black"
510 overlay_alpha: 0.66
511@@ -30,6 +33,7 @@
512 }
513
514 Rectangle {
515+ Accessible.name: "background"
516 anchors.fill: parent
517 color: "black"
518 opacity: 0.66
519@@ -37,6 +41,7 @@
520 }
521
522 Image {
523+ Accessible.name: "border"
524 id: border
525
526 width: 1
527@@ -50,12 +55,16 @@
528 onWebpageUrlDropped: applications.insertWebFavorite(url)
529
530 FocusScope {
531+ Accessible.name: "content"
532+
533 focus: true
534 anchors.fill: parent
535 z: 1 /* ensure the lists are always strictly on top of the background */
536
537 LauncherList {
538 id: main
539+ Accessible.name: "main"
540+
541 anchors.top: parent.top
542 anchors.bottom: shelf.top
543 anchors.bottomMargin: itemPadding
544@@ -75,6 +84,8 @@
545
546 LauncherList {
547 id: shelf
548+ Accessible.name: "shelf"
549+
550 anchors.bottom: parent.bottom
551 anchors.bottomMargin: main.anchors.bottomMargin
552 height: (tileSize + itemPadding) * count
553@@ -92,23 +103,14 @@
554 }
555 }
556
557- SortFilterProxyModel {
558- id: visiblePlaces
559- model: places
560- dynamicSortFilter: true
561-
562- filterRole: Place.RoleShowEntry
563- filterRegExp: RegExp("^true$")
564+ BfbModel {
565+ id: bfbModel
566 }
567
568 LauncherApplicationsList {
569 id: applications
570 }
571
572- LauncherPlacesList {
573- id: places
574- }
575-
576 LauncherDevicesList {
577 id: devices
578 }
579@@ -129,9 +131,9 @@
580 }
581
582 Component.onCompleted: {
583+ items.appendModel(bfbModel);
584 items.appendModel(applications);
585 items.appendModel(workspaces);
586- items.appendModel(visiblePlaces);
587 items.appendModel(devices);
588 shelfItems.appendModel(trashes);
589 }
590
591=== modified file 'launcher/LauncherItem.qml'
592--- launcher/LauncherItem.qml 2011-07-14 11:17:30 +0000
593+++ launcher/LauncherItem.qml 2011-08-24 12:47:31 +0000
594@@ -48,6 +48,8 @@
595 DropItem {
596 id: item
597
598+ Accessible.role: Accessible.PushButton
599+
600 anchors.horizontalCenter: parent.horizontalCenter
601
602 property int padding
603
604=== modified file 'launcher/LauncherList.qml'
605--- launcher/LauncherList.qml 2011-08-10 11:58:31 +0000
606+++ launcher/LauncherList.qml 2011-08-24 12:47:31 +0000
607@@ -77,6 +77,17 @@
608 delegate: LauncherItem {
609 id: launcherItem
610
611+ function accessibleDescription() {
612+ if (running) {
613+ var windows = u2d.tr("%1 window opened", "%1 windows opened", item.windowCount).arg(item.windowCount)
614+ return "%1 %2".arg(item.name).arg(windows)
615+ } else {
616+ return "%1 %2".arg(item.name).arg(u2d.tr("not running"))
617+ }
618+ }
619+
620+ Accessible.name: accessibleDescription()
621+
622 width: list.width
623 tileSize: list.tileSize
624 padding: list.itemPadding
625
626=== modified file 'launcher/app/launcher.cpp'
627--- launcher/app/launcher.cpp 2011-08-09 13:33:24 +0000
628+++ launcher/app/launcher.cpp 2011-08-24 12:47:31 +0000
629@@ -78,6 +78,7 @@
630 {
631 Unity2dApplication::earlySetup(argc, argv);
632 Unity2dApplication application(argc, argv);
633+ application.setApplicationName("Unity 2D Launcher");
634 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());
635
636 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop");
637@@ -91,6 +92,7 @@
638 Unity2dPanel panel(true);
639 panel.setEdge(Unity2dPanel::LeftEdge);
640 panel.setFixedWidth(LauncherClient::MaximumWidth);
641+ panel.setAccessibleName("Launcher");
642
643 VisibilityController* visibilityController = new VisibilityController(&panel);
644
645
646=== modified file 'launcher/app/launcherview.cpp'
647--- launcher/app/launcherview.cpp 2011-08-01 11:58:35 +0000
648+++ launcher/app/launcherview.cpp 2011-08-24 12:47:31 +0000
649@@ -56,8 +56,7 @@
650 static const char* DASH_DBUS_PROPERTY_ACTIVE = "active";
651 static const char* DASH_DBUS_METHOD_ACTIVATE_HOME = "activateHome";
652 static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown";
653-static const char* APPLICATIONS_PLACE = "/usr/share/unity/places/applications.place";
654-static const char* COMMANDS_PLACE_ENTRY = "Runner";
655+static const char* COMMANDS_LENS_ID = "commands.lens";
656 static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
657
658 LauncherView::LauncherView(QWidget* parent) :
659@@ -79,9 +78,9 @@
660 Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);
661 connect(altF1, SIGNAL(pressed()), SLOT(forceActivateWindow()));
662
663- /* Alt+F2 shows the dash with the commands place entry activated. */
664+ /* Alt+F2 shows the dash with the commands lens activated. */
665 Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);
666- connect(altF2, SIGNAL(pressed()), SLOT(showCommandsPlace()));
667+ connect(altF2, SIGNAL(pressed()), SLOT(showCommandsLens()));
668
669 /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */
670 for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {
671@@ -232,10 +231,9 @@
672 }
673
674 void
675-LauncherView::showCommandsPlace()
676+LauncherView::showCommandsLens()
677 {
678 QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
679- dashInterface.asyncCall("activatePlaceEntry",
680- APPLICATIONS_PLACE, COMMANDS_PLACE_ENTRY, 0);
681+ dashInterface.asyncCall("activateLens", COMMANDS_LENS_ID);
682 }
683
684
685=== modified file 'launcher/app/launcherview.h'
686--- launcher/app/launcherview.h 2011-08-01 11:58:35 +0000
687+++ launcher/app/launcherview.h 2011-08-24 12:47:31 +0000
688@@ -57,7 +57,7 @@
689 void updateSuperKeyMonitoring();
690 void updateSuperKeyHoldState();
691 void toggleDash();
692- void showCommandsPlace();
693+ void showCommandsLens();
694
695 protected:
696 void focusInEvent(QFocusEvent* event);
697
698=== modified file 'libunity-2d-private/CMakeLists.txt'
699--- libunity-2d-private/CMakeLists.txt 2011-07-29 13:49:34 +0000
700+++ libunity-2d-private/CMakeLists.txt 2011-08-24 12:47:31 +0000
701@@ -6,8 +6,10 @@
702 pkg_check_modules(QTDEE REQUIRED libqtdee)
703 pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)
704 pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)
705-pkg_check_modules(INDICATOR REQUIRED indicator)
706+pkg_check_modules(INDICATOR REQUIRED indicator3-0.4)
707 pkg_check_modules(DCONFQT REQUIRED dconf-qt)
708+pkg_check_modules(UNITYCORE REQUIRED unity-core-4.0)
709+pkg_check_modules(DEE REQUIRED dee-1.0)
710
711 set(libunity-2d-private_SOVERSION 0)
712 set(libunity-2d-private_VERSION ${libunity-2d-private_SOVERSION}.0.0)
713
714=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
715--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-29 13:49:34 +0000
716+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-08-24 12:47:31 +0000
717@@ -30,6 +30,9 @@
718 ${INDICATOR_INCLUDE_DIRS}
719 ${X11_INCLUDE_DIR}
720 ${DCONFQT_INCLUDE_DIRS}
721+ ${UNITYCORE_INCLUDE_DIRS}
722+ ${NUXCORE_INCLUDE_DIRS}
723+ ${DEE_INCLUDE_DIRS}
724 ${libunity-2d-private_SOURCE_DIR}/src
725 )
726
727
728=== modified file 'libunity-2d-private/Unity2d/GnomeBackground.qml'
729--- libunity-2d-private/Unity2d/GnomeBackground.qml 2011-08-09 13:33:24 +0000
730+++ libunity-2d-private/Unity2d/GnomeBackground.qml 2011-08-24 12:47:31 +0000
731@@ -17,7 +17,7 @@
732 */
733
734 import QtQuick 1.0
735-import gconf 1.0
736+import QConf 1.0
737 /* Necessary to access the blended image provider and CacheEffect */
738 import Unity2d 1.0
739
740@@ -32,19 +32,9 @@
741 property bool cached: true
742 effect: (cached) ? cacheEffect : null
743
744- GConfItem {
745- id: primary_color
746- key: "/desktop/gnome/background/primary_color"
747- }
748-
749- GConfItem {
750- id: picture_filename
751- key: "/desktop/gnome/background/picture_filename"
752- }
753-
754- GConfItem {
755- id: picture_options
756- key: "/desktop/gnome/background/picture_options"
757+ QConf {
758+ id: desktopBackground
759+ schema: "org.gnome.desktop.background"
760 }
761
762 Rectangle {
763@@ -55,13 +45,13 @@
764 }
765
766 anchors.fill: parent
767- color: primary_color.value
768+ color: desktopBackground.primaryColor
769 }
770
771 Image {
772 id: picture
773
774- visible: picture_filename.value
775+ visible: desktopBackground.pictureUri
776 source: {
777 if (!visible) return ""
778
779@@ -74,8 +64,8 @@
780 https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/296538
781 http://bugreports.qt.nokia.com/browse/QTBUG-7276
782 */
783- var filename = picture_filename.value
784- if(filename == "/usr/share/backgrounds/warty-final-ubuntu.png")
785+ var filename = desktopBackground.pictureUri
786+ if(filename == "file:///usr/share/backgrounds/warty-final-ubuntu.png")
787 filename = "/usr/share/unity-2d/warty-final-ubuntu.jpg"
788
789 if(overlay_alpha > 0.0)
790@@ -99,13 +89,13 @@
791 - "spanned" (NOT IMPLEMENTED)
792 */
793 fillMode: {
794- if(picture_options.value == "wallpaper")
795+ if(desktopBackground.pictureOptions== "wallpaper")
796 return Image.Tile
797- else if(picture_options.value == "scaled")
798+ else if(desktopBackground.pictureOptions == "scaled")
799 return Image.PreserveAspectFit
800- else if(picture_options.value == "stretched")
801+ else if(desktopBackground.pictureOptions == "stretched")
802 return Image.Stretch
803- else if(picture_options.value == "zoom")
804+ else if(desktopBackground.pictureOptions == "zoom")
805 return Image.PreserveAspectCrop
806 else return Image.PreserveAspectFit
807 }
808
809=== modified file 'libunity-2d-private/Unity2d/plugin.cpp'
810--- libunity-2d-private/Unity2d/plugin.cpp 2011-08-23 09:42:44 +0000
811+++ libunity-2d-private/Unity2d/plugin.cpp 2011-08-24 12:47:31 +0000
812@@ -20,10 +20,6 @@
813 /* Required otherwise using wnck_set_client_type breaks linking with error:
814 undefined reference to `wnck_set_client_type(WnckClientType)'
815 */
816-extern "C" {
817-#include <libwnck/util.h>
818-}
819-
820 #include "plugin.h"
821
822 #include "launcherapplication.h"
823@@ -60,6 +56,10 @@
824 #include "autohidebehavior.h"
825 #include "intellihidebehavior.h"
826 #include "forcevisiblebehavior.h"
827+#include "bfb.h"
828+
829+#include "lenses.h"
830+#include "lens.h"
831
832 #include <QtDeclarative/qdeclarative.h>
833 #include <QDeclarativeEngine>
834@@ -108,6 +108,9 @@
835
836 qmlRegisterType<ListAggregatorModel>(uri, 0, 1, "ListAggregatorModel");
837
838+ qmlRegisterType<BfbModel>(uri, 0, 1, "BfbModel");
839+ qmlRegisterType<BfbItem>(uri, 0, 1, "BfbItem");
840+
841 qmlRegisterType<LauncherApplicationsList>(uri, 0, 1, "LauncherApplicationsList");
842 qmlRegisterType<LauncherApplication>(uri, 0, 1, "LauncherApplication");
843
844@@ -133,6 +136,9 @@
845 qmlRegisterType<IconUtilities>(); // Register the type as non creatable
846
847 qmlRegisterType<GioDefaultApplication>(uri, 0, 1, "GioDefaultApplication");
848+
849+ qmlRegisterType<Lenses>(uri, 1, 0, "Lenses");
850+ qmlRegisterType<Lens>(uri, 1, 0, "Lens");
851 }
852
853 void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
854
855=== modified file 'libunity-2d-private/src/CMakeLists.txt'
856--- libunity-2d-private/src/CMakeLists.txt 2011-08-16 10:40:14 +0000
857+++ libunity-2d-private/src/CMakeLists.txt 2011-08-24 12:47:31 +0000
858@@ -2,7 +2,11 @@
859
860 # Sources
861 set(lib${LIB_NAME}_SRCS
862+ bfb.cpp
863+ dashclient.cpp
864+ debug.cpp
865 gconnector.cpp
866+ gimageutils.cpp
867 gnomesessionclient.cpp
868 keyboardmodifiersmonitor.cpp
869 hotkeymonitor.cpp
870@@ -53,7 +57,16 @@
871 workspaces.cpp
872 launcherdropitem.cpp
873 iconutilities.cpp
874+ lenses.cpp
875+ lens.cpp
876+ filter.cpp
877+ ratingsfilter.cpp
878+ cairoutils.cpp
879+ indicatorentrywidget.cpp
880+ indicatorsmanager.cpp
881+ indicatorwidget.cpp
882 panelapplet.cpp
883+ panelstyle.cpp
884 )
885
886 # Build
887@@ -65,6 +78,8 @@
888 ${CMAKE_CURRENT_BINARY_DIR}
889 ${CMAKE_CURRENT_SOURCE_DIR}
890 ${GLIB_INCLUDE_DIRS}
891+ ${GTK_INCLUDE_DIRS}
892+ ${PANGO_INCLUDE_DIRS}
893 ${WNCK_INCLUDE_DIRS}
894 ${QTBAMF_INCLUDE_DIRS}
895 ${QTGCONF_INCLUDE_DIRS}
896@@ -76,6 +91,9 @@
897 ${INDICATOR_INCLUDE_DIRS}
898 ${X11_INCLUDE_DIR}
899 ${DCONFQT_INCLUDE_DIRS}
900+ ${UNITYCORE_INCLUDE_DIRS}
901+ ${NUXCORE_INCLUDE_DIRS}
902+ ${DEE_INCLUDE_DIRS}
903 )
904
905 add_library(${LIB_NAME} SHARED ${libunity-2d-private_SRCS})
906@@ -94,6 +112,8 @@
907 ${QT_QTNETWORK_LIBRARIES}
908 ${X11_LIBRARIES}
909 ${GLIB_LDFLAGS}
910+ ${GTK_LDFLAGS}
911+ ${PANGO_LDFLAGS}
912 ${WNCK_LDFLAGS}
913 ${GDK_LDFLAGS}
914 ${GIO_LDFLAGS}
915@@ -105,6 +125,9 @@
916 ${STARTUPNOTIFICATION_LDFLAGS}
917 ${INDICATOR_LDFLAGS}
918 ${DCONFQT_LDFLAGS}
919+ ${UNITYCORE_LDFLAGS}
920+ ${NUXCORE_LDFLAGS}
921+ ${DEE_LDFLAGS}
922 )
923
924 # Install
925
926=== added file 'libunity-2d-private/src/bfb.cpp'
927--- libunity-2d-private/src/bfb.cpp 1970-01-01 00:00:00 +0000
928+++ libunity-2d-private/src/bfb.cpp 2011-08-24 12:47:31 +0000
929@@ -0,0 +1,119 @@
930+/*
931+ * Copyright (C) 2011 Canonical, Ltd.
932+ *
933+ * Authors:
934+ * Aurélien Gâteau <aurelien.gateau@canonical.com>
935+ *
936+ * This program is free software; you can redistribute it and/or modify
937+ * it under the terms of the GNU General Public License as published by
938+ * the Free Software Foundation; version 3.
939+ *
940+ * This program is distributed in the hope that it will be useful,
941+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
942+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
943+ * GNU General Public License for more details.
944+ *
945+ * You should have received a copy of the GNU General Public License
946+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
947+ */
948+
949+#include "bfb.h"
950+
951+// libunity-2d
952+#include <dashclient.h>
953+#include <debug_p.h>
954+#include <unity2dtr.h>
955+
956+// Qt
957+
958+BfbItem::BfbItem()
959+: m_active(false)
960+{
961+ connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)),
962+ SLOT(slotActivePageChanged(const QString&)));
963+}
964+
965+BfbItem::~BfbItem()
966+{
967+}
968+
969+bool BfbItem::active() const
970+{
971+ return m_active;
972+}
973+
974+void BfbItem::slotActivePageChanged(const QString& page)
975+{
976+ bool active = !page.isEmpty();
977+ if (m_active != active) {
978+ m_active = active;
979+ activeChanged(m_active);
980+ }
981+}
982+
983+bool BfbItem::running() const
984+{
985+ return false;
986+}
987+
988+int BfbItem::windowCount() const
989+{
990+ return 0;
991+}
992+
993+bool BfbItem::urgent() const
994+{
995+ return false;
996+}
997+
998+QString BfbItem::name() const
999+{
1000+ return u2dTr("Dash");
1001+}
1002+
1003+QString BfbItem::icon() const
1004+{
1005+ return "unity-icon-theme/distributor-logo";
1006+}
1007+
1008+bool BfbItem::launching() const
1009+{
1010+ return false;
1011+}
1012+
1013+void BfbItem::activate()
1014+{
1015+ DashClient::instance()->setActivePage(m_active ? "" : "home");
1016+}
1017+
1018+void BfbItem::createMenuActions()
1019+{
1020+}
1021+
1022+////////////////////////////////////////////////////////////
1023+BfbModel::BfbModel(QObject* parent)
1024+: QAbstractListModel(parent)
1025+, m_bfbItem(new BfbItem)
1026+{
1027+}
1028+
1029+BfbModel::~BfbModel()
1030+{
1031+ delete m_bfbItem;
1032+}
1033+
1034+int BfbModel::rowCount(const QModelIndex& /*parent*/) const
1035+{
1036+ return 1;
1037+}
1038+
1039+QVariant BfbModel::data(const QModelIndex& index, int /*role*/) const
1040+{
1041+ if (!index.isValid()) {
1042+ return QVariant();
1043+ }
1044+
1045+ return QVariant::fromValue(m_bfbItem);
1046+}
1047+
1048+#include <bfb.moc>
1049
1050=== added file 'libunity-2d-private/src/bfb.h'
1051--- libunity-2d-private/src/bfb.h 1970-01-01 00:00:00 +0000
1052+++ libunity-2d-private/src/bfb.h 2011-08-24 12:47:31 +0000
1053@@ -0,0 +1,75 @@
1054+/*
1055+ * Copyright (C) 2011 Canonical, Ltd.
1056+ *
1057+ * Authors:
1058+ * Aurélien Gâteau <aurelien.gateau@canonical.com>
1059+ *
1060+ * This program is free software; you can redistribute it and/or modify
1061+ * it under the terms of the GNU General Public License as published by
1062+ * the Free Software Foundation; version 3.
1063+ *
1064+ * This program is distributed in the hope that it will be useful,
1065+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1066+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1067+ * GNU General Public License for more details.
1068+ *
1069+ * You should have received a copy of the GNU General Public License
1070+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1071+ */
1072+
1073+#ifndef BFB_H
1074+#define BFB_H
1075+
1076+#include "launcheritem.h"
1077+
1078+// Qt
1079+#include <QAbstractListModel>
1080+#include <QMetaType>
1081+
1082+class BfbItem : public LauncherItem
1083+{
1084+ Q_OBJECT
1085+public:
1086+ BfbItem();
1087+ ~BfbItem();
1088+
1089+ /* getters */
1090+ virtual bool active() const;
1091+ virtual bool running() const;
1092+ virtual int windowCount() const;
1093+ virtual bool urgent() const;
1094+ virtual QString name() const;
1095+ virtual QString icon() const;
1096+ virtual bool launching() const;
1097+
1098+ /* methods */
1099+ Q_INVOKABLE virtual void activate();
1100+ Q_INVOKABLE virtual void createMenuActions();
1101+
1102+private Q_SLOTS:
1103+ void slotActivePageChanged(const QString&);
1104+
1105+private:
1106+ Q_DISABLE_COPY(BfbItem)
1107+ bool m_active;
1108+};
1109+
1110+Q_DECLARE_METATYPE(BfbItem*)
1111+
1112+
1113+class BfbModel : public QAbstractListModel
1114+{
1115+ Q_OBJECT
1116+public:
1117+ BfbModel(QObject* parent = 0);
1118+ ~BfbModel();
1119+
1120+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
1121+ int rowCount(const QModelIndex& parent = QModelIndex()) const;
1122+
1123+private:
1124+ Q_DISABLE_COPY(BfbModel)
1125+ BfbItem* m_bfbItem;
1126+};
1127+
1128+#endif // BFB_H
1129
1130=== added file 'libunity-2d-private/src/cairoutils.cpp'
1131--- libunity-2d-private/src/cairoutils.cpp 1970-01-01 00:00:00 +0000
1132+++ libunity-2d-private/src/cairoutils.cpp 2011-08-24 12:47:31 +0000
1133@@ -0,0 +1,42 @@
1134+/*
1135+ * This file is part of unity-2d
1136+ *
1137+ * Copyright 2011 Canonical Ltd.
1138+ *
1139+ * Authors:
1140+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1141+ *
1142+ * This program is free software; you can redistribute it and/or modify
1143+ * it under the terms of the GNU General Public License as published by
1144+ * the Free Software Foundation; version 3.
1145+ *
1146+ * This program is distributed in the hope that it will be useful,
1147+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1148+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1149+ * GNU General Public License for more details.
1150+ *
1151+ * You should have received a copy of the GNU General Public License
1152+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1153+ */
1154+// Self
1155+#include "cairoutils.h"
1156+
1157+// Local
1158+
1159+// Qt
1160+#include <QImage>
1161+
1162+namespace CairoUtils {
1163+
1164+cairo_surface_t* createSurfaceForQImage(QImage* image)
1165+{
1166+ return cairo_image_surface_create_for_data(
1167+ image->bits(),
1168+ CAIRO_FORMAT_ARGB32,
1169+ image->width(),
1170+ image->height(),
1171+ image->bytesPerLine()
1172+ );
1173+}
1174+
1175+} // namespace
1176
1177=== added file 'libunity-2d-private/src/cairoutils.h'
1178--- libunity-2d-private/src/cairoutils.h 1970-01-01 00:00:00 +0000
1179+++ libunity-2d-private/src/cairoutils.h 2011-08-24 12:47:31 +0000
1180@@ -0,0 +1,47 @@
1181+/*
1182+ * This file is part of unity-2d
1183+ *
1184+ * Copyright 2011 Canonical Ltd.
1185+ *
1186+ * Authors:
1187+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1188+ *
1189+ * This program is free software; you can redistribute it and/or modify
1190+ * it under the terms of the GNU General Public License as published by
1191+ * the Free Software Foundation; version 3.
1192+ *
1193+ * This program is distributed in the hope that it will be useful,
1194+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1195+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1196+ * GNU General Public License for more details.
1197+ *
1198+ * You should have received a copy of the GNU General Public License
1199+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1200+ */
1201+#ifndef CAIROUTILS_H
1202+#define CAIROUTILS_H
1203+
1204+// Local
1205+#include <gscopedpointer.h>
1206+
1207+// Qt
1208+
1209+// Cairo
1210+#include <cairo.h>
1211+
1212+class QImage;
1213+
1214+namespace CairoUtils {
1215+
1216+typedef GScopedPointer<cairo_surface_t, cairo_surface_destroy> SurfacePointer;
1217+typedef GScopedPointer<cairo_t, cairo_destroy> Pointer;
1218+
1219+/**
1220+ * Creates a Cairo surface for a QImage.
1221+ * QImage format must be Format_ARGB32_Premultiplied.
1222+ */
1223+cairo_surface_t* createSurfaceForQImage(QImage*);
1224+
1225+} // namespace
1226+
1227+#endif /* CAIROUTILS_H */
1228
1229=== added file 'libunity-2d-private/src/dashclient.cpp'
1230--- libunity-2d-private/src/dashclient.cpp 1970-01-01 00:00:00 +0000
1231+++ libunity-2d-private/src/dashclient.cpp 2011-08-24 12:47:31 +0000
1232@@ -0,0 +1,155 @@
1233+/*
1234+ * This file is part of unity-2d
1235+ *
1236+ * Copyright 2011 Canonical Ltd.
1237+ *
1238+ * Authors:
1239+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1240+ *
1241+ * This program is free software; you can redistribute it and/or modify
1242+ * it under the terms of the GNU General Public License as published by
1243+ * the Free Software Foundation; version 3.
1244+ *
1245+ * This program is distributed in the hope that it will be useful,
1246+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1247+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1248+ * GNU General Public License for more details.
1249+ *
1250+ * You should have received a copy of the GNU General Public License
1251+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1252+ */
1253+// Self
1254+#include "dashclient.h"
1255+
1256+// Local
1257+
1258+// libunity-2d
1259+#include <debug_p.h>
1260+
1261+// Qt
1262+#include <QApplication>
1263+#include <QDBusConnection>
1264+#include <QDBusConnectionInterface>
1265+#include <QDBusInterface>
1266+#include <QDBusServiceWatcher>
1267+
1268+static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
1269+static const char* DASH_DBUS_PATH = "/Dash";
1270+static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
1271+
1272+DashClient::DashClient(QObject* parent)
1273+: QObject(parent)
1274+, m_dashDbusIface(0)
1275+, m_dashActive(false)
1276+{
1277+ /* Check if the dash is already up and running by asking the bus instead of
1278+ trying to create an instance of the interface. Creating an instance would
1279+ cause D-Bus to activate the dash and we don’t want this to happen, the
1280+ dash should be started on demand only. */
1281+ QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface();
1282+ QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(DASH_DBUS_SERVICE);
1283+ if (reply.isValid() && reply.value()) {
1284+ connectToDash();
1285+ } else {
1286+ /* The dash is not running: monitor its registration on the bus so we
1287+ can connect to it when it comes up. */
1288+ QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DASH_DBUS_SERVICE,
1289+ QDBusConnection::sessionBus(),
1290+ QDBusServiceWatcher::WatchForRegistration,
1291+ this);
1292+ connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash()));
1293+ }
1294+}
1295+
1296+void DashClient::connectToDash()
1297+{
1298+ if (m_dashDbusIface) {
1299+ return;
1300+ }
1301+
1302+ m_dashDbusIface = new QDBusInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE,
1303+ QDBusConnection::sessionBus(), this);
1304+ connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
1305+ SLOT(slotDashActiveChanged(bool)));
1306+ connect(m_dashDbusIface, SIGNAL(activeLensChanged(const QString&)),
1307+ SLOT(slotDashActiveLensChanged(const QString&)));
1308+
1309+ QVariant value = m_dashDbusIface->property("active");
1310+ if (value.isValid()) {
1311+ m_dashActive = value.toBool();
1312+ } else {
1313+ UQ_WARNING << "Fetching Dash.active property failed";
1314+ }
1315+ value = m_dashDbusIface->property("activeLens");
1316+ if (value.isValid()) {
1317+ m_dashActiveLens = value.toString();
1318+ } else {
1319+ UQ_WARNING << "Fetching Dash.activeLens property failed";
1320+ }
1321+
1322+ updateActivePage();
1323+}
1324+
1325+DashClient* DashClient::instance()
1326+{
1327+ static DashClient* client = new DashClient(qApp);
1328+ return client;
1329+}
1330+
1331+void DashClient::slotDashActiveChanged(bool value)
1332+{
1333+ if (m_dashActive != value) {
1334+ m_dashActive = value;
1335+ updateActivePage();
1336+ }
1337+}
1338+
1339+void DashClient::slotDashActiveLensChanged(const QString& lens)
1340+{
1341+ if (m_dashActiveLens != lens) {
1342+ m_dashActiveLens = lens;
1343+ updateActivePage();
1344+ }
1345+}
1346+
1347+QString DashClient::activePage() const
1348+{
1349+ return m_activePage;
1350+}
1351+
1352+void DashClient::setActivePage(const QString& page, const QString& lensId)
1353+{
1354+ if (m_activePage == page) {
1355+ return;
1356+ }
1357+ if (page.isEmpty()) {
1358+ // Use m_dashDbusIface to close the dash, but only if it is running
1359+ if (m_dashDbusIface) {
1360+ m_dashDbusIface->setProperty("active", false);
1361+ }
1362+ return;
1363+ }
1364+ // Use a separate QDBusInterface so that the dash is started if it is not
1365+ // already running
1366+ QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
1367+ if (page == "home") {
1368+ iface.asyncCall("activateHome");
1369+ } else {
1370+ iface.asyncCall("activateLens", lensId);
1371+ }
1372+}
1373+
1374+void DashClient::updateActivePage()
1375+{
1376+ QString activePage;
1377+ if (m_dashActive) {
1378+ activePage = m_dashActiveLens.isEmpty() ? "home" : m_dashActiveLens;
1379+ }
1380+
1381+ if (m_activePage != activePage) {
1382+ m_activePage = activePage;
1383+ activePageChanged(m_activePage);
1384+ }
1385+}
1386+
1387+#include "dashclient.moc"
1388
1389=== added file 'libunity-2d-private/src/dashclient.h'
1390--- libunity-2d-private/src/dashclient.h 1970-01-01 00:00:00 +0000
1391+++ libunity-2d-private/src/dashclient.h 2011-08-24 12:47:31 +0000
1392@@ -0,0 +1,68 @@
1393+/*
1394+ * This file is part of unity-2d
1395+ *
1396+ * Copyright 2011 Canonical Ltd.
1397+ *
1398+ * Authors:
1399+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1400+ *
1401+ * This program is free software; you can redistribute it and/or modify
1402+ * it under the terms of the GNU General Public License as published by
1403+ * the Free Software Foundation; version 3.
1404+ *
1405+ * This program is distributed in the hope that it will be useful,
1406+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1407+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1408+ * GNU General Public License for more details.
1409+ *
1410+ * You should have received a copy of the GNU General Public License
1411+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1412+ */
1413+#ifndef DASHCLIENT_H
1414+#define DASHCLIENT_H
1415+
1416+// Local
1417+
1418+// Qt
1419+#include <QObject>
1420+
1421+class QDBusInterface;
1422+
1423+/**
1424+ * Monitors the dash and provide a single point of entry to its status
1425+ */
1426+class DashClient : public QObject
1427+{
1428+ Q_OBJECT
1429+public:
1430+ static DashClient* instance();
1431+
1432+ /**
1433+ * Returns the active page. This is either:
1434+ * - The lens id of the active lens
1435+ * - "home" if the home is visible
1436+ * - "" if the dash is not visible
1437+ */
1438+ QString activePage() const;
1439+
1440+ void setActivePage(const QString& page, const QString& lensId=QString());
1441+
1442+Q_SIGNALS:
1443+ void activePageChanged(const QString&);
1444+
1445+private Q_SLOTS:
1446+ void connectToDash();
1447+ void slotDashActiveChanged(bool);
1448+ void slotDashActiveLensChanged(const QString&);
1449+
1450+private:
1451+ DashClient(QObject* parent=0);
1452+ void updateActivePage();
1453+
1454+ QDBusInterface* m_dashDbusIface;
1455+ bool m_dashActive;
1456+ QString m_dashActiveLens;
1457+ QString m_activePage;
1458+};
1459+
1460+#endif /* DASHCLIENT_H */
1461
1462=== added file 'libunity-2d-private/src/debug.cpp'
1463--- libunity-2d-private/src/debug.cpp 1970-01-01 00:00:00 +0000
1464+++ libunity-2d-private/src/debug.cpp 2011-08-24 12:47:31 +0000
1465@@ -0,0 +1,23 @@
1466+/* This file is part of unity-2d
1467+ Copyright 2011 Canonical
1468+ Author: Aurelien Gateau <aurelien.gateau@canonical.com>
1469+
1470+ This program is free software; you can redistribute it and/or modify
1471+ it under the terms of the GNU General Public License as published
1472+ by the Free Software Foundation; version 3.
1473+
1474+ This program is distributed in the hope that it will be useful,
1475+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1476+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1477+ GNU General Public License for more details.
1478+
1479+ You should have received a copy of the GNU General Public License
1480+ along with this program. If not, see <http://www.gnu.org/licenses/>.
1481+ */
1482+// Self
1483+#include <debug_p.h>
1484+
1485+QDebug operator<<(QDebug& dbg, const std::string& str)
1486+{
1487+ return dbg << QString::fromUtf8(str.c_str());
1488+}
1489
1490=== modified file 'libunity-2d-private/src/debug_p.h'
1491--- libunity-2d-private/src/debug_p.h 2011-03-28 14:06:14 +0000
1492+++ libunity-2d-private/src/debug_p.h 2011-08-24 12:47:31 +0000
1493@@ -17,8 +17,12 @@
1494 #ifndef DEBUG_P_H
1495 #define DEBUG_P_H
1496
1497+// Qt
1498 #include <QDebug>
1499
1500+// STL
1501+#include <string>
1502+
1503 #define _UQ_TRACE(level) (level().nospace() << __PRETTY_FUNCTION__ << ":").space()
1504
1505 // Simple macros to get KDebug like support
1506@@ -62,5 +66,7 @@
1507
1508 #define UQ_DEBUG_BLOCK Unity2dDebugBlock __unity2dDebugBlock__(__PRETTY_FUNCTION__)
1509
1510+// Support for outputing std::string with qDebug
1511+QDebug operator<<(QDebug& dbg, const std::string& str);
1512
1513 #endif /* DEBUG_P_H */
1514
1515=== added file 'libunity-2d-private/src/filter.cpp'
1516--- libunity-2d-private/src/filter.cpp 1970-01-01 00:00:00 +0000
1517+++ libunity-2d-private/src/filter.cpp 2011-08-24 12:47:31 +0000
1518@@ -0,0 +1,92 @@
1519+/*
1520+ * Copyright (C) 2011 Canonical, Ltd.
1521+ *
1522+ * Authors:
1523+ * Florian Boucault <florian.boucault@canonical.com>
1524+ *
1525+ * This program is free software; you can redistribute it and/or modify
1526+ * it under the terms of the GNU General Public License as published by
1527+ * the Free Software Foundation; version 3.
1528+ *
1529+ * This program is distributed in the hope that it will be useful,
1530+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1531+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1532+ * GNU General Public License for more details.
1533+ *
1534+ * You should have received a copy of the GNU General Public License
1535+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1536+ */
1537+
1538+// Self
1539+#include "filter.h"
1540+
1541+Filter::Filter(QObject *parent) :
1542+ QObject(parent)
1543+{
1544+}
1545+
1546+
1547+QString Filter::id() const
1548+{
1549+ return QString::fromStdString(m_unityFilter->id());
1550+}
1551+
1552+QString Filter::name() const
1553+{
1554+ return QString::fromStdString(m_unityFilter->name());
1555+}
1556+
1557+QString Filter::iconHint() const
1558+{
1559+ return QString::fromStdString(m_unityFilter->icon_hint());
1560+}
1561+
1562+QString Filter::rendererName() const
1563+{
1564+ return QString::fromStdString(m_unityFilter->renderer_name());
1565+}
1566+
1567+bool Filter::visible() const
1568+{
1569+ return m_unityFilter->visible();
1570+}
1571+
1572+bool Filter::collapsed() const
1573+{
1574+ return m_unityFilter->collapsed();
1575+}
1576+
1577+bool Filter::filtering() const
1578+{
1579+ return m_unityFilter->filtering();
1580+}
1581+
1582+void Filter::clear()
1583+{
1584+ m_unityFilter->Clear();
1585+}
1586+
1587+
1588+void Filter::setUnityFilter(unity::dash::Filter::Ptr filter)
1589+{
1590+ if (m_unityFilter != NULL) {
1591+ // FIXME: should disconnect from m_unityFilter's signals
1592+ }
1593+
1594+ m_unityFilter = filter;
1595+
1596+ /* Property change signals */
1597+ m_unityFilter->id.changed.connect(sigc::mem_fun(this, &Filter::idChanged));
1598+ m_unityFilter->name.changed.connect(sigc::mem_fun(this, &Filter::nameChanged));
1599+ m_unityFilter->icon_hint.changed.connect(sigc::mem_fun(this, &Filter::iconHintChanged));
1600+ m_unityFilter->renderer_name.changed.connect(sigc::mem_fun(this, &Filter::rendererNameChanged));
1601+ m_unityFilter->visible.changed.connect(sigc::mem_fun(this, &Filter::visibleChanged));
1602+ m_unityFilter->collapsed.changed.connect(sigc::mem_fun(this, &Filter::collapsedChanged));
1603+ m_unityFilter->filtering.changed.connect(sigc::mem_fun(this, &Filter::filteringChanged));
1604+
1605+ /* Signals forwarding */
1606+ m_unityFilter->removed.connect(sigc::mem_fun(this, &Filter::removed));
1607+}
1608+
1609+
1610+#include "filter.moc"
1611
1612=== added file 'libunity-2d-private/src/filter.h'
1613--- libunity-2d-private/src/filter.h 1970-01-01 00:00:00 +0000
1614+++ libunity-2d-private/src/filter.h 2011-08-24 12:47:31 +0000
1615@@ -0,0 +1,74 @@
1616+/*
1617+ * Copyright (C) 2011 Canonical, Ltd.
1618+ *
1619+ * Authors:
1620+ * Florian Boucault <florian.boucault@canonical.com>
1621+ *
1622+ * This program is free software; you can redistribute it and/or modify
1623+ * it under the terms of the GNU General Public License as published by
1624+ * the Free Software Foundation; version 3.
1625+ *
1626+ * This program is distributed in the hope that it will be useful,
1627+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1628+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1629+ * GNU General Public License for more details.
1630+ *
1631+ * You should have received a copy of the GNU General Public License
1632+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1633+ */
1634+
1635+#ifndef FILTER_H
1636+#define FILTER_H
1637+
1638+// Qt
1639+#include <QObject>
1640+#include <QMetaType>
1641+
1642+// libunity-core
1643+#include <UnityCore/Filter.h>
1644+
1645+class Filter : public QObject
1646+{
1647+ Q_OBJECT
1648+
1649+ Q_PROPERTY(QString id READ id NOTIFY idChanged)
1650+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
1651+ Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
1652+ Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
1653+ Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
1654+ Q_PROPERTY(bool collapsed READ collapsed NOTIFY collapsedChanged)
1655+ Q_PROPERTY(bool filtering READ filtering NOTIFY filteringChanged)
1656+
1657+public:
1658+ explicit Filter(QObject *parent = 0);
1659+
1660+ /* getters */
1661+ QString id() const;
1662+ QString name() const;
1663+ QString iconHint() const;
1664+ QString rendererName() const;
1665+ bool visible() const;
1666+ bool collapsed() const;
1667+ bool filtering() const;
1668+
1669+ void clear();
1670+ virtual void setUnityFilter(unity::dash::Filter::Ptr filter);
1671+
1672+Q_SIGNALS:
1673+ void idChanged(std::string);
1674+ void nameChanged(std::string);
1675+ void iconHintChanged(std::string);
1676+ void rendererNameChanged(std::string);
1677+ void visibleChanged(bool);
1678+ void collapsedChanged(bool);
1679+ void filteringChanged(bool);
1680+
1681+ void removed();
1682+
1683+protected:
1684+ unity::dash::Filter::Ptr m_unityFilter;
1685+};
1686+
1687+Q_DECLARE_METATYPE(Filter*)
1688+
1689+#endif // FILTER_H
1690
1691=== added file 'libunity-2d-private/src/gimageutils.cpp'
1692--- libunity-2d-private/src/gimageutils.cpp 1970-01-01 00:00:00 +0000
1693+++ libunity-2d-private/src/gimageutils.cpp 2011-08-24 12:47:31 +0000
1694@@ -0,0 +1,102 @@
1695+/*
1696+ * This file is part of unity-2d
1697+ *
1698+ * Copyright 2011 Canonical Ltd.
1699+ *
1700+ * Authors:
1701+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1702+ *
1703+ * This program is free software; you can redistribute it and/or modify
1704+ * it under the terms of the GNU General Public License as published by
1705+ * the Free Software Foundation; version 3.
1706+ *
1707+ * This program is distributed in the hope that it will be useful,
1708+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1709+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1710+ * GNU General Public License for more details.
1711+ *
1712+ * You should have received a copy of the GNU General Public License
1713+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1714+ */
1715+// Self
1716+#include <gimageutils.h>
1717+
1718+// Local
1719+#include <debug_p.h>
1720+#include <gscopedpointer.h>
1721+
1722+// Qt
1723+#include <QByteArray>
1724+#include <QImage>
1725+
1726+// GTK
1727+#include <gtk/gtk.h>
1728+
1729+namespace GImageUtils
1730+{
1731+
1732+QImage imageForIconString(const QString& name, int size, GtkIconTheme* theme)
1733+{
1734+ if (!theme) {
1735+ theme = gtk_icon_theme_get_default();
1736+ }
1737+ QByteArray utf8Name = name.toUtf8();
1738+
1739+ /* Load the icon by creating a GIcon from the string icon_name.
1740+ icon_name can contain more than a simple icon name but possibly
1741+ a string as returned by g_icon_to_string().
1742+ */
1743+ GObjectScopedPointer<GIcon> icon(g_icon_new_for_string(utf8Name.data(), NULL));
1744+ GScopedPointer<GtkIconInfo, gtk_icon_info_free> iconInfo;
1745+ iconInfo.reset(gtk_icon_theme_lookup_by_gicon(
1746+ theme,
1747+ icon.data(),
1748+ size,
1749+ (GtkIconLookupFlags)0)
1750+ );
1751+
1752+ if (!iconInfo) {
1753+ UQ_WARNING << "Failed to find icon:" << name;
1754+ return QImage();
1755+ }
1756+
1757+ GObjectScopedPointer<GdkPixbuf> pixbuf(gtk_icon_info_load_icon(iconInfo.data(), NULL));
1758+ if (!pixbuf) {
1759+ UQ_WARNING << "Failed to load icon:" << name;
1760+ return QImage();
1761+ }
1762+
1763+ return imageForPixbuf(pixbuf.data());
1764+}
1765+
1766+QImage imageForPixbuf(const GdkPixbuf* pixbuf)
1767+{
1768+ QImage image(gdk_pixbuf_get_pixels(pixbuf),
1769+ gdk_pixbuf_get_width(pixbuf),
1770+ gdk_pixbuf_get_height(pixbuf),
1771+ gdk_pixbuf_get_rowstride(pixbuf),
1772+ QImage::Format_ARGB32);
1773+
1774+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1775+ /* ABGR → ARGB */
1776+ QImage swappedImage = image.rgbSwapped();
1777+#else
1778+ /* ABGR → BGRA */
1779+ /* Reference: https://bugs.launchpad.net/unity-2d/+bug/758782 */
1780+ QImage swappedImage(image.size(), image.format());
1781+ for (int i = 0; i < swappedImage.height(); ++i) {
1782+ QRgb* p = (QRgb*) image.constScanLine(i);
1783+ QRgb* q = (QRgb*) swappedImage.scanLine(i);
1784+ QRgb* end = p + image.width();
1785+ while (p < end) {
1786+ *q = qRgba(qAlpha(*p), qRed(*p), qGreen(*p), qBlue(*p));
1787+ p++;
1788+ q++;
1789+ }
1790+ }
1791+#endif
1792+
1793+ return swappedImage;
1794+}
1795+
1796+} // namespace
1797
1798=== added file 'libunity-2d-private/src/gimageutils.h'
1799--- libunity-2d-private/src/gimageutils.h 1970-01-01 00:00:00 +0000
1800+++ libunity-2d-private/src/gimageutils.h 2011-08-24 12:47:31 +0000
1801@@ -0,0 +1,46 @@
1802+/*
1803+ * This file is part of unity-2d
1804+ *
1805+ * Copyright 2011 Canonical Ltd.
1806+ *
1807+ * Authors:
1808+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1809+ *
1810+ * This program is free software; you can redistribute it and/or modify
1811+ * it under the terms of the GNU General Public License as published by
1812+ * the Free Software Foundation; version 3.
1813+ *
1814+ * This program is distributed in the hope that it will be useful,
1815+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1816+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1817+ * GNU General Public License for more details.
1818+ *
1819+ * You should have received a copy of the GNU General Public License
1820+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1821+ */
1822+#ifndef GIMAGEUTILS_H
1823+#define GIMAGEUTILS_H
1824+
1825+// Local
1826+
1827+// Qt
1828+
1829+class QImage;
1830+class QString;
1831+
1832+struct _GdkPixbuf;
1833+struct _GtkIconTheme;
1834+
1835+/**
1836+ * Helper methods to deal with GTK images
1837+ */
1838+namespace GImageUtils
1839+{
1840+
1841+QImage imageForIconString(const QString& name, int size, struct _GtkIconTheme* theme = 0);
1842+
1843+QImage imageForPixbuf(const struct _GdkPixbuf* pixbuf);
1844+
1845+} // namespace
1846+
1847+#endif /* GIMAGEUTILS_H */
1848
1849=== modified file 'libunity-2d-private/src/iconimageprovider.cpp'
1850--- libunity-2d-private/src/iconimageprovider.cpp 2011-08-23 17:32:38 +0000
1851+++ libunity-2d-private/src/iconimageprovider.cpp 2011-08-24 12:47:31 +0000
1852@@ -23,6 +23,7 @@
1853 #include <QFile>
1854
1855 #include <debug_p.h>
1856+#include <gimageutils.h>
1857
1858 static const char* UNITY_RES_PATH = "/usr/share/unity/";
1859
1860@@ -114,62 +115,9 @@
1861 icon_name.chop(4);
1862 }
1863
1864- /* Load the icon by creating a GIcon from the string icon_name.
1865- icon_name can contain more than a simple icon name but possibly
1866- a string as returned by g_icon_to_string().
1867- */
1868- QByteArray byte_array = icon_name.toUtf8();
1869- gchar *g_icon_name = byte_array.data();
1870-
1871- GIcon *g_icon = g_icon_new_for_string(g_icon_name, NULL);
1872- GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(theme, g_icon,
1873- requestedSize.width(),
1874- (GtkIconLookupFlags)0);
1875- g_object_unref(g_icon);
1876-
1877- if (icon_info == NULL) {
1878- UQ_WARNING << "Failed to find icon:" << icon_name;
1879- return QImage();
1880- }
1881-
1882- GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon_info, NULL);
1883- gtk_icon_info_free(icon_info);
1884-
1885- if (pixbuf == NULL) {
1886- UQ_WARNING << "Failed to load icon:" << icon_name;
1887- return QImage();
1888- }
1889-
1890- QImage image(gdk_pixbuf_get_pixels(pixbuf),
1891- gdk_pixbuf_get_width(pixbuf),
1892- gdk_pixbuf_get_height(pixbuf),
1893- gdk_pixbuf_get_rowstride(pixbuf),
1894- QImage::Format_ARGB32);
1895-
1896-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1897- /* ABGR → ARGB */
1898- QImage swappedImage = image.rgbSwapped();
1899-#else
1900- /* ABGR → BGRA */
1901- /* Reference: https://bugs.launchpad.net/unity-2d/+bug/758782 */
1902- QImage swappedImage(image.size(), image.format());
1903- for (int i = 0; i < swappedImage.height(); ++i) {
1904- QRgb* p = (QRgb*) image.constScanLine(i);
1905- QRgb* q = (QRgb*) swappedImage.scanLine(i);
1906- QRgb* end = p + image.width();
1907- while (p < end) {
1908- *q = qRgba(qAlpha(*p), qRed(*p), qGreen(*p), qBlue(*p));
1909- p++;
1910- q++;
1911- }
1912- }
1913-#endif
1914-
1915- g_object_unref(pixbuf);
1916-
1917+ QImage image = GImageUtils::imageForIconString(icon_name, requestedSize.width(), theme);
1918 if (size) {
1919- *size = swappedImage.size();
1920+ *size = image.size();
1921 }
1922-
1923- return swappedImage;
1924+ return image;
1925 }
1926
1927=== added file 'libunity-2d-private/src/indicatorentrywidget.cpp'
1928--- libunity-2d-private/src/indicatorentrywidget.cpp 1970-01-01 00:00:00 +0000
1929+++ libunity-2d-private/src/indicatorentrywidget.cpp 2011-08-24 12:47:31 +0000
1930@@ -0,0 +1,378 @@
1931+/*
1932+ * This file is part of unity-2d
1933+ *
1934+ * Copyright 2011 Canonical Ltd.
1935+ *
1936+ * Authors:
1937+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
1938+ *
1939+ * This program is free software; you can redistribute it and/or modify
1940+ * it under the terms of the GNU General Public License as published by
1941+ * the Free Software Foundation; version 3.
1942+ *
1943+ * This program is distributed in the hope that it will be useful,
1944+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1945+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1946+ * GNU General Public License for more details.
1947+ *
1948+ * You should have received a copy of the GNU General Public License
1949+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1950+ */
1951+// Self
1952+#include "indicatorentrywidget.h"
1953+
1954+// Local
1955+#include <cairoutils.h>
1956+#include <debug_p.h>
1957+#include <gscopedpointer.h>
1958+#include <gimageutils.h>
1959+#include <panelstyle.h>
1960+
1961+// Qt
1962+#include <QIcon>
1963+#include <QPainter>
1964+#include <QWheelEvent>
1965+
1966+// GTK
1967+#include <gtk/gtk.h>
1968+
1969+// libc
1970+#include <time.h>
1971+
1972+static const int SPACING = 3;
1973+static const int PADDING = 3;
1974+static const int ICON_SIZE = 22;
1975+
1976+using namespace unity::indicator;
1977+
1978+IndicatorEntryWidget::IndicatorEntryWidget(const Entry::Ptr& entry)
1979+: m_entry(entry)
1980+, m_padding(PADDING)
1981+, m_hasIcon(false)
1982+, m_hasLabel(false)
1983+, m_gtkWidgetPath(gtk_widget_path_new())
1984+{
1985+ gtk_widget_path_append_type(m_gtkWidgetPath, GTK_TYPE_WINDOW);
1986+ gtk_widget_path_iter_set_name(m_gtkWidgetPath, -1 , "UnityPanelWidget");
1987+ gtk_widget_path_append_type(m_gtkWidgetPath, GTK_TYPE_MENU_BAR);
1988+ gtk_widget_path_append_type(m_gtkWidgetPath, GTK_TYPE_MENU_ITEM);
1989+
1990+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
1991+ m_entry->updated.connect(sigc::mem_fun(this, &IndicatorEntryWidget::updatePix));
1992+}
1993+
1994+IndicatorEntryWidget::~IndicatorEntryWidget()
1995+{
1996+ gtk_widget_path_free(m_gtkWidgetPath);
1997+}
1998+
1999+QSize IndicatorEntryWidget::minimumSizeHint() const
2000+{
2001+ return sizeHint();
2002+}
2003+
2004+QSize IndicatorEntryWidget::sizeHint() const
2005+{
2006+ return m_pix.size();
2007+}
2008+
2009+void IndicatorEntryWidget::resizeEvent(QResizeEvent* event)
2010+{
2011+ QWidget::resizeEvent(event);
2012+ updatePix();
2013+}
2014+
2015+void IndicatorEntryWidget::paintEvent(QPaintEvent*)
2016+{
2017+ if (!m_pix.isNull()) {
2018+ QPainter painter(this);
2019+ painter.drawPixmap(0, 0, m_pix);
2020+ }
2021+}
2022+
2023+
2024+void IndicatorEntryWidget::paintActiveBackground(QImage* image)
2025+{
2026+ // This code should be kept in sync with corresponding unityshell code from
2027+ // plugins/unityshell/src/PanelIndicatorObjectEntryView.cpp
2028+
2029+ // Get a surface and a context
2030+ CairoUtils::SurfacePointer surface(CairoUtils::createSurfaceForQImage(image));
2031+ CairoUtils::Pointer cr(cairo_create(surface.data()));
2032+
2033+ // Init style
2034+ GtkStyleContext* styleContext = PanelStyle::instance()->styleContext();
2035+
2036+ gtk_style_context_save(styleContext);
2037+
2038+ gtk_style_context_set_path(styleContext, m_gtkWidgetPath);
2039+ gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_MENUBAR);
2040+ gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_MENUITEM);
2041+ gtk_style_context_set_state(styleContext, GTK_STATE_FLAG_PRELIGHT);
2042+
2043+ // Draw
2044+ // FIXME(Cimi) probably some padding is needed here.
2045+ gtk_render_background(styleContext, cr.data(), 0, 0, width(), height());
2046+ gtk_render_frame(styleContext, cr.data(), 0, 0, width(), height());
2047+
2048+ // Clean up
2049+ gtk_style_context_restore(styleContext);
2050+}
2051+
2052+void IndicatorEntryWidget::updatePix()
2053+{
2054+ bool oldIsEmpty = isEmpty();
2055+
2056+ int width = m_padding;
2057+ int iconX = m_padding;
2058+ int labelX = 0;
2059+
2060+ GObjectScopedPointer<PangoLayout> pangoLayout;
2061+
2062+ // Compute width, labelX and update m_has{Icon,Label}
2063+ QPixmap iconPix;
2064+ if (m_entry->image_visible()) {
2065+ iconPix = decodeIcon();
2066+ m_hasIcon = !iconPix.isNull();
2067+ } else {
2068+ m_hasIcon = false;
2069+ }
2070+ if (m_hasIcon) {
2071+ width += iconPix.width();
2072+ }
2073+
2074+ m_hasLabel = !m_entry->label().empty() && m_entry->label_visible();
2075+ if (m_hasLabel) {
2076+ if (m_hasIcon) {
2077+ width += SPACING;
2078+ }
2079+ labelX = width;
2080+ pangoLayout.reset(createPangoLayout());
2081+ int labelWidth;
2082+ int labelHeight;
2083+ pango_layout_get_pixel_size(pangoLayout.data(), &labelWidth, &labelHeight);
2084+
2085+ width += labelWidth;
2086+ }
2087+
2088+ width += m_padding;
2089+
2090+ // Paint
2091+ QPixmap oldPix = m_pix;
2092+ if (!m_hasIcon && !m_hasLabel) {
2093+ m_pix = QPixmap();
2094+ } else {
2095+ QImage img(width, height(), QImage::Format_ARGB32_Premultiplied);
2096+ QPainter painter(&img);
2097+ painter.initFrom(this);
2098+ painter.eraseRect(img.rect());
2099+ if (m_entry->active()) {
2100+ paintActiveBackground(&img);
2101+ }
2102+ if (m_hasIcon) {
2103+ bool disabled = !m_entry->image_sensitive();
2104+ if (disabled) {
2105+ painter.setOpacity(0.5);
2106+ }
2107+ painter.drawPixmap(iconX, (height() - iconPix.height()) / 2, iconPix);
2108+ if (disabled) {
2109+ painter.setOpacity(1);
2110+ }
2111+ }
2112+ if (m_hasLabel) {
2113+ paintLabel(&img, pangoLayout.data(), labelX);
2114+ }
2115+ m_pix = QPixmap::fromImage(img);
2116+ }
2117+
2118+ // Notify others we changed, but only trigger a layout update if necessary
2119+ if (m_pix.size() == oldPix.size()) {
2120+ update();
2121+ } else {
2122+ updateGeometry();
2123+ }
2124+ bool newIsEmpty = isEmpty();
2125+ if (newIsEmpty != oldIsEmpty) {
2126+ // If we emit isEmptyChanged() directly it won't reach any connected
2127+ // slot. I assume this is because this method is called as a response
2128+ // to a sigc++ signal.
2129+ QMetaObject::invokeMethod(this, "isEmptyChanged", Qt::QueuedConnection);
2130+ }
2131+}
2132+
2133+PangoLayout* IndicatorEntryWidget::createPangoLayout()
2134+{
2135+ // Parse
2136+ PangoAttrList* attrs = NULL;
2137+ if (m_entry->show_now()) {
2138+ if (!pango_parse_markup(m_entry->label().c_str(),
2139+ -1,
2140+ '_',
2141+ &attrs,
2142+ NULL,
2143+ NULL,
2144+ NULL))
2145+ {
2146+ UQ_WARNING << "pango_parse_markup failed";
2147+ }
2148+ }
2149+
2150+ // Create layout
2151+ GObjectScopedPointer<PangoContext> pangoContext(gdk_pango_context_get());
2152+ PangoLayout* layout = pango_layout_new(pangoContext.data());
2153+
2154+ if (attrs) {
2155+ pango_layout_set_attributes(layout, attrs);
2156+ pango_attr_list_unref(attrs);
2157+ }
2158+
2159+ // Set font
2160+ char* font_description = NULL;
2161+ GtkSettings *settings = gtk_settings_get_default();
2162+ g_object_get(settings,
2163+ "gtk-font-name", &font_description,
2164+ NULL);
2165+ PangoFontDescription* desc = pango_font_description_from_string(font_description);
2166+ pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL);
2167+ pango_layout_set_font_description(layout, desc);
2168+ pango_font_description_free(desc);
2169+ g_free(font_description);
2170+
2171+ // Set text
2172+ QString label = QString::fromUtf8(m_entry->label().c_str());
2173+ label.replace('_', QString());
2174+ QByteArray utf8Label = label.toUtf8();
2175+ pango_layout_set_text(layout, utf8Label.data(), -1);
2176+
2177+ return layout;
2178+}
2179+
2180+void IndicatorEntryWidget::paintLabel(QImage* image, PangoLayout* layout, int labelX)
2181+{
2182+ // This code should be kept in sync with corresponding unityshell code from
2183+ // plugins/unityshell/src/PanelIndicatorObjectEntryView.cpp
2184+ int labelWidth, labelHeight;
2185+ pango_layout_get_pixel_size(layout, &labelWidth, &labelHeight);
2186+ CairoUtils::SurfacePointer surface(CairoUtils::createSurfaceForQImage(image));
2187+ CairoUtils::Pointer cr(cairo_create(surface.data()));
2188+ pango_cairo_update_layout(cr.data(), layout);
2189+
2190+ PanelStyle* style = PanelStyle::instance();
2191+ GtkStyleContext* styleContext = style->styleContext();
2192+
2193+ gtk_style_context_save(styleContext);
2194+
2195+ gtk_style_context_set_path(styleContext, m_gtkWidgetPath);
2196+ gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_MENUBAR);
2197+ gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_MENUITEM);
2198+
2199+ if (m_entry->active()) {
2200+ gtk_style_context_set_state(styleContext, GTK_STATE_FLAG_PRELIGHT);
2201+ }
2202+
2203+ gtk_render_layout(styleContext, cr.data(), labelX, (image->height() - labelHeight) / 2, layout);
2204+ gtk_style_context_restore(styleContext);
2205+}
2206+
2207+QPixmap IndicatorEntryWidget::decodeIcon()
2208+{
2209+ QPixmap pix;
2210+
2211+ int type = m_entry->image_type();
2212+
2213+ if (type == 0) {
2214+ // No icon
2215+ } else if (type == GTK_IMAGE_PIXBUF) {
2216+ QByteArray data = QByteArray::fromBase64(m_entry->image_data().c_str());
2217+ QImage image;
2218+ bool ok = image.loadFromData(data);
2219+ if (ok) {
2220+ pix = QPixmap::fromImage(image);
2221+ } else {
2222+ UQ_WARNING << "Failed to decode image";
2223+ }
2224+ } else if (type == GTK_IMAGE_ICON_NAME) {
2225+ QString name = QString::fromStdString(m_entry->image_data());
2226+ QIcon icon = QIcon::fromTheme(name);
2227+ pix = icon.pixmap(ICON_SIZE, ICON_SIZE);
2228+ } else if (type == GTK_IMAGE_GICON) {
2229+ QString name = QString::fromStdString(m_entry->image_data());
2230+ QImage image = GImageUtils::imageForIconString(name, ICON_SIZE);
2231+ if (image.isNull()) {
2232+ UQ_WARNING << "Failed to load icon from" << name;
2233+ return QPixmap();
2234+ }
2235+ return QPixmap::fromImage(image);
2236+ } else {
2237+ UQ_WARNING << "Unknown image type" << m_entry->image_type();
2238+ }
2239+ return pix;
2240+}
2241+
2242+void IndicatorEntryWidget::mousePressEvent(QMouseEvent* event)
2243+{
2244+ UQ_RETURN_IF_FAIL(m_hasIcon || m_hasLabel);
2245+ if (event->button() != Qt::MiddleButton)
2246+ showMenu(Qt::LeftButton);
2247+}
2248+
2249+void IndicatorEntryWidget::mouseReleaseEvent(QMouseEvent* event)
2250+{
2251+ UQ_VAR(this);
2252+ update();
2253+
2254+ if (event->button() == Qt::MiddleButton && rect().contains(event->pos(), false))
2255+ m_entry->SecondaryActivate(time(NULL));
2256+}
2257+
2258+void IndicatorEntryWidget::wheelEvent(QWheelEvent* event)
2259+{
2260+ m_entry->Scroll(event->delta());
2261+}
2262+
2263+void IndicatorEntryWidget::showMenu(Qt::MouseButton qtButton)
2264+{
2265+ if (m_entry->active()) {
2266+ return;
2267+ }
2268+ int nuxButton = qtButton == Qt::NoButton ? 0 : 1;
2269+ QPoint pos = mapToGlobal(rect().bottomLeft());
2270+ m_entry->ShowMenu(pos.x(), pos.y(),
2271+ time(NULL),
2272+ nuxButton
2273+ );
2274+}
2275+
2276+void IndicatorEntryWidget::setPadding(int padding)
2277+{
2278+ if (m_padding != padding) {
2279+ m_padding = padding;
2280+ updatePix();
2281+ }
2282+}
2283+
2284+bool IndicatorEntryWidget::event(QEvent* ev)
2285+{
2286+ bool ret = QWidget::event(ev);
2287+ switch (ev->type()) {
2288+ case QEvent::FontChange:
2289+ case QEvent::PaletteChange:
2290+ updatePix();
2291+ break;
2292+ default:
2293+ break;
2294+ }
2295+ return ret;
2296+}
2297+
2298+bool IndicatorEntryWidget::isEmpty() const
2299+{
2300+ return !m_hasIcon && !m_hasLabel;
2301+}
2302+
2303+unity::indicator::Entry::Ptr IndicatorEntryWidget::entry() const
2304+{
2305+ return m_entry;
2306+}
2307+
2308+#include "indicatorentrywidget.moc"
2309
2310=== added file 'libunity-2d-private/src/indicatorentrywidget.h'
2311--- libunity-2d-private/src/indicatorentrywidget.h 1970-01-01 00:00:00 +0000
2312+++ libunity-2d-private/src/indicatorentrywidget.h 2011-08-24 12:47:31 +0000
2313@@ -0,0 +1,90 @@
2314+/*
2315+ * This file is part of unity-2d
2316+ *
2317+ * Copyright 2011 Canonical Ltd.
2318+ *
2319+ * Authors:
2320+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2321+ *
2322+ * This program is free software; you can redistribute it and/or modify
2323+ * it under the terms of the GNU General Public License as published by
2324+ * the Free Software Foundation; version 3.
2325+ *
2326+ * This program is distributed in the hope that it will be useful,
2327+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2328+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2329+ * GNU General Public License for more details.
2330+ *
2331+ * You should have received a copy of the GNU General Public License
2332+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2333+ */
2334+#ifndef INDICATORENTRYWIDGET_H
2335+#define INDICATORENTRYWIDGET_H
2336+
2337+// Local
2338+
2339+// libunity-core
2340+#include <UnityCore/IndicatorEntry.h>
2341+
2342+// Qt
2343+#include <QWidget>
2344+
2345+struct _GtkWidgetPath;
2346+struct _PangoLayout;
2347+
2348+class QPainter;
2349+
2350+class IndicatorEntryWidget : public QWidget, public sigc::trackable
2351+{
2352+Q_OBJECT
2353+public:
2354+ IndicatorEntryWidget(const unity::indicator::Entry::Ptr& entry);
2355+ ~IndicatorEntryWidget();
2356+
2357+ QSize minimumSizeHint() const;
2358+ QSize sizeHint() const;
2359+
2360+ void setPadding(int);
2361+
2362+ bool isEmpty() const;
2363+
2364+ unity::indicator::Entry::Ptr entry() const;
2365+
2366+ /**
2367+ * Shows the menu.
2368+ *
2369+ * When this method is called because of a click, button
2370+ * must be set to Qt::LeftButton.
2371+ *
2372+ * When it is called because user previously clicked an indicator and moved the
2373+ * mouse to another indicator, button must be set to Qt::NoButton.
2374+ */
2375+ void showMenu(Qt::MouseButton button);
2376+
2377+Q_SIGNALS:
2378+ void isEmptyChanged();
2379+
2380+protected:
2381+ void resizeEvent(QResizeEvent*);
2382+ void paintEvent(QPaintEvent*);
2383+ void mousePressEvent(QMouseEvent*);
2384+ void mouseReleaseEvent(QMouseEvent*);
2385+ void wheelEvent(QWheelEvent*);
2386+ bool event(QEvent*);
2387+
2388+private:
2389+ unity::indicator::Entry::Ptr m_entry;
2390+ QPixmap m_pix;
2391+ int m_padding;
2392+ bool m_hasIcon;
2393+ bool m_hasLabel;
2394+ struct _GtkWidgetPath* m_gtkWidgetPath;
2395+ void updatePix();
2396+ QPixmap decodeIcon();
2397+ void paintActiveBackground(QImage*);
2398+
2399+ struct _PangoLayout* createPangoLayout();
2400+ void paintLabel(QImage*, struct _PangoLayout*, int labelX);
2401+};
2402+
2403+#endif /* INDICATORENTRYWIDGET_H */
2404
2405=== added file 'libunity-2d-private/src/indicatorsmanager.cpp'
2406--- libunity-2d-private/src/indicatorsmanager.cpp 1970-01-01 00:00:00 +0000
2407+++ libunity-2d-private/src/indicatorsmanager.cpp 2011-08-24 12:47:31 +0000
2408@@ -0,0 +1,206 @@
2409+/*
2410+ * This file is part of unity-2d
2411+ *
2412+ * Copyright 2011 Canonical Ltd.
2413+ *
2414+ * Authors:
2415+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2416+ *
2417+ * This program is free software; you can redistribute it and/or modify
2418+ * it under the terms of the GNU General Public License as published by
2419+ * the Free Software Foundation; version 3.
2420+ *
2421+ * This program is distributed in the hope that it will be useful,
2422+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2423+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2424+ * GNU General Public License for more details.
2425+ *
2426+ * You should have received a copy of the GNU General Public License
2427+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2428+ */
2429+// Self
2430+#include "indicatorsmanager.h"
2431+
2432+// Local
2433+#include <debug_p.h>
2434+#include <indicatorentrywidget.h>
2435+
2436+// Qt
2437+#include <QApplication>
2438+#include <QTimer>
2439+#include <QX11Info>
2440+
2441+// X11
2442+#include <X11/Xlib.h>
2443+
2444+using namespace unity::indicator;
2445+
2446+IndicatorsManager::IndicatorsManager(QObject* parent)
2447+: QObject(parent)
2448+, m_indicators(new DBusIndicators)
2449+, m_geometrySyncTimer(new QTimer(this))
2450+, m_mouseTrackerTimer(new QTimer(this))
2451+{
2452+ m_geometrySyncTimer->setInterval(0);
2453+ m_geometrySyncTimer->setSingleShot(true);
2454+ connect(m_geometrySyncTimer, SIGNAL(timeout()), SLOT(syncGeometries()));
2455+
2456+ // m_mouseTrackerTimer is inspired from
2457+ // plugins/unityshell/src/PanelView.cpp in OnEntryActivated()
2458+ //
2459+ // Rationale copied from Unity source code:
2460+ // """
2461+ // Track menus being scrubbed at 60Hz (about every 16 millisec)
2462+ // It might sound ugly, but it's far nicer (and more responsive) than the
2463+ // code it replaces which used to capture motion events in another process
2464+ // (unity-panel-service) and send them to us over dbus.
2465+ // NOTE: The reason why we have to use a timer instead of tracking motion
2466+ // events is because the motion events will never be delivered to this
2467+ // process. All the motion events will go to unity-panel-service while
2468+ // scrubbing because the active panel menu has (needs) the pointer grab.
2469+ // """
2470+ m_mouseTrackerTimer->setInterval(16);
2471+ m_mouseTrackerTimer->setSingleShot(false);
2472+ connect(m_mouseTrackerTimer, SIGNAL(timeout()), SLOT(checkMousePosition()));
2473+
2474+ m_indicators->on_entry_show_menu.connect(
2475+ sigc::mem_fun(this, &IndicatorsManager::onEntryShowMenu)
2476+ );
2477+
2478+ m_indicators->on_entry_activate_request.connect(
2479+ sigc::mem_fun(this, &IndicatorsManager::onEntryActivateRequest)
2480+ );
2481+
2482+ m_indicators->on_entry_activated.connect(
2483+ sigc::mem_fun(this, &IndicatorsManager::onEntryActivated)
2484+ );
2485+
2486+ m_indicators->on_synced.connect(
2487+ sigc::mem_fun(this, &IndicatorsManager::onSynced)
2488+ );
2489+}
2490+
2491+unity::indicator::DBusIndicators::Ptr IndicatorsManager::indicators() const
2492+{
2493+ return m_indicators;
2494+}
2495+
2496+void IndicatorsManager::onEntryShowMenu(const std::string& /*entryId*/, int posX, int posY, int /*timestamp*/, int /*button*/)
2497+{
2498+ // Copied from plugins/unityshell/src/PanelView.cpp, in OnEntryShowMenu()
2499+ // Without this code, menus cannot be shown from mousePressEvent() (but can
2500+ // be shown from mouseReleaseEvent())
2501+ /*
2502+ Neil explanation:
2503+ On button down, X automatically gives Qt a passive grab on the mouse this
2504+ means that, if the panel service tries to grab the pointer to show the menu
2505+ (gtk does this automatically), it fails and the menu can't show.
2506+ We connect to the on_entry_show_menu signal, which is emitted before
2507+ DBusIndicators does anything else, and just break the grab.
2508+ */
2509+ Display* display = QX11Info::display();
2510+ XUngrabPointer(display, CurrentTime);
2511+ XFlush(display);
2512+
2513+ XButtonEvent event = {
2514+ ButtonRelease,
2515+ 0,
2516+ False,
2517+ display,
2518+ 0,
2519+ 0,
2520+ 0,
2521+ CurrentTime,
2522+ posX, posY,
2523+ posX, posY,
2524+ 0,
2525+ Button1,
2526+ True
2527+ };
2528+ qApp->x11ProcessEvent(reinterpret_cast<XEvent*>(&event));
2529+}
2530+
2531+void IndicatorsManager::checkMousePosition()
2532+{
2533+ // Called by m_mouseTrackerTimer to implement mouse scrubbing
2534+ // (Assuming item A menu is opened, move mouse over item B => item B menu opens)
2535+ QWidget* widget = QApplication::widgetAt(QCursor::pos());
2536+ IndicatorEntryWidget* entryWidget = qobject_cast<IndicatorEntryWidget*>(widget);
2537+ if (!entryWidget) {
2538+ return;
2539+ }
2540+ entryWidget->showMenu(Qt::NoButton);
2541+}
2542+
2543+void IndicatorsManager::onEntryActivateRequest(const std::string& entryId)
2544+{
2545+ if (entryId.empty()) {
2546+ return;
2547+ }
2548+ IndicatorEntryWidget* widget = 0;
2549+ Q_FOREACH(widget, m_widgetList) {
2550+ if (widget->entry()->id() == entryId) {
2551+ break;
2552+ }
2553+ }
2554+ if (!widget) {
2555+ UQ_WARNING << "Could not find a widget for IndicatorEntry with id" << QString::fromStdString(entryId);
2556+ return;
2557+ }
2558+ widget->showMenu(Qt::NoButton);
2559+}
2560+
2561+void IndicatorsManager::onEntryActivated(const std::string& entryId)
2562+{
2563+ if (entryId.empty()) {
2564+ m_mouseTrackerTimer->stop();
2565+ } else {
2566+ m_mouseTrackerTimer->start();
2567+ }
2568+}
2569+
2570+void IndicatorsManager::onSynced()
2571+{
2572+ QMetaObject::invokeMethod(m_geometrySyncTimer, "start", Qt::QueuedConnection);
2573+}
2574+
2575+void IndicatorsManager::addIndicatorEntryWidget(IndicatorEntryWidget* widget)
2576+{
2577+ m_widgetList.append(widget);
2578+ widget->installEventFilter(this);
2579+}
2580+
2581+bool IndicatorsManager::eventFilter(QObject*, QEvent* event)
2582+{
2583+ switch (event->type()) {
2584+ case QEvent::Show:
2585+ case QEvent::Hide:
2586+ case QEvent::Move:
2587+ case QEvent::Resize:
2588+ m_geometrySyncTimer->start();
2589+ break;
2590+ default:
2591+ break;
2592+ }
2593+ return false;
2594+}
2595+
2596+void IndicatorsManager::syncGeometries()
2597+{
2598+ EntryLocationMap locations;
2599+ Q_FOREACH(IndicatorEntryWidget* widget, m_widgetList) {
2600+ if (!widget->isVisible()) {
2601+ continue;
2602+ }
2603+ Entry::Ptr entry = widget->entry();
2604+ if (entry->IsUnused()) {
2605+ continue;
2606+ }
2607+ QPoint topLeft = widget->mapToGlobal(QPoint(0, 0));
2608+ nux::Rect rect(topLeft.x(), topLeft.y(), widget->width(), widget->height());
2609+ locations[widget->entry()->id()] = rect;
2610+ }
2611+ m_indicators->SyncGeometries("Panel", locations);
2612+}
2613+
2614+#include "indicatorsmanager.moc"
2615
2616=== added file 'libunity-2d-private/src/indicatorsmanager.h'
2617--- libunity-2d-private/src/indicatorsmanager.h 1970-01-01 00:00:00 +0000
2618+++ libunity-2d-private/src/indicatorsmanager.h 2011-08-24 12:47:31 +0000
2619@@ -0,0 +1,72 @@
2620+/*
2621+ * This file is part of unity-2d
2622+ *
2623+ * Copyright 2011 Canonical Ltd.
2624+ *
2625+ * Authors:
2626+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2627+ *
2628+ * This program is free software; you can redistribute it and/or modify
2629+ * it under the terms of the GNU General Public License as published by
2630+ * the Free Software Foundation; version 3.
2631+ *
2632+ * This program is distributed in the hope that it will be useful,
2633+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2634+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2635+ * GNU General Public License for more details.
2636+ *
2637+ * You should have received a copy of the GNU General Public License
2638+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2639+ */
2640+#ifndef INDICATORSMANAGER_H
2641+#define INDICATORSMANAGER_H
2642+
2643+// Local
2644+
2645+// Qt
2646+#include <QMap>
2647+#include <QObject>
2648+
2649+// libunity-core
2650+#include <UnityCore/DBusIndicators.h>
2651+
2652+class QTimer;
2653+
2654+class IndicatorEntryWidget;
2655+
2656+/**
2657+ * Instantiates DBusIndicators and implement common behavior
2658+ */
2659+class IndicatorsManager : public QObject, public sigc::trackable
2660+{
2661+ Q_OBJECT
2662+public:
2663+ IndicatorsManager(QObject* parent);
2664+
2665+ unity::indicator::DBusIndicators::Ptr indicators() const;
2666+
2667+ void addIndicatorEntryWidget(IndicatorEntryWidget* widget);
2668+
2669+protected:
2670+ bool eventFilter(QObject*, QEvent*);
2671+
2672+private Q_SLOTS:
2673+ void syncGeometries();
2674+ void checkMousePosition();
2675+
2676+private:
2677+ Q_DISABLE_COPY(IndicatorsManager)
2678+ unity::indicator::DBusIndicators::Ptr m_indicators;
2679+ QTimer* m_geometrySyncTimer;
2680+ QTimer* m_mouseTrackerTimer;
2681+
2682+ typedef QList<IndicatorEntryWidget*> IndicatorEntryWidgetList;
2683+ IndicatorEntryWidgetList m_widgetList;
2684+
2685+ void onSynced();
2686+ void onEntryShowMenu(const std::string&, int x, int y, int timestamp, int button);
2687+ void onEntryActivateRequest(const std::string& entryId);
2688+ void onEntryActivated(const std::string& entryId);
2689+};
2690+
2691+#endif /* INDICATORSMANAGER_H */
2692
2693=== added file 'libunity-2d-private/src/indicatorwidget.cpp'
2694--- libunity-2d-private/src/indicatorwidget.cpp 1970-01-01 00:00:00 +0000
2695+++ libunity-2d-private/src/indicatorwidget.cpp 2011-08-24 12:47:31 +0000
2696@@ -0,0 +1,53 @@
2697+/*
2698+ * This file is part of unity-2d
2699+ *
2700+ * Copyright 2011 Canonical Ltd.
2701+ *
2702+ * Authors:
2703+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2704+ *
2705+ * This program is free software; you can redistribute it and/or modify
2706+ * it under the terms of the GNU General Public License as published by
2707+ * the Free Software Foundation; version 3.
2708+ *
2709+ * This program is distributed in the hope that it will be useful,
2710+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2711+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2712+ * GNU General Public License for more details.
2713+ *
2714+ * You should have received a copy of the GNU General Public License
2715+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2716+ */
2717+// Self
2718+#include "indicatorwidget.h"
2719+
2720+// Local
2721+#include <debug_p.h>
2722+#include <indicatorentrywidget.h>
2723+#include <indicatorsmanager.h>
2724+
2725+// Qt
2726+#include <QHBoxLayout>
2727+
2728+using namespace unity::indicator;
2729+
2730+IndicatorWidget::IndicatorWidget(const Indicator::Ptr& indicator, IndicatorsManager* manager)
2731+: m_layout(new QHBoxLayout(this))
2732+, m_indicatorsManager(manager)
2733+, m_indicator(indicator)
2734+{
2735+ m_layout->setMargin(0);
2736+ m_layout->setSpacing(0);
2737+
2738+ m_indicator->on_entry_added.connect(sigc::mem_fun(this, &IndicatorWidget::onEntryAdded));
2739+}
2740+
2741+void IndicatorWidget::onEntryAdded(const Entry::Ptr& entry)
2742+{
2743+ IndicatorEntryWidget* widget = new IndicatorEntryWidget(entry);
2744+ m_indicatorsManager->addIndicatorEntryWidget(widget);
2745+ m_layout->addWidget(widget);
2746+}
2747+
2748+
2749+#include "indicatorwidget.moc"
2750
2751=== added file 'libunity-2d-private/src/indicatorwidget.h'
2752--- libunity-2d-private/src/indicatorwidget.h 1970-01-01 00:00:00 +0000
2753+++ libunity-2d-private/src/indicatorwidget.h 2011-08-24 12:47:31 +0000
2754@@ -0,0 +1,52 @@
2755+/*
2756+ * This file is part of unity-2d
2757+ *
2758+ * Copyright 2011 Canonical Ltd.
2759+ *
2760+ * Authors:
2761+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2762+ *
2763+ * This program is free software; you can redistribute it and/or modify
2764+ * it under the terms of the GNU General Public License as published by
2765+ * the Free Software Foundation; version 3.
2766+ *
2767+ * This program is distributed in the hope that it will be useful,
2768+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2769+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2770+ * GNU General Public License for more details.
2771+ *
2772+ * You should have received a copy of the GNU General Public License
2773+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2774+ */
2775+#ifndef INDICATORWIDGET_H
2776+#define INDICATORWIDGET_H
2777+
2778+// Local
2779+
2780+// libunity-core
2781+#include <UnityCore/Indicator.h>
2782+#include <UnityCore/IndicatorEntry.h>
2783+
2784+// Qt
2785+#include <QWidget>
2786+
2787+class QHBoxLayout;
2788+
2789+class IndicatorEntryWidget;
2790+class IndicatorsManager;
2791+
2792+class IndicatorWidget : public QWidget, public sigc::trackable
2793+{
2794+Q_OBJECT
2795+public:
2796+ IndicatorWidget(const unity::indicator::Indicator::Ptr& indicator, IndicatorsManager* manager);
2797+
2798+private:
2799+ QHBoxLayout* m_layout;
2800+ IndicatorsManager* m_indicatorsManager;
2801+ unity::indicator::Indicator::Ptr m_indicator;
2802+
2803+ void onEntryAdded(const unity::indicator::Entry::Ptr& entry);
2804+};
2805+
2806+#endif /* INDICATORWIDGET_H */
2807
2808=== modified file 'libunity-2d-private/src/launcherapplication.cpp'
2809--- libunity-2d-private/src/launcherapplication.cpp 2011-08-09 11:28:45 +0000
2810+++ libunity-2d-private/src/launcherapplication.cpp 2011-08-24 12:47:31 +0000
2811@@ -14,10 +14,6 @@
2812 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2813 */
2814
2815-/* Those have to be included before any QObject-style header to avoid
2816- compilation errors. */
2817-#include <gdk/gdk.h>
2818-
2819 /* Note regarding the use of wnck: it is critically important that the client
2820 type be set to pager because wnck will pass that type over to the window
2821 manager through XEvents.
2822@@ -59,6 +55,7 @@
2823 #include <QX11Info>
2824
2825 extern "C" {
2826+#include <gdk/gdk.h>
2827 #include <libsn/sn.h>
2828 }
2829
2830@@ -662,7 +659,8 @@
2831 GTimeVal timeval;
2832
2833 g_get_current_time (&timeval);
2834- GObjectScopedPointer<GdkAppLaunchContext> context(gdk_app_launch_context_new());
2835+ GdkDisplay* display = gdk_display_get_default();
2836+ GObjectScopedPointer<GdkAppLaunchContext> context(gdk_display_get_app_launch_context(display));
2837 /* Using GDK_CURRENT_TIME doesn’t seem to work, launched windows
2838 sometimes don’t get focus (see https://launchpad.net/bugs/643616). */
2839 gdk_app_launch_context_set_timestamp(context.data(), timeval.tv_sec);
2840@@ -893,7 +891,7 @@
2841 QAction* keep = new QAction(m_menu);
2842 keep->setCheckable(is_running);
2843 keep->setChecked(sticky());
2844- keep->setText(is_running ? u2dTr("Keep In Launcher") : u2dTr("Remove From Launcher"));
2845+ keep->setText(is_running ? u2dTr("Keep in launcher") : u2dTr("Remove from launcher"));
2846 actions.append(keep);
2847 QObject::connect(keep, SIGNAL(triggered()), this, SLOT(onKeepTriggered()));
2848 }
2849
2850=== modified file 'libunity-2d-private/src/launcherapplicationslist.cpp'
2851--- libunity-2d-private/src/launcherapplicationslist.cpp 2011-07-29 13:49:34 +0000
2852+++ libunity-2d-private/src/launcherapplicationslist.cpp 2011-08-24 12:47:31 +0000
2853@@ -101,6 +101,16 @@
2854 application->installX11EventFilter(this);
2855 }
2856
2857+ /* Get the system applications data dirs and be flexible if / is not at the
2858+ end of each path. */
2859+ QString xdgDataDir = QFile::decodeName(getenv("XDG_DATA_DIRS"));
2860+ if (xdgDataDir.isEmpty()) {
2861+ xdgDataDir = "/usr/local/share/:/usr/share/";
2862+ }
2863+ Q_FOREACH(const QString& dirName, xdgDataDir.split(':')) {
2864+ m_xdgApplicationDirs << QDir::cleanPath(dirName + "/applications") + "/";
2865+ }
2866+
2867 load();
2868 }
2869
2870@@ -178,9 +188,17 @@
2871 }
2872
2873 QString
2874-LauncherApplicationsList::favoriteFromDesktopFilePath(QString desktop_file)
2875+LauncherApplicationsList::favoriteFromDesktopFilePath(const QString& _desktopFile) const
2876 {
2877- return QDir(desktop_file).dirName();
2878+ QString desktopFile(_desktopFile);
2879+ Q_FOREACH(const QString& applicationDir, m_xdgApplicationDirs) {
2880+ if (_desktopFile.startsWith(applicationDir)) {
2881+ desktopFile.remove(applicationDir);
2882+ desktopFile.replace("/", "-");
2883+ break;
2884+ }
2885+ }
2886+ return desktopFile;
2887 }
2888
2889 void
2890
2891=== modified file 'libunity-2d-private/src/launcherapplicationslist.h'
2892--- libunity-2d-private/src/launcherapplicationslist.h 2011-08-06 10:42:04 +0000
2893+++ libunity-2d-private/src/launcherapplicationslist.h 2011-08-24 12:47:31 +0000
2894@@ -70,7 +70,7 @@
2895 void insertApplication(LauncherApplication* application);
2896 void removeApplication(LauncherApplication* application);
2897
2898- static QString favoriteFromDesktopFilePath(QString desktop_file);
2899+ QString favoriteFromDesktopFilePath(const QString& desktop_file) const;
2900
2901 void writeFavoritesToGConf();
2902
2903@@ -89,6 +89,7 @@
2904 */
2905 QHash<QString, LauncherApplication*> m_applicationForExecutable;
2906 QConf* m_dconf_launcher;
2907+ QStringList m_xdgApplicationDirs;
2908
2909 /* Startup notification support */
2910 SnDisplay *m_snDisplay;
2911
2912=== modified file 'libunity-2d-private/src/launcherdevice.cpp'
2913--- libunity-2d-private/src/launcherdevice.cpp 2011-07-29 13:49:34 +0000
2914+++ libunity-2d-private/src/launcherdevice.cpp 2011-08-24 12:47:31 +0000
2915@@ -186,35 +186,65 @@
2916 }
2917
2918 void
2919+LauncherDevice::unmount(GMountOperation* mountOperation)
2920+{
2921+ if (m_volume == NULL) {
2922+ return;
2923+ }
2924+
2925+ GObjectScopedPointer<GMount> mount(g_volume_get_mount(m_volume));
2926+
2927+ if (mount.isNull()) {
2928+ return;
2929+ }
2930+
2931+ if (g_mount_can_unmount(mount.data())) {
2932+ g_mount_unmount_with_operation(mount.data(), G_MOUNT_UNMOUNT_NONE, mountOperation, NULL,
2933+ (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,
2934+ NULL);
2935+ }
2936+}
2937+
2938+void
2939 LauncherDevice::eject()
2940 {
2941 if (m_volume == NULL) {
2942 return;
2943 }
2944
2945- GMountOperation *mountOperation;
2946- mountOperation = gtk_mount_operation_new(NULL);
2947+ GObjectScopedPointer<GMountOperation> mountOperation(gtk_mount_operation_new(NULL));
2948
2949 if (g_volume_can_eject(m_volume)) {
2950- g_volume_eject_with_operation(m_volume, G_MOUNT_UNMOUNT_NONE, mountOperation,
2951- NULL, (GAsyncReadyCallback) LauncherDevice::onVolumeEjected, NULL);
2952- } else {
2953- GMount* mount = g_volume_get_mount(m_volume);
2954-
2955- if (mount == NULL) {
2956- return;
2957- }
2958-
2959- if (g_mount_can_unmount(mount)) {
2960- g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, mountOperation,
2961- NULL, (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,
2962- NULL);
2963- } else {
2964- g_object_unref(mount);
2965- }
2966- }
2967-
2968- g_object_unref(mountOperation);
2969+ g_volume_eject_with_operation(m_volume, G_MOUNT_UNMOUNT_NONE, mountOperation.data(),
2970+ NULL,
2971+ (GAsyncReadyCallback) LauncherDevice::onVolumeEjected,
2972+ NULL);
2973+ } else {
2974+ unmount(mountOperation.data());
2975+ }
2976+}
2977+
2978+void
2979+LauncherDevice::stop()
2980+{
2981+ if (m_volume == NULL) {
2982+ return;
2983+ }
2984+
2985+ GObjectScopedPointer<GDrive> drive(g_volume_get_drive(m_volume));
2986+
2987+ if (drive.isNull()) {
2988+ return;
2989+ }
2990+
2991+ GObjectScopedPointer<GMountOperation> mountOperation(gtk_mount_operation_new(NULL));
2992+
2993+ if (g_drive_can_stop(drive.data())) {
2994+ g_drive_stop(drive.data(), G_MOUNT_UNMOUNT_NONE, mountOperation.data(), NULL,
2995+ (GAsyncReadyCallback) LauncherDevice::onDriveStopped, NULL);
2996+ } else {
2997+ unmount(mountOperation.data());
2998+ }
2999 }
3000
3001 void
3002@@ -224,6 +254,12 @@
3003 }
3004
3005 void
3006+LauncherDevice::onDriveStopped(GDrive* drive, GAsyncResult* res)
3007+{
3008+ g_drive_stop_finish(drive, res, NULL);
3009+}
3010+
3011+void
3012 LauncherDevice::onMountUnmounted(GMount* mount, GAsyncResult* res)
3013 {
3014 g_mount_unmount_with_operation_finish(mount, res, NULL);
3015@@ -237,6 +273,15 @@
3016 eject->setText(u2dTr("Eject"));
3017 m_menu->addAction(eject);
3018 QObject::connect(eject, SIGNAL(triggered()), this, SLOT(onEjectTriggered()));
3019+
3020+ GObjectScopedPointer<GDrive> drive(g_volume_get_drive(m_volume));
3021+
3022+ if (!drive.isNull() && g_drive_can_stop(drive.data())) {
3023+ QAction* stop = new QAction(m_menu);
3024+ stop->setText(u2dTr("Safely remove"));
3025+ m_menu->addAction(stop);
3026+ QObject::connect(stop, SIGNAL(triggered()), this, SLOT(onStopTriggered()));
3027+ }
3028 }
3029
3030 void
3031@@ -246,4 +291,11 @@
3032 eject();
3033 }
3034
3035+void
3036+LauncherDevice::onStopTriggered()
3037+{
3038+ m_menu->hide();
3039+ stop();
3040+}
3041+
3042 #include "launcherdevice.moc"
3043
3044=== modified file 'libunity-2d-private/src/launcherdevice.h'
3045--- libunity-2d-private/src/launcherdevice.h 2011-07-29 13:49:34 +0000
3046+++ libunity-2d-private/src/launcherdevice.h 2011-08-24 12:47:31 +0000
3047@@ -51,18 +51,22 @@
3048 Q_INVOKABLE GVolume* getVolume();
3049 Q_INVOKABLE void setVolume(GVolume* volume);
3050 Q_INVOKABLE void open();
3051+ Q_INVOKABLE void unmount(GMountOperation* mountOperation);
3052 Q_INVOKABLE void eject();
3053+ Q_INVOKABLE void stop();
3054
3055 Q_INVOKABLE virtual void createMenuActions();
3056
3057 private Q_SLOTS:
3058 void onEjectTriggered();
3059+ void onStopTriggered();
3060
3061 private:
3062 GVolume* m_volume;
3063
3064 static void onVolumeMounted(GVolume* volume, GAsyncResult* res);
3065 static void onVolumeEjected(GVolume* volume, GAsyncResult* res);
3066+ static void onDriveStopped(GDrive* drive, GAsyncResult* res);
3067 static void onMountUnmounted(GMount* mount, GAsyncResult* res);
3068 };
3069
3070
3071=== modified file 'libunity-2d-private/src/launchermenu.cpp'
3072--- libunity-2d-private/src/launchermenu.cpp 2011-07-29 13:49:34 +0000
3073+++ libunity-2d-private/src/launchermenu.cpp 2011-08-24 12:47:31 +0000
3074@@ -96,6 +96,7 @@
3075 void
3076 LauncherContextualMenu::setTitle(const QString& title)
3077 {
3078+ setAccessibleName(title);
3079 m_title = title;
3080 /* Escaping ampersands so that they are not considered as keyboard
3081 accelerators. */
3082
3083=== added file 'libunity-2d-private/src/lens.cpp'
3084--- libunity-2d-private/src/lens.cpp 1970-01-01 00:00:00 +0000
3085+++ libunity-2d-private/src/lens.cpp 2011-08-24 12:47:31 +0000
3086@@ -0,0 +1,272 @@
3087+/*
3088+ * Copyright (C) 2011 Canonical, Ltd.
3089+ *
3090+ * Authors:
3091+ * Florian Boucault <florian.boucault@canonical.com>
3092+ *
3093+ * This program is free software; you can redistribute it and/or modify
3094+ * it under the terms of the GNU General Public License as published by
3095+ * the Free Software Foundation; version 3.
3096+ *
3097+ * This program is distributed in the hope that it will be useful,
3098+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3099+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3100+ * GNU General Public License for more details.
3101+ *
3102+ * You should have received a copy of the GNU General Public License
3103+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3104+ */
3105+
3106+// Self
3107+#include "lens.h"
3108+
3109+// libunity-2d
3110+#include <debug_p.h>
3111+#include "launcherapplication.h"
3112+
3113+// Qt
3114+#include <QUrl>
3115+#include <QDesktopServices>
3116+
3117+Lens::Lens(QObject *parent) :
3118+ QObject(parent)
3119+{
3120+ m_results = new DeeListModel;
3121+ m_globalResults = new DeeListModel;
3122+ m_categories = new DeeListModel;
3123+}
3124+
3125+QString Lens::id() const
3126+{
3127+ return QString::fromStdString(m_unityLens->id());
3128+}
3129+
3130+QString Lens::dbusName() const
3131+{
3132+ return QString::fromStdString(m_unityLens->dbus_name());
3133+}
3134+
3135+QString Lens::dbusPath() const
3136+{
3137+ return QString::fromStdString(m_unityLens->dbus_path());
3138+}
3139+
3140+QString Lens::name() const
3141+{
3142+ return QString::fromStdString(m_unityLens->name());
3143+}
3144+
3145+QString Lens::iconHint() const
3146+{
3147+ return QString::fromStdString(m_unityLens->icon_hint());
3148+}
3149+
3150+QString Lens::description() const
3151+{
3152+ return QString::fromStdString(m_unityLens->description());
3153+}
3154+
3155+QString Lens::searchHint() const
3156+{
3157+ return QString::fromStdString(m_unityLens->search_hint());
3158+}
3159+
3160+bool Lens::visible() const
3161+{
3162+ return m_unityLens->visible();
3163+}
3164+
3165+bool Lens::searchInGlobal() const
3166+{
3167+ return m_unityLens->search_in_global();
3168+}
3169+
3170+QString Lens::shortcut() const
3171+{
3172+ return QString::fromStdString(m_unityLens->shortcut());
3173+}
3174+
3175+bool Lens::connected() const
3176+{
3177+ return m_unityLens->connected();
3178+}
3179+
3180+DeeListModel* Lens::results() const
3181+{
3182+ return m_results;
3183+}
3184+
3185+DeeListModel* Lens::globalResults() const
3186+{
3187+ return m_globalResults;
3188+}
3189+
3190+DeeListModel* Lens::categories() const
3191+{
3192+ return m_categories;
3193+}
3194+
3195+bool Lens::active() const
3196+{
3197+ return m_unityLens->active();
3198+}
3199+
3200+QString Lens::searchQuery() const
3201+{
3202+ return m_searchQuery;
3203+}
3204+
3205+QString Lens::globalSearchQuery() const
3206+{
3207+ return m_globalSearchQuery;
3208+}
3209+
3210+void Lens::setActive(bool active)
3211+{
3212+ m_unityLens->active = active;
3213+}
3214+
3215+void Lens::setSearchQuery(const QString& search_query)
3216+{
3217+ if (search_query != m_searchQuery) {
3218+ m_searchQuery = search_query;
3219+ m_unityLens->Search(search_query.toStdString());
3220+ Q_EMIT searchQueryChanged();
3221+ }
3222+}
3223+
3224+void Lens::setGlobalSearchQuery(const QString& search_query)
3225+{
3226+ if (search_query != m_globalSearchQuery) {
3227+ m_globalSearchQuery = search_query;
3228+ m_unityLens->GlobalSearch(search_query.toStdString());
3229+ Q_EMIT globalSearchQueryChanged();
3230+ }
3231+}
3232+
3233+void Lens::activate(const QString& uri)
3234+{
3235+ m_unityLens->Activate(uri.toStdString());
3236+}
3237+
3238+void Lens::onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&)
3239+{
3240+ if (type == unity::dash::NOT_HANDLED) {
3241+ fallbackActivate(QString::fromStdString(uri));
3242+ }
3243+}
3244+
3245+void Lens::fallbackActivate(const QString& uri)
3246+{
3247+ /* FIXME: stripping all content before the first column because for some
3248+ reason the lenses give uri with junk content at their beginning.
3249+ */
3250+ QString tweakedUri = uri;
3251+ int firstColumnAt = tweakedUri.indexOf(":");
3252+ tweakedUri.remove(0, firstColumnAt+1);
3253+
3254+ /* Tries various methods to trigger a sensible action for the given 'uri'.
3255+ If it has no understanding of the given scheme it falls back on asking
3256+ Qt to open the uri.
3257+ */
3258+ QUrl url(tweakedUri);
3259+ if (url.scheme() == "file") {
3260+ /* Override the files place's default URI handler: we want the file
3261+ manager to handle opening folders, not the dash.
3262+
3263+ Ref: https://bugs.launchpad.net/upicek/+bug/689667
3264+ */
3265+ QDesktopServices::openUrl(url);
3266+ return;
3267+ }
3268+ if (url.scheme() == "application") {
3269+ LauncherApplication application;
3270+ /* Cannot set the desktop file to url.host(), because the QUrl constructor
3271+ converts the host name to lower case to conform to the Nameprep
3272+ RFC (see http://doc.qt.nokia.com/qurl.html#FormattingOption-enum).
3273+ Ref: https://bugs.launchpad.net/unity-place-applications/+bug/784478 */
3274+ QString desktopFile = tweakedUri.mid(tweakedUri.indexOf("://") + 3);
3275+ application.setDesktopFile(desktopFile);
3276+ application.activate();
3277+ return;
3278+ }
3279+
3280+ UQ_WARNING << "FIXME: Possibly no handler for scheme: " << url.scheme();
3281+ UQ_WARNING << "Trying to open" << tweakedUri;
3282+ /* Try our luck */
3283+ QDesktopServices::openUrl(url);
3284+}
3285+
3286+void Lens::setUnityLens(unity::dash::Lens::Ptr lens)
3287+{
3288+ if (m_unityLens != NULL) {
3289+ // FIXME: should disconnect from m_unityLens's signals
3290+ }
3291+
3292+ // FIXME: should emit change notification signals for all properties
3293+
3294+ m_unityLens = lens;
3295+
3296+ m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3297+ m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3298+ m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3299+
3300+ /* Property change signals */
3301+ m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
3302+ m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));
3303+ m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));
3304+ m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
3305+ m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
3306+ m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
3307+ m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
3308+ m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
3309+ m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));
3310+ m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
3311+ m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
3312+ m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
3313+ m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
3314+ m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));
3315+ m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
3316+ m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
3317+ m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
3318+ m_unityLens->active.changed.connect(sigc::mem_fun(this, &Lens::activeChanged));
3319+
3320+ /* Signals forwarding */
3321+ m_unityLens->search_finished.connect(sigc::mem_fun(this, &Lens::searchFinished));
3322+ m_unityLens->global_search_finished.connect(sigc::mem_fun(this, &Lens::globalSearchFinished));
3323+
3324+ /* FIXME: signal should be forwarded instead of calling the handler directly */
3325+ m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
3326+}
3327+
3328+void Lens::onResultsSwarmNameChanged(std::string swarm_name)
3329+{
3330+ m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3331+}
3332+
3333+void Lens::onResultsChanged(unity::dash::Results::Ptr results)
3334+{
3335+ m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3336+}
3337+
3338+void Lens::onGlobalResultsSwarmNameChanged(std::string swarm_name)
3339+{
3340+ m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3341+}
3342+
3343+void Lens::onGlobalResultsChanged(unity::dash::Results::Ptr global_results)
3344+{
3345+ m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3346+}
3347+
3348+void Lens::onCategoriesSwarmNameChanged(std::string swarm_name)
3349+{
3350+ m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3351+}
3352+
3353+void Lens::onCategoriesChanged(unity::dash::Categories::Ptr categories)
3354+{
3355+ m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3356+}
3357+
3358+#include "lens.moc"
3359
3360=== added file 'libunity-2d-private/src/lens.h'
3361--- libunity-2d-private/src/lens.h 1970-01-01 00:00:00 +0000
3362+++ libunity-2d-private/src/lens.h 2011-08-24 12:47:31 +0000
3363@@ -0,0 +1,130 @@
3364+/*
3365+ * Copyright (C) 2011 Canonical, Ltd.
3366+ *
3367+ * Authors:
3368+ * Florian Boucault <florian.boucault@canonical.com>
3369+ *
3370+ * This program is free software; you can redistribute it and/or modify
3371+ * it under the terms of the GNU General Public License as published by
3372+ * the Free Software Foundation; version 3.
3373+ *
3374+ * This program is distributed in the hope that it will be useful,
3375+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3376+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3377+ * GNU General Public License for more details.
3378+ *
3379+ * You should have received a copy of the GNU General Public License
3380+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3381+ */
3382+
3383+#ifndef LENS_H
3384+#define LENS_H
3385+
3386+// Qt
3387+#include <QObject>
3388+#include <QString>
3389+#include <QMetaType>
3390+
3391+// libunity-core
3392+#include <UnityCore/Lens.h>
3393+
3394+// dee-qt
3395+#include "deelistmodel.h"
3396+
3397+
3398+class Lens : public QObject
3399+{
3400+ Q_OBJECT
3401+
3402+ Q_PROPERTY(QString id READ id NOTIFY idChanged)
3403+ Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
3404+ Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
3405+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
3406+ Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
3407+ Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
3408+ Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
3409+ Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
3410+ Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
3411+ Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
3412+ Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
3413+ Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)
3414+ Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
3415+ Q_PROPERTY(DeeListModel* categories READ categories NOTIFY categoriesChanged)
3416+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
3417+
3418+ Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
3419+ Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
3420+
3421+public:
3422+ explicit Lens(QObject *parent = 0);
3423+
3424+ /* getters */
3425+ QString id() const;
3426+ QString dbusName() const;
3427+ QString dbusPath() const;
3428+ QString name() const;
3429+ QString iconHint() const;
3430+ QString description() const;
3431+ QString searchHint() const;
3432+ bool visible() const;
3433+ bool searchInGlobal() const;
3434+ QString shortcut() const;
3435+ bool connected() const;
3436+ DeeListModel* results() const;
3437+ DeeListModel* globalResults() const;
3438+ DeeListModel* categories() const;
3439+ bool active() const;
3440+ QString searchQuery() const;
3441+ QString globalSearchQuery() const;
3442+
3443+ /* setters */
3444+ void setActive(bool active);
3445+ void setSearchQuery(const QString& search_query);
3446+ void setGlobalSearchQuery(const QString& search_query);
3447+
3448+ Q_INVOKABLE void activate(const QString& uri);
3449+ void setUnityLens(unity::dash::Lens::Ptr lens);
3450+
3451+Q_SIGNALS:
3452+ void idChanged(std::string);
3453+ void dbusNameChanged(std::string);
3454+ void dbusPathChanged(std::string);
3455+ void nameChanged(std::string);
3456+ void iconHintChanged(std::string);
3457+ void descriptionChanged(std::string);
3458+ void searchHintChanged(std::string);
3459+ void visibleChanged(bool);
3460+ void searchInGlobalChanged(bool);
3461+ void shortcutChanged(std::string);
3462+ void connectedChanged(bool);
3463+ void resultsChanged();
3464+ void globalResultsChanged();
3465+ void categoriesChanged();
3466+ void activeChanged(bool);
3467+ void searchFinished(std::string const&);
3468+ void globalSearchFinished(std::string const&);
3469+ void searchQueryChanged();
3470+ void globalSearchQueryChanged();
3471+
3472+private:
3473+ void onResultsSwarmNameChanged(std::string);
3474+ void onResultsChanged(unity::dash::Results::Ptr);
3475+ void onGlobalResultsSwarmNameChanged(std::string);
3476+ void onGlobalResultsChanged(unity::dash::Results::Ptr);
3477+ void onCategoriesSwarmNameChanged(std::string);
3478+ void onCategoriesChanged(unity::dash::Categories::Ptr);
3479+
3480+ void onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&);
3481+ void fallbackActivate(const QString& uri);
3482+
3483+ unity::dash::Lens::Ptr m_unityLens;
3484+ DeeListModel* m_results;
3485+ DeeListModel* m_globalResults;
3486+ DeeListModel* m_categories;
3487+ QString m_searchQuery;
3488+ QString m_globalSearchQuery;
3489+};
3490+
3491+Q_DECLARE_METATYPE(Lens*)
3492+
3493+#endif // LENS_H
3494
3495=== added file 'libunity-2d-private/src/lenses.cpp'
3496--- libunity-2d-private/src/lenses.cpp 1970-01-01 00:00:00 +0000
3497+++ libunity-2d-private/src/lenses.cpp 2011-08-24 12:47:31 +0000
3498@@ -0,0 +1,123 @@
3499+/*
3500+ * Copyright (C) 2011 Canonical, Ltd.
3501+ *
3502+ * Authors:
3503+ * Florian Boucault <florian.boucault@canonical.com>
3504+ *
3505+ * This program is free software; you can redistribute it and/or modify
3506+ * it under the terms of the GNU General Public License as published by
3507+ * the Free Software Foundation; version 3.
3508+ *
3509+ * This program is distributed in the hope that it will be useful,
3510+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3511+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3512+ * GNU General Public License for more details.
3513+ *
3514+ * You should have received a copy of the GNU General Public License
3515+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3516+ */
3517+
3518+// Self
3519+#include "lenses.h"
3520+
3521+// Local
3522+#include "lens.h"
3523+
3524+// Qt
3525+
3526+// libunity-core
3527+#include <UnityCore/FilesystemLenses.h>
3528+
3529+Lenses::Lenses(QObject *parent) :
3530+ QAbstractListModel(parent)
3531+{
3532+ QHash<int, QByteArray> roles;
3533+ roles[Lenses::RoleItem] = "item";
3534+ roles[Lenses::RoleVisible] = "visible";
3535+ setRoleNames(roles);
3536+
3537+ m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");
3538+ for (unsigned int i=0; i<m_unityLenses->count(); i++) {
3539+ unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i);
3540+ addUnityLens(unityLens, i);
3541+ }
3542+ m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
3543+}
3544+
3545+Lenses::~Lenses()
3546+{
3547+ delete m_unityLenses;
3548+}
3549+
3550+int Lenses::rowCount(const QModelIndex& parent) const
3551+{
3552+ Q_UNUSED(parent)
3553+
3554+ return m_unityLenses->count();
3555+}
3556+
3557+QVariant Lenses::data(const QModelIndex& index, int role) const
3558+{
3559+ Q_UNUSED(role)
3560+
3561+ if (!index.isValid()) {
3562+ return QVariant();
3563+ }
3564+
3565+ Lens* lens = m_lenses.at(index.row());
3566+
3567+ if (role == Lenses::RoleItem) {
3568+ return QVariant::fromValue(lens);
3569+ } else if (role == Lenses::RoleVisible) {
3570+ return QVariant::fromValue(lens->visible());
3571+ } else {
3572+ return QVariant();
3573+ }
3574+}
3575+
3576+QVariant Lenses::get(int row) const
3577+{
3578+ return data(QAbstractListModel::index(row), 0);
3579+}
3580+
3581+QVariant Lenses::get(const QString& lens_id) const
3582+{
3583+ Q_FOREACH(Lens* lens, m_lenses) {
3584+ if (lens->id() == lens_id) {
3585+ return QVariant::fromValue(lens);
3586+ }
3587+ }
3588+
3589+ return QVariant();
3590+}
3591+
3592+void Lenses::onLensAdded(unity::dash::Lens::Ptr& lens)
3593+{
3594+ int index = m_unityLenses->count()-1;
3595+ beginInsertRows(QModelIndex(), index, index);
3596+ addUnityLens(lens, index);
3597+ endInsertRows();
3598+}
3599+
3600+void Lenses::onLensPropertyChanged()
3601+{
3602+ QModelIndex lensIndex = index(m_lenses.indexOf(qobject_cast<Lens*>(sender())));
3603+ Q_EMIT dataChanged(lensIndex, lensIndex);
3604+}
3605+
3606+void Lenses::addUnityLens(unity::dash::Lens::Ptr unity_lens, int index)
3607+{
3608+ Lens* lens = new Lens();
3609+ lens->setUnityLens(unity_lens);
3610+ /* DOCME */
3611+ QObject::connect(lens, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));
3612+ m_lenses.insert(index, lens);
3613+}
3614+
3615+void Lenses::removeUnityLens(int index)
3616+{
3617+ Lens* lens = m_lenses.takeAt(index);
3618+ delete lens;
3619+}
3620+
3621+#include "lenses.moc"
3622
3623=== added file 'libunity-2d-private/src/lenses.h'
3624--- libunity-2d-private/src/lenses.h 1970-01-01 00:00:00 +0000
3625+++ libunity-2d-private/src/lenses.h 2011-08-24 12:47:31 +0000
3626@@ -0,0 +1,73 @@
3627+/*
3628+ * Copyright (C) 2011 Canonical, Ltd.
3629+ *
3630+ * Authors:
3631+ * Florian Boucault <florian.boucault@canonical.com>
3632+ *
3633+ * This program is free software; you can redistribute it and/or modify
3634+ * it under the terms of the GNU General Public License as published by
3635+ * the Free Software Foundation; version 3.
3636+ *
3637+ * This program is distributed in the hope that it will be useful,
3638+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3639+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3640+ * GNU General Public License for more details.
3641+ *
3642+ * You should have received a copy of the GNU General Public License
3643+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3644+ */
3645+
3646+#ifndef LENSES_H
3647+#define LENSES_H
3648+
3649+// Qt
3650+#include <QAbstractListModel>
3651+#include <QList>
3652+
3653+// libunity-core
3654+#include <UnityCore/Lens.h>
3655+
3656+namespace unity
3657+{
3658+namespace dash
3659+{
3660+class Lenses;
3661+}
3662+}
3663+
3664+class Lens;
3665+
3666+class Lenses : public QAbstractListModel
3667+{
3668+ Q_OBJECT
3669+
3670+ Q_ENUMS(Roles)
3671+
3672+public:
3673+ explicit Lenses(QObject *parent = 0);
3674+ ~Lenses();
3675+
3676+ enum Roles {
3677+ RoleItem,
3678+ RoleVisible
3679+ };
3680+
3681+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
3682+ Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
3683+
3684+ Q_INVOKABLE QVariant get(int row) const;
3685+ Q_INVOKABLE QVariant get(const QString& lens_id) const;
3686+
3687+private Q_SLOTS:
3688+ void onLensAdded(unity::dash::Lens::Ptr& lens);
3689+ void onLensPropertyChanged();
3690+
3691+private:
3692+ unity::dash::Lenses* m_unityLenses;
3693+ QList<Lens*> m_lenses;
3694+
3695+ void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);
3696+ void removeUnityLens(int index);
3697+};
3698+
3699+#endif // LENSES_H
3700
3701=== modified file 'libunity-2d-private/src/panelapplet.cpp'
3702--- libunity-2d-private/src/panelapplet.cpp 2011-08-17 09:21:18 +0000
3703+++ libunity-2d-private/src/panelapplet.cpp 2011-08-24 12:47:31 +0000
3704@@ -3,12 +3,30 @@
3705 namespace Unity2d
3706 {
3707
3708-PanelApplet::PanelApplet(QWidget* parent) :
3709- QWidget(parent)
3710-{
3711+class PanelAppletPrivate
3712+{
3713+ Unity2dPanel* m_panel;
3714+
3715+ PanelApplet* q_ptr;
3716+ Q_DECLARE_PUBLIC(PanelApplet)
3717+};
3718+
3719+PanelApplet::PanelApplet(Unity2dPanel* panel) :
3720+ QWidget(),
3721+ d_ptr(new PanelAppletPrivate)
3722+{
3723+ Q_D(PanelApplet);
3724+
3725+ d->m_panel = panel;
3726 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
3727 }
3728
3729+Unity2dPanel* PanelApplet::panel() const
3730+{
3731+ Q_D(const PanelApplet);
3732+ return d->m_panel;
3733+}
3734+
3735 } // namespace Unity2d
3736
3737 #include "panelapplet.moc"
3738
3739=== modified file 'libunity-2d-private/src/panelapplet.h'
3740--- libunity-2d-private/src/panelapplet.h 2011-08-16 12:58:45 +0000
3741+++ libunity-2d-private/src/panelapplet.h 2011-08-24 12:47:31 +0000
3742@@ -23,20 +23,28 @@
3743 #ifndef PANELAPPLET_H
3744 #define PANELAPPLET_H
3745
3746+// Local
3747+class Unity2dPanel;
3748+
3749 // Qt
3750 #include <QWidget>
3751
3752 namespace Unity2d
3753 {
3754
3755+class PanelAppletPrivate;
3756 class PanelApplet : public QWidget
3757 {
3758 Q_OBJECT
3759 public:
3760- explicit PanelApplet(QWidget* parent = 0);
3761+ explicit PanelApplet(Unity2dPanel* panel);
3762+
3763+ Unity2dPanel* panel() const;
3764
3765 private:
3766 Q_DISABLE_COPY(PanelApplet)
3767+ PanelAppletPrivate* d_ptr;
3768+ Q_DECLARE_PRIVATE(PanelApplet)
3769 };
3770
3771 } // namespace Unity2d
3772
3773=== modified file 'libunity-2d-private/src/panelappletproviderinterface.h'
3774--- libunity-2d-private/src/panelappletproviderinterface.h 2011-08-16 12:58:45 +0000
3775+++ libunity-2d-private/src/panelappletproviderinterface.h 2011-08-24 12:47:31 +0000
3776@@ -31,7 +31,7 @@
3777 {
3778 public:
3779 virtual QString appletName() const = 0;
3780- virtual PanelApplet* createApplet() const = 0;
3781+ virtual PanelApplet* createApplet(Unity2dPanel* panel) const = 0;
3782 };
3783
3784 } // namespace Unity2d
3785
3786=== added file 'libunity-2d-private/src/panelstyle.cpp'
3787--- libunity-2d-private/src/panelstyle.cpp 1970-01-01 00:00:00 +0000
3788+++ libunity-2d-private/src/panelstyle.cpp 2011-08-24 12:47:31 +0000
3789@@ -0,0 +1,201 @@
3790+/*
3791+ * This file is part of unity-2d
3792+ *
3793+ * Copyright 2011 Canonical Ltd.
3794+ *
3795+ * Authors:
3796+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3797+ *
3798+ * This program is free software; you can redistribute it and/or modify
3799+ * it under the terms of the GNU General Public License as published by
3800+ * the Free Software Foundation; version 3.
3801+ *
3802+ * This program is distributed in the hope that it will be useful,
3803+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3804+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3805+ * GNU General Public License for more details.
3806+ *
3807+ * You should have received a copy of the GNU General Public License
3808+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3809+ */
3810+// Self
3811+#include "panelstyle.h"
3812+
3813+// libunity-2d
3814+#include <cairoutils.h>
3815+#include <debug_p.h>
3816+#include <gconnector.h>
3817+#include <gscopedpointer.h>
3818+
3819+// Qt
3820+#include <QApplication>
3821+#include <QPalette>
3822+#include <QStyle>
3823+
3824+// GTK
3825+#include <gtk/gtk.h>
3826+
3827+static const char* METACITY_THEME_DIR = "/usr/share/themes/%1/metacity-1";
3828+
3829+class PanelStylePrivate
3830+{
3831+public:
3832+ PanelStyle* q;
3833+ GObjectScopedPointer<GtkStyleContext> m_styleContext;
3834+ GConnector m_gConnector;
3835+
3836+ QString m_themeName;
3837+
3838+ static void onThemeChanged(GObject*, GParamSpec*, gpointer data)
3839+ {
3840+ PanelStylePrivate* priv = reinterpret_cast<PanelStylePrivate*>(data);
3841+ priv->updatePalette();
3842+ }
3843+
3844+ void updatePalette()
3845+ {
3846+ gchar* themeName = 0;
3847+ g_object_get(gtk_settings_get_default(), "gtk-theme-name", &themeName, NULL);
3848+ m_themeName = QString::fromUtf8(themeName);
3849+ g_free(themeName);
3850+
3851+ GtkStyleContext* context = m_styleContext.data();
3852+ gtk_style_context_invalidate(context);
3853+
3854+ // Without this line, it seems the GtkStyleContext is not correctly
3855+ // initialized and we get some uninitialized pixels in the background
3856+ // brush.
3857+ gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL, NULL);
3858+
3859+ QPalette pal;
3860+ pal.setBrush(QPalette::Window, generateBackgroundBrush());
3861+ QApplication::setPalette(pal);
3862+ }
3863+
3864+ QBrush generateBackgroundBrush()
3865+ {
3866+ QImage image(100, 24, QImage::Format_ARGB32_Premultiplied); // FIXME: Hardcoded
3867+ image.fill(Qt::transparent);
3868+ CairoUtils::SurfacePointer surface(CairoUtils::createSurfaceForQImage(&image));
3869+ CairoUtils::Pointer cr(cairo_create(surface.data()));
3870+ gtk_render_background(m_styleContext.data(), cr.data(), 0, 0, image.width(), image.height());
3871+ return QBrush(image);
3872+ }
3873+
3874+ QPixmap windowButtonPixmapFromWMTheme(PanelStyle::WindowButtonType type, PanelStyle::WindowButtonState state)
3875+ {
3876+ QString dir = QString(METACITY_THEME_DIR).arg(m_themeName);
3877+
3878+ QString typeString, stateString;
3879+ switch (type) {
3880+ case PanelStyle::CloseWindowButton:
3881+ typeString = "close";
3882+ break;
3883+ case PanelStyle::MinimizeWindowButton:
3884+ typeString = "minimize";
3885+ break;
3886+ case PanelStyle::UnmaximizeWindowButton:
3887+ typeString = "unmaximize";
3888+ break;
3889+ }
3890+
3891+ switch (state) {
3892+ case PanelStyle::NormalState:
3893+ stateString = "";
3894+ break;
3895+ case PanelStyle::PrelightState:
3896+ stateString = "_focused_prelight";
3897+ break;
3898+ case PanelStyle::PressedState:
3899+ stateString = "_focused_pressed";
3900+ break;
3901+ }
3902+
3903+ QString path = QString("%1/%2%3.png")
3904+ .arg(dir)
3905+ .arg(typeString)
3906+ .arg(stateString);
3907+ return QPixmap(path);
3908+ }
3909+
3910+ QPixmap genericWindowButtonPixmap(PanelStyle::WindowButtonType type, PanelStyle::WindowButtonState state)
3911+ {
3912+ QStyle::StandardPixmap standardIcon;
3913+ switch (type) {
3914+ case PanelStyle::CloseWindowButton:
3915+ standardIcon = QStyle::SP_TitleBarCloseButton;
3916+ break;
3917+ case PanelStyle::MinimizeWindowButton:
3918+ standardIcon = QStyle::SP_TitleBarMinButton;
3919+ break;
3920+ case PanelStyle::UnmaximizeWindowButton:
3921+ standardIcon = QStyle::SP_TitleBarNormalButton;
3922+ break;
3923+ }
3924+
3925+ QIcon icon = QApplication::style()->standardIcon(standardIcon);
3926+ const int extent = 22;
3927+ switch (state) {
3928+ case PanelStyle::NormalState:
3929+ return icon.pixmap(extent);
3930+ case PanelStyle::PrelightState:
3931+ return icon.pixmap(extent, QIcon::Active);
3932+ case PanelStyle::PressedState:
3933+ return icon.pixmap(extent, QIcon::Active, QIcon::On);
3934+ }
3935+ // Silence compiler
3936+ return QPixmap();
3937+ }
3938+};
3939+
3940+PanelStyle::PanelStyle(QObject* parent)
3941+: d(new PanelStylePrivate)
3942+{
3943+ d->q = this;
3944+ d->m_styleContext.reset(gtk_style_context_new());
3945+
3946+ GtkWidgetPath* widgetPath = gtk_widget_path_new ();
3947+ gtk_widget_path_append_type(widgetPath, GTK_TYPE_WINDOW);
3948+ gtk_widget_path_iter_set_name(widgetPath, -1 , "UnityPanelWidget");
3949+
3950+ gtk_style_context_set_path(d->m_styleContext.data(), widgetPath);
3951+ gtk_style_context_add_class(d->m_styleContext.data(), "gnome-panel-menu-bar");
3952+ gtk_style_context_add_class(d->m_styleContext.data(), "unity-panel");
3953+
3954+ gtk_widget_path_free (widgetPath);
3955+
3956+ d->m_gConnector.connect(gtk_settings_get_default(), "notify::gtk-theme-name",
3957+ G_CALLBACK(PanelStylePrivate::onThemeChanged), d);
3958+
3959+ d->updatePalette();
3960+}
3961+
3962+PanelStyle::~PanelStyle()
3963+{
3964+ delete d;
3965+}
3966+
3967+PanelStyle* PanelStyle::instance()
3968+{
3969+ static PanelStyle style;
3970+ return &style;
3971+}
3972+
3973+GtkStyleContext* PanelStyle::styleContext() const
3974+{
3975+ return d->m_styleContext.data();
3976+}
3977+
3978+QPixmap PanelStyle::windowButtonPixmap(PanelStyle::WindowButtonType type, PanelStyle::WindowButtonState state)
3979+{
3980+ // According to Unity PanelStyle code, the buttons of some WM themes do not
3981+ // match well with the panel background. So except for themes we provide,
3982+ // fallback to generic button pixmaps.
3983+ if (d->m_themeName == "Ambiance" || d->m_themeName == "Radiance") {
3984+ return d->windowButtonPixmapFromWMTheme(type, state);
3985+ } else {
3986+ return d->genericWindowButtonPixmap(type, state);
3987+ }
3988+}
3989+
3990+#include "panelstyle.moc"
3991
3992=== added file 'libunity-2d-private/src/panelstyle.h'
3993--- libunity-2d-private/src/panelstyle.h 1970-01-01 00:00:00 +0000
3994+++ libunity-2d-private/src/panelstyle.h 2011-08-24 12:47:31 +0000
3995@@ -0,0 +1,72 @@
3996+/*
3997+ * This file is part of unity-2d
3998+ *
3999+ * Copyright 2011 Canonical Ltd.
4000+ *
4001+ * Authors:
4002+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4003+ *
4004+ * This program is free software; you can redistribute it and/or modify
4005+ * it under the terms of the GNU General Public License as published by
4006+ * the Free Software Foundation; version 3.
4007+ *
4008+ * This program is distributed in the hope that it will be useful,
4009+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4010+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4011+ * GNU General Public License for more details.
4012+ *
4013+ * You should have received a copy of the GNU General Public License
4014+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4015+ */
4016+#ifndef PANELSTYLE_H
4017+#define PANELSTYLE_H
4018+
4019+// Local
4020+
4021+// Qt
4022+#include <QObject>
4023+
4024+class QPixmap;
4025+
4026+struct _GtkStyleContext;
4027+
4028+class PanelStylePrivate;
4029+/**
4030+ * Provides easy access to panel style context and track platform theme to
4031+ * ensure we have the correct background brush.
4032+ *
4033+ * FIXME: This class does not have a very clear focus and has side-effects
4034+ * (background brush handling). It should be refactored.
4035+ */
4036+class PanelStyle : public QObject
4037+{
4038+ Q_OBJECT
4039+public:
4040+ PanelStyle(QObject* parent = 0);
4041+ ~PanelStyle();
4042+
4043+ enum WindowButtonType {
4044+ CloseWindowButton,
4045+ MinimizeWindowButton,
4046+ UnmaximizeWindowButton
4047+ };
4048+
4049+ enum WindowButtonState {
4050+ NormalState,
4051+ PrelightState,
4052+ PressedState
4053+ };
4054+
4055+ static PanelStyle* instance();
4056+
4057+ struct _GtkStyleContext* styleContext() const;
4058+
4059+ QPixmap windowButtonPixmap(WindowButtonType, WindowButtonState);
4060+
4061+private:
4062+ friend class PanelStylePrivate;
4063+ // Use a pimpl to avoid the need for gtk includes here
4064+ PanelStylePrivate* const d;
4065+};
4066+
4067+#endif /* PANELSTYLE_H */
4068
4069=== modified file 'libunity-2d-private/src/placeentry.cpp'
4070--- libunity-2d-private/src/placeentry.cpp 2011-08-23 09:42:44 +0000
4071+++ libunity-2d-private/src/placeentry.cpp 2011-08-24 12:47:31 +0000
4072@@ -22,6 +22,7 @@
4073 #include "launchermenu.h"
4074
4075 // libunity-2d
4076+#include <dashclient.h>
4077 #include <debug_p.h>
4078
4079 // QtDee
4080@@ -30,9 +31,6 @@
4081 #include <QDBusMetaType>
4082 #include <QAction>
4083 #include <QDebug>
4084-#include <QDBusServiceWatcher>
4085-#include <QDBusConnectionInterface>
4086-#include <QDBusReply>
4087
4088 // Marshall the RendererInfoStruct data into a D-Bus argument
4089 QDBusArgument &operator<<(QDBusArgument &argument, const RendererInfoStruct &r)
4090@@ -149,10 +147,6 @@
4091 static const char* UNITY_PLACE_ENTRY_INTERFACE = "com.canonical.Unity.PlaceEntry";
4092 static const char* SECTION_PROPERTY = "section";
4093
4094-static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
4095-static const char* DASH_DBUS_PATH = "/Dash";
4096-static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
4097-
4098 PlaceEntry::PlaceEntry(QObject* parent) :
4099 LauncherItem(parent),
4100 m_position(0),
4101@@ -166,32 +160,15 @@
4102 m_entryResultsModel(NULL),
4103 m_globalGroupsModel(NULL),
4104 m_globalResultsModel(NULL),
4105- m_dbusIface(NULL),
4106- m_dashDbusIface(NULL),
4107- m_dashActive(false)
4108+ m_dbusIface(NULL)
4109 {
4110 qDBusRegisterMetaType<RendererInfoStruct>();
4111 qDBusRegisterMetaType<PlaceEntryInfoStruct>();
4112 qDBusRegisterMetaType<QList<PlaceEntryInfoStruct> >();
4113 qDBusRegisterMetaType<QHash<QString, QString>>();
4114
4115- /* Check if the dash is already up and running by asking the bus instead of
4116- trying to create an instance of the interface. Creating an instance would
4117- cause D-Bus to activate the dash and we don’t want this to happen, the
4118- dash should be started on demand only. */
4119- QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface();
4120- QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(DASH_DBUS_SERVICE);
4121- if (reply.isValid() && reply.value()) {
4122- connectToDash();
4123- } else {
4124- /* The dash is not running: monitor its registration on the bus so we
4125- can connect to it when it comes up. */
4126- QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DASH_DBUS_SERVICE,
4127- QDBusConnection::sessionBus(),
4128- QDBusServiceWatcher::WatchForRegistration,
4129- this);
4130- connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash()));
4131- }
4132+ connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)),
4133+ SLOT(slotActivePageChanged(const QString&)));
4134 }
4135
4136 PlaceEntry::PlaceEntry(const PlaceEntry& other) :
4137@@ -755,59 +732,12 @@
4138 Q_EMIT globalRendererHintsChanged();
4139 }
4140
4141-void
4142-PlaceEntry::connectToDash()
4143-{
4144- if (m_dashDbusIface != NULL) {
4145- return;
4146- }
4147-
4148- m_dashDbusIface = new QDBusInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE,
4149- QDBusConnection::sessionBus(), this);
4150- connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
4151- SLOT(slotDashActiveChanged(bool)));
4152- connect(m_dashDbusIface, SIGNAL(activePlaceEntryChanged(const QString&)),
4153- SLOT(slotDashActivePlaceEntryChanged(const QString&)));
4154-
4155- QVariant value = m_dashDbusIface->property("active");
4156- if (value.isValid()) {
4157- m_dashActive = value.toBool();
4158- } else {
4159- UQ_WARNING << "Fetching Dash.active property failed";
4160- }
4161- value = m_dashDbusIface->property("activePlaceEntry");
4162- if (value.isValid()) {
4163- m_dashActivePlaceEntry = value.toString();
4164- } else {
4165- UQ_WARNING << "Fetching Dash.activePlaceEntry property failed";
4166- }
4167-
4168- updateActiveState();
4169-}
4170-
4171-void
4172-PlaceEntry::slotDashActiveChanged(bool value)
4173-{
4174- if (m_dashActive != value) {
4175- m_dashActive = value;
4176- updateActiveState();
4177- }
4178-}
4179-
4180-void
4181-PlaceEntry::slotDashActivePlaceEntryChanged(const QString& entry)
4182-{
4183- if (m_dashActivePlaceEntry != entry) {
4184- m_dashActivePlaceEntry = entry;
4185- updateActiveState();
4186- }
4187-}
4188-
4189-void
4190-PlaceEntry::updateActiveState()
4191+
4192+void
4193+PlaceEntry::slotActivePageChanged(const QString& page)
4194 {
4195 bool active = false;
4196- if (m_dashActive && !m_dbusObjectPath.isEmpty() && (m_dashActivePlaceEntry == m_dbusObjectPath)) {
4197+ if (!m_dbusObjectPath.isEmpty() && page == m_dbusObjectPath) {
4198 active = true;
4199 }
4200
4201@@ -830,8 +760,12 @@
4202 startRemotePlaceOnDemand();
4203 }
4204
4205- QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
4206- iface.asyncCall(QLatin1String("activatePlaceEntry"), m_fileName, m_groupName, section);
4207+ if (m_active) {
4208+ DashClient::instance()->setActivePage(QString());
4209+ } else {
4210+ /* FIXME: DashClient::setActivePage has changed but PlaceEntry is deprecated anyway */
4211+ //DashClient::instance()->setActivePage(m_dbusObjectPath, m_fileName, m_groupName, section);
4212+ }
4213 }
4214
4215 void
4216
4217=== modified file 'libunity-2d-private/src/placeentry.h'
4218--- libunity-2d-private/src/placeentry.h 2011-08-23 09:42:44 +0000
4219+++ libunity-2d-private/src/placeentry.h 2011-08-24 12:47:31 +0000
4220@@ -262,9 +262,6 @@
4221 QMap<QString, QVariant> m_globalRendererHints;
4222
4223 QDBusInterface* m_dbusIface;
4224- QDBusInterface* m_dashDbusIface;
4225- bool m_dashActive;
4226- QString m_dashActivePlaceEntry;
4227
4228 void setSection(const QString&);
4229 void activateEntry(const int section);
4230@@ -274,15 +271,12 @@
4231 private Q_SLOTS:
4232 void onRendererInfoChanged(const RendererInfoStruct&);
4233
4234- void connectToDash();
4235- void updateActiveState();
4236- void slotDashActiveChanged(bool);
4237- void slotDashActivePlaceEntryChanged(const QString&);
4238-
4239 void startMonitoringSections();
4240 void stopMonitoringSections();
4241 void slotSectionsChanged();
4242
4243+ void slotActivePageChanged(const QString& page);
4244+
4245 /* Contextual menu callbacks */
4246 void onSectionTriggered();
4247 };
4248
4249=== added file 'libunity-2d-private/src/ratingsfilter.cpp'
4250--- libunity-2d-private/src/ratingsfilter.cpp 1970-01-01 00:00:00 +0000
4251+++ libunity-2d-private/src/ratingsfilter.cpp 2011-08-24 12:47:31 +0000
4252@@ -0,0 +1,46 @@
4253+/*
4254+ * Copyright (C) 2011 Canonical, Ltd.
4255+ *
4256+ * Authors:
4257+ * Florian Boucault <florian.boucault@canonical.com>
4258+ *
4259+ * This program is free software; you can redistribute it and/or modify
4260+ * it under the terms of the GNU General Public License as published by
4261+ * the Free Software Foundation; version 3.
4262+ *
4263+ * This program is distributed in the hope that it will be useful,
4264+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4265+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4266+ * GNU General Public License for more details.
4267+ *
4268+ * You should have received a copy of the GNU General Public License
4269+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4270+ */
4271+
4272+// Self
4273+#include "ratingsfilter.h"
4274+
4275+RatingsFilter::RatingsFilter(QObject *parent) :
4276+ Filter(parent)
4277+{
4278+}
4279+
4280+float RatingsFilter::rating() const
4281+{
4282+ return m_unityRatingsFilter->rating();
4283+}
4284+
4285+void RatingsFilter::setUnityFilter(unity::dash::Filter::Ptr filter)
4286+{
4287+ if (m_unityFilter != NULL) {
4288+ // FIXME: should disconnect from m_unityFilter's signals
4289+ }
4290+
4291+ Filter::setUnityFilter(filter);
4292+ m_unityRatingsFilter = std::dynamic_pointer_cast<unity::dash::RatingsFilter>(m_unityFilter);
4293+
4294+ /* Property change signals */
4295+ m_unityRatingsFilter->rating.changed.connect(sigc::mem_fun(this, &RatingsFilter::ratingChanged));
4296+}
4297+
4298+#include "ratingsfilter.moc"
4299
4300=== added file 'libunity-2d-private/src/ratingsfilter.h'
4301--- libunity-2d-private/src/ratingsfilter.h 1970-01-01 00:00:00 +0000
4302+++ libunity-2d-private/src/ratingsfilter.h 2011-08-24 12:47:31 +0000
4303@@ -0,0 +1,56 @@
4304+/*
4305+ * Copyright (C) 2011 Canonical, Ltd.
4306+ *
4307+ * Authors:
4308+ * Florian Boucault <florian.boucault@canonical.com>
4309+ *
4310+ * This program is free software; you can redistribute it and/or modify
4311+ * it under the terms of the GNU General Public License as published by
4312+ * the Free Software Foundation; version 3.
4313+ *
4314+ * This program is distributed in the hope that it will be useful,
4315+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4316+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4317+ * GNU General Public License for more details.
4318+ *
4319+ * You should have received a copy of the GNU General Public License
4320+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4321+ */
4322+
4323+#ifndef RATINGSFILTER_H
4324+#define RATINGSFILTER_H
4325+
4326+// Qt
4327+#include <QObject>
4328+#include <QMetaType>
4329+
4330+// libunity-core
4331+#include <UnityCore/RatingsFilter.h>
4332+
4333+// Local
4334+#include "filter.h"
4335+
4336+class RatingsFilter : public Filter
4337+{
4338+ Q_OBJECT
4339+
4340+ Q_PROPERTY(float rating READ rating NOTIFY ratingChanged)
4341+
4342+public:
4343+ explicit RatingsFilter(QObject *parent = 0);
4344+
4345+ /* getters */
4346+ float rating() const;
4347+
4348+ virtual void setUnityFilter(unity::dash::Filter::Ptr filter);
4349+
4350+Q_SIGNALS:
4351+ void ratingChanged(float);
4352+
4353+private:
4354+ unity::dash::RatingsFilter::Ptr m_unityRatingsFilter;
4355+};
4356+
4357+Q_DECLARE_METATYPE(RatingsFilter*)
4358+
4359+#endif // RATINGSFILTER_H
4360
4361=== modified file 'libunity-2d-private/src/screeninfo.cpp'
4362--- libunity-2d-private/src/screeninfo.cpp 2011-07-29 13:49:34 +0000
4363+++ libunity-2d-private/src/screeninfo.cpp 2011-08-24 12:47:31 +0000
4364@@ -1,7 +1,5 @@
4365 extern "C" {
4366-#include <libwnck/screen.h>
4367-#include <libwnck/window.h>
4368-#include <libwnck/workspace.h>
4369+#include <libwnck/libwnck.h>
4370 }
4371
4372 #include "bamf-matcher.h"
4373@@ -16,7 +14,8 @@
4374 #include <QDesktopWidget>
4375
4376 ScreenInfo::ScreenInfo(QObject *parent) :
4377- QObject(parent)
4378+ QObject(parent),
4379+ m_activeWindow(0)
4380 {
4381 WnckScreen *screen = wnck_screen_get_default();
4382 g_signal_connect(G_OBJECT(screen), "active-window-changed",
4383
4384=== modified file 'libunity-2d-private/src/unity-2d-private.pc.cmake'
4385--- libunity-2d-private/src/unity-2d-private.pc.cmake 2011-08-05 10:52:31 +0000
4386+++ libunity-2d-private/src/unity-2d-private.pc.cmake 2011-08-24 12:47:31 +0000
4387@@ -9,4 +9,4 @@
4388 Version: @VERSION@
4389 Libs: -L@LIBDIR@ -lunity-2d-private
4390 Cflags: -I@INCLUDEDIR@/unity-2d-private
4391-Requires: glib-2.0, gtk+-2.0, libwnck-1.0
4392+Requires: glib-2.0, gtk+-3.0, libwnck-3.0, pango
4393
4394=== modified file 'libunity-2d-private/src/unity2dapplication.cpp'
4395--- libunity-2d-private/src/unity2dapplication.cpp 2011-07-27 11:42:46 +0000
4396+++ libunity-2d-private/src/unity2dapplication.cpp 2011-08-24 12:47:31 +0000
4397@@ -25,14 +25,62 @@
4398
4399 // libunity-2d
4400 #include <debug_p.h>
4401+#include <gconnector.h>
4402+#include <gscopedpointer.h>
4403 #include <unity2ddebug.h>
4404
4405 // Qt
4406+#include <QFont>
4407 #include <QWindowsStyle>
4408+#include <QAccessible>
4409+#include <QAccessibleWidget>
4410+#include <QWidget>
4411
4412 // GTK
4413 #include <gtk/gtk.h>
4414-
4415+#include <pango/pango.h>
4416+
4417+///////////////////////////////
4418+class PlatformFontTracker
4419+{
4420+public:
4421+ PlatformFontTracker()
4422+ {
4423+ m_gConnector.connect(gtk_settings_get_default(), "notify::gtk-font-name",
4424+ G_CALLBACK(PlatformFontTracker::onFontChanged), this);
4425+
4426+ updateFont();
4427+ }
4428+
4429+private:
4430+ void updateFont()
4431+ {
4432+ gchar* fontName = 0;
4433+ g_object_get(gtk_settings_get_default(), "gtk-font-name", &fontName, NULL);
4434+ GScopedPointer<PangoFontDescription, pango_font_description_free> fontDescription(
4435+ pango_font_description_from_string(fontName)
4436+ );
4437+ g_free(fontName);
4438+
4439+ int size = pango_font_description_get_size(fontDescription.data());
4440+
4441+ QFont font = QFont(
4442+ pango_font_description_get_family(fontDescription.data()),
4443+ size / PANGO_SCALE
4444+ );
4445+
4446+ QApplication::setFont(font);
4447+ }
4448+
4449+ static void onFontChanged(GObject*, GParamSpec*, PlatformFontTracker* obj)
4450+ {
4451+ obj->updateFont();
4452+ }
4453+
4454+ GConnector m_gConnector;
4455+};
4456+
4457+///////////////////////////////
4458 AbstractX11EventFilter::~AbstractX11EventFilter()
4459 {
4460 Unity2dApplication* application = Unity2dApplication::instance();
4461@@ -41,6 +89,28 @@
4462 }
4463 }
4464
4465+///////////////////////////////
4466+static bool arrayContains(char** begin, char** end, const char* string)
4467+{
4468+ for (char** ptr = begin; ptr != end; ++ptr) {
4469+ if (strcmp(*ptr, string) == 0) {
4470+ return true;
4471+ }
4472+ }
4473+ return false;
4474+}
4475+
4476+QAccessibleInterface *panelFactory(const QString &classname, QObject *object)
4477+{
4478+ QAccessibleInterface *interface = 0;
4479+
4480+ if (classname == "Unity2dPanel" && object && object->isWidgetType()) {
4481+ interface = new QAccessibleWidget(static_cast<QWidget *>(object), QAccessible::ToolBar);
4482+ }
4483+
4484+ return interface;
4485+}
4486+
4487 void Unity2dApplication::earlySetup(int& argc, char** argv)
4488 {
4489 // Parts of unity-2d uses GTK so it needs to be initialized
4490@@ -61,10 +131,19 @@
4491 if(getenv("QT_GRAPHICSSYSTEM") == 0) {
4492 QApplication::setGraphicsSystem("raster");
4493 }
4494+
4495+ /* Unless style has been specified in args, set default Qt style to
4496+ * QWindowStyle to avoid loading QGtkStyle. We don't want to load QGtkStyle
4497+ * because it uses libgtk2, which causes conflicts with our gtk3 code.
4498+ */
4499+ if (!arrayContains(argv, argv + argc, "-style")) {
4500+ QApplication::setStyle(new QWindowsStyle);
4501+ }
4502 }
4503
4504 Unity2dApplication::Unity2dApplication(int& argc, char** argv)
4505 : QApplication(argc, argv)
4506+, m_platformFontTracker(new PlatformFontTracker)
4507 {
4508 /* Allow developers to run Unity 2D uninstalled by telling dconf-qt
4509 where to look for Unity 2D's schemas.
4510@@ -73,11 +152,14 @@
4511 if (!isRunningInstalled()) {
4512 qputenv("GSETTINGS_SCHEMA_DIR", unity2dDirectory().toLocal8Bit() + "/data");
4513 }
4514+
4515+ QAccessible::installFactory(panelFactory);
4516 }
4517
4518 Unity2dApplication::~Unity2dApplication()
4519 {
4520 qDeleteAll(m_x11EventFilters);
4521+ delete m_platformFontTracker;
4522 }
4523
4524 Unity2dApplication* Unity2dApplication::instance()
4525
4526=== modified file 'libunity-2d-private/src/unity2dapplication.h'
4527--- libunity-2d-private/src/unity2dapplication.h 2011-07-18 13:47:29 +0000
4528+++ libunity-2d-private/src/unity2dapplication.h 2011-08-24 12:47:31 +0000
4529@@ -27,6 +27,8 @@
4530
4531 class Unity2dApplication;
4532
4533+class PlatformFontTracker;
4534+
4535 class AbstractX11EventFilter
4536 {
4537 public:
4538@@ -65,6 +67,7 @@
4539
4540 private:
4541 QList<AbstractX11EventFilter*> m_x11EventFilters;
4542+ PlatformFontTracker* m_platformFontTracker;
4543 };
4544
4545 #endif // UNITY2DAPPLICATION_H
4546
4547=== modified file 'libunity-2d-private/src/unity2dpanel.cpp'
4548--- libunity-2d-private/src/unity2dpanel.cpp 2011-06-07 13:46:38 +0000
4549+++ libunity-2d-private/src/unity2dpanel.cpp 2011-08-24 12:47:31 +0000
4550@@ -22,6 +22,7 @@
4551 // Self
4552 #include "unity2dpanel.h"
4553 #include <debug_p.h>
4554+#include <indicatorsmanager.h>
4555
4556 // Qt
4557 #include <QApplication>
4558@@ -41,6 +42,7 @@
4559 {
4560 Unity2dPanel* q;
4561 Unity2dPanel::Edge m_edge;
4562+ mutable IndicatorsManager* m_indicatorsManager;
4563 QHBoxLayout* m_layout;
4564 QPropertyAnimation* m_slideInAnimation;
4565 QPropertyAnimation* m_slideOutAnimation;
4566@@ -137,6 +139,7 @@
4567 {
4568 d->q = this;
4569 d->m_edge = Unity2dPanel::TopEdge;
4570+ d->m_indicatorsManager = 0;
4571 d->m_useStrut = true;
4572 d->m_delta = 0;
4573 d->m_manualSliding = false;
4574@@ -189,6 +192,15 @@
4575 return d->m_edge;
4576 }
4577
4578+IndicatorsManager* Unity2dPanel::indicatorsManager() const
4579+{
4580+ if (d->m_indicatorsManager == 0)
4581+ d->m_indicatorsManager =
4582+ new IndicatorsManager(const_cast<Unity2dPanel*>(this));
4583+
4584+ return d->m_indicatorsManager;
4585+}
4586+
4587 void Unity2dPanel::showEvent(QShowEvent* event)
4588 {
4589 QWidget::showEvent(event);
4590
4591=== modified file 'libunity-2d-private/src/unity2dpanel.h'
4592--- libunity-2d-private/src/unity2dpanel.h 2011-06-06 17:24:29 +0000
4593+++ libunity-2d-private/src/unity2dpanel.h 2011-08-24 12:47:31 +0000
4594@@ -23,6 +23,7 @@
4595 #define UNITY2DPANEL_H
4596
4597 // Local
4598+class IndicatorsManager;
4599
4600 // Qt
4601 #include <QWidget>
4602@@ -60,6 +61,8 @@
4603
4604 void addSpacer();
4605
4606+ IndicatorsManager* indicatorsManager() const;
4607+
4608 /**
4609 * Whether the panel should reserve space on the edge, preventing maximized
4610 * windows to overlap it.
4611
4612=== modified file 'libunity-2d-private/src/windowinfo.cpp'
4613--- libunity-2d-private/src/windowinfo.cpp 2011-07-29 13:49:34 +0000
4614+++ libunity-2d-private/src/windowinfo.cpp 2011-08-24 12:47:31 +0000
4615@@ -14,9 +14,7 @@
4616 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4617 */
4618
4619-#include <libwnck/screen.h>
4620-#include <libwnck/window.h>
4621-#include <libwnck/workspace.h>
4622+#include <libwnck/libwnck.h>
4623
4624 #include <glib-2.0/glib.h>
4625
4626
4627=== modified file 'libunity-2d-private/src/workspacesinfo.cpp'
4628--- libunity-2d-private/src/workspacesinfo.cpp 2011-07-29 13:49:34 +0000
4629+++ libunity-2d-private/src/workspacesinfo.cpp 2011-08-24 12:47:31 +0000
4630@@ -4,9 +4,7 @@
4631 #include <debug_p.h>
4632
4633 extern "C" {
4634-#include <libwnck/screen.h>
4635-#include <libwnck/window.h>
4636-#include <libwnck/workspace.h>
4637+#include <libwnck/libwnck.h>
4638 }
4639
4640 #include <QAbstractEventDispatcher>
4641@@ -23,7 +21,13 @@
4642 Atom _NET_CURRENT_DESKTOP;
4643
4644 WorkspacesInfo::WorkspacesInfo(QObject *parent) :
4645- QObject(parent)
4646+ QObject(parent),
4647+ m_count(0),
4648+ m_current(0),
4649+ m_rows(0),
4650+ m_columns(0),
4651+ m_orientation(OrientationHorizontal),
4652+ m_startingCorner(CornerTopLeft)
4653 {
4654 WorkspacesInfo::internX11Atoms();
4655
4656
4657=== modified file 'panel/CMakeLists.txt'
4658--- panel/CMakeLists.txt 2011-08-12 15:06:01 +0000
4659+++ panel/CMakeLists.txt 2011-08-24 12:47:31 +0000
4660@@ -1,5 +1,8 @@
4661 project(unity-2d-panel)
4662
4663+# Dependencies
4664+pkg_check_modules(UNITYCORE REQUIRED unity-core-4.0)
4665+
4666 # Source
4667 include_directories(
4668 ${libunity-2d-private_SOURCE_DIR}/src
4669@@ -8,8 +11,3 @@
4670 add_subdirectory(applets)
4671 add_subdirectory(app)
4672 add_subdirectory(tests)
4673-
4674-# Install
4675-install(DIRECTORY artwork
4676- DESTINATION ${UNITY_2D_DIR}/panel
4677- )
4678
4679=== modified file 'panel/app/CMakeLists.txt'
4680--- panel/app/CMakeLists.txt 2011-08-11 15:52:38 +0000
4681+++ panel/app/CMakeLists.txt 2011-08-24 12:47:31 +0000
4682@@ -3,7 +3,6 @@
4683 set(panel_SRCS
4684 main.cpp
4685 panelmanager.cpp
4686- unity2dstyle.cpp
4687 )
4688
4689 qt4_automoc(${panel_SRCS})
4690@@ -12,6 +11,8 @@
4691 include_directories(
4692 ${CMAKE_CURRENT_BINARY_DIR}
4693 ${CMAKE_CURRENT_SOURCE_DIR}
4694+ ${GTK_INCLUDE_DIRS}
4695+ ${UNITYCORE_INCLUDE_DIRS}
4696 ${DCONFQT_INCLUDE_DIRS}
4697 ${libunity-2d-private_SOURCE_DIR}/src
4698 )
4699@@ -19,6 +20,7 @@
4700 target_link_libraries(unity-2d-panel
4701 ${QT_QTGUI_LIBRARIES}
4702 ${QT_QTCORE_LIBRARIES}
4703+ ${GTK_LDFLAGS}
4704 ${DCONFQT_LIBRARIES}
4705 unity-2d-private
4706 )
4707
4708=== modified file 'panel/app/main.cpp'
4709--- panel/app/main.cpp 2011-07-18 13:47:29 +0000
4710+++ panel/app/main.cpp 2011-08-24 12:47:31 +0000
4711@@ -22,12 +22,12 @@
4712 // Local
4713 #include <config.h>
4714 #include <panelmanager.h>
4715+#include <panelstyle.h>
4716
4717 // Unity
4718 #include <gnomesessionclient.h>
4719 #include <unity2ddebug.h>
4720 #include <unity2dapplication.h>
4721-#include <unity2dstyle.h>
4722 #include <unity2dtr.h>
4723
4724 // Qt
4725@@ -54,7 +54,10 @@
4726 ThemeEngineHandler handler;
4727 Unity2dApplication::earlySetup(argc, argv);
4728 Unity2dApplication app(argc, argv);
4729- QApplication::setStyle(new Unity2dStyle);
4730+ app.setApplicationName("Unity 2D Panel");
4731+
4732+ // Instantiate a PanelStyle so that it configures QApplication
4733+ PanelStyle::instance();
4734
4735 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-panel.desktop");
4736 client.connectToSessionManager();
4737
4738=== modified file 'panel/app/panelmanager.cpp'
4739--- panel/app/panelmanager.cpp 2011-08-19 10:42:32 +0000
4740+++ panel/app/panelmanager.cpp 2011-08-24 12:47:31 +0000
4741@@ -24,6 +24,8 @@
4742
4743 // Local
4744 #include <config.h>
4745+#include <panelstyle.h>
4746+#include <indicatorsmanager.h>
4747
4748 // Unity
4749 #include <unity2dpanel.h>
4750@@ -49,21 +51,6 @@
4751 static const char* PANEL_DCONF_PROPERTY_APPLETS = "applets";
4752 static const char* PANEL_PLUGINS_DEV_DIR_ENV = "UNITY2D_PANEL_PLUGINS_PATH";
4753
4754-static QPalette getPalette()
4755-{
4756- QPalette palette;
4757-
4758- /* Should use the panel's background provided by Unity but it turns
4759- out not to be good. It would look like:
4760-
4761- QBrush bg(QPixmap("theme:/panel_background.png"));
4762- */
4763- QBrush bg(QPixmap(unity2dDirectory() + "/panel/artwork/background.png"));
4764- palette.setBrush(QPalette::Window, bg);
4765- palette.setBrush(QPalette::Button, bg);
4766- return palette;
4767-}
4768-
4769 static QHash<QString, PanelAppletProviderInterface*> loadPlugins()
4770 {
4771 QHash<QString, PanelAppletProviderInterface*> plugins;
4772@@ -130,11 +117,29 @@
4773 return appletsConfig.toStringList();
4774 }
4775
4776-static Unity2dPanel* instantiatePanel(int screen)
4777+PanelManager::PanelManager(QObject* parent)
4778+: QObject(parent)
4779+{
4780+ QDesktopWidget* desktop = QApplication::desktop();
4781+ for(int i = 0; i < desktop->screenCount(); ++i) {
4782+ Unity2dPanel* panel = instantiatePanel(i);
4783+ m_panels.append(panel);
4784+ panel->show();
4785+ panel->move(desktop->screenGeometry(i).topLeft());
4786+ }
4787+ connect(desktop, SIGNAL(screenCountChanged(int)), SLOT(onScreenCountChanged(int)));
4788+}
4789+
4790+PanelManager::~PanelManager()
4791+{
4792+ qDeleteAll(m_panels);
4793+}
4794+
4795+Unity2dPanel* PanelManager::instantiatePanel(int screen)
4796 {
4797 Unity2dPanel* panel = new Unity2dPanel;
4798+ panel->setAccessibleName("Top Panel");
4799 panel->setEdge(Unity2dPanel::TopEdge);
4800- panel->setPalette(getPalette());
4801 panel->setFixedHeight(24);
4802
4803 int leftmost = QApplication::desktop()->screenNumber(QPoint());
4804@@ -156,7 +161,7 @@
4805 << "installed plugin providing it.";
4806 } else {
4807 if (screen == leftmost || !onlyLeftmost) {
4808- QWidget *applet = provider->createApplet();
4809+ QWidget *applet = provider->createApplet(panel);
4810 if (applet == 0) {
4811 qWarning() << "The panel applet plugin for" << appletName
4812 << "did not return a valid plugin.";
4813@@ -170,24 +175,6 @@
4814 return panel;
4815 }
4816
4817-PanelManager::PanelManager(QObject* parent)
4818- : QObject(parent)
4819-{
4820- QDesktopWidget* desktop = QApplication::desktop();
4821- for(int i = 0; i < desktop->screenCount(); ++i) {
4822- Unity2dPanel* panel = instantiatePanel(i);
4823- m_panels.append(panel);
4824- panel->show();
4825- panel->move(desktop->screenGeometry(i).topLeft());
4826- }
4827- connect(desktop, SIGNAL(screenCountChanged(int)), SLOT(onScreenCountChanged(int)));
4828-}
4829-
4830-PanelManager::~PanelManager()
4831-{
4832- qDeleteAll(m_panels);
4833-}
4834-
4835 void
4836 PanelManager::onScreenCountChanged(int newCount)
4837 {
4838
4839=== modified file 'panel/app/panelmanager.h'
4840--- panel/app/panelmanager.h 2011-04-04 16:41:15 +0000
4841+++ panel/app/panelmanager.h 2011-08-24 12:47:31 +0000
4842@@ -40,6 +40,8 @@
4843 Q_DISABLE_COPY(PanelManager)
4844 QList<Unity2dPanel*> m_panels;
4845
4846+ Unity2dPanel* instantiatePanel(int screen);
4847+
4848 private Q_SLOTS:
4849 void onScreenCountChanged(int newCount);
4850 };
4851
4852=== removed file 'panel/app/unity2dstyle.cpp'
4853--- panel/app/unity2dstyle.cpp 2011-03-28 12:16:02 +0000
4854+++ panel/app/unity2dstyle.cpp 1970-01-01 00:00:00 +0000
4855@@ -1,98 +0,0 @@
4856-/*
4857- * Plasma applet to display DBus global menu
4858- *
4859- * Copyright 2009 Canonical Ltd.
4860- *
4861- * Authors:
4862- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4863- *
4864- * This program is free software; you can redistribute it and/or modify
4865- * it under the terms of the GNU General Public License as published by
4866- * the Free Software Foundation; version 3.
4867- *
4868- * This program is distributed in the hope that it will be useful,
4869- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4870- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4871- * GNU General Public License for more details.
4872- *
4873- * You should have received a copy of the GNU General Public License
4874- * along with this program. If not, see <http://www.gnu.org/licenses/>
4875- */
4876-
4877-// Self
4878-#include "unity2dstyle.h"
4879-
4880-// Local
4881-
4882-// libunity-2d-private
4883-#include <debug_p.h>
4884-#include <keyboardmodifiersmonitor.h>
4885-
4886-// Qt
4887-#include <QGtkStyle>
4888-#include <QMenu>
4889-#include <QPainter>
4890-#include <QStyleOptionFrame>
4891-#include <QWidget>
4892-
4893-Unity2dStyle::Unity2dStyle()
4894-: QProxyStyle(new QGtkStyle)
4895-{
4896-}
4897-
4898-void Unity2dStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
4899-{
4900- if (element == QStyle::CE_MenuBarItem && widget) {
4901- QStyleOptionMenuItem opt = *qstyleoption_cast<const QStyleOptionMenuItem*>(option);
4902- if (!(opt.state & QStyle::State_Enabled) && (opt.state & QStyle::State_Sunken)) {
4903- // Reset State_Sunken flag to avoid drawing a frame on a disabled menu item
4904- // See https://bugs.launchpad.net/unity-2d/+bug/717744
4905- opt.state ^= QStyle::State_Sunken;
4906- }
4907- // Skip "widget" parameter to avoid solid gray background behind the menubar items
4908- QProxyStyle::drawControl(element, &opt, painter, 0);
4909- } else if (element == QStyle::CE_MenuBarEmptyArea) {
4910- // Avoid gray borders around the menubar items
4911- } else {
4912- QProxyStyle::drawControl(element, option, painter, widget);
4913- }
4914-}
4915-
4916-int Unity2dStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
4917-{
4918- if (metric == QStyle::PM_MenuBarVMargin) {
4919- // Avoid one-pixel gap above menuitem
4920- return 0;
4921- } else {
4922- return QProxyStyle::pixelMetric(metric, option, widget);
4923- }
4924-}
4925-
4926-QSize Unity2dStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const
4927-{
4928- QSize size = QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
4929- if (type == QStyle::CT_MenuBarItem && widget) {
4930- // Avoid three-pixel gap below menuitem
4931- size.setHeight(widget->height());
4932- }
4933- return size;
4934-}
4935-
4936-int Unity2dStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const
4937-{
4938- if (hint == QStyle::SH_UnderlineShortcut) {
4939- // The shortcut of an opened menu can be triggered without holding Alt
4940- // down, so we always show the underline. For all other widgets we only
4941- // show the underlines if alt is down.
4942- // Note that this is a bit hackish: it only works reliably if the
4943- // widget repaints itself when alt is pressed or released. For now only
4944- // the MenuBarWidget from the AppNameApplets does this.
4945- if (qobject_cast<const QMenu*>(widget)) {
4946- return true;
4947- } else {
4948- return KeyboardModifiersMonitor::instance()->keyboardModifiers() == Qt::AltModifier;
4949- }
4950- } else {
4951- return QProxyStyle::styleHint(hint, option, widget, returnData);
4952- }
4953-}
4954
4955=== removed file 'panel/app/unity2dstyle.h'
4956--- panel/app/unity2dstyle.h 2011-01-26 15:50:26 +0000
4957+++ panel/app/unity2dstyle.h 1970-01-01 00:00:00 +0000
4958@@ -1,44 +0,0 @@
4959-/*
4960- * This file is part of unity-2d
4961- *
4962- * Copyright 2010 Canonical Ltd.
4963- *
4964- * Authors:
4965- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4966- *
4967- * This program is free software; you can redistribute it and/or modify
4968- * it under the terms of the GNU General Public License as published by
4969- * the Free Software Foundation; version 3.
4970- *
4971- * This program is distributed in the hope that it will be useful,
4972- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4973- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4974- * GNU General Public License for more details.
4975- *
4976- * You should have received a copy of the GNU General Public License
4977- * along with this program. If not, see <http://www.gnu.org/licenses/>
4978- */
4979-
4980-#ifndef UNITY2DSTYLE_H
4981-#define UNITY2DSTYLE_H
4982-
4983-// Local
4984-
4985-// Qt
4986-#include <QProxyStyle>
4987-
4988-class Unity2dStyle : public QProxyStyle
4989-{
4990-public:
4991- Unity2dStyle();
4992-
4993- virtual void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = 0) const;
4994-
4995- virtual int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const;
4996-
4997- virtual QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget = 0) const;
4998-
4999- virtual int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const;
5000-};
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches