Commit 37984dc2 authored by Seif Lotfy's avatar Seif Lotfy

Fix sorting of titles of songs in albumsongs view

parent 97100fea
......@@ -72,6 +72,7 @@
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">24</property>
<property name="column_homogeneous">True</property>
<child>
<placeholder/>
......
......@@ -8,10 +8,11 @@
<property name="margin_bottom">1</property>
<child>
<object class="GtkLabel" id="num">
<property name="width_request">32</property>
<property name="width_request">24</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="xalign">1</property>
<attributes>
<attribute name="foreground" value="#bababdbdb6b6"/>
</attributes>
......@@ -36,6 +37,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">9</property>
<property name="position">2</property>
</packing>
</child>
......
......@@ -276,6 +276,8 @@ const ArtistAlbumWidget = new Lang.Class({
this.album = album;
this.songs = [];
var track_count = album.get_childcount();
this.ui = new Gtk.Builder();
this.ui.add_from_resource('/org/gnome/music/ArtistAlbumWidget.ui');
this.model = this.ui.get_object("liststore1");
......@@ -297,29 +299,32 @@ const ArtistAlbumWidget = new Lang.Class({
if (track != null) {
tracks.push(track);
track.origin = this;
//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);
//this.model.set(iter,
// [0, 1, 2, 3, 4, 5],
// [ track.get_title(), track.get_track_number(), "", false, pixbuf, track ]);
var ui = new Gtk.Builder();
ui.add_from_resource('/org/gnome/music/TrackWidget.ui');
var songWidget = ui.get_object("box1");
this.songs.push(songWidget);
ui.get_object("num").set_text(this.songs.length.toString());
if (track.get_title() != null)
ui.get_object("title").set_text(track.get_title());
//var songWidget = ui.get_object("duration").set_text(track.get_title());
ui.get_object("title").set_alignment(0.0, 0.5);
if (this.songs.length == 1) {
this.ui.get_object("grid1").add(songWidget);
}
else {
var i = this.songs.length - 1;
this.ui.get_object("grid1").attach(songWidget, i%2, parseInt(i/2), 1, 1)
}
else {
var titles = []
for (var i=0; i<tracks.length; i++) {
track = tracks[i];
if (titles.indexOf(track.get_title()) == -1) {
titles.push(track.get_title())
var ui = new Gtk.Builder();
ui.add_from_resource('/org/gnome/music/TrackWidget.ui');
var songWidget = ui.get_object("box1");
this.songs.push(songWidget);
ui.get_object("num").set_text(this.songs.length.toString());
if (track.get_title() != null)
ui.get_object("title").set_text(track.get_title());
//var songWidget = ui.get_object("duration").set_text(track.get_title());
ui.get_object("title").set_alignment(0.0, 0.5);
if (this.songs.length == 1) {
this.ui.get_object("grid1").add(songWidget);
}
else {
var i = this.songs.length - 1;
this.ui.get_object("grid1").attach(songWidget, parseInt(i/(tracks.length/2)), parseInt((i)%(tracks.length/2)), 1, 1)
}
this.ui.get_object("grid1").show_all();
}
}
this.ui.get_object("grid1").show_all();
//ui.get_object("image1").hide();
}
}));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment