[Xfce4-commits] <xfmpc:master> playlist: pick the correct song when the playlist is filtered

Vincent Legout noreply at xfce.org
Sat Oct 22 14:42:01 CEST 2011


Updating branch refs/heads/master
         to 7ff0ad1c5370b5274ebccfc43bca18ae83a56a40 (commit)
       from 77edf6dc929e40c230a3c10a858dc075047158e5 (commit)

commit 7ff0ad1c5370b5274ebccfc43bca18ae83a56a40
Author: Vincent Legout <vincent at legout.info>
Date:   Sat Oct 22 11:09:35 2011 +0200

    playlist: pick the correct song when the playlist is filtered
    
    Always use filter to find the track instead of store because store
    doesn't know if the tree is filtered or not. This should fix bug #7992.

 src/playlist.vala |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/playlist.vala b/src/playlist.vala
index e94f3c1..49968cf 100644
--- a/src/playlist.vala
+++ b/src/playlist.vala
@@ -145,7 +145,7 @@ namespace Xfmpc {
 			bool result = true;
 
 			model.get (iter, Columns.COLUMN_SONG, &song, -1);
-			if (song == "")
+			if (song == null || song == "")
 				return true;
 
 			search = filter_entry.get_text ();
@@ -176,16 +176,16 @@ namespace Xfmpc {
 			if (selection.count_selected_rows () > 1)
 				return;
 
-			Gtk.TreeModel model = this.store;
+			Gtk.TreeModel model = this.filter;
 			var list = selection.get_selected_rows (out model);
 			if (list.length () == 0)
 				return;
 
 			Gtk.TreeIter iter;
 			var path = list.nth_data (0);
-			if (this.store.get_iter (out iter, path)) {
+			if (this.filter.get_iter (out iter, path)) {
 				string filename = "", dir;
-				store.get (iter, Columns.COLUMN_FILENAME, out filename, -1);
+				filter.get (iter, Columns.COLUMN_FILENAME, out filename, -1);
 				dir = GLib.Path.get_dirname (filename);
 				dbbrowser.set_wdir (dir);
 				dbbrowser.reload ();
@@ -201,15 +201,15 @@ namespace Xfmpc {
 			if (selection.count_selected_rows () > 1)
 				return;
 
-			Gtk.TreeModel model = this.store;
+			Gtk.TreeModel model = this.filter;
 			var list = selection.get_selected_rows (out model);
 			if (list.length () == 0)
 				return;
 
 			var path = list.nth_data (0);
 
-			if (this.store.get_iter (out iter, path)) {
-				this.store.get (iter, Columns.COLUMN_ID, out id, -1);
+			if (this.filter.get_iter (out iter, path)) {
+				this.filter.get (iter, Columns.COLUMN_ID, out id, -1);
 				var dialog = new Xfmpc.SongDialog (id);
 				dialog.show_all ();
 			}
@@ -403,13 +403,13 @@ namespace Xfmpc {
 		public void delete_selection () {
 			int id = 0;
 			Gtk.TreeIter iter;
-			Gtk.TreeModel model = this.store;
+			Gtk.TreeModel model = this.filter;
 
 			var list = (this.treeview.get_selection ()).get_selected_rows (out model);
 
 			foreach (Gtk.TreePath path in list) {
-				if (this.store.get_iter (out iter, path)) {
-					this.store.get (iter, Columns.COLUMN_ID, out id, -1);
+				if (this.filter.get_iter (out iter, path)) {
+					this.filter.get (iter, Columns.COLUMN_ID, out id, -1);
 					this.mpdclient.queue_remove_id (id);
 				}
 			}


More information about the Xfce4-commits mailing list