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

Proposed by Florian Boucault
Status: Merged
Approved by: Aurélien Gâteau
Approved revision: 551
Merged at revision: 558
Proposed branch: lp:~fboucault/unity-2d/launcher_device_icons
Merge into: lp:unity-2d/3.0
Diff against target: 28 lines (+10/-1)
1 file modified
launcher/UnityApplications/launcherdevice.cpp (+10/-1)
To merge this branch: bzr merge lp:~fboucault/unity-2d/launcher_device_icons
Reviewer Review Type Date Requested Status
Aurélien Gâteau (community) Approve
Review via email: mp+59377@code.launchpad.net

Description of the change

[launcher] Use appropriate icon for devices depending on their type (instead of always showing a USB icon).

To post a comment you must log in.
Revision history for this message
Aurélien Gâteau (agateau) wrote :

Looks good, but code could be simplified by taking advantage of the GScopedPointer classes. Also you can return QString(), it is a tiny bit more efficient than QString("").

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

Suggestions have been applied.

551. By Florian Boucault

Simplified code using GScopedPointer.

Revision history for this message
Aurélien Gâteau (agateau) wrote :

Works well (finally found a device to check!)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/UnityApplications/launcherdevice.cpp'
2--- launcher/UnityApplications/launcherdevice.cpp 2011-04-28 13:09:25 +0000
3+++ launcher/UnityApplications/launcherdevice.cpp 2011-04-28 18:56:06 +0000
4@@ -20,6 +20,7 @@
5 #include "launcherdevice.h"
6 #include "launchermenu.h"
7
8+#include <gscopedpointer.h>
9 #include "config.h"
10
11 #include <QDebug>
12@@ -93,7 +94,15 @@
13 QString
14 LauncherDevice::icon() const
15 {
16- return QString(unity2dDirectory() + "/launcher/artwork/devices.png");
17+ if (m_volume != NULL) {
18+ GObjectPointer icon((GObject*)g_volume_get_icon(m_volume));
19+ if (!icon.isNull()) {
20+ GCharPointer iconName(g_icon_to_string((GIcon*)icon.data()));
21+ return QString::fromUtf8(iconName.data());
22+ }
23+ }
24+
25+ return QString();
26 }
27
28 bool

Subscribers

People subscribed via source and target branches