diff options
author | waker <wakeroid@gmail.com> | 2009-08-27 20:37:13 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2009-08-27 20:37:13 +0200 |
commit | f66ceea04ef9a373398f0416130b300629405952 (patch) | |
tree | a4b50ec4011845499cf1e934cd903ce35d63e149 /gtkplaylist.c | |
parent | 05bd1d579b05814725b65d1380b600bfdec5ae28 (diff) |
cursor follows playback mode
Diffstat (limited to 'gtkplaylist.c')
-rw-r--r-- | gtkplaylist.c | 20 |
1 files changed, 12 insertions, 8 deletions
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)); } } |