Library Initialization

Name

Library Initialization -- Perform general initialization with limited argument parsing.

Synopsis



struct      GskInitInfo;
void        gsk_init_info_get_defaults      (GskInitInfo *info);
void        gsk_init                        (int *argc,
                                             char ***argv,
                                             GskInitInfo *info);
#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

struct GskInitInfo

struct GskInitInfo {

  char *prgname;
  guint needs_threads : 1;
};

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().

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_get_support_threads()

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


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;


gsk_main_thread

extern gpointer gsk_main_thread;