GTK: rename fileChooserDialog and add title parameter

This commit is contained in:
Julian Ospald 2015-12-25 23:17:22 +01:00
parent 71a2cb90be
commit 3edd3c8a19
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 6 additions and 6 deletions

View File

@ -268,7 +268,7 @@ upDir mygui myview = withErrorDialog $ do
newFile :: MyGUI -> MyView -> IO ()
newFile mygui myview = withErrorDialog $ do
cdir <- getCurrentDir myview
mfn <- fileChooserDialog
mfn <- textInputDialog "Enter file name"
maybe (return ()) (\fn -> do
createFile cdir fn
refreshTreeView' mygui myview cdir

View File

@ -161,16 +161,16 @@ withErrorDialog io = do
-- |Asks the user which directory copy mode he wants via dialog popup
-- and returns 'DirCopyMode'.
fileChooserDialog :: IO (Maybe String)
fileChooserDialog = do
textInputDialog :: String -> IO (Maybe String)
textInputDialog title = do
chooserDialog <- messageDialogNew Nothing
[DialogDestroyWithParent]
MessageQuestion
ButtonsNone
"Enter filename"
title
entry <- entryNew
cbox <- dialogGetActionArea chooserDialog
dialogAddButton chooserDialog "Create" (ResponseUser 0)
dialogAddButton chooserDialog "Ok" (ResponseUser 0)
dialogAddButton chooserDialog "Cancel" (ResponseUser 1)
boxPackStart (castToBox cbox) entry PackNatural 5
widgetShowAll chooserDialog