[Gtk-sharp-list] Glade# dynamic root

Sergio Duran Sergio Duran <sergioduran@gmail.com>
Fri, 18 Feb 2005 09:50:55 -0600


Hi,

I'm trying to write a generic class to load glade's XML, it gets the
name of the root window at runtime, so I cant declare a [Glade.Widget]
field, is there a way to do this?
I could be able to do it with multiple XML files, one for each window,
and only containing a single object, but I think it could become
combersome.

example class:
class Loader {
   [Glade.Widget] Button generic_button; // this is always there
   Loader(string root) {
       Glade.XML gxml = new Glade.XML("file.glade", root);
       generic_button.Clicked += new EventHandler(click);
        // where is the root window? glade didnt set it :(
        ...
    }
    void click(object o, EventArgs a) {
        ...
    }
    static void Main() {
        new Loader("window");
    }
}