diff --git a/src/utils.c b/src/utils.c
index 49841a350c1baffd57aee9d208492f0860d1eb3f..58340c42ece27d90c977dc9f9a8172e722e46d2b 100644 (file)
--- a/src/utils.c
+++ b/src/utils.c
/* create a list suiteble for GCompletion from path */
GList *
-gcmp_list_from_path(mpdclient_t *c, gchar *path, GList *list)
+gcmp_list_from_path(mpdclient_t *c, gchar *path, GList *list, gint types)
{
GList *flist = NULL;
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity = entry ? entry->entity : NULL;
char *name = NULL;
- if( entity && entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY )
+ if( entity && entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY &&
+ types & GCMP_TYPE_DIR)
{
mpd_Directory *dir = entity->info.directory;
gchar *tmp = utf8_to_locale(dir->path);
strcat(name, "/");
g_free(tmp);
}
- else if( entity && entity->type==MPD_INFO_ENTITY_TYPE_SONG )
+ else if( entity && entity->type==MPD_INFO_ENTITY_TYPE_SONG &&
+ types & GCMP_TYPE_FILE )
{
mpd_Song *song = entity->info.song;
name = utf8_to_locale(song->file);
}
+ else if( entity && entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE &&
+ types & GCMP_TYPE_PLAYLIST )
+ {
+ mpd_PlaylistFile *plf = entity->info.playlistFile;
+ name = utf8_to_locale(plf->path);
+ }
+
if( name )
list = g_list_append(list, name);