gwyapp

gwyapp — Library initialisation

Functions

Includes

#include <libgwyapp/gwyapp.h>

Description

Functions

gwy_app_init_widget_styles()

void
gwy_app_init_widget_styles (GdkScreen *screen);

Sets up style properties for special Gwyddion widgets.

Usually it is done as a part of gwy_app_init(). It exists for the case when you need to do the initialisation steps separately.

Parameters

screen

Gdk screen to set the styles for.

 

gwy_app_init()

void
gwy_app_init (gboolean for_gui,
              const gchar *option,
              ...);

Performs common initialisations useful for programs utilising Gwyddion libraries.

Regardless of the value of for_gui , the function initialises gwyddion libraries, loads resources, loads settings and imports modules (see below for pygwy). It also disables undo and GUI for the data browser as they are unlikely to be useful outside Gwyddion itself.

If for_gui is TRUE the function initialises GTK+ as follows

1
gtk_init(NULL, NULL);

GUI programs which wish to initialise GTK+ differently need to call gtk_init() or some other GTK+ initialisation function explicitly prior to calling gwy_app_init(), making the default call no-op. It also sets up Gwyddion-specific widget styles.

If for_gui is FALSE the function sets up logging to console (see also below) and does additional setup for for non-GUI operation. In particular, it disables GUI for waiting.

There are currently the following options:

"enable-threads" with gboolean value. If TRUE or FALSE is passed gwy_threads_set_enabled() will be called with this settings. By default, the multithread processing state is unchanged.

"enable-pygwy" with gboolean value. If TRUE is passed then pygwy will not be prevented from loading. Passing FALSE is the same as not setting the option at all and will result in pygwy being prevented from loading using gwy_module_disable_registration().

"no-logging-setup" with gboolean value. If TRUE is passed then logging setup is unchanged. Passing FALSE is the same as not setting the option at all and will set up logging to console in non-GUI mode.

So, for instance a program non-GUI wanting to enable multithread processing in Gwyddion functions (provided it is built in) can run

1
gwy_app_init(FALSE, "enable-threads", TRUE, NULL);

Parameters

for_gui

TRUE to do initialisation suitable for a GUI program; FALSE for a non-GUI program.

 

option

Name of the first initialisation option, or NULL if there are no options.

 

...

Value of the first option, if any, followed by another option name and value, etc. Terminated by NULL.