Merge lp:~unity-team/unity-scope-click/fix-1390191-rtm into lp:unity-scope-click/rtm-14.09

Proposed by Paweł Stołowski on 2014-11-19
Status: Merged
Approved by: Marcus Tomlinson on 2015-01-14
Approved revision: 300
Merged at revision: 302
Proposed branch: lp:~unity-team/unity-scope-click/fix-1390191-rtm
Merge into: lp:unity-scope-click/rtm-14.09
Diff against target: 34 lines (+4/-8)
2 files modified
libclickscope/click/departments-db.cpp (+2/-6)
libclickscope/tests/test_departments-db.cpp (+2/-2)
To merge this branch: bzr merge lp:~unity-team/unity-scope-click/fix-1390191-rtm
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2014-12-11
Unity Team 2014-11-19 Pending
Review via email: mp+242214@code.launchpad.net

Commit Message

Removed the restriction in get_children method that filtered empty departments out.

Description of the Change

Removed the restriction in get_children method that filtered empty departments out.

The database stores only the ids of applications installed via the Store and doesn't know about preinstalled apps which provide department id via X-Default-Department-ID (so from the db point of view some departments may appear empty). We then intersect them with the set of departments we have for currently installed apps (we get them from the database again and from .desktop files via the special key), so at this point empty departments are discarded and not shown - doing so right in get_children() was a premature optimization.

A simple way of reproducing and then testing the fix:
- make sure you have no apps installed from Travel Local department.
- add X-Ubuntu-Default-Department-ID=travel-local to /home/phablet/.local/share/applications/com.nokia.heremaps_here_1.0.4.desktop
- reboot
- without the fix Travel Local department won't be shown in Apps departments menu; with the fix it will be shown, and will have Here Maps app in it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libclickscope/click/departments-db.cpp'
2--- libclickscope/click/departments-db.cpp 2014-08-19 15:34:58 +0000
3+++ libclickscope/click/departments-db.cpp 2014-11-19 14:07:51 +0000
4@@ -221,12 +221,8 @@
5 while (select_children_depts_->next())
6 {
7 auto const child_id = select_children_depts_->value(0).toString().toStdString();
8- // only return child department if it's not empty
9- if (!is_empty(child_id))
10- {
11- const DepartmentInfo inf(child_id, select_children_depts_->value(1).toBool());
12- depts.push_back(inf);
13- }
14+ const DepartmentInfo inf(child_id, select_children_depts_->value(1).toBool());
15+ depts.push_back(inf);
16 }
17
18 select_children_depts_->finish();
19
20=== modified file 'libclickscope/tests/test_departments-db.cpp'
21--- libclickscope/tests/test_departments-db.cpp 2014-08-07 15:34:47 +0000
22+++ libclickscope/tests/test_departments-db.cpp 2014-11-19 14:07:51 +0000
23@@ -188,10 +188,10 @@
24 }
25 {
26 auto depts = db->get_children_departments("games");
27- EXPECT_EQ(2u, depts.size());
28+ EXPECT_EQ(3u, depts.size());
29 EXPECT_TRUE(std::find(depts.begin(), depts.end(), DepartmentsDb::DepartmentInfo("rpg", false)) != depts.end());
30 EXPECT_TRUE(std::find(depts.begin(), depts.end(), DepartmentsDb::DepartmentInfo("fps", false)) != depts.end());
31- EXPECT_FALSE(std::find(depts.begin(), depts.end(), DepartmentsDb::DepartmentInfo("card", false)) != depts.end());
32+ EXPECT_TRUE(std::find(depts.begin(), depts.end(), DepartmentsDb::DepartmentInfo("card", false)) != depts.end());
33 }
34 }
35

Subscribers

People subscribed via source and target branches

to all changes: