Ë
ÚÚ¡ö\uËã ód — d Z ddlZddlZddlZddlZddlZddlmZ G d„ d« Z G d„ d« Z
y)zo
Implementation of the XDG Recent File Storage Specification
http://standards.freedesktop.org/recent-file-spec
é N)ÚParsingErrorc óD — e Zd Zd„ Zd
d„Zd„ Zd
d„Zdd„Zdd„Zd„ Z d „ Z
y)
ÚRecentFilesc ó — g | _ d| _ y )NÚ )r Úfilename©Úselfs ú4/usr/lib/python3.12/site-packages/xdg/RecentFiles.pyÚ__init__zRecentFiles.__init__ s € ØˆÔØˆ�
ó Nc óô — |s3t j j t j d« d« } t j
j j |« }|| _
|j D ]¨ }|j t j
j j" k( sŒ5|j$ dk( sŒE|j D ]U }|j t j
j j" k( sŒ5|j$ dk( sŒE| j' |« ŒW Œª | j) « y# t $ r
t d|« ‚t j j j $ r
t d|« ‚w xY w)ziParse a list of recently used files.
filename defaults to ``~/.recently-used``.
ÚHOMEz.recently-usedúFile not foundzNot a valid .menu filer Ú
RecentItemN)ÚosÚpathÚjoinÚgetenvÚxmlÚdomÚminidomÚparseÚIOErrorr ÚparsersÚexpatÚ
ExpatErrorr Ú
childNodesÚnodeTypeÚNodeÚELEMENT_NODEÚtagNameÚ_RecentFiles__parseRecentItemÚsort)r
r ÚdocÚchildÚrecents r r zRecentFiles.parse s € ñ
Ü—w‘w—|‘|¤B§I¡I¨fÓ$5Ð7GÓHˆHð CÜ—'‘'—/‘/×'Ñ'¨Ó1ˆCð !ˆŒ
à—^”^ˆEØ�~‰~¤§¡§¡×!:Ñ!:Ó:Ø—=‘= MÓ1Ø"'×"2Ô"2˜Ø!Ÿ?™?¬c¯g©g¯l©l×.GÑ.GÓGØ%Ÿ~™~°Ó=Ø $× 6Ñ 6°vÕ >ñ #3ð $ð
� ‰ �øô ò ;ÜÐ/°Ó:Ð:Ü�{‰{× Ñ ×+Ñ+ò CÜÐ7¸ÓBÐBð Cús ·)D/ Ä/AE7c óV — t « }| j j |« |j D �]t }|j t
j j j k( sŒ6|j dk( r|j d j |_ Œd|j dk( r|j d j |_ Œ’|j dk( r(t |j d j « |_ ŒÉ|j dk( rd|_ Œà|j dk( sŒð|j D ]v }|j t
j j j k( sŒ5|j dk( sŒE|j j |j d j « Œx �Œw y ) NÚURIr z Mime-TypeÚ TimestampÚPrivateTÚGroupsÚGroup)Ú
RecentFiler Úappendr r r r r r! r" Ú nodeValuer) ÚMimeTypeÚintr* ÚPrviater, )r
Úitemr' Ú attributeÚgroups r Ú__parseRecentItemzRecentFiles.__parseRecentItem* s; € Ü“ˆØ×Ñ×Ñ Ô'àŸ�ˆIØ×!Ñ!¤S§W¡W§\¡\×%>Ñ%>Ó>Ø×$Ñ$¨Ò-Ø!*×!5Ñ!5°aÑ!8×!BÑ!B�F•JØ×&Ñ&¨+Ò5Ø&/×&:Ñ&:¸1Ñ&=×&GÑ&G�F•OØ×&Ñ&¨+Ò5Ü'*¨9×+?Ñ+?ÀÑ+B×+LÑ+LÓ'M�FÕ$Ø×&Ñ&¨)Ò3Ø%)�F•NØ×&Ñ&¨(Ó2à!*×!5Ô!5˜Ø Ÿ>™>¬S¯W©W¯\©\×-FÑ-FÓFØ$Ÿ}™}°Ó7Ø &§
¡
× 4Ñ 4°U×5EÑ5EÀaÑ5H×5RÑ5RÕ Sò "6ñ )r
c óö — |s| j st d|« ‚|s| j }t |d« 5 }t j |t j
« |j
d« |j
d« | j D �]% }|j
d« |j
dt j j j |j « z « |j
d|j z « |j
d|j z « |j d k( r|j
d
« t! |j" « dkD rG|j
d« |j" D ] }|j
d
|z « Œ |j
d« |j
d« �Œ( |j
d« t j |t j$ « ddd« y# 1 sw Y yxY w)z³Write the list of recently used files to disk.
If the instance is already associated with a file, filename can be
omitted to save it there again.
r Úwz
z
z
z %s
z %s
z %s
Tz
r z
z %s
z
z
z
N)r r ÚopenÚfcntlÚlockfÚLOCK_EXÚwriter r ÚsaxÚsaxutilsÚescaper) r1 r* r+ Úlenr, ÚLOCK_UN)r
r ÚfÚrr6 s r r> zRecentFiles.write? sp € ñ §
¢
ÜÐ/°Ó:Ð:ÙØ—}‘}ˆHä
�(˜CÔ
AÜ�K‰K˜œ5Ÿ=™=Ô)Ø
�G‰GÐ-Ô.Ø
�G‰GÐ%Ô&à×%Õ%�Ø—‘Ð*Ô+Ø—‘Ð-´·±×0@Ñ0@×0GÑ0GÈÏÉÓ0NÑNÔOØ—‘Ð9¸A¿J¹JÑFÔGØ—‘Ð9¸A¿K¹KÑGÔHØ—9‘9 Ò$Ø—G‘GÐ.Ô/Ü�q—x‘x“= 1Ò$Ø—G‘GÐ,Ô-Ø!"§¤˜ØŸ™Ð ;¸eÑ CÕDð "*à—G‘GÐ-Ô.Ø—‘Ð+Ö,ð &ð
�G‰GÐ&Ô'Ü�K‰K˜œ5Ÿ=™=Ô)÷) !×
Ñ
ús µF1G/Ç/G8c óT — g }d}| j D ]” }|r-|D ]' }||j v sŒ|j |« |dz
}Œ) nU|r.|D ]( }||j k( sŒ|j |« |dz
}Œ* n%|j dk( r|j |« |dz
}|dk7 sŒ�||k( sŒ“ |S |S )zþGet a list of recently used files.
The parameters can be used to filter by mime types, by group, or to
limit the number of items returned. By default, the entire list is
returned, except for items marked private.
r é F)r r, r/ r1 r+ ) r
Ú mimetypesÚgroupsÚlimitÚtmpÚir4 r6 Úmimetypes r ÚgetFileszRecentFiles.getFiles` s» € ð ˆØ
ˆØ×$Ô$ˆDÙÛ#�EØ §¡Ò+ØŸ
™
4Ô(ؘQ™™ñ $ñ Û )�HØ 4§=¡=Ó0ØŸ
™
4Ô(ؘQ™™ñ !*ð
—<‘< 5Ò(Ø—J‘J˜tÔ$ؘ‘F�Aؘ‹z˜a 5›jØàˆ
ð% %ð$ ˆ
r
c óÄ — || j v r+| j j |« }| j | }nWt | j « dk( r| j j « t « }| j j |« ||_ ||_ t t j « « |_
||_ |r||_ | j « y)z}Add a recently used file.
item should be the URI of the file, typically starting with ``file:///``.
iô N)r ÚindexrB Úpopr. r/ r) r1 r2 Útimer* r+ r, r$ )r
r4 rM rI ÚprivaterP r' s r ÚaddFilezRecentFiles.addFile} sµ € ð �4×#Ñ#Ñ#Ø×$Ñ$×*Ñ*¨4Ó0ˆEØ×%Ñ% eÑ,‰Fô �4×#Ñ#Ó$¨Ò+Ø× Ñ ×$Ñ$Ô&ä“\ˆFØ×Ñ×#Ñ# FÔ+àˆŒ
Ø"ˆŒÜœtŸy™y›{Ó+ˆÔØ ˆŒÙØ"ˆFŒMà� ‰ �r
c óX — || j v r| j j |« yy)z