diff --git a/gui/collection_mgr.cpp b/gui/collection_mgr.cpp index 7e404638..580c34fd 100644 --- a/gui/collection_mgr.cpp +++ b/gui/collection_mgr.cpp @@ -26,7 +26,8 @@ static void on_collection_update() static void on_collection_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col) { - c_chooser->set_current_folder(colmgr :: get_path(path)); + colmgr :: update_path(path); + enable_idle(); } static void do_collection_delete() diff --git a/include/lib/colmgr.h b/include/lib/colmgr.h index 3d6c714d..7d4464dc 100644 --- a/include/lib/colmgr.h +++ b/include/lib/colmgr.h @@ -12,10 +12,11 @@ namespace colmgr void init(); void add_path(const std::string &); - void del_path(Gtk::TreePath &); - Glib::ustring get_path(const Gtk::TreePath &); + void del_path(const Gtk::TreePath &); + void update_path(const Gtk::TreePath &); void update_paths(); + Glib::ustring get_path(const Gtk::TreePath &); void toggle_path_enabled(const Gtk::TreePath &); }; diff --git a/lib/colmgr.cpp b/lib/colmgr.cpp index d97f62aa..5bcc7e95 100644 --- a/lib/colmgr.cpp +++ b/lib/colmgr.cpp @@ -61,7 +61,7 @@ void colmgr :: add_path(const std::string &path) list_path(library :: add(path)); } -void colmgr :: del_path(Gtk::TreePath &path) +void colmgr :: del_path(const Gtk::TreePath &path) { Gtk::TreeModel::Row row = *(c_list->get_iter(path)); Library *lib = find_library(row); @@ -69,10 +69,10 @@ void colmgr :: del_path(Gtk::TreePath &path) c_list->erase(row); } -Glib::ustring colmgr :: get_path(const Gtk::TreePath &path) +void colmgr :: update_path(const Gtk::TreePath &path) { Gtk::TreeModel::Row row = *(c_list->get_iter(path)); - return row[c_cols.c_path]; + library :: update(find_library(row)); } void colmgr :: update_paths() @@ -87,6 +87,12 @@ void colmgr :: update_paths() } } +Glib::ustring colmgr :: get_path(const Gtk::TreePath &path) +{ + Gtk::TreeModel::Row row = *(c_list->get_iter(path)); + return row[c_cols.c_path]; +} + void colmgr :: toggle_path_enabled(const Gtk::TreePath &path) { Gtk::TreeModel::Row row = *(c_list->get_iter(path)); diff --git a/tests/lib/colmgr.cpp b/tests/lib/colmgr.cpp index 8898ed3a..d6ff2d68 100644 --- a/tests/lib/colmgr.cpp +++ b/tests/lib/colmgr.cpp @@ -43,6 +43,9 @@ void test_colmgr() colmgr :: toggle_path_enabled(path); test_equal(library->enabled, false); + colmgr :: update_path(path); + test_equal(idle :: run_task(), true); + colmgr :: del_path(path); test_equal((size_t)list->children().size(), (size_t)1); } @@ -51,6 +54,7 @@ int main(int argc, char **argv) { Gtk::Main ocarina(&argc, &argv); test :: cp_data_dir(); + test :: gen_library(); lib :: init(&argc, &argv, "ocarina6.glade"); run_test("Collection Manager Test", test_colmgr);