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
1=== modified file 'src/album.vala'
2--- src/album.vala 2013-03-12 21:16:31 +0000
3+++ src/album.vala 2013-05-17 10:15:30 +0000
4@@ -20,14 +20,16 @@
5 using GLib;
6
7 namespace Unity.MusicLens {
8-
9+
10 public class Album : GLib.Object
11 {
12 public string title { get; set; }
13 public string artist { get; set; }
14 public string uri { get; set; }
15 public string artwork_path { get; set; }
16+ public double price { get; set; }
17 public string formatted_price { get; set; }
18 public string purchase_sku { get; set; }
19+
20 }
21-}
22\ No newline at end of file
23+}
24
25=== modified file 'src/musicstore-collection.vala'
26--- src/musicstore-collection.vala 2013-04-17 15:02:43 +0000
27+++ src/musicstore-collection.vala 2013-05-17 10:15:30 +0000
28@@ -70,6 +70,12 @@
29 album.artist = root_obj.get_string_member ("artist");
30 album.uri = http_uri;
31
32+ // store the price in the album so that we can get the value easily
33+ if (root_obj.has_member ("price"))
34+ {
35+ album.price = double.parse (root_obj.get_string_member ("price"));
36+ }
37+
38 // musicsearch should give us formatted_price, but fallback to price + currency
39 if (root_obj.has_member ("formatted_price"))
40 {
41
42=== modified file 'src/musicstore-scope.vala'
43--- src/musicstore-scope.vala 2013-05-09 14:55:40 +0000
44+++ src/musicstore-scope.vala 2013-05-17 10:15:30 +0000
45@@ -129,8 +129,10 @@
46
47 GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
48 var download_action = new Unity.PreviewAction ("show_purchase_preview", _("Download"), icon);
49- if (album.formatted_price != null)
50+ if (album.price > 0 && album.formatted_price != null)
51 download_action.extra_text = album.formatted_price;
52+ else if (album.price == 0)
53+ download_action.extra_text = _("Free");
54 download_action.activated.connect (show_purchase_preview);
55 music_preview.add_action (download_action);
56 }
57@@ -168,7 +170,7 @@
58
59 delegate Unity.ActivationResponse LinkHandler (string uri);
60
61- private Unity.ActivationResponse build_error_preview (string uri, string error_header, string link_text, LinkHandler link_handler)
62+ private Unity.ActivationResponse build_error_preview (string uri, string error_header, string album_price, string link_text, LinkHandler link_handler)
63 {
64 Album album = null;
65 SList<Track> tracks = null;
66@@ -178,6 +180,8 @@
67 var cover = new FileIcon (cover_file);
68 var error_preview = new Unity.PaymentPreview.for_error(album.title, album.artist, cover);
69 error_preview.header = error_header;
70+ error_preview.purchase_prize = album_price;
71+ error_preview.purchase_type = _("Digital CD");
72 var error_action = new Unity.PreviewAction ("open_u1_link", link_text, null);
73 error_action.activated.connect (() => link_handler (uri));
74 error_preview.add_action (error_action);
75@@ -207,24 +211,18 @@
76
77 debug ("Finding %s", UBUNTUONE_MUSIC_LOGIN);
78 var ui_path = Environment.find_program_in_path (UBUNTUONE_MUSIC_LOGIN);
79- GLib.Pid child_pid;
80- string argv[6] = {
81- ui_path,
82- "--album=" + album.title,
83- "--artist=" + album.artist,
84- "--price=" + album.formatted_price,
85- "--picture=" + album.artwork_path,
86- "--url=" + uri
87- };
88+ string cmd_line = "%s --album=\"%s\" --artist=\"%s\" --price=\"%s\" --picture=\"%s\" --url=\"%s\"".printf(
89+ ui_path, album.title, album.artist, album.formatted_price, album.artwork_path, uri);
90 if (ui_path != null) {
91 try {
92- bool was_started = Process.spawn_async (null, argv, null, 0, null, out child_pid);
93+ debug ("Executing '%s'", cmd_line);
94+ bool was_started = Process.spawn_command_line_async (cmd_line);
95 // hide dash
96 if (was_started) {
97 return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
98 }
99 } catch (GLib.SpawnError e) {
100- debug ("Failed to start ubuntuone-music-login for uri %s", uri);
101+ debug ("Failed to start ubuntuone-music-login for uri %s due to '%s'", uri, e.message);
102 }
103 }
104 return open_uri (uri);
105@@ -282,12 +280,13 @@
106 if (purchase_service.got_credentials () == false)
107 {
108 debug ("no credentials available, opening sso login. %s", uri);
109- return build_error_preview (uri, ERROR_MESSAGE_NOT_LOGGED_IN, _("Continue"), open_sso_login);
110+ return open_sso_login (uri);
111 }
112
113 Album album = null;
114 SList<Track> tracks = null;
115 collection.get_album_details (uri, out album, out tracks);
116+
117 if (album != null)
118 {
119 try {
120@@ -296,7 +295,7 @@
121 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, null));
122 } catch (PurchaseError e) {
123 debug ("can't get default payment method: %s", e.message);
124- return build_error_preview (uri, ERROR_MESSAGE_NO_PAYMENT_METHOD, _("Choose Payment Method"), change_payment_method);
125+ return build_error_preview (uri, ERROR_MESSAGE_NO_PAYMENT_METHOD, album.formatted_price, _("Go to Ubuntu One"), change_payment_method);
126 }
127 }
128 return open_uri (uri);
129@@ -346,7 +345,7 @@
130 return new Unity.ActivationResponse.with_preview (purchase_preview (uri, _("Wrong password")));
131 } else {
132 debug ("got purchase error: %s", e.message);
133- return build_error_preview (uri, ERROR_MESSAGE_TECHNICAL_PROBLEM, _("Continue"), open_uri);
134+ return build_error_preview (uri, ERROR_MESSAGE_TECHNICAL_PROBLEM, album.formatted_price, _("Continue"), open_uri);
135 }
136 }
137 }

Subscribers

People subscribed via source and target branches

to all changes: