-- GENERATED by C->Haskell Compiler, version 0.16.0 Crystal Seed, 24 Jan 2009 (Haskell)-- Edit the ORIGNAL .chs file instead!{-# LINE 1 "./Gnome/Keyring/ItemInfo.chs" #-}-- Copyright (C) 2009 John Millikin <jmillikin@gmail.com>-- -- This program is free software: you can redistribute it and/or modify-- it under the terms of the GNU General Public License as published by-- the Free Software Foundation, either version 3 of the License, or-- any later version.-- -- This program is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-- GNU General Public License for more details.-- -- You should have received a copy of the GNU General Public License-- along with this program. If not, see <http://www.gnu.org/licenses/>.-- {-# LANGUAGE ForeignFunctionInterface #-}{-# LINE 18 "./Gnome/Keyring/ItemInfo.chs" #-}moduleGnome.Keyring.ItemInfo(ItemInfo(..),ItemType(..),ItemID(..),GetItemInfoCallbackPtr,itemIDOperation,itemIDListOperation,stealItemIDList,itemInfoOperation,fromItemType,withItemInfo,stealItemInfo,peekItemID)whereimportData.Text.Lazy(Text)importData.Time(UTCTime)importControl.Exception(bracket)importGnome.Keyring.Internal.FFIimportGnome.Keyring.Internal.OperationnewtypeItemID=ItemIDWord32deriving(Show,Eq,Ord)peekItemID::(Storablea,Integrala)=>Ptra->IOItemIDpeekItemID=fmap(ItemID.fromIntegral).peekdataRawType=ITEM_GENERIC_SECRET|ITEM_NETWORK_PASSWORD|ITEM_NOTE|ITEM_CHAINED_KEYRING_PASSWORD|ITEM_ENCRYPTION_KEY_PASSWORD|ITEM_PK_STORAGE|ITEM_LAST_TYPEderiving(Show)instanceEnumRawTypewherefromEnumITEM_GENERIC_SECRET=0fromEnumITEM_NETWORK_PASSWORD=1fromEnumITEM_NOTE=2fromEnumITEM_CHAINED_KEYRING_PASSWORD=3fromEnumITEM_ENCRYPTION_KEY_PASSWORD=4fromEnumITEM_PK_STORAGE=256fromEnumITEM_LAST_TYPE=257toEnum0=ITEM_GENERIC_SECRETtoEnum1=ITEM_NETWORK_PASSWORDtoEnum2=ITEM_NOTEtoEnum3=ITEM_CHAINED_KEYRING_PASSWORDtoEnum4=ITEM_ENCRYPTION_KEY_PASSWORDtoEnum256=ITEM_PK_STORAGEtoEnum257=ITEM_LAST_TYPEtoEnumunmatched=error("RawType.toEnum: Cannot match "++showunmatched){-# LINE 47 "./Gnome/Keyring/ItemInfo.chs" #-}dataItemType=ItemGenericSecret|ItemNetworkPassword|ItemNote|ItemChainedKeyringPassword|ItemEncryptionKeyPassword|ItemPublicKeyStoragederiving(Show,Eq)fromItemType::ItemType->CIntfromItemType=fromIntegral.fromEnum.toRawwheretoRawItemGenericSecret=ITEM_GENERIC_SECRETtoRawItemNetworkPassword=ITEM_NETWORK_PASSWORDtoRawItemNote=ITEM_NOTEtoRawItemChainedKeyringPassword=ITEM_CHAINED_KEYRING_PASSWORDtoRawItemEncryptionKeyPassword=ITEM_ENCRYPTION_KEY_PASSWORDtoRawItemPublicKeyStorage=ITEM_PK_STORAGEtoItemType::RawType->ItemTypetoItemTypeITEM_GENERIC_SECRET=ItemGenericSecrettoItemTypeITEM_NETWORK_PASSWORD=ItemNetworkPasswordtoItemTypeITEM_NOTE=ItemNotetoItemTypeITEM_CHAINED_KEYRING_PASSWORD=ItemChainedKeyringPasswordtoItemTypeITEM_ENCRYPTION_KEY_PASSWORD=ItemEncryptionKeyPasswordtoItemTypeITEM_PK_STORAGE=ItemPublicKeyStoragetoItemTypex=error$"Unknown item type: "++showx-- | Note: setting mtime and ctime will not affect the keyringdataItemInfo=ItemInfo{itemType::ItemType,itemSecret::MaybeText,itemDisplayName::MaybeText,itemMTime::UTCTime,itemCTime::UTCTime}deriving(Show,Eq)peekItemInfo::Ptr()->IOItemInfopeekItemInfoinfo=docType<-gnome_keyring_item_info_get_typeinfosecret<-stealNullableText=<<gnome_keyring_item_info_get_secretinfoname<-stealNullableText=<<gnome_keyring_item_info_get_display_nameinfomtime<-cToUTC`fmap`gnome_keyring_item_info_get_mtimeinfoctime<-cToUTC`fmap`gnome_keyring_item_info_get_ctimeinfolettype'=toItemType.toEnum.fromIntegral$cTypereturn$ItemInfotype'secretnamemtimectimestealItemInfo::Ptr(Ptr())->IOItemInfostealItemInfoptr=bracket(peekptr)freeItemInfopeekItemInfofreeItemInfo::Ptr()->IO()freeItemInfo=gnome_keyring_item_info_free{-# LINE 100 "./Gnome/Keyring/ItemInfo.chs" #-}foreignimportccall"gnome-keyring.h &gnome_keyring_item_info_free"finalizeItemInfo::FunPtr(Ptra->IO())withItemInfo::ItemInfo->(Ptr()->IOa)->IOawithItemInfoinfoio=dofptr<-newForeignPtrfinalizeItemInfo=<<gnome_keyring_item_info_new{-# LINE 107 "./Gnome/Keyring/ItemInfo.chs" #-}withForeignPtrfptr$\ptr->dognome_keyring_item_info_set_typeptr.fromItemType.itemType$infowithNullableText(itemSecretinfo)$gnome_keyring_item_info_set_secretptrwithNullableText(itemDisplayNameinfo)$gnome_keyring_item_info_set_display_nameptrioptritemIDListOperation::OperationImplGetListCallback[ItemID]itemIDListOperation=operationImpl$\checkResult->wrapGetListCallback$\cresptr_->checkResultcres$peekItemIDListptrpeekItemIDList::Ptr()->IO[ItemID]peekItemIDList=mapGList$return.ItemID.fromIntegral.ptrToWordPtrstealItemIDList::Ptr(Ptr())->IO[ItemID]stealItemIDListptr=bracket(peekptr)freeListpeekItemIDListwherefreeList=g_list_free{-# LINE 124 "./Gnome/Keyring/ItemInfo.chs" #-}typeGetItemInfoCallback=CInt->Ptr()->Ptr()->IO()typeGetItemInfoCallbackPtr=FunPtr((CInt->((Ptr())->((Ptr())->(IO()))))){-# LINE 127 "./Gnome/Keyring/ItemInfo.chs" #-}foreignimportccall"wrapper"wrapGetItemInfoCallback::GetItemInfoCallback->IOGetItemInfoCallbackPtritemIDOperation::OperationImplGetIntCallbackItemIDitemIDOperation=operationImpl$\checkResult->wrapGetIntCallback$\crescint_->checkResultcres$return.ItemID.fromIntegral$cintitemInfoOperation::OperationImplGetItemInfoCallbackItemInfoitemInfoOperation=operationImpl$\checkResult->wrapGetItemInfoCallback$\cresptr_->checkResultcres$peekItemInfoptrforeignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_get_type"gnome_keyring_item_info_get_type::((Ptr())->(IOCInt))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_get_secret"gnome_keyring_item_info_get_secret::((Ptr())->(IO(PtrCChar)))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_get_display_name"gnome_keyring_item_info_get_display_name::((Ptr())->(IO(PtrCChar)))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_get_mtime"gnome_keyring_item_info_get_mtime::((Ptr())->(IOCLong))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_get_ctime"gnome_keyring_item_info_get_ctime::((Ptr())->(IOCLong))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_free"gnome_keyring_item_info_free::((Ptr())->(IO()))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_new"gnome_keyring_item_info_new::(IO(Ptr()))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_set_type"gnome_keyring_item_info_set_type::((Ptr())->(CInt->(IO())))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_set_secret"gnome_keyring_item_info_set_secret::((Ptr())->((PtrCChar)->(IO())))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h gnome_keyring_item_info_set_display_name"gnome_keyring_item_info_set_display_name::((Ptr())->((PtrCChar)->(IO())))foreignimportccallunsafe"Gnome/Keyring/ItemInfo.chs.h g_list_free"g_list_free::((Ptr())->(IO()))