Library Initialization

Library Initialization — Perform general initialization with limited argument parsing.

Synopsis




            GskInitInfo;
void        gsk_init_info_get_defaults      (GskInitInfo *info);
void        gsk_init                        (int *argc,
                                             char ***argv,
                                             GskInitInfo *info);
void        gsk_init_without_threads        (int *argc,
                                             char ***argv);
#define     gsk_init_get_support_threads    ()
void        gsk_init_info_parse_args        (GskInitInfo *in_out,
                                             int *argc,
                                             char ***argv);
void        gsk_init_raw                    (GskInitInfo *info);
enum        _GskInitFlags;
extern      _GskInitFlags gsk_init_flags;
extern      gpointer gsk_main_thread;

Description

Almost always one run gsk_init() at the top of main and forgets about it. But sometimes you wish to separate the parsing and the initialization so these routines give you more fine-grained control, by separating the parsing into gsk_init_info_parse_args() and the real initialization into gsk_init_raw().

Details

GskInitInfo

typedef struct {
  char *prgname;
  guint needs_threads : 1;
} GskInitInfo;

Information about how to initialize GSK.

char *prgname; The name of the program, may be NULL.
guint needs_threads : 1; Whether the program needs threads. True by default.

gsk_init_info_get_defaults ()

void        gsk_init_info_get_defaults      (GskInitInfo *info);

Obtain the default initialization information. This should be run before gsk_init() or gsk_init_info_parse_args().

This API has been deprecated for public use, because it doesn't allow us to expand GskInitInfo without breaking binary-compatibility.

Use gsk_init_info_new() instead.

info : the GskInitInfo to fill.

gsk_init ()

void        gsk_init                        (int *argc,
                                             char ***argv,
                                             GskInitInfo *info);

Initialize the GSK library.

argc : a reference to main()'s argc; this will be decreased if arguments are parsed out of the argument array.
argv : a reference to main()'s argc; this may have arguments removed.
info : the GskInitInfo to use as hints, which will be filled with the actual initialization information used. If NULL, default initialization parameters will be used.

gsk_init_without_threads ()

void        gsk_init_without_threads        (int *argc,
                                             char ***argv);

Initialize the GSK library indicating that you will not use threads.

argc : a reference to main()'s argc; this will be decreased if arguments are parsed out of the argument array.
argv : a reference to main()'s argc; this may have arguments removed.

gsk_init_get_support_threads()

#define gsk_init_get_support_threads()	((gsk_init_flags & _GSK_INIT_SUPPORT_THREADS) == _GSK_INIT_SUPPORT_THREADS)

Ascertain whether thread support is necessary.


gsk_init_info_parse_args ()

void        gsk_init_info_parse_args        (GskInitInfo *in_out,
                                             int *argc,
                                             char ***argv);

Parse/modify arguments and return their values in in_out.

The only currently supported argument is --gsk-debug=FLAGS.

in_out : the GskInitInfo to fill.
argc : the argument count (may be modified)
argv : the arguments (may be modified)

gsk_init_raw ()

void        gsk_init_raw                    (GskInitInfo *info);

Initialize GSK.

info : information to use for initializing.

enum _GskInitFlags

typedef enum
{
  _GSK_INIT_SUPPORT_THREADS = (1<<0)
} _GskInitFlags;


gsk_init_flags

extern _GskInitFlags gsk_init_flags;

Flags given to gsk_init().


gsk_main_thread

extern gpointer gsk_main_thread;