//--------------------------------------------------------------------------------
void DbMySQLTableEditorIndexPage::get_value(const Gtk::TreeModel::iterator& iter, int column, GType type, Glib::ValueBase& value)
{
  bec::IndexColumnsListBE *columns_be = _be->get_indexes()->get_columns();
  bec::NodeId node(_indexes_columns_model->node_for_iter(iter));

  if ( !node.is_valid() )
    return;
  
  switch ( column )
  {
    case -2: // Sort order
    {
      ssize_t val = 0;
      columns_be->get_field(node, ::bec::IndexColumnsListBE::Descending, val);
      set_glib_string(value, val == 0 ? "ASC" : "DESC");
      break;
    }
    case -8: // Set/unset
    {
      const bool bv = columns_be->get_column_enabled(node);
      set_glib_bool(value, bv);
      break;
    }
  }
}
//------------------------------------------------------------------------------
void ListModelWrapper::get_value_vfunc(const iterator& iter, int column, Glib::ValueBase& value) const {
  if (!*_tm)
    return;

  bec::NodeId node = node_for_iter(iter);

  if (node.is_valid()) {
    const GType type = *(_columns.types() + column);

    column = _columns.ui2bec(column);

    if (column < 0) {
      if (!_fake_column_value_getter.empty())
        _fake_column_value_getter(iter, column, type, value);
    } else if (type == GDK_TYPE_PIXBUF) {
      get_icon_value(iter, column, node, value);
    } else {
      switch (type) {
        case G_TYPE_BOOLEAN: {
          bool bv = false;
          (*_tm)->get_field(node, column, bv);
          set_glib_bool(value, bv);
          lmwdprint("LMW::get_value_vfunc: %s: node %s, col %i: value: %i\n", _name.c_str(), node.repr().c_str(),
                    column, bv);
          break;
        }
        case G_TYPE_INT:
        case G_TYPE_UINT: {
          ssize_t iv = 0;
          (*_tm)->get_field(node, column, iv);
          set_glib_int(value, iv);
          lmwdprint("LMW::get_value_vfunc: %s: node %s, col %i: value: %i\n", _name.c_str(), node.repr().c_str(),
                    column, iv);
          break;
        }
        case G_TYPE_LONG:
        case G_TYPE_ULONG:
        case G_TYPE_INT64:
        case G_TYPE_UINT64: {
          throw std::logic_error("Imlement long ints in get_value_func");
          break;
        }
        case G_TYPE_FLOAT:
        case G_TYPE_DOUBLE: {
          double dv = 0.0;
          (*_tm)->get_field(node, column, dv);
          set_glib_double(value, dv);
          lmwdprint("LMW::get_value_vfunc: %s: node %s, col %i: value: %f\n", _name.c_str(), node.repr().c_str(),
                    column, dv);
          break;
        }
        case G_TYPE_STRING: {
          std::string sv;
          if (column < 0)
            sv = (*_tm)->get_field_description(node, -column);
          else
            (*_tm)->get_field_repr(node, column, sv);
          set_glib_string(value, sv, true);
          lmwdprint("LMW::get_value_vfunc: %s: node %s, col %i: value: '%s'\n", _name.c_str(), node.repr().c_str(),
                    column, sv.c_str());
          break;
        }
        default:
          set_glib_string(value, "<unkn>");
          break;
      }
    }
  }
}