File: demo-builder.lua

package info (click to toggle)
lua-lgi 0.9.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: ansic: 5,082; makefile: 169; sh: 31
file content (33 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
return function(parent, dir)

local lgi = require 'lgi'
local Gtk = lgi.Gtk

local assert = lgi.assert

local builder = Gtk.Builder()
assert(builder:add_from_file(dir:get_child('demo.ui'):get_path()))
local ui = builder.objects

-- Get top-level window from the builder.
local window = ui.window1

-- Connect 'Quit' and 'About' actions.
function ui.Quit:on_activate()
   window:destroy()
 end

function ui.About:on_activate()
   ui.aboutdialog1:run()
   ui.aboutdialog1:hide()
end

window:show_all()
return window
end,

"Builder",

table.concat {
   [[Demonstrates an interface loaded from a XML description.]],
}