Stop using wxDataViewModel::GetColumnType() in wxGTK code

We don't seem to really need it as we can just convert everything to
strings and this will allow to remove the requirement to override it in
the derived model classes.

This commit is best viewed ignoring whitespace-only changes.
This commit is contained in:
Vadim Zeitlin 2018-02-04 19:38:21 +01:00
parent 8536c9d683
commit 72171059b4

View File

@ -757,7 +757,7 @@ wxgtk_tree_model_get_n_columns (GtkTreeModel *tree_model)
static GType static GType
wxgtk_tree_model_get_column_type (GtkTreeModel *tree_model, wxgtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gint index) gint WXUNUSED(index))
{ {
GtkWxTreeModel *wxtree_model = (GtkWxTreeModel *) tree_model; GtkWxTreeModel *wxtree_model = (GtkWxTreeModel *) tree_model;
g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (wxtree_model), G_TYPE_INVALID); g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (wxtree_model), G_TYPE_INVALID);
@ -765,19 +765,7 @@ wxgtk_tree_model_get_column_type (GtkTreeModel *tree_model,
if ( wxtree_model->stamp == 0 ) if ( wxtree_model->stamp == 0 )
return G_TYPE_INVALID; return G_TYPE_INVALID;
GType gtype = G_TYPE_INVALID; return G_TYPE_STRING;
wxString wxtype = wxtree_model->internal->GetDataViewModel()->GetColumnType( (unsigned int) index );
if (wxtype == wxT("string"))
gtype = G_TYPE_STRING;
else
{
gtype = G_TYPE_POINTER;
// wxFAIL_MSG( wxT("non-string columns not supported for searching yet") );
}
return gtype;
} }
static gboolean static gboolean
@ -824,20 +812,12 @@ wxgtk_tree_model_get_value (GtkTreeModel *tree_model,
return; return;
wxDataViewModel *model = wxtree_model->internal->GetDataViewModel(); wxDataViewModel *model = wxtree_model->internal->GetDataViewModel();
wxString mtype = model->GetColumnType( (unsigned int) column ); wxVariant variant;
if (mtype == wxT("string")) g_value_init( value, G_TYPE_STRING );
{ wxDataViewItem item( (void*) iter->user_data );
wxVariant variant; model->GetValue( variant, item, (unsigned int) column );
g_value_init( value, G_TYPE_STRING );
wxDataViewItem item( (void*) iter->user_data );
model->GetValue( variant, item, (unsigned int) column );
g_value_set_string( value, variant.GetString().utf8_str() ); g_value_set_string( value, variant.GetString().utf8_str() );
}
else
{
wxFAIL_MSG( wxT("non-string columns not supported yet") );
}
} }
static gboolean static gboolean