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

Proposed by Paweł Stołowski
Status: Merged
Approved by: Neil J. Patel
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) Needs Fixing
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

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

Revision history for this message
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

Merged trunk.

Revision history for this message
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
=== modified file 'src/banshee-collection.vala'
--- src/banshee-collection.vala 2012-07-17 15:36:44 +0000
+++ src/banshee-collection.vala 2012-09-14 16:04:19 +0000
@@ -109,6 +109,8 @@
109 break;109 break;
110 case Sqlite.ROW:110 case Sqlite.ROW:
111 string artwork_path = get_album_artwork_path (stmt.column_text (ALBUM_ARTWORKID));111 string artwork_path = get_album_artwork_path (stmt.column_text (ALBUM_ARTWORKID));
112 if (artwork_path == null || artwork_path == "" || !FileUtils.test(artwork_path, FileTest.EXISTS))
113 artwork_path = ALBUM_MISSING_ICON_PATH;
112114
113 Track track = new Track ();115 Track track = new Track ();
114 track.title = stmt.column_text (TRACK_TITLE);116 track.title = stmt.column_text (TRACK_TITLE);
@@ -126,8 +128,8 @@
126 uint category_id = Category.SONGS;128 uint category_id = Category.SONGS;
127 if (category_override >= 0)129 if (category_override >= 0)
128 category_id = category_override;130 category_id = category_override;
129131
130 helper_model.append (track.uri, track.artwork_path, category_id,132 helper_model.append (track.uri, artwork_path, category_id,
131 track.mime_type, track.title, track.artist,133 track.mime_type, track.title, track.artist,
132 track.uri);134 track.uri);
133135
@@ -169,17 +171,12 @@
169 }171 }
170172
171 /**173 /**
172 * Computes path for album artwork; checks if cover file exists, defaults to generic audio icon.174 * Computes path for album artwork.
173 */175 */
174 private string get_album_artwork_path (string artwork_id)176 private string get_album_artwork_path (string artwork_id)
175 {177 {
176 string album_art_dir = "%s/media-art/".printf (Environment.get_user_cache_dir ());178 string album_art_dir = "%s/media-art/".printf (Environment.get_user_cache_dir ());
177 string artwork_path = "%s/%s.jpg".printf (album_art_dir, artwork_id);179 string artwork_path = "%s/%s.jpg".printf (album_art_dir, artwork_id);
178 File artwork_file = File.new_for_path (artwork_path);
179 if (!artwork_file.query_exists ())
180 {
181 artwork_path = "audio-x-generic";
182 }
183 return artwork_path;180 return artwork_path;
184 }181 }
185182
186183
=== modified file 'src/banshee-scope.vala'
--- src/banshee-scope.vala 2012-09-13 14:56:05 +0000
+++ src/banshee-scope.vala 2012-09-14 16:04:19 +0000
@@ -53,7 +53,8 @@
53 public Unity.Preview preview (string uri)53 public Unity.Preview preview (string uri)
54 {54 {
55 Unity.MusicPreview? preview = null;55 Unity.MusicPreview? preview = null;
56 GLib.ThemedIcon? icon_file = null;56 GLib.Icon? icon_file = null;
57 GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH));
5758
58 if (Uri.parse_scheme (uri) == "album")59 if (Uri.parse_scheme (uri) == "album")
59 {60 {
@@ -65,10 +66,10 @@
65 {66 {
66 if (preview == null)67 if (preview == null)
67 {68 {
68 if (track.artwork_path != null)69 if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS))
69 {
70 icon_file = new GLib.ThemedIcon(track.artwork_path);70 icon_file = new GLib.ThemedIcon(track.artwork_path);
71 }71 else
72 icon_file = missing_icon_file;
72 preview = new Unity.MusicPreview (title, artist, icon_file);73 preview = new Unity.MusicPreview (title, artist, icon_file);
73 }74 }
74 var tm = new Unity.TrackMetadata();75 var tm = new Unity.TrackMetadata();
@@ -84,10 +85,10 @@
84 Track? track = collection.get_album_track (uri);85 Track? track = collection.get_album_track (uri);
85 if (track != null)86 if (track != null)
86 {87 {
87 if (track.artwork_path != null)88 if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS))
88 {
89 icon_file = new GLib.ThemedIcon(track.artwork_path);89 icon_file = new GLib.ThemedIcon(track.artwork_path);
90 }90 else
91 icon_file = missing_icon_file;
91 preview = new Unity.MusicPreview (track.title, track.artist, icon_file);92 preview = new Unity.MusicPreview (track.title, track.artist, icon_file);
92 var tm = new Unity.TrackMetadata();93 var tm = new Unity.TrackMetadata();
93 tm.uri = track.uri;94 tm.uri = track.uri;
9495
=== modified file 'src/musicstore-scope.vala'
--- src/musicstore-scope.vala 2012-09-13 14:56:05 +0000
+++ src/musicstore-scope.vala 2012-09-14 16:04:19 +0000
@@ -171,7 +171,8 @@
171 }171 }
172 }172 }
173173
174 var download_action = new Unity.PreviewAction ("download_album", _("Download"), null);174 GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
175 var download_action = new Unity.PreviewAction ("download_album", _("Download"), icon);
175 if (album.formatted_price != null)176 if (album.formatted_price != null)
176 download_action.extra_text = album.formatted_price;177 download_action.extra_text = album.formatted_price;
177 download_action.activated.connect (download_album);178 download_action.activated.connect (download_album);
178179
=== modified file 'src/rhythmbox-collection.vala'
--- src/rhythmbox-collection.vala 2012-08-17 09:11:28 +0000
+++ src/rhythmbox-collection.vala 2012-09-14 16:04:19 +0000
@@ -23,6 +23,9 @@
2323
24namespace Unity.MusicLens24namespace Unity.MusicLens
25{25{
26 const string UNITY_ICON_PATH = Config.PKGDATADIR + "/6";
27 const string ALBUM_MISSING_ICON_PATH = UNITY_ICON_PATH + "/album_missing.png";
28 const string ALBUM_MISSING_PREVIEW_ICON_PATH = UNITY_ICON_PATH + "/album_missing_preview.png";
2629
27 private enum Columns30 private enum Columns
28 {31 {
@@ -535,8 +538,6 @@
535 string albumart = get_albumart (track);538 string albumart = get_albumart (track);
536 if (albumart != null)539 if (albumart != null)
537 track.artwork_path = albumart;540 track.artwork_path = albumart;
538 else
539 track.artwork_path = "audio-x-generic";
540541
541 prepare_row_buffer (track);542 prepare_row_buffer (track);
542 var iter = all_tracks.append_row (row_buffer);543 var iter = all_tracks.append_row (row_buffer);
@@ -605,21 +606,26 @@
605 artist = model.get_string (iter, Columns.ARTIST);606 artist = model.get_string (iter, Columns.ARTIST);
606607
607 var album_art_string = check_album_art_tdb (artist, album);608 var album_art_string = check_album_art_tdb (artist, album);
608 if (album_art_string != null)609 if (album_art_string != null && album_art_string != "")
609 {610 {
610 string filename;611 string filename;
611 filename = Path.build_filename (Environment.get_user_cache_dir (),612 filename = Path.build_filename (Environment.get_user_cache_dir (),
612 "rhythmbox", "album-art",613 "rhythmbox", "album-art",
613 album_art_string);614 album_art_string);
614 album_art_string = FileUtils.test (filename, FileTest.EXISTS) ?615 album_art_string = FileUtils.test (filename, FileTest.EXISTS) ?
615 filename : "audio-x-generic";616 filename : ALBUM_MISSING_ICON_PATH;
617 }
618 else
619 {
620 album_art_string = ALBUM_MISSING_ICON_PATH;
621 }
616622
617 if (album_art_string != model.get_string (iter, Columns.ARTWORK))623 if (album_art_string != model.get_string (iter, Columns.ARTWORK))
618 {624 {
619 model.set_value (iter, Columns.ARTWORK,625 model.set_value (iter, Columns.ARTWORK,
620 cached_variant_for_string (album_art_string));626 cached_variant_for_string (album_art_string));
621 }
622 }627 }
628
623 album_art_tag[model, iter] = current_album_art_tag;629 album_art_tag[model, iter] = current_album_art_tag;
624 }630 }
625631
@@ -646,8 +652,11 @@
646 uri = "album://%s".printf (album_key);652 uri = "album://%s".printf (album_key);
647 }653 }
648654
655 var artwork = model.get_string (iter, Columns.ARTWORK);
656 if (artwork == null || artwork == "")
657 artwork = ALBUM_MISSING_ICON_PATH;
649 results_model.append (uri,658 results_model.append (uri,
650 model.get_string (iter, Columns.ARTWORK),659 artwork,
651 category_id,660 category_id,
652 model.get_string (iter, Columns.MIMETYPE),661 model.get_string (iter, Columns.MIMETYPE),
653 title,662 title,
654663
=== modified file 'src/rhythmbox-scope.vala'
--- src/rhythmbox-scope.vala 2012-09-13 14:56:05 +0000
+++ src/rhythmbox-scope.vala 2012-09-14 16:04:19 +0000
@@ -76,7 +76,8 @@
76 public Unity.Preview preview (string uri)76 public Unity.Preview preview (string uri)
77 {77 {
78 music_preview = null;78 music_preview = null;
79 GLib.ThemedIcon? icon_file = null;79 GLib.Icon? icon_file = null;
80 GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH));
80 81
81 if (Uri.parse_scheme (uri) == "album")82 if (Uri.parse_scheme (uri) == "album")
82 {83 {
@@ -86,10 +87,12 @@
86 {87 {
87 if (music_preview == null)88 if (music_preview == null)
88 {89 {
89 if (track.artwork_path != null)90 var artwork_path = track.artwork_path;
90 {91 if (artwork_path == null || artwork_path == "")
91 icon_file = new GLib.ThemedIcon(track.artwork_path);92 icon_file = missing_icon_file;
92 }93 else
94 icon_file = new GLib.FileIcon(File.new_for_path (artwork_path));
95
93 music_preview = new Unity.MusicPreview (track.album, track.album_artist, icon_file);96 music_preview = new Unity.MusicPreview (track.album, track.album_artist, icon_file);
9497
95 var play_action = new Unity.PreviewAction ("play_album", _("Play"), null);98 var play_action = new Unity.PreviewAction ("play_album", _("Play"), null);
@@ -113,10 +116,11 @@
113 Track? track = collection.get_album_track (uri);116 Track? track = collection.get_album_track (uri);
114 if (track != null)117 if (track != null)
115 {118 {
116 if (track.artwork_path != null)119 var artwork_path = track.artwork_path;
117 {120 if (artwork_path == null || artwork_path == "")
118 icon_file = new GLib.ThemedIcon(track.artwork_path);121 icon_file = missing_icon_file;
119 }122 else
123 icon_file = new GLib.FileIcon(File.new_for_path (artwork_path));
120 music_preview = new Unity.MusicPreview (track.title, track.album_artist, icon_file);124 music_preview = new Unity.MusicPreview (track.title, track.album_artist, icon_file);
121125
122 var play_action = new Unity.PreviewAction ("play_track", _("Play"), null);126 var play_action = new Unity.PreviewAction ("play_track", _("Play"), null);

Subscribers

People subscribed via source and target branches

to all changes: