put_chekckboxes_in_treeview

From:

Jason Stover

Subject:

put_chekckboxes_in_treeview

Date:

Fri, 1 Feb 2008 17:18:16 -0500

User-agent:

Mutt/1.5.10i

I have a question about put_checkbox_items_in_treeview ().
on_statistics_clicked() is the function that runs the stats dialog.
The current version below is what I have to make the stats dialog box
work correctly when the user presses the 'Cancel' button. It mostly
works. The call to put_checkbox_items_in_treeview() is there to restore
the default after the user does anything but press 'Continue'. (I'll
have to fix that so I don't restore the default if the user presses,
say, 'Help', but that isn't the question I have now.)
Here is the function:
static void
on_statistics_clicked (struct crosstabs_dialog *cd)
{
GtkTreeIter iter;
bool ok;
int ret;
ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->stats_dialog));
if ( ret != PSPPIRE_RESPONSE_CONTINUE )
{
for (ok = gtk_tree_model_get_iter_first (cd->stats, &iter); ok;
ok = gtk_tree_model_iter_next (cd->stats, &iter))
{
gtk_list_store_set (GTK_LIST_STORE (cd->stats), &iter,
CHECKBOX_COLUMN_SELECTED, false, -1);
}
put_checkbox_items_in_treeview (GTK_TREE_VIEW(cd->stats_view),
B_CS_STATS_DEFAULT,
N_CROSSTABS_STATS,
stats);
}
}
Now, without the call to put_checkbox_items_in_treeview (), the
function behaves as expected and clears cd->stats. When I come back to
the stats dialog, I can re-select whatever checkboxes I like. Groovy.
But after the call to put_checkbox_items_in_treeview (), upon
returning to the stats dialog, I cannot select any checkboxes. Except
for the default checkbox, they are all empty, and I cannot change
their states, no matter how frantically I click with the mouse.
So is this a problem with put_checkbox_items_in_treeview (), or
am I misunderstanding something?
Also, I have tried different approaches to accomplish this task,
and until this approach, all of them resulted in the user being unable
to change the checkboxes on the second call to on_statistics_clicked().
-Jason