gui: Collection manager cleanups

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-06-21 12:44:07 -04:00
parent a5f47e46a8
commit 42ec504b90
1 changed files with 14 additions and 19 deletions

View File

@ -6,12 +6,14 @@
#include <lib/colmgr.h>
#include <gui/ocarina.h>
static Gtk::FileChooserWidget *c_chooser;
static Gtk::TreeView *c_treeview;
static void on_collection_ok()
{
Gtk::FileChooserWidget *chooser;
chooser = lib :: get_widget<Gtk::FileChooserWidget>("o_collection_chooser");
colmgr :: add_path(chooser->get_filename());
colmgr :: add_path(c_chooser->get_filename());
enable_idle();
}
@ -24,20 +26,15 @@ static void on_collection_update()
static void on_collection_row_activated(const Gtk::TreePath &path,
Gtk::TreeViewColumn *col)
{
Gtk::FileChooser *chooser = lib :: get_widget<Gtk::FileChooser>("o_collection_chooser");
chooser->set_current_folder(colmgr :: get_path(path));
c_chooser->set_current_folder(colmgr :: get_path(path));
}
#ifndef CONFIG_TEST
static
#endif /* CONFIG_TEST */
void do_collection_delete()
static void do_collection_delete()
{
Gtk::TreePath path;
Gtk::TreeViewColumn *col;
Gtk::TreeView *treeview = lib :: get_widget<Gtk::TreeView>("o_collection_treeview");
treeview->get_cursor(path, col);
c_treeview->get_cursor(path, col);
if (path)
colmgr :: del_path(path);
}
@ -52,26 +49,24 @@ static bool on_collection_key_pressed(GdkEventKey *event)
return false;
}
#ifndef CONFIG_TEST
static
#endif /* CONFIG_TEST */
void on_collection_toggled(const Glib::ustring &path)
static void on_collection_toggled(const Glib::ustring &path)
{
colmgr :: toggle_path_enabled(Gtk::TreePath(path));
}
void collection_mgr_init()
{
Gtk::TreeView *treeview = lib :: get_widget<Gtk::TreeView>("o_collection_treeview");
Glib::RefPtr<Gtk::CellRendererToggle> toggle;
c_treeview = lib :: get_widget<Gtk::TreeView>("o_collection_treeview");
c_chooser = lib :: get_widget<Gtk::FileChooserWidget>("o_collection_chooser");
toggle = lib :: get_object<Gtk::CellRendererToggle>("o_collection_toggle");
connect_button("o_collection_ok", on_collection_ok);
connect_button("o_collection_update", on_collection_update);
treeview->signal_row_activated().connect(sigc::ptr_fun(on_collection_row_activated));
treeview->signal_key_press_event().connect(sigc::ptr_fun(on_collection_key_pressed));
c_treeview->signal_row_activated().connect(sigc::ptr_fun(on_collection_row_activated));
c_treeview->signal_key_press_event().connect(sigc::ptr_fun(on_collection_key_pressed));
toggle->signal_toggled().connect(sigc::ptr_fun(on_collection_toggled));
colmgr :: init();