{-# LINE 2 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}-- -*-haskell-*--- GIMP Toolkit (GTK) Interface RecentChooser---- Author : Andy Stewart---- Created: 27 Mar 2010---- Copyright (C) 2010 Andy Stewart---- This library is free software; you can redistribute it and/or-- modify it under the terms of the GNU Lesser General Public-- License as published by the Free Software Foundation; either-- version 2.1 of the License, or (at your option) any later version.---- This library 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-- Lesser General Public License for more details.---- |-- Maintainer : gtk2hs-users@lists.sourceforge.net-- Stability : provisional-- Portability : portable (depends on GHC)---- Interface implemented by widgets displaying recently used files---- * Module available since Gtk+ version 2.10--moduleGraphics.UI.Gtk.Recent.RecentChooser(-- * Detail---- | 'RecentChooser' is an interface that can be implemented by widgets-- displaying the list of recently used files. In Gtk+, the main objects that-- implement this interface are 'RecentChooserWidget', 'RecentChooserDialog'-- and 'RecentChooserMenu'.---- Recently used files are supported since Gtk+ 2.10.-- * Class Hierarchy---- |-- @-- | 'GInterface'-- | +----RecentChooser-- @-- * TypesRecentChooser,RecentChooserClass,castToRecentChooser,toRecentChooser,-- * EnumsRecentChooserError(..),RecentSortType(..),-- * MethodsrecentChooserSetSortFunc,recentChooserSetCurrentURI,recentChooserGetCurrentURI,recentChooserGetCurrentItem,recentChooserSelectURI,recentChooserUnselectURI,recentChooserSelectAll,recentChooserUnselectAll,recentChooserGetItems,recentChooserGetURIs,recentChooserAddFilter,recentChooserRemoveFilter,recentChooserListFilters,-- * AttributesrecentChooserShowPrivate,recentChooserShowTips,recentChooserShowIcons,recentChooserShowNotFound,recentChooserSelectMultiple,recentChooserLocalOnly,recentChooserLimit,recentChooserSortType,recentChooserFilter,-- * SignalsrecentChooserSelectionChanged,recentChooserItemActivated,)whereimportControl.Monad(liftM)importSystem.Glib.FFIimportSystem.Glib.UTFStringimportSystem.Glib.AttributesimportSystem.Glib.PropertiesimportSystem.Glib.GListimportSystem.Glib.GObject(Quark,quarkFromString)importSystem.Glib.GError(GErrorDomain,GErrorClass(..),propagateGError,checkGError)importGraphics.UI.Gtk.Abstract.Object(makeNewObject)importGraphics.UI.Gtk.Recent.RecentInfo(RecentInfo,mkRecentInfo)importGraphics.UI.Gtk.Types{-# LINE 104 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}importGraphics.UI.Gtk.Signals{-# LINE 105 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}{-# LINE 107 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}---------------------- Enums-- | These identify the various errors that can occur while calling 'RecentChooser' functions.dataRecentChooserError=RecentChooserErrorNotFound|RecentChooserErrorInvalidUrideriving(Enum,Bounded,Eq,Show){-# LINE 113 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}-- | Used to specify the sorting method to be applyed to the recently used resource list.dataRecentSortType=RecentSortNone|RecentSortMru|RecentSortLru|RecentSortCustomderiving(Bounded,Eq,Show)instanceEnumRecentSortTypewherefromEnumRecentSortNone=0fromEnumRecentSortMru=1fromEnumRecentSortLru=2fromEnumRecentSortCustom=3toEnum0=RecentSortNonetoEnum1=RecentSortMrutoEnum2=RecentSortLrutoEnum3=RecentSortCustomtoEnumunmatched=error("RecentSortType.toEnum: Cannot match "++showunmatched)succRecentSortNone=RecentSortMrusuccRecentSortMru=RecentSortLrusuccRecentSortLru=RecentSortCustomsucc_=undefinedpredRecentSortMru=RecentSortNonepredRecentSortLru=RecentSortMrupredRecentSortCustom=RecentSortLrupred_=undefinedenumFromToxy|fromEnumx==fromEnumy=[y]|otherwise=x:enumFromTo(succx)yenumFromx=enumFromToxRecentSortCustomenumFromThen__=error"Enum RecentSortType: enumFromThen not implemented"enumFromThenTo___=error"Enum RecentSortType: enumFromThenTo not implemented"{-# LINE 116 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}---------------------- Methods-- | Sets the comparison function used when sorting to be @sortFunc@. If the-- @chooser@ has the sort type set to 'RecentSortCustom' then the chooser will-- sort using this function.---- To the comparison function will be passed two 'RecentInfo' structs and @sortData@; @sortFunc@ should return a positive-- integer if the first item comes before the second, zero if the two items are-- equal and a negative integer if the first item comes after the second.------ * Available since Gtk+ version 2.10--recentChooserSetSortFunc::RecentChooserClassself=>self->(Maybe(RecentInfo->IOInt))->IO()recentChooserSetSortFuncselfNothing=(\(RecentChooserarg1)arg2arg3arg4->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_set_sort_funcargPtr1arg2arg3arg4){-# LINE 136 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)nullFunPtrnullPtrnullFunPtrrecentChooserSetSortFuncself(Justfunc)=dofPtr<-mkRecentSortFunc$\_infoPtr_->doinfo<-mkRecentInfoinfoPtrliftMfromIntegral(funcinfo)(\(RecentChooserarg1)arg2arg3arg4->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_set_sort_funcargPtr1arg2arg3arg4){-# LINE 142 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)fPtr(castFunPtrToPtrfPtr)destroyFunPtrtypeRecentSortFunc=FunPtr(((PtrRecentInfo)->((PtrRecentInfo)->((Ptr())->(IOCInt))))){-# LINE 148 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}foreignimportccall"wrapper"mkRecentSortFunc::(PtrRecentInfo->PtrRecentInfo->Ptr()->IO(CInt))->IORecentSortFunc-- | Sets @uri@ as the current URI for @chooser@.------ * Available since Gtk+ version 2.10--recentChooserSetCurrentURI::RecentChooserClassself=>self->String-- ^ @uri@ - a URI->IOBool-- ^ returns @True@ if the URI was found.recentChooserSetCurrentURIselfuri=checkGError(\errorPtr->liftMtoBool$withUTFStringuri$\uriPtr->(\(RecentChooserarg1)arg2arg3->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_set_current_uriargPtr1arg2arg3){-# LINE 166 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)uriPtrerrorPtr)(\_->returnFalse)-- | Gets the URI currently selected by @chooser@.------ * Available since Gtk+ version 2.10--recentChooserGetCurrentURI::RecentChooserClassself=>self->IOString-- ^ returns a newly string holding a URI.recentChooserGetCurrentURIself=(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_get_current_uriargPtr1){-# LINE 180 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)>>=readUTFString-- | Gets the 'RecentInfo' currently selected by-- @chooser@.------ * Available since Gtk+ version 2.10--recentChooserGetCurrentItem::RecentChooserClassself=>self->IORecentInfo-- ^ returns a 'RecentInfo'.-- Use 'recentInfoUnref' when when you have finished-- using it.recentChooserGetCurrentItemself=doinfo<-(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_get_current_itemargPtr1)(toRecentChooserself)mkRecentInfoinfo-- | Selects @uri@ inside @chooser@.------ * Available since Gtk+ version 2.10--recentChooserSelectURI::RecentChooserClassself=>self->String-- ^ @uri@ - a URI->IOBool-- ^ returns @True@ if @uri@ was found.recentChooserSelectURIselfuri=checkGError(\errorPtr->liftMtoBool$withUTFStringuri$\uriPtr->(\(RecentChooserarg1)arg2arg3->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_select_uriargPtr1arg2arg3){-# LINE 210 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)uriPtrerrorPtr)(\_->returnFalse)-- | Unselects @uri@ inside @chooser@.------ * Available since Gtk+ version 2.10--recentChooserUnselectURI::RecentChooserClassself=>self->String-- ^ @uri@ - a URI->IO()recentChooserUnselectURIselfuri=withUTFStringuri$\uriPtr->(\(RecentChooserarg1)arg2->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_unselect_uriargPtr1arg2){-# LINE 226 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)uriPtr-- | Selects all the items inside @chooser@, if the @chooser@ supports-- multiple selection.------ * Available since Gtk+ version 2.10--recentChooserSelectAll::RecentChooserClassself=>self->IO()recentChooserSelectAllself=(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_select_allargPtr1){-# LINE 238 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)-- | Unselects all the items inside @chooser@.------ * Available since Gtk+ version 2.10--recentChooserUnselectAll::RecentChooserClassself=>self->IO()recentChooserUnselectAllself=(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_unselect_allargPtr1){-# LINE 248 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)-- | Gets the list of recently used resources in form of 'RecentInfo'---- The return value of this function is affected by the \"sort-type\" and-- \"limit\" properties of @chooser@.--recentChooserGetItems::RecentChooserClassself=>self->IO[RecentInfo]-- ^ returns A list of 'RecentInfo' objects.recentChooserGetItemsself=doglist<-(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_get_itemsargPtr1)(toRecentChooserself)list<-fromGListglistmapMmkRecentInfolist-- | Gets the URI of the recently used resources.---- The return value of this function is affected by the \"sort-type\" and-- \"limit\" properties of @chooser@.------ * Available since Gtk+ version 2.10--recentChooserGetURIs::RecentChooserClassself=>self->IO[String]recentChooserGetURIsself=alloca$\lengthPtr->dostr<-(\(RecentChooserarg1)arg2->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_get_urisargPtr1arg2){-# LINE 275 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)lengthPtrlength<-peeklengthPtrmapMpeekUTFString=<<peekArray(fromIntegrallength)str-- | Adds @filter@ to the list of 'RecentFilter' objects held by @chooser@.---- If no previous filter objects were defined, this function will call-- 'recentChooserSetFilter'.------ * Available since Gtk+ version 2.10--recentChooserAddFilter::(RecentChooserClassself,RecentFilterClassfilter)=>self->filter-- ^ @filter@ - a 'RecentFilter'->IO()recentChooserAddFilterselffilter=(\(RecentChooserarg1)(RecentFilterarg2)->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->gtk_recent_chooser_add_filterargPtr1argPtr2){-# LINE 293 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)(toRecentFilterfilter)-- | Removes @filter@ from the list of 'RecentFilter' objects held by-- @chooser@.--recentChooserRemoveFilter::(RecentChooserClassself,RecentFilterClassfilter)=>self->filter-- ^ @filter@ - a 'RecentFilter'->IO()recentChooserRemoveFilterselffilter=(\(RecentChooserarg1)(RecentFilterarg2)->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->gtk_recent_chooser_remove_filterargPtr1argPtr2){-# LINE 304 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)(toRecentFilterfilter)-- | Gets the 'RecentFilter' objects held by @chooser@.------ * Available since Gtk+ version 2.10--recentChooserListFilters::RecentChooserClassself=>self->IO[RecentFilter]-- ^ returns A singly linked list of 'RecentFilter'.recentChooserListFiltersself=doglist<-(\(RecentChooserarg1)->withForeignPtrarg1$\argPtr1->gtk_recent_chooser_list_filtersargPtr1){-# LINE 316 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}(toRecentChooserself)list<-fromGListglistmapM(\x->makeNewObjectmkRecentFilter(return(castPtrx)))list---------------------- Attributes-- | Whether the private items should be displayed.---- Default value: 'False'---- * Available since Gtk+ version 2.10--recentChooserShowPrivate::RecentChooserClassself=>AttrselfBoolrecentChooserShowPrivate=newAttrFromBoolProperty"show-private"-- | Whether this 'RecentChooser' should display a tooltip containing the full path of the recently used-- resources.---- Default value: 'False'------ * Available since Gtk+ version 2.10--recentChooserShowTips::RecentChooserClassself=>AttrselfBoolrecentChooserShowTips=newAttrFromBoolProperty"show-tips"-- | Whether this 'RecentChooser' should display an icon near the item.---- Default value: 'True'------ * Available since Gtk+ version 2.10--recentChooserShowIcons::RecentChooserClassself=>AttrselfBoolrecentChooserShowIcons=newAttrFromBoolProperty"show-icons"-- | Whether this 'RecentChooser' should display the recently used resources even if not present-- anymore. Setting this to 'False' will perform a potentially expensive check on every local resource-- (every remote resource will always be displayed).---- Default value: 'True'------ * Available since Gtk+ version 2.10--recentChooserShowNotFound::RecentChooserClassself=>AttrselfBoolrecentChooserShowNotFound=newAttrFromBoolProperty"show-not-found"-- | Allow the user to select multiple resources.---- Default value: 'False'------ * Available since Gtk+ version 2.10--recentChooserSelectMultiple::RecentChooserClassself=>AttrselfBoolrecentChooserSelectMultiple=newAttrFromBoolProperty"select-multiple"-- | Whether this 'RecentChooser' should display only local (file:) resources.---- Default value: 'True'------ * Available since Gtk+ version 2.10--recentChooserLocalOnly::RecentChooserClassself=>AttrselfBoolrecentChooserLocalOnly=newAttrFromBoolProperty"local-only"-- | The maximum number of recently used resources to be displayed, or -1 to display all items. By-- default, the 'Setting':gtk-recent-files-limit setting is respected: you can override that limit on-- a particular instance of 'RecentChooser' by setting this property.---- Allowed values: >= 'GMaxulong'---- Default value: -1------ * Available since Gtk+ version 2.10--recentChooserLimit::RecentChooserClassself=>AttrselfIntrecentChooserLimit=newAttrFromIntProperty"limit"-- | Sorting order to be used when displaying the recently used resources.---- Default value: ''RecentSortNone''------ * Available since Gtk+ version 2.10--recentChooserSortType::RecentChooserClassself=>AttrselfRecentSortTyperecentChooserSortType=newAttrFromEnumProperty"sort-type"gtk_recent_sort_type_get_type{-# LINE 409 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}-- | The 'RecentFilter' object to be used when displaying the recently used resources.------ * Available since Gtk+ version 2.10--recentChooserFilter::(RecentChooserClassself,RecentFilterClassrecentFilter)=>ReadWriteAttrselfRecentFilterrecentFilterrecentChooserFilter=newAttrFromObjectProperty"filter"gtk_recent_filter_get_type{-# LINE 418 "./Graphics/UI/Gtk/Recent/RecentChooser.chs" #-}---------------------- Signals-- | This signal is emitted when there is a change in the set of selected-- recently used resources. This can happen when a user modifies the selection-- with the mouse or the keyboard, or when explicitely calling functions to-- change the selection.------ * Available since Gtk+ version 2.10--recentChooserSelectionChanged::RecentChooserClassself=>Signalself(IO())recentChooserSelectionChanged=Signal(connect_NONE__NONE"selection_changed")-- | This signal is emitted when the user \"activates\" a recent item in the-- recent chooser. This can happen by double-clicking on an item in the-- recently used resources list, or by pressing Enter.------ * Available since Gtk+ version 2.10--recentChooserItemActivated::RecentChooserClassself=>Signalself(IO())recentChooserItemActivated=Signal(connect_NONE__NONE"item_activated")foreignimportccallsafe"gtk_recent_chooser_set_sort_func"gtk_recent_chooser_set_sort_func::((PtrRecentChooser)->((FunPtr((PtrRecentInfo)->((PtrRecentInfo)->((Ptr())->(IOCInt)))))->((Ptr())->((FunPtr((Ptr())->(IO())))->(IO())))))foreignimportccallsafe"gtk_recent_chooser_set_current_uri"gtk_recent_chooser_set_current_uri::((PtrRecentChooser)->((PtrCChar)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"gtk_recent_chooser_get_current_uri"gtk_recent_chooser_get_current_uri::((PtrRecentChooser)->(IO(PtrCChar)))foreignimportccallsafe"gtk_recent_chooser_get_current_item"gtk_recent_chooser_get_current_item::((PtrRecentChooser)->(IO(PtrRecentInfo)))foreignimportccallsafe"gtk_recent_chooser_select_uri"gtk_recent_chooser_select_uri::((PtrRecentChooser)->((PtrCChar)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"gtk_recent_chooser_unselect_uri"gtk_recent_chooser_unselect_uri::((PtrRecentChooser)->((PtrCChar)->(IO())))foreignimportccallsafe"gtk_recent_chooser_select_all"gtk_recent_chooser_select_all::((PtrRecentChooser)->(IO()))foreignimportccallsafe"gtk_recent_chooser_unselect_all"gtk_recent_chooser_unselect_all::((PtrRecentChooser)->(IO()))foreignimportccallsafe"gtk_recent_chooser_get_items"gtk_recent_chooser_get_items::((PtrRecentChooser)->(IO(Ptr())))foreignimportccallsafe"gtk_recent_chooser_get_uris"gtk_recent_chooser_get_uris::((PtrRecentChooser)->((PtrCUInt)->(IO(Ptr(PtrCChar)))))foreignimportccallsafe"gtk_recent_chooser_add_filter"gtk_recent_chooser_add_filter::((PtrRecentChooser)->((PtrRecentFilter)->(IO())))foreignimportccallsafe"gtk_recent_chooser_remove_filter"gtk_recent_chooser_remove_filter::((PtrRecentChooser)->((PtrRecentFilter)->(IO())))foreignimportccallsafe"gtk_recent_chooser_list_filters"gtk_recent_chooser_list_filters::((PtrRecentChooser)->(IO(Ptr())))foreignimportccallunsafe"gtk_recent_sort_type_get_type"gtk_recent_sort_type_get_type::CUIntforeignimportccallunsafe"gtk_recent_filter_get_type"gtk_recent_filter_get_type::CUInt