File: window.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 (49 lines) | stat: -rw-r--r-- 1,719 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
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="guide" style="task" id="window.js" xml:lang="fr">
  <info>
    <link type="guide" xref="beginner.js#windows"/>
    <revision version="0.1" date="2012-04-14" status="draft"/>

    <credit type="author copyright">
      <name>Taryn Fox</name>
      <email>jewelfox@fursona.net</email>
      <years>2012</years>
    </credit>

    <desc>A basic window which can contain other widgets</desc>
  </info>

  <title>Window</title>
  <media type="image" mime="image/png" src="media/window.png"/>
  <p>A plain window, without other widgets added to it.</p>
  
      <code mime="text/javascript" style="numbered"><![CDATA[
]]>#!/usr/bin/gjs

var Gtk = imports.gi.Gtk;
Gtk.init(null, 0);

// Create window and give it a name
// You can't call it "window" as that name is a JavaScript keyword.
var sampleWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
sampleWindow.title = "Welcome to GNOME";

/* The "destroy" signal is sent out when you click the X button.
   Here, we connect that signal to the GTK+ function to close the window. */
sampleWindow.connect("destroy", function(){Gtk.main_quit()});

/* Here are a few ways we can customize our window.
   Try uncommenting them or changing their values! */
// sampleWindow.set_default_size (400,200);
// sampleWindow.set_has_resize_grip (false);
// sampleWindow.set_opacity (0.5);
// sampleWindow.maximize ();

// If the window has widgets in it, you'll want to use show_all() instead.
sampleWindow.show();

Gtk.main();</code>
<p>
  In this sample we used the following widget: <link href="http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Window.html">Gtk.Window</link>
</p>
</page>