Function

Gtkaccelerator_parse

Declaration [src]

gboolean
gtk_accelerator_parse (
  const char* accelerator,
  guint* accelerator_key,
  GdkModifierType* accelerator_mods
)

Description [src]

Parses a string representing an accelerator.

The format looks like “<Control>a” or “<Shift><Alt>F1”.

The parser is fairly liberal and allows lower or upper case, and also abbreviations such as “<Ctl>” and “<Ctrl>”.

Key names are parsed using gdk_keyval_from_name(). For character keys the name is not the symbol, but the lowercase name, e.g. one would use “<Ctrl>minus” instead of “<Ctrl>-”.

Modifiers are enclosed in angular brackets <>, and match the GdkModifierType mask:

  • <Shift> for GDK_SHIFT_MASK
  • <Ctrl> for GDK_CONTROL_MASK
  • <Alt> for GDK_ALT_MASK
  • <Meta> for GDK_META_MASK
  • <Super> for GDK_SUPER_MASK
  • <Hyper> for GDK_HYPER_MASK

If the parse operation fails, accelerator_key and accelerator_mods will be set to 0 (zero).

Parameters

accelerator

Type: const char*

String representing an accelerator.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
accelerator_key

Type: guint*

Return location for accelerator keyval.

The argument will be set by the function.
The argument can be NULL.
accelerator_mods

Type: GdkModifierType

Return location for accelerator modifier mask.

The argument will be set by the function.
The argument can be NULL.
The caller of the function takes ownership of the returned data, and is responsible for freeing it.

Return value

Type: gboolean

Whether parsing succeeded.