summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deadbeef.h2
-rw-r--r--main.c6
-rw-r--r--playlist.c3
-rw-r--r--playlist.h2
-rw-r--r--plugins/gtkui/ddbtabstrip.c6
5 files changed, 10 insertions, 9 deletions
diff --git a/deadbeef.h b/deadbeef.h
index e6fad0f4..e7401cf9 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -282,7 +282,7 @@ typedef struct {
int (*cond_broadcast) (uintptr_t cond);
// playlist management
int (*plt_get_count) (void);
- void (*plt_add) (int before, const char *title);
+ int (*plt_add) (int before, const char *title);
void (*plt_remove) (int plt);
void (*plt_free) (void);
void (*plt_set_curr) (int plt);
diff --git a/main.c b/main.c
index 3c888c38..24dff4a0 100644
--- a/main.c
+++ b/main.c
@@ -596,11 +596,7 @@ main (int argc, char *argv[]) {
if (!noloadpl) {
pl_load_all ();
}
- //plt_add (plt_get_count (), "Test 1");
-// plt_add (plt_get_count (), "Test 2");
-// plt_add (plt_get_count (), "Test 3");
-// plt_add (plt_get_count (), "Test 4");
-// plt_add (plt_get_count (), "Test 5");
+ plt_set_curr (conf_get_int ("playlist.current", 0));
plug_trigger_event_playlistchanged ();
// this is old code left for backwards compatibility
diff --git a/playlist.c b/playlist.c
index 78b769e3..b8e7cac8 100644
--- a/playlist.c
+++ b/playlist.c
@@ -175,7 +175,7 @@ plt_get_count (void) {
return playlists_count;
}
-void
+int
plt_add (int before, const char *title) {
trace ("plt_add\n");
playlist_t *plt = malloc (sizeof (playlist_t));
@@ -220,6 +220,7 @@ plt_add (int before, const char *title) {
if (!plt_loading) {
plug_trigger_event (DB_EV_PLAYLISTSWITCH, 0);
}
+ return playlists_count-1;
}
void
diff --git a/playlist.h b/playlist.h
index c14cd643..d92050ac 100644
--- a/playlist.h
+++ b/playlist.h
@@ -100,7 +100,7 @@ plt_get_curr_ptr (void);
int
plt_get_count (void);
-void
+int
plt_add (int before, const char *title);
void
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index fb7a9319..6e538df6 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -408,6 +408,7 @@ on_tabstrip_button_press_event (GtkWidget *widget,
{
if (tab_clicked != -1) {
deadbeef->plt_set_curr (tab_clicked);
+ deadbeef->conf_set_int ("playlist.current", tab_clicked);
}
int x = -ts->hscrollpos + tabs_left_margin;
@@ -516,6 +517,7 @@ on_tabstrip_motion_notify_event (GtkWidget *widget,
deadbeef->conf_set_int (str1, pos2);
deadbeef->conf_set_int (str2, pos1);
ts->dragging = inspos;
+ deadbeef->conf_set_int ("playlist.current", ts->dragging);
}
tabstrip_render (ts);
tabstrip_expose (ts, 0, 0, widget->allocation.width, widget->allocation.height);
@@ -575,7 +577,9 @@ on_add_new_playlist1_activate (GtkMenuItem *menuitem,
}
}
if (i == cnt) {
- deadbeef->plt_add (cnt, name);
+ int playlist = deadbeef->plt_add (cnt, name);
+ deadbeef->plt_set_curr (playlist);
+ deadbeef->conf_set_int ("playlist.current", playlist);
DdbTabStrip *ts = DDB_TABSTRIP (lookup_widget (mainwin, "tabstrip"));
tabstrip_render (ts);
tabstrip_expose (ts, 0, 0, GTK_WIDGET (ts)->allocation.width, GTK_WIDGET (ts)->allocation.height);