libsaria: Remove operator[] for Track.banned

Public access to this variable is simpler and probably more efficient.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-11-24 16:59:25 -05:00 committed by Anna Schumaker
parent aaf1205078
commit 56dd54f114
4 changed files with 4 additions and 17 deletions

View File

@ -36,10 +36,6 @@ enum track_iprop_t {
TRACK_CHANNELS,
};
enum track_bprop_t {
TRACK_BANNED,
};
namespace libsaria
{
namespace library
@ -102,7 +98,6 @@ namespace libsaria
string &operator[](track_sprop_t);
unsigned int &operator[](track_uiprop_t);
int &operator[](track_iprop_t);
bool &operator[](track_bprop_t);
};
Track *current_track();

View File

@ -31,7 +31,7 @@ libsaria::library::Path *push_path(libsaria::library::Path &path)
static void hide_track(libsaria::Track *track)
{
if ((*track)[TRACK_BANNED])
if (track->banned)
libsaria::ban::get_banned_plist()->remove_track(track);
else
lib_playlist.remove_track(track);
@ -112,7 +112,7 @@ namespace libsaria
for (unsigned int i = 0; i < path->tracks.size(); i++) {
track = path->tracks[i];
if ((*track)[TRACK_BANNED])
if (track->banned)
ban.push_back(track);
else
lib.push_back(track);

View File

@ -100,12 +100,4 @@ namespace libsaria
}
}
bool &Track::operator[](track_bprop_t property)
{
switch (property) {
default: /* TRACK_BANNED */
return banned;
}
}
}

View File

@ -34,7 +34,7 @@ void update_labels(libsaria::Track *track)
set_label("AlbumLabel", (*track)[TRACK_ALBUM], "x-large");
set_label("DurLabel", (*track)[TRACK_LENSTR], "");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(get_widget("BanButton")),
(*track)[TRACK_BANNED]);
track->banned);
}
void update_buttons(notify_t event)
@ -122,7 +122,7 @@ static void toggle_ban(GtkWidget *b, gpointer d)
else
gtk_button_set_image(GTK_BUTTON(ban), get_widget("YesImage"));
if ((*cur)[TRACK_BANNED] == banned)
if (cur->banned == banned)
return;
cur->set_banned(banned);