summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40875b7)
raw | patch | inline | side by side (parent: 40875b7)
author | Max Kellermann <max@duempel.org> | |
Fri, 3 Oct 2008 09:53:55 +0000 (11:53 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 3 Oct 2008 09:53:55 +0000 (11:53 +0200) |
The function filelist_find_directory() will be useful for the
following patch.
following patch.
src/filelist.c | patch | blob | history | |
src/filelist.h | patch | blob | history |
diff --git a/src/filelist.c b/src/filelist.c
index 46137cd3b00ca6f15df939b6e4003eea0b2d18f5..415eec4021a6038c5def9f96a1d05b6871e52f5f 100644 (file)
--- a/src/filelist.c
+++ b/src/filelist.c
return NULL;
}
+
+int
+filelist_find_directory(struct filelist *filelist, const char *name)
+{
+ guint i;
+
+ assert(name != NULL);
+
+ for (i = 0; i < filelist_length(filelist); ++i) {
+ struct filelist_entry *entry = filelist_get(filelist, i);
+ mpd_InfoEntity *entity = entry->entity;
+
+ if (entity && entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY &&
+ strcmp(entity->info.directory->path, name) == 0)
+ return i;
+ }
+
+ return -1;
+}
diff --git a/src/filelist.h b/src/filelist.h
index 85e551fc3619943461b2e59659ae2ffcf7ddd8d5..d7d4dff888ba107bbbccb76506ab86d355b216db 100644 (file)
--- a/src/filelist.h
+++ b/src/filelist.h
struct filelist_entry *
filelist_find_song(struct filelist *flist, const struct mpd_song *song);
+int
+filelist_find_directory(struct filelist *filelist, const char *name);
+
#endif