Skip to content

Commit 5c5d44a

Browse files
gtkui: fix auto-naming playlists regression (fixes #3168)
1 parent 2fc8290 commit 5c5d44a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

plugins/gtkui/fileman.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ gtkpl_add_dirs (ddb_playlist_t *plt, GSList *lst) {
4848
char t[1000];
4949
if (!deadbeef->plt_get_title (plt, t, sizeof (t))) {
5050
char *def = _("New Playlist");
51-
if (!strncmp (t, def, strlen (def)) || empty) {
51+
if (empty || !strncmp (t, def, strlen (def))) {
5252
const char *folder = strrchr ((char*)lst->data, G_DIR_SEPARATOR);
5353
if (!folder) {
5454
folder = lst->data;
@@ -76,7 +76,14 @@ gtkpl_add_files (ddb_playlist_t *plt, GSList *lst) {
7676
void
7777
gtkui_add_dirs (GSList *lst) {
7878
ddb_playlist_t *plt_curr = deadbeef->plt_get_curr ();
79-
ddb_playlist_t *plt = deadbeef->plt_alloc ("add-dirs");
79+
80+
char *title = malloc(1000);
81+
deadbeef->plt_get_title (plt_curr, title, 1000);
82+
83+
ddb_playlist_t *plt = deadbeef->plt_alloc (title);
84+
85+
free (title);
86+
title = NULL;
8087

8188
if (deadbeef->plt_add_files_begin (plt_curr, 0) < 0) {
8289
deadbeef->plt_unref (plt);
@@ -92,6 +99,15 @@ gtkui_add_dirs (GSList *lst) {
9299

93100
gtkui_dispatch_on_main(^{
94101
ddb_playItem_t *tail = deadbeef->plt_get_tail_item(plt_curr, PL_MAIN);
102+
103+
char *new_title = malloc(1000);
104+
105+
deadbeef->plt_get_title(plt, new_title, 1000);
106+
deadbeef->plt_set_title(plt_curr, new_title);
107+
108+
free (new_title);
109+
new_title = NULL;
110+
95111
ddb_undo->set_action_name (_("Add Folders"));
96112
deadbeef->plt_move_all_items (plt_curr, plt, tail);
97113
if (tail != NULL) {

0 commit comments

Comments
 (0)