GTK: use new History module

This commit is contained in:
2016-06-04 17:28:15 +02:00
parent d904b74629
commit 05a62cb382
5 changed files with 53 additions and 54 deletions

View File

@@ -64,6 +64,7 @@ import HSFM.GUI.Glib.GlibString()
import HSFM.GUI.Gtk.Data
import HSFM.GUI.Gtk.Icons
import HSFM.GUI.Gtk.Utils
import HSFM.History
import HSFM.Utils.IO
import Paths_hsfm
(
@@ -93,6 +94,8 @@ import System.Posix.FilePath
-- |Creates a new tab with its own view and refreshes the view.
newTab :: MyGUI -> IO FMView -> Item -> Int -> IO MyView
newTab mygui iofmv item pos = do
-- create eventbox with label
label <- labelNewWithMnemonic
(maybe (P.fromAbs $ path item) P.fromRel $ P.basename $ path item)
@@ -105,6 +108,11 @@ newTab mygui iofmv item pos = do
_ <- notebookInsertPageMenu (notebook mygui) (viewBox myview)
ebox ebox pos
-- set initial history
let historySize = 5
putMVar (history myview)
(BrowsingHistory [] (path item) [] historySize)
notebookSetTabReorderable (notebook mygui) (viewBox myview) True
catchIOError (refreshView mygui myview item) $ \e -> do
@@ -134,7 +142,7 @@ createMyView :: MyGUI
-> IO MyView
createMyView mygui iofmv = do
inotify <- newEmptyMVar
history <- newTVarIO ([],[])
history <- newEmptyMVar
builder <- builderNew
builderAddFromFile builder =<< getDataFileName "data/Gtk/builder.xml"