    {-# LINE 2 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget ActionGroup
    --
    -- Author : Duncan Coutts
    --
    -- Created: 6 April 2005
    --
    -- Copyright (C) 2005 Duncan Coutts
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- A group of actions
    --
    -- * Module available since Gtk+ version 2.4
    --
    module Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup (
    -- * Detail
    --
    -- | Actions are organised into groups. An action group is essentially a map
    -- from names to 'Action' objects.
    --
    -- All actions that would make sense to use in a particular context should
    -- be in a single group. Multiple action groups may be used for a particular
    -- user interface. In fact, it is expected that most nontrivial applications
    -- will make use of multiple groups. For example, in an application that can
    -- edit multiple documents, one group holding global actions (e.g. quit, about,
    -- new), and one group per document holding actions that act on that document
    -- (eg. save, cut\/copy\/paste, etc). Each window's menus would be constructed
    -- from a combination of two action groups.
    --
    -- Accelerators are handled by the Gtk+ accelerator map. All actions are
    -- assigned an accelerator path (which normally has the form
    -- @\<Actions>\/group-name\/action-name@) and a shortcut is associated with
    -- this accelerator path. All menuitems and toolitems take on this accelerator
    -- path. The Gtk+ accelerator map code makes sure that the correct shortcut is
    -- displayed next to the menu item.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----ActionGroup
    -- @

    -- * Types
      ActionGroup,
      ActionGroupClass,
      castToActionGroup, gTypeActionGroup,
      toActionGroup,
      ActionEntry(..),
      ToggleActionEntry(..),
      RadioActionEntry(..),

    -- * Constructors
      actionGroupNew,

    -- * Methods
      actionGroupGetName,
      actionGroupGetSensitive,
      actionGroupSetSensitive,
      actionGroupGetVisible,
      actionGroupSetVisible,
      actionGroupGetAction,
      actionGroupListActions,
      actionGroupAddAction,
      actionGroupAddActionWithAccel,
      actionGroupRemoveAction,
      actionGroupAddActions,
      actionGroupAddToggleActions,
      actionGroupAddRadioActions,
      actionGroupSetTranslateFunc,
      actionGroupSetTranslationDomain,

      actionGroupTranslateString,

    -- * Attributes
      actionGroupName,
      actionGroupSensitive,
      actionGroupVisible,

    -- * Signals
    -- onConnectProxy,
    -- afterConnectProxy,
    -- onDisconnectProxy,
    -- afterDisconnectProxy,
    -- onPreActivate,
    -- afterPreActivate,
    -- onPostActivate,
    -- afterPostActivate,

      ) where

    import Control.Monad (liftM, foldM, when)

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.GList
    import System.Glib.Attributes
    import System.Glib.Properties
    import Graphics.UI.Gtk.Types
    {-# LINE 117 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
    import System.Glib.Signals (on)

    import Graphics.UI.Gtk.ActionMenuToolbar.Action
    import Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction
    import Graphics.UI.Gtk.ActionMenuToolbar.RadioAction

    {-# LINE 124 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}

    --------------------
    -- Constructors

    -- | Creates a new 'ActionGroup' object. The name of the action group is used
    -- when associating keybindings with the actions.
    --
    actionGroupNew :: GlibString string
     => string -- ^ @name@ - the name of the action group.
     -> IO ActionGroup
    actionGroupNew :: forall string. GlibString string => string -> IO ActionGroup
    actionGroupNew string
    name =
      (ForeignPtr ActionGroup -> ActionGroup, FinalizerPtr ActionGroup)
    -> IO (Ptr ActionGroup) -> IO ActionGroup
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    wrapNewGObject (ForeignPtr ActionGroup -> ActionGroup, FinalizerPtr ActionGroup)
    forall {a}. (ForeignPtr ActionGroup -> ActionGroup, FinalizerPtr a)
    mkActionGroup (IO (Ptr ActionGroup) -> IO ActionGroup)
    -> IO (Ptr ActionGroup) -> IO ActionGroup
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr ActionGroup)) -> IO (Ptr ActionGroup)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    name ((CString -> IO (Ptr ActionGroup)) -> IO (Ptr ActionGroup))
    -> (CString -> IO (Ptr ActionGroup)) -> IO (Ptr ActionGroup)
    forall a b. (a -> b) -> a -> b
    $ \CString
    namePtr ->
      CString -> IO (Ptr ActionGroup)
    gtk_action_group_new
    {-# LINE 139 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        namePtr

    --------------------
    -- Methods

    -- | Gets the name of the action group.
    --
    actionGroupGetName :: GlibString string => ActionGroup
     -> IO string -- ^ returns the name of the action group.
    actionGroupGetName :: forall string. GlibString string => ActionGroup -> IO string
    actionGroupGetName ActionGroup
    self =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) -> ForeignPtr ActionGroup
    -> (Ptr ActionGroup -> IO CString) -> IO CString
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO CString) -> IO CString)
    -> (Ptr ActionGroup -> IO CString) -> IO CString
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> IO CString
    gtk_action_group_get_name Ptr ActionGroup
    argPtr1)
    {-# LINE 150 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
      IO CString -> (CString -> IO string) -> IO string
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= CString -> IO string
    forall s. GlibString s => CString -> IO s
    peekUTFString

    -- | Returns @True@ if the group is sensitive. The constituent actions can
    -- only be logically sensitive (see 'actionIsSensitive') if they are sensitive
    -- (see 'actionGetSensitive') and their group is sensitive.
    --
    actionGroupGetSensitive :: ActionGroup -> IO Bool
    actionGroupGetSensitive :: ActionGroup -> IO Bool
    actionGroupGetSensitive ActionGroup
    self =
      (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO CInt) -> IO CInt)
    -> (Ptr ActionGroup -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> IO CInt
    gtk_action_group_get_sensitive Ptr ActionGroup
    argPtr1)
    {-# LINE 161 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self

    -- | Changes the sensitivity of @actionGroup@
    --
    actionGroupSetSensitive :: ActionGroup -> Bool -> IO ()
    actionGroupSetSensitive :: ActionGroup -> Bool -> IO ()
    actionGroupSetSensitive ActionGroup
    self Bool
    sensitive =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) CInt
    arg2 -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> CInt -> IO ()
    gtk_action_group_set_sensitive Ptr ActionGroup
    argPtr1 CInt
    arg2)
    {-# LINE 168 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    sensitive)

    -- | Returns @True@ if the group is visible. The constituent actions can only
    -- be logically visible (see 'actionIsVisible') if they are visible (see
    -- 'actionGetVisible') and their group is visible.
    --
    actionGroupGetVisible :: ActionGroup -> IO Bool
    actionGroupGetVisible :: ActionGroup -> IO Bool
    actionGroupGetVisible ActionGroup
    self =
      (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO CInt) -> IO CInt)
    -> (Ptr ActionGroup -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> IO CInt
    gtk_action_group_get_visible Ptr ActionGroup
    argPtr1)
    {-# LINE 179 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self

    -- | Changes the visible of @actionGroup@.
    --
    actionGroupSetVisible :: ActionGroup -> Bool -> IO ()
    actionGroupSetVisible :: ActionGroup -> Bool -> IO ()
    actionGroupSetVisible ActionGroup
    self Bool
    visible =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) CInt
    arg2 -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> CInt -> IO ()
    gtk_action_group_set_visible Ptr ActionGroup
    argPtr1 CInt
    arg2)
    {-# LINE 186 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    visible)

    -- | Looks up an action in the action group by name.
    --
    actionGroupGetAction :: GlibString string => ActionGroup
     -> string -- ^ @actionName@ - the name of the action
     -> IO (Maybe Action) -- ^ returns the action, or @Nothing@ if no action by
                          -- that name exists
    actionGroupGetAction :: forall string.
    GlibString string =>
    ActionGroup -> string -> IO (Maybe Action)
    actionGroupGetAction ActionGroup
    self string
    actionName =
      (IO (Ptr Action) -> IO Action)
    -> IO (Ptr Action) -> IO (Maybe Action)
    forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
    maybeNull ((ForeignPtr Action -> Action, FinalizerPtr Action)
    -> IO (Ptr Action) -> IO Action
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr Action -> Action, FinalizerPtr Action)
    forall {a}. (ForeignPtr Action -> Action, FinalizerPtr a)
    mkAction) (IO (Ptr Action) -> IO (Maybe Action))
    -> IO (Ptr Action) -> IO (Maybe Action)
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr Action)) -> IO (Ptr Action)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    actionName ((CString -> IO (Ptr Action)) -> IO (Ptr Action))
    -> (CString -> IO (Ptr Action)) -> IO (Ptr Action)
    forall a b. (a -> b) -> a -> b
    $ \CString
    actionNamePtr ->
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) CString
    arg2 -> ForeignPtr ActionGroup
    -> (Ptr ActionGroup -> IO (Ptr Action)) -> IO (Ptr Action)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO (Ptr Action)) -> IO (Ptr Action))
    -> (Ptr ActionGroup -> IO (Ptr Action)) -> IO (Ptr Action)
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> CString -> IO (Ptr Action)
    gtk_action_group_get_action Ptr ActionGroup
    argPtr1 CString
    arg2)
    {-# LINE 199 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        CString
    actionNamePtr

    -- | Lists the actions in the action group.
    --
    actionGroupListActions :: ActionGroup
     -> IO [Action] -- ^ returns a list of the action objects in the action group
    actionGroupListActions :: ActionGroup -> IO [Action]
    actionGroupListActions ActionGroup
    self =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) -> ForeignPtr ActionGroup
    -> (Ptr ActionGroup -> IO (Ptr ())) -> IO (Ptr ())
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO (Ptr ())) -> IO (Ptr ()))
    -> (Ptr ActionGroup -> IO (Ptr ())) -> IO (Ptr ())
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> IO (Ptr ())
    gtk_action_group_list_actions Ptr ActionGroup
    argPtr1)
    {-# LINE 208 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
      IO (Ptr ()) -> (Ptr () -> IO [Ptr Action]) -> IO [Ptr Action]
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Ptr () -> IO [Ptr Action]
    forall a. Ptr () -> IO [Ptr a]
    fromGList
      IO [Ptr Action] -> ([Ptr Action] -> IO [Action]) -> IO [Action]
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (Ptr Action -> IO Action) -> [Ptr Action] -> IO [Action]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    (a -> m b) -> t a -> m (t b)
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
    mapM (\Ptr Action
    elemPtr -> (ForeignPtr Action -> Action, FinalizerPtr Action)
    -> IO (Ptr Action) -> IO Action
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr Action -> Action, FinalizerPtr Action)
    forall {a}. (ForeignPtr Action -> Action, FinalizerPtr a)
    mkAction (Ptr Action -> IO (Ptr Action)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Ptr Action
    elemPtr))

    -- | Adds an action object to the action group. Note that this function does
    -- not set up the accel path of the action, which can lead to problems if a
    -- user tries to modify the accelerator of a menuitem associated with the
    -- action. Therefore you must either set the accel path yourself with
    -- 'actionSetAccelPath', or use @'actionGroupAddActionWithAccel' ... Nothing@.
    --
    actionGroupAddAction :: ActionClass action => ActionGroup -> action -> IO ()
    actionGroupAddAction :: forall action. ActionClass action => ActionGroup -> action -> IO ()
    actionGroupAddAction ActionGroup
    self action
    action =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) (Action ForeignPtr Action
    arg2) -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->ForeignPtr Action -> (Ptr Action -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Action
    arg2 ((Ptr Action -> IO ()) -> IO ()) -> (Ptr Action -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Action
    argPtr2 ->Ptr ActionGroup -> Ptr Action -> IO ()
    gtk_action_group_add_action Ptr ActionGroup
    argPtr1 Ptr Action
    argPtr2)
    {-# LINE 221 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        (action -> Action
    forall o. ActionClass o => o -> Action
    toAction action
    action)

    -- | Adds an action object to the action group and sets up the accelerator.
    --
    -- If @accelerator@ is @Nothing@, attempts to use the accelerator associated
    -- with the stock id of the action.
    --
    -- Accel paths are set to @\<Actions>\/group-name\/action-name@.
    --
    actionGroupAddActionWithAccel :: (ActionClass action, GlibString string) => ActionGroup
     -> action -- ^ @action@ - the action to add
     -> Maybe string -- ^ @accelerator@ - the accelerator for the action, in the
                     -- format understood by 'acceleratorParse', or \"\" for no
                     -- accelerator, or @Nothing@ to use the stock accelerator
     -> IO ()
    actionGroupAddActionWithAccel :: forall action string.
    (ActionClass action, GlibString string) =>
    ActionGroup -> action -> Maybe string -> IO ()
    actionGroupAddActionWithAccel ActionGroup
    self action
    action Maybe string
    accelerator =
      (string -> (CString -> IO ()) -> IO ())
    -> Maybe string -> (CString -> IO ()) -> IO ()
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString Maybe string
    accelerator ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    acceleratorPtr ->
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) (Action ForeignPtr Action
    arg2) CString
    arg3 -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->ForeignPtr Action -> (Ptr Action -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Action
    arg2 ((Ptr Action -> IO ()) -> IO ()) -> (Ptr Action -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Action
    argPtr2 ->Ptr ActionGroup -> Ptr Action -> CString -> IO ()
    gtk_action_group_add_action_with_accel Ptr ActionGroup
    argPtr1 Ptr Action
    argPtr2 CString
    arg3)
    {-# LINE 240 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        (action -> Action
    forall o. ActionClass o => o -> Action
    toAction action
    action)
        CString
    acceleratorPtr

    -- | Removes an action object from the action group.
    --
    actionGroupRemoveAction :: ActionClass action => ActionGroup -> action -> IO ()
    actionGroupRemoveAction :: forall action. ActionClass action => ActionGroup -> action -> IO ()
    actionGroupRemoveAction ActionGroup
    self action
    action =
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) (Action ForeignPtr Action
    arg2) -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->ForeignPtr Action -> (Ptr Action -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Action
    arg2 ((Ptr Action -> IO ()) -> IO ()) -> (Ptr Action -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Action
    argPtr2 ->Ptr ActionGroup -> Ptr Action -> IO ()
    gtk_action_group_remove_action Ptr ActionGroup
    argPtr1 Ptr Action
    argPtr2)
    {-# LINE 249 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        (action -> Action
    forall o. ActionClass o => o -> Action
    toAction action
    action)

    -- Note: for these next few functions we cannot use the C version because the
    -- callback doesn't allow for proper memory management. So like pygtk we
    -- implement them natively since they are only convenience functions after all.

    -- | A description of an action.
    data ActionEntry = ActionEntry {
           ActionEntry -> DefaultGlibString
    actionEntryName :: DefaultGlibString,
           ActionEntry -> DefaultGlibString
    actionEntryLabel :: DefaultGlibString,
           ActionEntry -> Maybe DefaultGlibString
    actionEntryStockId :: Maybe DefaultGlibString,
           ActionEntry -> Maybe DefaultGlibString
    actionEntryAccelerator :: Maybe DefaultGlibString,
           ActionEntry -> Maybe DefaultGlibString
    actionEntryTooltip :: Maybe DefaultGlibString,
           ActionEntry -> IO ()
    actionEntryCallback :: IO ()
         }

    -- | This is a convenience function to create a number of actions and add them
    -- to the action group.
    --
    -- The 'actionActivated' signals of the actions are connected to the callbacks
    -- and their accel paths are set to @\<Actions>\/group-name\/action-name@.
    --
    actionGroupAddActions :: ActionGroup
     -> [ActionEntry] -- ^ @entries@ - a list of action descriptions
     -> IO ()
    actionGroupAddActions :: ActionGroup -> [ActionEntry] -> IO ()
    actionGroupAddActions ActionGroup
    self [ActionEntry]
    entries =
      ((ActionEntry -> IO ()) -> [ActionEntry] -> IO ())
    -> [ActionEntry] -> (ActionEntry -> IO ()) -> IO ()
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip (ActionEntry -> IO ()) -> [ActionEntry] -> IO ()
    forall (t :: * -> *) (m :: * -> *) a b.
    (Foldable t, Monad m) =>
    (a -> m b) -> t a -> m ()
    mapM_ [ActionEntry]
    entries ((ActionEntry -> IO ()) -> IO ())
    -> (ActionEntry -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \(ActionEntry DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    stockId
                            Maybe DefaultGlibString
    accelerator Maybe DefaultGlibString
    tooltip IO ()
    callback) -> do
        action <- DefaultGlibString
    -> DefaultGlibString
    -> Maybe DefaultGlibString
    -> Maybe DefaultGlibString
    -> IO Action
    forall string.
    GlibString string =>
    string
    -> string -> Maybe string -> Maybe DefaultGlibString -> IO Action
    actionNew DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    tooltip Maybe DefaultGlibString
    stockId
        action `on` actionActivated $ callback
        actionGroupAddActionWithAccel self action accelerator

    -- | A description of an action for an entry that can be toggled.
    data ToggleActionEntry = ToggleActionEntry {
           ToggleActionEntry -> DefaultGlibString
    toggleActionName :: DefaultGlibString,
           ToggleActionEntry -> DefaultGlibString
    toggleActionLabel :: DefaultGlibString,
           ToggleActionEntry -> Maybe DefaultGlibString
    toggleActionStockId :: Maybe DefaultGlibString,
           ToggleActionEntry -> Maybe DefaultGlibString
    toggleActionAccelerator :: Maybe DefaultGlibString,
           ToggleActionEntry -> Maybe DefaultGlibString
    toggleActionTooltip :: Maybe DefaultGlibString,
           ToggleActionEntry -> IO ()
    toggleActionCallback :: IO (),
           ToggleActionEntry -> Bool
    toggleActionIsActive :: Bool
         }

    -- | This is a convenience function to create a number of toggle actions and
    -- add them to the action group.
    --
    -- The 'actionActivated' signals of the actions are connected to the callbacks
    -- and their accel paths are set to @\<Actions>\/group-name\/action-name@.
    --
    actionGroupAddToggleActions :: ActionGroup
     -> [ToggleActionEntry] -- ^ @entries@ - a list of toggle action descriptions
     -> IO ()
    actionGroupAddToggleActions :: ActionGroup -> [ToggleActionEntry] -> IO ()
    actionGroupAddToggleActions ActionGroup
    self [ToggleActionEntry]
    entries =
      ((ToggleActionEntry -> IO ()) -> [ToggleActionEntry] -> IO ())
    -> [ToggleActionEntry] -> (ToggleActionEntry -> IO ()) -> IO ()
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip (ToggleActionEntry -> IO ()) -> [ToggleActionEntry] -> IO ()
    forall (t :: * -> *) (m :: * -> *) a b.
    (Foldable t, Monad m) =>
    (a -> m b) -> t a -> m ()
    mapM_ [ToggleActionEntry]
    entries ((ToggleActionEntry -> IO ()) -> IO ())
    -> (ToggleActionEntry -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \(ToggleActionEntry DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    stockId
                            Maybe DefaultGlibString
    accelerator Maybe DefaultGlibString
    tooltip IO ()
    callback Bool
    isActive) -> do
        action <- DefaultGlibString
    -> DefaultGlibString
    -> Maybe DefaultGlibString
    -> Maybe DefaultGlibString
    -> IO ToggleAction
    forall string.
    GlibString string =>
    string
    -> string
    -> Maybe string
    -> Maybe DefaultGlibString
    -> IO ToggleAction
    toggleActionNew DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    tooltip Maybe DefaultGlibString
    stockId
        toggleActionSetActive action isActive
        action `on` actionActivated $ callback
        actionGroupAddActionWithAccel self action accelerator

    -- | A description of an action for an entry that provides a multiple choice.
    data RadioActionEntry = RadioActionEntry {
           RadioActionEntry -> DefaultGlibString
    radioActionName :: DefaultGlibString,
           RadioActionEntry -> DefaultGlibString
    radioActionLabel :: DefaultGlibString,
           RadioActionEntry -> Maybe DefaultGlibString
    radioActionStockId :: Maybe DefaultGlibString,
           RadioActionEntry -> Maybe DefaultGlibString
    radioActionAccelerator :: Maybe DefaultGlibString,
           RadioActionEntry -> Maybe DefaultGlibString
    radioActionTooltip :: Maybe DefaultGlibString,
           RadioActionEntry -> Int
    radioActionValue :: Int
         }

    -- | This is a convenience routine to create a group of radio actions and add
    -- them to the action group.
    --
    -- The 'radioActionChanged' signal of the first radio action is connected to the
    -- @onChange@ callback and the accel paths of the actions are set to
    -- @\<Actions>\/group-name\/action-name@.
    --
    actionGroupAddRadioActions :: ActionGroup
     -> [RadioActionEntry] -- ^ @entries@ - a list of radio action descriptions
     -> Int -- ^ @value@ - the value of the action to activate
                           -- initially, or -1 if no action should be activated
     -> (RadioAction -> IO ()) -- ^ @onChange@ - the callback for the changed signal
     -> IO ()
    actionGroupAddRadioActions :: ActionGroup
    -> [RadioActionEntry] -> Int -> (RadioAction -> IO ()) -> IO ()
    actionGroupAddRadioActions ActionGroup
    self [RadioActionEntry]
    entries Int
    initialValue RadioAction -> IO ()
    onChange = do
      group <- (Maybe RadioAction -> RadioActionEntry -> IO (Maybe RadioAction))
    -> Maybe RadioAction
    -> [RadioActionEntry]
    -> IO (Maybe RadioAction)
    forall (t :: * -> *) (m :: * -> *) b a.
    (Foldable t, Monad m) =>
    (b -> a -> m b) -> b -> t a -> m b
    foldM
        (\Maybe RadioAction
    group (RadioActionEntry DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    stockId
                   Maybe DefaultGlibString
    accelerator Maybe DefaultGlibString
    tooltip Int
    value) -> do
        action <- DefaultGlibString
    -> DefaultGlibString
    -> Maybe DefaultGlibString
    -> Maybe DefaultGlibString
    -> Int
    -> IO RadioAction
    forall string.
    GlibString string =>
    string
    -> string
    -> Maybe string
    -> Maybe DefaultGlibString
    -> Int
    -> IO RadioAction
    radioActionNew DefaultGlibString
    name DefaultGlibString
    label Maybe DefaultGlibString
    tooltip Maybe DefaultGlibString
    stockId Int
    value
        case group of
          Maybe RadioAction
    Nothing -> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()
          Just RadioAction
    group -> RadioAction -> RadioAction -> IO ()
    forall self groupMember.
    (RadioActionClass self, RadioActionClass groupMember) =>
    self -> groupMember -> IO ()
    radioActionSetGroup RadioAction
    action RadioAction
    group
        when (initialValue == value) (toggleActionSetActive action True)
        actionGroupAddActionWithAccel self action accelerator
        return (Just action))
        Maybe RadioAction
    forall a. Maybe a
    Nothing [RadioActionEntry]
    entries
      case group of
          Maybe RadioAction
    Nothing -> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()
          Just RadioAction
    group -> do
            RadioAction
    group RadioAction
    -> Signal RadioAction (RadioAction -> IO ())
    -> (RadioAction -> IO ())
    -> IO (ConnectId RadioAction)
    forall object callback.
    object
    -> Signal object callback -> callback -> IO (ConnectId object)
    `on` Signal RadioAction (RadioAction -> IO ())
    forall self.
    RadioActionClass self =>
    Signal self (RadioAction -> IO ())
    radioActionChanged ((RadioAction -> IO ()) -> IO (ConnectId RadioAction))
    -> (RadioAction -> IO ()) -> IO (ConnectId RadioAction)
    forall a b. (a -> b) -> a -> b
    $ RadioAction -> IO ()
    onChange
            () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    -- | Sets a function to be used for translating the @label@ and @tooltip@ of
    -- 'ActionEntry's added by 'actionGroupAddActions'.
    --
    -- If you\'re using \'gettext\', it is enough to set the translation domain
    -- with 'actionGroupSetTranslationDomain'.
    --
    actionGroupSetTranslateFunc :: GlibString string => ActionGroup
     -> (string -> IO string) -- ^ @(\label -> ...)@ - a translation function
     -> IO ()
    actionGroupSetTranslateFunc :: forall string.
    GlibString string =>
    ActionGroup -> (string -> IO string) -> IO ()
    actionGroupSetTranslateFunc ActionGroup
    self string -> IO string
    func = do
      funcPtr <- (CString -> Ptr () -> IO CString) -> IO TranslateFunc
    mkTranslateFunc ((CString -> Ptr () -> IO CString) -> IO TranslateFunc)
    -> (CString -> Ptr () -> IO CString) -> IO TranslateFunc
    forall a b. (a -> b) -> a -> b
    $ \CString
    strPtr Ptr ()
    _ -> do
                   str <- CString -> IO string
    forall s. GlibString s => CString -> IO s
    peekUTFString CString
    strPtr
                   translatedStr <- func str
                   newUTFString translatedStr
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) TranslateFunc
    arg2 Ptr ()
    arg3 FunPtr (Ptr () -> IO ())
    arg4 -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup
    -> TranslateFunc -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO ()
    gtk_action_group_set_translate_func Ptr ActionGroup
    argPtr1 TranslateFunc
    arg2 Ptr ()
    arg3 FunPtr (Ptr () -> IO ())
    arg4)
    {-# LINE 367 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        funcPtr
        (castFunPtrToPtr funcPtr)
        destroyFunPtr

    type TranslateFunc = FunPtr (((Ptr CChar) -> ((Ptr ()) -> (IO (Ptr CChar)))))
    {-# LINE 373 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}

    foreign import ccall "wrapper" mkTranslateFunc ::
      (CString -> Ptr () -> IO CString) -> IO TranslateFunc

    -- | Sets the translation domain and uses \'dgettext\' for translating the
    -- @label@ and @tooltip@ of 'ActionEntry's added by 'actionGroupAddActions'.
    --
    -- If you\'re not using \'gettext\' for localization, see
    -- 'actionGroupSetTranslateFunc'.
    --
    actionGroupSetTranslationDomain :: GlibString string => ActionGroup
     -> string -- ^ @domain@ - the translation domain to use for \'dgettext\'
                    -- calls
     -> IO ()
    actionGroupSetTranslationDomain :: forall string. GlibString string => ActionGroup -> string -> IO ()
    actionGroupSetTranslationDomain ActionGroup
    self string
    domain =
      string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    domain ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    domainPtr ->
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) CString
    arg2 -> ForeignPtr ActionGroup -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO ()) -> IO ())
    -> (Ptr ActionGroup -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> CString -> IO ()
    gtk_action_group_set_translation_domain Ptr ActionGroup
    argPtr1 CString
    arg2)
    {-# LINE 390 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        CString
    domainPtr

    -- | Translates a string.
    --
    -- * Available since Gtk+ version 2.6
    --
    actionGroupTranslateString :: GlibString string => ActionGroup
     -> string -- ^ @string@ - a string
     -> IO string -- ^ returns the translation of @string@
    actionGroupTranslateString :: forall string.
    GlibString string =>
    ActionGroup -> string -> IO string
    actionGroupTranslateString ActionGroup
    self string
    string =
      string -> (CString -> IO string) -> IO string
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    string ((CString -> IO string) -> IO string)
    -> (CString -> IO string) -> IO string
    forall a b. (a -> b) -> a -> b
    $ \CString
    stringPtr ->
      (\(ActionGroup ForeignPtr ActionGroup
    arg1) CString
    arg2 -> ForeignPtr ActionGroup
    -> (Ptr ActionGroup -> IO CString) -> IO CString
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ActionGroup
    arg1 ((Ptr ActionGroup -> IO CString) -> IO CString)
    -> (Ptr ActionGroup -> IO CString) -> IO CString
    forall a b. (a -> b) -> a -> b
    $ \Ptr ActionGroup
    argPtr1 ->Ptr ActionGroup -> CString -> IO CString
    gtk_action_group_translate_string Ptr ActionGroup
    argPtr1 CString
    arg2)
    {-# LINE 404 "./Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs" #-}
        self
        CString
    stringPtr
      IO CString -> (CString -> IO string) -> IO string
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= CString -> IO string
    forall s. GlibString s => CString -> IO s
    peekUTFString

    --------------------
    -- Attributes

    -- | A name for the action group.
    --
    -- Default value: \"\"
    --
    actionGroupName :: GlibString string => Attr ActionGroup string
    actionGroupName :: forall string. GlibString string => Attr ActionGroup string
    actionGroupName = String -> Attr ActionGroup string
    forall gobj string.
    (GObjectClass gobj, GlibString string) =>
    String -> Attr gobj string
    newAttrFromStringProperty String
    "name"

    -- | Whether the action group is enabled.
    --
    -- Default value: @True@
    --
    actionGroupSensitive :: Attr ActionGroup Bool
    actionGroupSensitive :: Attr ActionGroup Bool
    actionGroupSensitive = (ActionGroup -> IO Bool)
    -> (ActionGroup -> Bool -> IO ()) -> Attr ActionGroup Bool
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      ActionGroup -> IO Bool
    actionGroupGetSensitive
      ActionGroup -> Bool -> IO ()
    actionGroupSetSensitive

    -- | Whether the action group is visible.
    --
    -- Default value: @True@
    --
    actionGroupVisible :: Attr ActionGroup Bool
    actionGroupVisible :: Attr ActionGroup Bool
    actionGroupVisible = (ActionGroup -> IO Bool)
    -> (ActionGroup -> Bool -> IO ()) -> Attr ActionGroup Bool
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      ActionGroup -> IO Bool
    actionGroupGetVisible
      ActionGroup -> Bool -> IO ()
    actionGroupSetVisible

    --------------------
    -- Signals

    {-
    -- | The connect_proxy signal is emitted after connecting a proxy to an action
    -- in the group. Note that the proxy may have been connected to a different
    -- action before.
    --
    -- This is intended for simple customizations for which a custom action
    -- class would be too clumsy, e.g. showing tooltips for menuitems in the
    -- statusbar.
    --
    onConnectProxy, afterConnectProxy :: ActionGroupClass self => self
     -> ({-GtkAction-} -> {-GtkWidget-} -> IO ())
     -> IO (ConnectId self)
    onConnectProxy = connect_{-GtkAction-}_{-GtkWidget-}__NONE "connect_proxy" False
    afterConnectProxy = connect_{-GtkAction-}_{-GtkWidget-}__NONE "connect_proxy" True

    -- | The disconnect_proxy signal is emitted after disconnecting a proxy from
    -- an action in the group.
    --
    onDisconnectProxy, afterDisconnectProxy :: ActionGroupClass self => self
     -> ({-GtkAction-} -> {-GtkWidget-} -> IO ())
     -> IO (ConnectId self)
    onDisconnectProxy = connect_{-GtkAction-}_{-GtkWidget-}__NONE "disconnect_proxy" False
    afterDisconnectProxy = connect_{-GtkAction-}_{-GtkWidget-}__NONE "disconnect_proxy" True

    -- | The pre_activate signal is emitted just before the @action@ in the
    -- @actionGroup@ is activated
    --
    -- This is intended for 'UIManager' to proxy the signal and provide global
    -- notification just before any action is activated.
    --
    onPreActivate, afterPreActivate :: ActionGroupClass self => self
     -> ({-GtkAction-} -> IO ())
     -> IO (ConnectId self)
    onPreActivate = connect_{-GtkAction-}__NONE "pre_activate" False
    afterPreActivate = connect_{-GtkAction-}__NONE "pre_activate" True

    -- | The post_activate signal is emitted just after the @action@ in the
    -- @actionGroup@ is activated
    --
    -- This is intended for 'UIManager' to proxy the signal and provide global
    -- notification just after any action is activated.
    --
    onPostActivate, afterPostActivate :: ActionGroupClass self => self
     -> ({-GtkAction-} -> IO ())
     -> IO (ConnectId self)
    onPostActivate = connect_{-GtkAction-}__NONE "post_activate" False
    afterPostActivate = connect_{-GtkAction-}__NONE "post_activate" True
    -}

    foreign import ccall safe "gtk_action_group_new"
      gtk_action_group_new :: ((Ptr CChar) -> (IO (Ptr ActionGroup)))

    foreign import ccall safe "gtk_action_group_get_name"
      gtk_action_group_get_name :: ((Ptr ActionGroup) -> (IO (Ptr CChar)))

    foreign import ccall safe "gtk_action_group_get_sensitive"
      gtk_action_group_get_sensitive :: ((Ptr ActionGroup) -> (IO CInt))

    foreign import ccall safe "gtk_action_group_set_sensitive"
      gtk_action_group_set_sensitive :: ((Ptr ActionGroup) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_action_group_get_visible"
      gtk_action_group_get_visible :: ((Ptr ActionGroup) -> (IO CInt))

    foreign import ccall safe "gtk_action_group_set_visible"
      gtk_action_group_set_visible :: ((Ptr ActionGroup) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_action_group_get_action"
      gtk_action_group_get_action :: ((Ptr ActionGroup) -> ((Ptr CChar) -> (IO (Ptr Action))))

    foreign import ccall safe "gtk_action_group_list_actions"
      gtk_action_group_list_actions :: ((Ptr ActionGroup) -> (IO (Ptr ())))

    foreign import ccall safe "gtk_action_group_add_action"
      gtk_action_group_add_action :: ((Ptr ActionGroup) -> ((Ptr Action) -> (IO ())))

    foreign import ccall safe "gtk_action_group_add_action_with_accel"
      gtk_action_group_add_action_with_accel :: ((Ptr ActionGroup) -> ((Ptr Action) -> ((Ptr CChar) -> (IO ()))))

    foreign import ccall safe "gtk_action_group_remove_action"
      gtk_action_group_remove_action :: ((Ptr ActionGroup) -> ((Ptr Action) -> (IO ())))

    foreign import ccall safe "gtk_action_group_set_translate_func"
      gtk_action_group_set_translate_func :: ((Ptr ActionGroup) -> ((FunPtr ((Ptr CChar) -> ((Ptr ()) -> (IO (Ptr CChar))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO ())))))

    foreign import ccall safe "gtk_action_group_set_translation_domain"
      gtk_action_group_set_translation_domain :: ((Ptr ActionGroup) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall safe "gtk_action_group_translate_string"
      gtk_action_group_translate_string :: ((Ptr ActionGroup) -> ((Ptr CChar) -> (IO (Ptr CChar))))