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

Proposed by Florian Boucault
Status: Superseded
Proposed branch: lp:~fboucault/unity-2d/dash_collapsed_by_default
Merge into: lp:unity-2d/3.0
Diff against target: 10694 lines (+4169/-3110)
211 files modified
.bzrignore (+2/-0)
CMakeLists.txt (+6/-3)
data/unity-2d.convert (+0/-2)
debian/20_ubuntu-2d-gconf-default (+0/-8)
debian/20_ubuntu-2d-gconf-mandatory (+0/-1)
debian/changelog (+103/-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 (+0/-2)
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 (+18/-0)
libunity-2d-private/src/bfb.cpp (+119/-0)
libunity-2d-private/src/bfb.h (+75/-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/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/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 (+1/-3)
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/windowinfo.cpp (+1/-3)
libunity-2d-private/src/workspacesinfo.cpp (+1/-3)
panel/CMakeLists.txt (+3/-5)
panel/app/CMakeLists.txt (+3/-1)
panel/app/main.cpp (+5/-2)
panel/app/panelmanager.cpp (+23/-48)
panel/app/panelmanager.h (+2/-0)
panel/app/unity2dstyle.cpp (+0/-98)
panel/app/unity2dstyle.h (+0/-44)
panel/applets/CMakeLists.txt (+15/-29)
panel/applets/appname/appnameapplet.cpp (+49/-84)
panel/applets/appname/appnameapplet.h (+3/-1)
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/registrar.cpp (+0/-138)
panel/applets/appname/registrar.h (+0/-85)
panel/applets/common/cairoutils.cpp (+42/-0)
panel/applets/common/cairoutils.h (+47/-0)
panel/applets/common/indicatorentrywidget.cpp (+378/-0)
panel/applets/common/indicatorentrywidget.h (+90/-0)
panel/applets/common/indicatorsmanager.cpp (+206/-0)
panel/applets/common/indicatorsmanager.h (+72/-0)
panel/applets/common/indicatorwidget.cpp (+53/-0)
panel/applets/common/indicatorwidget.h (+52/-0)
panel/applets/common/panelstyle.cpp (+201/-0)
panel/applets/common/panelstyle.h (+72/-0)
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/-53)
panel/applets/indicator-config.h.in (+0/-7)
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.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/tests/CMakeLists.txt (+2/-4)
panel/tests/homebuttonapplettest.cpp (+0/-42)
places/AbstractButton.qml (+2/-0)
places/CategoryHeader.qml (+9/-7)
places/Home.qml (+26/-24)
places/HomeButton.qml (+2/-0)
places/HomeShortcuts.qml (+15/-11)
places/LensBar.qml (+117/-0)
places/LensButton.qml (+80/-0)
places/LensView.qml (+46/-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 (+7/-5)
places/TickBox.qml (+3/-0)
places/UnityDefaultRenderer.qml (+3/-1)
places/UnityEmptySearchRenderer.qml (+5/-3)
places/UnityFileInfoRenderer.qml (+3/-1)
places/UnityHorizontalTileRenderer.qml (+1/-1)
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/tile-vertical.qml (+22/-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_collapsed_by_default
Reviewer Review Type Date Requested Status
Gerry Boland Pending
Review via email: mp+71653@code.launchpad.net

Description of the change

[dash] Collapse categories by default.

To post a comment you must log in.

Unmerged revisions

653. By Florian Boucault

[dash] Collapse categories by default.

652. By Gerry Boland

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

651. By Florian Boucault

Readded dependency on libdee as a workaround until the proper fix is made in UnityCore.

650. By Florian Boucault

Removed mistakenly introduced dependency on libdee.

649. By Didier Roche-Tolomelli

releasing version 4.0.0-0ubuntu1

648. By Didier Roche-Tolomelli

* New upstream release:
  - [launcher] Impossible to keep KDE Apps in Launcher (LP: #741129)
  - [dash] Background should be blurred (LP: #823326)
  - No 'safely remove' option is present in the unity menu when a usb disk
    is inserted (LP: #660010)
  - Quicklist item "Keep In Launcher" should be "Keep in launcher" as design
    (LP: #795422)
  - [launcher] ESC doesn't dismiss launcher when activated with Alt+F1
    (LP: #812792)
  - [dash] Background wallpaper shifted when using a non compositing window
    manager (LP: #823295)
  - [launcher] Bottom gradient appears too early (LP: #823877)
  - mute/unmute sound when user clicks on sound applet using scroll button
    or middle mouse button (LP: #609860)
  - Secondary activate (i.e. middle click) support for indicators advanced
    usage (LP: #812933)
  - Unused GConfItemQmlWrapper dep found (LP: #821880)

647. By Didier Roche-Tolomelli

recommends lenses and not places anymore. Adding music lens

646. By Didier Roche-Tolomelli

* debian/control:
  - bump libunity-core-4.0-dev, libnux-1.0-dev

645. By Florian Boucault

[dash] Introduce bindings of shared backend for the dash and make use of them in the user interface.

Only search results have been integrated. The filters have been deactivated for now.
Also broken is the drag and drop from the dash to the launcher because lenses return garbled URIs.
All references to Place and PlaceEntry have been replaced by Lens.

644. By Aurélien Gâteau

[panel][launcher] Turn the HomeButtonApplet into a launcher item.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2011-08-09 08:05:28 +0000
+++ .bzrignore 2011-08-16 09:38:07 +0000
@@ -17,6 +17,8 @@
17panel/app/unity-2d-panel17panel/app/unity-2d-panel
18panel/applets/indicator-config.h18panel/applets/indicator-config.h
19panel/applets/registraradaptor.*19panel/applets/registraradaptor.*
20panel/lib/libuqpanel.so*
21panel/tests/Testing
20panel/tests/homebuttonapplettest22panel/tests/homebuttonapplettest
2123
22libunity-2d-private/src/libunity-2d-private.so.*24libunity-2d-private/src/libunity-2d-private.so.*
2325
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-07-27 09:42:32 +0000
+++ CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -25,10 +25,13 @@
25find_package(X11 REQUIRED)25find_package(X11 REQUIRED)
26find_package(Gettext REQUIRED)26find_package(Gettext REQUIRED)
27pkg_check_modules(GLIB REQUIRED glib-2.0)27pkg_check_modules(GLIB REQUIRED glib-2.0)
28pkg_check_modules(GDK REQUIRED gdk-2.0)28pkg_check_modules(GDK REQUIRED gdk-3.0)
29pkg_check_modules(GTK REQUIRED gtk+-2.0)29pkg_check_modules(GTK REQUIRED gtk+-3.0)
30pkg_check_modules(GIO REQUIRED gio-2.0)30pkg_check_modules(GIO REQUIRED gio-2.0)
31pkg_check_modules(WNCK REQUIRED libwnck-1.0)31pkg_check_modules(WNCK REQUIRED libwnck-3.0)
32pkg_check_modules(QTGCONF REQUIRED libqtgconf)
33pkg_check_modules(NUXCORE REQUIRED nux-core-1.0)
34pkg_check_modules(PANGO REQUIRED pango)
3235
3336
34# GSettings schemas37# GSettings schemas
3538
=== modified file 'data/unity-2d.convert'
--- data/unity-2d.convert 2011-07-25 11:56:59 +0000
+++ data/unity-2d.convert 2011-08-16 09:38:07 +0000
@@ -3,5 +3,3 @@
3hide-mode = /desktop/unity-2d/launcher/hide_mode3hide-mode = /desktop/unity-2d/launcher/hide_mode
4use-strut = /desktop/unity-2d/launcher/use_strut4use-strut = /desktop/unity-2d/launcher/use_strut
55
6[com.canonical.Unity.Launcher]
7favorites = /desktop/unity-2d/launcher/favorites
86
=== renamed file 'debian/20_unity-2d-gconf-default' => 'debian/20_ubuntu-2d-gconf-default'
--- debian/20_unity-2d-gconf-default 2011-07-25 11:56:59 +0000
+++ debian/20_ubuntu-2d-gconf-default 2011-08-16 09:38:07 +0000
@@ -1,13 +1,5 @@
1/apps/gnome-power-manager/lock/use_screensaver_settings true
2/apps/gnome-power-manager/general/use_time_for_policy false
3/desktop/gnome/applications/window_manager/default /usr/bin/metacity
4/desktop/gnome/applications/window_manager/current /usr/bin/metacity
5/apps/metacity/general/show_maximized_titlebars false1/apps/metacity/general/show_maximized_titlebars false
6/apps/metacity/general/auto_maximize_windows true2/apps/metacity/general/auto_maximize_windows true
7/apps/metacity/general/capture_before_unmap true3/apps/metacity/general/capture_before_unmap true
8/apps/metacity/general/compositing_manager true4/apps/metacity/general/compositing_manager true
9/apps/metacity/general/compositor_effects false5/apps/metacity/general/compositor_effects false
10/apps/metacity/general/theme Ambiance
11/desktop/gnome/interface/gtk_theme Ambiance
12/desktop/gnome/interface/icon_theme ubuntu-mono-dark
13/desktop/gnome/peripherals/mouse/cursor_theme DMZ-White
146
=== renamed file 'debian/20_unity-2d-gconf-mandatory' => 'debian/20_ubuntu-2d-gconf-mandatory'
--- debian/20_unity-2d-gconf-mandatory 2011-06-15 13:05:38 +0000
+++ debian/20_ubuntu-2d-gconf-mandatory 2011-08-16 09:38:07 +0000
@@ -1,3 +1,2 @@
1/apps/nautilus/preferences/exit_with_last_window false
2/apps/metacity/global_keybindings/panel_main_menu disabled1/apps/metacity/global_keybindings/panel_main_menu disabled
3/apps/metacity/global_keybindings/panel_run_dialog disabled2/apps/metacity/global_keybindings/panel_run_dialog disabled
43
=== modified file 'debian/changelog'
--- debian/changelog 2011-07-29 14:05:54 +0000
+++ debian/changelog 2011-08-16 09:38:07 +0000
@@ -1,20 +1,58 @@
1unity-2d (3.8.14-0ubuntu1) UNRELEASED; urgency=low1unity-2d (4.0.0-0ubuntu1) oneiric; urgency=low
22
3 * 3 * New upstream release:
44 - [launcher] Impossible to keep KDE Apps in Launcher (LP: #741129)
5 -- Florian Boucault <florian.boucault@canonical.com> Fri, 29 Jul 2011 16:05:25 +02005 - [dash] Background should be blurred (LP: #823326)
66 - No 'safely remove' option is present in the unity menu when a usb disk
7unity-2d (3.8.12-0ubuntu2) natty; urgency=low7 is inserted (LP: #660010)
8 - Quicklist item "Keep In Launcher" should be "Keep in launcher" as design
9 (LP: #795422)
10 - [launcher] ESC doesn't dismiss launcher when activated with Alt+F1
11 (LP: #812792)
12 - [dash] Background wallpaper shifted when using a non compositing window
13 manager (LP: #823295)
14 - [launcher] Bottom gradient appears too early (LP: #823877)
15 - mute/unmute sound when user clicks on sound applet using scroll button
16 or middle mouse button (LP: #609860)
17 - Secondary activate (i.e. middle click) support for indicators advanced
18 usage (LP: #812933)
19 - Unused GConfItemQmlWrapper dep found (LP: #821880)
20 * debian/control:
21 - bump libunity-core-4.0-dev, libnux-1.0-dev
22 - recommends lenses and not places anymore. Adding music lens
23
24 -- Didier Roche <didrocks@ubuntu.com> Thu, 11 Aug 2011 21:22:18 +0200
25
26unity-2d (3.8.14.1-0ubuntu1) oneiric; urgency=low
27
28 * Few upstream fixes:
29 - unity-2d-places crashed with SIGSEGV in
30 QDeclarativePropertyPrivate::initProperty() (LP: #817896)
31 - update resets unity launcher favorites (LP: #817954)
32
33 -- Didier Roche <didrocks@ubuntu.com> Tue, 02 Aug 2011 16:08:27 +0200
34
35unity-2d (3.8.14-0ubuntu1) oneiric; urgency=low
36
37 * New upstream release:
38 - [launcher] Need to press Alt+F1 twice to show launcher (LP: #812787)
39 * debian/control:
40 - build on latest libunity-core-4.0-dev and latest libnux-1.0-dev
41
42 -- Didier Roche <didrocks@ubuntu.com> Mon, 01 Aug 2011 19:53:40 +0200
43
44unity-2d (3.8.12-0ubuntu2) oneiric; urgency=low
845
9 * debian/control:46 * debian/control:
10 - enforcing latest libunity-private0 to be installed for each local47 - enforcing latest libunity-private0 to be installed for each local
11 consumer48 consumer
49 - don't recommends indicator-me, it's deprecated
12 * debian/libunity-2d-private0.lintian-overrides:50 * debian/libunity-2d-private0.lintian-overrides:
13 - remove a qml-related exported symbol warning wrongly detected51 - remove a qml-related exported symbol warning wrongly detected
1452
15 -- Didier Roche <didrocks@ubuntu.com> Fri, 29 Jul 2011 08:01:51 +020053 -- Didier Roche <didrocks@ubuntu.com> Fri, 29 Jul 2011 15:19:11 +0200
1654
17unity-2d (3.8.12-0ubuntu1) natty; urgency=low55unity-2d (3.8.12-0ubuntu1) oneiric; urgency=low
1856
19 [ Florian Boucault ]57 [ Florian Boucault ]
20 * Upstreamed patch 01_build_with_new_indicator.patch58 * Upstreamed patch 01_build_with_new_indicator.patch
@@ -32,6 +70,7 @@
32 - remove default value for /desktop/unity-2d/launcher/favorites70 - remove default value for /desktop/unity-2d/launcher/favorites
33 * debian/control:71 * debian/control:
34 - add dependency on libdconf-qt-dev72 - add dependency on libdconf-qt-dev
73 - add dependency on libnux-1.0-dev
3574
36 [ Didier Roche ]75 [ Didier Roche ]
37 * New upstream release:76 * New upstream release:
@@ -73,13 +112,27 @@
73 * Fix typo in trigger (debian/unity-2d.triggers): (LP: #807358)112 * Fix typo in trigger (debian/unity-2d.triggers): (LP: #807358)
74 * Install the apport hook in the right directory so that it's not launched113 * Install the apport hook in the right directory so that it's not launched
75 unconditionally (LP: #712343)114 unconditionally (LP: #712343)
115 * debian/control:
116 - dep on latest libqtdee-dev
117 - dep now on gtk3 indicator version
118 - dep on versionned libnux-1.0-dev
119 - dep on versionned libunity-core-4.0-dev
76 * debian/control, debian/rules, debian/libunity-2d-private-dev:120 * debian/control, debian/rules, debian/libunity-2d-private-dev:
77 - add new -dev project (LP: #814709)121 - add new -dev project (LP: #814709)
78 - add an upstream pc file122 - add an upstream pc file
79123
80 -- Florian Boucault <florian.boucault@canonical.com> Thu, 28 Jul 2011 12:05:05 +0200124 -- Didier Roche <didrocks@ubuntu.com> Thu, 28 Jul 2011 12:05:38 +0200
81125
82unity-2d (3.8.10-0ubuntu1) natty; urgency=low126unity-2d (3.8.10-0ubuntu2) oneiric; urgency=low
127
128 * debian/control:
129 - rebuild with new indicator 0.4
130 * 01_build_with_new_indicator.patch:
131 - patch to build with the new indicator 0.4 stack
132
133 -- Didier Roche <didrocks@ubuntu.com> Sun, 10 Jul 2011 23:48:01 +0200
134
135unity-2d (3.8.10-0ubuntu1) oneiric; urgency=low
83136
84 [ Florian Boucault ]137 [ Florian Boucault ]
85 * debian/unity-2d-launcher.install:138 * debian/unity-2d-launcher.install:
@@ -102,10 +155,17 @@
102 - Missing a GConf schema file for the /desktop/unity-2d/… keys155 - Missing a GConf schema file for the /desktop/unity-2d/… keys
103 (LP: #750303)156 (LP: #750303)
104 - [dash] home screen search hint should be 'Search' (LP: #797825)157 - [dash] home screen search hint should be 'Search' (LP: #797825)
105158 * debian/unity-2d.gconf-defaults,
106 -- Florian Boucault <florian.boucault@canonical.com> Wed, 13 Jul 2011 11:59:29 +0200159 debian/20_ubuntu-2d-gconf-default:
107160 - transition some gconf keys from session-wide to system-wide
108unity-2d (3.8.8-0ubuntu1) natty; urgency=low161 (LP: #797672, #797676)
162 * debian/control:
163 - ensure we are still using gtk2 indicator for alpha2 (LP: #804938)
164 - bump standards-version
165
166 -- Didier Roche <didrocks@ubuntu.com> Mon, 04 Jul 2011 11:05:54 +0200
167
168unity-2d (3.8.8-0ubuntu1) oneiric; urgency=low
109169
110 [ Didier Roche ]170 [ Didier Roche ]
111 * new upstream release:171 * new upstream release:
@@ -152,7 +212,21 @@
152212
153 -- Didier Roche <didrocks@ubuntu.com> Tue, 14 Jun 2011 16:14:18 +0200213 -- Didier Roche <didrocks@ubuntu.com> Tue, 14 Jun 2011 16:14:18 +0200
154214
155unity-2d (3.8.6-0ubuntu1) natty; urgency=low215unity-2d (3.8.6-0ubuntu3~ppa1) oneiric; urgency=low
216
217 * Rebuild with new gcc
218
219 -- Didier Roche <didrocks@ubuntu.com> Tue, 07 Jun 2011 15:00:32 +0200
220
221unity-2d (3.8.6-0ubuntu2) oneiric; urgency=low
222
223 * debian/unity-2d.postinst, debian/unity-2d.postrm:
224 - remove the magic to set unity-2d in oneiric as the default session in gdm
225 as it's now installed on the ubuntu CD.
226
227 -- Didier Roche <didrocks@ubuntu.com> Wed, 01 Jun 2011 09:42:21 +0200
228
229unity-2d (3.8.6-0ubuntu1) oneiric; urgency=low
156230
157 * New upstream release:231 * New upstream release:
158 - [launcher] Support static shortcuts in the quicklists. (LP: #669923)232 - [launcher] Support static shortcuts in the quicklists. (LP: #669923)
@@ -196,6 +270,18 @@
196 * debian/libunity-2d-private0.post*270 * debian/libunity-2d-private0.post*
197 - removed: ldconfig is generated directly by dh_makeshlibs as we don't pass271 - removed: ldconfig is generated directly by dh_makeshlibs as we don't pass
198 -n anymore272 -n anymore
273 * don't install unity-2d session as it's in gnome-session now
274 * debian/unity-2d.install
275 debian/20_ubuntu-2d-gconf-default
276 debian/20_ubuntu-2d-gconf-mandatory
277 debian/gconf/ubuntu-2d.default.path
278 debian/gconf/ubuntu-2d.mandatory.path:
279 - remove uneeded defaults and mandatory
280 - remove some deprecated keys
281 - the session is now called ubuntu-2d and not unity-2d anymore
282 * debian/unity-2d.preinst, debian/unity-2d.postinst
283 debian/unity-2d.postrm:
284 - take into account the natty -> oneiric migration with session name change
199285
200 -- Didier Roche <didrocks@ubuntu.com> Wed, 25 May 2011 12:19:25 +0200286 -- Didier Roche <didrocks@ubuntu.com> Wed, 25 May 2011 12:19:25 +0200
201287
202288
=== modified file 'debian/control'
--- debian/control 2011-07-29 11:55:03 +0000
+++ debian/control 2011-08-16 09:38:07 +0000
@@ -10,19 +10,22 @@
10 libqt4-dev,10 libqt4-dev,
11 libqt4-opengl-dev,11 libqt4-opengl-dev,
12 libglib2.0-dev,12 libglib2.0-dev,
13 libwnck-dev,13 libwnck-3-dev,
14 libpango1.0-dev,
14 libqtgconf-dev,15 libqtgconf-dev,
15 libdconf-qt-dev,16 libdconf-qt-dev,
16 libqtbamf-dev,17 libqtbamf-dev,
17 libqtdee-dev,18 libqtdee-dev (>= 0.2.3),
18 libdbusmenu-qt-dev,19 libdbusmenu-qt-dev,
19 libx11-dev,20 libx11-dev,
20 libindicator-dev,21 libindicator3-dev,
21 libgtk2.0-dev,22 libgtk-3-dev,
22 libutouch-geis-dev,23 libutouch-geis-dev,
23 libstartup-notification0-dev24 libstartup-notification0-dev,
24Standards-Version: 3.9.125 libunity-core-4.0-dev (>= 4.8.0),
25Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/unity-2d/trunk26 libnux-1.0-dev (>= 1.2.0),
27Standards-Version: 3.9.2
28Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/unity-2d/oneiric
2629
27Package: unity-2d30Package: unity-2d
28Architecture: all31Architecture: all
@@ -56,9 +59,10 @@
56Depends: ${shlibs:Depends},59Depends: ${shlibs:Depends},
57 ${misc:Depends},60 ${misc:Depends},
58 libunity-2d-private0 (= ${binary:Version}),61 libunity-2d-private0 (= ${binary:Version}),
59 libgtk2.0-dev,62 libgtk-3-dev,
60 libwnck-dev,63 libwnck-3-dev,
61 libglib2.0-dev,64 libglib2.0-dev,
65 libpango1.0-dev,
62Description: Unity 2D shared library - development files66Description: Unity 2D shared library - development files
63 This library is used to host common code used by several Unity 2D components67 This library is used to host common code used by several Unity 2D components
64 It is only used internally, there is no use case for it outside of the unity-2d68 It is only used internally, there is no use case for it outside of the unity-2d
@@ -73,8 +77,9 @@
73 unity-asset-pool,77 unity-asset-pool,
74 libunity-2d-private0 (= ${binary:Version}),78 libunity-2d-private0 (= ${binary:Version}),
75 libqt4-svg,79 libqt4-svg,
76Recommends: unity-place-files,80Recommends: unity-lens-files,
77 unity-place-applications81 unity-lens-applications,
82 unity-lens-music,
78Description: Unity 2D Launcher83Description: Unity 2D Launcher
79 The Unity 2D launcher displays a list of running applications as well as a84 The Unity 2D launcher displays a list of running applications as well as a
80 list of favorite applications in a panel at the left of the screen.85 list of favorite applications in a panel at the left of the screen.
@@ -90,7 +95,6 @@
90Recommends: indicator-application,95Recommends: indicator-application,
91 indicator-appmenu,96 indicator-appmenu,
92 indicator-datetime,97 indicator-datetime,
93 indicator-me,
94 indicator-messages,98 indicator-messages,
95 indicator-session,99 indicator-session,
96 indicator-sound,100 indicator-sound,
97101
=== renamed file 'debian/gconf/unity-2d.default.path' => 'debian/gconf/ubuntu-2d.default.path'
--- debian/gconf/unity-2d.default.path 2011-06-15 13:05:38 +0000
+++ debian/gconf/ubuntu-2d.default.path 2011-08-16 09:38:07 +0000
@@ -1,3 +1,3 @@
1# Additional mandatory path for unity-2d experience1# Additional mandatory path for ubuntu-2d experience
2xml:readonly:/var/lib/gconf/unity-2d.default2xml:readonly:/var/lib/gconf/ubuntu-2d.default
33
44
=== renamed file 'debian/gconf/unity-2d.mandatory.path' => 'debian/gconf/ubuntu-2d.mandatory.path'
--- debian/gconf/unity-2d.mandatory.path 2011-06-15 13:05:38 +0000
+++ debian/gconf/ubuntu-2d.mandatory.path 2011-08-16 09:38:07 +0000
@@ -1,3 +1,3 @@
1# Additional mandatory path for unity-2d experience1# Additional mandatory path for ubuntu-2d experience
2xml:readonly:/var/lib/gconf/unity-2d.mandatory2xml:readonly:/var/lib/gconf/ubuntu-2d.mandatory
33
44
=== modified file 'debian/unity-2d-panel.install'
--- debian/unity-2d-panel.install 2011-01-14 21:41:39 +0000
+++ debian/unity-2d-panel.install 2011-08-16 09:38:07 +0000
@@ -1,4 +1,2 @@
1usr/bin/unity-2d-panel1usr/bin/unity-2d-panel
2usr/share/applications/unity-2d-panel.desktop2usr/share/applications/unity-2d-panel.desktop
3usr/share/unity-2d/panel/artwork/background.png
4usr/share/unity-2d/panel/artwork/divider.png
53
=== added file 'debian/unity-2d.gconf-defaults'
--- debian/unity-2d.gconf-defaults 1970-01-01 00:00:00 +0000
+++ debian/unity-2d.gconf-defaults 2011-08-16 09:38:07 +0000
@@ -0,0 +1,4 @@
1/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]
2/desktop/unity-2d/launcher/hide_mode 2
3/desktop/unity-2d/launcher/use_strut false
4/desktop/unity-2d/launcher/super_key_enable true
05
=== modified file 'debian/unity-2d.install'
--- debian/unity-2d.install 2011-07-22 14:44:57 +0000
+++ debian/unity-2d.install 2011-08-16 09:38:07 +0000
@@ -1,9 +1,7 @@
1debian/unity-2d.py /usr/share/apport/package-hooks1debian/unity-2d.py /usr/share/apport/package-hooks
2debian/gconf/* /usr/share/gconf2debian/gconf/* /usr/share/gconf
3session/unity-2d.desktop /usr/share/xsessions3debian/20_ubuntu-2d-gconf-mandatory /usr/share/gconf/ubuntu-2d/mandatory
4session/2d-ubuntu.session /usr/share/gnome-session/sessions4debian/20_ubuntu-2d-gconf-default /usr/share/gconf/ubuntu-2d/default
5debian/20_unity-2d-gconf-mandatory /usr/share/gconf/unity-2d/mandatory
6debian/20_unity-2d-gconf-default /usr/share/gconf/unity-2d/default
7usr/share/locale/*/LC_MESSAGES/unity-2d.mo5usr/share/locale/*/LC_MESSAGES/unity-2d.mo
8usr/share/glib-2.0/schemas/com.canonical.Unity2d.gschema.xml6usr/share/glib-2.0/schemas/com.canonical.Unity2d.gschema.xml
9usr/share/GConf/gsettings7usr/share/GConf/gsettings
108
=== modified file 'debian/unity-2d.postinst'
--- debian/unity-2d.postinst 2011-06-15 13:05:38 +0000
+++ debian/unity-2d.postinst 2011-08-16 09:38:07 +0000
@@ -9,24 +9,21 @@
99
10case "$1" in10case "$1" in
11 configure|upgrade)11 configure|upgrade)
12 if [ -x /usr/lib/gdm/gdm-set-default-session ] ; then
13 /usr/lib/gdm/gdm-set-default-session --keep-old unity-2d || true
14 fi
15 if which update-gconf-defaults >/dev/null 2>&1 ; then12 if which update-gconf-defaults >/dev/null 2>&1 ; then
16 mkdir -p /var/lib/gconf/unity-2d.mandatory13 mkdir -p /var/lib/gconf/ubuntu-2d.mandatory
17 mkdir -p /var/lib/gconf/unity-2d.default14 mkdir -p /var/lib/gconf/ubuntu-2d.default
18 fi15 fi
19 ;;16 ;;
20 triggered)17 triggered)
21 for trigger in $2; do18 for trigger in $2; do
22 case $trigger in19 case $trigger in
23 /usr/share/gconf/unity-2d/mandatory)20 /usr/share/gconf/ubuntu-2d/mandatory)
24 update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \21 update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
25 --destination /var/lib/gconf/unity-2d.mandatory --no-signal22 --destination /var/lib/gconf/ubuntu-2d.mandatory --no-signal
26 ;;23 ;;
27 /usr/share/gconf/unity-2d/default)24 /usr/share/gconf/ubuntu-2d/default)
28 update-gconf-defaults --source /usr/share/gconf/unity-2d/default \25 update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
29 --destination /var/lib/gconf/unity-2d.default --no-signal26 --destination /var/lib/gconf/ubuntu-2d.default --no-signal
30 ;;27 ;;
31 esac28 esac
32 done29 done
@@ -39,9 +36,9 @@
3936
40# Upon installation/upgrade, regenerate all databases, because in this case 37# Upon installation/upgrade, regenerate all databases, because in this case
41# there will be no trigger run38# there will be no trigger run
42update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \39update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
43 --destination /var/lib/gconf/unity-2d.mandatory --no-signal40 --destination /var/lib/gconf/ubuntu-2d.mandatory --no-signal
44update-gconf-defaults --source /usr/share/gconf/unity-2d/default \41update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
45 --destination /var/lib/gconf/unity-2d.default --no-signal42 --destination /var/lib/gconf/ubuntu-2d.default --no-signal
46signal_daemons43signal_daemons
4744
4845
=== modified file 'debian/unity-2d.postrm'
--- debian/unity-2d.postrm 2011-06-15 13:05:38 +0000
+++ debian/unity-2d.postrm 2011-08-16 09:38:07 +0000
@@ -3,20 +3,17 @@
33
4case "$1" in4case "$1" in
5 remove|purge)5 remove|purge)
6 if which update-gconf-defaults >/dev/null 2>&1 && [ -d /usr/share/gconf/mandatory/unity-2d ]; then6 if which update-gconf-defaults >/dev/null 2>&1 && [ -d /usr/share/gconf/mandatory/ubuntu-2d ]; then
7 update-gconf-defaults --source /usr/share/gconf/unity-2d/mandatory \7 update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/mandatory \
8 --destination /var/lib/gconf/unity-2d.mandatory8 --destination /var/lib/gconf/ubuntu-2d.mandatory
9 update-gconf-defaults --source /usr/share/gconf/unity-2d/default \9 update-gconf-defaults --source /usr/share/gconf/ubuntu-2d/default \
10 --destination /var/lib/gconf/unity-2d.default10 --destination /var/lib/gconf/ubuntu-2d.default
11 fi11 fi
12 if [ -d /var/lib/gconf/unity-2d.mandatory ]; then12 if [ -d /var/lib/gconf/ubuntu-2d.mandatory ]; then
13 rm -rf /var/lib/gconf/unity-2d.mandatory13 rm -rf /var/lib/gconf/ubuntu-2d.mandatory
14 fi14 fi
15 if [ -d /var/lib/gconf/unity-2d.default ]; then15 if [ -d /var/lib/gconf/ubuntu-2d.default ]; then
16 rm -rf /var/lib/gconf/unity-2d.default16 rm -rf /var/lib/gconf/ubuntu-2d.default
17 fi
18 if [ -x /usr/lib/gdm/gdm-set-default-session ] ; then
19 /usr/lib/gdm/gdm-set-default-session --remove unity-2d || true
20 fi17 fi
21 ;;18 ;;
22esac19esac
2320
=== added file 'debian/unity-2d.preinst'
--- debian/unity-2d.preinst 1970-01-01 00:00:00 +0000
+++ debian/unity-2d.preinst 2011-08-16 09:38:07 +0000
@@ -0,0 +1,16 @@
1#!/bin/sh
2set -e
3
4case "$1" in
5 install|upgrade)
6 if dpkg --compare-versions "$2" le "3.8.6-0ubuntu1"; then
7 if [ -d /var/lib/gconf/unity-2d.mandatory ]; then
8 mv /var/lib/gconf/unity-2d.mandatory /var/lib/gconf/ubuntu-2d.mandatory || true
9 mv /var/lib/gconf/unity-2d.default /var/lib/gconf/ubuntu-2d.default || true
10 fi
11 fi
12 ;;
13esac
14
15#DEBHELPER#
16
017
=== modified file 'launcher/Launcher.qml'
--- launcher/Launcher.qml 2011-08-01 11:58:35 +0000
+++ launcher/Launcher.qml 2011-08-16 09:38:07 +0000
@@ -22,7 +22,10 @@
22LauncherDropItem {22LauncherDropItem {
23 id: launcher23 id: launcher
2424
25 Accessible.name: "root"
26
25 GnomeBackground {27 GnomeBackground {
28 Accessible.name: "background"
26 anchors.fill: parent29 anchors.fill: parent
27 overlay_color: "black"30 overlay_color: "black"
28 overlay_alpha: 0.6631 overlay_alpha: 0.66
@@ -30,6 +33,7 @@
30 }33 }
3134
32 Rectangle {35 Rectangle {
36 Accessible.name: "background"
33 anchors.fill: parent37 anchors.fill: parent
34 color: "black"38 color: "black"
35 opacity: 0.6639 opacity: 0.66
@@ -37,6 +41,7 @@
37 }41 }
38 42
39 Image {43 Image {
44 Accessible.name: "border"
40 id: border45 id: border
4146
42 width: 147 width: 1
@@ -50,12 +55,16 @@
50 onWebpageUrlDropped: applications.insertWebFavorite(url)55 onWebpageUrlDropped: applications.insertWebFavorite(url)
5156
52 FocusScope {57 FocusScope {
58 Accessible.name: "content"
59
53 focus: true60 focus: true
54 anchors.fill: parent61 anchors.fill: parent
55 z: 1 /* ensure the lists are always strictly on top of the background */62 z: 1 /* ensure the lists are always strictly on top of the background */
5663
57 LauncherList {64 LauncherList {
58 id: main65 id: main
66 Accessible.name: "main"
67
59 anchors.top: parent.top68 anchors.top: parent.top
60 anchors.bottom: shelf.top69 anchors.bottom: shelf.top
61 anchors.bottomMargin: itemPadding70 anchors.bottomMargin: itemPadding
@@ -75,6 +84,8 @@
7584
76 LauncherList {85 LauncherList {
77 id: shelf86 id: shelf
87 Accessible.name: "shelf"
88
78 anchors.bottom: parent.bottom89 anchors.bottom: parent.bottom
79 anchors.bottomMargin: main.anchors.bottomMargin90 anchors.bottomMargin: main.anchors.bottomMargin
80 height: (tileSize + itemPadding) * count91 height: (tileSize + itemPadding) * count
@@ -92,23 +103,14 @@
92 }103 }
93 }104 }
94105
95 SortFilterProxyModel {106 BfbModel {
96 id: visiblePlaces107 id: bfbModel
97 model: places
98 dynamicSortFilter: true
99
100 filterRole: Place.RoleShowEntry
101 filterRegExp: RegExp("^true$")
102 }108 }
103109
104 LauncherApplicationsList {110 LauncherApplicationsList {
105 id: applications111 id: applications
106 }112 }
107113
108 LauncherPlacesList {
109 id: places
110 }
111
112 LauncherDevicesList {114 LauncherDevicesList {
113 id: devices115 id: devices
114 }116 }
@@ -129,9 +131,9 @@
129 }131 }
130132
131 Component.onCompleted: {133 Component.onCompleted: {
134 items.appendModel(bfbModel);
132 items.appendModel(applications);135 items.appendModel(applications);
133 items.appendModel(workspaces);136 items.appendModel(workspaces);
134 items.appendModel(visiblePlaces);
135 items.appendModel(devices);137 items.appendModel(devices);
136 shelfItems.appendModel(trashes);138 shelfItems.appendModel(trashes);
137 }139 }
138140
=== modified file 'launcher/LauncherItem.qml'
--- launcher/LauncherItem.qml 2011-07-14 11:17:30 +0000
+++ launcher/LauncherItem.qml 2011-08-16 09:38:07 +0000
@@ -48,6 +48,8 @@
48DropItem {48DropItem {
49 id: item49 id: item
5050
51 Accessible.role: Accessible.PushButton
52
51 anchors.horizontalCenter: parent.horizontalCenter53 anchors.horizontalCenter: parent.horizontalCenter
5254
53 property int padding55 property int padding
5456
=== modified file 'launcher/LauncherList.qml'
--- launcher/LauncherList.qml 2011-08-10 11:58:31 +0000
+++ launcher/LauncherList.qml 2011-08-16 09:38:07 +0000
@@ -77,6 +77,17 @@
77 delegate: LauncherItem {77 delegate: LauncherItem {
78 id: launcherItem78 id: launcherItem
7979
80 function accessibleDescription() {
81 if (running) {
82 var windows = u2d.tr("%1 window opened", "%1 windows opened", item.windowCount).arg(item.windowCount)
83 return "%1 %2".arg(item.name).arg(windows)
84 } else {
85 return "%1 %2".arg(item.name).arg(u2d.tr("not running"))
86 }
87 }
88
89 Accessible.name: accessibleDescription()
90
80 width: list.width91 width: list.width
81 tileSize: list.tileSize92 tileSize: list.tileSize
82 padding: list.itemPadding93 padding: list.itemPadding
8394
=== modified file 'launcher/app/launcher.cpp'
--- launcher/app/launcher.cpp 2011-08-09 13:33:24 +0000
+++ launcher/app/launcher.cpp 2011-08-16 09:38:07 +0000
@@ -78,6 +78,7 @@
78{78{
79 Unity2dApplication::earlySetup(argc, argv);79 Unity2dApplication::earlySetup(argc, argv);
80 Unity2dApplication application(argc, argv);80 Unity2dApplication application(argc, argv);
81 application.setApplicationName("Unity 2D Launcher");
81 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());82 QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments());
8283
83 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop");84 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop");
@@ -91,6 +92,7 @@
91 Unity2dPanel panel(true);92 Unity2dPanel panel(true);
92 panel.setEdge(Unity2dPanel::LeftEdge);93 panel.setEdge(Unity2dPanel::LeftEdge);
93 panel.setFixedWidth(LauncherClient::MaximumWidth);94 panel.setFixedWidth(LauncherClient::MaximumWidth);
95 panel.setAccessibleName("Launcher");
9496
95 VisibilityController* visibilityController = new VisibilityController(&panel);97 VisibilityController* visibilityController = new VisibilityController(&panel);
9698
9799
=== modified file 'launcher/app/launcherview.cpp'
--- launcher/app/launcherview.cpp 2011-08-01 11:58:35 +0000
+++ launcher/app/launcherview.cpp 2011-08-16 09:38:07 +0000
@@ -56,8 +56,7 @@
56static const char* DASH_DBUS_PROPERTY_ACTIVE = "active";56static const char* DASH_DBUS_PROPERTY_ACTIVE = "active";
57static const char* DASH_DBUS_METHOD_ACTIVATE_HOME = "activateHome";57static const char* DASH_DBUS_METHOD_ACTIVATE_HOME = "activateHome";
58static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown";58static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown";
59static const char* APPLICATIONS_PLACE = "/usr/share/unity/places/applications.place";59static const char* COMMANDS_LENS_ID = "commands.lens";
60static const char* COMMANDS_PLACE_ENTRY = "Runner";
61static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";60static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
6261
63LauncherView::LauncherView(QWidget* parent) :62LauncherView::LauncherView(QWidget* parent) :
@@ -79,9 +78,9 @@
79 Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);78 Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);
80 connect(altF1, SIGNAL(pressed()), SLOT(forceActivateWindow()));79 connect(altF1, SIGNAL(pressed()), SLOT(forceActivateWindow()));
8180
82 /* Alt+F2 shows the dash with the commands place entry activated. */81 /* Alt+F2 shows the dash with the commands lens activated. */
83 Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);82 Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);
84 connect(altF2, SIGNAL(pressed()), SLOT(showCommandsPlace()));83 connect(altF2, SIGNAL(pressed()), SLOT(showCommandsLens()));
8584
86 /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */85 /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */
87 for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {86 for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {
@@ -232,10 +231,9 @@
232}231}
233232
234void233void
235LauncherView::showCommandsPlace()234LauncherView::showCommandsLens()
236{235{
237 QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);236 QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
238 dashInterface.asyncCall("activatePlaceEntry",237 dashInterface.asyncCall("activateLens", COMMANDS_LENS_ID);
239 APPLICATIONS_PLACE, COMMANDS_PLACE_ENTRY, 0);
240}238}
241239
242240
=== modified file 'launcher/app/launcherview.h'
--- launcher/app/launcherview.h 2011-08-01 11:58:35 +0000
+++ launcher/app/launcherview.h 2011-08-16 09:38:07 +0000
@@ -57,7 +57,7 @@
57 void updateSuperKeyMonitoring();57 void updateSuperKeyMonitoring();
58 void updateSuperKeyHoldState();58 void updateSuperKeyHoldState();
59 void toggleDash();59 void toggleDash();
60 void showCommandsPlace();60 void showCommandsLens();
6161
62protected:62protected:
63 void focusInEvent(QFocusEvent* event);63 void focusInEvent(QFocusEvent* event);
6464
=== modified file 'libunity-2d-private/CMakeLists.txt'
--- libunity-2d-private/CMakeLists.txt 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -6,8 +6,10 @@
6pkg_check_modules(QTDEE REQUIRED libqtdee)6pkg_check_modules(QTDEE REQUIRED libqtdee)
7pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)7pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)
8pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)8pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)
9pkg_check_modules(INDICATOR REQUIRED indicator)9pkg_check_modules(INDICATOR REQUIRED indicator3-0.4)
10pkg_check_modules(DCONFQT REQUIRED dconf-qt)10pkg_check_modules(DCONFQT REQUIRED dconf-qt)
11pkg_check_modules(UNITYCORE REQUIRED unity-core-4.0)
12pkg_check_modules(DEE REQUIRED dee-1.0)
1113
12set(libunity-2d-private_SOVERSION 0)14set(libunity-2d-private_SOVERSION 0)
13set(libunity-2d-private_VERSION ${libunity-2d-private_SOVERSION}.0.0)15set(libunity-2d-private_VERSION ${libunity-2d-private_SOVERSION}.0.0)
1416
=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -30,6 +30,9 @@
30 ${INDICATOR_INCLUDE_DIRS}30 ${INDICATOR_INCLUDE_DIRS}
31 ${X11_INCLUDE_DIR}31 ${X11_INCLUDE_DIR}
32 ${DCONFQT_INCLUDE_DIRS}32 ${DCONFQT_INCLUDE_DIRS}
33 ${UNITYCORE_INCLUDE_DIRS}
34 ${NUXCORE_INCLUDE_DIRS}
35 ${DEE_INCLUDE_DIRS}
33 ${libunity-2d-private_SOURCE_DIR}/src36 ${libunity-2d-private_SOURCE_DIR}/src
34 )37 )
3538
3639
=== modified file 'libunity-2d-private/Unity2d/GnomeBackground.qml'
--- libunity-2d-private/Unity2d/GnomeBackground.qml 2011-08-09 13:33:24 +0000
+++ libunity-2d-private/Unity2d/GnomeBackground.qml 2011-08-16 09:38:07 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19import QtQuick 1.019import QtQuick 1.0
20import gconf 1.020import QConf 1.0
21/* Necessary to access the blended image provider and CacheEffect */21/* Necessary to access the blended image provider and CacheEffect */
22import Unity2d 1.022import Unity2d 1.0
2323
@@ -32,19 +32,9 @@
32 property bool cached: true32 property bool cached: true
33 effect: (cached) ? cacheEffect : null33 effect: (cached) ? cacheEffect : null
3434
35 GConfItem {35 QConf {
36 id: primary_color36 id: desktopBackground
37 key: "/desktop/gnome/background/primary_color"37 schema: "org.gnome.desktop.background"
38 }
39
40 GConfItem {
41 id: picture_filename
42 key: "/desktop/gnome/background/picture_filename"
43 }
44
45 GConfItem {
46 id: picture_options
47 key: "/desktop/gnome/background/picture_options"
48 }38 }
4939
50 Rectangle {40 Rectangle {
@@ -55,13 +45,13 @@
55 }45 }
5646
57 anchors.fill: parent47 anchors.fill: parent
58 color: primary_color.value48 color: desktopBackground.primaryColor
59 }49 }
6050
61 Image {51 Image {
62 id: picture52 id: picture
6353
64 visible: picture_filename.value54 visible: desktopBackground.pictureUri
65 source: {55 source: {
66 if (!visible) return ""56 if (!visible) return ""
67 57
@@ -74,8 +64,8 @@
74 https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/29653864 https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/296538
75 http://bugreports.qt.nokia.com/browse/QTBUG-727665 http://bugreports.qt.nokia.com/browse/QTBUG-7276
76 */66 */
77 var filename = picture_filename.value67 var filename = desktopBackground.pictureUri
78 if(filename == "/usr/share/backgrounds/warty-final-ubuntu.png")68 if(filename == "file:///usr/share/backgrounds/warty-final-ubuntu.png")
79 filename = "/usr/share/unity-2d/warty-final-ubuntu.jpg"69 filename = "/usr/share/unity-2d/warty-final-ubuntu.jpg"
8070
81 if(overlay_alpha > 0.0)71 if(overlay_alpha > 0.0)
@@ -99,13 +89,13 @@
99 - "spanned" (NOT IMPLEMENTED)89 - "spanned" (NOT IMPLEMENTED)
100 */90 */
101 fillMode: {91 fillMode: {
102 if(picture_options.value == "wallpaper")92 if(desktopBackground.pictureOptions== "wallpaper")
103 return Image.Tile93 return Image.Tile
104 else if(picture_options.value == "scaled")94 else if(desktopBackground.pictureOptions == "scaled")
105 return Image.PreserveAspectFit95 return Image.PreserveAspectFit
106 else if(picture_options.value == "stretched")96 else if(desktopBackground.pictureOptions == "stretched")
107 return Image.Stretch97 return Image.Stretch
108 else if(picture_options.value == "zoom")98 else if(desktopBackground.pictureOptions == "zoom")
109 return Image.PreserveAspectCrop99 return Image.PreserveAspectCrop
110 else return Image.PreserveAspectFit100 else return Image.PreserveAspectFit
111 }101 }
112102
=== modified file 'libunity-2d-private/Unity2d/plugin.cpp'
--- libunity-2d-private/Unity2d/plugin.cpp 2011-07-26 16:05:51 +0000
+++ libunity-2d-private/Unity2d/plugin.cpp 2011-08-16 09:38:07 +0000
@@ -20,10 +20,6 @@
20/* Required otherwise using wnck_set_client_type breaks linking with error:20/* Required otherwise using wnck_set_client_type breaks linking with error:
21 undefined reference to `wnck_set_client_type(WnckClientType)'21 undefined reference to `wnck_set_client_type(WnckClientType)'
22*/22*/
23extern "C" {
24#include <libwnck/util.h>
25}
26
27#include "plugin.h"23#include "plugin.h"
2824
29#include "launcherapplication.h"25#include "launcherapplication.h"
@@ -60,6 +56,10 @@
60#include "autohidebehavior.h"56#include "autohidebehavior.h"
61#include "intellihidebehavior.h"57#include "intellihidebehavior.h"
62#include "forcevisiblebehavior.h"58#include "forcevisiblebehavior.h"
59#include "bfb.h"
60
61#include "lenses.h"
62#include "lens.h"
6363
64#include <QtDeclarative/qdeclarative.h>64#include <QtDeclarative/qdeclarative.h>
65#include <QDeclarativeEngine>65#include <QDeclarativeEngine>
@@ -105,6 +105,9 @@
105105
106 qmlRegisterType<ListAggregatorModel>(uri, 0, 1, "ListAggregatorModel");106 qmlRegisterType<ListAggregatorModel>(uri, 0, 1, "ListAggregatorModel");
107107
108 qmlRegisterType<BfbModel>(uri, 0, 1, "BfbModel");
109 qmlRegisterType<BfbItem>(uri, 0, 1, "BfbItem");
110
108 qmlRegisterType<LauncherApplicationsList>(uri, 0, 1, "LauncherApplicationsList");111 qmlRegisterType<LauncherApplicationsList>(uri, 0, 1, "LauncherApplicationsList");
109 qmlRegisterType<LauncherApplication>(uri, 0, 1, "LauncherApplication");112 qmlRegisterType<LauncherApplication>(uri, 0, 1, "LauncherApplication");
110113
@@ -130,6 +133,9 @@
130 qmlRegisterType<IconUtilities>(); // Register the type as non creatable133 qmlRegisterType<IconUtilities>(); // Register the type as non creatable
131134
132 qmlRegisterType<GioDefaultApplication>(uri, 0, 1, "GioDefaultApplication");135 qmlRegisterType<GioDefaultApplication>(uri, 0, 1, "GioDefaultApplication");
136
137 qmlRegisterType<Lenses>(uri, 1, 0, "Lenses");
138 qmlRegisterType<Lens>(uri, 1, 0, "Lens");
133}139}
134140
135void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)141void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
136142
=== modified file 'libunity-2d-private/src/CMakeLists.txt'
--- libunity-2d-private/src/CMakeLists.txt 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -2,7 +2,11 @@
22
3# Sources3# Sources
4set(lib${LIB_NAME}_SRCS4set(lib${LIB_NAME}_SRCS
5 bfb.cpp
6 dashclient.cpp
7 debug.cpp
5 gconnector.cpp8 gconnector.cpp
9 gimageutils.cpp
6 gnomesessionclient.cpp10 gnomesessionclient.cpp
7 keyboardmodifiersmonitor.cpp11 keyboardmodifiersmonitor.cpp
8 hotkeymonitor.cpp12 hotkeymonitor.cpp
@@ -53,6 +57,10 @@
53 workspaces.cpp57 workspaces.cpp
54 launcherdropitem.cpp58 launcherdropitem.cpp
55 iconutilities.cpp59 iconutilities.cpp
60 lenses.cpp
61 lens.cpp
62 filter.cpp
63 ratingsfilter.cpp
56 )64 )
5765
58# Build66# Build
@@ -64,6 +72,8 @@
64 ${CMAKE_CURRENT_BINARY_DIR}72 ${CMAKE_CURRENT_BINARY_DIR}
65 ${CMAKE_CURRENT_SOURCE_DIR}73 ${CMAKE_CURRENT_SOURCE_DIR}
66 ${GLIB_INCLUDE_DIRS}74 ${GLIB_INCLUDE_DIRS}
75 ${GTK_INCLUDE_DIRS}
76 ${PANGO_INCLUDE_DIRS}
67 ${WNCK_INCLUDE_DIRS}77 ${WNCK_INCLUDE_DIRS}
68 ${QTBAMF_INCLUDE_DIRS}78 ${QTBAMF_INCLUDE_DIRS}
69 ${QTGCONF_INCLUDE_DIRS}79 ${QTGCONF_INCLUDE_DIRS}
@@ -75,6 +85,9 @@
75 ${INDICATOR_INCLUDE_DIRS}85 ${INDICATOR_INCLUDE_DIRS}
76 ${X11_INCLUDE_DIR}86 ${X11_INCLUDE_DIR}
77 ${DCONFQT_INCLUDE_DIRS}87 ${DCONFQT_INCLUDE_DIRS}
88 ${UNITYCORE_INCLUDE_DIRS}
89 ${NUXCORE_INCLUDE_DIRS}
90 ${DEE_INCLUDE_DIRS}
78 )91 )
7992
80add_library(${LIB_NAME} SHARED ${libunity-2d-private_SRCS})93add_library(${LIB_NAME} SHARED ${libunity-2d-private_SRCS})
@@ -93,6 +106,8 @@
93 ${QT_QTNETWORK_LIBRARIES}106 ${QT_QTNETWORK_LIBRARIES}
94 ${X11_LIBRARIES}107 ${X11_LIBRARIES}
95 ${GLIB_LDFLAGS}108 ${GLIB_LDFLAGS}
109 ${GTK_LDFLAGS}
110 ${PANGO_LDFLAGS}
96 ${WNCK_LDFLAGS}111 ${WNCK_LDFLAGS}
97 ${GDK_LDFLAGS}112 ${GDK_LDFLAGS}
98 ${GIO_LDFLAGS}113 ${GIO_LDFLAGS}
@@ -104,6 +119,9 @@
104 ${STARTUPNOTIFICATION_LDFLAGS}119 ${STARTUPNOTIFICATION_LDFLAGS}
105 ${INDICATOR_LDFLAGS}120 ${INDICATOR_LDFLAGS}
106 ${DCONFQT_LDFLAGS}121 ${DCONFQT_LDFLAGS}
122 ${UNITYCORE_LDFLAGS}
123 ${NUXCORE_LDFLAGS}
124 ${DEE_LDFLAGS}
107 )125 )
108126
109# Install127# Install
110128
=== added file 'libunity-2d-private/src/bfb.cpp'
--- libunity-2d-private/src/bfb.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/bfb.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,119 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Aurélien Gâteau <aurelien.gateau@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "bfb.h"
21
22// libunity-2d
23#include <dashclient.h>
24#include <debug_p.h>
25#include <unity2dtr.h>
26
27// Qt
28
29BfbItem::BfbItem()
30: m_active(false)
31{
32 connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)),
33 SLOT(slotActivePageChanged(const QString&)));
34}
35
36BfbItem::~BfbItem()
37{
38}
39
40bool BfbItem::active() const
41{
42 return m_active;
43}
44
45void BfbItem::slotActivePageChanged(const QString& page)
46{
47 bool active = !page.isEmpty();
48 if (m_active != active) {
49 m_active = active;
50 activeChanged(m_active);
51 }
52}
53
54bool BfbItem::running() const
55{
56 return false;
57}
58
59int BfbItem::windowCount() const
60{
61 return 0;
62}
63
64bool BfbItem::urgent() const
65{
66 return false;
67}
68
69QString BfbItem::name() const
70{
71 return u2dTr("Dash");
72}
73
74QString BfbItem::icon() const
75{
76 return "unity-icon-theme/distributor-logo";
77}
78
79bool BfbItem::launching() const
80{
81 return false;
82}
83
84void BfbItem::activate()
85{
86 DashClient::instance()->setActivePage(m_active ? "" : "home");
87}
88
89void BfbItem::createMenuActions()
90{
91}
92
93////////////////////////////////////////////////////////////
94BfbModel::BfbModel(QObject* parent)
95: QAbstractListModel(parent)
96, m_bfbItem(new BfbItem)
97{
98}
99
100BfbModel::~BfbModel()
101{
102 delete m_bfbItem;
103}
104
105int BfbModel::rowCount(const QModelIndex& /*parent*/) const
106{
107 return 1;
108}
109
110QVariant BfbModel::data(const QModelIndex& index, int /*role*/) const
111{
112 if (!index.isValid()) {
113 return QVariant();
114 }
115
116 return QVariant::fromValue(m_bfbItem);
117}
118
119#include <bfb.moc>
0120
=== added file 'libunity-2d-private/src/bfb.h'
--- libunity-2d-private/src/bfb.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/bfb.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Aurélien Gâteau <aurelien.gateau@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef BFB_H
21#define BFB_H
22
23#include "launcheritem.h"
24
25// Qt
26#include <QAbstractListModel>
27#include <QMetaType>
28
29class BfbItem : public LauncherItem
30{
31 Q_OBJECT
32public:
33 BfbItem();
34 ~BfbItem();
35
36 /* getters */
37 virtual bool active() const;
38 virtual bool running() const;
39 virtual int windowCount() const;
40 virtual bool urgent() const;
41 virtual QString name() const;
42 virtual QString icon() const;
43 virtual bool launching() const;
44
45 /* methods */
46 Q_INVOKABLE virtual void activate();
47 Q_INVOKABLE virtual void createMenuActions();
48
49private Q_SLOTS:
50 void slotActivePageChanged(const QString&);
51
52private:
53 Q_DISABLE_COPY(BfbItem)
54 bool m_active;
55};
56
57Q_DECLARE_METATYPE(BfbItem*)
58
59
60class BfbModel : public QAbstractListModel
61{
62 Q_OBJECT
63public:
64 BfbModel(QObject* parent = 0);
65 ~BfbModel();
66
67 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
68 int rowCount(const QModelIndex& parent = QModelIndex()) const;
69
70private:
71 Q_DISABLE_COPY(BfbModel)
72 BfbItem* m_bfbItem;
73};
74
75#endif // BFB_H
076
=== added file 'libunity-2d-private/src/dashclient.cpp'
--- libunity-2d-private/src/dashclient.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/dashclient.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,155 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21// Self
22#include "dashclient.h"
23
24// Local
25
26// libunity-2d
27#include <debug_p.h>
28
29// Qt
30#include <QApplication>
31#include <QDBusConnection>
32#include <QDBusConnectionInterface>
33#include <QDBusInterface>
34#include <QDBusServiceWatcher>
35
36static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
37static const char* DASH_DBUS_PATH = "/Dash";
38static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
39
40DashClient::DashClient(QObject* parent)
41: QObject(parent)
42, m_dashDbusIface(0)
43, m_dashActive(false)
44{
45 /* Check if the dash is already up and running by asking the bus instead of
46 trying to create an instance of the interface. Creating an instance would
47 cause D-Bus to activate the dash and we don’t want this to happen, the
48 dash should be started on demand only. */
49 QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface();
50 QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(DASH_DBUS_SERVICE);
51 if (reply.isValid() && reply.value()) {
52 connectToDash();
53 } else {
54 /* The dash is not running: monitor its registration on the bus so we
55 can connect to it when it comes up. */
56 QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DASH_DBUS_SERVICE,
57 QDBusConnection::sessionBus(),
58 QDBusServiceWatcher::WatchForRegistration,
59 this);
60 connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash()));
61 }
62}
63
64void DashClient::connectToDash()
65{
66 if (m_dashDbusIface) {
67 return;
68 }
69
70 m_dashDbusIface = new QDBusInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE,
71 QDBusConnection::sessionBus(), this);
72 connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
73 SLOT(slotDashActiveChanged(bool)));
74 connect(m_dashDbusIface, SIGNAL(activeLensChanged(const QString&)),
75 SLOT(slotDashActiveLensChanged(const QString&)));
76
77 QVariant value = m_dashDbusIface->property("active");
78 if (value.isValid()) {
79 m_dashActive = value.toBool();
80 } else {
81 UQ_WARNING << "Fetching Dash.active property failed";
82 }
83 value = m_dashDbusIface->property("activeLens");
84 if (value.isValid()) {
85 m_dashActiveLens = value.toString();
86 } else {
87 UQ_WARNING << "Fetching Dash.activeLens property failed";
88 }
89
90 updateActivePage();
91}
92
93DashClient* DashClient::instance()
94{
95 static DashClient* client = new DashClient(qApp);
96 return client;
97}
98
99void DashClient::slotDashActiveChanged(bool value)
100{
101 if (m_dashActive != value) {
102 m_dashActive = value;
103 updateActivePage();
104 }
105}
106
107void DashClient::slotDashActiveLensChanged(const QString& lens)
108{
109 if (m_dashActiveLens != lens) {
110 m_dashActiveLens = lens;
111 updateActivePage();
112 }
113}
114
115QString DashClient::activePage() const
116{
117 return m_activePage;
118}
119
120void DashClient::setActivePage(const QString& page, const QString& lensId)
121{
122 if (m_activePage == page) {
123 return;
124 }
125 if (page.isEmpty()) {
126 // Use m_dashDbusIface to close the dash, but only if it is running
127 if (m_dashDbusIface) {
128 m_dashDbusIface->setProperty("active", false);
129 }
130 return;
131 }
132 // Use a separate QDBusInterface so that the dash is started if it is not
133 // already running
134 QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
135 if (page == "home") {
136 iface.asyncCall("activateHome");
137 } else {
138 iface.asyncCall("activateLens", lensId);
139 }
140}
141
142void DashClient::updateActivePage()
143{
144 QString activePage;
145 if (m_dashActive) {
146 activePage = m_dashActiveLens.isEmpty() ? "home" : m_dashActiveLens;
147 }
148
149 if (m_activePage != activePage) {
150 m_activePage = activePage;
151 activePageChanged(m_activePage);
152 }
153}
154
155#include "dashclient.moc"
0156
=== added file 'libunity-2d-private/src/dashclient.h'
--- libunity-2d-private/src/dashclient.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/dashclient.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,68 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef DASHCLIENT_H
22#define DASHCLIENT_H
23
24// Local
25
26// Qt
27#include <QObject>
28
29class QDBusInterface;
30
31/**
32 * Monitors the dash and provide a single point of entry to its status
33 */
34class DashClient : public QObject
35{
36 Q_OBJECT
37public:
38 static DashClient* instance();
39
40 /**
41 * Returns the active page. This is either:
42 * - The lens id of the active lens
43 * - "home" if the home is visible
44 * - "" if the dash is not visible
45 */
46 QString activePage() const;
47
48 void setActivePage(const QString& page, const QString& lensId=QString());
49
50Q_SIGNALS:
51 void activePageChanged(const QString&);
52
53private Q_SLOTS:
54 void connectToDash();
55 void slotDashActiveChanged(bool);
56 void slotDashActiveLensChanged(const QString&);
57
58private:
59 DashClient(QObject* parent=0);
60 void updateActivePage();
61
62 QDBusInterface* m_dashDbusIface;
63 bool m_dashActive;
64 QString m_dashActiveLens;
65 QString m_activePage;
66};
67
68#endif /* DASHCLIENT_H */
069
=== added file 'libunity-2d-private/src/debug.cpp'
--- libunity-2d-private/src/debug.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/debug.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,23 @@
1/* This file is part of unity-2d
2 Copyright 2011 Canonical
3 Author: Aurelien Gateau <aurelien.gateau@canonical.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; version 3.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17// Self
18#include <debug_p.h>
19
20QDebug operator<<(QDebug& dbg, const std::string& str)
21{
22 return dbg << QString::fromUtf8(str.c_str());
23}
024
=== modified file 'libunity-2d-private/src/debug_p.h'
--- libunity-2d-private/src/debug_p.h 2011-03-28 14:06:14 +0000
+++ libunity-2d-private/src/debug_p.h 2011-08-16 09:38:07 +0000
@@ -17,8 +17,12 @@
17#ifndef DEBUG_P_H17#ifndef DEBUG_P_H
18#define DEBUG_P_H18#define DEBUG_P_H
1919
20// Qt
20#include <QDebug>21#include <QDebug>
2122
23// STL
24#include <string>
25
22#define _UQ_TRACE(level) (level().nospace() << __PRETTY_FUNCTION__ << ":").space()26#define _UQ_TRACE(level) (level().nospace() << __PRETTY_FUNCTION__ << ":").space()
2327
24// Simple macros to get KDebug like support28// Simple macros to get KDebug like support
@@ -62,5 +66,7 @@
6266
63#define UQ_DEBUG_BLOCK Unity2dDebugBlock __unity2dDebugBlock__(__PRETTY_FUNCTION__)67#define UQ_DEBUG_BLOCK Unity2dDebugBlock __unity2dDebugBlock__(__PRETTY_FUNCTION__)
6468
69// Support for outputing std::string with qDebug
70QDebug operator<<(QDebug& dbg, const std::string& str);
6571
66#endif /* DEBUG_P_H */72#endif /* DEBUG_P_H */
6773
=== added file 'libunity-2d-private/src/filter.cpp'
--- libunity-2d-private/src/filter.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/filter.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,92 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20// Self
21#include "filter.h"
22
23Filter::Filter(QObject *parent) :
24 QObject(parent)
25{
26}
27
28
29QString Filter::id() const
30{
31 return QString::fromStdString(m_unityFilter->id());
32}
33
34QString Filter::name() const
35{
36 return QString::fromStdString(m_unityFilter->name());
37}
38
39QString Filter::iconHint() const
40{
41 return QString::fromStdString(m_unityFilter->icon_hint());
42}
43
44QString Filter::rendererName() const
45{
46 return QString::fromStdString(m_unityFilter->renderer_name());
47}
48
49bool Filter::visible() const
50{
51 return m_unityFilter->visible();
52}
53
54bool Filter::collapsed() const
55{
56 return m_unityFilter->collapsed();
57}
58
59bool Filter::filtering() const
60{
61 return m_unityFilter->filtering();
62}
63
64void Filter::clear()
65{
66 m_unityFilter->Clear();
67}
68
69
70void Filter::setUnityFilter(unity::dash::Filter::Ptr filter)
71{
72 if (m_unityFilter != NULL) {
73 // FIXME: should disconnect from m_unityFilter's signals
74 }
75
76 m_unityFilter = filter;
77
78 /* Property change signals */
79 m_unityFilter->id.changed.connect(sigc::mem_fun(this, &Filter::idChanged));
80 m_unityFilter->name.changed.connect(sigc::mem_fun(this, &Filter::nameChanged));
81 m_unityFilter->icon_hint.changed.connect(sigc::mem_fun(this, &Filter::iconHintChanged));
82 m_unityFilter->renderer_name.changed.connect(sigc::mem_fun(this, &Filter::rendererNameChanged));
83 m_unityFilter->visible.changed.connect(sigc::mem_fun(this, &Filter::visibleChanged));
84 m_unityFilter->collapsed.changed.connect(sigc::mem_fun(this, &Filter::collapsedChanged));
85 m_unityFilter->filtering.changed.connect(sigc::mem_fun(this, &Filter::filteringChanged));
86
87 /* Signals forwarding */
88 m_unityFilter->removed.connect(sigc::mem_fun(this, &Filter::removed));
89}
90
91
92#include "filter.moc"
093
=== added file 'libunity-2d-private/src/filter.h'
--- libunity-2d-private/src/filter.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/filter.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef FILTER_H
21#define FILTER_H
22
23// Qt
24#include <QObject>
25#include <QMetaType>
26
27// libunity-core
28#include <UnityCore/Filter.h>
29
30class Filter : public QObject
31{
32 Q_OBJECT
33
34 Q_PROPERTY(QString id READ id NOTIFY idChanged)
35 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
36 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
37 Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
38 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
39 Q_PROPERTY(bool collapsed READ collapsed NOTIFY collapsedChanged)
40 Q_PROPERTY(bool filtering READ filtering NOTIFY filteringChanged)
41
42public:
43 explicit Filter(QObject *parent = 0);
44
45 /* getters */
46 QString id() const;
47 QString name() const;
48 QString iconHint() const;
49 QString rendererName() const;
50 bool visible() const;
51 bool collapsed() const;
52 bool filtering() const;
53
54 void clear();
55 virtual void setUnityFilter(unity::dash::Filter::Ptr filter);
56
57Q_SIGNALS:
58 void idChanged(std::string);
59 void nameChanged(std::string);
60 void iconHintChanged(std::string);
61 void rendererNameChanged(std::string);
62 void visibleChanged(bool);
63 void collapsedChanged(bool);
64 void filteringChanged(bool);
65
66 void removed();
67
68protected:
69 unity::dash::Filter::Ptr m_unityFilter;
70};
71
72Q_DECLARE_METATYPE(Filter*)
73
74#endif // FILTER_H
075
=== added file 'libunity-2d-private/src/gimageutils.cpp'
--- libunity-2d-private/src/gimageutils.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/gimageutils.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,102 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21// Self
22#include <gimageutils.h>
23
24// Local
25#include <debug_p.h>
26#include <gscopedpointer.h>
27
28// Qt
29#include <QByteArray>
30#include <QImage>
31
32// GTK
33#include <gtk/gtk.h>
34
35namespace GImageUtils
36{
37
38QImage imageForIconString(const QString& name, int size, GtkIconTheme* theme)
39{
40 if (!theme) {
41 theme = gtk_icon_theme_get_default();
42 }
43 QByteArray utf8Name = name.toUtf8();
44
45 /* Load the icon by creating a GIcon from the string icon_name.
46 icon_name can contain more than a simple icon name but possibly
47 a string as returned by g_icon_to_string().
48 */
49 GObjectScopedPointer<GIcon> icon(g_icon_new_for_string(utf8Name.data(), NULL));
50 GScopedPointer<GtkIconInfo, gtk_icon_info_free> iconInfo;
51 iconInfo.reset(gtk_icon_theme_lookup_by_gicon(
52 theme,
53 icon.data(),
54 size,
55 (GtkIconLookupFlags)0)
56 );
57
58 if (!iconInfo) {
59 UQ_WARNING << "Failed to find icon:" << name;
60 return QImage();
61 }
62
63 GObjectScopedPointer<GdkPixbuf> pixbuf(gtk_icon_info_load_icon(iconInfo.data(), NULL));
64 if (!pixbuf) {
65 UQ_WARNING << "Failed to load icon:" << name;
66 return QImage();
67 }
68
69 return imageForPixbuf(pixbuf.data());
70}
71
72QImage imageForPixbuf(const GdkPixbuf* pixbuf)
73{
74 QImage image(gdk_pixbuf_get_pixels(pixbuf),
75 gdk_pixbuf_get_width(pixbuf),
76 gdk_pixbuf_get_height(pixbuf),
77 gdk_pixbuf_get_rowstride(pixbuf),
78 QImage::Format_ARGB32);
79
80#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
81 /* ABGR → ARGB */
82 QImage swappedImage = image.rgbSwapped();
83#else
84 /* ABGR → BGRA */
85 /* Reference: https://bugs.launchpad.net/unity-2d/+bug/758782 */
86 QImage swappedImage(image.size(), image.format());
87 for (int i = 0; i < swappedImage.height(); ++i) {
88 QRgb* p = (QRgb*) image.constScanLine(i);
89 QRgb* q = (QRgb*) swappedImage.scanLine(i);
90 QRgb* end = p + image.width();
91 while (p < end) {
92 *q = qRgba(qAlpha(*p), qRed(*p), qGreen(*p), qBlue(*p));
93 p++;
94 q++;
95 }
96 }
97#endif
98
99 return swappedImage;
100}
101
102} // namespace
0103
=== added file 'libunity-2d-private/src/gimageutils.h'
--- libunity-2d-private/src/gimageutils.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/gimageutils.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,46 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef GIMAGEUTILS_H
22#define GIMAGEUTILS_H
23
24// Local
25
26// Qt
27
28class QImage;
29class QString;
30
31struct _GdkPixbuf;
32struct _GtkIconTheme;
33
34/**
35 * Helper methods to deal with GTK images
36 */
37namespace GImageUtils
38{
39
40QImage imageForIconString(const QString& name, int size, struct _GtkIconTheme* theme = 0);
41
42QImage imageForPixbuf(const struct _GdkPixbuf* pixbuf);
43
44} // namespace
45
46#endif /* GIMAGEUTILS_H */
047
=== modified file 'libunity-2d-private/src/iconimageprovider.cpp'
--- libunity-2d-private/src/iconimageprovider.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/iconimageprovider.cpp 2011-08-16 09:38:07 +0000
@@ -23,6 +23,7 @@
23#include <QFile>23#include <QFile>
2424
25#include <debug_p.h>25#include <debug_p.h>
26#include <gimageutils.h>
2627
27static const char* UNITY_RES_PATH = "/usr/share/unity/";28static const char* UNITY_RES_PATH = "/usr/share/unity/";
2829
@@ -114,62 +115,9 @@
114 icon_name.chop(4);115 icon_name.chop(4);
115 }116 }
116117
117 /* Load the icon by creating a GIcon from the string icon_name.118 QImage image = GImageUtils::imageForIconString(icon_name, requestedSize.width(), theme);
118 icon_name can contain more than a simple icon name but possibly
119 a string as returned by g_icon_to_string().
120 */
121 QByteArray byte_array = icon_name.toUtf8();
122 gchar *g_icon_name = byte_array.data();
123
124 GIcon *g_icon = g_icon_new_for_string(g_icon_name, NULL);
125 GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(theme, g_icon,
126 requestedSize.width(),
127 (GtkIconLookupFlags)0);
128 g_object_unref(g_icon);
129
130 if (icon_info == NULL) {
131 UQ_WARNING << "Failed to find icon:" << icon_name;
132 return QImage();
133 }
134
135 GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon_info, NULL);
136 gtk_icon_info_free(icon_info);
137
138 if (pixbuf == NULL) {
139 UQ_WARNING << "Failed to load icon:" << icon_name;
140 return QImage();
141 }
142
143 QImage image(gdk_pixbuf_get_pixels(pixbuf),
144 gdk_pixbuf_get_width(pixbuf),
145 gdk_pixbuf_get_height(pixbuf),
146 gdk_pixbuf_get_rowstride(pixbuf),
147 QImage::Format_ARGB32);
148
149#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
150 /* ABGR → ARGB */
151 QImage swappedImage = image.rgbSwapped();
152#else
153 /* ABGR → BGRA */
154 /* Reference: https://bugs.launchpad.net/unity-2d/+bug/758782 */
155 QImage swappedImage(image.size(), image.format());
156 for (int i = 0; i < swappedImage.height(); ++i) {
157 QRgb* p = (QRgb*) image.constScanLine(i);
158 QRgb* q = (QRgb*) swappedImage.scanLine(i);
159 QRgb* end = p + image.width();
160 while (p < end) {
161 *q = qRgba(qAlpha(*p), qRed(*p), qGreen(*p), qBlue(*p));
162 p++;
163 q++;
164 }
165 }
166#endif
167
168 g_object_unref(pixbuf);
169
170 if (size) {119 if (size) {
171 *size = swappedImage.size();120 *size = image.size();
172 }121 }
173122 return image;
174 return swappedImage;
175}123}
176124
=== modified file 'libunity-2d-private/src/launcherapplication.cpp'
--- libunity-2d-private/src/launcherapplication.cpp 2011-08-09 11:28:45 +0000
+++ libunity-2d-private/src/launcherapplication.cpp 2011-08-16 09:38:07 +0000
@@ -14,10 +14,6 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17/* Those have to be included before any QObject-style header to avoid
18 compilation errors. */
19#include <gdk/gdk.h>
20
21/* Note regarding the use of wnck: it is critically important that the client17/* Note regarding the use of wnck: it is critically important that the client
22 type be set to pager because wnck will pass that type over to the window18 type be set to pager because wnck will pass that type over to the window
23 manager through XEvents.19 manager through XEvents.
@@ -59,6 +55,7 @@
59#include <QX11Info>55#include <QX11Info>
6056
61extern "C" {57extern "C" {
58#include <gdk/gdk.h>
62#include <libsn/sn.h>59#include <libsn/sn.h>
63}60}
6461
@@ -662,7 +659,8 @@
662 GTimeVal timeval;659 GTimeVal timeval;
663660
664 g_get_current_time (&timeval);661 g_get_current_time (&timeval);
665 GObjectScopedPointer<GdkAppLaunchContext> context(gdk_app_launch_context_new());662 GdkDisplay* display = gdk_display_get_default();
663 GObjectScopedPointer<GdkAppLaunchContext> context(gdk_display_get_app_launch_context(display));
666 /* Using GDK_CURRENT_TIME doesn’t seem to work, launched windows664 /* Using GDK_CURRENT_TIME doesn’t seem to work, launched windows
667 sometimes don’t get focus (see https://launchpad.net/bugs/643616). */665 sometimes don’t get focus (see https://launchpad.net/bugs/643616). */
668 gdk_app_launch_context_set_timestamp(context.data(), timeval.tv_sec);666 gdk_app_launch_context_set_timestamp(context.data(), timeval.tv_sec);
@@ -893,7 +891,7 @@
893 QAction* keep = new QAction(m_menu);891 QAction* keep = new QAction(m_menu);
894 keep->setCheckable(is_running);892 keep->setCheckable(is_running);
895 keep->setChecked(sticky());893 keep->setChecked(sticky());
896 keep->setText(is_running ? u2dTr("Keep In Launcher") : u2dTr("Remove From Launcher"));894 keep->setText(is_running ? u2dTr("Keep in launcher") : u2dTr("Remove from launcher"));
897 actions.append(keep);895 actions.append(keep);
898 QObject::connect(keep, SIGNAL(triggered()), this, SLOT(onKeepTriggered()));896 QObject::connect(keep, SIGNAL(triggered()), this, SLOT(onKeepTriggered()));
899 }897 }
900898
=== modified file 'libunity-2d-private/src/launcherapplicationslist.cpp'
--- libunity-2d-private/src/launcherapplicationslist.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/launcherapplicationslist.cpp 2011-08-16 09:38:07 +0000
@@ -101,6 +101,16 @@
101 application->installX11EventFilter(this);101 application->installX11EventFilter(this);
102 }102 }
103103
104 /* Get the system applications data dirs and be flexible if / is not at the
105 end of each path. */
106 QString xdgDataDir = QFile::decodeName(getenv("XDG_DATA_DIRS"));
107 if (xdgDataDir.isEmpty()) {
108 xdgDataDir = "/usr/local/share/:/usr/share/";
109 }
110 Q_FOREACH(const QString& dirName, xdgDataDir.split(':')) {
111 m_xdgApplicationDirs << QDir::cleanPath(dirName + "/applications") + "/";
112 }
113
104 load();114 load();
105}115}
106116
@@ -178,9 +188,17 @@
178}188}
179189
180QString190QString
181LauncherApplicationsList::favoriteFromDesktopFilePath(QString desktop_file)191LauncherApplicationsList::favoriteFromDesktopFilePath(const QString& _desktopFile) const
182{192{
183 return QDir(desktop_file).dirName();193 QString desktopFile(_desktopFile);
194 Q_FOREACH(const QString& applicationDir, m_xdgApplicationDirs) {
195 if (_desktopFile.startsWith(applicationDir)) {
196 desktopFile.remove(applicationDir);
197 desktopFile.replace("/", "-");
198 break;
199 }
200 }
201 return desktopFile;
184}202}
185203
186void204void
187205
=== modified file 'libunity-2d-private/src/launcherapplicationslist.h'
--- libunity-2d-private/src/launcherapplicationslist.h 2011-08-06 10:42:04 +0000
+++ libunity-2d-private/src/launcherapplicationslist.h 2011-08-16 09:38:07 +0000
@@ -70,7 +70,7 @@
70 void insertApplication(LauncherApplication* application);70 void insertApplication(LauncherApplication* application);
71 void removeApplication(LauncherApplication* application);71 void removeApplication(LauncherApplication* application);
7272
73 static QString favoriteFromDesktopFilePath(QString desktop_file);73 QString favoriteFromDesktopFilePath(const QString& desktop_file) const;
7474
75 void writeFavoritesToGConf();75 void writeFavoritesToGConf();
7676
@@ -89,6 +89,7 @@
89 */89 */
90 QHash<QString, LauncherApplication*> m_applicationForExecutable;90 QHash<QString, LauncherApplication*> m_applicationForExecutable;
91 QConf* m_dconf_launcher;91 QConf* m_dconf_launcher;
92 QStringList m_xdgApplicationDirs;
9293
93 /* Startup notification support */94 /* Startup notification support */
94 SnDisplay *m_snDisplay;95 SnDisplay *m_snDisplay;
9596
=== modified file 'libunity-2d-private/src/launcherdevice.cpp'
--- libunity-2d-private/src/launcherdevice.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/launcherdevice.cpp 2011-08-16 09:38:07 +0000
@@ -186,35 +186,65 @@
186}186}
187187
188void188void
189LauncherDevice::unmount(GMountOperation* mountOperation)
190{
191 if (m_volume == NULL) {
192 return;
193 }
194
195 GObjectScopedPointer<GMount> mount(g_volume_get_mount(m_volume));
196
197 if (mount.isNull()) {
198 return;
199 }
200
201 if (g_mount_can_unmount(mount.data())) {
202 g_mount_unmount_with_operation(mount.data(), G_MOUNT_UNMOUNT_NONE, mountOperation, NULL,
203 (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,
204 NULL);
205 }
206}
207
208void
189LauncherDevice::eject()209LauncherDevice::eject()
190{210{
191 if (m_volume == NULL) {211 if (m_volume == NULL) {
192 return;212 return;
193 }213 }
194214
195 GMountOperation *mountOperation;215 GObjectScopedPointer<GMountOperation> mountOperation(gtk_mount_operation_new(NULL));
196 mountOperation = gtk_mount_operation_new(NULL);
197216
198 if (g_volume_can_eject(m_volume)) {217 if (g_volume_can_eject(m_volume)) {
199 g_volume_eject_with_operation(m_volume, G_MOUNT_UNMOUNT_NONE, mountOperation,218 g_volume_eject_with_operation(m_volume, G_MOUNT_UNMOUNT_NONE, mountOperation.data(),
200 NULL, (GAsyncReadyCallback) LauncherDevice::onVolumeEjected, NULL);219 NULL,
201 } else {220 (GAsyncReadyCallback) LauncherDevice::onVolumeEjected,
202 GMount* mount = g_volume_get_mount(m_volume);221 NULL);
203222 } else {
204 if (mount == NULL) {223 unmount(mountOperation.data());
205 return;224 }
206 }225}
207226
208 if (g_mount_can_unmount(mount)) {227void
209 g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, mountOperation,228LauncherDevice::stop()
210 NULL, (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,229{
211 NULL);230 if (m_volume == NULL) {
212 } else {231 return;
213 g_object_unref(mount);232 }
214 }233
215 }234 GObjectScopedPointer<GDrive> drive(g_volume_get_drive(m_volume));
216235
217 g_object_unref(mountOperation);236 if (drive.isNull()) {
237 return;
238 }
239
240 GObjectScopedPointer<GMountOperation> mountOperation(gtk_mount_operation_new(NULL));
241
242 if (g_drive_can_stop(drive.data())) {
243 g_drive_stop(drive.data(), G_MOUNT_UNMOUNT_NONE, mountOperation.data(), NULL,
244 (GAsyncReadyCallback) LauncherDevice::onDriveStopped, NULL);
245 } else {
246 unmount(mountOperation.data());
247 }
218}248}
219249
220void250void
@@ -224,6 +254,12 @@
224}254}
225255
226void256void
257LauncherDevice::onDriveStopped(GDrive* drive, GAsyncResult* res)
258{
259 g_drive_stop_finish(drive, res, NULL);
260}
261
262void
227LauncherDevice::onMountUnmounted(GMount* mount, GAsyncResult* res)263LauncherDevice::onMountUnmounted(GMount* mount, GAsyncResult* res)
228{264{
229 g_mount_unmount_with_operation_finish(mount, res, NULL);265 g_mount_unmount_with_operation_finish(mount, res, NULL);
@@ -237,6 +273,15 @@
237 eject->setText(u2dTr("Eject"));273 eject->setText(u2dTr("Eject"));
238 m_menu->addAction(eject);274 m_menu->addAction(eject);
239 QObject::connect(eject, SIGNAL(triggered()), this, SLOT(onEjectTriggered()));275 QObject::connect(eject, SIGNAL(triggered()), this, SLOT(onEjectTriggered()));
276
277 GObjectScopedPointer<GDrive> drive(g_volume_get_drive(m_volume));
278
279 if (!drive.isNull() && g_drive_can_stop(drive.data())) {
280 QAction* stop = new QAction(m_menu);
281 stop->setText(u2dTr("Safely remove"));
282 m_menu->addAction(stop);
283 QObject::connect(stop, SIGNAL(triggered()), this, SLOT(onStopTriggered()));
284 }
240}285}
241286
242void287void
@@ -246,4 +291,11 @@
246 eject();291 eject();
247}292}
248293
294void
295LauncherDevice::onStopTriggered()
296{
297 m_menu->hide();
298 stop();
299}
300
249#include "launcherdevice.moc"301#include "launcherdevice.moc"
250302
=== modified file 'libunity-2d-private/src/launcherdevice.h'
--- libunity-2d-private/src/launcherdevice.h 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/launcherdevice.h 2011-08-16 09:38:07 +0000
@@ -51,18 +51,22 @@
51 Q_INVOKABLE GVolume* getVolume();51 Q_INVOKABLE GVolume* getVolume();
52 Q_INVOKABLE void setVolume(GVolume* volume);52 Q_INVOKABLE void setVolume(GVolume* volume);
53 Q_INVOKABLE void open();53 Q_INVOKABLE void open();
54 Q_INVOKABLE void unmount(GMountOperation* mountOperation);
54 Q_INVOKABLE void eject();55 Q_INVOKABLE void eject();
56 Q_INVOKABLE void stop();
5557
56 Q_INVOKABLE virtual void createMenuActions();58 Q_INVOKABLE virtual void createMenuActions();
5759
58private Q_SLOTS:60private Q_SLOTS:
59 void onEjectTriggered();61 void onEjectTriggered();
62 void onStopTriggered();
6063
61private:64private:
62 GVolume* m_volume;65 GVolume* m_volume;
6366
64 static void onVolumeMounted(GVolume* volume, GAsyncResult* res);67 static void onVolumeMounted(GVolume* volume, GAsyncResult* res);
65 static void onVolumeEjected(GVolume* volume, GAsyncResult* res);68 static void onVolumeEjected(GVolume* volume, GAsyncResult* res);
69 static void onDriveStopped(GDrive* drive, GAsyncResult* res);
66 static void onMountUnmounted(GMount* mount, GAsyncResult* res);70 static void onMountUnmounted(GMount* mount, GAsyncResult* res);
67};71};
6872
6973
=== modified file 'libunity-2d-private/src/launchermenu.cpp'
--- libunity-2d-private/src/launchermenu.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/launchermenu.cpp 2011-08-16 09:38:07 +0000
@@ -96,6 +96,7 @@
96void96void
97LauncherContextualMenu::setTitle(const QString& title)97LauncherContextualMenu::setTitle(const QString& title)
98{98{
99 setAccessibleName(title);
99 m_title = title;100 m_title = title;
100 /* Escaping ampersands so that they are not considered as keyboard101 /* Escaping ampersands so that they are not considered as keyboard
101 accelerators. */102 accelerators. */
102103
=== added file 'libunity-2d-private/src/lens.cpp'
--- libunity-2d-private/src/lens.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/lens.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,272 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20// Self
21#include "lens.h"
22
23// libunity-2d
24#include <debug_p.h>
25#include "launcherapplication.h"
26
27// Qt
28#include <QUrl>
29#include <QDesktopServices>
30
31Lens::Lens(QObject *parent) :
32 QObject(parent)
33{
34 m_results = new DeeListModel;
35 m_globalResults = new DeeListModel;
36 m_categories = new DeeListModel;
37}
38
39QString Lens::id() const
40{
41 return QString::fromStdString(m_unityLens->id());
42}
43
44QString Lens::dbusName() const
45{
46 return QString::fromStdString(m_unityLens->dbus_name());
47}
48
49QString Lens::dbusPath() const
50{
51 return QString::fromStdString(m_unityLens->dbus_path());
52}
53
54QString Lens::name() const
55{
56 return QString::fromStdString(m_unityLens->name());
57}
58
59QString Lens::iconHint() const
60{
61 return QString::fromStdString(m_unityLens->icon_hint());
62}
63
64QString Lens::description() const
65{
66 return QString::fromStdString(m_unityLens->description());
67}
68
69QString Lens::searchHint() const
70{
71 return QString::fromStdString(m_unityLens->search_hint());
72}
73
74bool Lens::visible() const
75{
76 return m_unityLens->visible();
77}
78
79bool Lens::searchInGlobal() const
80{
81 return m_unityLens->search_in_global();
82}
83
84QString Lens::shortcut() const
85{
86 return QString::fromStdString(m_unityLens->shortcut());
87}
88
89bool Lens::connected() const
90{
91 return m_unityLens->connected();
92}
93
94DeeListModel* Lens::results() const
95{
96 return m_results;
97}
98
99DeeListModel* Lens::globalResults() const
100{
101 return m_globalResults;
102}
103
104DeeListModel* Lens::categories() const
105{
106 return m_categories;
107}
108
109bool Lens::active() const
110{
111 return m_unityLens->active();
112}
113
114QString Lens::searchQuery() const
115{
116 return m_searchQuery;
117}
118
119QString Lens::globalSearchQuery() const
120{
121 return m_globalSearchQuery;
122}
123
124void Lens::setActive(bool active)
125{
126 m_unityLens->active = active;
127}
128
129void Lens::setSearchQuery(const QString& search_query)
130{
131 if (search_query != m_searchQuery) {
132 m_searchQuery = search_query;
133 m_unityLens->Search(search_query.toStdString());
134 Q_EMIT searchQueryChanged();
135 }
136}
137
138void Lens::setGlobalSearchQuery(const QString& search_query)
139{
140 if (search_query != m_globalSearchQuery) {
141 m_globalSearchQuery = search_query;
142 m_unityLens->GlobalSearch(search_query.toStdString());
143 Q_EMIT globalSearchQueryChanged();
144 }
145}
146
147void Lens::activate(const QString& uri)
148{
149 m_unityLens->Activate(uri.toStdString());
150}
151
152void Lens::onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&)
153{
154 if (type == unity::dash::NOT_HANDLED) {
155 fallbackActivate(QString::fromStdString(uri));
156 }
157}
158
159void Lens::fallbackActivate(const QString& uri)
160{
161 /* FIXME: stripping all content before the first column because for some
162 reason the lenses give uri with junk content at their beginning.
163 */
164 QString tweakedUri = uri;
165 int firstColumnAt = tweakedUri.indexOf(":");
166 tweakedUri.remove(0, firstColumnAt+1);
167
168 /* Tries various methods to trigger a sensible action for the given 'uri'.
169 If it has no understanding of the given scheme it falls back on asking
170 Qt to open the uri.
171 */
172 QUrl url(tweakedUri);
173 if (url.scheme() == "file") {
174 /* Override the files place's default URI handler: we want the file
175 manager to handle opening folders, not the dash.
176
177 Ref: https://bugs.launchpad.net/upicek/+bug/689667
178 */
179 QDesktopServices::openUrl(url);
180 return;
181 }
182 if (url.scheme() == "application") {
183 LauncherApplication application;
184 /* Cannot set the desktop file to url.host(), because the QUrl constructor
185 converts the host name to lower case to conform to the Nameprep
186 RFC (see http://doc.qt.nokia.com/qurl.html#FormattingOption-enum).
187 Ref: https://bugs.launchpad.net/unity-place-applications/+bug/784478 */
188 QString desktopFile = tweakedUri.mid(tweakedUri.indexOf("://") + 3);
189 application.setDesktopFile(desktopFile);
190 application.activate();
191 return;
192 }
193
194 UQ_WARNING << "FIXME: Possibly no handler for scheme: " << url.scheme();
195 UQ_WARNING << "Trying to open" << tweakedUri;
196 /* Try our luck */
197 QDesktopServices::openUrl(url);
198}
199
200void Lens::setUnityLens(unity::dash::Lens::Ptr lens)
201{
202 if (m_unityLens != NULL) {
203 // FIXME: should disconnect from m_unityLens's signals
204 }
205
206 // FIXME: should emit change notification signals for all properties
207
208 m_unityLens = lens;
209
210 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
211 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
212 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
213
214 /* Property change signals */
215 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
216 m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));
217 m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));
218 m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
219 m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
220 m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
221 m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
222 m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
223 m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));
224 m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
225 m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
226 m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
227 m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
228 m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));
229 m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
230 m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
231 m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
232 m_unityLens->active.changed.connect(sigc::mem_fun(this, &Lens::activeChanged));
233
234 /* Signals forwarding */
235 m_unityLens->search_finished.connect(sigc::mem_fun(this, &Lens::searchFinished));
236 m_unityLens->global_search_finished.connect(sigc::mem_fun(this, &Lens::globalSearchFinished));
237
238 /* FIXME: signal should be forwarded instead of calling the handler directly */
239 m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
240}
241
242void Lens::onResultsSwarmNameChanged(std::string swarm_name)
243{
244 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
245}
246
247void Lens::onResultsChanged(unity::dash::Results::Ptr results)
248{
249 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
250}
251
252void Lens::onGlobalResultsSwarmNameChanged(std::string swarm_name)
253{
254 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
255}
256
257void Lens::onGlobalResultsChanged(unity::dash::Results::Ptr global_results)
258{
259 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
260}
261
262void Lens::onCategoriesSwarmNameChanged(std::string swarm_name)
263{
264 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
265}
266
267void Lens::onCategoriesChanged(unity::dash::Categories::Ptr categories)
268{
269 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
270}
271
272#include "lens.moc"
0273
=== added file 'libunity-2d-private/src/lens.h'
--- libunity-2d-private/src/lens.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/lens.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,130 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LENS_H
21#define LENS_H
22
23// Qt
24#include <QObject>
25#include <QString>
26#include <QMetaType>
27
28// libunity-core
29#include <UnityCore/Lens.h>
30
31// dee-qt
32#include "deelistmodel.h"
33
34
35class Lens : public QObject
36{
37 Q_OBJECT
38
39 Q_PROPERTY(QString id READ id NOTIFY idChanged)
40 Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
41 Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
42 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
43 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
44 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
45 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
46 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
47 Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
48 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
49 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
50 Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)
51 Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
52 Q_PROPERTY(DeeListModel* categories READ categories NOTIFY categoriesChanged)
53 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
54
55 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
56 Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
57
58public:
59 explicit Lens(QObject *parent = 0);
60
61 /* getters */
62 QString id() const;
63 QString dbusName() const;
64 QString dbusPath() const;
65 QString name() const;
66 QString iconHint() const;
67 QString description() const;
68 QString searchHint() const;
69 bool visible() const;
70 bool searchInGlobal() const;
71 QString shortcut() const;
72 bool connected() const;
73 DeeListModel* results() const;
74 DeeListModel* globalResults() const;
75 DeeListModel* categories() const;
76 bool active() const;
77 QString searchQuery() const;
78 QString globalSearchQuery() const;
79
80 /* setters */
81 void setActive(bool active);
82 void setSearchQuery(const QString& search_query);
83 void setGlobalSearchQuery(const QString& search_query);
84
85 Q_INVOKABLE void activate(const QString& uri);
86 void setUnityLens(unity::dash::Lens::Ptr lens);
87
88Q_SIGNALS:
89 void idChanged(std::string);
90 void dbusNameChanged(std::string);
91 void dbusPathChanged(std::string);
92 void nameChanged(std::string);
93 void iconHintChanged(std::string);
94 void descriptionChanged(std::string);
95 void searchHintChanged(std::string);
96 void visibleChanged(bool);
97 void searchInGlobalChanged(bool);
98 void shortcutChanged(std::string);
99 void connectedChanged(bool);
100 void resultsChanged();
101 void globalResultsChanged();
102 void categoriesChanged();
103 void activeChanged(bool);
104 void searchFinished(std::string const&);
105 void globalSearchFinished(std::string const&);
106 void searchQueryChanged();
107 void globalSearchQueryChanged();
108
109private:
110 void onResultsSwarmNameChanged(std::string);
111 void onResultsChanged(unity::dash::Results::Ptr);
112 void onGlobalResultsSwarmNameChanged(std::string);
113 void onGlobalResultsChanged(unity::dash::Results::Ptr);
114 void onCategoriesSwarmNameChanged(std::string);
115 void onCategoriesChanged(unity::dash::Categories::Ptr);
116
117 void onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&);
118 void fallbackActivate(const QString& uri);
119
120 unity::dash::Lens::Ptr m_unityLens;
121 DeeListModel* m_results;
122 DeeListModel* m_globalResults;
123 DeeListModel* m_categories;
124 QString m_searchQuery;
125 QString m_globalSearchQuery;
126};
127
128Q_DECLARE_METATYPE(Lens*)
129
130#endif // LENS_H
0131
=== added file 'libunity-2d-private/src/lenses.cpp'
--- libunity-2d-private/src/lenses.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/lenses.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,123 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20// Self
21#include "lenses.h"
22
23// Local
24#include "lens.h"
25
26// Qt
27
28// libunity-core
29#include <UnityCore/FilesystemLenses.h>
30
31Lenses::Lenses(QObject *parent) :
32 QAbstractListModel(parent)
33{
34 QHash<int, QByteArray> roles;
35 roles[Lenses::RoleItem] = "item";
36 roles[Lenses::RoleVisible] = "visible";
37 setRoleNames(roles);
38
39 m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");
40 for (unsigned int i=0; i<m_unityLenses->count(); i++) {
41 unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i);
42 addUnityLens(unityLens, i);
43 }
44 m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
45}
46
47Lenses::~Lenses()
48{
49 delete m_unityLenses;
50}
51
52int Lenses::rowCount(const QModelIndex& parent) const
53{
54 Q_UNUSED(parent)
55
56 return m_unityLenses->count();
57}
58
59QVariant Lenses::data(const QModelIndex& index, int role) const
60{
61 Q_UNUSED(role)
62
63 if (!index.isValid()) {
64 return QVariant();
65 }
66
67 Lens* lens = m_lenses.at(index.row());
68
69 if (role == Lenses::RoleItem) {
70 return QVariant::fromValue(lens);
71 } else if (role == Lenses::RoleVisible) {
72 return QVariant::fromValue(lens->visible());
73 } else {
74 return QVariant();
75 }
76}
77
78QVariant Lenses::get(int row) const
79{
80 return data(QAbstractListModel::index(row), 0);
81}
82
83QVariant Lenses::get(const QString& lens_id) const
84{
85 Q_FOREACH(Lens* lens, m_lenses) {
86 if (lens->id() == lens_id) {
87 return QVariant::fromValue(lens);
88 }
89 }
90
91 return QVariant();
92}
93
94void Lenses::onLensAdded(unity::dash::Lens::Ptr& lens)
95{
96 int index = m_unityLenses->count()-1;
97 beginInsertRows(QModelIndex(), index, index);
98 addUnityLens(lens, index);
99 endInsertRows();
100}
101
102void Lenses::onLensPropertyChanged()
103{
104 QModelIndex lensIndex = index(m_lenses.indexOf(qobject_cast<Lens*>(sender())));
105 Q_EMIT dataChanged(lensIndex, lensIndex);
106}
107
108void Lenses::addUnityLens(unity::dash::Lens::Ptr unity_lens, int index)
109{
110 Lens* lens = new Lens();
111 lens->setUnityLens(unity_lens);
112 /* DOCME */
113 QObject::connect(lens, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));
114 m_lenses.insert(index, lens);
115}
116
117void Lenses::removeUnityLens(int index)
118{
119 Lens* lens = m_lenses.takeAt(index);
120 delete lens;
121}
122
123#include "lenses.moc"
0124
=== added file 'libunity-2d-private/src/lenses.h'
--- libunity-2d-private/src/lenses.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/lenses.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LENSES_H
21#define LENSES_H
22
23// Qt
24#include <QAbstractListModel>
25#include <QList>
26
27// libunity-core
28#include <UnityCore/Lens.h>
29
30namespace unity
31{
32namespace dash
33{
34class Lenses;
35}
36}
37
38class Lens;
39
40class Lenses : public QAbstractListModel
41{
42 Q_OBJECT
43
44 Q_ENUMS(Roles)
45
46public:
47 explicit Lenses(QObject *parent = 0);
48 ~Lenses();
49
50 enum Roles {
51 RoleItem,
52 RoleVisible
53 };
54
55 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
56 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
57
58 Q_INVOKABLE QVariant get(int row) const;
59 Q_INVOKABLE QVariant get(const QString& lens_id) const;
60
61private Q_SLOTS:
62 void onLensAdded(unity::dash::Lens::Ptr& lens);
63 void onLensPropertyChanged();
64
65private:
66 unity::dash::Lenses* m_unityLenses;
67 QList<Lens*> m_lenses;
68
69 void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);
70 void removeUnityLens(int index);
71};
72
73#endif // LENSES_H
074
=== modified file 'libunity-2d-private/src/placeentry.cpp'
--- libunity-2d-private/src/placeentry.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/placeentry.cpp 2011-08-16 09:38:07 +0000
@@ -22,14 +22,12 @@
22#include "launchermenu.h"22#include "launchermenu.h"
2323
24// libunity-2d24// libunity-2d
25#include <dashclient.h>
25#include <debug_p.h>26#include <debug_p.h>
2627
27#include <QDBusMetaType>28#include <QDBusMetaType>
28#include <QAction>29#include <QAction>
29#include <QDebug>30#include <QDebug>
30#include <QDBusServiceWatcher>
31#include <QDBusConnectionInterface>
32#include <QDBusReply>
3331
34// Marshall the RendererInfoStruct data into a D-Bus argument32// Marshall the RendererInfoStruct data into a D-Bus argument
35QDBusArgument &operator<<(QDBusArgument &argument, const RendererInfoStruct &r)33QDBusArgument &operator<<(QDBusArgument &argument, const RendererInfoStruct &r)
@@ -146,10 +144,6 @@
146static const char* UNITY_PLACE_ENTRY_INTERFACE = "com.canonical.Unity.PlaceEntry";144static const char* UNITY_PLACE_ENTRY_INTERFACE = "com.canonical.Unity.PlaceEntry";
147static const char* SECTION_PROPERTY = "section";145static const char* SECTION_PROPERTY = "section";
148146
149static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
150static const char* DASH_DBUS_PATH = "/Dash";
151static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
152
153PlaceEntry::PlaceEntry(QObject* parent) :147PlaceEntry::PlaceEntry(QObject* parent) :
154 LauncherItem(parent),148 LauncherItem(parent),
155 m_position(0),149 m_position(0),
@@ -163,32 +157,15 @@
163 m_entryResultsModel(NULL),157 m_entryResultsModel(NULL),
164 m_globalGroupsModel(NULL),158 m_globalGroupsModel(NULL),
165 m_globalResultsModel(NULL),159 m_globalResultsModel(NULL),
166 m_dbusIface(NULL),160 m_dbusIface(NULL)
167 m_dashDbusIface(NULL),
168 m_dashActive(false)
169{161{
170 qDBusRegisterMetaType<RendererInfoStruct>();162 qDBusRegisterMetaType<RendererInfoStruct>();
171 qDBusRegisterMetaType<PlaceEntryInfoStruct>();163 qDBusRegisterMetaType<PlaceEntryInfoStruct>();
172 qDBusRegisterMetaType<QList<PlaceEntryInfoStruct> >();164 qDBusRegisterMetaType<QList<PlaceEntryInfoStruct> >();
173 qDBusRegisterMetaType<QHash<QString, QString>>();165 qDBusRegisterMetaType<QHash<QString, QString>>();
174166
175 /* Check if the dash is already up and running by asking the bus instead of167 connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)),
176 trying to create an instance of the interface. Creating an instance would168 SLOT(slotActivePageChanged(const QString&)));
177 cause D-Bus to activate the dash and we don’t want this to happen, the
178 dash should be started on demand only. */
179 QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface();
180 QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(DASH_DBUS_SERVICE);
181 if (reply.isValid() && reply.value()) {
182 connectToDash();
183 } else {
184 /* The dash is not running: monitor its registration on the bus so we
185 can connect to it when it comes up. */
186 QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DASH_DBUS_SERVICE,
187 QDBusConnection::sessionBus(),
188 QDBusServiceWatcher::WatchForRegistration,
189 this);
190 connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash()));
191 }
192}169}
193170
194PlaceEntry::PlaceEntry(const PlaceEntry& other) :171PlaceEntry::PlaceEntry(const PlaceEntry& other) :
@@ -752,59 +729,12 @@
752 Q_EMIT globalRendererHintsChanged();729 Q_EMIT globalRendererHintsChanged();
753}730}
754731
755void732
756PlaceEntry::connectToDash()733void
757{734PlaceEntry::slotActivePageChanged(const QString& page)
758 if (m_dashDbusIface != NULL) {
759 return;
760 }
761
762 m_dashDbusIface = new QDBusInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE,
763 QDBusConnection::sessionBus(), this);
764 connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
765 SLOT(slotDashActiveChanged(bool)));
766 connect(m_dashDbusIface, SIGNAL(activePlaceEntryChanged(const QString&)),
767 SLOT(slotDashActivePlaceEntryChanged(const QString&)));
768
769 QVariant value = m_dashDbusIface->property("active");
770 if (value.isValid()) {
771 m_dashActive = value.toBool();
772 } else {
773 UQ_WARNING << "Fetching Dash.active property failed";
774 }
775 value = m_dashDbusIface->property("activePlaceEntry");
776 if (value.isValid()) {
777 m_dashActivePlaceEntry = value.toString();
778 } else {
779 UQ_WARNING << "Fetching Dash.activePlaceEntry property failed";
780 }
781
782 updateActiveState();
783}
784
785void
786PlaceEntry::slotDashActiveChanged(bool value)
787{
788 if (m_dashActive != value) {
789 m_dashActive = value;
790 updateActiveState();
791 }
792}
793
794void
795PlaceEntry::slotDashActivePlaceEntryChanged(const QString& entry)
796{
797 if (m_dashActivePlaceEntry != entry) {
798 m_dashActivePlaceEntry = entry;
799 updateActiveState();
800 }
801}
802
803void
804PlaceEntry::updateActiveState()
805{735{
806 bool active = false;736 bool active = false;
807 if (m_dashActive && !m_dbusObjectPath.isEmpty() && (m_dashActivePlaceEntry == m_dbusObjectPath)) {737 if (!m_dbusObjectPath.isEmpty() && page == m_dbusObjectPath) {
808 active = true;738 active = true;
809 }739 }
810740
@@ -827,8 +757,12 @@
827 startRemotePlaceOnDemand();757 startRemotePlaceOnDemand();
828 }758 }
829759
830 QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);760 if (m_active) {
831 iface.asyncCall(QLatin1String("activatePlaceEntry"), m_fileName, m_groupName, section);761 DashClient::instance()->setActivePage(QString());
762 } else {
763 /* FIXME: DashClient::setActivePage has changed but PlaceEntry is deprecated anyway */
764 //DashClient::instance()->setActivePage(m_dbusObjectPath, m_fileName, m_groupName, section);
765 }
832}766}
833767
834void768void
835769
=== modified file 'libunity-2d-private/src/placeentry.h'
--- libunity-2d-private/src/placeentry.h 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/placeentry.h 2011-08-16 09:38:07 +0000
@@ -261,9 +261,6 @@
261 QMap<QString, QVariant> m_globalRendererHints;261 QMap<QString, QVariant> m_globalRendererHints;
262262
263 QDBusInterface* m_dbusIface;263 QDBusInterface* m_dbusIface;
264 QDBusInterface* m_dashDbusIface;
265 bool m_dashActive;
266 QString m_dashActivePlaceEntry;
267264
268 void setSection(const QString&);265 void setSection(const QString&);
269 void activateEntry(const int section);266 void activateEntry(const int section);
@@ -273,15 +270,12 @@
273private Q_SLOTS:270private Q_SLOTS:
274 void onRendererInfoChanged(const RendererInfoStruct&);271 void onRendererInfoChanged(const RendererInfoStruct&);
275272
276 void connectToDash();
277 void updateActiveState();
278 void slotDashActiveChanged(bool);
279 void slotDashActivePlaceEntryChanged(const QString&);
280
281 void startMonitoringSections();273 void startMonitoringSections();
282 void stopMonitoringSections();274 void stopMonitoringSections();
283 void slotSectionsChanged();275 void slotSectionsChanged();
284276
277 void slotActivePageChanged(const QString& page);
278
285 /* Contextual menu callbacks */279 /* Contextual menu callbacks */
286 void onSectionTriggered();280 void onSectionTriggered();
287};281};
288282
=== added file 'libunity-2d-private/src/ratingsfilter.cpp'
--- libunity-2d-private/src/ratingsfilter.cpp 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/ratingsfilter.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20// Self
21#include "ratingsfilter.h"
22
23RatingsFilter::RatingsFilter(QObject *parent) :
24 Filter(parent)
25{
26}
27
28float RatingsFilter::rating() const
29{
30 return m_unityRatingsFilter->rating();
31}
32
33void RatingsFilter::setUnityFilter(unity::dash::Filter::Ptr filter)
34{
35 if (m_unityFilter != NULL) {
36 // FIXME: should disconnect from m_unityFilter's signals
37 }
38
39 Filter::setUnityFilter(filter);
40 m_unityRatingsFilter = std::dynamic_pointer_cast<unity::dash::RatingsFilter>(m_unityFilter);
41
42 /* Property change signals */
43 m_unityRatingsFilter->rating.changed.connect(sigc::mem_fun(this, &RatingsFilter::ratingChanged));
44}
45
46#include "ratingsfilter.moc"
047
=== added file 'libunity-2d-private/src/ratingsfilter.h'
--- libunity-2d-private/src/ratingsfilter.h 1970-01-01 00:00:00 +0000
+++ libunity-2d-private/src/ratingsfilter.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef RATINGSFILTER_H
21#define RATINGSFILTER_H
22
23// Qt
24#include <QObject>
25#include <QMetaType>
26
27// libunity-core
28#include <UnityCore/RatingsFilter.h>
29
30// Local
31#include "filter.h"
32
33class RatingsFilter : public Filter
34{
35 Q_OBJECT
36
37 Q_PROPERTY(float rating READ rating NOTIFY ratingChanged)
38
39public:
40 explicit RatingsFilter(QObject *parent = 0);
41
42 /* getters */
43 float rating() const;
44
45 virtual void setUnityFilter(unity::dash::Filter::Ptr filter);
46
47Q_SIGNALS:
48 void ratingChanged(float);
49
50private:
51 unity::dash::RatingsFilter::Ptr m_unityRatingsFilter;
52};
53
54Q_DECLARE_METATYPE(RatingsFilter*)
55
56#endif // RATINGSFILTER_H
057
=== modified file 'libunity-2d-private/src/screeninfo.cpp'
--- libunity-2d-private/src/screeninfo.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/screeninfo.cpp 2011-08-16 09:38:07 +0000
@@ -1,7 +1,5 @@
1extern "C" {1extern "C" {
2#include <libwnck/screen.h>2#include <libwnck/libwnck.h>
3#include <libwnck/window.h>
4#include <libwnck/workspace.h>
5}3}
64
7#include "bamf-matcher.h"5#include "bamf-matcher.h"
86
=== modified file 'libunity-2d-private/src/unity-2d-private.pc.cmake'
--- libunity-2d-private/src/unity-2d-private.pc.cmake 2011-08-05 10:52:31 +0000
+++ libunity-2d-private/src/unity-2d-private.pc.cmake 2011-08-16 09:38:07 +0000
@@ -9,4 +9,4 @@
9Version: @VERSION@9Version: @VERSION@
10Libs: -L@LIBDIR@ -lunity-2d-private10Libs: -L@LIBDIR@ -lunity-2d-private
11Cflags: -I@INCLUDEDIR@/unity-2d-private11Cflags: -I@INCLUDEDIR@/unity-2d-private
12Requires: glib-2.0, gtk+-2.0, libwnck-1.012Requires: glib-2.0, gtk+-3.0, libwnck-3.0, pango
1313
=== modified file 'libunity-2d-private/src/unity2dapplication.cpp'
--- libunity-2d-private/src/unity2dapplication.cpp 2011-07-27 11:42:46 +0000
+++ libunity-2d-private/src/unity2dapplication.cpp 2011-08-16 09:38:07 +0000
@@ -25,14 +25,62 @@
2525
26// libunity-2d26// libunity-2d
27#include <debug_p.h>27#include <debug_p.h>
28#include <gconnector.h>
29#include <gscopedpointer.h>
28#include <unity2ddebug.h>30#include <unity2ddebug.h>
2931
30// Qt32// Qt
33#include <QFont>
31#include <QWindowsStyle>34#include <QWindowsStyle>
35#include <QAccessible>
36#include <QAccessibleWidget>
37#include <QWidget>
3238
33// GTK39// GTK
34#include <gtk/gtk.h>40#include <gtk/gtk.h>
3541#include <pango/pango.h>
42
43///////////////////////////////
44class PlatformFontTracker
45{
46public:
47 PlatformFontTracker()
48 {
49 m_gConnector.connect(gtk_settings_get_default(), "notify::gtk-font-name",
50 G_CALLBACK(PlatformFontTracker::onFontChanged), this);
51
52 updateFont();
53 }
54
55private:
56 void updateFont()
57 {
58 gchar* fontName = 0;
59 g_object_get(gtk_settings_get_default(), "gtk-font-name", &fontName, NULL);
60 GScopedPointer<PangoFontDescription, pango_font_description_free> fontDescription(
61 pango_font_description_from_string(fontName)
62 );
63 g_free(fontName);
64
65 int size = pango_font_description_get_size(fontDescription.data());
66
67 QFont font = QFont(
68 pango_font_description_get_family(fontDescription.data()),
69 size / PANGO_SCALE
70 );
71
72 QApplication::setFont(font);
73 }
74
75 static void onFontChanged(GObject*, GParamSpec*, PlatformFontTracker* obj)
76 {
77 obj->updateFont();
78 }
79
80 GConnector m_gConnector;
81};
82
83///////////////////////////////
36AbstractX11EventFilter::~AbstractX11EventFilter()84AbstractX11EventFilter::~AbstractX11EventFilter()
37{85{
38 Unity2dApplication* application = Unity2dApplication::instance();86 Unity2dApplication* application = Unity2dApplication::instance();
@@ -41,6 +89,28 @@
41 }89 }
42}90}
4391
92///////////////////////////////
93static bool arrayContains(char** begin, char** end, const char* string)
94{
95 for (char** ptr = begin; ptr != end; ++ptr) {
96 if (strcmp(*ptr, string) == 0) {
97 return true;
98 }
99 }
100 return false;
101}
102
103QAccessibleInterface *panelFactory(const QString &classname, QObject *object)
104{
105 QAccessibleInterface *interface = 0;
106
107 if (classname == "Unity2dPanel" && object && object->isWidgetType()) {
108 interface = new QAccessibleWidget(static_cast<QWidget *>(object), QAccessible::ToolBar);
109 }
110
111 return interface;
112}
113
44void Unity2dApplication::earlySetup(int& argc, char** argv)114void Unity2dApplication::earlySetup(int& argc, char** argv)
45{115{
46 // Parts of unity-2d uses GTK so it needs to be initialized116 // Parts of unity-2d uses GTK so it needs to be initialized
@@ -61,10 +131,19 @@
61 if(getenv("QT_GRAPHICSSYSTEM") == 0) {131 if(getenv("QT_GRAPHICSSYSTEM") == 0) {
62 QApplication::setGraphicsSystem("raster");132 QApplication::setGraphicsSystem("raster");
63 }133 }
134
135 /* Unless style has been specified in args, set default Qt style to
136 * QWindowStyle to avoid loading QGtkStyle. We don't want to load QGtkStyle
137 * because it uses libgtk2, which causes conflicts with our gtk3 code.
138 */
139 if (!arrayContains(argv, argv + argc, "-style")) {
140 QApplication::setStyle(new QWindowsStyle);
141 }
64}142}
65143
66Unity2dApplication::Unity2dApplication(int& argc, char** argv)144Unity2dApplication::Unity2dApplication(int& argc, char** argv)
67: QApplication(argc, argv)145: QApplication(argc, argv)
146, m_platformFontTracker(new PlatformFontTracker)
68{147{
69 /* Allow developers to run Unity 2D uninstalled by telling dconf-qt148 /* Allow developers to run Unity 2D uninstalled by telling dconf-qt
70 where to look for Unity 2D's schemas.149 where to look for Unity 2D's schemas.
@@ -73,11 +152,14 @@
73 if (!isRunningInstalled()) {152 if (!isRunningInstalled()) {
74 qputenv("GSETTINGS_SCHEMA_DIR", unity2dDirectory().toLocal8Bit() + "/data");153 qputenv("GSETTINGS_SCHEMA_DIR", unity2dDirectory().toLocal8Bit() + "/data");
75 }154 }
155
156 QAccessible::installFactory(panelFactory);
76}157}
77158
78Unity2dApplication::~Unity2dApplication()159Unity2dApplication::~Unity2dApplication()
79{160{
80 qDeleteAll(m_x11EventFilters);161 qDeleteAll(m_x11EventFilters);
162 delete m_platformFontTracker;
81}163}
82164
83Unity2dApplication* Unity2dApplication::instance()165Unity2dApplication* Unity2dApplication::instance()
84166
=== modified file 'libunity-2d-private/src/unity2dapplication.h'
--- libunity-2d-private/src/unity2dapplication.h 2011-07-18 13:47:29 +0000
+++ libunity-2d-private/src/unity2dapplication.h 2011-08-16 09:38:07 +0000
@@ -27,6 +27,8 @@
2727
28class Unity2dApplication;28class Unity2dApplication;
2929
30class PlatformFontTracker;
31
30class AbstractX11EventFilter32class AbstractX11EventFilter
31{33{
32public:34public:
@@ -65,6 +67,7 @@
6567
66private:68private:
67 QList<AbstractX11EventFilter*> m_x11EventFilters;69 QList<AbstractX11EventFilter*> m_x11EventFilters;
70 PlatformFontTracker* m_platformFontTracker;
68};71};
6972
70#endif // UNITY2DAPPLICATION_H73#endif // UNITY2DAPPLICATION_H
7174
=== modified file 'libunity-2d-private/src/windowinfo.cpp'
--- libunity-2d-private/src/windowinfo.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/windowinfo.cpp 2011-08-16 09:38:07 +0000
@@ -14,9 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include <libwnck/screen.h>17#include <libwnck/libwnck.h>
18#include <libwnck/window.h>
19#include <libwnck/workspace.h>
2018
21#include <glib-2.0/glib.h>19#include <glib-2.0/glib.h>
2220
2321
=== modified file 'libunity-2d-private/src/workspacesinfo.cpp'
--- libunity-2d-private/src/workspacesinfo.cpp 2011-07-29 13:49:34 +0000
+++ libunity-2d-private/src/workspacesinfo.cpp 2011-08-16 09:38:07 +0000
@@ -4,9 +4,7 @@
4#include <debug_p.h>4#include <debug_p.h>
55
6extern "C" {6extern "C" {
7#include <libwnck/screen.h>7#include <libwnck/libwnck.h>
8#include <libwnck/window.h>
9#include <libwnck/workspace.h>
10}8}
119
12#include <QAbstractEventDispatcher>10#include <QAbstractEventDispatcher>
1311
=== modified file 'panel/CMakeLists.txt'
--- panel/CMakeLists.txt 2011-06-27 13:40:51 +0000
+++ panel/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -1,5 +1,8 @@
1project(unity-2d-panel)1project(unity-2d-panel)
22
3# Dependencies
4pkg_check_modules(UNITYCORE REQUIRED unity-core-4.0)
5
3# Source6# Source
4include_directories(7include_directories(
5 ${libunity-2d-private_SOURCE_DIR}/src8 ${libunity-2d-private_SOURCE_DIR}/src
@@ -8,8 +11,3 @@
8add_subdirectory(applets)11add_subdirectory(applets)
9add_subdirectory(app)12add_subdirectory(app)
10add_subdirectory(tests)13add_subdirectory(tests)
11
12# Install
13install(DIRECTORY artwork
14 DESTINATION ${UNITY_2D_DIR}/panel
15 )
1614
=== modified file 'panel/app/CMakeLists.txt'
--- panel/app/CMakeLists.txt 2011-04-04 16:41:15 +0000
+++ panel/app/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -1,7 +1,6 @@
1set(panel_SRCS1set(panel_SRCS
2 main.cpp2 main.cpp
3 panelmanager.cpp3 panelmanager.cpp
4 unity2dstyle.cpp
5 )4 )
65
7qt4_automoc(${panel_SRCS})6qt4_automoc(${panel_SRCS})
@@ -10,14 +9,17 @@
10include_directories(9include_directories(
11 ${CMAKE_CURRENT_BINARY_DIR}10 ${CMAKE_CURRENT_BINARY_DIR}
12 ${CMAKE_CURRENT_SOURCE_DIR}11 ${CMAKE_CURRENT_SOURCE_DIR}
12 ${GTK_INCLUDE_DIRS}
13 ${uqapplets_SOURCE_DIR}13 ${uqapplets_SOURCE_DIR}
14 ${uqapplets_SOURCE_DIR}/common14 ${uqapplets_SOURCE_DIR}/common
15 ${UNITYCORE_INCLUDE_DIRS}
15 ${libunity-2d-private_SOURCE_DIR}/src16 ${libunity-2d-private_SOURCE_DIR}/src
16 )17 )
1718
18target_link_libraries(unity-2d-panel19target_link_libraries(unity-2d-panel
19 ${QT_QTGUI_LIBRARIES}20 ${QT_QTGUI_LIBRARIES}
20 ${QT_QTCORE_LIBRARIES}21 ${QT_QTCORE_LIBRARIES}
22 ${GTK_LDFLAGS}
21 uqapplets23 uqapplets
22 unity-2d-private24 unity-2d-private
23 )25 )
2426
=== modified file 'panel/app/main.cpp'
--- panel/app/main.cpp 2011-07-18 13:47:29 +0000
+++ panel/app/main.cpp 2011-08-16 09:38:07 +0000
@@ -22,12 +22,12 @@
22// Local22// Local
23#include <config.h>23#include <config.h>
24#include <panelmanager.h>24#include <panelmanager.h>
25#include <panelstyle.h>
2526
26// Unity27// Unity
27#include <gnomesessionclient.h>28#include <gnomesessionclient.h>
28#include <unity2ddebug.h>29#include <unity2ddebug.h>
29#include <unity2dapplication.h>30#include <unity2dapplication.h>
30#include <unity2dstyle.h>
31#include <unity2dtr.h>31#include <unity2dtr.h>
3232
33// Qt33// Qt
@@ -54,7 +54,10 @@
54 ThemeEngineHandler handler;54 ThemeEngineHandler handler;
55 Unity2dApplication::earlySetup(argc, argv);55 Unity2dApplication::earlySetup(argc, argv);
56 Unity2dApplication app(argc, argv);56 Unity2dApplication app(argc, argv);
57 QApplication::setStyle(new Unity2dStyle);57 app.setApplicationName("Unity 2D Panel");
58
59 // Instantiate a PanelStyle so that it configures QApplication
60 PanelStyle::instance();
5861
59 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-panel.desktop");62 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-panel.desktop");
60 client.connectToSessionManager();63 client.connectToSessionManager();
6164
=== modified file 'panel/app/panelmanager.cpp'
--- panel/app/panelmanager.cpp 2011-06-12 23:01:35 +0000
+++ panel/app/panelmanager.cpp 2011-08-16 09:38:07 +0000
@@ -24,11 +24,12 @@
2424
25// Local25// Local
26#include <config.h>26#include <config.h>
27#include <panelstyle.h>
28#include <indicatorsmanager.h>
2729
28// Applets30// Applets
29#include <appindicator/appindicatorapplet.h>31#include <appindicator/appindicatorapplet.h>
30#include <appname/appnameapplet.h>32#include <appname/appnameapplet.h>
31#include <homebutton/homebuttonapplet.h>
32#include <indicator/indicatorapplet.h>33#include <indicator/indicatorapplet.h>
33#include <legacytray/legacytrayapplet.h>34#include <legacytray/legacytrayapplet.h>
3435
@@ -42,54 +43,8 @@
4243
43using namespace Unity2d;44using namespace Unity2d;
4445
45static QPalette getPalette()
46{
47 QPalette palette;
48
49 /* Should use the panel's background provided by Unity but it turns
50 out not to be good. It would look like:
51
52 QBrush bg(QPixmap("theme:/panel_background.png"));
53 */
54 QBrush bg(QPixmap(unity2dDirectory() + "/panel/artwork/background.png"));
55 palette.setBrush(QPalette::Window, bg);
56 palette.setBrush(QPalette::Button, bg);
57 return palette;
58}
59
60static QLabel* createSeparator()
61{
62 QLabel* label = new QLabel;
63 QPixmap pix(unity2dDirectory() + "/panel/artwork/divider.png");
64 label->setPixmap(pix);
65 label->setFixedSize(pix.size());
66 return label;
67}
68
69static Unity2dPanel* instantiatePanel(int screen)
70{
71 Unity2dPanel* panel = new Unity2dPanel;
72 panel->setEdge(Unity2dPanel::TopEdge);
73 panel->setPalette(getPalette());
74 panel->setFixedHeight(24);
75
76 int leftmost = QApplication::desktop()->screenNumber(QPoint());
77 if (screen == leftmost) {
78 panel->addWidget(new HomeButtonApplet);
79 panel->addWidget(createSeparator());
80 }
81 panel->addWidget(new AppNameApplet);
82 if (screen == leftmost) {
83 /* It doesn’t make sense to have more than one instance of the systray,
84 XEmbed’ed windows can be displayed only once anyway. */
85 panel->addWidget(new LegacyTrayApplet);
86 }
87 panel->addWidget(new IndicatorApplet);
88 return panel;
89}
90
91PanelManager::PanelManager(QObject* parent)46PanelManager::PanelManager(QObject* parent)
92 : QObject(parent)47: QObject(parent)
93{48{
94 QDesktopWidget* desktop = QApplication::desktop();49 QDesktopWidget* desktop = QApplication::desktop();
95 for(int i = 0; i < desktop->screenCount(); ++i) {50 for(int i = 0; i < desktop->screenCount(); ++i) {
@@ -106,6 +61,26 @@
106 qDeleteAll(m_panels);61 qDeleteAll(m_panels);
107}62}
10863
64Unity2dPanel* PanelManager::instantiatePanel(int screen)
65{
66 Unity2dPanel* panel = new Unity2dPanel;
67 panel->setAccessibleName("Top Panel");
68 panel->setEdge(Unity2dPanel::TopEdge);
69 panel->setFixedHeight(24);
70
71 IndicatorsManager* indicatorsManager = new IndicatorsManager(panel);
72
73 panel->addWidget(new AppNameApplet(indicatorsManager));
74 int leftmost = QApplication::desktop()->screenNumber(QPoint());
75 if (screen == leftmost) {
76 /* It doesn’t make sense to have more than one instance of the systray,
77 XEmbed’ed windows can be displayed only once anyway. */
78 panel->addWidget(new LegacyTrayApplet);
79 }
80 panel->addWidget(new IndicatorApplet(indicatorsManager));
81 return panel;
82}
83
109void84void
110PanelManager::onScreenCountChanged(int newCount)85PanelManager::onScreenCountChanged(int newCount)
111{86{
11287
=== modified file 'panel/app/panelmanager.h'
--- panel/app/panelmanager.h 2011-04-04 16:41:15 +0000
+++ panel/app/panelmanager.h 2011-08-16 09:38:07 +0000
@@ -40,6 +40,8 @@
40 Q_DISABLE_COPY(PanelManager)40 Q_DISABLE_COPY(PanelManager)
41 QList<Unity2dPanel*> m_panels;41 QList<Unity2dPanel*> m_panels;
4242
43 Unity2dPanel* instantiatePanel(int screen);
44
43private Q_SLOTS:45private Q_SLOTS:
44 void onScreenCountChanged(int newCount);46 void onScreenCountChanged(int newCount);
45};47};
4648
=== removed file 'panel/app/unity2dstyle.cpp'
--- panel/app/unity2dstyle.cpp 2011-03-28 12:16:02 +0000
+++ panel/app/unity2dstyle.cpp 1970-01-01 00:00:00 +0000
@@ -1,98 +0,0 @@
1/*
2 * Plasma applet to display DBus global menu
3 *
4 * Copyright 2009 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
20 */
21
22// Self
23#include "unity2dstyle.h"
24
25// Local
26
27// libunity-2d-private
28#include <debug_p.h>
29#include <keyboardmodifiersmonitor.h>
30
31// Qt
32#include <QGtkStyle>
33#include <QMenu>
34#include <QPainter>
35#include <QStyleOptionFrame>
36#include <QWidget>
37
38Unity2dStyle::Unity2dStyle()
39: QProxyStyle(new QGtkStyle)
40{
41}
42
43void Unity2dStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
44{
45 if (element == QStyle::CE_MenuBarItem && widget) {
46 QStyleOptionMenuItem opt = *qstyleoption_cast<const QStyleOptionMenuItem*>(option);
47 if (!(opt.state & QStyle::State_Enabled) && (opt.state & QStyle::State_Sunken)) {
48 // Reset State_Sunken flag to avoid drawing a frame on a disabled menu item
49 // See https://bugs.launchpad.net/unity-2d/+bug/717744
50 opt.state ^= QStyle::State_Sunken;
51 }
52 // Skip "widget" parameter to avoid solid gray background behind the menubar items
53 QProxyStyle::drawControl(element, &opt, painter, 0);
54 } else if (element == QStyle::CE_MenuBarEmptyArea) {
55 // Avoid gray borders around the menubar items
56 } else {
57 QProxyStyle::drawControl(element, option, painter, widget);
58 }
59}
60
61int Unity2dStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
62{
63 if (metric == QStyle::PM_MenuBarVMargin) {
64 // Avoid one-pixel gap above menuitem
65 return 0;
66 } else {
67 return QProxyStyle::pixelMetric(metric, option, widget);
68 }
69}
70
71QSize Unity2dStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const
72{
73 QSize size = QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
74 if (type == QStyle::CT_MenuBarItem && widget) {
75 // Avoid three-pixel gap below menuitem
76 size.setHeight(widget->height());
77 }
78 return size;
79}
80
81int Unity2dStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const
82{
83 if (hint == QStyle::SH_UnderlineShortcut) {
84 // The shortcut of an opened menu can be triggered without holding Alt
85 // down, so we always show the underline. For all other widgets we only
86 // show the underlines if alt is down.
87 // Note that this is a bit hackish: it only works reliably if the
88 // widget repaints itself when alt is pressed or released. For now only
89 // the MenuBarWidget from the AppNameApplets does this.
90 if (qobject_cast<const QMenu*>(widget)) {
91 return true;
92 } else {
93 return KeyboardModifiersMonitor::instance()->keyboardModifiers() == Qt::AltModifier;
94 }
95 } else {
96 return QProxyStyle::styleHint(hint, option, widget, returnData);
97 }
98}
990
=== removed file 'panel/app/unity2dstyle.h'
--- panel/app/unity2dstyle.h 2011-01-26 15:50:26 +0000
+++ panel/app/unity2dstyle.h 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2010 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
20 */
21
22#ifndef UNITY2DSTYLE_H
23#define UNITY2DSTYLE_H
24
25// Local
26
27// Qt
28#include <QProxyStyle>
29
30class Unity2dStyle : public QProxyStyle
31{
32public:
33 Unity2dStyle();
34
35 virtual void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = 0) const;
36
37 virtual int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const;
38
39 virtual QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget = 0) const;
40
41 virtual int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const;
42};
43
44#endif /* UNITY2DSTYLE_H */
450
=== modified file 'panel/applets/CMakeLists.txt'
--- panel/applets/CMakeLists.txt 2011-07-18 10:33:35 +0000
+++ panel/applets/CMakeLists.txt 2011-08-16 09:38:07 +0000
@@ -1,42 +1,26 @@
1project(uqapplets)1project(uqapplets)
22
3macro(read_pkg_variable cmake_var pkg pkg_var)
4 execute_process(
5 COMMAND pkg-config --variable=${pkg_var} ${pkg}
6 OUTPUT_VARIABLE tmp
7 )
8 # Remove trailing newline from ${tmp}
9 string(STRIP "${tmp}" ${cmake_var})
10endmacro(read_pkg_variable)
11
12# Dependencies3# Dependencies
13include(FindPkgConfig)4include(FindPkgConfig)
145
15pkg_check_modules(QTBAMF REQUIRED libqtbamf)6pkg_check_modules(QTBAMF REQUIRED libqtbamf)
16pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)7pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)
17pkg_check_modules(INDICATOR REQUIRED indicator)
18
19# Get indicator dirs from pkgconfig
20read_pkg_variable(INDICATOR_DIR indicator indicatordir)
21read_pkg_variable(INDICATOR_ICONS_DIR indicator iconsdir)
22configure_file(indicator-config.h.in indicator-config.h)
238
24# Sources9# Sources
25set(uqapplets_SRCS10set(uqapplets_SRCS
26 appindicator/appindicatorapplet.cpp11 appindicator/appindicatorapplet.cpp
27 appindicator/sniitem.cpp12 appindicator/sniitem.cpp
28 appname/appnameapplet.cpp13 appname/appnameapplet.cpp
14 appname/croppedlabel.cpp
29 appname/menubarwidget.cpp15 appname/menubarwidget.cpp
30 appname/registrar.cpp
31 appname/windowhelper.cpp16 appname/windowhelper.cpp
32 common/applet.cpp17 common/applet.cpp
33 homebutton/homebuttonapplet.cpp18 common/indicatorentrywidget.cpp
34 homebutton/homebutton.cpp19 common/indicatorsmanager.cpp
35 indicator/abstractindicator.cpp20 common/indicatorwidget.cpp
36 indicator/datetimeindicator.cpp21 common/cairoutils.cpp
22 common/panelstyle.cpp
37 indicator/indicatorapplet.cpp23 indicator/indicatorapplet.cpp
38 indicator/indicatorservicemanager.cpp
39 indicator/indicator.c
40 legacytray/legacytrayapplet.cpp24 legacytray/legacytrayapplet.cpp
41 legacytray/fdoselectionmanager.cpp25 legacytray/fdoselectionmanager.cpp
42 legacytray/fdotask.cpp26 legacytray/fdotask.cpp
@@ -45,10 +29,6 @@
45 legacytray/x11embedpainter.cpp29 legacytray/x11embedpainter.cpp
46 )30 )
4731
48qt4_add_dbus_adaptor(uqapplets_SRCS appname/com.canonical.AppMenu.Registrar.xml
49 registrar.h Registrar
50 )
51
52qt4_automoc(${uqapplets_SRCS})32qt4_automoc(${uqapplets_SRCS})
5333
54# Build34# Build
@@ -56,15 +36,18 @@
56 ${CMAKE_CURRENT_SOURCE_DIR}/appindicator36 ${CMAKE_CURRENT_SOURCE_DIR}/appindicator
57 ${CMAKE_CURRENT_SOURCE_DIR}/appname37 ${CMAKE_CURRENT_SOURCE_DIR}/appname
58 ${CMAKE_CURRENT_SOURCE_DIR}/common38 ${CMAKE_CURRENT_SOURCE_DIR}/common
59 ${CMAKE_CURRENT_SOURCE_DIR}/homebutton
60 ${CMAKE_CURRENT_SOURCE_DIR}/indicator39 ${CMAKE_CURRENT_SOURCE_DIR}/indicator
40 ${CMAKE_CURRENT_SOURCE_DIR}/unitycore
61 ${QTBAMF_INCLUDE_DIRS}41 ${QTBAMF_INCLUDE_DIRS}
42 ${QTGCONF_INCLUDE_DIRS}
62 ${DBUSMENUQT_INCLUDE_DIRS}43 ${DBUSMENUQT_INCLUDE_DIRS}
63 ${GTK_INCLUDE_DIRS}44 ${GTK_INCLUDE_DIRS}
64 ${INDICATOR_INCLUDE_DIRS}
65 ${WNCK_INCLUDE_DIRS}45 ${WNCK_INCLUDE_DIRS}
66 ${CMAKE_CURRENT_BINARY_DIR}46 ${CMAKE_CURRENT_BINARY_DIR}
67 ${X11_INCLUDE_DIR}47 ${X11_INCLUDE_DIR}
48 ${UNITYCORE_INCLUDE_DIRS}
49 ${NUXCORE_INCLUDE_DIRS}
50 ${PANGO_INCLUDE_DIRS}
68 ${libunity-2d-private_SOURCE_DIR}/src51 ${libunity-2d-private_SOURCE_DIR}/src
69 )52 )
7053
@@ -75,13 +58,16 @@
75 ${QT_QTCORE_LIBRARIES}58 ${QT_QTCORE_LIBRARIES}
76 ${DBUSMENUQT_LDFLAGS}59 ${DBUSMENUQT_LDFLAGS}
77 ${QTBAMF_LDFLAGS}60 ${QTBAMF_LDFLAGS}
61 ${QTGCONF_LDFLAGS}
78 ${GTK_LDFLAGS}62 ${GTK_LDFLAGS}
79 ${INDICATOR_LDFLAGS}
80 ${WNCK_LDFLAGS}63 ${WNCK_LDFLAGS}
81 ${X11_LIBRARIES}64 ${X11_LIBRARIES}
82 ${X11_Xrender_LIB}65 ${X11_Xrender_LIB}
83 ${X11_Xcomposite_LIB}66 ${X11_Xcomposite_LIB}
84 ${X11_Xdamage_LIB}67 ${X11_Xdamage_LIB}
85 ${X11_Xfixes_LIB}68 ${X11_Xfixes_LIB}
69 ${UNITYCORE_LDFLAGS}
70 ${NUXCORE_LDFLAGS}
71 ${PANGO_LDFLAGS}
86 unity-2d-private72 unity-2d-private
87 )73 )
8874
=== modified file 'panel/applets/appname/appnameapplet.cpp'
--- panel/applets/appname/appnameapplet.cpp 2011-07-26 09:36:41 +0000
+++ panel/applets/appname/appnameapplet.cpp 2011-08-16 09:38:07 +0000
@@ -23,12 +23,15 @@
23#include "appnameapplet.h"23#include "appnameapplet.h"
2424
25// Local25// Local
26#include "croppedlabel.h"
26#include "menubarwidget.h"27#include "menubarwidget.h"
28#include "panelstyle.h"
27#include "windowhelper.h"29#include "windowhelper.h"
2830
29// Unity-2d31// Unity-2d
30#include <debug_p.h>32#include <debug_p.h>
31#include <keyboardmodifiersmonitor.h>33#include <keyboardmodifiersmonitor.h>
34#include <launcherclient.h>
3235
33// Bamf36// Bamf
34#include <bamf-application.h>37#include <bamf-application.h>
@@ -45,13 +48,7 @@
45#include <QApplication>48#include <QApplication>
46#include <QDesktopWidget>49#include <QDesktopWidget>
4750
48static const char* METACITY_DIR = "/usr/share/themes/Ambiance/metacity-1";51static const int APPNAME_LABEL_LEFT_MARGIN = 6;
49
50static const int WINDOW_BUTTONS_RIGHT_MARGIN = 4;
51
52static const int APPNAME_LABEL_LEFT_MARGIN = 12;
53
54static const int FADEOUT_WIDTH = 16;
5552
56namespace Unity2d53namespace Unity2d
57{54{
@@ -59,14 +56,16 @@
59class WindowButton : public QAbstractButton56class WindowButton : public QAbstractButton
60{57{
61public:58public:
62 WindowButton(const QString& prefix, QWidget* parent = 0)59 WindowButton(const PanelStyle::WindowButtonType& buttonType, QWidget* parent = 0)
63 : QAbstractButton(parent)60 : QAbstractButton(parent)
64 , m_prefix(prefix)61 , m_buttonType(buttonType)
65 , m_normalPix(loadPix("normal"))
66 , m_hoverPix(loadPix("prelight"))
67 , m_downPix(loadPix("pressed"))
68 {62 {
69 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);63 loadPixmaps();
64 if (buttonType == PanelStyle::MinimizeWindowButton) {
65 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
66 } else {
67 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
68 }
70 setAttribute(Qt::WA_Hover);69 setAttribute(Qt::WA_Hover);
71 }70 }
7271
@@ -76,6 +75,14 @@
76 }75 }
7776
78protected:77protected:
78 bool event(QEvent* ev)
79 {
80 if (ev->type() == QEvent::PaletteChange) {
81 loadPixmaps();
82 }
83 return QAbstractButton::event(ev);
84 }
85
79 void paintEvent(QPaintEvent*)86 void paintEvent(QPaintEvent*)
80 {87 {
81 QPainter painter(this);88 QPainter painter(this);
@@ -87,66 +94,27 @@
87 } else {94 } else {
88 pix = m_normalPix;95 pix = m_normalPix;
89 }96 }
90 painter.drawPixmap((width() - pix.width()) / 2, (height() - pix.height()) / 2, pix);97 int posX;
98 if (m_buttonType == PanelStyle::CloseWindowButton) {
99 posX = width() - pix.width();
100 } else {
101 posX = 0;
102 }
103 painter.drawPixmap(posX, (height() - pix.height()) / 2, pix);
91 }104 }
92105
93private:106private:
94 QString m_prefix;107 PanelStyle::WindowButtonType m_buttonType;
95 QPixmap m_normalPix;108 QPixmap m_normalPix;
96 QPixmap m_hoverPix;109 QPixmap m_hoverPix;
97 QPixmap m_downPix;110 QPixmap m_downPix;
98111
99 QPixmap loadPix(const QString& name)112 void loadPixmaps()
100 {113 {
101 QString path = QString("%1/%2_focused_%3.png")114 PanelStyle* style = PanelStyle::instance();
102 .arg(METACITY_DIR)115 m_normalPix = style->windowButtonPixmap(m_buttonType, PanelStyle::NormalState);
103 .arg(m_prefix)116 m_hoverPix = style->windowButtonPixmap(m_buttonType, PanelStyle::PrelightState);
104 .arg(name);117 m_downPix = style->windowButtonPixmap(m_buttonType, PanelStyle::PressedState);
105 return QPixmap(path);
106 }
107};
108
109/**
110 * This label makes sure minimumSizeHint() is not set. This ensures the applet
111 * does not get wider if a window title is very long
112 */
113class CroppedLabel : public QLabel
114{
115public:
116 CroppedLabel(QWidget* parent = 0)
117 : QLabel(parent)
118 {}
119
120 QSize minimumSizeHint() const
121 {
122 return QWidget::minimumSizeHint();
123 }
124
125protected:
126 void paintEvent(QPaintEvent* event)
127 {
128 QImage image(width(), height(), QImage::Format_ARGB32_Premultiplied);
129 {
130 QPainter painter(&image);
131 painter.initFrom(this);
132 painter.setCompositionMode(QPainter::CompositionMode_Source);
133 painter.fillRect(rect(), Qt::transparent);
134
135 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
136 painter.drawText(contentsRect(), Qt::AlignLeft | Qt::AlignVCenter, text());
137
138 if (QLabel::minimumSizeHint().width() > contentsRect().width()) {
139 // Text does not fit, fade the end
140 painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
141 QRect gradientRect(width() - FADEOUT_WIDTH, 0, FADEOUT_WIDTH, height());
142 QLinearGradient gradient(gradientRect.topLeft(), gradientRect.topRight());
143 gradient.setColorAt(0, Qt::white);
144 gradient.setColorAt(1, Qt::transparent);
145 painter.fillRect(gradientRect, gradient);
146 }
147 }
148 QPainter painter(this);
149 painter.drawImage(0, 0, image);
150 }118 }
151};119};
152120
@@ -178,14 +146,15 @@
178 m_windowButtonWidget = new QWidget;146 m_windowButtonWidget = new QWidget;
179 m_windowButtonWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);147 m_windowButtonWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
180 QHBoxLayout* layout = new QHBoxLayout(m_windowButtonWidget);148 QHBoxLayout* layout = new QHBoxLayout(m_windowButtonWidget);
181 layout->setContentsMargins(0, 0, WINDOW_BUTTONS_RIGHT_MARGIN, 0);149 layout->setMargin(0);
182 layout->setSpacing(0);150 layout->setSpacing(0);
183 m_closeButton = new WindowButton("close");151 m_closeButton = new WindowButton(PanelStyle::CloseWindowButton);
184 m_minimizeButton = new WindowButton("minimize");152 m_minimizeButton = new WindowButton(PanelStyle::MinimizeWindowButton);
185 m_maximizeButton = new WindowButton("unmaximize");153 m_maximizeButton = new WindowButton(PanelStyle::UnmaximizeWindowButton);
186 layout->addWidget(m_closeButton);154 layout->addWidget(m_closeButton);
187 layout->addWidget(m_minimizeButton);155 layout->addWidget(m_minimizeButton);
188 layout->addWidget(m_maximizeButton);156 layout->addWidget(m_maximizeButton);
157 m_windowButtonWidget->setFixedWidth(LauncherClient::MaximumWidth);
189 QObject::connect(m_closeButton, SIGNAL(clicked()), m_windowHelper, SLOT(close()));158 QObject::connect(m_closeButton, SIGNAL(clicked()), m_windowHelper, SLOT(close()));
190 QObject::connect(m_minimizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(minimize()));159 QObject::connect(m_minimizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(minimize()));
191 QObject::connect(m_maximizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(unmaximize()));160 QObject::connect(m_maximizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(unmaximize()));
@@ -200,10 +169,10 @@
200 q, SLOT(updateWidgets()));169 q, SLOT(updateWidgets()));
201 }170 }
202171
203 void setupMenuBarWidget()172 void setupMenuBarWidget(IndicatorsManager* manager)
204 {173 {
205 m_menuBarWidget = new MenuBarWidget(0 /* Window menu */);174 m_menuBarWidget = new MenuBarWidget(manager);
206 QObject::connect(m_menuBarWidget, SIGNAL(menuBarClosed()),175 QObject::connect(m_menuBarWidget, SIGNAL(isOpenedChanged()),
207 q, SLOT(updateWidgets()));176 q, SLOT(updateWidgets()));
208 QObject::connect(m_menuBarWidget, SIGNAL(isEmptyChanged()),177 QObject::connect(m_menuBarWidget, SIGNAL(isEmptyChanged()),
209 q, SLOT(updateWidgets()));178 q, SLOT(updateWidgets()));
@@ -216,27 +185,22 @@
216 }185 }
217};186};
218187
219AppNameApplet::AppNameApplet()188AppNameApplet::AppNameApplet(IndicatorsManager* indicatorsManager)
220: d(new AppNameAppletPrivate)189: d(new AppNameAppletPrivate)
221{190{
222 d->q = this;191 d->q = this;
223 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);192 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
224193
225 QPalette palette;
226 palette.setColor(QPalette::WindowText, Qt::white);
227 palette.setColor(QPalette::ButtonText, Qt::white);
228 setPalette(palette);
229
230 d->setupWindowHelper();194 d->setupWindowHelper();
231 d->setupLabel();195 d->setupLabel();
232 d->setupWindowButtonWidget();196 d->setupWindowButtonWidget();
233 d->setupMenuBarWidget();197 d->setupMenuBarWidget(indicatorsManager);
234 d->setupKeyboardModifiersMonitor();198 d->setupKeyboardModifiersMonitor();
235199
236 QHBoxLayout* layout = new QHBoxLayout(this);200 QHBoxLayout* layout = new QHBoxLayout(this);
237 layout->setMargin(0);201 layout->setMargin(0);
238 layout->setSpacing(0);202 layout->setSpacing(0);
239 layout->addWidget(d->m_windowButtonWidget, 0, Qt::AlignLeft);203 layout->addWidget(d->m_windowButtonWidget);
240 layout->addWidget(d->m_label);204 layout->addWidget(d->m_label);
241 layout->addWidget(d->m_menuBarWidget);205 layout->addWidget(d->m_menuBarWidget);
242206
@@ -255,14 +219,15 @@
255 bool isMaximized = d->m_windowHelper->isMaximized();219 bool isMaximized = d->m_windowHelper->isMaximized();
256 bool isUserVisibleApp = app ? app->user_visible() : false;220 bool isUserVisibleApp = app ? app->user_visible() : false;
257 bool isOnSameScreen = d->m_windowHelper->isMostlyOnScreen(QApplication::desktop()->screenNumber(this));221 bool isOnSameScreen = d->m_windowHelper->isMostlyOnScreen(QApplication::desktop()->screenNumber(this));
222 bool isUnderMouse = rect().contains(mapFromGlobal(QCursor::pos()));
258 bool showMenu = (!d->m_menuBarWidget->isEmpty() && isUserVisibleApp && isOnSameScreen)223 bool showMenu = (!d->m_menuBarWidget->isEmpty() && isUserVisibleApp && isOnSameScreen)
259 && (rect().contains(mapFromGlobal(QCursor::pos()))224 && (isUnderMouse
260 || KeyboardModifiersMonitor::instance()->keyboardModifiers() == Qt::AltModifier225 || KeyboardModifiersMonitor::instance()->keyboardModifiers() == Qt::AltModifier
261 || d->m_menuBarWidget->isOpened()226 || d->m_menuBarWidget->isOpened()
262 );227 );
263 bool showLabel = !(isMaximized && showMenu) && isUserVisibleApp && isOnSameScreen;228 bool showLabel = !(isMaximized && showMenu) && isUserVisibleApp && isOnSameScreen;
264229
265 d->m_windowButtonWidget->setVisible(isOnSameScreen && isMaximized);230 d->m_windowButtonWidget->setVisible(isOnSameScreen && isMaximized && isUnderMouse);
266231
267 d->m_label->setVisible(showLabel);232 d->m_label->setVisible(showLabel);
268 if (showLabel) {233 if (showLabel) {
@@ -284,7 +249,7 @@
284249
285 // Define width250 // Define width
286 if (!isMaximized && showMenu) {251 if (!isMaximized && showMenu) {
287 d->m_label->setMaximumWidth(d->m_windowButtonWidget->sizeHint().width());252 d->m_label->setMaximumWidth(LauncherClient::MaximumWidth);
288 } else {253 } else {
289 d->m_label->setMaximumWidth(QWIDGETSIZE_MAX);254 d->m_label->setMaximumWidth(QWIDGETSIZE_MAX);
290 }255 }
291256
=== modified file 'panel/applets/appname/appnameapplet.h'
--- panel/applets/appname/appnameapplet.h 2011-06-06 09:06:55 +0000
+++ panel/applets/appname/appnameapplet.h 2011-08-16 09:38:07 +0000
@@ -29,6 +29,8 @@
2929
30class QEvent;30class QEvent;
3131
32class IndicatorsManager;
33
32namespace Unity2d34namespace Unity2d
33{35{
3436
@@ -37,7 +39,7 @@
37{39{
38Q_OBJECT40Q_OBJECT
39public:41public:
40 AppNameApplet();42 AppNameApplet(IndicatorsManager*);
41 ~AppNameApplet();43 ~AppNameApplet();
4244
43protected:45protected:
4446
=== removed file 'panel/applets/appname/com.canonical.AppMenu.Registrar.xml'
--- panel/applets/appname/com.canonical.AppMenu.Registrar.xml 2011-02-10 01:10:19 +0000
+++ panel/applets/appname/com.canonical.AppMenu.Registrar.xml 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
2<node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
3 <dox:d><![CDATA[
4 @mainpage
5  
6 An interface to register menus that are associated with a window in an application.  The
7 main interface is docuemented here: @ref com::canonical::AppMenu::Registrar.
8     
9 The actual menus are transported using the dbusmenu protocol which is available
10 here: @ref com::canonical::dbusmenu.
11 ]]></dox:d>
12 <interface name="com.canonical.AppMenu.Registrar" xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
13 <dox:d>
14 An interface to register a menu from an application's window to be displayed in another
15 window.  This manages that association between XWindow Window IDs and the dbus
16 address and object that provides the menu using the dbusmenu dbus interface.
17 </dox:d>
18 <method name="RegisterWindow">
19 <dox:d><![CDATA[
20 Associates a dbusmenu with a window
21      
22 /note this method assumes that the connection from the caller is the DBus connection
23 to use for the object.  Applications that use multiple DBus connections will need to
24 ensure this method is called with the same connection that implmenets the object.
25 ]]></dox:d>
26 <arg name="windowId" type="u" direction="in">
27 <dox:d>The XWindow ID of the window</dox:d>
28 </arg>
29 <arg name="menuObjectPath" type="o" direction="in">
30 <dox:d>The object on the dbus interface implementing the dbusmenu interface</dox:d>
31 </arg>
32 </method>
33 <method name="UnregisterWindow">
34 <dox:d>
35 A method to allow removing a window from the database. Windows will also be removed
36 when the client drops off DBus so this is not required. It is polite though. And
37 important for testing.
38 </dox:d>
39 <arg name="windowId" type="u" direction="in">
40 <dox:d>The XWindow ID of the window</dox:d>
41 </arg>
42 </method>
43 <method name="GetMenuForWindow">
44 <dox:d>Gets the registered menu for a given window ID.</dox:d>
45 <arg name="windowId" type="u" direction="in">
46 <dox:d>The XWindow ID of the window to get</dox:d>
47 </arg>
48 <arg name="service" type="s" direction="out">
49 <dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
50 </arg>
51 <arg name="menuObjectPath" type="o" direction="out">
52 <dox:d>The path to the object which implements the com.canonical.dbusmenu interface.</dox:d>
53 </arg>
54 </method>
55 <method name="GetMenus">
56 <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MenuInfoList"/>
57 <dox:d>Gets the information on all menus that the registrar knows about. This
58 is useful for debugging or bringing up a new renderer.</dox:d>
59 <arg name="menus" type="a(uso)" direction="out">
60 <dox:d>An array of structures containing the same parameters as @GetMenuForWindow. Window ID, Service and ObjectPath.</dox:d>
61 </arg>
62 </method>
63 <signal name="WindowRegistered">
64 <dox:d>Signals when the registrar gets a new menu registered</dox:d>
65 <arg name="windowId" type="u" direction="out">
66 <dox:d>The XWindow ID of the window</dox:d>
67 </arg>
68 <arg name="service" type="s" direction="out">
69 <dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
70 </arg>
71 <arg name="menuObjectPath" type="o" direction="out">
72 <dox:d>The path to the object which implements the com.canonical.dbusmenu interface.</dox:d>
73 </arg>
74 </signal>
75 <signal name="WindowUnregistered">
76 <dox:d>Signals when the registrar removes a menu registration</dox:d>
77 <arg name="windowId" type="u" direction="out">
78 <dox:d>The XWindow ID of the window</dox:d>
79 </arg>
80 </signal>
81 </interface>
82</node>
830
=== added file 'panel/applets/appname/croppedlabel.cpp'
--- panel/applets/appname/croppedlabel.cpp 1970-01-01 00:00:00 +0000
+++ panel/applets/appname/croppedlabel.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,140 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21// Self
22#include "croppedlabel.h"
23
24// Local
25#include <cairoutils.h>
26#include <panelstyle.h>
27
28// unity-2d
29#include <debug_p.h>
30
31// libqtgconf
32#include <gconfitem-qml-wrapper.h>
33
34// Qt
35#include <QImage>
36#include <QPainter>
37
38// GTK
39#include <gtk/gtk.h>
40
41static const int FADEOUT_WIDTH = 30;
42
43static const char* WINDOW_TITLE_FONT_KEY = "/apps/metacity/general/titlebar_font";
44
45CroppedLabel::CroppedLabel(QWidget* parent)
46: QLabel(parent)
47{
48}
49
50QSize CroppedLabel::minimumSizeHint() const
51{
52 return QWidget::minimumSizeHint();
53}
54
55static void paintFadeoutGradient(QImage* image)
56{
57 QPainter painter(image);
58 painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
59 QRect gradientRect(image->width() - FADEOUT_WIDTH, 0, FADEOUT_WIDTH, image->height());
60 QLinearGradient gradient(gradientRect.topLeft(), gradientRect.topRight());
61 gradient.setColorAt(0, Qt::white);
62 gradient.setColorAt(1, Qt::transparent);
63 painter.fillRect(gradientRect, gradient);
64}
65
66static QString getWindowTitleFontName()
67{
68 GConfItemQmlWrapper client;
69 client.setKey(WINDOW_TITLE_FONT_KEY);
70 return client.getValue().toString();
71}
72
73void CroppedLabel::paintEvent(QPaintEvent* event)
74{
75 // Create an image filled with background brush (to avoid subpixel hinting
76 // artefacts around text)
77 QImage image(width(), height(), QImage::Format_ARGB32_Premultiplied);
78 {
79 QPainter painter(&image);
80 painter.initFrom(this);
81 painter.eraseRect(rect());
82 }
83
84 // Create a pango layout
85 GObjectScopedPointer<PangoContext> pangoContext(gdk_pango_context_get());
86 GObjectScopedPointer<PangoLayout> layout(pango_layout_new(pangoContext.data()));
87
88 // Set font
89 QByteArray fontName = getWindowTitleFontName().toUtf8();
90 PangoFontDescription* desc = pango_font_description_from_string(fontName.data());
91 pango_layout_set_font_description(layout.data(), desc);
92 pango_font_description_free(desc);
93
94 // Set text
95 QByteArray utf8Text = text().toUtf8();
96 pango_layout_set_text (layout.data(), utf8Text.data(), -1);
97
98 // Get text size
99 int textWidth = 0;
100 int textHeight = 0;
101 pango_layout_get_pixel_size(layout.data(), &textWidth, &textHeight);
102
103 // Draw text
104 CairoUtils::SurfacePointer surface(CairoUtils::createSurfaceForQImage(&image));
105 CairoUtils::Pointer cr(cairo_create(surface.data()));
106
107 PanelStyle* style = PanelStyle::instance();
108 GtkStyleContext* style_context = style->styleContext();
109
110 gtk_style_context_save(style_context);
111
112 GtkWidgetPath* widget_path = gtk_widget_path_new();
113 gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
114 gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
115 gtk_widget_path_iter_set_name(widget_path, -1 , "UnityPanelWidget");
116
117 gtk_style_context_set_path(style_context, widget_path);
118 gtk_style_context_add_class(style_context, GTK_STYLE_CLASS_MENUBAR);
119 gtk_style_context_add_class(style_context, GTK_STYLE_CLASS_MENUITEM);
120
121 gtk_render_layout(style_context, cr.data(),
122 contentsRect().left(),
123 contentsRect().top() + (height() - textHeight) / 2,
124 layout.data());
125
126 gtk_widget_path_free(widget_path);
127
128 gtk_style_context_restore(style_context);
129
130 // Fade if necessary
131 if (textWidth > contentsRect().width()) {
132 paintFadeoutGradient(&image);
133 }
134
135 // Paint on our widget
136 QPainter painter(this);
137 painter.drawImage(0, 0, image);
138}
139
140#include "croppedlabel.moc"
0141
=== added file 'panel/applets/appname/croppedlabel.h'
--- panel/applets/appname/croppedlabel.h 1970-01-01 00:00:00 +0000
+++ panel/applets/appname/croppedlabel.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,45 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef CROPPEDLABEL_H
22#define CROPPEDLABEL_H
23
24// Local
25
26// Qt
27#include <QLabel>
28
29/**
30 * This label makes sure minimumSizeHint() is not set. This ensures the applet
31 * does not get wider if a window title is very long
32 */
33class CroppedLabel : public QLabel
34{
35 Q_OBJECT
36public:
37 CroppedLabel(QWidget* parent = 0);
38
39 QSize minimumSizeHint() const;
40
41protected:
42 void paintEvent(QPaintEvent*);
43};
44
45#endif /* CROPPEDLABEL_H */
046
=== modified file 'panel/applets/appname/menubarwidget.cpp'
--- panel/applets/appname/menubarwidget.cpp 2011-07-26 09:36:41 +0000
+++ panel/applets/appname/menubarwidget.cpp 2011-08-16 09:38:07 +0000
@@ -20,299 +20,98 @@
20 */20 */
2121
22// Self22// Self
23#include "menubarwidget.h"23#include <menubarwidget.h>
2424
25// Local25// Local
26#include "config.h"26#include <debug_p.h>
27#include "debug_p.h"27#include <indicatorentrywidget.h>
28#include "keyboardmodifiersmonitor.h"28#include <indicatorsmanager.h>
29#include "registrar.h"
30
31// dbusmenu-qt
32#include <dbusmenuimporter.h>
33
34// bamf
35#include <bamf-matcher.h>
36#include <bamf-window.h>
3729
38// Qt30// Qt
39#include <QActionEvent>
40#include <QHBoxLayout>31#include <QHBoxLayout>
41#include <QLabel>32
42#include <QMenuBar>33static const int MENU_ITEM_PADDING = 6;
43#include <QTimer>34
4435MenuBarWidget::MenuBarWidget(IndicatorsManager* indicatorsManager, QWidget* parent)
45class MyDBusMenuImporter : public DBusMenuImporter
46{
47public:
48 MyDBusMenuImporter(const QString &service, const QString &path, QObject *parent)
49 : DBusMenuImporter(service, path, parent)
50 , m_service(service)
51 , m_path(path)
52 {}
53
54 QString service() const { return m_service; }
55 QString path() const { return m_path; }
56
57private:
58 QString m_service;
59 QString m_path;
60};
61
62MenuBarWidget::MenuBarWidget(QMenu* windowMenu, QWidget* parent)
63: QWidget(parent)36: QWidget(parent)
64, m_windowMenu(windowMenu)37, m_indicatorsManager(indicatorsManager)
65{38, m_layout(new QHBoxLayout(this))
66 m_activeWinId = 0;39, m_isEmpty(true)
67 setupRegistrar();40, m_isOpened(false)
68 setupMenuBar();41{
6942 m_layout->setMargin(0);
70 connect(&BamfMatcher::get_default(), SIGNAL(ActiveWindowChanged(BamfWindow*, BamfWindow*)),43 m_layout->setSpacing(0);
71 SLOT(slotActiveWindowChanged(BamfWindow*, BamfWindow*)));44 indicatorsManager->indicators()->on_object_added.connect(
72 /* Work around a bug in BAMF: the ActiveWindowChanged signal is not emitted45 sigc::mem_fun(this, &MenuBarWidget::onObjectAdded)
73 for some windows that open maximized. This is for example the case of the46 );
74 LibreOffice startcenter. */47 indicatorsManager->indicators()->on_entry_activated.connect(
75 connect(&BamfMatcher::get_default(), SIGNAL(ViewOpened(BamfView*)),48 sigc::mem_fun(this, &MenuBarWidget::onEntryActivated)
76 SLOT(slotViewOpened()));49 );
77 updateActiveWinId(BamfMatcher::get_default().active_window());50 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
78}51 m_layout->addStretch();
79
80void MenuBarWidget::setupRegistrar()
81{
82 m_registrar = Registrar::instance();
83 if (!m_registrar->connectToBus()) {
84 UQ_WARNING << "could not connect registrar to DBus";
85 }
86
87 connect(m_registrar, SIGNAL(WindowRegistered(WId, const QString&, const QDBusObjectPath&)),
88 SLOT(slotWindowRegistered(WId, const QString&, const QDBusObjectPath&)));
89 connect(m_registrar, SIGNAL(WindowUnregistered(WId)),
90 SLOT(slotWindowUnregistered(WId)));
91}
92
93void MenuBarWidget::setupMenuBar()
94{
95 m_menuBar = new QMenuBar;
96 new MenuBarClosedHelper(this);
97
98 QHBoxLayout* layout = new QHBoxLayout(this);
99 layout->setMargin(0);
100 layout->setSpacing(0);
101 layout->addWidget(m_menuBar);
102 m_menuBar->setNativeMenuBar(false);
103
104 m_updateMenuBarTimer = new QTimer(this);
105 m_updateMenuBarTimer->setSingleShot(true);
106 m_updateMenuBarTimer->setInterval(0);
107 connect(m_updateMenuBarTimer, SIGNAL(timeout()),
108 SLOT(updateMenuBar()));
109
110 // Repaint the menubar when modifiers change so that the shortcut underline
111 // is drawn or not
112 connect(KeyboardModifiersMonitor::instance(), SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
113 m_menuBar, SLOT(update()));
114}
115
116void MenuBarWidget::slotActiveWindowChanged(BamfWindow* /*former*/, BamfWindow* current)
117{
118 if (current) {
119 updateActiveWinId(current);
120 }
121}
122
123void MenuBarWidget::slotViewOpened()
124{
125 BamfWindow* active = BamfMatcher::get_default().active_window();
126 if (active != NULL) {
127 if (active->xid() != m_activeWinId) {
128 /* This shouldn’t be needed as BAMF should have emitted the
129 ActiveWindowChanged signal, but it sometimes doesn’t (e.g. when
130 LibreOffice startcenter starts automatically maximized). */
131 updateActiveWinId(active);
132 }
133 }
134}
135
136void MenuBarWidget::slotWindowRegistered(WId wid, const QString& service, const QDBusObjectPath& menuObjectPath)
137{
138 MyDBusMenuImporter* importer = new MyDBusMenuImporter(service, menuObjectPath.path(), this);
139 delete m_importers.take(wid);
140 m_importers.insert(wid, importer);
141 connect(importer, SIGNAL(menuUpdated()), SLOT(slotMenuUpdated()));
142 connect(importer, SIGNAL(actionActivationRequested(QAction*)), SLOT(slotActionActivationRequested(QAction*)));
143 QMetaObject::invokeMethod(importer, "updateMenu", Qt::QueuedConnection);
144}
145
146void MenuBarWidget::slotWindowUnregistered(WId wid)
147{
148 MyDBusMenuImporter* importer = m_importers.take(wid);
149 if (importer) {
150 importer->deleteLater();
151 }
152 if (wid == m_activeWinId) {
153 m_activeWinId = 0;
154 updateMenuBar();
155 }
156}
157
158void MenuBarWidget::slotMenuUpdated()
159{
160 DBusMenuImporter* importer = static_cast<DBusMenuImporter*>(sender());
161
162 if (m_importers.value(m_activeWinId) == importer) {
163 updateMenuBar();
164 }
165}
166
167void MenuBarWidget::slotActionActivationRequested(QAction* action)
168{
169 DBusMenuImporter* importer = static_cast<DBusMenuImporter*>(sender());
170
171 if (m_importers.value(m_activeWinId) == importer) {
172 m_menuBar->setActiveAction(action);
173 }
174}
175
176QMenu* MenuBarWidget::menuForWinId(WId wid) const
177{
178 MyDBusMenuImporter* importer = m_importers.value(wid);
179 return importer ? importer->menu() : 0;
180}
181
182void MenuBarWidget::updateActiveWinId(BamfWindow* bamfWindow)
183{
184 WId id = bamfWindow ? bamfWindow->xid() : 0;
185 if (id == m_activeWinId) {
186 return;
187 }
188 if (id == window()->winId()) {
189 // Do not update id if the active window is the one hosting this applet
190 return;
191 }
192 m_activeWinId = id;
193 updateMenuBar();
194}
195
196void MenuBarWidget::updateMenuBar()
197{
198 WId winId = m_activeWinId;
199 QMenu* menu = menuForWinId(winId);
200
201 if (!menu) {
202 if (winId) {
203 menu = m_windowMenu;
204 } else {
205 // No active window, show a desktop menubar
206 // FIXME: Empty menu
207 /*
208 menu = mEmptyMenu;
209 */
210 }
211 }
212
213 m_menuBar->clear();
214 // FIXME: Empty menu
215 if (!menu) {
216 return;
217 }
218 menu->installEventFilter(this);
219 Q_FOREACH(QAction* action, menu->actions()) {
220 if (action->isSeparator()) {
221 continue;
222 }
223 m_menuBar->addAction(action);
224 }
225}
226
227bool MenuBarWidget::eventFilter(QObject* object, QEvent* event)
228{
229 switch (event->type()) {
230 case QEvent::ActionAdded:
231 case QEvent::ActionRemoved:
232 case QEvent::ActionChanged:
233 m_updateMenuBarTimer->start();
234 break;
235 default:
236 break;
237 }
238 return false;
239}52}
24053
241bool MenuBarWidget::isEmpty() const54bool MenuBarWidget::isEmpty() const
242{55{
243 return m_menuBar->actions().isEmpty();56 return m_isEmpty;
244}57}
24558
246bool MenuBarWidget::isOpened() const59bool MenuBarWidget::isOpened() const
247{60{
248 return m_menuBar->activeAction();61 return m_isOpened;
249}62}
25063
251// MenuBarClosedHelper ----------------------------------------64void MenuBarWidget::onObjectAdded(const unity::indicator::Indicator::Ptr& indicator)
252MenuBarClosedHelper::MenuBarClosedHelper(MenuBarWidget* widget)65{
253: QObject(widget)66 QString name = QString::fromStdString(indicator->name());
254, m_widget(widget)67 if (name == "libappmenu.so") {
255{68 indicator->on_entry_added.connect(sigc::mem_fun(this, &MenuBarWidget::onEntryAdded));
256 widget->m_menuBar->installEventFilter(this);69 }
257}70}
25871
259bool MenuBarClosedHelper::eventFilter(QObject* object, QEvent* event)72void MenuBarWidget::onEntryAdded(const unity::indicator::Entry::Ptr& entry)
260{73{
261 if (object == m_widget->m_menuBar) {74 IndicatorEntryWidget* widget = new IndicatorEntryWidget(entry);
262 switch (event->type()) {75 widget->setPadding(MENU_ITEM_PADDING);
263 case QEvent::ActionAdded:76 connect(widget, SIGNAL(isEmptyChanged()), SLOT(updateIsEmpty()));
264 case QEvent::ActionRemoved:77
265 case QEvent::ActionChanged:78 m_widgetList.append(widget);
266 menuBarActionEvent(static_cast<QActionEvent*>(event));79 m_indicatorsManager->addIndicatorEntryWidget(widget);
267 break;80
268 default:81 // Insert *before* stretch
269 break;82 m_layout->insertWidget(m_layout->count() - 1, widget);
270 }83}
271 } else {84
272 // Top-level menus85void MenuBarWidget::updateIsEmpty()
273 if (event->type() == QEvent::Hide) {86{
274 // menu hide themselves when the menubar is closed but also when87 bool empty = true;
275 // one goes from one menu to another. The way to know this is to88 Q_FOREACH(IndicatorEntryWidget* widget, m_widgetList) {
276 // check the value of QMenuBar::activeAction(), but at this point89 if (!widget->isEmpty()) {
277 // it has not been updated yet, so we check in a delayed method.90 empty = false;
278 QMetaObject::invokeMethod(this, "emitMenuBarClosed", Qt::QueuedConnection);91 break;
279 }92 }
280 }93 }
281 return false;94 if (m_isEmpty != empty) {
282}95 m_isEmpty = empty;
28396 isEmptyChanged();
284void MenuBarClosedHelper::emitMenuBarClosed()97 }
285{98}
286 if (!m_widget->m_menuBar->activeAction()) {99
287 QMetaObject::invokeMethod(m_widget, "menuBarClosed");100void MenuBarWidget::onEntryActivated(const std::string& id)
288 }101{
289}102 bool isOpened = false;
290103 if (!id.empty()) {
291void MenuBarClosedHelper::menuBarActionEvent(QActionEvent* event)104 // We only cares about menubar entries
292{105 Q_FOREACH(IndicatorEntryWidget* widget, m_widgetList) {
293 QMenu* menu = event->action()->menu();106 if (widget->entry()->id() == id) {
294 if (menu) {107 isOpened = true;
295 // Install/remove event filters on top level menus so that know when108 break;
296 // they hide themselves and can emit menuBarClosed()109 }
297 switch (event->type()) {110 }
298 case QEvent::ActionAdded:111 }
299 case QEvent::ActionChanged:112 if (m_isOpened != isOpened) {
300 menu->installEventFilter(this);113 m_isOpened = isOpened;
301 break;114 isOpenedChanged();
302 case QEvent::ActionRemoved:
303 menu->removeEventFilter(this);
304 break;
305 default:
306 break;
307 }
308 }
309
310 // Emit isEmptyChanged() if necessary
311 QList<QAction*> actions = m_widget->m_menuBar->actions();
312 if (event->type() == QEvent::ActionAdded && actions.count() == 1) {
313 QMetaObject::invokeMethod(m_widget, "isEmptyChanged");
314 } else if (event->type() == QEvent::ActionRemoved && actions.isEmpty()) {
315 QMetaObject::invokeMethod(m_widget, "isEmptyChanged");
316 }115 }
317}116}
318117
319118
=== modified file 'panel/applets/appname/menubarwidget.h'
--- panel/applets/appname/menubarwidget.h 2011-07-26 09:36:41 +0000
+++ panel/applets/appname/menubarwidget.h 2011-08-16 09:38:07 +0000
@@ -23,86 +23,45 @@
23#define MENUBARWIDGET_H23#define MENUBARWIDGET_H
2424
25// Qt25// Qt
26#include <QHash>
27#include <QWidget>26#include <QWidget>
2827
29class BamfWindow;28// libunity-core
3029#include <UnityCore/Indicator.h>
31class QActionEvent;30#include <UnityCore/IndicatorEntry.h>
32class QDBusObjectPath;31
33class QMenu;32class QHBoxLayout;
34class QMenuBar;33
35class QTimer;34class IndicatorEntryWidget;
3635class IndicatorsManager;
37class MyDBusMenuImporter;36
38class Registrar;37class MenuBarWidget : public QWidget, public sigc::trackable
3938{
40typedef QHash<WId, MyDBusMenuImporter*> ImporterForWId;39Q_OBJECT
4140public:
42class MenuBarWidget;41 MenuBarWidget(IndicatorsManager*, QWidget* parent = 0);
43
44/**
45 * An helper class which monitors the menubar and emits MenuBarWidget::menuBarClosed()
46 * when necessary
47 */
48class MenuBarClosedHelper : public QObject
49{
50Q_OBJECT
51public:
52 MenuBarClosedHelper(MenuBarWidget*);
53
54protected:
55 bool eventFilter(QObject*, QEvent*); //reimp
56
57private Q_SLOTS:
58 void emitMenuBarClosed();
59
60private:
61 MenuBarWidget* m_widget;
62 void menuBarActionEvent(QActionEvent*);
63};
64
65class MenuBarWidget : public QWidget
66{
67Q_OBJECT
68public:
69 MenuBarWidget(QMenu* windowMenu, QWidget* parent = 0);
7042
71 bool isEmpty() const;43 bool isEmpty() const;
72 bool isOpened() const;44 bool isOpened() const;
7345
74Q_SIGNALS:46Q_SIGNALS:
75 void menuBarClosed();47 void isOpenedChanged();
76 void isEmptyChanged();48 void isEmptyChanged();
7749
78protected:
79 bool eventFilter(QObject*, QEvent*); // reimp
80
81private Q_SLOTS:50private Q_SLOTS:
82 void slotActiveWindowChanged(BamfWindow*, BamfWindow*);51 void updateIsEmpty();
83 void slotViewOpened();
84 void slotWindowRegistered(WId, const QString& service, const QDBusObjectPath& menuObjectPath);
85 void slotWindowUnregistered(WId);
86 void slotMenuUpdated();
87 void slotActionActivationRequested(QAction* action);
88 void updateMenuBar();
8952
90private:53private:
91 Q_DISABLE_COPY(MenuBarWidget)54 Q_DISABLE_COPY(MenuBarWidget)
9255
93 QMenuBar* m_menuBar;56 IndicatorsManager* m_indicatorsManager;
94 Registrar* m_registrar;57 QHBoxLayout* m_layout;
95 ImporterForWId m_importers;58 bool m_isEmpty;
96 WId m_activeWinId;59 bool m_isOpened;
97 QMenu* m_windowMenu;60 QList<IndicatorEntryWidget*> m_widgetList;
98 QTimer* m_updateMenuBarTimer;61
9962 void onObjectAdded(const unity::indicator::Indicator::Ptr&);
100 void setupRegistrar();63 void onEntryAdded(const unity::indicator::Entry::Ptr&);
101 void setupMenuBar();64 void onEntryActivated(const std::string&);
102 QMenu* menuForWinId(WId) const;
103 void updateActiveWinId(BamfWindow*);
104
105 friend class MenuBarClosedHelper;
106};65};
10766
108#endif /* MENUBARWIDGET_H */67#endif /* MENUBARWIDGET_H */
10968
=== removed file 'panel/applets/appname/registrar.cpp'
--- panel/applets/appname/registrar.cpp 2011-04-04 16:46:14 +0000
+++ panel/applets/appname/registrar.cpp 1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
1/*
2 * Plasma applet to display application window menus
3 *
4 * Copyright 2010 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22// Self
23#include "registrar.h"
24
25// Qt
26#include <QApplication>
27#include <QDBusMessage>
28#include <QDBusObjectPath>
29#include <QDBusServiceWatcher>
30
31// Local
32#include "registraradaptor.h"
33
34static const char* DBUS_SERVICE = "com.canonical.AppMenu.Registrar";
35static const char* DBUS_OBJECT_PATH = "/com/canonical/AppMenu/Registrar";
36
37// Marshalling code for MenuInfo
38QDBusArgument& operator<<(QDBusArgument& argument, const MenuInfo& info)
39{
40 argument.beginStructure();
41 argument << info.winId << info.service << info.path;
42 argument.endStructure();
43 return argument;
44}
45
46const QDBusArgument& operator>>(const QDBusArgument& argument, MenuInfo& info)
47{
48 argument.beginStructure();
49 argument >> info.winId >> info.service >> info.path;
50 argument.endStructure();
51 return argument;
52}
53
54Registrar::Registrar()
55: QObject()
56, mServiceWatcher(new QDBusServiceWatcher(this))
57{
58 qDBusRegisterMetaType<MenuInfo>();
59 qDBusRegisterMetaType<MenuInfoList>();
60 mServiceWatcher->setConnection(QDBusConnection::sessionBus());
61 mServiceWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
62 connect(mServiceWatcher, SIGNAL(serviceUnregistered(const QString&)), SLOT(slotServiceUnregistered(const QString&)));
63}
64
65Registrar::~Registrar()
66{
67 QDBusConnection::sessionBus().unregisterService(mService);
68}
69
70Registrar* Registrar::instance()
71{
72 static Registrar singleton;
73 return &singleton;
74}
75
76bool Registrar::connectToBus(const QString& _service, const QString& _path)
77{
78 mService = _service.isEmpty() ? DBUS_SERVICE : _service;
79 QString path = _path.isEmpty() ? DBUS_OBJECT_PATH : _path;
80
81 bool ok = QDBusConnection::sessionBus().registerService(mService);
82 if (!ok) {
83 return false;
84 }
85 new RegistrarAdaptor(this);
86 QDBusConnection::sessionBus().registerObject(path, this);
87
88 return true;
89}
90
91void Registrar::RegisterWindow(WId wid, const QDBusObjectPath& menuObjectPath)
92{
93 MenuInfo info;
94 info.winId = wid;
95 info.service = message().service();
96 info.path = menuObjectPath;
97 mDb.insert(wid, info);
98 mServiceWatcher->addWatchedService(info.service);
99 WindowRegistered(wid, info.service, info.path);
100}
101
102void Registrar::UnregisterWindow(WId wid)
103{
104 mDb.remove(wid);
105 WindowUnregistered(wid);
106}
107
108QString Registrar::GetMenuForWindow(WId winId, QDBusObjectPath& menuObjectPath)
109{
110 MenuInfo info = mDb.value(winId);
111 QString service = info.service;
112 menuObjectPath = info.path;
113 return service;
114}
115
116MenuInfoList Registrar::GetMenus()
117{
118 return mDb.values();
119}
120
121void Registrar::slotServiceUnregistered(const QString& service)
122{
123 MenuInfoDb::Iterator
124 it = mDb.begin(),
125 end = mDb.end();
126 for (;it != end;) {
127 if (it.value().service == service) {
128 WId id = it.key();
129 it = mDb.erase(it);
130 WindowUnregistered(id);
131 } else {
132 ++it;
133 }
134 }
135 mServiceWatcher->removeWatchedService(service);
136}
137
138#include "registrar.moc"
1390
=== removed file 'panel/applets/appname/registrar.h'
--- panel/applets/appname/registrar.h 2011-04-04 16:47:28 +0000
+++ panel/applets/appname/registrar.h 1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
1/*
2 * Plasma applet to display application window menus
3 *
4 * Copyright 2010 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef REGISTRAR_H
23#define REGISTRAR_H
24
25// Qt
26#include <QDBusContext>
27#include <QDBusObjectPath>
28#include <QObject>
29#include <QWidget> // For WId
30
31class QDBusObjectPath;
32class QDBusServiceWatcher;
33class QMenu;
34
35struct MenuInfo
36{
37 MenuInfo()
38 : winId(0)
39 , path("/")
40 {}
41
42 uint winId;
43 QString service;
44 QDBusObjectPath path;
45};
46Q_DECLARE_METATYPE(MenuInfo)
47
48typedef QList<MenuInfo> MenuInfoList;
49Q_DECLARE_METATYPE(MenuInfoList)
50
51class Registrar : public QObject, protected QDBusContext
52{
53 Q_OBJECT
54
55public:
56 /* The registrar is a singleton shared between all instances of MenuBarWidget. */
57 static Registrar* instance();
58
59 bool connectToBus(const QString& service = QString(), const QString& objectPath = QString());
60
61Q_SIGNALS:
62 void WindowRegistered(WId wid, const QString& service, const QDBusObjectPath&);
63 void WindowUnregistered(WId wid);
64
65public Q_SLOTS:
66 Q_NOREPLY void RegisterWindow(WId wid, const QDBusObjectPath& menuObjectPath);
67 Q_NOREPLY void UnregisterWindow(WId wid);
68 QString GetMenuForWindow(WId wid, QDBusObjectPath& menuObjectPath);
69 MenuInfoList GetMenus();
70
71private Q_SLOTS:
72 void slotServiceUnregistered(const QString& service);
73
74private:
75 Registrar();
76 Q_DISABLE_COPY(Registrar)
77 ~Registrar();
78
79 QDBusServiceWatcher* mServiceWatcher;
80 typedef QHash<WId, MenuInfo> MenuInfoDb;
81 MenuInfoDb mDb;
82 QString mService;
83};
84
85#endif /* REGISTRAR_H */
860
=== added file 'panel/applets/common/cairoutils.cpp'
--- panel/applets/common/cairoutils.cpp 1970-01-01 00:00:00 +0000
+++ panel/applets/common/cairoutils.cpp 2011-08-16 09:38:07 +0000
@@ -0,0 +1,42 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21// Self
22#include "cairoutils.h"
23
24// Local
25
26// Qt
27#include <QImage>
28
29namespace CairoUtils {
30
31cairo_surface_t* createSurfaceForQImage(QImage* image)
32{
33 return cairo_image_surface_create_for_data(
34 image->bits(),
35 CAIRO_FORMAT_ARGB32,
36 image->width(),
37 image->height(),
38 image->bytesPerLine()
39 );
40}
41
42} // namespace
043
=== added file 'panel/applets/common/cairoutils.h'
--- panel/applets/common/cairoutils.h 1970-01-01 00:00:00 +0000
+++ panel/applets/common/cairoutils.h 2011-08-16 09:38:07 +0000
@@ -0,0 +1,47 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * Authors:
7 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef CAIROUTILS_H
22#define CAIROUTILS_H
23
24// Local
25#include <gscopedpointer.h>
26
27// Qt
28
29// Cairo
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches