Merge lp:~stolowski/unity-lens-applications/fix-buy-button-6.0 into lp:unity-lens-applications/6.0

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 311
Merged at revision: 312
Proposed branch: lp:~stolowski/unity-lens-applications/fix-buy-button-6.0
Merge into: lp:unity-lens-applications/6.0
Diff against target: 157 lines (+31/-17)
2 files modified
src/daemon.vala (+17/-17)
tests/manual/apps-lens-tests.txt (+14/-0)
To merge this branch: bzr merge lp:~stolowski/unity-lens-applications/fix-buy-button-6.0
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+129627@code.launchpad.net

Commit message

Use extra_hint for price of 'Buy' button.
Cherry-picked trunk rev 310..311.

Description of the change

Use extra_hint for price of 'Buy' button.
Cherry-picked trunk rev 310..311.

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2012-09-27 08:38:36 +0000
3+++ src/daemon.vala 2012-10-15 09:16:21 +0000
4@@ -26,7 +26,7 @@
5
6 namespace Unity.ApplicationsLens {
7
8- /* Number of 'Apps available for download' to show if no search query is provided AND a filter is active.
9+ /* Number of 'Apps available for download' to show if no search query is provided AND a filter is active.
10 It shouldn't be too high as this may impact lens performance.
11 */
12 const uint MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY = 100;
13@@ -368,7 +368,7 @@
14 if (app_menu == null)
15 {
16 debug ("Building initial application menu");
17-
18+
19 /* We need INCLUDE_NODISPLAY to employ proper de-duping between
20 * the Installed and Availabale categorys. If a NoDisplay app is installed,
21 * eg. Evince, it wont otherwise be in the menu index, only in the
22@@ -603,7 +603,7 @@
23 try
24 {
25 Set<string> duplicates_lookup = new HashSet<string> ();
26-
27+
28 if (sc_data_provider == null)
29 sc_data_provider = new SoftwareCenterDataCache (TOP_RATED_ITEMS_CACHE_LIFETIME);
30
31@@ -632,7 +632,7 @@
32
33 if (model.get_n_rows () == 0)
34 {
35- search.set_reply_hint ("no-results-hint",
36+ search.set_reply_hint ("no-results-hint",
37 _("Sorry, there are no applications that match your search."));
38 }
39
40@@ -889,7 +889,7 @@
41 return desktop_id;
42 }
43
44- /*
45+ /*
46 * Performs secondary level sorting of the results according to popularity
47 * of individual desktop files.
48 */
49@@ -918,7 +918,7 @@
50 }
51
52 /**
53- * Sanitize executable name -- make it suitable for Home Lens.
54+ * Sanitize executable name -- make it suitable for Home Lens.
55 */
56 private static string sanitize_binary_name (string name)
57 {
58@@ -945,14 +945,14 @@
59 {
60 annotated_icon.size_hint = IconSizeHint.SMALL;
61 }
62-
63+
64 return annotated_icon.to_string ();
65 }
66
67 /**
68 * Add all results obtained from SoftwareCenterDataProvider
69 */
70- private uint add_sc_category_results (SoftwareCenterDataProviderService.AppInfo?[] results,
71+ private uint add_sc_category_results (SoftwareCenterDataProviderService.AppInfo?[] results,
72 Dee.Model model,
73 Category category,
74 ref Set<string> duplicates_lookup,
75@@ -985,10 +985,10 @@
76 }
77
78 model.append (uri, icon_obj,
79- category,
80+ category,
81 "application/x-desktop",
82 app.application_name,
83- "", //comment
84+ "", //comment
85 "file://" + app.desktop_file);
86 duplicates_lookup.add (uri);
87 i++;
88@@ -1082,11 +1082,11 @@
89 {
90 icon_str = icon.to_string ();
91 }
92-
93+
94 model.append (uri, icon_str,
95 category,"application/x-desktop",
96 display_name != null ? display_name : "",
97- comment != null ? comment : "",
98+ comment != null ? comment : "",
99 full_path != null ? "file://" + full_path : "");
100
101 /* Stop if we added the number of items requested */
102@@ -1312,7 +1312,7 @@
103 File scr_file = File.new_for_uri (sc_data_provider.screenshot);
104 screenshot = new FileIcon (scr_file);
105 }
106-
107+
108 string subtitle = "";
109 if (sc_data_provider.version != "")
110 subtitle = _("Version %s").printf (sc_data_provider.version);
111@@ -1340,12 +1340,12 @@
112 // uninstalled and not purchased before
113 if (sc_data_provider.pkg_state == SoftwareCenterDataProviderProxy.PackageState.NEEDS_PURCHASE)
114 {
115- var buy_str = _("Buy");
116+ var buy_action = new Unity.PreviewAction ("buy", _("Buy"), null);
117 if (sc_data_provider.price != null && sc_data_provider.price != "")
118 {
119- buy_str += " " + sc_data_provider.price; //FIXME: implement action hints
120+ buy_action.extra_text = sc_data_provider.price;
121 }
122- var buy_action = new Unity.PreviewAction ("buy", buy_str, null);
123+
124 buy_action.activated.connect (app_preview_buy);
125 preview.add_action (buy_action);
126 }
127@@ -1397,7 +1397,7 @@
128 preview = null;
129 }
130 }
131-
132+
133 // xapian db doesn't know this .desktop file or S-C dbus data provider fails,
134 // fallback to DesktopAppInfo (based on installed .desktop file) if available
135 if (preview == null && desktopfile != null)
136
137=== modified file 'tests/manual/apps-lens-tests.txt'
138--- tests/manual/apps-lens-tests.txt 2012-10-01 13:04:10 +0000
139+++ tests/manual/apps-lens-tests.txt 2012-10-15 09:16:21 +0000
140@@ -26,3 +26,17 @@
141 Expected Result:
142 The search has to find the application when searching both "aisleriot" as well as "aisle" or "riot".
143
144+Prices for search results
145+------------------------
146+Price ribbon in search results and Buy/Free Download button correctly reflects application price.
147+
148+Setup:
149+Software-Center cache is updated (launch Software-Center at least once).
150+
151+Actions:
152+1. Spot some commercial non-free apps as some free open-source apps in the app lens earch results.
153+2. Right-click an app to activate its preview (repeat for commercial and free apps).
154+
155+Expected Result:
156+Open-source free applications display 'Free' string in ribbons in the search results. Their previews should have 'Developer site' and 'Free Download' buttons.
157+Commercial apps should have the price displayed in ribbons (e.g. 'US$ 8.40'). Their previews should have 'Developer site' and 'Buy US$ ...' buttons.

Subscribers

People subscribed via source and target branches

to all changes: