[Gtk-sharp-list] Glade autoconnection problem.

Dan Winship danw at novell.com
Wed Jun 22 13:34:15 EDT 2005


On Wed, 2005-06-22 at 17:29 +0200, Kyku wrote:
> Hello again.
> This time I'm having trouble with Glade.XML.Autoconnect. It doesn't
> connect to on_window1_realize even that it is specified as the handler
> in glade file. On the contrary on_window1_delete works without problems.

Heh, funny, this is basically exactly the same issue as the previous
message I just replied to :-)

The problem is that the window is being realized when the glade file is
read it, because it's "visible" property is "True". So the realization
happens before the call to Autoconnect. If you change "visible" to
"False" and then explicitly Show() the window after autoconnecting, it
will work.

-- Dan

> Here is the code:
> 
> using System;
> using Gtk;
> using GladeSharp;
> 
> public class Test2 {
> 	[Glade.Widget] private Widget window1;
> 	public void on_window1_realize(object o, EventArgs args) {
> 		Console.WriteLine("on_window1_realize");
> 	}
> 	public void on_window1_delete_event(object o, EventArgs args) {
> 		Console.WriteLine("on_window1_detele");
> 		Application.Quit();
> 	}
> 	public Test2() {
> 		Glade.XML gxml =
> 			new Glade.XML ("test.glade", "window1", null);
> 		gxml.Autoconnect(this);
> 	}
> 	public static void Main() {
> 		Application.Init();
> 		new Test2();
> 		Application.Run();
> 	}
> 
> And here, the glade file:
> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
> 
> <glade-interface>
> 
> <widget class="GtkWindow" id="window1">
>   <property name="visible">True</property>
>   <property name="title" translatable="yes">window1</property>
>   <property name="type">GTK_WINDOW_TOPLEVEL</property>
>   <property name="window_position">GTK_WIN_POS_NONE</property>
>   <property name="modal">False</property>
>   <property name="resizable">True</property>
>   <property name="destroy_with_parent">False</property>
>   <property name="decorated">True</property>
>   <property name="skip_taskbar_hint">False</property>
>   <property name="skip_pager_hint">False</property>
>   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
>   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
>   <property name="focus_on_map">True</property>
>   <signal name="realize" handler="on_window1_realize"
> last_modification_time="Wed, 22 Jun 2005 13:58:40 GMT"/>
>   <signal name="delete_event" handler="on_window1_delete_event"
> last_modification_time="Wed, 22 Jun 2005 15:26:43 GMT"/>
> 
>   <child>
>     <placeholder/>
>   </child>
> </widget>
> 
> </glade-interface>
> 
> Thanks for your patience.
> 
> 
> -------------------------------
> Rejestracja domen internetowych
>     http://www.adresik.pl
>     domeny *.pl od 56 zl
>    domeny *.com od 28 zl
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 



More information about the Gtk-sharp-list mailing list