Merge lp:~mandel/unity-lens-music/design-fixes into lp:~unity-team/unity-lens-music/libunity7-compatible

Proposed by Manuel de la Peña
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 162
Merged at revision: 154
Proposed branch: lp:~mandel/unity-lens-music/design-fixes
Merge into: lp:~unity-team/unity-lens-music/libunity7-compatible
Diff against target: 137 lines (+25/-18)
3 files modified
src/album.vala (+4/-2)
src/musicstore-collection.vala (+6/-0)
src/musicstore-scope.vala (+15/-16)
To merge this branch: bzr merge lp:~mandel/unity-lens-music/design-fixes
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+164332@code.launchpad.net

Commit message

- Pass the price to the error previews (LP:1179981)
- Fix spawning of the ubuntuone-credentials app (LP:180347)
- Ensure that free songs say are free and do not use a weird price tag (LP:1180717)

Description of the change

Fixed the following bugs according the reviews done by design:

- Pass the price to the error previews (LP:1179981)
- Fix spawning of the ubuntuone-credentials app (LP:180347)
- Ensure that free songs say are free and do not use a weird price tag (LP:1180717)

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

The simplest way to test this changes IRL is to purge the experimenta ppa (just in case) and do the following:

sudo apt-add-repository ppa:ubuntuone/dashpurchase-testing
sudo apt-get update
sudo apt-get install unity-scope-home ubuntuone-credentials
sudo apt-get upgrade

Once you have done that you can log out, log in and try to purchase songs within the dash.

162. By Manuel de la Peña

Fixed album price issue.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Code-wise looks fine. I was only able to test spawning of the ubuntuone-credentials app. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/album.vala'
--- src/album.vala 2013-03-12 21:16:31 +0000
+++ src/album.vala 2013-05-17 10:15:30 +0000
@@ -20,14 +20,16 @@
20using GLib;20using GLib;
2121
22namespace Unity.MusicLens {22namespace Unity.MusicLens {
23 23
24 public class Album : GLib.Object24 public class Album : GLib.Object
25 {25 {
26 public string title { get; set; }26 public string title { get; set; }
27 public string artist { get; set; }27 public string artist { get; set; }
28 public string uri { get; set; }28 public string uri { get; set; }
29 public string artwork_path { get; set; }29 public string artwork_path { get; set; }
30 public double price { get; set; }
30 public string formatted_price { get; set; }31 public string formatted_price { get; set; }
31 public string purchase_sku { get; set; }32 public string purchase_sku { get; set; }
33
32 }34 }
33}
34\ No newline at end of file35\ No newline at end of file
36}
3537
=== modified file 'src/musicstore-collection.vala'
--- src/musicstore-collection.vala 2013-04-17 15:02:43 +0000
+++ src/musicstore-collection.vala 2013-05-17 10:15:30 +0000
@@ -70,6 +70,12 @@
70 album.artist = root_obj.get_string_member ("artist");70 album.artist = root_obj.get_string_member ("artist");
71 album.uri = http_uri;71 album.uri = http_uri;
7272
73 // store the price in the album so that we can get the value easily
74 if (root_obj.has_member ("price"))
75 {
76 album.price = double.parse (root_obj.get_string_member ("price"));
77 }
78
73 // musicsearch should give us formatted_price, but fallback to price + currency79 // musicsearch should give us formatted_price, but fallback to price + currency
74 if (root_obj.has_member ("formatted_price"))80 if (root_obj.has_member ("formatted_price"))
75 {81 {
7682
=== modified file 'src/musicstore-scope.vala'
--- src/musicstore-scope.vala 2013-05-09 14:55:40 +0000
+++ src/musicstore-scope.vala 2013-05-17 10:15:30 +0000
@@ -129,8 +129,10 @@
129129
130 GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));130 GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
131 var download_action = new Unity.PreviewAction ("show_purchase_preview", _("Download"), icon);131 var download_action = new Unity.PreviewAction ("show_purchase_preview", _("Download"), icon);
132 if (album.formatted_price != null)132 if (album.price > 0 && album.formatted_price != null)
133 download_action.extra_text = album.formatted_price;133 download_action.extra_text = album.formatted_price;
134 else if (album.price == 0)
135 download_action.extra_text = _("Free");
134 download_action.activated.connect (show_purchase_preview);136 download_action.activated.connect (show_purchase_preview);
135 music_preview.add_action (download_action);137 music_preview.add_action (download_action);
136 }138 }
@@ -168,7 +170,7 @@
168170
169 delegate Unity.ActivationResponse LinkHandler (string uri);171 delegate Unity.ActivationResponse LinkHandler (string uri);
170172
171 private Unity.ActivationResponse build_error_preview (string uri, string error_header, string link_text, LinkHandler link_handler)173 private Unity.ActivationResponse build_error_preview (string uri, string error_header, string album_price, string link_text, LinkHandler link_handler)
172 {174 {
173 Album album = null;175 Album album = null;
174 SList<Track> tracks = null;176 SList<Track> tracks = null;
@@ -178,6 +180,8 @@
178 var cover = new FileIcon (cover_file);180 var cover = new FileIcon (cover_file);
179 var error_preview = new Unity.PaymentPreview.for_error(album.title, album.artist, cover);181 var error_preview = new Unity.PaymentPreview.for_error(album.title, album.artist, cover);
180 error_preview.header = error_header;182 error_preview.header = error_header;
183 error_preview.purchase_prize = album_price;
184 error_preview.purchase_type = _("Digital CD");
181 var error_action = new Unity.PreviewAction ("open_u1_link", link_text, null);185 var error_action = new Unity.PreviewAction ("open_u1_link", link_text, null);
182 error_action.activated.connect (() => link_handler (uri));186 error_action.activated.connect (() => link_handler (uri));
183 error_preview.add_action (error_action);187 error_preview.add_action (error_action);
@@ -207,24 +211,18 @@
207211
208 debug ("Finding %s", UBUNTUONE_MUSIC_LOGIN);212 debug ("Finding %s", UBUNTUONE_MUSIC_LOGIN);
209 var ui_path = Environment.find_program_in_path (UBUNTUONE_MUSIC_LOGIN);213 var ui_path = Environment.find_program_in_path (UBUNTUONE_MUSIC_LOGIN);
210 GLib.Pid child_pid;214 string cmd_line = "%s --album=\"%s\" --artist=\"%s\" --price=\"%s\" --picture=\"%s\" --url=\"%s\"".printf(
211 string argv[6] = {215 ui_path, album.title, album.artist, album.formatted_price, album.artwork_path, uri);
212 ui_path,
213 "--album=" + album.title,
214 "--artist=" + album.artist,
215 "--price=" + album.formatted_price,
216 "--picture=" + album.artwork_path,
217 "--url=" + uri
218 };
219 if (ui_path != null) {216 if (ui_path != null) {
220 try {217 try {
221 bool was_started = Process.spawn_async (null, argv, null, 0, null, out child_pid);218 debug ("Executing '%s'", cmd_line);
219 bool was_started = Process.spawn_command_line_async (cmd_line);
222 // hide dash220 // hide dash
223 if (was_started) {221 if (was_started) {
224 return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);222 return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
225 }223 }
226 } catch (GLib.SpawnError e) {224 } catch (GLib.SpawnError e) {
227 debug ("Failed to start ubuntuone-music-login for uri %s", uri);225 debug ("Failed to start ubuntuone-music-login for uri %s due to '%s'", uri, e.message);
228 }226 }
229 }227 }
230 return open_uri (uri);228 return open_uri (uri);
@@ -282,12 +280,13 @@
282 if (purchase_service.got_credentials () == false)280 if (purchase_service.got_credentials () == false)
283 {281 {
284 debug ("no credentials available, opening sso login. %s", uri);282 debug ("no credentials available, opening sso login. %s", uri);
285 return build_error_preview (uri, ERROR_MESSAGE_NOT_LOGGED_IN, _("Continue"), open_sso_login);283 return open_sso_login (uri);
286 }284 }
287285
288 Album album = null;286 Album album = null;
289 SList<Track> tracks = null;287 SList<Track> tracks = null;
290 collection.get_album_details (uri, out album, out tracks);288 collection.get_album_details (uri, out album, out tracks);
289
291 if (album != null)290 if (album != null)
292 {291 {
293 try {292 try {
@@ -296,7 +295,7 @@
296 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, null));295 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, null));
297 } catch (PurchaseError e) {296 } catch (PurchaseError e) {
298 debug ("can't get default payment method: %s", e.message);297 debug ("can't get default payment method: %s", e.message);
299 return build_error_preview (uri, ERROR_MESSAGE_NO_PAYMENT_METHOD, _("Choose Payment Method"), change_payment_method);298 return build_error_preview (uri, ERROR_MESSAGE_NO_PAYMENT_METHOD, album.formatted_price, _("Go to Ubuntu One"), change_payment_method);
300 }299 }
301 }300 }
302 return open_uri (uri);301 return open_uri (uri);
@@ -346,7 +345,7 @@
346 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, _("Wrong password")));345 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, _("Wrong password")));
347 } else {346 } else {
348 debug ("got purchase error: %s", e.message);347 debug ("got purchase error: %s", e.message);
349 return build_error_preview (uri, ERROR_MESSAGE_TECHNICAL_PROBLEM, _("Continue"), open_uri);348 return build_error_preview (uri, ERROR_MESSAGE_TECHNICAL_PROBLEM, album.formatted_price, _("Continue"), open_uri);
350 }349 }
351 }350 }
352 }351 }

Subscribers

People subscribed via source and target branches

to all changes: