gi-gtk-3.0.28: GI/Gtk/Structs/RecentFilterInfo.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
A GtkRecentFilterInfo struct is used
to pass information about the tested file to 'GI.Gtk.Objects.RecentFilter.recentFilterFilter'.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.RecentFilterInfo
(
-- * Exported types
RecentFilterInfo(..) ,
newZeroRecentFilterInfo ,
noRecentFilterInfo ,
-- * Properties
-- ** age #attr:age#
{- | The number of days elapsed since the file has been
registered.
-}
getRecentFilterInfoAge ,
#if ENABLE_OVERLOADING
recentFilterInfo_age ,
#endif
setRecentFilterInfoAge ,
-- ** applications #attr:applications#
{- | The list of
applications that have registered the file.
-}
clearRecentFilterInfoApplications ,
getRecentFilterInfoApplications ,
#if ENABLE_OVERLOADING
recentFilterInfo_applications ,
#endif
setRecentFilterInfoApplications ,
-- ** contains #attr:contains#
{- | 'GI.Gtk.Flags.RecentFilterFlags' to indicate which fields are set.
-}
getRecentFilterInfoContains ,
#if ENABLE_OVERLOADING
recentFilterInfo_contains ,
#endif
setRecentFilterInfoContains ,
-- ** displayName #attr:displayName#
{- | The string that will be used to display
the file in the recent chooser.
-}
clearRecentFilterInfoDisplayName ,
getRecentFilterInfoDisplayName ,
#if ENABLE_OVERLOADING
recentFilterInfo_displayName ,
#endif
setRecentFilterInfoDisplayName ,
-- ** groups #attr:groups#
{- | The groups to which
the file belongs to.
-}
clearRecentFilterInfoGroups ,
getRecentFilterInfoGroups ,
#if ENABLE_OVERLOADING
recentFilterInfo_groups ,
#endif
setRecentFilterInfoGroups ,
-- ** mimeType #attr:mimeType#
{- | MIME type of the file.
-}
clearRecentFilterInfoMimeType ,
getRecentFilterInfoMimeType ,
#if ENABLE_OVERLOADING
recentFilterInfo_mimeType ,
#endif
setRecentFilterInfoMimeType ,
-- ** uri #attr:uri#
{- | The URI of the file being tested.
-}
clearRecentFilterInfoUri ,
getRecentFilterInfoUri ,
#if ENABLE_OVERLOADING
recentFilterInfo_uri ,
#endif
setRecentFilterInfoUri ,
) 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 {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
-- | Memory-managed wrapper type.
newtype RecentFilterInfo = RecentFilterInfo (ManagedPtr RecentFilterInfo)
instance WrappedPtr RecentFilterInfo where
wrappedPtrCalloc = callocBytes 56
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 56 >=> wrapPtr RecentFilterInfo)
wrappedPtrFree = Just ptr_to_g_free
-- | Construct a `RecentFilterInfo` struct initialized to zero.
newZeroRecentFilterInfo :: MonadIO m => m RecentFilterInfo
newZeroRecentFilterInfo = liftIO $ wrappedPtrCalloc >>= wrapPtr RecentFilterInfo
instance tag ~ 'AttrSet => Constructible RecentFilterInfo tag where
new _ attrs = do
o <- newZeroRecentFilterInfo
GI.Attributes.set o attrs
return o
-- | A convenience alias for `Nothing` :: `Maybe` `RecentFilterInfo`.
noRecentFilterInfo :: Maybe RecentFilterInfo
noRecentFilterInfo = Nothing
{- |
Get the value of the “@contains@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #contains
@
-}
getRecentFilterInfoContains :: MonadIO m => RecentFilterInfo -> m [Gtk.Flags.RecentFilterFlags]
getRecentFilterInfoContains s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = wordToGFlags val
return val'
{- |
Set the value of the “@contains@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #contains 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoContains :: MonadIO m => RecentFilterInfo -> [Gtk.Flags.RecentFilterFlags] -> m ()
setRecentFilterInfoContains s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gflagsToWord val
poke (ptr `plusPtr` 0) (val' :: CUInt)
#if ENABLE_OVERLOADING
data RecentFilterInfoContainsFieldInfo
instance AttrInfo RecentFilterInfoContainsFieldInfo where
type AttrAllowedOps RecentFilterInfoContainsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RecentFilterInfoContainsFieldInfo = (~) [Gtk.Flags.RecentFilterFlags]
type AttrBaseTypeConstraint RecentFilterInfoContainsFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoContainsFieldInfo = [Gtk.Flags.RecentFilterFlags]
type AttrLabel RecentFilterInfoContainsFieldInfo = "contains"
type AttrOrigin RecentFilterInfoContainsFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoContains
attrSet _ = setRecentFilterInfoContains
attrConstruct = undefined
attrClear _ = undefined
recentFilterInfo_contains :: AttrLabelProxy "contains"
recentFilterInfo_contains = AttrLabelProxy
#endif
{- |
Get the value of the “@uri@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #uri
@
-}
getRecentFilterInfoUri :: MonadIO m => RecentFilterInfo -> m (Maybe T.Text)
getRecentFilterInfoUri s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
{- |
Set the value of the “@uri@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #uri 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoUri :: MonadIO m => RecentFilterInfo -> CString -> m ()
setRecentFilterInfoUri s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
{- |
Set the value of the “@uri@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #uri
@
-}
clearRecentFilterInfoUri :: MonadIO m => RecentFilterInfo -> m ()
clearRecentFilterInfoUri s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data RecentFilterInfoUriFieldInfo
instance AttrInfo RecentFilterInfoUriFieldInfo where
type AttrAllowedOps RecentFilterInfoUriFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RecentFilterInfoUriFieldInfo = (~) CString
type AttrBaseTypeConstraint RecentFilterInfoUriFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoUriFieldInfo = Maybe T.Text
type AttrLabel RecentFilterInfoUriFieldInfo = "uri"
type AttrOrigin RecentFilterInfoUriFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoUri
attrSet _ = setRecentFilterInfoUri
attrConstruct = undefined
attrClear _ = clearRecentFilterInfoUri
recentFilterInfo_uri :: AttrLabelProxy "uri"
recentFilterInfo_uri = AttrLabelProxy
#endif
{- |
Get the value of the “@display_name@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #displayName
@
-}
getRecentFilterInfoDisplayName :: MonadIO m => RecentFilterInfo -> m (Maybe T.Text)
getRecentFilterInfoDisplayName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
{- |
Set the value of the “@display_name@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #displayName 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoDisplayName :: MonadIO m => RecentFilterInfo -> CString -> m ()
setRecentFilterInfoDisplayName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: CString)
{- |
Set the value of the “@display_name@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #displayName
@
-}
clearRecentFilterInfoDisplayName :: MonadIO m => RecentFilterInfo -> m ()
clearRecentFilterInfoDisplayName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data RecentFilterInfoDisplayNameFieldInfo
instance AttrInfo RecentFilterInfoDisplayNameFieldInfo where
type AttrAllowedOps RecentFilterInfoDisplayNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RecentFilterInfoDisplayNameFieldInfo = (~) CString
type AttrBaseTypeConstraint RecentFilterInfoDisplayNameFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoDisplayNameFieldInfo = Maybe T.Text
type AttrLabel RecentFilterInfoDisplayNameFieldInfo = "display_name"
type AttrOrigin RecentFilterInfoDisplayNameFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoDisplayName
attrSet _ = setRecentFilterInfoDisplayName
attrConstruct = undefined
attrClear _ = clearRecentFilterInfoDisplayName
recentFilterInfo_displayName :: AttrLabelProxy "displayName"
recentFilterInfo_displayName = AttrLabelProxy
#endif
{- |
Get the value of the “@mime_type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #mimeType
@
-}
getRecentFilterInfoMimeType :: MonadIO m => RecentFilterInfo -> m (Maybe T.Text)
getRecentFilterInfoMimeType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
{- |
Set the value of the “@mime_type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #mimeType 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoMimeType :: MonadIO m => RecentFilterInfo -> CString -> m ()
setRecentFilterInfoMimeType s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: CString)
{- |
Set the value of the “@mime_type@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #mimeType
@
-}
clearRecentFilterInfoMimeType :: MonadIO m => RecentFilterInfo -> m ()
clearRecentFilterInfoMimeType s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data RecentFilterInfoMimeTypeFieldInfo
instance AttrInfo RecentFilterInfoMimeTypeFieldInfo where
type AttrAllowedOps RecentFilterInfoMimeTypeFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RecentFilterInfoMimeTypeFieldInfo = (~) CString
type AttrBaseTypeConstraint RecentFilterInfoMimeTypeFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoMimeTypeFieldInfo = Maybe T.Text
type AttrLabel RecentFilterInfoMimeTypeFieldInfo = "mime_type"
type AttrOrigin RecentFilterInfoMimeTypeFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoMimeType
attrSet _ = setRecentFilterInfoMimeType
attrConstruct = undefined
attrClear _ = clearRecentFilterInfoMimeType
recentFilterInfo_mimeType :: AttrLabelProxy "mimeType"
recentFilterInfo_mimeType = AttrLabelProxy
#endif
{- |
Get the value of the “@applications@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #applications
@
-}
getRecentFilterInfoApplications :: MonadIO m => RecentFilterInfo -> m (Maybe [T.Text])
getRecentFilterInfoApplications s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO (Ptr CString)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- unpackZeroTerminatedUTF8CArray val'
return val''
return result
{- |
Set the value of the “@applications@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #applications 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoApplications :: MonadIO m => RecentFilterInfo -> Ptr CString -> m ()
setRecentFilterInfoApplications s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (val :: Ptr CString)
{- |
Set the value of the “@applications@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #applications
@
-}
clearRecentFilterInfoApplications :: MonadIO m => RecentFilterInfo -> m ()
clearRecentFilterInfoApplications s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (FP.nullPtr :: Ptr CString)
#if ENABLE_OVERLOADING
data RecentFilterInfoApplicationsFieldInfo
instance AttrInfo RecentFilterInfoApplicationsFieldInfo where
type AttrAllowedOps RecentFilterInfoApplicationsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RecentFilterInfoApplicationsFieldInfo = (~) (Ptr CString)
type AttrBaseTypeConstraint RecentFilterInfoApplicationsFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoApplicationsFieldInfo = Maybe [T.Text]
type AttrLabel RecentFilterInfoApplicationsFieldInfo = "applications"
type AttrOrigin RecentFilterInfoApplicationsFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoApplications
attrSet _ = setRecentFilterInfoApplications
attrConstruct = undefined
attrClear _ = clearRecentFilterInfoApplications
recentFilterInfo_applications :: AttrLabelProxy "applications"
recentFilterInfo_applications = AttrLabelProxy
#endif
{- |
Get the value of the “@groups@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #groups
@
-}
getRecentFilterInfoGroups :: MonadIO m => RecentFilterInfo -> m (Maybe [T.Text])
getRecentFilterInfoGroups s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 40) :: IO (Ptr CString)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- unpackZeroTerminatedUTF8CArray val'
return val''
return result
{- |
Set the value of the “@groups@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #groups 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoGroups :: MonadIO m => RecentFilterInfo -> Ptr CString -> m ()
setRecentFilterInfoGroups s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 40) (val :: Ptr CString)
{- |
Set the value of the “@groups@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #groups
@
-}
clearRecentFilterInfoGroups :: MonadIO m => RecentFilterInfo -> m ()
clearRecentFilterInfoGroups s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 40) (FP.nullPtr :: Ptr CString)
#if ENABLE_OVERLOADING
data RecentFilterInfoGroupsFieldInfo
instance AttrInfo RecentFilterInfoGroupsFieldInfo where
type AttrAllowedOps RecentFilterInfoGroupsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RecentFilterInfoGroupsFieldInfo = (~) (Ptr CString)
type AttrBaseTypeConstraint RecentFilterInfoGroupsFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoGroupsFieldInfo = Maybe [T.Text]
type AttrLabel RecentFilterInfoGroupsFieldInfo = "groups"
type AttrOrigin RecentFilterInfoGroupsFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoGroups
attrSet _ = setRecentFilterInfoGroups
attrConstruct = undefined
attrClear _ = clearRecentFilterInfoGroups
recentFilterInfo_groups :: AttrLabelProxy "groups"
recentFilterInfo_groups = AttrLabelProxy
#endif
{- |
Get the value of the “@age@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' recentFilterInfo #age
@
-}
getRecentFilterInfoAge :: MonadIO m => RecentFilterInfo -> m Int32
getRecentFilterInfoAge s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 48) :: IO Int32
return val
{- |
Set the value of the “@age@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' recentFilterInfo [ #age 'Data.GI.Base.Attributes.:=' value ]
@
-}
setRecentFilterInfoAge :: MonadIO m => RecentFilterInfo -> Int32 -> m ()
setRecentFilterInfoAge s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 48) (val :: Int32)
#if ENABLE_OVERLOADING
data RecentFilterInfoAgeFieldInfo
instance AttrInfo RecentFilterInfoAgeFieldInfo where
type AttrAllowedOps RecentFilterInfoAgeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RecentFilterInfoAgeFieldInfo = (~) Int32
type AttrBaseTypeConstraint RecentFilterInfoAgeFieldInfo = (~) RecentFilterInfo
type AttrGetType RecentFilterInfoAgeFieldInfo = Int32
type AttrLabel RecentFilterInfoAgeFieldInfo = "age"
type AttrOrigin RecentFilterInfoAgeFieldInfo = RecentFilterInfo
attrGet _ = getRecentFilterInfoAge
attrSet _ = setRecentFilterInfoAge
attrConstruct = undefined
attrClear _ = undefined
recentFilterInfo_age :: AttrLabelProxy "age"
recentFilterInfo_age = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList RecentFilterInfo
type instance O.AttributeList RecentFilterInfo = RecentFilterInfoAttributeList
type RecentFilterInfoAttributeList = ('[ '("contains", RecentFilterInfoContainsFieldInfo), '("uri", RecentFilterInfoUriFieldInfo), '("displayName", RecentFilterInfoDisplayNameFieldInfo), '("mimeType", RecentFilterInfoMimeTypeFieldInfo), '("applications", RecentFilterInfoApplicationsFieldInfo), '("groups", RecentFilterInfoGroupsFieldInfo), '("age", RecentFilterInfoAgeFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveRecentFilterInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveRecentFilterInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRecentFilterInfoMethod t RecentFilterInfo, O.MethodInfo info RecentFilterInfo p) => OL.IsLabel t (RecentFilterInfo -> 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