changeset 35460:7d1d7f783975

Add listMgr command PLAYLIST_ITEM_FIND. Search for a specific entry in the list.
author ib
date Sun, 02 Dec 2012 00:42:13 +0000
parents 1edb306bc754
children b7696c82c72d
files gui/util/list.c gui/util/list.h
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/list.c	Sun Dec 02 00:38:14 2012 +0000
+++ b/gui/util/list.c	Sun Dec 02 00:42:13 2012 +0000
@@ -96,6 +96,21 @@
         } else
             return listMgr(PLAYLIST_ITEM_APPEND, pdat);
 
+    case PLAYLIST_ITEM_FIND:
+
+        if (plList) {
+            plItem *item = plList;
+
+            do {
+                if (gstrcmp(item->path, pdat->path) == 0 && gstrcmp(item->name, pdat->name) == 0)
+                    return item;
+
+                item = item->next;
+            } while (item);
+        }
+
+        return NULL;
+
     case PLAYLIST_ITEM_SET_CURR:
 
         plCurrent = pdat;
--- a/gui/util/list.h	Sun Dec 02 00:38:14 2012 +0000
+++ b/gui/util/list.h	Sun Dec 02 00:42:13 2012 +0000
@@ -24,6 +24,7 @@
     PLAYLIST_GET,
     PLAYLIST_ITEM_APPEND,
     PLAYLIST_ITEM_INSERT,
+    PLAYLIST_ITEM_FIND,
     PLAYLIST_ITEM_SET_CURR,
     PLAYLIST_ITEM_GET_CURR,
     PLAYLIST_ITEM_GET_POS,