summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gtkui/ddblistview.h1
-rw-r--r--plugins/gtkui/ddbtabstrip.c12
-rw-r--r--plugins/gtkui/gtkui.c10
-rw-r--r--plugins/gtkui/mainplaylist.c3
4 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h
index 8569f53e..30ffa86d 100644
--- a/plugins/gtkui/ddblistview.h
+++ b/plugins/gtkui/ddblistview.h
@@ -84,6 +84,7 @@ typedef struct {
void (*col_sort) (int col, int sort_order, void *user_data);
void (*col_free_user_data) (void *user_data);
void (*vscroll_changed) (int pos);
+ void (*cursor_changed) (int pos);
} DdbListviewBinding;
struct _DdbListviewColumn;
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index af3368d2..3d56f38e 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -803,16 +803,28 @@ on_tabstrip_motion_notify_event (GtkWidget *widget,
if (inspos >= 0 && inspos != ts->dragging) {
char str1[100];
char str2[100];
+ char strcursor1[100];
+ char strcursor2[100];
int pos1;
int pos2;
+ int cursor1;
+ int cursor2;
snprintf (str1, sizeof (str1), "playlist.scroll.%d", ts->dragging);
pos1 = deadbeef->conf_get_int (str1, 0);
snprintf (str2, sizeof (str2), "playlist.scroll.%d", inspos);
pos2 = deadbeef->conf_get_int (str2, 0);
+
+ snprintf (strcursor1, sizeof (strcursor1), "playlist.cursor.%d", ts->dragging);
+ cursor1 = deadbeef->conf_get_int (strcursor1, 0);
+ snprintf (strcursor2, sizeof (strcursor2), "playlist.cursor.%d", inspos);
+ cursor2 = deadbeef->conf_get_int (strcursor2, 0);
+
deadbeef->plt_move (ts->dragging, inspos);
tab_moved = 1;
deadbeef->conf_set_int (str1, pos2);
deadbeef->conf_set_int (str2, pos1);
+ deadbeef->conf_set_int (strcursor1, cursor2);
+ deadbeef->conf_set_int (strcursor2, cursor1);
ts->dragging = inspos;
deadbeef->conf_set_int ("playlist.current", ts->dragging);
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 31cc5f85..9c7eb63b 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -506,9 +506,19 @@ playlistswitch_cb (gpointer none) {
char conf[100];
snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr);
int scroll = deadbeef->conf_get_int (conf, 0);
+ snprintf (conf, sizeof (conf), "playlist.cursor.%d", curr);
+ int cursor = deadbeef->conf_get_int (conf, -1);
// gdk_window_invalidate_rect (tabstrip->window, NULL, FALSE);
ddb_tabstrip_refresh (DDB_TABSTRIP (tabstrip));
DdbListview *listview = DDB_LISTVIEW (lookup_widget (mainwin, "playlist"));
+ deadbeef->pl_set_cursor (PL_MAIN, cursor);
+ if (cursor != -1) {
+ DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (cursor, PL_MAIN);
+ if (it) {
+ deadbeef->pl_set_selected (it, 1);
+ deadbeef->pl_item_unref (it);
+ }
+ }
playlist_refresh ();
ddb_listview_set_vscroll (listview, scroll);
search_refresh ();
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 7ad6e0ad..84e62951 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -64,6 +64,9 @@ main_get_cursor (void) {
static void
main_set_cursor (int cursor) {
+ char conf[100];
+ snprintf (conf, sizeof (conf), "playlist.cursor.%d", deadbeef->plt_get_curr ());
+ deadbeef->conf_set_int (conf, cursor);
return deadbeef->pl_set_cursor (PL_MAIN, cursor);
}