//------------------------------------------------------------------------------ void DbMySQLTableEditorIndexPage::switch_be(MySQLTableEditorBE *be) { if (!_editing_sig.empty()) _editing_sig.disconnect(); _index_node = bec::NodeId(); _indexes_columns_model.clear(); Gtk::TreeView *tv = 0; _xml->get_widget("index_columns", tv); tv->remove_all_columns(); tv->unset_model(); _be = be; _be->get_indexes()->select_index(_index_node); // refresh is done from TableEd _indexes_tv->remove_all_columns(); _indexes_model = ListModelWrapper::create(_be->get_indexes(), _indexes_tv, "DbMySQLTableEditorIndexPage"); _indexes_model->model().append_string_column(0, "Index Name", EDITABLE, NO_ICON); _indexes_model->model().append_combo_column(1, "Type", model_from_string_list(_be->get_index_types()), EDITABLE, true); _indexes_tv->set_model(_indexes_model); Gtk::CellRenderer *rend = _indexes_tv->get_column_cell_renderer(0); _editing_sig = rend->signal_editing_started().connect(sigc::mem_fun(this, &DbMySQLTableEditorIndexPage::cell_editing_started)); }
bool DbMySQLTableEditorIndexPage::real_refresh() { if (!_editing_sig.empty()) _editing_sig.disconnect(); Gtk::TreeView *tv = 0; _xml->get_widget("index_columns", tv); tv->unset_model(); tv->remove_all_columns(); _index_node = bec::NodeId(); _be->get_indexes()->select_index(_index_node); fill_combo_from_string_list(_index_storage_combo, _be->get_index_storage_types()); _indexes_tv->remove_all_columns(); _indexes_model = ListModelWrapper::create(_be->get_indexes(), _indexes_tv, "DbMySQLTableEditorIndexPage"); _indexes_model->model().append_string_column(0, "Index Name", EDITABLE, NO_ICON); _indexes_model->model().append_combo_column(1, "Type", model_from_string_list(_be->get_index_types()), EDITABLE, true); _indexes_tv->set_model(_indexes_model); Gtk::CellRenderer* rend = _indexes_tv->get_column_cell_renderer(0); _editing_sig = rend->signal_editing_started(). connect(sigc::mem_fun(this, &DbMySQLTableEditorIndexPage::cell_editing_started)); const bool has_columns = _be->get_columns()->count() > 1; tv->set_sensitive(has_columns); _indexes_tv->set_sensitive(has_columns); index_cursor_changed(); return false; }