[gnome-devel-docs] Update Spanish translation
- From: Translations User D-L <translations src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Update Spanish translation
- Date: Tue, 12 Dec 2017 11:10:44 +0000 (UTC)
commit 304f77df5c9859c02a7183f8dd27a039abdf644a
Author: Daniel Mustieles <daniel mustieles gmail com>
Date: Tue Dec 12 11:10:33 2017 +0000
Update Spanish translation
platform-demos/es/es.po | 9236 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 6763 insertions(+), 2473 deletions(-)
---
diff --git a/platform-demos/es/es.po b/platform-demos/es/es.po
index f715930..f9758bf 100644
--- a/platform-demos/es/es.po
+++ b/platform-demos/es/es.po
@@ -10,8 +10,8 @@
msgid ""
msgstr ""
"Project-Id-Version: gnome-devel-docs.platform-demos.master\n"
-"POT-Creation-Date: 2017-08-05 10:04+0000\n"
-"PO-Revision-Date: 2017-08-31 13:14+0200\n"
+"POT-Creation-Date: 2017-12-04 19:32+0000\n"
+"PO-Revision-Date: 2017-12-12 12:07+0100\n"
"Last-Translator: Daniel Mustieles <daniel mustieles gmail com>\n"
"Language-Team: es <gnome-es-list gnome org>\n"
"Language: \n"
@@ -204,36 +204,45 @@ msgstr ""
"escribir el código básico plantilla que la aplicación requiere."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:43 C/comboboxtext.js.page:31
-#: C/textview.js.page:39
+#: C/02_welcome_to_the_grid.js.page:43
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
#. (itstool) path: section/p
#: C/02_welcome_to_the_grid.js.page:49
+#| msgid ""
+#| "This part always goes at the start of your code. Depending on what you'll "
+#| "be doing with it, you may want to declare more imports here. What we're "
+#| "writing today is pretty basic, so these are all we need; Gtk for the "
+#| "widgets, and Lang so we can use Lang.bind to connect our application's "
+#| "activate and startup signals to the requisite functions."
msgid ""
"This part always goes at the start of your code. Depending on what you'll be "
"doing with it, you may want to declare more imports here. What we're writing "
-"today is pretty basic, so these are all we need; Gtk for the widgets, and "
-"Lang so we can use Lang.bind to connect our application's activate and "
-"startup signals to the requisite functions."
+"today is pretty basic, so these are all we need; Gtk for the widgets, using "
+"the stable '3.0' API."
msgstr ""
"Esta parte siempre va al inicio del código. Dependiendo de qué va a hacer "
"con él, puede querer declarar más importaciones aquí. Este ejemplo es "
"bastante básico, por lo que esto es todo lo que necesita; «Gtk» para los "
-"widgets, y «Lang» para poder usar «Lang.bind» para conectar las señales de "
-"activación e inicio de la aplicación a las funciones requeridas."
+"widgets, usando la versión estable 3.0 de la API."
#. (itstool) path: section/p
#: C/02_welcome_to_the_grid.js.page:50
@@ -243,55 +252,71 @@ msgstr "Hablando de eso:"
#. (itstool) path: section/code
#: C/02_welcome_to_the_grid.js.page:51
#, no-wrap
-msgid ""
-"\n"
-"const WelcomeToTheGrid = new Lang.Class({\n"
-" Name: 'Welcome to the Grid',\n"
-"\n"
+#| msgid ""
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+msgid ""
+"\n"
+"class WelcomeToTheGrid {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
-"const WelcomeToTheGrid = new Lang.Class({\n"
-" Name: 'Welcome to the Grid',\n"
-"\n"
+"class WelcomeToTheGrid {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:74
+#: C/02_welcome_to_the_grid.js.page:72
msgid ""
"This is the start of the application itself, and the _init function which "
"creates it. It tells _buildUI to create an ApplicationWindow, which we're "
@@ -303,7 +328,7 @@ msgstr ""
"«_window», y le dice a la ventana que se presente cuando se la necesite."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:75
+#: C/02_welcome_to_the_grid.js.page:73
msgid ""
"This part, again, is pretty much copy-and-paste, but you always want to give "
"your application a unique name."
@@ -312,12 +337,23 @@ msgstr ""
"querrá darle a su aplicación un nombre único."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:77
+#: C/02_welcome_to_the_grid.js.page:75
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 10,\n"
+#| " title: \"Welcome to the Grid\"});\n"
msgid ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -328,7 +364,7 @@ msgid ""
msgstr ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -338,7 +374,7 @@ msgstr ""
" title: \"Welcome to the Grid\"});\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:88
+#: C/02_welcome_to_the_grid.js.page:86
msgid ""
"Finally, we start off the _buildUI function by creating a new "
"ApplicationWindow. We specify that it goes with this application, that it "
@@ -353,12 +389,12 @@ msgstr ""
"aparecerá en la parte superior de la ventana."
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:92
+#: C/02_welcome_to_the_grid.js.page:90
msgid "Reaching into the GTK+ toolbox"
msgstr "Usar la caja de herramientas de GTK+"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:93
+#: C/02_welcome_to_the_grid.js.page:91
msgid ""
"What widgets should we use? Well, let's say we want to write an application "
"that looks like this:"
@@ -371,7 +407,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:95
+#: C/02_welcome_to_the_grid.js.page:93
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_01.png' md5='3fdc22d361cf801f71557fdc76ae5b49'"
@@ -379,7 +415,7 @@ msgstr ""
"external ref='media/02_jsgrid_01.png' md5='3fdc22d361cf801f71557fdc76ae5b49'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:97
+#: C/02_welcome_to_the_grid.js.page:95
msgid ""
"We're going to need, at the very least, a picture and a text label to go "
"with it. Let's start with the picture:"
@@ -388,7 +424,7 @@ msgstr ""
"Comience con la imagen:"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:98
+#: C/02_welcome_to_the_grid.js.page:96
#, no-wrap
msgid ""
"\n"
@@ -400,7 +436,7 @@ msgstr ""
" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:103
+#: C/02_welcome_to_the_grid.js.page:101
msgid ""
"You can download the image file used in this example <link href=\"https://"
"live.gnome.org/TarynFox?action=AttachFile&do=get&target=gnome-image."
@@ -413,7 +449,7 @@ msgstr ""
"carpeta que el código que está escribiendo."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:105
+#: C/02_welcome_to_the_grid.js.page:103
#, no-wrap
msgid ""
"\n"
@@ -425,7 +461,7 @@ msgstr ""
" this._label = new Gtk.Label ({ label: \"Welcome to GNOME, too!\" });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:109
+#: C/02_welcome_to_the_grid.js.page:107
msgid ""
"That code adds in the label beneath. You can see how we create widgets, "
"here; each one is a part of Gtk, and we can give it properties that "
@@ -440,7 +476,7 @@ msgstr ""
"propiedad «label» de la etiqueta a la oración que se quiere bajo la imagen."
#. (itstool) path: note/p
-#: C/02_welcome_to_the_grid.js.page:110
+#: C/02_welcome_to_the_grid.js.page:108
msgid ""
"Yes, it sounds redundant for a Label to have a label property, but it's not. "
"Other widgets that contain text have a label property, so it's "
@@ -452,7 +488,7 @@ msgstr ""
"tenga una."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:111
+#: C/02_welcome_to_the_grid.js.page:109
msgid ""
"We can't just add these widgets to our window in order, though, the same way "
"HTML elements appear in the order you write them. That's because an "
@@ -463,7 +499,7 @@ msgstr ""
"Eso es porque una «ApplicationWindow» sólo puede contener un widget."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:112
+#: C/02_welcome_to_the_grid.js.page:110
msgid ""
"How do we get around that? By making that one widget a container widget, "
"which can hold more than one widget and organize them inside it. Behold: The "
@@ -473,7 +509,7 @@ msgstr ""
"puede contener más de un widget y organizarlos dentro. Observe la rejilla."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:113
+#: C/02_welcome_to_the_grid.js.page:111
#, no-wrap
msgid ""
"\n"
@@ -485,7 +521,7 @@ msgstr ""
" this._grid = new Gtk.Grid ();\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:118
+#: C/02_welcome_to_the_grid.js.page:116
msgid ""
"We're not giving it any properties yet. Those will come later, as we learn "
"how to use the Grid's powers. First, let's attach the Image and Label we "
@@ -496,7 +532,7 @@ msgstr ""
"imagen y la etiqueta que hizo."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:119
+#: C/02_welcome_to_the_grid.js.page:117
#, no-wrap
msgid ""
"\n"
@@ -510,7 +546,7 @@ msgstr ""
" this._grid.attach (this._label, 0, 1, 1, 1);\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:125
+#: C/02_welcome_to_the_grid.js.page:123
msgid ""
"This code looks awfully complicated, but it's not. Here's what those numbers "
"mean:"
@@ -519,7 +555,7 @@ msgstr ""
"esos números significan:"
#. (itstool) path: item/p
-#: C/02_welcome_to_the_grid.js.page:127
+#: C/02_welcome_to_the_grid.js.page:125
msgid ""
"The <em>first</em> number is what left-to-right position to put things in, "
"starting from 0. Any widget that uses a 0 here goes all the way to the left."
@@ -529,7 +565,7 @@ msgstr ""
"la izquierda."
#. (itstool) path: item/p
-#: C/02_welcome_to_the_grid.js.page:128
+#: C/02_welcome_to_the_grid.js.page:126
msgid ""
"The <em>second</em> number is what top-to-bottom position to put a given "
"widget in, starting from 0. The Label goes beneath the Image, so we give the "
@@ -540,7 +576,7 @@ msgstr ""
"que se le da a la imagen un 0 y a la etiqueta un 1 aquí."
#. (itstool) path: item/p
-#: C/02_welcome_to_the_grid.js.page:129
+#: C/02_welcome_to_the_grid.js.page:127
msgid ""
"The <em>third</em> and <em>fourth</em> numbers are how many columns and rows "
"a widget should take up. We'll see how these work in a minute."
@@ -549,8 +585,22 @@ msgstr ""
"debe ocupar un widget. Se verá cómo funciona esto en un minuto."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:132
+#: C/02_welcome_to_the_grid.js.page:130
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new WelcomeToTheGrid ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"\n"
" // Add the grid to the window\n"
@@ -560,7 +610,7 @@ msgid ""
" this._window.show_all();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new WelcomeToTheGrid ();\n"
@@ -574,14 +624,14 @@ msgstr ""
" this._window.show_all();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new WelcomeToTheGrid ();\n"
"app.application.run (ARGV);\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:146
+#: C/02_welcome_to_the_grid.js.page:144
msgid ""
"Now that we've created the Grid and attached all our widgets to it, we add "
"it to the window and tell the window to show itself, as the last part of the "
@@ -594,7 +644,7 @@ msgstr ""
"clase de la aplicación y se le dice que se ejecute."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:147
+#: C/02_welcome_to_the_grid.js.page:145
msgid ""
"Save your application as welcome_to_the_grid.js. Then, to run your "
"application just open a terminal, go to the directory where your application "
@@ -605,7 +655,7 @@ msgstr ""
"está, y escriba"
#. (itstool) path: section/screen
-#: C/02_welcome_to_the_grid.js.page:148
+#: C/02_welcome_to_the_grid.js.page:146
#, no-wrap
msgid " <output style=\"prompt\">$ </output>gjs welcome_to_the_grid.js "
msgstr " <output style=\"prompt\">$ </output>gjs welcome_to_the_grid.js "
@@ -615,7 +665,7 @@ msgstr " <output style=\"prompt\">$ </output>gjs welcome_to_the_grid.js "
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:150
+#: C/02_welcome_to_the_grid.js.page:148
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_02.png' md5='07db86b0043ba5c3c24a90d7322bd81e'"
@@ -623,7 +673,7 @@ msgstr ""
"external ref='media/02_jsgrid_02.png' md5='07db86b0043ba5c3c24a90d7322bd81e'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:152
+#: C/02_welcome_to_the_grid.js.page:150
msgid ""
"There we go! But wait. That doesn't look right. Why is the Label crammed up "
"next to the Image like that? That doesn't look as nice, and it makes it "
@@ -634,12 +684,12 @@ msgstr ""
"hacer acerca de esto?"
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:156
+#: C/02_welcome_to_the_grid.js.page:154
msgid "Tweaking the Grid"
msgstr "Configurar la rejilla"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:158
+#: C/02_welcome_to_the_grid.js.page:156
msgid ""
"One thing we can do, is we can give the Label a margin_top property when we "
"create it. This works sort of like setting a margin for an HTML element "
@@ -650,7 +700,7 @@ msgstr ""
"un elemento HTML usando estilos CSS en línea."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:159
+#: C/02_welcome_to_the_grid.js.page:157
#, no-wrap
msgid ""
"\n"
@@ -666,7 +716,7 @@ msgstr ""
" margin_top: 20 });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:166
+#: C/02_welcome_to_the_grid.js.page:164
msgid ""
"Of course, if we do that then if we replace the Label with something else -- "
"or add in another widget -- then we have to repeat the margin_top on it too. "
@@ -681,7 +731,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:167
+#: C/02_welcome_to_the_grid.js.page:165
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_03.png' md5='817351e73c687d47253c56ed06b6629f'"
@@ -689,7 +739,7 @@ msgstr ""
"external ref='media/02_jsgrid_03.png' md5='817351e73c687d47253c56ed06b6629f'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:169
+#: C/02_welcome_to_the_grid.js.page:167
msgid ""
"We could give the Image a margin_bottom property, but that won't work when "
"the new Label is in a separate column. So how about we try this instead:"
@@ -699,7 +749,7 @@ msgstr ""
"probar esto:"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:170
+#: C/02_welcome_to_the_grid.js.page:168
#, no-wrap
msgid ""
"\n"
@@ -713,7 +763,7 @@ msgstr ""
" row_spacing: 20 });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:176
+#: C/02_welcome_to_the_grid.js.page:174
msgid ""
"That makes it so that there are always 20 pixels of space in between each "
"horizontal row."
@@ -721,7 +771,7 @@ msgstr ""
"Eso hace que siempre hayan 20 píxeles de espacio entre cada fila horizontal."
#. (itstool) path: note/p
-#: C/02_welcome_to_the_grid.js.page:177
+#: C/02_welcome_to_the_grid.js.page:175
msgid ""
"Yes, you can also set the column_spacing property on a Grid, or the "
"margin_left and margin_right properties on any widget. Try them out, if you "
@@ -732,12 +782,12 @@ msgstr ""
"Pruébelas, si quiere."
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:181
+#: C/02_welcome_to_the_grid.js.page:179
msgid "Adding more widgets"
msgstr "Añadir más widgets"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:183
+#: C/02_welcome_to_the_grid.js.page:181
msgid ""
"If we did want to add a second Label, how would we do it so that it actually "
"looked like it belonged there? One way is to center the Image on top, so "
@@ -751,7 +801,7 @@ msgstr ""
"rejilla entran:"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:184
+#: C/02_welcome_to_the_grid.js.page:182
#, no-wrap
msgid ""
"\n"
@@ -775,7 +825,7 @@ msgstr ""
" this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:195
+#: C/02_welcome_to_the_grid.js.page:193
msgid ""
"After we create the second Label, we attach it to the Grid to the right of "
"the first Label. Remember, the first two numbers count columns and rows from "
@@ -790,7 +840,7 @@ msgstr ""
"segunda en la columna 1 y fila 1 para ponerla a la derecha de la primera."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:196
+#: C/02_welcome_to_the_grid.js.page:194
msgid ""
"Note the number 2 in the attach statement for the Image. That's what does "
"the trick here. That number is how many columns the Image spans, remember? "
@@ -805,7 +855,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:197
+#: C/02_welcome_to_the_grid.js.page:195
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_04.png' md5='eeaead27cee2851877fc3cfe66177f07'"
@@ -813,12 +863,12 @@ msgstr ""
"external ref='media/02_jsgrid_04.png' md5='eeaead27cee2851877fc3cfe66177f07'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:199
+#: C/02_welcome_to_the_grid.js.page:197
msgid "There are two things you should take note of, here."
msgstr "Hay dos cosas de las que debe tomar nota, aquí."
#. (itstool) path: item/p
-#: C/02_welcome_to_the_grid.js.page:201
+#: C/02_welcome_to_the_grid.js.page:199
msgid ""
"Setting the Image to span two columns doesn't stretch the picture itself "
"horizontally. Instead, it stretches the invisible box taken up by the Image "
@@ -830,7 +880,7 @@ msgstr ""
"centro de esa caja."
#. (itstool) path: item/p
-#: C/02_welcome_to_the_grid.js.page:202
+#: C/02_welcome_to_the_grid.js.page:200
msgid ""
"Even though we've set the Grid's row_spacing and the ApplicationWindow's "
"border_width properties, we haven't yet set anything that puts a border in "
@@ -845,7 +895,7 @@ msgstr ""
"ahora que ocupa ambas GNOME no ve una razón para mantenerlas separadas."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:205
+#: C/02_welcome_to_the_grid.js.page:203
msgid ""
"There are at least three ways we can get around that last one. First, we can "
"set a margin_left or margin_right on one of the Labels:"
@@ -858,7 +908,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:206
+#: C/02_welcome_to_the_grid.js.page:204
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_05.png' md5='a3ad12f432d5977fc1f66302ad5b7498'"
@@ -866,14 +916,14 @@ msgstr ""
"external ref='media/02_jsgrid_05.png' md5='a3ad12f432d5977fc1f66302ad5b7498'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:208
+#: C/02_welcome_to_the_grid.js.page:206
msgid "Second, we can set the Grid's column_homogeneous property to true."
msgstr ""
"Segundo, se puede establecer la propiedad «column_homogenous» de la rejilla "
"a «true»."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:209
+#: C/02_welcome_to_the_grid.js.page:207
#, no-wrap
msgid ""
"\n"
@@ -889,7 +939,7 @@ msgstr ""
" row_spacing: 20 });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:216
+#: C/02_welcome_to_the_grid.js.page:214
msgid "That makes it look something like this:"
msgstr "Eso hace que se vea algo así:"
@@ -898,7 +948,7 @@ msgstr "Eso hace que se vea algo así:"
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:217
+#: C/02_welcome_to_the_grid.js.page:215
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_06.png' md5='450e48dbf6b8f5ce1c208e4812e1714b'"
@@ -906,7 +956,7 @@ msgstr ""
"external ref='media/02_jsgrid_06.png' md5='450e48dbf6b8f5ce1c208e4812e1714b'"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:219
+#: C/02_welcome_to_the_grid.js.page:217
msgid ""
"And third, we can set the Grid's column_spacing property, the same way we "
"set its row_spacing."
@@ -915,7 +965,7 @@ msgstr ""
"de la misma manera que «row_spacing»."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:220
+#: C/02_welcome_to_the_grid.js.page:218
#, no-wrap
msgid ""
"\n"
@@ -931,7 +981,7 @@ msgstr ""
" row_spacing: 20 });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:226
+#: C/02_welcome_to_the_grid.js.page:224
msgid "That makes it look like this:"
msgstr "Esto hace que se vea así:"
@@ -940,7 +990,7 @@ msgstr "Esto hace que se vea así:"
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:227
+#: C/02_welcome_to_the_grid.js.page:225
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_07.png' md5='0b304d70728903fbb2601d55bf00fdb9'"
@@ -948,12 +998,12 @@ msgstr ""
"external ref='media/02_jsgrid_07.png' md5='0b304d70728903fbb2601d55bf00fdb9'"
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:231
+#: C/02_welcome_to_the_grid.js.page:229
msgid "Using stock images"
msgstr "Usar imágenes del almacén"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:233
+#: C/02_welcome_to_the_grid.js.page:231
msgid ""
"GNOME has a lot of stock images on hand already, that we can use if we don't "
"feel like creating our own or if we want a universally-recognized icon. "
@@ -965,7 +1015,7 @@ msgstr ""
"normal:"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:234
+#: C/02_welcome_to_the_grid.js.page:232
#, no-wrap
msgid ""
"\n"
@@ -983,7 +1033,7 @@ msgstr ""
" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:241
+#: C/02_welcome_to_the_grid.js.page:239
msgid ""
"After that, we attach it to the Grid to the left of the first Label. (We "
"aren't using the second one for this example.)"
@@ -992,7 +1042,7 @@ msgstr ""
"(todavía no se usa la segunda en este ejemplo)."
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:242
+#: C/02_welcome_to_the_grid.js.page:240
#, no-wrap
msgid ""
"\n"
@@ -1008,7 +1058,7 @@ msgstr ""
" this._grid.attach (this._label, 1, 1, 1, 1);\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:248
+#: C/02_welcome_to_the_grid.js.page:246
msgid "That gives us this, when we run it:"
msgstr "Eso da esto, cuando se ejecuta:"
@@ -1017,7 +1067,7 @@ msgstr "Eso da esto, cuando se ejecuta:"
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/02_welcome_to_the_grid.js.page:249
+#: C/02_welcome_to_the_grid.js.page:247
msgctxt "_"
msgid ""
"external ref='media/02_jsgrid_08.png' md5='78890beb47bd11360154b8ca4d50d1ff'"
@@ -1027,7 +1077,7 @@ msgstr ""
# Dejo las comillas "" porque así están en la página citada (que no está disponible en castellano,
aparentemente).
# Nicolás.
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:251
+#: C/02_welcome_to_the_grid.js.page:249
msgid ""
"That's what the stock \"About\" icon looks like. You can see a list of all "
"the stock items starting with gtk-about in <link href=\"https://developer."
@@ -1045,7 +1095,7 @@ msgstr ""
"usar el icono junto a ella."
#. (itstool) path: note/p
-#: C/02_welcome_to_the_grid.js.page:252
+#: C/02_welcome_to_the_grid.js.page:250
msgid ""
"We put single quotes around 'gtk-about' here because, unlike text strings "
"that have double quotes around them, that part will never need to be "
@@ -1060,20 +1110,20 @@ msgstr ""
"en el que habla."
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:257 C/03_getting_the_signal.js.page:338
+#: C/02_welcome_to_the_grid.js.page:255 C/03_getting_the_signal.js.page:336
#: C/hellognome.js.page:187
msgid "What's next?"
msgstr "¿Qué viene ahora?"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:258
+#: C/02_welcome_to_the_grid.js.page:256
msgid ""
"Before we go on to the next tutorial, let's try something a little different:"
msgstr ""
"Antes de continuar con el siguiente tutorial, intente algo un poco diferente:"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:259
+#: C/02_welcome_to_the_grid.js.page:257
#, no-wrap
msgid ""
"\n"
@@ -1097,7 +1147,7 @@ msgstr ""
" this._grid.attach (this._button, 1, 1, 1, 1);\n"
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:270
+#: C/02_welcome_to_the_grid.js.page:268
msgid ""
"That's right, we turned the Label into a Button just by changing the name! "
"If you run the application and click on it, though, you'll find that it "
@@ -1111,7 +1161,7 @@ msgstr ""
"<link xref=\"03_getting_the_signal.js\">el próximo tutorial</link>."
#. (itstool) path: section/p
-#: C/02_welcome_to_the_grid.js.page:271
+#: C/02_welcome_to_the_grid.js.page:269
msgid ""
"If you like, feel free to spend some time experimenting with Grids, Labels, "
"and Images, including stock images."
@@ -1120,7 +1170,7 @@ msgstr ""
"imágenes, incluyendo imágenes del almacén."
#. (itstool) path: note/p
-#: C/02_welcome_to_the_grid.js.page:272
+#: C/02_welcome_to_the_grid.js.page:270
msgid ""
"One trick you can use to make more complex layouts is to nest Grids inside "
"of each other. This lets you group together related widgets, and rearrange "
@@ -1134,7 +1184,7 @@ msgstr ""
"ver cómo se hace esto."
#. (itstool) path: section/title
-#: C/02_welcome_to_the_grid.js.page:276 C/checkbutton.js.page:131
+#: C/02_welcome_to_the_grid.js.page:274 C/checkbutton.js.page:130
#: C/comboboxtext.js.page:171 C/combobox.js.page:228 C/hellognome.js.page:194
#: C/messagedialog.js.page:184 C/radiobutton.js.page:269 C/scale.js.page:203
#: C/spinbutton.js.page:194 C/statusbar.js.page:216 C/switch.js.page:259
@@ -1144,40 +1194,124 @@ msgid "Complete code sample"
msgstr "Código de ejemplo completo"
#. (itstool) path: section/code
-#: C/02_welcome_to_the_grid.js.page:277
+#: C/02_welcome_to_the_grid.js.page:275
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const WelcomeToTheGrid = new Lang.Class({\n"
+#| " Name: 'Welcome to the Grid',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 10,\n"
+#| " title: \"Welcome to the Grid\"});\n"
+#| "\n"
+#| " // Create the Grid\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " // column_homogeneous: true,\n"
+#| " // column_spacing: 20,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Create an image\n"
+#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n"
+#| "\n"
+#| " // Create a second image using a stock icon\n"
+#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n"
+#| "\n"
+#| " // Create a label\n"
+#| " this._label = new Gtk.Label ({\n"
+#| " label: \"Welcome to GNOME, too!\",\n"
+#| " /* margin_top: 20 */ });\n"
+#| "\n"
+#| " /* Create a second label\n"
+#| " this._labelTwo = new Gtk.Label ({\n"
+#| " label: \"The cake is a pie.\" }); */\n"
+#| "\n"
+#| " /* Create a button\n"
+#| " this._button = new Gtk.Button ({\n"
+#| " label: \"Welcome to GNOME, too!\"}); */\n"
+#| "\n"
+#| " // Attach the images and button to the grid\n"
+#| " this._grid.attach (this._image, 0, 0, 2, 1);\n"
+#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n"
+#| " this._grid.attach (this._label, 1, 1, 1, 1);\n"
+#| "\n"
+#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n"
+#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n"
+#| "\n"
+#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new WelcomeToTheGrid ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const WelcomeToTheGrid = new Lang.Class({\n"
-" Name: 'Welcome to the Grid',\n"
+"class WelcomeToTheGrid {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -1228,7 +1362,7 @@ msgid ""
" this._window.show_all();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new WelcomeToTheGrid ();\n"
@@ -1236,35 +1370,32 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const WelcomeToTheGrid = new Lang.Class({\n"
-" Name: 'Welcome to the Grid',\n"
+"class WelcomeToTheGrid {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -1315,7 +1446,7 @@ msgstr ""
" this._window.show_all();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new WelcomeToTheGrid ();\n"
@@ -1385,7 +1516,7 @@ msgstr "Aquí hay un ejemplo extremadamente básico:"
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/03_getting_the_signal.js.page:37 C/03_getting_the_signal.js.page:351
+#: C/03_getting_the_signal.js.page:37 C/03_getting_the_signal.js.page:349
msgctxt "_"
msgid ""
"external ref='media/03_jssignal_01.png' "
@@ -1437,91 +1568,123 @@ msgstr ""
#. (itstool) path: section/code
#: C/03_getting_the_signal.js.page:42
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "// We start out with 0 cookies\n"
+#| "var cookies = 0;\n"
+#| "\n"
+#| "const GettingTheSignal = new Lang.Class({\n"
+#| " Name: 'Getting the Signal',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
-"\n"
+"class GettingTheSignal {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
-"\n"
+"class GettingTheSignal {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:73
+#: C/03_getting_the_signal.js.page:71
+#| msgid ""
+#| "Take a look at the part that uses our application's connect method and "
+#| "Lang.bind, to connect its activate and startup signals to the functions "
+#| "that present the window and build the UI. We're going to do the same "
+#| "thing with our Button when we get to it, except that we're going to "
+#| "connect its \"clicked\" signal instead."
msgid ""
-"Take a look at the part that uses our application's connect method and Lang."
-"bind, to connect its activate and startup signals to the functions that "
-"present the window and build the UI. We're going to do the same thing with "
-"our Button when we get to it, except that we're going to connect its "
-"\"clicked\" signal instead."
+"Take a look at the part that uses our application's connect method and bind, "
+"to connect its activate and startup signals to the functions that present "
+"the window and build the UI. We're going to do the same thing with our "
+"Button when we get to it, except that we're going to connect its \"clicked\" "
+"signal instead."
msgstr ""
"Eche un vistazo a la parte que usa el método «connect» de la aplicación y "
-"«Lang.bind», para conectar sus señales «activate» y «startup» a las "
-"funciones que presentan la ventana y construyen la IU. Va a hacer lo mismo "
-"con el botón cuando llegue a él, excepto que conectará la señal «clicked» en "
-"su lugar."
+"«bind», para conectar sus señales «activate» y «startup» a las funciones que "
+"presentan la ventana y construyen la IU. Va a hacer lo mismo con el botón "
+"cuando llegue a él, excepto que conectará la señal «clicked» en su lugar."
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:77
+#: C/03_getting_the_signal.js.page:75
msgid "Click the button"
msgstr "Pulsar el botón"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:79
+#: C/03_getting_the_signal.js.page:77
msgid ""
"As usual, we'll put all the code to create our Button and other widgets "
"inside the _buildUI function, which is called when the application starts up."
@@ -1531,24 +1694,28 @@ msgstr ""
"arranca."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:80
+#: C/03_getting_the_signal.js.page:78
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
msgid ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
msgstr ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:85
+#: C/03_getting_the_signal.js.page:83
msgid "First, we create the window itself:"
msgstr "Primero, se crea la ventana en sí:"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:86
+#: C/03_getting_the_signal.js.page:84
#, no-wrap
msgid ""
"\n"
@@ -1570,7 +1737,7 @@ msgstr ""
" title: \"Click the button to get a cookie!\"});\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:95
+#: C/03_getting_the_signal.js.page:93
msgid ""
"Note that we've set its default_height and default_width properties. These "
"let us control how tall and wide the ApplicationWindow will be, in pixels."
@@ -1580,7 +1747,7 @@ msgstr ""
"«ApplicationWindow», en píxeles."
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:96
+#: C/03_getting_the_signal.js.page:94
msgid ""
"Next, we'll create the Label that shows us the number of cookies. We can use "
"the cookies variable as part of the Label's label property."
@@ -1590,7 +1757,7 @@ msgstr ""
"la etiqueta."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:97
+#: C/03_getting_the_signal.js.page:95
#, no-wrap
msgid ""
"\n"
@@ -1604,7 +1771,7 @@ msgstr ""
" label: \"Number of cookies: \" + cookies });\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:103
+#: C/03_getting_the_signal.js.page:101
msgid ""
"Now we'll create the Button. We set its label property to show the text that "
"we want on the Button, and we connect its \"clicked\" signal to a function "
@@ -1617,25 +1784,32 @@ msgstr ""
"la IU de la aplicación."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:104
+#: C/03_getting_the_signal.js.page:102
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Create the cookie button\n"
+#| " this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
+#| "\n"
+#| " // Connect the cookie button to the function that handles clicking it\n"
+#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
msgid ""
"\n"
" // Create the cookie button\n"
" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
msgstr ""
"\n"
" // Create the cookie button\n"
" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:111
+#: C/03_getting_the_signal.js.page:109
msgid ""
"Finally, we create a Grid, attach the Label and Button to it, add it to the "
"window and tell the window to show itself and its contents. That's all we "
@@ -1653,8 +1827,27 @@ msgstr ""
"tal que quede en la parte inferior."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:112
+#: C/03_getting_the_signal.js.page:110
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Create a grid to arrange everything inside\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Put everything inside the grid\n"
+#| " this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| "\n"
+#| " },\n"
msgid ""
"\n"
" // Create a grid to arrange everything inside\n"
@@ -1673,7 +1866,7 @@ msgid ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
" // Create a grid to arrange everything inside\n"
@@ -1692,10 +1885,10 @@ msgstr ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:131
+#: C/03_getting_the_signal.js.page:129
msgid ""
"Now, we write the _getACookie function. Whenever our Button sends out its "
"\"clicked\" signal, the code in this function will run. In this case, all it "
@@ -1709,7 +1902,7 @@ msgstr ""
"«set_label» de la etiqueta."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:132
+#: C/03_getting_the_signal.js.page:130
msgid ""
"Many widgets have the same properties and methods. Both Labels and Buttons, "
"for instance, have a label property that says what text is inside them, and "
@@ -1725,8 +1918,19 @@ msgstr ""
"similares."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:133
+#: C/03_getting_the_signal.js.page:131
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
msgid ""
"\n"
" _getACookie: function() {\n"
@@ -1737,7 +1941,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
msgstr ""
"\n"
" _getACookie: function() {\n"
@@ -1748,10 +1952,10 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:145
+#: C/03_getting_the_signal.js.page:143
msgid ""
"Finally, we run the application, using the same kind of code as in our last "
"tutorial."
@@ -1760,7 +1964,7 @@ msgstr ""
"el tutorial anterior."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:146
+#: C/03_getting_the_signal.js.page:144
#, no-wrap
msgid ""
"\n"
@@ -1774,12 +1978,12 @@ msgstr ""
"app.application.run (ARGV);\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:154
+#: C/03_getting_the_signal.js.page:152
msgid "Flip the switch"
msgstr "Pulsar el interruptor"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:155
+#: C/03_getting_the_signal.js.page:153
msgid ""
"Buttons aren't the only input widgets in our GTK+ toolbox. We can also use "
"switches, like the one in this example. Switches don't have a label "
@@ -1796,7 +2000,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/03_getting_the_signal.js.page:157 C/03_getting_the_signal.js.page:357
+#: C/03_getting_the_signal.js.page:155 C/03_getting_the_signal.js.page:355
msgctxt "_"
msgid ""
"external ref='media/03_jssignal_02.png' "
@@ -1806,7 +2010,7 @@ msgstr ""
"md5='ba941390fbafc4a0f653c8f70bca92c0'"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:159
+#: C/03_getting_the_signal.js.page:157
msgid ""
"A Switch has two positions, Off and On. When a Switch is turned on, its text "
"and background color change, so you can tell which position it's in."
@@ -1816,7 +2020,7 @@ msgstr ""
"qué posición está."
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:161
+#: C/03_getting_the_signal.js.page:159
msgid ""
"You may have seen Switches like these in GNOME's accessibility menu, which "
"let you turn features like large text and the on-screen keyboard on and off. "
@@ -1832,7 +2036,7 @@ msgstr ""
"no hará nada."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:162
+#: C/03_getting_the_signal.js.page:160
msgid ""
"You can get to the accessibility menu by clicking on the outline of a human, "
"near your name in the upper-right corner of the screen."
@@ -1841,12 +2045,12 @@ msgstr ""
"cerca de su nombre en la esquina superior derecha de la pantalla."
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:163
+#: C/03_getting_the_signal.js.page:161
msgid "Here's how we create the Switch:"
msgstr "Aquí se muestra cómo crear el interruptor:"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:164
+#: C/03_getting_the_signal.js.page:162
#, no-wrap
msgid ""
"\n"
@@ -1858,7 +2062,7 @@ msgstr ""
" this._cookieSwitch = new Gtk.Switch ();\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:169
+#: C/03_getting_the_signal.js.page:167
msgid ""
"We don't actually need to connect the Switch to anything. All we need to do "
"is write an if statement in our _getACookie function, to check to see if the "
@@ -1872,19 +2076,23 @@ msgstr ""
"«notify::active», así:"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:170
+#: C/03_getting_the_signal.js.page:168
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Connect the switch to the function that handles it\n"
+#| " this._cookieSwitch.connect ('notify::active', Lang.bind (this, this._cookieDispenser));\n"
msgid ""
"\n"
" // Connect the switch to the function that handles it\n"
-" this._cookieSwitch.connect ('notify::active', Lang.bind (this, this._cookieDispenser));\n"
+" this._cookieSwitch.connect ('notify::active', this._cookieDispenser.bind(this));\n"
msgstr ""
"\n"
" // Connect the switch to the function that handles it\n"
-" this._cookieSwitch.connect ('notify::active', Lang.bind (this, this._cookieDispenser));\n"
+" this._cookieSwitch.connect ('notify::active', this._cookieDispenser.bind(this));\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:175
+#: C/03_getting_the_signal.js.page:173
msgid ""
"A Switch is set to the off position by default. If we wanted the Switch to "
"start out turned on, we would set the value of its active property to true "
@@ -1895,7 +2103,7 @@ msgstr ""
"«active» a «true» cuando lo crea."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:176
+#: C/03_getting_the_signal.js.page:174
#, no-wrap
msgid ""
"\n"
@@ -1905,7 +2113,7 @@ msgstr ""
" this._cookieSwitch = new Gtk.Switch ({ active: true });\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:180
+#: C/03_getting_the_signal.js.page:178
msgid ""
"Let's just create it normally, though, and then create the Label that goes "
"with it. We want the Switch and the Label to be kept right next to each "
@@ -1920,7 +2128,7 @@ msgstr ""
"cómo se ve el código para crear todo eso:"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:181
+#: C/03_getting_the_signal.js.page:179
#, no-wrap
msgid ""
"\n"
@@ -1958,12 +2166,12 @@ msgstr ""
" this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:199
+#: C/03_getting_the_signal.js.page:197
msgid "And now we arrange everything in the larger Grid like so."
msgstr "Y ahora se organiza todo en la rejilla más grande así."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:200
+#: C/03_getting_the_signal.js.page:198
#, no-wrap
msgid ""
"\n"
@@ -1979,7 +2187,7 @@ msgstr ""
" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:207
+#: C/03_getting_the_signal.js.page:205
msgid ""
"Now we change the _getACookie function so that it checks to see if the "
"cookie dispenser is turned on. We do that by using the Switch's get_active "
@@ -1992,7 +2200,7 @@ msgstr ""
"si está apagado."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:208
+#: C/03_getting_the_signal.js.page:206
msgid ""
"When a method is used in an if statement like this, the code inside the if "
"statement is executed if the method returns true."
@@ -2001,11 +2209,25 @@ msgstr ""
"de la declaración «if» se ejecuta si el método devuelve «true»."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:209
+#: C/03_getting_the_signal.js.page:207
#, no-wrap
-msgid ""
-"\n"
-" _getACookie: function() {\n"
+#| msgid ""
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Is the cookie dispenser turned on?\n"
+#| " if (this._cookieSwitch.get_active()) {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+msgid ""
+"\n"
+" _getACookie() {\n"
"\n"
" // Is the cookie dispenser turned on?\n"
" if (this._cookieSwitch.get_active()) {\n"
@@ -2019,7 +2241,7 @@ msgid ""
" }\n"
msgstr ""
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Is the cookie dispenser turned on?\n"
" if (this._cookieSwitch.get_active()) {\n"
@@ -2033,12 +2255,12 @@ msgstr ""
" }\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:227
+#: C/03_getting_the_signal.js.page:225
msgid "Tuning the radio"
msgstr "Sintonizar la radio"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:229
+#: C/03_getting_the_signal.js.page:227
msgid ""
"Another type of input widget we can use is called the RadioButton. You "
"create them in groups, and then only one RadioButton in a group can be "
@@ -2059,7 +2281,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/03_getting_the_signal.js.page:231 C/03_getting_the_signal.js.page:363
+#: C/03_getting_the_signal.js.page:229 C/03_getting_the_signal.js.page:361
msgctxt "_"
msgid ""
"external ref='media/03_jssignal_03.png' "
@@ -2069,7 +2291,7 @@ msgstr ""
"md5='49ecf251b0bf57543c8d79a77b6f306d'"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:233
+#: C/03_getting_the_signal.js.page:231
msgid ""
"First off, let's change our ApplicationWindow's name and increase its "
"border_width property, so that our widgets aren't packed in too tightly. The "
@@ -2082,7 +2304,7 @@ msgstr ""
"y el borde de la ventana."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:234
+#: C/03_getting_the_signal.js.page:232
#, no-wrap
msgid ""
"\n"
@@ -2106,7 +2328,7 @@ msgstr ""
" title: \"Choose the one that says 'cookie'!\"});\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:245
+#: C/03_getting_the_signal.js.page:243
msgid ""
"After that, we create the RadioButtons. Remember how they're created in "
"groups? The way we do that, is we set each new RadioButton's group property "
@@ -2117,7 +2339,7 @@ msgstr ""
"radio al nombre de otro."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:246
+#: C/03_getting_the_signal.js.page:244
#, no-wrap
msgid ""
"\n"
@@ -2137,7 +2359,7 @@ msgstr ""
" group: this._cookieRadio });\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:255
+#: C/03_getting_the_signal.js.page:253
msgid ""
"Next, we create a Grid for the RadioButtons. Remember, we don't have to "
"arrange things in Grids in the same order that we create them in."
@@ -2146,7 +2368,7 @@ msgstr ""
"es necesario ordenar cosas en rejillas en el mismo orden que se crean."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:256
+#: C/03_getting_the_signal.js.page:254
#, no-wrap
msgid ""
"\n"
@@ -2164,7 +2386,7 @@ msgstr ""
" this._radioGrid.attach (this._notCookieTwo, 0, 2, 1, 1);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:264
+#: C/03_getting_the_signal.js.page:262
msgid ""
"Normally, the RadioButton that's selected by default is the one that's the "
"name of the group. We want the first \"Not cookie\" button to be selected by "
@@ -2176,13 +2398,13 @@ msgstr ""
"que se usa su método «set_active»."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:265
+#: C/03_getting_the_signal.js.page:263
msgid "We could also set its active property to true when we create it."
msgstr ""
"También se podría establecer su propiedad «active» a «true» cuando se crea."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:266
+#: C/03_getting_the_signal.js.page:264
#, no-wrap
msgid ""
"\n"
@@ -2194,12 +2416,12 @@ msgstr ""
" this._notCookieOne.set_active (true);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:271
+#: C/03_getting_the_signal.js.page:269
msgid "Now we arrange everything in our main Grid like usual ..."
msgstr "Ahora se organiza todo en la rejilla principal como siempre…"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:272
+#: C/03_getting_the_signal.js.page:270
#, no-wrap
msgid ""
"\n"
@@ -2215,7 +2437,7 @@ msgstr ""
" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:279
+#: C/03_getting_the_signal.js.page:277
msgid ""
"And then we change our _getACookie function to test to see if the cookie "
"button is the one that's selected."
@@ -2224,11 +2446,25 @@ msgstr ""
"galleta es el que está seleccionado."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:280
+#: C/03_getting_the_signal.js.page:278
#, no-wrap
-msgid ""
-"\n"
-" _getACookie: function() {\n"
+#| msgid ""
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Did you select \"cookie\" instead of \"not cookie\"?\n"
+#| " if (this._cookieRadio.get_active()) {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+msgid ""
+"\n"
+" _getACookie() {\n"
"\n"
" // Did you select \"cookie\" instead of \"not cookie\"?\n"
" if (this._cookieRadio.get_active()) {\n"
@@ -2242,7 +2478,7 @@ msgid ""
" }\n"
msgstr ""
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you select \"cookie\" instead of \"not cookie\"?\n"
" if (this._cookieRadio.get_active()) {\n"
@@ -2256,12 +2492,12 @@ msgstr ""
" }\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:298
+#: C/03_getting_the_signal.js.page:296
msgid "Can you spell \"cookie\"?"
msgstr "¿Puede deletrear «cookie»?"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:300
+#: C/03_getting_the_signal.js.page:298
msgid ""
"The last input widget we're going to cover is the Entry widget, which is "
"used for single-line text entry."
@@ -2270,7 +2506,7 @@ msgstr ""
"usa para entrada de texto de una sola línea."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:301
+#: C/03_getting_the_signal.js.page:299
msgid ""
"If you need to be able to enter in a whole paragraph or more, like if you "
"are building a text editor, you'll want to look at the much more "
@@ -2285,7 +2521,7 @@ msgstr ""
#. the file changes, the md5 hash will change to let you know you need to
#. update your localized copy. The msgstr is not used at all. Set it to
#. whatever you like once you have updated your copy of the file.
-#: C/03_getting_the_signal.js.page:302 C/03_getting_the_signal.js.page:369
+#: C/03_getting_the_signal.js.page:300 C/03_getting_the_signal.js.page:367
msgctxt "_"
msgid ""
"external ref='media/03_jssignal_04.png' "
@@ -2295,12 +2531,12 @@ msgstr ""
"md5='dfc5221ca15ca9fba7d3c76a73804e2d'"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:304
+#: C/03_getting_the_signal.js.page:302
msgid "After we change the window's name, we create the Entry widget."
msgstr "Después de cambiar el nombre de la ventana, se crea el widget «Entry»."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:305
+#: C/03_getting_the_signal.js.page:303
#, no-wrap
msgid ""
"\n"
@@ -2312,12 +2548,12 @@ msgstr ""
" this._spellCookie = new Gtk.Entry ();\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:310
+#: C/03_getting_the_signal.js.page:308
msgid "Next, we arrange everything in the Grid ..."
msgstr "A continuación, se organiza todo en la rejilla…"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:311
+#: C/03_getting_the_signal.js.page:309
#, no-wrap
msgid ""
"\n"
@@ -2333,7 +2569,7 @@ msgstr ""
" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:318
+#: C/03_getting_the_signal.js.page:316
msgid ""
"And now we modify _getACookie's if statement again, using the Entry's "
"get_text method to retrieve the text that you entered into it and see if you "
@@ -2349,7 +2585,7 @@ msgstr ""
"declaración «if»."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:319
+#: C/03_getting_the_signal.js.page:317
msgid ""
"An Entry widget doesn't have a label property, which is a set text string "
"that the user can't change. (You can't normally change the label on a "
@@ -2362,11 +2598,25 @@ msgstr ""
"que cambia de acuerdo a lo que el usuario introduce."
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:320
+#: C/03_getting_the_signal.js.page:318
#, no-wrap
-msgid ""
-"\n"
-" _getACookie: function() {\n"
+#| msgid ""
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Did you spell \"cookie\" correctly?\n"
+#| " if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+msgid ""
+"\n"
+" _getACookie() {\n"
"\n"
" // Did you spell \"cookie\" correctly?\n"
" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
@@ -2380,7 +2630,7 @@ msgid ""
" }\n"
msgstr ""
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you spell \"cookie\" correctly?\n"
" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
@@ -2394,7 +2644,7 @@ msgstr ""
" }\n"
#. (itstool) path: section/p
-#: C/03_getting_the_signal.js.page:339
+#: C/03_getting_the_signal.js.page:337
msgid ""
"Keep reading, if you'd like to see the complete code for each version of our "
"cookie maker application."
@@ -2403,7 +2653,7 @@ msgstr ""
"aplicación creadora de galletas."
#. (itstool) path: note/p
-#: C/03_getting_the_signal.js.page:340
+#: C/03_getting_the_signal.js.page:338
msgid ""
"The main JavaScript tutorials page has <link xref=\"beginner.js#buttons"
"\">more detailed code samples</link> for each input widget, including "
@@ -2414,53 +2664,137 @@ msgstr ""
"entrada, incluyendo varios no cubiertos aquí."
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:345
+#: C/03_getting_the_signal.js.page:343
msgid "Complete code samples"
msgstr "Ejemplos de código completos"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:350
+#: C/03_getting_the_signal.js.page:348
msgid "Code sample with Button"
msgstr "Ejemplo de código con botón"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:352
+#: C/03_getting_the_signal.js.page:350
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "// We start out with 0 cookies\n"
+#| "var cookies = 0;\n"
+#| "\n"
+#| "const GettingTheSignal = new Lang.Class({\n"
+#| " Name: 'Getting the Signal',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 200,\n"
+#| " default_width: 400,\n"
+#| " title: \"Click the button to get a cookie!\"});\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this._cookieLabel = new Gtk.Label ({\n"
+#| " label: \"Number of cookies: \" + cookies });\n"
+#| "\n"
+#| " // Create the cookie button\n"
+#| " this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
+#| "\n"
+#| " // Connect the cookie button to the function that handles clicking it\n"
+#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+#| "\n"
+#| " // Create a grid to arrange everything inside\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Put everything inside the grid\n"
+#| " this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new GettingTheSignal ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -2478,7 +2812,7 @@ msgid ""
" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create a grid to arrange everything inside\n"
" this._grid = new Gtk.Grid ({\n"
@@ -2496,11 +2830,9 @@ msgid ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Increase the number of cookies by 1 and update the label\n"
" cookies++;\n"
@@ -2508,7 +2840,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
@@ -2516,38 +2848,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -2565,7 +2894,7 @@ msgstr ""
" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create a grid to arrange everything inside\n"
" this._grid = new Gtk.Grid ({\n"
@@ -2583,11 +2912,9 @@ msgstr ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Increase the number of cookies by 1 and update the label\n"
" cookies++;\n"
@@ -2595,55 +2922,162 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
"app.application.run (ARGV);\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:356
+#: C/03_getting_the_signal.js.page:354
msgid "Code sample with Switch"
msgstr "Ejemplo de código con interruptor"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:358
+#: C/03_getting_the_signal.js.page:356
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "// We start out with 0 cookies\n"
+#| "var cookies = 0;\n"
+#| "\n"
+#| "const GettingTheSignal = new Lang.Class({\n"
+#| " Name: 'Getting the Signal',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 200,\n"
+#| " default_width: 400,\n"
+#| " title: \"Click the button to get a cookie!\"});\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this._cookieLabel = new Gtk.Label ({\n"
+#| " label: \"Number of cookies: \" + cookies });\n"
+#| "\n"
+#| " // Create the cookie button\n"
+#| " this._cookieButton = new Gtk.Button ({\n"
+#| " label: \"Get a cookie\" });\n"
+#| "\n"
+#| " // Connect the cookie button to the function that handles clicking it\n"
+#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+#| "\n"
+#| " // Create the switch that controls whether or not you can win\n"
+#| " this._cookieSwitch = new Gtk.Switch ();\n"
+#| "\n"
+#| " // Create the label to go with the switch\n"
+#| " this._switchLabel = new Gtk.Label ({\n"
+#| " label: \"Cookie dispenser\" });\n"
+#| "\n"
+#| " // Create a grid for the switch and its label\n"
+#| " this._switchGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| "\n"
+#| " // Put the switch and its label inside that grid\n"
+#| " this._switchGrid.attach (this._switchLabel, 0, 0, 1, 1);\n"
+#| " this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n"
+#| "\n"
+#| " // Create a grid to arrange everything else inside\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Put everything inside the grid\n"
+#| " this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._switchGrid, 0, 1, 1, 1);\n"
+#| " this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Is the cookie dispenser turned on?\n"
+#| " if (this._cookieSwitch.get_active()) {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new GettingTheSignal ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -2662,7 +3096,7 @@ msgid ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the switch that controls whether or not you can win\n"
" this._cookieSwitch = new Gtk.Switch ();\n"
@@ -2697,11 +3131,9 @@ msgid ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Is the cookie dispenser turned on?\n"
" if (this._cookieSwitch.get_active()) {\n"
@@ -2714,7 +3146,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
@@ -2722,38 +3154,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -2772,7 +3201,7 @@ msgstr ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the switch that controls whether or not you can win\n"
" this._cookieSwitch = new Gtk.Switch ();\n"
@@ -2807,11 +3236,9 @@ msgstr ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Is the cookie dispenser turned on?\n"
" if (this._cookieSwitch.get_active()) {\n"
@@ -2824,55 +3251,163 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
"app.application.run (ARGV);\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:362
+#: C/03_getting_the_signal.js.page:360
msgid "Code sample with RadioButton"
msgstr "Ejemplo de código con botón de radio"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:364
+#: C/03_getting_the_signal.js.page:362
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "// We start out with 0 cookies\n"
+#| "var cookies = 0;\n"
+#| "\n"
+#| "const GettingTheSignal = new Lang.Class({\n"
+#| " Name: 'Getting the Signal',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 200,\n"
+#| " default_width: 400,\n"
+#| " border_width: 20,\n"
+#| " title: \"Choose the one that says 'cookie'!\"});\n"
+#| "\n"
+#| " // Create the radio buttons\n"
+#| " this._cookieRadio = new Gtk.RadioButton ({ label: \"Cookie\" });\n"
+#| " this._notCookieOne = new Gtk.RadioButton ({ label: \"Not cookie\",\n"
+#| " group: this._cookieRadio });\n"
+#| " this._notCookieTwo = new Gtk.RadioButton ({ label: \"Not cookie\",\n"
+#| " group: this._cookieRadio });\n"
+#| "\n"
+#| " // Arrange the radio buttons in their own grid\n"
+#| " this._radioGrid = new Gtk.Grid ();\n"
+#| " this._radioGrid.attach (this._notCookieOne, 0, 0, 1, 1);\n"
+#| " this._radioGrid.attach (this._cookieRadio, 0, 1, 1, 1);\n"
+#| " this._radioGrid.attach (this._notCookieTwo, 0, 2, 1, 1);\n"
+#| "\n"
+#| " // Set the button that will be at the top to be active by default\n"
+#| " this._notCookieOne.set_active (true);\n"
+#| "\n"
+#| " // Create the cookie button\n"
+#| " this._cookieButton = new Gtk.Button ({\n"
+#| " label: \"Get a cookie\" });\n"
+#| "\n"
+#| " // Connect the cookie button to the function that handles clicking it\n"
+#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this._cookieLabel = new Gtk.Label ({\n"
+#| " label: \"Number of cookies: \" + cookies });\n"
+#| "\n"
+#| " // Create a grid to arrange everything inside\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Put everything inside the grid\n"
+#| " this._grid.attach (this._radioGrid, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n"
+#| " this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Did you select \"cookie\" instead of \"not cookie\"?\n"
+#| " if (this._cookieRadio.get_active()) {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new GettingTheSignal ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -2904,7 +3439,7 @@ msgid ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the label\n"
" this._cookieLabel = new Gtk.Label ({\n"
@@ -2927,11 +3462,9 @@ msgid ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you select \"cookie\" instead of \"not cookie\"?\n"
" if (this._cookieRadio.get_active()) {\n"
@@ -2944,7 +3477,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
@@ -2952,38 +3485,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -3015,7 +3545,7 @@ msgstr ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the label\n"
" this._cookieLabel = new Gtk.Label ({\n"
@@ -3038,11 +3568,9 @@ msgstr ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you select \"cookie\" instead of \"not cookie\"?\n"
" if (this._cookieRadio.get_active()) {\n"
@@ -3055,55 +3583,150 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
"app.application.run (ARGV);\n"
#. (itstool) path: section/title
-#: C/03_getting_the_signal.js.page:368
+#: C/03_getting_the_signal.js.page:366
msgid "Code sample with Entry"
msgstr "Ejemplo de código con «Entry»"
#. (itstool) path: section/code
-#: C/03_getting_the_signal.js.page:370
+#: C/03_getting_the_signal.js.page:368
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "// We start out with 0 cookies\n"
+#| "var cookies = 0;\n"
+#| "\n"
+#| "const GettingTheSignal = new Lang.Class({\n"
+#| " Name: 'Getting the Signal',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 200,\n"
+#| " default_width: 400,\n"
+#| " border_width: 20,\n"
+#| " title: \"Spell 'cookie' to get a cookie!\"});\n"
+#| "\n"
+#| " // Create the text entry field\n"
+#| " this._spellCookie = new Gtk.Entry ();\n"
+#| "\n"
+#| " // Create the cookie button\n"
+#| " this._cookieButton = new Gtk.Button ({\n"
+#| " label: \"Get a cookie\" });\n"
+#| "\n"
+#| " // Connect the cookie button to the function that handles clicking it\n"
+#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this._cookieLabel = new Gtk.Label ({\n"
+#| " label: \"Number of cookies: \" + cookies });\n"
+#| "\n"
+#| " // Create a grid to arrange everything inside\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " row_spacing: 20 });\n"
+#| "\n"
+#| " // Put everything inside the grid\n"
+#| " this._grid.attach (this._spellCookie, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n"
+#| " this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _getACookie: function() {\n"
+#| "\n"
+#| " // Did you spell \"cookie\" correctly?\n"
+#| " if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
+#| "\n"
+#| " // Increase the number of cookies by 1 and update the label\n"
+#| " cookies++;\n"
+#| " this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new GettingTheSignal ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -3122,7 +3745,7 @@ msgid ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the label\n"
" this._cookieLabel = new Gtk.Label ({\n"
@@ -3145,11 +3768,9 @@ msgid ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you spell \"cookie\" correctly?\n"
" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
@@ -3162,7 +3783,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
@@ -3170,38 +3791,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
"// We start out with 0 cookies\n"
"var cookies = 0;\n"
"\n"
-"const GettingTheSignal = new Lang.Class({\n"
-" Name: 'Getting the Signal',\n"
+"class GettingTheSignal {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -3220,7 +3838,7 @@ msgstr ""
" label: \"Get a cookie\" });\n"
"\n"
" // Connect the cookie button to the function that handles clicking it\n"
-" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n"
+" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n"
"\n"
" // Create the label\n"
" this._cookieLabel = new Gtk.Label ({\n"
@@ -3243,11 +3861,9 @@ msgstr ""
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _getACookie: function() {\n"
+" _getACookie() {\n"
"\n"
" // Did you spell \"cookie\" correctly?\n"
" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n"
@@ -3260,7 +3876,7 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GettingTheSignal ();\n"
@@ -3765,42 +4381,145 @@ msgstr ""
#. (itstool) path: page/code
#: C/aboutdialog.js.page:24
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const AboutDialogExample = new Lang.Class({\n"
+#| " Name: 'AboutDialog Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsaboutdialog',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal creates the menu and builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._initMenus();\n"
+#| " this._buildUI();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function(){\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"AboutDialog Example\",\n"
+#| " default_height: 250,\n"
+#| " default_width: 350 });\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " // Create the application menu\n"
+#| " _initMenus: function() {\n"
+#| " let menu = new Gio.Menu();\n"
+#| " menu.append(\"About\", 'app.about');\n"
+#| " menu.append(\"Quit\",'app.quit');\n"
+#| " this.application.set_app_menu(menu);\n"
+#| "\n"
+#| " // Create the \"About\" menu option and have it call the _showAbout() function\n"
+#| " let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
+#| " aboutAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showAbout();\n"
+#| " }));\n"
+#| " this.application.add_action(aboutAction);\n"
+#| "\n"
+#| " // Create the \"Quit\" menu option and have it close the window\n"
+#| " let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| " },\n"
+#| "\n"
+#| " _showAbout: function() {\n"
+#| "\n"
+#| " // String arrays of the names of the people involved in the project\n"
+#| " var authors = [\"GNOME Documentation Team\"];\n"
+#| " var documenters = [\"GNOME Documentation Team\"];\n"
+#| "\n"
+#| " // Create the About dialog\n"
+#| " let aboutDialog = new Gtk.AboutDialog({ title: \"AboutDialog Example\",\n"
+#| " program_name: \"GtkApplication Example\",\n"
+#| " copyright: \"Copyright \\xa9 2012 GNOME Documentation
Team\",\n"
+#| " authors: authors,\n"
+#| " documenters: documenters,\n"
+#| " website: \"http://developer.gnome.org\",\n"
+#| " website_label: \"GNOME Developer Website\" });\n"
+#| "\n"
+#| " // Attach the About dialog to the window\n"
+#| " aboutDialog.modal = true;\n"
+#| " aboutDialog.transient_for = this._window;\n"
+#| "\n"
+#| " // Show the About dialog\n"
+#| " aboutDialog.show();\n"
+#| "\n"
+#| " // Connect the Close button to the destroy signal for the dialog\n"
+#| " aboutDialog.connect('response', function() {\n"
+#| " aboutDialog.destroy();\n"
+#| " });\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new AboutDialogExample();\n"
+#| "app.application.run(ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const AboutDialogExample = new Lang.Class({\n"
-" Name: 'AboutDialog Example',\n"
+"class AboutDialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
-" this.application = new Gtk.Application({\n"
-" application_id: 'org.example.jsaboutdialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jsaboutdialog',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal creates the menu and builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI();\n"
-" },\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function(){\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -3810,10 +4529,10 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Create the application menu\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"About\", 'app.about');\n"
" menu.append(\"Quit\",'app.quit');\n"
@@ -3821,22 +4540,16 @@ msgid ""
"\n"
" // Create the \"About\" menu option and have it call the _showAbout() function\n"
" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" // Create the \"Quit\" menu option and have it close the window\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
+" _showAbout() {\n"
"\n"
" // String arrays of the names of the people involved in the project\n"
" var authors = [\"GNOME Documentation Team\"];\n"
@@ -3863,7 +4576,7 @@ msgid ""
" aboutDialog.destroy();\n"
" });\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new AboutDialogExample();\n"
@@ -3871,39 +4584,39 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const AboutDialogExample = new Lang.Class({\n"
-" Name: 'AboutDialog Example',\n"
+"class AboutDialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
-" this.application = new Gtk.Application({\n"
-" application_id: 'org.example.jsaboutdialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jsaboutdialog',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal creates the menu and builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI();\n"
-" },\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function(){\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -3913,10 +4626,10 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Create the application menu\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"About\", 'app.about');\n"
" menu.append(\"Quit\",'app.quit');\n"
@@ -3924,22 +4637,16 @@ msgstr ""
"\n"
" // Create the \"About\" menu option and have it call the _showAbout() function\n"
" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" // Create the \"Quit\" menu option and have it close the window\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
+" _showAbout() {\n"
"\n"
" // String arrays of the names of the people involved in the project\n"
" var authors = [\"GNOME Documentation Team\"];\n"
@@ -3966,7 +4673,7 @@ msgstr ""
" aboutDialog.destroy();\n"
" });\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new AboutDialogExample();\n"
@@ -4003,7 +4710,7 @@ msgstr ""
"html\">Gtk.AboutDialog</link>"
#. (itstool) path: item/p
-#: C/aboutdialog.js.page:32 C/button.js.page:31 C/checkbutton.js.page:138
+#: C/aboutdialog.js.page:32 C/button.js.page:31 C/checkbutton.js.page:137
#: C/comboboxtext.js.page:181 C/combobox.js.page:238 C/dialog.js.page:30
#: C/entry.js.page:30 C/grid.js.page:34 C/GtkApplicationWindow.js.page:31
#: C/image.js.page:32 C/label.js.page:30 C/linkbutton.js.page:30
@@ -4020,7 +4727,7 @@ msgstr ""
"html\">Gtk.Application</link>"
#. (itstool) path: item/p
-#: C/aboutdialog.js.page:33 C/button.js.page:32 C/checkbutton.js.page:139
+#: C/aboutdialog.js.page:33 C/button.js.page:32 C/checkbutton.js.page:138
#: C/comboboxtext.js.page:182 C/combobox.js.page:239 C/dialog.js.page:31
#: C/entry.js.page:31 C/grid.js.page:35 C/GtkApplicationWindow.js.page:32
#: C/image.js.page:33 C/label.js.page:31 C/linkbutton.js.page:31
@@ -5183,42 +5890,106 @@ msgstr "Un widget que cambia su etiqueta cuando se pulsa sobre él."
#. (itstool) path: page/code
#: C/button.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ButtonExample = new Lang.Class ({\n"
+#| " Name: 'Button Example',\n"
+#| "\n"
+#| " /* Create the application itself\n"
+#| " This boilerplate code is needed to build any GTK+ application. */\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jsbutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position:
Gtk.WindowPosition.CENTER,\n"
+#| " title: \"GNOME Button\",\n"
+#| " default_height: 50,\n"
+#| " default_width: 250 });\n"
+#| "\n"
+#| " // Create the button\n"
+#| " this.Button = new Gtk.Button ({label: \"Click Me\"});\n"
+#| " this._window.add (this.Button);\n"
+#| "\n"
+#| " // Bind it to a function that says what to do when the button is clicked\n"
+#| " this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " // Here's the function that says what happens when the button is clicked\n"
+#| " _clickHandler: function () {\n"
+#| " this.Button.set_label (\"Clicked!\");\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ButtonExample = new Lang.Class ({\n"
-" Name: 'Button Example',\n"
+"class ButtonExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsbutton',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsbutton',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -5232,17 +6003,17 @@ msgid ""
" this._window.add (this.Button);\n"
"\n"
" // Bind it to a function that says what to do when the button is clicked\n"
-" this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Here's the function that says what happens when the button is clicked\n"
-" _clickHandler: function () {\n"
+" _clickHandler() {\n"
" this.Button.set_label (\"Clicked!\");\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ButtonExample ();\n"
@@ -5250,39 +6021,39 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ButtonExample = new Lang.Class ({\n"
-" Name: 'Button Example',\n"
+"class ButtonExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsbutton',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsbutton',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -5296,17 +6067,17 @@ msgstr ""
" this._window.add (this.Button);\n"
"\n"
" // Bind it to a function that says what to do when the button is clicked\n"
-" this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Here's the function that says what happens when the button is clicked\n"
-" _clickHandler: function () {\n"
+" _clickHandler() {\n"
" this.Button.set_label (\"Clicked!\");\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ButtonExample ();\n"
@@ -5685,37 +6456,220 @@ msgstr "Una calculadora: los botones se agrupan en botoneras horizontales."
#. (itstool) path: section/code
#: C/buttonbox.js.page:31
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ButtonBoxExample = new Lang.Class ({\n"
+#| " Name: 'ButtonBox Example',\n"
+#| "\n"
+#| " // Create the application itthis\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application({ application_id: 'org.example.jsbuttonbox' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Calculator\",\n"
+#| " default_width: 350,\n"
+#| " default_height: 200,\n"
+#| " border_width: 10 });\n"
+#| " this.entry = new Gtk.Entry();\n"
+#| " this.entry.set_text('0');\n"
+#| " // text aligned on the right\n"
+#| " this.entry.set_alignment(1);\n"
+#| " // the text in the entry cannot be modified by writing in it\n"
+#| " this.entry.set_can_focus(false);\n"
+#| "\n"
+#| " // a grid\n"
+#| " this.grid = new Gtk.Grid();\n"
+#| " this.grid.set_row_spacing(5);\n"
+#| " \n"
+#| " // to attach the entry\n"
+#| " this.grid.attach(this.entry, 0, 0, 1, 1);\n"
+#| " \n"
+#| " // the labels for the buttons\n"
+#| " this.buttons = [ 7, 8, 9, '/', 4, 5, 6, '*', 1, 2, 3, '-', 'C', 0, '=', '+' ];\n"
+#| " \n"
+#| " // each row is a ButtonBox, attached to the grid \n"
+#| " for (i = 0; i < 4; i++) {\n"
+#| " this.hbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL);\n"
+#| " this.hbox.set_spacing(5);\n"
+#| " this.grid.attach(this.hbox, 0, i + 1, 1, 1);\n"
+#| " // each ButtonBox has 4 buttons, connected to the callback function\n"
+#| " for (j= 0; j < 4; j++) {\n"
+#| " this.button = new Gtk.Button();\n"
+#| " this.buttonLabel = (this.buttons[i * 4 + j].toString());\n"
+#| " this.button.set_label(this.buttonLabel);\n"
+#| " this.button.set_can_focus(false);\n"
+#| " this.button.connect(\"clicked\", Lang.bind(this, this._buttonClicked, this.button));\n"
+#| " this.hbox.add(this.button);\n"
+#| " }\n"
+#| " }\n"
+#| " \n"
+#| " // some variables for the calculations\n"
+#| " this.firstNumber = 0;\n"
+#| " this.secondNumber = 0;\n"
+#| " this.counter = 0;\n"
+#| " this.operation = \"\";\n"
+#| "\n"
+#| " // add the grid to the window\n"
+#| " this.window.add(this.grid);\n"
+#| " this.window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " // callback function for all the buttons\n"
+#| " _buttonClicked: function(button) {\n"
+#| " this.button = button;\n"
+#| " // for the operations\n"
+#| " if (this.button.get_label() == '+') {\n"
+#| " this.counter += 1 \n"
+#| " if (this.counter > 1)\n"
+#| " this._doOperation();\n"
+#| " this.entry.set_text('0');\n"
+#| " this.operation = \"plus\";\n"
+#| " }\n"
+#| "\n"
+#| " else if (this.button.get_label() == '-') {\n"
+#| " this.counter += 1;\n"
+#| " if (this.counter > 1)\n"
+#| " this._doOperation();\n"
+#| " this.entry.set_text('0');\n"
+#| " this.operation = \"minus\";\n"
+#| " }\n"
+#| "\n"
+#| " else if (this.button.get_label() == '*') {\n"
+#| " this.counter += 1; \n"
+#| " if (this.counter > 1)\n"
+#| " this._doOperation();\n"
+#| " this.entry.set_text('0');\n"
+#| " this.operation = \"multiplication\";\n"
+#| " }\n"
+#| "\n"
+#| " else if (this.button.get_label() == '/') {\n"
+#| " this.counter += 1 \n"
+#| " if (this.counter > 1)\n"
+#| " this._doOperation();\n"
+#| " this.entry.set_text('0');\n"
+#| " this.operation = \"division\";\n"
+#| " }\n"
+#| "\n"
+#| " // for =\n"
+#| " else if (this.button.get_label() == '=') {\n"
+#| " this._doOperation();\n"
+#| " this.entry.set_text(this.firstNumber.toString());\n"
+#| " this.counter = 1;\n"
+#| " }\n"
+#| "\n"
+#| " // for Cancel\n"
+#| " else if (this.button.get_label() == 'C') {\n"
+#| " this.firstNumber = 0;\n"
+#| " this.secondNumber = 0;\n"
+#| " this.counter = 0;\n"
+#| " this.entry.set_text('0');\n"
+#| " this.operation = \"\";\n"
+#| " }\n"
+#| "\n"
+#| " // for a digit button\n"
+#| " else {\n"
+#| " this.newDigit = parseInt(this.button.get_label());\n"
+#| " if (this.entry.get_text() == \"error\")\n"
+#| " this.number = 0;\n"
+#| " else\n"
+#| " this.number = parseInt(this.entry.get_text());\n"
+#| " this.number = this.number * 10 + this.newDigit; \n"
+#| " if (this.counter == 0)\n"
+#| " this.firstNumber = this.number;\n"
+#| " else\n"
+#| " this.secondNumber = this.number;\n"
+#| " this.entry.set_text(this.number.toString());\n"
+#| " }\n"
+#| " },\n"
+#| "\n"
+#| " _doOperation: function() {\n"
+#| " if (this.operation == \"plus\") {\n"
+#| " this.firstNumber += this.secondNumber;\n"
+#| " } else if (this.operation == \"minus\") {\n"
+#| " this.firstNumber -= this.secondNumber;\n"
+#| " } else if (this.operation == \"multiplication\") {\n"
+#| " this.firstNumber *= this.secondNumber;\n"
+#| " } else if (this.operation == \"division\") {\n"
+#| " if (this.secondNumber != 0) {\n"
+#| " this.firstNumber /= this.secondNumber;\n"
+#| " } else {\n"
+#| " this.firstNumber = 0; \n"
+#| " this.secondNumber = 0;\n"
+#| " this.counter = 0; \n"
+#| " this.entry.set_text(\"error\");\n"
+#| " this.operation = \"\";\n"
+#| "\n"
+#| " return\n"
+#| " }\n"
+#| " } else {\n"
+#| " this.firstNumber = 0;\n"
+#| " this.secondNumber = 0;\n"
+#| " this.counter = 0;\n"
+#| " this.entry.set_text(\"error\");\n"
+#| " }\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ButtonBoxExample();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ButtonBoxExample = new Lang.Class ({\n"
-" Name: 'ButtonBox Example',\n"
+"class ButtonBoxExample {\n"
"\n"
" // Create the application itthis\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application({ application_id: 'org.example.jsbuttonbox' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jsbuttonbox'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -5741,17 +6695,17 @@ msgid ""
" this.buttons = [ 7, 8, 9, '/', 4, 5, 6, '*', 1, 2, 3, '-', 'C', 0, '=', '+' ];\n"
" \n"
" // each row is a ButtonBox, attached to the grid \n"
-" for (i = 0; i < 4; i++) {\n"
+" for (let i = 0; i < 4; i++) {\n"
" this.hbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL);\n"
" this.hbox.set_spacing(5);\n"
" this.grid.attach(this.hbox, 0, i + 1, 1, 1);\n"
" // each ButtonBox has 4 buttons, connected to the callback function\n"
-" for (j= 0; j < 4; j++) {\n"
+" for (let j= 0; j < 4; j++) {\n"
" this.button = new Gtk.Button();\n"
" this.buttonLabel = (this.buttons[i * 4 + j].toString());\n"
" this.button.set_label(this.buttonLabel);\n"
" this.button.set_can_focus(false);\n"
-" this.button.connect(\"clicked\", Lang.bind(this, this._buttonClicked, this.button));\n"
+" this.button.connect(\"clicked\", this._buttonClicked.bind(this));\n"
" this.hbox.add(this.button);\n"
" }\n"
" }\n"
@@ -5765,10 +6719,10 @@ msgid ""
" // add the grid to the window\n"
" this.window.add(this.grid);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // callback function for all the buttons\n"
-" _buttonClicked: function(button) {\n"
+" _buttonClicked(button) {\n"
" this.button = button;\n"
" // for the operations\n"
" if (this.button.get_label() == '+') {\n"
@@ -5833,9 +6787,9 @@ msgid ""
" this.secondNumber = this.number;\n"
" this.entry.set_text(this.number.toString());\n"
" }\n"
-" },\n"
+" }\n"
"\n"
-" _doOperation: function() {\n"
+" _doOperation() {\n"
" if (this.operation == \"plus\") {\n"
" this.firstNumber += this.secondNumber;\n"
" } else if (this.operation == \"minus\") {\n"
@@ -5861,7 +6815,7 @@ msgid ""
" this.entry.set_text(\"error\");\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ButtonBoxExample();\n"
@@ -5869,34 +6823,36 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ButtonBoxExample = new Lang.Class ({\n"
-" Name: 'ButtonBox Example',\n"
+"class ButtonBoxExample {\n"
"\n"
" // Create the application itthis\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application({ application_id: 'org.example.jsbuttonbox' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jsbuttonbox'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -5922,17 +6878,17 @@ msgstr ""
" this.buttons = [ 7, 8, 9, '/', 4, 5, 6, '*', 1, 2, 3, '-', 'C', 0, '=', '+' ];\n"
" \n"
" // each row is a ButtonBox, attached to the grid \n"
-" for (i = 0; i < 4; i++) {\n"
+" for (let i = 0; i < 4; i++) {\n"
" this.hbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL);\n"
" this.hbox.set_spacing(5);\n"
" this.grid.attach(this.hbox, 0, i + 1, 1, 1);\n"
" // each ButtonBox has 4 buttons, connected to the callback function\n"
-" for (j= 0; j < 4; j++) {\n"
+" for (let j= 0; j < 4; j++) {\n"
" this.button = new Gtk.Button();\n"
" this.buttonLabel = (this.buttons[i * 4 + j].toString());\n"
" this.button.set_label(this.buttonLabel);\n"
" this.button.set_can_focus(false);\n"
-" this.button.connect(\"clicked\", Lang.bind(this, this._buttonClicked, this.button));\n"
+" this.button.connect(\"clicked\", this._buttonClicked.bind(this));\n"
" this.hbox.add(this.button);\n"
" }\n"
" }\n"
@@ -5946,10 +6902,10 @@ msgstr ""
" // add the grid to the window\n"
" this.window.add(this.grid);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // callback function for all the buttons\n"
-" _buttonClicked: function(button) {\n"
+" _buttonClicked(button) {\n"
" this.button = button;\n"
" // for the operations\n"
" if (this.button.get_label() == '+') {\n"
@@ -6014,9 +6970,9 @@ msgstr ""
" this.secondNumber = this.number;\n"
" this.entry.set_text(this.number.toString());\n"
" }\n"
-" },\n"
+" }\n"
"\n"
-" _doOperation: function() {\n"
+" _doOperation() {\n"
" if (this.operation == \"plus\") {\n"
" this.firstNumber += this.secondNumber;\n"
" } else if (this.operation == \"minus\") {\n"
@@ -6042,7 +6998,7 @@ msgstr ""
" this.entry.set_text(\"error\");\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ButtonBoxExample();\n"
@@ -6846,27 +7802,34 @@ msgid "Libraries to import"
msgstr "Bibliotecas que importar"
#. (itstool) path: section/code
-#: C/checkbutton.js.page:29 C/messagedialog.js.page:32
-#: C/radiobutton.js.page:29 C/scale.js.page:29 C/spinbutton.js.page:32
-#: C/statusbar.js.page:29 C/switch.js.page:36 C/togglebutton.js.page:29
+#: C/checkbutton.js.page:29
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:36 C/comboboxtext.js.page:37 C/combobox.js.page:41
+#: C/checkbutton.js.page:37 C/comboboxtext.js.page:37 C/combobox.js.page:42
#: C/messagedialog.js.page:39 C/radiobutton.js.page:36 C/scale.js.page:36
#: C/spinbutton.js.page:39 C/statusbar.js.page:36 C/switch.js.page:43
#: C/textview.js.page:45 C/togglebutton.js.page:36
@@ -6881,7 +7844,7 @@ msgstr ""
"siempre tiene que ir al principio."
#. (itstool) path: section/title
-#: C/checkbutton.js.page:40 C/comboboxtext.js.page:41 C/combobox.js.page:45
+#: C/checkbutton.js.page:41 C/comboboxtext.js.page:41 C/combobox.js.page:46
#: C/messagedialog.js.page:43 C/radiobutton.js.page:40 C/scale.js.page:40
#: C/spinbutton.js.page:43 C/statusbar.js.page:40 C/switch.js.page:47
#: C/textview.js.page:49 C/togglebutton.js.page:40
@@ -6890,63 +7853,85 @@ msgid "Creating the application window"
msgstr "Crear la ventana de la aplicación"
#. (itstool) path: section/code
-#: C/checkbutton.js.page:41
+#: C/checkbutton.js.page:42
#, no-wrap
-msgid ""
-"\n"
-"const CheckButtonExample = new Lang.Class({\n"
-" Name: 'CheckButton Example',\n"
-"\n"
+#| msgid ""
+#| "\n"
+#| "const CheckButtonExample = new Lang.Class({\n"
+#| " Name: 'CheckButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jscheckbutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+msgid ""
+"\n"
+"class CheckButtonExample {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jscheckbutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
-"const CheckButtonExample = new Lang.Class({\n"
-" Name: 'CheckButton Example',\n"
-"\n"
+"class CheckButtonExample {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jscheckbutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:67
+#: C/checkbutton.js.page:66
msgid ""
"All the code for this sample goes in the CheckButtonExample class. The above "
"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/"
@@ -6959,12 +7944,25 @@ msgstr ""
"la ventana."
#. (itstool) path: section/code
-#: C/checkbutton.js.page:68
+#: C/checkbutton.js.page:67
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 100,\n"
+#| " default_width: 300,\n"
+#| " border_width: 10,\n"
+#| " title: \"CheckButton Example\"});\n"
msgid ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -6977,7 +7975,7 @@ msgid ""
msgstr ""
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -6989,7 +7987,7 @@ msgstr ""
" title: \"CheckButton Example\"});\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:81
+#: C/checkbutton.js.page:80
msgid ""
"The _buildUI function is where we put all the code to create the "
"application's user interface. The first step is creating a new <link href="
@@ -7002,13 +8000,24 @@ msgstr ""
"poner todos los widgets."
#. (itstool) path: section/title
-#: C/checkbutton.js.page:85
+#: C/checkbutton.js.page:84
msgid "Creating the checkbutton"
msgstr "Crear la casilla"
#. (itstool) path: section/code
-#: C/checkbutton.js.page:86
+#: C/checkbutton.js.page:85
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Create the check button\n"
+#| " this._button = new Gtk.CheckButton ({label: \"Show Title\"});\n"
+#| " this._window.add (this._button);\n"
+#| "\n"
+#| " // Have the check button be checked by default\n"
+#| " this._button.set_active (true);\n"
+#| "\n"
+#| " // Connect the button to a function that does something when it's toggled\n"
+#| " this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
msgid ""
"\n"
" // Create the check button\n"
@@ -7019,7 +8028,7 @@ msgid ""
" this._button.set_active (true);\n"
"\n"
" // Connect the button to a function that does something when it's toggled\n"
-" this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
+" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n"
msgstr ""
"\n"
" // Create the check button\n"
@@ -7030,10 +8039,10 @@ msgstr ""
" this._button.set_active (true);\n"
"\n"
" // Connect the button to a function that does something when it's toggled\n"
-" this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
+" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:97
+#: C/checkbutton.js.page:96
msgid ""
"This code creates the checkbutton itself. The label next to the checkbutton "
"is created by giving the checkbutton the \"label\" property and assigning a "
@@ -7050,21 +8059,26 @@ msgstr ""
"llamará a la función «_toggledCB»."
#. (itstool) path: section/code
-#: C/checkbutton.js.page:98 C/radiobutton.js.page:170
+#: C/checkbutton.js.page:97
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:103
+#: C/checkbutton.js.page:102
msgid ""
"This code finishes up creating the UI, by telling the window to show itself "
"and all child widgets (which is just the checkbutton in this case)."
@@ -7074,16 +8088,29 @@ msgstr ""
"verificación)."
#. (itstool) path: section/title
-#: C/checkbutton.js.page:107
+#: C/checkbutton.js.page:106
msgid "Function which handles the checkbutton's toggling"
msgstr "Función que maneja la conmutación de la casilla de verificación"
#. (itstool) path: section/code
-#: C/checkbutton.js.page:108
+#: C/checkbutton.js.page:107
#, no-wrap
-msgid ""
-"\n"
-" _toggledCB: function () {\n"
+#| msgid ""
+#| "\n"
+#| " _toggledCB: function () {\n"
+#| "\n"
+#| " // Make the window title appear or disappear when the checkbox is toggled\n"
+#| " if (this._button.get_active() == true)\n"
+#| " this._window.set_title (\"CheckButton Example\");\n"
+#| " else\n"
+#| " this._window.set_title (\"\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+msgid ""
+"\n"
+" _toggledCB() {\n"
"\n"
" // Make the window title appear or disappear when the checkbox is toggled\n"
" if (this._button.get_active() == true)\n"
@@ -7093,10 +8120,10 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
msgstr ""
"\n"
-" _toggledCB: function () {\n"
+" _toggledCB() {\n"
"\n"
" // Make the window title appear or disappear when the checkbox is toggled\n"
" if (this._button.get_active() == true)\n"
@@ -7106,10 +8133,10 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:121
+#: C/checkbutton.js.page:120
msgid ""
"If the checkbutton is toggled from on to off, we want the window title to "
"disappear. If it's toggled from off to on, we want it to reappear. We can "
@@ -7124,7 +8151,7 @@ msgstr ""
"casilla de verificación funcionará."
#. (itstool) path: section/code
-#: C/checkbutton.js.page:122
+#: C/checkbutton.js.page:121
#, no-wrap
msgid ""
"\n"
@@ -7138,7 +8165,7 @@ msgstr ""
"app.application.run (ARGV);\n"
#. (itstool) path: section/p
-#: C/checkbutton.js.page:127
+#: C/checkbutton.js.page:126
msgid ""
"Finally, we create a new instance of the finished CheckButtonExample class, "
"and set the application running."
@@ -7147,44 +8174,119 @@ msgstr ""
"terminada, y se ejecuta la aplicación."
#. (itstool) path: section/code
-#: C/checkbutton.js.page:132
+#: C/checkbutton.js.page:131
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const CheckButtonExample = new Lang.Class({\n"
+#| " Name: 'CheckButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jscheckbutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 100,\n"
+#| " default_width: 300,\n"
+#| " border_width: 10,\n"
+#| " title: \"CheckButton Example\"});\n"
+#| "\n"
+#| " // Create the check button\n"
+#| " this._button = new Gtk.CheckButton ({label: \"Show Title\"});\n"
+#| " this._window.add (this._button);\n"
+#| "\n"
+#| " // Have the check button be checked by default\n"
+#| " this._button.set_active (true);\n"
+#| "\n"
+#| " // Connect the button to a function that does something when it's toggled\n"
+#| " this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _toggledCB: function () {\n"
+#| "\n"
+#| " // Make the window title appear or disappear when the checkbox is toggled\n"
+#| " if (this._button.get_active() == true)\n"
+#| " this._window.set_title (\"CheckButton Example\");\n"
+#| " else\n"
+#| " this._window.set_title (\"\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new CheckButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const CheckButtonExample = new Lang.Class({\n"
-" Name: 'CheckButton Example',\n"
+"class CheckButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jscheckbutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -7203,15 +8305,13 @@ msgid ""
" this._button.set_active (true);\n"
"\n"
" // Connect the button to a function that does something when it's toggled\n"
-" this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
+" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _toggledCB: function () {\n"
+" _toggledCB() {\n"
"\n"
" // Make the window title appear or disappear when the checkbox is toggled\n"
" if (this._button.get_active() == true)\n"
@@ -7221,7 +8321,7 @@ msgid ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new CheckButtonExample ();\n"
@@ -7229,39 +8329,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const CheckButtonExample = new Lang.Class({\n"
-" Name: 'CheckButton Example',\n"
+"class CheckButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jscheckbutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -7280,15 +8378,13 @@ msgstr ""
" this._button.set_active (true);\n"
"\n"
" // Connect the button to a function that does something when it's toggled\n"
-" this._button.connect (\"toggled\", Lang.bind (this, this._toggledCB));\n"
+" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _toggledCB: function () {\n"
+" _toggledCB() {\n"
"\n"
" // Make the window title appear or disappear when the checkbox is toggled\n"
" if (this._button.get_active() == true)\n"
@@ -7298,14 +8394,14 @@ msgstr ""
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new CheckButtonExample ();\n"
"app.application.run (ARGV);\n"
#. (itstool) path: section/title
-#: C/checkbutton.js.page:136 C/comboboxtext.js.page:176 C/combobox.js.page:233
+#: C/checkbutton.js.page:135 C/comboboxtext.js.page:176 C/combobox.js.page:233
#: C/messagedialog.js.page:189 C/radiobutton.js.page:274 C/scale.js.page:208
#: C/spinbutton.js.page:199 C/statusbar.js.page:221 C/switch.js.page:264
#: C/textview.js.page:248 C/togglebutton.js.page:153
@@ -7314,7 +8410,7 @@ msgid "In-depth documentation"
msgstr "Documentación en profundidad"
#. (itstool) path: item/p
-#: C/checkbutton.js.page:140
+#: C/checkbutton.js.page:139
msgid ""
"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.CheckButton."
"html\">Gtk.CheckButton</link>"
@@ -7651,38 +8747,107 @@ msgstr ""
#. (itstool) path: section/code
#: C/colorbutton.js.page:29
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gdk = imports.gi.Gdk;\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ColorbuttonExample = new Lang.Class ({\n"
+#| " Name: 'Colorbutton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({ application_id: 'org.example.jscolorbutton' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"ColorButton\",\n"
+#| " default_width: 150,\n"
+#| " default_height: 50,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " this.button = new Gtk.ColorButton();\n"
+#| " this.color = new Gdk.RGBA();\n"
+#| " this.color.red = 0.0;\n"
+#| " this.color.green = 0.0;\n"
+#| " this.color.blue = 1.0;\n"
+#| " this.color.alpha = 0.5;\n"
+#| " this.button.set_rgba(this.color);\n"
+#| " this.button.connect(\"color-set\", Lang.bind(this, this.onColorChosen));\n"
+#| " this.label = new Gtk.Label();\n"
+#| " this.label.set_text(\"Click to choose a color\");\n"
+#| "\n"
+#| " let grid = new Gtk.Grid();\n"
+#| " grid.attach(this.button, 0, 0, 2, 1);\n"
+#| " grid.attach(this.label, 0, 1, 2, 1);\n"
+#| " this.window.add(grid);\n"
+#| " this.window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " onColorChosen: function() {\n"
+#| " let colorName = this.color.to_string();\n"
+#| " this.label.set_text(\"You chose the color \" + colorName);\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ColorbuttonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ColorbuttonExample = new Lang.Class ({\n"
-" Name: 'Colorbutton Example',\n"
+"class ColorbuttonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({ application_id: 'org.example.jscolorbutton' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -7699,7 +8864,7 @@ msgid ""
" this.color.blue = 1.0;\n"
" this.color.alpha = 0.5;\n"
" this.button.set_rgba(this.color);\n"
-" this.button.connect(\"color-set\", Lang.bind(this, this.onColorChosen));\n"
+" this.button.connect(\"color-set\", this.onColorChosen.bind(this));\n"
" this.label = new Gtk.Label();\n"
" this.label.set_text(\"Click to choose a color\");\n"
"\n"
@@ -7708,13 +8873,13 @@ msgid ""
" grid.attach(this.label, 0, 1, 2, 1);\n"
" this.window.add(grid);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" onColorChosen: function() {\n"
-" let colorName = this.color.to_string();\n"
-" this.label.set_text(\"You chose the color \" + colorName);\n"
+" onColorChosen() {\n"
+" let colorName = this.color.to_string();\n"
+" this.label.set_text(\"You chose the color \" + colorName);\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ColorbuttonExample ();\n"
@@ -7722,35 +8887,36 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ColorbuttonExample = new Lang.Class ({\n"
-" Name: 'Colorbutton Example',\n"
+"class ColorbuttonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({ application_id: 'org.example.jscolorbutton' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -7767,7 +8933,7 @@ msgstr ""
" this.color.blue = 1.0;\n"
" this.color.alpha = 0.5;\n"
" this.button.set_rgba(this.color);\n"
-" this.button.connect(\"color-set\", Lang.bind(this, this.onColorChosen));\n"
+" this.button.connect(\"color-set\", this.onColorChosen.bind(this));\n"
" this.label = new Gtk.Label();\n"
" this.label.set_text(\"Click to choose a color\");\n"
"\n"
@@ -7776,13 +8942,13 @@ msgstr ""
" grid.attach(this.label, 0, 1, 2, 1);\n"
" this.window.add(grid);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" onColorChosen: function() {\n"
-" let colorName = this.color.to_string();\n"
-" this.label.set_text(\"You chose the color \" + colorName);\n"
+" onColorChosen() {\n"
+" let colorName = this.color.to_string();\n"
+" this.label.set_text(\"You chose the color \" + colorName);\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ColorbuttonExample ();\n"
@@ -8144,6 +9310,22 @@ msgstr ""
"encontrará mucho más simple usar un «ComboBoxText» siempre que sea posible."
#. (itstool) path: section/code
+#: C/comboboxtext.js.page:31 C/textview.js.page:39
+#, no-wrap
+msgid ""
+"\n"
+"#!/usr/bin/gjs\n"
+"\n"
+"const Gtk = imports.gi.Gtk;\n"
+"const Lang = imports.lang;\n"
+msgstr ""
+"\n"
+"#!/usr/bin/gjs\n"
+"\n"
+"const Gtk = imports.gi.Gtk;\n"
+"const Lang = imports.lang;\n"
+
+#. (itstool) path: section/code
#: C/comboboxtext.js.page:42
#, no-wrap
msgid ""
@@ -8209,7 +9391,7 @@ msgstr ""
"widgets y la ventana."
#. (itstool) path: section/code
-#: C/comboboxtext.js.page:67 C/combobox.js.page:71
+#: C/comboboxtext.js.page:67
#, no-wrap
msgid ""
"\n"
@@ -8488,7 +9670,7 @@ msgstr ""
"función «onDialogResponse», y se le dice que se muestre."
#. (itstool) path: section/code
-#: C/comboboxtext.js.page:151 C/combobox.js.page:208
+#: C/comboboxtext.js.page:151
#, no-wrap
msgid ""
"\n"
@@ -8546,39 +9728,141 @@ msgstr ""
#. (itstool) path: section/code
#: C/comboboxtext.js.page:172
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ComboBoxTextExample = new Lang.Class ({\n"
+#| " Name: 'ComboBoxText Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jscomboboxtext'});\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_width: 200,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " // Create the combobox\n"
+#| " this._comboBoxText = new Gtk.ComboBoxText();\n"
+#| "\n"
+#| " // Populate the combobox\n"
+#| " let distros = [\"Select distribution\", \"Fedora\", \"Mint\", \"Suse\"];\n"
+#| " for (let i = 0; i < distros.length; i++)\n"
+#| " this._comboBoxText.append_text (distros[i]);\n"
+#| " this._comboBoxText.set_active (0);\n"
+#| "\n"
+#| " // Connect the combobox's 'changed' signal to our callback function\n"
+#| " this._comboBoxText.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+#| "\n"
+#| " // Add the combobox to the window\n"
+#| " this._window.add (this._comboBoxText);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onComboChanged: function () {\n"
+#| "\n"
+#| " // The responses we'll use for our messagedialog\n"
+#| " let responses = [\"\",\n"
+#| " \"Fedora is a community distro sponsored by Red Hat.\",\n"
+#| " \"Mint is a popular distro based on Ubuntu.\",\n"
+#| " \"SUSE is a name shared by two separate distros.\"];\n"
+#| "\n"
+#| " // Which combobox item is active?\n"
+#| " let activeItem = this._comboBoxText.get_active();\n"
+#| "\n"
+#| " // No messagedialog if you chose \"Select distribution\"\n"
+#| " if (activeItem != 0) {\n"
+#| " this._popUp = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " buttons: Gtk.ButtonsType.OK,\n"
+#| " message_type: Gtk.MessageType.INFO,\n"
+#| " text: responses[activeItem]});\n"
+#| "\n"
+#| " // Connect the OK button to a handler function\n"
+#| " this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+#| "\n"
+#| " // Show the messagedialog\n"
+#| " this._popUp.show();\n"
+#| " }\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onDialogResponse: function () {\n"
+#| "\n"
+#| " this._popUp.destroy ();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ComboBoxTextExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ComboBoxTextExample = new Lang.Class ({\n"
-" Name: 'ComboBoxText Example',\n"
+"class ComboBoxTextExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscomboboxtext'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -8598,18 +9882,16 @@ msgid ""
" this._comboBoxText.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBoxText.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBoxText.connect ('changed', this._onComboChanged.bind(this));\n"
"\n"
" // Add the combobox to the window\n"
" this._window.add (this._comboBoxText);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onComboChanged: function () {\n"
+" _onComboChanged() {\n"
"\n"
" // The responses we'll use for our messagedialog\n"
" let responses = [\"\",\n"
@@ -8630,23 +9912,21 @@ msgid ""
" text: responses[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onDialogResponse: function () {\n"
+" _onDialogResponse() {\n"
"\n"
" this._popUp.destroy ();\n"
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ComboBoxTextExample ();\n"
@@ -8654,36 +9934,33 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ComboBoxTextExample = new Lang.Class ({\n"
-" Name: 'ComboBoxText Example',\n"
+"class ComboBoxTextExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscomboboxtext'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -8703,18 +9980,16 @@ msgstr ""
" this._comboBoxText.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBoxText.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBoxText.connect ('changed', this._onComboChanged.bind(this));\n"
"\n"
" // Add the combobox to the window\n"
" this._window.add (this._comboBoxText);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onComboChanged: function () {\n"
+" _onComboChanged() {\n"
"\n"
" // The responses we'll use for our messagedialog\n"
" let responses = [\"\",\n"
@@ -8735,23 +10010,21 @@ msgstr ""
" text: responses[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onDialogResponse: function () {\n"
+" _onDialogResponse() {\n"
"\n"
" this._popUp.destroy ();\n"
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ComboBoxTextExample ();\n"
@@ -9049,72 +10322,103 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:34
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
#. (itstool) path: section/code
-#: C/combobox.js.page:46
+#: C/combobox.js.page:47
#, no-wrap
-msgid ""
-"\n"
-"const ComboBoxExample = new Lang.Class ({\n"
-" Name: 'ComboBox Example',\n"
+#| msgid ""
+#| "\n"
+#| "const ComboBoxExample = new Lang.Class ({\n"
+#| " Name: 'ComboBox Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jscombobox'});\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+msgid ""
+"\n"
+"class ComboBoxExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscombobox'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
-"const ComboBoxExample = new Lang.Class ({\n"
-" Name: 'ComboBox Example',\n"
+"class ComboBoxExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscombobox'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
+" _onStartup() {\n"
" this._buildUI ();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
#: C/combobox.js.page:70
@@ -9129,6 +10433,46 @@ msgstr ""
"Gtk.Application.html\">Gtk.Application</link> para que vayan los widgets y "
"la ventana."
+#. (itstool) path: section/code
+#: C/combobox.js.page:71
+#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_width: 200,\n"
+#| " border_width: 10 });\n"
+msgid ""
+"\n"
+" // Build the application's UI\n"
+" _buildUI() {\n"
+"\n"
+" // Create the application window\n"
+" this._window = new Gtk.ApplicationWindow ({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_width: 200,\n"
+" border_width: 10 });\n"
+msgstr ""
+"\n"
+" // Build the application's UI\n"
+" _buildUI() {\n"
+"\n"
+" // Create the application window\n"
+" this._window = new Gtk.ApplicationWindow ({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_width: 200,\n"
+" border_width: 10 });\n"
+
#. (itstool) path: section/title
#: C/combobox.js.page:87 C/treeview_simple_liststore.js.page:94
msgid "Creating the ListStore"
@@ -9382,20 +10726,27 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:149
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Set the first row in the combobox to be active on startup\n"
+#| " this._comboBox.set_active (0);\n"
+#| "\n"
+#| " // Connect the combobox's 'changed' signal to our callback function\n"
+#| " this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
msgid ""
"\n"
" // Set the first row in the combobox to be active on startup\n"
" this._comboBox.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n"
msgstr ""
"\n"
" // Set the first row in the combobox to be active on startup\n"
" this._comboBox.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n"
#. (itstool) path: section/p
#: C/combobox.js.page:156
@@ -9416,6 +10767,14 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:158
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Add the combobox to the window\n"
+#| " this._window.add (this._comboBox);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
msgid ""
"\n"
" // Add the combobox to the window\n"
@@ -9423,7 +10782,7 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
" // Add the combobox to the window\n"
@@ -9431,7 +10790,7 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
#: C/combobox.js.page:166
@@ -9445,9 +10804,18 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:171
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " _selected: function () {\n"
+#| "\n"
+#| " // The silly pseudohaiku that we'll use for our messagedialog\n"
+#| " let haiku = [\"\",\n"
+#| " \"You ask for the new\\nwith no thought for the aged\\nlike fallen leaves trod.\",\n"
+#| " \"Like a simple clam\\nrevealing a lustrous pearl\\nit opens for you.\",\n"
+#| " \"A moment in time\\na memory on the breeze\\nthese things can't be saved.\"];\n"
msgid ""
"\n"
-" _selected: function () {\n"
+" _selected() {\n"
"\n"
" // The silly pseudohaiku that we'll use for our messagedialog\n"
" let haiku = [\"\",\n"
@@ -9456,7 +10824,7 @@ msgid ""
" \"A moment in time\\na memory on the breeze\\nthese things can't be saved.\"];\n"
msgstr ""
"\n"
-" _selected: function () {\n"
+" _selected() {\n"
"\n"
" // The silly pseudohaiku that we'll use for our messagedialog\n"
" let haiku = [\"\",\n"
@@ -9482,6 +10850,28 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:182
#, no-wrap
+#| msgid ""
+#| "\n"
+#| " // Which combobox item is active?\n"
+#| " let activeItem = this._comboBox.get_active();\n"
+#| "\n"
+#| " // No messagedialog if you choose \"Select\"\n"
+#| " if (activeItem != 0) {\n"
+#| " this._popUp = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " buttons: Gtk.ButtonsType.OK,\n"
+#| " message_type: Gtk.MessageType.INFO,\n"
+#| " text: haiku[activeItem]});\n"
+#| "\n"
+#| " // Connect the OK button to a handler function\n"
+#| " this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+#| "\n"
+#| " // Show the messagedialog\n"
+#| " this._popUp.show();\n"
+#| " }\n"
+#| "\n"
+#| " },\n"
msgid ""
"\n"
" // Which combobox item is active?\n"
@@ -9497,13 +10887,13 @@ msgid ""
" text: haiku[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
+" }\n"
msgstr ""
"\n"
" // Which combobox item is active?\n"
@@ -9519,13 +10909,13 @@ msgstr ""
" text: haiku[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
+" }\n"
#. (itstool) path: section/p
#: C/combobox.js.page:204
@@ -9555,6 +10945,37 @@ msgstr ""
"que seleccionó."
#. (itstool) path: section/code
+#: C/combobox.js.page:208
+#, no-wrap
+#| msgid ""
+#| "\n"
+#| " _onDialogResponse: function () {\n"
+#| "\n"
+#| " this._popUp.destroy ();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+msgid ""
+"\n"
+" _onDialogResponse() {\n"
+"\n"
+" this._popUp.destroy ();\n"
+"\n"
+" }\n"
+"\n"
+"};\n"
+msgstr ""
+"\n"
+" _onDialogResponse() {\n"
+"\n"
+" this._popUp.destroy ();\n"
+"\n"
+" }\n"
+"\n"
+"};\n"
+
+#. (itstool) path: section/code
#: C/combobox.js.page:219
#, no-wrap
msgid ""
@@ -9580,40 +11001,175 @@ msgstr ""
#. (itstool) path: section/code
#: C/combobox.js.page:229
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ComboBoxExample = new Lang.Class ({\n"
+#| " Name: 'ComboBox Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jscombobox'});\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_width: 200,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " // Create the liststore to put our options in\n"
+#| " this._listStore = new Gtk.ListStore();\n"
+#| " this._listStore.set_column_types ([\n"
+#| " GObject.TYPE_STRING,\n"
+#| " GObject.TYPE_STRING]);\n"
+#| "\n"
+#| " // This array holds our list of options and their icons\n"
+#| " let options = [{ name: \"Select\" },\n"
+#| " { name: \"New\", icon: Gtk.STOCK_NEW },\n"
+#| " { name: \"Open\", icon: Gtk.STOCK_OPEN },\n"
+#| " { name: \"Save\", icon: Gtk.STOCK_SAVE }];\n"
+#| "\n"
+#| " // Put the options in the liststore\n"
+#| " for (let i = 0; i < options.length; i++ ) {\n"
+#| " let option = options[i];\n"
+#| " let iter = this._listStore.append();\n"
+#| " this._listStore.set (iter, [0], [option.name]);\n"
+#| " if ('icon' in option)\n"
+#| " this._listStore.set (iter, [1], [option.icon]);\n"
+#| " }\n"
+#| "\n"
+#| " // Create the combobox\n"
+#| " this._comboBox = new Gtk.ComboBox({\n"
+#| " model: this._listStore});\n"
+#| "\n"
+#| " // Create some cellrenderers for the items in each column\n"
+#| " let rendererPixbuf = new Gtk.CellRendererPixbuf();\n"
+#| " let rendererText = new Gtk.CellRendererText();\n"
+#| "\n"
+#| " // Pack the renderers into the combobox in the order we want to see\n"
+#| " this._comboBox.pack_start (rendererPixbuf, false);\n"
+#| " this._comboBox.pack_start (rendererText, false);\n"
+#| "\n"
+#| " // Set the renderers to use the information from our liststore\n"
+#| " this._comboBox.add_attribute (rendererText, \"text\", 0);\n"
+#| " this._comboBox.add_attribute (rendererPixbuf, \"stock_id\", 1);\n"
+#| "\n"
+#| " // Set the first row in the combobox to be active on startup\n"
+#| " this._comboBox.set_active (0);\n"
+#| "\n"
+#| " // Connect the combobox's 'changed' signal to our callback function\n"
+#| " this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+#| "\n"
+#| " // Add the combobox to the window\n"
+#| " this._window.add (this._comboBox);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onComboChanged: function () {\n"
+#| "\n"
+#| " // The silly pseudohaiku that we'll use for our messagedialog\n"
+#| " let haiku = [\"\",\n"
+#| " \"You ask for the new\\nwith no thought for the aged\\nlike fallen leaves trod.\",\n"
+#| " \"Like a simple clam\\nrevealing a lustrous pearl\\nit opens for you.\",\n"
+#| " \"A moment in time\\na memory on the breeze\\nthese things can't be saved.\"];\n"
+#| "\n"
+#| " // Which combobox item is active?\n"
+#| " let activeItem = this._comboBox.get_active();\n"
+#| "\n"
+#| " // No messagedialog if you choose \"Select\"\n"
+#| " if (activeItem != 0) {\n"
+#| " this._popUp = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " buttons: Gtk.ButtonsType.OK,\n"
+#| " message_type: Gtk.MessageType.INFO,\n"
+#| " text: haiku[activeItem]});\n"
+#| "\n"
+#| " // Connect the OK button to a handler function\n"
+#| " this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+#| "\n"
+#| " // Show the messagedialog\n"
+#| " this._popUp.show();\n"
+#| " }\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onDialogResponse: function () {\n"
+#| "\n"
+#| " this._popUp.destroy ();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ComboBoxExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ComboBoxExample = new Lang.Class ({\n"
-" Name: 'ComboBox Example',\n"
+"class ComboBoxExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscombobox'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -9664,18 +11220,16 @@ msgid ""
" this._comboBox.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n"
"\n"
" // Add the combobox to the window\n"
" this._window.add (this._comboBox);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onComboChanged: function () {\n"
+" _onComboChanged() {\n"
"\n"
" // The silly pseudohaiku that we'll use for our messagedialog\n"
" let haiku = [\"\",\n"
@@ -9696,23 +11250,21 @@ msgid ""
" text: haiku[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onDialogResponse: function () {\n"
+" _onDialogResponse() {\n"
"\n"
" this._popUp.destroy ();\n"
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ComboBoxExample ();\n"
@@ -9720,37 +11272,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ComboBoxExample = new Lang.Class ({\n"
-" Name: 'ComboBox Example',\n"
+"class ComboBoxExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.jscombobox'});\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
+" _onActivate() {\n"
" this._window.present ();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -9801,18 +11351,16 @@ msgstr ""
" this._comboBox.set_active (0);\n"
"\n"
" // Connect the combobox's 'changed' signal to our callback function\n"
-" this._comboBox.connect ('changed', Lang.bind (this, this._onComboChanged));\n"
+" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n"
"\n"
" // Add the combobox to the window\n"
" this._window.add (this._comboBox);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onComboChanged: function () {\n"
+" _onComboChanged() {\n"
"\n"
" // The silly pseudohaiku that we'll use for our messagedialog\n"
" let haiku = [\"\",\n"
@@ -9833,23 +11381,21 @@ msgstr ""
" text: haiku[activeItem]});\n"
"\n"
" // Connect the OK button to a handler function\n"
-" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n"
+" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n"
"\n"
" // Show the messagedialog\n"
" this._popUp.show();\n"
" }\n"
"\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _onDialogResponse: function () {\n"
+" _onDialogResponse() {\n"
"\n"
" this._popUp.destroy ();\n"
"\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ComboBoxExample ();\n"
@@ -11035,41 +12581,129 @@ msgstr ""
#. (itstool) path: page/code
#: C/dialog.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const DialogExample = new Lang.Class ({\n"
+#| " Name: 'Dialog Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jsdialog',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Gtk.Dialog Example\",\n"
+#| " default_height: 50,\n"
+#| " default_width: 250 });\n"
+#| "\n"
+#| " // Create a button\n"
+#| " this._button = new Gtk.Button ({label: \"Click Me\"});\n"
+#| " this._window.add (this._button);\n"
+#| "\n"
+#| " // Bind it to the function that creates the dialog\n"
+#| " this._button.connect (\"clicked\", Lang.bind(this, this._createDialog));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " _createDialog: function () {\n"
+#| "\n"
+#| " // Create the dialog\n"
+#| " this._dialog = new Gtk.Dialog ({ transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " title: \"A Gtk+ dialog\" });\n"
+#| "\n"
+#| " // Create the dialog's content area, which contains a message\n"
+#| " this._contentArea = this._dialog.get_content_area();\n"
+#| " this._message = new Gtk.Label ({label: \"This demonstrates a dialog with a label\"});\n"
+#| " this._contentArea.add (this._message);\n"
+#| "\n"
+#| " // Create the dialog's action area, which contains a stock OK button\n"
+#| " this._actionArea = this._dialog.get_action_area();\n"
+#| " this._OKButton = Gtk.Button.new_from_stock (Gtk.STOCK_OK);\n"
+#| " this._actionArea.add (this._OKButton);\n"
+#| "\n"
+#| " // Connect the button to the function that handles what it does\n"
+#| " this._OKButton.connect (\"clicked\", Lang.bind (this, this._OKHandler));\n"
+#| "\n"
+#| " this._dialog.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " _OKHandler: function (dialog, response_id) {\n"
+#| "\n"
+#| " // Destroy the dialog\n"
+#| " this._dialog.destroy();\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new DialogExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const DialogExample = new Lang.Class ({\n"
-" Name: 'Dialog Example',\n"
+"class DialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsdialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsdialog',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -11083,13 +12717,13 @@ msgid ""
" this._window.add (this._button);\n"
"\n"
" // Bind it to the function that creates the dialog\n"
-" this._button.connect (\"clicked\", Lang.bind(this, this._createDialog));\n"
+" this._button.connect (\"clicked\", this._createDialog.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _createDialog: function () {\n"
+" _createDialog() {\n"
"\n"
" // Create the dialog\n"
" this._dialog = new Gtk.Dialog ({ transient_for: this._window,\n"
@@ -11107,18 +12741,18 @@ msgid ""
" this._actionArea.add (this._OKButton);\n"
"\n"
" // Connect the button to the function that handles what it does\n"
-" this._OKButton.connect (\"clicked\", Lang.bind (this, this._OKHandler));\n"
+" this._OKButton.connect (\"clicked\", this._OKHandler.bind(this));\n"
"\n"
" this._dialog.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _OKHandler: function (dialog, response_id) {\n"
+" _OKHandler(dialog, response_id) {\n"
"\n"
" // Destroy the dialog\n"
" this._dialog.destroy();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new DialogExample ();\n"
@@ -11126,38 +12760,38 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const DialogExample = new Lang.Class ({\n"
-" Name: 'Dialog Example',\n"
+"class DialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsdialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsdialog',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -11171,13 +12805,13 @@ msgstr ""
" this._window.add (this._button);\n"
"\n"
" // Bind it to the function that creates the dialog\n"
-" this._button.connect (\"clicked\", Lang.bind(this, this._createDialog));\n"
+" this._button.connect (\"clicked\", this._createDialog.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _createDialog: function () {\n"
+" _createDialog() {\n"
"\n"
" // Create the dialog\n"
" this._dialog = new Gtk.Dialog ({ transient_for: this._window,\n"
@@ -11195,18 +12829,18 @@ msgstr ""
" this._actionArea.add (this._OKButton);\n"
"\n"
" // Connect the button to the function that handles what it does\n"
-" this._OKButton.connect (\"clicked\", Lang.bind (this, this._OKHandler));\n"
+" this._OKButton.connect (\"clicked\", this._OKHandler.bind(this));\n"
"\n"
" this._dialog.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _OKHandler: function (dialog, response_id) {\n"
+" _OKHandler(dialog, response_id) {\n"
"\n"
" // Destroy the dialog\n"
" this._dialog.destroy();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new DialogExample ();\n"
@@ -11817,43 +13451,128 @@ msgstr "Esta aplicación le saluda por su nombre con una ventana emergente."
#. (itstool) path: page/code
#: C/entry.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const EntryExample = new Lang.Class({\n"
+#| " Name: 'Entry Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsentry',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 100,\n"
+#| " default_width: 300,\n"
+#| " border_width: 10,\n"
+#| " title: \"What is your name?\"});\n"
+#| "\n"
+#| " // Create the text entry box\n"
+#| " this.entry = new Gtk.Entry ();\n"
+#| " this._window.add(this.entry);\n"
+#| "\n"
+#| " // Connect the text entry box to a function that responds to what you type in\n"
+#| " this.entry.connect(\"activate\", Lang.bind (this, this._hello));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _hello: function() {\n"
+#| "\n"
+#| " // Create a popup dialog to greet the person who types in their name\n"
+#| " this._greeter = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " text: \"Hello, \" + this.entry.get_text() + \"!\",\n"
+#| " message_type: Gtk.MessageType.OTHER,\n"
+#| " buttons: Gtk.ButtonsType.OK,\n"
+#| " });\n"
+#| "\n"
+#| " // Show the popup dialog\n"
+#| " this._greeter.show();\n"
+#| "\n"
+#| " // Bind the OK button to the function that closes the popup\n"
+#| " this._greeter.connect (\"response\", Lang.bind(this, this._okClicked));\n"
+#| " },\n"
+#| "\n"
+#| " _okClicked: function () {\n"
+#| " this._greeter.destroy();\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new EntryExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const EntryExample = new Lang.Class({\n"
-" Name: 'Entry Example',\n"
+"class EntryExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsentry',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -11869,15 +13588,13 @@ msgid ""
" this._window.add(this.entry);\n"
"\n"
" // Connect the text entry box to a function that responds to what you type in\n"
-" this.entry.connect(\"activate\", Lang.bind (this, this._hello));\n"
+" this.entry.connect(\"activate\", this._hello.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _hello: function() {\n"
+" _hello() {\n"
"\n"
" // Create a popup dialog to greet the person who types in their name\n"
" this._greeter = new Gtk.MessageDialog ({\n"
@@ -11892,14 +13609,14 @@ msgid ""
" this._greeter.show();\n"
"\n"
" // Bind the OK button to the function that closes the popup\n"
-" this._greeter.connect (\"response\", Lang.bind(this, this._okClicked));\n"
-" },\n"
+" this._greeter.connect (\"response\", this._okClicked.bind(this));\n"
+" }\n"
"\n"
-" _okClicked: function () {\n"
+" _okClicked() {\n"
" this._greeter.destroy();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new EntryExample ();\n"
@@ -11907,40 +13624,38 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const EntryExample = new Lang.Class({\n"
-" Name: 'Entry Example',\n"
+"class EntryExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsentry',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -11956,15 +13671,13 @@ msgstr ""
" this._window.add(this.entry);\n"
"\n"
" // Connect the text entry box to a function that responds to what you type in\n"
-" this.entry.connect(\"activate\", Lang.bind (this, this._hello));\n"
+" this.entry.connect(\"activate\", this._hello.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _hello: function() {\n"
+" _hello() {\n"
"\n"
" // Create a popup dialog to greet the person who types in their name\n"
" this._greeter = new Gtk.MessageDialog ({\n"
@@ -11979,14 +13692,14 @@ msgstr ""
" this._greeter.show();\n"
"\n"
" // Bind the OK button to the function that closes the popup\n"
-" this._greeter.connect (\"response\", Lang.bind(this, this._okClicked));\n"
-" },\n"
+" this._greeter.connect (\"response\", this._okClicked.bind(this));\n"
+" }\n"
"\n"
-" _okClicked: function () {\n"
+" _okClicked() {\n"
" this._greeter.destroy();\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new EntryExample ();\n"
@@ -13815,36 +15528,97 @@ msgstr "Un FontChooserWidget con una función de retorno de llamada."
#. (itstool) path: section/code
#: C/fontchooserwidget.js.page:30
#, no-wrap
+#| msgid ""
+#| "//!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const FontChooserWidgetExample = new Lang.Class ({\n"
+#| " Name: 'Font Chooser Widget Example',\n"
+#| "\n"
+#| " // Create the application itthis\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application({ application_id: 'org.example.fontchooserwidget' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"FontChooserWidget\",\n"
+#| " default_width: 200,\n"
+#| " default_height: 200,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " this.fontChooser = new Gtk.FontChooserWidget();\n"
+#| " // a default font\n"
+#| " this.fontChooser.set_font(\"Sans\");\n"
+#| " // a text to preview the font\n"
+#| " this.fontChooser.set_preview_text(\"This is an example of preview text!\");\n"
+#| "\n"
+#| " // connect signal from the font chooser to the callback function\n"
+#| " this.fontChooser.connect(\"notify::font\", Lang.bind(this, this._fontCb));\n"
+#| "\n"
+#| " // add the font chooser to the window\n"
+#| " this.window.add(this.fontChooser);\n"
+#| " this.window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " // callback function:\n"
+#| " _fontCb: function() {\n"
+#| " // print in the terminal\n"
+#| " print(\"You chose the font \" + this.fontChooser.get_font());\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new FontChooserWidgetExample();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"//!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const FontChooserWidgetExample = new Lang.Class ({\n"
-" Name: 'Font Chooser Widget Example',\n"
+"class FontChooserWidgetExample {\n"
"\n"
" // Create the application itthis\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({ application_id: 'org.example.fontchooserwidget' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -13860,19 +15634,19 @@ msgid ""
" this.fontChooser.set_preview_text(\"This is an example of preview text!\");\n"
"\n"
" // connect signal from the font chooser to the callback function\n"
-" this.fontChooser.connect(\"notify::font\", Lang.bind(this, this._fontCb));\n"
+" this.fontChooser.connect(\"notify::font\", this._fontCb.bind(this));\n"
"\n"
" // add the font chooser to the window\n"
" this.window.add(this.fontChooser);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // callback function:\n"
-" _fontCb: function() {\n"
+" _fontCb() {\n"
" // print in the terminal\n"
" print(\"You chose the font \" + this.fontChooser.get_font());\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new FontChooserWidgetExample();\n"
@@ -13880,33 +15654,32 @@ msgid ""
msgstr ""
"//!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const FontChooserWidgetExample = new Lang.Class ({\n"
-" Name: 'Font Chooser Widget Example',\n"
+"class FontChooserWidgetExample {\n"
"\n"
" // Create the application itthis\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({ application_id: 'org.example.fontchooserwidget' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -13922,19 +15695,19 @@ msgstr ""
" this.fontChooser.set_preview_text(\"This is an example of preview text!\");\n"
"\n"
" // connect signal from the font chooser to the callback function\n"
-" this.fontChooser.connect(\"notify::font\", Lang.bind(this, this._fontCb));\n"
+" this.fontChooser.connect(\"notify::font\", this._fontCb.bind(this));\n"
"\n"
" // add the font chooser to the window\n"
" this.window.add(this.fontChooser);\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // callback function:\n"
-" _fontCb: function() {\n"
+" _fontCb() {\n"
" // print in the terminal\n"
" print(\"You chose the font \" + this.fontChooser.get_font());\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new FontChooserWidgetExample();\n"
@@ -14391,31 +16164,121 @@ msgstr ""
#. (itstool) path: page/code
#: C/gmenu.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const Application = new Lang.Class ({\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.myapp',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " //connect to 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " //create the UI (in this case it's just the ApplicationWindow\n"
+#| " _buildUI: function() {\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\" });\n"
+#| "\n"
+#| " //uncommenting the line below will change the window size\n"
+#| " //this._window.set_default_size(600, 400);\n"
+#| "\n"
+#| " //show the window and all child widgets (none in this case)\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " _showNew: function() {\n"
+#| " print (\"This doesn't do anything. It is only a demonstration.\");\n"
+#| " },\n"
+#| "\n"
+#| " _showAbout: function() {\n"
+#| " print (\"No AboutDialog here. This is only a demonstration.\");\n"
+#| " },\n"
+#| "\n"
+#| " //create the menu items and connect the signals to the callback functions.\n"
+#| " _initMenus: function() {\n"
+#| " let menu = new Gio.Menu();\n"
+#| " menu.append(\"New\",'app.new');\n"
+#| " menu.append(\"About\", 'app.about');\n"
+#| " menu.append(\"Quit\",'app.quit');\n"
+#| " this.application.set_app_menu(menu);\n"
+#| "\n"
+#| " let newAction = new Gio.SimpleAction ({ name: 'new' });\n"
+#| " newAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showNew();\n"
+#| " }));\n"
+#| " this.application.add_action(newAction);\n"
+#| "\n"
+#| " let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
+#| " aboutAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showAbout();\n"
+#| " }));\n"
+#| " this.application.add_action(aboutAction);\n"
+#| "\n"
+#| " let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'activate' signal\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'startup' signal\n"
+#| " _onStartup: function() {\n"
+#| " //You must call _initMenus() before calling _buildUI().\n"
+#| " this._initMenus();\n"
+#| " this._buildUI();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Welcome to GNOME\" });\n"
@@ -14425,18 +16288,18 @@ msgid ""
"\n"
" //show the window and all child widgets (none in this case)\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _showNew: function() {\n"
-" print (\"This doesn't do anything. It is only a demonstration.\");\n"
-" },\n"
+" _showNew() {\n"
+" print(\"This doesn't do anything. It is only a demonstration.\");\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
-" print (\"No AboutDialog here. This is only a demonstration.\");\n"
-" },\n"
+" _showAbout() {\n"
+" print(\"No AboutDialog here. This is only a demonstration.\");\n"
+" }\n"
"\n"
" //create the menu items and connect the signals to the callback functions.\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"New\",'app.new');\n"
" menu.append(\"About\", 'app.about');\n"
@@ -14444,39 +16307,30 @@ msgid ""
" this.application.set_app_menu(menu);\n"
"\n"
" let newAction = new Gio.SimpleAction ({ name: 'new' });\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showNew();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._showNew(); });\n"
" this.application.add_action(newAction);\n"
"\n"
" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" //You must call _initMenus() before calling _buildUI().\n"
" this._initMenus();\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -14484,28 +16338,28 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Welcome to GNOME\" });\n"
@@ -14515,18 +16369,18 @@ msgstr ""
"\n"
" //show the window and all child widgets (none in this case)\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _showNew: function() {\n"
-" print (\"This doesn't do anything. It is only a demonstration.\");\n"
-" },\n"
+" _showNew() {\n"
+" print(\"This doesn't do anything. It is only a demonstration.\");\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
-" print (\"No AboutDialog here. This is only a demonstration.\");\n"
-" },\n"
+" _showAbout() {\n"
+" print(\"No AboutDialog here. This is only a demonstration.\");\n"
+" }\n"
"\n"
" //create the menu items and connect the signals to the callback functions.\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"New\",'app.new');\n"
" menu.append(\"About\", 'app.about');\n"
@@ -14534,39 +16388,30 @@ msgstr ""
" this.application.set_app_menu(menu);\n"
"\n"
" let newAction = new Gio.SimpleAction ({ name: 'new' });\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showNew();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._showNew(); });\n"
" this.application.add_action(newAction);\n"
"\n"
" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" //You must call _initMenus() before calling _buildUI().\n"
" this._initMenus();\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -15356,45 +17201,115 @@ msgstr ""
#. (itstool) path: page/code
#: C/grid.js.page:29
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const GridExample = new Lang.Class ({\n"
+#| " Name: 'Grid Example',\n"
+#| "\n"
+#| " /* Create the application itself\n"
+#| " This boilerplate code is needed to build any GTK+ application. */\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jsgrid',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Grid Example\"});\n"
+#| "\n"
+#| " // Create the grid\n"
+#| " this.Grid = new Gtk.Grid ();\n"
+#| "\n"
+#| " // Create the widgets inside the grid\n"
+#| " this.progressBar = new Gtk.ProgressBar ();\n"
+#| " this.Button = new Gtk.Button ({ label: \"Button\" });\n"
+#| " this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+#| "\n"
+#| " // Assemble the grid\n"
+#| " this._window.add (this.Grid);\n"
+#| " this.Grid.attach (this.Button, 1, 1, 1, 1);\n"
+#| " this.Grid.attach_next_to (this.progressBar, this.Button, Gtk.PositionType.BOTTOM, 1, 1);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " // Here's the function that says what happens when the button is clicked\n"
+#| " _clickHandler: function () {\n"
+#| " this.progressBar.pulse ();\n"
+#| " }\n"
+#| "\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new GridExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const GridExample = new Lang.Class ({\n"
-" Name: 'Grid Example',\n"
+"class GridExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsgrid',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsgrid',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -15407,7 +17322,7 @@ msgid ""
" // Create the widgets inside the grid\n"
" this.progressBar = new Gtk.ProgressBar ();\n"
" this.Button = new Gtk.Button ({ label: \"Button\" });\n"
-" this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n"
"\n"
" // Assemble the grid\n"
" this._window.add (this.Grid);\n"
@@ -15416,15 +17331,15 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Here's the function that says what happens when the button is clicked\n"
-" _clickHandler: function () {\n"
+" _clickHandler() {\n"
" this.progressBar.pulse ();\n"
" }\n"
"\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GridExample ();\n"
@@ -15432,42 +17347,39 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const GridExample = new Lang.Class ({\n"
-" Name: 'Grid Example',\n"
+"class GridExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jsgrid',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsgrid',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -15480,7 +17392,7 @@ msgstr ""
" // Create the widgets inside the grid\n"
" this.progressBar = new Gtk.ProgressBar ();\n"
" this.Button = new Gtk.Button ({ label: \"Button\" });\n"
-" this.Button.connect (\"clicked\", Lang.bind(this, this._clickHandler));\n"
+" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n"
"\n"
" // Assemble the grid\n"
" this._window.add (this.Grid);\n"
@@ -15489,15 +17401,15 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" // Here's the function that says what happens when the button is clicked\n"
-" _clickHandler: function () {\n"
+" _clickHandler() {\n"
" this.progressBar.pulse ();\n"
" }\n"
"\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new GridExample ();\n"
@@ -15970,33 +17882,84 @@ msgstr "Una GtkApplicationWindow sencilla que soporta menús."
#. (itstool) path: page/code
#: C/GtkApplicationWindow.js.page:25
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const Application = new Lang.Class ({\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.myapp',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " //connect to 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " //create the UI (in this case it's just the ApplicationWindow\n"
+#| " _buildUI: function () {\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\" });\n"
+#| "\n"
+#| " //uncommenting the line below will change the window size\n"
+#| " //this._window.set_default_size(600, 400);\n"
+#| "\n"
+#| " //show the window and all child widgets (none in this case)\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'activate' signal\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'startup' signal\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function () {\n"
-" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+" _buildUI() {\n"
+" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Welcome to GNOME\" });\n"
"\n"
@@ -16005,18 +17968,18 @@ msgid ""
"\n"
" //show the window and all child widgets (none in this case)\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -16025,29 +17988,29 @@ msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function () {\n"
-" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+" _buildUI() {\n"
+" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Welcome to GNOME\" });\n"
"\n"
@@ -16056,18 +18019,18 @@ msgstr ""
"\n"
" //show the window and all child widgets (none in this case)\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -20393,38 +22356,98 @@ msgstr ""
#. (itstool) path: section/code
#: C/hellognome.js.page:195
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "const Webkit = imports.gi.WebKit;\n"
+#| "\n"
+#| "const HelloGNOME = new Lang.Class ({\n"
+#| " Name: 'Hello GNOME',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ();\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_height: 200,\n"
+#| " default_width: 400,\n"
+#| " window_position: Gtk.WindowPosition.CENTER });\n"
+#| "\n"
+#| " // Create a webview to show the web app\n"
+#| " this._webView = new Webkit.WebView ();\n"
+#| "\n"
+#| " // Put the web app into the webview\n"
+#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n"
+#| " \"/hellognome.html\", null));\n"
+#| "\n"
+#| " // Put the webview into the window\n"
+#| " this._window.add (this._webView);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new HelloGNOME ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"const Webkit = imports.gi.WebKit;\n"
"\n"
-"const HelloGNOME = new Lang.Class ({\n"
-" Name: 'Hello GNOME',\n"
+"class HelloGNOME {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -20446,9 +22469,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new HelloGNOME ();\n"
@@ -20456,35 +22479,35 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"const Webkit = imports.gi.WebKit;\n"
"\n"
-"const HelloGNOME = new Lang.Class ({\n"
-" Name: 'Hello GNOME',\n"
+"class HelloGNOME {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application ();\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -20506,9 +22529,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new HelloGNOME ();\n"
@@ -20935,45 +22958,86 @@ msgstr "El archivo completo:"
#. (itstool) path: section/code
#: C/hello-world.js.page:116
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Lang = imports.lang;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "\n"
+#| "const Application = new Lang.Class({\n"
+#| " //A Class requires an explicit Name parameter. This is the Class Name.\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application();\n"
+#| "\n"
+#| " //connect to 'activate' and 'startup' signals to handlers.\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " //create the UI\n"
+#| " _buildUI: function() {\n"
+#| " this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
+#| " title: \"Hello World!\" });\n"
+#| " this._window.set_default_size(200, 200);\n"
+#| " this.label = new Gtk.Label({ label: \"Hello World\" });\n"
+#| " this._window.add(this.label);\n"
+#| " },\n"
+#| "\n"
+#| " //handler for 'activate' signal\n"
+#| " _onActivate: function() {\n"
+#| " //show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " //handler for 'startup' signal\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application();\n"
+#| "app.application.run(ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
-"const Lang = imports.lang;\n"
+"imports.gi.versions.Gtk = '3.0'\n"
"const Gtk = imports.gi.Gtk;\n"
"\n"
-"const Application = new Lang.Class({\n"
-" //A Class requires an explicit Name parameter. This is the Class Name.\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" //connect to 'activate' and 'startup' signals to handlers.\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" title: \"Hello World!\" });\n"
" this._window.set_default_size(200, 200);\n"
" this.label = new Gtk.Label({ label: \"Hello World\" });\n"
" this._window.add(this.label);\n"
-" },\n"
+" }\n"
"\n"
" //handler for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" //show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" //handler for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -20981,42 +23045,40 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
-"const Lang = imports.lang;\n"
+"imports.gi.versions.Gtk = '3.0'\n"
"const Gtk = imports.gi.Gtk;\n"
"\n"
-"const Application = new Lang.Class({\n"
-" //A Class requires an explicit Name parameter. This is the Class Name.\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application();\n"
"\n"
" //connect to 'activate' and 'startup' signals to handlers.\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" title: \"Hello World!\" });\n"
" this._window.set_default_size(200, 200);\n"
" this.label = new Gtk.Label({ label: \"Hello World\" });\n"
" this._window.add(this.label);\n"
-" },\n"
+" }\n"
"\n"
" //handler for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" //show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
" //handler for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -22188,63 +24250,121 @@ msgstr "Image (JavaScript)"
#. (itstool) path: page/code
#: C/image.js.page:27
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const LabelExample = new Lang.Class ({\n"
+#| " Name: 'Label Example',\n"
+#| "\n"
+#| " /* Create the application itself\n"
+#| " This boilerplate code is needed to build any GTK+ application. */\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jslabel',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position:
Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_height: 100,\n"
+#| " default_width: 200 });\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this.label = new Gtk.Label ({label: \"Hello GNOME!\"});\n"
+#| " this._window.add (this.label);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " }\n"
+#| "\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new LabelExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
-"\n"
-"const ImageExample = new Lang.Class ({\n"
-"\tName: 'Image Example',\n"
-"\n"
-"\t/* Create the application itself\n"
-"\t This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" \t this.application = new Gtk.Application ({\n"
-" \t application_id: 'org.example.jsimage',\n"
-" \t flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" \t });\n"
-"\n"
-"\t// Connect 'activate' and 'startup' signals to the callback functions\n"
-"\tthis.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-"\tthis.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-"\t},\n"
-"\n"
-"\t// Callback function for 'activate' signal presents windows when active\n"
-"\t_onActivate: function () {\n"
-"\t\tthis._window.present ();\n"
-"\t},\n"
-"\n"
-"\t// Callback function for 'startup' signal initializes menus and builds the UI\n"
-"\t_onStartup: function () {\n"
-"\t\tthis._buildUI ();\n"
-"\t},\n"
"\n"
+"class ImageExample {\n"
"\n"
+" /* Create the application itself\n"
+" This boilerplate code is needed to build any GTK+ application. */\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsimage',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
-"\t// Build the application's UI\n"
-"\t_buildUI: function () {\n"
+" // Callback function for 'activate' signal presents windows when active\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
-"\t\t// Create the application window\n"
-" \tthis._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" \t window_position: Gtk.WindowPosition.CENTER,\n"
-" \t title: \"Welcome to GNOME\",\n"
-" \t default_height: 300,\n"
-" \t default_width: 300 });\n"
+" // Callback function for 'startup' signal initializes menus and builds the UI\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
-"\t\t// Create the label\n"
-"\t\tthis.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
-"\t\tthis._window.add (this.jsimage);\n"
+" // Build the application's UI\n"
+" _buildUI() {\n"
"\n"
-" \t \t// Show the window and all child widgets\n"
-" \t \tthis._window.show_all();\n"
-"\t}\n"
+" // Create the application window\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_height: 300,\n"
+" default_width: 300\n"
+" });\n"
"\n"
+" // Create the label\n"
+" this.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
+" this._window.add (this.jsimage);\n"
"\n"
-"});\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
+" }\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ImageExample ();\n"
@@ -22252,60 +24372,57 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
-"\n"
-"const ImageExample = new Lang.Class ({\n"
-"\tName: 'Image Example',\n"
-"\n"
-"\t/* Create the application itself\n"
-"\t This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" \t this.application = new Gtk.Application ({\n"
-" \t application_id: 'org.example.jsimage',\n"
-" \t flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" \t });\n"
-"\n"
-"\t// Connect 'activate' and 'startup' signals to the callback functions\n"
-"\tthis.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-"\tthis.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-"\t},\n"
-"\n"
-"\t// Callback function for 'activate' signal presents windows when active\n"
-"\t_onActivate: function () {\n"
-"\t\tthis._window.present ();\n"
-"\t},\n"
-"\n"
-"\t// Callback function for 'startup' signal initializes menus and builds the UI\n"
-"\t_onStartup: function () {\n"
-"\t\tthis._buildUI ();\n"
-"\t},\n"
"\n"
+"class ImageExample {\n"
"\n"
+" /* Create the application itself\n"
+" This boilerplate code is needed to build any GTK+ application. */\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jsimage',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
-"\t// Build the application's UI\n"
-"\t_buildUI: function () {\n"
+" // Callback function for 'activate' signal presents windows when active\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
-"\t\t// Create the application window\n"
-" \tthis._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" \t window_position: Gtk.WindowPosition.CENTER,\n"
-" \t title: \"Welcome to GNOME\",\n"
-" \t default_height: 300,\n"
-" \t default_width: 300 });\n"
+" // Callback function for 'startup' signal initializes menus and builds the UI\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
-"\t\t// Create the label\n"
-"\t\tthis.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
-"\t\tthis._window.add (this.jsimage);\n"
+" // Build the application's UI\n"
+" _buildUI() {\n"
"\n"
-" \t \t// Show the window and all child widgets\n"
-" \t \tthis._window.show_all();\n"
-"\t}\n"
+" // Create the application window\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_height: 300,\n"
+" default_width: 300\n"
+" });\n"
"\n"
+" // Create the label\n"
+" this.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
+" this._window.add (this.jsimage);\n"
"\n"
-"});\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
+" }\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ImageExample ();\n"
@@ -26140,63 +28257,123 @@ msgstr "Un widget que muestra un mensaje amigable"
#. (itstool) path: page/code
#: C/label.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const LabelExample = new Lang.Class ({\n"
+#| " Name: 'Label Example',\n"
+#| "\n"
+#| " /* Create the application itself\n"
+#| " This boilerplate code is needed to build any GTK+ application. */\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jslabel',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position:
Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Welcome to GNOME\",\n"
+#| " default_height: 100,\n"
+#| " default_width: 200 });\n"
+#| "\n"
+#| " // Create the label\n"
+#| " this.label = new Gtk.Label ({label: \"Hello GNOME!\"});\n"
+#| " this._window.add (this.label);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " }\n"
+#| "\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new LabelExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const LabelExample = new Lang.Class ({\n"
-" Name: 'Label Example',\n"
+"class LabelExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jslabel',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jslabel',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Welcome to GNOME\",\n"
-" default_height: 100,\n"
-" default_width: 200 });\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_height: 100,\n"
+" default_width: 200\n"
+" });\n"
"\n"
" // Create the label\n"
-" this.label = new Gtk.Label ({label: \"Hello GNOME!\"});\n"
-" this._window.add (this.label);\n"
+" this.label = new Gtk.Label({ label: \"Hello GNOME!\" });\n"
+" this._window.add(this.label);\n"
"\n"
-" // Show the window and all child widgets\n"
-" this._window.show_all();\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
" }\n"
"\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new LabelExample ();\n"
@@ -26204,60 +28381,59 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const LabelExample = new Lang.Class ({\n"
-" Name: 'Label Example',\n"
+"class LabelExample {\n"
"\n"
" /* Create the application itself\n"
" This boilerplate code is needed to build any GTK+ application. */\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jslabel',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
-" });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application ({\n"
+" application_id: 'org.example.jslabel',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Welcome to GNOME\",\n"
-" default_height: 100,\n"
-" default_width: 200 });\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Welcome to GNOME\",\n"
+" default_height: 100,\n"
+" default_width: 200\n"
+" });\n"
"\n"
" // Create the label\n"
-" this.label = new Gtk.Label ({label: \"Hello GNOME!\"});\n"
-" this._window.add (this.label);\n"
+" this.label = new Gtk.Label({ label: \"Hello GNOME!\" });\n"
+" this._window.add(this.label);\n"
"\n"
-" // Show the window and all child widgets\n"
-" this._window.show_all();\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
" }\n"
"\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new LabelExample ();\n"
@@ -26766,41 +28942,97 @@ msgstr "Un botón que enlaza con live.gnome.org."
#. (itstool) path: page/code
#: C/linkbutton.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const LinkButtonExample = new Lang.Class ({\n"
+#| " Name: 'LinkButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jslinkbutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"GNOME LinkButton\",\n"
+#| " default_height: 50,\n"
+#| " default_width: 250 });\n"
+#| "\n"
+#| " // Create the LinkButton and have it link to live.gnome.org\n"
+#| " this.LinkButton = new Gtk.LinkButton ({label: \"Link to GNOME live!\",\n"
+#| " uri: \"http://live.gnome.org\"});\n"
+#| " this._window.add (this.LinkButton);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new LinkButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const LinkButtonExample = new Lang.Class ({\n"
-" Name: 'LinkButton Example',\n"
+"class LinkButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jslinkbutton',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jslinkbutton',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -26816,8 +29048,8 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"});\n"
+" }\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new LinkButtonExample ();\n"
@@ -26825,38 +29057,38 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const LinkButtonExample = new Lang.Class ({\n"
-" Name: 'LinkButton Example',\n"
+"class LinkButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jslinkbutton',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jslinkbutton',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n"
@@ -26872,8 +29104,8 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"});\n"
+" }\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new LinkButtonExample ();\n"
@@ -30186,29 +32418,138 @@ msgstr "Anna Zacchi"
#. (itstool) path: page/code
#: C/menubutton.js.page:28
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const Application = new Lang.Class ({\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application ({ application_id: 'org.example.myapp',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+#| "\n"
+#| " //connect to 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " //create the UI (in this case it's just the ApplicationWindow)\n"
+#| " _buildUI: function() {\n"
+#| " this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"MenuButton Example\" });\n"
+#| " this._window.set_default_size(600, 400);\n"
+#| " this.grid = new Gtk.Grid();\n"
+#| " this._window.add(this.grid);\n"
+#| "\n"
+#| "\n"
+#| " this._menuButton = new Gtk.MenuButton();\n"
+#| " this.grid.attach(this._menuButton, 0, 0, 1, 1 );\n"
+#| " this.menu = new Gtk.Menu.new_from_model(this.menuModel);\n"
+#| "\n"
+#| " this.menu.show();\n"
+#| " this._menuButton.set_menu_model (this.menuModel);\n"
+#| " this._menuButton.set_size_request(80, 35);\n"
+#| " this._menuButton.show();\n"
+#| "\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " _showNew: function() {\n"
+#| " print(\"You clicked \\\"New\\\"\");\n"
+#| " },\n"
+#| "\n"
+#| " _showAbout: function() {\n"
+#| " print(\"You clicked \\\"About\\\"\");\n"
+#| " },\n"
+#| "\n"
+#| " //create the menu items and connect the signals to the callback functions.\n"
+#| " _initMenus: function() {\n"
+#| " let newAction = new Gio.SimpleAction({ name: 'new' });\n"
+#| " newAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showNew();\n"
+#| " }));\n"
+#| " this.application.add_action(newAction);\n"
+#| "\n"
+#| " let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
+#| " aboutAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showAbout();\n"
+#| " }));\n"
+#| " this.application.add_action(aboutAction);\n"
+#| "\n"
+#| " let quitAction = new Gio.SimpleAction({ name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| "\n"
+#| " this.menuModel = new Gio.Menu();\n"
+#| "\n"
+#| " this.menuItemNew = Gio.MenuItem.new(\"New\", 'app.new');\n"
+#| " this.menuItemAbout = Gio.MenuItem.new(\"About\", 'app.about');\n"
+#| " this.fileMenuItem = Gio.MenuItem.new(\"Other\", null);\n"
+#| "\n"
+#| " this.menuModel.append_item(this.menuItemNew);\n"
+#| " this.menuModel.append_item(this.menuItemAbout);\n"
+#| "\n"
+#| " //submenu\n"
+#| " this.subMenu = new Gio.Menu();\n"
+#| " this.fileMenuItem.set_submenu(this.subMenu);\n"
+#| " this.menuItemQuit = Gio.MenuItem.new(\"Quit\", 'app.quit');\n"
+#| " this.subMenu.append_item(this.menuItemQuit);\n"
+#| " this.menuModel.append_item(this.fileMenuItem);\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'activate' signal\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'startup' signal\n"
+#| " _onStartup: function() {\n"
+#| " //You must call _initMenus() before calling _buildUI().\n"
+#| " this._initMenus();\n"
+#| " this._buildUI();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application();\n"
+#| "app.application.run(ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
-" this.application = new Gtk.Application ({ application_id: 'org.example.myapp',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.myapp',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" //connect to 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow)\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"MenuButton Example\" });\n"
@@ -30219,7 +32560,7 @@ msgid ""
"\n"
" this._menuButton = new Gtk.MenuButton();\n"
" this.grid.attach(this._menuButton, 0, 0, 1, 1 );\n"
-" this.menu = new Gtk.Menu.new_from_model(this.menuModel);\n"
+" this.menu = Gtk.Menu.new_from_model(this.menuModel);\n"
"\n"
" this.menu.show();\n"
" this._menuButton.set_menu_model (this.menuModel);\n"
@@ -30227,37 +32568,28 @@ msgid ""
" this._menuButton.show();\n"
"\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _showNew: function() {\n"
-" print(\"You clicked \\\"New\\\"\");\n"
-" },\n"
+" _showNew() {\n"
+" print(\"You clicked \\\"New\\\"\");\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
+" _showAbout() {\n"
" print(\"You clicked \\\"About\\\"\");\n"
-" },\n"
+" }\n"
"\n"
" //create the menu items and connect the signals to the callback functions.\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let newAction = new Gio.SimpleAction({ name: 'new' });\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showNew();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._showNew(); });\n"
" this.application.add_action(newAction);\n"
"\n"
" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" let quitAction = new Gio.SimpleAction({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
"\n"
" this.menuModel = new Gio.Menu();\n"
@@ -30275,20 +32607,20 @@ msgid ""
" this.menuItemQuit = Gio.MenuItem.new(\"Quit\", 'app.quit');\n"
" this.subMenu.append_item(this.menuItemQuit);\n"
" this.menuModel.append_item(this.fileMenuItem);\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" //You must call _initMenus() before calling _buildUI().\n"
" this._initMenus();\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -30296,26 +32628,28 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
-" this.application = new Gtk.Application ({ application_id: 'org.example.myapp',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.myapp',\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
-" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" //connect to 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow)\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"MenuButton Example\" });\n"
@@ -30326,7 +32660,7 @@ msgstr ""
"\n"
" this._menuButton = new Gtk.MenuButton();\n"
" this.grid.attach(this._menuButton, 0, 0, 1, 1 );\n"
-" this.menu = new Gtk.Menu.new_from_model(this.menuModel);\n"
+" this.menu = Gtk.Menu.new_from_model(this.menuModel);\n"
"\n"
" this.menu.show();\n"
" this._menuButton.set_menu_model (this.menuModel);\n"
@@ -30334,37 +32668,28 @@ msgstr ""
" this._menuButton.show();\n"
"\n"
" this._window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _showNew: function() {\n"
-" print(\"You clicked \\\"New\\\"\");\n"
-" },\n"
+" _showNew() {\n"
+" print(\"You clicked \\\"New\\\"\");\n"
+" }\n"
"\n"
-" _showAbout: function() {\n"
+" _showAbout() {\n"
" print(\"You clicked \\\"About\\\"\");\n"
-" },\n"
+" }\n"
"\n"
" //create the menu items and connect the signals to the callback functions.\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let newAction = new Gio.SimpleAction({ name: 'new' });\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showNew();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._showNew(); });\n"
" this.application.add_action(newAction);\n"
"\n"
" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" let quitAction = new Gio.SimpleAction({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
"\n"
" this.menuModel = new Gio.Menu();\n"
@@ -30382,20 +32707,20 @@ msgstr ""
" this.menuItemQuit = Gio.MenuItem.new(\"Quit\", 'app.quit');\n"
" this.subMenu.append_item(this.menuItemQuit);\n"
" this.menuModel.append_item(this.fileMenuItem);\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" //You must call _initMenus() before calling _buildUI().\n"
" this._initMenus();\n"
" this._buildUI();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -32115,6 +34440,26 @@ msgstr ""
"botones."
#. (itstool) path: section/code
+#: C/messagedialog.js.page:32 C/radiobutton.js.page:29 C/scale.js.page:29
+#: C/spinbutton.js.page:32 C/statusbar.js.page:29 C/switch.js.page:36
+#: C/togglebutton.js.page:29
+#, no-wrap
+msgid ""
+"\n"
+"#!/usr/bin/gjs\n"
+"\n"
+"const Gio = imports.gi.Gio;\n"
+"const Gtk = imports.gi.Gtk;\n"
+"const Lang = imports.lang;\n"
+msgstr ""
+"\n"
+"#!/usr/bin/gjs\n"
+"\n"
+"const Gio = imports.gi.Gio;\n"
+"const Gtk = imports.gi.Gtk;\n"
+"const Lang = imports.lang;\n"
+
+#. (itstool) path: section/code
#: C/messagedialog.js.page:44
#, no-wrap
msgid ""
@@ -32486,64 +34831,186 @@ msgstr ""
#. (itstool) path: section/code
#: C/messagedialog.js.page:185
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const MessageDialogExample = new Lang.Class ({\n"
+#| " Name: 'MessageDialog Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jsmessagedialog',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal initializes menus and builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._initMenus();\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Gtk.MessageDialog Example\",\n"
+#| " default_height: 200,\n"
+#| " default_width: 400 });\n"
+#| "\n"
+#| " // Create a silly warning message and add it to the window\n"
+#| " this.warningLabel = new Gtk.Label ({\n"
+#| " label: \"This application goes boom! (Not really.)\"});\n"
+#| " this._window.add (this.warningLabel);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application menu, including the button that calls the dialog\n"
+#| " _initMenus: function() {\n"
+#| " let menu = new Gio.Menu();\n"
+#| " menu.append(\"Message\",'app.message');\n"
+#| " menu.append(\"Quit\",'app.quit');\n"
+#| " this.application.set_app_menu(menu);\n"
+#| "\n"
+#| " // This pops up a MessageDialog when \"Message\" is clicked in the menu\n"
+#| " let messageAction = new Gio.SimpleAction ({ name: 'message' });\n"
+#| " messageAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showMessageDialog();\n"
+#| " }));\n"
+#| " this.application.add_action(messageAction);\n"
+#| "\n"
+#| " // This closes the window when \"Quit\" is clicked in the menu\n"
+#| " let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _showMessageDialog: function () {\n"
+#| "\n"
+#| " // Create a modal MessageDialog whose parent is the window\n"
+#| " this._messageDialog = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " buttons: Gtk.ButtonsType.OK_CANCEL,\n"
+#| " message_type: Gtk.MessageType.WARNING,\n"
+#| " text: \"This action will cause the universe to stop existing.\" });\n"
+#| "\n"
+#| " this._messageDialog.connect ('response', Lang.bind(this, this._response_cb));\n"
+#| " this._messageDialog.show();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Callback function (aka signal handler) for the response signal\n"
+#| " _response_cb: function (messagedialog, response_id) {\n"
+#| "\n"
+#| " // A simple switch that changes the main window's label\n"
+#| " switch (response_id) {\n"
+#| " case Gtk.ResponseType.OK:\n"
+#| " this.warningLabel.set_label (\"*BOOM*\\n\");\n"
+#| " break;\n"
+#| " case Gtk.ResponseType.CANCEL:\n"
+#| " this.warningLabel.set_label (\"Good choice!\\n\");\n"
+#| " break;\n"
+#| " case Gtk.ResponseType.DELETE_EVENT:\n"
+#| " this.warningLabel.set_label (\"Dialog closed or cancelled.\\n\");\n"
+#| " break;\n"
+#| " }\n"
+#| "\n"
+#| " this._messageDialog.destroy();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new MessageDialogExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const MessageDialogExample = new Lang.Class ({\n"
-" Name: 'MessageDialog Example',\n"
+"class MessageDialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsmessagedialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({\n"
+" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Gtk.MessageDialog Example\",\n"
" default_height: 200,\n"
-" default_width: 400 });\n"
+" default_width: 400\n"
+" });\n"
"\n"
" // Create a silly warning message and add it to the window\n"
-" this.warningLabel = new Gtk.Label ({\n"
-" label: \"This application goes boom! (Not really.)\"});\n"
+" this.warningLabel = new Gtk.Label({\n"
+" label: \"This application goes boom! (Not really.)\"\n"
+" });\n"
" this._window.add (this.warningLabel);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application menu, including the button that calls the dialog\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"Message\",'app.message');\n"
" menu.append(\"Quit\",'app.quit');\n"
@@ -32551,24 +35018,16 @@ msgid ""
"\n"
" // This pops up a MessageDialog when \"Message\" is clicked in the menu\n"
" let messageAction = new Gio.SimpleAction ({ name: 'message' });\n"
-" messageAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showMessageDialog();\n"
-" }));\n"
+" messageAction.connect('activate', () => { this._showMessageDialog(); });\n"
" this.application.add_action(messageAction);\n"
"\n"
" // This closes the window when \"Quit\" is clicked in the menu\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _showMessageDialog: function () {\n"
+" _showMessageDialog() {\n"
"\n"
" // Create a modal MessageDialog whose parent is the window\n"
" this._messageDialog = new Gtk.MessageDialog ({\n"
@@ -32578,14 +35037,12 @@ msgid ""
" message_type: Gtk.MessageType.WARNING,\n"
" text: \"This action will cause the universe to stop existing.\" });\n"
"\n"
-" this._messageDialog.connect ('response', Lang.bind(this, this._response_cb));\n"
+" this._messageDialog.connect ('response', this._response_cb.bind(this));\n"
" this._messageDialog.show();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Callback function (aka signal handler) for the response signal\n"
-" _response_cb: function (messagedialog, response_id) {\n"
+" _response_cb(messagedialog, response_id) {\n"
"\n"
" // A simple switch that changes the main window's label\n"
" switch (response_id) {\n"
@@ -32603,8 +35060,7 @@ msgid ""
" this._messageDialog.destroy();\n"
"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new MessageDialogExample ();\n"
@@ -32612,61 +35068,60 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const MessageDialogExample = new Lang.Class ({\n"
-" Name: 'MessageDialog Example',\n"
+"class MessageDialogExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsmessagedialog',\n"
-" flags: Gio.ApplicationFlags.FLAGS_NONE });\n"
+" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal initializes menus and builds the UI\n"
-" _onStartup: function () {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({\n"
+" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Gtk.MessageDialog Example\",\n"
" default_height: 200,\n"
-" default_width: 400 });\n"
+" default_width: 400\n"
+" });\n"
"\n"
" // Create a silly warning message and add it to the window\n"
-" this.warningLabel = new Gtk.Label ({\n"
-" label: \"This application goes boom! (Not really.)\"});\n"
+" this.warningLabel = new Gtk.Label({\n"
+" label: \"This application goes boom! (Not really.)\"\n"
+" });\n"
" this._window.add (this.warningLabel);\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Build the application menu, including the button that calls the dialog\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"Message\",'app.message');\n"
" menu.append(\"Quit\",'app.quit');\n"
@@ -32674,24 +35129,16 @@ msgstr ""
"\n"
" // This pops up a MessageDialog when \"Message\" is clicked in the menu\n"
" let messageAction = new Gio.SimpleAction ({ name: 'message' });\n"
-" messageAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showMessageDialog();\n"
-" }));\n"
+" messageAction.connect('activate', () => { this._showMessageDialog(); });\n"
" this.application.add_action(messageAction);\n"
"\n"
" // This closes the window when \"Quit\" is clicked in the menu\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _showMessageDialog: function () {\n"
+" _showMessageDialog() {\n"
"\n"
" // Create a modal MessageDialog whose parent is the window\n"
" this._messageDialog = new Gtk.MessageDialog ({\n"
@@ -32701,14 +35148,12 @@ msgstr ""
" message_type: Gtk.MessageType.WARNING,\n"
" text: \"This action will cause the universe to stop existing.\" });\n"
"\n"
-" this._messageDialog.connect ('response', Lang.bind(this, this._response_cb));\n"
+" this._messageDialog.connect ('response', this._response_cb.bind(this));\n"
" this._messageDialog.show();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Callback function (aka signal handler) for the response signal\n"
-" _response_cb: function (messagedialog, response_id) {\n"
+" _response_cb(messagedialog, response_id) {\n"
"\n"
" // A simple switch that changes the main window's label\n"
" switch (response_id) {\n"
@@ -32726,8 +35171,7 @@ msgstr ""
" this._messageDialog.destroy();\n"
"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new MessageDialogExample ();\n"
@@ -34192,36 +36636,97 @@ msgstr "Paned (JavaScript)"
#. (itstool) path: section/code
#: C/paned.js.page:29
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const PanedExample = new Lang.Class ({\n"
+#| " Name: 'Paned Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application({ application_id: 'org.example.panedexample' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Paned Window Example\",\n"
+#| " default_width: 450,\n"
+#| " default_height: 350,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " // a new widget with two adjustable panes,\n"
+#| " // one on the left and one on the right\n"
+#| " this.paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL);\n"
+#| "\n"
+#| " // two images\n"
+#| " this.image1 = new Gtk.Image();\n"
+#| " this.image1.set_from_file(\"gnome-image.png\");\n"
+#| " this.image2 = new Gtk.Image();\n"
+#| " this.image2.set_from_file(\"tux.png\");\n"
+#| "\n"
+#| " // add the first image to the left pane\n"
+#| " this.paned.add1(this.image1);\n"
+#| " // add the second image to the right pane\n"
+#| " this.paned.add2(this.image2)\n"
+#| "\n"
+#| " // add the panes to the window\n"
+#| " this.window.add(this.paned)\n"
+#| " this.window.show_all();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new PanedExample();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const PanedExample = new Lang.Class ({\n"
-" Name: 'Paned Example',\n"
+"class PanedExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({ application_id: 'org.example.panedexample' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -34249,7 +36754,7 @@ msgid ""
" this.window.add(this.paned)\n"
" this.window.show_all();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new PanedExample();\n"
@@ -34257,33 +36762,32 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const PanedExample = new Lang.Class ({\n"
-" Name: 'Paned Example',\n"
+"class PanedExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({ application_id: 'org.example.panedexample' });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
@@ -34311,7 +36815,7 @@ msgstr ""
" this.window.add(this.paned)\n"
" this.window.show_all();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new PanedExample();\n"
@@ -35868,43 +38372,123 @@ msgstr "La ProgressBar se detiene y se inicia pulsando una tecla."
#. (itstool) path: page/code
#: C/progressbar.js.page:34
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ProgressBarExample = new Lang.Class({\n"
+#| " Name: 'ProgressBar Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsprogressbar',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 20,\n"
+#| " default_width: 220,\n"
+#| " title: \"ProgressBar Example\"});\n"
+#| "\n"
+#| " // Create the progress bar\n"
+#| " this.progressBar = new Gtk.ProgressBar ();\n"
+#| " this._window.add(this.progressBar);\n"
+#| "\n"
+#| " // Start the function that pulses the bar every 100 milliseconds\n"
+#| " this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this, this._barPulse));\n"
+#| "\n"
+#| " // Connect a keypress event to the function that toggles the bar to start or stop pulsing\n"
+#| " this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Pulse the progressbar (unless it has been disabled by a keypress)\n"
+#| " _barPulse: function() {\n"
+#| " this.progressBar.pulse();\n"
+#| " return true;\n"
+#| " },\n"
+#| "\n"
+#| " // Start or stop the progressbar when a key is pressed\n"
+#| " _onKeyPress: function() {\n"
+#| " if (this.sourceID == 0)\n"
+#| " this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this,
this._barPulse));\n"
+#| " else {\n"
+#| " GLib.source_remove(this.sourceID);\n"
+#| " this.sourceID = 0;\n"
+#| " }\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ProgressBarExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ProgressBarExample = new Lang.Class({\n"
-" Name: 'ProgressBar Example',\n"
+"class ProgressBarExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsprogressbar',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
@@ -35918,34 +38502,34 @@ msgid ""
" this._window.add(this.progressBar);\n"
"\n"
" // Start the function that pulses the bar every 100 milliseconds\n"
-" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this, this._barPulse));\n"
+" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n"
+" this._barPulse.bind(this));\n"
"\n"
" // Connect a keypress event to the function that toggles the bar to start or stop pulsing\n"
-" this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Pulse the progressbar (unless it has been disabled by a keypress)\n"
-" _barPulse: function() {\n"
+" _barPulse() {\n"
" this.progressBar.pulse();\n"
" return true;\n"
-" },\n"
+" }\n"
"\n"
" // Start or stop the progressbar when a key is pressed\n"
-" _onKeyPress: function() {\n"
+" _onKeyPress() {\n"
" if (this.sourceID == 0)\n"
-" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this,
this._barPulse));\n"
+" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n"
+" this._barPulse.bind(this));\n"
" else {\n"
" GLib.source_remove(this.sourceID);\n"
" this.sourceID = 0;\n"
" }\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ProgressBarExample ();\n"
@@ -35953,40 +38537,38 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ProgressBarExample = new Lang.Class({\n"
-" Name: 'ProgressBar Example',\n"
+"class ProgressBarExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsprogressbar',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
@@ -36000,34 +38582,34 @@ msgstr ""
" this._window.add(this.progressBar);\n"
"\n"
" // Start the function that pulses the bar every 100 milliseconds\n"
-" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this, this._barPulse));\n"
+" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n"
+" this._barPulse.bind(this));\n"
"\n"
" // Connect a keypress event to the function that toggles the bar to start or stop pulsing\n"
-" this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
" // Pulse the progressbar (unless it has been disabled by a keypress)\n"
-" _barPulse: function() {\n"
+" _barPulse() {\n"
" this.progressBar.pulse();\n"
" return true;\n"
-" },\n"
+" }\n"
"\n"
" // Start or stop the progressbar when a key is pressed\n"
-" _onKeyPress: function() {\n"
+" _onKeyPress() {\n"
" if (this.sourceID == 0)\n"
-" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, Lang.bind(this,
this._barPulse));\n"
+" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n"
+" this._barPulse.bind(this));\n"
" else {\n"
" GLib.source_remove(this.sourceID);\n"
" this.sourceID = 0;\n"
" }\n"
" }\n"
"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ProgressBarExample ();\n"
@@ -37118,6 +39700,20 @@ msgstr ""
"Después de haberlos organizado, se ponen en una tercera rejilla maestra, "
"junto con el botón «OK». Luego se adjuntan a la ventana."
+#. (itstool) path: section/code
+#: C/radiobutton.js.page:170
+#, no-wrap
+msgid ""
+"\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
+" },\n"
+msgstr ""
+"\n"
+" // Show the window and all child widgets\n"
+" this._window.show_all();\n"
+" },\n"
+
#. (itstool) path: section/p
#: C/radiobutton.js.page:176
msgid ""
@@ -37346,42 +39942,229 @@ msgstr ""
#. (itstool) path: section/code
#: C/radiobutton.js.page:270
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const RadioButtonExample = new Lang.Class({\n"
+#| " Name: 'RadioButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsradiobutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 20,\n"
+#| " title: \"Travel Planning\"});\n"
+#| "\n"
+#| " // Create a label for the first group of buttons\n"
+#| " this._placeLabel = new Gtk.Label ({label: \"Where would you like to travel to?\"});\n"
+#| "\n"
+#| " // Create three radio buttons three different ways\n"
+#| " this._place1 = new Gtk.RadioButton ({label: \"The Beach\"});\n"
+#| "\n"
+#| " this._place2 = Gtk.RadioButton.new_from_widget (this._place1);\n"
+#| " this._place2.set_label (\"The Moon\");\n"
+#| "\n"
+#| " this._place3 = Gtk.RadioButton.new_with_label_from_widget (this._place1, \"Antarctica\");\n"
+#| " // this._place3.set_active (true);\n"
+#| "\n"
+#| " // Create a label for the second group of buttons\n"
+#| " this._thingLabel = new Gtk.Label ({label: \"And what would you like to bring?\" });\n"
+#| "\n"
+#| " // Create three more radio buttons\n"
+#| " this._thing1 = new Gtk.RadioButton ({label: \"Penguins\" });\n"
+#| " this._thing2 = new Gtk.RadioButton ({label: \"Sunscreen\", group: this._thing1 });\n"
+#| " this._thing3 = new Gtk.RadioButton ({label: \"A spacesuit\", group: this._thing1 });\n"
+#| "\n"
+#| " // Create a stock OK button\n"
+#| " this._okButton = new Gtk.Button ({\n"
+#| " label: 'gtk-ok',\n"
+#| " use_stock: 'true',\n"
+#| " halign: Gtk.Align.END });\n"
+#| "\n"
+#| " // Connect the button to the function which handles clicking it\n"
+#| " this._okButton.connect ('clicked', Lang.bind (this, this._okClicked));\n"
+#| "\n"
+#| " // Create a grid to put the \"place\" items in\n"
+#| " this._places = new Gtk.Grid ();\n"
+#| "\n"
+#| " // Attach the \"place\" items to the grid\n"
+#| " this._places.attach (this._placeLabel, 0, 0, 1, 1);\n"
+#| " this._places.attach (this._place1, 0, 1, 1, 1);\n"
+#| " this._places.attach (this._place2, 0, 2, 1, 1);\n"
+#| " this._places.attach (this._place3, 0, 3, 1, 1);\n"
+#| "\n"
+#| " // Create a grid to put the \"thing\" items in\n"
+#| " this._things = new Gtk.Grid ({ margin_top: 50 });\n"
+#| "\n"
+#| " // Attach the \"thing\" items to the grid\n"
+#| " this._things.attach (this._thingLabel, 0, 0, 1, 1);\n"
+#| " this._things.attach (this._thing1, 0, 1, 1, 1);\n"
+#| " this._things.attach (this._thing2, 0, 2, 1, 1);\n"
+#| " this._things.attach (this._thing3, 0, 3, 1, 1);\n"
+#| "\n"
+#| " // Create a grid to put everything in\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " margin_left: 40,\n"
+#| " margin_right: 50 });\n"
+#| "\n"
+#| " // Attach everything to the grid\n"
+#| " this._grid.attach (this._places, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._things, 0, 1, 1, 1);\n"
+#| " this._grid.attach (this._okButton, 0, 2, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _okClicked: function () {\n"
+#| "\n"
+#| " // Create a popup that shows a silly message\n"
+#| " this._travel = new Gtk.MessageDialog ({\n"
+#| " transient_for: this._window,\n"
+#| " modal: true,\n"
+#| " message_type: Gtk.MessageType.OTHER,\n"
+#| " buttons: Gtk.ButtonsType.OK,\n"
+#| " text: this._messageText() });\n"
+#| "\n"
+#| " // Show the popup\n"
+#| " this._travel.show();\n"
+#| "\n"
+#| " // Bind the OK button to the function that closes the popup\n"
+#| " this._travel.connect (\"response\", Lang.bind (this, this._clearTravelPopUp));\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _messageText: function() {\n"
+#| "\n"
+#| " // Create a silly message for the popup depending on what you selected\n"
+#| " var stringMessage = \"\";\n"
+#| "\n"
+#| " if (this._place1.get_active()) {\n"
+#| "\n"
+#| " if (this._thing1.get_active())\n"
+#| " stringMessage = \"Penguins love the beach, too!\";\n"
+#| "\n"
+#| " else if (this._thing2.get_active())\n"
+#| " stringMessage = \"Make sure to put on that sunscreen!\";\n"
+#| "\n"
+#| " else stringMessage = \"Are you going to the beach in space?\";\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " else if (this._place2.get_active()) {\n"
+#| "\n"
+#| " if (this._thing1.get_active())\n"
+#| " stringMessage = \"The penguins will take over the moon!\";\n"
+#| "\n"
+#| " else if (this._thing2.get_active())\n"
+#| " stringMessage = \"A lack of sunscreen will be the least of your problems!\";\n"
+#| "\n"
+#| " else stringMessage = \"You'll probably want a spaceship, too!\";\n"
+#| " }\n"
+#| "\n"
+#| " else if (this._place3.get_active()) {\n"
+#| "\n"
+#| " if (this._thing1.get_active())\n"
+#| " stringMessage = \"The penguins will be happy to be back home!\";\n"
+#| "\n"
+#| " else if (this._thing2.get_active())\n"
+#| " stringMessage = \"Antarctic sunbathing may be hazardous to your health!\";\n"
+#| "\n"
+#| " else stringMessage = \"Try bringing a parka instead!\";\n"
+#| " }\n"
+#| "\n"
+#| " return stringMessage;\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _clearTravelPopUp: function () {\n"
+#| "\n"
+#| " this._travel.destroy();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new RadioButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const RadioButtonExample = new Lang.Class({\n"
-" Name: 'RadioButton Example',\n"
+"class RadioButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsradiobutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -37417,7 +40200,7 @@ msgid ""
" halign: Gtk.Align.END });\n"
"\n"
" // Connect the button to the function which handles clicking it\n"
-" this._okButton.connect ('clicked', Lang.bind (this, this._okClicked));\n"
+" this._okButton.connect ('clicked', this._okClicked.bind(this));\n"
"\n"
" // Create a grid to put the \"place\" items in\n"
" this._places = new Gtk.Grid ();\n"
@@ -37454,11 +40237,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _okClicked: function () {\n"
+" _okClicked() {\n"
"\n"
" // Create a popup that shows a silly message\n"
" this._travel = new Gtk.MessageDialog ({\n"
@@ -37472,13 +40253,11 @@ msgid ""
" this._travel.show();\n"
"\n"
" // Bind the OK button to the function that closes the popup\n"
-" this._travel.connect (\"response\", Lang.bind (this, this._clearTravelPopUp));\n"
-"\n"
-" },\n"
-"\n"
+" this._travel.connect (\"response\", this._clearTravelPopUp.bind(this));\n"
"\n"
+" }\n"
"\n"
-" _messageText: function() {\n"
+" _messageText() {\n"
"\n"
" // Create a silly message for the popup depending on what you selected\n"
" var stringMessage = \"\";\n"
@@ -37519,18 +40298,12 @@ msgid ""
"\n"
" return stringMessage;\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-"\n"
-" _clearTravelPopUp: function () {\n"
+" }\n"
"\n"
+" _clearTravelPopUp() {\n"
" this._travel.destroy();\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new RadioButtonExample ();\n"
@@ -37538,39 +40311,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const RadioButtonExample = new Lang.Class({\n"
-" Name: 'RadioButton Example',\n"
+"class RadioButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsradiobutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -37606,7 +40377,7 @@ msgstr ""
" halign: Gtk.Align.END });\n"
"\n"
" // Connect the button to the function which handles clicking it\n"
-" this._okButton.connect ('clicked', Lang.bind (this, this._okClicked));\n"
+" this._okButton.connect ('clicked', this._okClicked.bind(this));\n"
"\n"
" // Create a grid to put the \"place\" items in\n"
" this._places = new Gtk.Grid ();\n"
@@ -37643,11 +40414,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _okClicked: function () {\n"
+" _okClicked() {\n"
"\n"
" // Create a popup that shows a silly message\n"
" this._travel = new Gtk.MessageDialog ({\n"
@@ -37661,13 +40430,11 @@ msgstr ""
" this._travel.show();\n"
"\n"
" // Bind the OK button to the function that closes the popup\n"
-" this._travel.connect (\"response\", Lang.bind (this, this._clearTravelPopUp));\n"
-"\n"
-" },\n"
-"\n"
+" this._travel.connect (\"response\", this._clearTravelPopUp.bind(this));\n"
"\n"
+" }\n"
"\n"
-" _messageText: function() {\n"
+" _messageText() {\n"
"\n"
" // Create a silly message for the popup depending on what you selected\n"
" var stringMessage = \"\";\n"
@@ -37708,18 +40475,12 @@ msgstr ""
"\n"
" return stringMessage;\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-"\n"
-" _clearTravelPopUp: function () {\n"
+" }\n"
"\n"
+" _clearTravelPopUp() {\n"
" this._travel.destroy();\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new RadioButtonExample ();\n"
@@ -40044,41 +42805,168 @@ msgstr ""
#. (itstool) path: section/code
#: C/scale.js.page:204
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ScaleExample = new Lang.Class({\n"
+#| " Name: 'Scale Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsscale'\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 20,\n"
+#| " title: \"Birds on a Floe\"});\n"
+#| "\n"
+#| " // Create the horizontal scale\n"
+#| " this._hScale = Gtk.Scale.new_with_range (Gtk.Orientation.HORIZONTAL, 0.0, 100.0, 5.0);\n"
+#| " this._hScale.set_valign (Gtk.Align.START);\n"
+#| " this._hScale.set_value (50);\n"
+#| " this._hScale.set_digits (0);\n"
+#| " // this._hScale.set_draw_value (false);\n"
+#| "\n"
+#| " // Create a master adjustment to use for the vertical (or any other) scale\n"
+#| " this._adjustment = new Gtk.Adjustment ({\n"
+#| " value: 95,\n"
+#| " lower: 0,\n"
+#| " upper: 100,\n"
+#| " step_increment: 5,\n"
+#| " page_increment: 10 });\n"
+#| "\n"
+#| " // Create a vertical scale using the adjustment we just made\n"
+#| " this._vScale = new Gtk.Scale ({\n"
+#| " orientation: Gtk.Orientation.VERTICAL,\n"
+#| " adjustment: this._adjustment,\n"
+#| " digits: 0,\n"
+#| " // draw_value: false,\n"
+#| " margin_left: 10 });\n"
+#| "\n"
+#| " // Create the label that shows the product of the two values\n"
+#| " this._product = (this._hScale.get_value() * this._vScale.get_value());\n"
+#| " this._label = new Gtk.Label ({\n"
+#| " label: (String(this._product) + \" penguins on the iceberg.\"),\n"
+#| " height_request: 200,\n"
+#| " width_request: 200,\n"
+#| " wrap: true});\n"
+#| "\n"
+#| " // Connect the two scales to functions which recalculate the label\n"
+#| " this._hScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
+#| " this._vScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
+#| "\n"
+#| " // Create a grid to arrange things in\n"
+#| " this._UIGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " margin_top: 20,\n"
+#| " margin_left: 20});\n"
+#| "\n"
+#| " // Attach everything to the grid\n"
+#| " this._UIGrid.attach (this._label, 0, 0, 1, 1);\n"
+#| " this._UIGrid.attach (this._hScale, 0, 1, 1, 1);\n"
+#| " this._UIGrid.attach (this._vScale, 1, 0, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._UIGrid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _recalc: function() {\n"
+#| "\n"
+#| " // Figure out what the product of the two scales' values is\n"
+#| " var product = (this._hScale.get_value() * this._vScale.get_value());\n"
+#| "\n"
+#| " // Create a blank comment line in case there isn't a silly comment to make\n"
+#| " var comment = \"\";\n"
+#| "\n"
+#| " // Make a silly comment based on the number of penguins\n"
+#| " if (product > 9000) {\n"
+#| " comment = \"It's over 9000!\";\n"
+#| " }\n"
+#| " else if (product < 1000 && product > 0) {\n"
+#| " comment = \"They're getting lonely.\";\n"
+#| " }\n"
+#| " else if (product == 0) {\n"
+#| " comment = \"They're all gone ...\";\n"
+#| " }\n"
+#| " else comment = \"\";\n"
+#| "\n"
+#| " // Set ._label's new text\n"
+#| " this._label.set_label (String (product) + \" penguins on the iceberg. \" + comment);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ScaleExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ScaleExample = new Lang.Class({\n"
-" Name: 'Scale Example',\n"
+"class ScaleExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsscale'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -40119,8 +43007,8 @@ msgid ""
" wrap: true});\n"
"\n"
" // Connect the two scales to functions which recalculate the label\n"
-" this._hScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
-" this._vScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
+" this._hScale.connect (\"value-changed\", this._recalc.bind(this));\n"
+" this._vScale.connect (\"value-changed\", this._recalc.bind(this));\n"
"\n"
" // Create a grid to arrange things in\n"
" this._UIGrid = new Gtk.Grid ({\n"
@@ -40139,11 +43027,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _recalc: function() {\n"
+" _recalc() {\n"
"\n"
" // Figure out what the product of the two scales' values is\n"
" var product = (this._hScale.get_value() * this._vScale.get_value());\n"
@@ -40165,10 +43051,8 @@ msgid ""
"\n"
" // Set ._label's new text\n"
" this._label.set_label (String (product) + \" penguins on the iceberg. \" + comment);\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ScaleExample ();\n"
@@ -40176,38 +43060,36 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ScaleExample = new Lang.Class({\n"
-" Name: 'Scale Example',\n"
+"class ScaleExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsscale'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -40248,8 +43130,8 @@ msgstr ""
" wrap: true});\n"
"\n"
" // Connect the two scales to functions which recalculate the label\n"
-" this._hScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
-" this._vScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n"
+" this._hScale.connect (\"value-changed\", this._recalc.bind(this));\n"
+" this._vScale.connect (\"value-changed\", this._recalc.bind(this));\n"
"\n"
" // Create a grid to arrange things in\n"
" this._UIGrid = new Gtk.Grid ({\n"
@@ -40268,11 +43150,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _recalc: function() {\n"
+" _recalc() {\n"
"\n"
" // Figure out what the product of the two scales' values is\n"
" var product = (this._hScale.get_value() * this._vScale.get_value());\n"
@@ -40294,10 +43174,8 @@ msgstr ""
"\n"
" // Set ._label's new text\n"
" this._label.set_label (String (product) + \" penguins on the iceberg. \" + comment);\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ScaleExample ();\n"
@@ -40985,44 +43863,107 @@ msgstr "ScrolledWindow (JavaScript)"
#. (itstool) path: section/code
#: C/scrolledwindow.js.page:29
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ScrolledWindowExample = new Lang.Class ({\n"
+#| " Name: 'ScrolledWindow Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application({ application_id: 'org.example.jscrolledwindow' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"ScrolledWindow Example\",\n"
+#| " default_width: 200,\n"
+#| " default_height: 200,\n"
+#| " border_width: 10 });\n"
+#| " // the scrolledwindow\n"
+#| " this.scrolledWindow = new Gtk.ScrolledWindow();\n"
+#| " this.scrolledWindow.set_border_width(10);\n"
+#| " // there is always the scrollbar (otherwise: AUTOMATIC - only if needed - or NEVER)\n"
+#| " this.scrolledWindow.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS);\n"
+#| " // an image - slightly larger than the window\n"
+#| " this.image = new Gtk.Image();\n"
+#| " this.image.set_from_file(\"gnome-image.png\");\n"
+#| "\n"
+#| " // add the image to the scrolledwindow\n"
+#| " this.scrolledWindow.add_with_viewport(this.image);\n"
+#| "\n"
+#| " // add the scrolledwindow to the window\n"
+#| " this.window.add(this.scrolledWindow);\n"
+#| " this.window.show_all();\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ScrolledWindowExample();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ScrolledWindowExample = new Lang.Class ({\n"
-" Name: 'ScrolledWindow Example',\n"
+"class ScrolledWindowExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application({ application_id: 'org.example.jscrolledwindow' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jscrolledwindow'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
-" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"ScrolledWindow Example\",\n"
-" default_width: 200,\n"
-" default_height: 200,\n"
-" border_width: 10 });\n"
+" this.window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"ScrolledWindow Example\",\n"
+" default_width: 200,\n"
+" default_height: 200,\n"
+" border_width: 10\n"
+" });\n"
" // the scrolledwindow\n"
" this.scrolledWindow = new Gtk.ScrolledWindow();\n"
" this.scrolledWindow.set_border_width(10);\n"
@@ -41039,7 +43980,7 @@ msgid ""
" this.window.add(this.scrolledWindow);\n"
" this.window.show_all();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ScrolledWindowExample();\n"
@@ -41047,41 +43988,45 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ScrolledWindowExample = new Lang.Class ({\n"
-" Name: 'ScrolledWindow Example',\n"
+"class ScrolledWindowExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application({ application_id: 'org.example.jscrolledwindow' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jscrolledwindow'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
" // Create the application window\n"
-" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"ScrolledWindow Example\",\n"
-" default_width: 200,\n"
-" default_height: 200,\n"
-" border_width: 10 });\n"
+" this.window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"ScrolledWindow Example\",\n"
+" default_width: 200,\n"
+" default_height: 200,\n"
+" border_width: 10\n"
+" });\n"
" // the scrolledwindow\n"
" this.scrolledWindow = new Gtk.ScrolledWindow();\n"
" this.scrolledWindow.set_border_width(10);\n"
@@ -41098,7 +44043,7 @@ msgstr ""
" this.window.add(this.scrolledWindow);\n"
" this.window.show_all();\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ScrolledWindowExample();\n"
@@ -42737,41 +45682,153 @@ msgstr ""
#. (itstool) path: section/code
#: C/spinbutton.js.page:195
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const SpinButtonExample = new Lang.Class({\n"
+#| " Name: 'SpinButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsspinbutton'\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 20,\n"
+#| " title: \"Kitten Feeder\"});\n"
+#| "\n"
+#| " // Create the first spinbutton using a function\n"
+#| " this._kittens = Gtk.SpinButton.new_with_range (1, 9001, 1);\n"
+#| " this._kittens.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+#| "\n"
+#| " // Create an adjustment to use for the second spinbutton\n"
+#| " this._adjustment = new Gtk.Adjustment ({\n"
+#| " value: 1,\n"
+#| " lower: 0,\n"
+#| " upper: 9001,\n"
+#| " step_increment: 1,\n"
+#| " page_increment: 10 });\n"
+#| "\n"
+#| " // Create the second spinbutton\n"
+#| " this._tuna = new Gtk.SpinButton ({ adjustment: this._adjustment });\n"
+#| " this._tuna.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+#| "\n"
+#| " // this._tuna.set_digits (1);\n"
+#| " // this._tuna.set_wrap (true);\n"
+#| "\n"
+#| " // Create the text labels to go with the spinbuttons\n"
+#| " this._startLabel = new Gtk.Label ({ label: \"There are \" });\n"
+#| " this._kittenLabel = new Gtk.Label ({ label: \" kitten(s), and \"});\n"
+#| " this._tunaLabel = new Gtk.Label ({ label: \" can(s) of tuna.\"});\n"
+#| " this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()));\n"
+#| " this._lastLabel = new Gtk.Label ({\n"
+#| " label: \"That's \" + this.perKitten + \" can(s) of tuna per kitten.\" });\n"
+#| "\n"
+#| " // Create a grid to put the spinbuttons and their labels in\n"
+#| " this._spinGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " margin_bottom: 20 });\n"
+#| "\n"
+#| " // Attach everything to the grid\n"
+#| " this._spinGrid.attach (this._startLabel, 0, 0, 1, 1);\n"
+#| " this._spinGrid.attach (this._kittens, 1, 0, 1, 1);\n"
+#| " this._spinGrid.attach (this._kittenLabel, 2, 0, 1, 1);\n"
+#| " this._spinGrid.attach (this._tuna, 3, 0, 1, 1);\n"
+#| " this._spinGrid.attach (this._tunaLabel, 4, 0, 1, 1);\n"
+#| "\n"
+#| " // Create a main grid to hold it and the last label\n"
+#| " this._mainGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| "\n"
+#| " // Attach the smaller grid and the last label to the main grid\n"
+#| " this._mainGrid.attach (this._spinGrid, 0, 0, 1, 1);\n"
+#| " this._mainGrid.attach (this._lastLabel, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the main grid to the window\n"
+#| " this._window.add (this._mainGrid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _newValue: function () {\n"
+#| "\n"
+#| " // Update the label which shows how many cans there are per kitten\n"
+#| " this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()))\n"
+#| " this._lastLabel.set_label (\"That's \" + this.perKitten + \" can(s) of tuna per kitten.\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new SpinButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SpinButtonExample = new Lang.Class({\n"
-" Name: 'SpinButton Example',\n"
+"class SpinButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsspinbutton'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -42782,7 +45839,7 @@ msgid ""
"\n"
" // Create the first spinbutton using a function\n"
" this._kittens = Gtk.SpinButton.new_with_range (1, 9001, 1);\n"
-" this._kittens.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+" this._kittens.connect (\"value-changed\", this._newValue.bind(this));\n"
"\n"
" // Create an adjustment to use for the second spinbutton\n"
" this._adjustment = new Gtk.Adjustment ({\n"
@@ -42794,7 +45851,7 @@ msgid ""
"\n"
" // Create the second spinbutton\n"
" this._tuna = new Gtk.SpinButton ({ adjustment: this._adjustment });\n"
-" this._tuna.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+" this._tuna.connect (\"value-changed\", this._newValue.bind(this));\n"
"\n"
" // this._tuna.set_digits (1);\n"
" // this._tuna.set_wrap (true);\n"
@@ -42834,19 +45891,14 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _newValue: function () {\n"
+" }\n"
"\n"
+" _newValue() {\n"
" // Update the label which shows how many cans there are per kitten\n"
" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()))\n"
" this._lastLabel.set_label (\"That's \" + this.perKitten + \" can(s) of tuna per kitten.\");\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SpinButtonExample ();\n"
@@ -42854,38 +45906,36 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SpinButtonExample = new Lang.Class({\n"
-" Name: 'SpinButton Example',\n"
+"class SpinButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsspinbutton'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -42896,7 +45946,7 @@ msgstr ""
"\n"
" // Create the first spinbutton using a function\n"
" this._kittens = Gtk.SpinButton.new_with_range (1, 9001, 1);\n"
-" this._kittens.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+" this._kittens.connect (\"value-changed\", this._newValue.bind(this));\n"
"\n"
" // Create an adjustment to use for the second spinbutton\n"
" this._adjustment = new Gtk.Adjustment ({\n"
@@ -42908,7 +45958,7 @@ msgstr ""
"\n"
" // Create the second spinbutton\n"
" this._tuna = new Gtk.SpinButton ({ adjustment: this._adjustment });\n"
-" this._tuna.connect (\"value-changed\", Lang.bind (this, this._newValue));\n"
+" this._tuna.connect (\"value-changed\", this._newValue.bind(this));\n"
"\n"
" // this._tuna.set_digits (1);\n"
" // this._tuna.set_wrap (true);\n"
@@ -42948,19 +45998,14 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _newValue: function () {\n"
+" }\n"
"\n"
+" _newValue() {\n"
" // Update the label which shows how many cans there are per kitten\n"
" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()))\n"
" this._lastLabel.set_label (\"That's \" + this.perKitten + \" can(s) of tuna per kitten.\");\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SpinButtonExample ();\n"
@@ -43535,71 +46580,150 @@ msgstr "Spinner (JavaScript)"
#. (itstool) path: page/code
#: C/spinner.js.page:25
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Gdk = imports.gi.Gdk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const SpinnerExample = new Lang.Class ({\n"
+#| " Name: 'Spinner Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jsspinner',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Spinner Example\",\n"
+#| " default_height: 200,\n"
+#| " default_width: 200,\n"
+#| " border_width: 30 });\n"
+#| "\n"
+#| " // Create a spinner which starts spinning automatically\n"
+#| " this._spinner = new Gtk.Spinner ({active: true});\n"
+#| " this._window.add (this._spinner);\n"
+#| "\n"
+#| " // Connect a keypress event to the function that makes it start or stop spinning\n"
+#| " this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onKeyPress: function(widget, event) {\n"
+#| "\n"
+#| " // Get the value of the key that was pressed\n"
+#| " let keyval = event.get_keyval()[1];\n"
+#| "\n"
+#| " // If it was the spacebar, toggle the spinner to start or stop\n"
+#| " if (keyval == Gdk.KEY_space) {\n"
+#| " if (this._spinner.active == true)\n"
+#| " this._spinner.stop();\n"
+#| " else\n"
+#| " this._spinner.start();\n"
+#| " }\n"
+#| " }\n"
+#| "\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new SpinnerExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
"const Gdk = imports.gi.Gdk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SpinnerExample = new Lang.Class ({\n"
-" Name: 'Spinner Example',\n"
+"class SpinnerExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsspinner',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({\n"
+" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Spinner Example\",\n"
" default_height: 200,\n"
" default_width: 200,\n"
-" border_width: 30 });\n"
+" border_width: 30\n"
+" });\n"
"\n"
" // Create a spinner which starts spinning automatically\n"
" this._spinner = new Gtk.Spinner ({active: true});\n"
" this._window.add (this._spinner);\n"
"\n"
" // Connect a keypress event to the function that makes it start or stop spinning\n"
-" this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onKeyPress: function(widget, event) {\n"
+" _onKeyPress(widget, event) {\n"
"\n"
" // Get the value of the key that was pressed\n"
-" let keyval = event.get_keyval()[1];\n"
+" let [, keyval] = event.get_keyval();\n"
"\n"
" // If it was the spacebar, toggle the spinner to start or stop\n"
" if (keyval == Gdk.KEY_space) {\n"
@@ -43609,9 +46733,7 @@ msgid ""
" this._spinner.start();\n"
" }\n"
" }\n"
-"\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SpinnerExample ();\n"
@@ -43619,68 +46741,66 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
"const Gdk = imports.gi.Gdk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SpinnerExample = new Lang.Class ({\n"
-" Name: 'Spinner Example',\n"
+"class SpinnerExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsspinner',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this._window = new Gtk.ApplicationWindow ({\n"
+" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
" window_position: Gtk.WindowPosition.CENTER,\n"
" title: \"Spinner Example\",\n"
" default_height: 200,\n"
" default_width: 200,\n"
-" border_width: 30 });\n"
+" border_width: 30\n"
+" });\n"
"\n"
" // Create a spinner which starts spinning automatically\n"
" this._spinner = new Gtk.Spinner ({active: true});\n"
" this._window.add (this._spinner);\n"
"\n"
" // Connect a keypress event to the function that makes it start or stop spinning\n"
-" this._window.connect(\"key-press-event\", Lang.bind(this, this._onKeyPress));\n"
+" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n"
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onKeyPress: function(widget, event) {\n"
+" _onKeyPress(widget, event) {\n"
"\n"
" // Get the value of the key that was pressed\n"
-" let keyval = event.get_keyval()[1];\n"
+" let [, keyval] = event.get_keyval();\n"
"\n"
" // If it was the spacebar, toggle the spinner to start or stop\n"
" if (keyval == Gdk.KEY_space) {\n"
@@ -43690,9 +46810,7 @@ msgstr ""
" this._spinner.start();\n"
" }\n"
" }\n"
-"\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SpinnerExample ();\n"
@@ -44820,42 +47938,191 @@ msgstr ""
#. (itstool) path: section/code
#: C/statusbar.js.page:217
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const StatusbarExample = new Lang.Class({\n"
+#| " Name: 'Statusbar Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsstatusbar',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 120,\n"
+#| " default_width: 300,\n"
+#| " title: \"Button Clicker\"});\n"
+#| "\n"
+#| " // Create a paned interface\n"
+#| " this._panes = new Gtk.Paned ({\n"
+#| " orientation: Gtk.Orientation.VERTICAL });\n"
+#| "\n"
+#| " // Create the main button\n"
+#| " this._clickMe = new Gtk.Button ({\n"
+#| " label: \"Click Me!\" });\n"
+#| " this._clickMe.connect (\"clicked\", Lang.bind (this, this._clicked));\n"
+#| "\n"
+#| " // Create the back button\n"
+#| " this._backButton = new Gtk.Button ({\n"
+#| " label: \"gtk-go-back\",\n"
+#| " use_stock: true });\n"
+#| " this._backButton.connect (\"clicked\", Lang.bind (this, this._back));\n"
+#| "\n"
+#| " // Create the clear button\n"
+#| " this._clearButton = new Gtk.Button ({\n"
+#| " label: \"gtk-clear\",\n"
+#| " use_stock: true });\n"
+#| " this._clearButton.connect (\"clicked\", Lang.bind (this, this._clear));\n"
+#| "\n"
+#| " // Put the buttons in a grid\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| " this._grid.attach (this._backButton, 0, 0, 1, 1);\n"
+#| " this._grid.attach_next_to (this._clickMe, this._backButton, Gtk.PositionType.RIGHT, 1, 1);\n"
+#| " this._grid.attach_next_to (this._clearButton, this._clickMe, Gtk.PositionType.RIGHT, 1, 1);\n"
+#| "\n"
+#| " // Put the grid in a large frame that fills most of the window\n"
+#| " this._topFrame = new Gtk.Frame ({\n"
+#| " border_width: 20,\n"
+#| " height_request: 90,\n"
+#| " width_request: 300});\n"
+#| " this._topFrame.add (this._grid);\n"
+#| "\n"
+#| " // Create the statusbar\n"
+#| " this._statusbar = new Gtk.Statusbar();\n"
+#| "\n"
+#| " // Keep track of the number of times the button has been clicked\n"
+#| " this.Clicks = 0;\n"
+#| " this.ContextID = this._statusbar.get_context_id (\"Number of Clicks\");\n"
+#| "\n"
+#| " // Give the statusbar an initial message\n"
+#| " this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
+#| "\n"
+#| " // Put the statusbar in its own frame at the bottom\n"
+#| " this._barFrame = new Gtk.Frame ({\n"
+#| " height_request: 30 });\n"
+#| " this._barFrame.add (this._statusbar);\n"
+#| "\n"
+#| " // Assemble the frames into the paned interface\n"
+#| " this._panes.pack1 (this._topFrame, true, false);\n"
+#| " this._panes.pack2 (this._barFrame, false, false);\n"
+#| "\n"
+#| " // Put the panes into the window\n"
+#| " this._window.add (this._panes);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _clicked: function() {\n"
+#| "\n"
+#| " // Increment the number of clicks by 1\n"
+#| " this.Clicks++;\n"
+#| "\n"
+#| " // Update the statusbar with the new number of clicks\n"
+#| " this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _back: function () {\n"
+#| "\n"
+#| " // If there have been any clicks, decrement by 1 and remove last statusbar update\n"
+#| " if (this.Clicks > 0 ) {\n"
+#| " this.Clicks--;\n"
+#| " this._statusbar.pop (this.ContextID);\n"
+#| " };\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _clear: function () {\n"
+#| "\n"
+#| " // Reset the number of clicks\n"
+#| " this.Clicks = 0;\n"
+#| "\n"
+#| " // Wipe out all the messages pushed to the statusbar\n"
+#| " this._statusbar.remove_all (this.ContextID);\n"
+#| "\n"
+#| " // Reset the statusbar's message\n"
+#| " this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new StatusbarExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const StatusbarExample = new Lang.Class({\n"
-" Name: 'Statusbar Example',\n"
+"class StatusbarExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsstatusbar',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -44872,19 +48139,19 @@ msgid ""
" // Create the main button\n"
" this._clickMe = new Gtk.Button ({\n"
" label: \"Click Me!\" });\n"
-" this._clickMe.connect (\"clicked\", Lang.bind (this, this._clicked));\n"
+" this._clickMe.connect (\"clicked\", this._clicked.bind(this));\n"
"\n"
" // Create the back button\n"
" this._backButton = new Gtk.Button ({\n"
" label: \"gtk-go-back\",\n"
" use_stock: true });\n"
-" this._backButton.connect (\"clicked\", Lang.bind (this, this._back));\n"
+" this._backButton.connect (\"clicked\", this._back.bind(this));\n"
"\n"
" // Create the clear button\n"
" this._clearButton = new Gtk.Button ({\n"
" label: \"gtk-clear\",\n"
" use_stock: true });\n"
-" this._clearButton.connect (\"clicked\", Lang.bind (this, this._clear));\n"
+" this._clearButton.connect (\"clicked\", this._clear.bind(this));\n"
"\n"
" // Put the buttons in a grid\n"
" this._grid = new Gtk.Grid ({\n"
@@ -44925,35 +48192,27 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _clicked: function() {\n"
+" _clicked() {\n"
"\n"
" // Increment the number of clicks by 1\n"
" this.Clicks++;\n"
"\n"
" // Update the statusbar with the new number of clicks\n"
" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _back: function () {\n"
+" _back() {\n"
"\n"
" // If there have been any clicks, decrement by 1 and remove last statusbar update\n"
" if (this.Clicks > 0 ) {\n"
" this.Clicks--;\n"
" this._statusbar.pop (this.ContextID);\n"
" };\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _clear: function () {\n"
+" _clear() {\n"
"\n"
" // Reset the number of clicks\n"
" this.Clicks = 0;\n"
@@ -44963,10 +48222,8 @@ msgid ""
"\n"
" // Reset the statusbar's message\n"
" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new StatusbarExample ();\n"
@@ -44974,39 +48231,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const StatusbarExample = new Lang.Class({\n"
-" Name: 'Statusbar Example',\n"
+"class StatusbarExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsstatusbar',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -45023,19 +48278,19 @@ msgstr ""
" // Create the main button\n"
" this._clickMe = new Gtk.Button ({\n"
" label: \"Click Me!\" });\n"
-" this._clickMe.connect (\"clicked\", Lang.bind (this, this._clicked));\n"
+" this._clickMe.connect (\"clicked\", this._clicked.bind(this));\n"
"\n"
" // Create the back button\n"
" this._backButton = new Gtk.Button ({\n"
" label: \"gtk-go-back\",\n"
" use_stock: true });\n"
-" this._backButton.connect (\"clicked\", Lang.bind (this, this._back));\n"
+" this._backButton.connect (\"clicked\", this._back.bind(this));\n"
"\n"
" // Create the clear button\n"
" this._clearButton = new Gtk.Button ({\n"
" label: \"gtk-clear\",\n"
" use_stock: true });\n"
-" this._clearButton.connect (\"clicked\", Lang.bind (this, this._clear));\n"
+" this._clearButton.connect (\"clicked\", this._clear.bind(this));\n"
"\n"
" // Put the buttons in a grid\n"
" this._grid = new Gtk.Grid ({\n"
@@ -45076,35 +48331,27 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _clicked: function() {\n"
+" _clicked() {\n"
"\n"
" // Increment the number of clicks by 1\n"
" this.Clicks++;\n"
"\n"
" // Update the statusbar with the new number of clicks\n"
" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _back: function () {\n"
+" _back() {\n"
"\n"
" // If there have been any clicks, decrement by 1 and remove last statusbar update\n"
" if (this.Clicks > 0 ) {\n"
" this.Clicks--;\n"
" this._statusbar.pop (this.ContextID);\n"
" };\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _clear: function () {\n"
+" _clear() {\n"
"\n"
" // Reset the number of clicks\n"
" this.Clicks = 0;\n"
@@ -45114,10 +48361,8 @@ msgstr ""
"\n"
" // Reset the statusbar's message\n"
" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new StatusbarExample ();\n"
@@ -46719,42 +49964,220 @@ msgstr ""
#. (itstool) path: section/code
#: C/switch.js.page:260
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const SwitchExample = new Lang.Class({\n"
+#| " Name: 'Switch Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jsswitch'\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal creates the menu and builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._initMenus();\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " border_width: 20,\n"
+#| " title: \"Animal Creator\"});\n"
+#| "\n"
+#| " // Create the image widget and set its default picture\n"
+#| " this._image = new Gtk.Image ({file: \"redfox.png\"});\n"
+#| "\n"
+#| " // Create a label for the first switch\n"
+#| " this._flyLabel = new Gtk.Label ({\n"
+#| " label: \"Make it fly\",\n"
+#| " margin_right: 30});\n"
+#| "\n"
+#| " // Create the first switch and set its default position\n"
+#| " this._flySwitch = new Gtk.Switch ({active: false});\n"
+#| " this._flySwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+#| "\n"
+#| " // Create a label for the second switch\n"
+#| " this._birdLabel = new Gtk.Label ({\n"
+#| " label: \"Make it a bird\",\n"
+#| " margin_right: 30});\n"
+#| "\n"
+#| " // Create the second switch\n"
+#| " this._birdSwitch = new Gtk.Switch ({active: false});\n"
+#| " this._birdSwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+#| "\n"
+#| " // Create a grid for the labels and switches beneath the picture\n"
+#| " this._UIGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER,\n"
+#| " margin_top: 20});\n"
+#| "\n"
+#| " // Attach the labels and switches to that grid\n"
+#| " this._UIGrid.attach (this._flyLabel, 0, 0, 1, 1);\n"
+#| " this._UIGrid.attach (this._flySwitch, 1, 0, 1, 1);\n"
+#| " this._UIGrid.attach (this._birdLabel, 0, 1, 1, 1);\n"
+#| " this._UIGrid.attach (this._birdSwitch, 1, 1, 1, 1);\n"
+#| "\n"
+#| " // Create a master grid to put both the UI and the picture into\n"
+#| " this._mainGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| "\n"
+#| " // Attach the picture and the UI grid to the master grid\n"
+#| " this._mainGrid.attach (this._image, 0, 0, 1, 1);\n"
+#| " this._mainGrid.attach (this._UIGrid, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the master grid to the window\n"
+#| " this._window.add (this._mainGrid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _switchFlip: function() {\n"
+#| "\n"
+#| " // Change the picture depending on which switches are flipped\n"
+#| " if (this._flySwitch.get_active()) {\n"
+#| "\n"
+#| " if (this._birdSwitch.get_active()) this._image.set_from_file (\"muteswan.png\");\n"
+#| "\n"
+#| " else this._image.set_from_file (\"fruitbat.png\");\n"
+#| " }\n"
+#| "\n"
+#| " else {\n"
+#| "\n"
+#| " if (this._birdSwitch.get_active()) this._image.set_from_file (\"gentoopenguin.png\");\n"
+#| "\n"
+#| " else this._image.set_from_file (\"redfox.png\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _initMenus: function() {\n"
+#| "\n"
+#| " // Build the application's menu so we can have an \"About\" button\n"
+#| " let menu = new Gio.Menu();\n"
+#| " menu.append(\"About\", 'app.about');\n"
+#| " menu.append(\"Quit\",'app.quit');\n"
+#| " this.application.set_app_menu(menu);\n"
+#| "\n"
+#| " // Bind the \"About\" button to the _showAbout() function\n"
+#| " let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
+#| " aboutAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._showAbout();\n"
+#| " }));\n"
+#| " this.application.add_action(aboutAction);\n"
+#| "\n"
+#| " // Bind the \"Quit\" button to the function that closes the window\n"
+#| " let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _showAbout: function () {\n"
+#| "\n"
+#| " // String arrays of the names of the people involved in the project\n"
+#| " var artists = ['Rob Lee http://en.wikipedia.org/wiki/File:Fuzzy_Freddy.png', 'Ken Funakoshi
http://en.wikipedia.org/wiki/File:Pygoscelis_papua_-Nagasaki_Penguin_Aquarium_-swimming_underwater-8a.png',
'Shek Graham http://www.flickr.com/photos/shekgraham/127431519/in/photostream/', 'Mindaugas Urbonas
http://commons.wikimedia.org/wiki/File:Mute_Swan-Mindaugas_Urbonas.png'];\n"
+#| " var authors = [\"GNOME Documentation Team\"];\n"
+#| " var documenters = [\"GNOME Documentation Team\"];\n"
+#| "\n"
+#| " // Create the About dialog\n"
+#| " let aboutDialog = new Gtk.AboutDialog({\n"
+#| " title: \"AboutDialog Example\",\n"
+#| " program_name: \"Animal Creator\",\n"
+#| " copyright: \"Copyright \\xa9 2012 GNOME Documentation Team\\n\\nRed fox photo licensed CC-By
by Rob Lee\\nGentoo penguin photo licensed CC-By-SA by Ken Funakoshi\\nFruit bat photo licensed CC-By by Shek
Graham\\nMute swan photo licensed CC-By-SA by Mindaugas Urbonas\\nLinks to the originals are available under
Credits.\\n\\nHave you hugged a penguin today?\",\n"
+#| " artists: artists,\n"
+#| " authors: authors,\n"
+#| " documenters: documenters,\n"
+#| " website: \"http://developer.gnome.org\",\n"
+#| " website_label: \"GNOME Developer Website\" });\n"
+#| "\n"
+#| " // Attach the About dialog to the window\n"
+#| " aboutDialog.modal = true;\n"
+#| " aboutDialog.transient_for = this._window;\n"
+#| "\n"
+#| " // Show the About dialog\n"
+#| " aboutDialog.show();\n"
+#| "\n"
+#| " // Connect the Close button to the destroy signal for the dialog\n"
+#| " aboutDialog.connect('response', function() {\n"
+#| " aboutDialog.destroy();\n"
+#| " });\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new SwitchExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SwitchExample = new Lang.Class({\n"
-" Name: 'Switch Example',\n"
+"class SwitchExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsswitch'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal creates the menu and builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -46773,7 +50196,7 @@ msgid ""
"\n"
" // Create the first switch and set its default position\n"
" this._flySwitch = new Gtk.Switch ({active: false});\n"
-" this._flySwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+" this._flySwitch.connect ('notify::active', this._switchFlip.bind(this));\n"
"\n"
" // Create a label for the second switch\n"
" this._birdLabel = new Gtk.Label ({\n"
@@ -46782,7 +50205,7 @@ msgid ""
"\n"
" // Create the second switch\n"
" this._birdSwitch = new Gtk.Switch ({active: false});\n"
-" this._birdSwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+" this._birdSwitch.connect ('notify::active', this._switchFlip.bind(this));\n"
"\n"
" // Create a grid for the labels and switches beneath the picture\n"
" this._UIGrid = new Gtk.Grid ({\n"
@@ -46810,33 +50233,27 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
+" }\n"
"\n"
-"\n"
-" _switchFlip: function() {\n"
+" _switchFlip() {\n"
"\n"
" // Change the picture depending on which switches are flipped\n"
" if (this._flySwitch.get_active()) {\n"
"\n"
-" if (this._birdSwitch.get_active()) this._image.set_from_file (\"muteswan.png\");\n"
-"\n"
-" else this._image.set_from_file (\"fruitbat.png\");\n"
-" }\n"
-"\n"
-" else {\n"
-"\n"
-" if (this._birdSwitch.get_active()) this._image.set_from_file (\"gentoopenguin.png\");\n"
-"\n"
-" else this._image.set_from_file (\"redfox.png\");\n"
+" if (this._birdSwitch.get_active())\n"
+" this._image.set_from_file (\"muteswan.png\");\n"
+" else\n"
+" this._image.set_from_file (\"fruitbat.png\");\n"
+" } else {\n"
"\n"
+" if (this._birdSwitch.get_active())\n"
+" this._image.set_from_file (\"gentoopenguin.png\");\n"
+" else\n"
+" this._image.set_from_file (\"redfox.png\");\n"
" }\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
"\n"
" // Build the application's menu so we can have an \"About\" button\n"
" let menu = new Gio.Menu();\n"
@@ -46846,24 +50263,16 @@ msgid ""
"\n"
" // Bind the \"About\" button to the _showAbout() function\n"
" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" // Bind the \"Quit\" button to the function that closes the window\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _showAbout: function () {\n"
+" _showAbout() {\n"
"\n"
" // String arrays of the names of the people involved in the project\n"
" var artists = ['Rob Lee http://en.wikipedia.org/wiki/File:Fuzzy_Freddy.png', 'Ken Funakoshi
http://en.wikipedia.org/wiki/File:Pygoscelis_papua_-Nagasaki_Penguin_Aquarium_-swimming_underwater-8a.png',
'Shek Graham http://www.flickr.com/photos/shekgraham/127431519/in/photostream/', 'Mindaugas Urbonas
http://commons.wikimedia.org/wiki/File:Mute_Swan-Mindaugas_Urbonas.png'];\n"
@@ -46893,8 +50302,7 @@ msgid ""
" aboutDialog.destroy();\n"
" });\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SwitchExample ();\n"
@@ -46902,39 +50310,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const SwitchExample = new Lang.Class({\n"
-" Name: 'Switch Example',\n"
+"class SwitchExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jsswitch'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal creates the menu and builds the UI\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -46953,7 +50359,7 @@ msgstr ""
"\n"
" // Create the first switch and set its default position\n"
" this._flySwitch = new Gtk.Switch ({active: false});\n"
-" this._flySwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+" this._flySwitch.connect ('notify::active', this._switchFlip.bind(this));\n"
"\n"
" // Create a label for the second switch\n"
" this._birdLabel = new Gtk.Label ({\n"
@@ -46962,7 +50368,7 @@ msgstr ""
"\n"
" // Create the second switch\n"
" this._birdSwitch = new Gtk.Switch ({active: false});\n"
-" this._birdSwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n"
+" this._birdSwitch.connect ('notify::active', this._switchFlip.bind(this));\n"
"\n"
" // Create a grid for the labels and switches beneath the picture\n"
" this._UIGrid = new Gtk.Grid ({\n"
@@ -46990,33 +50396,27 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _switchFlip: function() {\n"
+" _switchFlip() {\n"
"\n"
" // Change the picture depending on which switches are flipped\n"
" if (this._flySwitch.get_active()) {\n"
"\n"
-" if (this._birdSwitch.get_active()) this._image.set_from_file (\"muteswan.png\");\n"
-"\n"
-" else this._image.set_from_file (\"fruitbat.png\");\n"
-" }\n"
-"\n"
-" else {\n"
-"\n"
-" if (this._birdSwitch.get_active()) this._image.set_from_file (\"gentoopenguin.png\");\n"
-"\n"
-" else this._image.set_from_file (\"redfox.png\");\n"
+" if (this._birdSwitch.get_active())\n"
+" this._image.set_from_file (\"muteswan.png\");\n"
+" else\n"
+" this._image.set_from_file (\"fruitbat.png\");\n"
+" } else {\n"
"\n"
+" if (this._birdSwitch.get_active())\n"
+" this._image.set_from_file (\"gentoopenguin.png\");\n"
+" else\n"
+" this._image.set_from_file (\"redfox.png\");\n"
" }\n"
+" }\n"
"\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _initMenus: function() {\n"
+" _initMenus() {\n"
"\n"
" // Build the application's menu so we can have an \"About\" button\n"
" let menu = new Gio.Menu();\n"
@@ -47026,24 +50426,16 @@ msgstr ""
"\n"
" // Bind the \"About\" button to the _showAbout() function\n"
" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n"
-" aboutAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._showAbout();\n"
-" }));\n"
+" aboutAction.connect('activate', () => { this._showAbout(); });\n"
" this.application.add_action(aboutAction);\n"
"\n"
" // Bind the \"Quit\" button to the function that closes the window\n"
" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _showAbout: function () {\n"
+" _showAbout() {\n"
"\n"
" // String arrays of the names of the people involved in the project\n"
" var artists = ['Rob Lee http://en.wikipedia.org/wiki/File:Fuzzy_Freddy.png', 'Ken Funakoshi
http://en.wikipedia.org/wiki/File:Pygoscelis_papua_-Nagasaki_Penguin_Aquarium_-swimming_underwater-8a.png',
'Shek Graham http://www.flickr.com/photos/shekgraham/127431519/in/photostream/', 'Mindaugas Urbonas
http://commons.wikimedia.org/wiki/File:Mute_Swan-Mindaugas_Urbonas.png'];\n"
@@ -47073,8 +50465,7 @@ msgstr ""
" aboutDialog.destroy();\n"
" });\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new SwitchExample ();\n"
@@ -48218,39 +51609,192 @@ msgstr ""
#. (itstool) path: section/code
#: C/textview.js.page:244
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const TextViewExample = new Lang.Class ({\n"
+#| " Name: 'TextView Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.jstextview' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function () {\n"
+#| " this._window.present ();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow ({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Talk to a Penguin\",\n"
+#| " default_height: 400,\n"
+#| " default_width: 440,\n"
+#| " border_width: 20 });\n"
+#| "\n"
+#| " // Create a label for the penguin to talk to you\n"
+#| " this._penguin = new Gtk.Label ({\n"
+#| " height_request: 180,\n"
+#| " width_request: 400,\n"
+#| " label: \"Squaaaak?\",\n"
+#| " wrap: true });\n"
+#| "\n"
+#| " // Create a textview for you to talk to the penguin\n"
+#| " this.buffer = new Gtk.TextBuffer();\n"
+#| " this._textView = new Gtk.TextView ({\n"
+#| " buffer: this.buffer,\n"
+#| " editable: true,\n"
+#| " wrap_mode: Gtk.WrapMode.WORD });\n"
+#| "\n"
+#| " // Create a \"scrolled window\" to put your textview in so it will scroll\n"
+#| " this._scrolled = new Gtk.ScrolledWindow ({\n"
+#| " hscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n"
+#| " vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n"
+#| " shadow_type: Gtk.ShadowType.ETCHED_IN,\n"
+#| " height_request: 180,\n"
+#| " width_request: 400, });\n"
+#| "\n"
+#| " // Put the textview into the scrolled window\n"
+#| " this._scrolled.add_with_viewport (this._textView);\n"
+#| "\n"
+#| " // Create a grid to organize them in\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| "\n"
+#| " // Put the label and textview in the grid one on top of the other\n"
+#| " this._grid.attach (this._penguin, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._scrolled, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Create a button to send your message to the penguin\n"
+#| " this._send = new Gtk.Button ({\n"
+#| " halign: Gtk.Align.END,\n"
+#| " margin_top: 20,\n"
+#| " label: \"Send\" });\n"
+#| " this._send.connect ('clicked', Lang.bind (this, this._chat));\n"
+#| "\n"
+#| " // Create a grid that will have the other grid on top and the button on bottom\n"
+#| " this._mainGrid = new Gtk.Grid ({\n"
+#| " halign: Gtk.Align.CENTER,\n"
+#| " valign: Gtk.Align.CENTER });\n"
+#| "\n"
+#| " // Add the other grid and the button to the main grid\n"
+#| " this._mainGrid.attach (this._grid, 0, 0, 1, 1);\n"
+#| " this._mainGrid.attach (this._send, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Attach the main grid to the window\n"
+#| " this._window.add (this._mainGrid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _chat: function () {\n"
+#| "\n"
+#| " // Create a random number to determine what the penguin says\n"
+#| " this.number = Math.floor ((Math.random() * 3) + 1);\n"
+#| "\n"
+#| " // Did you actually say anything?\n"
+#| " if (this.buffer.text) {\n"
+#| "\n"
+#| " // Did you mention fish?\n"
+#| " if (this.buffer.text.match (/fish/gi)) {\n"
+#| "\n"
+#| " // Have the penguin squaak about fish\n"
+#| " if (this.number == 1)\n"
+#| " this._penguin.set_label (\"FISH!\");\n"
+#| "\n"
+#| " else if (this.number == 2)\n"
+#| " this._penguin.set_label (\"Fish fish fish fish. Fish!\");\n"
+#| "\n"
+#| " else\n"
+#| " this._penguin.set_label (\"Fish? Fish fish fish. Fish fish. FISH!\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " // I guess you didn't mention fish\n"
+#| " else {\n"
+#| "\n"
+#| " // Have the penguin talk about penguinny stuff\n"
+#| " if (this.number == 1)\n"
+#| " this._penguin.set_label (\"SQUAAK!\");\n"
+#| "\n"
+#| " else if (this.number == 2)\n"
+#| " this._penguin.set_label (\"Ork ork ork ork squaak. Squaak squaak! *waves
flippers*\");\n"
+#| "\n"
+#| " else\n"
+#| " this._penguin.set_label (\"Ork ork ork ork ork?\");\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| " // Clear the buffer\n"
+#| " this.buffer.text = \"\";\n"
+#| "\n"
+#| " // Give focus back to the textview so you don't have to click it again\n"
+#| " this._textView.has_focus = true;\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new TextViewExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const TextViewExample = new Lang.Class ({\n"
-" Name: 'TextView Example',\n"
+"class TextViewExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jstextview' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jstextview'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -48300,7 +51844,7 @@ msgid ""
" halign: Gtk.Align.END,\n"
" margin_top: 20,\n"
" label: \"Send\" });\n"
-" this._send.connect ('clicked', Lang.bind (this, this._chat));\n"
+" this._send.connect ('clicked', this._chat.bind(this));\n"
"\n"
" // Create a grid that will have the other grid on top and the button on bottom\n"
" this._mainGrid = new Gtk.Grid ({\n"
@@ -48316,11 +51860,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _chat: function () {\n"
+" _chat() {\n"
"\n"
" // Create a random number to determine what the penguin says\n"
" this.number = Math.floor ((Math.random() * 3) + 1);\n"
@@ -48365,10 +51907,8 @@ msgid ""
"\n"
" // Give focus back to the textview so you don't have to click it again\n"
" this._textView.has_focus = true;\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TextViewExample ();\n"
@@ -48376,36 +51916,34 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const TextViewExample = new Lang.Class ({\n"
-" Name: 'TextView Example',\n"
+"class TextViewExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
-" application_id: 'org.example.jstextview' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jstextview'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function () {\n"
-" this._window.present ();\n"
-" },\n"
+" _onActivate() {\n"
+" this._window.present();\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow ({\n"
@@ -48455,7 +51993,7 @@ msgstr ""
" halign: Gtk.Align.END,\n"
" margin_top: 20,\n"
" label: \"Send\" });\n"
-" this._send.connect ('clicked', Lang.bind (this, this._chat));\n"
+" this._send.connect ('clicked', this._chat.bind(this));\n"
"\n"
" // Create a grid that will have the other grid on top and the button on bottom\n"
" this._mainGrid = new Gtk.Grid ({\n"
@@ -48471,11 +52009,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _chat: function () {\n"
+" _chat() {\n"
"\n"
" // Create a random number to determine what the penguin says\n"
" this.number = Math.floor ((Math.random() * 3) + 1);\n"
@@ -48520,10 +52056,8 @@ msgstr ""
"\n"
" // Give focus back to the textview so you don't have to click it again\n"
" this._textView.has_focus = true;\n"
-"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TextViewExample ();\n"
@@ -49647,42 +53181,123 @@ msgstr ""
#. (itstool) path: section/code
#: C/togglebutton.js.page:149
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const ToggleButtonExample = new Lang.Class({\n"
+#| " Name: 'ToggleButton Example',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jstogglebutton',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 300,\n"
+#| " default_width: 300,\n"
+#| " border_width: 30,\n"
+#| " title: \"ToggleButton Example\"});\n"
+#| "\n"
+#| " // Create the spinner that the button stops and starts\n"
+#| " this._spinner = new Gtk.Spinner ({hexpand: true, vexpand: true});\n"
+#| "\n"
+#| " // Create the togglebutton that starts and stops the spinner\n"
+#| " this._toggleButton = new Gtk.ToggleButton ({label: \"Start/Stop\"});\n"
+#| " this._toggleButton.connect ('toggled', Lang.bind (this, this._onToggle));\n"
+#| "\n"
+#| " // Create a grid and put everything in it\n"
+#| " this._grid = new Gtk.Grid ({\n"
+#| " row_homogeneous: false,\n"
+#| " row_spacing: 15});\n"
+#| " this._grid.attach (this._spinner, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._toggleButton, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onToggle: function() {\n"
+#| "\n"
+#| " // Start or stop the spinner\n"
+#| " if (this._toggleButton.get_active ())\n"
+#| " this._spinner.start ();\n"
+#| " else this._spinner.stop ();\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new ToggleButtonExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ToggleButtonExample = new Lang.Class({\n"
-" Name: 'ToggleButton Example',\n"
+"class ToggleButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jstogglebutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -49698,7 +53313,7 @@ msgid ""
"\n"
" // Create the togglebutton that starts and stops the spinner\n"
" this._toggleButton = new Gtk.ToggleButton ({label: \"Start/Stop\"});\n"
-" this._toggleButton.connect ('toggled', Lang.bind (this, this._onToggle));\n"
+" this._toggleButton.connect ('toggled', this._onToggle.bind(this));\n"
"\n"
" // Create a grid and put everything in it\n"
" this._grid = new Gtk.Grid ({\n"
@@ -49712,11 +53327,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onToggle: function() {\n"
+" _onToggle() {\n"
"\n"
" // Start or stop the spinner\n"
" if (this._toggleButton.get_active ())\n"
@@ -49724,8 +53337,7 @@ msgid ""
" else this._spinner.stop ();\n"
"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ToggleButtonExample ();\n"
@@ -49733,39 +53345,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const ToggleButtonExample = new Lang.Class({\n"
-" Name: 'ToggleButton Example',\n"
+"class ToggleButtonExample {\n"
"\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jstogglebutton',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
@@ -49781,7 +53391,7 @@ msgstr ""
"\n"
" // Create the togglebutton that starts and stops the spinner\n"
" this._toggleButton = new Gtk.ToggleButton ({label: \"Start/Stop\"});\n"
-" this._toggleButton.connect ('toggled', Lang.bind (this, this._onToggle));\n"
+" this._toggleButton.connect ('toggled', this._onToggle.bind(this));\n"
"\n"
" // Create a grid and put everything in it\n"
" this._grid = new Gtk.Grid ({\n"
@@ -49795,11 +53405,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
+" }\n"
"\n"
-" _onToggle: function() {\n"
+" _onToggle() {\n"
"\n"
" // Start or stop the spinner\n"
" if (this._toggleButton.get_active ())\n"
@@ -49807,8 +53415,7 @@ msgstr ""
" else this._spinner.stop ();\n"
"\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new ToggleButtonExample ();\n"
@@ -50655,37 +54262,212 @@ msgstr ""
#. (itstool) path: page/code
#: C/toolbar.js.page:26
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gdk = imports.gi.Gdk;\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const Application = new Lang.Class({\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.myapp',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " //connect to 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " //create the UI (in this case it's just the ApplicationWindow\n"
+#| " _buildUI: function() {\n"
+#| " this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Toolbar Example\",\n"
+#| " default_height: 200,\n"
+#| " default_width: 400 });\n"
+#| "\n"
+#| " this._grid = new Gtk.Grid();\n"
+#| " this._window.add(this._grid);\n"
+#| " this._grid.show();\n"
+#| "\n"
+#| " this._createToolbar();\n"
+#| " this._toolbar.set_hexpand(true);\n"
+#| " this._grid.attach(this._toolbar, 0, 0, 1, 1);\n"
+#| "\n"
+#| " //show the toolbar and window\n"
+#| " this._toolbar.show();\n"
+#| " this._window.show();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'activate' signal\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'startup' signal\n"
+#| " _onStartup: function() {\n"
+#| " this._initMenus();\n"
+#| " this._buildUI();\n"
+#| " },\n"
+#| "\n"
+#| " //create the toolbar, its toolbuttons and their actions\n"
+#| " _createToolbar: function() {\n"
+#| "\n"
+#| " this._toolbar = new Gtk.Toolbar();\n"
+#| " this._toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
+#| "\n"
+#| " //create the \"New\" ToolButton and its SimpleAction.\n"
+#| " //Using actions allows you to add them to the app menu\n"
+#| " //without duplicating code.\n"
+#| " let newAction = new Gio.SimpleAction({ name: 'new'});\n"
+#| " newAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._newCB();\n"
+#| " }));\n"
+#| " this.application.add_action(newAction);//note: this action is added to the app\n"
+#| "\n"
+#| " this._newButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
+#| " this._newButton.is_important = true;\n"
+#| " this._toolbar.add(this._newButton);\n"
+#| " this._newButton.show();\n"
+#| " this._newButton.action_name = \"app.new\";\n"
+#| "\n"
+#| " //create the \"Open\" ToolButton and its SimpleAction\n"
+#| " let openAction = new Gio.SimpleAction({ name: 'open'});\n"
+#| " openAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._openCB();\n"
+#| " }));\n"
+#| " this.application.add_action(openAction);\n"
+#| "\n"
+#| " this._openButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
+#| " this._openButton.is_important = true;\n"
+#| " this._toolbar.add(this._openButton);\n"
+#| " this._openButton.show();\n"
+#| " this._openButton.action_name = \"app.open\";\n"
+#| "\n"
+#| " //create the \"Undo\" ToolButton and its SimpleAction\n"
+#| " let undoAction = new Gio.SimpleAction({ name: 'undo'});\n"
+#| " undoAction.connect('activate', Lang.bind (this,\n"
+#| " function() {\n"
+#| " this._undoCB();\n"
+#| " }));\n"
+#| " this._window.add_action(undoAction);//note this action is added to the window\n"
+#| "\n"
+#| " this._undoButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
+#| " this._undoButton.is_important = true;\n"
+#| " this._toolbar.add(this._undoButton);\n"
+#| " this._undoButton.show();\n"
+#| " this._undoButton.action_name = \"win.undo\";\n"
+#| "\n"
+#| " //create the \"Fullscreen\" ToolButton and its SimpleAction\n"
+#| " let fullscreenToggleAction = new Gio.SimpleAction ({ name: 'fullscreenToggle' });\n"
+#| " fullscreenToggleAction.connect ('activate', Lang.bind (this,\n"
+#| " function () {\n"
+#| " this._fullscreenToggleCB();\n"
+#| " }));\n"
+#| " this._window.add_action(fullscreenToggleAction);\n"
+#| "\n"
+#| " this._fullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
+#| " this._fullscreenButton.is_important = true;\n"
+#| " this._toolbar.add(this._fullscreenButton);\n"
+#| " this._fullscreenButton.show();\n"
+#| " this._fullscreenButton.action_name = \"win.fullscreenToggle\";\n"
+#| "\n"
+#| " //create the \"leaveFullscreen\" ToolButton, and set the action name to
\"win.fullscreenToggle\"\n"
+#| " this._leaveFullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
+#| " this._leaveFullscreenButton.is_important = true;\n"
+#| " this._toolbar.add(this._leaveFullscreenButton);\n"
+#| " this._leaveFullscreenButton.action_name = \"win.fullscreenToggle\";\n"
+#| " },\n"
+#| "\n"
+#| " _initMenus: function () {\n"
+#| " let menu = new Gio.Menu();\n"
+#| " menu.append(\"New\", 'app.new');\n"
+#| " menu.append(\"Open\", 'app.open');\n"
+#| " menu.append(\"Quit\", 'app.quit');\n"
+#| "\n"
+#| " this.application.set_app_menu(menu);\n"
+#| "\n"
+#| " let quitAction = new Gio.SimpleAction({name: 'quit' });\n"
+#| " quitAction.connect('activate', Lang.bind(this,\n"
+#| " function() {\n"
+#| " this._window.destroy();\n"
+#| " }));\n"
+#| " this.application.add_action(quitAction);\n"
+#| " },\n"
+#| "\n"
+#| " _newCB: function() {\n"
+#| " print(\"You clicked 'New'.\");\n"
+#| " },\n"
+#| "\n"
+#| " _openCB: function() {\n"
+#| " print(\"You clicked 'Open'.\");\n"
+#| " },\n"
+#| "\n"
+#| " _undoCB:function () {\n"
+#| " print (\"You clicked 'Undo'.\");\n"
+#| " },\n"
+#| "\n"
+#| " _fullscreenToggleCB: function() {\n"
+#| " if ((this._window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ) {\n"
+#| " this._window.unfullscreen();\n"
+#| " this._leaveFullscreenButton.hide();\n"
+#| " this._fullscreenButton.show();\n"
+#| " }\n"
+#| " else {\n"
+#| " this._window.fullscreen();\n"
+#| " this._fullscreenButton.hide();\n"
+#| " this._leaveFullscreenButton.show();\n"
+#| " }\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application();\n"
+#| "app.application.run(ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function() {\n"
-" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Toolbar Example\",\n"
-" default_height: 200,\n"
-" default_width: 400 });\n"
+" _buildUI() {\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Toolbar Example\",\n"
+" default_height: 200,\n"
+" default_width: 400\n"
+" });\n"
"\n"
" this._grid = new Gtk.Grid();\n"
" this._window.add(this._grid);\n"
@@ -50698,21 +54480,21 @@ msgid ""
" //show the toolbar and window\n"
" this._toolbar.show();\n"
" this._window.show();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI();\n"
-" },\n"
+" }\n"
"\n"
" //create the toolbar, its toolbuttons and their actions\n"
-" _createToolbar: function() {\n"
+" _createToolbar() {\n"
"\n"
" this._toolbar = new Gtk.Toolbar();\n"
" this._toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
@@ -50721,13 +54503,10 @@ msgid ""
" //Using actions allows you to add them to the app menu\n"
" //without duplicating code.\n"
" let newAction = new Gio.SimpleAction({ name: 'new'});\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._newCB();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._newCB(); });\n"
" this.application.add_action(newAction);//note: this action is added to the app\n"
"\n"
-" this._newButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
+" this._newButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
" this._newButton.is_important = true;\n"
" this._toolbar.add(this._newButton);\n"
" this._newButton.show();\n"
@@ -50735,13 +54514,10 @@ msgid ""
"\n"
" //create the \"Open\" ToolButton and its SimpleAction\n"
" let openAction = new Gio.SimpleAction({ name: 'open'});\n"
-" openAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._openCB();\n"
-" }));\n"
+" openAction.connect('activate', () => { this._openCB(); });\n"
" this.application.add_action(openAction);\n"
"\n"
-" this._openButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
+" this._openButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
" this._openButton.is_important = true;\n"
" this._toolbar.add(this._openButton);\n"
" this._openButton.show();\n"
@@ -50749,13 +54525,10 @@ msgid ""
"\n"
" //create the \"Undo\" ToolButton and its SimpleAction\n"
" let undoAction = new Gio.SimpleAction({ name: 'undo'});\n"
-" undoAction.connect('activate', Lang.bind (this,\n"
-" function() {\n"
-" this._undoCB();\n"
-" }));\n"
+" undoAction.connect('activate', () => { this._undoCB(); });\n"
" this._window.add_action(undoAction);//note this action is added to the window\n"
"\n"
-" this._undoButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
+" this._undoButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
" this._undoButton.is_important = true;\n"
" this._toolbar.add(this._undoButton);\n"
" this._undoButton.show();\n"
@@ -50763,26 +54536,25 @@ msgid ""
"\n"
" //create the \"Fullscreen\" ToolButton and its SimpleAction\n"
" let fullscreenToggleAction = new Gio.SimpleAction ({ name: 'fullscreenToggle' });\n"
-" fullscreenToggleAction.connect ('activate', Lang.bind (this,\n"
-" function () {\n"
-" this._fullscreenToggleCB();\n"
-" }));\n"
+" fullscreenToggleAction.connect('activate', () => {\n"
+" this._fullscreenToggleCB();\n"
+" });\n"
" this._window.add_action(fullscreenToggleAction);\n"
"\n"
-" this._fullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
+" this._fullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
" this._fullscreenButton.is_important = true;\n"
" this._toolbar.add(this._fullscreenButton);\n"
" this._fullscreenButton.show();\n"
" this._fullscreenButton.action_name = \"win.fullscreenToggle\";\n"
"\n"
" //create the \"leaveFullscreen\" ToolButton, and set the action name to \"win.fullscreenToggle\"\n"
-" this._leaveFullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
+" this._leaveFullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
" this._leaveFullscreenButton.is_important = true;\n"
" this._toolbar.add(this._leaveFullscreenButton);\n"
" this._leaveFullscreenButton.action_name = \"win.fullscreenToggle\";\n"
-" },\n"
+" }\n"
"\n"
-" _initMenus: function () {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"New\", 'app.new');\n"
" menu.append(\"Open\", 'app.open');\n"
@@ -50791,38 +54563,34 @@ msgid ""
" this.application.set_app_menu(menu);\n"
"\n"
" let quitAction = new Gio.SimpleAction({name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
-" _newCB: function() {\n"
+" _newCB() {\n"
" print(\"You clicked 'New'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _openCB: function() {\n"
+" _openCB() {\n"
" print(\"You clicked 'Open'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _undoCB:function () {\n"
+" _undoCB() {\n"
" print (\"You clicked 'Undo'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _fullscreenToggleCB: function() {\n"
+" _fullscreenToggleCB() {\n"
" if ((this._window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ) {\n"
" this._window.unfullscreen();\n"
" this._leaveFullscreenButton.hide();\n"
" this._fullscreenButton.show();\n"
-" }\n"
-" else {\n"
+" } else {\n"
" this._window.fullscreen();\n"
" this._fullscreenButton.hide();\n"
" this._leaveFullscreenButton.show();\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -50830,34 +54598,37 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"\n"
-"const Application = new Lang.Class({\n"
-" Name: 'Application',\n"
+"class Application {\n"
"\n"
" //create the application\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
" //connect to 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" //create the UI (in this case it's just the ApplicationWindow\n"
-" _buildUI: function() {\n"
-" this._window = new Gtk.ApplicationWindow({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Toolbar Example\",\n"
-" default_height: 200,\n"
-" default_width: 400 });\n"
+" _buildUI() {\n"
+" this._window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Toolbar Example\",\n"
+" default_height: 200,\n"
+" default_width: 400\n"
+" });\n"
"\n"
" this._grid = new Gtk.Grid();\n"
" this._window.add(this._grid);\n"
@@ -50870,21 +54641,21 @@ msgstr ""
" //show the toolbar and window\n"
" this._toolbar.show();\n"
" this._window.show();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" //callback function for 'startup' signal\n"
-" _onStartup: function() {\n"
+" _onStartup() {\n"
" this._initMenus();\n"
" this._buildUI();\n"
-" },\n"
+" }\n"
"\n"
" //create the toolbar, its toolbuttons and their actions\n"
-" _createToolbar: function() {\n"
+" _createToolbar() {\n"
"\n"
" this._toolbar = new Gtk.Toolbar();\n"
" this._toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
@@ -50893,13 +54664,10 @@ msgstr ""
" //Using actions allows you to add them to the app menu\n"
" //without duplicating code.\n"
" let newAction = new Gio.SimpleAction({ name: 'new'});\n"
-" newAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._newCB();\n"
-" }));\n"
+" newAction.connect('activate', () => { this._newCB(); });\n"
" this.application.add_action(newAction);//note: this action is added to the app\n"
"\n"
-" this._newButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
+" this._newButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
" this._newButton.is_important = true;\n"
" this._toolbar.add(this._newButton);\n"
" this._newButton.show();\n"
@@ -50907,13 +54675,10 @@ msgstr ""
"\n"
" //create the \"Open\" ToolButton and its SimpleAction\n"
" let openAction = new Gio.SimpleAction({ name: 'open'});\n"
-" openAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._openCB();\n"
-" }));\n"
+" openAction.connect('activate', () => { this._openCB(); });\n"
" this.application.add_action(openAction);\n"
"\n"
-" this._openButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
+" this._openButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
" this._openButton.is_important = true;\n"
" this._toolbar.add(this._openButton);\n"
" this._openButton.show();\n"
@@ -50921,13 +54686,10 @@ msgstr ""
"\n"
" //create the \"Undo\" ToolButton and its SimpleAction\n"
" let undoAction = new Gio.SimpleAction({ name: 'undo'});\n"
-" undoAction.connect('activate', Lang.bind (this,\n"
-" function() {\n"
-" this._undoCB();\n"
-" }));\n"
+" undoAction.connect('activate', () => { this._undoCB(); });\n"
" this._window.add_action(undoAction);//note this action is added to the window\n"
"\n"
-" this._undoButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
+" this._undoButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
" this._undoButton.is_important = true;\n"
" this._toolbar.add(this._undoButton);\n"
" this._undoButton.show();\n"
@@ -50935,26 +54697,25 @@ msgstr ""
"\n"
" //create the \"Fullscreen\" ToolButton and its SimpleAction\n"
" let fullscreenToggleAction = new Gio.SimpleAction ({ name: 'fullscreenToggle' });\n"
-" fullscreenToggleAction.connect ('activate', Lang.bind (this,\n"
-" function () {\n"
-" this._fullscreenToggleCB();\n"
-" }));\n"
+" fullscreenToggleAction.connect('activate', () => {\n"
+" this._fullscreenToggleCB();\n"
+" });\n"
" this._window.add_action(fullscreenToggleAction);\n"
"\n"
-" this._fullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
+" this._fullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
" this._fullscreenButton.is_important = true;\n"
" this._toolbar.add(this._fullscreenButton);\n"
" this._fullscreenButton.show();\n"
" this._fullscreenButton.action_name = \"win.fullscreenToggle\";\n"
"\n"
" //create the \"leaveFullscreen\" ToolButton, and set the action name to \"win.fullscreenToggle\"\n"
-" this._leaveFullscreenButton = new Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
+" this._leaveFullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
" this._leaveFullscreenButton.is_important = true;\n"
" this._toolbar.add(this._leaveFullscreenButton);\n"
" this._leaveFullscreenButton.action_name = \"win.fullscreenToggle\";\n"
-" },\n"
+" }\n"
"\n"
-" _initMenus: function () {\n"
+" _initMenus() {\n"
" let menu = new Gio.Menu();\n"
" menu.append(\"New\", 'app.new');\n"
" menu.append(\"Open\", 'app.open');\n"
@@ -50963,38 +54724,34 @@ msgstr ""
" this.application.set_app_menu(menu);\n"
"\n"
" let quitAction = new Gio.SimpleAction({name: 'quit' });\n"
-" quitAction.connect('activate', Lang.bind(this,\n"
-" function() {\n"
-" this._window.destroy();\n"
-" }));\n"
+" quitAction.connect('activate', () => { this._window.destroy(); });\n"
" this.application.add_action(quitAction);\n"
-" },\n"
+" }\n"
"\n"
-" _newCB: function() {\n"
+" _newCB() {\n"
" print(\"You clicked 'New'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _openCB: function() {\n"
+" _openCB() {\n"
" print(\"You clicked 'Open'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _undoCB:function () {\n"
+" _undoCB() {\n"
" print (\"You clicked 'Undo'.\");\n"
-" },\n"
+" }\n"
"\n"
-" _fullscreenToggleCB: function() {\n"
+" _fullscreenToggleCB() {\n"
" if ((this._window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ) {\n"
" this._window.unfullscreen();\n"
" this._leaveFullscreenButton.hide();\n"
" this._fullscreenButton.show();\n"
-" }\n"
-" else {\n"
+" } else {\n"
" this._window.fullscreen();\n"
" this._fullscreenButton.hide();\n"
" this._leaveFullscreenButton.show();\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application();\n"
@@ -53486,47 +57243,204 @@ msgstr "Esto construye el ejemplo de <link xref=\"toolbar.js\">Toolbar</link>."
#. (itstool) path: section/code
#: C/tooltip.js.page:30
#, no-wrap
+#| msgid ""
+#| "//!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gdk = imports.gi.Gdk;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const Gtk = imports.gi.Gtk; \n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const TooltipExample = new Lang.Class ({\n"
+#| " Name: 'Tooltip Example',\n"
+#| "\n"
+#| " // Create the application \n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({ application_id: 'org.example.jstooltip' });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents windows when active\n"
+#| " _onActivate: function() {\n"
+#| " this.window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function () {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function () {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " title: \"Toolbar with Tooltips Example\",\n"
+#| " default_width: 400,\n"
+#| " default_height: 200,\n"
+#| " border_width: 10 });\n"
+#| "\n"
+#| " this.grid = new Gtk.Grid();\n"
+#| "\n"
+#| " this.toolbar = this._createToolbar();\n"
+#| " this.toolbar.set_hexpand(true);\n"
+#| " this.toolbar.show();\n"
+#| "\n"
+#| " this.grid.attach(this.toolbar, 0, 0, 1, 1);\n"
+#| "\n"
+#| " this.window.add(this.grid);\n"
+#| "\n"
+#| " this._newAction = new Gio.SimpleAction({ name: \"new\" });\n"
+#| " this._newAction.connect(\"activate\", Lang.bind(this, this._newCallback));\n"
+#| " this.window.add_action(this._newAction);\n"
+#| "\n"
+#| " this._openAction = new Gio.SimpleAction({ name: \"open\" });\n"
+#| " this._openAction.connect(\"activate\", Lang.bind(this, this._openCallback));\n"
+#| " this.window.add_action(this._openAction);\n"
+#| "\n"
+#| " this._undoAction = new Gio.SimpleAction({ name: \"undo\" });\n"
+#| " this._undoAction.connect(\"activate\", Lang.bind(this, this._undoCallback));\n"
+#| " this.window.add_action(this._undoAction);\n"
+#| "\n"
+#| " this._fullScreenAction = new Gio.SimpleAction({ name: \"fullscreenToggle\" });\n"
+#| " this._fullScreenAction.connect(\"activate\", Lang.bind(this, this._fullScreenCallback));\n"
+#| " this.window.add_action(this._fullScreenAction);\n"
+#| "\n"
+#| " this.window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| " _createToolbar: function(){\n"
+#| " this.toolbar = new Gtk.Toolbar();\n"
+#| " this.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
+#| "\n"
+#| " // button for the \"new\" action\n"
+#| " this.newButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n"
+#| " // with a tooltip with a given text \n"
+#| " this.newButton.set_tooltip_text(\"Create a new file\");\n"
+#| " this.newButton.set_is_important(true);\n"
+#| " this.toolbar.insert(this.newButton, 0);\n"
+#| " this.newButton.show();\n"
+#| " this.newButton.set_action_name(\"win.new\");\n"
+#| "\n"
+#| " // button for the \"open\" action\n"
+#| " this.openButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n"
+#| " // with a tooltip with a given text in the Pango markup language \n"
+#| " this.openButton.set_tooltip_markup(\"Open an <i>existing</i> file\");\n"
+#| " this.openButton.set_is_important(true);\n"
+#| " this.toolbar.insert(this.openButton, 1);\n"
+#| " this.openButton.show();\n"
+#| " this.openButton.set_action_name(\"win.open\");\n"
+#| "\n"
+#| " // button for the \"undo\" action\n"
+#| " this.undoButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n"
+#| " // with a tooltip with an image\n"
+#| " // set true the property \"has-tooltip\" \n"
+#| " this.undoButton.set_property(\"has-tooltip\", true);\n"
+#| " // connect to the callback function that for the tooltip\n"
+#| " // with the signal \"query-tooltip\"\n"
+#| " this.undoButton.connect(\"query-tooltip\", Lang.bind(this, this._undoTooltipCallback));\n"
+#| " this.undoButton.set_is_important(true);\n"
+#| " this.toolbar.insert(this.undoButton, 2);\n"
+#| " this.undoButton.show();\n"
+#| " this.undoButton.set_action_name(\"win.undo\");\n"
+#| "\n"
+#| " // button for the \"fullscreen/leave fullscreen\" action\n"
+#| " this.fullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n"
+#| " this.fullscreenButton.set_is_important(true);\n"
+#| " this.toolbar.insert(this.fullscreenButton, 3);\n"
+#| " this.fullscreenButton.set_action_name(\"win.fullscreenToggle\");\n"
+#| "\n"
+#| " return this.toolbar;\n"
+#| " },\n"
+#| "\n"
+#| " _newCallback: function(action, parameter) {\n"
+#| " print(\"You clicked \\\"New\\\".\");\n"
+#| " },\n"
+#| "\n"
+#| " _openCallback: function(action, parameter) {\n"
+#| " print(\"You clicked \\\"Open\\\".\");\n"
+#| " },\n"
+#| "\n"
+#| " // the callback function for the tooltip of the \"undo\" button\n"
+#| " _undoTooltipCallback: function(widget, x, y, keyboard_mode, tooltip) {\n"
+#| " // set the text for the tooltip\n"
+#| " tooltip.set_text(\"Undo your last action\");\n"
+#| " // set an icon fot the tooltip\n"
+#| " tooltip.set_icon_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.MENU);\n"
+#| " // show the tooltip\n"
+#| " return true;\n"
+#| " },\n"
+#| "\n"
+#| " _undoCallback: function(action, parameter) {\n"
+#| " print(\"You clicked \\\"Undo\\\".\");\n"
+#| " },\n"
+#| "\n"
+#| " _fullScreenCallback: function() {\n"
+#| " if ((this.window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ){\n"
+#| " this.fullscreenButton.set_stock_id(Gtk.STOCK_FULLSCREEN);\n"
+#| " this.fullscreenButton.set_tooltip_text(\"Make your window fullscreen\");\n"
+#| " this.window.unfullscreen();\n"
+#| " } else {\n"
+#| " this.fullscreenButton.set_stock_id(Gtk.STOCK_LEAVE_FULLSCREEN);\n"
+#| " this.fullscreenButton.set_tooltip_text(\"Leave fullscreen\");\n"
+#| " this.window.fullscreen();\n"
+#| " }\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new TooltipExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"//!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const GLib = imports.gi.GLib;\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk; \n"
-"const Lang = imports.lang;\n"
-"\n"
-"const TooltipExample = new Lang.Class ({\n"
-" Name: 'Tooltip Example',\n"
"\n"
+"class TooltipExample {\n"
" // Create the application \n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({ application_id: 'org.example.jstooltip' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jstooltip'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Toolbar with Tooltips Example\",\n"
-" default_width: 400,\n"
-" default_height: 200,\n"
-" border_width: 10 });\n"
+" this.window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Toolbar with Tooltips Example\",\n"
+" default_width: 400,\n"
+" default_height: 200,\n"
+" border_width: 10\n"
+" });\n"
"\n"
" this.grid = new Gtk.Grid();\n"
"\n"
@@ -53539,25 +57453,26 @@ msgid ""
" this.window.add(this.grid);\n"
"\n"
" this._newAction = new Gio.SimpleAction({ name: \"new\" });\n"
-" this._newAction.connect(\"activate\", Lang.bind(this, this._newCallback));\n"
+" this._newAction.connect(\"activate\", this._newCallback.bind(this));\n"
" this.window.add_action(this._newAction);\n"
"\n"
" this._openAction = new Gio.SimpleAction({ name: \"open\" });\n"
-" this._openAction.connect(\"activate\", Lang.bind(this, this._openCallback));\n"
+" this._openAction.connect(\"activate\", this._openCallback.bind(this));\n"
" this.window.add_action(this._openAction);\n"
"\n"
" this._undoAction = new Gio.SimpleAction({ name: \"undo\" });\n"
-" this._undoAction.connect(\"activate\", Lang.bind(this, this._undoCallback));\n"
+" this._undoAction.connect(\"activate\", this._undoCallback.bind(this));\n"
" this.window.add_action(this._undoAction);\n"
"\n"
" this._fullScreenAction = new Gio.SimpleAction({ name: \"fullscreenToggle\" });\n"
-" this._fullScreenAction.connect(\"activate\", Lang.bind(this, this._fullScreenCallback));\n"
+" this._fullScreenAction.connect(\"activate\",\n"
+" this._fullScreenCallback.bind(this));\n"
" this.window.add_action(this._fullScreenAction);\n"
"\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _createToolbar: function(){\n"
+" _createToolbar() {\n"
" this.toolbar = new Gtk.Toolbar();\n"
" this.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
"\n"
@@ -53586,7 +57501,7 @@ msgid ""
" this.undoButton.set_property(\"has-tooltip\", true);\n"
" // connect to the callback function that for the tooltip\n"
" // with the signal \"query-tooltip\"\n"
-" this.undoButton.connect(\"query-tooltip\", Lang.bind(this, this._undoTooltipCallback));\n"
+" this.undoButton.connect(\"query-tooltip\", this._undoTooltipCallback.bind(this));\n"
" this.undoButton.set_is_important(true);\n"
" this.toolbar.insert(this.undoButton, 2);\n"
" this.undoButton.show();\n"
@@ -53599,31 +57514,31 @@ msgid ""
" this.fullscreenButton.set_action_name(\"win.fullscreenToggle\");\n"
"\n"
" return this.toolbar;\n"
-" },\n"
+" }\n"
"\n"
-" _newCallback: function(action, parameter) {\n"
+" _newCallback(action, parameter) {\n"
" print(\"You clicked \\\"New\\\".\");\n"
-" },\n"
+" }\n"
"\n"
-" _openCallback: function(action, parameter) {\n"
+" _openCallback(action, parameter) {\n"
" print(\"You clicked \\\"Open\\\".\");\n"
-" },\n"
+" }\n"
"\n"
" // the callback function for the tooltip of the \"undo\" button\n"
-" _undoTooltipCallback: function(widget, x, y, keyboard_mode, tooltip) {\n"
+" _undoTooltipCallback(widget, x, y, keyboard_mode, tooltip) {\n"
" // set the text for the tooltip\n"
" tooltip.set_text(\"Undo your last action\");\n"
" // set an icon fot the tooltip\n"
" tooltip.set_icon_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.MENU);\n"
" // show the tooltip\n"
" return true;\n"
-" },\n"
+" }\n"
"\n"
-" _undoCallback: function(action, parameter) {\n"
+" _undoCallback(action, parameter) {\n"
" print(\"You clicked \\\"Undo\\\".\");\n"
-" },\n"
+" }\n"
"\n"
-" _fullScreenCallback: function() {\n"
+" _fullScreenCallback() {\n"
" if ((this.window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ){\n"
" this.fullscreenButton.set_stock_id(Gtk.STOCK_FULLSCREEN);\n"
" this.fullscreenButton.set_tooltip_text(\"Make your window fullscreen\");\n"
@@ -53634,7 +57549,7 @@ msgid ""
" this.window.fullscreen();\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TooltipExample ();\n"
@@ -53642,44 +57557,48 @@ msgid ""
msgstr ""
"//!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gdk = '3.0';\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gdk = imports.gi.Gdk;\n"
"const GLib = imports.gi.GLib;\n"
"const Gio = imports.gi.Gio;\n"
"const Gtk = imports.gi.Gtk; \n"
-"const Lang = imports.lang;\n"
-"\n"
-"const TooltipExample = new Lang.Class ({\n"
-" Name: 'Tooltip Example',\n"
"\n"
+"class TooltipExample {\n"
" // Create the application \n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({ application_id: 'org.example.jstooltip' });\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
+" application_id: 'org.example.jstooltip'\n"
+" });\n"
"\n"
" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents windows when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this.window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function () {\n"
-" this._buildUI ();\n"
-" },\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function () {\n"
+" _buildUI() {\n"
"\n"
" // Create the application window\n"
-" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n"
-" window_position: Gtk.WindowPosition.CENTER,\n"
-" title: \"Toolbar with Tooltips Example\",\n"
-" default_width: 400,\n"
-" default_height: 200,\n"
-" border_width: 10 });\n"
+" this.window = new Gtk.ApplicationWindow({\n"
+" application: this.application,\n"
+" window_position: Gtk.WindowPosition.CENTER,\n"
+" title: \"Toolbar with Tooltips Example\",\n"
+" default_width: 400,\n"
+" default_height: 200,\n"
+" border_width: 10\n"
+" });\n"
"\n"
" this.grid = new Gtk.Grid();\n"
"\n"
@@ -53692,25 +57611,26 @@ msgstr ""
" this.window.add(this.grid);\n"
"\n"
" this._newAction = new Gio.SimpleAction({ name: \"new\" });\n"
-" this._newAction.connect(\"activate\", Lang.bind(this, this._newCallback));\n"
+" this._newAction.connect(\"activate\", this._newCallback.bind(this));\n"
" this.window.add_action(this._newAction);\n"
"\n"
" this._openAction = new Gio.SimpleAction({ name: \"open\" });\n"
-" this._openAction.connect(\"activate\", Lang.bind(this, this._openCallback));\n"
+" this._openAction.connect(\"activate\", this._openCallback.bind(this));\n"
" this.window.add_action(this._openAction);\n"
"\n"
" this._undoAction = new Gio.SimpleAction({ name: \"undo\" });\n"
-" this._undoAction.connect(\"activate\", Lang.bind(this, this._undoCallback));\n"
+" this._undoAction.connect(\"activate\", this._undoCallback.bind(this));\n"
" this.window.add_action(this._undoAction);\n"
"\n"
" this._fullScreenAction = new Gio.SimpleAction({ name: \"fullscreenToggle\" });\n"
-" this._fullScreenAction.connect(\"activate\", Lang.bind(this, this._fullScreenCallback));\n"
+" this._fullScreenAction.connect(\"activate\",\n"
+" this._fullScreenCallback.bind(this));\n"
" this.window.add_action(this._fullScreenAction);\n"
"\n"
" this.window.show_all();\n"
-" },\n"
+" }\n"
"\n"
-" _createToolbar: function(){\n"
+" _createToolbar() {\n"
" this.toolbar = new Gtk.Toolbar();\n"
" this.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n"
"\n"
@@ -53739,7 +57659,7 @@ msgstr ""
" this.undoButton.set_property(\"has-tooltip\", true);\n"
" // connect to the callback function that for the tooltip\n"
" // with the signal \"query-tooltip\"\n"
-" this.undoButton.connect(\"query-tooltip\", Lang.bind(this, this._undoTooltipCallback));\n"
+" this.undoButton.connect(\"query-tooltip\", this._undoTooltipCallback.bind(this));\n"
" this.undoButton.set_is_important(true);\n"
" this.toolbar.insert(this.undoButton, 2);\n"
" this.undoButton.show();\n"
@@ -53752,31 +57672,31 @@ msgstr ""
" this.fullscreenButton.set_action_name(\"win.fullscreenToggle\");\n"
"\n"
" return this.toolbar;\n"
-" },\n"
+" }\n"
"\n"
-" _newCallback: function(action, parameter) {\n"
+" _newCallback(action, parameter) {\n"
" print(\"You clicked \\\"New\\\".\");\n"
-" },\n"
+" }\n"
"\n"
-" _openCallback: function(action, parameter) {\n"
+" _openCallback(action, parameter) {\n"
" print(\"You clicked \\\"Open\\\".\");\n"
-" },\n"
+" }\n"
"\n"
" // the callback function for the tooltip of the \"undo\" button\n"
-" _undoTooltipCallback: function(widget, x, y, keyboard_mode, tooltip) {\n"
+" _undoTooltipCallback(widget, x, y, keyboard_mode, tooltip) {\n"
" // set the text for the tooltip\n"
" tooltip.set_text(\"Undo your last action\");\n"
" // set an icon fot the tooltip\n"
" tooltip.set_icon_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.MENU);\n"
" // show the tooltip\n"
" return true;\n"
-" },\n"
+" }\n"
"\n"
-" _undoCallback: function(action, parameter) {\n"
+" _undoCallback(action, parameter) {\n"
" print(\"You clicked \\\"Undo\\\".\");\n"
-" },\n"
+" }\n"
"\n"
-" _fullScreenCallback: function() {\n"
+" _fullScreenCallback() {\n"
" if ((this.window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ){\n"
" this.fullscreenButton.set_stock_id(Gtk.STOCK_FULLSCREEN);\n"
" this.fullscreenButton.set_tooltip_text(\"Make your window fullscreen\");\n"
@@ -53787,7 +57707,7 @@ msgstr ""
" this.window.fullscreen();\n"
" }\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TooltipExample ();\n"
@@ -56044,43 +59964,191 @@ msgstr ""
#. (itstool) path: section/code
#: C/treeview_simple_liststore.js.page:268
#, no-wrap
+#| msgid ""
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const GObject = imports.gi.GObject;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "const Pango = imports.gi.Pango;\n"
+#| "\n"
+#| "const TreeViewExample = new Lang.Class({\n"
+#| " Name: 'TreeView Example with Simple ListStore',\n"
+#| "\n"
+#| " // Create the application itself\n"
+#| " _init: function() {\n"
+#| " this.application = new Gtk.Application({\n"
+#| " application_id: 'org.example.jstreeviewsimpleliststore'\n"
+#| " });\n"
+#| "\n"
+#| " // Connect 'activate' and 'startup' signals to the callback functions\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'activate' signal presents window when active\n"
+#| " _onActivate: function() {\n"
+#| " this._window.present();\n"
+#| " },\n"
+#| "\n"
+#| " // Callback function for 'startup' signal builds the UI\n"
+#| " _onStartup: function() {\n"
+#| " this._buildUI ();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " // Build the application's UI\n"
+#| " _buildUI: function() {\n"
+#| "\n"
+#| " // Create the application window\n"
+#| " this._window = new Gtk.ApplicationWindow({\n"
+#| " application: this.application,\n"
+#| " window_position: Gtk.WindowPosition.CENTER,\n"
+#| " default_height: 250,\n"
+#| " default_width: 100,\n"
+#| " border_width: 20,\n"
+#| " title: \"My Phone Book\"});\n"
+#| "\n"
+#| " // Create the underlying liststore for the phonebook\n"
+#| " this._listStore = new Gtk.ListStore ();\n"
+#| " this._listStore.set_column_types ([\n"
+#| " GObject.TYPE_STRING,\n"
+#| " GObject.TYPE_STRING,\n"
+#| " GObject.TYPE_STRING,\n"
+#| " GObject.TYPE_STRING]);\n"
+#| "\n"
+#| " // Data to go in the phonebook\n"
+#| " let phonebook =\n"
+#| " [{ name: \"Jurg\", surname: \"Billeter\", phone: \"555-0123\",\n"
+#| " description: \"A friendly person.\"},\n"
+#| " { name: \"Johannes\", surname: \"Schmid\", phone: \"555-1234\",\n"
+#| " description: \"Easy phone number to remember.\"},\n"
+#| " { name: \"Julita\", surname: \"Inca\", phone: \"555-2345\",\n"
+#| " description: \"Another friendly person.\"},\n"
+#| " { name: \"Javier\", surname: \"Jardon\", phone: \"555-3456\",\n"
+#| " description: \"Bring fish for his penguins.\"},\n"
+#| " { name: \"Jason\", surname: \"Clinton\", phone: \"555-4567\",\n"
+#| " description: \"His cake's not a lie.\"},\n"
+#| " { name: \"Random J.\", surname: \"Hacker\", phone: \"555-5678\",\n"
+#| " description: \"Very random!\"}];\n"
+#| "\n"
+#| " // Put the data in the phonebook\n"
+#| " for (let i = 0; i < phonebook.length; i++ ) {\n"
+#| " let contact = phonebook [i];\n"
+#| " this._listStore.set (this._listStore.append(), [0, 1, 2, 3],\n"
+#| " [contact.name, contact.surname, contact.phone, contact.description]);\n"
+#| " }\n"
+#| "\n"
+#| " // Create the treeview\n"
+#| " this._treeView = new Gtk.TreeView ({\n"
+#| " expand: true,\n"
+#| " model: this._listStore });\n"
+#| "\n"
+#| " // Create the columns for the address book\n"
+#| " let firstName = new Gtk.TreeViewColumn ({ title: \"First Name\" });\n"
+#| " let lastName = new Gtk.TreeViewColumn ({ title: \"Last Name\" });\n"
+#| " let phone = new Gtk.TreeViewColumn ({ title: \"Phone Number\" });\n"
+#| "\n"
+#| " // Create a cell renderer for when bold text is needed\n"
+#| " let bold = new Gtk.CellRendererText ({\n"
+#| " weight: Pango.Weight.BOLD });\n"
+#| "\n"
+#| " // Create a cell renderer for normal text\n"
+#| " let normal = new Gtk.CellRendererText ();\n"
+#| "\n"
+#| " // Pack the cell renderers into the columns\n"
+#| " firstName.pack_start (bold, true);\n"
+#| " lastName.pack_start (normal, true);\n"
+#| " phone.pack_start (normal, true);\n"
+#| "\n"
+#| " // Set each column to pull text from the TreeView's model\n"
+#| " firstName.add_attribute (bold, \"text\", 0);\n"
+#| " lastName.add_attribute (normal, \"text\", 1);\n"
+#| " phone.add_attribute (normal, \"text\", 2);\n"
+#| "\n"
+#| " // Insert the columns into the treeview\n"
+#| " this._treeView.insert_column (firstName, 0);\n"
+#| " this._treeView.insert_column (lastName, 1);\n"
+#| " this._treeView.insert_column (phone, 2);\n"
+#| "\n"
+#| " // Create the label that shows details for the name you select\n"
+#| " this._label = new Gtk.Label ({ label: \"\" });\n"
+#| "\n"
+#| " // Get which item is selected\n"
+#| " this.selection = this._treeView.get_selection();\n"
+#| "\n"
+#| " // When something new is selected, call _on_changed\n"
+#| " this.selection.connect ('changed', Lang.bind (this, this._onSelectionChanged));\n"
+#| "\n"
+#| " // Create a grid to organize everything in\n"
+#| " this._grid = new Gtk.Grid;\n"
+#| "\n"
+#| " // Attach the treeview and label to the grid\n"
+#| " this._grid.attach (this._treeView, 0, 0, 1, 1);\n"
+#| " this._grid.attach (this._label, 0, 1, 1, 1);\n"
+#| "\n"
+#| " // Add the grid to the window\n"
+#| " this._window.add (this._grid);\n"
+#| "\n"
+#| " // Show the window and all child widgets\n"
+#| " this._window.show_all();\n"
+#| " },\n"
+#| "\n"
+#| "\n"
+#| "\n"
+#| " _onSelectionChanged: function () {\n"
+#| "\n"
+#| " // Grab a treeiter pointing to the current selection\n"
+#| " let [ isSelected, model, iter ] = this.selection.get_selected();\n"
+#| "\n"
+#| " // Set the label to read off the values stored in the current selection\n"
+#| " this._label.set_label (\"\\n\" +\n"
+#| " this._listStore.get_value (iter, 0) + \" \" +\n"
+#| " this._listStore.get_value (iter, 1) + \" \" +\n"
+#| " this._listStore.get_value (iter, 2) + \"\\n\" +\n"
+#| " this._listStore.get_value (iter, 3));\n"
+#| "\n"
+#| " }\n"
+#| "\n"
+#| "});\n"
+#| "\n"
+#| "// Run the application\n"
+#| "let app = new TreeViewExample ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"const Pango = imports.gi.Pango;\n"
"\n"
-"const TreeViewExample = new Lang.Class({\n"
-" Name: 'TreeView Example with Simple ListStore',\n"
-"\n"
+"class TreeViewExample {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jstreeviewsimpleliststore'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
-"\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
@@ -56159,7 +60227,7 @@ msgid ""
" this.selection = this._treeView.get_selection();\n"
"\n"
" // When something new is selected, call _on_changed\n"
-" this.selection.connect ('changed', Lang.bind (this, this._onSelectionChanged));\n"
+" this.selection.connect ('changed', this._onSelectionChanged.bind(this));\n"
"\n"
" // Create a grid to organize everything in\n"
" this._grid = new Gtk.Grid;\n"
@@ -56173,12 +60241,9 @@ msgid ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _onSelectionChanged: function () {\n"
+" }\n"
"\n"
+" _onSelectionChanged() {\n"
" // Grab a treeiter pointing to the current selection\n"
" let [ isSelected, model, iter ] = this.selection.get_selected();\n"
"\n"
@@ -56187,11 +60252,10 @@ msgid ""
" this._listStore.get_value (iter, 0) + \" \" +\n"
" this._listStore.get_value (iter, 1) + \" \" +\n"
" this._listStore.get_value (iter, 2) + \"\\n\" +\n"
-" this._listStore.get_value (iter, 3));\n"
-"\n"
+" this._listStore.get_value (iter, 3)\n"
+" );\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TreeViewExample ();\n"
@@ -56199,40 +60263,36 @@ msgid ""
msgstr ""
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const GObject = imports.gi.GObject;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
"const Pango = imports.gi.Pango;\n"
"\n"
-"const TreeViewExample = new Lang.Class({\n"
-" Name: 'TreeView Example with Simple ListStore',\n"
-"\n"
+"class TreeViewExample {\n"
" // Create the application itself\n"
-" _init: function() {\n"
+" constructor() {\n"
" this.application = new Gtk.Application({\n"
" application_id: 'org.example.jstreeviewsimpleliststore'\n"
" });\n"
"\n"
-" // Connect 'activate' and 'startup' signals to the callback functions\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" this.application.connect('startup', Lang.bind(this, this._onStartup));\n"
-" },\n"
+" // Connect 'activate' and 'startup' signals to the callback functions\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" this.application.connect('startup', this._onStartup.bind(this));\n"
+" }\n"
"\n"
" // Callback function for 'activate' signal presents window when active\n"
-" _onActivate: function() {\n"
+" _onActivate() {\n"
" this._window.present();\n"
-" },\n"
+" }\n"
"\n"
" // Callback function for 'startup' signal builds the UI\n"
-" _onStartup: function() {\n"
-" this._buildUI ();\n"
-" },\n"
-"\n"
-"\n"
+" _onStartup() {\n"
+" this._buildUI();\n"
+" }\n"
"\n"
" // Build the application's UI\n"
-" _buildUI: function() {\n"
-"\n"
+" _buildUI() {\n"
" // Create the application window\n"
" this._window = new Gtk.ApplicationWindow({\n"
" application: this.application,\n"
@@ -56311,7 +60371,7 @@ msgstr ""
" this.selection = this._treeView.get_selection();\n"
"\n"
" // When something new is selected, call _on_changed\n"
-" this.selection.connect ('changed', Lang.bind (this, this._onSelectionChanged));\n"
+" this.selection.connect ('changed', this._onSelectionChanged.bind(this));\n"
"\n"
" // Create a grid to organize everything in\n"
" this._grid = new Gtk.Grid;\n"
@@ -56325,12 +60385,9 @@ msgstr ""
"\n"
" // Show the window and all child widgets\n"
" this._window.show_all();\n"
-" },\n"
-"\n"
-"\n"
-"\n"
-" _onSelectionChanged: function () {\n"
+" }\n"
"\n"
+" _onSelectionChanged() {\n"
" // Grab a treeiter pointing to the current selection\n"
" let [ isSelected, model, iter ] = this.selection.get_selected();\n"
"\n"
@@ -56339,11 +60396,10 @@ msgstr ""
" this._listStore.get_value (iter, 0) + \" \" +\n"
" this._listStore.get_value (iter, 1) + \" \" +\n"
" this._listStore.get_value (iter, 2) + \"\\n\" +\n"
-" this._listStore.get_value (iter, 3));\n"
-"\n"
+" this._listStore.get_value (iter, 3)\n"
+" );\n"
" }\n"
-"\n"
-"});\n"
+"};\n"
"\n"
"// Run the application\n"
"let app = new TreeViewExample ();\n"
@@ -59059,46 +63115,88 @@ msgstr ""
#. (itstool) path: page/code
#: C/window.js.page:33
#, no-wrap
+#| msgid ""
+#| "\n"
+#| "#!/usr/bin/gjs\n"
+#| "\n"
+#| "const Gio = imports.gi.Gio;\n"
+#| "const GLib = imports.gi.GLib;\n"
+#| "const Gtk = imports.gi.Gtk;\n"
+#| "const Lang = imports.lang;\n"
+#| "\n"
+#| "const Application = new Lang.Class ({\n"
+#| " Name: 'Application',\n"
+#| "\n"
+#| " //create the application\n"
+#| " _init: function () {\n"
+#| " this.application = new Gtk.Application ({\n"
+#| " application_id: 'org.example.myapp',\n"
+#| " flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#| " });\n"
+#| "\n"
+#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
+#| " },\n"
+#| "\n"
+#| " //callback function for 'activate' signal\n"
+#| " _onActivate: function () {\n"
+#| "\n"
+#| " MyWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n"
+#| " MyWindow.title = \"Welcome to GNOME\";\n"
+#| "\n"
+#| " /* Here are a few ways we can customize our window.\n"
+#| " Try uncommenting them or changing their values! */\n"
+#| " //MyWindow.set_default_size (400,200);\n"
+#| " //MyWindow.set_has_resize_grip (false);\n"
+#| " //MyWindow.set_opacity (0.5);\n"
+#| " //MyWindow.maximize ();\n"
+#| "\n"
+#| " //show the window and all child widgets (none in this case)\n"
+#| " MyWindow.show_all();\n"
+#| " this.application.add_window(MyWindow);\n"
+#| " }\n"
+#| "});\n"
+#| "\n"
+#| "//run the application\n"
+#| "let app = new Application ();\n"
+#| "app.application.run (ARGV);\n"
msgid ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
-"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
"\n"
+"class Application {\n"
" //create the application\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function () {\n"
-"\n"
-" MyWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n"
-" MyWindow.title = \"Welcome to GNOME\";\n"
+" _onActivate() {\n"
+" let myWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n"
+" myWindow.title = \"Welcome to GNOME\";\n"
"\n"
" /* Here are a few ways we can customize our window.\n"
" Try uncommenting them or changing their values! */\n"
-" //MyWindow.set_default_size (400,200);\n"
-" //MyWindow.set_has_resize_grip (false);\n"
-" //MyWindow.set_opacity (0.5);\n"
-" //MyWindow.maximize ();\n"
+" //myWindow.set_default_size (400,200);\n"
+" //myWindow.set_has_resize_grip (false);\n"
+" //myWindow.set_opacity (0.5);\n"
+" //myWindow.maximize ();\n"
"\n"
" //show the window and all child widgets (none in this case)\n"
-" MyWindow.show_all();\n"
-" this.application.add_window(MyWindow);\n"
+" myWindow.show_all();\n"
+" this.application.add_window(myWindow);\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -59107,42 +63205,40 @@ msgstr ""
"\n"
"#!/usr/bin/gjs\n"
"\n"
+"imports.gi.versions.Gtk = '3.0';\n"
+"\n"
"const Gio = imports.gi.Gio;\n"
"const GLib = imports.gi.GLib;\n"
"const Gtk = imports.gi.Gtk;\n"
-"const Lang = imports.lang;\n"
-"\n"
-"const Application = new Lang.Class ({\n"
-" Name: 'Application',\n"
"\n"
+"class Application {\n"
" //create the application\n"
-" _init: function () {\n"
-" this.application = new Gtk.Application ({\n"
+" constructor() {\n"
+" this.application = new Gtk.Application({\n"
" application_id: 'org.example.myapp',\n"
" flags: Gio.ApplicationFlags.FLAGS_NONE\n"
" });\n"
"\n"
-" this.application.connect('activate', Lang.bind(this, this._onActivate));\n"
-" },\n"
+" this.application.connect('activate', this._onActivate.bind(this));\n"
+" }\n"
"\n"
" //callback function for 'activate' signal\n"
-" _onActivate: function () {\n"
-"\n"
-" MyWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n"
-" MyWindow.title = \"Welcome to GNOME\";\n"
+" _onActivate() {\n"
+" let myWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n"
+" myWindow.title = \"Welcome to GNOME\";\n"
"\n"
" /* Here are a few ways we can customize our window.\n"
" Try uncommenting them or changing their values! */\n"
-" //MyWindow.set_default_size (400,200);\n"
-" //MyWindow.set_has_resize_grip (false);\n"
-" //MyWindow.set_opacity (0.5);\n"
-" //MyWindow.maximize ();\n"
+" //myWindow.set_default_size (400,200);\n"
+" //myWindow.set_has_resize_grip (false);\n"
+" //myWindow.set_opacity (0.5);\n"
+" //myWindow.maximize ();\n"
"\n"
" //show the window and all child widgets (none in this case)\n"
-" MyWindow.show_all();\n"
-" this.application.add_window(MyWindow);\n"
+" myWindow.show_all();\n"
+" this.application.add_window(myWindow);\n"
" }\n"
-"});\n"
+"};\n"
"\n"
"//run the application\n"
"let app = new Application ();\n"
@@ -60272,6 +64368,200 @@ msgstr ""
"link> sincroniza el hilo principal y un hilo trabajador TLS que realiza las "
"operaciones de bloqueo de TLS."
+#~ msgid ""
+#~ "\n"
+#~ "const WelcomeToTheGrid = new Lang.Class({\n"
+#~ " Name: 'Welcome to the Grid',\n"
+#~ "\n"
+#~ " // Create the application itself\n"
+#~ " _init: function() {\n"
+#~ " this.application = new Gtk.Application();\n"
+#~ "\n"
+#~ " // Connect 'activate' and 'startup' signals to the callback "
+#~ "functions\n"
+#~ " this.application.connect('activate', Lang.bind(this, this."
+#~ "_onActivate));\n"
+#~ " this.application.connect('startup', Lang.bind(this, this."
+#~ "_onStartup));\n"
+#~ " },\n"
+#~ "\n"
+#~ " // Callback function for 'activate' signal presents windows when "
+#~ "active\n"
+#~ " _onActivate: function() {\n"
+#~ " this._window.present();\n"
+#~ " },\n"
+#~ "\n"
+#~ " // Callback function for 'startup' signal builds the UI\n"
+#~ " _onStartup: function() {\n"
+#~ " this._buildUI ();\n"
+#~ " },\n"
+#~ msgstr ""
+#~ "\n"
+#~ "const WelcomeToTheGrid = new Lang.Class({\n"
+#~ " Name: 'Welcome to the Grid',\n"
+#~ "\n"
+#~ " // Create the application itself\n"
+#~ " _init: function() {\n"
+#~ " this.application = new Gtk.Application();\n"
+#~ "\n"
+#~ " // Connect 'activate' and 'startup' signals to the callback "
+#~ "functions\n"
+#~ " this.application.connect('activate', Lang.bind(this, this."
+#~ "_onActivate));\n"
+#~ " this.application.connect('startup', Lang.bind(this, this."
+#~ "_onStartup));\n"
+#~ " },\n"
+#~ "\n"
+#~ " // Callback function for 'activate' signal presents windows when "
+#~ "active\n"
+#~ " _onActivate: function() {\n"
+#~ " this._window.present();\n"
+#~ " },\n"
+#~ "\n"
+#~ " // Callback function for 'startup' signal builds the UI\n"
+#~ " _onStartup: function() {\n"
+#~ " this._buildUI ();\n"
+#~ " },\n"
+
+#~ msgid ""
+#~ "#!/usr/bin/gjs\n"
+#~ "\n"
+#~ "const Gio = imports.gi.Gio;\n"
+#~ "const GLib = imports.gi.GLib;\n"
+#~ "const Gtk = imports.gi.Gtk;\n"
+#~ "const Lang = imports.lang;\n"
+#~ "\n"
+#~ "const ImageExample = new Lang.Class ({\n"
+#~ "\tName: 'Image Example',\n"
+#~ "\n"
+#~ "\t/* Create the application itself\n"
+#~ "\t This boilerplate code is needed to build any GTK+ application. */\n"
+#~ " _init: function () {\n"
+#~ " \t this.application = new Gtk.Application ({\n"
+#~ " \t application_id: 'org.example.jsimage',\n"
+#~ " \t flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#~ " \t });\n"
+#~ "\n"
+#~ "\t// Connect 'activate' and 'startup' signals to the callback functions\n"
+#~ "\tthis.application.connect('activate', Lang.bind(this, this."
+#~ "_onActivate));\n"
+#~ "\tthis.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\t// Callback function for 'activate' signal presents windows when "
+#~ "active\n"
+#~ "\t_onActivate: function () {\n"
+#~ "\t\tthis._window.present ();\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\t// Callback function for 'startup' signal initializes menus and builds "
+#~ "the UI\n"
+#~ "\t_onStartup: function () {\n"
+#~ "\t\tthis._buildUI ();\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\n"
+#~ "\n"
+#~ "\n"
+#~ "\t// Build the application's UI\n"
+#~ "\t_buildUI: function () {\n"
+#~ "\n"
+#~ "\t\t// Create the application window\n"
+#~ " \tthis._window = new Gtk.ApplicationWindow ({ application: this."
+#~ "application,\n"
+#~ " \t "
+#~ "window_position: Gtk.WindowPosition.CENTER,\n"
+#~ " \t title: "
+#~ "\"Welcome to GNOME\",\n"
+#~ " \t "
+#~ "default_height: 300,\n"
+#~ " \t "
+#~ "default_width: 300 });\n"
+#~ "\n"
+#~ "\t\t// Create the label\n"
+#~ "\t\tthis.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
+#~ "\t\tthis._window.add (this.jsimage);\n"
+#~ "\n"
+#~ " \t \t// Show the window and all child widgets\n"
+#~ " \t \tthis._window.show_all();\n"
+#~ "\t}\n"
+#~ "\n"
+#~ "\n"
+#~ "});\n"
+#~ "\n"
+#~ "// Run the application\n"
+#~ "let app = new ImageExample ();\n"
+#~ "app.application.run (ARGV);\n"
+#~ msgstr ""
+#~ "#!/usr/bin/gjs\n"
+#~ "\n"
+#~ "const Gio = imports.gi.Gio;\n"
+#~ "const GLib = imports.gi.GLib;\n"
+#~ "const Gtk = imports.gi.Gtk;\n"
+#~ "const Lang = imports.lang;\n"
+#~ "\n"
+#~ "const ImageExample = new Lang.Class ({\n"
+#~ "\tName: 'Image Example',\n"
+#~ "\n"
+#~ "\t/* Create the application itself\n"
+#~ "\t This boilerplate code is needed to build any GTK+ application. */\n"
+#~ " _init: function () {\n"
+#~ " \t this.application = new Gtk.Application ({\n"
+#~ " \t application_id: 'org.example.jsimage',\n"
+#~ " \t flags: Gio.ApplicationFlags.FLAGS_NONE\n"
+#~ " \t });\n"
+#~ "\n"
+#~ "\t// Connect 'activate' and 'startup' signals to the callback functions\n"
+#~ "\tthis.application.connect('activate', Lang.bind(this, this."
+#~ "_onActivate));\n"
+#~ "\tthis.application.connect('startup', Lang.bind(this, this._onStartup));\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\t// Callback function for 'activate' signal presents windows when "
+#~ "active\n"
+#~ "\t_onActivate: function () {\n"
+#~ "\t\tthis._window.present ();\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\t// Callback function for 'startup' signal initializes menus and builds "
+#~ "the UI\n"
+#~ "\t_onStartup: function () {\n"
+#~ "\t\tthis._buildUI ();\n"
+#~ "\t},\n"
+#~ "\n"
+#~ "\n"
+#~ "\n"
+#~ "\n"
+#~ "\t// Build the application's UI\n"
+#~ "\t_buildUI: function () {\n"
+#~ "\n"
+#~ "\t\t// Create the application window\n"
+#~ " \tthis._window = new Gtk.ApplicationWindow ({ application: this."
+#~ "application,\n"
+#~ " \t "
+#~ "window_position: Gtk.WindowPosition.CENTER,\n"
+#~ " \t title: "
+#~ "\"Welcome to GNOME\",\n"
+#~ " \t "
+#~ "default_height: 300,\n"
+#~ " \t "
+#~ "default_width: 300 });\n"
+#~ "\n"
+#~ "\t\t// Create the label\n"
+#~ "\t\tthis.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n"
+#~ "\t\tthis._window.add (this.jsimage);\n"
+#~ "\n"
+#~ " \t \t// Show the window and all child widgets\n"
+#~ " \t \tthis._window.show_all();\n"
+#~ "\t}\n"
+#~ "\n"
+#~ "\n"
+#~ "});\n"
+#~ "\n"
+#~ "// Run the application\n"
+#~ "let app = new ImageExample ();\n"
+#~ "app.application.run (ARGV);\n"
+
#~ msgid "autohen.sh"
#~ msgstr "autohen.sh"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]