Re: [gtk-list] Re: Bug fix or feature addition?



Lars Hamann wrote:
> 
> On Thu, Aug 26, 1999 at 06:25:43PM -0600, Brad Pepers wrote:
> > I've noticed that when using a ctree and adding a signal callback
> > for the selection signal, I don't get a signal for the default of
> > the first item getting selected.
> 
> You should use the "tree_select_row" as selection signal. I could
> fix the reported behavior, but in general ctree won't emit a "select_row"
> signal in many other situations. Extended selection for instance works
> almost without "select_row" signals. CTree needed another selection
> signal, because "select_row" can only select visible rows and ctree
> has to handle invisible rows too.

Thanks!  That solved the problem quite nicely.  Plus it passes in a
GtkCTreeNode* which is better for the code.

Another question (there are always more!) is how to easily change the
is_leaf status on a node.  Right now it looks like I've got to call
gtk_ctree_get_node_info with a whole wack of pointers to things and
then call gtk_ctree_set_node_info with all the same data.  Wouldn't
it be nicer and easier just to have some routines to change things
like the is_leaf status?  Plus I can't seem to get the text part right.
I declare a char* variable called text, pass a pointer to this to the
get_node_info routine and then pass text itself to set_node_info.
Doing this turns the text of the node to garbage so what do I do?  Do
I have to regenerate the text for the node just to change the is_leaf
status?

It would be nice to have one routine to set/get all the pixmaps and
another to set/get the is_leaf and expanded values.  There are routines
already for changing the text so that wouldn't be needed in the new
set/get routines which would just leave the text alone.

Here is basically the code I have that works for setting the is_leaf
but turns the text to garbage:

static void
insert_in(GtkMenuItem *menuitem, ScreenInfo *info)
{
    GtkCTreeNode *node;
    char *text;
    guint8 spacing;
    GdkPixmap *p_closed;
    GdkPixmap *m_closed;
    GdkPixmap *p_opened;
    GdkPixmap *m_opened;
    gboolean is_leaf;

    /* If parent is a leaf, change it */
    node = id_to_node(info, info->acct.gl_id);
    gtk_ctree_get_node_info(GTK_CTREE(info->list), node, &text,
&spacing,
				&p_closed, &m_closed, &p_opened, &m_opened,
				&is_leaf, NULL);
    if (is_leaf) {
	  gtk_ctree_set_node_info(GTK_CTREE(info->list), node, text, spacing,
				  p_closed, m_closed, p_opened, m_opened,
				  FALSE, TRUE);
    }
}

-- 
Brad Pepers
Linux Canada Inc.            Home of Linux products in Canada!
http://www.linuxcanada.com   Proud supporter of Cyclades, Red
brad@linuxcanada.com         Hat, and Caldera.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]