gi-ostree-1.0.8: GI/OSTree/Objects/RepoFinderMount.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)
/No description available in the introspection data./
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.OSTree.Objects.RepoFinderMount
(
-- * Exported types
RepoFinderMount(..) ,
IsRepoFinderMount ,
toRepoFinderMount ,
noRepoFinderMount ,
-- * Methods
-- ** new #method:new#
repoFinderMountNew ,
-- * Properties
-- ** monitor #attr:monitor#
{- | Volume monitor to use to look up mounted volumes when queried.
/Since: 2018.6/
-}
#if ENABLE_OVERLOADING
RepoFinderMountMonitorPropertyInfo ,
#endif
constructRepoFinderMountMonitor ,
getRepoFinderMountMonitor ,
#if ENABLE_OVERLOADING
repoFinderMountMonitor ,
#endif
) 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.Gio.Objects.VolumeMonitor as Gio.VolumeMonitor
import {-# SOURCE #-} qualified GI.OSTree.Interfaces.RepoFinder as OSTree.RepoFinder
-- | Memory-managed wrapper type.
newtype RepoFinderMount = RepoFinderMount (ManagedPtr RepoFinderMount)
foreign import ccall "ostree_repo_finder_mount_get_type"
c_ostree_repo_finder_mount_get_type :: IO GType
instance GObject RepoFinderMount where
gobjectType = c_ostree_repo_finder_mount_get_type
-- | Type class for types which can be safely cast to `RepoFinderMount`, for instance with `toRepoFinderMount`.
class (GObject o, O.IsDescendantOf RepoFinderMount o) => IsRepoFinderMount o
instance (GObject o, O.IsDescendantOf RepoFinderMount o) => IsRepoFinderMount o
instance O.HasParentTypes RepoFinderMount
type instance O.ParentTypes RepoFinderMount = '[GObject.Object.Object, OSTree.RepoFinder.RepoFinder]
-- | Cast to `RepoFinderMount`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toRepoFinderMount :: (MonadIO m, IsRepoFinderMount o) => o -> m RepoFinderMount
toRepoFinderMount = liftIO . unsafeCastTo RepoFinderMount
-- | A convenience alias for `Nothing` :: `Maybe` `RepoFinderMount`.
noRepoFinderMount :: Maybe RepoFinderMount
noRepoFinderMount = Nothing
#if ENABLE_OVERLOADING
type family ResolveRepoFinderMountMethod (t :: Symbol) (o :: *) :: * where
ResolveRepoFinderMountMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveRepoFinderMountMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveRepoFinderMountMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveRepoFinderMountMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveRepoFinderMountMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveRepoFinderMountMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveRepoFinderMountMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveRepoFinderMountMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveRepoFinderMountMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveRepoFinderMountMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveRepoFinderMountMethod "resolveAsync" o = OSTree.RepoFinder.RepoFinderResolveAsyncMethodInfo
ResolveRepoFinderMountMethod "resolveFinish" o = OSTree.RepoFinder.RepoFinderResolveFinishMethodInfo
ResolveRepoFinderMountMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveRepoFinderMountMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveRepoFinderMountMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveRepoFinderMountMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveRepoFinderMountMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveRepoFinderMountMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveRepoFinderMountMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveRepoFinderMountMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveRepoFinderMountMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveRepoFinderMountMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveRepoFinderMountMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveRepoFinderMountMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRepoFinderMountMethod t RepoFinderMount, O.MethodInfo info RepoFinderMount p) => OL.IsLabel t (RepoFinderMount -> 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 "monitor"
-- Type: TInterface (Name {namespace = "Gio", name = "VolumeMonitor"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@monitor@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' repoFinderMount #monitor
@
-}
getRepoFinderMountMonitor :: (MonadIO m, IsRepoFinderMount o) => o -> m (Maybe Gio.VolumeMonitor.VolumeMonitor)
getRepoFinderMountMonitor obj = liftIO $ B.Properties.getObjectPropertyObject obj "monitor" Gio.VolumeMonitor.VolumeMonitor
{- |
Construct a `GValueConstruct` with valid value for the “@monitor@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructRepoFinderMountMonitor :: (IsRepoFinderMount o, Gio.VolumeMonitor.IsVolumeMonitor a) => a -> IO (GValueConstruct o)
constructRepoFinderMountMonitor val = B.Properties.constructObjectPropertyObject "monitor" (Just val)
#if ENABLE_OVERLOADING
data RepoFinderMountMonitorPropertyInfo
instance AttrInfo RepoFinderMountMonitorPropertyInfo where
type AttrAllowedOps RepoFinderMountMonitorPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RepoFinderMountMonitorPropertyInfo = Gio.VolumeMonitor.IsVolumeMonitor
type AttrBaseTypeConstraint RepoFinderMountMonitorPropertyInfo = IsRepoFinderMount
type AttrGetType RepoFinderMountMonitorPropertyInfo = (Maybe Gio.VolumeMonitor.VolumeMonitor)
type AttrLabel RepoFinderMountMonitorPropertyInfo = "monitor"
type AttrOrigin RepoFinderMountMonitorPropertyInfo = RepoFinderMount
attrGet _ = getRepoFinderMountMonitor
attrSet _ = undefined
attrConstruct _ = constructRepoFinderMountMonitor
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList RepoFinderMount
type instance O.AttributeList RepoFinderMount = RepoFinderMountAttributeList
type RepoFinderMountAttributeList = ('[ '("monitor", RepoFinderMountMonitorPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
repoFinderMountMonitor :: AttrLabelProxy "monitor"
repoFinderMountMonitor = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList RepoFinderMount = RepoFinderMountSignalList
type RepoFinderMountSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method RepoFinderMount::new
-- method type : Constructor
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gio", name = "VolumeMonitor"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "volume monitor to use, or %NULL to use\n the system default", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "RepoFinderMount"}))
-- throws : False
-- Skip return : False
foreign import ccall "ostree_repo_finder_mount_new" ostree_repo_finder_mount_new ::
Ptr Gio.VolumeMonitor.VolumeMonitor -> -- monitor : TInterface (Name {namespace = "Gio", name = "VolumeMonitor"})
IO (Ptr RepoFinderMount)
{- |
Create a new 'GI.OSTree.Objects.RepoFinderMount.RepoFinderMount', using the given /@monitor@/ to look up
volumes. If /@monitor@/ is 'Nothing', the monitor from 'GI.Gio.Objects.VolumeMonitor.volumeMonitorGet' will
be used.
/Since: 2018.6/
-}
repoFinderMountNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.VolumeMonitor.IsVolumeMonitor a) =>
Maybe (a)
{- ^ /@monitor@/: volume monitor to use, or 'Nothing' to use
the system default -}
-> m RepoFinderMount
{- ^ __Returns:__ a new 'GI.OSTree.Objects.RepoFinderMount.RepoFinderMount' -}
repoFinderMountNew monitor = liftIO $ do
maybeMonitor <- case monitor of
Nothing -> return nullPtr
Just jMonitor -> do
jMonitor' <- unsafeManagedPtrCastPtr jMonitor
return jMonitor'
result <- ostree_repo_finder_mount_new maybeMonitor
checkUnexpectedReturnNULL "repoFinderMountNew" result
result' <- (wrapObject RepoFinderMount) result
whenJust monitor touchManagedPtr
return result'
#if ENABLE_OVERLOADING
#endif