libsaria: Give playlists an apparent_size() function

This will return the number of visible songs, instead of the number of
songs in the playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-22 10:03:40 -05:00
parent 9980f53f63
commit d075773682
3 changed files with 9 additions and 3 deletions

View File

@ -49,6 +49,7 @@ namespace libsaria
void sort();
unsigned int size();
unsigned int apparent_size();
Track *next();
/* Iterator functions */

View File

@ -42,9 +42,7 @@ namespace libsaria
unsigned int library::size()
{
if (index::is_filtered() == true)
return index::size();
return lib_playlist.size();
return lib_playlist.apparent_size();
}
}

View File

@ -1,5 +1,6 @@
// Copyright (c) 2012 Bryan Schumaker.
#include <libsaria/files.h>
#include <libsaria/index.h>
#include <libsaria/library.h>
#include <libsaria/playlist.h>
@ -71,4 +72,10 @@ namespace libsaria
return plist.size();
}
unsigned int Playlist::apparent_size()
{
if ( (flags & PL_FILTER) && (index::is_filtered()) )
return index::size();
return plist.size();
}
}