Merge lp:~stolowski/unity-lens-music/missing-cover-icon into lp:unity-lens-music

Proposed by Paweł Stołowski on 2012-09-13
Status: Merged
Approved by: Neil J. Patel on 2012-09-17
Approved revision: 104
Merged at revision: 105
Proposed branch: lp:~stolowski/unity-lens-music/missing-cover-icon
Merge into: lp:unity-lens-music
Diff against target: 215 lines (+47/-35)
5 files modified
src/banshee-collection.vala (+5/-8)
src/banshee-scope.vala (+8/-7)
src/musicstore-scope.vala (+2/-1)
src/rhythmbox-collection.vala (+19/-10)
src/rhythmbox-scope.vala (+13/-9)
To merge this branch: bzr merge lp:~stolowski/unity-lens-music/missing-cover-icon
Reviewer Review Type Date Requested Status
Michal Hruby (community) 2012-09-13 Needs Fixing on 2012-09-13
Review via email: mp+124198@code.launchpad.net

Commit Message

Use new icons when album cover is missing.

Description of the Change

Use new icons when album cover is missing.

To post a comment you must log in.
103. By Paweł Stołowski on 2012-09-13

Use u1-service icon for the 'Download' button in the preview.

Michal Hruby (mhr3) wrote :

93 +<<<<<<< TREE
94 var download_action = new Unity.PreviewAction ("download_album", _("Download"), null);
95 if (album.formatted_price != null)
96 download_action.extra_text = album.formatted_price;
97 +=======
98 + GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
99 + var download_action = new Unity.PreviewAction ("download_album", _("Download"), icon);
100 +>>>>>>> MERGE-SOURCE

Uh oh :(

review: Needs Fixing
104. By Paweł Stołowski on 2012-09-14

Merged trunk.

Paweł Stołowski (stolowski) wrote :

Fixed the conflict.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/banshee-collection.vala'
2--- src/banshee-collection.vala 2012-07-17 15:36:44 +0000
3+++ src/banshee-collection.vala 2012-09-14 16:04:19 +0000
4@@ -109,6 +109,8 @@
5 break;
6 case Sqlite.ROW:
7 string artwork_path = get_album_artwork_path (stmt.column_text (ALBUM_ARTWORKID));
8+ if (artwork_path == null || artwork_path == "" || !FileUtils.test(artwork_path, FileTest.EXISTS))
9+ artwork_path = ALBUM_MISSING_ICON_PATH;
10
11 Track track = new Track ();
12 track.title = stmt.column_text (TRACK_TITLE);
13@@ -126,8 +128,8 @@
14 uint category_id = Category.SONGS;
15 if (category_override >= 0)
16 category_id = category_override;
17-
18- helper_model.append (track.uri, track.artwork_path, category_id,
19+
20+ helper_model.append (track.uri, artwork_path, category_id,
21 track.mime_type, track.title, track.artist,
22 track.uri);
23
24@@ -169,17 +171,12 @@
25 }
26
27 /**
28- * Computes path for album artwork; checks if cover file exists, defaults to generic audio icon.
29+ * Computes path for album artwork.
30 */
31 private string get_album_artwork_path (string artwork_id)
32 {
33 string album_art_dir = "%s/media-art/".printf (Environment.get_user_cache_dir ());
34 string artwork_path = "%s/%s.jpg".printf (album_art_dir, artwork_id);
35- File artwork_file = File.new_for_path (artwork_path);
36- if (!artwork_file.query_exists ())
37- {
38- artwork_path = "audio-x-generic";
39- }
40 return artwork_path;
41 }
42
43
44=== modified file 'src/banshee-scope.vala'
45--- src/banshee-scope.vala 2012-09-13 14:56:05 +0000
46+++ src/banshee-scope.vala 2012-09-14 16:04:19 +0000
47@@ -53,7 +53,8 @@
48 public Unity.Preview preview (string uri)
49 {
50 Unity.MusicPreview? preview = null;
51- GLib.ThemedIcon? icon_file = null;
52+ GLib.Icon? icon_file = null;
53+ GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH));
54
55 if (Uri.parse_scheme (uri) == "album")
56 {
57@@ -65,10 +66,10 @@
58 {
59 if (preview == null)
60 {
61- if (track.artwork_path != null)
62- {
63+ if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS))
64 icon_file = new GLib.ThemedIcon(track.artwork_path);
65- }
66+ else
67+ icon_file = missing_icon_file;
68 preview = new Unity.MusicPreview (title, artist, icon_file);
69 }
70 var tm = new Unity.TrackMetadata();
71@@ -84,10 +85,10 @@
72 Track? track = collection.get_album_track (uri);
73 if (track != null)
74 {
75- if (track.artwork_path != null)
76- {
77+ if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS))
78 icon_file = new GLib.ThemedIcon(track.artwork_path);
79- }
80+ else
81+ icon_file = missing_icon_file;
82 preview = new Unity.MusicPreview (track.title, track.artist, icon_file);
83 var tm = new Unity.TrackMetadata();
84 tm.uri = track.uri;
85
86=== modified file 'src/musicstore-scope.vala'
87--- src/musicstore-scope.vala 2012-09-13 14:56:05 +0000
88+++ src/musicstore-scope.vala 2012-09-14 16:04:19 +0000
89@@ -171,7 +171,8 @@
90 }
91 }
92
93- var download_action = new Unity.PreviewAction ("download_album", _("Download"), null);
94+ GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
95+ var download_action = new Unity.PreviewAction ("download_album", _("Download"), icon);
96 if (album.formatted_price != null)
97 download_action.extra_text = album.formatted_price;
98 download_action.activated.connect (download_album);
99
100=== modified file 'src/rhythmbox-collection.vala'
101--- src/rhythmbox-collection.vala 2012-08-17 09:11:28 +0000
102+++ src/rhythmbox-collection.vala 2012-09-14 16:04:19 +0000
103@@ -23,6 +23,9 @@
104
105 namespace Unity.MusicLens
106 {
107+ const string UNITY_ICON_PATH = Config.PKGDATADIR + "/6";
108+ const string ALBUM_MISSING_ICON_PATH = UNITY_ICON_PATH + "/album_missing.png";
109+ const string ALBUM_MISSING_PREVIEW_ICON_PATH = UNITY_ICON_PATH + "/album_missing_preview.png";
110
111 private enum Columns
112 {
113@@ -535,8 +538,6 @@
114 string albumart = get_albumart (track);
115 if (albumart != null)
116 track.artwork_path = albumart;
117- else
118- track.artwork_path = "audio-x-generic";
119
120 prepare_row_buffer (track);
121 var iter = all_tracks.append_row (row_buffer);
122@@ -605,21 +606,26 @@
123 artist = model.get_string (iter, Columns.ARTIST);
124
125 var album_art_string = check_album_art_tdb (artist, album);
126- if (album_art_string != null)
127+ if (album_art_string != null && album_art_string != "")
128 {
129 string filename;
130 filename = Path.build_filename (Environment.get_user_cache_dir (),
131 "rhythmbox", "album-art",
132 album_art_string);
133 album_art_string = FileUtils.test (filename, FileTest.EXISTS) ?
134- filename : "audio-x-generic";
135+ filename : ALBUM_MISSING_ICON_PATH;
136+ }
137+ else
138+ {
139+ album_art_string = ALBUM_MISSING_ICON_PATH;
140+ }
141
142- if (album_art_string != model.get_string (iter, Columns.ARTWORK))
143- {
144- model.set_value (iter, Columns.ARTWORK,
145- cached_variant_for_string (album_art_string));
146- }
147+ if (album_art_string != model.get_string (iter, Columns.ARTWORK))
148+ {
149+ model.set_value (iter, Columns.ARTWORK,
150+ cached_variant_for_string (album_art_string));
151 }
152+
153 album_art_tag[model, iter] = current_album_art_tag;
154 }
155
156@@ -646,8 +652,11 @@
157 uri = "album://%s".printf (album_key);
158 }
159
160+ var artwork = model.get_string (iter, Columns.ARTWORK);
161+ if (artwork == null || artwork == "")
162+ artwork = ALBUM_MISSING_ICON_PATH;
163 results_model.append (uri,
164- model.get_string (iter, Columns.ARTWORK),
165+ artwork,
166 category_id,
167 model.get_string (iter, Columns.MIMETYPE),
168 title,
169
170=== modified file 'src/rhythmbox-scope.vala'
171--- src/rhythmbox-scope.vala 2012-09-13 14:56:05 +0000
172+++ src/rhythmbox-scope.vala 2012-09-14 16:04:19 +0000
173@@ -76,7 +76,8 @@
174 public Unity.Preview preview (string uri)
175 {
176 music_preview = null;
177- GLib.ThemedIcon? icon_file = null;
178+ GLib.Icon? icon_file = null;
179+ GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH));
180
181 if (Uri.parse_scheme (uri) == "album")
182 {
183@@ -86,10 +87,12 @@
184 {
185 if (music_preview == null)
186 {
187- if (track.artwork_path != null)
188- {
189- icon_file = new GLib.ThemedIcon(track.artwork_path);
190- }
191+ var artwork_path = track.artwork_path;
192+ if (artwork_path == null || artwork_path == "")
193+ icon_file = missing_icon_file;
194+ else
195+ icon_file = new GLib.FileIcon(File.new_for_path (artwork_path));
196+
197 music_preview = new Unity.MusicPreview (track.album, track.album_artist, icon_file);
198
199 var play_action = new Unity.PreviewAction ("play_album", _("Play"), null);
200@@ -113,10 +116,11 @@
201 Track? track = collection.get_album_track (uri);
202 if (track != null)
203 {
204- if (track.artwork_path != null)
205- {
206- icon_file = new GLib.ThemedIcon(track.artwork_path);
207- }
208+ var artwork_path = track.artwork_path;
209+ if (artwork_path == null || artwork_path == "")
210+ icon_file = missing_icon_file;
211+ else
212+ icon_file = new GLib.FileIcon(File.new_for_path (artwork_path));
213 music_preview = new Unity.MusicPreview (track.title, track.album_artist, icon_file);
214
215 var play_action = new Unity.PreviewAction ("play_track", _("Play"), null);

Subscribers

People subscribed via source and target branches

to all changes: