Re: Getting the selected row in a GtkCTree
- From: Jacques Fortier <jfortier seul org>
- To: Havoc Pennington <hp redhat com>
- Cc: gtk-list gnome org
- Subject: Re: Getting the selected row in a GtkCTree
- Date: Sat, 8 Jul 2000 15:22:35 -0400 (EDT)
On 8 Jul 2000, Havoc Pennington wrote:
>
> Jacques Fortier <jfortier@seul.org> writes:
> > Is there a way to get the currently selected row of a GtkCTree?
> > I've checked the docs a few times, and can't seem to find it.
> >
>
> It's something like
> GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data)
> IIRC. Yes, it sucks. We're replacing it in 2.0.
>
> Havoc
>
I think that may work for a clist (I've seen an example of it
being done that way), but the problem is that, if I understand correctly
(which I probably don't), ctrees don't exactly use row numbers. If I cast
the pointer to int, I get a number like 134847224, which looks to me like
it's really a pointer. As well, none of the ctree methods accept a row
number int. However, they all accept GtkCTreeNodes, which is just a
wrapper around a GList. So, I tried using clist-selection directly, like
so:
void
on_button_add_item_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *ctree;
xmlNodePtr data_node;
GList *node;
tree = lookup_widget(app1, "ctree");
node = GTK_CLIST(ctree)->selection;
data_node = gtk_ctree_node_get_row_data(GTK_CTREE(ctree),
GTK_CTREE_NODE(node));
if(g_strcasecmp(data_node->name, "quiz") == 0)
{
g_message("It's a quiz.");
}
}
However, that doesn't work, as the strcasecmp gives me a segfault,
even though I know from a previous signal handler that the data is
definitely there on that row.
I'm not quite sure what I'm supposed to be doing. Is there some
way I can use a row number in a GtkCTree, or am I doing something wrong
with my attempt at using the GList directly?
Thanks,
Jacques
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]