From 3c140832bcdf0e8a214742b4045d8398533344f4 Mon Sep 17 00:00:00 2001 From: hasufell Date: Wed, 1 Oct 2014 21:47:54 +0200 Subject: [PATCH] Allow setting a startFile via cli --- Gtk.hs | 5 +++-- Main.hs | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Gtk.hs b/Gtk.hs index 85eefc4..a92d8e6 100644 --- a/Gtk.hs +++ b/Gtk.hs @@ -10,8 +10,8 @@ import Graphics.UI.Gtk.Windows.MessageDialog import System.Directory -startGUI :: IO () -startGUI = do +startGUI :: FilePath -> IO () +startGUI startFile = do homedir <- getHomeDirectory -- init gui @@ -53,6 +53,7 @@ startGUI = do _ <- windowSetTypeHint window WindowTypeHintDialog containerSetBorderWidth box2 10 _ <- fileChooserSetCurrentFolder fileButton homedir + _ <- fileChooserSetFilename fileButton startFile -- callbacks _ <- onDestroy window mainQuit diff --git a/Main.hs b/Main.hs index afbd2aa..b0ebfc8 100644 --- a/Main.hs +++ b/Main.hs @@ -1,4 +1,8 @@ import Gtk +import System.Environment + main :: IO () -main = startGUI +main = do + [a] <- getArgs + startGUI a