gi-dbusmenugtk3-0.4.16: DbusmenuGtk 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.DbusmenuGtk3.Functions

Contents

- Methods
  - gtkParseGetCachedItem
  - gtkParseMenuStructure
  - menuitemPropertyGetImage
  - menuitemPropertyGetShortcut
  - menuitemPropertySetImage
  - menuitemPropertySetShortcut
  - menuitemPropertySetShortcutMenuitem
  - menuitemPropertySetShortcutString

Description

Synopsis

- gtkParseGetCachedItem :: (HasCallStack, MonadIO m, IsWidget a) => a -> m Menuitem
- gtkParseMenuStructure :: (HasCallStack, MonadIO m, IsWidget a) => a -> m Menuitem
- menuitemPropertyGetImage :: (HasCallStack, MonadIO m, IsMenuitem a) => a -> Text -> m Pixbuf
- menuitemPropertyGetShortcut :: (HasCallStack, MonadIO m, IsMenuitem a) => a -> m (Word32, [ModifierType])
- menuitemPropertySetImage :: (HasCallStack, MonadIO m, IsMenuitem a, IsPixbuf b) => a -> Text -> b -> m Bool
- menuitemPropertySetShortcut :: (HasCallStack, MonadIO m, IsMenuitem a) => a -> Word32 -> [ModifierType] -> m Bool
- menuitemPropertySetShortcutMenuitem :: (HasCallStack, MonadIO m, IsMenuitem a, IsMenuItem b) => a -> b -> m Bool
- menuitemPropertySetShortcutString :: (HasCallStack, MonadIO m, IsMenuitem a) => a -> Text -> m Bool

# Methods

## gtkParseGetCachedItem

gtkParseGetCachedItem Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) |
=> a | `widget`: A `MenuItem` that may have a cached `Menuitem` from the parser
-> m Menuitem | Returns: A pointer to the cached item or NULL if it isn't there.

The Dbusmenu GTK parser adds cached items on the various menu items throughout the tree. Sometimes it can be useful to get that cached item to use directly. This function will retrieve it for you.

## gtkParseMenuStructure

gtkParseMenuStructure Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) |
=> a | `widget`: A `MenuItem` or `MenuShell` to turn into a `Menuitem`
-> m Menuitem | Returns: A dbusmenu item representing the menu structure

Goes through the GTK structures and turns them into the appropraite Dbusmenu structures along with setting up all the relationships between the objects. It also stores the dbusmenu items as a cache on the GTK items so that they'll be reused if necissary.

## menuitemPropertyGetImage

menuitemPropertyGetImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a) |
=> a | `menuitem`: The `Menuitem` to look for the property on
-> Text | `property`: The name of the property to look for.
-> m Pixbuf | Returns: A pixbuf or `NULL` to signal error.

This function looks on the menu item for a property by the name of `property`. If one exists it tries to turn it into a `Pixbuf`. It assumes that the property is a base64 encoded PNG file like the one created by `dbusmenu_menuite_property_set_image`.

## menuitemPropertyGetShortcut

menuitemPropertyGetShortcut Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a) |
=> a | `menuitem`: The `Menuitem` to get the shortcut off
-> m (Word32, [ModifierType]) |

This function gets a GTK shortcut as a key and a mask for use to set the accelerators.

## menuitemPropertySetImage

menuitemPropertySetImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a, IsPixbuf b) |
=> a | `menuitem`: The `Menuitem` to set the property on.
-> Text | `property`: Name of the property to set.
-> b | `data`: The image to place on the property.
-> m Bool | Returns: Whether the function was able to set the property or not.

This function takes the pixbuf that is stored in `data` and turns it into a base64 encoded PNG so that it can be placed onto a standard `Menuitem` property.

## menuitemPropertySetShortcut

menuitemPropertySetShortcut Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a) |
=> a | `menuitem`: The `Menuitem` to set the shortcut on
-> Word32 | `key`: The keycode of the key to send
-> [ModifierType] | `modifier`: A bitmask of modifiers used to activate the item
-> m Bool | Returns: Whether it was successful at setting the property.

Takes the modifer described by `key` and `modifier` and places that into the format sending across Dbus for shortcuts.

## menuitemPropertySetShortcutMenuitem

menuitemPropertySetShortcutMenuitem Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a, IsMenuItem b) |
=> a | `menuitem`: The `Menuitem` to set the shortcut on
-> b | `gmi`: A menu item to steal the shortcut off of
-> m Bool | Returns: Whether it was successful at setting the property.

Takes the shortcut that is installed on a menu item and calls `dbusmenu_menuitem_property_set_shortcut` with it. It also sets up listeners to watch it change.

## menuitemPropertySetShortcutString

menuitemPropertySetShortcutString Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuitem a) |
=> a | `menuitem`: The `Menuitem` to set the shortcut on
-> Text | `shortcut`: String describing the shortcut
-> m Bool | Returns: Whether it was successful at setting the property.

This function takes a GTK shortcut string as defined in `gtk_accelerator_parse` and turns that into the information required to send it over DBusmenu.