on xenial help sign in
Fix some nits, making the branch mostly work
90611f5Michael Terry
Launcher/LauncherDelegate.qml+1−1
@@ -56,7 +56,7 @@ Item {
56 id: iconImage
56 id: iconImage
57 sourceSize.width: iconShape.width
57 sourceSize.width: iconShape.width
58 sourceSize.height: iconShape.height
58 sourceSize.height: iconShape.height
59− source: "../graphics/applicationIcons/" + root.iconName + ".png"
59+ source: root.iconName
60 }
60 }
61
61
62 MouseArea {
62 MouseArea {
Shell.qml+1
@@ -18,6 +18,7 @@ import QtQuick 2.0
18import Ubuntu.Application 0.1
18import Ubuntu.Application 0.1
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21+import Unity.Launcher 0.1
21import LightDM 0.1 as LightDM
22import LightDM 0.1 as LightDM
22import AccountsService 0.1
23import AccountsService 0.1
23import Powerd 0.1
24import Powerd 0.1
plugins/AccountsService/com.canonical.unity.AccountsService.xml+3−1
@@ -13,7 +13,9 @@
13 <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
13 <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
14 </property>
14 </property>
15
15
16− <property name="launcher-items" type="as" access="readwrite"/>
16+ <property name="launcher-items" type="as" access="readwrite">
17+ <annotation name="org.freedesktop.Accounts.DefaultValue" value="[]"/>
18+ </property>
17
19
18 </interface>
20 </interface>
19</node>
21</node>
plugins/Unity/Launcher/backend/launcherbackend.cpp+23−7
@@ -22,11 +22,6 @@
22#include <QDir>
22#include <QDir>
23#include <QFileInfo>
23#include <QFileInfo>
24
24
25−LauncherBackend::LauncherBackendItem::~LauncherBackendItem()
26−{
27− delete settings;
28−}
29−
30LauncherBackend::LauncherBackend(QObject *parent):
25LauncherBackend::LauncherBackend(QObject *parent):
31 QObject(parent)
26 QObject(parent)
32{
27{
@@ -36,7 +31,15 @@ LauncherBackend::LauncherBackend(QObject *parent):
36
31
37LauncherBackend::~LauncherBackend()
32LauncherBackend::~LauncherBackend()
38{
33{
34+ clearItems();
35+}
39
36
37+void LauncherBackend::clearItems()
38+{
39+ for (int i = 0; i < m_storedApps.size(); i++) {
40+ delete m_storedApps[i].settings;
41+ }
42+ m_storedApps.clear();
40}
43}
41
44
42QStringList LauncherBackend::storedApplications() const
45QStringList LauncherBackend::storedApplications() const
@@ -69,7 +72,8 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
69 }
72 }
70 }
73 }
71
74
72− m_storedApps.clear();
75+ clearItems();
76+
73 for (auto appId: appIds) {
77 for (auto appId: appIds) {
74 loadDesktopFile(appId);
78 loadDesktopFile(appId);
75 }
79 }
@@ -101,7 +105,14 @@ QString LauncherBackend::icon(const QString &appId) const
101 if (index < 0) {
105 if (index < 0) {
102 return "";
106 return "";
103 } else {
107 } else {
104− return m_storedApps[index].settings->value("Desktop Entry/Icon").toString();
108+ auto iconName = m_storedApps[index].settings->value("Desktop Entry/Icon").toString();
109+ if (!iconName.isEmpty()) {
110+ QFileInfo iconFileInfo(iconName);
111+ if (iconFileInfo.isRelative()) {
112+ iconName = "image://gicon/" + iconName;
113+ }
114+ }
115+ return iconName;
105 }
116 }
106}
117}
107
118
@@ -187,6 +198,11 @@ void LauncherBackend::syncFromAccounts()
187 }
198 }
188
199
189 setStoredApplications(appIds);
200 setStoredApplications(appIds);
201+
202+ // Mark all apps as pinned (since we just refreshed the set)
203+ for (int i = 0; i < m_storedApps.size(); i++) {
204+ m_storedApps[i].pinned = true;
205+ }
190}
206}
191
207
192void LauncherBackend::syncToAccounts()
208void LauncherBackend::syncToAccounts()
plugins/Unity/Launcher/backend/launcherbackend.h+1−2
@@ -136,12 +136,11 @@ private:
136 int findItem(const QString &appId) const;
136 int findItem(const QString &appId) const;
137 void syncFromAccounts();
137 void syncFromAccounts();
138 void syncToAccounts();
138 void syncToAccounts();
139+ void clearItems();
139
140
140 class LauncherBackendItem
141 class LauncherBackendItem
141 {
142 {
142 public:
143 public:
143− ~LauncherBackendItem();
144−
145 QSettings *settings;
144 QSettings *settings;
146 bool pinned;
145 bool pinned;
147 };
146 };
tests/mocks/Unity/Launcher/CMakeLists.txt+2
@@ -1,6 +1,8 @@
1include(FindPkgConfig)
1include(FindPkgConfig)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=2)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=2)
3
3
4+add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
5+
4include_directories(
6include_directories(
5 ${CMAKE_CURRENT_SOURCE_DIR}
7 ${CMAKE_CURRENT_SOURCE_DIR}
6)
8)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+1−1
@@ -27,7 +27,7 @@ MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopF
27 m_appId(appId),
27 m_appId(appId),
28 m_desktopFile(desktopFile),
28 m_desktopFile(desktopFile),
29 m_name(name),
29 m_name(name),
30− m_icon(icon),
30+ m_icon(TOP_SRCDIR "/graphics/applicationIcons/" + icon + ".png"),
31 m_pinned(false),
31 m_pinned(false),
32 m_running(false),
32 m_running(false),
33 m_recent(false),
33 m_recent(false),