Function

Gtkinit_with_args

Declaration [src]

gboolean
gtk_init_with_args (
  gint* argc,
  gchar*** argv,
  const gchar* parameter_string,
  const GOptionEntry* entries,
  const gchar* translation_domain,
  GError** error
)

Description [src]

This function does the same work as gtk_init_check(). Additionally, it allows you to add your own commandline options, and it automatically generates nicely formatted --help output. Note that your program will be terminated after writing out the help output.

Available since:2.6

Parameters

argc

Type: gint*

Address of the argc parameter of your main() function (or 0 if argv is NULL). This will be changed if any arguments were handled.

The argument will be modified by the function.
argv

Type: An array of gchar**

Address of the argv parameter of main(), or NULL. Any options understood by GTK+ are stripped before return.

The argument will be modified by the function.
The argument can be set to NULL by the function.
The length of the array is specified in the argc argument.
The called function takes ownership of the data, and is responsible for freeing it.
Each element is a NUL terminated UTF-8 string.
parameter_string

Type: const gchar*

A string which is displayed in the first line of --help output, after programname [OPTION...]

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
entries

Type: An array of GOptionEntry

A NULL-terminated array of GOptionEntrys describing the options of your program.

The array must be NULL-terminated.
The data is owned by the caller of the function.
translation_domain

Type: const gchar*

A translation domain to use for translating the --help output for the options in entries and the parameter_string with gettext(), or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if the commandline arguments (if any) were valid and if the windowing system has been successfully initialized, FALSE otherwise.