diff options
-rw-r--r-- | deadbeef.h | 2 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | playlist.c | 3 | ||||
-rw-r--r-- | playlist.h | 2 | ||||
-rw-r--r-- | plugins/gtkui/ddbtabstrip.c | 6 |
5 files changed, 10 insertions, 9 deletions
@@ -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); @@ -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 @@ -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 @@ -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); |