Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] GTK: Is there any reason not using the gtk_widget_show_all() func

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Mon, 01 Mar 2004 21:27:32 +0100
Hi List!

When looking at the files in the gtk dir, you'll very often find something like this:

label = gtk_label_new("hello");
gtk_widget_show(label);
frame = gtk_frame_new();
gtk_widget_show(frame);
...

with several appearances of the gtk_widget_show() call.

Is there any reason against using the gtk_widget_show_all() function at the end of the window/dialog generation? This will show the widget in question and all it's child widgets with one call and is available for both GTK versions 1 and 2 :-)

Of course, there are some specials, e.g. where some of the widgets are not shown, this has to be handled differently, but that's really an exception and not the usual case (and usually bad GUI design too).

Using gtk_widget_show_all() will remove a *lot* of the gtk_widget_show() codelines, without changing anything in the behaviour of the code
and it might even be a bit faster :-)

Regards, ULFL