aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-19 19:33:46 +0000
committerKalle Wallin <kaw@linux.se>2004-06-19 19:33:46 +0000
commit7534ac103fd0499f7359304f8cb81a3f250968bb (patch)
treeeffe54670895e7a3cd1049d9a8b0fe281c1946d0 /src/utils.c
parent96ba600d2385d910d02339c257154e3da4f1aa13 (diff)
downloadmpd-7534ac103fd0499f7359304f8cb81a3f250968bb.tar.gz
mpd-7534ac103fd0499f7359304f8cb81a3f250968bb.tar.xz
mpd-7534ac103fd0499f7359304f8cb81a3f250968bb.zip
added type argument to gcmp_list_from_path()
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1567 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/utils.c b/src/utils.c
index 49841a350..58340c42e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -81,7 +81,7 @@ string_list_remove(GList *string_list, gchar *str)
/* 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;
@@ -96,7 +96,8 @@ gcmp_list_from_path(mpdclient_t *c, gchar *path, GList *list)
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);
@@ -106,11 +107,19 @@ gcmp_list_from_path(mpdclient_t *c, gchar *path, GList *list)
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);