Re: How to determine if Gtk+ had been initialized



On Wed, Oct 18, 2006 at 10:34:51PM +0200, Paul Plaquette wrote:
an application is using GTK+

It calls functions provide in a shared libary.

the library could present user interface based on GTK+ or not
depending on the application initialized Gtk+ or not (calling gtk-init 
()).

This sounds a bit strange.  Shouldn't the application
tell the library whether it wants GUI or not?

The question is : from the library, is there a way to know the caller  
had initialized Gtk+ ?

There is no way to get the value of gtk_initialized from
gtkmain.  A fairly safe check for a GUI running is

    if (gtk_main_level() > 0)
       ...

However this fails when Gtk+ is initialized but no main loop
is running.

Yeti


--
Whatever.



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