File: tour-gjs.page

package info (click to toggle)
gnome-devel-docs 40.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 79,188 kB
  • sloc: javascript: 2,514; xml: 2,407; ansic: 2,229; python: 1,854; makefile: 805; sh: 499; cpp: 131
file content (63 lines) | stat: -rw-r--r-- 2,674 bytes parent folder | download | duplicates (3)
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
57
58
59
60
61
62
63
<?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="pt-BR">

  <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>Inclua bindings necessários apra executar seu script.</desc>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Enrico Nicoletto</mal:name>
      <mal:email>liverig@gmail.com</mal:email>
      <mal:years>2009</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Rafael Fontenelle</mal:name>
      <mal:email>rafaelff@gnome.org</mal:email>
      <mal:years>2013, 2014, 2016, 2017</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Isaac Ferreira Filho</mal:name>
      <mal:email>isaacmob@riseup.net</mal:email>
      <mal:years>2018</mal:years>
    </mal:credit>
  </info>

  <title>Gjs e Gtk</title>
  <links type="prevnext" style="top"/>
  <links type="series" style="floatend">
    <title>Primeiros passos com GNOME</title>
  </links>

  <p><link href="https://wiki.gnome.org/Projects/Gjs">Gjs</link> é um binding JavaScript para o GNOME e pode ser usado para interagir com Gtk. <link href="http://www.gtk.org/">Gtk</link> é um kit de ferramentas para criação de interfaces de usuário gráficas.</p> <p>Abra um editor de texto e cole nas linhas do código. O script completo está disponível no <link xref="tour-summary">Resumo</link>.</p> <p>Crie um <code>object</code> usando sua <code>class</code> e chame o método <code>run()</code>:</p> <example>
  <p>Chame o binding JavaScript do Gjs. Isso instrui o shell a executar esse script com Gjs.</p>

  <code>
#!/usr/bin/gjs
</code>

  <p>Importe <code>gi.Gtk</code> para as funções <code>Gtk</code>. Ambas versões 3.0 e 4.0 podem ser instaladas, certifique-se de que a versão desejada seja importada primeiro.</p>

  <code>
imports.gi.versions.Gtk = '3.0';
const Gtk = imports.gi.Gtk;
</code>
</example>
  <links type="prevnext"/>
</page>