Re: GtkTree, cell with toggle
- From: p s <tuxnduke welho com>
- To: gtk-app-devel-list gnome org
- Subject: Re: GtkTree, cell with toggle
- Date: Mon, 14 Jun 2004 22:10:23 +0300
Still a problem..
This row asserts:
gtk_tree_store_set(GTK_TREE_STORE( model ), &iter, column_number, value,
-1 );
(moviecatalog:8356): GLib-GObject-WARNING **: invalid cast from
`GtkTreeModelSort' to `GtkTreeStore'
(moviecatalog:8356): Gtk-CRITICAL **: file gtktreestore.c: line 1043
(gtk_tree_store_set): assertion `GTK_IS_TREE_STORE (tree_store)' failed
(to remind I used :
GtkTreeModel * sort_model;
sort_model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(store));
when initially creating the table..)
Also tried:
gtk_tree_store_set_value (GTK_TREE_STORE( model ), &iter,
column_number, value );
with equally bad outcome and same assert..
TIA,
P_s
Todd Fisher wrote:
P s
// setup the toggle column
gtk_tree_view_column_add_attribute( column, cell, "active", COL_ID );
g_signal_connect( cell, "toggled", G_CALLBACK( check_toggled ), treeview );
// an example toggle callback:
void check_toggled( GtkCellRendererToggle *cell, gchar *path_str,
GtkTreeView *view )
{
gboolean value;
guint column_number = GPOINTER_TO_UINT( g_object_get_data( G_OBJECT(
cell ), "column_number" ) );
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model( view );
GtkTreePath *path = gtk_tree_path_new_from_string( path_str );
if( gtk_tree_model_get_iter( model, &iter, path ) ){
gtk_tree_model_get( model, &iter, column_number, &value, -1 );
if( value ){
value = FALSE;
}
else{
value = TRUE;
}
// value = !value;
gtk_tree_store_set( GTK_TREE_STORE( model ), &iter, column_number,
value, -1 );
}
gtk_tree_path_free( path );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]