Re: remove a toolbar icon
- From: muppet <scott asofyet org>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: remove a toolbar icon
- Date: Sat, 31 Dec 2005 16:08:01 -0500
On Dec 31, 2005, at 8:59 AM, Dave M wrote:
Ok, here's what I have:
my $toolbar = Gtk2::Toolbar->new;
(...several Gtk2::ToolButton->new_from_stock('gtk-stuff') here...)
my $new_button = Gtk2::ToolButton->new_from_stock('gtk-foo') # to
be added later
later in code:
if($blah) {
$toolbar->insert($new_button, -1); # <- this part seems to work
} elsif($foo) {
$toolbar->remove($new_button);
}
These are the errors that are showing during this process:
Gtk-CRITICAL **: gtk_toolbar_remove: assertion `content_to_remove !=
NULL' failed at ./stuff line 1064.
This assertion comes from inside the GtkToolbar virtual handler for
GtkContainer::remove; it means that you're trying to remove a widget
that wasn't in the toolbar. You're probably getting into the -
>remove branch on $new_button before $new_button has been added to
the toolbar.
Gtk-WARNING **: Can't set a parent on widget which has a parent
Gtk-ERROR **: file gtkcontainer.c: line 2447
Here you've tried to add to a container a widget that is already in a
different container. You have to either remove first or reparent it.
(gtk_container_propagate_expose): assertion failed: (child->parent ==
GTK_WIDGET (container)) at ./stuff line 289.
Aborted
This is probably just the result of broken invariants in the rest of
the code.
Any hints?
It would probably be easier just to add all of the buttons to the
toolbar up front, then show and hide them as needed, and thus avoid
all this reparenting stuff.
(The meticulous and error-prone bookkeeping here is why i suggested
UIManager. ;-)
--
"the ternary operator makes it a bit less ugly."
-- kaffee
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]