[Gtk-sharp-list] MonkeyGuide?: Hello World in GNOME.NET - Second Draft

Charles Iliya Krempeaux charles@reptile.ca
16 Feb 2003 23:25:39 -0800


On Sun, 2003-02-16 at 21:29, Mike Kestner wrote:
> On Sun, 2003-02-16 at 13:11, Charles Iliya Krempeaux wrote:


> In the C API, GnomeProgram derives from GObject, so it can be subclassed
> in C.  I am not aware of any C-based applications that subclass
> GnomeProgram. Nautilus doesn't.  Evolution doesn't.  Gnumeric doesn't.
> These flagship GNOME applications make extensive use of the
> object-oriented paradigm through GObjects yet see no advantage to
> subclassing GnomeProgram.   

That's probably because in C, GObject subclassing is a hassle.  (And
in most people's opinions, it's more trouble than it is worth.)  But
in a language like C#, it is very easy.

> > *cough* *cough*  That's why I created that patch for 
> > "gnome/Program.custom".  That way I could "override" the Run()
> > method, and do even more polymorphism.  (It seems stupid that
> > I have to create a new method called run() to take the place
> > of Run().)
> I've been mulling over whether I think it's a good idea to include
> this.  To be honest, I'm more inclined to remove the Gnome.Program.Run
> () and Quit () methods than to make them virtual.  They provide zero
> additional capability over Gtk.Application.Run and Quit and their
> presence in the Gnome.Program class has only managed to infuse confusion
> as to the purpose of the class.  It is not a mainloop management class. 
> It is a library initialization and argument parsing helper.

Why not make put the initialization in a "static constructor"???

I.e., something change Init() to:

    namespace Gtk {


       public class Application {


            static Application() {
                // The old contents of Init() go here.

That way you wouldn't even have to call the Init() procedure.
It would automagically get called.

See ya

     Charles Iliya Krempeaux, BSc

 Reptile Consulting & Services    604-REPTILE    http://www.reptile.ca/