[Gtk-sharp-list] [PROPOSAL] Eliminating Application.Init ()
fd
fd0h1440@yahoo.co.uk
Thu, 11 Sep 2003 04:59:23 +0100
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.
* Metadata: Gtk.Object now derives from Gtk.Client, not
GLib.Object
* Metadata: Glade.XML now derives from Gtk.Client, not GLib.Object
and that's it.. no more ugly Application.Init (), ever. Any thoughts? OK
to commit?