Skip to content

Commit

Permalink
scopeCairoNew: return an IORef
Browse files Browse the repository at this point in the history
  • Loading branch information
kfish committed Mar 16, 2012
1 parent ebeac11 commit 850a7dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Scope/Cairo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Prelude hiding (catch)

import Control.Monad.CatchIO
import Control.Monad.Reader
import Data.IORef
import qualified Graphics.Rendering.Cairo as C
import Graphics.Rendering.Cairo.Internal (Render(..))
import Graphics.Rendering.Cairo.Types (Cairo)
Expand All @@ -30,8 +31,8 @@ data ViewCairo = ViewCairo
, adj :: G.Adjustment
}

scopeCairoNew :: G.DrawingArea -> G.Adjustment -> Scope ViewCairo
scopeCairoNew c a = scopeNew (viewCairoInit c a)
scopeCairoNew :: G.DrawingArea -> G.Adjustment -> IO (IORef (Scope ViewCairo))
scopeCairoNew c a = newIORef $ scopeNew (viewCairoInit c a)

viewCairoInit :: G.DrawingArea -> G.Adjustment -> ViewCairo
viewCairoInit c a = ViewCairo c a
Expand Down
3 changes: 1 addition & 2 deletions src/GUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ guiMain chan args = do
adj <- G.adjustmentNew (0.0) (0.0) (1.0) (0.1) 1.0 1.0
drawingArea <- G.drawingAreaNew

let scope = scopeCairoNew drawingArea adj
scopeRef <- newIORef scope
scopeRef <- scopeCairoNew drawingArea adj

quita `G.on` G.actionActivated $ myQuit scopeRef window chan

Expand Down

0 comments on commit 850a7dc

Please sign in to comment.