From f66ceea04ef9a373398f0416130b300629405952 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 27 Aug 2009 20:37:13 +0200 Subject: cursor follows playback mode --- gtkplaylist.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'gtkplaylist.c') diff --git a/gtkplaylist.c b/gtkplaylist.c index 488c1dfb..dc0783f4 100644 --- a/gtkplaylist.c +++ b/gtkplaylist.c @@ -42,6 +42,7 @@ #include "search.h" #include "progress.h" #include "drawing.h" +#include "session.h" // orange on dark color scheme float colo_dark_orange[COLO_COUNT][3] = { @@ -741,14 +742,17 @@ gtkpl_playsongnum (int idx) { void gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) { - if (from >= 0 || to >= 0) { - GtkWidget *widget = ps->playlist; - if (from >= 0) { - gtkpl_redraw_pl_row (ps, from, gtkpl_get_for_idx (ps, from)); - } - if (to >= 0) { - gtkpl_redraw_pl_row (ps, to, gtkpl_get_for_idx (ps, to)); - } + GtkWidget *widget = ps->playlist; + if (to >= 0 && session_get_cursor_follows_playback ()) { + gtk_range_set_value (GTK_RANGE (ps->scrollbar), to - ps->nvisiblerows/2); + return; + } + + if (from >= 0) { + gtkpl_redraw_pl_row (ps, from, gtkpl_get_for_idx (ps, from)); + } + if (to >= 0) { + gtkpl_redraw_pl_row (ps, to, gtkpl_get_for_idx (ps, to)); } } -- cgit v1.2.3