{-# LINE 2 "./Graphics/UI/Gtk/Selectors/FileChooserDialog.chs" #-}
module Graphics.UI.Gtk.Selectors.FileChooserDialog (
FileChooserDialog,
FileChooserDialogClass,
castToFileChooserDialog, gTypeFileChooserDialog,
toFileChooserDialog,
fileChooserDialogNew,
fileChooserDialogNewWithBackend
) where
import Control.Monad (liftM, when)
import Data.Maybe (isJust, fromJust)
import System.Glib.FFI
import System.Glib.UTFString
import Graphics.UI.Gtk.Types
{-# LINE 82 "./Graphics/UI/Gtk/Selectors/FileChooserDialog.chs" #-}
import Graphics.UI.Gtk.Selectors.FileChooser
{-# LINE 83 "./Graphics/UI/Gtk/Selectors/FileChooserDialog.chs" #-}
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Windows.Window
import Graphics.UI.Gtk.Windows.Dialog
import System.Glib.GValue (allocaGValue)
import System.Glib.GValueTypes (valueSetMaybeString)
import System.Glib.Attributes
{-# LINE 91 "./Graphics/UI/Gtk/Selectors/FileChooserDialog.chs" #-}
instance FileChooserClass FileChooserDialog
fileChooserDialogNew
:: GlibString string
=> Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> IO FileChooserDialog
fileChooserDialogNew :: forall string.
GlibString string =>
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> IO FileChooserDialog
fileChooserDialogNew Maybe string
title Maybe Window
parent FileChooserAction
action [(string, ResponseId)]
buttons =
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> Maybe string
-> IO FileChooserDialog
forall string.
GlibString string =>
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> Maybe string
-> IO FileChooserDialog
internalFileChooserDialogNew Maybe string
title Maybe Window
parent FileChooserAction
action [(string, ResponseId)]
buttons Maybe string
forall a. Maybe a
Nothing
fileChooserDialogNewWithBackend
:: GlibString string
=> Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> string
-> IO FileChooserDialog
fileChooserDialogNewWithBackend :: forall string.
GlibString string =>
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> string
-> IO FileChooserDialog
fileChooserDialogNewWithBackend Maybe string
title Maybe Window
parent FileChooserAction
action [(string, ResponseId)]
buttons string
backend =
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> Maybe string
-> IO FileChooserDialog
forall string.
GlibString string =>
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> Maybe string
-> IO FileChooserDialog
internalFileChooserDialogNew Maybe string
title Maybe Window
parent FileChooserAction
action [(string, ResponseId)]
buttons (string -> Maybe string
forall a. a -> Maybe a
Just string
backend)
internalFileChooserDialogNew :: GlibString string =>
Maybe string ->
Maybe Window ->
FileChooserAction ->
[(string, ResponseId)] ->
Maybe string ->
IO FileChooserDialog
internalFileChooserDialogNew :: forall string.
GlibString string =>
Maybe string
-> Maybe Window
-> FileChooserAction
-> [(string, ResponseId)]
-> Maybe string
-> IO FileChooserDialog
internalFileChooserDialogNew Maybe string
title Maybe Window
parent FileChooserAction
action [(string, ResponseId)]
buttons Maybe string
backend = do
objType <- IO CUInt
gtk_file_chooser_dialog_get_type
{-# LINE 142 "./Graphics/UI/Gtk/Selectors/FileChooserDialog.chs" #-}
dialog <-makeNewObject mkFileChooserDialog $ liftM castPtr $
if (isJust backend)
then allocaGValue $ \backendGValue -> do
valueSetMaybeString backendGValue backend
objectNew objType [("file-system-backend", backendGValue)]
else objectNew objType []
when (isJust title)
(set dialog [windowTitle := fromJust title])
when (isJust parent)
(set dialog [windowTransientFor := fromJust parent])
dialog `fileChooserSetAction` action
mapM_ (\(string
btnName, ResponseId
btnResponse) ->
FileChooserDialog -> string -> ResponseId -> IO Button
forall self string.
(DialogClass self, GlibString string) =>
self -> string -> ResponseId -> IO Button
dialogAddButton FileChooserDialog
dialog string
btnName ResponseId
btnResponse) buttons
return dialog
foreign import ccall unsafe "gtk_file_chooser_dialog_get_type"
gtk_file_chooser_dialog_get_type :: (IO CUInt)