Basics
Guides
API Reference
Basics
Guides
API Reference
[17:7] extends: object
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.
GOptionGroup (name = null, description = null, help_description = null, user_data = null, destroy = null)
Creates a new #GOptionGroup. @description is typically used to provide a title for the group. If so, it is recommended that it’s written in title case, and has a trailing colon so that it matches the style of built-in GLib group titles such as ‘Application Options:’.
name is the name for the option group, this is used to provide help for the options in this group with --help-@name.description is a description for this group to be shown in --help. This string is translated using the translation domain or translation function of the group.help_description is a description for the --help-@name option. This string is translated using the translation domain or translation function of the group.user_data is user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULL.destroy is a function that will be called to free @user_data, or %NULL.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.add_entries (list entries)
Adds the options specified in @entries to @group.
entries is a %NULL-terminated array of #GOptionEntrys.None.free ()
Frees a #GOptionGroup. Note that you must not free groups which have been added to a #GOptionContext.
None.ref ()
Increments the reference count of @group by one.
a #GOptionGroup.set_error_hook (object error_func)
Associates a function with @group which will be called from g_option_context_parse() when an error occurs. Note that the user data to be passed to @error_func can be specified when constructing the group with g_option_group_new().
error_func is a function to call when an error occurs.None.set_parse_hooks (object pre_parse_func, object post_parse_func)
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. Note that the user data to be passed to @pre_parse_func and @post_parse_func can be specified when constructing the group with g_option_group_new().
pre_parse_func is a function to call before parsing, or %NULL.post_parse_func is a function to call after parsing, or %NULL.None.set_translate_func (object destroy_notify)
Sets the function which is used to translate user-visible strings, for
--helpoutput. Different groups can use different #GTranslateFuncs. If
is %NULL, strings are not translated. If you are using gettext(), you only need to set the translation domain, see g_option_group_set_translation_domain().func is the #GTranslateFunc, or %NULL.data is user data to pass to @func, or %NULL.destroy_notify is a function which gets called to free @data, or %NULL.None.set_translation_domain (string domain)
A convenience function to use gettext() for translating user-visible strings.
domain is the domain to use.None.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
is released.None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.