gi-glib-2.0.30: GLib bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.GLib.Structs.OptionGroup

Contents

- Exported types
- Methods
  - addEntries
  - free
  - new
  - ref
  - setTranslateFunc
  - setTranslationDomain
  - unref

Description

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 `OptionContext`.

Synopsis

- newtype OptionGroup = OptionGroup (ManagedPtr OptionGroup)
- optionGroupAddEntries :: (HasCallStack, MonadIO m) => OptionGroup -> [OptionEntry] -> m ()
- optionGroupFree :: (HasCallStack, MonadIO m) => OptionGroup -> m ()
- optionGroupNew :: (HasCallStack, MonadIO m) => Text -> Text -> Text -> Ptr () -> Maybe DestroyNotify -> m OptionGroup
- optionGroupRef :: (HasCallStack, MonadIO m) => OptionGroup -> m OptionGroup
- optionGroupSetTranslateFunc :: (HasCallStack, MonadIO m) => OptionGroup -> Maybe TranslateFunc -> m ()
- optionGroupSetTranslationDomain :: (HasCallStack, MonadIO m) => OptionGroup -> Text -> m ()
- optionGroupUnref :: (HasCallStack, MonadIO m) => OptionGroup -> m ()

# Exported types

newtype OptionGroup Source #

Memory-managed wrapper type.

Constructors

OptionGroup (ManagedPtr OptionGroup) |

#### Instances

Instances details

Eq OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup Methods (==) :: OptionGroup -> OptionGroup -> Bool Source # (/=) :: OptionGroup -> OptionGroup -> Bool Source #
GBoxed OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup
ManagedPtrNewtype OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup Methods toManagedPtr :: OptionGroup -> ManagedPtr OptionGroup Source #
TypedObject OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup Methods glibType :: IO GType Source #
HasParentTypes OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup
IsGValue (Maybe OptionGroup) Source # | Convert `OptionGroup` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.GLib.Structs.OptionGroup Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe OptionGroup -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe OptionGroup) Source #
type ParentTypes OptionGroup Source # |
Instance details Defined in GI.GLib.Structs.OptionGroup type ParentTypes OptionGroup = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

addEntries, free, ref, unref.

#### Getters

None.

#### Setters

setTranslateFunc, setTranslationDomain.

## addEntries

optionGroupAddEntries Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> [OptionEntry] | `entries`: a `Nothing`-terminated array of `GOptionEntrys`
-> m () |

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

Since: 2.6

## free

optionGroupFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> m () |

Deprecated: (Since version 2.44)Use `optionGroupUnref` instead.

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

Since: 2.6

## new

optionGroupNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `name`: the name for the option group, this is used to provide help for the options in this group with `--help-``name`
-> Text | `description`: a description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the group
-> Text | `helpDescription`: a description for the `--help-``name` option. This string is translated using the translation domain or translation function of the group
-> Ptr () | `userData`: user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of `OptionArgCallback` options, or `Nothing`
-> Maybe DestroyNotify | `destroy`: a function that will be called to free `userData`, or `Nothing`
-> m OptionGroup | Returns: a newly created option group. It should be added to a `OptionContext` or freed with `optionGroupUnref`.

Creates a new `OptionGroup`.

`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:’.

Since: 2.6

## ref

optionGroupRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> m OptionGroup | Returns: a `OptionGroup`

Increments the reference count of `group` by one.

Since: 2.44

## setTranslateFunc

optionGroupSetTranslateFunc Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> Maybe TranslateFunc | `func`: the `TranslateFunc`, or `Nothing`
-> m () |

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

If you are using `gettext()`, you only need to set the translation domain, see `optionGroupSetTranslationDomain`.

Since: 2.6

## setTranslationDomain

optionGroupSetTranslationDomain Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> Text | `domain`: the domain to use
-> m () |

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

Since: 2.6

## unref

optionGroupUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> OptionGroup | `group`: a `OptionGroup`
-> m () |

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