GTK: allow to start gui with specific directory

This commit is contained in:
Julian Ospald 2015-12-18 14:11:26 +01:00
parent 7c84dce09f
commit 074ee45961
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 15 additions and 4 deletions

View File

@ -4,11 +4,22 @@ module Main where
import Graphics.UI.Gtk import Graphics.UI.Gtk
import GUI.Gtk.Gui import GUI.Gtk.Gui
import Safe
(
headDef
)
import System.Environment
(
getArgs
)
main :: IO () main :: IO ()
main = do main = do
_ <- initGUI _ <- initGUI
startMainWindow args <- getArgs
startMainWindow (headDef "/" args)
mainGUI mainGUI

View File

@ -458,8 +458,8 @@ withErrorDialog io = do
-- |Set up the GUI. -- |Set up the GUI.
startMainWindow :: IO () startMainWindow :: FilePath -> IO ()
startMainWindow = do startMainWindow startdir = do
settings <- newTVarIO (MkFMSettings False True) settings <- newTVarIO (MkFMSettings False True)
@ -469,7 +469,7 @@ startMainWindow = do
filePix <- getIcon IFile 24 filePix <- getIcon IFile 24
errorPix <- getIcon IError 24 errorPix <- getIcon IError 24
fsState <- readPath' "/" >>= newTVarIO fsState <- readPath' startdir >>= newTVarIO
operationBuffer <- newTVarIO (Right None) operationBuffer <- newTVarIO (Right None)