<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="guide" style="task" id="window.js" xml:lang="ca">
  <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>
