gui: Change chooser directory when selected path is changed
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
2094227f91
commit
fdb31916a6
|
@ -11,6 +11,20 @@ static Gtk::FileChooserWidget *c_chooser;
|
|||
static Gtk::TreeView *c_treeview;
|
||||
|
||||
|
||||
static void cd_chooser(const std::string &dir)
|
||||
{
|
||||
if (c_chooser->get_current_folder() != dir)
|
||||
c_chooser->set_current_folder(dir);
|
||||
}
|
||||
|
||||
static bool find_cur_path(Gtk::TreePath &path)
|
||||
{
|
||||
Gtk::TreeViewColumn *col;
|
||||
c_treeview->get_cursor(path, col);
|
||||
return !path.empty();
|
||||
}
|
||||
|
||||
|
||||
static void on_ok()
|
||||
{
|
||||
colmgr :: add_path(c_chooser->get_filename());
|
||||
|
@ -25,18 +39,21 @@ static void on_update()
|
|||
|
||||
static void on_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 on_cursor_changed()
|
||||
{
|
||||
Gtk::TreePath path;
|
||||
if (find_cur_path(path))
|
||||
cd_chooser(colmgr :: get_path(path));
|
||||
}
|
||||
|
||||
static void on_delete()
|
||||
{
|
||||
Gtk::TreePath path;
|
||||
Gtk::TreeViewColumn *col;
|
||||
|
||||
c_treeview->get_cursor(path, col);
|
||||
if (path)
|
||||
if (find_cur_path(path))
|
||||
colmgr :: del_path(path);
|
||||
}
|
||||
|
||||
|
@ -67,6 +84,7 @@ void collection_mgr_init()
|
|||
connect_button("o_collection_update", on_update);
|
||||
|
||||
c_treeview->signal_row_activated().connect(sigc::ptr_fun(on_row_activated));
|
||||
c_treeview->signal_cursor_changed().connect(sigc::ptr_fun(on_cursor_changed));
|
||||
c_treeview->signal_key_press_event().connect(sigc::ptr_fun(on_key_pressed));
|
||||
toggle->signal_toggled().connect(sigc::ptr_fun(on_toggled));
|
||||
|
||||
|
|
Loading…
Reference in New Issue