GnomeProgram in libgnome

While doing the LB p.o.v. API review of libgnome, I was looking at

It seems to half act as a singleton object (there is a gnome_program_get()
call that returns the contents of a global variable called
"global_program"), yet the gnome_program_initv() function will
unconditionally create a new GnomeProgram object even if called multiple

Also, if gnome_program_get() is called before gnome_program_initv, it will
return NULL.

On IRC, Anders mentioned that the reason for this is that sometimes you
might want multiple GnomeProgram objects when there are libraries
installed in different prefixes.  If this is the case, then pretending
there is a global program object in other parts of the code is probably a

If the GnomeProgram object _is_ meant to be a singleton, then
gnome_program_get() should probably create the global program object if it
hasn't already been created, and gnome_program_init() should manipulate
that object rather than creating a new one.

With this second scenario, the "GType type" argument to
gnome_program_initv() doesn't make sense (I am not sure what the use of
subclassing GnomeProgram is, as there are no signals or virtual functions
to override).

Does anyone have an idea of what should be happening here?


Email: james daa com au

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]