----------------------------------------------------------------
--# Recent Chooser file info
----------------------------------------------------------------
include GtkEngine.e
include std/net/url.e
atom theme = create(GtkIconTheme)
constant docs = `Recent Chooser
This shows how to get more info, such as last
access and program used ...
`
constant fmt = "\nuri: %s\n\nmime: %s\n\nlast app: %s\n\ndays: %d"
constant win = create(GtkWindow,"size=300x300,border=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl = create(GtkLabel,{{"markup",docs}})
add(panel,lbl)
constant rcw = create(GtkRecentChooserWidget,{
{"local only",TRUE},
{"show private",TRUE},
{"show tips",TRUE},
{"limit",500},
{"sort type",GTK_RECENT_SORT_MRU}})
-- following only seems to work if a filter has been
-- installed;
set(rcw,"show not found",TRUE)
pack(panel,rcw,TRUE,TRUE,10)
constant btnbox = create(GtkButtonBox)
pack(panel,-btnbox)
constant btn1 = create(GtkButton,"gtk-quit","Quit")
constant btn2 = create(GtkButton,"gtk-ok","Foo")
add(btnbox,{btn1,btn2})
show_all(win)
main()
----------------------------------------------------------
global function Foo()
----------------------------------------------------------
object info = get(rcw,"current item") -- get the rc_info structure
object name = get(info,"display name")
object uri = decode(get(info,"uri")) -- get rid of escaped chars in the url
object age = get(info,"age")
object mime = get(info,"mime type")
object last = get(info,"last application")
Info(win,"You Chose",name,sprintf(fmt,{uri,mime,last,age}))
return 1
end function