~nimu-zh3/+junk/lua-gtk

« back to all changes in this revision

Viewing changes to examples/button.lua

  • Committer: Bazaar Package Importer
  • Author(s): Enrico Tassi
  • Date: 2009-05-17 18:16:21 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090517181621-9kmdd82nxg54jsio
* new upstream snapshot comprising many more GNOME libraries:
    Gtk, GDK, GLib, Pango, Atk, Libxml2, Cairo, Clutter, Gtkhtml, 
    GtkSourceView, Gio, Gtkspell and GConf. 
* new upstream release includes a new configure script written in Lua,
  no more bashisms there (Closes: #507205)
* renamed binary packages to liblua5.1-gnome-*
* updated standards-version to 3.8.1, no changes needed
* patch to load .so.* version of libraries and not .so (that was requiring
  -dev packages) (Closes: #522087)
* removed redundant Architecture line from the source stanza of control
  (Closes: #498120)
* updated copyright file, Wolfgang Oertl holds it for 2009 too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
require "gtk"
8
8
 
9
 
 
10
 
function quit()
11
 
    gtk.main_quit()
12
 
end
13
 
 
14
9
--
15
10
-- Destroy the button on click, and add a Quit button instead.
16
11
-- Note that a Window can only contain one child widget; to have two or more
23
16
    button = gtk.button_new_with_label("Quit")
24
17
    win:add(button)
25
18
    button:show()
26
 
    button:connect('clicked', quit)
 
19
    button:connect('clicked', gtk.main_quit)
27
20
end
28
21
 
29
22
-- Change the button on click; same effect as the above function.
30
23
function make_quit_button_b(button)
31
24
    button:set_label("Quit")
32
 
    button:connect('clicked', quit)
 
25
    button:connect('clicked', gtk.main_quit)
33
26
end
34
27
 
35
28
 
36
29
-- Create the main window.
37
 
win = gtk.window_new(gtk.GTK_WINDOW_TOPLEVEL)
 
30
win = gtk.window_new(gtk.WINDOW_TOPLEVEL)
38
31
win:set_title("Button Demo")
39
 
win:connect('destroy', quit)
 
32
win:connect('destroy', gtk.main_quit)
40
33
win:show()
41
34
 
42
35
-- a button that will destroy itself when clicked.