summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-05-08 15:01:24 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2009-05-08 15:01:24 +0100
commit446ef601d6d9c47702df484508426bec6171973b (patch)
tree33707e2dba51d390cf6c84ede0c3cdf06f4fb232
parent1786af416e64a0034e5e57e29217d39ab714c9ee (diff)
Always open at least one window.
Previously, if there were some arguments but they couldn't be loaded, mainGUI wouldn't run and you'd never see the dialogue. I think opening an empty window is probably the right thing to do.
-rw-r--r--Bustle.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Bustle.hs b/Bustle.hs
index 7c62b4a..a7bad71 100644
--- a/Bustle.hs
+++ b/Bustle.hs
@@ -126,14 +126,15 @@ mainB :: B ()
mainB = do
io initGUI
- fs <- io getArgs
-
- if null fs
- then createInitialWindow
- else mapM_ loadLog fs
+ -- Try to load arguments, if any.
+ mapM_ loadLog =<< io getArgs
+ -- If no windows are open (because none of the arguments, if any, were loaded
+ -- successfully) create an empty window
n <- gets windows
- when (n > 0) (io mainGUI)
+ when (n == 0) createInitialWindow
+
+ io mainGUI
createInitialWindow :: B ()
createInitialWindow = do