diff --git a/gui/collection_mgr.cpp b/gui/collection_mgr.cpp index 4f497348..7e404638 100644 --- a/gui/collection_mgr.cpp +++ b/gui/collection_mgr.cpp @@ -6,12 +6,14 @@ #include #include + +static Gtk::FileChooserWidget *c_chooser; +static Gtk::TreeView *c_treeview; + + static void on_collection_ok() { - Gtk::FileChooserWidget *chooser; - - chooser = lib :: get_widget("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("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("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("o_collection_treeview"); Glib::RefPtr toggle; + c_treeview = lib :: get_widget("o_collection_treeview"); + c_chooser = lib :: get_widget("o_collection_chooser"); toggle = lib :: get_object("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();