[gnome-music] Revert "Add error symbol nearby the tracks, which cannot be played due to missing codecs."
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Revert "Add error symbol nearby the tracks, which cannot be played due to missing codecs."
- Date: Mon, 13 May 2013 11:11:37 +0000 (UTC)
commit 120d13743101fe022f3b4534ad881f22c5028998
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Mon May 13 13:11:14 2013 +0200
Revert "Add error symbol nearby the tracks, which cannot be played due to missing codecs."
This reverts commit 3802a3af450a9839a166009355fc9eda4aa618cd.
Sorry, accidentally pushed this
src/player.js | 2 -
src/view.js | 57 +++++---------------------------------
src/widgets.js | 82 +++++++++++++++++--------------------------------------
3 files changed, 34 insertions(+), 107 deletions(-)
---
diff --git a/src/player.js b/src/player.js
index f507d1e..bc6be7d 100644
--- a/src/player.js
+++ b/src/player.js
@@ -24,7 +24,6 @@ const Lang = imports.lang;
const Gtk = imports.gi.Gtk;
const Gd = imports.gi.Gd;
const Gst = imports.gi.Gst;
-const GstPbutils = imports.gi.GstPbutils;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Grl = imports.gi.Grl;
@@ -59,7 +58,6 @@ const Player = new Lang.Class({
this.cache = AlbumArtCache.AlbumArtCache.getDefault();
Gst.init(null, 0);
- this.discoverer = new GstPbutils.Discoverer();
this.player = Gst.ElementFactory.make("playbin", "player");
this.bus = this.player.get_bus();
this.bus.add_signal_watch();
diff --git a/src/view.js b/src/view.js
index 967b58a..9e92acf 100644
--- a/src/view.js
+++ b/src/view.js
@@ -41,13 +41,6 @@ const AlbumArtCache = imports.albumArtCache;
const Grilo = imports.grilo;
const albumArtCache = AlbumArtCache.AlbumArtCache.getDefault();
-const nowPlayingPixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
- "/usr/share/icons/gnome/scalable/actions/media-playback-start-symbolic.svg",
- -1, 16, true);
-const errorPixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
- "/usr/share/icons/gnome/scalable/status/dialog-error-symbolic.svg",
- -1, 16, true);
-
function extractFileName(uri) {
var exp = /^.*[\\\/]|[.][^.]*$/g;
return unescape(uri.replace(exp, ''));
@@ -129,8 +122,7 @@ const ViewContainer = new Lang.Class({
GObject.TYPE_STRING,
GdkPixbuf.Pixbuf,
GObject.TYPE_OBJECT,
- GObject.TYPE_BOOLEAN,
- GdkPixbuf.Pixbuf,
+ GObject.TYPE_BOOLEAN
]);
this.view = new Gd.MainView({
shadow_type: Gtk.ShadowType.NONE
@@ -220,22 +212,11 @@ const ViewContainer = new Lang.Class({
if ((item.get_title() == null) && (item.get_url() != null)) {
item.set_title (extractFileName(item.get_url()));
}
- try{
- if (item.get_url())
- this.player.discoverer.discover_uri(item.get_url());
- this._model.set(
- iter,
- [0, 1, 2, 3, 4, 5, 6, 7],
- [toString(item.get_id()), "", item.get_title(), artist, this._symbolicIcon, item,
false, nowPlayingPixbuf]
- );
- } catch(err) {
- log("failed to discover url " + item.get_url());
- this._model.set(
- iter,
- [0, 1, 2, 3, 4, 5, 6, 7],
- [toString(item.get_id()), "", item.get_title(), artist, this._symbolicIcon, item,
true, errorPixbuf]
- );
- }
+ this._model.set(
+ iter,
+ [0, 1, 2, 3, 4, 5],
+ [toString(item.get_id()), "", item.get_title(), artist, this._symbolicIcon, item]
+ );
GLib.idle_add(300, Lang.bind(this, this._updateAlbumArt, item, iter));
}
},
@@ -364,24 +345,11 @@ const Songs = new Lang.Class({
this._symbolicIcon = albumArtCache.makeDefaultIcon(this._iconHeight, this._iconWidth)
this._addListRenderers();
this.player = player;
- this.player.connect('playlist-item-changed', Lang.bind(this, this.updateModel));
},
_onItemActivated: function (widget, id, path) {
- var iter = this._model.get_iter(path)[1]
- if (this._model.get_value(iter, 7) != errorPixbuf) {
- this.player.setPlaylist("Songs", null, this._model, iter, 5);
- this.player.setPlaying(true);
- }
- },
-
- updateModel: function(player, playlist, currentIter){
- if (this.iterToClean){
- this._model.set_value(this.iterToClean, 6, false);
- }
- this._model.set_value(currentIter, 6, true);
- this.iterToClean = currentIter.copy();
- return false;
+ this.player.setPlaylist("Songs", null, this._model, this._model.get_iter(path)[1], 5);
+ this.player.setPlaying(true);
},
_addItem: function(source, param, item) {
@@ -391,15 +359,6 @@ const Songs = new Lang.Class({
_addListRenderers: function() {
let listWidget = this.view.get_generic_view();
- let nowPlayingSymbolRenderer = new Gtk.CellRendererPixbuf({ xpad: 0 });
- var columnNowPlaying = new Gtk.TreeViewColumn();
- nowPlayingSymbolRenderer.set_property("xalign", 1.0);
- columnNowPlaying.pack_start(nowPlayingSymbolRenderer, false)
- columnNowPlaying.set_property('fixed-width', 24)
- columnNowPlaying.add_attribute(nowPlayingSymbolRenderer, "visible", 6);
- columnNowPlaying.add_attribute(nowPlayingSymbolRenderer, "pixbuf", 7);
- listWidget.insert_column(columnNowPlaying, 0)
-
let typeRenderer =
new Gd.StyledTextRenderer({ xpad: 0 });
typeRenderer.add_class('dim-label');
diff --git a/src/widgets.js b/src/widgets.js
index 9486c28..21aef63 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -38,9 +38,6 @@ const albumArtCache = AlbumArtCache.AlbumArtCache.getDefault();
const nowPlayingPixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
"/usr/share/icons/gnome/scalable/actions/media-playback-start-symbolic.svg",
-1, 16, true);
-const errorPixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
- "/usr/share/icons/gnome/scalable/status/dialog-error-symbolic.svg",
- -1, 16, true);
const AlbumWidget = new Lang.Class({
Name: "AlbumWidget",
@@ -62,18 +59,15 @@ const AlbumWidget = new Lang.Class({
this.album=null;
this.view.connect('item-activated', Lang.bind(this,
function(widget, id, path) {
- let iter = this.model.get_iter(path)[1];
- if (this.model.get_value(iter, 4) != errorPixbuf) {
- this.player.stop();
- if (this.iterToClean && this.player.playlistId == this.album){
- let item = this.model.get_value(this.iterToClean, 5);
- this.model.set_value(this.iterToClean, 0, item.get_title());
- // Hide now playing icon
- this.model.set_value(this.iterToClean, 3, false);
- }
- this.player.setPlaylist("Album", this.album, this.model, iter, 5);
- this.player.setPlaying(true);
+ this.player.stop();
+ if (this.iterToClean && this.player.playlistId == this.album){
+ let item = this.model.get_value(this.iterToClean, 5);
+ this.model.set_value(this.iterToClean, 0, item.get_title());
+ // Hide now playing icon
+ this.model.set_value(this.iterToClean, 3, false);
}
+ this.player.setPlaylist("Album", this.album, this.model, this.model.get_iter(path)[1], 5);
+ this.player.setPlaying(true);
})
);
@@ -105,13 +99,13 @@ const AlbumWidget = new Lang.Class({
cells[1].visible = false
let nowPlayingSymbolRenderer = new Gtk.CellRendererPixbuf({ xpad: 0 });
+ nowPlayingSymbolRenderer.pixbuf = nowPlayingPixbuf;
var columnNowPlaying = new Gtk.TreeViewColumn();
nowPlayingSymbolRenderer.set_property("xalign", 1.0);
columnNowPlaying.pack_start(nowPlayingSymbolRenderer, false)
columnNowPlaying.set_property('fixed-width', 24)
columnNowPlaying.add_attribute(nowPlayingSymbolRenderer, "visible", 3);
- columnNowPlaying.add_attribute(nowPlayingSymbolRenderer, "pixbuf", 4);
listWidget.insert_column(columnNowPlaying, 0)
let typeRenderer =
@@ -159,7 +153,7 @@ const AlbumWidget = new Lang.Class({
GObject.TYPE_STRING,
GObject.TYPE_STRING,
GObject.TYPE_BOOLEAN,/*icon shown*/
- GdkPixbuf.Pixbuf, /*icon to display*/
+ GdkPixbuf.Pixbuf, /*icon*/
GObject.TYPE_OBJECT, /*song object*/
GObject.TYPE_BOOLEAN
]);
@@ -169,22 +163,14 @@ const AlbumWidget = new Lang.Class({
tracks.push(track);
duration = duration + track.get_duration();
let iter = this.model.append();
- let escapedTitle = GLib.markup_escape_text(track.get_title(), track.get_title().length);
- try{
- this.player.discoverer.discover_uri(track.get_url());
- this.model.set(iter,
- [0, 1, 2, 3, 4, 5],
- [ escapedTitle, "", "", false, nowPlayingPixbuf, track ]);
- } catch(err) {
- log("failed to discover url " + track.get_url());
- this.model.set(iter,
- [0, 1, 2, 3, 4, 5],
- [ escapedTitle, "", "", true, errorPixbuf, track ]);
- }
-
+ let path = "/usr/share/icons/gnome/scalable/actions/media-playback-start-symbolic.svg";
+ let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, -1, 16, true);
+ let escapedTitle = GLib.markup_escape_text(track.get_title(), -1);
+ this.model.set(iter,
+ [0, 1, 2, 3, 4, 5],
+ [ escapedTitle, "", "", false, nowPlayingPixbuf, track ]);
this.ui.get_object("running_length_label_info").set_text(
(parseInt(duration/60) + 1) + " min");
-
this.emit("track-added")
}
}));
@@ -297,9 +283,6 @@ const ArtistAlbums = new Lang.Class({
let song = playlist.get_value(iter, 5);
let songWidget = song.songWidget;
- if (!songWidget.can_be_played)
- continue
-
let escapedTitle = GLib.markup_escape_text(song.get_title(), -1);
if (song == currentSong){
songWidget.nowPlayingSign.show();
@@ -324,8 +307,7 @@ const ArtistAlbums = new Lang.Class({
let song = this.model.get_value(iter, 5);
let songWidget = song.songWidget;
let escapedTitle = GLib.markup_escape_text(song.get_title(), -1);
- if (songWidget.can_be_played)
- songWidget.nowPlayingSign.hide();
+ songWidget.nowPlayingSign.hide();
songWidget.title.set_markup("<span>" + escapedTitle + "</span>");
} while(this.model.iter_next(iter));
return false;
@@ -383,30 +365,18 @@ const ArtistAlbumWidget = new Lang.Class({
parseInt((i)%(this.tracks.length/2)), 1, 1);
track.songWidget = songWidget;
let iter = model.append();
+ model.set(iter,
+ [0, 1, 2, 3, 4, 5],
+ [ track.get_title(), "", "", false, pixbuf, track]);
+
songWidget.iter = iter;
songWidget.model = model;
+ songWidget.connect('button-release-event', Lang.bind(
+ this, this.trackSelected));
songWidget.title = ui.get_object("title");
-
- try{
- this.player.discoverer.discover_uri(track.get_url());
- model.set(iter,
- [0, 1, 2, 3, 4, 5],
- [ track.get_title(), "", "", false, nowPlayingPixbuf, track]);
- songWidget.nowPlayingSign = ui.get_object("image1");
- songWidget.nowPlayingSign.set_from_pixbuf(nowPlayingPixbuf);
- songWidget.nowPlayingSign.set_no_show_all("true");
- songWidget.can_be_played = true;
- songWidget.connect('button-release-event', Lang.bind(
- this, this.trackSelected));
- } catch(err) {
- log("failed to discover url " + track.get_url());
- this.model.set(iter,
- [0, 1, 2, 3, 4, 5],
- [ track.get_title(), "", "", true, errorPixbuf, track ]);
- songWidget.nowPlayingSign = ui.get_object("image1");
- songWidget.nowPlayingSign.set_from_pixbuf(errorPixbuf);
- songWidget.can_be_played = false;
- }
+ songWidget.nowPlayingSign = ui.get_object("image1");
+ songWidget.nowPlayingSign.set_from_pixbuf(nowPlayingPixbuf);
+ songWidget.nowPlayingSign.set_no_show_all("true");
}
this.ui.get_object("grid1").show_all();
this.emit("tracks-loaded");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]