From 3edd3c8a194e47e22b9783f38788d84c4acc805d Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 25 Dec 2015 23:17:22 +0100 Subject: [PATCH] GTK: rename fileChooserDialog and add title parameter --- src/GUI/Gtk/Callbacks.hs | 4 ++-- src/GUI/Gtk/Dialogs.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GUI/Gtk/Callbacks.hs b/src/GUI/Gtk/Callbacks.hs index 7c9277e..6d7d402 100644 --- a/src/GUI/Gtk/Callbacks.hs +++ b/src/GUI/Gtk/Callbacks.hs @@ -267,8 +267,8 @@ upDir mygui myview = withErrorDialog $ do -- |Go up one directory and visualize it in the treeView. newFile :: MyGUI -> MyView -> IO () newFile mygui myview = withErrorDialog $ do - cdir <- getCurrentDir myview - mfn <- fileChooserDialog + cdir <- getCurrentDir myview + mfn <- textInputDialog "Enter file name" maybe (return ()) (\fn -> do createFile cdir fn refreshTreeView' mygui myview cdir diff --git a/src/GUI/Gtk/Dialogs.hs b/src/GUI/Gtk/Dialogs.hs index 7e48395..1c5d1e8 100644 --- a/src/GUI/Gtk/Dialogs.hs +++ b/src/GUI/Gtk/Dialogs.hs @@ -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