added eugtk examples
This commit is contained in:
65
eugtk/examples/test126.ex
Normal file
65
eugtk/examples/test126.ex
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
----------------------------------------------------------------
|
||||
--# Recent Chooser file info
|
||||
----------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
include std/net/url.e
|
||||
|
||||
atom theme = create(GtkIconTheme)
|
||||
|
||||
constant docs = `<b><u>Recent Chooser</u></b>
|
||||
|
||||
This shows how to get more info, such as last
|
||||
access and program used ...
|
||||
`
|
||||
constant fmt = "\n<small><b>uri:</b> %s\n\n<b>mime:</b> %s\n\n<b>last app:</b> %s\n\n<b>days:</b> %d</small>"
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user