GLib.OptionGroup
Description: Reference for GLib.OptionGroup

### Struct

# GLibOptionGroup

since: 2.0

#### Description

    struct GOptionGroup {
      /* No available fields */
    }

A `GOptionGroup` struct defines the options in a single group. The struct has only private fields and should not be directly accessed.

All options in a group share the same translation function. Libraries which need to parse commandline options are expected to provide a function for getting a `GOptionGroup` holding their options, which the application can then add to its `GOptionContext`.

Available since: 2.0

#### Constructors

###### g_option_group_new

Creates a new `GOptionGroup`.

since: 2.6

#### Instance methods

###### g_option_group_add_entries

Adds the options specified in `entries` to `group`.

since: 2.6

###### g_option_group_free

Frees a `GOptionGroup`. Note that you must not free groups which have been added to a `GOptionContext`.

deprecated: 2.44 since: 2.6

###### g_option_group_ref

Increments the reference count of `group` by one.

since: 2.44

###### g_option_group_set_error_hook

Associates a function with `group` which will be called from `g_option_context_parse()` when an error occurs.

since: 2.6

###### g_option_group_set_parse_hooks

Associates two functions with `group` which will be called from `g_option_context_parse()` before the first option is parsed and after the last option has been parsed, respectively.

since: 2.6

###### g_option_group_set_translate_func

Sets the function which is used to translate user-visible strings, for `--help` output. Different groups can use different `GTranslateFuncs`. If `func` is `NULL`, strings are not translated.

since: 2.6

###### g_option_group_set_translation_domain

A convenience function to use `gettext()` for translating user-visible strings.

since: 2.6

###### g_option_group_unref

Decrements the reference count of `group` by one. If the reference count drops to 0, the `group` will be freed. and all memory allocated by the `group` is released.

since: 2.44