File: tour-gjs.page

package info (click to toggle)
gnome-devel-docs 3.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 46,300 kB
  • ctags: 630
  • sloc: xml: 2,321; ansic: 2,040; python: 1,807; makefile: 747; sh: 504; cpp: 131
file content (51 lines) | stat: -rw-r--r-- 1,874 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="tour-gjs" xml:lang="sv">

  <info>
    <link type="next" xref="tour-events"/>
    <revision version="0.1" date="2013-06-17" status="stub"/>

    <credit type="author copyright">
      <name>Ekaterina Gerasimova</name>
      <email its:translate="no">kittykat3756@gmail.com</email>
      <years>2013</years>
    </credit>
    <credit type="author copyright">
      <name>Gordon Hill</name>
      <email its:translate="no">caseyweederman@gmail.com</email>
      <years>2013</years>
    </credit>

    <include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>

    <desc>Include bindings necessary to run your script.</desc>
  </info>

  <title>Gjs and Gtk</title>
  <links type="prevnext" style="top"/>
  <links type="series" style="floatend">
    <title>Get started with GNOME</title>
  </links>

  <p><link href="https://wiki.gnome.org/Projects/Gjs">Gjs</link> is a
  JavaScript binding for GNOME and can be used to interact with Gtk. <link href="http://www.gtk.org/">Gtk</link> is a toolkit for creating graphical user
  interfaces.</p> <p>Open a text editor and paste in the lines of code. The
  complete script is available in the <link xref="tour-summary">Summary</link>.</p> <p>Create an <code>object</code> using
  your <code>class</code> and call the <code>run()</code> method:</p> <example>
  <p>Call the Gjs JavaScript binding. This instructs the shell to run this script
  with Gjs.</p>

  <code><![CDATA[
#!/usr/bin/gjs
]]></code>

  <p>Import <code>lang</code> for the <code>bind</code> function and
  <code>gi.Gtk</code> for <code>Gtk</code> functions.</p>

  <code><![CDATA[
const Lang = imports.lang;
const Gtk = imports.gi.Gtk;
]]></code>
</example>
  <links type="prevnext"/>
</page>