[sound-juicer/wip/better-editing: 3/13] Fix playback with multiple track selection
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer/wip/better-editing: 3/13] Fix playback with multiple track selection
- Date: Fri, 25 Jul 2014 08:54:33 +0000 (UTC)
commit 7227116586c2688241a334f4bcbcd1d7c32a2c49
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Tue Jun 11 10:56:04 2013 +0100
Fix playback with multiple track selection
Prepare support for multiple selections. Only change seek_to_track if
there is a single track selected.
https://bugzilla.gnome.org/show_bug.cgi?id=151469
src/sj-play.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/sj-play.c b/src/sj-play.c
index 58bea19..396efaf 100644
--- a/src/sj-play.c
+++ b/src/sj-play.c
@@ -506,21 +506,29 @@ set_gst_ui_and_play (void)
}
}
+static void
+select_track_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gint track;
+
+ gtk_tree_model_get (model, iter, COLUMN_NUMBER, &track, -1);
+ seek_to_track = track - 1;
+}
+
G_MODULE_EXPORT void
on_tracklist_row_selected (GtkTreeView *treeview,
gpointer user_data)
{
- gint track;
GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
if (is_playing () || is_paused ())
return;
- if (gtk_tree_selection_get_selected (selection, NULL, ¤t_iter)) {
- gtk_tree_model_get (GTK_TREE_MODEL (track_store),
- ¤t_iter, COLUMN_NUMBER, &track, -1);
- seek_to_track = track - 1;
- }
+ if (gtk_tree_selection_count_selected_rows (selection) == 1)
+ gtk_tree_selection_selected_foreach (selection, select_track_foreach, NULL);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]