
---------------------------------------
--# Applications, Notifications, etc...
---------------------------------------

include GtkEngine.e

constant docs = `<u><b>App Win</b></u>
demos pop-up notifications.
Works on Mint 17, but not 18? 
Maybe due to different desktops,
Gnome vs. Cinnamon?
`
constant lbl = create(GtkLabel,{{"markup",docs}})
show(lbl)

constant app = create(GtkApplication,"AppWin.main",0) 
connect(app,"activate","AddMainWindow")

constant icon = create(GThemedIcon,"face-cool") 

constant note = create(GNotification,"Note:")
 set(note,{
  {"icon",icon}, -- maybe depends upon window manager?
  {"body","AppWin Program Started\nthis note will self-destruct in 10 seconds."}})
 
set(app,"run")

-------------------------------
global function AddMainWindow()
-------------------------------
 atom win = create(GtkApplicationWindow,app)

 set(win,{
  {"icon","face-cool"},
  {"border width",10},
  {"position",GTK_WIN_POS_CENTER},
  {"show menubar",TRUE},
  {"show all",win}})
  
 add(win,lbl)
 
 set(app,{ -- win must be 'realized' a.k.a. shown, before adding to app;
  {"add window",win}}) 
 
 if get(app,"register") then 
  set(app,"send notification","startup",note)
 end if

return 1
end function


