diff options
author | 2010-04-02 20:29:08 +0200 | |
---|---|---|
committer | 2010-04-02 20:29:08 +0200 | |
commit | afc9d00750d37e8a1e5e0c35e3c11bab20b2282f (patch) | |
tree | bb97a89c34cb20c03e036ef6a1fb10e9fe4d9fff /plugins/gtkui/gtkui.c | |
parent | 794425e3af729e99c31811b9b2158b0de8ce81a5 (diff) |
added New playlist menu item and ctrl+n shortcut
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 |