diff options
Diffstat (limited to 'plugins/gtkui/gtkui.c')
-rw-r--r-- | plugins/gtkui/gtkui.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 12afe93d..d08af942 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -667,6 +667,34 @@ redraw_seekbar_cb (gpointer nothing) { return FALSE; } +int +gtkui_add_new_playlist (void) { + int cnt = deadbeef->plt_get_count (); + int i; + int idx = 0; + for (;;) { + char name[100]; + if (!idx) { + strcpy (name, "New Playlist"); + } + else { + snprintf (name, sizeof (name), "New Playlist (%d)", idx); + } + for (i = 0; i < cnt; i++) { + char t[100]; + deadbeef->plt_get_title (i, t, sizeof (t)); + if (!strcasecmp (t, name)) { + break; + } + } + if (i == cnt) { + return deadbeef->plt_add (cnt, name); + } + idx++; + } + return -1; +} + static int gtk_initialized = 0; void |