[Gtk-sharp-list] [PROPOSAL] Eliminating Application.Init ()

Gonzalo Paniagua Javier gonzalo@ximian.com
Sat, 13 Sep 2003 20:22:17 +0200

El jue, 11-09-2003 a las 05:59, fd escribió:
> More from the API beauty police...
> So, I was looking around and noticed that the Application.Init () call
> done at the start of almost every Gtk# program is really quite redundant
> as this kind of initialisation can be done in the Gtk.Object static
> constructor.
> Then I noticed that Glade.XML uses Gtk+ but, of course, doesn't inherit
> from Gtk.Object.
> So here's the proposal:
>       * We make a new Gtk.Client class (derived from GLib.Object), which
>         any class that makes use of Gtk+ should inherit from. The
>         Gtk.Client static constructor checks to see if the application
>         has already been manually initialised (by legacy code calling
>         Application.Init or code that uses Application.Init with
>         arguments, and if not, runs Application.Init itself. As the
>         static constructor is only ever called once by a process, this
>         has no impact on performance.

If you create a couple of instances of that Gtk.Client derived class in
different AppDomains, the static ctor will be called twice.