Strange, I don't know why perhaps I had a typo I missed but it's
working now with a simple show/hide:
// Deal with terminal now, since it would just waste cpu cycles
dealing with it in a for loop
if( g_strrstr( sets->terminal, ":false" ) )
gtk_widget_hide( GTK_WIDGET( pd->tb_cmd ) );
else
gtk_widget_show( GTK_WIDGET( pd->tb_cmd ) );
Thanks though.
2012/1/14 David Nečas :
> On Sat, Jan 14, 2012 at 12:34:10PM +, Neil Munro wrote:
>> I was wondering if it is possible to remove a tool item from a
>> toolbar instantly,
>
> =
> from gi.repository import Gtk
>
> def modify(b, t):
> if t.get_n_items() == 1:
> b.set_stock_id(Gtk.STOCK_REMOVE)
> b2 = Gtk.ToolButton.new_from_stock(Gtk.STOCK_HELP)
> b2.show_all()
> t.insert(b2, 1)
> else:
> b.set_stock_id(Gtk.STOCK_ADD)
> t.get_nth_item(1).destroy()
> print t.get_n_items()
>
> w = Gtk.Window()
> w.connect('destroy', Gtk.main_quit)
> w.set_default_size(200,40)
>
> t = Gtk.Toolbar()
> w.add(t)
>
> b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ADD)
> b.connect('clicked', modify, t)
> t.insert(b, 0)
>
> w.show_all()
> Gtk.main()
> =
>
>> I have tried
>> to destroy the widget but it still works, am I missing something
>
> Yes. Hard to tell what.
>
> Yeti
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list