[gnome-music] Add frames to the albumView
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Add frames to the albumView
- Date: Sun, 5 May 2013 08:07:57 +0000 (UTC)
commit 1353178e6a779a2f282b09ad1a4ab271a3e3ca13
Author: Seif Lotfy <seif lotfy com>
Date: Sun May 5 10:07:43 2013 +0200
Add frames to the albumView
src/albumArtCache.js | 19 ++++++++++++++++++-
src/view.js | 5 ++++-
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/albumArtCache.js b/src/albumArtCache.js
index 9e90268..c5dd2ef 100644
--- a/src/albumArtCache.js
+++ b/src/albumArtCache.js
@@ -149,8 +149,25 @@ const AlbumArtCache = new Lang.Class({
file.copy(new_file, Gio.FileCopyFlags.NONE, null, null);
callback(icon);
});
+ },
+
+ makeIconFrame: function (pixbuf) {
+ var border = 1;
+ var color = 0x0000000044;
+ var result = GdkPixbuf.Pixbuf.new(pixbuf.get_colorspace(),
+ true,
+ pixbuf.get_bits_per_sample(),
+ pixbuf.get_width(),
+ pixbuf.get_height())
+ result.fill(color)
+ pixbuf.copy_area(border, border,
+ pixbuf.get_width() - (border * 2), pixbuf.get_height() - (border * 2),
+ result,
+ border, border)
+ return result
}
+
});
AlbumArtCache.instance = null;
@@ -161,4 +178,4 @@ AlbumArtCache.getDefault = function() {
}
return AlbumArtCache.instance;
-};
\ No newline at end of file
+};
diff --git a/src/view.js b/src/view.js
index 1f6414d..f990c82 100644
--- a/src/view.js
+++ b/src/view.js
@@ -213,10 +213,11 @@ const ViewContainer = new Lang.Class({
if ((item.get_title() == null) && (item.get_url() != null)) {
item.set_title (extractFileName(item.get_url()));
}
+ var icon = albumArtCache.makeIconFrame(this._symbolicIcon)
this._model.set(
iter,
[0, 1, 2, 3, 4, 5],
- [toString(item.get_id()), "", item.get_title(), artist, this._symbolicIcon, item]
+ [toString(item.get_id()), "", item.get_title(), artist, icon, item]
);
GLib.idle_add(300, Lang.bind(this, this._updateAlbumArt, item, iter));
}
@@ -240,6 +241,7 @@ const ViewContainer = new Lang.Class({
artist = item.get_string(Grl.METADATA_KEY_ARTIST)
var icon = albumArtCache.lookup(this._iconHeight, artist, item.get_string(Grl.METADATA_KEY_ALBUM));
if (icon != null) {
+ icon = albumArtCache.makeIconFrame(icon)
this._model.set_value(iter, 4, icon);
return false;
}
@@ -259,6 +261,7 @@ const ViewContainer = new Lang.Class({
this._iconHeight,
Lang.bind(this,
function (icon) {
+ icon = albumArtCache.makeIconFrame(icon);
this._model.set_value(iter, 4, icon);
}))
}));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]