module GI.WebKit2.Objects.FileChooserRequest
(
FileChooserRequest(..) ,
FileChooserRequestK ,
toFileChooserRequest ,
noFileChooserRequest ,
fileChooserRequestCancel ,
fileChooserRequestGetMimeTypes ,
fileChooserRequestGetMimeTypesFilter ,
fileChooserRequestGetSelectMultiple ,
fileChooserRequestGetSelectedFiles ,
fileChooserRequestSelectFiles ,
FileChooserRequestFilterPropertyInfo ,
getFileChooserRequestFilter ,
FileChooserRequestMimeTypesPropertyInfo ,
getFileChooserRequestMimeTypes ,
FileChooserRequestSelectMultiplePropertyInfo,
getFileChooserRequestSelectMultiple ,
FileChooserRequestSelectedFilesPropertyInfo,
getFileChooserRequestSelectedFiles ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Gtk as Gtk
newtype FileChooserRequest = FileChooserRequest (ForeignPtr FileChooserRequest)
foreign import ccall "webkit_file_chooser_request_get_type"
c_webkit_file_chooser_request_get_type :: IO GType
type instance ParentTypes FileChooserRequest = FileChooserRequestParentTypes
type FileChooserRequestParentTypes = '[GObject.Object]
instance GObject FileChooserRequest where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_file_chooser_request_get_type
class GObject o => FileChooserRequestK o
instance (GObject o, IsDescendantOf FileChooserRequest o) => FileChooserRequestK o
toFileChooserRequest :: FileChooserRequestK o => o -> IO FileChooserRequest
toFileChooserRequest = unsafeCastTo FileChooserRequest
noFileChooserRequest :: Maybe FileChooserRequest
noFileChooserRequest = Nothing
getFileChooserRequestFilter :: (MonadIO m, FileChooserRequestK o) => o -> m Gtk.FileFilter
getFileChooserRequestFilter obj = liftIO $ getObjectPropertyObject obj "filter" Gtk.FileFilter
data FileChooserRequestFilterPropertyInfo
instance AttrInfo FileChooserRequestFilterPropertyInfo where
type AttrAllowedOps FileChooserRequestFilterPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileChooserRequestFilterPropertyInfo = (~) ()
type AttrBaseTypeConstraint FileChooserRequestFilterPropertyInfo = FileChooserRequestK
type AttrGetType FileChooserRequestFilterPropertyInfo = Gtk.FileFilter
type AttrLabel FileChooserRequestFilterPropertyInfo = "FileChooserRequest::filter"
attrGet _ = getFileChooserRequestFilter
attrSet _ = undefined
attrConstruct _ = undefined
getFileChooserRequestMimeTypes :: (MonadIO m, FileChooserRequestK o) => o -> m [T.Text]
getFileChooserRequestMimeTypes obj = liftIO $ getObjectPropertyStringArray obj "mime-types"
data FileChooserRequestMimeTypesPropertyInfo
instance AttrInfo FileChooserRequestMimeTypesPropertyInfo where
type AttrAllowedOps FileChooserRequestMimeTypesPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileChooserRequestMimeTypesPropertyInfo = (~) ()
type AttrBaseTypeConstraint FileChooserRequestMimeTypesPropertyInfo = FileChooserRequestK
type AttrGetType FileChooserRequestMimeTypesPropertyInfo = [T.Text]
type AttrLabel FileChooserRequestMimeTypesPropertyInfo = "FileChooserRequest::mime-types"
attrGet _ = getFileChooserRequestMimeTypes
attrSet _ = undefined
attrConstruct _ = undefined
getFileChooserRequestSelectMultiple :: (MonadIO m, FileChooserRequestK o) => o -> m Bool
getFileChooserRequestSelectMultiple obj = liftIO $ getObjectPropertyBool obj "select-multiple"
data FileChooserRequestSelectMultiplePropertyInfo
instance AttrInfo FileChooserRequestSelectMultiplePropertyInfo where
type AttrAllowedOps FileChooserRequestSelectMultiplePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileChooserRequestSelectMultiplePropertyInfo = (~) ()
type AttrBaseTypeConstraint FileChooserRequestSelectMultiplePropertyInfo = FileChooserRequestK
type AttrGetType FileChooserRequestSelectMultiplePropertyInfo = Bool
type AttrLabel FileChooserRequestSelectMultiplePropertyInfo = "FileChooserRequest::select-multiple"
attrGet _ = getFileChooserRequestSelectMultiple
attrSet _ = undefined
attrConstruct _ = undefined
getFileChooserRequestSelectedFiles :: (MonadIO m, FileChooserRequestK o) => o -> m [T.Text]
getFileChooserRequestSelectedFiles obj = liftIO $ getObjectPropertyStringArray obj "selected-files"
data FileChooserRequestSelectedFilesPropertyInfo
instance AttrInfo FileChooserRequestSelectedFilesPropertyInfo where
type AttrAllowedOps FileChooserRequestSelectedFilesPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileChooserRequestSelectedFilesPropertyInfo = (~) ()
type AttrBaseTypeConstraint FileChooserRequestSelectedFilesPropertyInfo = FileChooserRequestK
type AttrGetType FileChooserRequestSelectedFilesPropertyInfo = [T.Text]
type AttrLabel FileChooserRequestSelectedFilesPropertyInfo = "FileChooserRequest::selected-files"
attrGet _ = getFileChooserRequestSelectedFiles
attrSet _ = undefined
attrConstruct _ = undefined
type instance AttributeList FileChooserRequest = FileChooserRequestAttributeList
type FileChooserRequestAttributeList = ('[ '("filter", FileChooserRequestFilterPropertyInfo), '("mime-types", FileChooserRequestMimeTypesPropertyInfo), '("select-multiple", FileChooserRequestSelectMultiplePropertyInfo), '("selected-files", FileChooserRequestSelectedFilesPropertyInfo)] :: [(Symbol, *)])
type instance SignalList FileChooserRequest = FileChooserRequestSignalList
type FileChooserRequestSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_file_chooser_request_cancel" webkit_file_chooser_request_cancel ::
Ptr FileChooserRequest ->
IO ()
fileChooserRequestCancel ::
(MonadIO m, FileChooserRequestK a) =>
a ->
m ()
fileChooserRequestCancel _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
webkit_file_chooser_request_cancel _obj'
touchManagedPtr _obj
return ()
foreign import ccall "webkit_file_chooser_request_get_mime_types" webkit_file_chooser_request_get_mime_types ::
Ptr FileChooserRequest ->
IO (Ptr CString)
fileChooserRequestGetMimeTypes ::
(MonadIO m, FileChooserRequestK a) =>
a ->
m [T.Text]
fileChooserRequestGetMimeTypes _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_file_chooser_request_get_mime_types _obj'
checkUnexpectedReturnNULL "webkit_file_chooser_request_get_mime_types" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_file_chooser_request_get_mime_types_filter" webkit_file_chooser_request_get_mime_types_filter ::
Ptr FileChooserRequest ->
IO (Ptr Gtk.FileFilter)
fileChooserRequestGetMimeTypesFilter ::
(MonadIO m, FileChooserRequestK a) =>
a ->
m Gtk.FileFilter
fileChooserRequestGetMimeTypesFilter _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_file_chooser_request_get_mime_types_filter _obj'
checkUnexpectedReturnNULL "webkit_file_chooser_request_get_mime_types_filter" result
result' <- (newObject Gtk.FileFilter) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_file_chooser_request_get_select_multiple" webkit_file_chooser_request_get_select_multiple ::
Ptr FileChooserRequest ->
IO CInt
fileChooserRequestGetSelectMultiple ::
(MonadIO m, FileChooserRequestK a) =>
a ->
m Bool
fileChooserRequestGetSelectMultiple _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_file_chooser_request_get_select_multiple _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_file_chooser_request_get_selected_files" webkit_file_chooser_request_get_selected_files ::
Ptr FileChooserRequest ->
IO (Ptr CString)
fileChooserRequestGetSelectedFiles ::
(MonadIO m, FileChooserRequestK a) =>
a ->
m [T.Text]
fileChooserRequestGetSelectedFiles _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_file_chooser_request_get_selected_files _obj'
checkUnexpectedReturnNULL "webkit_file_chooser_request_get_selected_files" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_file_chooser_request_select_files" webkit_file_chooser_request_select_files ::
Ptr FileChooserRequest ->
Ptr CString ->
IO ()
fileChooserRequestSelectFiles ::
(MonadIO m, FileChooserRequestK a) =>
a ->
[T.Text] ->
m ()
fileChooserRequestSelectFiles _obj files = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
files' <- packZeroTerminatedUTF8CArray files
webkit_file_chooser_request_select_files _obj' files'
touchManagedPtr _obj
mapZeroTerminatedCArray freeMem files'
freeMem files'
return ()