diff --git a/PKGBUILD b/PKGBUILD index 0c2d6f95..f49bcff7 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Anna Schumaker pkgname=ocarina -pkgver=6.1.1 +pkgver=6.1.3 pkgrel=1 pkgdesc="A simple GTK and gstreamer based music player." url="http://www.ocarinaproject.net/" @@ -13,7 +13,7 @@ conflicts=() replaces=() backup=() source=("http://ocarinaproject.net/wp-content/ocarina/${pkgname}-${pkgver}.tar.gz") -sha1sums=('7fa6275aeba85b86988b5a3c88bafc7c6e36ec88') +sha1sums=('d54ba4ca864d988475337a8b44feec0f84cc46d1') build() { cd "${srcdir}/${pkgname}-${pkgver}" diff --git a/core/filter.cpp b/core/filter.cpp index 941c797f..71a82ccb 100644 --- a/core/filter.cpp +++ b/core/filter.cpp @@ -90,14 +90,21 @@ std::string filter :: add(const std::string &text, unsigned int track_id) return reassemble_text(parsed); } +static void do_set_intersection(std::set &a, + std::set &b, + std::set &res) +{ + set_intersection(a.begin(), a.end(), b.begin(), b.end(), + std::inserter >(res, res.begin())); +} + static void find_intersection(std::string &text, std::set &res) { - IndexEntry *it = filter_index.find(text); std::set tmp; + IndexEntry *it = filter_index.find(text); - set_intersection(it->values.begin(), it->values.end(), - res.begin(), res.end(), - std::inserter >(tmp, tmp.begin())); + if (it) + do_set_intersection(res, it->values, tmp); res.swap(tmp); } @@ -107,6 +114,7 @@ void filter :: search(const std::string &text, std::set &res) std::list::iterator it; IndexEntry *found; + res.clear(); parse_text(text, parsed); if (parsed.size() == 0) return; diff --git a/gui/collection_mgr.cpp b/gui/collection_mgr.cpp index bb42876f..d5a88f64 100644 --- a/gui/collection_mgr.cpp +++ b/gui/collection_mgr.cpp @@ -2,6 +2,7 @@ * Copyright 2014 (c) Anna Schumaker. */ #include +#include #include #include #include diff --git a/gui/gui.cpp b/gui/gui.cpp index 173742cf..8e621b49 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -108,9 +108,10 @@ static void on_ban_toggled() { Gtk::ToggleButton *ban = lib :: get_widget("o_ban"); - if (ban->get_active() == true) + if (ban->get_active() == true) { playlist :: add(audio :: current_track(), "Banned"); - else + on_next(); + } else playlist :: del(audio::current_track(), "Banned"); } diff --git a/lib/colmgr.cpp b/lib/colmgr.cpp index 1a7c7231..fc5f0d63 100644 --- a/lib/colmgr.cpp +++ b/lib/colmgr.cpp @@ -2,6 +2,7 @@ * Copyright 2014 (c) Anna Schumaker. */ #include +#include #include #include #include @@ -48,6 +49,18 @@ static void list_path(Library *lib) row[c_cols.c_path] = lib->root_path; } +static void library_remove_banned() +{ + std::set::iterator it; + IndexEntry *ent = playlist :: get_tracks("Banned"); + + if (!ent) + return; + + for (it = ent->values.begin(); it != ent->values.end(); it++) + library :: get_queue()->del(tagdb :: lookup(*it)); +} + void colmgr :: init() { Database::iterator it; @@ -103,4 +116,7 @@ void colmgr :: toggle_path_enabled(const Gtk::TreePath &path) Library *lib = find_library(row); row[c_cols.c_enabled] = !row[c_cols.c_enabled]; library :: set_enabled(lib, row[c_cols.c_enabled]); + + if (row[c_cols.c_enabled]) + library_remove_banned(); } diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade index 61f041a9..7de5029c 100644 --- a/share/ocarina/ocarina6.glade +++ b/share/ocarina/ocarina6.glade @@ -217,7 +217,7 @@ True False - Ocarina 6.1.1 + Ocarina 6.1.3 1024 683 diff --git a/tests/core/filter.cpp b/tests/core/filter.cpp index 75b27767..127e70f5 100644 --- a/tests/core/filter.cpp +++ b/tests/core/filter.cpp @@ -64,7 +64,8 @@ static void test_add() static void do_test_search(const std::string &text, unsigned int len, unsigned int *ids) { - std::set res; + int init_values[] = { 1, 2, 3, 4, 5 }; + std::set res(init_values, init_values + 5); std::set::iterator it; filter :: search(text, res); @@ -96,6 +97,7 @@ static void test_search() unsigned int res5[] = {}; do_test_search("unknown terms", 0, res5); + do_test_search("the chestZ", 0, res5); } int main(int argc, char **argv)