{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.WebKit2.Objects.FileChooserRequest
    (

-- * Exported types
    FileChooserRequest(..)                  ,
    IsFileChooserRequest                    ,
    toFileChooserRequest                    ,
    noFileChooserRequest                    ,


 -- * Methods
-- ** cancel #method:cancel#

#if ENABLE_OVERLOADING
    FileChooserRequestCancelMethodInfo      ,
#endif
    fileChooserRequestCancel                ,


-- ** getMimeTypes #method:getMimeTypes#

#if ENABLE_OVERLOADING
    FileChooserRequestGetMimeTypesMethodInfo,
#endif
    fileChooserRequestGetMimeTypes          ,


-- ** getMimeTypesFilter #method:getMimeTypesFilter#

#if ENABLE_OVERLOADING
    FileChooserRequestGetMimeTypesFilterMethodInfo,
#endif
    fileChooserRequestGetMimeTypesFilter    ,


-- ** getSelectMultiple #method:getSelectMultiple#

#if ENABLE_OVERLOADING
    FileChooserRequestGetSelectMultipleMethodInfo,
#endif
    fileChooserRequestGetSelectMultiple     ,


-- ** getSelectedFiles #method:getSelectedFiles#

#if ENABLE_OVERLOADING
    FileChooserRequestGetSelectedFilesMethodInfo,
#endif
    fileChooserRequestGetSelectedFiles      ,


-- ** selectFiles #method:selectFiles#

#if ENABLE_OVERLOADING
    FileChooserRequestSelectFilesMethodInfo ,
#endif
    fileChooserRequestSelectFiles           ,




 -- * Properties
-- ** filter #attr:filter#
{- | The filter currently associated with the request. See
'GI.WebKit2.Objects.FileChooserRequest.fileChooserRequestGetMimeTypesFilter' for more
details.
-}
#if ENABLE_OVERLOADING
    FileChooserRequestFilterPropertyInfo    ,
#endif
#if ENABLE_OVERLOADING
    fileChooserRequestFilter                ,
#endif
    getFileChooserRequestFilter             ,


-- ** mimeTypes #attr:mimeTypes#
{- | A 'Nothing'-terminated array of strings containing the list of MIME
types the file chooser dialog should handle. See
'GI.WebKit2.Objects.FileChooserRequest.fileChooserRequestGetMimeTypes' for more details.
-}
#if ENABLE_OVERLOADING
    FileChooserRequestMimeTypesPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
    fileChooserRequestMimeTypes             ,
#endif
    getFileChooserRequestMimeTypes          ,


-- ** selectMultiple #attr:selectMultiple#
{- | Whether the file chooser should allow selecting multiple
files. See
'GI.WebKit2.Objects.FileChooserRequest.fileChooserRequestGetSelectMultiple' for
more details.
-}
#if ENABLE_OVERLOADING
    FileChooserRequestSelectMultiplePropertyInfo,
#endif
#if ENABLE_OVERLOADING
    fileChooserRequestSelectMultiple        ,
#endif
    getFileChooserRequestSelectMultiple     ,


-- ** selectedFiles #attr:selectedFiles#
{- | A 'Nothing'-terminated array of strings containing the list of
selected files associated to the current request. See
'GI.WebKit2.Objects.FileChooserRequest.fileChooserRequestGetSelectedFiles' for more details.
-}
#if ENABLE_OVERLOADING
    FileChooserRequestSelectedFilesPropertyInfo,
#endif
#if ENABLE_OVERLOADING
    fileChooserRequestSelectedFiles         ,
#endif
    getFileChooserRequestSelectedFiles      ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.FileFilter as Gtk.FileFilter

-- | Memory-managed wrapper type.
newtype FileChooserRequest = FileChooserRequest (ManagedPtr FileChooserRequest)
foreign import ccall "webkit_file_chooser_request_get_type"
    c_webkit_file_chooser_request_get_type :: IO GType

instance GObject FileChooserRequest where
    gobjectType = c_webkit_file_chooser_request_get_type


-- | Type class for types which can be safely cast to `FileChooserRequest`, for instance with `toFileChooserRequest`.
class (GObject o, O.IsDescendantOf FileChooserRequest o) => IsFileChooserRequest o
instance (GObject o, O.IsDescendantOf FileChooserRequest o) => IsFileChooserRequest o

instance O.HasParentTypes FileChooserRequest
type instance O.ParentTypes FileChooserRequest = '[GObject.Object.Object]

-- | Cast to `FileChooserRequest`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toFileChooserRequest :: (MonadIO m, IsFileChooserRequest o) => o -> m FileChooserRequest
toFileChooserRequest = liftIO . unsafeCastTo FileChooserRequest

-- | A convenience alias for `Nothing` :: `Maybe` `FileChooserRequest`.
noFileChooserRequest :: Maybe FileChooserRequest
noFileChooserRequest = Nothing

#if ENABLE_OVERLOADING
type family ResolveFileChooserRequestMethod (t :: Symbol) (o :: *) :: * where
    ResolveFileChooserRequestMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFileChooserRequestMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFileChooserRequestMethod "cancel" o = FileChooserRequestCancelMethodInfo
    ResolveFileChooserRequestMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFileChooserRequestMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFileChooserRequestMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFileChooserRequestMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFileChooserRequestMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFileChooserRequestMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFileChooserRequestMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFileChooserRequestMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFileChooserRequestMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFileChooserRequestMethod "selectFiles" o = FileChooserRequestSelectFilesMethodInfo
    ResolveFileChooserRequestMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFileChooserRequestMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFileChooserRequestMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFileChooserRequestMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFileChooserRequestMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFileChooserRequestMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFileChooserRequestMethod "getMimeTypes" o = FileChooserRequestGetMimeTypesMethodInfo
    ResolveFileChooserRequestMethod "getMimeTypesFilter" o = FileChooserRequestGetMimeTypesFilterMethodInfo
    ResolveFileChooserRequestMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFileChooserRequestMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFileChooserRequestMethod "getSelectMultiple" o = FileChooserRequestGetSelectMultipleMethodInfo
    ResolveFileChooserRequestMethod "getSelectedFiles" o = FileChooserRequestGetSelectedFilesMethodInfo
    ResolveFileChooserRequestMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFileChooserRequestMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFileChooserRequestMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveFileChooserRequestMethod t FileChooserRequest, O.MethodInfo info FileChooserRequest p) => OL.IsLabel t (FileChooserRequest -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- VVV Prop "filter"
   -- Type: TInterface (Name {namespace = "Gtk", name = "FileFilter"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@filter@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileChooserRequest #filter
@
-}
getFileChooserRequestFilter :: (MonadIO m, IsFileChooserRequest o) => o -> m (Maybe Gtk.FileFilter.FileFilter)
getFileChooserRequestFilter obj = liftIO $ B.Properties.getObjectPropertyObject obj "filter" Gtk.FileFilter.FileFilter

#if ENABLE_OVERLOADING
data FileChooserRequestFilterPropertyInfo
instance AttrInfo FileChooserRequestFilterPropertyInfo where
    type AttrAllowedOps FileChooserRequestFilterPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileChooserRequestFilterPropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileChooserRequestFilterPropertyInfo = IsFileChooserRequest
    type AttrGetType FileChooserRequestFilterPropertyInfo = (Maybe Gtk.FileFilter.FileFilter)
    type AttrLabel FileChooserRequestFilterPropertyInfo = "filter"
    type AttrOrigin FileChooserRequestFilterPropertyInfo = FileChooserRequest
    attrGet _ = getFileChooserRequestFilter
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "mime-types"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@mime-types@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileChooserRequest #mimeTypes
@
-}
getFileChooserRequestMimeTypes :: (MonadIO m, IsFileChooserRequest o) => o -> m [T.Text]
getFileChooserRequestMimeTypes obj = liftIO $ checkUnexpectedNothing "getFileChooserRequestMimeTypes" $ B.Properties.getObjectPropertyStringArray obj "mime-types"

#if ENABLE_OVERLOADING
data FileChooserRequestMimeTypesPropertyInfo
instance AttrInfo FileChooserRequestMimeTypesPropertyInfo where
    type AttrAllowedOps FileChooserRequestMimeTypesPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileChooserRequestMimeTypesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileChooserRequestMimeTypesPropertyInfo = IsFileChooserRequest
    type AttrGetType FileChooserRequestMimeTypesPropertyInfo = [T.Text]
    type AttrLabel FileChooserRequestMimeTypesPropertyInfo = "mime-types"
    type AttrOrigin FileChooserRequestMimeTypesPropertyInfo = FileChooserRequest
    attrGet _ = getFileChooserRequestMimeTypes
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "select-multiple"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@select-multiple@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileChooserRequest #selectMultiple
@
-}
getFileChooserRequestSelectMultiple :: (MonadIO m, IsFileChooserRequest o) => o -> m Bool
getFileChooserRequestSelectMultiple obj = liftIO $ B.Properties.getObjectPropertyBool obj "select-multiple"

#if ENABLE_OVERLOADING
data FileChooserRequestSelectMultiplePropertyInfo
instance AttrInfo FileChooserRequestSelectMultiplePropertyInfo where
    type AttrAllowedOps FileChooserRequestSelectMultiplePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint FileChooserRequestSelectMultiplePropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileChooserRequestSelectMultiplePropertyInfo = IsFileChooserRequest
    type AttrGetType FileChooserRequestSelectMultiplePropertyInfo = Bool
    type AttrLabel FileChooserRequestSelectMultiplePropertyInfo = "select-multiple"
    type AttrOrigin FileChooserRequestSelectMultiplePropertyInfo = FileChooserRequest
    attrGet _ = getFileChooserRequestSelectMultiple
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "selected-files"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Nothing)

{- |
Get the value of the “@selected-files@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileChooserRequest #selectedFiles
@
-}
getFileChooserRequestSelectedFiles :: (MonadIO m, IsFileChooserRequest o) => o -> m (Maybe [T.Text])
getFileChooserRequestSelectedFiles obj = liftIO $ B.Properties.getObjectPropertyStringArray obj "selected-files"

#if ENABLE_OVERLOADING
data FileChooserRequestSelectedFilesPropertyInfo
instance AttrInfo FileChooserRequestSelectedFilesPropertyInfo where
    type AttrAllowedOps FileChooserRequestSelectedFilesPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileChooserRequestSelectedFilesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileChooserRequestSelectedFilesPropertyInfo = IsFileChooserRequest
    type AttrGetType FileChooserRequestSelectedFilesPropertyInfo = (Maybe [T.Text])
    type AttrLabel FileChooserRequestSelectedFilesPropertyInfo = "selected-files"
    type AttrOrigin FileChooserRequestSelectedFilesPropertyInfo = FileChooserRequest
    attrGet _ = getFileChooserRequestSelectedFiles
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList FileChooserRequest
type instance O.AttributeList FileChooserRequest = FileChooserRequestAttributeList
type FileChooserRequestAttributeList = ('[ '("filter", FileChooserRequestFilterPropertyInfo), '("mimeTypes", FileChooserRequestMimeTypesPropertyInfo), '("selectMultiple", FileChooserRequestSelectMultiplePropertyInfo), '("selectedFiles", FileChooserRequestSelectedFilesPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
fileChooserRequestFilter :: AttrLabelProxy "filter"
fileChooserRequestFilter = AttrLabelProxy

fileChooserRequestMimeTypes :: AttrLabelProxy "mimeTypes"
fileChooserRequestMimeTypes = AttrLabelProxy

fileChooserRequestSelectMultiple :: AttrLabelProxy "selectMultiple"
fileChooserRequestSelectMultiple = AttrLabelProxy

fileChooserRequestSelectedFiles :: AttrLabelProxy "selectedFiles"
fileChooserRequestSelectedFiles = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList FileChooserRequest = FileChooserRequestSignalList
type FileChooserRequestSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method FileChooserRequest::cancel
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_cancel" webkit_file_chooser_request_cancel ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    IO ()

{- |
Ask WebKit to cancel the request. It\'s important to do this in case
no selection has been made in the client, otherwise the request
won\'t be properly completed and the browser will keep the request
pending forever, which might cause the browser to hang.
-}
fileChooserRequestCancel ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> m ()
fileChooserRequestCancel request = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    webkit_file_chooser_request_cancel request'
    touchManagedPtr request
    return ()

#if ENABLE_OVERLOADING
data FileChooserRequestCancelMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestCancelMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestCancel

#endif

-- method FileChooserRequest::get_mime_types
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_get_mime_types" webkit_file_chooser_request_get_mime_types ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    IO (Ptr CString)

{- |
Get the list of MIME types the file chooser dialog should handle,
in the format specified in RFC 2046 for \"media types\". Its contents
depend on the value of the \'accept\' attribute for HTML input
elements. This function should normally be called before presenting
the file chooser dialog to the user, to decide whether to allow the
user to select multiple files at once or only one.
-}
fileChooserRequestGetMimeTypes ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> m [T.Text]
    {- ^ __Returns:__ a
'Nothing'-terminated array of strings if a list of accepted MIME types
is defined or 'Nothing' otherwise, meaning that any MIME type should be
accepted. This array and its contents are owned by WebKit and
should not be modified or freed. -}
fileChooserRequestGetMimeTypes request = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    result <- webkit_file_chooser_request_get_mime_types request'
    checkUnexpectedReturnNULL "fileChooserRequestGetMimeTypes" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr request
    return result'

#if ENABLE_OVERLOADING
data FileChooserRequestGetMimeTypesMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestGetMimeTypesMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestGetMimeTypes

#endif

-- method FileChooserRequest::get_mime_types_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "FileFilter"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_get_mime_types_filter" webkit_file_chooser_request_get_mime_types_filter ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    IO (Ptr Gtk.FileFilter.FileFilter)

{- |
Get the filter currently associated with the request, ready to be
used by 'GI.Gtk.Interfaces.FileChooser.FileChooser'. This function should normally be called
before presenting the file chooser dialog to the user, to decide
whether to apply a filter so the user would not be allowed to
select files with other MIME types.

See 'GI.WebKit2.Objects.FileChooserRequest.fileChooserRequestGetMimeTypes' if you are
interested in getting the list of accepted MIME types.
-}
fileChooserRequestGetMimeTypesFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> m (Maybe Gtk.FileFilter.FileFilter)
    {- ^ __Returns:__ a 'GI.Gtk.Objects.FileFilter.FileFilter' if a list of accepted
MIME types is defined or 'Nothing' otherwise. The returned object is
owned by WebKit should not be modified or freed. -}
fileChooserRequestGetMimeTypesFilter request = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    result <- webkit_file_chooser_request_get_mime_types_filter request'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gtk.FileFilter.FileFilter) result'
        return result''
    touchManagedPtr request
    return maybeResult

#if ENABLE_OVERLOADING
data FileChooserRequestGetMimeTypesFilterMethodInfo
instance (signature ~ (m (Maybe Gtk.FileFilter.FileFilter)), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestGetMimeTypesFilterMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestGetMimeTypesFilter

#endif

-- method FileChooserRequest::get_select_multiple
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_get_select_multiple" webkit_file_chooser_request_get_select_multiple ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    IO CInt

{- |
Determine whether the file chooser associated to this
'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' should allow selecting multiple files,
which depends on the HTML input element having a \'multiple\'
attribute defined.
-}
fileChooserRequestGetSelectMultiple ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the file chooser should allow selecting multiple files or 'False' otherwise. -}
fileChooserRequestGetSelectMultiple request = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    result <- webkit_file_chooser_request_get_select_multiple request'
    let result' = (/= 0) result
    touchManagedPtr request
    return result'

#if ENABLE_OVERLOADING
data FileChooserRequestGetSelectMultipleMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestGetSelectMultipleMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestGetSelectMultiple

#endif

-- method FileChooserRequest::get_selected_files
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_get_selected_files" webkit_file_chooser_request_get_selected_files ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    IO (Ptr CString)

{- |
Get the list of selected files currently associated to the
request. Initially, the return value of this method contains any
files selected in previous file chooser requests for this HTML
input element. Once webkit_file_chooser_request_select_files, the
value will reflect whatever files are given.

This function should normally be called only before presenting the
file chooser dialog to the user, to decide whether to perform some
extra action, like pre-selecting the files from a previous request.
-}
fileChooserRequestGetSelectedFiles ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> m (Maybe [T.Text])
    {- ^ __Returns:__ a
'Nothing'-terminated array of strings if there are selected files
associated with the request or 'Nothing' otherwise. This array and its
contents are owned by WebKit and should not be modified or
freed. -}
fileChooserRequestGetSelectedFiles request = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    result <- webkit_file_chooser_request_get_selected_files request'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackZeroTerminatedUTF8CArray result'
        return result''
    touchManagedPtr request
    return maybeResult

#if ENABLE_OVERLOADING
data FileChooserRequestGetSelectedFilesMethodInfo
instance (signature ~ (m (Maybe [T.Text])), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestGetSelectedFilesMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestGetSelectedFiles

#endif

-- method FileChooserRequest::select_files
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "request", argType = TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitFileChooserRequest", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "files", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a\n%NULL-terminated array of strings, containing paths to local files.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_file_chooser_request_select_files" webkit_file_chooser_request_select_files ::
    Ptr FileChooserRequest ->               -- request : TInterface (Name {namespace = "WebKit2", name = "FileChooserRequest"})
    Ptr CString ->                          -- files : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO ()

{- |
Ask WebKit to select local files for upload and complete the
request.
-}
fileChooserRequestSelectFiles ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileChooserRequest a) =>
    a
    {- ^ /@request@/: a 'GI.WebKit2.Objects.FileChooserRequest.FileChooserRequest' -}
    -> [T.Text]
    {- ^ /@files@/: a
'Nothing'-terminated array of strings, containing paths to local files. -}
    -> m ()
fileChooserRequestSelectFiles request files = liftIO $ do
    request' <- unsafeManagedPtrCastPtr request
    files' <- packZeroTerminatedUTF8CArray files
    webkit_file_chooser_request_select_files request' files'
    touchManagedPtr request
    mapZeroTerminatedCArray freeMem files'
    freeMem files'
    return ()

#if ENABLE_OVERLOADING
data FileChooserRequestSelectFilesMethodInfo
instance (signature ~ ([T.Text] -> m ()), MonadIO m, IsFileChooserRequest a) => O.MethodInfo FileChooserRequestSelectFilesMethodInfo a signature where
    overloadedMethod _ = fileChooserRequestSelectFiles

#endif