summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-17 22:39:47 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-17 22:39:47 +0100
commitfc493f5e80de2860c73b998c8ce187ea68bedcdf (patch)
tree6cc06a89530d8b2bc9d8ca1a3e361cf9fdc465af /playlist.c
parentf30ba666c5fa2a16c0b5b2ee1d253ab2ac71de09 (diff)
fix bug #1020: incorrect cursor/scroll after deleting playlists
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/playlist.c b/playlist.c
index 3cf80dae..33a059cd 100644
--- a/playlist.c
+++ b/playlist.c
@@ -265,6 +265,10 @@ plt_gen_conf (void) {
char s[100];
snprintf (s, sizeof (s), "playlist.tab.%02d", i);
conf_set_str (s, p->title);
+ snprintf (s, sizeof (s), "playlist.cursor.%d", i);
+ conf_set_int (s, p->current_row[PL_MAIN]);
+ snprintf (s, sizeof (s), "playlist.scroll.%d", i);
+ conf_set_int (s, p->scroll);
}
UNLOCK;
}
@@ -2166,6 +2170,7 @@ pl_save_all (void) {
int curr = plt_get_curr_idx ();
int err = 0;
+ plt_gen_conf ();
plt_loading = 1;
for (i = 0; i < cnt; i++, p = p->next) {
if (snprintf (path, sizeof (path), "%s/playlists/%d.dbpl", dbconfdir, i) > sizeof (path)) {
@@ -2523,6 +2528,11 @@ pl_load_all (void) {
if (trk) {
pl_item_unref (trk);
}
+ char conf[100];
+ snprintf (conf, sizeof (conf), "playlist.cursor.%d", i);
+ plt->current_row[PL_MAIN] = deadbeef->conf_get_int (conf, -1);
+ snprintf (conf, sizeof (conf), "playlist.scroll.%d", i);
+ plt->scroll = deadbeef->conf_get_int (conf, 0);
plt_unref (plt);
if (!it) {
@@ -4133,3 +4143,14 @@ plt_deselect_all (playlist_t *playlist) {
}
UNLOCK;
}
+
+void
+plt_set_scroll (playlist_t *plt, int scroll) {
+ plt->scroll = scroll;
+}
+
+int
+plt_get_scroll (playlist_t *plt) {
+ return plt->scroll;
+}
+