From 5bfea0db10766dcba6aacfef161630be301854c1 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 20 Dec 2015 05:32:11 +0100 Subject: [PATCH] GUI: clean up copyFinal Don't show CopyModeChooserDialog for file copy operations. --- src/GUI/Gtk/Callbacks.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/GUI/Gtk/Callbacks.hs b/src/GUI/Gtk/Callbacks.hs index 68712a6..4ace5a3 100644 --- a/src/GUI/Gtk/Callbacks.hs +++ b/src/GUI/Gtk/Callbacks.hs @@ -170,13 +170,14 @@ copyFinal :: MyGUI -> MyView -> IO () copyFinal mygui myview = do op <- readTVarIO (operationBuffer myview) case op of - FCopy (CP1 sourceDir) -> do - curDir <- anchor <$> readTVarIO (fsState myview) - let cmsg = "Really copy file \"" ++ sourceDir - ++ "\"" ++ " to \"" ++ curDir ++ "\"?" + FCopy (CP1 source) -> do + dest <- anchor <$> readTVarIO (fsState myview) + isFile <- doesFileExist source + let cmsg = "Really copy file \"" ++ source + ++ "\"" ++ " to \"" ++ dest ++ "\"?" withConfirmationDialog cmsg $ do - copyMode <- showCopyModeChooserDialog - withErrorDialog ((runFileOp . FCopy . CC sourceDir curDir $ copyMode) + copyMode <- if isFile then return Strict else showCopyModeChooserDialog + withErrorDialog ((runFileOp . FCopy . CC source dest $ copyMode) >> refreshTreeView mygui myview Nothing) _ -> return ()