Merge lp:~stolowski/unity-lens-shopping/restore-category-icons into lp:unity-lens-shopping

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 31
Merged at revision: 31
Proposed branch: lp:~stolowski/unity-lens-shopping/restore-category-icons
Merge into: lp:unity-lens-shopping
Diff against target: 72 lines (+36/-5)
2 files modified
src/scope.vala (+23/-4)
tests/manual-tests/shopping-lens-tests.txt (+13/-1)
To merge this branch: bzr merge lp:~stolowski/unity-lens-shopping/restore-category-icons
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+129127@code.launchpad.net

Commit message

Restored support for category icons (merged rev. 25..24).

Description of the change

Restored support for category icons (merged rev. 25..24).

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scope.vala'
2--- src/scope.vala 2012-10-03 11:07:45 +0000
3+++ src/scope.vala 2012-10-11 09:21:22 +0000
4@@ -390,13 +390,32 @@
5
6 if (image_uri != "")
7 {
8- // TODO: what to do if we have price but no icon?
9 var file = File.new_for_uri (image_uri);
10 var icon = new AnnotatedIcon (new FileIcon (file));
11 // FIXME: dash doesn't like empty string as ribbon
12- icon.ribbon = price == null || price == "" ? " " : price;
13- // FIXME: the service doesn't expose categories yet
14- // icon.category = CategoryType.BOOK;
15+ icon.ribbon = price == null || price == "" ? " " : price;
16+
17+ unowned string category = "";
18+ if (result.has_member ("category"))
19+ category = result.get_string_member ("category");
20+ switch (category)
21+ {
22+ case "application":
23+ icon.category = CategoryType.APPLICATION;
24+ break;
25+ case "movie":
26+ icon.category = CategoryType.MOVIE;
27+ break;
28+ case "music":
29+ icon.category = CategoryType.MUSIC;
30+ break;
31+ case "book":
32+ icon.category = CategoryType.BOOK;
33+ break;
34+ default:
35+ icon.category = CategoryType.HOME; // will use generic icon
36+ break;
37+ }
38 image_uri = icon.to_string ();
39 }
40
41
42=== modified file 'tests/manual-tests/shopping-lens-tests.txt'
43--- tests/manual-tests/shopping-lens-tests.txt 2012-10-03 12:13:26 +0000
44+++ tests/manual-tests/shopping-lens-tests.txt 2012-10-11 09:21:22 +0000
45@@ -24,7 +24,7 @@
46
47 Expected Result:
48 Verify that Applications / Files & Folders / Music / Video / More suggestions home lens categories
49-(if results are available for them) are ordered by number of results, with personal content taking precedence
50+(if results are available for them) are ordered by number of results, with personal content taking precedence
51 (applications, local music files, local videos etc. are considered personal content) over shopping results,
52 with an exception that 'More suggestions' is displayed no further than on 3rd position.
53 Verify that shopping results have orange price ribbons on top of item pictures.
54@@ -84,6 +84,18 @@
55 Expected Results:
56 An empty preview should be displayed. Note that performing searches without internet connectivity will not return any results in the "More suggestions" category.
57
58+Emblems on icons provided by the Shopping lens
59+----------------------------------------------------
60+Whenever there are results from the shopping lens, emblems are present on the icons.
61+
62+Setup:
63+Internet connectivity.
64+
65+Perform a search so that some results in the "More suggestions" category are displayed. (for example search for "novel")
66+
67+Expected Results:
68+All items that are displayed have an icon categorizing the product - either a music icon, book, movie, or a generic shopping bag icon along with a price.
69+
70 'Disable' Shopping Lens Search
71 ----------------------------------------------------
72 Disabling the shopping lens should not show any result.

Subscribers

People subscribed via source and target branches