[Glade-devel] libglade usage
Olexiy Avramchenko
olexiy@irtech.cn.ua
Mon, 29 Dec 2003 08:56:52 +0200
Todd Fisher wrote:
> I have a very simple libglade application. I used glade-2.0.1 to
> generate a
> .glade file which contains a gtkWindow and a GtkButton nothing else.
> It defines
> two signal handlers. A realize and destroy signal for the
> GtkWindow. when i use the following as my main applicaion the realize
> signal handler is not
> called.
<...>
> I expect to run the program see my window pop up and see hello printed
> at the terminal.
> I get no Gtk Warnings or Errors instead. I think its important to
> have this realize signal
> handler called because I want to initialize my application here.
>
> any ideas? Am i misuing the api? is this a bug in libglade?
>
> I've tested this with the lastest unstable release of libglade and a
> fairly recent cvs version and
> noticed the same behavoir.
Your window is just realized before glade_xml_signal_autoconnect() call.
Possible solutions:
1. (the nice one) Test your main window widget with
GTK_WIDGET_REALIZED() macro.
2. (the worse and untested) Set "Visible" flag ("Common" tab in
"Properties" notebook) to FALSE, get a pointer to your window (with call
like 'glade_xml_get_widget(xml, "window1")') and call
gtk_widget_show_all() on it before gtk_main().
Olexiy