File: dialog.vala.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 (56 lines) | stat: -rw-r--r-- 1,929 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="guide" style="task" id="dialog.vala" xml:lang="el">
  <info>
    <link type="guide" xref="beginner.vala#windows"/>
    <revision version="0.1" date="2012-04-07" status="stub"/>

    <credit type="author copyright">
      <name>Tiffany Antopolski</name>
      <email>tiffany.antopolski@gmail.com</email>
      <years>2012</years>
    </credit>

    <desc>A popup window</desc>
  </info>

  <title>Dialog</title>
  <media type="image" mime="image/png" src="media/dialog.png"/>
  <p>A dialog with the response signal hooked up to a callback function.</p>
  
      <code mime="text/x-vala" style="numbered"><![CDATA[
void on_response (int response_id) {

    /*To see the int value of the ResponseType*/
    print ("response is %d\n", response_id);

    Gtk.main_quit ();
}

int main (string[] args) {

    Gtk.init (ref args);

    var dialog = new Gtk.Dialog.with_buttons ("A Gtk+ Dialog", null, 0, Gtk.Stock.OK, Gtk.ResponseType.OK, null);
    var content_area = dialog.get_content_area () as Gtk.Container; //TODO: explain this
    var label = new Gtk.Label ("This demonstrates a dialog with a label");

    content_area.add (label);
    dialog.response.connect (on_response);
    dialog.show_all ();

    Gtk.main ();
    return 0;
}
]]></code>

<p>
  In this sample we used the following:
</p>
<list>
  <item><p><link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Dialog">Gtk.Dialog</link></p></item>
  <item><p><link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Dialog.Dialog.with_buttons">Gtk.Dialog.with_buttons</link></p></item>
  <item><p><link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.Label">Gtk.Label</link></p></item>
  <item><p><link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Dialog.get_content_area">get_content_area</link></p></item>
  <item><p><link xref="response-type"/></p></item>
</list>
</page>