libsaria: Fill out a struct PathInfo
This struct is used by the gui to show how large a library path is and eventually to remove it from the library.
This commit is contained in:
parent
e8341288b3
commit
2a6d05ebee
|
@ -11,6 +11,11 @@ namespace libsaria
|
|||
{
|
||||
namespace library
|
||||
{
|
||||
struct PathInfo {
|
||||
string path;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
void load();
|
||||
void save();
|
||||
void refresh();
|
||||
|
@ -18,6 +23,7 @@ namespace libsaria
|
|||
void add_path(string);
|
||||
void play_id(ino_t);
|
||||
void for_each(void (*)(Track &));
|
||||
void for_each_path(void (*)(struct PathInfo &));
|
||||
|
||||
unsigned int size();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,14 @@ void LibraryPath::for_each(void (*ins_func)(Track &))
|
|||
}
|
||||
}
|
||||
|
||||
void LibraryPath::get_info(void (*info_func)(struct libsaria::library::PathInfo &))
|
||||
{
|
||||
struct libsaria::library::PathInfo info;
|
||||
info.path = path;
|
||||
info.size = size();
|
||||
info_func(info);
|
||||
}
|
||||
|
||||
bool LibraryPath::play_id(ino_t id)
|
||||
{
|
||||
map<ino_t, TrackTag>::iterator it;
|
||||
|
@ -54,6 +62,13 @@ namespace libsaria
|
|||
it->second.for_each(ins_func);
|
||||
}
|
||||
|
||||
void library::for_each_path(void (*info_func)(struct library::PathInfo &))
|
||||
{
|
||||
map<string, LibraryPath>::iterator it;
|
||||
for (it = path_map.begin(); it != path_map.end(); it++)
|
||||
it->second.get_info(info_func);
|
||||
}
|
||||
|
||||
void library::play_id(ino_t id)
|
||||
{
|
||||
map<string, LibraryPath>::iterator it;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/path.h>
|
||||
|
||||
class LibraryPath
|
||||
|
@ -19,6 +20,7 @@ class LibraryPath
|
|||
~LibraryPath();
|
||||
|
||||
void for_each(void (*)(Track &));
|
||||
void get_info(void (*)(struct libsaria::library::PathInfo &));
|
||||
void insert_track(ino_t, TrackTag &);
|
||||
bool play_id(ino_t);
|
||||
void save(OutFile &);
|
||||
|
|
Loading…
Reference in New Issue