File: button.js.page

package info (click to toggle)
gnome-devel-docs 3.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 28,808 kB
  • sloc: xml: 101,979; sh: 625; makefile: 380; ansic: 340; cpp: 131; python: 80
file content (40 lines) | stat: -rw-r--r-- 1,234 bytes parent folder | download
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
34
35
36
37
38
39
40
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="guide" style="task" id="button.js" xml:lang="el">
  <info>
    <link type="guide" xref="beginner.js#buttons"/>
    <revision version="0.1" date="2012-02-21" status="stub"/>

    <credit type="author copyright">
      <name>Susanna Huhtanen</name>
      <email>ihmis.suski@gmail.com</email>
      <years>2012</years>
    </credit>

    <desc>A button widget which is connected to a progress bar</desc>
  </info>

  <title>Button widget</title>

  <media type="image" mime="image/png" src="media/button_with_progress_bar.png"/>
  <p>A button widget connected to a progress bar.</p>
  
      <code mime="text/javascript" style="numbered"><![CDATA[
#!/usr/bin/gjs
Gtk = imports.gi.Gtk;
Gtk.init(null, 0);
myW = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
myW.title = "Button";
myW.connect("destroy", function(){Gtk.main_quit()});
grid = new Gtk.Grid();
myW.add(grid);
this.pbar = new Gtk.ProgressBar();
function foo(){
  this.pbar.pulse();
}
var button = new Gtk.Button({label: "Button"});
button.connect("clicked", foo);
grid.attach(button, 1, 1, 1, 1);
grid.attach_next_to(pbar, button, 3,1,1);
myW.show_all();
Gtk.main();]]></code>
</page>