Hi everyone,

(I am using GHC 7.4.1 x86, Gtk2hs 0.12.3, on win7 x64)

I am trying to add a Label with some text to the contentArea of an InfoBar,
but I am not getting the results I expect.  If I use code to add the label to the
InfoBar outside of a button-activate signal, the label is added fine.

If I use the exact same code as part of a button-activate signal, the label is NOT
added.

Is this a bug in Gtk2hs? Or am I doing something wrong here?

Here is an isolated sample program that can be used to reproduce the error:

================================================

{-# LANGUAGE RecordWildCards #-}
module Main where

   import Control.Concurrent
   import Graphics.UI.Gtk


   main = do
      -- init GTK+ engine
      initGUI
      -- Every so often, we try to run other threads.
      timeoutAddFull (yield >> return True) priorityDefaultIdle 100
      -- show the main app window
      widgetShowAll =<< mkWindow
      -- Run the GTK+ main loop; exits after GUI is done
      mainGUI


   -- constructor for new window
   mkWindow :: IO Window
   mkWindow = do
      (window, btnSave, btnCancel, ibarAlert) <- createAndConfigureWindow

      -- add a default Label to the InfoBar
      contentArea2 <- infoBarGetContentArea ibarAlert
      lbl2 <- labelNew $! Just "Unsaved Changes"
      boxPackStart (castToHBox contentArea2) lbl2 PackNatural 5

      ----------------------------------------------------------------
      -- EVENTS
      ----------------------------------------------------------------
      onDestroy window mainQuit

      -- hook up the btnSave_onClick event handler
      --btnSave `on` buttonActivated $! btnSave_onClick window ibarAlert
      btnSave `on` buttonActivated $
         do putStrLn "saving ..."
            -- try to add another label to the InfoBar, BUT THIS DOES NOT SEEM TO WORK
            contentArea <- infoBarGetContentArea ibarAlert
            lbl <- labelNew $! Just "Saving Completed"
            boxPackStart (castToHBox contentArea) lbl PackNatural 5


      -- hook up the btnCancel_onClick event handler
      btnCancel `on` buttonActivated $! btnCancel_onClick window

      return window


   {--------------------------------------------------------------------------------------------------------------
   -- EVENT HANDLERS
   --------------------------------------------------------------------------------------------------------------}

   -- | event handler that fires when user clicks the Save button
   btnSave_onClick :: Window -> InfoBar -> IO ()
   btnSave_onClick _ ibarAlert = do
      putStrLn "saving ..."

      contentArea <- infoBarGetContentArea ibarAlert
      lbl <- labelNew $! Just "Saving Completed"
      boxPackStart (castToHBox contentArea) lbl PackNatural 5

      return ()

   
   -- | event handler that fires when user clicks the Cancel button
   btnCancel_onClick :: Window -> IO ()
   btnCancel_onClick window = do
      widgetDestroy window
      return ()


   -- creates a new window and adds all the necessary controls to the window
   createAndConfigureWindow = do
      -----------------------------------------------
      -- set up window
      -----------------------------------------------      
      window <- windowNew
      set window [windowDefaultWidth   := 800
                 ,windowDefaultHeight  := 400
                 ,containerBorderWidth := 5]
                       
      vb       <- vBoxNew False 0
      containerAdd window vb      
      -----------------------------------------------
      -- set up info-panel
      -----------------------------------------------
      infoBarAlert <- infoBarNew
      set infoBarAlert [infoBarMessageType := MessageOther]
      -----------------------------------------------
      -- set up buttons
      -----------------------------------------------
      hbButtons <- hBoxNew False 0
      btnSave   <- buttonNewWithLabel "Save"
      btnCancel <- buttonNewWithLabel "Cancel"
      boxPackStart hbButtons infoBarAlert PackGrow 5
      boxPackStart hbButtons btnSave PackNatural 5
      boxPackStart hbButtons btnCancel PackNatural 5
      -----------------------------------------------
      -- PACK WINDOW
      -----------------------------------------------
      boxPackStart vb hbButtons PackNatural 5

      return (window, btnSave, btnCancel, infoBarAlert)

================================================

The code in the mkWindow function is the main thing to look at.  I add a label to the InfoBar
and use the same code for the btnSave-activate signal, but the 2nd label does not get added.

Regards
Rouan