eumandy/eugtk/examples/test123.ex
2016-11-25 00:33:18 -07:00

66 lines
1.7 KiB
Elixir

----------------------------------------------------------------
--# GtkAppChooseerButton
----------------------------------------------------------------
include GtkEngine.e
constant docs = `<b><u>App Chooser Buttons</u></b>
Shows available apps for various file types.
This doesn't <i>change</i> the associations,
just displays the current setting.
You change the association by changing
properties in your file manager (usually).
`
constant win = create(GtkWindow,"size=300x300,position=1,border_width=10,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
constant lbl1 = create(GtkLabel,"Apps for plain text files")
set(lbl1,"font","8")
add(panel,lbl1)
constant appbtn1 = create(GtkAppChooserButton,"text/plain")
pack(panel,appbtn1)
constant lbl2 = create(GtkLabel,"Apps for png images:")
set(lbl2,"font","8")
add(panel,lbl2)
constant appbtn2 = create(GtkAppChooserButton,"image/png")
pack(panel,appbtn2)
constant lbl3 = create(GtkLabel,"Apps for web pages:")
set(lbl3,"font","8")
add(panel,lbl3)
constant myicon = create(GIcon,"face-cool")
constant appbtn3 = create(GtkAppChooserButton,"text/html")
set(appbtn3,{
{"append separator"},
{"append custom item","Foo","My Own Web Page Editor",myicon},
{"connect","custom-item-activated",_("ShowDetails"),1}})
pack(panel,appbtn3)
constant btn = create(GtkButton,"gtk-quit","Quit")
constant box = create(GtkButtonBox)
pack(panel,-box)
set(box,"margin top",10)
add(box,btn)
show_all(win)
main()
-----------------------------
function ShowDetails()
-----------------------------
return Info(win,"Foo","My own web page editor","would be run here",,myicon)
end function