From cb53b2b61d0315b7c814ecccfe850e430620797d Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 2 Oct 2014 14:36:23 +0200 Subject: [PATCH] Improve default file chooser settings If the user hasn't specified a file on CLI, the button now correctly shows "None" and has $HOME as start dir. --- Gtk.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Gtk.hs b/Gtk.hs index 74e33b9..780266d 100644 --- a/Gtk.hs +++ b/Gtk.hs @@ -35,8 +35,13 @@ makeGUI startFile = do hscale <- xmlGetWidget xml castToHScale "hscale" -- adjust properties - _ <- fileChooserSetCurrentFolder fileButton homedir - _ <- fileChooserSetFilename fileButton startFile + case startFile == "" of + True -> do + _ <- fileChooserSetCurrentFolder fileButton homedir + return () + False -> do + _ <- fileChooserSetFilename fileButton startFile + return () -- callbacks _ <- onDestroy window mainQuit