{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gio.Objects.ApplicationCommandLine ( -- * Exported types ApplicationCommandLine(..) , ApplicationCommandLineK , toApplicationCommandLine , noApplicationCommandLine , -- * Methods -- ** applicationCommandLineCreateFileForArg applicationCommandLineCreateFileForArg , -- ** applicationCommandLineGetArguments applicationCommandLineGetArguments , -- ** applicationCommandLineGetCwd applicationCommandLineGetCwd , -- ** applicationCommandLineGetEnviron applicationCommandLineGetEnviron , -- ** applicationCommandLineGetExitStatus applicationCommandLineGetExitStatus , -- ** applicationCommandLineGetIsRemote applicationCommandLineGetIsRemote , -- ** applicationCommandLineGetOptionsDict applicationCommandLineGetOptionsDict , -- ** applicationCommandLineGetPlatformData applicationCommandLineGetPlatformData , -- ** applicationCommandLineGetStdin applicationCommandLineGetStdin , -- ** applicationCommandLineGetenv applicationCommandLineGetenv , -- ** applicationCommandLineSetExitStatus applicationCommandLineSetExitStatus , -- * Properties -- ** Arguments ApplicationCommandLineArgumentsPropertyInfo, constructApplicationCommandLineArguments, -- ** IsRemote ApplicationCommandLineIsRemotePropertyInfo, getApplicationCommandLineIsRemote , -- ** Options ApplicationCommandLineOptionsPropertyInfo, constructApplicationCommandLineOptions , -- ** PlatformData ApplicationCommandLinePlatformDataPropertyInfo, constructApplicationCommandLinePlatformData, ) 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.Gio.Types import GI.Gio.Callbacks import qualified GI.GLib as GLib import qualified GI.GObject as GObject newtype ApplicationCommandLine = ApplicationCommandLine (ForeignPtr ApplicationCommandLine) foreign import ccall "g_application_command_line_get_type" c_g_application_command_line_get_type :: IO GType type instance ParentTypes ApplicationCommandLine = ApplicationCommandLineParentTypes type ApplicationCommandLineParentTypes = '[GObject.Object] instance GObject ApplicationCommandLine where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_application_command_line_get_type class GObject o => ApplicationCommandLineK o instance (GObject o, IsDescendantOf ApplicationCommandLine o) => ApplicationCommandLineK o toApplicationCommandLine :: ApplicationCommandLineK o => o -> IO ApplicationCommandLine toApplicationCommandLine = unsafeCastTo ApplicationCommandLine noApplicationCommandLine :: Maybe ApplicationCommandLine noApplicationCommandLine = Nothing -- VVV Prop "arguments" -- Type: TVariant -- Flags: [PropertyWritable,PropertyConstructOnly] constructApplicationCommandLineArguments :: GVariant -> IO ([Char], GValue) constructApplicationCommandLineArguments val = constructObjectPropertyVariant "arguments" val data ApplicationCommandLineArgumentsPropertyInfo instance AttrInfo ApplicationCommandLineArgumentsPropertyInfo where type AttrAllowedOps ApplicationCommandLineArgumentsPropertyInfo = '[ 'AttrConstruct] type AttrSetTypeConstraint ApplicationCommandLineArgumentsPropertyInfo = (~) GVariant type AttrBaseTypeConstraint ApplicationCommandLineArgumentsPropertyInfo = ApplicationCommandLineK type AttrGetType ApplicationCommandLineArgumentsPropertyInfo = () type AttrLabel ApplicationCommandLineArgumentsPropertyInfo = "ApplicationCommandLine::arguments" attrGet _ = undefined attrSet _ = undefined attrConstruct _ = constructApplicationCommandLineArguments -- VVV Prop "is-remote" -- Type: TBasicType TBoolean -- Flags: [PropertyReadable] getApplicationCommandLineIsRemote :: (MonadIO m, ApplicationCommandLineK o) => o -> m Bool getApplicationCommandLineIsRemote obj = liftIO $ getObjectPropertyBool obj "is-remote" data ApplicationCommandLineIsRemotePropertyInfo instance AttrInfo ApplicationCommandLineIsRemotePropertyInfo where type AttrAllowedOps ApplicationCommandLineIsRemotePropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint ApplicationCommandLineIsRemotePropertyInfo = (~) () type AttrBaseTypeConstraint ApplicationCommandLineIsRemotePropertyInfo = ApplicationCommandLineK type AttrGetType ApplicationCommandLineIsRemotePropertyInfo = Bool type AttrLabel ApplicationCommandLineIsRemotePropertyInfo = "ApplicationCommandLine::is-remote" attrGet _ = getApplicationCommandLineIsRemote attrSet _ = undefined attrConstruct _ = undefined -- VVV Prop "options" -- Type: TVariant -- Flags: [PropertyWritable,PropertyConstructOnly] constructApplicationCommandLineOptions :: GVariant -> IO ([Char], GValue) constructApplicationCommandLineOptions val = constructObjectPropertyVariant "options" val data ApplicationCommandLineOptionsPropertyInfo instance AttrInfo ApplicationCommandLineOptionsPropertyInfo where type AttrAllowedOps ApplicationCommandLineOptionsPropertyInfo = '[ 'AttrConstruct] type AttrSetTypeConstraint ApplicationCommandLineOptionsPropertyInfo = (~) GVariant type AttrBaseTypeConstraint ApplicationCommandLineOptionsPropertyInfo = ApplicationCommandLineK type AttrGetType ApplicationCommandLineOptionsPropertyInfo = () type AttrLabel ApplicationCommandLineOptionsPropertyInfo = "ApplicationCommandLine::options" attrGet _ = undefined attrSet _ = undefined attrConstruct _ = constructApplicationCommandLineOptions -- VVV Prop "platform-data" -- Type: TVariant -- Flags: [PropertyWritable,PropertyConstructOnly] constructApplicationCommandLinePlatformData :: GVariant -> IO ([Char], GValue) constructApplicationCommandLinePlatformData val = constructObjectPropertyVariant "platform-data" val data ApplicationCommandLinePlatformDataPropertyInfo instance AttrInfo ApplicationCommandLinePlatformDataPropertyInfo where type AttrAllowedOps ApplicationCommandLinePlatformDataPropertyInfo = '[ 'AttrConstruct] type AttrSetTypeConstraint ApplicationCommandLinePlatformDataPropertyInfo = (~) GVariant type AttrBaseTypeConstraint ApplicationCommandLinePlatformDataPropertyInfo = ApplicationCommandLineK type AttrGetType ApplicationCommandLinePlatformDataPropertyInfo = () type AttrLabel ApplicationCommandLinePlatformDataPropertyInfo = "ApplicationCommandLine::platform-data" attrGet _ = undefined attrSet _ = undefined attrConstruct _ = constructApplicationCommandLinePlatformData type instance AttributeList ApplicationCommandLine = ApplicationCommandLineAttributeList type ApplicationCommandLineAttributeList = ('[ '("arguments", ApplicationCommandLineArgumentsPropertyInfo), '("is-remote", ApplicationCommandLineIsRemotePropertyInfo), '("options", ApplicationCommandLineOptionsPropertyInfo), '("platform-data", ApplicationCommandLinePlatformDataPropertyInfo)] :: [(Symbol, *)]) type instance SignalList ApplicationCommandLine = ApplicationCommandLineSignalList type ApplicationCommandLineSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method ApplicationCommandLine::create_file_for_arg -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arg", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arg", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "File" -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_create_file_for_arg" g_application_command_line_create_file_for_arg :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" CString -> -- arg : TBasicType TUTF8 IO (Ptr File) applicationCommandLineCreateFileForArg :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj T.Text -> -- arg m File applicationCommandLineCreateFileForArg _obj arg = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj arg' <- textToCString arg result <- g_application_command_line_create_file_for_arg _obj' arg' checkUnexpectedReturnNULL "g_application_command_line_create_file_for_arg" result result' <- (wrapObject File) result touchManagedPtr _obj freeMem arg' return result' -- method ApplicationCommandLine::get_arguments -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TCArray False (-1) 1 (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_arguments" g_application_command_line_get_arguments :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" Ptr Int32 -> -- argc : TBasicType TInt32 IO (Ptr CString) applicationCommandLineGetArguments :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m [T.Text] applicationCommandLineGetArguments _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj argc <- allocMem :: IO (Ptr Int32) result <- g_application_command_line_get_arguments _obj' argc argc' <- peek argc checkUnexpectedReturnNULL "g_application_command_line_get_arguments" result result' <- (unpackUTF8CArrayWithLength argc') result (mapCArrayWithLength argc') freeMem result freeMem result touchManagedPtr _obj freeMem argc return result' -- method ApplicationCommandLine::get_cwd -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_cwd" g_application_command_line_get_cwd :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO CString applicationCommandLineGetCwd :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m T.Text applicationCommandLineGetCwd _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_cwd _obj' checkUnexpectedReturnNULL "g_application_command_line_get_cwd" result result' <- cstringToText result touchManagedPtr _obj return result' -- method ApplicationCommandLine::get_environ -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TCArray True (-1) (-1) (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_environ" g_application_command_line_get_environ :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO (Ptr CString) applicationCommandLineGetEnviron :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m [T.Text] applicationCommandLineGetEnviron _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_environ _obj' checkUnexpectedReturnNULL "g_application_command_line_get_environ" result result' <- unpackZeroTerminatedUTF8CArray result touchManagedPtr _obj return result' -- method ApplicationCommandLine::get_exit_status -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_exit_status" g_application_command_line_get_exit_status :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO Int32 applicationCommandLineGetExitStatus :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m Int32 applicationCommandLineGetExitStatus _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_exit_status _obj' touchManagedPtr _obj return result -- method ApplicationCommandLine::get_is_remote -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_is_remote" g_application_command_line_get_is_remote :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO CInt applicationCommandLineGetIsRemote :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m Bool applicationCommandLineGetIsRemote _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_is_remote _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method ApplicationCommandLine::get_options_dict -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "VariantDict" -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_options_dict" g_application_command_line_get_options_dict :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO (Ptr GLib.VariantDict) applicationCommandLineGetOptionsDict :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m GLib.VariantDict applicationCommandLineGetOptionsDict _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_options_dict _obj' checkUnexpectedReturnNULL "g_application_command_line_get_options_dict" result result' <- (newBoxed GLib.VariantDict) result touchManagedPtr _obj return result' -- method ApplicationCommandLine::get_platform_data -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TVariant -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_platform_data" g_application_command_line_get_platform_data :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO (Ptr GVariant) applicationCommandLineGetPlatformData :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m GVariant applicationCommandLineGetPlatformData _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_platform_data _obj' checkUnexpectedReturnNULL "g_application_command_line_get_platform_data" result result' <- wrapGVariantPtr result touchManagedPtr _obj return result' -- method ApplicationCommandLine::get_stdin -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "InputStream" -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_get_stdin" g_application_command_line_get_stdin :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" IO (Ptr InputStream) applicationCommandLineGetStdin :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj m InputStream applicationCommandLineGetStdin _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_application_command_line_get_stdin _obj' checkUnexpectedReturnNULL "g_application_command_line_get_stdin" result result' <- (wrapObject InputStream) result touchManagedPtr _obj return result' -- method ApplicationCommandLine::getenv -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_getenv" g_application_command_line_getenv :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" CString -> -- name : TBasicType TUTF8 IO CString applicationCommandLineGetenv :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj T.Text -> -- name m T.Text applicationCommandLineGetenv _obj name = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj name' <- textToCString name result <- g_application_command_line_getenv _obj' name' checkUnexpectedReturnNULL "g_application_command_line_getenv" result result' <- cstringToText result touchManagedPtr _obj freeMem name' return result' -- method ApplicationCommandLine::set_exit_status -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "exit_status", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ApplicationCommandLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "exit_status", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_application_command_line_set_exit_status" g_application_command_line_set_exit_status :: Ptr ApplicationCommandLine -> -- _obj : TInterface "Gio" "ApplicationCommandLine" Int32 -> -- exit_status : TBasicType TInt32 IO () applicationCommandLineSetExitStatus :: (MonadIO m, ApplicationCommandLineK a) => a -> -- _obj Int32 -> -- exit_status m () applicationCommandLineSetExitStatus _obj exit_status = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_application_command_line_set_exit_status _obj' exit_status touchManagedPtr _obj return ()