1# Brazilian Portuguese translation for gnome-devel-docs. 2# Copyright (C) 2018 gnome-devel-docs's COPYRIGHT HOLDER 3# This file is distributed under the same license as the gnome-devel-docs package. 4# Rafael Fontenelle <rafaelff@gnome.org>, 2013, 2018. 5msgid "" 6msgstr "" 7"Project-Id-Version: gnome-devel-docs master\n" 8"POT-Creation-Date: 2018-09-25 15:49+0000\n" 9"PO-Revision-Date: 2018-09-25 14:42-0200\n" 10"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n" 11"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n" 12"Language: pt_BR\n" 13"MIME-Version: 1.0\n" 14"Content-Type: text/plain; charset=UTF-8\n" 15"Content-Transfer-Encoding: 8bit\n" 16"Plural-Forms: nplurals=2; plural=(n > 1);\n" 17"X-Generator: Virtaal 1.0.0-beta1\n" 18"X-Project-Style: gnome\n" 19 20#. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2 21msgctxt "_" 22msgid "translator-credits" 23msgstr "Rafael Fontenelle <rafaelff@gnome.org>, 2013, 2018" 24 25#. (itstool) path: credit/name 26#: C/02_welcome_to_the_grid.js.page:15 C/03_getting_the_signal.js.page:16 27#: C/aboutdialog.js.page:12 C/button.js.page:13 C/checkbutton.js.page:13 28#: C/comboboxtext.js.page:15 C/combobox.js.page:17 C/dialog.js.page:13 29#: C/entry.js.page:13 C/grid.js.page:18 C/hellognome.js.page:12 30#: C/image.js.page:12 C/label.js.page:13 C/linkbutton.js.page:13 31#: C/messagedialog.js.page:16 C/progressbar.js.page:12 C/radiobutton.js.page:13 32#: C/scale.js.page:13 C/set-up-gedit.js.page:12 C/spinbutton.js.page:16 33#: C/spinner.js.page:13 C/statusbar.js.page:13 C/switch.js.page:13 34#: C/textview.js.page:17 C/togglebutton.js.page:13 35#: C/treeview_simple_liststore.js.page:16 C/window.js.page:13 36msgid "Taryn Fox" 37msgstr "Taryn Fox" 38 39#. (itstool) path: credit/years 40#: C/02_welcome_to_the_grid.js.page:17 C/03_getting_the_signal.js.page:18 41#: C/aboutdialog.c.page:17 C/aboutdialog.js.page:14 C/aboutdialog.py.page:16 42#: C/aboutdialog.vala.page:17 C/beginner.js.page:13 C/button.c.page:17 43#: C/button.js.page:15 C/button.py.page:17 C/button.vala.page:16 44#: C/buttonbox.py.page:17 C/checkbutton.c.page:15 C/checkbutton.js.page:15 45#: C/checkbutton.py.page:16 C/checkbutton.vala.page:15 C/colorbutton.py.page:16 46#: C/colorbutton.vala.page:17 C/comboboxtext.js.page:17 C/combobox.c.page:15 47#: C/combobox.js.page:19 C/combobox.py.page:17 C/combobox.vala.page:15 48#: C/combobox_multicolumn.py.page:16 C/dialog.c.page:17 C/dialog.js.page:15 49#: C/dialog.py.page:17 C/dialog.vala.page:15 C/entry.c.page:15 50#: C/entry.js.page:15 C/entry.py.page:17 C/entry.vala.page:15 51#: C/filechooserdialog.py.page:19 C/filechooserdialog.vala.page:18 52#: C/fontchooserwidget.py.page:17 C/gmenu.c.page:15 C/gmenu.js.page:15 53#: C/gmenu.py.page:17 C/gmenu.py.page:23 C/gmenu.vala.page:16 C/grid.c.page:15 54#: C/grid.js.page:15 C/grid.py.page:17 C/grid.py.page:23 C/grid.vala.page:17 55#: C/GtkApplicationWindow.c.page:15 C/GtkApplicationWindow.js.page:15 56#: C/GtkApplicationWindow.py.page:17 C/GtkApplicationWindow.py.page:22 57#: C/GtkApplicationWindow.vala.page:15 C/guitar-tuner.js.page:14 58#: C/hellognome.js.page:14 C/hello-world.c.page:17 C/hello-world.js.page:17 59#: C/hello-world.py.page:17 C/hello-world.vala.page:17 C/image.c.page:15 60#: C/image.js.page:14 C/image.py.page:17 C/image.vala.page:15 C/label.c.page:16 61#: C/label.js.page:15 C/label.py.page:19 C/label.py.page:24 62#: C/label.vala.page:15 C/linkbutton.c.page:15 C/linkbutton.js.page:15 63#: C/linkbutton.py.page:16 C/linkbutton.vala.page:15 C/menubar.c.page:17 64#: C/menubar.py.page:17 C/menubar.py.page:22 C/menubar.vala.page:17 65#: C/menubutton.js.page:15 C/menubutton.py.page:16 C/menubutton.py.page:22 66#: C/menubutton.vala.page:15 C/messagedialog.c.page:16 67#: C/messagedialog.js.page:18 C/messagedialog.py.page:16 68#: C/messagedialog.vala.page:15 C/model-view-controller.py.page:23 69#: C/paned.c.page:15 C/paned.py.page:16 C/progressbar.c.page:16 70#: C/progressbar.js.page:14 C/progressbar.py.page:16 C/progressbar.vala.page:15 71#: C/properties.py.page:23 C/radiobutton.c.page:17 C/radiobutton.js.page:15 72#: C/radiobutton.py.page:17 C/radiobutton.vala.page:18 C/response-type.page:11 73#: C/scale.c.page:17 C/scale.js.page:15 C/scale.py.page:17 C/scale.vala.page:17 74#: C/scrolledwindow.c.page:17 C/scrolledwindow.py.page:16 75#: C/scrolledwindow.vala.page:16 C/separator.py.page:17 76#: C/set-up-gedit.js.page:14 C/signals-callbacks.py.page:23 77#: C/spinbutton.c.page:18 C/spinbutton.js.page:18 C/spinbutton.py.page:17 78#: C/spinbutton.vala.page:17 C/spinner.c.page:16 C/spinner.js.page:15 79#: C/spinner.py.page:16 C/spinner.vala.page:15 C/statusbar.c.page:19 80#: C/statusbar.js.page:15 C/statusbar.py.page:17 C/statusbar.vala.page:18 81#: C/strings.py.page:23 C/switch.c.page:15 C/switch.js.page:15 82#: C/switch.py.page:16 C/switch.vala.page:19 C/textview.c.page:15 83#: C/textview.js.page:19 C/textview.py.page:24 C/textview.vala.page:15 84#: C/togglebutton.c.page:19 C/togglebutton.js.page:15 C/togglebutton.py.page:16 85#: C/togglebutton.vala.page:18 C/toolbar.c.page:17 C/toolbar.js.page:15 86#: C/toolbar.py.page:17 C/toolbar.vala.page:16 C/toolbar_builder.py.page:18 87#: C/toolbar_builder.py.page:24 C/toolbar_builder.vala.page:17 88#: C/tooltip.py.page:17 C/treeview_advanced_liststore.py.page:16 89#: C/treeview_cellrenderertoggle.py.page:16 90#: C/treeview_simple_liststore.js.page:18 91#: C/treeview_simple_liststore.py.page:17 92#: C/treeview_simple_liststore.vala.page:17 C/treeview_treestore.py.page:17 93#: C/tutorial.py.page:17 C/weatherApp.js.page:14 C/weatherAppMain.js.page:13 94#: C/weatherAutotools.js.page:13 C/weatherGeonames.js.page:13 95#: C/window.c.page:15 C/window.js.page:15 C/window.py.page:17 96#: C/window.py.page:22 C/window.vala.page:15 97msgid "2012" 98msgstr "2012" 99 100#. (itstool) path: info/desc 101#: C/02_welcome_to_the_grid.js.page:20 102msgid "Learn how to lay out UI components, like Images and Labels." 103msgstr "" 104"Aprenda como posicionar componentes de interface de usuário, como Images e " 105"Labels." 106 107#. (itstool) path: page/title 108#: C/02_welcome_to_the_grid.js.page:23 109msgid "2. Welcome to the Grid" 110msgstr "2. Bem-vindo à Grid" 111 112#. (itstool) path: synopsis/p 113#: C/02_welcome_to_the_grid.js.page:25 114msgid "" 115"This tutorial will show you how to create basic widgets, or parts of the " 116"GNOME user interface, like Images and Labels. You'll then learn how to " 117"arrange them all in a Grid, which lets you put widgets exactly where you " 118"want them." 119msgstr "" 120"Este tutorial vai mostrar a você como criar widgets básicos ou partes da " 121"interface de usuário do GNOME, como Images (imagens) e Labels (rótulos). " 122"Você, então, aprenderá como organizá-las em uma Grid (grade), que permite " 123"que você coloca widgets exatamente onde você os quer." 124 125#. (itstool) path: note/p 126#: C/02_welcome_to_the_grid.js.page:26 127msgid "" 128"Have you taken <link xref=\"hellognome.js\">the first tutorial in this " 129"series</link> already? You'll want to do so before continuing." 130msgstr "" 131"Você já viu <link xref=\"hellognome.js\">o primeiro tutorial desta série</" 132"link>? Você vai querer vê-lo antes de continuar." 133 134#. (itstool) path: section/title 135#: C/02_welcome_to_the_grid.js.page:32 136msgid "Going native" 137msgstr "Se tornando nativo" 138 139#. (itstool) path: section/p 140#: C/02_welcome_to_the_grid.js.page:34 141msgid "" 142"In the last tutorial, we created what was basically a GNOME window frame for " 143"a web app. All the GNOME-specific code we needed to learn revolved around " 144"putting the WebView -- the widget containing our application -- into an " 145"ApplicationWindow, and telling it to display. The application itself was " 146"written in HTML and JavaScript, just like most pages on the web." 147msgstr "" 148"No último tutorial, nós criamos o que era basicamente um quadro de janela do " 149"GNOME para um aplicativo web. Todo o código específico do GNOME que nós " 150"precisamos aprender se resolver colocando o WebView -- o widget contendo " 151"nosso aplicativo -- em um ApplicationWindow, e falando para ele exibir. O " 152"aplicativo em si foi escrito em HTML e JavaScript, assim como a maioria das " 153"páginas na web." 154 155#. (itstool) path: section/p 156#: C/02_welcome_to_the_grid.js.page:35 157msgid "" 158"This time, we're going to use only native GNOME widgets. A widget is just a " 159"thing, like a checkbox or picture, and GNOME has a wide variety of them to " 160"choose from. We call them \"native\" widgets to distinguish them from things " 161"like the button and header in the web app we wrote. Because instead of using " 162"web code, these are going to be 100 percent GNOME, using GTK+." 163msgstr "" 164"Agora, nós vamos usar apenas widgets nativos do GNOME. Um widget é apenas " 165"uma coisa, como uma caixa de seleção ou imagem, e o GNOME tem uma ampla " 166"variedade delas para se escolher. Nós chamamos elas de widgets “nativas” " 167"para diferenciá-las de coisas como o botão e cabeçalho nos aplicativos web " 168"que nós escrevemos. Porque em vez de usarmos código web, essas vão ser 100 " 169"porcento GNOME, usando o GTK+." 170 171#. (itstool) path: note/p 172#: C/02_welcome_to_the_grid.js.page:36 173msgid "" 174"GTK+ stands for \"GIMP Toolkit\". It's like a toolbox of widgets that you " 175"can reach into, while building your applications. It was originally written " 176"for <link href=\"http://www.gimp.org/\">the GIMP</link>, which is a free " 177"software image editor." 178msgstr "" 179"GTK+ significa “GIMP Toolkit” (kit de ferramentas do GIMP). É como uma caixa " 180"de ferramentas de widgets que você pode acessar, enquanto construindo seus " 181"aplicativos. Ele foi escrito originalmente para <link href=\"http://www.gimp." 182"org/\">o GIMP</link>, que é um software livre de edição de imagens." 183 184#. (itstool) path: section/title 185#: C/02_welcome_to_the_grid.js.page:40 186msgid "Setting up our application" 187msgstr "Configurando seu aplicativo" 188 189#. (itstool) path: section/p 190#: C/02_welcome_to_the_grid.js.page:42 191msgid "" 192"Before we dig out any widgets from the GTK+ toolbox, we first need to write " 193"the basic boilerplate code that our application requires." 194msgstr "" 195"Antes de nos aprofundarmos na caixa de ferramentas do GTK+, nós primeiro " 196"precisamos escrever o código básico padrão que nosso aplicativo requer." 197 198#. (itstool) path: section/code 199#: C/02_welcome_to_the_grid.js.page:43 200#, no-wrap 201msgid "" 202"\n" 203"#!/usr/bin/gjs\n" 204"\n" 205"imports.gi.versions.Gtk = '3.0';\n" 206"const Gtk = imports.gi.Gtk;\n" 207msgstr "" 208"\n" 209"#!/usr/bin/gjs\n" 210"\n" 211"imports.gi.versions.Gtk = '3.0';\n" 212"const Gtk = imports.gi.Gtk;\n" 213 214#. (itstool) path: section/p 215#: C/02_welcome_to_the_grid.js.page:49 216msgid "" 217"This part always goes at the start of your code. Depending on what you'll be " 218"doing with it, you may want to declare more imports here. What we're writing " 219"today is pretty basic, so these are all we need; Gtk for the widgets, using " 220"the stable '3.0' API." 221msgstr "" 222"Essa parte sempre vai no começo do seu código. Dependendo do que você vai " 223"fazer com ele, você pode querer declarar muitas importações aqui. O que nós " 224"estamos escrevendo hoje é bem básico, de forma que isso é tudo que " 225"precisamos; o Gtk para os widgets, usando a API '3.0' estável." 226 227#. (itstool) path: section/p 228#: C/02_welcome_to_the_grid.js.page:50 229msgid "Speaking of which:" 230msgstr "Falando nisso:" 231 232#. (itstool) path: section/code 233#: C/02_welcome_to_the_grid.js.page:51 234#, no-wrap 235msgid "" 236"\n" 237"class WelcomeToTheGrid {\n" 238" // Create the application itself\n" 239" constructor() {\n" 240" this.application = new Gtk.Application();\n" 241"\n" 242" // Connect 'activate' and 'startup' signals to the callback functions\n" 243" this.application.connect('activate', this._onActivate.bind(this));\n" 244" this.application.connect('startup', this._onStartup.bind(this));\n" 245" }\n" 246"\n" 247" // Callback function for 'activate' signal presents windows when active\n" 248" _onActivate() {\n" 249" this._window.present();\n" 250" }\n" 251"\n" 252" // Callback function for 'startup' signal builds the UI\n" 253" _onStartup() {\n" 254" this._buildUI ();\n" 255" }\n" 256msgstr "" 257"\n" 258"class WelcomeToTheGrid {\n" 259" // Cria o aplicativo em si\n" 260" constructor() {\n" 261" this.application = new Gtk.Application();\n" 262"\n" 263" // Conecta os sinais \"activate\" e \"startup\" às funções de chamada\n" 264" this.application.connect('activate', this._onActivate.bind(this));\n" 265" this.application.connect('startup', this._onStartup.bind(this));\n" 266" }\n" 267"\n" 268" // Função de chamada para o sinal \"activate\" apresenta janelas quando ativa\n" 269" _onActivate() {\n" 270" this._window.present();\n" 271" }\n" 272"\n" 273" // Função de chamada para o sinal \"startup\" constrói a interface gráfica\n" 274" _onStartup() {\n" 275" this._buildUI ();\n" 276" }\n" 277 278#. (itstool) path: section/p 279#: C/02_welcome_to_the_grid.js.page:72 280msgid "" 281"This is the start of the application itself, and the _init function which " 282"creates it. It tells _buildUI to create an ApplicationWindow, which we're " 283"going to call _window, and it tells our window to present itself whenever " 284"needed." 285msgstr "" 286"Esse é o começo de um aplicativo em si e a função _init que cria-o. Ela fala " 287"para _buildUI criar um ApplicationWindow, com o qual nós vamos chamar " 288"_window, e fala para nossa janela para se apresentar quando for necessário." 289 290#. (itstool) path: section/p 291#: C/02_welcome_to_the_grid.js.page:73 292msgid "" 293"This part, again, is pretty much copy-and-paste, but you always want to give " 294"your application a unique name." 295msgstr "" 296"Essa parte, de novo, é basicamente um copia-e-cola, mas você sempre deseja " 297"dar seu aplicativo um nome único." 298 299#. (itstool) path: section/code 300#: C/02_welcome_to_the_grid.js.page:75 301#, no-wrap 302msgid "" 303"\n" 304" // Build the application's UI\n" 305" _buildUI() {\n" 306"\n" 307" // Create the application window\n" 308" this._window = new Gtk.ApplicationWindow({\n" 309" application: this.application,\n" 310" window_position: Gtk.WindowPosition.CENTER,\n" 311" border_width: 10,\n" 312" title: \"Welcome to the Grid\"});\n" 313msgstr "" 314"\n" 315" // Constrói a interface gráfica do aplicativo\n" 316" _buildUI() {\n" 317"\n" 318" // Cria a janela do aplicativo\n" 319" this._window = new Gtk.ApplicationWindow({\n" 320" application: this.application,\n" 321" window_position: Gtk.WindowPosition.CENTER,\n" 322" border_width: 10,\n" 323" title: \"Bem-vindo à Grid\"});\n" 324 325#. (itstool) path: section/p 326#: C/02_welcome_to_the_grid.js.page:86 327msgid "" 328"Finally, we start off the _buildUI function by creating a new " 329"ApplicationWindow. We specify that it goes with this application, that it " 330"should appear in the center of the screen, and that there should be at least " 331"10 pixels between the outside edge and any widgets inside of it. We also " 332"give it a title, which will appear at the top of the window." 333msgstr "" 334"Finalmente, nós começamos a função _buildUI criando uma nova " 335"ApplicationWindow. Nós especificamos que ela vai com este aplicativo, que " 336"ela deveria aparecer no centro da tela, e que deve haver pelo menos 10 " 337"pixels entre a borda exterior e quaisquer widgets dentro dela. Nós também " 338"damos a ela um título, que vai aparecer no topo da janela." 339 340#. (itstool) path: section/title 341#: C/02_welcome_to_the_grid.js.page:90 342msgid "Reaching into the GTK+ toolbox" 343msgstr "Alcançando a caixa de ferramentas do GTK+" 344 345#. (itstool) path: section/p 346#: C/02_welcome_to_the_grid.js.page:91 347msgid "" 348"What widgets should we use? Well, let's say we want to write an application " 349"that looks like this:" 350msgstr "" 351"Quais widgets nós deveríamos usar? Bem, digamos que nós queremos escrever um " 352"aplicativo que se parece com este:" 353 354#. (itstool) path: section/media 355#. This is a reference to an external file such as an image or video. When 356#. the file changes, the md5 hash will change to let you know you need to 357#. update your localized copy. The msgstr is not used at all. Set it to 358#. whatever you like once you have updated your copy of the file. 359#: C/02_welcome_to_the_grid.js.page:93 360msgctxt "_" 361msgid "" 362"external ref='media/02_jsgrid_01.png' md5='3fdc22d361cf801f71557fdc76ae5b49'" 363msgstr "" 364"external ref='media/02_jsgrid_01.png' md5='3fdc22d361cf801f71557fdc76ae5b49'" 365 366#. (itstool) path: section/p 367#: C/02_welcome_to_the_grid.js.page:95 368msgid "" 369"We're going to need, at the very least, a picture and a text label to go " 370"with it. Let's start with the picture:" 371msgstr "" 372"Nós vamos precisar, no mínimo, de uma imagem e um rótulo de texto para " 373"seguir. Vamos começar com a imagem:" 374 375#. (itstool) path: section/code 376#: C/02_welcome_to_the_grid.js.page:96 377#, no-wrap 378msgid "" 379"\n" 380" // Create an image\n" 381" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 382msgstr "" 383"\n" 384" // Cria uma imagem\n" 385" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 386 387#. (itstool) path: section/p 388#: C/02_welcome_to_the_grid.js.page:101 389msgid "" 390"You can download the image file used in this example <link href=\"https://" 391"live.gnome.org/TarynFox?action=AttachFile&do=get&target=gnome-image." 392"png\">here</link>. Be sure to put it in the same directory as the code " 393"you're writing." 394msgstr "" 395"Você pode baixar o arquivo de imagem neste exemplo <link href=\"https://live." 396"gnome.org/TarynFox?action=AttachFile&do=get&target=gnome-image.png" 397"\">arquivo</link>. Certifique-se de colocá-lo no mesmo diretório do código " 398"que você está escrevendo." 399 400#. (itstool) path: section/code 401#: C/02_welcome_to_the_grid.js.page:103 402#, no-wrap 403msgid "" 404"\n" 405" // Create a label\n" 406" this._label = new Gtk.Label ({ label: \"Welcome to GNOME, too!\" });\n" 407msgstr "" 408"\n" 409" // Cria um rótulo\n" 410" this._label = new Gtk.Label ({ label: \"Bem-vindo ao GNOME, também!\" });\n" 411 412#. (itstool) path: section/p 413#: C/02_welcome_to_the_grid.js.page:107 414msgid "" 415"That code adds in the label beneath. You can see how we create widgets, " 416"here; each one is a part of Gtk, and we can give it properties that " 417"customize how it behaves. In this case, we set the Image's file property to " 418"be the filename of the picture we want, and the Label's label property to be " 419"the sentence that we want beneath the picture." 420msgstr "" 421"Aquele código adiciona o rótulo abaixo. Você pode ver como nós criamos " 422"widgets aqui; cada um é uma parte do GTK e nós podemos dar a ele " 423"propriedades que personalizam como ele se comporta. neste caso, nós " 424"definimos a propriedade do arquivo de imagem para ser o nome do arquivo da " 425"imagem que queremos e adicionamos a propriedade de rótulo do Label para ser " 426"a sentença que desejamos embaixo da imagem." 427 428#. (itstool) path: note/p 429#: C/02_welcome_to_the_grid.js.page:108 430msgid "" 431"Yes, it sounds redundant for a Label to have a label property, but it's not. " 432"Other widgets that contain text have a label property, so it's " 433"<em>consistent</em> for the Label widget to have one too." 434msgstr "" 435"Sim, isso soa redundante um Label ter uma propriedade de rótulo, mas não é. " 436"Outros widgets que contêm texto possuem uma propriedade de rótulo, de forma " 437"que é <em>consistente</em> para o widget de Label ter um também." 438 439#. (itstool) path: section/p 440#: C/02_welcome_to_the_grid.js.page:109 441msgid "" 442"We can't just add these widgets to our window in order, though, the same way " 443"HTML elements appear in the order you write them. That's because an " 444"ApplicationWindow can only contain one widget." 445msgstr "" 446"Nós não podemos simplesmente adicionar estes widgets a nossa janela em " 447"ordem, porém, da mesma forma que elementos HTML aparecem na ordem que você " 448"escreve-os. Isso porque em ApplicationWindow pode conter apenas um widget." 449 450#. (itstool) path: section/p 451#: C/02_welcome_to_the_grid.js.page:110 452msgid "" 453"How do we get around that? By making that one widget a container widget, " 454"which can hold more than one widget and organize them inside it. Behold: The " 455"Grid." 456msgstr "" 457"Como nós resolvemos isso? Marcando aquele widget como um widget contêiner, " 458"que pode manter mais de um widget e organizá-los dentro dele. Conheça: a " 459"Grid." 460 461#. (itstool) path: section/code 462#: C/02_welcome_to_the_grid.js.page:111 463#, no-wrap 464msgid "" 465"\n" 466" // Create the Grid\n" 467" this._grid = new Gtk.Grid ();\n" 468msgstr "" 469"\n" 470" // Cria a Grid\n" 471" this._grid = new Gtk.Grid ();\n" 472 473#. (itstool) path: section/p 474#: C/02_welcome_to_the_grid.js.page:116 475msgid "" 476"We're not giving it any properties yet. Those will come later, as we learn " 477"how to use the Grid's powers. First, let's attach the Image and Label we " 478"made to our Grid." 479msgstr "" 480"Nós não estamos desistindo de nenhuma propriedade ainda. Aquelas virão " 481"posteriormente, na medida em que aprendemos como usar os poderes da Grid. " 482"Primeiro, vamos anexar a Image e Label que nós fizemos para nossa Grid." 483 484#. (itstool) path: section/code 485#: C/02_welcome_to_the_grid.js.page:117 486#, no-wrap 487msgid "" 488"\n" 489" // Attach the image and label to the grid\n" 490" this._grid.attach (this._image, 0, 0, 1, 1);\n" 491" this._grid.attach (this._label, 0, 1, 1, 1);\n" 492msgstr "" 493"\n" 494" // Anexa a imagem e o rótulo à grade\n" 495" this._grid.attach (this._image, 0, 0, 1, 1);\n" 496" this._grid.attach (this._label, 0, 1, 1, 1);\n" 497 498#. (itstool) path: section/p 499#: C/02_welcome_to_the_grid.js.page:123 500msgid "" 501"This code looks awfully complicated, but it's not. Here's what those numbers " 502"mean:" 503msgstr "" 504"Este código parece muito complicado, mas não é. Aqui segue o que aqueles " 505"números significam:" 506 507#. (itstool) path: item/p 508#: C/02_welcome_to_the_grid.js.page:125 509msgid "" 510"The <em>first</em> number is what left-to-right position to put things in, " 511"starting from 0. Any widget that uses a 0 here goes all the way to the left." 512msgstr "" 513"O <em>primeiro</em> número é qual posição esquerda-para-direita deve-se " 514"coloca as coisas, começando de 0. Qualquer widget que usa um 0 aqui vai para " 515"o mais esquerda possível." 516 517#. (itstool) path: item/p 518#: C/02_welcome_to_the_grid.js.page:126 519msgid "" 520"The <em>second</em> number is what top-to-bottom position to put a given " 521"widget in, starting from 0. The Label goes beneath the Image, so we give the " 522"Image a 0 and the Label a 1 here." 523msgstr "" 524"O <em>segundo</em> número é qual posição de cima-para-baixo deve-se colocar " 525"uma dado widget, começando de 0. O Label vai embaixo da Image, de forma que " 526"nós damos à Image um 0 e o Label um 1 aqui." 527 528#. (itstool) path: item/p 529#: C/02_welcome_to_the_grid.js.page:127 530msgid "" 531"The <em>third</em> and <em>fourth</em> numbers are how many columns and rows " 532"a widget should take up. We'll see how these work in a minute." 533msgstr "" 534"O <em>terceiro</em> e <em>quarto</em> números são quantas colunas e linhas " 535"um widget deveria levar. Nós vamos ver como estes funcionam em um minuto." 536 537#. (itstool) path: section/code 538#: C/02_welcome_to_the_grid.js.page:130 539#, no-wrap 540msgid "" 541"\n" 542" // Add the grid to the window\n" 543" this._window.add (this._grid);\n" 544"\n" 545" // Show the window and all child widgets\n" 546" this._window.show_all();\n" 547" }\n" 548"\n" 549"};\n" 550"\n" 551"// Run the application\n" 552"let app = new WelcomeToTheGrid ();\n" 553"app.application.run (ARGV);\n" 554msgstr "" 555"\n" 556" // Adiciona a grade à janela\n" 557" this._window.add (this._grid);\n" 558"\n" 559" // Mostra a janela e todos seus widgets filhos\n" 560" this._window.show_all();\n" 561" }\n" 562"\n" 563"};\n" 564"\n" 565"// Executa o aplicativo\n" 566"let app = new WelcomeToTheGrid ();\n" 567"app.application.run (ARGV);\n" 568 569#. (itstool) path: section/p 570#: C/02_welcome_to_the_grid.js.page:144 571msgid "" 572"Now that we've created the Grid and attached all our widgets to it, we add " 573"it to the window and tell the window to show itself, as the last part of the " 574"_buildUI function. As always, to finish up we create a new instance of the " 575"application's class and tell it to run." 576msgstr "" 577"Agora que nós criamos a Grid e anexamos todos os nossos widgets a ela, nós " 578"adicionamos-a à janela e falamos para a janela se mostrar, como parte da " 579"função _buildUI. Como sempre, para finalizar nós criamos uma nova instância " 580"da classe do aplicativo e falamos para ele executar." 581 582#. (itstool) path: section/p 583#: C/02_welcome_to_the_grid.js.page:145 584msgid "" 585"Save your application as welcome_to_the_grid.js. Then, to run your " 586"application just open a terminal, go to the directory where your application " 587"is at, and type" 588msgstr "" 589"Salva seu aplicativo como welcome_to_the_grid.js. Então, para executar seu " 590"aplicativo basta abrir um terminal, ir até o diretório onde seu aplicativo " 591"se encontra e digitar" 592 593#. (itstool) path: section/screen 594#: C/02_welcome_to_the_grid.js.page:146 595#, no-wrap 596msgid " <output style=\"prompt\">$ </output>gjs welcome_to_the_grid.js " 597msgstr " <output style=\"prompt\">$ </output>gjs welcome_to_the_grid.js " 598 599#. (itstool) path: section/media 600#. This is a reference to an external file such as an image or video. When 601#. the file changes, the md5 hash will change to let you know you need to 602#. update your localized copy. The msgstr is not used at all. Set it to 603#. whatever you like once you have updated your copy of the file. 604#: C/02_welcome_to_the_grid.js.page:148 605msgctxt "_" 606msgid "" 607"external ref='media/02_jsgrid_02.png' md5='07db86b0043ba5c3c24a90d7322bd81e'" 608msgstr "" 609"external ref='media/02_jsgrid_02.png' md5='07db86b0043ba5c3c24a90d7322bd81e'" 610 611#. (itstool) path: section/p 612#: C/02_welcome_to_the_grid.js.page:150 613msgid "" 614"There we go! But wait. That doesn't look right. Why is the Label crammed up " 615"next to the Image like that? That doesn't look as nice, and it makes it " 616"harder to read. What can we do about this?" 617msgstr "" 618"Pronto! Mas espera. Isso não parece correto. Por que o Label está misturado " 619"próximo à Image desta forma? Isso não ficou legal e fica mais difícil de " 620"ler. O que nós podemos fazer quanto a isso?" 621 622#. (itstool) path: section/title 623#: C/02_welcome_to_the_grid.js.page:154 624msgid "Tweaking the Grid" 625msgstr "Ajustando a Grid" 626 627#. (itstool) path: section/p 628#: C/02_welcome_to_the_grid.js.page:156 629msgid "" 630"One thing we can do, is we can give the Label a margin_top property when we " 631"create it. This works sort of like setting a margin for an HTML element " 632"using inline CSS styling." 633msgstr "" 634"Uma coisa que nós podemos fazer é dar ao Label uma propriedade margin_top no " 635"momento de sua criação. Isso funciona mais ou menos como definir uma margem " 636"para um elemento HTML usando estilo CSS embutido." 637 638#. (itstool) path: section/code 639#: C/02_welcome_to_the_grid.js.page:157 640#, no-wrap 641msgid "" 642"\n" 643" // Create a label\n" 644" this._label = new Gtk.Label ({\n" 645" label: \"Welcome to GNOME, too!\",\n" 646" margin_top: 20 });\n" 647msgstr "" 648"\n" 649" // Cria um rótulo\n" 650" this._label = new Gtk.Label ({\n" 651" label: \"Bem-vindo ao GNOME, também!\",\n" 652" margin_top: 20 });\n" 653 654#. (itstool) path: section/p 655#: C/02_welcome_to_the_grid.js.page:164 656msgid "" 657"Of course, if we do that then if we replace the Label with something else -- " 658"or add in another widget -- then we have to repeat the margin_top on it too. " 659"Otherwise we end up with something like this:" 660msgstr "" 661"É claro que, se nós fizermos isso, então se substituirmos a Label com alguma " 662"outra coisa -- ou adicionar em outro widget --, então nós teremos que " 663"repetir o margin_top nele também. Do contrário, nós acabaremos com alguma " 664"coisa como isso:" 665 666#. (itstool) path: section/media 667#. This is a reference to an external file such as an image or video. When 668#. the file changes, the md5 hash will change to let you know you need to 669#. update your localized copy. The msgstr is not used at all. Set it to 670#. whatever you like once you have updated your copy of the file. 671#: C/02_welcome_to_the_grid.js.page:165 672msgctxt "_" 673msgid "" 674"external ref='media/02_jsgrid_03.png' md5='817351e73c687d47253c56ed06b6629f'" 675msgstr "" 676"external ref='media/02_jsgrid_03.png' md5='817351e73c687d47253c56ed06b6629f'" 677 678#. (itstool) path: section/p 679#: C/02_welcome_to_the_grid.js.page:167 680msgid "" 681"We could give the Image a margin_bottom property, but that won't work when " 682"the new Label is in a separate column. So how about we try this instead:" 683msgstr "" 684"Nós poderíamos dar à Image uma propriedade margin_bottom, mas isso não vai " 685"funcionar quando a nova Label estiver em uma coluna separada. Então, que tal " 686"nós tentarmos isso:" 687 688#. (itstool) path: section/code 689#: C/02_welcome_to_the_grid.js.page:168 690#, no-wrap 691msgid "" 692"\n" 693" // Create the Grid\n" 694" this._grid = new Gtk.Grid ({\n" 695" row_spacing: 20 });\n" 696msgstr "" 697"\n" 698" // Cria a Grid\n" 699" this._grid = new Gtk.Grid ({\n" 700" row_spacing: 20 });\n" 701 702#. (itstool) path: section/p 703#: C/02_welcome_to_the_grid.js.page:174 704msgid "" 705"That makes it so that there are always 20 pixels of space in between each " 706"horizontal row." 707msgstr "" 708"Isso resolve, de forma que há sempre 20 pixels de espaço entre cada linha " 709"horizontal." 710 711#. (itstool) path: note/p 712#: C/02_welcome_to_the_grid.js.page:175 713msgid "" 714"Yes, you can also set the column_spacing property on a Grid, or the " 715"margin_left and margin_right properties on any widget. Try them out, if you " 716"like!" 717msgstr "" 718"Sim, você também pode definir a propriedade column_spacing em uma Grid ou as " 719"propriedades margin_left e margin_right em qualquer widget. Tente-os, se " 720"você quiser!" 721 722#. (itstool) path: section/title 723#: C/02_welcome_to_the_grid.js.page:179 724msgid "Adding more widgets" 725msgstr "Adicionando mais widgets" 726 727#. (itstool) path: section/p 728#: C/02_welcome_to_the_grid.js.page:181 729msgid "" 730"If we did want to add a second Label, how would we do it so that it actually " 731"looked like it belonged there? One way is to center the Image on top, so " 732"that it's above both Labels instead of just the one on the left. That's " 733"where those other numbers in the Grid's attach method come in:" 734msgstr "" 735"Se nós quiséssemos adicionar um segundo Label, como que nós vamos fazê-lo de " 736"forma que ela realmente pareça como pertencente dali? Uma forma é " 737"centralizar a Image na parte superior, de forma que esteja em cima de ambas " 738"Labels, em vez de apenas uma para a esquerda. É aí que aqueles outros " 739"números no método para anexar na Grid entram:" 740 741#. (itstool) path: section/code 742#: C/02_welcome_to_the_grid.js.page:182 743#, no-wrap 744msgid "" 745"\n" 746" // Create a second label\n" 747" this._labelTwo = new Gtk.Label ({\n" 748" label: \"The cake is a pie.\" });\n" 749"\n" 750" // Attach the image and labels to the grid\n" 751" this._grid.attach (this._image, 0, 0, 2, 1);\n" 752" this._grid.attach (this._label, 0, 1, 1, 1);\n" 753" this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 754msgstr "" 755"\n" 756" // Cria um segundo rótulo\n" 757" this._labelTwo = new Gtk.Label ({\n" 758" label: \"O bolo é uma torta.\" });\n" 759"\n" 760" // Anexa a imagem e rótulos à grade\n" 761" this._grid.attach (this._image, 0, 0, 2, 1);\n" 762" this._grid.attach (this._label, 0, 1, 1, 1);\n" 763" this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 764 765#. (itstool) path: section/p 766#: C/02_welcome_to_the_grid.js.page:193 767msgid "" 768"After we create the second Label, we attach it to the Grid to the right of " 769"the first Label. Remember, the first two numbers count columns and rows from " 770"left to right and top to bottom, starting with 0. So if the first Label is " 771"in column 0 and row 1, we can put the second in column 1 and row 1 to put it " 772"to the right of the first Label." 773msgstr "" 774"Após termos criado um segundo Label, nós o anexamos o segundo Label, o " 775"anexamos à Grid à direita do primeiro Label. Lembre-se, os primeiros dois " 776"números contam colunas e linhas da esquerda para a direita e de cima para " 777"baixo, começando com 0. Então, se o primeiro Label está na coluna 0 e linha " 778"1, nós podemos colocar o segundo na coluna 1 e linha 1 para colocá-lo à " 779"direita do primeiro Label." 780 781#. (itstool) path: section/p 782#: C/02_welcome_to_the_grid.js.page:194 783msgid "" 784"Note the number 2 in the attach statement for the Image. That's what does " 785"the trick here. That number is how many columns the Image spans, remember? " 786"So when we put it together, we get something like this:" 787msgstr "" 788"Note que o número 2 na declaração de anexação para a Image. É o que faz o " 789"truque aqui. Aquele número é quantas colunas uma Image se estende, lembra-" 790"se? Então, quando nós colocarmos isso junto, nós obteremos algo tipo isso:" 791 792#. (itstool) path: section/media 793#. This is a reference to an external file such as an image or video. When 794#. the file changes, the md5 hash will change to let you know you need to 795#. update your localized copy. The msgstr is not used at all. Set it to 796#. whatever you like once you have updated your copy of the file. 797#: C/02_welcome_to_the_grid.js.page:195 798msgctxt "_" 799msgid "" 800"external ref='media/02_jsgrid_04.png' md5='eeaead27cee2851877fc3cfe66177f07'" 801msgstr "" 802"external ref='media/02_jsgrid_04.png' md5='eeaead27cee2851877fc3cfe66177f07'" 803 804#. (itstool) path: section/p 805#: C/02_welcome_to_the_grid.js.page:197 806msgid "There are two things you should take note of, here." 807msgstr "Há duas coisas das quais você deveria tomar nota, aqui." 808 809#. (itstool) path: item/p 810#: C/02_welcome_to_the_grid.js.page:199 811msgid "" 812"Setting the Image to span two columns doesn't stretch the picture itself " 813"horizontally. Instead, it stretches the invisible box taken up by the Image " 814"widget to fill both columns, then places the Image in the center of that box." 815msgstr "" 816"A definição da Image para se estender a duas colunas não estica a imagem em " 817"si horizontalmente. Ao invés disso, ela estica a caixa invisível utilizadas " 818"pelo widget da Image para preencher ambas colunas e, então, colocar a imagem " 819"no centro daquela caixa." 820 821#. (itstool) path: item/p 822#: C/02_welcome_to_the_grid.js.page:200 823msgid "" 824"Even though we've set the Grid's row_spacing and the ApplicationWindow's " 825"border_width properties, we haven't yet set anything that puts a border in " 826"between the two Labels. They were separate earlier when the Image was in " 827"only one column, but now that it spans both GNOME doesn't see a reason to " 828"keep them apart." 829msgstr "" 830"Ainda que tenhamos definido as propriedades row_spacing da Grid e " 831"border_width da ApplicationWindow, nós ainda não definimos nada que coloque " 832"uma borda entre as duas Labels. Elas estavam separadas anteriormente, quando " 833"a Imagem estava apenas em uma coluna, mas agora que ela estende ambas, o " 834"GNOME não vê um motivo para mantê-los separados." 835 836#. (itstool) path: section/p 837#: C/02_welcome_to_the_grid.js.page:203 838msgid "" 839"There are at least three ways we can get around that last one. First, we can " 840"set a margin_left or margin_right on one of the Labels:" 841msgstr "" 842"Há pelo menos três formas de resolvermos o último. Primeiro, nós podemos " 843"definir um margin_left ou margin_right em um dos Labels:" 844 845#. (itstool) path: section/media 846#. This is a reference to an external file such as an image or video. When 847#. the file changes, the md5 hash will change to let you know you need to 848#. update your localized copy. The msgstr is not used at all. Set it to 849#. whatever you like once you have updated your copy of the file. 850#: C/02_welcome_to_the_grid.js.page:204 851msgctxt "_" 852msgid "" 853"external ref='media/02_jsgrid_05.png' md5='a3ad12f432d5977fc1f66302ad5b7498'" 854msgstr "" 855"external ref='media/02_jsgrid_05.png' md5='a3ad12f432d5977fc1f66302ad5b7498'" 856 857#. (itstool) path: section/p 858#: C/02_welcome_to_the_grid.js.page:206 859msgid "Second, we can set the Grid's column_homogeneous property to true." 860msgstr "" 861"Segundo, nós podemos definir a propriedade column_homogeneous da Grid para " 862"“true”." 863 864#. (itstool) path: section/code 865#: C/02_welcome_to_the_grid.js.page:207 866#, no-wrap 867msgid "" 868"\n" 869" // Create the Grid\n" 870" this._grid = new Gtk.Grid ({\n" 871" column_homogeneous: true,\n" 872" row_spacing: 20 });\n" 873msgstr "" 874"\n" 875" // Cria a Grid\n" 876" this._grid = new Gtk.Grid ({\n" 877" column_homogeneous: true,\n" 878" row_spacing: 20 });\n" 879 880#. (itstool) path: section/p 881#: C/02_welcome_to_the_grid.js.page:214 882msgid "That makes it look something like this:" 883msgstr "Isso faz com que ela se pareça com algo como isso:" 884 885#. (itstool) path: section/media 886#. This is a reference to an external file such as an image or video. When 887#. the file changes, the md5 hash will change to let you know you need to 888#. update your localized copy. The msgstr is not used at all. Set it to 889#. whatever you like once you have updated your copy of the file. 890#: C/02_welcome_to_the_grid.js.page:215 891msgctxt "_" 892msgid "" 893"external ref='media/02_jsgrid_06.png' md5='450e48dbf6b8f5ce1c208e4812e1714b'" 894msgstr "" 895"external ref='media/02_jsgrid_06.png' md5='450e48dbf6b8f5ce1c208e4812e1714b'" 896 897#. (itstool) path: section/p 898#: C/02_welcome_to_the_grid.js.page:217 899msgid "" 900"And third, we can set the Grid's column_spacing property, the same way we " 901"set its row_spacing." 902msgstr "" 903"E terceiro, nós podemos definir a propriedade column_spacing da Grid, da " 904"mesma forma que nós definimos sua row_spacing." 905 906#. (itstool) path: section/code 907#: C/02_welcome_to_the_grid.js.page:218 908#, no-wrap 909msgid "" 910"\n" 911" // Create the Grid\n" 912" this._grid = new Gtk.Grid ({\n" 913" column_spacing: 20,\n" 914" row_spacing: 20 });\n" 915msgstr "" 916"\n" 917" // Cria a Grid\n" 918" this._grid = new Gtk.Grid ({\n" 919" column_spacing: 20,\n" 920" row_spacing: 20 });\n" 921 922#. (itstool) path: section/p 923#: C/02_welcome_to_the_grid.js.page:224 924msgid "That makes it look like this:" 925msgstr "Isso faz com que ela se pareça com isso:" 926 927#. (itstool) path: section/media 928#. This is a reference to an external file such as an image or video. When 929#. the file changes, the md5 hash will change to let you know you need to 930#. update your localized copy. The msgstr is not used at all. Set it to 931#. whatever you like once you have updated your copy of the file. 932#: C/02_welcome_to_the_grid.js.page:225 933msgctxt "_" 934msgid "" 935"external ref='media/02_jsgrid_07.png' md5='0b304d70728903fbb2601d55bf00fdb9'" 936msgstr "" 937"external ref='media/02_jsgrid_07.png' md5='0b304d70728903fbb2601d55bf00fdb9'" 938 939#. (itstool) path: section/title 940#: C/02_welcome_to_the_grid.js.page:229 941msgid "Using stock images" 942msgstr "Usando imagens padrões" 943 944#. (itstool) path: section/p 945#: C/02_welcome_to_the_grid.js.page:231 946msgid "" 947"GNOME has a lot of stock images on hand already, that we can use if we don't " 948"feel like creating our own or if we want a universally-recognized icon. " 949"Here's how we create a stock image, compared to how we create a normal one:" 950msgstr "" 951"O GNOME já possui um monte de imagens padrões em mãos, que nós podemos usar " 952"se não quisermos criar nossa própria ou se nós quisermos um ícone " 953"reconhecido universalmente. Aqui está como nós criamos imagens padrões, " 954"comparado com como nós criamos um normal:" 955 956#. (itstool) path: section/code 957#: C/02_welcome_to_the_grid.js.page:232 958#, no-wrap 959msgid "" 960"\n" 961" // Create an image\n" 962" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 963"\n" 964" // Create a second image using a stock icon\n" 965" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 966msgstr "" 967"\n" 968" // Cria uma imagem\n" 969" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 970"\n" 971" // Cria uma segunda imagem usando o ícone padrão\n" 972" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 973 974#. (itstool) path: section/p 975#: C/02_welcome_to_the_grid.js.page:239 976msgid "" 977"After that, we attach it to the Grid to the left of the first Label. (We " 978"aren't using the second one for this example.)" 979msgstr "" 980"Após isso, nós anexamos-o à Grid à esquerda do primeiro Label. (Nós não " 981"vamos usar o segundo para este exemplo.)" 982 983#. (itstool) path: section/code 984#: C/02_welcome_to_the_grid.js.page:240 985#, no-wrap 986msgid "" 987"\n" 988" // Attach the images and label to the grid\n" 989" this._grid.attach (this._image, 0, 0, 2, 1);\n" 990" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 991" this._grid.attach (this._label, 1, 1, 1, 1);\n" 992msgstr "" 993"\n" 994" // Anexa as imagens e rótulos à grade\n" 995" this._grid.attach (this._image, 0, 0, 2, 1);\n" 996" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 997" this._grid.attach (this._label, 1, 1, 1, 1);\n" 998 999#. (itstool) path: section/p 1000#: C/02_welcome_to_the_grid.js.page:246 1001msgid "That gives us this, when we run it:" 1002msgstr "Isso nos dá isso, quando nós o executamos:" 1003 1004#. (itstool) path: section/media 1005#. This is a reference to an external file such as an image or video. When 1006#. the file changes, the md5 hash will change to let you know you need to 1007#. update your localized copy. The msgstr is not used at all. Set it to 1008#. whatever you like once you have updated your copy of the file. 1009#: C/02_welcome_to_the_grid.js.page:247 1010msgctxt "_" 1011msgid "" 1012"external ref='media/02_jsgrid_08.png' md5='78890beb47bd11360154b8ca4d50d1ff'" 1013msgstr "" 1014"external ref='media/02_jsgrid_08.png' md5='78890beb47bd11360154b8ca4d50d1ff'" 1015 1016#. (itstool) path: section/p 1017#: C/02_welcome_to_the_grid.js.page:249 1018msgid "" 1019"That's what the stock \"About\" icon looks like. You can see a list of all " 1020"the stock items starting with gtk-about in <link href=\"https://developer." 1021"gnome.org/gtk3/3.4/gtk3-Stock-Items.html#GTK-STOCK-ABOUT:CAPS\">GNOME's " 1022"developer documentation</link>. It was written for C programmers, but you " 1023"don't need to know C to use it; just look at the part in quotation marks, " 1024"like \"gtk-about\", and copy that part to use the icon next to it." 1025msgstr "" 1026"É assim que o ícone padrão “Sobre” se parece. Você pode ver uma lista de " 1027"todos os itens padrões começando com o gtk-about na <link href=\"https://" 1028"developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html#GTK-STOCK-ABOUT:CAPS" 1029"\">documentação de desenvolvimento do GNOME</link>. Foi escrita para " 1030"programadores de C, mas você não precisa saber C para usá-la; basta olha na " 1031"parte nos sinais de citação, como “gtk-about” e copiar aquela parte para " 1032"usar o ícone ao lado dele." 1033 1034#. (itstool) path: note/p 1035#: C/02_welcome_to_the_grid.js.page:250 1036msgid "" 1037"We put single quotes around 'gtk-about' here because, unlike text strings " 1038"that have double quotes around them, that part will never need to be " 1039"translated into another language. In fact, if it <em>were</em> translated " 1040"it'd break the icon, because its name is still \"gtk-about\" no matter which " 1041"language you speak." 1042msgstr "" 1043"Nós colocamos aspas simples em volta de 'gtk-about' aqui porque, ao " 1044"contrário de strings de texto que têm aspas duplas em volta, aquela parte " 1045"nunca precisará ser traduzida para outro idioma. Na verdade, se ela " 1046"<em>fosse</em> traduzida, ela quebraria o ícone porque seu nome ainda é “gtk-" 1047"about” independentemente do seu idioma." 1048 1049#. (itstool) path: section/title 1050#: C/02_welcome_to_the_grid.js.page:255 C/03_getting_the_signal.js.page:336 1051#: C/hellognome.js.page:191 1052msgid "What's next?" 1053msgstr "O que vem em seguida?" 1054 1055#. (itstool) path: section/p 1056#: C/02_welcome_to_the_grid.js.page:256 1057msgid "" 1058"Before we go on to the next tutorial, let's try something a little different:" 1059msgstr "" 1060"Antes de irmos para o próximo tutorial, vamos tentar algo um pouco diferente:" 1061 1062#. (itstool) path: section/code 1063#: C/02_welcome_to_the_grid.js.page:257 1064#, no-wrap 1065msgid "" 1066"\n" 1067" // Create a button\n" 1068" this._button = new Gtk.Button ({\n" 1069" label: \"Welcome to GNOME, too!\"});\n" 1070"\n" 1071" // Attach the images and button to the grid\n" 1072" this._grid.attach (this._image, 0, 0, 2, 1);\n" 1073" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 1074" this._grid.attach (this._button, 1, 1, 1, 1);\n" 1075msgstr "" 1076"\n" 1077" // Cria um botão\n" 1078" this._button = new Gtk.Button ({\n" 1079" label: \"Bem-vindo ao GNOME, também!\"});\n" 1080"\n" 1081" // Anexa as imagens e botão à grade\n" 1082" this._grid.attach (this._image, 0, 0, 2, 1);\n" 1083" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 1084" this._grid.attach (this._button, 1, 1, 1, 1);\n" 1085 1086#. (itstool) path: section/p 1087#: C/02_welcome_to_the_grid.js.page:268 1088msgid "" 1089"That's right, we turned the Label into a Button just by changing the name! " 1090"If you run the application and click on it, though, you'll find that it " 1091"doesn't do anything. How do we make our Button do something? That's what " 1092"we'll find out, in <link xref=\"03_getting_the_signal.js\">our next " 1093"tutorial</link>." 1094msgstr "" 1095"É isso mesmo, nós tornamos o Label em um Button apenas alterando o seu nome! " 1096"Se você executar o aplicativo e clicar nele, porém, você descobrirá que ele " 1097"faz nada. Como nós vamos fazer nosso Button fazer algo? É o que vamos " 1098"descobrir, em <link xref=\"03_getting_the_signal.js\">nosso próximo " 1099"tutorial</link>." 1100 1101#. (itstool) path: section/p 1102#: C/02_welcome_to_the_grid.js.page:269 1103msgid "" 1104"If you like, feel free to spend some time experimenting with Grids, Labels, " 1105"and Images, including stock images." 1106msgstr "" 1107"Se você quiser, sinta-se à vontade para gastar algum tempo experimentando " 1108"Grids, Labels e Images, incluindo imagens padrões." 1109 1110#. (itstool) path: note/p 1111#: C/02_welcome_to_the_grid.js.page:270 1112msgid "" 1113"One trick you can use to make more complex layouts is to nest Grids inside " 1114"of each other. This lets you group together related widgets, and rearrange " 1115"them easily. Take a look at the <link xref=\"radiobutton.js\">RadioButton</" 1116"link> code sample if you'd like to see how this is done." 1117msgstr "" 1118"Um truque que você pode usar para fazer layouts mais complexos é aninhar " 1119"Grids dentro de Grids. Isso permite que você agrupe widgets relacionados e " 1120"rearranje-os facilmente. Dê uma olhada na amostra de código do <link xref=" 1121"\"radiobutton.js\">RadioButton</link>, se você quiser ver como ele é feito." 1122 1123#. (itstool) path: section/title 1124#: C/02_welcome_to_the_grid.js.page:274 C/checkbutton.js.page:130 1125#: C/comboboxtext.js.page:171 C/combobox.js.page:228 C/hellognome.js.page:198 1126#: C/messagedialog.js.page:184 C/radiobutton.js.page:269 C/scale.js.page:203 1127#: C/spinbutton.js.page:194 C/statusbar.js.page:216 C/switch.js.page:259 1128#: C/textview.js.page:243 C/togglebutton.js.page:148 1129#: C/treeview_simple_liststore.js.page:267 1130msgid "Complete code sample" 1131msgstr "Amostra de código completo" 1132 1133#. (itstool) path: section/code 1134#: C/02_welcome_to_the_grid.js.page:275 1135#, no-wrap 1136msgid "" 1137"#!/usr/bin/gjs\n" 1138"\n" 1139"imports.gi.versions.Gtk = '3.0';\n" 1140"const Gtk = imports.gi.Gtk;\n" 1141"\n" 1142"class WelcomeToTheGrid {\n" 1143"\n" 1144" // Create the application itself\n" 1145" constructor() {\n" 1146" this.application = new Gtk.Application();\n" 1147"\n" 1148" // Connect 'activate' and 'startup' signals to the callback functions\n" 1149" this.application.connect('activate', this._onActivate.bind(this));\n" 1150" this.application.connect('startup', this._onStartup.bind(this));\n" 1151" }\n" 1152"\n" 1153" // Callback function for 'activate' signal presents windows when active\n" 1154" _onActivate() {\n" 1155" this._window.present();\n" 1156" }\n" 1157"\n" 1158" // Callback function for 'startup' signal builds the UI\n" 1159" _onStartup() {\n" 1160" this._buildUI ();\n" 1161" }\n" 1162"\n" 1163" // Build the application's UI\n" 1164" _buildUI() {\n" 1165"\n" 1166" // Create the application window\n" 1167" this._window = new Gtk.ApplicationWindow({\n" 1168" application: this.application,\n" 1169" window_position: Gtk.WindowPosition.CENTER,\n" 1170" border_width: 10,\n" 1171" title: \"Welcome to the Grid\"});\n" 1172"\n" 1173" // Create the Grid\n" 1174" this._grid = new Gtk.Grid ({\n" 1175" // column_homogeneous: true,\n" 1176" // column_spacing: 20,\n" 1177" row_spacing: 20 });\n" 1178"\n" 1179" // Create an image\n" 1180" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 1181"\n" 1182" // Create a second image using a stock icon\n" 1183" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 1184"\n" 1185" // Create a label\n" 1186" this._label = new Gtk.Label ({\n" 1187" label: \"Welcome to GNOME, too!\",\n" 1188" /* margin_top: 20 */ });\n" 1189"\n" 1190" /* Create a second label\n" 1191" this._labelTwo = new Gtk.Label ({\n" 1192" label: \"The cake is a pie.\" }); */\n" 1193"\n" 1194" /* Create a button\n" 1195" this._button = new Gtk.Button ({\n" 1196" label: \"Welcome to GNOME, too!\"}); */\n" 1197"\n" 1198" // Attach the images and button to the grid\n" 1199" this._grid.attach (this._image, 0, 0, 2, 1);\n" 1200" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 1201" this._grid.attach (this._label, 1, 1, 1, 1);\n" 1202"\n" 1203" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 1204" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 1205"\n" 1206" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 1207"\n" 1208" // Add the grid to the window\n" 1209" this._window.add (this._grid);\n" 1210"\n" 1211" // Show the window and all child widgets\n" 1212" this._window.show_all();\n" 1213" }\n" 1214"\n" 1215"};\n" 1216"\n" 1217"// Run the application\n" 1218"let app = new WelcomeToTheGrid ();\n" 1219"app.application.run (ARGV);\n" 1220msgstr "" 1221"#!/usr/bin/gjs\n" 1222"\n" 1223"imports.gi.versions.Gtk = '3.0';\n" 1224"const Gtk = imports.gi.Gtk;\n" 1225"\n" 1226"class WelcomeToTheGrid {\n" 1227"\n" 1228" // Cria o aplicativo em si\n" 1229" constructor() {\n" 1230" this.application = new Gtk.Application();\n" 1231"\n" 1232" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 1233" this.application.connect('activate', this._onActivate.bind(this));\n" 1234" this.application.connect('startup', this._onStartup.bind(this));\n" 1235" }\n" 1236"\n" 1237" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 1238" _onActivate() {\n" 1239" this._window.present();\n" 1240" }\n" 1241"\n" 1242" // Função de chamada para o sinal 'startup' constrói a interface de usuário\n" 1243" _onStartup() {\n" 1244" this._buildUI ();\n" 1245" }\n" 1246"\n" 1247" // Constrói a interface de usuário do aplicativo\n" 1248" _buildUI() {\n" 1249"\n" 1250" // Cria a janela do aplicativo\n" 1251" this._window = new Gtk.ApplicationWindow({\n" 1252" application: this.application,\n" 1253" window_position: Gtk.WindowPosition.CENTER,\n" 1254" border_width: 10,\n" 1255" title: \"Bem-vindo à Grid\"});\n" 1256"\n" 1257" // Cria a Grid\n" 1258" this._grid = new Gtk.Grid ({\n" 1259" // column_homogeneous: true,\n" 1260" // column_spacing: 20,\n" 1261" row_spacing: 20 });\n" 1262"\n" 1263" // Cria uma imagem\n" 1264" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 1265"\n" 1266" // Cria uma segunda imagem usando um ícone padrão\n" 1267" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 1268"\n" 1269" // Cria um rótulo\n" 1270" this._label = new Gtk.Label ({\n" 1271" label: \"Welcome to GNOME, too!\",\n" 1272" /* margin_top: 20 */ });\n" 1273"\n" 1274" /* Cria um segundo rótulo\n" 1275" this._labelTwo = new Gtk.Label ({\n" 1276" label: \"The cake is a pie.\" }); */\n" 1277"\n" 1278" /* Cria um botão\n" 1279" this._button = new Gtk.Button ({\n" 1280" label: \"Welcome to GNOME, too!\"}); */\n" 1281"\n" 1282" // Anexa as imagens e botão à grade\n" 1283" this._grid.attach (this._image, 0, 0, 2, 1);\n" 1284" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 1285" this._grid.attach (this._label, 1, 1, 1, 1);\n" 1286"\n" 1287" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 1288" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 1289"\n" 1290" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 1291"\n" 1292" // Adiciona a grade à janela\n" 1293" this._window.add (this._grid);\n" 1294"\n" 1295" // Mostra a janela e todos os widgets filhos\n" 1296" this._window.show_all();\n" 1297" }\n" 1298"\n" 1299"};\n" 1300"\n" 1301"// Executa o aplicativo\n" 1302"let app = new WelcomeToTheGrid ();\n" 1303"app.application.run (ARGV);\n" 1304 1305#. (itstool) path: info/desc 1306#: C/03_getting_the_signal.js.page:21 1307msgid "Create Buttons and other widgets that do things when you click on them." 1308msgstr "Crie Buttons e outros widgets que fazem coisas quando clicados." 1309 1310#. (itstool) path: page/title 1311#: C/03_getting_the_signal.js.page:24 1312msgid "3. Getting the Signal" 1313msgstr "3. Obtendo o Signal" 1314 1315#. (itstool) path: synopsis/p 1316#: C/03_getting_the_signal.js.page:26 1317msgid "" 1318"In the last tutorial, we learned how to create widgets like Labels, Images, " 1319"and Buttons. Here, we'll learn how to make Buttons and other input widgets " 1320"actually do things, by writing functions which handle the signals they send " 1321"when they are clicked on or interacted with." 1322msgstr "" 1323"No último tutorial, nós aprendemos como criar widgets tipo Labels (rótulos), " 1324"Images (imagens) e Buttons (botões). Aqui, nós vamos aprender como fazer " 1325"para Buttons e outros widgets de entrada realmente fazer as coisas, " 1326"escrevendo funções que lidam com os sinais que elas enviam quando elas são " 1327"clicadas ou recebem interação." 1328 1329#. (itstool) path: section/title 1330#: C/03_getting_the_signal.js.page:32 1331msgid "A basic application" 1332msgstr "Um aplicativo básico" 1333 1334#. (itstool) path: section/p 1335#: C/03_getting_the_signal.js.page:33 1336msgid "" 1337"In GNOME, widgets that you can interact with, like Buttons and Switches, " 1338"send out signals when they are clicked on or activated. A Button, for " 1339"instance, sends out the \"clicked\" signal when somebody clicks on it. When " 1340"this happens, GNOME looks for the part in your code that says what to do." 1341msgstr "" 1342"No GNOME, widgets com os quais você pode interagir, como Buttons e Switches, " 1343"enviam sinais quando são clicados ou ativados. Um Button, por exemplo, envia " 1344"o sinal de “clicado” quando alguém clica nele. Quando isto acontece, o GNOME " 1345"procura a parte do código que diz o que deve ser feito." 1346 1347#. (itstool) path: section/p 1348#: C/03_getting_the_signal.js.page:34 1349msgid "" 1350"How do we write that code? By connecting that Button's \"clicked\" signal to " 1351"a callback function, which is a function you write just to handle that " 1352"signal. So whenever it gives off that signal, the function connected to that " 1353"signal is run." 1354msgstr "" 1355"Como nós vamos escrever esse código? Conectando aquele sinal de “clicado” do " 1356"Button a uma função de chamada, que é uma função que você escreve apenas " 1357"para lidar com esse sinal. Então, quando você aplica aquele sinal, a função " 1358"conectada a ele será executada." 1359 1360#. (itstool) path: section/p 1361#: C/03_getting_the_signal.js.page:35 1362msgid "Here is an extremely basic example:" 1363msgstr "Aqui está um exemplo extremamente básico:" 1364 1365#. (itstool) path: section/media 1366#. This is a reference to an external file such as an image or video. When 1367#. the file changes, the md5 hash will change to let you know you need to 1368#. update your localized copy. The msgstr is not used at all. Set it to 1369#. whatever you like once you have updated your copy of the file. 1370#: C/03_getting_the_signal.js.page:37 C/03_getting_the_signal.js.page:349 1371msgctxt "_" 1372msgid "" 1373"external ref='media/03_jssignal_01.png' " 1374"md5='8d6ecab185f4af4534cc255d62b58b8e'" 1375msgstr "" 1376"external ref='media/03_jssignal_01.png' " 1377"md5='8d6ecab185f4af4534cc255d62b58b8e'" 1378 1379#. (itstool) path: section/p 1380#: C/03_getting_the_signal.js.page:39 1381msgid "" 1382"This ApplicationWindow has a Button and a Label inside it, arranged in a " 1383"Grid. Whenever the Button is clicked, a variable that holds the number of " 1384"cookies is increased by 1, and the Label that shows how many cookies there " 1385"are is updated." 1386msgstr "" 1387"Esse ApplicationWindow possui um Button e um Label, organizados em uma Grid. " 1388"Quando o Button é clicado, uma variável que mantém o número de cookies é " 1389"incrementada em 1 e o Label que mostra quantos cookies existem será " 1390"atualizado." 1391 1392#. (itstool) path: note/p 1393#: C/03_getting_the_signal.js.page:40 1394msgid "" 1395"The cookies in this example are not the same as the cookies that you get " 1396"from websites, which store your login information and may keep track of " 1397"which sites you've visited. They're just imaginary treats. You may bake some " 1398"real ones if you like." 1399msgstr "" 1400"Os cookies neste exemplo não são os mesmos que aqueles que você obtém de " 1401"sites, que armazenam a informação da sua sessão e podem manter rastro de " 1402"quais sites você visitou. Eles são apenas biscoitos imaginários. Você pode " 1403"preparar alguns de verdade, se quiser." 1404 1405#. (itstool) path: section/p 1406#: C/03_getting_the_signal.js.page:41 1407msgid "" 1408"Here is the basic, boilerplate code that goes at the start of the " 1409"application, before we start creating the window and widgets. Besides the " 1410"application having a unique name, the biggest change from the usual " 1411"boilerplate is that we create a global variable right near the beginning, to " 1412"hold the number of cookies." 1413msgstr "" 1414"Aqui está o código básico, padrão que vai na inicialização do aplicativo, " 1415"antes de começar a criação da janela e widgets. Além do aplicativo ter um " 1416"nome único, a maior alteração em relação ao padrão é que nós criamos uma " 1417"variável global bem perto do começo, para manter o número de cookies." 1418 1419#. (itstool) path: section/code 1420#: C/03_getting_the_signal.js.page:42 1421#, no-wrap 1422msgid "" 1423"\n" 1424"#!/usr/bin/gjs\n" 1425"\n" 1426"imports.gi.versions.Gtk = '3.0';\n" 1427"const Gtk = imports.gi.Gtk;\n" 1428"\n" 1429"// We start out with 0 cookies\n" 1430"var cookies = 0;\n" 1431"\n" 1432"class GettingTheSignal {\n" 1433" // Create the application itself\n" 1434" constructor() {\n" 1435" this.application = new Gtk.Application();\n" 1436"\n" 1437" // Connect 'activate' and 'startup' signals to the callback functions\n" 1438" this.application.connect('activate', this._onActivate.bind(this));\n" 1439" this.application.connect('startup', this._onStartup.bind(this));\n" 1440" }\n" 1441"\n" 1442" // Callback function for 'activate' signal presents window when active\n" 1443" _onActivate() {\n" 1444" this._window.present();\n" 1445" }\n" 1446"\n" 1447" // Callback function for 'startup' signal builds the UI\n" 1448" _onStartup() {\n" 1449" this._buildUI ();\n" 1450" }\n" 1451msgstr "" 1452"\n" 1453"#!/usr/bin/gjs\n" 1454"\n" 1455"imports.gi.versions.Gtk = '3.0';\n" 1456"const Gtk = imports.gi.Gtk;\n" 1457"\n" 1458"// Nós começamos com 0 cookies\n" 1459"var cookies = 0;\n" 1460"\n" 1461"class GettingTheSignal {\n" 1462" // Cria o aplicativo em si\n" 1463" constructor() {\n" 1464" this.application = new Gtk.Application();\n" 1465"\n" 1466" // Conecta os sinais \"activate\" e \"startup\" às funções de chamada\n" 1467" this.application.connect('activate', this._onActivate.bind(this));\n" 1468" this.application.connect('startup', this._onStartup.bind(this));\n" 1469" }\n" 1470"\n" 1471" // Função de chamada para o sinal \"activate\" apresenta uma janela quando ativa\n" 1472" _onActivate() {\n" 1473" this._window.present();\n" 1474" }\n" 1475"\n" 1476" // Função de chamada para o sinal \"startup\" constrói a UI\n" 1477" _onStartup() {\n" 1478" this._buildUI ();\n" 1479" }\n" 1480 1481#. (itstool) path: section/p 1482#: C/03_getting_the_signal.js.page:71 1483msgid "" 1484"Take a look at the part that uses our application's connect method and bind, " 1485"to connect its activate and startup signals to the functions that present " 1486"the window and build the UI. We're going to do the same thing with our " 1487"Button when we get to it, except that we're going to connect its \"clicked\" " 1488"signal instead." 1489msgstr "" 1490"Dê uma olhada na parte que usa o método de conexão do nosso aplicativo e " 1491"bind, para conectar seus sinais de ativação e inicialização à função que " 1492"apresenta a janela e constrói a interface gráfica. Nós vamos fazer a mesma " 1493"coisa com o nosso Button quando nós chegarmos nele, porém nós vamos conectar " 1494"o seu sinal de “clicado”." 1495 1496#. (itstool) path: section/title 1497#: C/03_getting_the_signal.js.page:75 1498msgid "Click the button" 1499msgstr "Clicando no botão" 1500 1501#. (itstool) path: section/p 1502#: C/03_getting_the_signal.js.page:77 1503msgid "" 1504"As usual, we'll put all the code to create our Button and other widgets " 1505"inside the _buildUI function, which is called when the application starts up." 1506msgstr "" 1507"Como de costume, não colocamos todo o código para criar um Button e outros " 1508"widgets dentro da função _buildUI, a qual é chamada quando o aplicativo é " 1509"iniciado." 1510 1511#. (itstool) path: section/code 1512#: C/03_getting_the_signal.js.page:78 1513#, no-wrap 1514msgid "" 1515"\n" 1516" // Build the application's UI\n" 1517" _buildUI() {\n" 1518msgstr "" 1519"\n" 1520" // Compila a interface de usuário do aplicativo\n" 1521" _buildUI() {\n" 1522 1523#. (itstool) path: section/p 1524#: C/03_getting_the_signal.js.page:83 1525msgid "First, we create the window itself:" 1526msgstr "Primeiro, nós criamos a janela em si:" 1527 1528#. (itstool) path: section/code 1529#: C/03_getting_the_signal.js.page:84 1530#, no-wrap 1531msgid "" 1532"\n" 1533" // Create the application window\n" 1534" this._window = new Gtk.ApplicationWindow({\n" 1535" application: this.application,\n" 1536" window_position: Gtk.WindowPosition.CENTER,\n" 1537" default_height: 200,\n" 1538" default_width: 400,\n" 1539" title: \"Click the button to get a cookie!\"});\n" 1540msgstr "" 1541"\n" 1542" // Cria a janela do aplicativo\n" 1543" this._window = new Gtk.ApplicationWindow({\n" 1544" application: this.application,\n" 1545" window_position: Gtk.WindowPosition.CENTER,\n" 1546" default_height: 200,\n" 1547" default_width: 400,\n" 1548" title: \"Clique no botão para obter um cookie!\"});\n" 1549 1550#. (itstool) path: section/p 1551#: C/03_getting_the_signal.js.page:93 1552msgid "" 1553"Note that we've set its default_height and default_width properties. These " 1554"let us control how tall and wide the ApplicationWindow will be, in pixels." 1555msgstr "" 1556"Note que nós definimos as propriedades de seus default_height e " 1557"default_width. Estes permite que nós controlemos o quão alto e largo o " 1558"ApplicationWindow será, em pixels." 1559 1560#. (itstool) path: section/p 1561#: C/03_getting_the_signal.js.page:94 1562msgid "" 1563"Next, we'll create the Label that shows us the number of cookies. We can use " 1564"the cookies variable as part of the Label's label property." 1565msgstr "" 1566"A seguir, nós vamos criar o Label que nos mostra o número de cookies. Nós " 1567"podemos usar as variáveis de cookies como parte da propriedade do rótulo do " 1568"Label." 1569 1570#. (itstool) path: section/code 1571#: C/03_getting_the_signal.js.page:95 1572#, no-wrap 1573msgid "" 1574"\n" 1575" // Create the label\n" 1576" this._cookieLabel = new Gtk.Label ({\n" 1577" label: \"Number of cookies: \" + cookies });\n" 1578msgstr "" 1579"\n" 1580" // Cria o rótulo\n" 1581" this._cookieLabel = new Gtk.Label ({\n" 1582" label: \"Número de cookies: \" + cookies });\n" 1583 1584#. (itstool) path: section/p 1585#: C/03_getting_the_signal.js.page:101 1586msgid "" 1587"Now we'll create the Button. We set its label property to show the text that " 1588"we want on the Button, and we connect its \"clicked\" signal to a function " 1589"called _getACookie, which we'll write after we're done building our " 1590"application's UI." 1591msgstr "" 1592"Agora nós vamos criar o Button. Nós defimos a propriedade do rótulo para " 1593"mostrar o texto que nós queremos no Button e nós conectamos seu sinal de " 1594"“clicado” a uma função chamada _getACookie, a qual nós vamos escrever após " 1595"nós terminarmos a construção da interface gráfica do nosso aplicativo." 1596 1597#. (itstool) path: section/code 1598#: C/03_getting_the_signal.js.page:102 1599#, no-wrap 1600msgid "" 1601"\n" 1602" // Create the cookie button\n" 1603" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n" 1604"\n" 1605" // Connect the cookie button to the function that handles clicking it\n" 1606" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 1607msgstr "" 1608"\n" 1609" // Cria o botão do cookie\n" 1610" this._cookieButton = new Gtk.Button ({ label: \"Obter um cookie\" });\n" 1611"\n" 1612" // Conecta o botão do cookie à função que lida o clique nele\n" 1613" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 1614 1615#. (itstool) path: section/p 1616#: C/03_getting_the_signal.js.page:109 1617msgid "" 1618"Finally, we create a Grid, attach the Label and Button to it, add it to the " 1619"window and tell the window to show itself and its contents. That's all we " 1620"need inside the _buildUI function, so we close it with a bracket, as well as " 1621"a comma that tells GNOME to go on to the next function. Note that even " 1622"though we wrote the code for the Label first, we can still attach it to the " 1623"Grid in a way that will put it on the bottom." 1624msgstr "" 1625"Finalmente, nós criamos uma Grid, anexamos os Label e Button a ela e " 1626"adicionamos-na à janela e informamos à janela para mostrar a si e a seu " 1627"conteúdo. Isso é tudo que nós precisamos dentro da função _buildUI, de forma " 1628"que nós fechamos-a com chaves, assim como uma vírgula que informa ao GNOME " 1629"para continuar para a próxima função. Note que ainda que nós tenhamos " 1630"escrito o código para o primeiro Label, nós ainda podemos anexá-lo à Grid de " 1631"uma forma que vai colocá-lo na parte inferior." 1632 1633#. (itstool) path: section/code 1634#: C/03_getting_the_signal.js.page:110 1635#, no-wrap 1636msgid "" 1637"\n" 1638" // Create a grid to arrange everything inside\n" 1639" this._grid = new Gtk.Grid ({\n" 1640" halign: Gtk.Align.CENTER,\n" 1641" valign: Gtk.Align.CENTER,\n" 1642" row_spacing: 20 });\n" 1643"\n" 1644" // Put everything inside the grid\n" 1645" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 1646" this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n" 1647"\n" 1648" // Add the grid to the window\n" 1649" this._window.add (this._grid);\n" 1650"\n" 1651" // Show the window and all child widgets\n" 1652" this._window.show_all();\n" 1653"\n" 1654" }\n" 1655msgstr "" 1656"\n" 1657" // Cria uma grade para organizar tudo dentro\n" 1658" this._grid = new Gtk.Grid ({\n" 1659" halign: Gtk.Align.CENTER,\n" 1660" valign: Gtk.Align.CENTER,\n" 1661" row_spacing: 20 });\n" 1662"\n" 1663" // Coloca tudo dentro da grade\n" 1664" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 1665" this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n" 1666"\n" 1667" // Adiciona a grade à janela\n" 1668" this._window.add (this._grid);\n" 1669"\n" 1670" // Mostra a janela e todos os widgets filhos\n" 1671" this._window.show_all();\n" 1672"\n" 1673" }\n" 1674 1675#. (itstool) path: section/p 1676#: C/03_getting_the_signal.js.page:129 1677msgid "" 1678"Now, we write the _getACookie function. Whenever our Button sends out its " 1679"\"clicked\" signal, the code in this function will run. In this case, all it " 1680"does is increase the number of cookies by 1, and update the Label to show " 1681"the new number of cookies. We do this using the Label's set_label method." 1682msgstr "" 1683"Agora, nós escrevemos a função _getACookie. Quando nosso Button envia seu " 1684"sinal de “clicado”, o código nesta função vai ser executado. Neste caso, " 1685"tudo que isso faz é aumentar o número de cookies em 1 e atualizar o Label " 1686"para mostrar o novo número de cookies. Nós fazemos isso usando o método " 1687"set_label do Label." 1688 1689#. (itstool) path: note/p 1690#: C/03_getting_the_signal.js.page:130 1691msgid "" 1692"Many widgets have the same properties and methods. Both Labels and Buttons, " 1693"for instance, have a label property that says what text is inside them, and " 1694"get_label and set_label methods that let you check what that text is and " 1695"change it, respectively. So if you learn how one widget works, you'll also " 1696"know how others like it work." 1697msgstr "" 1698"Muitos widgets têm as mesmas propriedades e métodos. Ambos Labels e Buttons, " 1699"por exemplo, tem uma propriedade de rótulo que informa que texto está dentro " 1700"dele e métodos get_label e set_label que permitem a você verificar o que " 1701"este texto é e alterá-lo, respectivamente. Então, se você aprende como um " 1702"widget funciona, você também vai saber como outros como ele funcionam." 1703 1704#. (itstool) path: section/code 1705#: C/03_getting_the_signal.js.page:131 1706#, no-wrap 1707msgid "" 1708"\n" 1709" _getACookie: function() {\n" 1710"\n" 1711" // Increase the number of cookies by 1 and update the label\n" 1712" cookies++;\n" 1713" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 1714"\n" 1715" }\n" 1716"\n" 1717"};\n" 1718msgstr "" 1719"\n" 1720" _getACookie: function() {\n" 1721"\n" 1722" // Aumenta o número de cookies em 1 e atualiza o rótulo\n" 1723" cookies++;\n" 1724" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 1725"\n" 1726" }\n" 1727"\n" 1728"};\n" 1729 1730#. (itstool) path: section/p 1731#: C/03_getting_the_signal.js.page:143 1732msgid "" 1733"Finally, we run the application, using the same kind of code as in our last " 1734"tutorial." 1735msgstr "" 1736"Finalmente, nós executamos o aplicativo, usando o mesmo tipo de código de " 1737"nosso último tutorial." 1738 1739#. (itstool) path: section/code 1740#: C/03_getting_the_signal.js.page:144 1741#, no-wrap 1742msgid "" 1743"\n" 1744"// Run the application\n" 1745"let app = new GettingTheSignal ();\n" 1746"app.application.run (ARGV);\n" 1747msgstr "" 1748"\n" 1749"// Executa o aplicativo\n" 1750"let app = new GettingTheSignal ();\n" 1751"app.application.run (ARGV);\n" 1752 1753#. (itstool) path: section/title 1754#: C/03_getting_the_signal.js.page:152 1755msgid "Flip the switch" 1756msgstr "Ligando o switch" 1757 1758#. (itstool) path: section/p 1759#: C/03_getting_the_signal.js.page:153 1760msgid "" 1761"Buttons aren't the only input widgets in our GTK+ toolbox. We can also use " 1762"switches, like the one in this example. Switches don't have a label " 1763"property, so we have to create a separate Label that says what it does to go " 1764"next to it." 1765msgstr "" 1766"Os botões não são os únicos widgets de entrada na nossa caixa de ferramentas " 1767"do GTK+. Também podemos usar <em>switches</em> (interruptores), como o deste " 1768"exemplo. Os switches não têm uma propriedade de rótulo, por isso, temos que " 1769"criar um rótulo separado que diga o que fazer para ir ao lado dele." 1770 1771#. (itstool) path: section/media 1772#. This is a reference to an external file such as an image or video. When 1773#. the file changes, the md5 hash will change to let you know you need to 1774#. update your localized copy. The msgstr is not used at all. Set it to 1775#. whatever you like once you have updated your copy of the file. 1776#: C/03_getting_the_signal.js.page:155 C/03_getting_the_signal.js.page:355 1777msgctxt "_" 1778msgid "" 1779"external ref='media/03_jssignal_02.png' " 1780"md5='ba941390fbafc4a0f653c8f70bca92c0'" 1781msgstr "" 1782"external ref='media/03_jssignal_02.png' " 1783"md5='ba941390fbafc4a0f653c8f70bca92c0'" 1784 1785#. (itstool) path: section/p 1786#: C/03_getting_the_signal.js.page:157 1787msgid "" 1788"A Switch has two positions, Off and On. When a Switch is turned on, its text " 1789"and background color change, so you can tell which position it's in." 1790msgstr "" 1791"Um Switch tem duas posições, desligado <em>(Off)</em> e ligado <em>(On)</" 1792"em>. Quando um Switch está ativado, o texto e a cor do plano de fundo mudam, " 1793"para que você possa identificar em que posição está." 1794 1795#. (itstool) path: section/p 1796#: C/03_getting_the_signal.js.page:159 1797msgid "" 1798"You may have seen Switches like these in GNOME's accessibility menu, which " 1799"let you turn features like large text and the on-screen keyboard on and off. " 1800"In this case, the Switch controls our imaginary cookie dispenser. If the " 1801"Switch is turned on, you can get cookies by clicking the \"Get a cookie\" " 1802"Button. If it's turned off, clicking the Button won't do anything." 1803msgstr "" 1804"Você pode ter visto Switches como esses no menu de acessibilidade do GNOME, " 1805"que permite ativar e desativar recursos como texto grande e o teclado na " 1806"tela. Neste caso, o Switch controla nosso dispensador de cookie imaginário. " 1807"Se o Comutador estiver ativado, você poderá obter cookies clicando no botão " 1808"“Obter um cookie”. Se estiver desligado, clicar no botão não fará nada." 1809 1810#. (itstool) path: note/p 1811#: C/03_getting_the_signal.js.page:160 1812msgid "" 1813"You can get to the accessibility menu by clicking on the outline of a human, " 1814"near your name in the upper-right corner of the screen." 1815msgstr "" 1816"Você pode acessar o menu de acessibilidade clicando no contorno de um ser " 1817"humano, próximo ao seu nome no canto superior direito da tela." 1818 1819#. (itstool) path: section/p 1820#: C/03_getting_the_signal.js.page:161 1821msgid "Here's how we create the Switch:" 1822msgstr "Veja como nós criamos o Switch:" 1823 1824#. (itstool) path: section/code 1825#: C/03_getting_the_signal.js.page:162 1826#, no-wrap 1827msgid "" 1828"\n" 1829" // Create the switch that controls whether or not you can win\n" 1830" this._cookieSwitch = new Gtk.Switch ();\n" 1831msgstr "" 1832"\n" 1833" // Cria um switch que controla se você pode ou não ganhar\n" 1834" this._cookieSwitch = new Gtk.Switch ();\n" 1835 1836#. (itstool) path: section/p 1837#: C/03_getting_the_signal.js.page:167 1838msgid "" 1839"We don't actually need to connect the Switch to anything. All we need to do " 1840"is write an if statement in our _getACookie function, to check to see if the " 1841"Switch is turned on. If we wanted to make something happen as soon as you " 1842"flip the Switch, though, we would connect its notify::active signal, like so:" 1843msgstr "" 1844"Na verdade, não precisamos conectar o Switch a nada. Tudo o que precisamos " 1845"fazer é escrever uma declaração if em nossa função _getACookie, para " 1846"verificar se o Switch está ativado. Se quiséssemos fazer algo acontecer " 1847"assim que você ligasse o Switch, nós conectaríamos o sinal notify::active, " 1848"assim:" 1849 1850#. (itstool) path: section/code 1851#: C/03_getting_the_signal.js.page:168 1852#, no-wrap 1853msgid "" 1854"\n" 1855" // Connect the switch to the function that handles it\n" 1856" this._cookieSwitch.connect ('notify::active', this._cookieDispenser.bind(this));\n" 1857msgstr "" 1858"\n" 1859" // Conecta o switch à função que lida com ele\n" 1860" this._cookieSwitch.connect ('notify::active', this._cookieDispenser.bind(this));\n" 1861 1862#. (itstool) path: section/p 1863#: C/03_getting_the_signal.js.page:173 1864msgid "" 1865"A Switch is set to the off position by default. If we wanted the Switch to " 1866"start out turned on, we would set the value of its active property to true " 1867"when we create it." 1868msgstr "" 1869"Um Switch está definido para a posição desligada por padrão. Se quiséssemos " 1870"que o Switch inciasse ligado, definiríamos o valor de sua propriedade ativa " 1871"como “true” quando o criamos." 1872 1873#. (itstool) path: section/code 1874#: C/03_getting_the_signal.js.page:174 1875#, no-wrap 1876msgid "" 1877"\n" 1878" this._cookieSwitch = new Gtk.Switch ({ active: true });\n" 1879msgstr "" 1880"\n" 1881" this._cookieSwitch = new Gtk.Switch ({ active: true });\n" 1882 1883#. (itstool) path: section/p 1884#: C/03_getting_the_signal.js.page:178 1885msgid "" 1886"Let's just create it normally, though, and then create the Label that goes " 1887"with it. We want the Switch and the Label to be kept right next to each " 1888"other, so we'll create a Grid just for them, then put that Grid in our " 1889"larger Grid that holds all the widgets inside it. Here's what the code looks " 1890"like to create all that:" 1891msgstr "" 1892"Vamos apenas criá-lo normalmente, e então criar o Label que o acompanha. " 1893"Queremos que o Switch e o Label sejam mantidos próximos uns dos outros, " 1894"então criaremos um Grid apenas para eles, e então colocaremos esse Grid em " 1895"nosso Grid maior que contém todos os widgets dentro dele. Veja como é o " 1896"código para criar tudo isso:" 1897 1898#. (itstool) path: section/code 1899#: C/03_getting_the_signal.js.page:179 1900#, no-wrap 1901msgid "" 1902"\n" 1903" // Create the switch that controls whether or not you can win\n" 1904" this._cookieSwitch = new Gtk.Switch ();\n" 1905"\n" 1906" // Create the label to go with the switch\n" 1907" this._switchLabel = new Gtk.Label ({\n" 1908" label: \"Cookie dispenser\" });\n" 1909"\n" 1910" // Create a grid for the switch and its label\n" 1911" this._switchGrid = new Gtk.Grid ({\n" 1912" halign: Gtk.Align.CENTER,\n" 1913" valign: Gtk.Align.CENTER });\n" 1914"\n" 1915" // Put the switch and its label inside that grid\n" 1916" this._switchGrid.attach (this._switchLabel, 0, 0, 1, 1);\n" 1917" this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n" 1918msgstr "" 1919"\n" 1920" // Cria o switch que controla se você pode ou não ganhar\n" 1921" this._cookieSwitch = new Gtk.Switch ();\n" 1922"\n" 1923" // Cria o rótulo para ir com o switch\n" 1924" this._switchLabel = new Gtk.Label ({\n" 1925" label: \"Cookie dispenser\" });\n" 1926"\n" 1927" // Cria uma grade para o switch e seu rótulo\n" 1928" this._switchGrid = new Gtk.Grid ({\n" 1929" halign: Gtk.Align.CENTER,\n" 1930" valign: Gtk.Align.CENTER });\n" 1931"\n" 1932" // Coloca seu switch e seu rótulo dentro daquela grade\n" 1933" this._switchGrid.attach (this._switchLabel, 0, 0, 1, 1);\n" 1934" this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n" 1935 1936#. (itstool) path: section/p 1937#: C/03_getting_the_signal.js.page:197 1938msgid "And now we arrange everything in the larger Grid like so." 1939msgstr "E agora nós organizamos tudo na Grad maior assim." 1940 1941#. (itstool) path: section/code 1942#: C/03_getting_the_signal.js.page:198 1943#, no-wrap 1944msgid "" 1945"\n" 1946" // Put everything inside the grid\n" 1947" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 1948" this._grid.attach (this._switchGrid, 0, 1, 1, 1);\n" 1949" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 1950msgstr "" 1951"\n" 1952" // Coloca tudo dentro da grade\n" 1953" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 1954" this._grid.attach (this._switchGrid, 0, 1, 1, 1);\n" 1955" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 1956 1957#. (itstool) path: section/p 1958#: C/03_getting_the_signal.js.page:205 1959msgid "" 1960"Now we change the _getACookie function so that it checks to see if the " 1961"cookie dispenser is turned on. We do that by using the Switch's get_active " 1962"method. It returns true if the Switch is turned on, and false if the Switch " 1963"is turned off." 1964msgstr "" 1965"Agora, alteramos a função _getACookie para verificar se o fornecedor de " 1966"cookie está ativado. Fazemos isso usando o método get_active do Switch. " 1967"Retorna “true” se o Switch estiver ligado e “false” se o Switch estiver " 1968"desligado." 1969 1970#. (itstool) path: note/p 1971#: C/03_getting_the_signal.js.page:206 1972msgid "" 1973"When a method is used in an if statement like this, the code inside the if " 1974"statement is executed if the method returns true." 1975msgstr "" 1976"Quando um método é usado em uma instrução if como essa, o código dentro da " 1977"instrução if é executado se o método retornar “true”." 1978 1979#. (itstool) path: section/code 1980#: C/03_getting_the_signal.js.page:207 1981#, no-wrap 1982msgid "" 1983"\n" 1984" _getACookie() {\n" 1985"\n" 1986" // Is the cookie dispenser turned on?\n" 1987" if (this._cookieSwitch.get_active()) {\n" 1988"\n" 1989" // Increase the number of cookies by 1 and update the label\n" 1990" cookies++;\n" 1991" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 1992"\n" 1993" }\n" 1994"\n" 1995" }\n" 1996msgstr "" 1997"\n" 1998" _getACookie() {\n" 1999"\n" 2000" // O fornecedor de cookie está ligado?\n" 2001" if (this._cookieSwitch.get_active()) {\n" 2002"\n" 2003" // Aumenta o número de cookies em 1 e atualiza o rótulo\n" 2004" cookies++;\n" 2005" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 2006"\n" 2007" }\n" 2008"\n" 2009" }\n" 2010 2011#. (itstool) path: section/title 2012#: C/03_getting_the_signal.js.page:225 2013msgid "Tuning the radio" 2014msgstr "Sintonizando o rádio" 2015 2016#. (itstool) path: section/p 2017#: C/03_getting_the_signal.js.page:227 2018msgid "" 2019"Another type of input widget we can use is called the RadioButton. You " 2020"create them in groups, and then only one RadioButton in a group can be " 2021"selected at a time. They're called RadioButtons because they work like the " 2022"channel preset button in old-style car radios. The radio could only be tuned " 2023"to one station at a time, so whenever you pressed one button in, another " 2024"would pop back out." 2025msgstr "" 2026"Outro tipo de widget de entrada que podemos usar é chamado de RadioButton, " 2027"normalmente conhecido em português como “botão de opção”. Você os cria em " 2028"grupos e, em seguida, apenas um RadioButton em um grupo pode ser selecionado " 2029"por vez. Eles são chamados de RadioButtons porque funcionam como o botão de " 2030"pré-seleção de canais em rádios de carros antigos. O rádio só podia ser " 2031"sintonizado em uma estação de cada vez, então, sempre que você pressionasse " 2032"um botão, outro retornaria para o estado de não pressionado." 2033 2034#. (itstool) path: section/media 2035#. This is a reference to an external file such as an image or video. When 2036#. the file changes, the md5 hash will change to let you know you need to 2037#. update your localized copy. The msgstr is not used at all. Set it to 2038#. whatever you like once you have updated your copy of the file. 2039#: C/03_getting_the_signal.js.page:229 C/03_getting_the_signal.js.page:361 2040msgctxt "_" 2041msgid "" 2042"external ref='media/03_jssignal_03.png' " 2043"md5='49ecf251b0bf57543c8d79a77b6f306d'" 2044msgstr "" 2045"external ref='media/03_jssignal_03.png' " 2046"md5='49ecf251b0bf57543c8d79a77b6f306d'" 2047 2048#. (itstool) path: section/p 2049#: C/03_getting_the_signal.js.page:231 2050msgid "" 2051"First off, let's change our ApplicationWindow's name and increase its " 2052"border_width property, so that our widgets aren't packed in too tightly. The " 2053"border_width is the number of pixels between any widget and the edge of the " 2054"window." 2055msgstr "" 2056"Primeiramente, vamos alterar o nome do nosso ApplicationWindow e aumentar " 2057"sua propriedade border_width, para que nossos widgets não sejam muito " 2058"compactados. A border_width é o número de pixels entre qualquer widget e a " 2059"borda da janela." 2060 2061#. (itstool) path: section/code 2062#: C/03_getting_the_signal.js.page:232 2063#, no-wrap 2064msgid "" 2065"\n" 2066" // Create the application window\n" 2067" this._window = new Gtk.ApplicationWindow({\n" 2068" application: this.application,\n" 2069" window_position: Gtk.WindowPosition.CENTER,\n" 2070" default_height: 200,\n" 2071" default_width: 400,\n" 2072" border_width: 20,\n" 2073" title: \"Choose the one that says 'cookie'!\"});\n" 2074msgstr "" 2075"\n" 2076" // Cria a janela do aplicativo\n" 2077" this._window = new Gtk.ApplicationWindow({\n" 2078" application: this.application,\n" 2079" window_position: Gtk.WindowPosition.CENTER,\n" 2080" default_height: 200,\n" 2081" default_width: 400,\n" 2082" border_width: 20,\n" 2083" title: \"Escolha o com nome 'cookie'!\"});\n" 2084 2085#. (itstool) path: section/p 2086#: C/03_getting_the_signal.js.page:243 2087msgid "" 2088"After that, we create the RadioButtons. Remember how they're created in " 2089"groups? The way we do that, is we set each new RadioButton's group property " 2090"to the name of another RadioButton." 2091msgstr "" 2092"Depois disso, criamos os RadioButtons. Lembre-se de como eles são criados em " 2093"grupos? A maneira como fazemos isso, é definir cada nova propriedade de " 2094"grupo RadioButton para o nome de outro RadioButton." 2095 2096#. (itstool) path: section/code 2097#: C/03_getting_the_signal.js.page:244 2098#, no-wrap 2099msgid "" 2100"\n" 2101" // Create the radio buttons\n" 2102" this._cookieRadio = new Gtk.RadioButton ({ label: \"Cookie\" });\n" 2103" this._notCookieOne = new Gtk.RadioButton ({ label: \"Not cookie\",\n" 2104" group: this._cookieRadio });\n" 2105" this._notCookieTwo = new Gtk.RadioButton ({ label: \"Not cookie\",\n" 2106" group: this._cookieRadio });\n" 2107msgstr "" 2108"\n" 2109" // Cria os botões de opção\n" 2110" this._cookieRadio = new Gtk.RadioButton ({ label: \"Cookie\" });\n" 2111" this._notCookieOne = new Gtk.RadioButton ({ label: \"Não um cookie\",\n" 2112" group: this._cookieRadio });\n" 2113" this._notCookieTwo = new Gtk.RadioButton ({ label: \"Não um cookie\",\n" 2114" group: this._cookieRadio });\n" 2115 2116#. (itstool) path: section/p 2117#: C/03_getting_the_signal.js.page:253 2118msgid "" 2119"Next, we create a Grid for the RadioButtons. Remember, we don't have to " 2120"arrange things in Grids in the same order that we create them in." 2121msgstr "" 2122"Em seguida, criamos uma grade para os RadioButtons. Lembre-se, não " 2123"precisamos organizar as coisas em Grids na mesma ordem em que as criamos." 2124 2125#. (itstool) path: section/code 2126#: C/03_getting_the_signal.js.page:254 2127#, no-wrap 2128msgid "" 2129"\n" 2130" // Arrange the radio buttons in their own grid\n" 2131" this._radioGrid = new Gtk.Grid ();\n" 2132" this._radioGrid.attach (this._notCookieOne, 0, 0, 1, 1);\n" 2133" this._radioGrid.attach (this._cookieRadio, 0, 1, 1, 1);\n" 2134" this._radioGrid.attach (this._notCookieTwo, 0, 2, 1, 1);\n" 2135msgstr "" 2136"\n" 2137" // Ordenamos os botões de opção na sua própria grade\n" 2138" this._radioGrid = new Gtk.Grid ();\n" 2139" this._radioGrid.attach (this._notCookieOne, 0, 0, 1, 1);\n" 2140" this._radioGrid.attach (this._cookieRadio, 0, 1, 1, 1);\n" 2141" this._radioGrid.attach (this._notCookieTwo, 0, 2, 1, 1);\n" 2142 2143#. (itstool) path: section/p 2144#: C/03_getting_the_signal.js.page:262 2145msgid "" 2146"Normally, the RadioButton that's selected by default is the one that's the " 2147"name of the group. We want the first \"Not cookie\" button to be selected by " 2148"default, though, so we use its set_active method." 2149msgstr "" 2150"Normalmente, o RadioButton selecionado por padrão é aquele que é o nome do " 2151"grupo. Queremos que o primeiro botão “Não um cookie” esteja selecionado por " 2152"padrão, motivo pelo qual usamos o método set_active." 2153 2154#. (itstool) path: note/p 2155#: C/03_getting_the_signal.js.page:263 2156msgid "We could also set its active property to true when we create it." 2157msgstr "" 2158"Poderíamos também definir sua propriedade ativa como “true” quando a criamos." 2159 2160#. (itstool) path: section/code 2161#: C/03_getting_the_signal.js.page:264 2162#, no-wrap 2163msgid "" 2164"\n" 2165" // Set the button that will be at the top to be active by default\n" 2166" this._notCookieOne.set_active (true);\n" 2167msgstr "" 2168"\n" 2169" // Define o botão que estará no topo como estando ativo por padrão\n" 2170" this._notCookieOne.set_active (true);\n" 2171 2172#. (itstool) path: section/p 2173#: C/03_getting_the_signal.js.page:269 2174msgid "Now we arrange everything in our main Grid like usual ..." 2175msgstr "Agora nós organizamos tudo em nossa Grid principal como de costume …" 2176 2177#. (itstool) path: section/code 2178#: C/03_getting_the_signal.js.page:270 2179#, no-wrap 2180msgid "" 2181"\n" 2182" // Put everything inside the grid\n" 2183" this._grid.attach (this._radioGrid, 0, 0, 1, 1);\n" 2184" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 2185" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2186msgstr "" 2187"\n" 2188" // Coloca tudo dentro da grade\n" 2189" this._grid.attach (this._radioGrid, 0, 0, 1, 1);\n" 2190" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 2191" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2192 2193#. (itstool) path: section/p 2194#: C/03_getting_the_signal.js.page:277 2195msgid "" 2196"And then we change our _getACookie function to test to see if the cookie " 2197"button is the one that's selected." 2198msgstr "" 2199"Em seguida, alteramos nossa função _getACookie para testar se o botão do " 2200"cookie é o selecionado." 2201 2202#. (itstool) path: section/code 2203#: C/03_getting_the_signal.js.page:278 2204#, no-wrap 2205msgid "" 2206"\n" 2207" _getACookie() {\n" 2208"\n" 2209" // Did you select \"cookie\" instead of \"not cookie\"?\n" 2210" if (this._cookieRadio.get_active()) {\n" 2211"\n" 2212" // Increase the number of cookies by 1 and update the label\n" 2213" cookies++;\n" 2214" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 2215"\n" 2216" }\n" 2217"\n" 2218" }\n" 2219msgstr "" 2220"\n" 2221" _getACookie() {\n" 2222"\n" 2223" // Você selecionou \"cookie\" em vez de \"não um cookie\"?\n" 2224" if (this._cookieRadio.get_active()) {\n" 2225"\n" 2226" // Aumenta o número de cookies em 1 e atualiza o rótulo\n" 2227" cookies++;\n" 2228" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 2229"\n" 2230" }\n" 2231"\n" 2232" }\n" 2233 2234#. (itstool) path: section/title 2235#: C/03_getting_the_signal.js.page:296 2236msgid "Can you spell \"cookie\"?" 2237msgstr "Você consegue escrever “cookie”?" 2238 2239#. (itstool) path: section/p 2240#: C/03_getting_the_signal.js.page:298 2241msgid "" 2242"The last input widget we're going to cover is the Entry widget, which is " 2243"used for single-line text entry." 2244msgstr "" 2245"O último widget de entrada que vamos cobrir é o widget Entry, que é usado " 2246"para entrada de texto de linha única." 2247 2248#. (itstool) path: note/p 2249#: C/03_getting_the_signal.js.page:299 2250msgid "" 2251"If you need to be able to enter in a whole paragraph or more, like if you " 2252"are building a text editor, you'll want to look at the much more " 2253"customizable <link xref=\"textview.js\">TextView</link> widget." 2254msgstr "" 2255"Se você precisar inserir um parágrafo inteiro ou mais, como se estivesse " 2256"construindo um editor de texto, você vai querer dar uma olhada no widget " 2257"muito mais personalizável <link xref=\"textview.js\">TextView</link>." 2258 2259#. (itstool) path: section/media 2260#. This is a reference to an external file such as an image or video. When 2261#. the file changes, the md5 hash will change to let you know you need to 2262#. update your localized copy. The msgstr is not used at all. Set it to 2263#. whatever you like once you have updated your copy of the file. 2264#: C/03_getting_the_signal.js.page:300 C/03_getting_the_signal.js.page:367 2265msgctxt "_" 2266msgid "" 2267"external ref='media/03_jssignal_04.png' " 2268"md5='dfc5221ca15ca9fba7d3c76a73804e2d'" 2269msgstr "" 2270"external ref='media/03_jssignal_04.png' " 2271"md5='dfc5221ca15ca9fba7d3c76a73804e2d'" 2272 2273#. (itstool) path: section/p 2274#: C/03_getting_the_signal.js.page:302 2275msgid "After we change the window's name, we create the Entry widget." 2276msgstr "Depois de alterar o nome da janela, criamos o widget Entry." 2277 2278#. (itstool) path: section/code 2279#: C/03_getting_the_signal.js.page:303 2280#, no-wrap 2281msgid "" 2282"\n" 2283" // Create the text entry field\n" 2284" this._spellCookie = new Gtk.Entry ();\n" 2285msgstr "" 2286"\n" 2287" // Cria um novo campo de entrada de texto\n" 2288" this._spellCookie = new Gtk.Entry ();\n" 2289 2290#. (itstool) path: section/p 2291#: C/03_getting_the_signal.js.page:308 2292msgid "Next, we arrange everything in the Grid ..." 2293msgstr "Em seguida, organizamos tudo na Grid …" 2294 2295#. (itstool) path: section/code 2296#: C/03_getting_the_signal.js.page:309 2297#, no-wrap 2298msgid "" 2299"\n" 2300" // Put everything inside the grid\n" 2301" this._grid.attach (this._spellCookie, 0, 0, 1, 1);\n" 2302" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 2303" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2304msgstr "" 2305"\n" 2306" // Coloca tudo dentro da grade\n" 2307" this._grid.attach (this._spellCookie, 0, 0, 1, 1);\n" 2308" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 2309" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2310 2311#. (itstool) path: section/p 2312#: C/03_getting_the_signal.js.page:316 2313msgid "" 2314"And now we modify _getACookie's if statement again, using the Entry's " 2315"get_text method to retrieve the text that you entered into it and see if you " 2316"spelled \"cookie\" right. We don't care whether you capitalize \"cookie\" or " 2317"not, so we use JavaScript's built-in toLowerCase method to change the " 2318"Entry's text to all lower case inside the if statement." 2319msgstr "" 2320"E agora nós modificamos a instrução if do _getACookie novamente, usando o " 2321"método get_text do Entry para recuperar o texto que você inseriu nele e ver " 2322"se você digitou “cookie” corretamente. Não nos importamos se você capitaliza " 2323"“cookie” ou não, então usamos o método embutido toLowerCase do JavaScript " 2324"para alterar o todo texto do Entry para minúsculo dentro da instrução if." 2325 2326#. (itstool) path: note/p 2327#: C/03_getting_the_signal.js.page:317 2328msgid "" 2329"An Entry widget doesn't have a label property, which is a set text string " 2330"that the user can't change. (You can't normally change the label on a " 2331"Button, for instance.) Instead, it has a text property, which changes to " 2332"match what the user types in." 2333msgstr "" 2334"Um widget de Entry não possui uma propriedade de rótulo, que é uma string " 2335"definida que o usuário não pode alterar. (Você não pode normalmente alterar " 2336"o rótulo em um Button, por exemplo). Em vez disso, ele tem uma propriedade " 2337"de texto, que muda para corresponder ao que o usuário digita." 2338 2339#. (itstool) path: section/code 2340#: C/03_getting_the_signal.js.page:318 2341#, no-wrap 2342msgid "" 2343"\n" 2344" _getACookie() {\n" 2345"\n" 2346" // Did you spell \"cookie\" correctly?\n" 2347" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n" 2348"\n" 2349" // Increase the number of cookies by 1 and update the label\n" 2350" cookies++;\n" 2351" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 2352"\n" 2353" }\n" 2354"\n" 2355" }\n" 2356msgstr "" 2357"\n" 2358" _getACookie() {\n" 2359"\n" 2360" // Você escreveu \"cookie\" corretamente?\n" 2361" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n" 2362"\n" 2363" // Aumenta o número de cookies em 1 e atualiza o rótulo\n" 2364" cookies++;\n" 2365" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 2366"\n" 2367" }\n" 2368"\n" 2369" }\n" 2370 2371#. (itstool) path: section/p 2372#: C/03_getting_the_signal.js.page:337 2373msgid "" 2374"Keep reading, if you'd like to see the complete code for each version of our " 2375"cookie maker application." 2376msgstr "" 2377"Continue lendo, se você quiser ver o código completo para cada versão do " 2378"nosso aplicativo de criador de cookies." 2379 2380#. (itstool) path: note/p 2381#: C/03_getting_the_signal.js.page:338 2382msgid "" 2383"The main JavaScript tutorials page has <link xref=\"beginner.js#buttons" 2384"\">more detailed code samples</link> for each input widget, including " 2385"several not covered here." 2386msgstr "" 2387"A página principal de tutoriais em JavaScript possui <link xref=\"beginner." 2388"js#buttons\">amostras de código mais detalhadas</link> para cada widget de " 2389"entrada, incluindo vários não abordados aqui." 2390 2391#. (itstool) path: section/title 2392#: C/03_getting_the_signal.js.page:343 2393msgid "Complete code samples" 2394msgstr "Amostra de código completo" 2395 2396#. (itstool) path: section/title 2397#: C/03_getting_the_signal.js.page:348 2398msgid "Code sample with Button" 2399msgstr "Amostra de código com Button" 2400 2401#. (itstool) path: section/code 2402#: C/03_getting_the_signal.js.page:350 2403#, no-wrap 2404msgid "" 2405"#!/usr/bin/gjs\n" 2406"\n" 2407"imports.gi.versions.Gtk = '3.0';\n" 2408"const Gtk = imports.gi.Gtk;\n" 2409"\n" 2410"// We start out with 0 cookies\n" 2411"var cookies = 0;\n" 2412"\n" 2413"class GettingTheSignal {\n" 2414"\n" 2415" // Create the application itself\n" 2416" constructor() {\n" 2417" this.application = new Gtk.Application();\n" 2418"\n" 2419" // Connect 'activate' and 'startup' signals to the callback functions\n" 2420" this.application.connect('activate', this._onActivate.bind(this));\n" 2421" this.application.connect('startup', this._onStartup.bind(this));\n" 2422" }\n" 2423"\n" 2424" // Callback function for 'activate' signal presents window when active\n" 2425" _onActivate() {\n" 2426" this._window.present();\n" 2427" }\n" 2428"\n" 2429" // Callback function for 'startup' signal builds the UI\n" 2430" _onStartup() {\n" 2431" this._buildUI();\n" 2432" }\n" 2433"\n" 2434" // Build the application's UI\n" 2435" _buildUI() {\n" 2436"\n" 2437" // Create the application window\n" 2438" this._window = new Gtk.ApplicationWindow({\n" 2439" application: this.application,\n" 2440" window_position: Gtk.WindowPosition.CENTER,\n" 2441" default_height: 200,\n" 2442" default_width: 400,\n" 2443" title: \"Click the button to get a cookie!\"});\n" 2444"\n" 2445" // Create the label\n" 2446" this._cookieLabel = new Gtk.Label ({\n" 2447" label: \"Number of cookies: \" + cookies });\n" 2448"\n" 2449" // Create the cookie button\n" 2450" this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n" 2451"\n" 2452" // Connect the cookie button to the function that handles clicking it\n" 2453" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 2454"\n" 2455" // Create a grid to arrange everything inside\n" 2456" this._grid = new Gtk.Grid ({\n" 2457" halign: Gtk.Align.CENTER,\n" 2458" valign: Gtk.Align.CENTER,\n" 2459" row_spacing: 20 });\n" 2460"\n" 2461" // Put everything inside the grid\n" 2462" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 2463" this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n" 2464"\n" 2465" // Add the grid to the window\n" 2466" this._window.add (this._grid);\n" 2467"\n" 2468" // Show the window and all child widgets\n" 2469" this._window.show_all();\n" 2470"\n" 2471" }\n" 2472"\n" 2473" _getACookie() {\n" 2474"\n" 2475" // Increase the number of cookies by 1 and update the label\n" 2476" cookies++;\n" 2477" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 2478"\n" 2479" }\n" 2480"\n" 2481"};\n" 2482"\n" 2483"// Run the application\n" 2484"let app = new GettingTheSignal ();\n" 2485"app.application.run (ARGV);\n" 2486msgstr "" 2487"#!/usr/bin/gjs\n" 2488"\n" 2489"imports.gi.versions.Gtk = '3.0';\n" 2490"const Gtk = imports.gi.Gtk;\n" 2491"\n" 2492"// Começamos com 0 cookies\n" 2493"var cookies = 0;\n" 2494"\n" 2495"class GettingTheSignal {\n" 2496"\n" 2497" // Cria o aplicativo em si\n" 2498" constructor() {\n" 2499" this.application = new Gtk.Application();\n" 2500"\n" 2501" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 2502" this.application.connect('activate', this._onActivate.bind(this));\n" 2503" this.application.connect('startup', this._onStartup.bind(this));\n" 2504" }\n" 2505"\n" 2506" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 2507" _onActivate() {\n" 2508" this._window.present();\n" 2509" }\n" 2510"\n" 2511" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 2512" _onStartup() {\n" 2513" this._buildUI();\n" 2514" }\n" 2515"\n" 2516" // Constrói a interface gráfica do aplicativo\n" 2517" _buildUI() {\n" 2518"\n" 2519" // Cria a janela do aplicativo\n" 2520" this._window = new Gtk.ApplicationWindow({\n" 2521" application: this.application,\n" 2522" window_position: Gtk.WindowPosition.CENTER,\n" 2523" default_height: 200,\n" 2524" default_width: 400,\n" 2525" title: \"Clique no botão para obter um cookie!\"});\n" 2526"\n" 2527" // Cria o rótulo\n" 2528" this._cookieLabel = new Gtk.Label ({\n" 2529" label: \"Número de cookies: \" + cookies });\n" 2530"\n" 2531" // Cria o botão de cookie\n" 2532" this._cookieButton = new Gtk.Button ({ label: \"Obtenha um cookie\" });\n" 2533"\n" 2534" // Conecta o botão de cookie à função que lida com clicar nele\n" 2535" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 2536"\n" 2537" // Cria uma grade que organiza tudo dentro\n" 2538" this._grid = new Gtk.Grid ({\n" 2539" halign: Gtk.Align.CENTER,\n" 2540" valign: Gtk.Align.CENTER,\n" 2541" row_spacing: 20 });\n" 2542"\n" 2543" // Coloca tudo dentro da grade\n" 2544" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 2545" this._grid.attach (this._cookieLabel, 0, 1, 1, 1);\n" 2546"\n" 2547" // Adiciona a grade à janela\n" 2548" this._window.add (this._grid);\n" 2549"\n" 2550" // Mostra a janela e todos os widgets filhos\n" 2551" this._window.show_all();\n" 2552"\n" 2553" }\n" 2554"\n" 2555" _getACookie() {\n" 2556"\n" 2557" // Aumenta o número de cookies por 1 e atualiza o rótulo\n" 2558" cookies++;\n" 2559" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 2560"\n" 2561" }\n" 2562"\n" 2563"};\n" 2564"\n" 2565"// Executa o aplicativo\n" 2566"let app = new GettingTheSignal ();\n" 2567"app.application.run (ARGV);\n" 2568 2569#. (itstool) path: section/title 2570#: C/03_getting_the_signal.js.page:354 2571msgid "Code sample with Switch" 2572msgstr "Amostra de código com Switch" 2573 2574#. (itstool) path: section/code 2575#: C/03_getting_the_signal.js.page:356 2576#, no-wrap 2577msgid "" 2578"#!/usr/bin/gjs\n" 2579"\n" 2580"imports.gi.versions.Gtk = '3.0';\n" 2581"const Gtk = imports.gi.Gtk;\n" 2582"\n" 2583"// We start out with 0 cookies\n" 2584"var cookies = 0;\n" 2585"\n" 2586"class GettingTheSignal {\n" 2587"\n" 2588" // Create the application itself\n" 2589" constructor() {\n" 2590" this.application = new Gtk.Application();\n" 2591"\n" 2592" // Connect 'activate' and 'startup' signals to the callback functions\n" 2593" this.application.connect('activate', this._onActivate.bind(this));\n" 2594" this.application.connect('startup', this._onStartup.bind(this));\n" 2595" }\n" 2596"\n" 2597" // Callback function for 'activate' signal presents window when active\n" 2598" _onActivate() {\n" 2599" this._window.present();\n" 2600" }\n" 2601"\n" 2602" // Callback function for 'startup' signal builds the UI\n" 2603" _onStartup() {\n" 2604" this._buildUI();\n" 2605" }\n" 2606"\n" 2607" // Build the application's UI\n" 2608" _buildUI() {\n" 2609"\n" 2610" // Create the application window\n" 2611" this._window = new Gtk.ApplicationWindow({\n" 2612" application: this.application,\n" 2613" window_position: Gtk.WindowPosition.CENTER,\n" 2614" default_height: 200,\n" 2615" default_width: 400,\n" 2616" title: \"Click the button to get a cookie!\"});\n" 2617"\n" 2618" // Create the label\n" 2619" this._cookieLabel = new Gtk.Label ({\n" 2620" label: \"Number of cookies: \" + cookies });\n" 2621"\n" 2622" // Create the cookie button\n" 2623" this._cookieButton = new Gtk.Button ({\n" 2624" label: \"Get a cookie\" });\n" 2625"\n" 2626" // Connect the cookie button to the function that handles clicking it\n" 2627" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 2628"\n" 2629" // Create the switch that controls whether or not you can win\n" 2630" this._cookieSwitch = new Gtk.Switch ();\n" 2631"\n" 2632" // Create the label to go with the switch\n" 2633" this._switchLabel = new Gtk.Label ({\n" 2634" label: \"Cookie dispenser\" });\n" 2635"\n" 2636" // Create a grid for the switch and its label\n" 2637" this._switchGrid = new Gtk.Grid ({\n" 2638" halign: Gtk.Align.CENTER,\n" 2639" valign: Gtk.Align.CENTER });\n" 2640"\n" 2641" // Put the switch and its label inside that grid\n" 2642" this._switchGrid.attach (this._switchLabel, 0, 0, 1, 1);\n" 2643" this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n" 2644"\n" 2645" // Create a grid to arrange everything else inside\n" 2646" this._grid = new Gtk.Grid ({\n" 2647" halign: Gtk.Align.CENTER,\n" 2648" valign: Gtk.Align.CENTER,\n" 2649" row_spacing: 20 });\n" 2650"\n" 2651" // Put everything inside the grid\n" 2652" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 2653" this._grid.attach (this._switchGrid, 0, 1, 1, 1);\n" 2654" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2655"\n" 2656" // Add the grid to the window\n" 2657" this._window.add (this._grid);\n" 2658"\n" 2659" // Show the window and all child widgets\n" 2660" this._window.show_all();\n" 2661"\n" 2662" }\n" 2663"\n" 2664" _getACookie() {\n" 2665"\n" 2666" // Is the cookie dispenser turned on?\n" 2667" if (this._cookieSwitch.get_active()) {\n" 2668"\n" 2669" // Increase the number of cookies by 1 and update the label\n" 2670" cookies++;\n" 2671" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 2672"\n" 2673" }\n" 2674"\n" 2675" }\n" 2676"\n" 2677"};\n" 2678"\n" 2679"// Run the application\n" 2680"let app = new GettingTheSignal ();\n" 2681"app.application.run (ARGV);\n" 2682msgstr "" 2683"#!/usr/bin/gjs\n" 2684"\n" 2685"imports.gi.versions.Gtk = '3.0';\n" 2686"const Gtk = imports.gi.Gtk;\n" 2687"\n" 2688"// Nós começamos com 0 cookies\n" 2689"var cookies = 0;\n" 2690"\n" 2691"class GettingTheSignal {\n" 2692"\n" 2693" // Cria o aplicativo em si\n" 2694" constructor() {\n" 2695" this.application = new Gtk.Application();\n" 2696"\n" 2697" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 2698" this.application.connect('activate', this._onActivate.bind(this));\n" 2699" this.application.connect('startup', this._onStartup.bind(this));\n" 2700" }\n" 2701"\n" 2702" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 2703" _onActivate() {\n" 2704" this._window.present();\n" 2705" }\n" 2706"\n" 2707" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 2708" _onStartup() {\n" 2709" this._buildUI();\n" 2710" }\n" 2711"\n" 2712" // Constrói a interface gráfica do aplicativo\n" 2713" _buildUI() {\n" 2714"\n" 2715" // Cria a janela do aplicativo\n" 2716" this._window = new Gtk.ApplicationWindow({\n" 2717" application: this.application,\n" 2718" window_position: Gtk.WindowPosition.CENTER,\n" 2719" default_height: 200,\n" 2720" default_width: 400,\n" 2721" title: \"Clique no botão para obter um cookie!\"});\n" 2722"\n" 2723" // Cria o rótulo\n" 2724" this._cookieLabel = new Gtk.Label ({\n" 2725" label: \"Número de cookies: \" + cookies });\n" 2726"\n" 2727" // Cria o botão de cookie\n" 2728" this._cookieButton = new Gtk.Button ({\n" 2729" label: \"Obter um cookie\" });\n" 2730"\n" 2731" // Conecta o botão do cookie à função que lida o clique nele\n" 2732" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 2733"\n" 2734" // Cria um switch que controla se você pode ou não ganhar\n" 2735" this._cookieSwitch = new Gtk.Switch ();\n" 2736"\n" 2737" // Cria o rótulo para ir com o switch\n" 2738" this._switchLabel = new Gtk.Label ({\n" 2739" label: \"Cookie dispenser\" });\n" 2740"\n" 2741" // Cria uma grade para o switch e seu rótulo\n" 2742" this._switchGrid = new Gtk.Grid ({\n" 2743" halign: Gtk.Align.CENTER,\n" 2744" valign: Gtk.Align.CENTER });\n" 2745"\n" 2746" // Coloca seu switch e seu rótulo dentro daquela grade\n" 2747" this._switchGrid.attach (this._switchLabel, 0, 0, 1, 1);\n" 2748" this._switchGrid.attach (this._cookieSwitch, 1, 0, 1, 1);\n" 2749"\n" 2750" // Cria uma grade para organizar todo resto dentro\n" 2751" this._grid = new Gtk.Grid ({\n" 2752" halign: Gtk.Align.CENTER,\n" 2753" valign: Gtk.Align.CENTER,\n" 2754" row_spacing: 20 });\n" 2755"\n" 2756" // Coloca tudo dentro da grade\n" 2757" this._grid.attach (this._cookieButton, 0, 0, 1, 1);\n" 2758" this._grid.attach (this._switchGrid, 0, 1, 1, 1);\n" 2759" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2760"\n" 2761" // Adiciona a grade à janela\n" 2762" this._window.add (this._grid);\n" 2763"\n" 2764" // Mostra a janela e todos os widgets filhos\n" 2765" this._window.show_all();\n" 2766"\n" 2767" }\n" 2768"\n" 2769" _getACookie() {\n" 2770"\n" 2771" // O fornecedor de cookie está ligado?\n" 2772" if (this._cookieSwitch.get_active()) {\n" 2773"\n" 2774" // Aumenta o número de cookies em 1 e atualiza o rótulo\n" 2775" cookies++;\n" 2776" this._cookieLabel.set_label (\"Número de cookies: \" + cookies);\n" 2777"\n" 2778" }\n" 2779"\n" 2780" }\n" 2781"\n" 2782"};\n" 2783"\n" 2784"// Executa o aplicativo\n" 2785"let app = new GettingTheSignal ();\n" 2786"app.application.run (ARGV);\n" 2787 2788#. (itstool) path: section/title 2789#: C/03_getting_the_signal.js.page:360 2790msgid "Code sample with RadioButton" 2791msgstr "Amostra de código com RadioButton" 2792 2793#. (itstool) path: section/code 2794#: C/03_getting_the_signal.js.page:362 2795#, fuzzy, no-wrap 2796#| msgid "" 2797#| "#!/usr/bin/gjs\n" 2798#| "\n" 2799#| "const Gtk = imports.gi.Gtk;\n" 2800#| "const Lang = imports.lang;\n" 2801#| "\n" 2802#| "const WelcomeToTheGrid = new Lang.Class({\n" 2803#| " Name: 'Welcome to the Grid',\n" 2804#| "\n" 2805#| " // Create the application itself\n" 2806#| " _init: function() {\n" 2807#| " this.application = new Gtk.Application();\n" 2808#| "\n" 2809#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 2810#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 2811#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 2812#| " },\n" 2813#| "\n" 2814#| " // Callback function for 'activate' signal presents windows when active\n" 2815#| " _onActivate: function() {\n" 2816#| " this._window.present();\n" 2817#| " },\n" 2818#| "\n" 2819#| " // Callback function for 'startup' signal builds the UI\n" 2820#| " _onStartup: function() {\n" 2821#| " this._buildUI ();\n" 2822#| " },\n" 2823#| "\n" 2824#| "\n" 2825#| "\n" 2826#| " // Build the application's UI\n" 2827#| " _buildUI: function() {\n" 2828#| "\n" 2829#| " // Create the application window\n" 2830#| " this._window = new Gtk.ApplicationWindow({\n" 2831#| " application: this.application,\n" 2832#| " window_position: Gtk.WindowPosition.CENTER,\n" 2833#| " border_width: 10,\n" 2834#| " title: \"Welcome to the Grid\"});\n" 2835#| "\n" 2836#| " // Create the Grid\n" 2837#| " this._grid = new Gtk.Grid ({\n" 2838#| " // column_homogeneous: true,\n" 2839#| " // column_spacing: 20,\n" 2840#| " row_spacing: 20 });\n" 2841#| "\n" 2842#| " // Create an image\n" 2843#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 2844#| "\n" 2845#| " // Create a second image using a stock icon\n" 2846#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 2847#| "\n" 2848#| " // Create a label\n" 2849#| " this._label = new Gtk.Label ({\n" 2850#| " label: \"Welcome to GNOME, too!\",\n" 2851#| " /* margin_top: 20 */ });\n" 2852#| "\n" 2853#| " /* Create a second label\n" 2854#| " this._labelTwo = new Gtk.Label ({\n" 2855#| " label: \"The cake is a pie.\" }); */\n" 2856#| "\n" 2857#| " /* Create a button\n" 2858#| " this._button = new Gtk.Button ({\n" 2859#| " label: \"Welcome to GNOME, too!\"}); */\n" 2860#| "\n" 2861#| " // Attach the images and button to the grid\n" 2862#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 2863#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 2864#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 2865#| "\n" 2866#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 2867#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 2868#| "\n" 2869#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 2870#| "\n" 2871#| " // Add the grid to the window\n" 2872#| " this._window.add (this._grid);\n" 2873#| "\n" 2874#| " // Show the window and all child widgets\n" 2875#| " this._window.show_all();\n" 2876#| " }\n" 2877#| "\n" 2878#| "});\n" 2879#| "\n" 2880#| "// Run the application\n" 2881#| "let app = new WelcomeToTheGrid ();\n" 2882#| "app.application.run (ARGV);\n" 2883msgid "" 2884"#!/usr/bin/gjs\n" 2885"\n" 2886"imports.gi.versions.Gtk = '3.0';\n" 2887"const Gtk = imports.gi.Gtk;\n" 2888"\n" 2889"// We start out with 0 cookies\n" 2890"var cookies = 0;\n" 2891"\n" 2892"class GettingTheSignal {\n" 2893"\n" 2894" // Create the application itself\n" 2895" constructor() {\n" 2896" this.application = new Gtk.Application();\n" 2897"\n" 2898" // Connect 'activate' and 'startup' signals to the callback functions\n" 2899" this.application.connect('activate', this._onActivate.bind(this));\n" 2900" this.application.connect('startup', this._onStartup.bind(this));\n" 2901" }\n" 2902"\n" 2903" // Callback function for 'activate' signal presents window when active\n" 2904" _onActivate() {\n" 2905" this._window.present();\n" 2906" }\n" 2907"\n" 2908" // Callback function for 'startup' signal builds the UI\n" 2909" _onStartup() {\n" 2910" this._buildUI();\n" 2911" }\n" 2912"\n" 2913" // Build the application's UI\n" 2914" _buildUI() {\n" 2915"\n" 2916" // Create the application window\n" 2917" this._window = new Gtk.ApplicationWindow({\n" 2918" application: this.application,\n" 2919" window_position: Gtk.WindowPosition.CENTER,\n" 2920" default_height: 200,\n" 2921" default_width: 400,\n" 2922" border_width: 20,\n" 2923" title: \"Choose the one that says 'cookie'!\"});\n" 2924"\n" 2925" // Create the radio buttons\n" 2926" this._cookieRadio = new Gtk.RadioButton ({ label: \"Cookie\" });\n" 2927" this._notCookieOne = new Gtk.RadioButton ({ label: \"Not cookie\",\n" 2928" group: this._cookieRadio });\n" 2929" this._notCookieTwo = new Gtk.RadioButton ({ label: \"Not cookie\",\n" 2930" group: this._cookieRadio });\n" 2931"\n" 2932" // Arrange the radio buttons in their own grid\n" 2933" this._radioGrid = new Gtk.Grid ();\n" 2934" this._radioGrid.attach (this._notCookieOne, 0, 0, 1, 1);\n" 2935" this._radioGrid.attach (this._cookieRadio, 0, 1, 1, 1);\n" 2936" this._radioGrid.attach (this._notCookieTwo, 0, 2, 1, 1);\n" 2937"\n" 2938" // Set the button that will be at the top to be active by default\n" 2939" this._notCookieOne.set_active (true);\n" 2940"\n" 2941" // Create the cookie button\n" 2942" this._cookieButton = new Gtk.Button ({\n" 2943" label: \"Get a cookie\" });\n" 2944"\n" 2945" // Connect the cookie button to the function that handles clicking it\n" 2946" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 2947"\n" 2948" // Create the label\n" 2949" this._cookieLabel = new Gtk.Label ({\n" 2950" label: \"Number of cookies: \" + cookies });\n" 2951"\n" 2952" // Create a grid to arrange everything inside\n" 2953" this._grid = new Gtk.Grid ({\n" 2954" halign: Gtk.Align.CENTER,\n" 2955" valign: Gtk.Align.CENTER,\n" 2956" row_spacing: 20 });\n" 2957"\n" 2958" // Put everything inside the grid\n" 2959" this._grid.attach (this._radioGrid, 0, 0, 1, 1);\n" 2960" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 2961" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 2962"\n" 2963" // Add the grid to the window\n" 2964" this._window.add (this._grid);\n" 2965"\n" 2966" // Show the window and all child widgets\n" 2967" this._window.show_all();\n" 2968"\n" 2969" }\n" 2970"\n" 2971" _getACookie() {\n" 2972"\n" 2973" // Did you select \"cookie\" instead of \"not cookie\"?\n" 2974" if (this._cookieRadio.get_active()) {\n" 2975"\n" 2976" // Increase the number of cookies by 1 and update the label\n" 2977" cookies++;\n" 2978" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 2979"\n" 2980" }\n" 2981"\n" 2982" }\n" 2983"\n" 2984"};\n" 2985"\n" 2986"// Run the application\n" 2987"let app = new GettingTheSignal ();\n" 2988"app.application.run (ARGV);\n" 2989msgstr "" 2990"#!/usr/bin/gjs\n" 2991"\n" 2992"const Gtk = imports.gi.Gtk;\n" 2993"const Lang = imports.lang;\n" 2994"\n" 2995"const WelcomeToTheGrid = new Lang.Class({\n" 2996" Name: 'Bem-vindo à Grid',\n" 2997"\n" 2998" // Cria o aplicativo em si\n" 2999" _init: function() {\n" 3000" this.application = new Gtk.Application();\n" 3001"\n" 3002" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 3003" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 3004" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 3005" },\n" 3006"\n" 3007" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 3008" _onActivate: function() {\n" 3009" this._window.present();\n" 3010" },\n" 3011"\n" 3012" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 3013" _onStartup: function() {\n" 3014" this._buildUI ();\n" 3015" },\n" 3016"\n" 3017"\n" 3018"\n" 3019" // Constrói a interface gráfica do aplicativo\n" 3020" _buildUI: function() {\n" 3021"\n" 3022" // Cria a janela do aplicativo\n" 3023" this._window = new Gtk.ApplicationWindow({\n" 3024" application: this.application,\n" 3025" window_position: Gtk.WindowPosition.CENTER,\n" 3026" border_width: 10,\n" 3027" title: \"Bem-vindo à Grid\"});\n" 3028"\n" 3029" // Cria a Grid\n" 3030" this._grid = new Gtk.Grid ({\n" 3031" // column_homogeneous: true,\n" 3032" // column_spacing: 20,\n" 3033" row_spacing: 20 });\n" 3034"\n" 3035" // Cria uma imagem\n" 3036" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 3037"\n" 3038" // Cria uma segunda imagem usando um ícone padrão\n" 3039" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 3040"\n" 3041" // Cria um rótulo\n" 3042" this._label = new Gtk.Label ({\n" 3043" label: \"Bem-vindo ao GNOME, também!\",\n" 3044" /* margin_top: 20 */ });\n" 3045"\n" 3046" /* Cria um segundo rótulo\n" 3047" this._labelTwo = new Gtk.Label ({\n" 3048" label: \"O bolo é uma torta.\" }); */\n" 3049"\n" 3050" /* Cria um botão\n" 3051" this._button = new Gtk.Button ({\n" 3052" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 3053"\n" 3054" // Anexa as imagens e botão à grade\n" 3055" this._grid.attach (this._image, 0, 0, 2, 1);\n" 3056" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 3057" this._grid.attach (this._label, 1, 1, 1, 1);\n" 3058"\n" 3059" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 3060" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 3061"\n" 3062" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 3063"\n" 3064" // Adiciona a grade à janela\n" 3065" this._window.add (this._grid);\n" 3066"\n" 3067" // Mostra a janela e todos os widgets filhos\n" 3068" this._window.show_all();\n" 3069" }\n" 3070"\n" 3071"});\n" 3072"\n" 3073"// Executa o aplicativo\n" 3074"let app = new WelcomeToTheGrid ();\n" 3075"app.application.run (ARGV);\n" 3076 3077#. (itstool) path: section/title 3078#: C/03_getting_the_signal.js.page:366 3079#, fuzzy 3080msgid "Code sample with Entry" 3081msgstr "Amostra de código completo" 3082 3083#. (itstool) path: section/code 3084#: C/03_getting_the_signal.js.page:368 3085#, fuzzy, no-wrap 3086#| msgid "" 3087#| "#!/usr/bin/gjs\n" 3088#| "\n" 3089#| "const Gtk = imports.gi.Gtk;\n" 3090#| "const Lang = imports.lang;\n" 3091#| "\n" 3092#| "const WelcomeToTheGrid = new Lang.Class({\n" 3093#| " Name: 'Welcome to the Grid',\n" 3094#| "\n" 3095#| " // Create the application itself\n" 3096#| " _init: function() {\n" 3097#| " this.application = new Gtk.Application();\n" 3098#| "\n" 3099#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 3100#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 3101#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 3102#| " },\n" 3103#| "\n" 3104#| " // Callback function for 'activate' signal presents windows when active\n" 3105#| " _onActivate: function() {\n" 3106#| " this._window.present();\n" 3107#| " },\n" 3108#| "\n" 3109#| " // Callback function for 'startup' signal builds the UI\n" 3110#| " _onStartup: function() {\n" 3111#| " this._buildUI ();\n" 3112#| " },\n" 3113#| "\n" 3114#| "\n" 3115#| "\n" 3116#| " // Build the application's UI\n" 3117#| " _buildUI: function() {\n" 3118#| "\n" 3119#| " // Create the application window\n" 3120#| " this._window = new Gtk.ApplicationWindow({\n" 3121#| " application: this.application,\n" 3122#| " window_position: Gtk.WindowPosition.CENTER,\n" 3123#| " border_width: 10,\n" 3124#| " title: \"Welcome to the Grid\"});\n" 3125#| "\n" 3126#| " // Create the Grid\n" 3127#| " this._grid = new Gtk.Grid ({\n" 3128#| " // column_homogeneous: true,\n" 3129#| " // column_spacing: 20,\n" 3130#| " row_spacing: 20 });\n" 3131#| "\n" 3132#| " // Create an image\n" 3133#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 3134#| "\n" 3135#| " // Create a second image using a stock icon\n" 3136#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 3137#| "\n" 3138#| " // Create a label\n" 3139#| " this._label = new Gtk.Label ({\n" 3140#| " label: \"Welcome to GNOME, too!\",\n" 3141#| " /* margin_top: 20 */ });\n" 3142#| "\n" 3143#| " /* Create a second label\n" 3144#| " this._labelTwo = new Gtk.Label ({\n" 3145#| " label: \"The cake is a pie.\" }); */\n" 3146#| "\n" 3147#| " /* Create a button\n" 3148#| " this._button = new Gtk.Button ({\n" 3149#| " label: \"Welcome to GNOME, too!\"}); */\n" 3150#| "\n" 3151#| " // Attach the images and button to the grid\n" 3152#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 3153#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 3154#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 3155#| "\n" 3156#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 3157#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 3158#| "\n" 3159#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 3160#| "\n" 3161#| " // Add the grid to the window\n" 3162#| " this._window.add (this._grid);\n" 3163#| "\n" 3164#| " // Show the window and all child widgets\n" 3165#| " this._window.show_all();\n" 3166#| " }\n" 3167#| "\n" 3168#| "});\n" 3169#| "\n" 3170#| "// Run the application\n" 3171#| "let app = new WelcomeToTheGrid ();\n" 3172#| "app.application.run (ARGV);\n" 3173msgid "" 3174"#!/usr/bin/gjs\n" 3175"\n" 3176"imports.gi.versions.Gtk = '3.0';\n" 3177"const Gtk = imports.gi.Gtk;\n" 3178"\n" 3179"// We start out with 0 cookies\n" 3180"var cookies = 0;\n" 3181"\n" 3182"class GettingTheSignal {\n" 3183"\n" 3184" // Create the application itself\n" 3185" constructor() {\n" 3186" this.application = new Gtk.Application();\n" 3187"\n" 3188" // Connect 'activate' and 'startup' signals to the callback functions\n" 3189" this.application.connect('activate', this._onActivate.bind(this));\n" 3190" this.application.connect('startup', this._onStartup.bind(this));\n" 3191" }\n" 3192"\n" 3193" // Callback function for 'activate' signal presents window when active\n" 3194" _onActivate() {\n" 3195" this._window.present();\n" 3196" }\n" 3197"\n" 3198" // Callback function for 'startup' signal builds the UI\n" 3199" _onStartup() {\n" 3200" this._buildUI();\n" 3201" }\n" 3202"\n" 3203" // Build the application's UI\n" 3204" _buildUI() {\n" 3205"\n" 3206" // Create the application window\n" 3207" this._window = new Gtk.ApplicationWindow({\n" 3208" application: this.application,\n" 3209" window_position: Gtk.WindowPosition.CENTER,\n" 3210" default_height: 200,\n" 3211" default_width: 400,\n" 3212" border_width: 20,\n" 3213" title: \"Spell 'cookie' to get a cookie!\"});\n" 3214"\n" 3215" // Create the text entry field\n" 3216" this._spellCookie = new Gtk.Entry ();\n" 3217"\n" 3218" // Create the cookie button\n" 3219" this._cookieButton = new Gtk.Button ({\n" 3220" label: \"Get a cookie\" });\n" 3221"\n" 3222" // Connect the cookie button to the function that handles clicking it\n" 3223" this._cookieButton.connect ('clicked', this._getACookie.bind(this));\n" 3224"\n" 3225" // Create the label\n" 3226" this._cookieLabel = new Gtk.Label ({\n" 3227" label: \"Number of cookies: \" + cookies });\n" 3228"\n" 3229" // Create a grid to arrange everything inside\n" 3230" this._grid = new Gtk.Grid ({\n" 3231" halign: Gtk.Align.CENTER,\n" 3232" valign: Gtk.Align.CENTER,\n" 3233" row_spacing: 20 });\n" 3234"\n" 3235" // Put everything inside the grid\n" 3236" this._grid.attach (this._spellCookie, 0, 0, 1, 1);\n" 3237" this._grid.attach (this._cookieButton, 0, 1, 1, 1);\n" 3238" this._grid.attach (this._cookieLabel, 0, 2, 1, 1);\n" 3239"\n" 3240" // Add the grid to the window\n" 3241" this._window.add (this._grid);\n" 3242"\n" 3243" // Show the window and all child widgets\n" 3244" this._window.show_all();\n" 3245"\n" 3246" }\n" 3247"\n" 3248" _getACookie() {\n" 3249"\n" 3250" // Did you spell \"cookie\" correctly?\n" 3251" if ((this._spellCookie.get_text()).toLowerCase() == \"cookie\") {\n" 3252"\n" 3253" // Increase the number of cookies by 1 and update the label\n" 3254" cookies++;\n" 3255" this._cookieLabel.set_label (\"Number of cookies: \" + cookies);\n" 3256"\n" 3257" }\n" 3258"\n" 3259" }\n" 3260"\n" 3261"};\n" 3262"\n" 3263"// Run the application\n" 3264"let app = new GettingTheSignal ();\n" 3265"app.application.run (ARGV);\n" 3266msgstr "" 3267"#!/usr/bin/gjs\n" 3268"\n" 3269"const Gtk = imports.gi.Gtk;\n" 3270"const Lang = imports.lang;\n" 3271"\n" 3272"const WelcomeToTheGrid = new Lang.Class({\n" 3273" Name: 'Bem-vindo à Grid',\n" 3274"\n" 3275" // Cria o aplicativo em si\n" 3276" _init: function() {\n" 3277" this.application = new Gtk.Application();\n" 3278"\n" 3279" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 3280" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 3281" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 3282" },\n" 3283"\n" 3284" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 3285" _onActivate: function() {\n" 3286" this._window.present();\n" 3287" },\n" 3288"\n" 3289" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 3290" _onStartup: function() {\n" 3291" this._buildUI ();\n" 3292" },\n" 3293"\n" 3294"\n" 3295"\n" 3296" // Constrói a interface gráfica do aplicativo\n" 3297" _buildUI: function() {\n" 3298"\n" 3299" // Cria a janela do aplicativo\n" 3300" this._window = new Gtk.ApplicationWindow({\n" 3301" application: this.application,\n" 3302" window_position: Gtk.WindowPosition.CENTER,\n" 3303" border_width: 10,\n" 3304" title: \"Bem-vindo à Grid\"});\n" 3305"\n" 3306" // Cria a Grid\n" 3307" this._grid = new Gtk.Grid ({\n" 3308" // column_homogeneous: true,\n" 3309" // column_spacing: 20,\n" 3310" row_spacing: 20 });\n" 3311"\n" 3312" // Cria uma imagem\n" 3313" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 3314"\n" 3315" // Cria uma segunda imagem usando um ícone padrão\n" 3316" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 3317"\n" 3318" // Cria um rótulo\n" 3319" this._label = new Gtk.Label ({\n" 3320" label: \"Bem-vindo ao GNOME, também!\",\n" 3321" /* margin_top: 20 */ });\n" 3322"\n" 3323" /* Cria um segundo rótulo\n" 3324" this._labelTwo = new Gtk.Label ({\n" 3325" label: \"O bolo é uma torta.\" }); */\n" 3326"\n" 3327" /* Cria um botão\n" 3328" this._button = new Gtk.Button ({\n" 3329" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 3330"\n" 3331" // Anexa as imagens e botão à grade\n" 3332" this._grid.attach (this._image, 0, 0, 2, 1);\n" 3333" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 3334" this._grid.attach (this._label, 1, 1, 1, 1);\n" 3335"\n" 3336" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 3337" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 3338"\n" 3339" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 3340"\n" 3341" // Adiciona a grade à janela\n" 3342" this._window.add (this._grid);\n" 3343"\n" 3344" // Mostra a janela e todos os widgets filhos\n" 3345" this._window.show_all();\n" 3346" }\n" 3347"\n" 3348"});\n" 3349"\n" 3350"// Executa o aplicativo\n" 3351"let app = new WelcomeToTheGrid ();\n" 3352"app.application.run (ARGV);\n" 3353 3354#. (itstool) path: info/title 3355#: C/aboutdialog.c.page:8 3356msgctxt "text" 3357msgid "AboutDialog (C)" 3358msgstr "AboutDialog (C)" 3359 3360#. (itstool) path: credit/name 3361#: C/aboutdialog.c.page:15 C/button.c.page:15 C/combobox.c.page:13 3362#: C/dialog.c.page:15 C/entry.c.page:13 C/grid.c.page:13 C/image.c.page:13 3363#: C/label.c.page:14 C/linkbutton.c.page:13 C/menubar.c.page:15 3364#: C/messagedialog.c.page:14 C/progressbar.c.page:14 C/radiobutton.c.page:15 3365#: C/scale.c.page:15 C/scrolledwindow.c.page:15 C/spinbutton.c.page:16 3366#: C/spinner.c.page:14 C/statusbar.c.page:17 C/switch.c.page:13 3367#: C/textview.c.page:13 C/togglebutton.c.page:17 C/toolbar.c.page:15 3368#, fuzzy 3369msgid "Monica Kochofar" 3370msgstr "Monica Kochofar" 3371 3372#. (itstool) path: info/desc 3373#: C/aboutdialog.c.page:20 C/aboutdialog.js.page:17 C/aboutdialog.vala.page:26 3374#, fuzzy 3375msgid "Display information about an application" 3376msgstr "Exibe informações sobre esse aplicativo" 3377 3378#. (itstool) path: page/title 3379#: C/aboutdialog.c.page:23 C/aboutdialog.js.page:20 C/aboutdialog.py.page:22 3380#: C/aboutdialog.vala.page:29 3381msgid "AboutDialog" 3382msgstr "" 3383 3384#. (itstool) path: page/media 3385#. This is a reference to an external file such as an image or video. When 3386#. the file changes, the md5 hash will change to let you know you need to 3387#. update your localized copy. The msgstr is not used at all. Set it to 3388#. whatever you like once you have updated your copy of the file. 3389#: C/aboutdialog.c.page:25 C/aboutdialog.js.page:21 C/aboutdialog.py.page:23 3390#: C/aboutdialog.vala.page:30 3391msgctxt "_" 3392msgid "" 3393"external ref='media/aboutdialog_GMenu.png' " 3394"md5='a36117a559fa98e25e2f6b3db593639f'" 3395msgstr "" 3396 3397#. (itstool) path: page/p 3398#: C/aboutdialog.c.page:26 C/aboutdialog.vala.page:31 3399msgid "An AboutDialog example using Gtk.ApplicationWindow and Menu" 3400msgstr "" 3401 3402#. (itstool) path: note/p 3403#: C/aboutdialog.c.page:27 C/aboutdialog.vala.page:32 C/gmenu.c.page:24 3404msgid "" 3405"<em style=\"bold\">You need to be running Gtk3.4 or later for this to work</" 3406"em>" 3407msgstr "" 3408 3409#. (itstool) path: page/code 3410#: C/aboutdialog.c.page:29 3411#, no-wrap 3412msgid "" 3413"\n" 3414"#include <gtk/gtk.h>\n" 3415"\n" 3416"/* Callback function in which reacts to the \"response\" signal from the user in\n" 3417" * the message dialog window.\n" 3418" * This function is used to destroy the dialog window.\n" 3419" */\n" 3420"static void\n" 3421"on_close (GtkDialog *dialog,\n" 3422" gint response_id,\n" 3423" gpointer user_data)\n" 3424"{\n" 3425" /* This will cause the dialog to be destroyed */\n" 3426" gtk_widget_destroy (GTK_WIDGET (dialog));\n" 3427"}\n" 3428"\n" 3429"/* Callback function for the response signal \"activate\" related to the SimpleAction\n" 3430" * \"about_action\".\n" 3431" * This function is used to cause the about dialog window to popup.\n" 3432" */\n" 3433"static void\n" 3434"about_cb (GSimpleAction *simple,\n" 3435" GVariant *parameter,\n" 3436" gpointer user_data)\n" 3437"{\n" 3438" GtkWidget *about_dialog;\n" 3439"\n" 3440" about_dialog = gtk_about_dialog_new ();\n" 3441"\n" 3442" /* Lists of authors/ documentators to be used later, they must be initialized\n" 3443" * in a null terminated array of strings.\n" 3444" */\n" 3445" const gchar *authors[] = {\"GNOME Documentation Team\", NULL};\n" 3446" const gchar *documenters[] = {\"GNOME Documentation Team\", NULL};\n" 3447"\n" 3448" /* We fill in the information for the about dialog */\n" 3449" gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), \"AboutDialog Example\");\n" 3450" gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), \"Copyright \\xc2\\xa9 2012 GNOME Documentation Team\");\n" 3451" gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), authors);\n" 3452" gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG (about_dialog), documenters);\n" 3453" gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (about_dialog), \"GNOME Developer Website\");\n" 3454" gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about_dialog), \"http://developer.gnome.org\");\n" 3455"\n" 3456" /* We do not wish to show the title, which in this case would be\n" 3457" * \"AboutDialog Example\". We have to reset the title of the messagedialog\n" 3458" * window after setting the program name.\n" 3459" */\n" 3460" gtk_window_set_title (GTK_WINDOW (about_dialog), \"\");\n" 3461"\n" 3462" /* To close the aboutdialog when \"close\" is clicked we connect the response\n" 3463" * signal to on_close\n" 3464" */\n" 3465" g_signal_connect (GTK_DIALOG (about_dialog), \"response\",\n" 3466" G_CALLBACK (on_close), NULL);\n" 3467"\n" 3468" /* Show the about dialog */\n" 3469" gtk_widget_show (about_dialog);\n" 3470"}\n" 3471"\n" 3472"static void\n" 3473"activate (GtkApplication *app,\n" 3474" gpointer user_data)\n" 3475"{\n" 3476" GtkWidget *window;\n" 3477"\n" 3478" GSimpleAction *about_action;\n" 3479"\n" 3480" /* Create a window with a title and a default size */\n" 3481" window = gtk_application_window_new (app);\n" 3482" gtk_window_set_title (GTK_WINDOW (window), \"AboutDialog Example\");\n" 3483" gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);\n" 3484"\n" 3485" /* Create a new simple action, giving it a NULL parameter type. It will\n" 3486" * always be NULL for actions invoked from a menu. (e.g clicking on an \"ok\"\n" 3487" * or \"cancel\" button)\n" 3488" */\n" 3489" about_action = g_simple_action_new (\"about\", NULL);\n" 3490"\n" 3491" /* Connect the \"activate\" signal to the appropriate callback function.\n" 3492" * It will indicate that the action was just activated.\n" 3493" */\n" 3494" g_signal_connect (about_action, \"activate\", G_CALLBACK (about_cb),\n" 3495" GTK_WINDOW (window));\n" 3496"\n" 3497" /* Adds the about_action to the overall action map. An Action map is an\n" 3498" * interface that contains a number of named GAction instances\n" 3499" * (such as about_action)\n" 3500" */\n" 3501" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));\n" 3502"\n" 3503" gtk_widget_show_all (window);\n" 3504"}\n" 3505"\n" 3506"/* Callback function for the response signal \"activate\" from the \"quit\" action\n" 3507" * found in the function directly below.\n" 3508" */\n" 3509"static void\n" 3510"quit_cb (GSimpleAction *simple,\n" 3511" GVariant *parameter,\n" 3512" gpointer user_data)\n" 3513"{\n" 3514" GApplication *application = user_data;\n" 3515"\n" 3516" g_application_quit (application);\n" 3517"}\n" 3518"\n" 3519"/* Startup function for the menu we are creating in this sample */\n" 3520"static void\n" 3521"startup (GApplication *app,\n" 3522" gpointer user_data)\n" 3523"{\n" 3524" GMenu *menu;\n" 3525" GSimpleAction *quit_action;\n" 3526"\n" 3527" /* Initialize the GMenu, and add a menu item with label \"About\" and action\n" 3528" * \"win.about\". Also add another menu item with label \"Quit\" and action\n" 3529" * \"app.quit\"\n" 3530" */\n" 3531" menu = g_menu_new ();\n" 3532" g_menu_append (menu, \"About\", \"win.about\");\n" 3533" g_menu_append (menu, \"Quit\", \"app.quit\");\n" 3534"\n" 3535" /* Create a new simple action for the application. (In this case it is the\n" 3536" * \"quit\" action.\n" 3537" */\n" 3538" quit_action = g_simple_action_new (\"quit\", NULL);\n" 3539"\n" 3540" /* Ensure that the menu we have just created is set for the overall application */\n" 3541" gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));\n" 3542"\n" 3543" g_signal_connect (quit_action,\n" 3544" \"activate\",\n" 3545" G_CALLBACK (quit_cb),\n" 3546" app);\n" 3547"\n" 3548" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));\n" 3549"}\n" 3550"\n" 3551"/* Startup function for the application */\n" 3552"int\n" 3553"main (int argc, char **argv)\n" 3554"{\n" 3555" GtkApplication *app;\n" 3556" int status;\n" 3557"\n" 3558" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 3559" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 3560" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 3561" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 3562" g_object_unref (app);\n" 3563"\n" 3564" return status;\n" 3565"}\n" 3566msgstr "" 3567 3568#. (itstool) path: page/p 3569#. (itstool) path: section/p 3570#: C/aboutdialog.c.page:31 C/aboutdialog.js.page:25 C/aboutdialog.py.page:42 3571#: C/aboutdialog.vala.page:35 C/button.c.page:30 C/button.js.page:27 3572#: C/button.py.page:53 C/buttonbox.js.page:36 C/buttonbox.py.page:47 3573#: C/checkbutton.c.page:26 C/checkbutton.py.page:43 C/checkbutton.vala.page:26 3574#: C/colorbutton.js.page:34 C/colorbutton.py.page:41 C/colorbutton.vala.page:28 3575#: C/comboboxtext.js.page:177 C/combobox.c.page:31 C/combobox.js.page:234 3576#: C/combobox.py.page:43 C/combobox.vala.page:26 3577#: C/combobox_multicolumn.py.page:42 C/combobox_multicolumn.vala.page:36 3578#: C/dialog.c.page:30 C/dialog.js.page:26 C/dialog.py.page:47 3579#: C/dialog.vala.page:28 C/entry.c.page:28 C/entry.js.page:26 3580#: C/entry.py.page:62 C/entry.vala.page:26 C/filechooserdialog.py.page:71 3581#: C/filechooserdialog.vala.page:36 C/fontchooserwidget.js.page:35 3582#: C/fontchooserwidget.py.page:45 C/fontchooserwidget.vala.page:35 3583#: C/gmenu.c.page:28 C/gmenu.js.page:26 C/gmenu.py.page:78 C/gmenu.vala.page:35 3584#: C/grid.c.page:28 C/grid.js.page:30 C/grid.py.page:55 C/grid.vala.page:28 3585#: C/GtkApplicationWindow.c.page:26 C/GtkApplicationWindow.js.page:27 3586#: C/GtkApplicationWindow.py.page:51 C/GtkApplicationWindow.vala.page:27 3587#: C/image.c.page:29 C/image.js.page:28 C/image.py.page:128 3588#: C/image.vala.page:28 C/label.c.page:33 C/label.js.page:26 3589#: C/label.py.page:103 C/label.vala.page:27 C/linkbutton.c.page:28 3590#: C/linkbutton.js.page:26 C/linkbutton.py.page:45 C/linkbutton.vala.page:26 3591#: C/menubar.c.page:33 C/menubar.py.page:184 C/menubar.vala.page:188 3592#: C/menubutton.c.page:36 C/menubutton.js.page:29 C/menubutton.py.page:54 3593#: C/menubutton.vala.page:29 C/messagedialog.c.page:32 3594#: C/messagedialog.js.page:190 C/messagedialog.py.page:55 3595#: C/messagedialog.vala.page:27 C/paned.c.page:34 C/paned.js.page:34 3596#: C/paned.py.page:40 C/paned.vala.page:34 C/progressbar.c.page:29 3597#: C/progressbar.js.page:35 C/progressbar.py.page:55 C/progressbar.vala.page:26 3598#: C/radiobutton.c.page:30 C/radiobutton.py.page:47 C/radiobutton.vala.page:29 3599#: C/scale.c.page:30 C/scale.py.page:55 C/scale.vala.page:28 3600#: C/scrolledwindow.c.page:30 C/scrolledwindow.js.page:34 3601#: C/scrolledwindow.py.page:43 C/scrolledwindow.vala.page:27 3602#: C/separator.c.page:36 C/separator.py.page:37 C/separator.vala.page:38 3603#: C/spinbutton.c.page:31 C/spinbutton.py.page:47 C/spinbutton.vala.page:28 3604#: C/spinner.c.page:29 C/spinner.js.page:26 C/spinner.py.page:40 3605#: C/spinner.vala.page:26 C/statusbar.c.page:32 C/statusbar.py.page:51 3606#: C/statusbar.vala.page:29 C/switch.c.page:29 C/switch.py.page:43 3607#: C/switch.vala.page:32 C/textview.c.page:32 C/textview.py.page:94 3608#: C/textview.vala.page:31 C/togglebutton.c.page:32 C/togglebutton.py.page:42 3609#: C/togglebutton.vala.page:29 C/toolbar.c.page:31 C/toolbar.js.page:27 3610#: C/toolbar.py.page:53 C/toolbar.vala.page:30 C/toolbar_builder.py.page:192 3611#: C/toolbar_builder.vala.page:147 C/tooltip.c.page:36 C/tooltip.js.page:35 3612#: C/tooltip.py.page:57 C/tooltip.vala.page:36 3613#: C/treeview_advanced_liststore.py.page:42 3614#: C/treeview_cellrenderertoggle.py.page:42 3615#: C/treeview_simple_liststore.js.page:273 3616#: C/treeview_simple_liststore.py.page:43 3617#: C/treeview_simple_liststore.vala.page:28 C/treeview_treestore.py.page:42 3618#: C/widget_drawing.py.page:36 C/window.c.page:30 C/window.py.page:62 3619#: C/window.vala.page:34 3620#, fuzzy 3621msgid "In this sample we used the following:" 3622msgstr "A seguir estão os exemplos que nós apresentamos:" 3623 3624#. (itstool) path: item/p 3625#: C/aboutdialog.c.page:35 C/button.c.page:34 C/combobox.c.page:35 3626#: C/dialog.c.page:34 C/entry.c.page:32 C/grid.c.page:32 3627#: C/GtkApplicationWindow.c.page:30 C/image.c.page:33 C/label.c.page:37 3628#: C/linkbutton.c.page:32 C/messagedialog.c.page:36 C/progressbar.c.page:33 3629#: C/radiobutton.c.page:34 C/scale.c.page:34 C/spinbutton.c.page:35 3630#: C/spinner.c.page:33 C/statusbar.c.page:36 C/switch.c.page:33 3631#: C/textview.c.page:36 C/togglebutton.c.page:36 C/window.c.page:34 3632msgid "" 3633"<link href=\"http://developer.gnome.org/gtk3/3.4/GtkApplication.html" 3634"\">GtkApplication</link>" 3635msgstr "" 3636 3637#. (itstool) path: item/p 3638#: C/aboutdialog.c.page:36 C/button.c.page:35 C/combobox.c.page:36 3639#: C/dialog.c.page:35 C/entry.c.page:33 C/grid.c.page:33 C/linkbutton.c.page:33 3640#: C/messagedialog.c.page:38 C/progressbar.c.page:34 C/radiobutton.c.page:35 3641#: C/scale.c.page:35 C/spinbutton.c.page:36 C/spinner.c.page:34 3642#: C/statusbar.c.page:37 C/switch.c.page:34 C/textview.c.page:37 3643#: C/togglebutton.c.page:37 C/window.c.page:35 3644msgid "" 3645"<link href=\"http://developer.gnome.org/gtk3/3.4/GtkWindow.html\">GtkWindow</" 3646"link>" 3647msgstr "" 3648 3649#. (itstool) path: item/p 3650#: C/aboutdialog.c.page:37 3651#, fuzzy 3652msgid "" 3653"<link href=\"http://developer.gnome.org/gtk3/stable/GtkAboutDialog.html" 3654"\">GtkAboutDialog</link>" 3655msgstr "" 3656"<link href=\"https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html" 3657"\">GtkAboutDialog</link>" 3658 3659#. (itstool) path: item/p 3660#: C/aboutdialog.c.page:38 C/aboutdialog.py.page:48 C/messagedialog.c.page:42 3661#: C/messagedialog.py.page:64 3662msgid "" 3663"<link href=\"http://developer.gnome.org/gio/stable/GMenu.html\">GMenu</link>" 3664msgstr "" 3665"<link href=\"http://developer.gnome.org/gio/stable/GMenu.html\">GMenu</link>" 3666 3667#. (itstool) path: item/p 3668#: C/aboutdialog.c.page:39 C/messagedialog.c.page:41 3669msgid "" 3670"<link href=\"http://developer.gnome.org/gio/stable/GActionMap.html" 3671"\">GActionMap</link>" 3672msgstr "" 3673"<link href=\"http://developer.gnome.org/gio/stable/GActionMap.html" 3674"\">GActionMap</link>" 3675 3676#. (itstool) path: info/title 3677#: C/aboutdialog.js.page:7 3678msgctxt "text" 3679msgid "AboutDialog (JavaScript)" 3680msgstr "AboutDialog (JavaScript)" 3681 3682#. (itstool) path: page/p 3683#: C/aboutdialog.js.page:22 3684msgid "" 3685"A modal dialog window which shows information about an application and its " 3686"creators. This one is triggered by clicking \"About\" in the application's " 3687"menu, which is normally a good place to put it." 3688msgstr "" 3689 3690#. (itstool) path: page/code 3691#: C/aboutdialog.js.page:24 3692#, no-wrap 3693msgid "" 3694"#!/usr/bin/gjs\n" 3695"\n" 3696"imports.gi.versions.Gtk = '3.0';\n" 3697"\n" 3698"const Gio = imports.gi.Gio;\n" 3699"const GLib = imports.gi.GLib;\n" 3700"const Gtk = imports.gi.Gtk;\n" 3701"\n" 3702"class AboutDialogExample {\n" 3703"\n" 3704" // Create the application itself\n" 3705" constructor() {\n" 3706" this.application = new Gtk.Application({\n" 3707" application_id: 'org.example.jsaboutdialog',\n" 3708" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 3709" });\n" 3710"\n" 3711" // Connect 'activate' and 'startup' signals to the callback functions\n" 3712" this.application.connect('activate', this._onActivate.bind(this));\n" 3713" this.application.connect('startup', this._onStartup.bind(this));\n" 3714" }\n" 3715"\n" 3716" // Callback function for 'activate' signal presents windows when active\n" 3717" _onActivate() {\n" 3718" this._window.present();\n" 3719" }\n" 3720"\n" 3721" // Callback function for 'startup' signal creates the menu and builds the UI\n" 3722" _onStartup() {\n" 3723" this._initMenus();\n" 3724" this._buildUI();\n" 3725" }\n" 3726"\n" 3727" // Build the application's UI\n" 3728" _buildUI() {\n" 3729" // Create the application window\n" 3730" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 3731" window_position: Gtk.WindowPosition.CENTER,\n" 3732" title: \"AboutDialog Example\",\n" 3733" default_height: 250,\n" 3734" default_width: 350 });\n" 3735"\n" 3736" // Show the window and all child widgets\n" 3737" this._window.show_all();\n" 3738" }\n" 3739"\n" 3740" // Create the application menu\n" 3741" _initMenus() {\n" 3742" let menu = new Gio.Menu();\n" 3743" menu.append(\"About\", 'app.about');\n" 3744" menu.append(\"Quit\",'app.quit');\n" 3745" this.application.set_app_menu(menu);\n" 3746"\n" 3747" // Create the \"About\" menu option and have it call the _showAbout() function\n" 3748" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n" 3749" aboutAction.connect('activate', () => { this._showAbout(); });\n" 3750" this.application.add_action(aboutAction);\n" 3751"\n" 3752" // Create the \"Quit\" menu option and have it close the window\n" 3753" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 3754" quitAction.connect('activate', () => { this._window.destroy(); });\n" 3755" this.application.add_action(quitAction);\n" 3756" }\n" 3757"\n" 3758" _showAbout() {\n" 3759"\n" 3760" // String arrays of the names of the people involved in the project\n" 3761" var authors = [\"GNOME Documentation Team\"];\n" 3762" var documenters = [\"GNOME Documentation Team\"];\n" 3763"\n" 3764" // Create the About dialog\n" 3765" let aboutDialog = new Gtk.AboutDialog({ title: \"AboutDialog Example\",\n" 3766" program_name: \"GtkApplication Example\",\n" 3767" copyright: \"Copyright \\xa9 2012 GNOME Documentation Team\",\n" 3768" authors: authors,\n" 3769" documenters: documenters,\n" 3770" website: \"http://developer.gnome.org\",\n" 3771" website_label: \"GNOME Developer Website\" });\n" 3772"\n" 3773" // Attach the About dialog to the window\n" 3774" aboutDialog.modal = true;\n" 3775" aboutDialog.transient_for = this._window;\n" 3776"\n" 3777" // Show the About dialog\n" 3778" aboutDialog.show();\n" 3779"\n" 3780" // Connect the Close button to the destroy signal for the dialog\n" 3781" aboutDialog.connect('response', function() {\n" 3782" aboutDialog.destroy();\n" 3783" });\n" 3784" }\n" 3785"};\n" 3786"\n" 3787"// Run the application\n" 3788"let app = new AboutDialogExample();\n" 3789"app.application.run(ARGV);\n" 3790msgstr "" 3791 3792#. (itstool) path: item/p 3793#: C/aboutdialog.js.page:29 C/gmenu.c.page:32 C/gmenu.js.page:30 3794#: C/gmenu.py.page:80 C/messagedialog.js.page:194 C/switch.js.page:266 3795msgid "" 3796"<link href=\"http://developer.gnome.org/gio/unstable/GMenu.html\">GMenu</" 3797"link>" 3798msgstr "" 3799 3800#. (itstool) path: item/p 3801#: C/aboutdialog.js.page:30 C/filechooserdialog.py.page:80 C/gmenu.c.page:33 3802#: C/gmenu.js.page:31 C/gmenu.py.page:81 C/menubar.c.page:39 3803#: C/messagedialog.js.page:195 C/messagedialog.py.page:62 C/switch.js.page:267 3804msgid "" 3805"<link href=\"http://developer.gnome.org/gio/stable/GSimpleAction.html" 3806"\">GSimpleAction</link>" 3807msgstr "" 3808"<link href=\"http://developer.gnome.org/gio/stable/GSimpleAction.html" 3809"\">GSimpleAction</link>" 3810 3811#. (itstool) path: item/p 3812#: C/aboutdialog.js.page:31 3813msgid "" 3814"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.AboutDialog." 3815"html\">Gtk.AboutDialog</link>" 3816msgstr "" 3817 3818#. (itstool) path: item/p 3819#: C/aboutdialog.js.page:32 C/button.js.page:31 C/checkbutton.js.page:137 3820#: C/comboboxtext.js.page:181 C/combobox.js.page:238 C/dialog.js.page:30 3821#: C/entry.js.page:30 C/grid.js.page:34 C/GtkApplicationWindow.js.page:31 3822#: C/image.js.page:32 C/label.js.page:30 C/linkbutton.js.page:30 3823#: C/messagedialog.js.page:196 C/progressbar.js.page:40 3824#: C/radiobutton.js.page:276 C/scale.js.page:211 C/spinbutton.js.page:202 3825#: C/spinner.js.page:31 C/statusbar.js.page:223 C/switch.js.page:268 3826#: C/textview.js.page:250 C/togglebutton.js.page:155 3827#: C/treeview_simple_liststore.js.page:277 C/window.js.page:39 3828msgid "" 3829"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Application." 3830"html\">Gtk.Application</link>" 3831msgstr "" 3832 3833#. (itstool) path: item/p 3834#: C/aboutdialog.js.page:33 C/button.js.page:32 C/checkbutton.js.page:138 3835#: C/comboboxtext.js.page:182 C/combobox.js.page:239 C/dialog.js.page:31 3836#: C/entry.js.page:31 C/grid.js.page:35 C/GtkApplicationWindow.js.page:32 3837#: C/image.js.page:33 C/label.js.page:31 C/linkbutton.js.page:31 3838#: C/messagedialog.js.page:197 C/progressbar.js.page:41 3839#: C/radiobutton.js.page:277 C/scale.js.page:212 C/spinbutton.js.page:203 3840#: C/spinner.js.page:32 C/statusbar.js.page:224 C/switch.js.page:269 3841#: C/textview.js.page:251 C/togglebutton.js.page:156 3842#: C/treeview_simple_liststore.js.page:278 3843msgid "" 3844"<link href=\"http://developer.gnome.org/gtk3/stable/GtkApplicationWindow.html" 3845"\">Gtk.ApplicationWindow</link>" 3846msgstr "" 3847"<link href=\"http://developer.gnome.org/gtk3/stable/GtkApplicationWindow.html" 3848"\">Gtk.ApplicationWindow</link>" 3849 3850#. (itstool) path: info/title 3851#: C/aboutdialog.py.page:8 3852msgctxt "text" 3853msgid "AboutDialog (Python)" 3854msgstr "AboutDialog (Python)" 3855 3856#. (itstool) path: credit/name 3857#: C/aboutdialog.py.page:14 C/beginner.js.page:16 C/beginner.py.page:19 3858#: C/beginner.vala.page:19 C/button.py.page:15 C/buttonbox.py.page:15 3859#: C/checkbutton.py.page:14 C/colorbutton.py.page:14 C/combobox.py.page:15 3860#: C/combobox_multicolumn.py.page:14 C/dialog.py.page:15 C/entry.py.page:15 3861#: C/filechooserdialog.py.page:17 C/fontchooserwidget.py.page:15 3862#: C/gmenu.py.page:21 C/grid.py.page:21 C/GtkApplicationWindow.py.page:20 3863#: C/guitar-tuner.c.page:23 C/guitar-tuner.cpp.page:21 3864#: C/guitar-tuner.py.page:23 C/guitar-tuner.py.page:28 3865#: C/guitar-tuner.vala.page:26 C/image.py.page:15 C/image-viewer.c.page:23 3866#: C/image-viewer.cpp.page:21 C/image-viewer.js.page:23 3867#: C/image-viewer.py.page:23 C/image-viewer.vala.page:31 C/js.page:16 3868#: C/label.py.page:17 C/linkbutton.py.page:14 C/magic-mirror.vala.page:23 3869#: C/menubar.py.page:20 C/menubutton.py.page:20 C/message-board.c.page:20 3870#: C/messagedialog.py.page:14 C/model-view-controller.py.page:21 3871#: C/paned.py.page:14 C/photo-wall.c.page:22 C/progressbar.py.page:14 3872#: C/properties.py.page:21 C/py.page:15 C/radiobutton.py.page:15 3873#: C/record-collection.js.page:23 C/scale.py.page:15 3874#: C/scrolledwindow.py.page:14 C/separator.py.page:15 3875#: C/signals-callbacks.py.page:21 C/spinbutton.py.page:15 C/spinner.py.page:14 3876#: C/statusbar.py.page:15 C/strings.py.page:21 C/switch.py.page:14 3877#: C/textview.py.page:22 C/togglebutton.py.page:14 C/toolbar.py.page:15 3878#: C/toolbar_builder.py.page:22 C/tooltip.py.page:15 3879#: C/treeview_advanced_liststore.py.page:14 3880#: C/treeview_cellrenderertoggle.py.page:14 3881#: C/treeview_simple_liststore.py.page:15 C/treeview_treestore.py.page:15 3882#: C/tutorial.py.page:20 C/vala.page:15 C/weatherApp.js.page:17 3883#: C/widget_drawing.py.page:13 C/window.py.page:20 3884#, fuzzy 3885msgid "Marta Maria Casetti" 3886msgstr "Santa Marta" 3887 3888#. (itstool) path: info/desc 3889#: C/aboutdialog.py.page:19 3890#, fuzzy 3891msgid "A window that displays information about an application" 3892msgstr "Exibe informações sobre esse aplicativo" 3893 3894#. (itstool) path: page/p 3895#: C/aboutdialog.py.page:24 3896msgid "" 3897"An AboutDialog example using Gtk.ApplicationWindow and Menu (the \"about\" " 3898"is displayed if \"About\" in the menu is selected)." 3899msgstr "" 3900 3901#. (itstool) path: section/title 3902#: C/aboutdialog.py.page:29 C/button.py.page:31 C/buttonbox.js.page:30 3903#: C/buttonbox.py.page:31 C/checkbutton.py.page:29 C/colorbutton.js.page:28 3904#: C/colorbutton.py.page:29 C/combobox.py.page:30 3905#: C/combobox_multicolumn.py.page:29 C/combobox_multicolumn.vala.page:29 3906#: C/dialog.py.page:30 C/entry.py.page:35 C/filechooserdialog.py.page:53 3907#: C/fontchooserwidget.js.page:29 C/fontchooserwidget.py.page:31 3908#: C/fontchooserwidget.vala.page:29 C/gmenu.py.page:36 C/grid.py.page:37 3909#: C/GtkApplicationWindow.py.page:35 C/image.py.page:41 C/label.py.page:37 3910#: C/linkbutton.py.page:30 C/menubutton.c.page:30 C/menubutton.py.page:37 3911#: C/messagedialog.py.page:29 C/paned.c.page:28 C/paned.js.page:28 3912#: C/paned.py.page:29 C/paned.vala.page:28 C/progressbar.py.page:39 3913#: C/radiobutton.py.page:30 C/scale.py.page:30 C/scrolledwindow.js.page:28 3914#: C/scrolledwindow.py.page:29 C/separator.c.page:30 C/separator.py.page:31 3915#: C/separator.vala.page:32 C/spinbutton.py.page:30 C/spinner.py.page:29 3916#: C/statusbar.py.page:30 C/switch.py.page:31 C/textview.py.page:44 3917#: C/togglebutton.py.page:29 C/toolbar.py.page:31 C/toolbar_builder.py.page:164 3918#: C/tooltip.c.page:30 C/tooltip.js.page:29 C/tooltip.py.page:31 3919#: C/tooltip.vala.page:30 C/treeview_advanced_liststore.py.page:29 3920#: C/treeview_cellrenderertoggle.py.page:29 3921#: C/treeview_simple_liststore.py.page:30 C/treeview_treestore.py.page:30 3922#: C/widget_drawing.py.page:28 C/window.py.page:45 3923#, fuzzy 3924msgid "Code used to generate this example" 3925msgstr "-M\t\tgera código MT-safe\n" 3926 3927#. (itstool) path: section/code 3928#: C/aboutdialog.py.page:31 3929#, no-wrap 3930msgid "" 3931"from gi.repository import Gtk\n" 3932"from gi.repository import Gio\n" 3933"import sys\n" 3934"\n" 3935"\n" 3936"class MyWindow(Gtk.ApplicationWindow):\n" 3937"\n" 3938" # constructor for a window (the parent window)\n" 3939" def __init__(self, app):\n" 3940" Gtk.Window.__init__(self, title=\"AboutDialog Example\", application=app)\n" 3941" self.set_default_size(200, 200)\n" 3942"\n" 3943" # create the about_action (a Gio.SimpleAction)\n" 3944" about_action = Gio.SimpleAction.new(\"about\", None)\n" 3945" # connect the signal from the action to the function about_cb()\n" 3946" about_action.connect(\"activate\", self.about_cb)\n" 3947" # add the action to the application\n" 3948" app.add_action(about_action)\n" 3949"\n" 3950" # callback function for the about_action's \"activate\" signal\n" 3951" def about_cb(self, action, parameter):\n" 3952" # a Gtk.AboutDialog\n" 3953" aboutdialog = Gtk.AboutDialog()\n" 3954"\n" 3955" # lists of authors and documenters (will be used later)\n" 3956" authors = [\"GNOME Documentation Team\"]\n" 3957" documenters = [\"GNOME Documentation Team\"]\n" 3958"\n" 3959" # we fill in the aboutdialog\n" 3960" aboutdialog.set_program_name(\"AboutDialog Example\")\n" 3961" aboutdialog.set_copyright(\n" 3962" \"Copyright \\xc2\\xa9 2012 GNOME Documentation Team\")\n" 3963" aboutdialog.set_authors(authors)\n" 3964" aboutdialog.set_documenters(documenters)\n" 3965" aboutdialog.set_website(\"http://developer.gnome.org\")\n" 3966" aboutdialog.set_website_label(\"GNOME Developer Website\")\n" 3967"\n" 3968" # we do not want to show the title, which by default would be \"About AboutDialog Example\"\n" 3969" # we have to reset the title of the messagedialog window after setting\n" 3970" # the program name\n" 3971" aboutdialog.set_title(\"\")\n" 3972"\n" 3973" # to close the aboutdialog when \"close\" is clicked we connect the\n" 3974" # \"response\" signal to on_close\n" 3975" aboutdialog.connect(\"response\", self.on_close)\n" 3976" # show the aboutdialog\n" 3977" aboutdialog.show()\n" 3978"\n" 3979" # destroy the aboutdialog\n" 3980" def on_close(self, action, parameter):\n" 3981" action.destroy()\n" 3982"\n" 3983"\n" 3984"class MyApplication(Gtk.Application):\n" 3985"\n" 3986" def __init__(self):\n" 3987" Gtk.Application.__init__(self)\n" 3988"\n" 3989" def do_activate(self):\n" 3990" win = MyWindow(self)\n" 3991" win.show_all()\n" 3992"\n" 3993" def quit_cb(self, action, parameter):\n" 3994" self.quit()\n" 3995"\n" 3996" def do_startup(self):\n" 3997" Gtk.Application.do_startup(self)\n" 3998"\n" 3999" # create a menu (a Gio.Menu)\n" 4000" menu = Gio.Menu()\n" 4001" # append a menu item with label \"About\" and action \"app.about\"\n" 4002" menu.append(\"About\", \"app.about\")\n" 4003" # append a menu item with label \"Quit\" and action \"app.quit\"\n" 4004" menu.append(\"Quit\", \"app.quit\")\n" 4005" # set menu as the menu for the application\n" 4006" self.set_app_menu(menu)\n" 4007"\n" 4008" # a new simpleaction - for the application\n" 4009" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 4010" quit_action.connect(\"activate\", self.quit_cb)\n" 4011" self.add_action(quit_action)\n" 4012"\n" 4013"app = MyApplication()\n" 4014"exit_status = app.run(sys.argv)\n" 4015"sys.exit(exit_status)\n" 4016msgstr "" 4017 4018#. (itstool) path: section/title 4019#: C/aboutdialog.py.page:36 4020#, fuzzy 4021msgid "Useful methods for an AboutDialog widget" 4022msgstr "Métodos úteis" 4023 4024#. (itstool) path: section/p 4025#: C/aboutdialog.py.page:37 4026msgid "" 4027"In line 15 the signal <code>\"activate\"</code> is connected to the callback " 4028"function <code>about_cb()</code> using <code><var>widget</var>." 4029"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 4030"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 4031msgstr "" 4032 4033#. (itstool) path: section/title 4034#: C/aboutdialog.py.page:41 C/button.py.page:52 C/buttonbox.js.page:35 4035#: C/buttonbox.py.page:46 C/checkbutton.py.page:42 C/colorbutton.js.page:33 4036#: C/colorbutton.py.page:40 C/combobox.py.page:42 4037#: C/combobox_multicolumn.py.page:41 C/combobox_multicolumn.vala.page:35 4038#: C/dialog.py.page:46 C/entry.py.page:61 C/filechooserdialog.py.page:70 4039#: C/fontchooserwidget.js.page:34 C/fontchooserwidget.py.page:44 4040#: C/fontchooserwidget.vala.page:34 C/gmenu.py.page:77 C/grid.py.page:54 4041#: C/GtkApplicationWindow.py.page:50 C/image.py.page:126 C/label.py.page:102 4042#: C/linkbutton.py.page:44 C/menubar.py.page:183 C/menubutton.c.page:35 4043#: C/menubutton.py.page:53 C/messagedialog.py.page:54 C/paned.c.page:33 4044#: C/paned.js.page:33 C/paned.py.page:39 C/paned.vala.page:33 4045#: C/progressbar.py.page:54 C/radiobutton.py.page:46 C/scale.py.page:54 4046#: C/scrolledwindow.js.page:33 C/scrolledwindow.py.page:42 4047#: C/spinbutton.py.page:46 C/spinner.py.page:39 C/statusbar.py.page:50 4048#: C/switch.py.page:42 C/textview.py.page:93 C/togglebutton.py.page:41 4049#: C/toolbar.py.page:52 C/toolbar_builder.py.page:191 C/tooltip.c.page:35 4050#: C/tooltip.js.page:34 C/tooltip.py.page:56 C/tooltip.vala.page:35 4051#: C/treeview_advanced_liststore.py.page:41 4052#: C/treeview_cellrenderertoggle.py.page:41 4053#: C/treeview_simple_liststore.py.page:42 C/treeview_treestore.py.page:41 4054#: C/widget_drawing.py.page:35 C/window.py.page:60 4055msgid "API References" 4056msgstr "Referências da API" 4057 4058#. (itstool) path: item/p 4059#: C/aboutdialog.py.page:46 4060msgid "" 4061"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkAboutDialog.html" 4062"\">GtkAboutDialog</link>" 4063msgstr "" 4064"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkAboutDialog.html" 4065"\">GtkAboutDialog</link>" 4066 4067#. (itstool) path: item/p 4068#: C/aboutdialog.py.page:47 C/checkbutton.py.page:46 C/grid.py.page:58 4069#: C/GtkApplicationWindow.py.page:56 C/separator.c.page:38 4070msgid "" 4071"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkApplicationWindow." 4072"html\">GtkApplicationWindow</link>" 4073msgstr "" 4074 4075#. (itstool) path: item/p 4076#: C/aboutdialog.py.page:49 C/checkbutton.py.page:45 C/grid.py.page:57 4077#: C/GtkApplicationWindow.py.page:55 C/messagedialog.py.page:65 4078#: C/window.py.page:64 4079msgid "" 4080"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkApplication.html" 4081"\">GtkApplication</link>" 4082msgstr "" 4083"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkApplication.html" 4084"\">GtkApplication</link>" 4085 4086#. (itstool) path: info/title 4087#: C/aboutdialog.vala.page:8 4088msgctxt "text" 4089msgid "AboutDialog (Vala)" 4090msgstr "AboutDialog (Vala)" 4091 4092#. (itstool) path: credit/name 4093#: C/aboutdialog.vala.page:15 C/gmenu.vala.page:14 4094msgid "Ryan Lortie" 4095msgstr "Ryan Lortie" 4096 4097#. (itstool) path: credit/name 4098#: C/aboutdialog.vala.page:21 C/beginner.py.page:15 C/beginner.vala.page:15 4099#: C/button.vala.page:14 C/c.page:14 C/checkbutton.c.page:13 4100#: C/checkbutton.vala.page:13 C/colorbutton.vala.page:15 C/combobox.c.page:18 4101#: C/combobox.vala.page:13 C/combobox_multicolumn.vala.page:14 C/cpp.page:11 4102#: C/dialog.vala.page:13 C/entry.vala.page:13 C/filechooserdialog.vala.page:16 4103#: C/gmenu.c.page:13 C/gmenu.js.page:13 C/gmenu.py.page:15 C/gmenu.vala.page:20 4104#: C/grid.py.page:15 C/grid.vala.page:15 C/GtkApplicationWindow.c.page:13 4105#: C/GtkApplicationWindow.js.page:13 C/GtkApplicationWindow.py.page:15 4106#: C/GtkApplicationWindow.vala.page:13 C/guitar-tuner.vala.page:22 4107#: C/hello-world.c.page:20 C/hello-world.js.page:20 C/hello-world.py.page:20 4108#: C/hello-world.vala.page:20 C/image.vala.page:13 C/image-viewer.vala.page:27 4109#: C/index.page:23 C/js.page:12 C/label.vala.page:13 C/linkbutton.vala.page:13 4110#: C/menubar.py.page:15 C/menubar.vala.page:15 C/menubutton.c.page:13 4111#: C/menubutton.py.page:14 C/menubutton.vala.page:13 4112#: C/messagedialog.vala.page:13 C/paned.c.page:13 C/paned.vala.page:13 4113#: C/progressbar.vala.page:13 C/py.page:11 C/radiobutton.vala.page:16 4114#: C/response-type.page:9 C/scale.vala.page:15 C/scrolledwindow.vala.page:14 4115#: C/separator.c.page:14 C/separator.vala.page:16 C/spinbutton.vala.page:15 4116#: C/spinner.vala.page:13 C/statusbar.vala.page:16 C/switch.vala.page:17 4117#: C/textview.vala.page:13 C/togglebutton.vala.page:16 C/toolbar.js.page:13 4118#: C/toolbar.vala.page:14 C/toolbar_builder.py.page:16 4119#: C/toolbar_builder.vala.page:15 C/tooltip.c.page:14 C/tooltip.vala.page:14 4120#: C/treeview_simple_liststore.vala.page:15 C/tutorial.py.page:15 4121#: C/vala.page:11 C/window.c.page:13 C/window.py.page:15 C/window.vala.page:13 4122msgid "Tiffany Antopolski" 4123msgstr "Tiffany Antopolski" 4124 4125#. (itstool) path: page/code 4126#: C/aboutdialog.vala.page:34 4127#, no-wrap 4128msgid "" 4129"/* A window in the application */\n" 4130"public class Window : Gtk.ApplicationWindow {\n" 4131"\n" 4132"\t/* The constructor */\n" 4133"\tpublic Window (Application app) {\n" 4134"\t\tObject (application: app, title: \"AboutDialog Example\");\n" 4135"\n" 4136"\t\tvar about_action = new SimpleAction (\"about\", null);\n" 4137"\n" 4138"\t\tabout_action.activate.connect (this.about_cb);\n" 4139"\t\tthis.add_action (about_action);\n" 4140"\t\tthis.show_all ();\n" 4141"\t}\n" 4142"\n" 4143"\t/* This is the callback function connected to the 'activate' signal\n" 4144"\t * of the SimpleAction about_action.\n" 4145"\t */\n" 4146"\tvoid about_cb (SimpleAction simple, Variant? parameter) {\n" 4147"\t\tstring[] authors = { \"GNOME Documentation Team\", null };\n" 4148"\t\tstring[] documenters = { \"GNOME Documentation Team\", null };\n" 4149"\n" 4150"\t\tGtk.show_about_dialog (this,\n" 4151" \"program-name\", (\"GtkApplication Example\"),\n" 4152" \"copyright\", (\"Copyright \\xc2\\xa9 2012 GNOME Documentation Team\"),\n" 4153" \"authors\", authors,\n" 4154" \"documenters\", documenters,\n" 4155" \"website\", \"http://developer.gnome.org\",\n" 4156" \"website-label\", (\"GNOME Developer Website\"),\n" 4157" null);\n" 4158"\t}\n" 4159"}\n" 4160"\n" 4161"/* This is the Application */\n" 4162"public class Application : Gtk.Application {\n" 4163"\n" 4164"\t/* Here we override the activate signal of GLib.Application */\n" 4165"\tprotected override void activate () {\n" 4166"\t\tnew Window (this);\n" 4167"\t}\n" 4168"\n" 4169"\t/* Here we override the startup signal of GLib.Application */\n" 4170"\tprotected override void startup () {\n" 4171"\n" 4172"\t\tbase.startup ();\n" 4173"\n" 4174"\t\tvar menu = new Menu ();\n" 4175"\t\tmenu.append (\"About\", \"win.about\");\n" 4176"\t\tmenu.append (\"Quit\", \"app.quit\");\n" 4177"\t\tthis.app_menu = menu;\n" 4178"\n" 4179"\t\tvar quit_action = new SimpleAction (\"quit\", null);\n" 4180"\t\t//quit_action.activate.connect (this.quit);\n" 4181"\t\tthis.add_action (quit_action);\n" 4182"\t}\n" 4183"\n" 4184"\t/* The constructor */\n" 4185"\tpublic Application () {\n" 4186"\t\tObject (application_id: \"org.example.application\");\n" 4187"\t}\n" 4188"}\n" 4189"\n" 4190"/* main function creates Application and runs it */\n" 4191"int main (string[] args) {\n" 4192"\treturn new Application ().run (args);\n" 4193"}\n" 4194msgstr "" 4195 4196#. (itstool) path: item/p 4197#: C/aboutdialog.vala.page:39 C/gmenu.vala.page:39 C/window.vala.page:38 4198msgid "" 4199"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Application.html\">Gtk." 4200"Application</link>" 4201msgstr "" 4202 4203#. (itstool) path: item/p 4204#: C/aboutdialog.vala.page:40 C/gmenu.vala.page:40 4205#: C/GtkApplicationWindow.vala.page:32 C/label.vala.page:32 4206msgid "" 4207"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ApplicationWindow.html" 4208"\">Gtk.ApplicationWindow</link>" 4209msgstr "" 4210 4211#. (itstool) path: item/p 4212#: C/aboutdialog.vala.page:41 4213msgid "" 4214"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Window.set_default_size.html" 4215"\">set_default_size</link>" 4216msgstr "" 4217 4218#. (itstool) path: info/desc 4219#: C/audio-player.vala.page:10 4220#, fuzzy 4221msgid "Coming soon..." 4222msgstr "" 4223"Você está usando uma prévia do Livros. Recursos de visualização completos " 4224"chegarão em breve!" 4225 4226#. (itstool) path: credit/name 4227#: C/audio-player.vala.page:14 C/guitar-tuner.c.page:15 4228#: C/guitar-tuner.cpp.page:13 C/guitar-tuner.py.page:15 4229#: C/guitar-tuner.vala.page:14 C/image-viewer.c.page:15 4230#: C/image-viewer.cpp.page:13 C/image-viewer.vala.page:15 4231#: C/record-collection.js.page:15 4232msgid "GNOME Documentation Project" 4233msgstr "Projeto de Documentação do GNOME" 4234 4235#. (itstool) path: page/title 4236#: C/audio-player.vala.page:19 4237#, fuzzy 4238msgid "Audio player" 4239msgstr "Reproduzir o anexo no reprodutor de áudio embutido" 4240 4241#. (itstool) path: credit/name 4242#: C/beginner.js.page:11 C/grid.js.page:13 C/guitar-tuner.js.page:12 4243#: C/hello-world.c.page:15 C/hello-world.js.page:15 C/hello-world.py.page:15 4244#: C/hello-world.vala.page:15 C/weatherApp.js.page:12 4245#: C/weatherAppMain.js.page:11 C/weatherAutotools.js.page:11 4246#: C/weatherGeonames.js.page:11 4247msgid "Susanna Huhtanen" 4248msgstr "Susanna Huhtanen" 4249 4250#. (itstool) path: credit/years 4251#: C/beginner.js.page:18 C/beginner.py.page:21 C/beginner.vala.page:21 4252#: C/buttonbox.js.page:16 C/colorbutton.js.page:15 4253#: C/combobox_multicolumn.vala.page:16 C/fontchooserwidget.js.page:15 4254#: C/fontchooserwidget.vala.page:15 C/guitar-tuner.c.page:25 4255#: C/guitar-tuner.cpp.page:23 C/guitar-tuner.py.page:25 4256#: C/guitar-tuner.py.page:30 C/guitar-tuner.vala.page:28 4257#: C/image-viewer.c.page:25 C/image-viewer.cpp.page:23 4258#: C/image-viewer.js.page:25 C/image-viewer.py.page:25 4259#: C/image-viewer.vala.page:33 C/js.page:18 C/magic-mirror.vala.page:25 4260#: C/menubutton.c.page:15 C/message-board.c.page:22 C/paned.js.page:15 4261#: C/paned.vala.page:15 C/photo-wall.c.page:24 C/py.page:17 4262#: C/record-collection.js.page:25 C/scrolledwindow.js.page:15 4263#: C/separator.c.page:16 C/separator.vala.page:18 C/tooltip.c.page:16 4264#: C/tooltip.js.page:16 C/tooltip.vala.page:16 C/tutorial.py.page:27 4265#: C/vala.page:17 C/weatherApp.js.page:19 C/widget_drawing.py.page:15 4266msgid "2013" 4267msgstr "2013" 4268 4269#. (itstool) path: info/desc 4270#: C/beginner.js.page:21 4271msgid "" 4272"A beginner's guide to writing GNOME applications in JavaScript, including " 4273"code samples and practice exercises." 4274msgstr "" 4275"Um guia para iniciantes na escrita de aplicativos do GNOME em JavaScript, " 4276"incluindo amostras de códigos e exercícios práticos." 4277 4278#. (itstool) path: page/title 4279#: C/beginner.js.page:24 C/beginner.vala.page:25 4280msgid "Tutorial for beginners and code samples" 4281msgstr "Tutoriais para iniciantes e amostras de códigos" 4282 4283#. (itstool) path: synopsis/p 4284#: C/beginner.js.page:26 4285msgid "" 4286"JavaScript is one of the most popular programming languages on the web. It's " 4287"not just for the web, though. If you have even a basic understanding of " 4288"JavaScript, you can write full-fledged applications for GNOME. <link href=" 4289"\"https://wiki.gnome.org/Apps/Documents\">GNOME Documents</link> is written " 4290"in JavaScript, and so is <link href=\"https://live.gnome.org/GnomeShell/Tour" 4291"\">GNOME Shell</link>, the most basic part of GNOME." 4292msgstr "" 4293"JavaScript é uma das linguagens de programação mais populares da web. Não é " 4294"apenas para a web, no entanto. Se você tiver uma compreensão básica do " 4295"JavaScript, poderá criar aplicativos completos para o GNOME. <link href=" 4296"\"https://wiki.gnome.org/Apps/Documents\">Documentos do GNOME</link> é " 4297"escrito em JavaScript, assim como <link href=\"https://live.gnome.org/" 4298"GnomeShell/Tour\">GNOME Shell</link>, a parte mais básica do GNOME." 4299 4300#. (itstool) path: note/p 4301#: C/beginner.js.page:27 4302msgid "" 4303"GNOME Shell is what you see when you click on \"Activities\" in the top-left " 4304"corner of your screen. It also controls the clock and the rest of the top " 4305"panel. Besides showing how you to write GNOME applications, these tutorials " 4306"will also show you how to use JavaScript to write GNOME Shell extensions, " 4307"which give it new features or change the way it does things." 4308msgstr "" 4309"O GNOME Shell é o que você vê quando clica em “Atividades” no canto superior " 4310"esquerdo da tela. Também controla o relógio e o resto do painel superior. " 4311"Além de mostrar como você escreve aplicativos GNOME, esses tutoriais também " 4312"mostram como usar o JavaScript para escrever extensões do GNOME Shell, que " 4313"fornecem novos recursos ou mudam a maneira como ele faz as coisas." 4314 4315#. (itstool) path: section/title 4316#: C/beginner.js.page:31 4317msgid "Getting Started" 4318msgstr "Primeiros passos" 4319 4320#. (itstool) path: section/p 4321#: C/beginner.js.page:32 4322msgid "" 4323"These tutorials are designed for people who already know how to write in " 4324"JavaScript, and who have GNOME installed on their computers already, but who " 4325"are new to developing GNOME applications. If you don't already know " 4326"JavaScript, or if you need help getting GNOME set up, take a look at these " 4327"resources first:" 4328msgstr "" 4329 4330#. (itstool) path: item/p 4331#: C/beginner.js.page:34 4332msgid "" 4333"<link href=\"http://eloquentjavascript.net/contents.html\">Eloquent " 4334"JavaScript</link> is a free, Creative Commons-licensed book, which explains " 4335"the basics of JavaScript programming. Since you won't be writing JavaScript " 4336"for the web, you only need to read up to chapter 10 or so." 4337msgstr "" 4338 4339#. (itstool) path: item/p 4340#: C/beginner.js.page:35 4341msgid "" 4342"<link href=\"http://www.gnome.org/getting-gnome/\">Download GNOME</link> as " 4343"part of a distribution, like Fedora, openSUSE, or Ubuntu. Each distribution " 4344"has its own instructions for how to get GNOME." 4345msgstr "" 4346 4347#. (itstool) path: item/p 4348#: C/beginner.js.page:36 4349msgid "" 4350"<link xref=\"set-up-gedit.js\">Set up gedit</link> for writing applications. " 4351"GNOME's text editor, gedit, is sometimes just called \"text editor\"." 4352msgstr "" 4353 4354#. (itstool) path: section/title 4355#: C/beginner.js.page:42 C/beginner.vala.page:42 C/c.page:113 4356msgid "Tutorials" 4357msgstr "Tutoriais" 4358 4359#. (itstool) path: section/title 4360#: C/beginner.js.page:46 C/beginner.vala.page:46 C/py.page:32 4361#, fuzzy 4362msgid "Code samples" 4363msgstr "" 4364"Tutoriais, amostras de código e demonstrações da plataforma em JavaScript" 4365 4366#. (itstool) path: section/p 4367#: C/beginner.js.page:47 4368msgid "" 4369"These samples show how to use widgets in your GNOME applications. Each one " 4370"demonstrates a complete application which showcases the featured widget. At " 4371"the end of each sample, you will find links to more detailed reference " 4372"material." 4373msgstr "" 4374 4375#. (itstool) path: section/p 4376#: C/beginner.js.page:48 C/beginner.vala.page:47 C/c.page:91 4377#, fuzzy 4378msgid "To run the code samples:" 4379msgstr "Amostras de códigos e tutoriais" 4380 4381#. (itstool) path: item/p 4382#: C/beginner.js.page:50 4383msgid "Copy and paste the code into <var>filename</var>.js" 4384msgstr "" 4385 4386#. (itstool) path: item/p 4387#: C/beginner.js.page:51 4388#, fuzzy 4389msgid "In the terminal, type:" 4390msgstr "Em um terminal, digite:" 4391 4392#. (itstool) path: item/screen 4393#: C/beginner.js.page:52 4394#, fuzzy, no-wrap 4395msgid "gjs <var>filename</var>.js" 4396msgstr "<cmd>--filename</cmd>=<var>arquivo</var>" 4397 4398#. (itstool) path: section/title 4399#: C/beginner.js.page:55 C/beginner.py.page:32 C/beginner.vala.page:58 4400#: C/c.page:118 4401#, fuzzy 4402msgid "Windows" 4403msgstr "Windows" 4404 4405#. (itstool) path: section/title 4406#: C/beginner.js.page:57 C/beginner.py.page:34 C/beginner.vala.page:61 4407#: C/c.page:121 4408#, fuzzy 4409msgid "Display widgets" 4410msgstr "Widgets disponíveis" 4411 4412#. (itstool) path: section/title 4413#: C/beginner.js.page:59 C/beginner.py.page:36 C/beginner.vala.page:63 4414#: C/c.page:123 4415#, fuzzy 4416msgid "Buttons and toggles" 4417msgstr "Alterna o negrito do texto." 4418 4419#. (itstool) path: section/title 4420#: C/beginner.js.page:61 C/beginner.py.page:38 C/beginner.vala.page:65 4421#: C/c.page:125 4422#, fuzzy 4423msgid "Numeric and text data entry" 4424msgstr "Entrada de texto" 4425 4426#. (itstool) path: section/title 4427#: C/beginner.js.page:63 C/beginner.py.page:40 C/beginner.vala.page:67 4428#: C/c.page:127 4429#, fuzzy 4430msgid "Multiline text editor" 4431msgstr "Multilinha" 4432 4433#. (itstool) path: section/title 4434#: C/beginner.js.page:65 C/beginner.py.page:42 C/beginner.vala.page:69 4435#: C/c.page:129 4436msgid "Menu, combo box and toolbar widgets" 4437msgstr "" 4438 4439#. (itstool) path: section/title 4440#: C/beginner.js.page:67 C/beginner.py.page:44 C/beginner.vala.page:71 4441#: C/c.page:131 4442#, fuzzy 4443msgid "TreeView widget" 4444msgstr "Widget de visualização em árvore" 4445 4446#. (itstool) path: section/title 4447#. (itstool) path: steps/title 4448#: C/beginner.js.page:69 C/beginner.py.page:46 C/beginner.vala.page:73 4449#: C/c.page:133 C/tutorial.py.page:127 4450#, fuzzy 4451msgid "Selectors" 4452msgstr "Suplemento de seletores de variação" 4453 4454#. (itstool) path: section/title 4455#: C/beginner.js.page:70 C/beginner.py.page:47 C/beginner.vala.page:74 4456#: C/c.page:134 4457#, fuzzy 4458msgid "File selectors" 4459msgstr "Seletores de cor" 4460 4461#. (itstool) path: section/title 4462#: C/beginner.js.page:72 C/beginner.py.page:49 C/beginner.vala.page:76 4463#: C/c.page:136 4464#, fuzzy 4465msgid "Font selectors" 4466msgstr "Seletores de cor" 4467 4468#. (itstool) path: section/title 4469#: C/beginner.js.page:74 C/beginner.py.page:51 C/beginner.vala.page:78 4470#: C/c.page:138 4471#, fuzzy 4472msgid "Color Selectors" 4473msgstr "Seletores de cor" 4474 4475#. (itstool) path: section/title 4476#: C/beginner.js.page:77 C/beginner.py.page:54 C/beginner.vala.page:81 4477#: C/c.page:141 4478#, fuzzy 4479msgid "Layout containers" 4480msgstr "Contêiners personalizados" 4481 4482#. (itstool) path: section/title 4483#: C/beginner.js.page:79 C/beginner.py.page:56 C/beginner.vala.page:83 4484#: C/c.page:143 4485#, fuzzy 4486msgid "Ornaments" 4487msgstr "Ornamentos" 4488 4489#. (itstool) path: section/title 4490#: C/beginner.js.page:81 C/beginner.py.page:58 C/beginner.vala.page:85 4491#: C/c.page:145 4492#, fuzzy 4493msgid "Scrolling" 4494msgstr "Bloquear rolagem" 4495 4496#. (itstool) path: section/title 4497#: C/beginner.js.page:83 C/beginner.py.page:60 C/beginner.vala.page:87 4498#: C/c.page:147 4499#, fuzzy 4500msgid "Miscellaneous" 4501msgstr "Diversos" 4502 4503#. (itstool) path: section/title 4504#: C/beginner.js.page:88 C/beginner.vala.page:92 C/menubar.vala.page:198 4505#, fuzzy 4506msgid "Exercises" 4507msgstr "Todos os exercícios" 4508 4509#. (itstool) path: info/title 4510#: C/beginner.py.page:9 4511msgctxt "text" 4512msgid "GTK+ widgets sample code (Python)" 4513msgstr "" 4514 4515#. (itstool) path: info/desc 4516#: C/beginner.py.page:13 4517msgid "" 4518"A guide to GUI programming using GTK+, including code samples and practice " 4519"exercises." 4520msgstr "" 4521 4522#. (itstool) path: page/title 4523#: C/beginner.py.page:25 4524#, fuzzy 4525msgid "GTK+ widgets sample code" 4526msgstr "Widgets e objetos não-GTK+" 4527 4528#. (itstool) path: synopsis/p 4529#: C/beginner.py.page:27 4530msgid "" 4531"If you are a beginner and you would like a tutorial to guide you step by " 4532"step in an exploration of what you can do with GTK+ 3, you should go to the " 4533"<link xref=\"tutorial.py\"/> page. If you are looking for a specific widget, " 4534"you can find it in the sections below." 4535msgstr "" 4536 4537#. (itstool) path: section/title 4538#: C/beginner.py.page:64 4539#, fuzzy 4540msgid "Theory pages" 4541msgstr "Teoria musical" 4542 4543#. (itstool) path: info/title 4544#: C/beginner.vala.page:9 4545msgctxt "text" 4546msgid "Tutorial for beginners (Vala)" 4547msgstr "Tutorial for beginners (Vala)" 4548 4549#. (itstool) path: info/desc 4550#: C/beginner.vala.page:13 4551msgid "" 4552"A beginner's guide to GUI programming using GTK+, including code samples and " 4553"practice exercises." 4554msgstr "" 4555 4556#. (itstool) path: synopsis/p 4557#: C/beginner.vala.page:27 4558msgid "" 4559"Although these tutorials are designed for beginners, we can't cover all the " 4560"basics. Before attempting to follow these tutorials, you are expected to be " 4561"familiar with the following concepts:" 4562msgstr "" 4563 4564#. (itstool) path: item/p 4565#: C/beginner.vala.page:29 4566#, fuzzy 4567msgid "Object oriented programming" 4568msgstr "" 4569"Cim é o compilador GNU para Simula, a primeira linguagem de programação " 4570"orientada a objetos. <small>(<a href=\"/manual/manual.html#cim\">doc</a>)</" 4571"small>" 4572 4573#. (itstool) path: item/p 4574#: C/beginner.vala.page:30 4575#, fuzzy 4576msgid "The Vala programming language:" 4577msgstr "Linguagem de _programação:" 4578 4579#. (itstool) path: item/p 4580#: C/beginner.vala.page:32 4581msgid "" 4582"<link href=\"https://live.gnome.org/Vala/Tutorial\">The Vala Tutorial</link>" 4583msgstr "" 4584 4585#. (itstool) path: item/p 4586#: C/beginner.vala.page:33 4587msgid "" 4588"<link href=\"https://live.gnome.org/Vala/Documentation#Sample_Code\">Sample " 4589"Vala code</link>" 4590msgstr "" 4591 4592#. (itstool) path: synopsis/p 4593#: C/beginner.vala.page:38 4594msgid "" 4595"By following these tutorials you will learn the basics of GUI programming " 4596"using GTK+." 4597msgstr "" 4598 4599#. (itstool) path: item/p 4600#: C/beginner.vala.page:51 4601msgid "Copy and paste the code into <var>filename</var>.vala" 4602msgstr "" 4603 4604#. (itstool) path: item/p 4605#: C/beginner.vala.page:52 C/c.page:98 4606#, fuzzy 4607msgid "In the terminal type:" 4608msgstr "Em um terminal, digite:" 4609 4610#. (itstool) path: item/screen 4611#: C/beginner.vala.page:53 4612#, no-wrap 4613msgid "valac --pkg gtk+-3.0 <var>filename</var>.vala" 4614msgstr "" 4615 4616#. (itstool) path: item/screen 4617#: C/beginner.vala.page:54 C/c.page:100 4618#, fuzzy, no-wrap 4619msgid "./<var>filename</var>" 4620msgstr "Localiza mensagens com anexos cujo nome corresponda a <var>nome de arquivo</var>." 4621 4622#. (itstool) path: info/title 4623#: C/button.c.page:8 4624msgctxt "text" 4625msgid "Button (C)" 4626msgstr "Button (C)" 4627 4628#. (itstool) path: info/desc 4629#: C/button.c.page:20 C/button.py.page:20 C/button.vala.page:19 4630msgid "A button widget which emits a signal when clicked" 4631msgstr "" 4632 4633#. (itstool) path: page/title 4634#: C/button.c.page:23 C/button.js.page:21 C/button.py.page:23 4635#, fuzzy 4636msgid "Button" 4637msgstr "Bot@~{a}o" 4638 4639#. (itstool) path: page/media 4640#. This is a reference to an external file such as an image or video. When 4641#. the file changes, the md5 hash will change to let you know you need to 4642#. update your localized copy. The msgstr is not used at all. Set it to 4643#. whatever you like once you have updated your copy of the file. 4644#: C/button.c.page:25 C/button.js.page:22 C/button.py.page:25 4645#: C/button.vala.page:24 4646msgctxt "_" 4647msgid "external ref='media/button.png' md5='8d69efbb3a0d3e043af6139b6492171c'" 4648msgstr "external ref='media/button.png' md5='8d69efbb3a0d3e043af6139b6492171c'" 4649 4650#. (itstool) path: page/p 4651#: C/button.c.page:26 4652msgid "" 4653"A button widget connected to a callback function that reverses its label " 4654"when clicked." 4655msgstr "" 4656 4657#. (itstool) path: page/code 4658#: C/button.c.page:28 4659#, no-wrap 4660msgid "" 4661"\n" 4662"#include <gtk/gtk.h>\n" 4663"\n" 4664"\n" 4665"\n" 4666"/*This is the callback function. It is a handler function which \n" 4667"reacts to the signal. In this case, it will cause the button label's \n" 4668"string to reverse.*/\n" 4669"static void\n" 4670"button_clicked (GtkButton *button,\n" 4671" gpointer user_data)\n" 4672"{\n" 4673" const char *old_label;\n" 4674" char *new_label;\n" 4675"\n" 4676" old_label = gtk_button_get_label (button);\n" 4677" new_label = g_utf8_strreverse (old_label, -1);\n" 4678"\n" 4679" gtk_button_set_label (button, new_label);\n" 4680" g_free (new_label);\n" 4681"}\n" 4682"\n" 4683"\n" 4684"\n" 4685"static void\n" 4686"activate (GtkApplication *app,\n" 4687" gpointer user_data)\n" 4688"{\n" 4689" GtkWidget *window;\n" 4690" GtkWidget *button;\n" 4691"\n" 4692" /*Create a window with a title and a default size*/\n" 4693" window = gtk_application_window_new (app);\n" 4694" gtk_window_set_title (GTK_WINDOW (window), \"GNOME Button\");\n" 4695" gtk_window_set_default_size (GTK_WINDOW (window), 250, 50);\n" 4696"\n" 4697" /*Create a button with a label, and add it to the window*/\n" 4698" button = gtk_button_new_with_label (\"Click Me\");\n" 4699" gtk_container_add (GTK_CONTAINER (window), button);\n" 4700"\n" 4701" /*Connecting the clicked signal to the callback function*/\n" 4702" g_signal_connect (GTK_BUTTON (button),\n" 4703" \"clicked\", \n" 4704" G_CALLBACK (button_clicked), \n" 4705" G_OBJECT (window));\n" 4706"\n" 4707" gtk_widget_show_all (window);\n" 4708"}\n" 4709"\n" 4710"\n" 4711"\n" 4712"int\n" 4713"main (int argc, char **argv)\n" 4714"{\n" 4715" GtkApplication *app;\n" 4716" int status;\n" 4717"\n" 4718" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 4719" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 4720" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 4721" g_object_unref (app);\n" 4722"\n" 4723" return status;\n" 4724"}\n" 4725msgstr "" 4726 4727#. (itstool) path: item/p 4728#: C/button.c.page:36 C/buttonbox.py.page:51 C/grid.c.page:35 4729#, fuzzy 4730msgid "" 4731"<link href=\"http://developer.gnome.org/gtk3/stable/GtkButton.html" 4732"\">GtkButton</link>" 4733msgstr "" 4734"<link href=\"https://developer.gnome.org/gtk3/stable/GtkButton.html" 4735"\">GtkButton</link>" 4736 4737#. (itstool) path: item/p 4738#: C/button.c.page:37 4739msgid "" 4740"<link href=\"http://developer.gnome.org/glib/stable/glib-Unicode-" 4741"Manipulation.html#g-utf8-strreverse\">Unicode Manipulation</link>" 4742msgstr "" 4743 4744#. (itstool) path: info/title 4745#: C/button.js.page:8 4746msgctxt "text" 4747msgid "Button (JavaScript)" 4748msgstr "Button (JavaScript)" 4749 4750#. (itstool) path: info/desc 4751#: C/button.js.page:18 4752msgid "A button which can be connected to other widgets" 4753msgstr "" 4754 4755#. (itstool) path: page/p 4756#: C/button.js.page:23 4757msgid "A button widget that changes its label when you click it." 4758msgstr "" 4759 4760#. (itstool) path: page/code 4761#: C/button.js.page:25 4762#, fuzzy, no-wrap 4763#| msgid "" 4764#| "#!/usr/bin/gjs\n" 4765#| "\n" 4766#| "const GLib = imports.gi.GLib;\n" 4767#| "const Gtk = imports.gi.Gtk;\n" 4768#| "const Lang = imports.lang;\n" 4769#| "const Webkit = imports.gi.WebKit;\n" 4770#| "\n" 4771#| "const HelloGNOME = new Lang.Class ({\n" 4772#| " Name: 'Hello GNOME',\n" 4773#| "\n" 4774#| " // Create the application itself\n" 4775#| " _init: function () {\n" 4776#| " this.application = new Gtk.Application ();\n" 4777#| "\n" 4778#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 4779#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 4780#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 4781#| " },\n" 4782#| "\n" 4783#| " // Callback function for 'activate' signal presents windows when active\n" 4784#| " _onActivate: function () {\n" 4785#| " this._window.present ();\n" 4786#| " },\n" 4787#| "\n" 4788#| " // Callback function for 'startup' signal builds the UI\n" 4789#| " _onStartup: function () {\n" 4790#| " this._buildUI ();\n" 4791#| " },\n" 4792#| "\n" 4793#| " // Build the application's UI\n" 4794#| " _buildUI: function () {\n" 4795#| "\n" 4796#| " // Create the application window\n" 4797#| " this._window = new Gtk.ApplicationWindow ({\n" 4798#| " application: this.application,\n" 4799#| " title: \"Welcome to GNOME\",\n" 4800#| " default_height: 200,\n" 4801#| " default_width: 400,\n" 4802#| " window_position: Gtk.WindowPosition.CENTER });\n" 4803#| "\n" 4804#| " // Create a webview to show the web app\n" 4805#| " this._webView = new Webkit.WebView ();\n" 4806#| "\n" 4807#| " // Put the web app into the webview\n" 4808#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 4809#| " \"/hellognome.html\", null));\n" 4810#| "\n" 4811#| " // Put the webview into the window\n" 4812#| " this._window.add (this._webView);\n" 4813#| "\n" 4814#| " // Show the window and all child widgets\n" 4815#| " this._window.show_all();\n" 4816#| " },\n" 4817#| "\n" 4818#| "});\n" 4819#| "\n" 4820#| "// Run the application\n" 4821#| "let app = new HelloGNOME ();\n" 4822#| "app.application.run (ARGV);\n" 4823msgid "" 4824"#!/usr/bin/gjs\n" 4825"\n" 4826"imports.gi.versions.Gtk = '3.0';\n" 4827"\n" 4828"const Gio = imports.gi.Gio;\n" 4829"const GLib = imports.gi.GLib;\n" 4830"const Gtk = imports.gi.Gtk;\n" 4831"\n" 4832"class ButtonExample {\n" 4833"\n" 4834" /* Create the application itself\n" 4835" This boilerplate code is needed to build any GTK+ application. */\n" 4836" constructor() {\n" 4837" this.application = new Gtk.Application ({\n" 4838" application_id: 'org.example.jsbutton',\n" 4839" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 4840" });\n" 4841"\n" 4842" // Connect 'activate' and 'startup' signals to the callback functions\n" 4843" this.application.connect('activate', this._onActivate.bind(this));\n" 4844" this.application.connect('startup', this._onStartup.bind(this));\n" 4845" }\n" 4846"\n" 4847" // Callback function for 'activate' signal presents windows when active\n" 4848" _onActivate() {\n" 4849" this._window.present ();\n" 4850" }\n" 4851"\n" 4852" // Callback function for 'startup' signal initializes menus and builds the UI\n" 4853" _onStartup() {\n" 4854" this._buildUI();\n" 4855" }\n" 4856"\n" 4857" // Build the application's UI\n" 4858" _buildUI() {\n" 4859"\n" 4860" // Create the application window\n" 4861" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n" 4862" window_position: Gtk.WindowPosition.CENTER,\n" 4863" title: \"GNOME Button\",\n" 4864" default_height: 50,\n" 4865" default_width: 250 });\n" 4866"\n" 4867" // Create the button\n" 4868" this.Button = new Gtk.Button ({label: \"Click Me\"});\n" 4869" this._window.add (this.Button);\n" 4870"\n" 4871" // Bind it to a function that says what to do when the button is clicked\n" 4872" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n" 4873"\n" 4874" // Show the window and all child widgets\n" 4875" this._window.show_all();\n" 4876" }\n" 4877"\n" 4878" // Here's the function that says what happens when the button is clicked\n" 4879" _clickHandler() {\n" 4880" this.Button.set_label (\"Clicked!\");\n" 4881" }\n" 4882"};\n" 4883"\n" 4884"// Run the application\n" 4885"let app = new ButtonExample ();\n" 4886"app.application.run (ARGV);\n" 4887msgstr "" 4888"#!/usr/bin/gjs\n" 4889"\n" 4890"const GLib = imports.gi.GLib;\n" 4891"const Gtk = imports.gi.Gtk;\n" 4892"const Lang = imports.lang;\n" 4893"const Webkit = imports.gi.WebKit;\n" 4894"\n" 4895"const HelloGNOME = new Lang.Class ({\n" 4896" Name: 'Olá, GNOME',\n" 4897"\n" 4898" // Cria o aplicativo em si\n" 4899" _init: function () {\n" 4900" this.application = new Gtk.Application ();\n" 4901"\n" 4902" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 4903" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 4904" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 4905" },\n" 4906"\n" 4907" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 4908" _onActivate: function () {\n" 4909" this._window.present ();\n" 4910" },\n" 4911"\n" 4912" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 4913" _onStartup: function () {\n" 4914" this._buildUI ();\n" 4915" },\n" 4916"\n" 4917" // Constrói a interface gráfica do aplicativo\n" 4918" _buildUI: function () {\n" 4919"\n" 4920" // Cria a janela do aplicativo\n" 4921" this._window = new Gtk.ApplicationWindow ({\n" 4922" application: this.application,\n" 4923" title: \"Bem-vindo ao GNOME\",\n" 4924" default_height: 200,\n" 4925" default_width: 400,\n" 4926" window_position: Gtk.WindowPosition.CENTER });\n" 4927"\n" 4928" // Cria um webview para mostrar o aplicativo web\n" 4929" this._webView = new Webkit.WebView ();\n" 4930"\n" 4931" // Coloca o aplicativo web no webview\n" 4932" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 4933" \"/hellognome.html\", null));\n" 4934"\n" 4935" // Coloca o webview na janela\n" 4936" this._window.add (this._webView);\n" 4937"\n" 4938" // Mostra a janela e todos seus widgets filhos\n" 4939" this._window.show_all();\n" 4940" },\n" 4941"\n" 4942"});\n" 4943"\n" 4944"// Executa o aplicativo\n" 4945"let app = new HelloGNOME ();\n" 4946"app.application.run (ARGV);\n" 4947 4948#. (itstool) path: item/p 4949#: C/button.js.page:33 C/grid.js.page:36 4950msgid "" 4951"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Button.html" 4952"\">Gtk.Button</link>" 4953msgstr "" 4954 4955#. (itstool) path: info/title 4956#: C/button.py.page:8 4957msgctxt "text" 4958msgid "Button (Python)" 4959msgstr "Button (Python)" 4960 4961#. (itstool) path: page/p 4962#: C/button.py.page:26 C/button.vala.page:25 4963msgid "A button widget connected to a simple callback function." 4964msgstr "" 4965 4966#. (itstool) path: section/code 4967#: C/button.py.page:32 4968#, no-wrap 4969msgid "" 4970"from gi.repository import Gtk\n" 4971"import sys\n" 4972"\n" 4973"\n" 4974"class MyWindow(Gtk.ApplicationWindow):\n" 4975" # a window\n" 4976"\n" 4977" def __init__(self, app):\n" 4978" Gtk.Window.__init__(self, title=\"GNOME Button\", application=app)\n" 4979" self.set_default_size(250, 50)\n" 4980"\n" 4981" # a button\n" 4982" button = Gtk.Button()\n" 4983" # with a label\n" 4984" button.set_label(\"Click me\")\n" 4985" # connect the signal \"clicked\" emitted by the button\n" 4986" # to the callback function do_clicked\n" 4987" button.connect(\"clicked\", self.do_clicked)\n" 4988" # add the button to the window\n" 4989" self.add(button)\n" 4990"\n" 4991" # callback function connected to the signal \"clicked\" of the button\n" 4992" def do_clicked(self, button):\n" 4993" print(\"You clicked me!\")\n" 4994"\n" 4995"\n" 4996"class MyApplication(Gtk.Application):\n" 4997"\n" 4998" def __init__(self):\n" 4999" Gtk.Application.__init__(self)\n" 5000"\n" 5001" def do_activate(self):\n" 5002" win = MyWindow(self)\n" 5003" win.show_all()\n" 5004"\n" 5005" def do_startup(self):\n" 5006" Gtk.Application.do_startup(self)\n" 5007"\n" 5008"app = MyApplication()\n" 5009"exit_status = app.run(sys.argv)\n" 5010"sys.exit(exit_status)\n" 5011msgstr "" 5012 5013#. (itstool) path: section/title 5014#: C/button.py.page:36 5015#, fuzzy 5016msgid "Useful methods for a Button widget" 5017msgstr "Métodos úteis" 5018 5019#. (itstool) path: section/p 5020#: C/button.py.page:37 5021msgid "" 5022"In line 16 the <code>\"clicked\"</code> signal from the button is connected " 5023"to the callback function <code>do_clicked()</code> using <code><var>widget</" 5024"var>.connect(<var>signal</var>, <var>callback function</var>)</code>. See " 5025"<link xref=\"signals-callbacks.py\"/> for a more detailed explanation." 5026msgstr "" 5027 5028#. (itstool) path: item/p 5029#: C/button.py.page:39 5030msgid "" 5031"<code>set_relief(Gtk.ReliefStyle.NONE)</code> sets to none the relief style " 5032"of the edges of the Gtk.Button - as opposed to <code>Gtk.ReliefStyle.NORMAL</" 5033"code>." 5034msgstr "" 5035 5036#. (itstool) path: item/p 5037#: C/button.py.page:40 5038msgid "" 5039"If the label of the button is a <link href=\"http://developer.gnome.org/gtk3/" 5040"unstable/gtk3-Stock-Items.html\">stock icon</link>, " 5041"<code>set_use_stock(True)</code> sets the label as the name of the " 5042"corresponding stock icon." 5043msgstr "" 5044 5045#. (itstool) path: item/p 5046#: C/button.py.page:41 5047msgid "" 5048"To set an image (e.g. a stock image) for the button <code>button</code>:" 5049msgstr "" 5050 5051#. (itstool) path: item/code 5052#: C/button.py.page:42 5053#, no-wrap 5054msgid "" 5055"\n" 5056"image = Gtk.Image()\n" 5057"image.set_from_stock(Gtk.STOCK_ABOUT, Gtk.IconSize.BUTTON)\n" 5058"button.set_image(image)" 5059msgstr "" 5060 5061#. (itstool) path: item/p 5062#: C/button.py.page:46 5063msgid "" 5064"You should not set a label for the button after this, otherwise it will show " 5065"the label and not the image." 5066msgstr "" 5067 5068#. (itstool) path: item/p 5069#: C/button.py.page:47 5070msgid "" 5071"If we use <code>set_focus_on_click(False)</code> the button will not grab " 5072"focus when it is clicked by the mouse. This could be useful in places like " 5073"toolbars, so that the keyboard focus is not removed from the main area of " 5074"the application." 5075msgstr "" 5076 5077#. (itstool) path: item/p 5078#: C/button.py.page:55 5079msgid "" 5080"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkButton.html" 5081"\">GtkButton</link>" 5082msgstr "" 5083"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkButton.html" 5084"\">GtkButton</link>" 5085 5086#. (itstool) path: item/p 5087#: C/button.py.page:56 C/dialog.py.page:52 C/label.py.page:106 5088#: C/linkbutton.py.page:47 C/messagedialog.py.page:61 C/radiobutton.py.page:49 5089#: C/separator.py.page:39 C/window.py.page:65 5090msgid "" 5091"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkWindow.html" 5092"\">GtkWindow</link>" 5093msgstr "" 5094 5095#. (itstool) path: info/title 5096#: C/button.vala.page:8 5097msgctxt "text" 5098msgid "Button (Vala)" 5099msgstr "Button (Vala)" 5100 5101#. (itstool) path: page/title 5102#: C/button.vala.page:22 5103#, fuzzy 5104msgid "Button widget" 5105msgstr "A largura desejada do componente do botão, em caracteres." 5106 5107#. (itstool) path: page/code 5108#: C/button.vala.page:27 5109#, no-wrap 5110msgid "" 5111"\n" 5112"/* A window in the application */\n" 5113"public class MyWindow : Gtk.ApplicationWindow {\n" 5114"\n" 5115"\t/* The constructor of the window */\n" 5116"\tinternal MyWindow (MyApplication app) {\n" 5117"\t\tObject (application: app, title: \"GNOME Button\");\n" 5118"\n" 5119"\t\tvar button = new Gtk.Button.with_label (\"Click Me\");\n" 5120"\t\tbutton.clicked.connect (this.reverse_label);\n" 5121"\t\tbutton.show ();\n" 5122"\n" 5123"\t\tthis.window_position = Gtk.WindowPosition.CENTER;\n" 5124"\t\tthis.set_default_size (250,50);\n" 5125"\t\tthis.add (button);\n" 5126"\t}\n" 5127"\n" 5128"\t/* The callback function connected to the\n" 5129"\t * 'clicked' signal of the button.\n" 5130"\t */\n" 5131"\tvoid reverse_label (Gtk.Button button) {\n" 5132"\t\tbutton.label = button.label.reverse ();\n" 5133"\t}\n" 5134"}\n" 5135"\n" 5136"/* This is the application. */\n" 5137"public class MyApplication : Gtk.Application {\n" 5138"\n" 5139"\t/* This is the constructor */\n" 5140"\tinternal MyApplication () {\n" 5141"\t\tObject (application_id: \"org.example.MyApplication\");\n" 5142"\t}\n" 5143"\n" 5144"\t/* Override the activate signal of GLib.Application */\n" 5145"\tprotected override void activate () {\n" 5146"\t\tnew MyWindow (this).show ();\n" 5147"\t}\n" 5148"}\n" 5149"\n" 5150"/* main creates and runs the application */\n" 5151"public int main (string[] args) {\n" 5152"\treturn new MyApplication ().run (args);\n" 5153"}\n" 5154msgstr "" 5155 5156#. (itstool) path: page/p 5157#: C/button.vala.page:29 5158msgid "" 5159"In this sample we used the following: <link href=\"http://www.valadoc.org/gtk" 5160"+-3.0/Gtk.Button.html\">Gtk.Button</link>" 5161msgstr "" 5162 5163#. (itstool) path: info/title 5164#: C/buttonbox.js.page:8 5165msgctxt "text" 5166msgid "ButtonBox (JavaScript)" 5167msgstr "ButtonBox (JavaScript)" 5168 5169#. (itstool) path: credit/name 5170#: C/buttonbox.js.page:14 C/colorbutton.js.page:13 5171#: C/fontchooserwidget.js.page:13 C/paned.js.page:13 5172#: C/scrolledwindow.js.page:13 C/tooltip.js.page:14 5173msgid "Meg Ford" 5174msgstr "" 5175 5176#. (itstool) path: info/desc 5177#: C/buttonbox.js.page:19 C/buttonbox.py.page:20 5178#, fuzzy 5179msgid "A container for arranging buttons" 5180msgstr "Organizando elementos nas interfaces de usuário." 5181 5182#. (itstool) path: page/title 5183#. (itstool) path: steps/title 5184#: C/buttonbox.js.page:22 C/buttonbox.py.page:23 C/tutorial.py.page:92 5185msgid "ButtonBox" 5186msgstr "ButtonBox" 5187 5188#. (itstool) path: page/media 5189#. This is a reference to an external file such as an image or video. When 5190#. the file changes, the md5 hash will change to let you know you need to 5191#. update your localized copy. The msgstr is not used at all. Set it to 5192#. whatever you like once you have updated your copy of the file. 5193#: C/buttonbox.js.page:24 C/buttonbox.py.page:25 5194msgctxt "_" 5195msgid "" 5196"external ref='media/buttonbox_calculator.png' " 5197"md5='ce0de08b7ac66f517290e33e6d33d508'" 5198msgstr "" 5199 5200#. (itstool) path: page/p 5201#: C/buttonbox.js.page:25 C/buttonbox.py.page:26 5202msgid "A calculator - the buttons are enclosed in horizontal ButtonBoxes." 5203msgstr "" 5204 5205#. (itstool) path: section/code 5206#: C/buttonbox.js.page:31 5207#, no-wrap 5208msgid "" 5209"#!/usr/bin/gjs\n" 5210"\n" 5211"imports.gi.versions.Gtk = '3.0';\n" 5212"\n" 5213"const GObject = imports.gi.GObject;\n" 5214"const Gtk = imports.gi.Gtk;\n" 5215"\n" 5216"class ButtonBoxExample {\n" 5217"\n" 5218" // Create the application itthis\n" 5219" constructor() {\n" 5220" this.application = new Gtk.Application({\n" 5221" application_id: 'org.example.jsbuttonbox'\n" 5222" });\n" 5223"\n" 5224" // Connect 'activate' and 'startup' signals to the callback functions\n" 5225" this.application.connect('activate', this._onActivate.bind(this));\n" 5226" this.application.connect('startup', this._onStartup.bind(this));\n" 5227" }\n" 5228"\n" 5229" // Callback function for 'activate' signal presents windows when active\n" 5230" _onActivate() {\n" 5231" this.window.present();\n" 5232" }\n" 5233"\n" 5234" // Callback function for 'startup' signal builds the UI\n" 5235" _onStartup() {\n" 5236" this._buildUI();\n" 5237" }\n" 5238"\n" 5239" // Build the application's UI\n" 5240" _buildUI() {\n" 5241" // Create the application window\n" 5242" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n" 5243" window_position: Gtk.WindowPosition.CENTER,\n" 5244" title: \"Calculator\",\n" 5245" default_width: 350,\n" 5246" default_height: 200,\n" 5247" border_width: 10 });\n" 5248" this.entry = new Gtk.Entry();\n" 5249" this.entry.set_text('0');\n" 5250" // text aligned on the right\n" 5251" this.entry.set_alignment(1);\n" 5252" // the text in the entry cannot be modified by writing in it\n" 5253" this.entry.set_can_focus(false);\n" 5254"\n" 5255" // a grid\n" 5256" this.grid = new Gtk.Grid();\n" 5257" this.grid.set_row_spacing(5);\n" 5258" \n" 5259" // to attach the entry\n" 5260" this.grid.attach(this.entry, 0, 0, 1, 1);\n" 5261" \n" 5262" // the labels for the buttons\n" 5263" this.buttons = [ 7, 8, 9, '/', 4, 5, 6, '*', 1, 2, 3, '-', 'C', 0, '=', '+' ];\n" 5264" \n" 5265" // each row is a ButtonBox, attached to the grid \n" 5266" for (let i = 0; i < 4; i++) {\n" 5267" this.hbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL);\n" 5268" this.hbox.set_spacing(5);\n" 5269" this.grid.attach(this.hbox, 0, i + 1, 1, 1);\n" 5270" // each ButtonBox has 4 buttons, connected to the callback function\n" 5271" for (let j= 0; j < 4; j++) {\n" 5272" this.button = new Gtk.Button();\n" 5273" this.buttonLabel = (this.buttons[i * 4 + j].toString());\n" 5274" this.button.set_label(this.buttonLabel);\n" 5275" this.button.set_can_focus(false);\n" 5276" this.button.connect(\"clicked\", this._buttonClicked.bind(this));\n" 5277" this.hbox.add(this.button);\n" 5278" }\n" 5279" }\n" 5280" \n" 5281" // some variables for the calculations\n" 5282" this.firstNumber = 0;\n" 5283" this.secondNumber = 0;\n" 5284" this.counter = 0;\n" 5285" this.operation = \"\";\n" 5286"\n" 5287" // add the grid to the window\n" 5288" this.window.add(this.grid);\n" 5289" this.window.show_all();\n" 5290" }\n" 5291"\n" 5292" // callback function for all the buttons\n" 5293" _buttonClicked(button) {\n" 5294" this.button = button;\n" 5295" // for the operations\n" 5296" if (this.button.get_label() == '+') {\n" 5297" this.counter += 1 \n" 5298" if (this.counter > 1)\n" 5299" this._doOperation();\n" 5300" this.entry.set_text('0');\n" 5301" this.operation = \"plus\";\n" 5302" }\n" 5303"\n" 5304" else if (this.button.get_label() == '-') {\n" 5305" this.counter += 1;\n" 5306" if (this.counter > 1)\n" 5307" this._doOperation();\n" 5308" this.entry.set_text('0');\n" 5309" this.operation = \"minus\";\n" 5310" }\n" 5311"\n" 5312" else if (this.button.get_label() == '*') {\n" 5313" this.counter += 1; \n" 5314" if (this.counter > 1)\n" 5315" this._doOperation();\n" 5316" this.entry.set_text('0');\n" 5317" this.operation = \"multiplication\";\n" 5318" }\n" 5319"\n" 5320" else if (this.button.get_label() == '/') {\n" 5321" this.counter += 1 \n" 5322" if (this.counter > 1)\n" 5323" this._doOperation();\n" 5324" this.entry.set_text('0');\n" 5325" this.operation = \"division\";\n" 5326" }\n" 5327"\n" 5328" // for =\n" 5329" else if (this.button.get_label() == '=') {\n" 5330" this._doOperation();\n" 5331" this.entry.set_text(this.firstNumber.toString());\n" 5332" this.counter = 1;\n" 5333" }\n" 5334"\n" 5335" // for Cancel\n" 5336" else if (this.button.get_label() == 'C') {\n" 5337" this.firstNumber = 0;\n" 5338" this.secondNumber = 0;\n" 5339" this.counter = 0;\n" 5340" this.entry.set_text('0');\n" 5341" this.operation = \"\";\n" 5342" }\n" 5343"\n" 5344" // for a digit button\n" 5345" else {\n" 5346" this.newDigit = parseInt(this.button.get_label());\n" 5347" if (this.entry.get_text() == \"error\")\n" 5348" this.number = 0;\n" 5349" else\n" 5350" this.number = parseInt(this.entry.get_text());\n" 5351" this.number = this.number * 10 + this.newDigit; \n" 5352" if (this.counter == 0)\n" 5353" this.firstNumber = this.number;\n" 5354" else\n" 5355" this.secondNumber = this.number;\n" 5356" this.entry.set_text(this.number.toString());\n" 5357" }\n" 5358" }\n" 5359"\n" 5360" _doOperation() {\n" 5361" if (this.operation == \"plus\") {\n" 5362" this.firstNumber += this.secondNumber;\n" 5363" } else if (this.operation == \"minus\") {\n" 5364" this.firstNumber -= this.secondNumber;\n" 5365" } else if (this.operation == \"multiplication\") {\n" 5366" this.firstNumber *= this.secondNumber;\n" 5367" } else if (this.operation == \"division\") {\n" 5368" if (this.secondNumber != 0) {\n" 5369" this.firstNumber /= this.secondNumber;\n" 5370" } else {\n" 5371" this.firstNumber = 0; \n" 5372" this.secondNumber = 0;\n" 5373" this.counter = 0; \n" 5374" this.entry.set_text(\"error\");\n" 5375" this.operation = \"\";\n" 5376"\n" 5377" return\n" 5378" }\n" 5379" } else {\n" 5380" this.firstNumber = 0;\n" 5381" this.secondNumber = 0;\n" 5382" this.counter = 0;\n" 5383" this.entry.set_text(\"error\");\n" 5384" }\n" 5385" }\n" 5386"};\n" 5387"\n" 5388"// Run the application\n" 5389"let app = new ButtonBoxExample();\n" 5390"app.application.run (ARGV);\n" 5391msgstr "" 5392 5393#. (itstool) path: item/p 5394#: C/buttonbox.js.page:38 5395msgid "" 5396"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.ButtonBox.html" 5397"\">GtkButtonBox</link>" 5398msgstr "" 5399 5400#. (itstool) path: item/p 5401#: C/buttonbox.js.page:39 5402msgid "" 5403"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Box.html" 5404"\">GtkBox</link>" 5405msgstr "" 5406 5407#. (itstool) path: item/p 5408#: C/buttonbox.js.page:40 5409msgid "" 5410"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Button.html" 5411"\">GtkButton</link>" 5412msgstr "" 5413 5414#. (itstool) path: item/p 5415#: C/buttonbox.js.page:41 5416msgid "" 5417"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Entry.html" 5418"\">GtkEntry</link>" 5419msgstr "" 5420 5421#. (itstool) path: item/p 5422#: C/buttonbox.js.page:42 5423msgid "" 5424"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Grid.html" 5425"\">GtkGrid</link>" 5426msgstr "" 5427 5428#. (itstool) path: info/title 5429#: C/buttonbox.py.page:8 5430msgctxt "text" 5431msgid "ButtonBox (Python)" 5432msgstr "ButtonBox (Python)" 5433 5434#. (itstool) path: section/code 5435#: C/buttonbox.py.page:32 5436#, no-wrap 5437msgid "" 5438"from gi.repository import Gtk\n" 5439"import sys\n" 5440"\n" 5441"\n" 5442"class MyWindow(Gtk.ApplicationWindow):\n" 5443"\n" 5444" def __init__(self, app):\n" 5445" Gtk.Window.__init__(self, title=\"Calculator\", application=app)\n" 5446" self.set_default_size(350, 200)\n" 5447" self.set_border_width(10)\n" 5448"\n" 5449" # an entry\n" 5450" self.entry = Gtk.Entry()\n" 5451" # with an initial text\n" 5452" self.entry.set_text('0')\n" 5453" # text aligned on the right\n" 5454" self.entry.set_alignment(1)\n" 5455" # the text in the entry cannot be modified writing in it\n" 5456" self.entry.set_can_focus(False)\n" 5457"\n" 5458" # a grid\n" 5459" grid = Gtk.Grid()\n" 5460" grid.set_row_spacing(5)\n" 5461"\n" 5462" # to attach the entry\n" 5463" grid.attach(self.entry, 0, 0, 1, 1)\n" 5464"\n" 5465" # the labels for the buttons\n" 5466" buttons = [7, 8, 9, '/',\n" 5467" 4, 5, 6, '*',\n" 5468" 1, 2, 3, '-',\n" 5469" 'C', 0, '=', '+']\n" 5470"\n" 5471" # each row is a ButtonBox, attached to the grid\n" 5472" for i in range(4):\n" 5473" hbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL)\n" 5474" hbox.set_spacing(5)\n" 5475" grid.attach(hbox, 0, i + 1, 1, 1)\n" 5476" # each ButtonBox has 4 buttons, connected to the callback function\n" 5477" for j in range(4):\n" 5478" button = Gtk.Button(label=buttons[i * 4 + j])\n" 5479" button.set_can_focus(False)\n" 5480" button.connect(\"clicked\", self.button_clicked)\n" 5481" hbox.add(button)\n" 5482"\n" 5483" # some variables for the calculations\n" 5484" self.first_number = 0\n" 5485" self.second_number = 0\n" 5486" self.counter = 0\n" 5487" self.operation = \"\"\n" 5488"\n" 5489" # add the grid to the window\n" 5490" self.add(grid)\n" 5491"\n" 5492" # callback function for all the buttons\n" 5493" def button_clicked(self, button):\n" 5494" # for the operations\n" 5495" if button.get_label() == '+':\n" 5496" self.counter += 1\n" 5497" if self.counter > 1:\n" 5498" self.do_operation()\n" 5499" self.entry.set_text('0')\n" 5500" self.operation = \"plus\"\n" 5501" elif button.get_label() == '-':\n" 5502" self.counter += 1\n" 5503" if self.counter > 1:\n" 5504" self.do_operation()\n" 5505" self.entry.set_text('0')\n" 5506" self.operation = \"minus\"\n" 5507" elif button.get_label() == '*':\n" 5508" self.counter += 1\n" 5509" if self.counter > 1:\n" 5510" self.do_operation()\n" 5511" self.entry.set_text('0')\n" 5512" self.operation = \"multiplication\"\n" 5513" elif button.get_label() == '/':\n" 5514" self.counter += 1\n" 5515" if self.counter > 1:\n" 5516" self.do_operation()\n" 5517" self.entry.set_text('0')\n" 5518" self.operation = \"division\"\n" 5519" # for =\n" 5520" elif button.get_label() == '=':\n" 5521" self.do_operation()\n" 5522" self.entry.set_text(str(self.first_number))\n" 5523" self.counter = 1\n" 5524" # for Cancel\n" 5525" elif button.get_label() == 'C':\n" 5526" self.first_number = 0\n" 5527" self.second_number = 0\n" 5528" self.counter = 0\n" 5529" self.entry.set_text('')\n" 5530" self.operation = \"\"\n" 5531" # for a digit button\n" 5532" else:\n" 5533" new_digit = int(button.get_label())\n" 5534" if self.entry.get_text() == 'error':\n" 5535" number = 0\n" 5536" else:\n" 5537" number = int(self.entry.get_text())\n" 5538" number = number * 10 + new_digit\n" 5539" if self.counter == 0:\n" 5540" self.first_number = number\n" 5541" else:\n" 5542" self.second_number = number\n" 5543" self.entry.set_text(str(number))\n" 5544"\n" 5545" def do_operation(self):\n" 5546" if self.operation == \"plus\":\n" 5547" self.first_number += self.second_number\n" 5548" elif self.operation == \"minus\":\n" 5549" self.first_number -= self.second_number\n" 5550" elif self.operation == \"multiplication\":\n" 5551" self.first_number *= self.second_number\n" 5552" elif self.operation == \"division\":\n" 5553" try:\n" 5554" self.first_number /= self.second_number\n" 5555" except ZeroDivisionError:\n" 5556" self.first_number = 0\n" 5557" self.second_number = 0\n" 5558" self.counter = 0\n" 5559" self.entry.set_text('error')\n" 5560" self.operation = \"\"\n" 5561" return\n" 5562" else:\n" 5563" self.first_number = 0\n" 5564" self.second_number = 0\n" 5565" self.counter = 0\n" 5566" self.entry.set_text('error')\n" 5567"\n" 5568"\n" 5569"class MyApplication(Gtk.Application):\n" 5570"\n" 5571" def __init__(self):\n" 5572" Gtk.Application.__init__(self)\n" 5573"\n" 5574" def do_activate(self):\n" 5575" win = MyWindow(self)\n" 5576" win.show_all()\n" 5577"\n" 5578" def do_startup(self):\n" 5579" Gtk.Application.do_startup(self)\n" 5580"\n" 5581"app = MyApplication()\n" 5582"exit_status = app.run(sys.argv)\n" 5583"sys.exit(exit_status)\n" 5584msgstr "" 5585 5586#. (itstool) path: section/title 5587#: C/buttonbox.py.page:36 5588#, fuzzy 5589msgid "Useful methods for a ButtonBox widget" 5590msgstr "Métodos úteis" 5591 5592#. (itstool) path: item/p 5593#: C/buttonbox.py.page:38 5594msgid "" 5595"The layout of the ButtonBox are set with <code>set_layout(layout)</code>, " 5596"where <code>layout</code> can be <code>Gtk.ButtonBoxStyle.SPREAD</code> " 5597"(buttons are evenly spread across the box), <code>Gtk.ButtonBoxStyle.EDGE</" 5598"code> (buttons are placed at the edges of the box), <code>Gtk.ButtonBoxStyle." 5599"START</code> (buttons are grouped towards the start of the box), <code>Gtk." 5600"ButtonBoxStyle.END</code> (buttons are grouped towards the end of the box), " 5601"<code>Gtk.ButtonBoxStyle.CENTER</code> (buttons are centered in the box)." 5602msgstr "" 5603 5604#. (itstool) path: item/p 5605#: C/buttonbox.py.page:39 5606msgid "" 5607"<code>set_child_secondary(button, is_secondary)</code> sets whether " 5608"<code>button</code> should appear in a secondary group of children. A " 5609"typical use of a secondary child is the help button in a dialog. This group " 5610"appears after the other children if the style is <code>START</code>, " 5611"<code>SPREAD</code> or <code>EDGE</code>, and before the other children if " 5612"the style is <code>END</code>. If the style is <code>START</code> or " 5613"<code>END</code>, then the secondary children are aligned at the other end " 5614"of the button box from the main children. For the other styles, they appear " 5615"immediately next to the main children." 5616msgstr "" 5617 5618#. (itstool) path: item/p 5619#: C/buttonbox.py.page:40 5620msgid "" 5621"<code>set_child_non_homogeneous(button, is_non_homogeneous)</code> sets " 5622"whether the child is exempted from homogeneous sizing. Default value is " 5623"<code>False</code>." 5624msgstr "" 5625 5626#. (itstool) path: item/p 5627#: C/buttonbox.py.page:41 5628msgid "" 5629"<code>set_spacing(spacing)</code> sets the spacing, in pixels, between the " 5630"buttons of the box." 5631msgstr "" 5632 5633#. (itstool) path: item/p 5634#: C/buttonbox.py.page:49 5635msgid "" 5636"<link href=\"http://developer.gnome.org/gtk3/stable/GtkButtonBox.html" 5637"\">GtkButtonBox</link>" 5638msgstr "" 5639"<link href=\"http://developer.gnome.org/gtk3/stable/GtkButtonBox.html" 5640"\">GtkButtonBox</link>" 5641 5642#. (itstool) path: item/p 5643#: C/buttonbox.py.page:50 5644msgid "" 5645"<link href=\"http://developer.gnome.org/gtk3/stable/GtkBox.html\">GtkBox</" 5646"link>" 5647msgstr "" 5648"<link href=\"http://developer.gnome.org/gtk3/stable/GtkBox.html\">GtkBox</" 5649"link>" 5650 5651#. (itstool) path: item/p 5652#: C/buttonbox.py.page:52 C/entry.c.page:34 5653msgid "" 5654"<link href=\"http://developer.gnome.org/gtk3/stable/GtkEntry.html" 5655"\">GtkEntry</link>" 5656msgstr "" 5657"<link href=\"http://developer.gnome.org/gtk3/stable/GtkEntry.html" 5658"\">GtkEntry</link>" 5659 5660#. (itstool) path: item/p 5661#: C/buttonbox.py.page:53 C/grid.c.page:36 C/radiobutton.c.page:37 5662#: C/spinbutton.c.page:40 C/statusbar.c.page:40 C/switch.c.page:37 5663#: C/togglebutton.c.page:40 5664msgid "" 5665"<link href=\"http://developer.gnome.org/gtk3/stable/GtkGrid.html\">GtkGrid</" 5666"link>" 5667msgstr "" 5668"<link href=\"http://developer.gnome.org/gtk3/stable/GtkGrid.html\">GtkGrid</" 5669"link>" 5670 5671#. (itstool) path: info/title 5672#: C/c.page:9 5673msgctxt "link" 5674msgid "C" 5675msgstr "C" 5676 5677#. (itstool) path: credit/name 5678#: C/c.page:18 5679msgid "Bastian Ilso" 5680msgstr "" 5681 5682#. (itstool) path: info/desc 5683#: C/c.page:24 5684#, fuzzy 5685#| msgid "Tutorials, code samples, platform demos and more" 5686msgid "Tutorials and code samples in C." 5687msgstr "Amostras de códigos e tutoriais" 5688 5689#. (itstool) path: page/title 5690#: C/c.page:27 5691#, fuzzy 5692msgid "Platform Demos in C" 5693msgstr "Demonstrativos da plataforma do GNOME" 5694 5695#. (itstool) path: section/title 5696#: C/c.page:31 5697msgid "Prerequisites" 5698msgstr "Pré-requisitos" 5699 5700#. (itstool) path: section/p 5701#: C/c.page:33 5702msgid "" 5703"To compile these platform demos you will need a C compiler, for example " 5704"<link href=\"https://gcc.gnu.org/\">gcc</link>. You will also need GTK+ 3 " 5705"including headers and pkg-config files. Linux distributions usually abstract " 5706"GTK+ 3 headers and pkg-config files into separate packages called <em>gtk3-" 5707"devel</em>, <em>gtk3-dev</em> or similar." 5708msgstr "" 5709 5710#. (itstool) path: section/title 5711#: C/c.page:44 5712#, fuzzy 5713msgid "Guidelines for new developers" 5714msgstr "Diretrizes" 5715 5716#. (itstool) path: section/p 5717#: C/c.page:46 5718msgid "" 5719"Beyond the prerequisites mentioned above, several tools has been developed " 5720"to assist you further in developing your GNOME application. GNOME also " 5721"recommends a specific coding style and conventions which this section will " 5722"elaborate further upon." 5723msgstr "" 5724 5725#. (itstool) path: section/title 5726#: C/c.page:52 5727#, fuzzy 5728msgid "Recommended tools" 5729msgstr "Não recomendado" 5730 5731#. (itstool) path: item/p 5732#: C/c.page:56 5733msgid "" 5734"<link href=\"https://wiki.gnome.org/Apps/Devhelp\">DevHelp</link>: An API " 5735"documentation browser for GNOME." 5736msgstr "" 5737 5738#. (itstool) path: item/p 5739#: C/c.page:60 5740msgid "" 5741"A GNOME IDE (Integrated Development Environment). An IDE can assist you in " 5742"writing and debugging C code, for example <link href=\"https://wiki.gnome." 5743"org/Apps/Builder\">Builder</link> or <link href=\"https://wiki.gnome.org/" 5744"Apps/Anjuta\">Anjuta</link>." 5745msgstr "" 5746 5747#. (itstool) path: item/p 5748#: C/c.page:66 5749msgid "" 5750"<link href=\"http://glade.gnome.org/\">Glade</link>: A user interface " 5751"designer for GTK+ Applications." 5752msgstr "" 5753 5754#. (itstool) path: item/p 5755#: C/c.page:70 5756msgid "" 5757"An IRC Client, for example <link href=\"https://wiki.gnome.org/Apps/Polari" 5758"\">Polari</link> or <link href=\"https://wiki.gnome.org/Apps/Empathy" 5759"\">Empathy</link>. If you run into problems while following the beginner " 5760"tutorials, join #gnome on <em>irc.gnome.org</em>." 5761msgstr "" 5762 5763#. (itstool) path: section/title 5764#: C/c.page:80 5765#, fuzzy 5766msgid "Coding Style" 5767msgstr "Estilo de codificação C" 5768 5769#. (itstool) path: section/p 5770#: C/c.page:82 5771msgid "" 5772"Most applications in the GNOME project is written in the <link href=\"http://" 5773"en.wikipedia.org/wiki/Indent_style#GNU_style\">GNU style</link> of " 5774"indentation. The tutorials and code examples presented are following this " 5775"convention and you are recommended to do so too." 5776msgstr "" 5777 5778#. (itstool) path: section/title 5779#: C/c.page:89 5780#, fuzzy 5781msgid "Executing Code" 5782msgstr "EXECUTANDO" 5783 5784#. (itstool) path: item/p 5785#: C/c.page:95 5786msgid "Copy and paste the code into <var>filename</var>.c" 5787msgstr "" 5788 5789#. (itstool) path: item/screen 5790#: C/c.page:99 5791#, no-wrap 5792msgid "gcc <var>filename</var>.c `pkg-config --cflags --libs gtk+-3.0` -o <var>filename</var>" 5793msgstr "" 5794 5795#. (itstool) path: note/p 5796#: C/c.page:105 5797msgid "" 5798"For more information about compiling GTK+ programs see <link href=\"http://" 5799"developer.gnome.org/gtk3/3.4/gtk-compiling.html\">Compiling GTK+ " 5800"Applications on UNIX</link>." 5801msgstr "" 5802 5803#. (itstool) path: section/title 5804#: C/c.page:117 5805#, fuzzy 5806#| msgid "Complete code sample" 5807msgid "Widget Code Examples" 5808msgstr "Demonstrações e exemplos de códigos" 5809 5810#. (itstool) path: info/title 5811#: C/checkbutton.c.page:8 5812msgctxt "text" 5813msgid "CheckButton (C)" 5814msgstr "CheckButton (C)" 5815 5816#. (itstool) path: info/desc 5817#: C/checkbutton.c.page:18 5818msgid "Create widgets with a discrete ToggleButton" 5819msgstr "" 5820 5821#. (itstool) path: page/title 5822#: C/checkbutton.c.page:21 C/checkbutton.js.page:21 C/checkbutton.py.page:22 5823#: C/checkbutton.vala.page:21 5824#, fuzzy 5825msgid "CheckButton" 5826msgstr "Botão de seleção" 5827 5828#. (itstool) path: page/media 5829#. This is a reference to an external file such as an image or video. When 5830#. the file changes, the md5 hash will change to let you know you need to 5831#. update your localized copy. The msgstr is not used at all. Set it to 5832#. whatever you like once you have updated your copy of the file. 5833#: C/checkbutton.c.page:22 C/checkbutton.js.page:22 C/checkbutton.py.page:23 5834#: C/checkbutton.vala.page:22 5835msgctxt "_" 5836msgid "" 5837"external ref='media/checkbutton.png' md5='7921a6812c87dd2b3781f4fad241e858'" 5838msgstr "" 5839"external ref='media/checkbutton.png' md5='7921a6812c87dd2b3781f4fad241e858'" 5840 5841#. (itstool) path: page/p 5842#: C/checkbutton.c.page:23 C/checkbutton.py.page:24 C/checkbutton.vala.page:23 5843#, fuzzy 5844msgid "This CheckButton toggles the title." 5845msgstr "Botão de seleção" 5846 5847#. (itstool) path: page/code 5848#: C/checkbutton.c.page:25 5849#, no-wrap 5850msgid "" 5851"#include <gtk/gtk.h>\n" 5852"\n" 5853"/* signal handler for \"toggled\" signal of the CheckButton */\n" 5854"static void\n" 5855"toggled_cb (GtkToggleButton *toggle_button,\n" 5856" gpointer user_data)\n" 5857"{\n" 5858" GtkWindow *window = user_data;\n" 5859"\n" 5860" if (gtk_toggle_button_get_active (toggle_button))\n" 5861" gtk_window_set_title (window, \"CheckButton Example\");\n" 5862" else\n" 5863" gtk_window_set_title (window, \"\");\n" 5864"}\n" 5865"\n" 5866"static void\n" 5867"activate (GtkApplication *app,\n" 5868" gpointer user_data)\n" 5869"{\n" 5870" GtkWidget *window;\n" 5871" GtkWidget *checkbutton;\n" 5872"\n" 5873" window = gtk_application_window_new (app);\n" 5874" gtk_window_set_title (GTK_WINDOW (window), \"CheckButton Example\");\n" 5875" gtk_window_set_default_size (GTK_WINDOW (window), 300, 100);\n" 5876"\n" 5877" checkbutton = gtk_check_button_new_with_label (\"Show Title\");\n" 5878" gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), TRUE);\n" 5879" g_signal_connect (GTK_TOGGLE_BUTTON (checkbutton), \"toggled\", G_CALLBACK (toggled_cb), window);\n" 5880" gtk_container_add (GTK_CONTAINER (window), checkbutton);\n" 5881" gtk_widget_show_all (window);\n" 5882"}\n" 5883"\n" 5884"int\n" 5885"main (int argc, char **argv)\n" 5886"{\n" 5887" GtkApplication *app;\n" 5888" int status;\n" 5889"\n" 5890" app = gtk_application_new (\"org.example.checkbutton\", G_APPLICATION_FLAGS_NONE);\n" 5891" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 5892" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 5893" g_object_unref (app);\n" 5894"\n" 5895" return status;\n" 5896"}\n" 5897msgstr "" 5898 5899#. (itstool) path: item/p 5900#: C/checkbutton.c.page:30 5901msgid "" 5902"<link href=\"http://developer.gnome.org/gtk3/3.2/GtkCheckButton.html" 5903"\">GtkCheckButton</link>" 5904msgstr "" 5905 5906#. (itstool) path: info/title 5907#: C/checkbutton.js.page:8 5908msgctxt "text" 5909msgid "CheckButton (JavaScript)" 5910msgstr "CheckButton (JavaScript)" 5911 5912#. (itstool) path: info/desc 5913#: C/checkbutton.js.page:18 5914msgid "A box which can be checked or unchecked" 5915msgstr "" 5916 5917#. (itstool) path: page/p 5918#: C/checkbutton.js.page:23 5919msgid "" 5920"This application has a CheckButton. Whether the box is checked dictates " 5921"whether the window's title bar shows anything." 5922msgstr "" 5923 5924#. (itstool) path: page/p 5925#: C/checkbutton.js.page:24 5926msgid "" 5927"A CheckButton sends the \"toggled\" signal when it's checked or unchecked. " 5928"While it's checked, the \"active\" property is true. While it's not, \"active" 5929"\" tests as false." 5930msgstr "" 5931 5932#. (itstool) path: section/title 5933#: C/checkbutton.js.page:28 C/comboboxtext.js.page:30 C/combobox.js.page:33 5934#: C/guitar-tuner.js.page:55 C/hello-world.js.page:53 C/hello-world.py.page:46 5935#: C/messagedialog.js.page:31 C/radiobutton.js.page:28 C/scale.js.page:28 5936#: C/spinbutton.js.page:31 C/statusbar.js.page:28 C/switch.js.page:35 5937#: C/textview.js.page:38 C/togglebutton.js.page:28 5938#: C/treeview_simple_liststore.js.page:37 C/weatherAppMain.js.page:41 5939#, fuzzy 5940msgid "Libraries to import" 5941msgstr "Bibliotecas" 5942 5943#. (itstool) path: section/code 5944#: C/checkbutton.js.page:29 5945#, fuzzy, no-wrap 5946#| msgid "" 5947#| "\n" 5948#| "#!/usr/bin/gjs\n" 5949#| "\n" 5950#| "const Gtk = imports.gi.Gtk;\n" 5951#| "const Lang = imports.lang;\n" 5952msgid "" 5953"\n" 5954"#!/usr/bin/gjs\n" 5955"\n" 5956"imports.gi.versions.Gtk = '3.0';\n" 5957"\n" 5958"const Gio = imports.gi.Gio;\n" 5959"const Gtk = imports.gi.Gtk;\n" 5960msgstr "" 5961"\n" 5962"#!/usr/bin/gjs\n" 5963"\n" 5964"const Gtk = imports.gi.Gtk;\n" 5965"const Lang = imports.lang;\n" 5966 5967#. (itstool) path: section/p 5968#: C/checkbutton.js.page:37 C/comboboxtext.js.page:37 C/combobox.js.page:42 5969#: C/messagedialog.js.page:39 C/radiobutton.js.page:36 C/scale.js.page:36 5970#: C/spinbutton.js.page:39 C/statusbar.js.page:36 C/switch.js.page:43 5971#: C/textview.js.page:45 C/togglebutton.js.page:36 5972#: C/treeview_simple_liststore.js.page:46 5973msgid "" 5974"These are the libraries we need to import for this application to run. " 5975"Remember that the line which tells GNOME that we're using Gjs always needs " 5976"to go at the start." 5977msgstr "" 5978 5979#. (itstool) path: section/title 5980#: C/checkbutton.js.page:41 C/comboboxtext.js.page:41 C/combobox.js.page:46 5981#: C/messagedialog.js.page:43 C/radiobutton.js.page:40 C/scale.js.page:40 5982#: C/spinbutton.js.page:43 C/statusbar.js.page:40 C/switch.js.page:47 5983#: C/textview.js.page:49 C/togglebutton.js.page:40 5984#: C/treeview_simple_liststore.js.page:50 5985#, fuzzy 5986msgid "Creating the application window" 5987msgstr "Criando janela de aplicativo" 5988 5989#. (itstool) path: section/code 5990#: C/checkbutton.js.page:42 5991#, fuzzy, no-wrap 5992#| msgid "" 5993#| "\n" 5994#| " // Create the application itself\n" 5995#| " _init: function () {\n" 5996#| " this.application = new Gtk.Application ();\n" 5997#| "\n" 5998#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 5999#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6000#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6001#| " },\n" 6002#| "\n" 6003#| " // Callback function for 'activate' signal presents windows when active\n" 6004#| " _onActivate: function () {\n" 6005#| " this._window.present ();\n" 6006#| " },\n" 6007#| "\n" 6008#| " // Callback function for 'startup' signal builds the UI\n" 6009#| " _onStartup: function () {\n" 6010#| " this._buildUI ();\n" 6011#| " },\n" 6012msgid "" 6013"\n" 6014"class CheckButtonExample {\n" 6015" // Create the application itself\n" 6016" constructor() {\n" 6017" this.application = new Gtk.Application({\n" 6018" application_id: 'org.example.jscheckbutton',\n" 6019" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 6020" });\n" 6021"\n" 6022" // Connect 'activate' and 'startup' signals to the callback functions\n" 6023" this.application.connect('activate', this._onActivate.bind(this));\n" 6024" this.application.connect('startup', this._onStartup.bind(this));\n" 6025" }\n" 6026"\n" 6027" // Callback function for 'activate' signal presents window when active\n" 6028" _onActivate() {\n" 6029" this._window.present();\n" 6030" }\n" 6031"\n" 6032" // Callback function for 'startup' signal builds the UI\n" 6033" _onStartup() {\n" 6034" this._buildUI ();\n" 6035" }\n" 6036msgstr "" 6037"\n" 6038" // Cria o aplicativo em si\n" 6039" _init: function () {\n" 6040" this.application = new Gtk.Application ();\n" 6041"\n" 6042" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 6043" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6044" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6045" },\n" 6046"\n" 6047" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 6048" _onActivate: function () {\n" 6049" this._window.present ();\n" 6050" },\n" 6051"\n" 6052" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 6053" _onStartup: function () {\n" 6054" this._buildUI ();\n" 6055" },\n" 6056 6057#. (itstool) path: section/p 6058#: C/checkbutton.js.page:66 6059msgid "" 6060"All the code for this sample goes in the CheckButtonExample class. The above " 6061"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 6062"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 6063"go in." 6064msgstr "" 6065 6066#. (itstool) path: section/code 6067#: C/checkbutton.js.page:67 6068#, fuzzy, no-wrap 6069#| msgid "" 6070#| "\n" 6071#| " // Build the application's UI\n" 6072#| " _buildUI: function() {\n" 6073#| "\n" 6074#| " // Create the application window\n" 6075#| " this._window = new Gtk.ApplicationWindow({\n" 6076#| " application: this.application,\n" 6077#| " window_position: Gtk.WindowPosition.CENTER,\n" 6078#| " border_width: 10,\n" 6079#| " title: \"Welcome to the Grid\"});\n" 6080msgid "" 6081"\n" 6082" // Build the application's UI\n" 6083" _buildUI() {\n" 6084"\n" 6085" // Create the application window\n" 6086" this._window = new Gtk.ApplicationWindow({\n" 6087" application: this.application,\n" 6088" window_position: Gtk.WindowPosition.CENTER,\n" 6089" default_height: 100,\n" 6090" default_width: 300,\n" 6091" border_width: 10,\n" 6092" title: \"CheckButton Example\"});\n" 6093msgstr "" 6094"\n" 6095" // Constrói a interface gráfica do aplicativo\n" 6096" _buildUI: function() {\n" 6097"\n" 6098" // Cria a janela do aplicativo\n" 6099" this._window = new Gtk.ApplicationWindow({\n" 6100" application: this.application,\n" 6101" window_position: Gtk.WindowPosition.CENTER,\n" 6102" border_width: 10,\n" 6103" title: \"Bem-vindo à Grid\"});\n" 6104 6105#. (itstool) path: section/p 6106#: C/checkbutton.js.page:80 6107msgid "" 6108"The _buildUI function is where we put all the code to create the " 6109"application's user interface. The first step is creating a new <link href=" 6110"\"GtkApplicationWindow.js.page\">Gtk.ApplicationWindow</link> to put all our " 6111"widgets into." 6112msgstr "" 6113 6114#. (itstool) path: section/title 6115#: C/checkbutton.js.page:84 6116#, fuzzy 6117msgid "Creating the checkbutton" 6118msgstr "Botão de seleção" 6119 6120#. (itstool) path: section/code 6121#: C/checkbutton.js.page:85 6122#, fuzzy, no-wrap 6123#| msgid "" 6124#| "\n" 6125#| " // Create the cookie button\n" 6126#| " this._cookieButton = new Gtk.Button ({ label: \"Get a cookie\" });\n" 6127#| "\n" 6128#| " // Connect the cookie button to the function that handles clicking it\n" 6129#| " this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n" 6130msgid "" 6131"\n" 6132" // Create the check button\n" 6133" this._button = new Gtk.CheckButton ({label: \"Show Title\"});\n" 6134" this._window.add (this._button);\n" 6135"\n" 6136" // Have the check button be checked by default\n" 6137" this._button.set_active (true);\n" 6138"\n" 6139" // Connect the button to a function that does something when it's toggled\n" 6140" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n" 6141msgstr "" 6142"\n" 6143" // Cria o botão do cookie\n" 6144" this._cookieButton = new Gtk.Button ({ label: \"Obter um cookie\" });\n" 6145"\n" 6146" // Conecta o botão do cookie à função que lida o clique nele\n" 6147" this._cookieButton.connect ('clicked', Lang.bind (this, this._getACookie));\n" 6148 6149#. (itstool) path: section/p 6150#: C/checkbutton.js.page:96 6151msgid "" 6152"This code creates the checkbutton itself. The label next to the checkbutton " 6153"is created by giving the checkbutton the \"label\" property and assigning a " 6154"string value to it. Since this checkbutton toggles whether the window title " 6155"is on or off, and the window title will be on to start with, we want the box " 6156"to be checked by default. Whenever the user checks or unchecks the box, we " 6157"call the _toggledCB function." 6158msgstr "" 6159 6160#. (itstool) path: section/code 6161#: C/checkbutton.js.page:97 6162#, fuzzy, no-wrap 6163#| msgid "" 6164#| "\n" 6165#| " // Put the webview into the window\n" 6166#| " this._window.add (this._webView);\n" 6167#| "\n" 6168#| " // Show the window and all child widgets\n" 6169#| " this._window.show_all();\n" 6170#| " },\n" 6171#| "\n" 6172#| "});\n" 6173msgid "" 6174"\n" 6175" // Show the window and all child widgets\n" 6176" this._window.show_all();\n" 6177" }\n" 6178msgstr "" 6179"\n" 6180" // Coloca o webview na janela\n" 6181" this._window.add (this._webView);\n" 6182"\n" 6183" // Mostra a janela e todos seus widgets filhos\n" 6184" this._window.show_all();\n" 6185" },\n" 6186"\n" 6187"});\n" 6188 6189#. (itstool) path: section/p 6190#: C/checkbutton.js.page:102 6191msgid "" 6192"This code finishes up creating the UI, by telling the window to show itself " 6193"and all child widgets (which is just the checkbutton in this case)." 6194msgstr "" 6195 6196#. (itstool) path: section/title 6197#: C/checkbutton.js.page:106 6198msgid "Function which handles the checkbutton's toggling" 6199msgstr "" 6200 6201#. (itstool) path: section/code 6202#: C/checkbutton.js.page:107 6203#, no-wrap 6204msgid "" 6205"\n" 6206" _toggledCB() {\n" 6207"\n" 6208" // Make the window title appear or disappear when the checkbox is toggled\n" 6209" if (this._button.get_active() == true)\n" 6210" this._window.set_title (\"CheckButton Example\");\n" 6211" else\n" 6212" this._window.set_title (\"\");\n" 6213"\n" 6214" }\n" 6215"\n" 6216"};\n" 6217msgstr "" 6218 6219#. (itstool) path: section/p 6220#: C/checkbutton.js.page:120 6221msgid "" 6222"If the checkbutton is toggled from on to off, we want the window title to " 6223"disappear. If it's toggled from off to on, we want it to reappear. We can " 6224"tell which way it was toggled by testing to see whether it's active " 6225"(checked) or not afterwards. A simple if / else statement which calls the " 6226"checkbutton's get_active() method will work for this." 6227msgstr "" 6228 6229#. (itstool) path: section/code 6230#: C/checkbutton.js.page:121 6231#, fuzzy, no-wrap 6232msgid "" 6233"\n" 6234"// Run the application\n" 6235"let app = new CheckButtonExample ();\n" 6236"app.application.run (ARGV);\n" 6237msgstr "" 6238"\n" 6239"// Executa o aplicativo\n" 6240"let app = new GettingTheSignal ();\n" 6241"app.application.run (ARGV);\n" 6242 6243#. (itstool) path: section/p 6244#: C/checkbutton.js.page:126 6245msgid "" 6246"Finally, we create a new instance of the finished CheckButtonExample class, " 6247"and set the application running." 6248msgstr "" 6249 6250#. (itstool) path: section/code 6251#: C/checkbutton.js.page:131 6252#, fuzzy, no-wrap 6253#| msgid "" 6254#| "#!/usr/bin/gjs\n" 6255#| "\n" 6256#| "const GLib = imports.gi.GLib;\n" 6257#| "const Gtk = imports.gi.Gtk;\n" 6258#| "const Lang = imports.lang;\n" 6259#| "const Webkit = imports.gi.WebKit;\n" 6260#| "\n" 6261#| "const HelloGNOME = new Lang.Class ({\n" 6262#| " Name: 'Hello GNOME',\n" 6263#| "\n" 6264#| " // Create the application itself\n" 6265#| " _init: function () {\n" 6266#| " this.application = new Gtk.Application ();\n" 6267#| "\n" 6268#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 6269#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6270#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6271#| " },\n" 6272#| "\n" 6273#| " // Callback function for 'activate' signal presents windows when active\n" 6274#| " _onActivate: function () {\n" 6275#| " this._window.present ();\n" 6276#| " },\n" 6277#| "\n" 6278#| " // Callback function for 'startup' signal builds the UI\n" 6279#| " _onStartup: function () {\n" 6280#| " this._buildUI ();\n" 6281#| " },\n" 6282#| "\n" 6283#| " // Build the application's UI\n" 6284#| " _buildUI: function () {\n" 6285#| "\n" 6286#| " // Create the application window\n" 6287#| " this._window = new Gtk.ApplicationWindow ({\n" 6288#| " application: this.application,\n" 6289#| " title: \"Welcome to GNOME\",\n" 6290#| " default_height: 200,\n" 6291#| " default_width: 400,\n" 6292#| " window_position: Gtk.WindowPosition.CENTER });\n" 6293#| "\n" 6294#| " // Create a webview to show the web app\n" 6295#| " this._webView = new Webkit.WebView ();\n" 6296#| "\n" 6297#| " // Put the web app into the webview\n" 6298#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 6299#| " \"/hellognome.html\", null));\n" 6300#| "\n" 6301#| " // Put the webview into the window\n" 6302#| " this._window.add (this._webView);\n" 6303#| "\n" 6304#| " // Show the window and all child widgets\n" 6305#| " this._window.show_all();\n" 6306#| " },\n" 6307#| "\n" 6308#| "});\n" 6309#| "\n" 6310#| "// Run the application\n" 6311#| "let app = new HelloGNOME ();\n" 6312#| "app.application.run (ARGV);\n" 6313msgid "" 6314"#!/usr/bin/gjs\n" 6315"\n" 6316"imports.gi.versions.Gtk = '3.0';\n" 6317"\n" 6318"const Gio = imports.gi.Gio;\n" 6319"const Gtk = imports.gi.Gtk;\n" 6320"\n" 6321"class CheckButtonExample {\n" 6322"\n" 6323" // Create the application itself\n" 6324" constructor() {\n" 6325" this.application = new Gtk.Application({\n" 6326" application_id: 'org.example.jscheckbutton',\n" 6327" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 6328" });\n" 6329"\n" 6330" // Connect 'activate' and 'startup' signals to the callback functions\n" 6331" this.application.connect('activate', this._onActivate.bind(this));\n" 6332" this.application.connect('startup', this._onStartup.bind(this));\n" 6333" }\n" 6334"\n" 6335" // Callback function for 'activate' signal presents window when active\n" 6336" _onActivate() {\n" 6337" this._window.present();\n" 6338" }\n" 6339"\n" 6340" // Callback function for 'startup' signal builds the UI\n" 6341" _onStartup() {\n" 6342" this._buildUI();\n" 6343" }\n" 6344"\n" 6345" // Build the application's UI\n" 6346" _buildUI() {\n" 6347"\n" 6348" // Create the application window\n" 6349" this._window = new Gtk.ApplicationWindow({\n" 6350" application: this.application,\n" 6351" window_position: Gtk.WindowPosition.CENTER,\n" 6352" default_height: 100,\n" 6353" default_width: 300,\n" 6354" border_width: 10,\n" 6355" title: \"CheckButton Example\"});\n" 6356"\n" 6357" // Create the check button\n" 6358" this._button = new Gtk.CheckButton ({label: \"Show Title\"});\n" 6359" this._window.add (this._button);\n" 6360"\n" 6361" // Have the check button be checked by default\n" 6362" this._button.set_active (true);\n" 6363"\n" 6364" // Connect the button to a function that does something when it's toggled\n" 6365" this._button.connect (\"toggled\", this._toggledCB.bind(this));\n" 6366"\n" 6367" // Show the window and all child widgets\n" 6368" this._window.show_all();\n" 6369" }\n" 6370"\n" 6371" _toggledCB() {\n" 6372"\n" 6373" // Make the window title appear or disappear when the checkbox is toggled\n" 6374" if (this._button.get_active() == true)\n" 6375" this._window.set_title (\"CheckButton Example\");\n" 6376" else\n" 6377" this._window.set_title (\"\");\n" 6378"\n" 6379" }\n" 6380"\n" 6381"};\n" 6382"\n" 6383"// Run the application\n" 6384"let app = new CheckButtonExample ();\n" 6385"app.application.run (ARGV);\n" 6386msgstr "" 6387"#!/usr/bin/gjs\n" 6388"\n" 6389"const GLib = imports.gi.GLib;\n" 6390"const Gtk = imports.gi.Gtk;\n" 6391"const Lang = imports.lang;\n" 6392"const Webkit = imports.gi.WebKit;\n" 6393"\n" 6394"const HelloGNOME = new Lang.Class ({\n" 6395" Name: 'Olá, GNOME',\n" 6396"\n" 6397" // Cria o aplicativo em si\n" 6398" _init: function () {\n" 6399" this.application = new Gtk.Application ();\n" 6400"\n" 6401" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 6402" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6403" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6404" },\n" 6405"\n" 6406" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 6407" _onActivate: function () {\n" 6408" this._window.present ();\n" 6409" },\n" 6410"\n" 6411" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 6412" _onStartup: function () {\n" 6413" this._buildUI ();\n" 6414" },\n" 6415"\n" 6416" // Constrói a interface gráfica do aplicativo\n" 6417" _buildUI: function () {\n" 6418"\n" 6419" // Cria a janela do aplicativo\n" 6420" this._window = new Gtk.ApplicationWindow ({\n" 6421" application: this.application,\n" 6422" title: \"Bem-vindo ao GNOME\",\n" 6423" default_height: 200,\n" 6424" default_width: 400,\n" 6425" window_position: Gtk.WindowPosition.CENTER });\n" 6426"\n" 6427" // Cria um webview para mostrar o aplicativo web\n" 6428" this._webView = new Webkit.WebView ();\n" 6429"\n" 6430" // Coloca o aplicativo web no webview\n" 6431" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 6432" \"/hellognome.html\", null));\n" 6433"\n" 6434" // Coloca o webview na janela\n" 6435" this._window.add (this._webView);\n" 6436"\n" 6437" // Mostra a janela e todos seus widgets filhos\n" 6438" this._window.show_all();\n" 6439" },\n" 6440"\n" 6441"});\n" 6442"\n" 6443"// Executa o aplicativo\n" 6444"let app = new HelloGNOME ();\n" 6445"app.application.run (ARGV);\n" 6446 6447#. (itstool) path: section/title 6448#: C/checkbutton.js.page:135 C/comboboxtext.js.page:176 C/combobox.js.page:233 6449#: C/messagedialog.js.page:189 C/radiobutton.js.page:274 C/scale.js.page:208 6450#: C/spinbutton.js.page:199 C/statusbar.js.page:221 C/switch.js.page:264 6451#: C/textview.js.page:248 C/togglebutton.js.page:153 6452#: C/treeview_simple_liststore.js.page:272 6453#, fuzzy 6454msgid "In-depth documentation" 6455msgstr "Em Detalhes" 6456 6457#. (itstool) path: item/p 6458#: C/checkbutton.js.page:139 6459msgid "" 6460"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.CheckButton." 6461"html\">Gtk.CheckButton</link>" 6462msgstr "" 6463 6464#. (itstool) path: info/title 6465#: C/checkbutton.py.page:8 6466msgctxt "text" 6467msgid "CheckButton (Python)" 6468msgstr "CheckButton (Python)" 6469 6470#. (itstool) path: info/desc 6471#: C/checkbutton.py.page:19 6472#, fuzzy 6473msgid "A toggle button in a window" 6474msgstr "Desenhar o botão de alternância como um botão de opção" 6475 6476#. (itstool) path: section/code 6477#: C/checkbutton.py.page:31 6478#, no-wrap 6479msgid "" 6480"from gi.repository import Gtk\n" 6481"import sys\n" 6482"\n" 6483"\n" 6484"class MyWindow(Gtk.ApplicationWindow):\n" 6485" # a window\n" 6486"\n" 6487" def __init__(self, app):\n" 6488" Gtk.Window.__init__(self, title=\"CheckButton Example\", application=app)\n" 6489" self.set_default_size(300, 100)\n" 6490" self.set_border_width(10)\n" 6491"\n" 6492" # a new checkbutton\n" 6493" button = Gtk.CheckButton()\n" 6494" # with a label\n" 6495" button.set_label(\"Show Title\")\n" 6496" # connect the signal \"toggled\" emitted by the checkbutton\n" 6497" # with the callback function toggled_cb\n" 6498" button.connect(\"toggled\", self.toggled_cb)\n" 6499" # by default, the checkbutton is active\n" 6500" button.set_active(True)\n" 6501"\n" 6502" # add the checkbutton to the window\n" 6503" self.add(button)\n" 6504"\n" 6505" # callback function\n" 6506" def toggled_cb(self, button):\n" 6507" # if the togglebutton is active, set the title of the window\n" 6508" # as \"Checkbutton Example\"\n" 6509" if button.get_active():\n" 6510" self.set_title(\"CheckButton Example\")\n" 6511" # else, set it as \"\" (empty string)\n" 6512" else:\n" 6513" self.set_title(\"\")\n" 6514"\n" 6515"\n" 6516"class MyApplication(Gtk.Application):\n" 6517"\n" 6518" def __init__(self):\n" 6519" Gtk.Application.__init__(self)\n" 6520"\n" 6521" def do_activate(self):\n" 6522" win = MyWindow(self)\n" 6523" win.show_all()\n" 6524"\n" 6525" def do_startup(self):\n" 6526" Gtk.Application.do_startup(self)\n" 6527"\n" 6528"app = MyApplication()\n" 6529"exit_status = app.run(sys.argv)\n" 6530"sys.exit(exit_status)\n" 6531msgstr "" 6532 6533#. (itstool) path: section/title 6534#: C/checkbutton.py.page:36 6535#, fuzzy 6536msgid "Useful methods for a CheckButton widget" 6537msgstr "Métodos úteis" 6538 6539#. (itstool) path: section/p 6540#: C/checkbutton.py.page:37 6541msgid "" 6542"In line 17 the <code>\"toggled\"</code> signal is connected to the callback " 6543"function <code>toggled_cb()</code> using <code><var>widget</var>." 6544"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 6545"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 6546msgstr "" 6547 6548#. (itstool) path: item/p 6549#: C/checkbutton.py.page:47 C/togglebutton.py.page:44 6550msgid "" 6551"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkToggleButton.html" 6552"\">GtkToggleButton</link>" 6553msgstr "" 6554"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkToggleButton.html" 6555"\">GtkToggleButton</link>" 6556 6557#. (itstool) path: item/p 6558#: C/checkbutton.py.page:48 6559msgid "" 6560"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCheckButton.html" 6561"\">GtkCheckButton</link>" 6562msgstr "" 6563"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCheckButton.html" 6564"\">GtkCheckButton</link>" 6565 6566#. (itstool) path: info/title 6567#: C/checkbutton.vala.page:8 6568msgctxt "text" 6569msgid "CheckButton (Vala)" 6570msgstr "CheckButton (Vala)" 6571 6572#. (itstool) path: info/desc 6573#: C/checkbutton.vala.page:18 6574msgid "Create widgets with a discrete toggle button" 6575msgstr "" 6576 6577#. (itstool) path: page/code 6578#: C/checkbutton.vala.page:25 6579#, no-wrap 6580msgid "" 6581"/* A window in the application */\n" 6582"class MyWindow : Gtk.ApplicationWindow {\n" 6583"\n" 6584"\t/* The constructor */\n" 6585"\tinternal MyWindow (MyApplication app) {\n" 6586"\t\tObject (application: app, title: \"CheckButton Example\");\n" 6587"\n" 6588"\t\tthis.set_default_size (300, 100);\n" 6589"\t\tthis.border_width = 10;\n" 6590"\n" 6591"\t\tvar checkbutton = new Gtk.CheckButton.with_label (\"Show Title\");\n" 6592"\n" 6593"\t\t/* Connect the checkbutton to the\n" 6594"\t\t * callback function (aka. signal handler).\n" 6595"\t\t */\n" 6596"\t\tcheckbutton.toggled.connect (this.toggled_cb);\n" 6597"\n" 6598"\t\t/* Add the button to the this window */\n" 6599"\t\tthis.add (checkbutton);\n" 6600"\n" 6601"\t\tcheckbutton.set_active (true);\n" 6602"\t\tcheckbutton.show ();\n" 6603"\t}\n" 6604"\n" 6605"\t/* The signal handler for the 'toggled' signal of the checkbutton. */\n" 6606"\tvoid toggled_cb (Gtk.ToggleButton checkbutton) {\n" 6607"\t\tif (checkbutton.get_active())\n" 6608"\t\t\tthis.set_title (\"CheckButton Example\");\n" 6609"\t\telse\n" 6610"\t\t\tthis.set_title (\"\");\n" 6611"\t}\n" 6612"}\n" 6613"\n" 6614"/* This is the application */\n" 6615"class MyApplication : Gtk.Application {\n" 6616"\n" 6617"\t/* The constructor */\n" 6618"\tinternal MyApplication () {\n" 6619"\t\tObject (application_id: \"org.example.checkbutton\");\n" 6620"\t}\n" 6621"\n" 6622"\t/* Override the activate signal of GLib.Application */\n" 6623"\tprotected override void activate () {\n" 6624"\t\tnew MyWindow (this).show ();\n" 6625"\t}\n" 6626"\n" 6627"}\n" 6628"\n" 6629"/* main creates and runs the application */\n" 6630"int main (string[] args) {\n" 6631"\treturn new MyApplication ().run (args);\n" 6632"}\n" 6633msgstr "" 6634 6635#. (itstool) path: item/p 6636#: C/checkbutton.vala.page:30 6637msgid "" 6638"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CheckButton.html\">Gtk." 6639"CheckButton</link>" 6640msgstr "" 6641 6642#. (itstool) path: info/title 6643#: C/colorbutton.js.page:8 6644msgctxt "text" 6645msgid "ColorButton (JavaScript)" 6646msgstr "ColorButton (JavaScript)" 6647 6648#. (itstool) path: info/desc 6649#: C/colorbutton.js.page:18 C/colorbutton.py.page:19 C/colorbutton.vala.page:20 6650msgid "A button to launch a color selection dialog" 6651msgstr "" 6652 6653#. (itstool) path: page/title 6654#: C/colorbutton.js.page:21 C/colorbutton.py.page:22 C/colorbutton.vala.page:23 6655msgid "ColorButton" 6656msgstr "" 6657 6658#. (itstool) path: page/media 6659#. This is a reference to an external file such as an image or video. When 6660#. the file changes, the md5 hash will change to let you know you need to 6661#. update your localized copy. The msgstr is not used at all. Set it to 6662#. whatever you like once you have updated your copy of the file. 6663#: C/colorbutton.js.page:22 C/colorbutton.py.page:23 C/colorbutton.vala.page:24 6664msgctxt "_" 6665msgid "" 6666"external ref='media/colorbutton.png' md5='904539d26fe367bf99f9a0961cfc9a03'" 6667msgstr "" 6668"external ref='media/colorbutton.png' md5='904539d26fe367bf99f9a0961cfc9a03'" 6669 6670#. (itstool) path: page/p 6671#: C/colorbutton.js.page:23 C/colorbutton.py.page:24 6672msgid "" 6673"This ColorButton launches a color selection dialog and prints in the " 6674"terminal the RGB values of the color selected." 6675msgstr "" 6676 6677#. (itstool) path: section/code 6678#: C/colorbutton.js.page:29 6679#, fuzzy, no-wrap 6680#| msgid "" 6681#| "#!/usr/bin/gjs\n" 6682#| "\n" 6683#| "const Gtk = imports.gi.Gtk;\n" 6684#| "const Lang = imports.lang;\n" 6685#| "\n" 6686#| "const WelcomeToTheGrid = new Lang.Class({\n" 6687#| " Name: 'Welcome to the Grid',\n" 6688#| "\n" 6689#| " // Create the application itself\n" 6690#| " _init: function() {\n" 6691#| " this.application = new Gtk.Application();\n" 6692#| "\n" 6693#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 6694#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6695#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6696#| " },\n" 6697#| "\n" 6698#| " // Callback function for 'activate' signal presents windows when active\n" 6699#| " _onActivate: function() {\n" 6700#| " this._window.present();\n" 6701#| " },\n" 6702#| "\n" 6703#| " // Callback function for 'startup' signal builds the UI\n" 6704#| " _onStartup: function() {\n" 6705#| " this._buildUI ();\n" 6706#| " },\n" 6707#| "\n" 6708#| "\n" 6709#| "\n" 6710#| " // Build the application's UI\n" 6711#| " _buildUI: function() {\n" 6712#| "\n" 6713#| " // Create the application window\n" 6714#| " this._window = new Gtk.ApplicationWindow({\n" 6715#| " application: this.application,\n" 6716#| " window_position: Gtk.WindowPosition.CENTER,\n" 6717#| " border_width: 10,\n" 6718#| " title: \"Welcome to the Grid\"});\n" 6719#| "\n" 6720#| " // Create the Grid\n" 6721#| " this._grid = new Gtk.Grid ({\n" 6722#| " // column_homogeneous: true,\n" 6723#| " // column_spacing: 20,\n" 6724#| " row_spacing: 20 });\n" 6725#| "\n" 6726#| " // Create an image\n" 6727#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 6728#| "\n" 6729#| " // Create a second image using a stock icon\n" 6730#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 6731#| "\n" 6732#| " // Create a label\n" 6733#| " this._label = new Gtk.Label ({\n" 6734#| " label: \"Welcome to GNOME, too!\",\n" 6735#| " /* margin_top: 20 */ });\n" 6736#| "\n" 6737#| " /* Create a second label\n" 6738#| " this._labelTwo = new Gtk.Label ({\n" 6739#| " label: \"The cake is a pie.\" }); */\n" 6740#| "\n" 6741#| " /* Create a button\n" 6742#| " this._button = new Gtk.Button ({\n" 6743#| " label: \"Welcome to GNOME, too!\"}); */\n" 6744#| "\n" 6745#| " // Attach the images and button to the grid\n" 6746#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 6747#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 6748#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 6749#| "\n" 6750#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 6751#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 6752#| "\n" 6753#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 6754#| "\n" 6755#| " // Add the grid to the window\n" 6756#| " this._window.add (this._grid);\n" 6757#| "\n" 6758#| " // Show the window and all child widgets\n" 6759#| " this._window.show_all();\n" 6760#| " }\n" 6761#| "\n" 6762#| "});\n" 6763#| "\n" 6764#| "// Run the application\n" 6765#| "let app = new WelcomeToTheGrid ();\n" 6766#| "app.application.run (ARGV);\n" 6767msgid "" 6768"#!/usr/bin/gjs\n" 6769"\n" 6770"imports.gi.versions.Gdk = '3.0';\n" 6771"imports.gi.versions.Gtk = '3.0';\n" 6772"\n" 6773"const Gdk = imports.gi.Gdk;\n" 6774"const GObject = imports.gi.GObject;\n" 6775"const Gtk = imports.gi.Gtk;\n" 6776"\n" 6777"class ColorbuttonExample {\n" 6778"\n" 6779" // Create the application itself\n" 6780" constructor() {\n" 6781" this.application = new Gtk.Application ({ application_id: 'org.example.jscolorbutton' });\n" 6782"\n" 6783" // Connect 'activate' and 'startup' signals to the callback functions\n" 6784" this.application.connect('activate', this._onActivate.bind(this));\n" 6785" this.application.connect('startup', this._onStartup.bind(this));\n" 6786" }\n" 6787"\n" 6788" // Callback function for 'activate' signal presents windows when active\n" 6789" _onActivate() {\n" 6790" this.window.present();\n" 6791" }\n" 6792"\n" 6793" // Callback function for 'startup' signal builds the UI\n" 6794" _onStartup() {\n" 6795" this._buildUI();\n" 6796" }\n" 6797"\n" 6798" // Build the application's UI\n" 6799" _buildUI() {\n" 6800"\n" 6801" // Create the application window\n" 6802" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n" 6803" window_position: Gtk.WindowPosition.CENTER,\n" 6804" title: \"ColorButton\",\n" 6805" default_width: 150,\n" 6806" default_height: 50,\n" 6807" border_width: 10 });\n" 6808"\n" 6809" this.button = new Gtk.ColorButton();\n" 6810" this.color = new Gdk.RGBA();\n" 6811" this.color.red = 0.0;\n" 6812" this.color.green = 0.0;\n" 6813" this.color.blue = 1.0;\n" 6814" this.color.alpha = 0.5;\n" 6815" this.button.set_rgba(this.color);\n" 6816" this.button.connect(\"color-set\", this.onColorChosen.bind(this));\n" 6817" this.label = new Gtk.Label();\n" 6818" this.label.set_text(\"Click to choose a color\");\n" 6819"\n" 6820" let grid = new Gtk.Grid();\n" 6821" grid.attach(this.button, 0, 0, 2, 1);\n" 6822" grid.attach(this.label, 0, 1, 2, 1);\n" 6823" this.window.add(grid);\n" 6824" this.window.show_all();\n" 6825" }\n" 6826"\n" 6827" onColorChosen() {\n" 6828" let colorName = this.color.to_string();\n" 6829" this.label.set_text(\"You chose the color \" + colorName);\n" 6830" }\n" 6831"};\n" 6832"\n" 6833"// Run the application\n" 6834"let app = new ColorbuttonExample ();\n" 6835"app.application.run (ARGV);\n" 6836msgstr "" 6837"#!/usr/bin/gjs\n" 6838"\n" 6839"const Gtk = imports.gi.Gtk;\n" 6840"const Lang = imports.lang;\n" 6841"\n" 6842"const WelcomeToTheGrid = new Lang.Class({\n" 6843" Name: 'Bem-vindo à Grid',\n" 6844"\n" 6845" // Cria o aplicativo em si\n" 6846" _init: function() {\n" 6847" this.application = new Gtk.Application();\n" 6848"\n" 6849" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 6850" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 6851" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 6852" },\n" 6853"\n" 6854" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 6855" _onActivate: function() {\n" 6856" this._window.present();\n" 6857" },\n" 6858"\n" 6859" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 6860" _onStartup: function() {\n" 6861" this._buildUI ();\n" 6862" },\n" 6863"\n" 6864"\n" 6865"\n" 6866" // Constrói a interface gráfica do aplicativo\n" 6867" _buildUI: function() {\n" 6868"\n" 6869" // Cria a janela do aplicativo\n" 6870" this._window = new Gtk.ApplicationWindow({\n" 6871" application: this.application,\n" 6872" window_position: Gtk.WindowPosition.CENTER,\n" 6873" border_width: 10,\n" 6874" title: \"Bem-vindo à Grid\"});\n" 6875"\n" 6876" // Cria a Grid\n" 6877" this._grid = new Gtk.Grid ({\n" 6878" // column_homogeneous: true,\n" 6879" // column_spacing: 20,\n" 6880" row_spacing: 20 });\n" 6881"\n" 6882" // Cria uma imagem\n" 6883" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 6884"\n" 6885" // Cria uma segunda imagem usando um ícone padrão\n" 6886" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 6887"\n" 6888" // Cria um rótulo\n" 6889" this._label = new Gtk.Label ({\n" 6890" label: \"Bem-vindo ao GNOME, também!\",\n" 6891" /* margin_top: 20 */ });\n" 6892"\n" 6893" /* Cria um segundo rótulo\n" 6894" this._labelTwo = new Gtk.Label ({\n" 6895" label: \"O bolo é uma torta.\" }); */\n" 6896"\n" 6897" /* Cria um botão\n" 6898" this._button = new Gtk.Button ({\n" 6899" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 6900"\n" 6901" // Anexa as imagens e botão à grade\n" 6902" this._grid.attach (this._image, 0, 0, 2, 1);\n" 6903" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 6904" this._grid.attach (this._label, 1, 1, 1, 1);\n" 6905"\n" 6906" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 6907" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 6908"\n" 6909" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 6910"\n" 6911" // Adiciona a grade à janela\n" 6912" this._window.add (this._grid);\n" 6913"\n" 6914" // Mostra a janela e todos os widgets filhos\n" 6915" this._window.show_all();\n" 6916" }\n" 6917"\n" 6918"});\n" 6919"\n" 6920"// Executa o aplicativo\n" 6921"let app = new WelcomeToTheGrid ();\n" 6922"app.application.run (ARGV);\n" 6923 6924#. (itstool) path: item/p 6925#: C/colorbutton.js.page:36 6926msgid "" 6927"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.ColorButton." 6928"html\">GtkColorButton</link>" 6929msgstr "" 6930 6931#. (itstool) path: item/p 6932#: C/colorbutton.js.page:37 C/colorbutton.py.page:45 6933msgid "" 6934"<link href=\"http://developer.gnome.org/gdk3/stable/gdk3-RGBA-Colors.html" 6935"\">RGBA Colors</link>" 6936msgstr "" 6937 6938#. (itstool) path: info/title 6939#: C/colorbutton.py.page:8 6940msgctxt "text" 6941msgid "ColorButton (Python)" 6942msgstr "ColorButton (Python)" 6943 6944#. (itstool) path: section/code 6945#: C/colorbutton.py.page:30 6946#, no-wrap 6947msgid "" 6948"from gi.repository import Gtk\n" 6949"from gi.repository import Gdk\n" 6950"import sys\n" 6951"\n" 6952"\n" 6953"class MyWindow(Gtk.ApplicationWindow):\n" 6954"\n" 6955" def __init__(self, app):\n" 6956" Gtk.Window.__init__(self, title=\"ColorButton\", application=app)\n" 6957" self.set_default_size(150, 50)\n" 6958" self.set_border_width(10)\n" 6959"\n" 6960" # a colorbutton (which opens a dialogue window in\n" 6961" # which we choose a color)\n" 6962" self.button = Gtk.ColorButton()\n" 6963" # with a default color (blue, in this instance)\n" 6964" color = Gdk.RGBA()\n" 6965" color.red = 0.0\n" 6966" color.green = 0.0\n" 6967" color.blue = 1.0\n" 6968" color.alpha = 0.5\n" 6969" self.button.set_rgba(color)\n" 6970"\n" 6971" # choosing a color in the dialogue window emits a signal\n" 6972" self.button.connect(\"color-set\", self.on_color_chosen)\n" 6973"\n" 6974" # a label\n" 6975" label = Gtk.Label()\n" 6976" label.set_text(\"Click to choose a color\")\n" 6977"\n" 6978" # a grid to attach button and label\n" 6979" grid = Gtk.Grid()\n" 6980" grid.attach(self.button, 0, 0, 2, 1)\n" 6981" grid.attach(label, 0, 1, 2, 1)\n" 6982" self.add(grid)\n" 6983"\n" 6984" # if a new color is chosen, we print it as rgb(r,g,b) in the terminal\n" 6985" def on_color_chosen(self, user_data):\n" 6986" print(\"You chose the color: \" + self.button.get_rgba().to_string())\n" 6987"\n" 6988"\n" 6989"class MyApplication(Gtk.Application):\n" 6990"\n" 6991" def __init__(self):\n" 6992" Gtk.Application.__init__(self)\n" 6993"\n" 6994" def do_activate(self):\n" 6995" win = MyWindow(self)\n" 6996" win.show_all()\n" 6997"\n" 6998" def do_startup(self):\n" 6999" Gtk.Application.do_startup(self)\n" 7000"\n" 7001"app = MyApplication()\n" 7002"exit_status = app.run(sys.argv)\n" 7003"sys.exit(exit_status)\n" 7004msgstr "" 7005 7006#. (itstool) path: section/title 7007#: C/colorbutton.py.page:34 7008#, fuzzy 7009msgid "Useful methods for a ColorButton widget" 7010msgstr "Métodos úteis" 7011 7012#. (itstool) path: section/p 7013#: C/colorbutton.py.page:35 7014msgid "" 7015"<code>set_color(color)</code>, where the <code>color</code> is defined as in " 7016"the example, sets the color of the ColorButton, which by default is black. " 7017"<code>get_color()</code> returns the color." 7018msgstr "" 7019 7020#. (itstool) path: section/p 7021#: C/colorbutton.py.page:36 7022msgid "" 7023"In line 23 the <code>\"color-set\"</code> signal is connected to the " 7024"callback function <code>on_color_chosen()</code> using <code><var>widget</" 7025"var>.connect(<var>signal</var>, <var>callback function</var>)</code>. See " 7026"<link xref=\"signals-callbacks.py\"/> for a more detailed explanation." 7027msgstr "" 7028 7029#. (itstool) path: item/p 7030#: C/colorbutton.py.page:43 7031msgid "" 7032"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkColorButton.html" 7033"\">GtkColorButton</link>" 7034msgstr "" 7035 7036#. (itstool) path: item/p 7037#: C/colorbutton.py.page:44 7038msgid "" 7039"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkColorChooser.html" 7040"\">GtkColorChooser</link>" 7041msgstr "" 7042 7043#. (itstool) path: info/title 7044#: C/colorbutton.vala.page:8 7045msgctxt "text" 7046msgid "ColorButton (Vala)" 7047msgstr "ColorButton (Vala)" 7048 7049#. (itstool) path: page/p 7050#: C/colorbutton.vala.page:25 7051msgid "RGB values of the selected color are shown in the label." 7052msgstr "" 7053 7054#. (itstool) path: page/code 7055#: C/colorbutton.vala.page:27 7056#, no-wrap 7057msgid "" 7058"/* This is the application. */\n" 7059"public class MyApplication : Gtk.Application {\n" 7060"\tGtk.Label label;\n" 7061"\n" 7062"\t/* Override the 'activate' signal of GLib.Application. */\n" 7063"\tprotected override void activate () {\n" 7064"\t\t/* Create the window of this application and show it. */\n" 7065"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 7066"\t\twindow.title = \"ColorButton\";\n" 7067"\t\twindow.set_default_size (150, 50);\n" 7068"\t\twindow.set_border_width (10);\n" 7069"\n" 7070"\t\t/* Create a new ColorButton with default blue. */\n" 7071"\t\tvar blue = Gdk.RGBA ();\n" 7072"\t\tblue.parse (\"blue\");\n" 7073"\t\tvar colorbutton = new Gtk.ColorButton.with_rgba (blue);\n" 7074"\n" 7075"\t\tlabel = new Gtk.Label (\"Click to choose a color\");\n" 7076"\n" 7077"\t\tvar grid = new Gtk.Grid ();\n" 7078"\t\tgrid.attach (colorbutton, 0, 0, 1, 1);\n" 7079"\t\tgrid.attach_next_to (label, colorbutton, Gtk.PositionType.BOTTOM, 1, 1);\n" 7080"\n" 7081"\t\tcolorbutton.color_set.connect (this.on_color_set);\n" 7082"\n" 7083"\t\twindow.add (grid);\n" 7084"\t\twindow.show_all ();\n" 7085"\t}\n" 7086"\n" 7087"\tvoid on_color_set (Gtk.ColorButton button) {\n" 7088"\t\tvar color = button.get_rgba ();\n" 7089"\t\tlabel.set_text (\"RGBA: \" + color.to_string());\n" 7090"\t}\n" 7091"}\n" 7092"\n" 7093"/* main creates and runs the application. */\n" 7094"public int main (string[] args) {\n" 7095"\treturn new MyApplication ().run (args);\n" 7096"}\n" 7097msgstr "" 7098 7099#. (itstool) path: item/p 7100#: C/colorbutton.vala.page:32 7101msgid "" 7102"<link href=\"http://valadoc.org/gtk+-3.0/Gtk.ColorButton.html\">Gtk." 7103"ColorButton</link>" 7104msgstr "" 7105 7106#. (itstool) path: item/p 7107#: C/colorbutton.vala.page:33 7108msgid "<link href=\"http://valadoc.org/gdk-3.0/Gdk.RGBA.html\">Gdk.RGBA</link>" 7109msgstr "" 7110 7111#. (itstool) path: info/title 7112#: C/comboboxtext.js.page:8 7113msgctxt "text" 7114msgid "ComboBoxText (JavaScript)" 7115msgstr "ComboBoxText (JavaScript)" 7116 7117#. (itstool) path: info/desc 7118#: C/comboboxtext.js.page:20 7119#, fuzzy 7120msgid "A text-only drop-down menu" 7121msgstr "Menu suspenso" 7122 7123#. (itstool) path: page/title 7124#: C/comboboxtext.js.page:23 7125#, fuzzy 7126msgid "ComboBoxText" 7127msgstr "ComboBoxText com uma entrada" 7128 7129#. (itstool) path: page/media 7130#. This is a reference to an external file such as an image or video. When 7131#. the file changes, the md5 hash will change to let you know you need to 7132#. update your localized copy. The msgstr is not used at all. Set it to 7133#. whatever you like once you have updated your copy of the file. 7134#: C/comboboxtext.js.page:24 C/combobox.c.page:26 C/combobox.py.page:24 7135#: C/combobox.vala.page:22 7136msgctxt "_" 7137msgid "" 7138"external ref='media/combobox.png' md5='ab9e91bc1a58fe866cb00dd52159251d'" 7139msgstr "" 7140"external ref='media/combobox.png' md5='ab9e91bc1a58fe866cb00dd52159251d'" 7141 7142#. (itstool) path: page/p 7143#: C/comboboxtext.js.page:25 7144msgid "" 7145"A ComboBox is a drop-down menu. The difference between a <link xref=" 7146"\"combobox.js\">ComboBox</link> and a ComboBoxText is that a ComboBoxText " 7147"just has basic text options, while a full ComboBox uses a ListStore or " 7148"TreeStore (which are basically spreadsheets) to show things like branching " 7149"options, or pictures to go alongside each choice." 7150msgstr "" 7151 7152#. (itstool) path: note/p 7153#: C/comboboxtext.js.page:26 7154msgid "" 7155"Unless you need the added features of a full ComboBox, or are comfortable " 7156"working with ListStores and TreeStores, you may find it a lot simpler to use " 7157"a ComboBoxText whenever possible." 7158msgstr "" 7159 7160#. (itstool) path: section/code 7161#: C/comboboxtext.js.page:31 C/textview.js.page:39 7162#, no-wrap 7163msgid "" 7164"\n" 7165"#!/usr/bin/gjs\n" 7166"\n" 7167"const Gtk = imports.gi.Gtk;\n" 7168"const Lang = imports.lang;\n" 7169msgstr "" 7170"\n" 7171"#!/usr/bin/gjs\n" 7172"\n" 7173"const Gtk = imports.gi.Gtk;\n" 7174"const Lang = imports.lang;\n" 7175 7176#. (itstool) path: section/code 7177#: C/comboboxtext.js.page:42 7178#, no-wrap 7179msgid "" 7180"\n" 7181"const ComboBoxTextExample = new Lang.Class ({\n" 7182" Name: 'ComboBoxText Example',\n" 7183"\n" 7184" // Create the application itself\n" 7185" _init: function () {\n" 7186" this.application = new Gtk.Application ({\n" 7187" application_id: 'org.example.jscomboboxtext'});\n" 7188"\n" 7189" // Connect 'activate' and 'startup' signals to the callback functions\n" 7190" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 7191" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 7192" },\n" 7193"\n" 7194" // Callback function for 'activate' signal presents windows when active\n" 7195" _onActivate: function () {\n" 7196" this._window.present ();\n" 7197" },\n" 7198"\n" 7199" // Callback function for 'startup' signal builds the UI\n" 7200" _onStartup: function () {\n" 7201" this._buildUI ();\n" 7202" },\n" 7203msgstr "" 7204 7205#. (itstool) path: section/p 7206#: C/comboboxtext.js.page:66 C/messagedialog.js.page:70 7207msgid "" 7208"All the code for this sample goes in the MessageDialogExample class. The " 7209"above code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/" 7210"gjs/Gtk.Application.html\">Gtk.Application</link> for our widgets and window " 7211"to go in." 7212msgstr "" 7213 7214#. (itstool) path: section/code 7215#: C/comboboxtext.js.page:67 7216#, no-wrap 7217msgid "" 7218"\n" 7219" // Build the application's UI\n" 7220" _buildUI: function () {\n" 7221"\n" 7222" // Create the application window\n" 7223" this._window = new Gtk.ApplicationWindow ({\n" 7224" application: this.application,\n" 7225" window_position: Gtk.WindowPosition.CENTER,\n" 7226" title: \"Welcome to GNOME\",\n" 7227" default_width: 200,\n" 7228" border_width: 10 });\n" 7229msgstr "" 7230 7231#. (itstool) path: section/p 7232#: C/comboboxtext.js.page:79 C/combobox.js.page:83 C/messagedialog.js.page:84 7233#: C/radiobutton.js.page:79 C/scale.js.page:78 C/spinbutton.js.page:81 7234#: C/switch.js.page:88 C/textview.js.page:88 C/togglebutton.js.page:81 7235#: C/treeview_simple_liststore.js.page:90 7236msgid "" 7237"The _buildUI function is where we put all the code to create the " 7238"application's user interface. The first step is creating a new <link xref=" 7239"\"GtkApplicationWindow.js\">Gtk.ApplicationWindow</link> to put all our " 7240"widgets into." 7241msgstr "" 7242 7243#. (itstool) path: section/title 7244#: C/comboboxtext.js.page:83 7245#, fuzzy 7246msgid "Creating the ComboBoxText" 7247msgstr "ComboBoxText com uma entrada" 7248 7249#. (itstool) path: section/code 7250#: C/comboboxtext.js.page:84 7251#, no-wrap 7252msgid "" 7253"\n" 7254" // Create the combobox\n" 7255" this._comboBoxText = new Gtk.ComboBoxText();\n" 7256"\n" 7257" // Populate the combobox\n" 7258" let distros = [\"Select distribution\", \"Fedora\", \"Mint\", \"Suse\"];\n" 7259" for (let i = 0; i < distros.length; i++)\n" 7260" this._comboBoxText.append_text (distros[i]);\n" 7261" this._comboBoxText.set_active (0);\n" 7262"\n" 7263" // Connect the combobox's 'changed' signal to our callback function\n" 7264" this._comboBoxText.connect ('changed', Lang.bind (this, this._onComboChanged));\n" 7265msgstr "" 7266 7267#. (itstool) path: section/p 7268#: C/comboboxtext.js.page:97 7269msgid "" 7270"After we create the ComboBoxText, we use its <file>append_text</file> method " 7271"to add text strings to it. Like the entries in an array, they each have a " 7272"number for an ID, starting with 0. To make things simpler, you can actually " 7273"create an array for your ComboBoxText entries, then use a for loop to append " 7274"them in order, like we did here." 7275msgstr "" 7276 7277#. (itstool) path: section/p 7278#: C/comboboxtext.js.page:98 7279msgid "" 7280"After we populate the ComboBoxText, we set its first entry to be active, so " 7281"that we'll see the \"Select distribution\" line before we click on it. Then " 7282"we connect its <file>changed</file> signal to the _onComboChanged function, " 7283"so that it's called whenever you make a new selection from the drop-down " 7284"menu." 7285msgstr "" 7286 7287#. (itstool) path: note/p 7288#: C/comboboxtext.js.page:99 7289msgid "" 7290"If you'd like to add an entry to a ComboBoxText, you can use the " 7291"<file>insert_text</file> method. And if you'd rather use a text string as an " 7292"ID for each entry than rely on numbers alone, you can use the <file>append</" 7293"file> and <file>insert</file> methods. See the links at the bottom of this " 7294"tutorial for the details of how to use them." 7295msgstr "" 7296 7297#. (itstool) path: section/code 7298#: C/comboboxtext.js.page:101 7299#, no-wrap 7300msgid "" 7301"\n" 7302" // Add the combobox to the window\n" 7303" this._window.add (this._comboBoxText);\n" 7304"\n" 7305" // Show the window and all child widgets\n" 7306" this._window.show_all();\n" 7307" },\n" 7308msgstr "" 7309 7310#. (itstool) path: section/p 7311#: C/comboboxtext.js.page:109 7312msgid "" 7313"Finally, we add the ComboBoxText to the window, and tell the window to show " 7314"itself and the widget inside it." 7315msgstr "" 7316 7317#. (itstool) path: section/title 7318#: C/comboboxtext.js.page:113 C/combobox.js.page:170 C/radiobutton.js.page:181 7319msgid "Function which handles your selection" 7320msgstr "" 7321 7322#. (itstool) path: section/code 7323#: C/comboboxtext.js.page:114 7324#, no-wrap 7325msgid "" 7326"\n" 7327" _onComboChanged: function () {\n" 7328"\n" 7329" // The responses we'll use for our messagedialog\n" 7330" let responses = [\"\",\n" 7331" \"Fedora is a community distro sponsored by Red Hat.\",\n" 7332" \"Mint is a popular distro based on Ubuntu.\",\n" 7333" \"SUSE is a name shared by two separate distros.\"];\n" 7334msgstr "" 7335 7336#. (itstool) path: section/p 7337#: C/comboboxtext.js.page:123 7338msgid "" 7339"We're going to create a pop-up <link xref=\"messagedialog.js" 7340"\">MessageDialog</link>, which shows you a message based on which distro you " 7341"select. First, we create the array of responses to use. Since the first " 7342"string in our ComboBoxText is just the \"Select distribution\" message, we " 7343"make the first string in our array blank." 7344msgstr "" 7345 7346#. (itstool) path: section/code 7347#: C/comboboxtext.js.page:125 7348#, no-wrap 7349msgid "" 7350"\n" 7351" // Which combobox item is active?\n" 7352" let activeItem = this._comboBoxText.get_active();\n" 7353"\n" 7354" // No messagedialog if you chose \"Select distribution\"\n" 7355" if (activeItem != 0) {\n" 7356" this._popUp = new Gtk.MessageDialog ({\n" 7357" transient_for: this._window,\n" 7358" modal: true,\n" 7359" buttons: Gtk.ButtonsType.OK,\n" 7360" message_type: Gtk.MessageType.INFO,\n" 7361" text: responses[activeItem]});\n" 7362"\n" 7363" // Connect the OK button to a handler function\n" 7364" this._popUp.connect ('response', Lang.bind (this, this._onDialogResponse));\n" 7365"\n" 7366" // Show the messagedialog\n" 7367" this._popUp.show();\n" 7368" }\n" 7369"\n" 7370" },\n" 7371msgstr "" 7372 7373#. (itstool) path: section/p 7374#: C/comboboxtext.js.page:147 7375msgid "" 7376"Before showing a MessageDialog, we first test to make sure you didn't choose " 7377"the \"Select distribution\" message. After that, we set its text to be the " 7378"entry in the array that corresponds to the active entry in our ComboBoxText. " 7379"We do that using the <file>get_active</file> method, which returns the " 7380"number ID of your selection." 7381msgstr "" 7382 7383#. (itstool) path: note/p 7384#: C/comboboxtext.js.page:148 7385msgid "" 7386"Other methods you can use include <file>get_active_id,</file> which returns " 7387"the text ID assigned by <file>append,</file> and <file>get_active_text,</" 7388"file> which returns the full text of the string you selected." 7389msgstr "" 7390 7391#. (itstool) path: section/p 7392#: C/comboboxtext.js.page:149 C/combobox.js.page:206 7393msgid "" 7394"After we create the MessageDialog, we connect its response signal to the " 7395"_onDialogResponse function, then tell it to show itself." 7396msgstr "" 7397 7398#. (itstool) path: section/code 7399#: C/comboboxtext.js.page:151 7400#, fuzzy, no-wrap 7401msgid "" 7402"\n" 7403" _onDialogResponse: function () {\n" 7404"\n" 7405" this._popUp.destroy ();\n" 7406"\n" 7407" }\n" 7408"\n" 7409"});\n" 7410msgstr "A função <function>car</function> " 7411 7412#. (itstool) path: section/p 7413#: C/comboboxtext.js.page:160 C/combobox.js.page:217 7414msgid "" 7415"Since the only button the MessageDialog has is an OK button, we don't need " 7416"to test its response_id to see which button was clicked. All we do here is " 7417"destroy the popup." 7418msgstr "" 7419 7420#. (itstool) path: section/code 7421#: C/comboboxtext.js.page:162 7422#, fuzzy, no-wrap 7423msgid "" 7424"\n" 7425"// Run the application\n" 7426"let app = new ComboBoxTextExample ();\n" 7427"app.application.run (ARGV);\n" 7428msgstr "" 7429"\n" 7430"// Executa o aplicativo\n" 7431"let app = new GettingTheSignal ();\n" 7432"app.application.run (ARGV);\n" 7433 7434#. (itstool) path: section/p 7435#: C/comboboxtext.js.page:167 7436msgid "" 7437"Finally, we create a new instance of the finished ComboBoxTextExample class, " 7438"and set the application running." 7439msgstr "" 7440 7441#. (itstool) path: section/code 7442#: C/comboboxtext.js.page:172 7443#, fuzzy, no-wrap 7444#| msgid "" 7445#| "#!/usr/bin/gjs\n" 7446#| "\n" 7447#| "const Gtk = imports.gi.Gtk;\n" 7448#| "const Lang = imports.lang;\n" 7449#| "\n" 7450#| "const WelcomeToTheGrid = new Lang.Class({\n" 7451#| " Name: 'Welcome to the Grid',\n" 7452#| "\n" 7453#| " // Create the application itself\n" 7454#| " _init: function() {\n" 7455#| " this.application = new Gtk.Application();\n" 7456#| "\n" 7457#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 7458#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 7459#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 7460#| " },\n" 7461#| "\n" 7462#| " // Callback function for 'activate' signal presents windows when active\n" 7463#| " _onActivate: function() {\n" 7464#| " this._window.present();\n" 7465#| " },\n" 7466#| "\n" 7467#| " // Callback function for 'startup' signal builds the UI\n" 7468#| " _onStartup: function() {\n" 7469#| " this._buildUI ();\n" 7470#| " },\n" 7471#| "\n" 7472#| "\n" 7473#| "\n" 7474#| " // Build the application's UI\n" 7475#| " _buildUI: function() {\n" 7476#| "\n" 7477#| " // Create the application window\n" 7478#| " this._window = new Gtk.ApplicationWindow({\n" 7479#| " application: this.application,\n" 7480#| " window_position: Gtk.WindowPosition.CENTER,\n" 7481#| " border_width: 10,\n" 7482#| " title: \"Welcome to the Grid\"});\n" 7483#| "\n" 7484#| " // Create the Grid\n" 7485#| " this._grid = new Gtk.Grid ({\n" 7486#| " // column_homogeneous: true,\n" 7487#| " // column_spacing: 20,\n" 7488#| " row_spacing: 20 });\n" 7489#| "\n" 7490#| " // Create an image\n" 7491#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 7492#| "\n" 7493#| " // Create a second image using a stock icon\n" 7494#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 7495#| "\n" 7496#| " // Create a label\n" 7497#| " this._label = new Gtk.Label ({\n" 7498#| " label: \"Welcome to GNOME, too!\",\n" 7499#| " /* margin_top: 20 */ });\n" 7500#| "\n" 7501#| " /* Create a second label\n" 7502#| " this._labelTwo = new Gtk.Label ({\n" 7503#| " label: \"The cake is a pie.\" }); */\n" 7504#| "\n" 7505#| " /* Create a button\n" 7506#| " this._button = new Gtk.Button ({\n" 7507#| " label: \"Welcome to GNOME, too!\"}); */\n" 7508#| "\n" 7509#| " // Attach the images and button to the grid\n" 7510#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 7511#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 7512#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 7513#| "\n" 7514#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 7515#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 7516#| "\n" 7517#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 7518#| "\n" 7519#| " // Add the grid to the window\n" 7520#| " this._window.add (this._grid);\n" 7521#| "\n" 7522#| " // Show the window and all child widgets\n" 7523#| " this._window.show_all();\n" 7524#| " }\n" 7525#| "\n" 7526#| "});\n" 7527#| "\n" 7528#| "// Run the application\n" 7529#| "let app = new WelcomeToTheGrid ();\n" 7530#| "app.application.run (ARGV);\n" 7531msgid "" 7532"#!/usr/bin/gjs\n" 7533"\n" 7534"imports.gi.versions.Gtk = '3.0';\n" 7535"const Gtk = imports.gi.Gtk;\n" 7536"\n" 7537"class ComboBoxTextExample {\n" 7538"\n" 7539" // Create the application itself\n" 7540" constructor() {\n" 7541" this.application = new Gtk.Application ({\n" 7542" application_id: 'org.example.jscomboboxtext'});\n" 7543"\n" 7544" // Connect 'activate' and 'startup' signals to the callback functions\n" 7545" this.application.connect('activate', this._onActivate.bind(this));\n" 7546" this.application.connect('startup', this._onStartup.bind(this));\n" 7547" }\n" 7548"\n" 7549" // Callback function for 'activate' signal presents windows when active\n" 7550" _onActivate() {\n" 7551" this._window.present ();\n" 7552" }\n" 7553"\n" 7554" // Callback function for 'startup' signal builds the UI\n" 7555" _onStartup() {\n" 7556" this._buildUI();\n" 7557" }\n" 7558"\n" 7559" // Build the application's UI\n" 7560" _buildUI() {\n" 7561"\n" 7562" // Create the application window\n" 7563" this._window = new Gtk.ApplicationWindow ({\n" 7564" application: this.application,\n" 7565" window_position: Gtk.WindowPosition.CENTER,\n" 7566" title: \"Welcome to GNOME\",\n" 7567" default_width: 200,\n" 7568" border_width: 10 });\n" 7569"\n" 7570" // Create the combobox\n" 7571" this._comboBoxText = new Gtk.ComboBoxText();\n" 7572"\n" 7573" // Populate the combobox\n" 7574" let distros = [\"Select distribution\", \"Fedora\", \"Mint\", \"Suse\"];\n" 7575" for (let i = 0; i < distros.length; i++)\n" 7576" this._comboBoxText.append_text (distros[i]);\n" 7577" this._comboBoxText.set_active (0);\n" 7578"\n" 7579" // Connect the combobox's 'changed' signal to our callback function\n" 7580" this._comboBoxText.connect ('changed', this._onComboChanged.bind(this));\n" 7581"\n" 7582" // Add the combobox to the window\n" 7583" this._window.add (this._comboBoxText);\n" 7584"\n" 7585" // Show the window and all child widgets\n" 7586" this._window.show_all();\n" 7587" }\n" 7588"\n" 7589" _onComboChanged() {\n" 7590"\n" 7591" // The responses we'll use for our messagedialog\n" 7592" let responses = [\"\",\n" 7593" \"Fedora is a community distro sponsored by Red Hat.\",\n" 7594" \"Mint is a popular distro based on Ubuntu.\",\n" 7595" \"SUSE is a name shared by two separate distros.\"];\n" 7596"\n" 7597" // Which combobox item is active?\n" 7598" let activeItem = this._comboBoxText.get_active();\n" 7599"\n" 7600" // No messagedialog if you chose \"Select distribution\"\n" 7601" if (activeItem != 0) {\n" 7602" this._popUp = new Gtk.MessageDialog ({\n" 7603" transient_for: this._window,\n" 7604" modal: true,\n" 7605" buttons: Gtk.ButtonsType.OK,\n" 7606" message_type: Gtk.MessageType.INFO,\n" 7607" text: responses[activeItem]});\n" 7608"\n" 7609" // Connect the OK button to a handler function\n" 7610" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n" 7611"\n" 7612" // Show the messagedialog\n" 7613" this._popUp.show();\n" 7614" }\n" 7615"\n" 7616" }\n" 7617"\n" 7618" _onDialogResponse() {\n" 7619"\n" 7620" this._popUp.destroy ();\n" 7621"\n" 7622" }\n" 7623"\n" 7624"};\n" 7625"\n" 7626"// Run the application\n" 7627"let app = new ComboBoxTextExample ();\n" 7628"app.application.run (ARGV);\n" 7629msgstr "" 7630"#!/usr/bin/gjs\n" 7631"\n" 7632"const Gtk = imports.gi.Gtk;\n" 7633"const Lang = imports.lang;\n" 7634"\n" 7635"const WelcomeToTheGrid = new Lang.Class({\n" 7636" Name: 'Bem-vindo à Grid',\n" 7637"\n" 7638" // Cria o aplicativo em si\n" 7639" _init: function() {\n" 7640" this.application = new Gtk.Application();\n" 7641"\n" 7642" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 7643" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 7644" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 7645" },\n" 7646"\n" 7647" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 7648" _onActivate: function() {\n" 7649" this._window.present();\n" 7650" },\n" 7651"\n" 7652" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 7653" _onStartup: function() {\n" 7654" this._buildUI ();\n" 7655" },\n" 7656"\n" 7657"\n" 7658"\n" 7659" // Constrói a interface gráfica do aplicativo\n" 7660" _buildUI: function() {\n" 7661"\n" 7662" // Cria a janela do aplicativo\n" 7663" this._window = new Gtk.ApplicationWindow({\n" 7664" application: this.application,\n" 7665" window_position: Gtk.WindowPosition.CENTER,\n" 7666" border_width: 10,\n" 7667" title: \"Bem-vindo à Grid\"});\n" 7668"\n" 7669" // Cria a Grid\n" 7670" this._grid = new Gtk.Grid ({\n" 7671" // column_homogeneous: true,\n" 7672" // column_spacing: 20,\n" 7673" row_spacing: 20 });\n" 7674"\n" 7675" // Cria uma imagem\n" 7676" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 7677"\n" 7678" // Cria uma segunda imagem usando um ícone padrão\n" 7679" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 7680"\n" 7681" // Cria um rótulo\n" 7682" this._label = new Gtk.Label ({\n" 7683" label: \"Bem-vindo ao GNOME, também!\",\n" 7684" /* margin_top: 20 */ });\n" 7685"\n" 7686" /* Cria um segundo rótulo\n" 7687" this._labelTwo = new Gtk.Label ({\n" 7688" label: \"O bolo é uma torta.\" }); */\n" 7689"\n" 7690" /* Cria um botão\n" 7691" this._button = new Gtk.Button ({\n" 7692" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 7693"\n" 7694" // Anexa as imagens e botão à grade\n" 7695" this._grid.attach (this._image, 0, 0, 2, 1);\n" 7696" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 7697" this._grid.attach (this._label, 1, 1, 1, 1);\n" 7698"\n" 7699" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 7700" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 7701"\n" 7702" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 7703"\n" 7704" // Adiciona a grade à janela\n" 7705" this._window.add (this._grid);\n" 7706"\n" 7707" // Mostra a janela e todos os widgets filhos\n" 7708" this._window.show_all();\n" 7709" }\n" 7710"\n" 7711"});\n" 7712"\n" 7713"// Executa o aplicativo\n" 7714"let app = new WelcomeToTheGrid ();\n" 7715"app.application.run (ARGV);\n" 7716 7717#. (itstool) path: item/p 7718#: C/comboboxtext.js.page:183 7719msgid "" 7720"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.ComboBoxText." 7721"html\">Gtk.ComboBoxText</link>" 7722msgstr "" 7723 7724#. (itstool) path: item/p 7725#: C/comboboxtext.js.page:184 C/combobox.js.page:244 C/entry.js.page:33 7726#: C/messagedialog.js.page:198 7727msgid "" 7728"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.MessageDialog." 7729"html\">Gtk.MessageDialog</link>" 7730msgstr "" 7731 7732#. (itstool) path: info/title 7733#: C/combobox.c.page:8 7734msgctxt "text" 7735msgid "ComboBox (C)" 7736msgstr "ComboBox (C)" 7737 7738#. (itstool) path: info/desc 7739#: C/combobox.c.page:22 C/combobox.py.page:20 C/combobox.vala.page:18 7740#: C/combobox_multicolumn.py.page:19 C/combobox_multicolumn.vala.page:19 7741msgid "A widget used to choose from a list of items" 7742msgstr "" 7743 7744#. (itstool) path: page/title 7745#: C/combobox.c.page:25 C/combobox.js.page:25 C/combobox.vala.page:21 7746#, fuzzy 7747msgid "ComboBox" 7748msgstr "Caixa de combinação" 7749 7750#. (itstool) path: page/p 7751#: C/combobox.c.page:27 C/combobox.vala.page:23 7752msgid "This ComboBox prints to the terminal when you change your selection." 7753msgstr "" 7754 7755#. (itstool) path: page/code 7756#: C/combobox.c.page:29 7757#, no-wrap 7758msgid "" 7759"\n" 7760"#include <gtk/gtk.h>\n" 7761"\n" 7762"/* This is the callback function. It is a handler function which reacts to the\n" 7763" * signal. In this case, if the row selected is not the first one of the\n" 7764" * ComboBox, we write its value in the terminal for the user.\n" 7765" */\n" 7766"static void\n" 7767"on_changed (GtkComboBox *widget,\n" 7768" gpointer user_data)\n" 7769"{\n" 7770" GtkComboBox *combo_box = widget;\n" 7771"\n" 7772" if (gtk_combo_box_get_active (combo_box) != 0) {\n" 7773" gchar *distro = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(combo_box));\n" 7774" g_print (\"You chose %s\\n\", distro);\n" 7775" g_free (distro);\n" 7776" }\n" 7777"\n" 7778"}\n" 7779"\n" 7780"\n" 7781"static void\n" 7782"activate (GtkApplication *app,\n" 7783" gpointer user_data)\n" 7784"{\n" 7785" gint i;\n" 7786" GtkWidget *view;\n" 7787" GtkWidget *window;\n" 7788" GtkWidget *combo_box;\n" 7789"\n" 7790" /* Create a window with a title, border width, and a default size. Setting the\n" 7791" * size to -1 means to use the \"natural\" default size.\n" 7792" * (the size request of the window)\n" 7793" */\n" 7794" window = gtk_application_window_new (app);\n" 7795" gtk_window_set_title (GTK_WINDOW (window), \"Welcome to GNOME\");\n" 7796" gtk_window_set_default_size (GTK_WINDOW (window), 200, -1);\n" 7797" gtk_container_set_border_width (GTK_CONTAINER (window), 10);\n" 7798"\n" 7799"\n" 7800" /* Create the combo box and append your string values to it. */\n" 7801" combo_box = gtk_combo_box_text_new ();\n" 7802" const char *distros[] = {\"Select distribution\", \"Fedora\", \"Mint\", \"Suse\"};\n" 7803"\n" 7804" \n" 7805" /* G_N_ELEMENTS is a macro which determines the number of elements in an array.*/ \n" 7806" for (i = 0; i < G_N_ELEMENTS (distros); i++){\n" 7807" \tgtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), distros[i]);\n" 7808" }\n" 7809"\n" 7810" /* Choose to set the first row as the active one by default, from the beginning */\n" 7811" gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);\n" 7812"\n" 7813" /* Connect the signal emitted when a row is selected to the appropriate\n" 7814" * callback function.\n" 7815" */\n" 7816" g_signal_connect (combo_box,\n" 7817" \"changed\",\n" 7818" G_CALLBACK (on_changed),\n" 7819" NULL);\n" 7820"\n" 7821" /* Add it to the window */\n" 7822" gtk_container_add (GTK_CONTAINER (window), combo_box);\n" 7823"\n" 7824" gtk_widget_show_all (window);\n" 7825"}\n" 7826"\n" 7827"\n" 7828"int\n" 7829"main (int argc, char **argv)\n" 7830"{\n" 7831" GtkApplication *app;\n" 7832" int status;\n" 7833"\n" 7834" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 7835" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 7836" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 7837" g_object_unref (app);\n" 7838"\n" 7839" return status;\n" 7840"}\n" 7841msgstr "" 7842 7843#. (itstool) path: item/p 7844#: C/combobox.c.page:37 7845#, fuzzy 7846msgid "" 7847"<link href=\"http://developer.gnome.org/gtk3/stable/GtkComboBoxText.html" 7848"\">GtkComboBoxText</link>" 7849msgstr "" 7850"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 7851"link>" 7852 7853#. (itstool) path: info/title 7854#: C/combobox.js.page:8 7855msgctxt "text" 7856msgid "ComboBox (JavaScript)" 7857msgstr "ComboBox (JavaScript)" 7858 7859#. (itstool) path: info/desc 7860#: C/combobox.js.page:22 7861#, fuzzy 7862msgid "A customizable drop-down menu" 7863msgstr "Menu suspenso" 7864 7865#. (itstool) path: page/media 7866#. This is a reference to an external file such as an image or video. When 7867#. the file changes, the md5 hash will change to let you know you need to 7868#. update your localized copy. The msgstr is not used at all. Set it to 7869#. whatever you like once you have updated your copy of the file. 7870#: C/combobox.js.page:26 C/combobox_multicolumn.py.page:23 7871#: C/combobox_multicolumn.vala.page:23 7872msgctxt "_" 7873msgid "" 7874"external ref='media/combobox_multicolumn.png' " 7875"md5='43f16648fb11ebc7d2f70825ed0f63b3'" 7876msgstr "" 7877 7878#. (itstool) path: page/p 7879#: C/combobox.js.page:27 7880msgid "" 7881"A ComboBox is an extremely customizable drop-down menu. It holds the " 7882"equivalent of a <link xref=\"treeview_simple_liststore.js\">TreeView</link> " 7883"widget that appears when you click on it, complete with a ListStore " 7884"(basically a spreadsheet) that says what's in the rows and columns. In this " 7885"example, our ListStore has the name of each option in one column, and the " 7886"name of a stock icon in the other, which the ComboBox then turns into an " 7887"icon for each option." 7888msgstr "" 7889 7890#. (itstool) path: page/p 7891#: C/combobox.js.page:28 7892msgid "" 7893"You select a whole horizontal row at a time, so the icons aren't treated as " 7894"separate options. They and the text beside them make up each option you can " 7895"click on." 7896msgstr "" 7897 7898#. (itstool) path: note/p 7899#: C/combobox.js.page:29 7900msgid "" 7901"Working with a ListStore can be time-consuming. If you just want a simple " 7902"text-only drop-down menu, take a look at the <link xref=\"comboboxtext.js" 7903"\">ComboBoxText</link>. It doesn't take as much time to set up, and is " 7904"easier to work with." 7905msgstr "" 7906 7907#. (itstool) path: section/code 7908#: C/combobox.js.page:34 7909#, fuzzy, no-wrap 7910#| msgid "" 7911#| "\n" 7912#| "#!/usr/bin/gjs\n" 7913#| "\n" 7914#| "const Gtk = imports.gi.Gtk;\n" 7915#| "const Lang = imports.lang;\n" 7916msgid "" 7917"\n" 7918"#!/usr/bin/gjs\n" 7919"\n" 7920"imports.gi.versions.Gtk = '3.0';\n" 7921"\n" 7922"const GObject = imports.gi.GObject;\n" 7923"const Gtk = imports.gi.Gtk;\n" 7924msgstr "" 7925"\n" 7926"#!/usr/bin/gjs\n" 7927"\n" 7928"const Gtk = imports.gi.Gtk;\n" 7929"const Lang = imports.lang;\n" 7930 7931#. (itstool) path: section/code 7932#: C/combobox.js.page:47 7933#, fuzzy, no-wrap 7934#| msgid "" 7935#| "\n" 7936#| " // Create the application itself\n" 7937#| " _init: function () {\n" 7938#| " this.application = new Gtk.Application ();\n" 7939#| "\n" 7940#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 7941#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 7942#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 7943#| " },\n" 7944#| "\n" 7945#| " // Callback function for 'activate' signal presents windows when active\n" 7946#| " _onActivate: function () {\n" 7947#| " this._window.present ();\n" 7948#| " },\n" 7949#| "\n" 7950#| " // Callback function for 'startup' signal builds the UI\n" 7951#| " _onStartup: function () {\n" 7952#| " this._buildUI ();\n" 7953#| " },\n" 7954msgid "" 7955"\n" 7956"class ComboBoxExample {\n" 7957"\n" 7958" // Create the application itself\n" 7959" constructor() {\n" 7960" this.application = new Gtk.Application ({\n" 7961" application_id: 'org.example.jscombobox'});\n" 7962"\n" 7963" // Connect 'activate' and 'startup' signals to the callback functions\n" 7964" this.application.connect('activate', this._onActivate.bind(this));\n" 7965" this.application.connect('startup', this._onStartup.bind(this));\n" 7966" }\n" 7967"\n" 7968" // Callback function for 'activate' signal presents windows when active\n" 7969" _onActivate() {\n" 7970" this._window.present ();\n" 7971" }\n" 7972"\n" 7973" // Callback function for 'startup' signal builds the UI\n" 7974" _onStartup() {\n" 7975" this._buildUI ();\n" 7976" }\n" 7977msgstr "" 7978"\n" 7979" // Cria o aplicativo em si\n" 7980" _init: function () {\n" 7981" this.application = new Gtk.Application ();\n" 7982"\n" 7983" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 7984" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 7985" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 7986" },\n" 7987"\n" 7988" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 7989" _onActivate: function () {\n" 7990" this._window.present ();\n" 7991" },\n" 7992"\n" 7993" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 7994" _onStartup: function () {\n" 7995" this._buildUI ();\n" 7996" },\n" 7997 7998#. (itstool) path: section/p 7999#: C/combobox.js.page:70 8000msgid "" 8001"All the code for this sample goes in the ComboBoxExample class. The above " 8002"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 8003"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 8004"go in." 8005msgstr "" 8006 8007#. (itstool) path: section/code 8008#: C/combobox.js.page:71 8009#, fuzzy, no-wrap 8010#| msgid "" 8011#| "\n" 8012#| " // Build the application's UI\n" 8013#| " _buildUI: function() {\n" 8014#| "\n" 8015#| " // Create the application window\n" 8016#| " this._window = new Gtk.ApplicationWindow({\n" 8017#| " application: this.application,\n" 8018#| " window_position: Gtk.WindowPosition.CENTER,\n" 8019#| " border_width: 10,\n" 8020#| " title: \"Welcome to the Grid\"});\n" 8021msgid "" 8022"\n" 8023" // Build the application's UI\n" 8024" _buildUI() {\n" 8025"\n" 8026" // Create the application window\n" 8027" this._window = new Gtk.ApplicationWindow ({\n" 8028" application: this.application,\n" 8029" window_position: Gtk.WindowPosition.CENTER,\n" 8030" title: \"Welcome to GNOME\",\n" 8031" default_width: 200,\n" 8032" border_width: 10 });\n" 8033msgstr "" 8034"\n" 8035" // Constrói a interface gráfica do aplicativo\n" 8036" _buildUI: function() {\n" 8037"\n" 8038" // Cria a janela do aplicativo\n" 8039" this._window = new Gtk.ApplicationWindow({\n" 8040" application: this.application,\n" 8041" window_position: Gtk.WindowPosition.CENTER,\n" 8042" border_width: 10,\n" 8043" title: \"Bem-vindo à Grid\"});\n" 8044 8045#. (itstool) path: section/title 8046#: C/combobox.js.page:87 C/treeview_simple_liststore.js.page:94 8047#, fuzzy 8048msgid "Creating the ListStore" 8049msgstr "Criar correções (patches)" 8050 8051#. (itstool) path: section/code 8052#: C/combobox.js.page:88 8053#, no-wrap 8054msgid "" 8055"\n" 8056" // Create the liststore to put our options in\n" 8057" this._listStore = new Gtk.ListStore();\n" 8058" this._listStore.set_column_types ([\n" 8059" GObject.TYPE_STRING,\n" 8060" GObject.TYPE_STRING]);\n" 8061msgstr "" 8062 8063#. (itstool) path: section/p 8064#: C/combobox.js.page:95 8065msgid "" 8066"This ListStore works like the one used in the <link xref=" 8067"\"treeview_simple_liststore.js\">TreeView</link> example. We're giving it " 8068"two columns, both strings, because one of them will contain the names of " 8069"<link href=\"https://developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html" 8070"\">stock Gtk icons</link>." 8071msgstr "" 8072 8073#. (itstool) path: section/p 8074#: C/combobox.js.page:96 8075msgid "" 8076"If we'd wanted to use our own icons that weren't already built in to GNOME, " 8077"we'd have needed to use the <file>gtk.gdk.Pixbuf</file> type instead. Here " 8078"are a few other types you can use:" 8079msgstr "" 8080 8081#. (itstool) path: item/p 8082#: C/combobox.js.page:98 C/treeview_simple_liststore.js.page:107 8083msgid "<file>GObject.TYPE_BOOLEAN</file> -- True or false" 8084msgstr "" 8085 8086#. (itstool) path: item/p 8087#: C/combobox.js.page:99 C/treeview_simple_liststore.js.page:108 8088msgid "" 8089"<file>GObject.TYPE_FLOAT</file> -- A floating point number (one with a " 8090"decimal point)" 8091msgstr "" 8092 8093#. (itstool) path: item/p 8094#: C/combobox.js.page:100 C/treeview_simple_liststore.js.page:109 8095msgid "<file>GObject.TYPE_STRING</file> -- A string of letters and numbers" 8096msgstr "" 8097 8098#. (itstool) path: note/p 8099#: C/combobox.js.page:102 C/treeview_simple_liststore.js.page:113 8100msgid "" 8101"You need to put the line <file>const GObject = imports.gi.GObject;</file> at " 8102"the start of your application's code, like we did in this example, if you " 8103"want to be able to use GObject types." 8104msgstr "" 8105 8106#. (itstool) path: section/code 8107#: C/combobox.js.page:104 8108#, no-wrap 8109msgid "" 8110"\n" 8111" // This array holds our list of options and their icons\n" 8112" let options = [{ name: \"Select\" },\n" 8113" { name: \"New\", icon: Gtk.STOCK_NEW },\n" 8114" { name: \"Open\", icon: Gtk.STOCK_OPEN },\n" 8115" { name: \"Save\", icon: Gtk.STOCK_SAVE }];\n" 8116"\n" 8117" // Put the options in the liststore\n" 8118" for (let i = 0; i < options.length; i++ ) {\n" 8119" let option = options[i];\n" 8120" let iter = this._listStore.append();\n" 8121" this._listStore.set (iter, [0], [option.name]);\n" 8122" if ('icon' in option)\n" 8123" this._listStore.set (iter, [1], [option.icon]);\n" 8124" }\n" 8125msgstr "" 8126 8127#. (itstool) path: section/p 8128#: C/combobox.js.page:120 8129msgid "" 8130"Here we create an array of the text options and their corresponding icons, " 8131"then put them into the ListStore in much the same way we would for a <link " 8132"xref=\"treeview_simple_liststore.js\">TreeView's</link> ListStore. We only " 8133"want to put an icon in if there's actually an icon in the options array, so " 8134"we make sure to check for that first." 8135msgstr "" 8136 8137#. (itstool) path: note/p 8138#: C/combobox.js.page:121 8139msgid "" 8140"\"Select\" isn't really an option so much as an invitation to click on our " 8141"ComboBox, so it doesn't need an icon." 8142msgstr "" 8143 8144#. (itstool) path: section/title 8145#: C/combobox.js.page:125 8146#, fuzzy 8147msgid "Creating the ComboBox" 8148msgstr "Caixa de combinação" 8149 8150#. (itstool) path: section/code 8151#: C/combobox.js.page:126 8152#, no-wrap 8153msgid "" 8154"\n" 8155" // Create the combobox\n" 8156" this._comboBox = new Gtk.ComboBox({\n" 8157" model: this._listStore});\n" 8158msgstr "" 8159 8160#. (itstool) path: section/p 8161#: C/combobox.js.page:131 8162msgid "" 8163"Each ComboBox has an underlying \"model\" it takes all its options from. You " 8164"can use a TreeStore if you want to have a ComboBox with branching options. " 8165"In this case, we're just using the ListStore we already created." 8166msgstr "" 8167 8168#. (itstool) path: section/code 8169#: C/combobox.js.page:132 8170#, no-wrap 8171msgid "" 8172"\n" 8173" // Create some cellrenderers for the items in each column\n" 8174" let rendererPixbuf = new Gtk.CellRendererPixbuf();\n" 8175" let rendererText = new Gtk.CellRendererText();\n" 8176"\n" 8177" // Pack the renderers into the combobox in the order we want to see\n" 8178" this._comboBox.pack_start (rendererPixbuf, false);\n" 8179" this._comboBox.pack_start (rendererText, false);\n" 8180"\n" 8181" // Set the renderers to use the information from our liststore\n" 8182" this._comboBox.add_attribute (rendererText, \"text\", 0);\n" 8183" this._comboBox.add_attribute (rendererPixbuf, \"stock_id\", 1);\n" 8184msgstr "" 8185 8186#. (itstool) path: section/p 8187#: C/combobox.js.page:145 8188msgid "" 8189"This part, again, works much like creating CellRenderers and packing them " 8190"into the columns of a <link xref=\"treeview_simple_liststore.js\">TreeView</" 8191"link>. The biggest difference is that we don't need to create the ComboBox's " 8192"columns as separate objects. We just pack the CellRenderers into it in the " 8193"order we want them to show up, then tell them to pull information from the " 8194"ListStore (and what type of information we want them to expect)." 8195msgstr "" 8196 8197#. (itstool) path: section/p 8198#: C/combobox.js.page:146 8199msgid "" 8200"We use a CellRendererText to show the text, and a CellRendererPixbuf to show " 8201"the icons. We can store the names of the icons' stock types as strings, but " 8202"when we display them we need a CellRenderer that's designed for pictures." 8203msgstr "" 8204 8205#. (itstool) path: note/p 8206#: C/combobox.js.page:147 8207msgid "" 8208"Just like with a TreeView, the \"model\" (in this case a ListStore) and the " 8209"\"view\" (in this case our ComboBox) are separate. Because of that, we can " 8210"do things like have the columns in one order in the ListStore, and then pack " 8211"the CellRenderers that correspond to those columns into the ComboBox in a " 8212"different order. We can even create a TreeView or other widget that shows " 8213"the information in the ListStore in a different way, without it affecting " 8214"our ComboBox." 8215msgstr "" 8216 8217#. (itstool) path: section/code 8218#: C/combobox.js.page:149 8219#, no-wrap 8220msgid "" 8221"\n" 8222" // Set the first row in the combobox to be active on startup\n" 8223" this._comboBox.set_active (0);\n" 8224"\n" 8225" // Connect the combobox's 'changed' signal to our callback function\n" 8226" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n" 8227msgstr "" 8228 8229#. (itstool) path: section/p 8230#: C/combobox.js.page:156 8231msgid "" 8232"We want the \"Select\" text to be the part people see at first, that gets " 8233"them to click on the ComboBox. So we set it to be the active entry. We also " 8234"connect the ComboBox's <file>changed</file> signal to a callback function, " 8235"so that any time someone clicks on a new option something happens. In this " 8236"case, we're just going to show a popup with a little haiku." 8237msgstr "" 8238 8239#. (itstool) path: section/code 8240#: C/combobox.js.page:158 8241#, fuzzy, no-wrap 8242#| msgid "" 8243#| "\n" 8244#| " // Put the webview into the window\n" 8245#| " this._window.add (this._webView);\n" 8246#| "\n" 8247#| " // Show the window and all child widgets\n" 8248#| " this._window.show_all();\n" 8249#| " },\n" 8250#| "\n" 8251#| "});\n" 8252msgid "" 8253"\n" 8254" // Add the combobox to the window\n" 8255" this._window.add (this._comboBox);\n" 8256"\n" 8257" // Show the window and all child widgets\n" 8258" this._window.show_all();\n" 8259" }\n" 8260msgstr "" 8261"\n" 8262" // Coloca o webview na janela\n" 8263" this._window.add (this._webView);\n" 8264"\n" 8265" // Mostra a janela e todos seus widgets filhos\n" 8266" this._window.show_all();\n" 8267" },\n" 8268"\n" 8269"});\n" 8270 8271#. (itstool) path: section/p 8272#: C/combobox.js.page:166 8273msgid "" 8274"Finally, we add the ComboBox to the window, and tell the window to show " 8275"itself and everything inside it." 8276msgstr "" 8277 8278#. (itstool) path: section/code 8279#: C/combobox.js.page:171 8280#, no-wrap 8281msgid "" 8282"\n" 8283" _selected() {\n" 8284"\n" 8285" // The silly pseudohaiku that we'll use for our messagedialog\n" 8286" let haiku = [\"\",\n" 8287" \"You ask for the new\\nwith no thought for the aged\\nlike fallen leaves trod.\",\n" 8288" \"Like a simple clam\\nrevealing a lustrous pearl\\nit opens for you.\",\n" 8289" \"A moment in time\\na memory on the breeze\\nthese things can't be saved.\"];\n" 8290msgstr "" 8291 8292#. (itstool) path: section/p 8293#: C/combobox.js.page:180 8294msgid "" 8295"We're going to create a pop-up <link xref=\"messagedialog.js" 8296"\">MessageDialog</link>, which shows you a silly haiku based on which distro " 8297"you select. First, we create the array of haiku to use. Since the first " 8298"string in our ComboBox is just the \"Select\" message, we make the first " 8299"string in our array blank." 8300msgstr "" 8301 8302#. (itstool) path: section/code 8303#: C/combobox.js.page:182 8304#, no-wrap 8305msgid "" 8306"\n" 8307" // Which combobox item is active?\n" 8308" let activeItem = this._comboBox.get_active();\n" 8309"\n" 8310" // No messagedialog if you choose \"Select\"\n" 8311" if (activeItem != 0) {\n" 8312" this._popUp = new Gtk.MessageDialog ({\n" 8313" transient_for: this._window,\n" 8314" modal: true,\n" 8315" buttons: Gtk.ButtonsType.OK,\n" 8316" message_type: Gtk.MessageType.INFO,\n" 8317" text: haiku[activeItem]});\n" 8318"\n" 8319" // Connect the OK button to a handler function\n" 8320" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n" 8321"\n" 8322" // Show the messagedialog\n" 8323" this._popUp.show();\n" 8324" }\n" 8325"\n" 8326" }\n" 8327msgstr "" 8328 8329#. (itstool) path: section/p 8330#: C/combobox.js.page:204 8331msgid "" 8332"Before showing a MessageDialog, we first test to make sure you didn't choose " 8333"the \"Select\" message. After that, we set its text to be the haiku in the " 8334"array that corresponds to the active entry in our ComboBoxText. We do that " 8335"using the <file>get_active</file> method, which returns the number ID of " 8336"your selection." 8337msgstr "" 8338 8339#. (itstool) path: note/p 8340#: C/combobox.js.page:205 8341msgid "" 8342"Other methods you can use include <file>get_active_id</file>, which returns " 8343"the text ID assigned by <file>append</file>, and <file>get_active_text</" 8344"file>, which returns the full text of the string you selected." 8345msgstr "" 8346 8347#. (itstool) path: section/code 8348#: C/combobox.js.page:208 8349#, no-wrap 8350msgid "" 8351"\n" 8352" _onDialogResponse() {\n" 8353"\n" 8354" this._popUp.destroy ();\n" 8355"\n" 8356" }\n" 8357"\n" 8358"};\n" 8359msgstr "" 8360 8361#. (itstool) path: section/code 8362#: C/combobox.js.page:219 8363#, fuzzy, no-wrap 8364msgid "" 8365"\n" 8366"// Run the application\n" 8367"let app = new ComboBoxExample ();\n" 8368"app.application.run (ARGV);\n" 8369msgstr "" 8370"\n" 8371"// Executa o aplicativo\n" 8372"let app = new GettingTheSignal ();\n" 8373"app.application.run (ARGV);\n" 8374 8375#. (itstool) path: section/p 8376#: C/combobox.js.page:224 8377msgid "" 8378"Finally, we create a new instance of the finished ComboBoxExample class, and " 8379"set the application running." 8380msgstr "" 8381 8382#. (itstool) path: section/code 8383#: C/combobox.js.page:229 8384#, no-wrap 8385msgid "" 8386"#!/usr/bin/gjs\n" 8387"\n" 8388"imports.gi.versions.Gtk = '3.0';\n" 8389"\n" 8390"const GObject = imports.gi.GObject;\n" 8391"const Gtk = imports.gi.Gtk;\n" 8392"\n" 8393"class ComboBoxExample {\n" 8394"\n" 8395" // Create the application itself\n" 8396" constructor() {\n" 8397" this.application = new Gtk.Application ({\n" 8398" application_id: 'org.example.jscombobox'});\n" 8399"\n" 8400" // Connect 'activate' and 'startup' signals to the callback functions\n" 8401" this.application.connect('activate', this._onActivate.bind(this));\n" 8402" this.application.connect('startup', this._onStartup.bind(this));\n" 8403" }\n" 8404"\n" 8405" // Callback function for 'activate' signal presents windows when active\n" 8406" _onActivate() {\n" 8407" this._window.present ();\n" 8408" }\n" 8409"\n" 8410" // Callback function for 'startup' signal builds the UI\n" 8411" _onStartup() {\n" 8412" this._buildUI();\n" 8413" }\n" 8414"\n" 8415" // Build the application's UI\n" 8416" _buildUI() {\n" 8417"\n" 8418" // Create the application window\n" 8419" this._window = new Gtk.ApplicationWindow ({\n" 8420" application: this.application,\n" 8421" window_position: Gtk.WindowPosition.CENTER,\n" 8422" title: \"Welcome to GNOME\",\n" 8423" default_width: 200,\n" 8424" border_width: 10 });\n" 8425"\n" 8426" // Create the liststore to put our options in\n" 8427" this._listStore = new Gtk.ListStore();\n" 8428" this._listStore.set_column_types ([\n" 8429" GObject.TYPE_STRING,\n" 8430" GObject.TYPE_STRING]);\n" 8431"\n" 8432" // This array holds our list of options and their icons\n" 8433" let options = [{ name: \"Select\" },\n" 8434" { name: \"New\", icon: Gtk.STOCK_NEW },\n" 8435" { name: \"Open\", icon: Gtk.STOCK_OPEN },\n" 8436" { name: \"Save\", icon: Gtk.STOCK_SAVE }];\n" 8437"\n" 8438" // Put the options in the liststore\n" 8439" for (let i = 0; i < options.length; i++ ) {\n" 8440" let option = options[i];\n" 8441" let iter = this._listStore.append();\n" 8442" this._listStore.set (iter, [0], [option.name]);\n" 8443" if ('icon' in option)\n" 8444" this._listStore.set (iter, [1], [option.icon]);\n" 8445" }\n" 8446"\n" 8447" // Create the combobox\n" 8448" this._comboBox = new Gtk.ComboBox({\n" 8449" model: this._listStore});\n" 8450"\n" 8451" // Create some cellrenderers for the items in each column\n" 8452" let rendererPixbuf = new Gtk.CellRendererPixbuf();\n" 8453" let rendererText = new Gtk.CellRendererText();\n" 8454"\n" 8455" // Pack the renderers into the combobox in the order we want to see\n" 8456" this._comboBox.pack_start (rendererPixbuf, false);\n" 8457" this._comboBox.pack_start (rendererText, false);\n" 8458"\n" 8459" // Set the renderers to use the information from our liststore\n" 8460" this._comboBox.add_attribute (rendererText, \"text\", 0);\n" 8461" this._comboBox.add_attribute (rendererPixbuf, \"stock_id\", 1);\n" 8462"\n" 8463" // Set the first row in the combobox to be active on startup\n" 8464" this._comboBox.set_active (0);\n" 8465"\n" 8466" // Connect the combobox's 'changed' signal to our callback function\n" 8467" this._comboBox.connect ('changed', this._onComboChanged.bind(this));\n" 8468"\n" 8469" // Add the combobox to the window\n" 8470" this._window.add (this._comboBox);\n" 8471"\n" 8472" // Show the window and all child widgets\n" 8473" this._window.show_all();\n" 8474" }\n" 8475"\n" 8476" _onComboChanged() {\n" 8477"\n" 8478" // The silly pseudohaiku that we'll use for our messagedialog\n" 8479" let haiku = [\"\",\n" 8480" \"You ask for the new\\nwith no thought for the aged\\nlike fallen leaves trod.\",\n" 8481" \"Like a simple clam\\nrevealing a lustrous pearl\\nit opens for you.\",\n" 8482" \"A moment in time\\na memory on the breeze\\nthese things can't be saved.\"];\n" 8483"\n" 8484" // Which combobox item is active?\n" 8485" let activeItem = this._comboBox.get_active();\n" 8486"\n" 8487" // No messagedialog if you choose \"Select\"\n" 8488" if (activeItem != 0) {\n" 8489" this._popUp = new Gtk.MessageDialog ({\n" 8490" transient_for: this._window,\n" 8491" modal: true,\n" 8492" buttons: Gtk.ButtonsType.OK,\n" 8493" message_type: Gtk.MessageType.INFO,\n" 8494" text: haiku[activeItem]});\n" 8495"\n" 8496" // Connect the OK button to a handler function\n" 8497" this._popUp.connect ('response', this._onDialogResponse.bind(this));\n" 8498"\n" 8499" // Show the messagedialog\n" 8500" this._popUp.show();\n" 8501" }\n" 8502"\n" 8503" }\n" 8504"\n" 8505" _onDialogResponse() {\n" 8506"\n" 8507" this._popUp.destroy ();\n" 8508"\n" 8509" }\n" 8510"\n" 8511"};\n" 8512"\n" 8513"// Run the application\n" 8514"let app = new ComboBoxExample ();\n" 8515"app.application.run (ARGV);\n" 8516msgstr "" 8517 8518#. (itstool) path: item/p 8519#: C/combobox.js.page:240 8520msgid "" 8521"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk." 8522"CellRendererPixbuf.html\">Gtk.CellRendererPixbuf</link>" 8523msgstr "" 8524 8525#. (itstool) path: item/p 8526#: C/combobox.js.page:241 C/treeview_simple_liststore.js.page:279 8527msgid "" 8528"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk." 8529"CellRendererText.html\">Gtk.CellRendererText</link>" 8530msgstr "" 8531 8532#. (itstool) path: item/p 8533#: C/combobox.js.page:242 8534msgid "" 8535"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.ComboBox.html" 8536"\">Gtk.ComboBox</link>" 8537msgstr "" 8538 8539#. (itstool) path: item/p 8540#: C/combobox.js.page:243 C/treeview_simple_liststore.js.page:280 8541msgid "" 8542"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.ListStore.html" 8543"\">Gtk.ListStore</link>" 8544msgstr "" 8545 8546#. (itstool) path: item/p 8547#: C/combobox.js.page:245 C/treeview_simple_liststore.js.page:281 8548msgid "" 8549"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.TreeIter.html" 8550"\">Gtk.TreeIter</link>" 8551msgstr "" 8552 8553#. (itstool) path: info/title 8554#: C/combobox.py.page:8 C/combobox_multicolumn.py.page:8 8555msgctxt "text" 8556msgid "ComboBox (Python)" 8557msgstr "ComboBox (Python)" 8558 8559#. (itstool) path: page/title 8560#: C/combobox.py.page:23 8561#, fuzzy 8562msgid "ComboBox (one column)" 8563msgstr "Caixa de combinação" 8564 8565#. (itstool) path: page/p 8566#: C/combobox.py.page:25 C/combobox_multicolumn.py.page:24 8567#: C/combobox_multicolumn.vala.page:24 8568msgid "This ComboBox prints to the terminal your selection when you change it." 8569msgstr "" 8570 8571#. (itstool) path: section/code 8572#: C/combobox.py.page:31 8573#, no-wrap 8574msgid "" 8575"from gi.repository import Gtk\n" 8576"import sys\n" 8577"\n" 8578"distros = [[\"Select distribution\"], [\"Fedora\"], [\"Mint\"], [\"Suse\"]]\n" 8579"\n" 8580"\n" 8581"class MyWindow(Gtk.ApplicationWindow):\n" 8582"\n" 8583" def __init__(self, app):\n" 8584" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 8585" self.set_default_size(200, -1)\n" 8586" self.set_border_width(10)\n" 8587"\n" 8588" # the data in the model, of type string\n" 8589" listmodel = Gtk.ListStore(str)\n" 8590" # append the data in the model\n" 8591" for i in range(len(distros)):\n" 8592" listmodel.append(distros[i])\n" 8593"\n" 8594" # a combobox to see the data stored in the model\n" 8595" combobox = Gtk.ComboBox(model=listmodel)\n" 8596"\n" 8597" # a cellrenderer to render the text\n" 8598" cell = Gtk.CellRendererText()\n" 8599"\n" 8600" # pack the cell into the beginning of the combobox, allocating\n" 8601" # no more space than needed\n" 8602" combobox.pack_start(cell, False)\n" 8603" # associate a property (\"text\") of the cellrenderer (cell) to a column (column 0)\n" 8604" # in the model used by the combobox\n" 8605" combobox.add_attribute(cell, \"text\", 0)\n" 8606"\n" 8607" # the first row is the active one by default at the beginning\n" 8608" combobox.set_active(0)\n" 8609"\n" 8610" # connect the signal emitted when a row is selected to the callback\n" 8611" # function\n" 8612" combobox.connect(\"changed\", self.on_changed)\n" 8613"\n" 8614" # add the combobox to the window\n" 8615" self.add(combobox)\n" 8616"\n" 8617" def on_changed(self, combo):\n" 8618" # if the row selected is not the first one, write its value on the\n" 8619" # terminal\n" 8620" if combo.get_active() != 0:\n" 8621" print(\"You chose \" + str(distros[combo.get_active()][0]) + \".\")\n" 8622" return True\n" 8623"\n" 8624"\n" 8625"class MyApplication(Gtk.Application):\n" 8626"\n" 8627" def __init__(self):\n" 8628" Gtk.Application.__init__(self)\n" 8629"\n" 8630" def do_activate(self):\n" 8631" win = MyWindow(self)\n" 8632" win.show_all()\n" 8633"\n" 8634" def do_startup(self):\n" 8635" Gtk.Application.do_startup(self)\n" 8636"\n" 8637"app = MyApplication()\n" 8638"exit_status = app.run(sys.argv)\n" 8639"sys.exit(exit_status)\n" 8640msgstr "" 8641 8642#. (itstool) path: section/title 8643#: C/combobox.py.page:35 C/combobox_multicolumn.py.page:35 8644#, fuzzy 8645msgid "Useful methods for a ComboBox widget" 8646msgstr "Métodos úteis" 8647 8648#. (itstool) path: section/p 8649#: C/combobox.py.page:36 C/combobox_multicolumn.py.page:36 8650msgid "" 8651"The ComboBox widget is designed around a <em>Model/View/Controller</em> " 8652"design: the <em>Model</em> stores the data; the <em>View</em> gets change " 8653"notifications and displays the content of the model; the <em>Controller</" 8654"em>, finally, changes the state of the model and notifies the view of these " 8655"changes. For more information and for a list of useful methods for ComboBox " 8656"see <link xref=\"model-view-controller.py\"/>." 8657msgstr "" 8658 8659#. (itstool) path: section/p 8660#: C/combobox.py.page:37 8661msgid "" 8662"In line 35 the <code>\"changed\"</code> signal is connected to the callback " 8663"function <code>on_changed()</code> using <code><var>widget</var>." 8664"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 8665"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 8666msgstr "" 8667 8668#. (itstool) path: item/p 8669#: C/combobox.py.page:45 C/combobox_multicolumn.py.page:44 8670#: C/model-view-controller.py.page:190 8671msgid "" 8672"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkComboBox.html" 8673"\">GtkComboBox</link>" 8674msgstr "" 8675 8676#. (itstool) path: item/p 8677#: C/combobox.py.page:46 C/combobox_multicolumn.py.page:45 8678#: C/treeview_advanced_liststore.py.page:46 8679#: C/treeview_simple_liststore.py.page:47 8680msgid "" 8681"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkListStore.html" 8682"\">GtkListStore</link>" 8683msgstr "" 8684 8685#. (itstool) path: item/p 8686#: C/combobox.py.page:47 C/combobox_multicolumn.py.page:46 8687#: C/treeview_advanced_liststore.py.page:47 8688#: C/treeview_cellrenderertoggle.py.page:47 8689#: C/treeview_simple_liststore.py.page:48 C/treeview_treestore.py.page:47 8690msgid "" 8691"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCellRendererText." 8692"html\">GtkCellRendererText</link>" 8693msgstr "" 8694 8695#. (itstool) path: item/p 8696#: C/combobox.py.page:48 8697msgid "" 8698"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCellLayout.html" 8699"\">GtkCellLayout</link>" 8700msgstr "" 8701 8702#. (itstool) path: item/p 8703#: C/combobox.py.page:49 C/combobox_multicolumn.py.page:49 8704#: C/treeview_advanced_liststore.py.page:49 8705#: C/treeview_simple_liststore.py.page:50 8706msgid "" 8707"<link href=\"http://git.gnome.org/browse/pygobject/tree/gi/overrides/Gtk.py" 8708"\">pygobject - Python bindings for GObject Introspection</link>" 8709msgstr "" 8710 8711#. (itstool) path: info/title 8712#: C/combobox.vala.page:8 C/combobox_multicolumn.vala.page:8 8713msgctxt "text" 8714msgid "ComboBox (Vala)" 8715msgstr "ComboBox (Vala)" 8716 8717#. (itstool) path: page/code 8718#: C/combobox.vala.page:25 8719#, no-wrap 8720msgid "" 8721"/* A window in the application */\n" 8722"class MyWindow : Gtk.ApplicationWindow {\n" 8723"\n" 8724"\t/* An instance array of linux distributions belonging to this window. */\n" 8725"\tstring[] distros = {\"Select distribution\", \"Fedora\", \"Mint\", \"Suse\"};\n" 8726"\n" 8727"\t/* This enum makes the code more readable when we refer to\n" 8728"\t * the column as Column.DISTRO, instead of just 0.\n" 8729"\t */\n" 8730"\tenum Column {\n" 8731"\t\tDISTRO\n" 8732"\t}\n" 8733"\n" 8734"\t/* Constructor */\n" 8735"\tinternal MyWindow (MyApplication app) {\n" 8736"\t\tObject (application: app, title: \"Welcome to GNOME\");\n" 8737"\n" 8738"\t\tthis.set_default_size (200, -1);\n" 8739"\t\tthis.border_width = 10;\n" 8740"\n" 8741"\t\tGtk.ListStore liststore = new Gtk.ListStore (1, typeof (string));\n" 8742"\n" 8743"\t\tfor (int i = 0; i < distros.length; i++){\n" 8744"\t\t\tGtk.TreeIter iter;\n" 8745"\t\t\tliststore.append (out iter);\n" 8746"\t\t\tliststore.set (iter, Column.DISTRO, distros[i]);\n" 8747"\t\t}\n" 8748"\n" 8749"\t\tGtk.ComboBox combobox = new Gtk.ComboBox.with_model (liststore);\n" 8750"\t\tGtk.CellRendererText cell = new Gtk.CellRendererText ();\n" 8751"\t\tcombobox.pack_start (cell, false);\n" 8752"\n" 8753"\t\tcombobox.set_attributes (cell, \"text\", Column.DISTRO);\n" 8754"\n" 8755"\t\t/* Set the first item in the list to be selected (active). */\n" 8756"\t\tcombobox.set_active (0);\n" 8757"\n" 8758"\t\t/* Connect the 'changed' signal of the combobox\n" 8759"\t\t * to the signal handler (aka. callback function).\n" 8760"\t\t */\n" 8761"\t\tcombobox.changed.connect (this.item_changed);\n" 8762"\n" 8763"\t\t/* Add the combobox to this window */\n" 8764"\t\tthis.add (combobox);\n" 8765"\t\tcombobox.show ();\n" 8766"\t}\n" 8767"\n" 8768"\t/* Signal handler for the 'changed' signal of the combobox. */\n" 8769"\tvoid item_changed (Gtk.ComboBox combo) {\n" 8770"\t\tif (combo.get_active () !=0) {\n" 8771"\t\t\tprint (\"You chose \" + distros [combo.get_active ()] +\"\\n\");\n" 8772"\t\t}\n" 8773"\t}\n" 8774"}\n" 8775"\n" 8776"/* This is the application */\n" 8777"class MyApplication : Gtk.Application {\n" 8778"\n" 8779"\t/* Constructor */\n" 8780"\tinternal MyApplication () {\n" 8781"\t\tObject (application_id: \"org.example.MyApplication\");\n" 8782"\t}\n" 8783"\n" 8784"\t/* Override the activate signal of GLib.Application,\n" 8785"\t * which is inherited by Gtk.Application.\n" 8786"\t */\n" 8787"\tprotected override void activate () {\n" 8788"\n" 8789"\t\t/* Create the window of this application\n" 8790"\t\t * and show it.\n" 8791"\t\t */\n" 8792"\t\tnew MyWindow (this).show ();\n" 8793"\t}\n" 8794"}\n" 8795"\n" 8796"/* main creates and runs the application */\n" 8797"int main (string[] args) {\n" 8798"\treturn new MyApplication ().run (args);\n" 8799"}\n" 8800msgstr "" 8801 8802#. (itstool) path: item/p 8803#: C/combobox.vala.page:30 C/treeview_simple_liststore.vala.page:33 8804msgid "" 8805"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ListStore.html\">Gtk." 8806"ListStore</link>" 8807msgstr "" 8808 8809#. (itstool) path: item/p 8810#: C/combobox.vala.page:31 8811msgid "" 8812"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ComboBox.html\">Gtk." 8813"ComboBox</link>" 8814msgstr "" 8815 8816#. (itstool) path: item/p 8817#: C/combobox.vala.page:32 8818msgid "" 8819"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellRendererText.html\">Gtk." 8820"CellRendererText</link>" 8821msgstr "" 8822 8823#. (itstool) path: item/p 8824#: C/combobox.vala.page:33 8825msgid "" 8826"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellLayout.set_attributes." 8827"html\">set_attributes</link>" 8828msgstr "" 8829 8830#. (itstool) path: page/title 8831#: C/combobox_multicolumn.py.page:22 C/combobox_multicolumn.vala.page:22 8832#, fuzzy 8833msgid "ComboBox (two columns)" 8834msgstr "Duas colunas – \\begin{columns}" 8835 8836#. (itstool) path: section/code 8837#: C/combobox_multicolumn.py.page:30 8838#, no-wrap 8839msgid "" 8840"from gi.repository import Gtk\n" 8841"import sys\n" 8842"\n" 8843"actions = [[\"Select\", None],\n" 8844" [\"New\", Gtk.STOCK_NEW],\n" 8845" [\"Open\", Gtk.STOCK_OPEN],\n" 8846" [\"Save\", Gtk.STOCK_SAVE]]\n" 8847"\n" 8848"\n" 8849"class MyWindow(Gtk.ApplicationWindow):\n" 8850"\n" 8851" def __init__(self, app):\n" 8852" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 8853" self.set_default_size(200, -1)\n" 8854" self.set_border_width(10)\n" 8855"\n" 8856" # the data in the model, of type string on two columns\n" 8857" listmodel = Gtk.ListStore(str, str)\n" 8858" # append the data\n" 8859" for i in range(len(actions)):\n" 8860" listmodel.append(actions[i])\n" 8861"\n" 8862" # a combobox to see the data stored in the model\n" 8863" combobox = Gtk.ComboBox(model=listmodel)\n" 8864"\n" 8865" # cellrenderers to render the data\n" 8866" renderer_pixbuf = Gtk.CellRendererPixbuf()\n" 8867" renderer_text = Gtk.CellRendererText()\n" 8868"\n" 8869" # we pack the cell into the beginning of the combobox, allocating\n" 8870" # no more space than needed;\n" 8871" # first the image, then the text;\n" 8872" # note that it does not matter in which order they are in the model,\n" 8873" # the visualization is decided by the order of the cellrenderers\n" 8874" combobox.pack_start(renderer_pixbuf, False)\n" 8875" combobox.pack_start(renderer_text, False)\n" 8876"\n" 8877" # associate a property of the cellrenderer to a column in the model\n" 8878" # used by the combobox\n" 8879" combobox.add_attribute(renderer_text, \"text\", 0)\n" 8880" combobox.add_attribute(renderer_pixbuf, \"stock_id\", 1)\n" 8881"\n" 8882" # the first row is the active one at the beginning\n" 8883" combobox.set_active(0)\n" 8884"\n" 8885" # connect the signal emitted when a row is selected to the callback\n" 8886" # function\n" 8887" combobox.connect(\"changed\", self.on_changed)\n" 8888"\n" 8889" # add the combobox to the window\n" 8890" self.add(combobox)\n" 8891"\n" 8892" def on_changed(self, combo):\n" 8893" # if the row selected is not the first one, write on the terminal\n" 8894" # the value of the first column in the model\n" 8895" if combo.get_active() != 0:\n" 8896" print(\"You chose \" + str(actions[combo.get_active()][0]) + \"\\n\")\n" 8897" return True\n" 8898"\n" 8899"\n" 8900"class MyApplication(Gtk.Application):\n" 8901"\n" 8902" def __init__(self):\n" 8903" Gtk.Application.__init__(self)\n" 8904"\n" 8905" def do_activate(self):\n" 8906" win = MyWindow(self)\n" 8907" win.show_all()\n" 8908"\n" 8909" def do_startup(self):\n" 8910" Gtk.Application.do_startup(self)\n" 8911"\n" 8912"app = MyApplication()\n" 8913"exit_status = app.run(sys.argv)\n" 8914"sys.exit(exit_status)\n" 8915msgstr "" 8916 8917#. (itstool) path: section/p 8918#: C/combobox_multicolumn.py.page:37 8919msgid "" 8920"In line 45 the <code>\"changed\"</code> signal is connected to the callback " 8921"function <code>on_changed()</code> using <code><var>widget</var>." 8922"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 8923"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 8924msgstr "" 8925 8926#. (itstool) path: item/p 8927#: C/combobox_multicolumn.py.page:47 8928msgid "" 8929"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCellRendererPixbuf." 8930"html\">GtkCellRendererPixbuf</link>" 8931msgstr "" 8932 8933#. (itstool) path: item/p 8934#: C/combobox_multicolumn.py.page:48 C/combobox_multicolumn.vala.page:42 8935#: C/toolbar.py.page:58 8936msgid "" 8937"<link href=\"http://developer.gnome.org/gtk3/unstable/gtk3-Stock-Items.html" 8938"\">Stock Items</link>" 8939msgstr "" 8940 8941#. (itstool) path: section/code 8942#: C/combobox_multicolumn.vala.page:30 8943#, no-wrap 8944msgid "" 8945"class MyWindow : Gtk.ApplicationWindow {\n" 8946"\n" 8947"\tstring[] file = {\"Select\", \"New\", \"Open\", \"Save\"};\n" 8948"\tstring[] stock_item = {\"\",\"gtk-new\", \"gtk-open\", \"gtk-save\"};\n" 8949"\n" 8950"\tenum Column {\n" 8951"\t\tFILE,\n" 8952"\t\tSTOCK_ITEM\t\n" 8953"\t}\n" 8954"\n" 8955"\t/* Constructor */\n" 8956"\tinternal MyWindow (MyApplication app) {\n" 8957"\t\tObject (application: app, title: \"Welcome to GNOME\");\n" 8958"\n" 8959"\t\tthis.set_default_size (200, -1);\n" 8960"\t\tthis.border_width = 10;\n" 8961"\n" 8962"\t\tGtk.ListStore liststore = new Gtk.ListStore (2, typeof (string), typeof (string));\n" 8963"\n" 8964"\t\tfor (int i = 0; i < file.length; i++){\n" 8965"\t\t\tGtk.TreeIter iter;\n" 8966"\t\t\tliststore.append (out iter);\n" 8967"\t\t\tliststore.set (iter, Column.FILE, file[i]);\n" 8968"\t\t\tliststore.set (iter, Column.STOCK_ITEM, stock_item[i]);\n" 8969"\t\t}\n" 8970"\n" 8971"\t\tGtk.ComboBox combobox = new Gtk.ComboBox.with_model (liststore);\n" 8972"\n" 8973"\t\t/* CellRenderers render the data. */\n" 8974"\t\tGtk.CellRendererText cell = new Gtk.CellRendererText ();\n" 8975"\t\tGtk.CellRendererPixbuf cell_pb = new Gtk.CellRendererPixbuf ();\n" 8976"\t\t\n" 8977" /* we pack the cell into the beginning of the combobox, allocating\n" 8978"\t\t * no more space than needed;\n" 8979"\t\t * first the image, then the text;\n" 8980"\t\t * note that it does not matter in which order they are in the model,\n" 8981"\t\t * the visualization is decided by the order of the cellrenderers\n" 8982"\t\t */\n" 8983"\t\tcombobox.pack_start (cell_pb, false);\n" 8984"\t\tcombobox.pack_start (cell, false);\n" 8985"\n" 8986"\t\t/* associate a property of the cellrenderer to a column in the model\n" 8987"\t\t * used by the combobox\n" 8988"\t\t */\n" 8989"\t\tcombobox.set_attributes (cell_pb, \"stock_id\", Column.STOCK_ITEM);\n" 8990"\t\tcombobox.set_attributes (cell, \"text\", Column.FILE);\n" 8991"\n" 8992"\t\t/* Set the first item in the list to be selected (active). */\n" 8993"\t\tcombobox.set_active (0);\n" 8994"\n" 8995"\t\t/* Connect the 'changed' signal of the combobox\n" 8996"\t\t * to the signal handler (aka. callback function).\n" 8997"\t\t */\n" 8998"\t\tcombobox.changed.connect (this.item_changed);\n" 8999"\n" 9000"\t\t/* Add the combobox to this window */\n" 9001"\t\tthis.add (combobox);\n" 9002"\t\tcombobox.show ();\n" 9003"\t}\n" 9004"\n" 9005"\tvoid item_changed (Gtk.ComboBox combo) {\n" 9006"\t\tif (combo.get_active () !=0) {\n" 9007"\t\t\tprint (\"You chose \" + file [combo.get_active ()] +\"\\n\");\n" 9008"\t\t}\n" 9009"\t}\n" 9010"}\n" 9011"\n" 9012"class MyApplication : Gtk.Application {\n" 9013" protected override void activate () {\n" 9014" new MyWindow (this).show ();\n" 9015" }\n" 9016"}\n" 9017"\n" 9018"int main (string[] args) {\n" 9019"\treturn new MyApplication ().run (args);\n" 9020"}\n" 9021msgstr "" 9022 9023#. (itstool) path: item/p 9024#: C/combobox_multicolumn.vala.page:38 9025msgid "" 9026"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ComboBox.html" 9027"\">GtkComboBox</link>" 9028msgstr "" 9029"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ComboBox.html" 9030"\">GtkComboBox</link>" 9031 9032#. (itstool) path: item/p 9033#: C/combobox_multicolumn.vala.page:39 9034msgid "" 9035"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ListStore.html" 9036"\">GtkListStore</link>" 9037msgstr "" 9038"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ListStore.html" 9039"\">GtkListStore</link>" 9040 9041#. (itstool) path: item/p 9042#: C/combobox_multicolumn.vala.page:40 9043msgid "" 9044"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellRendererText.html" 9045"\">GtkCellRendererText</link>" 9046msgstr "" 9047"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellRendererText.html" 9048"\">GtkCellRendererText</link>" 9049 9050#. (itstool) path: item/p 9051#: C/combobox_multicolumn.vala.page:41 9052msgid "" 9053"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellRendererPixbuf.html" 9054"\">GtkCellRendererPixbuf</link>" 9055msgstr "" 9056"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.CellRendererPixbuf.html" 9057"\">GtkCellRendererPixbuf</link>" 9058 9059#. (itstool) path: info/title 9060#: C/cpp.page:7 9061msgctxt "link" 9062msgid "C++" 9063msgstr "C++" 9064 9065#. (itstool) path: page/title 9066#: C/cpp.page:16 9067msgid "Code samples and platform demos in C++" 9068msgstr "Amostras de código e demonstrações da plataforma em C++" 9069 9070#. (itstool) path: section/title 9071#: C/cpp.page:21 C/js.page:36 C/py.page:39 C/vala.page:30 9072msgid "Examples of applications" 9073msgstr "Exemplos de aplicativos" 9074 9075#. (itstool) path: info/title 9076#: C/dialog.c.page:8 9077msgctxt "text" 9078msgid "Dialog (C)" 9079msgstr "Dialog (C)" 9080 9081#. (itstool) path: info/desc 9082#: C/dialog.c.page:20 C/dialog.js.page:18 C/dialog.py.page:20 9083#: C/dialog.vala.page:18 9084#, fuzzy 9085msgid "A popup window" 9086msgstr "** Tag HTML desconhecida ** Impossível criar janela de pop-up!" 9087 9088#. (itstool) path: page/title 9089#: C/dialog.c.page:23 C/dialog.js.page:21 C/dialog.py.page:23 9090#: C/dialog.vala.page:21 9091msgid "Dialog" 9092msgstr "Diálogo" 9093 9094#. (itstool) path: page/media 9095#. This is a reference to an external file such as an image or video. When 9096#. the file changes, the md5 hash will change to let you know you need to 9097#. update your localized copy. The msgstr is not used at all. Set it to 9098#. whatever you like once you have updated your copy of the file. 9099#: C/dialog.c.page:25 C/dialog.js.page:22 C/dialog.py.page:24 9100#: C/dialog.vala.page:22 9101msgctxt "_" 9102msgid "external ref='media/dialog.png' md5='c90a33386a600e892fe623d4072c8c38'" 9103msgstr "external ref='media/dialog.png' md5='c90a33386a600e892fe623d4072c8c38'" 9104 9105#. (itstool) path: page/p 9106#: C/dialog.c.page:26 9107msgid "A dialog window that pops up when a button is pressed." 9108msgstr "" 9109 9110#. (itstool) path: page/code 9111#: C/dialog.c.page:28 9112#, no-wrap 9113msgid "" 9114"\n" 9115"#include <gtk/gtk.h>\n" 9116" \n" 9117"\n" 9118"/*Callback function in which reacts to the \"response\" signal. Be sure to place \n" 9119"it before the function it is called in*/\n" 9120"static void\n" 9121"on_response (GtkDialog *dialog,\n" 9122" gint response_id,\n" 9123" gpointer user_data)\n" 9124"{\n" 9125" /*For demonstration purposes, this will show the int value \n" 9126" of the response type*/\n" 9127" g_print (\"response is %d\\n\", response_id);\n" 9128" \n" 9129" /*This will cause the dialog to be destroyed*/\n" 9130" gtk_widget_destroy (GTK_WIDGET (dialog));\n" 9131"}\n" 9132"\n" 9133"\n" 9134"\n" 9135"/*Callback function in which reacts to the \"clicked\" signal*/\n" 9136"static void\n" 9137"show_dialog (GtkButton *button,\n" 9138" gpointer user_data)\n" 9139"{\n" 9140" GtkWindow *window = user_data;\n" 9141" GtkWidget *dialog;\n" 9142" GtkWidget *content_area;\n" 9143" GtkWidget *label;\n" 9144"\n" 9145" gint response_id;\n" 9146"\n" 9147" /*Create the dialog window. Modal windows prevent interaction with other \n" 9148" windows in the same application*/\n" 9149" dialog = gtk_dialog_new_with_buttons (\"A Gtk+ Dialog\", \n" 9150" window, \n" 9151" GTK_DIALOG_MODAL, \n" 9152" GTK_STOCK_OK, \n" 9153" GTK_RESPONSE_OK, \n" 9154" NULL);\n" 9155"\n" 9156" /*Create a label and attach it to the content area of the dialog*/\n" 9157" content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));\n" 9158" label = gtk_label_new (\"This demonstrates a dialog with a label\");\n" 9159" gtk_container_add (GTK_CONTAINER (content_area), label);\n" 9160"\n" 9161" /*The main purpose of this is to show dialog's child widget, label*/\n" 9162" gtk_widget_show_all (dialog);\n" 9163" \n" 9164" /*Connecting the \"response\" signal from the user to the associated\n" 9165" callback function*/\n" 9166" g_signal_connect (GTK_DIALOG (dialog), \n" 9167" \"response\", \n" 9168" G_CALLBACK (on_response), \n" 9169" NULL);\n" 9170"\n" 9171"}\n" 9172"\n" 9173"\n" 9174"\n" 9175"static void\n" 9176"activate (GtkApplication *app,\n" 9177" gpointer user_data)\n" 9178"{\n" 9179" GtkWidget *window;\n" 9180" GtkWidget *button;\n" 9181" \n" 9182" /*Create a window with a title and a default size*/\n" 9183" window = gtk_application_window_new (app);\n" 9184" gtk_window_set_title (GTK_WINDOW (window), \"GNOME Button\");\n" 9185" gtk_window_set_default_size (GTK_WINDOW (window), 250, 50);\n" 9186"\n" 9187" /*Create a button with a label, and add it to the window*/\n" 9188" button = gtk_button_new_with_label (\"Click Me\");\n" 9189" gtk_container_add (GTK_CONTAINER (window), button);\n" 9190" \n" 9191" /*Connecting the clicked signal to the callback*/\n" 9192" g_signal_connect (GTK_BUTTON (button), \n" 9193" \"clicked\", \n" 9194" G_CALLBACK (show_dialog), \n" 9195" GTK_WINDOW (window));\n" 9196" \n" 9197" gtk_widget_show_all (window);\n" 9198"}\n" 9199" \n" 9200"\n" 9201"\n" 9202"int\n" 9203"main (int argc, char **argv)\n" 9204"{\n" 9205" GtkApplication *app;\n" 9206" int status;\n" 9207" \n" 9208" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 9209" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 9210" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 9211" g_object_unref (app);\n" 9212" \n" 9213" return status;\n" 9214"}\n" 9215msgstr "" 9216 9217#. (itstool) path: item/p 9218#: C/dialog.c.page:36 9219msgid "" 9220"<link href=\"http://developer.gnome.org/gtk3/stable/GtkDialog.html" 9221"\">GtkDialog</link>" 9222msgstr "" 9223"<link href=\"http://developer.gnome.org/gtk3/stable/GtkDialog.html" 9224"\">GtkDialog</link>" 9225 9226#. (itstool) path: item/p 9227#: C/dialog.c.page:37 C/radiobutton.c.page:36 C/spinbutton.c.page:38 9228#: C/switch.c.page:35 9229msgid "" 9230"<link href=\"http://developer.gnome.org/gtk3/stable/GtkLabel.html" 9231"\">GtkLabel</link>" 9232msgstr "" 9233"<link href=\"http://developer.gnome.org/gtk3/stable/GtkLabel.html" 9234"\">GtkLabel</link>" 9235 9236#. (itstool) path: info/title 9237#: C/dialog.js.page:8 9238msgctxt "text" 9239msgid "Dialog (JavaScript)" 9240msgstr "Dialog (JavaScript)" 9241 9242#. (itstool) path: page/p 9243#: C/dialog.js.page:23 9244msgid "" 9245"A customizable popup window, which has a content area and an action area. " 9246"This example dialog's content area contains a short message, and its action " 9247"area contains a button which dismisses the dialog." 9248msgstr "" 9249 9250#. (itstool) path: page/code 9251#: C/dialog.js.page:25 9252#, fuzzy, no-wrap 9253#| msgid "" 9254#| "#!/usr/bin/gjs\n" 9255#| "\n" 9256#| "const Gtk = imports.gi.Gtk;\n" 9257#| "const Lang = imports.lang;\n" 9258#| "\n" 9259#| "const WelcomeToTheGrid = new Lang.Class({\n" 9260#| " Name: 'Welcome to the Grid',\n" 9261#| "\n" 9262#| " // Create the application itself\n" 9263#| " _init: function() {\n" 9264#| " this.application = new Gtk.Application();\n" 9265#| "\n" 9266#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 9267#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 9268#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 9269#| " },\n" 9270#| "\n" 9271#| " // Callback function for 'activate' signal presents windows when active\n" 9272#| " _onActivate: function() {\n" 9273#| " this._window.present();\n" 9274#| " },\n" 9275#| "\n" 9276#| " // Callback function for 'startup' signal builds the UI\n" 9277#| " _onStartup: function() {\n" 9278#| " this._buildUI ();\n" 9279#| " },\n" 9280#| "\n" 9281#| "\n" 9282#| "\n" 9283#| " // Build the application's UI\n" 9284#| " _buildUI: function() {\n" 9285#| "\n" 9286#| " // Create the application window\n" 9287#| " this._window = new Gtk.ApplicationWindow({\n" 9288#| " application: this.application,\n" 9289#| " window_position: Gtk.WindowPosition.CENTER,\n" 9290#| " border_width: 10,\n" 9291#| " title: \"Welcome to the Grid\"});\n" 9292#| "\n" 9293#| " // Create the Grid\n" 9294#| " this._grid = new Gtk.Grid ({\n" 9295#| " // column_homogeneous: true,\n" 9296#| " // column_spacing: 20,\n" 9297#| " row_spacing: 20 });\n" 9298#| "\n" 9299#| " // Create an image\n" 9300#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 9301#| "\n" 9302#| " // Create a second image using a stock icon\n" 9303#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 9304#| "\n" 9305#| " // Create a label\n" 9306#| " this._label = new Gtk.Label ({\n" 9307#| " label: \"Welcome to GNOME, too!\",\n" 9308#| " /* margin_top: 20 */ });\n" 9309#| "\n" 9310#| " /* Create a second label\n" 9311#| " this._labelTwo = new Gtk.Label ({\n" 9312#| " label: \"The cake is a pie.\" }); */\n" 9313#| "\n" 9314#| " /* Create a button\n" 9315#| " this._button = new Gtk.Button ({\n" 9316#| " label: \"Welcome to GNOME, too!\"}); */\n" 9317#| "\n" 9318#| " // Attach the images and button to the grid\n" 9319#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 9320#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 9321#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 9322#| "\n" 9323#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 9324#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 9325#| "\n" 9326#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 9327#| "\n" 9328#| " // Add the grid to the window\n" 9329#| " this._window.add (this._grid);\n" 9330#| "\n" 9331#| " // Show the window and all child widgets\n" 9332#| " this._window.show_all();\n" 9333#| " }\n" 9334#| "\n" 9335#| "});\n" 9336#| "\n" 9337#| "// Run the application\n" 9338#| "let app = new WelcomeToTheGrid ();\n" 9339#| "app.application.run (ARGV);\n" 9340msgid "" 9341"#!/usr/bin/gjs\n" 9342"\n" 9343"imports.gi.versions.Gtk = '3.0';\n" 9344"\n" 9345"const Gio = imports.gi.Gio;\n" 9346"const GLib = imports.gi.GLib;\n" 9347"const Gtk = imports.gi.Gtk;\n" 9348"\n" 9349"class DialogExample {\n" 9350"\n" 9351" // Create the application itself\n" 9352" constructor() {\n" 9353" this.application = new Gtk.Application ({\n" 9354" application_id: 'org.example.jsdialog',\n" 9355" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 9356" });\n" 9357"\n" 9358" // Connect 'activate' and 'startup' signals to the callback functions\n" 9359" this.application.connect('activate', this._onActivate.bind(this));\n" 9360" this.application.connect('startup', this._onStartup.bind(this));\n" 9361" }\n" 9362"\n" 9363" // Callback function for 'activate' signal presents windows when active\n" 9364" _onActivate() {\n" 9365" this._window.present();\n" 9366" }\n" 9367"\n" 9368" // Callback function for 'startup' signal builds the UI\n" 9369" _onStartup() {\n" 9370" this._buildUI();\n" 9371" }\n" 9372"\n" 9373" // Build the application's UI\n" 9374" _buildUI() {\n" 9375"\n" 9376" // Create the application window\n" 9377" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n" 9378" window_position: Gtk.WindowPosition.CENTER,\n" 9379" title: \"Gtk.Dialog Example\",\n" 9380" default_height: 50,\n" 9381" default_width: 250 });\n" 9382"\n" 9383" // Create a button\n" 9384" this._button = new Gtk.Button ({label: \"Click Me\"});\n" 9385" this._window.add (this._button);\n" 9386"\n" 9387" // Bind it to the function that creates the dialog\n" 9388" this._button.connect (\"clicked\", this._createDialog.bind(this));\n" 9389"\n" 9390" // Show the window and all child widgets\n" 9391" this._window.show_all();\n" 9392" }\n" 9393"\n" 9394" _createDialog() {\n" 9395"\n" 9396" // Create the dialog\n" 9397" this._dialog = new Gtk.Dialog ({ transient_for: this._window,\n" 9398" modal: true,\n" 9399" title: \"A Gtk+ dialog\" });\n" 9400"\n" 9401" // Create the dialog's content area, which contains a message\n" 9402" this._contentArea = this._dialog.get_content_area();\n" 9403" this._message = new Gtk.Label ({label: \"This demonstrates a dialog with a label\"});\n" 9404" this._contentArea.add (this._message);\n" 9405"\n" 9406" // Create the dialog's action area, which contains a stock OK button\n" 9407" this._actionArea = this._dialog.get_action_area();\n" 9408" this._OKButton = Gtk.Button.new_from_stock (Gtk.STOCK_OK);\n" 9409" this._actionArea.add (this._OKButton);\n" 9410"\n" 9411" // Connect the button to the function that handles what it does\n" 9412" this._OKButton.connect (\"clicked\", this._OKHandler.bind(this));\n" 9413"\n" 9414" this._dialog.show_all();\n" 9415" }\n" 9416"\n" 9417" _OKHandler(dialog, response_id) {\n" 9418"\n" 9419" // Destroy the dialog\n" 9420" this._dialog.destroy();\n" 9421" }\n" 9422"\n" 9423"};\n" 9424"\n" 9425"// Run the application\n" 9426"let app = new DialogExample ();\n" 9427"app.application.run (ARGV);\n" 9428msgstr "" 9429"#!/usr/bin/gjs\n" 9430"\n" 9431"const Gtk = imports.gi.Gtk;\n" 9432"const Lang = imports.lang;\n" 9433"\n" 9434"const WelcomeToTheGrid = new Lang.Class({\n" 9435" Name: 'Bem-vindo à Grid',\n" 9436"\n" 9437" // Cria o aplicativo em si\n" 9438" _init: function() {\n" 9439" this.application = new Gtk.Application();\n" 9440"\n" 9441" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 9442" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 9443" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 9444" },\n" 9445"\n" 9446" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 9447" _onActivate: function() {\n" 9448" this._window.present();\n" 9449" },\n" 9450"\n" 9451" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 9452" _onStartup: function() {\n" 9453" this._buildUI ();\n" 9454" },\n" 9455"\n" 9456"\n" 9457"\n" 9458" // Constrói a interface gráfica do aplicativo\n" 9459" _buildUI: function() {\n" 9460"\n" 9461" // Cria a janela do aplicativo\n" 9462" this._window = new Gtk.ApplicationWindow({\n" 9463" application: this.application,\n" 9464" window_position: Gtk.WindowPosition.CENTER,\n" 9465" border_width: 10,\n" 9466" title: \"Bem-vindo à Grid\"});\n" 9467"\n" 9468" // Cria a Grid\n" 9469" this._grid = new Gtk.Grid ({\n" 9470" // column_homogeneous: true,\n" 9471" // column_spacing: 20,\n" 9472" row_spacing: 20 });\n" 9473"\n" 9474" // Cria uma imagem\n" 9475" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 9476"\n" 9477" // Cria uma segunda imagem usando um ícone padrão\n" 9478" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 9479"\n" 9480" // Cria um rótulo\n" 9481" this._label = new Gtk.Label ({\n" 9482" label: \"Bem-vindo ao GNOME, também!\",\n" 9483" /* margin_top: 20 */ });\n" 9484"\n" 9485" /* Cria um segundo rótulo\n" 9486" this._labelTwo = new Gtk.Label ({\n" 9487" label: \"O bolo é uma torta.\" }); */\n" 9488"\n" 9489" /* Cria um botão\n" 9490" this._button = new Gtk.Button ({\n" 9491" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 9492"\n" 9493" // Anexa as imagens e botão à grade\n" 9494" this._grid.attach (this._image, 0, 0, 2, 1);\n" 9495" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 9496" this._grid.attach (this._label, 1, 1, 1, 1);\n" 9497"\n" 9498" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 9499" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 9500"\n" 9501" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 9502"\n" 9503" // Adiciona a grade à janela\n" 9504" this._window.add (this._grid);\n" 9505"\n" 9506" // Mostra a janela e todos os widgets filhos\n" 9507" this._window.show_all();\n" 9508" }\n" 9509"\n" 9510"});\n" 9511"\n" 9512"// Executa o aplicativo\n" 9513"let app = new WelcomeToTheGrid ();\n" 9514"app.application.run (ARGV);\n" 9515 9516#. (itstool) path: item/p 9517#: C/dialog.js.page:32 9518msgid "" 9519"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Dialog.html" 9520"\">Gtk.Dialog</link>" 9521msgstr "" 9522 9523#. (itstool) path: info/title 9524#: C/dialog.py.page:8 9525msgctxt "text" 9526msgid "Dialog (Python)" 9527msgstr "Dialog (Python)" 9528 9529#. (itstool) path: page/p 9530#: C/dialog.py.page:25 9531msgid "A dialog with the response signal connected to a callback function." 9532msgstr "" 9533 9534#. (itstool) path: section/code 9535#: C/dialog.py.page:32 9536#, no-wrap 9537msgid "" 9538"from gi.repository import Gtk\n" 9539"import sys\n" 9540"\n" 9541"\n" 9542"class MyWindow(Gtk.ApplicationWindow):\n" 9543" # construct a window (the parent window)\n" 9544"\n" 9545" def __init__(self, app):\n" 9546" Gtk.Window.__init__(self, title=\"GNOME Button\", application=app)\n" 9547" self.set_default_size(250, 50)\n" 9548"\n" 9549" # a button on the parent window\n" 9550" button = Gtk.Button(\"Click me\")\n" 9551" # connect the signal \"clicked\" of the button with the function\n" 9552" # on_button_click()\n" 9553" button.connect(\"clicked\", self.on_button_click)\n" 9554" # add the button to the window\n" 9555" self.add(button)\n" 9556"\n" 9557" # callback function for the signal \"clicked\" of the button in the parent\n" 9558" # window\n" 9559" def on_button_click(self, widget):\n" 9560" # create a Gtk.Dialog\n" 9561" dialog = Gtk.Dialog()\n" 9562" dialog.set_title(\"A Gtk+ Dialog\")\n" 9563" # The window defined in the constructor (self) is the parent of the dialog.\n" 9564" # Furthermore, the dialog is on top of the parent window\n" 9565" dialog.set_transient_for(self)\n" 9566" # set modal true: no interaction with other windows of the application\n" 9567" dialog.set_modal(True)\n" 9568" # add a button to the dialog window\n" 9569" dialog.add_button(button_text=\"OK\", response_id=Gtk.ResponseType.OK)\n" 9570" # connect the \"response\" signal (the button has been clicked) to the\n" 9571" # function on_response()\n" 9572" dialog.connect(\"response\", self.on_response)\n" 9573"\n" 9574" # get the content area of the dialog, add a label to it\n" 9575" content_area = dialog.get_content_area()\n" 9576" label = Gtk.Label(\"This demonstrates a dialog with a label\")\n" 9577" content_area.add(label)\n" 9578" # show the dialog\n" 9579" dialog.show_all()\n" 9580"\n" 9581" def on_response(self, widget, response_id):\n" 9582" print(\"response_id is\", response_id)\n" 9583" # destroy the widget (the dialog) when the function on_response() is called\n" 9584" # (that is, when the button of the dialog has been clicked)\n" 9585" widget.destroy()\n" 9586"\n" 9587"\n" 9588"class MyApplication(Gtk.Application):\n" 9589"\n" 9590" def __init__(self):\n" 9591" Gtk.Application.__init__(self)\n" 9592"\n" 9593" def do_activate(self):\n" 9594" win = MyWindow(self)\n" 9595" win.show_all()\n" 9596"\n" 9597" def do_startup(self):\n" 9598" Gtk.Application.do_startup(self)\n" 9599"\n" 9600"app = MyApplication()\n" 9601"exit_status = app.run(sys.argv)\n" 9602"sys.exit(exit_status)\n" 9603msgstr "" 9604 9605#. (itstool) path: section/title 9606#: C/dialog.py.page:37 9607#, fuzzy 9608msgid "Useful methods for a Dialog widget" 9609msgstr "Métodos úteis" 9610 9611#. (itstool) path: section/p 9612#: C/dialog.py.page:38 9613msgid "" 9614"In line 16 the signal <code>\"clicked\"</code> is connected to the callback " 9615"function <code>on_button_click()</code> using <code><var>widget</var>." 9616"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 9617"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 9618msgstr "" 9619 9620#. (itstool) path: item/p 9621#: C/dialog.py.page:40 9622msgid "" 9623"Instead of <code>set_modal(True)</code> we could have " 9624"<code>set_modal(False)</code> followed by " 9625"<code>set_destroy_with_parent(True)</code> that would destroy the dialog " 9626"window if the main window is closed." 9627msgstr "" 9628 9629#. (itstool) path: item/p 9630#: C/dialog.py.page:41 9631msgid "" 9632"<code>add_button(button_text=\"The Answer\", response_id=42)</code>, where " 9633"<code>42</code> is any integer, is an alternative to " 9634"<code>add_button(button_text=\"text\", response_id=Gtk.ResponseType." 9635"RESPONSE)</code>, where <code>RESPONSE</code> could be one of <code>OK, " 9636"CANCEL, CLOSE, YES, NO, APPLY, HELP</code>, which in turn correspond to the " 9637"integers <code>-5, -6,..., -11</code>." 9638msgstr "" 9639 9640#. (itstool) path: item/p 9641#: C/dialog.py.page:51 C/messagedialog.py.page:60 9642msgid "" 9643"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkDialog.html" 9644"\">GtkDialog</link>" 9645msgstr "" 9646"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkDialog.html" 9647"\">GtkDialog</link>" 9648 9649#. (itstool) path: info/title 9650#: C/dialog.vala.page:8 9651msgctxt "text" 9652msgid "Dialog (Vala)" 9653msgstr "Dialog (Vala)" 9654 9655#. (itstool) path: page/p 9656#: C/dialog.vala.page:23 9657msgid "A dialog with the response signal hooked up to a callback function." 9658msgstr "" 9659 9660#. (itstool) path: page/code 9661#: C/dialog.vala.page:25 9662#, no-wrap 9663msgid "" 9664"\n" 9665"/* A window in the application. */\n" 9666"public class MyWindow : Gtk.ApplicationWindow {\n" 9667"\n" 9668"\t/* Constructor */\n" 9669"\tinternal MyWindow (MyApplication app) {\n" 9670"\t\tObject (application: app, title: \"GNOME Button\");\n" 9671"\n" 9672"\t\tthis.window_position = Gtk.WindowPosition.CENTER;\n" 9673"\t\tthis.set_default_size (250,50);\n" 9674"\n" 9675"\t\tvar button = new Gtk.Button.with_label (\"Click Me\");\n" 9676"\n" 9677"\t\t/* Connect the button's \"clicked\" signal to\n" 9678"\t\t * the signal handler (aka. this.callback function).\n" 9679"\t\t */\n" 9680"\t\tbutton.clicked.connect (this.on_button_click);\n" 9681"\n" 9682"\t\t/* Add the button to this window and show it. */\n" 9683"\t\tthis.add (button);\n" 9684"\t\tbutton.show ();\n" 9685"\t}\n" 9686"\n" 9687"\t/* The signal handler for the buttons 'clicked' signal. */\n" 9688"\tvoid on_button_click (Gtk.Button button) {\n" 9689"\t\tvar dialog = new Gtk.Dialog.with_buttons (\"A Gtk+ Dialog\", this,\n" 9690" Gtk.DialogFlags.MODAL,\n" 9691" Gtk.Stock.OK,\n" 9692" Gtk.ResponseType.OK, null);\n" 9693"\n" 9694"\t\tvar content_area = dialog.get_content_area ();\n" 9695"\t\tvar label = new Gtk.Label (\"This demonstrates a dialog with a label\");\n" 9696"\n" 9697"\t\tcontent_area.add (label);\n" 9698"\n" 9699"\t\t/* Connect the 'response' signal of the dialog\n" 9700"\t\t * the signal handler. It is emitted when the dialog's\n" 9701"\t\t * OK button is clicked.\n" 9702"\t\t */\n" 9703"\t\tdialog.response.connect (on_response);\n" 9704"\n" 9705"\t\t/* Show the dialog and all the widgets. */\n" 9706"\t\tdialog.show_all ();\n" 9707"\t}\n" 9708"\n" 9709"\t/* Signal handler for the 'response' signal of the dialog. */\n" 9710" void on_response (Gtk.Dialog dialog, int response_id) {\n" 9711"\n" 9712" /* To see the int value of the ResponseType. This is only\n" 9713"\t\t * for demonstration purposes.*/\n" 9714" print (\"response is %d\\n\", response_id);\n" 9715"\n" 9716"\t\t/* This causes the dialog to be destroyed. */\n" 9717" dialog.destroy ();\n" 9718" }\n" 9719"\n" 9720"}\n" 9721"\n" 9722"/* This is the application. */\n" 9723"public class MyApplication : Gtk.Application {\n" 9724"\n" 9725"\t/* The constructor of the application. */\n" 9726"\tinternal MyApplication () {\n" 9727"\t\tObject (application_id: \"org.example.MyApplication\");\n" 9728"\t}\n" 9729"\n" 9730"\t/* Override the 'activate' signal of GLib.Application. */\n" 9731"\tprotected override void activate () {\n" 9732"\n" 9733"\t\t/* Create a window for the this application and show it. */\n" 9734"\t\tnew MyWindow (this).show ();\n" 9735"\t}\n" 9736"}\n" 9737"\n" 9738"/* The main function creates and runs the application. */\n" 9739"public int main (string[] args) {\n" 9740"\treturn new MyApplication ().run (args);\n" 9741"}\n" 9742msgstr "" 9743 9744#. (itstool) path: item/p 9745#: C/dialog.vala.page:32 9746msgid "" 9747"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Dialog.html\">Gtk.Dialog</" 9748"link>" 9749msgstr "" 9750 9751#. (itstool) path: item/p 9752#: C/dialog.vala.page:33 9753msgid "" 9754"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Dialog.Dialog.with_buttons." 9755"html\">Gtk.Dialog.with_buttons</link>" 9756msgstr "" 9757 9758#. (itstool) path: item/p 9759#: C/dialog.vala.page:34 C/label.vala.page:33 9760msgid "" 9761"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Label.html\">Gtk.Label</" 9762"link>" 9763msgstr "" 9764 9765#. (itstool) path: item/p 9766#: C/dialog.vala.page:35 9767msgid "" 9768"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Dialog.get_content_area.html" 9769"\">get_content_area</link>" 9770msgstr "" 9771 9772#. (itstool) path: info/title 9773#: C/entry.c.page:8 9774msgctxt "text" 9775msgid "Entry (C)" 9776msgstr "Entry (C)" 9777 9778#. (itstool) path: info/desc 9779#: C/entry.c.page:18 C/entry.py.page:25 C/entry.vala.page:18 9780#, fuzzy 9781msgid "A single line text entry field" 9782msgstr "Oculta o texto no campo de entrada do diálogo de entrada de texto." 9783 9784#. (itstool) path: page/title 9785#: C/entry.c.page:21 C/entry.js.page:21 C/entry.py.page:28 C/entry.vala.page:21 9786#, fuzzy 9787msgid "Entry" 9788msgstr "entrada" 9789 9790#. (itstool) path: page/media 9791#. This is a reference to an external file such as an image or video. When 9792#. the file changes, the md5 hash will change to let you know you need to 9793#. update your localized copy. The msgstr is not used at all. Set it to 9794#. whatever you like once you have updated your copy of the file. 9795#: C/entry.c.page:23 C/entry.js.page:22 C/entry.py.page:29 C/entry.vala.page:22 9796msgctxt "_" 9797msgid "external ref='media/entry.png' md5='8a828cffdcbaa4bad83342e109f28cc8'" 9798msgstr "external ref='media/entry.png' md5='8a828cffdcbaa4bad83342e109f28cc8'" 9799 9800#. (itstool) path: page/p 9801#: C/entry.c.page:24 C/entry.vala.page:23 9802#, fuzzy 9803msgid "This application greets you in the terminal." 9804msgstr "Aplicativo no terminal" 9805 9806#. (itstool) path: page/code 9807#: C/entry.c.page:26 9808#, no-wrap 9809msgid "" 9810"\n" 9811"#include <gtk/gtk.h>\n" 9812"\n" 9813"\n" 9814"\n" 9815"/*This is the callback function. It is a handler function \n" 9816"which reacts to the signal. In this case, it will grab the \n" 9817"text input from the entry box and print out a line to the user.*/\n" 9818"static void\n" 9819"on_activate (GtkEntry *entry,\n" 9820" gpointer user_data)\n" 9821"{\n" 9822" const char *name;\n" 9823" name = gtk_entry_get_text (entry);\n" 9824"\n" 9825" g_print (\"\\nHello %s!\\n\\n\", name);\n" 9826"}\n" 9827"\n" 9828"\n" 9829"\n" 9830"static void\n" 9831"activate (GtkApplication *app,\n" 9832" gpointer user_data)\n" 9833"{\n" 9834" GtkWidget *window;\n" 9835" GtkWidget *entry_box;\n" 9836"\n" 9837" /*Create a window with a title, a default size, \n" 9838" and a set border width*/\n" 9839" window = gtk_application_window_new (app);\n" 9840" gtk_window_set_title (GTK_WINDOW (window), \"What is your name?\");\n" 9841" gtk_window_set_default_size (GTK_WINDOW (window), 300, 100);\n" 9842" gtk_container_set_border_width (GTK_CONTAINER (window), 10);\n" 9843"\n" 9844" /*Create a new entry box, and add it to the window*/\n" 9845" entry_box = gtk_entry_new ();\n" 9846" gtk_container_add (GTK_CONTAINER (window), entry_box);\n" 9847"\n" 9848" /*Connecting the activate signal to the callback*/\n" 9849" g_signal_connect (GTK_ENTRY (entry_box), \"activate\", \n" 9850" G_CALLBACK (on_activate), NULL);\n" 9851"\n" 9852" gtk_widget_show_all (window);\n" 9853"}\n" 9854"\n" 9855"\n" 9856"\n" 9857"int\n" 9858"main (int argc, char **argv)\n" 9859"{\n" 9860" GtkApplication *app;\n" 9861" int status;\n" 9862"\n" 9863" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 9864" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 9865" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 9866" g_object_unref (app);\n" 9867"\n" 9868" return status;\n" 9869"}\n" 9870msgstr "" 9871 9872#. (itstool) path: info/title 9873#: C/entry.js.page:8 9874msgctxt "text" 9875msgid "Entry (JavaScript)" 9876msgstr "Entry (JavaScript)" 9877 9878#. (itstool) path: info/desc 9879#: C/entry.js.page:18 9880#, fuzzy 9881msgid "A single-line text entry field" 9882msgstr "Oculta o texto no campo de entrada do diálogo de entrada de texto." 9883 9884#. (itstool) path: page/p 9885#: C/entry.js.page:23 9886msgid "This application greets you by name through a pop-up window." 9887msgstr "" 9888 9889#. (itstool) path: page/code 9890#: C/entry.js.page:25 9891#, fuzzy, no-wrap 9892#| msgid "" 9893#| "#!/usr/bin/gjs\n" 9894#| "\n" 9895#| "const GLib = imports.gi.GLib;\n" 9896#| "const Gtk = imports.gi.Gtk;\n" 9897#| "const Lang = imports.lang;\n" 9898#| "const Webkit = imports.gi.WebKit;\n" 9899#| "\n" 9900#| "const HelloGNOME = new Lang.Class ({\n" 9901#| " Name: 'Hello GNOME',\n" 9902#| "\n" 9903#| " // Create the application itself\n" 9904#| " _init: function () {\n" 9905#| " this.application = new Gtk.Application ();\n" 9906#| "\n" 9907#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 9908#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 9909#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 9910#| " },\n" 9911#| "\n" 9912#| " // Callback function for 'activate' signal presents windows when active\n" 9913#| " _onActivate: function () {\n" 9914#| " this._window.present ();\n" 9915#| " },\n" 9916#| "\n" 9917#| " // Callback function for 'startup' signal builds the UI\n" 9918#| " _onStartup: function () {\n" 9919#| " this._buildUI ();\n" 9920#| " },\n" 9921#| "\n" 9922#| " // Build the application's UI\n" 9923#| " _buildUI: function () {\n" 9924#| "\n" 9925#| " // Create the application window\n" 9926#| " this._window = new Gtk.ApplicationWindow ({\n" 9927#| " application: this.application,\n" 9928#| " title: \"Welcome to GNOME\",\n" 9929#| " default_height: 200,\n" 9930#| " default_width: 400,\n" 9931#| " window_position: Gtk.WindowPosition.CENTER });\n" 9932#| "\n" 9933#| " // Create a webview to show the web app\n" 9934#| " this._webView = new Webkit.WebView ();\n" 9935#| "\n" 9936#| " // Put the web app into the webview\n" 9937#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 9938#| " \"/hellognome.html\", null));\n" 9939#| "\n" 9940#| " // Put the webview into the window\n" 9941#| " this._window.add (this._webView);\n" 9942#| "\n" 9943#| " // Show the window and all child widgets\n" 9944#| " this._window.show_all();\n" 9945#| " },\n" 9946#| "\n" 9947#| "});\n" 9948#| "\n" 9949#| "// Run the application\n" 9950#| "let app = new HelloGNOME ();\n" 9951#| "app.application.run (ARGV);\n" 9952msgid "" 9953"#!/usr/bin/gjs\n" 9954"\n" 9955"imports.gi.versions.Gtk = '3.0';\n" 9956"\n" 9957"const Gio = imports.gi.Gio;\n" 9958"const GLib = imports.gi.GLib;\n" 9959"const Gtk = imports.gi.Gtk;\n" 9960"\n" 9961"class EntryExample {\n" 9962"\n" 9963" // Create the application itself\n" 9964" constructor() {\n" 9965" this.application = new Gtk.Application({\n" 9966" application_id: 'org.example.jsentry',\n" 9967" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 9968" });\n" 9969"\n" 9970" // Connect 'activate' and 'startup' signals to the callback functions\n" 9971" this.application.connect('activate', this._onActivate.bind(this));\n" 9972" this.application.connect('startup', this._onStartup.bind(this));\n" 9973" }\n" 9974"\n" 9975" // Callback function for 'activate' signal presents windows when active\n" 9976" _onActivate() {\n" 9977" this._window.present();\n" 9978" }\n" 9979"\n" 9980" // Callback function for 'startup' signal builds the UI\n" 9981" _onStartup() {\n" 9982" this._buildUI();\n" 9983" }\n" 9984"\n" 9985" // Build the application's UI\n" 9986" _buildUI() {\n" 9987"\n" 9988" // Create the application window\n" 9989" this._window = new Gtk.ApplicationWindow({\n" 9990" application: this.application,\n" 9991" window_position: Gtk.WindowPosition.CENTER,\n" 9992" default_height: 100,\n" 9993" default_width: 300,\n" 9994" border_width: 10,\n" 9995" title: \"What is your name?\"});\n" 9996"\n" 9997" // Create the text entry box\n" 9998" this.entry = new Gtk.Entry ();\n" 9999" this._window.add(this.entry);\n" 10000"\n" 10001" // Connect the text entry box to a function that responds to what you type in\n" 10002" this.entry.connect(\"activate\", this._hello.bind(this));\n" 10003"\n" 10004" // Show the window and all child widgets\n" 10005" this._window.show_all();\n" 10006" }\n" 10007"\n" 10008" _hello() {\n" 10009"\n" 10010" // Create a popup dialog to greet the person who types in their name\n" 10011" this._greeter = new Gtk.MessageDialog ({\n" 10012" transient_for: this._window,\n" 10013" modal: true,\n" 10014" text: \"Hello, \" + this.entry.get_text() + \"!\",\n" 10015" message_type: Gtk.MessageType.OTHER,\n" 10016" buttons: Gtk.ButtonsType.OK,\n" 10017" });\n" 10018"\n" 10019" // Show the popup dialog\n" 10020" this._greeter.show();\n" 10021"\n" 10022" // Bind the OK button to the function that closes the popup\n" 10023" this._greeter.connect (\"response\", this._okClicked.bind(this));\n" 10024" }\n" 10025"\n" 10026" _okClicked() {\n" 10027" this._greeter.destroy();\n" 10028" }\n" 10029"\n" 10030"};\n" 10031"\n" 10032"// Run the application\n" 10033"let app = new EntryExample ();\n" 10034"app.application.run (ARGV);\n" 10035msgstr "" 10036"#!/usr/bin/gjs\n" 10037"\n" 10038"const GLib = imports.gi.GLib;\n" 10039"const Gtk = imports.gi.Gtk;\n" 10040"const Lang = imports.lang;\n" 10041"const Webkit = imports.gi.WebKit;\n" 10042"\n" 10043"const HelloGNOME = new Lang.Class ({\n" 10044" Name: 'Olá, GNOME',\n" 10045"\n" 10046" // Cria o aplicativo em si\n" 10047" _init: function () {\n" 10048" this.application = new Gtk.Application ();\n" 10049"\n" 10050" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 10051" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 10052" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 10053" },\n" 10054"\n" 10055" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 10056" _onActivate: function () {\n" 10057" this._window.present ();\n" 10058" },\n" 10059"\n" 10060" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 10061" _onStartup: function () {\n" 10062" this._buildUI ();\n" 10063" },\n" 10064"\n" 10065" // Constrói a interface gráfica do aplicativo\n" 10066" _buildUI: function () {\n" 10067"\n" 10068" // Cria a janela do aplicativo\n" 10069" this._window = new Gtk.ApplicationWindow ({\n" 10070" application: this.application,\n" 10071" title: \"Bem-vindo ao GNOME\",\n" 10072" default_height: 200,\n" 10073" default_width: 400,\n" 10074" window_position: Gtk.WindowPosition.CENTER });\n" 10075"\n" 10076" // Cria um webview para mostrar o aplicativo web\n" 10077" this._webView = new Webkit.WebView ();\n" 10078"\n" 10079" // Coloca o aplicativo web no webview\n" 10080" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 10081" \"/hellognome.html\", null));\n" 10082"\n" 10083" // Coloca o webview na janela\n" 10084" this._window.add (this._webView);\n" 10085"\n" 10086" // Mostra a janela e todos seus widgets filhos\n" 10087" this._window.show_all();\n" 10088" },\n" 10089"\n" 10090"});\n" 10091"\n" 10092"// Executa o aplicativo\n" 10093"let app = new HelloGNOME ();\n" 10094"app.application.run (ARGV);\n" 10095 10096#. (itstool) path: item/p 10097#: C/entry.js.page:32 10098msgid "" 10099"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Entry.html" 10100"\">Gtk.Entry</link>" 10101msgstr "" 10102 10103#. (itstool) path: info/title 10104#: C/entry.py.page:8 10105msgctxt "text" 10106msgid "Entry (Python)" 10107msgstr "Entry (Python)" 10108 10109#. (itstool) path: credit/name 10110#: C/entry.py.page:21 C/label.py.page:22 C/model-view-controller.py.page:16 10111#: C/properties.py.page:16 C/signals-callbacks.py.page:16 C/strings.py.page:16 10112#: C/textview.py.page:16 C/toolbar_builder.py.page:28 10113#, fuzzy 10114msgid "Sebastian Pölsterl" 10115msgstr "Sebastian Rasmussen" 10116 10117#. (itstool) path: credit/years 10118#: C/entry.py.page:23 C/index.page:20 C/model-view-controller.py.page:18 10119#: C/properties.py.page:18 C/signals-callbacks.py.page:18 C/strings.py.page:18 10120#: C/textview.py.page:18 C/toolbar_builder.py.page:30 10121msgid "2011" 10122msgstr "2011" 10123 10124#. (itstool) path: page/p 10125#: C/entry.py.page:30 10126msgid "This application greets you in the terminal with the name you provide." 10127msgstr "" 10128 10129#. (itstool) path: section/code 10130#: C/entry.py.page:36 10131#, no-wrap 10132msgid "" 10133"from gi.repository import Gtk\n" 10134"import sys\n" 10135"\n" 10136"\n" 10137"class MyWindow(Gtk.ApplicationWindow):\n" 10138"\n" 10139" def __init__(self, app):\n" 10140" Gtk.Window.__init__(self, title=\"What is your name?\", application=app)\n" 10141" self.set_default_size(300, 100)\n" 10142" self.set_border_width(10)\n" 10143"\n" 10144" # a single line entry\n" 10145" name_box = Gtk.Entry()\n" 10146" # emits a signal when the Enter key is pressed, connected to the\n" 10147" # callback function cb_activate\n" 10148" name_box.connect(\"activate\", self.cb_activate)\n" 10149"\n" 10150" # add the Gtk.Entry to the window\n" 10151" self.add(name_box)\n" 10152"\n" 10153" # the content of the entry is used to write in the terminal\n" 10154" def cb_activate(self, entry):\n" 10155" # retrieve the content of the widget\n" 10156" name = entry.get_text()\n" 10157" # print it in a nice form in the terminal\n" 10158" print(\"Hello \" + name + \"!\")\n" 10159"\n" 10160"\n" 10161"class MyApplication(Gtk.Application):\n" 10162"\n" 10163" def __init__(self):\n" 10164" Gtk.Application.__init__(self)\n" 10165"\n" 10166" def do_activate(self):\n" 10167" win = MyWindow(self)\n" 10168" win.show_all()\n" 10169"\n" 10170" def do_startup(self):\n" 10171" Gtk.Application.do_startup(self)\n" 10172"\n" 10173"app = MyApplication()\n" 10174"exit_status = app.run(sys.argv)\n" 10175"sys.exit(exit_status)\n" 10176msgstr "" 10177 10178#. (itstool) path: section/title 10179#: C/entry.py.page:40 10180#, fuzzy 10181msgid "Useful methods for an Entry widget" 10182msgstr "Métodos úteis" 10183 10184#. (itstool) path: section/p 10185#: C/entry.py.page:41 10186msgid "" 10187"In line 14 the signal <code>\"activate\"</code> is connected to the callback " 10188"function <code>cb_activate()</code> using <code><var>widget</var>." 10189"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 10190"xref=\"signals-callbacks.py\"/> for a more detailed explanation. Some of the " 10191"signals that a Gtk.Entry widget can emit are: <code>\"activate\"</code> " 10192"(emitted when the user activates the Entry key); <code>\"backspace\"</code> " 10193"(emitted when the user activates the Backspace or Shift-Backspace keys); " 10194"<code>\"copy-clipboard\"</code> (Ctrl-c and Ctrl-Insert); <code>\"paste-" 10195"clipboard\"</code> (Ctrl-v and Shift-Insert); <code>\"delete-from-cursor\"</" 10196"code> (Delete, for deleting a character; Ctrl-Delete, for deleting a word); " 10197"<code>\"icon-press\"</code> (emitted when the user clicks an activatable " 10198"icon); <code>\"icon-release\"</code> (emitted on the button release from a " 10199"mouse click over an activatable icon); <code>\"insert-at-cursor\"</code> " 10200"(emitted when the user initiates the insertion of a fixed string at the " 10201"cursor); <code>\"move-cursor\"</code> (emitted when the user initiates a " 10202"cursor movement); <code>\"populate-popup\"</code> (emitted before showing " 10203"the context menu of the entry; it can be used to add items to it)." 10204msgstr "" 10205 10206#. (itstool) path: item/p 10207#: C/entry.py.page:43 10208msgid "" 10209"<code>get_buffer()</code> and <code>set_buffer(buffer)</code>, where " 10210"<code>buffer</code> is a Gtk.EntryBuffer object, can be used to get and set " 10211"the buffer for the entry." 10212msgstr "" 10213 10214#. (itstool) path: item/p 10215#: C/entry.py.page:44 10216msgid "" 10217"<code>get_text()</code> and <code>set_text(\"some text\")</code> can be used " 10218"to get and set the content for the entry." 10219msgstr "" 10220 10221#. (itstool) path: item/p 10222#: C/entry.py.page:45 10223msgid "<code>get_text_length()</code> is self-explanatory." 10224msgstr "" 10225 10226#. (itstool) path: item/p 10227#: C/entry.py.page:46 10228msgid "" 10229"<code>get_text_area()</code> gets the area where the entry's text is drawn." 10230msgstr "" 10231 10232#. (itstool) path: item/p 10233#: C/entry.py.page:47 10234msgid "" 10235"If we set <code>set_visibility(False)</code> the characters in the entry are " 10236"displayed as the invisible char. This is the best available in the current " 10237"font, but it can be changed with <code>set_invisible_char(ch)</code>, where " 10238"<code>ch</code> is a Unicode character. The latter method is reversed by " 10239"<code>unset_invisible_char()</code>." 10240msgstr "" 10241 10242#. (itstool) path: item/p 10243#: C/entry.py.page:48 10244msgid "" 10245"<code>set_max_length(int)</code>, where <code>int</code> is an integer, " 10246"truncates every entry longer than <code>int</code> to have the desired " 10247"maximum length." 10248msgstr "" 10249 10250#. (itstool) path: item/p 10251#: C/entry.py.page:49 10252msgid "" 10253"By default, if you press the Entry key the Gtk.Entry emits the signal <code>" 10254"\"activate\"</code>. If you would like to activate the default widget for " 10255"the window (set using <code>set_default(widget)</code> on the window), then " 10256"use <code>set_activates_default(True)</code>." 10257msgstr "" 10258 10259#. (itstool) path: item/p 10260#: C/entry.py.page:50 10261msgid "To set a frame around the entry: <code>set_has_frame(True)</code>." 10262msgstr "" 10263 10264#. (itstool) path: item/p 10265#: C/entry.py.page:51 10266msgid "" 10267"<code>set_placeholder_text(\"some text\")</code> sets the text to be " 10268"displayed in the entry when it is empty and unfocused." 10269msgstr "" 10270 10271#. (itstool) path: item/p 10272#: C/entry.py.page:52 10273msgid "" 10274"<code>set_overwrite_mode(True)</code> and <code>set_overwrite_mode(False)</" 10275"code> are self-explanatory." 10276msgstr "" 10277 10278#. (itstool) path: item/p 10279#: C/entry.py.page:53 10280msgid "" 10281"If we have <code>set_editable(False)</code> the user cannot edit the text in " 10282"the widget." 10283msgstr "" 10284 10285#. (itstool) path: item/p 10286#: C/entry.py.page:54 10287msgid "" 10288"<code>set_completion(completion)</code>, where <code>completion</code> is a " 10289"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkEntryCompletion.html" 10290"\"><code>Gtk.EntryCompletion</code></link>, sets completion - or disables it " 10291"if <code>completion</code> is <code>None</code>." 10292msgstr "" 10293 10294#. (itstool) path: item/p 10295#: C/entry.py.page:55 10296msgid "" 10297"An Entry widget can display progress or activity information behind the " 10298"text. We use <code>set_progress_fraction(fraction)</code>, where " 10299"<code>fraction</code> is a <code>float</code> between <code>0.0</code> and " 10300"<code>1.0</code> inclusive, to fill in the given fraction of the bar. We use " 10301"<code>set_progress_pulse_step()</code> to set the fraction of total entry " 10302"width to move the progress bouncing block for each call to " 10303"<code>progress_pulse()</code>. The latter method indicates that some " 10304"progress is made, and causes the progress indicator of the entry to enter " 10305"\"activity mode\", where a block bounces back and forth. Each call to " 10306"<code>progress_pulse()</code> causes the block to move by a little bit (the " 10307"amount of movement per pulse is determined, as said before, by " 10308"<code>set_progress_pulse_step()</code>)." 10309msgstr "" 10310 10311#. (itstool) path: item/p 10312#: C/entry.py.page:56 10313msgid "" 10314"An Entry widget can also show icons. These icons can be activatable by " 10315"clicking, can be set up as drag source and can have tooltips. To add an " 10316"icon, use <code>set_icon_from_stock(icon_position, stock_id)</code>, or one " 10317"of <code>set_icon_from_pixbuf(icon_position, pixbuf)</code>, " 10318"<code>set_icon_from_icon_name(icon_position, icon_name)</code>, where " 10319"<code>icon_position</code> is one of <code>Gtk.EntryIconPosition.PRIMARY</" 10320"code> (to set the icon at the beginning of the entry) <code>Gtk." 10321"EntryIconPosition.SECONDARY</code> (to set the icon at the end of the " 10322"entry). To set a tooltip on an icon, use " 10323"<code>set_icon_tooltip_text(\"tooltip text\")</code> or " 10324"<code>set_icon_tooltip_markup(\"tooltip text in Pango markup language\")</" 10325"code>." 10326msgstr "" 10327 10328#. (itstool) path: item/p 10329#: C/entry.py.page:64 10330msgid "" 10331"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkEntry.html" 10332"\">GtkEntry</link>" 10333msgstr "" 10334 10335#. (itstool) path: info/title 10336#: C/entry.vala.page:8 10337msgctxt "text" 10338msgid "Entry (Vala)" 10339msgstr "Entry (Vala)" 10340 10341#. (itstool) path: page/code 10342#: C/entry.vala.page:25 10343#, no-wrap 10344msgid "" 10345"/* A window in the application. */\n" 10346"class MyWindow : Gtk.ApplicationWindow {\n" 10347"\n" 10348"\t/* Constructor */\n" 10349"\tinternal MyWindow (MyApplication app) {\n" 10350"\t\tObject (application: app, title: \"What is your name?\");\n" 10351"\n" 10352"\t\tvar name_box = new Gtk.Entry ();\n" 10353"\n" 10354"\t\t/* Connect to the signal handler. */\n" 10355"\t\tname_box.activate.connect (this.on_activate);\n" 10356"\t\tname_box.show ();\n" 10357"\n" 10358"\t\tthis.set_default_size (300, 100);\n" 10359"\t\tthis.border_width = 10;\n" 10360"\n" 10361"\t\t/* Add the name_box to this window. */\n" 10362"\t\tthis.add (name_box);\n" 10363"\t}\n" 10364"\n" 10365"\t/* Signal handler (aka. callback function) for the 'activate'\n" 10366"\t * signal of a Gtk.Entry.\n" 10367"\t */\n" 10368"\tvoid on_activate (Gtk.Entry entry) {\n" 10369"\t\tname = entry.get_text ();\n" 10370"\t\tprint (\"\\nHello \" + name + \"!\\n\\n\");\n" 10371"\t}\n" 10372"}\n" 10373"\n" 10374"/* This is the application. */\n" 10375"class MyApplication : Gtk.Application {\n" 10376"\n" 10377"\t/* Constructor for the application. */\n" 10378"\tinternal MyApplication () {\n" 10379"\t\tObject (application_id: \"org.example.MyApplication\");\n" 10380"\t}\n" 10381"\n" 10382"\t/* Override the 'activate' signal of GLib.Application. */\n" 10383"\tprotected override void activate () {\n" 10384"\n" 10385"\t\t/* Create a new window for this application\n" 10386"\t\t * and show it. */\n" 10387"\t\tnew MyWindow (this).show ();\n" 10388"\t}\n" 10389"\n" 10390"}\n" 10391"\n" 10392"/* The main function creates and runs the application. */\n" 10393"int main (string[] args) {\n" 10394"\treturn new MyApplication ().run (args);\n" 10395"}\n" 10396msgstr "" 10397 10398#. (itstool) path: item/p 10399#: C/entry.vala.page:30 10400msgid "" 10401"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Entry.html\">Gtk.Entry</" 10402"link>" 10403msgstr "" 10404 10405#. (itstool) path: info/title 10406#: C/filechooserdialog.py.page:8 10407msgctxt "text" 10408msgid "FileChooserDialog (Python)" 10409msgstr "FileChooserDialog (Python)" 10410 10411#. (itstool) path: info/desc 10412#: C/filechooserdialog.py.page:22 10413#, fuzzy 10414msgid "A dialog suitable for \"Open\" and \"Save\" commands" 10415msgstr "O diretório para a janela de salvamento de jogos" 10416 10417#. (itstool) path: page/title 10418#: C/filechooserdialog.py.page:25 C/filechooserdialog.vala.page:24 10419msgid "FileChooserDialog" 10420msgstr "" 10421 10422#. (itstool) path: page/media 10423#. This is a reference to an external file such as an image or video. When 10424#. the file changes, the md5 hash will change to let you know you need to 10425#. update your localized copy. The msgstr is not used at all. Set it to 10426#. whatever you like once you have updated your copy of the file. 10427#: C/filechooserdialog.py.page:26 10428msgctxt "_" 10429msgid "" 10430"external ref='media/filechooserdialog_save.png' " 10431"md5='3a7a3b71b9d3a36066857843b68ff27f'" 10432msgstr "" 10433 10434#. (itstool) path: page/p 10435#: C/filechooserdialog.py.page:27 10436msgid "" 10437"This FileChooserDialog saves a text document, which can be opened or written " 10438"from scratch in a TextView (see below)." 10439msgstr "" 10440 10441#. (itstool) path: page/media 10442#. This is a reference to an external file such as an image or video. When 10443#. the file changes, the md5 hash will change to let you know you need to 10444#. update your localized copy. The msgstr is not used at all. Set it to 10445#. whatever you like once you have updated your copy of the file. 10446#: C/filechooserdialog.py.page:28 10447msgctxt "_" 10448msgid "" 10449"external ref='media/filechooserdialog_menu.png' " 10450"md5='8a75f04127a70eba0ed68a9eb1d3bbca'" 10451msgstr "" 10452 10453#. (itstool) path: page/p 10454#: C/filechooserdialog.py.page:29 10455msgid "It is also possible to call a FileChooserDialog to open a new document." 10456msgstr "" 10457 10458#. (itstool) path: section/title 10459#: C/filechooserdialog.py.page:34 10460#, fuzzy 10461msgid "Steps to recreate the example" 10462msgstr "Atualizar pré-_visualização" 10463 10464#. (itstool) path: item/p 10465#: C/filechooserdialog.py.page:36 10466msgid "" 10467"Create a file .ui to describe an app-menu with items \"New\", \"Open\", " 10468"\"Save\", \"Save as\", and \"Quit\". This can be done with Glade or in a " 10469"text editor. See <link xref=\"#xml\"/>" 10470msgstr "" 10471 10472#. (itstool) path: item/p 10473#: C/filechooserdialog.py.page:37 10474msgid "" 10475"Create a Python program for a Gtk.TextView with a Gtk.Buffer <code>self." 10476"buffer</code>, and a <code>self.file</code> which will be a Gio.File and we " 10477"set initially as <code>None</code>." 10478msgstr "" 10479 10480#. (itstool) path: item/p 10481#: C/filechooserdialog.py.page:38 10482msgid "" 10483"In this program, create also the actions corresponding to the items in the " 10484"app-menu, connect them to callback functions, and import the menu in the " 10485"<code>do_startup()</code> method with a Gtk.Builder." 10486msgstr "" 10487 10488#. (itstool) path: item/p 10489#: C/filechooserdialog.py.page:39 10490msgid "" 10491"\"New\" and \"Quit\" actions and callback functions are quite " 10492"straightforward, see <link xref=\"#code\"/>. See <link xref=\"signals-" 10493"callbacks.py\"/> for a more detailed explanation of signals and callback " 10494"functions." 10495msgstr "" 10496 10497#. (itstool) path: item/p 10498#: C/filechooserdialog.py.page:40 10499msgid "" 10500"\"Open\" callback should create and open a Gtk.FileChooserDialog for \"Open" 10501"\", connected with another callback function for each of the two \"Open\" " 10502"and \"Cancel\" buttons of the FileChooserDialog." 10503msgstr "" 10504 10505#. (itstool) path: item/p 10506#: C/filechooserdialog.py.page:41 10507msgid "" 10508"\"Save as\" works basically as \"Open\", but the callback function of the " 10509"\"Save\" button depends on a more complex method <code>save_to_file()</code>." 10510msgstr "" 10511 10512#. (itstool) path: item/p 10513#: C/filechooserdialog.py.page:42 10514msgid "" 10515"\"Save\" can be reduced to the case where the file is <code>None</code>, " 10516"that is the case where <code>self.file</code> is a new file, which in turn " 10517"is the case \"Save as\"; and to the case where the file is not <code>None</" 10518"code>, which in turn is reduced to <code>save_to_file()</code>." 10519msgstr "" 10520 10521#. (itstool) path: item/p 10522#: C/filechooserdialog.py.page:43 10523msgid "" 10524"Finally, the method <code>save_to_file()</code>: see <link xref=\"#code\"/>, " 10525"lines 146 - 175." 10526msgstr "" 10527 10528#. (itstool) path: section/title 10529#: C/filechooserdialog.py.page:48 10530msgid "XML file which creates the app-menu" 10531msgstr "" 10532 10533#. (itstool) path: section/code 10534#: C/filechooserdialog.py.page:49 C/filechooserdialog.vala.page:30 10535#, no-wrap 10536msgid "" 10537"<?xml version=\"1.0\"?>\n" 10538"<interface>\n" 10539" <menu id=\"appmenu\">\n" 10540" <section>\n" 10541" <item>\n" 10542" <attribute name=\"label\">New</attribute>\n" 10543" <attribute name=\"action\">win.new</attribute>\n" 10544" </item>\n" 10545" <item>\n" 10546" <attribute name=\"label\">Open</attribute>\n" 10547" <attribute name=\"action\">win.open</attribute>\n" 10548" </item>\n" 10549" </section>\n" 10550" <section>\n" 10551" <item>\n" 10552" <attribute name=\"label\">Save</attribute>\n" 10553" <attribute name=\"action\">win.save</attribute>\n" 10554" </item>\n" 10555" <item>\n" 10556" <attribute name=\"label\">Save As...</attribute>\n" 10557" <attribute name=\"action\">win.save-as</attribute>\n" 10558" </item>\n" 10559" </section>\n" 10560" <section>\n" 10561" <item>\n" 10562" <attribute name=\"label\">Quit</attribute>\n" 10563" <attribute name=\"action\">app.quit</attribute>\n" 10564" </item>\n" 10565" </section>\n" 10566" </menu>\n" 10567"</interface>\n" 10568msgstr "" 10569 10570#. (itstool) path: section/code 10571#: C/filechooserdialog.py.page:54 10572#, no-wrap 10573msgid "" 10574"from gi.repository import Gtk\n" 10575"from gi.repository import Gdk\n" 10576"from gi.repository import Gio\n" 10577"from gi.repository import GObject\n" 10578"import sys\n" 10579"\n" 10580"\n" 10581"class MyWindow(Gtk.ApplicationWindow):\n" 10582"\n" 10583" def __init__(self, app):\n" 10584" Gtk.Window.__init__(\n" 10585" self, title=\"FileChooserDialog Example\", application=app)\n" 10586" self.set_default_size(400, 400)\n" 10587"\n" 10588" # the actions for the window menu, connected to the callback functions\n" 10589" new_action = Gio.SimpleAction.new(\"new\", None)\n" 10590" new_action.connect(\"activate\", self.new_callback)\n" 10591" self.add_action(new_action)\n" 10592"\n" 10593" open_action = Gio.SimpleAction.new(\"open\", None)\n" 10594" open_action.connect(\"activate\", self.open_callback)\n" 10595" self.add_action(open_action)\n" 10596"\n" 10597" save_action = Gio.SimpleAction.new(\"save\", None)\n" 10598" save_action.connect(\"activate\", self.save_callback)\n" 10599" self.add_action(save_action)\n" 10600"\n" 10601" save_as_action = Gio.SimpleAction.new(\"save-as\", None)\n" 10602" save_as_action.connect(\"activate\", self.save_as_callback)\n" 10603" self.add_action(save_as_action)\n" 10604"\n" 10605" # the file\n" 10606" self.file = None\n" 10607"\n" 10608" # the textview with the buffer\n" 10609" self.buffer = Gtk.TextBuffer()\n" 10610" textview = Gtk.TextView(buffer=self.buffer)\n" 10611" textview.set_wrap_mode(Gtk.WrapMode.WORD)\n" 10612"\n" 10613" # a scrolled window for the textview\n" 10614" self.scrolled_window = Gtk.ScrolledWindow()\n" 10615" self.scrolled_window.set_policy(\n" 10616" Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n" 10617" self.scrolled_window.add(textview)\n" 10618" self.scrolled_window.set_border_width(5)\n" 10619"\n" 10620" # add the scrolled window to the window\n" 10621" self.add(self.scrolled_window)\n" 10622"\n" 10623" # callback for new\n" 10624" def new_callback(self, action, parameter):\n" 10625" self.buffer.set_text(\"\")\n" 10626" print(\"New file created\")\n" 10627"\n" 10628" # callback for open\n" 10629" def open_callback(self, action, parameter):\n" 10630" # create a filechooserdialog to open:\n" 10631" # the arguments are: title of the window, parent_window, action,\n" 10632" # (buttons, response)\n" 10633" open_dialog = Gtk.FileChooserDialog(\"Pick a file\", self,\n" 10634" Gtk.FileChooserAction.OPEN,\n" 10635" (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,\n" 10636" Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT))\n" 10637"\n" 10638" # not only local files can be selected in the file selector\n" 10639" open_dialog.set_local_only(False)\n" 10640" # dialog always on top of the textview window\n" 10641" open_dialog.set_modal(True)\n" 10642" # connect the dialog with the callback function open_response_cb()\n" 10643" open_dialog.connect(\"response\", self.open_response_cb)\n" 10644" # show the dialog\n" 10645" open_dialog.show()\n" 10646"\n" 10647" # callback function for the dialog open_dialog\n" 10648" def open_response_cb(self, dialog, response_id):\n" 10649" open_dialog = dialog\n" 10650" # if response is \"ACCEPT\" (the button \"Open\" has been clicked)\n" 10651" if response_id == Gtk.ResponseType.ACCEPT:\n" 10652" # self.file is the file that we get from the FileChooserDialog\n" 10653" self.file = open_dialog.get_file()\n" 10654" # an empty string (provisionally)\n" 10655" content = \"\"\n" 10656" try:\n" 10657" # load the content of the file into memory:\n" 10658" # success is a boolean depending on the success of the operation\n" 10659" # content is self-explanatory\n" 10660" # etags is an entity tag (can be used to quickly determine if the\n" 10661" # file has been modified from the version on the file system)\n" 10662" [success, content, etags] = self.file.load_contents(None)\n" 10663" except GObject.GError as e:\n" 10664" print(\"Error: \" + e.message)\n" 10665" # set the content as the text into the buffer\n" 10666" self.buffer.set_text(content, len(content))\n" 10667" print(\"opened: \" + open_dialog.get_filename())\n" 10668" # if response is \"CANCEL\" (the button \"Cancel\" has been clicked)\n" 10669" elif response_id == Gtk.ResponseType.CANCEL:\n" 10670" print(\"cancelled: FileChooserAction.OPEN\")\n" 10671" # destroy the FileChooserDialog\n" 10672" dialog.destroy()\n" 10673"\n" 10674" # callback function for save_as\n" 10675" def save_as_callback(self, action, parameter):\n" 10676" # create a filechooserdialog to save:\n" 10677" # the arguments are: title of the window, parent_window, action,\n" 10678" # (buttons, response)\n" 10679" save_dialog = Gtk.FileChooserDialog(\"Pick a file\", self,\n" 10680" Gtk.FileChooserAction.SAVE,\n" 10681" (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,\n" 10682" Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT))\n" 10683" # the dialog will present a confirmation dialog if the user types a file name that\n" 10684" # already exists\n" 10685" save_dialog.set_do_overwrite_confirmation(True)\n" 10686" # dialog always on top of the textview window\n" 10687" save_dialog.set_modal(True)\n" 10688" # if self.file has already been saved\n" 10689" if self.file is not None:\n" 10690" try:\n" 10691" # set self.file as the current filename for the file chooser\n" 10692" save_dialog.set_file(self.file)\n" 10693" except GObject.GError as e:\n" 10694" print(\"Error: \" + e.message)\n" 10695" # connect the dialog to the callback function save_response_cb()\n" 10696" save_dialog.connect(\"response\", self.save_response_cb)\n" 10697" # show the dialog\n" 10698" save_dialog.show()\n" 10699"\n" 10700" # callback function for the dialog save_dialog\n" 10701" def save_response_cb(self, dialog, response_id):\n" 10702" save_dialog = dialog\n" 10703" # if response is \"ACCEPT\" (the button \"Save\" has been clicked)\n" 10704" if response_id == Gtk.ResponseType.ACCEPT:\n" 10705" # self.file is the currently selected file\n" 10706" self.file = save_dialog.get_file()\n" 10707" # save to file (see below)\n" 10708" self.save_to_file()\n" 10709" # if response is \"CANCEL\" (the button \"Cancel\" has been clicked)\n" 10710" elif response_id == Gtk.ResponseType.CANCEL:\n" 10711" print(\"cancelled: FileChooserAction.SAVE\")\n" 10712" # destroy the FileChooserDialog\n" 10713" dialog.destroy()\n" 10714"\n" 10715" # callback function for save\n" 10716" def save_callback(self, action, parameter):\n" 10717" # if self.file is not already there\n" 10718" if self.file is not None:\n" 10719" self.save_to_file()\n" 10720" # self.file is a new file\n" 10721" else:\n" 10722" # use save_as\n" 10723" self.save_as_callback(action, parameter)\n" 10724"\n" 10725" # save_to_file\n" 10726" def save_to_file(self):\n" 10727" # get the content of the buffer, without hidden characters\n" 10728" [start, end] = self.buffer.get_bounds()\n" 10729" current_contents = self.buffer.get_text(start, end, False)\n" 10730" # if there is some content\n" 10731" if current_contents != \"\":\n" 10732" # set the content as content of self.file.\n" 10733" # arguments: contents, etags, make_backup, flags, GError\n" 10734" try:\n" 10735" self.file.replace_contents(current_contents,\n" 10736" None,\n" 10737" False,\n" 10738" Gio.FileCreateFlags.NONE,\n" 10739" None)\n" 10740" print(\"saved: \" + self.file.get_path())\n" 10741" except GObject.GError as e:\n" 10742" print(\"Error: \" + e.message)\n" 10743" # if the contents are empty\n" 10744" else:\n" 10745" # create (if the file does not exist) or overwrite the file in readwrite mode.\n" 10746" # arguments: etags, make_backup, flags, GError\n" 10747" try:\n" 10748" self.file.replace_readwrite(None,\n" 10749" False,\n" 10750" Gio.FileCreateFlags.NONE,\n" 10751" None)\n" 10752" print(\"saved: \" + self.file.get_path())\n" 10753" except GObject.GError as e:\n" 10754" print(\"Error: \" + e.message)\n" 10755"\n" 10756"\n" 10757"class MyApplication(Gtk.Application):\n" 10758"\n" 10759" def __init__(self):\n" 10760" Gtk.Application.__init__(self)\n" 10761"\n" 10762" def do_activate(self):\n" 10763" win = MyWindow(self)\n" 10764" win.show_all()\n" 10765"\n" 10766" def do_startup(self):\n" 10767" Gtk.Application.do_startup(self)\n" 10768"\n" 10769" # app action quit, connected to the callback function\n" 10770" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 10771" quit_action.connect(\"activate\", self.quit_callback)\n" 10772" self.add_action(quit_action)\n" 10773"\n" 10774" # get the menu from the ui file with a builder\n" 10775" builder = Gtk.Builder()\n" 10776" try:\n" 10777" builder.add_from_file(\"filechooserdialog.ui\")\n" 10778" except:\n" 10779" print(\"file not found\")\n" 10780" sys.exit()\n" 10781" menu = builder.get_object(\"appmenu\")\n" 10782" self.set_app_menu(menu)\n" 10783"\n" 10784" # callback function for quit\n" 10785" def quit_callback(self, action, parameter):\n" 10786" self.quit()\n" 10787"\n" 10788"app = MyApplication()\n" 10789"exit_status = app.run(sys.argv)\n" 10790"sys.exit(exit_status)\n" 10791msgstr "" 10792 10793#. (itstool) path: section/title 10794#: C/filechooserdialog.py.page:58 10795#, fuzzy 10796msgid "Useful methods for a FileChooserDialog" 10797msgstr "Métodos úteis" 10798 10799#. (itstool) path: section/p 10800#: C/filechooserdialog.py.page:59 10801msgid "" 10802"Note that the action of the FileChooserDialog can be one of the following: " 10803"<code>Gtk.FileChooserAction.OPEN</code> (the file chooser will only let the " 10804"user pick an existing file) <code>Gtk.FileChooserAction.SAVE</code> (the " 10805"file chooser will let the user pick an existing file, or type in a new " 10806"filename), <code>Gtk.FileChooserAction.SELECT_FOLDER</code> (the file " 10807"chooser will let the user pick an existing folder), <code>Gtk." 10808"FileChooserAction.CREATE_FOLDER</code> (the file chooser will let the user " 10809"name an existing or new folder)." 10810msgstr "" 10811 10812#. (itstool) path: section/p 10813#: C/filechooserdialog.py.page:60 10814msgid "Besides the methods used in the <link xref=\"#code\"/>, we have:" 10815msgstr "" 10816 10817#. (itstool) path: item/p 10818#: C/filechooserdialog.py.page:62 10819msgid "" 10820"<code>set_show_hidden(True)</code> is used to display hidden files and " 10821"folders." 10822msgstr "" 10823 10824#. (itstool) path: item/p 10825#: C/filechooserdialog.py.page:63 10826msgid "" 10827"<code>set_select_multiple(True)</code> sets that multiple files can be " 10828"selected. This is only relevant if the mode is <code>Gtk.FileChooserAction." 10829"OPEN</code> or <code>Gtk.FileChooserAction.SELECT_FOLDER</code>." 10830msgstr "" 10831 10832#. (itstool) path: item/p 10833#: C/filechooserdialog.py.page:64 10834msgid "" 10835"In a \"Save as\" dialog, <code>set_current_name(current_name)</code> sets " 10836"<code>current_name</code> in the file selector, as if entered by the user; " 10837"<code>current_name</code> can be something like <em>Untitled.txt</em>. This " 10838"method should not be used except in a \"Save as\" dialog." 10839msgstr "" 10840 10841#. (itstool) path: item/p 10842#: C/filechooserdialog.py.page:65 10843msgid "" 10844"The default current folder is \"recent items\". To set another folder use " 10845"<code>set_current_folder_uri(uri)</code>; but note you should use this " 10846"method and cause the file chooser to show a specific folder only when you " 10847"are doing a \"Save as\" command and you already have a file saved somewhere." 10848msgstr "" 10849 10850#. (itstool) path: item/p 10851#: C/filechooserdialog.py.page:73 10852msgid "" 10853"<link href=\"http://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html" 10854"\">GtkFileChooserDialog</link>" 10855msgstr "" 10856"<link href=\"http://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html" 10857"\">GtkFileChooserDialog</link>" 10858 10859#. (itstool) path: item/p 10860#: C/filechooserdialog.py.page:74 10861msgid "" 10862"<link href=\"http://developer.gnome.org/gtk3/stable/GtkFileChooser.html" 10863"\">GtkFileChooser</link>" 10864msgstr "" 10865"<link href=\"http://developer.gnome.org/gtk3/stable/GtkFileChooser.html" 10866"\">GtkFileChooser</link>" 10867 10868#. (itstool) path: item/p 10869#: C/filechooserdialog.py.page:75 C/image.c.page:34 C/label.c.page:38 10870#: C/menubar.c.page:38 C/scrolledwindow.c.page:35 10871msgid "" 10872"<link href=\"http://developer.gnome.org/gtk3/stable/GtkWindow.html" 10873"\">GtkWindow</link>" 10874msgstr "" 10875"<link href=\"http://developer.gnome.org/gtk3/stable/GtkWindow.html" 10876"\">GtkWindow</link>" 10877 10878#. (itstool) path: item/p 10879#: C/filechooserdialog.py.page:76 C/textview.c.page:39 10880msgid "" 10881"<link href=\"http://developer.gnome.org/gtk3/stable/GtkTextView.html" 10882"\">GtkTextView</link>" 10883msgstr "" 10884"<link href=\"http://developer.gnome.org/gtk3/stable/GtkTextView.html" 10885"\">GtkTextView</link>" 10886 10887#. (itstool) path: item/p 10888#: C/filechooserdialog.py.page:77 C/textview.c.page:38 10889msgid "" 10890"<link href=\"http://developer.gnome.org/gtk3/stable/GtkTextBuffer.html" 10891"\">GtkTextBuffer</link>" 10892msgstr "" 10893"<link href=\"http://developer.gnome.org/gtk3/stable/GtkTextBuffer.html" 10894"\">GtkTextBuffer</link>" 10895 10896#. (itstool) path: item/p 10897#: C/filechooserdialog.py.page:78 C/scrolledwindow.c.page:36 10898#: C/textview.c.page:40 10899msgid "" 10900"<link href=\"http://developer.gnome.org/gtk3/stable/GtkScrolledWindow.html" 10901"\">GtkScrolledWindow</link>" 10902msgstr "" 10903"<link href=\"http://developer.gnome.org/gtk3/stable/GtkScrolledWindow.html" 10904"\">GtkScrolledWindow</link>" 10905 10906#. (itstool) path: item/p 10907#: C/filechooserdialog.py.page:79 10908msgid "" 10909"<link href=\"http://developer.gnome.org/gio/stable/GFile.html\">GFile</link>" 10910msgstr "" 10911"<link href=\"http://developer.gnome.org/gio/stable/GFile.html\">GFile</link>" 10912 10913#. (itstool) path: item/p 10914#: C/filechooserdialog.py.page:81 10915msgid "" 10916"<link href=\"http://developer.gnome.org/gtk3/stable/GtkBuilder.html" 10917"\">GtkBuilder</link>" 10918msgstr "" 10919"<link href=\"http://developer.gnome.org/gtk3/stable/GtkBuilder.html" 10920"\">GtkBuilder</link>" 10921 10922#. (itstool) path: info/title 10923#: C/filechooserdialog.vala.page:8 10924msgctxt "text" 10925msgid "FileChooserDialog (Vala)" 10926msgstr "FileChooserDialog (Vala)" 10927 10928#. (itstool) path: info/desc 10929#: C/filechooserdialog.vala.page:21 10930#, fuzzy 10931msgid "A dialog suitable for \"Open\" and \"Save\" commands." 10932msgstr "O diretório para a janela de salvamento de jogos" 10933 10934#. (itstool) path: section/title 10935#: C/filechooserdialog.vala.page:26 10936#, fuzzy 10937msgid "Overview of the example" 10938msgstr "" 10939"GNOME permite que você personalize o que você deseja exibir nos resultados " 10940"de pesquisa no <gui>Panorama de atividades</gui>. Por exemplo, você pode " 10941"escolher se deseja mostrar resultados de páginas web, fotos ou músicas." 10942 10943#. (itstool) path: section/p 10944#: C/filechooserdialog.vala.page:27 10945msgid "" 10946"This example demonstrates how the FileChooserDialog can be used. It is " 10947"incorporated into a very simple text editor application. All the <link xref=" 10948"\"menubar.vala#win-app\">actions</link>, including the \"open\", \"save\" " 10949"and \"save-as\" commands can be found in the <link xref=\"gmenu.vala\">app-" 10950"menu</link>. Here, the app-menu is created using an XML UI file, which is " 10951"then imported into the application using Gtk.Builder." 10952msgstr "" 10953 10954#. (itstool) path: section/title 10955#: C/filechooserdialog.vala.page:29 10956msgid "XML UI file which creates the app-menu" 10957msgstr "" 10958 10959#. (itstool) path: section/title 10960#: C/filechooserdialog.vala.page:32 10961#, fuzzy 10962msgid "Vala Code" 10963msgstr "Código-fonte Vala" 10964 10965#. (itstool) path: section/code 10966#: C/filechooserdialog.vala.page:33 10967#, no-wrap 10968msgid "" 10969"class MyWindow: Gtk.ApplicationWindow {\n" 10970"\n" 10971"\t/* MyWindow instance variables. */\n" 10972"\tGLib.File? file;\n" 10973"\tGtk.TextBuffer buffer;\n" 10974"\tGtk.TextView textview;\n" 10975"\tGtk.ScrolledWindow scrolled_window;\n" 10976"\n" 10977"\t/* Create ActionEntries. */\n" 10978"\tconst ActionEntry[] actions = {\n" 10979"\t\t{ \"new\", new_cb },\n" 10980"\t\t{ \"open\", open_cb },\n" 10981"\t\t{ \"save\", save_cb },\n" 10982"\t\t{ \"save-as\", save_as_cb }\n" 10983"\t};\n" 10984"\n" 10985"\t/* Constructor creates MyWindow, and add the scrolled_window. */\n" 10986"\tinternal MyWindow (MyApplication app) {\n" 10987"\t\tObject (application: app, title: \"FileChooserDialog Example\");\n" 10988"\t\tthis.set_default_size (400, 400);\n" 10989"\n" 10990"\t\t/* Add the ActionEntries to MyWindow. */\n" 10991"\t\tthis.add_action_entries (actions, this);\n" 10992"\n" 10993"\t\tbuffer = new Gtk.TextBuffer (null); //stores text to be displayed\n" 10994"\t\ttextview = new Gtk.TextView.with_buffer (buffer); //displays TextBuffer\n" 10995"\t\ttextview.set_wrap_mode (Gtk.WrapMode.WORD); //sets line wrapping\n" 10996"\n" 10997"\t\tscrolled_window = new Gtk.ScrolledWindow (null, null);\n" 10998"\t\tscrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC,\n" 10999"\t\t Gtk.PolicyType.AUTOMATIC);\n" 11000"\n" 11001"\t\tscrolled_window.add (textview);\n" 11002"\t\tscrolled_window.set_border_width (5);\n" 11003"\n" 11004" this.add (scrolled_window);\n" 11005"\t\tthis.show_all ();\n" 11006"\t}\n" 11007"\n" 11008"\tvoid new_cb (SimpleAction action, Variant? parameter) {\n" 11009"\t\tfile = null;\n" 11010"\t\tbuffer.set_text (\"\");\n" 11011"\t\tprint (\"New file created\\n\");\n" 11012"\t}\n" 11013"\n" 11014"\t/* Create FileChooserDialog in OPEN mode. */\n" 11015"\tvoid open_cb (SimpleAction action, Variant? parameter) {\n" 11016"\n" 11017"\t\tvar open_dialog = new Gtk.FileChooserDialog (\"Pick a file\",\n" 11018"\t\t this as Gtk.Window,\n" 11019"\t\t Gtk.FileChooserAction.OPEN,\n" 11020"\t\t Gtk.Stock.CANCEL,\n" 11021"\t\t Gtk.ResponseType.CANCEL,\n" 11022"\t\t Gtk.Stock.OPEN,\n" 11023"\t\t Gtk.ResponseType.ACCEPT);\n" 11024"\n" 11025"\t\topen_dialog.local_only = false; //allow for uri\n" 11026"\t\topen_dialog.set_modal (true);\n" 11027"\t\topen_dialog.response.connect (open_response_cb);\n" 11028"\t\topen_dialog.show ();\n" 11029"\t}\n" 11030"\n" 11031"\t/* Either open the file and load the file contents or cancel. */\n" 11032"\tvoid open_response_cb (Gtk.Dialog dialog, int response_id) {\n" 11033"\t\tvar open_dialog = dialog as Gtk.FileChooserDialog;\n" 11034"\n" 11035"\t\tswitch (response_id) {\n" 11036"\t\t\tcase Gtk.ResponseType.ACCEPT: //open the file\n" 11037"\t\t\t\tfile = open_dialog.get_file();\n" 11038"\n" 11039"\t\t\t\tuint8[] file_contents;\n" 11040"\n" 11041"\t\t\t\ttry {\n" 11042"\t\t\t\t\tfile.load_contents (null, out file_contents, null);\n" 11043"\t\t\t\t}\n" 11044"\t\t\t\tcatch (GLib.Error err) { //handle the exception\n" 11045"\t\t\t\t\terror (\"%s\\n\", err.message);\n" 11046"\t\t\t\t}\n" 11047"\t\t\t\t/* Set the buffer text to be the contents of the file. */\n" 11048"\t\t\t\tbuffer.set_text ((string) file_contents,\n" 11049"\t\t\t\t file_contents.length);\n" 11050"\n" 11051"\t\t\t\tprint (\"opened: %s\\n\", (open_dialog.get_filename ()));\n" 11052"\t\t\t\tbreak;\n" 11053"\n" 11054"\t\t\tcase Gtk.ResponseType.CANCEL:\n" 11055"\t\t\t\tprint (\"cancelled: FileChooserAction.OPEN\\n\");\n" 11056"\t\t\t\tbreak;\n" 11057"\t\t}\n" 11058"\t\tdialog.destroy ();\n" 11059"\t}\n" 11060"\n" 11061"\n" 11062"\t/* Create FileChooserDialog in SAVE mode. */\n" 11063"\tvoid save_as_cb (SimpleAction action, Variant? parameter) {\n" 11064"\t\tvar save_dialog = new Gtk.FileChooserDialog (\"Pick a file\",\n" 11065"\t\t this as Gtk.Window,\n" 11066"\t\t Gtk.FileChooserAction.SAVE,\n" 11067"\t\t Gtk.Stock.CANCEL,\n" 11068"\t\t Gtk.ResponseType.CANCEL,\n" 11069"\t\t Gtk.Stock.SAVE,\n" 11070"\t\t Gtk.ResponseType.ACCEPT);\n" 11071"\n" 11072"\t\tsave_dialog.set_do_overwrite_confirmation (true);\n" 11073"\t\tsave_dialog.set_modal (true);\n" 11074"\t\tif (file != null) {\n" 11075"\t\t\ttry {\n" 11076"\t\t\t\t(save_dialog as Gtk.FileChooser).set_file (file);\n" 11077"\t\t\t}\n" 11078"\t\t\tcatch (GLib.Error error) {\n" 11079"\t\t\t\tprint (\"%s\\n\", error.message);\n" 11080"\t\t\t}\n" 11081"\t\t}\n" 11082"\t\tsave_dialog.response.connect (save_as_response_cb);\n" 11083"\t\tsave_dialog.show ();\n" 11084"\t}\n" 11085"\n" 11086"\tvoid save_as_response_cb (Gtk.Dialog dialog, int response_id) {\n" 11087"\t\tvar save_dialog = dialog as Gtk.FileChooserDialog;\n" 11088"\n" 11089"\t\tswitch (response_id) {\n" 11090"\t\t\tcase Gtk.ResponseType.ACCEPT:\n" 11091"\t\t\t\tfile = save_dialog.get_file();\n" 11092"\t\t\t\tthis.save_to_file ();\n" 11093"\t\t\t\tbreak;\n" 11094"\t\t\tdefault:\n" 11095"\t\t\t\tbreak;\n" 11096"\t\t}\n" 11097"\t\t\tdialog.destroy ();\n" 11098"\t}\n" 11099"\n" 11100"\t/* Save the existing contents to the file.\n" 11101"\t * If file does not exist, call save_as_cb.\n" 11102"\t */\n" 11103"\tvoid save_cb (SimpleAction action, Variant? parameter) {\n" 11104"\t\tif (file != null) {\n" 11105"\t\t\tthis.save_to_file ();\n" 11106"\t\t}\n" 11107"\t\telse {\n" 11108"\t\t\tsave_as_cb (action, parameter);\n" 11109"\t\t}\n" 11110"\t}\n" 11111"\n" 11112"\tvoid save_to_file (){\n" 11113"\t\tGtk.TextIter start;\n" 11114"\t\tGtk.TextIter end;\n" 11115"\n" 11116"\t\tbuffer.get_bounds (out start, out end);\n" 11117"\t\tstring current_contents = buffer.get_text (start, end, false);\n" 11118"\t\ttry {\n" 11119"\t\t\t\tfile.replace_contents (current_contents.data, null, false,\n" 11120"\t\t\t\t GLib.FileCreateFlags.NONE, null, null);\n" 11121"\n" 11122"\t\t\t\tprint (\"saved: %s\\n\", file.get_path ());\n" 11123"\t\t}\n" 11124"\t\tcatch (GLib.Error err) {\n" 11125"\t\t\terror (\"%s\\n\", err.message);\n" 11126"\t\t}\n" 11127"\t}\n" 11128"}\n" 11129"\n" 11130"/* This is the application */\n" 11131"class MyApplication: Gtk.Application {\n" 11132"\tprotected override void activate () {\n" 11133"\t\tnew MyWindow (this).show_all;\n" 11134"\t}\n" 11135"\n" 11136"\tconst ActionEntry[] actions = {\n" 11137"\t\t{ \"quit\", quit_cb }\n" 11138"\t};\n" 11139"\n" 11140"\tvoid quit_cb (SimpleAction action, Variant? parameter) {\n" 11141"\t\tthis.quit ();\n" 11142"\t}\n" 11143"\n" 11144"\tprotected override void startup () {\n" 11145"\t\tbase.startup ();\n" 11146"\n" 11147"\t\t/* Setup actions */\n" 11148"\t\tthis.add_action_entries (actions, this);\n" 11149"\n" 11150"\t\t/* Setup menus */\n" 11151"\t\tvar builder = new Gtk.Builder ();\n" 11152"\t\ttry {\n" 11153"\t\t\tbuilder.add_from_file (\"filechooserdialog.ui\");\n" 11154"\t\t} catch (GLib.Error err) {\n" 11155"\t\t\terror (\"Unable to load file: %s\\n\", err.message);\n" 11156"\t\t}\n" 11157"\t\tthis.app_menu = builder.get_object (\"appmenu\") as MenuModel;\n" 11158"\t}\n" 11159"}\n" 11160"\n" 11161"/* main creates and runs the application. */\n" 11162"public int main (string[] args) {\n" 11163"\treturn new MyApplication ().run (args);\n" 11164"}\n" 11165msgstr "" 11166 11167#. (itstool) path: section/title 11168#: C/filechooserdialog.vala.page:35 C/menubar.vala.page:187 11169#, fuzzy 11170msgid "Relevant API documentation" 11171msgstr "Navegador de documentação de API" 11172 11173#. (itstool) path: item/p 11174#: C/filechooserdialog.vala.page:40 11175msgid "" 11176"<link href=\"http://valadoc.org/gtk+-3.0/Gtk.FileChooser.html\">FileChooser</" 11177"link>" 11178msgstr "" 11179 11180#. (itstool) path: item/p 11181#: C/filechooserdialog.vala.page:41 11182msgid "" 11183"<link href=\"http://valadoc.org/gtk+-3.0/Gtk.FileChooserDialog.html" 11184"\">FileChooserDialog</link>" 11185msgstr "" 11186 11187#. (itstool) path: item/p 11188#: C/filechooserdialog.vala.page:42 11189msgid "" 11190"<link href=\"http://valadoc.org/gtk+-3.0/Gtk.Builder.html\">Gtk.Builder</" 11191"link>" 11192msgstr "" 11193 11194#. (itstool) path: item/p 11195#: C/filechooserdialog.vala.page:43 11196msgid "" 11197"<link href=\"http://valadoc.org/gio-2.0/GLib.ActionEntry.html\">GLib." 11198"ActionEntry</link>" 11199msgstr "" 11200 11201#. (itstool) path: info/title 11202#: C/fontchooserwidget.js.page:8 11203msgctxt "text" 11204msgid "FontChooserWidget (JavaScript)" 11205msgstr "FontChooserWidget (JavaScript)" 11206 11207#. (itstool) path: info/desc 11208#: C/fontchooserwidget.js.page:18 C/fontchooserwidget.py.page:20 11209#: C/fontchooserwidget.vala.page:18 11210#, fuzzy 11211msgid "A widget to choose a font" 11212msgstr "Widget de seleção de fontes" 11213 11214#. (itstool) path: page/title 11215#: C/fontchooserwidget.js.page:21 C/fontchooserwidget.py.page:23 11216#: C/fontchooserwidget.vala.page:21 11217msgid "FontChooserWidget" 11218msgstr "" 11219 11220#. (itstool) path: page/media 11221#. This is a reference to an external file such as an image or video. When 11222#. the file changes, the md5 hash will change to let you know you need to 11223#. update your localized copy. The msgstr is not used at all. Set it to 11224#. whatever you like once you have updated your copy of the file. 11225#: C/fontchooserwidget.js.page:23 C/fontchooserwidget.py.page:25 11226#: C/fontchooserwidget.vala.page:23 11227msgctxt "_" 11228msgid "" 11229"external ref='media/fontchooserwidget.png' " 11230"md5='9161245e307b432ae1313e9a9941edae'" 11231msgstr "" 11232"external ref='media/fontchooserwidget.png' " 11233"md5='9161245e307b432ae1313e9a9941edae'" 11234 11235#. (itstool) path: page/p 11236#: C/fontchooserwidget.js.page:24 C/fontchooserwidget.py.page:26 11237#, fuzzy 11238msgid "A FontChooserWidget with a callback function." 11239msgstr "slot_callback" 11240 11241#. (itstool) path: section/code 11242#: C/fontchooserwidget.js.page:30 11243#, fuzzy, no-wrap 11244#| msgid "" 11245#| "#!/usr/bin/gjs\n" 11246#| "\n" 11247#| "const GLib = imports.gi.GLib;\n" 11248#| "const Gtk = imports.gi.Gtk;\n" 11249#| "const Lang = imports.lang;\n" 11250#| "const Webkit = imports.gi.WebKit;\n" 11251#| "\n" 11252#| "const HelloGNOME = new Lang.Class ({\n" 11253#| " Name: 'Hello GNOME',\n" 11254#| "\n" 11255#| " // Create the application itself\n" 11256#| " _init: function () {\n" 11257#| " this.application = new Gtk.Application ();\n" 11258#| "\n" 11259#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 11260#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 11261#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 11262#| " },\n" 11263#| "\n" 11264#| " // Callback function for 'activate' signal presents windows when active\n" 11265#| " _onActivate: function () {\n" 11266#| " this._window.present ();\n" 11267#| " },\n" 11268#| "\n" 11269#| " // Callback function for 'startup' signal builds the UI\n" 11270#| " _onStartup: function () {\n" 11271#| " this._buildUI ();\n" 11272#| " },\n" 11273#| "\n" 11274#| " // Build the application's UI\n" 11275#| " _buildUI: function () {\n" 11276#| "\n" 11277#| " // Create the application window\n" 11278#| " this._window = new Gtk.ApplicationWindow ({\n" 11279#| " application: this.application,\n" 11280#| " title: \"Welcome to GNOME\",\n" 11281#| " default_height: 200,\n" 11282#| " default_width: 400,\n" 11283#| " window_position: Gtk.WindowPosition.CENTER });\n" 11284#| "\n" 11285#| " // Create a webview to show the web app\n" 11286#| " this._webView = new Webkit.WebView ();\n" 11287#| "\n" 11288#| " // Put the web app into the webview\n" 11289#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 11290#| " \"/hellognome.html\", null));\n" 11291#| "\n" 11292#| " // Put the webview into the window\n" 11293#| " this._window.add (this._webView);\n" 11294#| "\n" 11295#| " // Show the window and all child widgets\n" 11296#| " this._window.show_all();\n" 11297#| " },\n" 11298#| "\n" 11299#| "});\n" 11300#| "\n" 11301#| "// Run the application\n" 11302#| "let app = new HelloGNOME ();\n" 11303#| "app.application.run (ARGV);\n" 11304msgid "" 11305"//!/usr/bin/gjs\n" 11306"\n" 11307"imports.gi.versions.Gtk = '3.0';\n" 11308"const Gtk = imports.gi.Gtk;\n" 11309"\n" 11310"class FontChooserWidgetExample {\n" 11311"\n" 11312" // Create the application itthis\n" 11313" constructor() {\n" 11314" this.application = new Gtk.Application({ application_id: 'org.example.fontchooserwidget' });\n" 11315"\n" 11316" // Connect 'activate' and 'startup' signals to the callback functions\n" 11317" this.application.connect('activate', this._onActivate.bind(this));\n" 11318" this.application.connect('startup', this._onStartup.bind(this));\n" 11319" }\n" 11320"\n" 11321" // Callback function for 'activate' signal presents windows when active\n" 11322" _onActivate() {\n" 11323" this.window.present();\n" 11324" }\n" 11325"\n" 11326" // Callback function for 'startup' signal builds the UI\n" 11327" _onStartup() {\n" 11328" this._buildUI();\n" 11329" }\n" 11330"\n" 11331" // Build the application's UI\n" 11332" _buildUI() {\n" 11333" // Create the application window\n" 11334" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n" 11335" window_position: Gtk.WindowPosition.CENTER,\n" 11336" title: \"FontChooserWidget\",\n" 11337" default_width: 200,\n" 11338" default_height: 200,\n" 11339" border_width: 10 });\n" 11340"\n" 11341" this.fontChooser = new Gtk.FontChooserWidget();\n" 11342" // a default font\n" 11343" this.fontChooser.set_font(\"Sans\");\n" 11344" // a text to preview the font\n" 11345" this.fontChooser.set_preview_text(\"This is an example of preview text!\");\n" 11346"\n" 11347" // connect signal from the font chooser to the callback function\n" 11348" this.fontChooser.connect(\"notify::font\", this._fontCb.bind(this));\n" 11349"\n" 11350" // add the font chooser to the window\n" 11351" this.window.add(this.fontChooser);\n" 11352" this.window.show_all();\n" 11353" }\n" 11354"\n" 11355" // callback function:\n" 11356" _fontCb() {\n" 11357" // print in the terminal\n" 11358" print(\"You chose the font \" + this.fontChooser.get_font());\n" 11359" }\n" 11360"};\n" 11361"\n" 11362"// Run the application\n" 11363"let app = new FontChooserWidgetExample();\n" 11364"app.application.run (ARGV);\n" 11365msgstr "" 11366"#!/usr/bin/gjs\n" 11367"\n" 11368"const GLib = imports.gi.GLib;\n" 11369"const Gtk = imports.gi.Gtk;\n" 11370"const Lang = imports.lang;\n" 11371"const Webkit = imports.gi.WebKit;\n" 11372"\n" 11373"const HelloGNOME = new Lang.Class ({\n" 11374" Name: 'Olá, GNOME',\n" 11375"\n" 11376" // Cria o aplicativo em si\n" 11377" _init: function () {\n" 11378" this.application = new Gtk.Application ();\n" 11379"\n" 11380" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 11381" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 11382" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 11383" },\n" 11384"\n" 11385" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 11386" _onActivate: function () {\n" 11387" this._window.present ();\n" 11388" },\n" 11389"\n" 11390" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 11391" _onStartup: function () {\n" 11392" this._buildUI ();\n" 11393" },\n" 11394"\n" 11395" // Constrói a interface gráfica do aplicativo\n" 11396" _buildUI: function () {\n" 11397"\n" 11398" // Cria a janela do aplicativo\n" 11399" this._window = new Gtk.ApplicationWindow ({\n" 11400" application: this.application,\n" 11401" title: \"Bem-vindo ao GNOME\",\n" 11402" default_height: 200,\n" 11403" default_width: 400,\n" 11404" window_position: Gtk.WindowPosition.CENTER });\n" 11405"\n" 11406" // Cria um webview para mostrar o aplicativo web\n" 11407" this._webView = new Webkit.WebView ();\n" 11408"\n" 11409" // Coloca o aplicativo web no webview\n" 11410" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 11411" \"/hellognome.html\", null));\n" 11412"\n" 11413" // Coloca o webview na janela\n" 11414" this._window.add (this._webView);\n" 11415"\n" 11416" // Mostra a janela e todos seus widgets filhos\n" 11417" this._window.show_all();\n" 11418" },\n" 11419"\n" 11420"});\n" 11421"\n" 11422"// Executa o aplicativo\n" 11423"let app = new HelloGNOME ();\n" 11424"app.application.run (ARGV);\n" 11425 11426#. (itstool) path: item/p 11427#: C/fontchooserwidget.js.page:37 C/fontchooserwidget.py.page:47 11428msgid "" 11429"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkFontChooserWidget." 11430"html\">GtkFontChooserWidget</link>" 11431msgstr "" 11432 11433#. (itstool) path: info/title 11434#: C/fontchooserwidget.py.page:8 11435msgctxt "text" 11436msgid "FontChooserWidget (Python)" 11437msgstr "FontChooserWidget (Python)" 11438 11439#. (itstool) path: section/code 11440#: C/fontchooserwidget.py.page:32 11441#, no-wrap 11442msgid "" 11443"from gi.repository import Gtk\n" 11444"import sys\n" 11445"\n" 11446"\n" 11447"class MyWindow(Gtk.ApplicationWindow):\n" 11448"\n" 11449" def __init__(self, app):\n" 11450" Gtk.Window.__init__(self, title=\"FontChooserWidget\", application=app)\n" 11451"\n" 11452" # a font chooser\n" 11453" self.font_chooser = Gtk.FontChooserWidget()\n" 11454" # a default font\n" 11455" self.font_chooser.set_font(\"Sans\")\n" 11456" # a text to preview the font\n" 11457" self.font_chooser.set_preview_text(\n" 11458" \"This is an example of preview text!\")\n" 11459"\n" 11460" # connect signal from the font chooser to the callback function\n" 11461" self.font_chooser.connect(\"notify::font\", self.font_cb)\n" 11462"\n" 11463" # add the font chooser to the window\n" 11464" self.add(self.font_chooser)\n" 11465"\n" 11466" # callback function:\n" 11467" def font_cb(self, event, user_data):\n" 11468" # print in the terminal\n" 11469" print(\"You chose the font \" + self.font_chooser.get_font())\n" 11470"\n" 11471"\n" 11472"class MyApplication(Gtk.Application):\n" 11473"\n" 11474" def __init__(self):\n" 11475" Gtk.Application.__init__(self)\n" 11476"\n" 11477" def do_activate(self):\n" 11478" win = MyWindow(self)\n" 11479" win.show_all()\n" 11480"\n" 11481" def do_startup(self):\n" 11482" Gtk.Application.do_startup(self)\n" 11483"\n" 11484"app = MyApplication()\n" 11485"exit_status = app.run(sys.argv)\n" 11486"sys.exit(exit_status)\n" 11487msgstr "" 11488 11489#. (itstool) path: section/title 11490#: C/fontchooserwidget.py.page:35 11491#, fuzzy 11492msgid "Useful methods for a FontChooserWidget" 11493msgstr "Métodos úteis" 11494 11495#. (itstool) path: section/p 11496#: C/fontchooserwidget.py.page:36 11497msgid "" 11498"In line 16 the <code>\"notify::font\"</code> signal from the widget is " 11499"connected to the callback function <code>font_cb()</code> using " 11500"<code><var>widget</var>.connect(<var>signal</var>, <var>callback function</" 11501"var>)</code>. See <link xref=\"signals-callbacks.py\"/> for a more detailed " 11502"explanation." 11503msgstr "" 11504 11505#. (itstool) path: item/p 11506#: C/fontchooserwidget.py.page:38 11507msgid "" 11508"To set the font which is initially selected, use <code>set_font(font)</code> " 11509"(where <code>font</code> is the font name) or <code>set_font_desc(font)</" 11510"code> (where <code>font</code> is the PangoFontDescription)." 11511msgstr "" 11512 11513#. (itstool) path: item/p 11514#: C/fontchooserwidget.py.page:39 11515msgid "" 11516"To get the selected font use <code>get_font()</code> or " 11517"<code>get_font_desc()</code>." 11518msgstr "" 11519 11520#. (itstool) path: item/p 11521#: C/fontchooserwidget.py.page:40 11522msgid "" 11523"To change the text which is shown in the preview area, use " 11524"<code>set_preview_text()</code>." 11525msgstr "" 11526 11527#. (itstool) path: info/title 11528#: C/fontchooserwidget.vala.page:8 11529msgctxt "text" 11530msgid "FontChooserWidget (Vala)" 11531msgstr "FontChooserWidget (Vala)" 11532 11533#. (itstool) path: credit/name 11534#: C/fontchooserwidget.vala.page:13 11535#, fuzzy 11536msgid "Tiffany Antpoolski" 11537msgstr "Tiffany Antopolski" 11538 11539#. (itstool) path: page/p 11540#: C/fontchooserwidget.vala.page:24 11541msgid "A FontChooserWidget with a lambda callback function." 11542msgstr "" 11543 11544#. (itstool) path: section/code 11545#: C/fontchooserwidget.vala.page:30 11546#, no-wrap 11547msgid "" 11548"public class MyWindow : Gtk.ApplicationWindow {\n" 11549" internal MyWindow (MyApplication app) {\n" 11550" Object (application: app, title: \"FontChooserWidget\");\n" 11551"\n" 11552"\t\tvar font_chooser = new Gtk.FontChooserWidget ();\n" 11553"\t\tfont_chooser.set_font (\"Sans\");\n" 11554"\t\tfont_chooser.set_preview_text (\"This is an example of preview text!\");\n" 11555"\t\tthis.add (font_chooser);\n" 11556"\n" 11557"\t\tfont_chooser.notify[\"font\"].connect (() => {\n" 11558"\t\t\tprint (\"font: %s\\n\", font_chooser.get_font ().to_string ());\n" 11559"\t\t\tprint (\"desc: %s\\n\", font_chooser.get_font_desc ().to_string ());\n" 11560"\t\t\tprint (\"face: %s\\n\", font_chooser.get_font_face ().get_face_name ());\n" 11561"\t\t\tprint (\"size: %d\\n\", font_chooser.get_font_size ());\n" 11562"\t\t\tprint (\"family: %s\\n\", font_chooser.get_font_family ().get_name ());\n" 11563"\t\t\tprint (\"monospace: %s\\n\\n\", font_chooser.get_font_family ().is_monospace ().to_string ());\n" 11564"\t\t});\n" 11565"\n" 11566" this.show_all ();\n" 11567" }\n" 11568"}\n" 11569"\n" 11570"public class MyApplication : Gtk.Application {\n" 11571" protected override void activate () {\n" 11572" new MyWindow (this).show ();\n" 11573" }\n" 11574"}\n" 11575"\n" 11576"public int main (string[] args) {\n" 11577" return new MyApplication ().run (args);\n" 11578"}\n" 11579"\n" 11580msgstr "" 11581 11582#. (itstool) path: item/p 11583#: C/fontchooserwidget.vala.page:37 11584msgid "" 11585"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.FontChooserWidget.html" 11586"\">GtkFontChooserWidget</link>" 11587msgstr "" 11588 11589#. (itstool) path: info/title 11590#: C/gmenu.c.page:8 11591msgctxt "text" 11592msgid "GMenu (C)" 11593msgstr "GMenu (C)" 11594 11595#. (itstool) path: info/desc 11596#: C/gmenu.c.page:18 C/gmenu.js.page:18 C/gmenu.vala.page:24 11597#, fuzzy 11598msgid "A simple implementation of GMenuModel" 11599msgstr "O GMenuModel para a barra de menu" 11600 11601#. (itstool) path: page/title 11602#: C/gmenu.c.page:21 C/gmenu.js.page:21 C/gmenu.py.page:29 C/gmenu.vala.page:27 11603msgid "GMenu" 11604msgstr "" 11605 11606#. (itstool) path: page/media 11607#. This is a reference to an external file such as an image or video. When 11608#. the file changes, the md5 hash will change to let you know you need to 11609#. update your localized copy. The msgstr is not used at all. Set it to 11610#. whatever you like once you have updated your copy of the file. 11611#: C/gmenu.c.page:22 11612msgctxt "_" 11613msgid "external ref='media/gmenu.c.png' md5='f305fc3cae8d16d72b734ee53b559e33'" 11614msgstr "" 11615"external ref='media/gmenu.c.png' md5='f305fc3cae8d16d72b734ee53b559e33'" 11616 11617#. (itstool) path: page/p 11618#: C/gmenu.c.page:23 C/gmenu.js.page:23 C/gmenu.py.page:31 C/gmenu.vala.page:32 11619msgid "A GtkApplication with a simple GMenu and SimpleActions" 11620msgstr "" 11621 11622#. (itstool) path: page/code 11623#: C/gmenu.c.page:26 11624#, no-wrap 11625msgid "" 11626"\n" 11627"#include <gtk/gtk.h>\n" 11628"\n" 11629"static void\n" 11630"new_window (GSimpleAction *action,\n" 11631" GVariant *parameter,\n" 11632" gpointer user_data)\n" 11633"{\n" 11634" g_print (\"This does nothing. It is only a demonstration.\\n\");\n" 11635"}\n" 11636"\n" 11637"static void\n" 11638"quit (GSimpleAction *action,\n" 11639" GVariant *parameter,\n" 11640" gpointer user_data)\n" 11641"{\n" 11642" GApplication *application = user_data;\n" 11643"\n" 11644" g_application_quit (application);\n" 11645"}\n" 11646"\n" 11647"static void\n" 11648"startup (GtkApplication *application,\n" 11649" gpointer user_data)\n" 11650"{\n" 11651" static const GActionEntry actions[] = {\n" 11652" { \"new\", new_window },\n" 11653" { \"quit\", quit }\n" 11654" };\n" 11655"\n" 11656" GMenu *menu;\n" 11657"\n" 11658" g_action_map_add_action_entries (G_ACTION_MAP (application), actions, G_N_ELEMENTS (actions), application);\n" 11659"\n" 11660" menu = g_menu_new ();\n" 11661" g_menu_append (menu, \"New\", \"app.new\");\n" 11662" g_menu_append (menu, \"Quit\", \"app.quit\");\n" 11663" gtk_application_set_app_menu (application, G_MENU_MODEL (menu));\n" 11664" g_object_unref (menu);\n" 11665"}\n" 11666"\n" 11667"static void\n" 11668"activate (GtkApplication *app,\n" 11669" gpointer user_data)\n" 11670"{\n" 11671" GtkWidget *window;\n" 11672"\n" 11673" window = gtk_application_window_new (app);\n" 11674"\n" 11675" gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));\n" 11676" gtk_window_set_title (GTK_WINDOW (window), \"Hello GNOME\");\n" 11677"\n" 11678" gtk_widget_show_all (GTK_WIDGET (window));\n" 11679"}\n" 11680"\n" 11681"int\n" 11682"main (int argc, char **argv)\n" 11683"{\n" 11684" GtkApplication *app;\n" 11685" int status;\n" 11686"\n" 11687" app = gtk_application_new (\"org.gtk.example\",G_APPLICATION_FLAGS_NONE);\n" 11688" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 11689" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 11690" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 11691" g_object_unref (app);\n" 11692" return status;\n" 11693"}\n" 11694msgstr "" 11695 11696#. (itstool) path: info/title 11697#: C/gmenu.js.page:8 11698msgctxt "text" 11699msgid "GMenu (JavaScript)" 11700msgstr "GMenu (JavaScript)" 11701 11702#. (itstool) path: page/media 11703#. This is a reference to an external file such as an image or video. When 11704#. the file changes, the md5 hash will change to let you know you need to 11705#. update your localized copy. The msgstr is not used at all. Set it to 11706#. whatever you like once you have updated your copy of the file. 11707#: C/gmenu.js.page:22 11708msgctxt "_" 11709msgid "" 11710"external ref='media/gmenu.js.png' md5='16b8bee122197771ec8498dac42f196b'" 11711msgstr "" 11712"external ref='media/gmenu.js.png' md5='16b8bee122197771ec8498dac42f196b'" 11713 11714#. (itstool) path: page/code 11715#: C/gmenu.js.page:25 11716#, no-wrap 11717msgid "" 11718"#!/usr/bin/gjs\n" 11719"\n" 11720"imports.gi.versions.Gtk = '3.0';\n" 11721"\n" 11722"const Gio = imports.gi.Gio;\n" 11723"const GLib = imports.gi.GLib;\n" 11724"const Gtk = imports.gi.Gtk;\n" 11725"\n" 11726"class Application {\n" 11727"\n" 11728" //create the application\n" 11729" constructor() {\n" 11730" this.application = new Gtk.Application ({\n" 11731" application_id: 'org.example.myapp',\n" 11732" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 11733" });\n" 11734"\n" 11735" //connect to 'activate' and 'startup' signals to the callback functions\n" 11736" this.application.connect('activate', this._onActivate.bind(this));\n" 11737" this.application.connect('startup', this._onStartup.bind(this));\n" 11738" }\n" 11739"\n" 11740" //create the UI (in this case it's just the ApplicationWindow\n" 11741" _buildUI() {\n" 11742" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n" 11743" window_position: Gtk.WindowPosition.CENTER,\n" 11744" title: \"Welcome to GNOME\" });\n" 11745"\n" 11746" //uncommenting the line below will change the window size\n" 11747" //this._window.set_default_size(600, 400);\n" 11748"\n" 11749" //show the window and all child widgets (none in this case)\n" 11750" this._window.show_all();\n" 11751" }\n" 11752"\n" 11753" _showNew() {\n" 11754" print(\"This doesn't do anything. It is only a demonstration.\");\n" 11755" }\n" 11756"\n" 11757" _showAbout() {\n" 11758" print(\"No AboutDialog here. This is only a demonstration.\");\n" 11759" }\n" 11760"\n" 11761" //create the menu items and connect the signals to the callback functions.\n" 11762" _initMenus() {\n" 11763" let menu = new Gio.Menu();\n" 11764" menu.append(\"New\",'app.new');\n" 11765" menu.append(\"About\", 'app.about');\n" 11766" menu.append(\"Quit\",'app.quit');\n" 11767" this.application.set_app_menu(menu);\n" 11768"\n" 11769" let newAction = new Gio.SimpleAction ({ name: 'new' });\n" 11770" newAction.connect('activate', () => { this._showNew(); });\n" 11771" this.application.add_action(newAction);\n" 11772"\n" 11773" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n" 11774" aboutAction.connect('activate', () => { this._showAbout(); });\n" 11775" this.application.add_action(aboutAction);\n" 11776"\n" 11777" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 11778" quitAction.connect('activate', () => { this._window.destroy(); });\n" 11779" this.application.add_action(quitAction);\n" 11780" }\n" 11781"\n" 11782" //callback function for 'activate' signal\n" 11783" _onActivate() {\n" 11784" this._window.present();\n" 11785" }\n" 11786"\n" 11787" //callback function for 'startup' signal\n" 11788" _onStartup() {\n" 11789" //You must call _initMenus() before calling _buildUI().\n" 11790" this._initMenus();\n" 11791" this._buildUI();\n" 11792" }\n" 11793"};\n" 11794"\n" 11795"//run the application\n" 11796"let app = new Application ();\n" 11797"app.application.run (ARGV);\n" 11798msgstr "" 11799 11800#. (itstool) path: info/title 11801#: C/gmenu.py.page:8 11802msgctxt "text" 11803msgid "GMenu (Python)" 11804msgstr "GMenu (Python)" 11805 11806#. (itstool) path: info/desc 11807#: C/gmenu.py.page:26 11808#, fuzzy 11809msgid "A simple implementation of GMenu" 11810msgstr "Sem implementação" 11811 11812#. (itstool) path: page/media 11813#. This is a reference to an external file such as an image or video. When 11814#. the file changes, the md5 hash will change to let you know you need to 11815#. update your localized copy. The msgstr is not used at all. Set it to 11816#. whatever you like once you have updated your copy of the file. 11817#: C/gmenu.py.page:30 11818msgctxt "_" 11819msgid "" 11820"external ref='media/gmenu.py.png' md5='52c68b34d5d566f37e9f803dedb6353a'" 11821msgstr "" 11822"external ref='media/gmenu.py.png' md5='52c68b34d5d566f37e9f803dedb6353a'" 11823 11824#. (itstool) path: section/code 11825#: C/gmenu.py.page:37 11826#, no-wrap 11827msgid "" 11828"\n" 11829" from gi.repository import Gtk\n" 11830"from gi.repository import Gio\n" 11831"import sys\n" 11832"\n" 11833"\n" 11834"class MyWindow(Gtk.ApplicationWindow):\n" 11835"\n" 11836" def __init__(self, app):\n" 11837" Gtk.Window.__init__(self, title=\"GMenu Example\", application=app)\n" 11838"\n" 11839"\n" 11840"class MyApplication(Gtk.Application):\n" 11841"\n" 11842" def __init__(self):\n" 11843" Gtk.Application.__init__(self)\n" 11844"\n" 11845" def do_activate(self):\n" 11846" win = MyWindow(self)\n" 11847" win.show_all()\n" 11848"\n" 11849" def do_startup(self):\n" 11850" # start the application\n" 11851" Gtk.Application.do_startup(self)\n" 11852"\n" 11853" # create a menu\n" 11854" menu = Gio.Menu()\n" 11855" # append to the menu three options\n" 11856" menu.append(\"New\", \"app.new\")\n" 11857" menu.append(\"About\", \"app.about\")\n" 11858" menu.append(\"Quit\", \"app.quit\")\n" 11859" # set the menu as menu of the application\n" 11860" self.set_app_menu(menu)\n" 11861"\n" 11862" # create an action for the option \"new\" of the menu\n" 11863" new_action = Gio.SimpleAction.new(\"new\", None)\n" 11864" # connect it to the callback function new_cb\n" 11865" new_action.connect(\"activate\", self.new_cb)\n" 11866" # add the action to the application\n" 11867" self.add_action(new_action)\n" 11868"\n" 11869" # option \"about\"\n" 11870" about_action = Gio.SimpleAction.new(\"about\", None)\n" 11871" about_action.connect(\"activate\", self.about_cb)\n" 11872" self.add_action(about_action)\n" 11873"\n" 11874" # option \"quit\"\n" 11875" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 11876" quit_action.connect(\"activate\", self.quit_cb)\n" 11877" self.add_action(quit_action)\n" 11878"\n" 11879" # callback function for \"new\"\n" 11880" def new_cb(self, action, parameter):\n" 11881" print(\"This does nothing. It is only a demonstration.\")\n" 11882"\n" 11883" # callback function for \"about\"\n" 11884" def about_cb(self, action, parameter):\n" 11885" print(\"No AboutDialog for you. This is only a demonstration.\")\n" 11886"\n" 11887" # callback function for \"quit\"\n" 11888" def quit_cb(self, action, parameter):\n" 11889" print(\"You have quit.\")\n" 11890" self.quit()\n" 11891"\n" 11892"app = MyApplication()\n" 11893"exit_status = app.run(sys.argv)\n" 11894"sys.exit(exit_status)\n" 11895msgstr "" 11896 11897#. (itstool) path: section/title 11898#: C/gmenu.py.page:42 11899#, fuzzy 11900msgid "Useful methods for a GSimpleAction and a GMenu" 11901msgstr "Métodos úteis" 11902 11903#. (itstool) path: section/p 11904#: C/gmenu.py.page:44 11905msgid "" 11906"In line 33 the signal <code>\"activate\"</code> from the action " 11907"<code>new_action</code> (not the menu!) is connected to the callback " 11908"function <code>new_cb()</code> using <code><var>action</var>." 11909"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 11910"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 11911msgstr "" 11912 11913#. (itstool) path: section/p 11914#: C/gmenu.py.page:46 11915#, fuzzy 11916msgid "Useful methods for a GSimpleAction:" 11917msgstr "Métodos úteis" 11918 11919#. (itstool) path: item/p 11920#: C/gmenu.py.page:48 11921msgid "" 11922"To create a new action that is <em>stateless</em>, that is, an action that " 11923"do not retain or depend on a state given by the action itself, use" 11924msgstr "" 11925 11926#. (itstool) path: item/code 11927#: C/gmenu.py.page:49 11928#, no-wrap 11929msgid "" 11930"\n" 11931"action = Gio.SimpleAction.new(\"name\", parameter_type)" 11932msgstr "" 11933 11934#. (itstool) path: item/p 11935#: C/gmenu.py.page:51 11936msgid "" 11937"where <code>\"name\"</code> is the name of the action and " 11938"<code>parameter_type</code> is the type of the parameters that the action " 11939"receives when being activated. This can be <code>None</code>, or <code>GLib." 11940"VariantType.new('s')</code> if the parameter is of type <code>str</code>, or " 11941"instead of <code>'s'</code> a character as described <link href=\"http://" 11942"developer.gnome.org/glib/unstable/glib-GVariantType.html\">here</link>. To " 11943"create a new <em>stateful</em> (i.e. not stateless) action, use" 11944msgstr "" 11945 11946#. (itstool) path: item/code 11947#: C/gmenu.py.page:52 11948#, no-wrap 11949msgid "" 11950"\n" 11951"action = Gio.SimpleAction.new_stateful(\"name\", parameter_type, initial_state)" 11952msgstr "" 11953 11954#. (itstool) path: item/p 11955#: C/gmenu.py.page:54 11956msgid "" 11957"where <code>initial_state</code> is defined as a GVariant - for instance " 11958"<code>Glib.Variant.new_string('start')</code>; for a list of possibilities " 11959"see <link href=\"http://developer.gnome.org/glib/unstable/glib-GVariant.html" 11960"\">here</link>." 11961msgstr "" 11962 11963#. (itstool) path: item/p 11964#: C/gmenu.py.page:55 11965msgid "" 11966"<code>set_enabled(True)</code> sets the action as enabled; an action must be " 11967"enabled in order to be activated or in order to have its state changed from " 11968"outside callers. This should only be called by the implementor of the " 11969"action. Users of the action should not attempt to modify its enabled flag." 11970msgstr "" 11971 11972#. (itstool) path: item/p 11973#: C/gmenu.py.page:56 11974msgid "" 11975"<code>set_state(state)</code>, where <code>state</code> is a GVariant, sets " 11976"the state of the action, updating the 'state' property to the given value. " 11977"This should only be called by the implementor of the action; users of the " 11978"action should instead call <code>change_state(state)</code> (where " 11979"<code>state</code> is as above) to request the change." 11980msgstr "" 11981 11982#. (itstool) path: section/p 11983#: C/gmenu.py.page:59 11984#, fuzzy 11985msgid "Useful methods for a GMenu:" 11986msgstr "Métodos úteis" 11987 11988#. (itstool) path: item/p 11989#: C/gmenu.py.page:61 11990msgid "" 11991"To insert an item in the menu in position <code>position</code>, use " 11992"<code>insert(position, label, detailed_action)</code>, where <code>label</" 11993"code> is the label that will appear in the menu and <code>detailed_action</" 11994"code> is a string composed of the name of the action to which we prepend the " 11995"prefix <code>app.</code>. A more detailed discussion of this can be found in " 11996"<link xref=\"menubar.py#win-app\"/>." 11997msgstr "" 11998 11999#. (itstool) path: item/p 12000#: C/gmenu.py.page:62 12001msgid "" 12002"To append or prepend an item in the menu use respectively " 12003"<code>append(label, detailed_action)</code> and <code>prepend(label, " 12004"detailed_action)</code>." 12005msgstr "" 12006 12007#. (itstool) path: item/p 12008#: C/gmenu.py.page:63 12009msgid "" 12010"Another way of adding items to the menu is to create them as " 12011"<code>GMenuItem</code>s and use <code>insert_item(position, item)</code>, " 12012"<code>append_item(item)</code>, or <code>prepend_item(item)</code>; so for " 12013"instance we might have:" 12014msgstr "" 12015 12016#. (itstool) path: item/code 12017#: C/gmenu.py.page:64 12018#, no-wrap 12019msgid "" 12020"\n" 12021"about = Gio.MenuItem.new(\"About\", \"app.about\")\n" 12022"menu.append_item(about)" 12023msgstr "" 12024 12025#. (itstool) path: item/p 12026#: C/gmenu.py.page:68 12027msgid "" 12028"We can also add a whole subsection in a menu using " 12029"<code>insert_section(position, label, section)</code>, " 12030"<code>append_section(label, section)</code>, or <code>prepend_section(label, " 12031"section)</code>, where <code>label</code> is the title of the subsection." 12032msgstr "" 12033 12034#. (itstool) path: item/p 12035#: C/gmenu.py.page:69 12036msgid "" 12037"To add a submenu that will expand and collapse, use " 12038"<code>insert_submenu(position, label, section)</code>, " 12039"<code>append_submenu(label, section)</code>, or <code>prepend_submenu(label, " 12040"section)</code>, where <code>label</code> is the title of the subsection." 12041msgstr "" 12042 12043#. (itstool) path: item/p 12044#: C/gmenu.py.page:70 12045msgid "To remove an item from the menu, use <code>remove(position)</code>." 12046msgstr "" 12047 12048#. (itstool) path: item/p 12049#: C/gmenu.py.page:71 12050msgid "To set a label for the menu, use <code>set_label(label)</code>." 12051msgstr "" 12052 12053#. (itstool) path: item/p 12054#: C/gmenu.py.page:82 12055msgid "" 12056"<link href=\"http://developer.gnome.org/glib/unstable/glib-GVariantType.html" 12057"\">GVariantType</link>" 12058msgstr "" 12059 12060#. (itstool) path: item/p 12061#: C/gmenu.py.page:83 12062msgid "" 12063"<link href=\"http://developer.gnome.org/glib/unstable/glib-GVariant.html" 12064"\">GVariant</link>" 12065msgstr "" 12066 12067#. (itstool) path: info/title 12068#: C/gmenu.vala.page:8 12069msgctxt "text" 12070msgid "GMenu (Vala)" 12071msgstr "GMenu (Vala)" 12072 12073#. (itstool) path: page/media 12074#. This is a reference to an external file such as an image or video. When 12075#. the file changes, the md5 hash will change to let you know you need to 12076#. update your localized copy. The msgstr is not used at all. Set it to 12077#. whatever you like once you have updated your copy of the file. 12078#: C/gmenu.vala.page:28 12079msgctxt "_" 12080msgid "" 12081"external ref='media/gmenu.vala.png' md5='7a9f381fc3ed5bf8d1c50d2acb095400'" 12082msgstr "" 12083"external ref='media/gmenu.vala.png' md5='7a9f381fc3ed5bf8d1c50d2acb095400'" 12084 12085#. (itstool) path: note/p 12086#: C/gmenu.vala.page:30 12087msgid "" 12088"<em style=\"strong\">You need to be running GTK+-3.4 or later for this to " 12089"work</em>" 12090msgstr "" 12091 12092#. (itstool) path: page/code 12093#: C/gmenu.vala.page:34 12094#, no-wrap 12095msgid "" 12096"/* A window in the application. */\n" 12097"public class Window : Gtk.ApplicationWindow {\n" 12098"\n" 12099"\t/* Constructor */\n" 12100"\tpublic Window (Application app) {\n" 12101"\t\tObject (application: app, title: \"Gmenu Example\");\n" 12102"\n" 12103"\t\tvar about_action = new SimpleAction (\"about\", null);\n" 12104"\n" 12105"\t\t/* Connect the 'activate' signal to the\n" 12106"\t\t * signal handler (aka. callback).\n" 12107"\t\t */\n" 12108"\t\tabout_action.activate.connect (this.about_cb);\n" 12109"\n" 12110"\t\t/* Add the action to this window. */\n" 12111"\t\tthis.add_action (about_action);\n" 12112"\n" 12113"\t\tthis.show ();\n" 12114"\t}\n" 12115"\n" 12116"\t/* Signal handler for 'activate' signal of the SimpleAction. */\n" 12117"\tvoid about_cb (SimpleAction simple, Variant? parameter) {\n" 12118"\t\tprint (\"This does nothing. It is only a demonstration.\\n\");\n" 12119"\t}\n" 12120"}\n" 12121"\n" 12122"/* This is the Application. */\n" 12123"public class Application : Gtk.Application {\n" 12124"\n" 12125"\t/* Constructor */\n" 12126"\tpublic Application () {\n" 12127"\t\tObject (application_id: \"org.example.application\");\n" 12128"\t}\n" 12129"\n" 12130"\t/* Override the 'activate' signal of GLib.Application. */\n" 12131"\tprotected override void activate () {\n" 12132"\n" 12133"\t\t/* Create a new window for this application. */\n" 12134"\t\tnew Window (this);\n" 12135"\t}\n" 12136"\n" 12137"\t/* Override the 'startup' signal of GLib.Application. */\n" 12138"\tprotected override void startup () {\n" 12139"\t\tbase.startup ();\n" 12140"\n" 12141"\t\tvar menu = new Menu ();\n" 12142"\t\tmenu.append (\"About\", \"win.about\");\n" 12143"\t\tmenu.append (\"Quit\", \"app.quit\");\n" 12144"\t\tthis.app_menu = menu;\n" 12145"\n" 12146"\t\tvar quit_action = new SimpleAction (\"quit\", null);\n" 12147"\t\tquit_action.activate.connect (this.quit);\n" 12148"\t\tthis.add_action (quit_action);\n" 12149"\t}\n" 12150"}\n" 12151"\n" 12152"/* main function creates Application and runs it. */\n" 12153"int main (string[] args) {\n" 12154"\treturn new Application ().run (args);\n" 12155"}\n" 12156msgstr "" 12157 12158#. (itstool) path: item/p 12159#: C/gmenu.vala.page:41 12160msgid "" 12161"<link href=\"http://www.valadoc.org/gio-2.0/GLib.Menu.Menu.html\">Menu</link>" 12162msgstr "" 12163 12164#. (itstool) path: item/p 12165#: C/gmenu.vala.page:42 12166msgid "" 12167"<link href=\"http://www.valadoc.org/gio-2.0/GLib.Menu.append.html\">append</" 12168"link>" 12169msgstr "" 12170 12171#. (itstool) path: item/p 12172#: C/gmenu.vala.page:43 12173msgid "" 12174"<link href=\"http://www.valadoc.org/gio-2.0/GLib.SimpleAction.html" 12175"\">SimpleAction</link>" 12176msgstr "" 12177 12178#. (itstool) path: item/p 12179#: C/gmenu.vala.page:44 12180msgid "" 12181"<link href=\"http://www.valadoc.org/gio-2.0/GLib.ActionMap.add_action.html" 12182"\">add_action</link>" 12183msgstr "" 12184 12185#. (itstool) path: info/title 12186#: C/grid.c.page:8 12187msgctxt "text" 12188msgid "Grid (C)" 12189msgstr "Grid (C)" 12190 12191#. (itstool) path: info/desc 12192#: C/grid.c.page:18 C/grid.js.page:22 C/grid.py.page:26 C/grid.vala.page:20 12193#, fuzzy 12194msgid "Pack widgets in rows and columns" 12195msgstr "dimensões (colunas x linhas)" 12196 12197#. (itstool) path: page/title 12198#: C/grid.c.page:21 C/grid.js.page:25 C/grid.py.page:29 12199#, fuzzy 12200msgid "Grid" 12201msgstr "Grade" 12202 12203#. (itstool) path: page/media 12204#. This is a reference to an external file such as an image or video. When 12205#. the file changes, the md5 hash will change to let you know you need to 12206#. update your localized copy. The msgstr is not used at all. Set it to 12207#. whatever you like once you have updated your copy of the file. 12208#: C/grid.c.page:23 C/grid.js.page:26 C/grid.vala.page:24 12209msgctxt "_" 12210msgid "external ref='media/grid.png' md5='27d45da115401127456a3b854dcfc5be'" 12211msgstr "external ref='media/grid.png' md5='27d45da115401127456a3b854dcfc5be'" 12212 12213#. (itstool) path: page/p 12214#: C/grid.c.page:24 C/grid.vala.page:25 12215msgid "A button widget connected to a progress bar." 12216msgstr "" 12217 12218#. (itstool) path: page/code 12219#: C/grid.c.page:26 12220#, no-wrap 12221msgid "" 12222"\n" 12223"#include <gtk/gtk.h>\n" 12224"\n" 12225"\n" 12226"\n" 12227"/*Signal handler for the \"clicked\" signal of the Button. Each\n" 12228"click generates a progress bar pulse*/\n" 12229"static void\n" 12230"on_button_click (GtkButton *button,\n" 12231" gpointer user_data)\n" 12232"{\n" 12233" GtkProgressBar *progress_bar = user_data;\n" 12234" gtk_progress_bar_pulse (progress_bar);\n" 12235"}\n" 12236"\n" 12237"\n" 12238"\n" 12239"static void\n" 12240"activate (GtkApplication *app,\n" 12241" gpointer user_data)\n" 12242"{\n" 12243" GtkWidget *grid;\n" 12244" GtkWidget *window;\n" 12245" GtkWidget *button;\n" 12246" GtkWidget *progress_bar;\n" 12247"\n" 12248" /*Create the window and set a title*/\n" 12249" window = gtk_application_window_new (app);\n" 12250" gtk_window_set_title (GTK_WINDOW (window), \"Grid Example\");\n" 12251"\n" 12252" /*Create a button with a label*/\n" 12253" button = gtk_button_new_with_label (\"Button\");\n" 12254"\n" 12255" /*Create the progress bar*/\n" 12256" progress_bar = gtk_progress_bar_new ();\n" 12257"\n" 12258" /*Create a grid and attach the button and progress bar\n" 12259" accordingly*/\n" 12260" grid = gtk_grid_new ();\n" 12261" gtk_grid_attach (GTK_GRID (grid), button, 1, 1, 1, 1);\n" 12262" gtk_grid_attach_next_to (GTK_GRID (grid), \n" 12263" progress_bar, \n" 12264" button, \n" 12265" GTK_POS_BOTTOM, 1, 1);\n" 12266"\n" 12267" /*Connecting the clicked signal to the callback function*/\n" 12268" g_signal_connect (GTK_BUTTON (button), \"clicked\", \n" 12269" G_CALLBACK (on_button_click), progress_bar);\n" 12270"\n" 12271" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));\n" 12272"\n" 12273" gtk_widget_show_all (window);\n" 12274"}\n" 12275"\n" 12276"\n" 12277"\n" 12278"int\n" 12279"main (int argc, char **argv)\n" 12280"{\n" 12281" GtkApplication *app;\n" 12282" int status;\n" 12283"\n" 12284" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 12285" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 12286" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 12287" g_object_unref (app);\n" 12288"\n" 12289" return status;\n" 12290"}\n" 12291msgstr "" 12292 12293#. (itstool) path: item/p 12294#: C/grid.c.page:34 C/progressbar.c.page:35 12295msgid "" 12296"<link href=\"http://developer.gnome.org/gtk3/stable/GtkProgressBar.html" 12297"\">GtkProgressBar</link>" 12298msgstr "" 12299"<link href=\"http://developer.gnome.org/gtk3/stable/GtkProgressBar.html" 12300"\">GtkProgressBar</link>" 12301 12302#. (itstool) path: info/title 12303#: C/grid.js.page:8 12304msgctxt "text" 12305msgid "Grid (JavaScript)" 12306msgstr "Grid (JavaScript)" 12307 12308#. (itstool) path: page/p 12309#: C/grid.js.page:27 12310msgid "" 12311"A button widget connected to a progress bar, inside of a grid which handles " 12312"the layout." 12313msgstr "" 12314 12315#. (itstool) path: page/code 12316#: C/grid.js.page:29 12317#, fuzzy, no-wrap 12318#| msgid "" 12319#| "#!/usr/bin/gjs\n" 12320#| "\n" 12321#| "const GLib = imports.gi.GLib;\n" 12322#| "const Gtk = imports.gi.Gtk;\n" 12323#| "const Lang = imports.lang;\n" 12324#| "const Webkit = imports.gi.WebKit;\n" 12325#| "\n" 12326#| "const HelloGNOME = new Lang.Class ({\n" 12327#| " Name: 'Hello GNOME',\n" 12328#| "\n" 12329#| " // Create the application itself\n" 12330#| " _init: function () {\n" 12331#| " this.application = new Gtk.Application ();\n" 12332#| "\n" 12333#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 12334#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 12335#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 12336#| " },\n" 12337#| "\n" 12338#| " // Callback function for 'activate' signal presents windows when active\n" 12339#| " _onActivate: function () {\n" 12340#| " this._window.present ();\n" 12341#| " },\n" 12342#| "\n" 12343#| " // Callback function for 'startup' signal builds the UI\n" 12344#| " _onStartup: function () {\n" 12345#| " this._buildUI ();\n" 12346#| " },\n" 12347#| "\n" 12348#| " // Build the application's UI\n" 12349#| " _buildUI: function () {\n" 12350#| "\n" 12351#| " // Create the application window\n" 12352#| " this._window = new Gtk.ApplicationWindow ({\n" 12353#| " application: this.application,\n" 12354#| " title: \"Welcome to GNOME\",\n" 12355#| " default_height: 200,\n" 12356#| " default_width: 400,\n" 12357#| " window_position: Gtk.WindowPosition.CENTER });\n" 12358#| "\n" 12359#| " // Create a webview to show the web app\n" 12360#| " this._webView = new Webkit.WebView ();\n" 12361#| "\n" 12362#| " // Put the web app into the webview\n" 12363#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 12364#| " \"/hellognome.html\", null));\n" 12365#| "\n" 12366#| " // Put the webview into the window\n" 12367#| " this._window.add (this._webView);\n" 12368#| "\n" 12369#| " // Show the window and all child widgets\n" 12370#| " this._window.show_all();\n" 12371#| " },\n" 12372#| "\n" 12373#| "});\n" 12374#| "\n" 12375#| "// Run the application\n" 12376#| "let app = new HelloGNOME ();\n" 12377#| "app.application.run (ARGV);\n" 12378msgid "" 12379"#!/usr/bin/gjs\n" 12380"\n" 12381"imports.gi.versions.Gtk = '3.0';\n" 12382"\n" 12383"const Gio = imports.gi.Gio;\n" 12384"const GLib = imports.gi.GLib;\n" 12385"const Gtk = imports.gi.Gtk;\n" 12386"\n" 12387"class GridExample {\n" 12388"\n" 12389" /* Create the application itself\n" 12390" This boilerplate code is needed to build any GTK+ application. */\n" 12391" constructor() {\n" 12392" this.application = new Gtk.Application ({\n" 12393" application_id: 'org.example.jsgrid',\n" 12394" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 12395" });\n" 12396"\n" 12397" // Connect 'activate' and 'startup' signals to the callback functions\n" 12398" this.application.connect('activate', this._onActivate.bind(this));\n" 12399" this.application.connect('startup', this._onStartup.bind(this));\n" 12400" }\n" 12401"\n" 12402" // Callback function for 'activate' signal presents windows when active\n" 12403" _onActivate() {\n" 12404" this._window.present();\n" 12405" }\n" 12406"\n" 12407" // Callback function for 'startup' signal initializes menus and builds the UI\n" 12408" _onStartup() {\n" 12409" this._buildUI();\n" 12410" }\n" 12411"\n" 12412" // Build the application's UI\n" 12413" _buildUI() {\n" 12414"\n" 12415" // Create the application window\n" 12416" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n" 12417" window_position: Gtk.WindowPosition.CENTER,\n" 12418" title: \"Grid Example\"});\n" 12419"\n" 12420" // Create the grid\n" 12421" this.Grid = new Gtk.Grid ();\n" 12422"\n" 12423" // Create the widgets inside the grid\n" 12424" this.progressBar = new Gtk.ProgressBar ();\n" 12425" this.Button = new Gtk.Button ({ label: \"Button\" });\n" 12426" this.Button.connect (\"clicked\", this._clickHandler.bind(this));\n" 12427"\n" 12428" // Assemble the grid\n" 12429" this._window.add (this.Grid);\n" 12430" this.Grid.attach (this.Button, 1, 1, 1, 1);\n" 12431" this.Grid.attach_next_to (this.progressBar, this.Button, Gtk.PositionType.BOTTOM, 1, 1);\n" 12432"\n" 12433" // Show the window and all child widgets\n" 12434" this._window.show_all();\n" 12435" }\n" 12436"\n" 12437" // Here's the function that says what happens when the button is clicked\n" 12438" _clickHandler() {\n" 12439" this.progressBar.pulse ();\n" 12440" }\n" 12441"\n" 12442"\n" 12443"};\n" 12444"\n" 12445"// Run the application\n" 12446"let app = new GridExample ();\n" 12447"app.application.run (ARGV);\n" 12448msgstr "" 12449"#!/usr/bin/gjs\n" 12450"\n" 12451"const GLib = imports.gi.GLib;\n" 12452"const Gtk = imports.gi.Gtk;\n" 12453"const Lang = imports.lang;\n" 12454"const Webkit = imports.gi.WebKit;\n" 12455"\n" 12456"const HelloGNOME = new Lang.Class ({\n" 12457" Name: 'Olá, GNOME',\n" 12458"\n" 12459" // Cria o aplicativo em si\n" 12460" _init: function () {\n" 12461" this.application = new Gtk.Application ();\n" 12462"\n" 12463" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 12464" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 12465" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 12466" },\n" 12467"\n" 12468" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 12469" _onActivate: function () {\n" 12470" this._window.present ();\n" 12471" },\n" 12472"\n" 12473" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 12474" _onStartup: function () {\n" 12475" this._buildUI ();\n" 12476" },\n" 12477"\n" 12478" // Constrói a interface gráfica do aplicativo\n" 12479" _buildUI: function () {\n" 12480"\n" 12481" // Cria a janela do aplicativo\n" 12482" this._window = new Gtk.ApplicationWindow ({\n" 12483" application: this.application,\n" 12484" title: \"Bem-vindo ao GNOME\",\n" 12485" default_height: 200,\n" 12486" default_width: 400,\n" 12487" window_position: Gtk.WindowPosition.CENTER });\n" 12488"\n" 12489" // Cria um webview para mostrar o aplicativo web\n" 12490" this._webView = new Webkit.WebView ();\n" 12491"\n" 12492" // Coloca o aplicativo web no webview\n" 12493" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 12494" \"/hellognome.html\", null));\n" 12495"\n" 12496" // Coloca o webview na janela\n" 12497" this._window.add (this._webView);\n" 12498"\n" 12499" // Mostra a janela e todos seus widgets filhos\n" 12500" this._window.show_all();\n" 12501" },\n" 12502"\n" 12503"});\n" 12504"\n" 12505"// Executa o aplicativo\n" 12506"let app = new HelloGNOME ();\n" 12507"app.application.run (ARGV);\n" 12508 12509#. (itstool) path: item/p 12510#: C/grid.js.page:37 12511msgid "" 12512"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Grid.html" 12513"\">Gtk.Grid</link>" 12514msgstr "" 12515 12516#. (itstool) path: item/p 12517#: C/grid.js.page:38 C/progressbar.js.page:42 12518msgid "" 12519"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.ProgressBar." 12520"html\">Gtk.ProgressBar</link>" 12521msgstr "" 12522 12523#. (itstool) path: info/title 12524#: C/grid.py.page:8 12525msgctxt "text" 12526msgid "Grid (Python)" 12527msgstr "Grid (Python)" 12528 12529#. (itstool) path: page/media 12530#. This is a reference to an external file such as an image or video. When 12531#. the file changes, the md5 hash will change to let you know you need to 12532#. update your localized copy. The msgstr is not used at all. Set it to 12533#. whatever you like once you have updated your copy of the file. 12534#: C/grid.py.page:31 12535msgctxt "_" 12536msgid "" 12537"external ref='media/grid_simple.png' md5='c806f2e69b30373d4d2e08b41d6cc1f6'" 12538msgstr "" 12539 12540#. (itstool) path: page/p 12541#: C/grid.py.page:32 12542#, fuzzy 12543msgid "Some labels in a grid." 12544msgstr "Grade" 12545 12546#. (itstool) path: section/code 12547#: C/grid.py.page:38 12548#, no-wrap 12549msgid "" 12550"from gi.repository import Gtk\n" 12551"import sys\n" 12552"\n" 12553"\n" 12554"class MyWindow(Gtk.ApplicationWindow):\n" 12555"\n" 12556" def __init__(self, app):\n" 12557" Gtk.Window.__init__(self, title=\"Grid Example\", application=app)\n" 12558"\n" 12559" # three labels\n" 12560" label_top_left = Gtk.Label(label=\"This is Top Left\")\n" 12561" label_top_right = Gtk.Label(label=\"This is Top Right\")\n" 12562" label_bottom = Gtk.Label(label=\"This is Bottom\")\n" 12563"\n" 12564" # a grid\n" 12565" grid = Gtk.Grid()\n" 12566"\n" 12567" # some space between the columns of the grid\n" 12568" grid.set_column_spacing(20)\n" 12569"\n" 12570" # in the grid:\n" 12571" # attach the first label in the top left corner\n" 12572" grid.attach(label_top_left, 0, 0, 1, 1)\n" 12573" # attach the second label\n" 12574" grid.attach(label_top_right, 1, 0, 1, 1)\n" 12575" # attach the third label below the first label\n" 12576" grid.attach_next_to(\n" 12577" label_bottom, label_top_left, Gtk.PositionType.BOTTOM, 2, 1)\n" 12578"\n" 12579" # add the grid to the window\n" 12580" self.add(grid)\n" 12581"\n" 12582"\n" 12583"class MyApplication(Gtk.Application):\n" 12584"\n" 12585" def __init__(self):\n" 12586" Gtk.Application.__init__(self)\n" 12587"\n" 12588" def do_activate(self):\n" 12589" win = MyWindow(self)\n" 12590" win.show_all()\n" 12591"\n" 12592"app = MyApplication()\n" 12593"exit_status = app.run(sys.argv)\n" 12594"sys.exit(exit_status)\n" 12595msgstr "" 12596 12597#. (itstool) path: section/title 12598#: C/grid.py.page:42 12599#, fuzzy 12600msgid "Useful methods for a Grid widget" 12601msgstr "Métodos úteis" 12602 12603#. (itstool) path: item/p 12604#: C/grid.py.page:45 12605msgid "" 12606"To attach a widget <code>child</code> in position <code>left, top</code> in " 12607"a slot of given <code>width, height</code> use <code>attach(child, top, " 12608"left, width, height)</code>. If a widget <code>sibling</code> is already in " 12609"place, we can also use <code>attach_next_to(child, sibling, side, width, " 12610"height)</code>, where <code>side</code> is one of <code>Gtk.PositionType." 12611"LEFT, Gtk.PositionType.RIGHT, Gtk.PositionType.TOP, Gtk.PositionType.BOTTOM</" 12612"code>." 12613msgstr "" 12614 12615#. (itstool) path: item/p 12616#: C/grid.py.page:46 12617msgid "" 12618"<code>insert_row(position)</code> and <code>insert_column(position)</code> " 12619"do exactly what they say; children which are attached at or below this " 12620"position are moved one row down, and children which span across this " 12621"position are grown to span the new row. <code>insert_next_to(sibling, side)</" 12622"code> inserts a row or column at the specified position. The new row or " 12623"column is placed next to <code>sibling</code>, on the side determined by " 12624"<code>side</code>; if side is <code>Gtk.PositionType.TOP</code> or <code>Gtk." 12625"PositionType.BOTTOM</code>, a row is inserted, if side is <code>Gtk." 12626"PositionType.LEFT</code> or <code>Gtk.PositionType.RIGHT</code>, a column is " 12627"inserted." 12628msgstr "" 12629 12630#. (itstool) path: item/p 12631#: C/grid.py.page:47 12632msgid "" 12633"<code>set_row_homogeneous(True)</code> and " 12634"<code>set_column_homogeneous(True)</code> ensure that (respectively) every " 12635"row or every column has the same width or height." 12636msgstr "" 12637 12638#. (itstool) path: item/p 12639#: C/grid.py.page:48 12640msgid "" 12641"<code>set_row_spacing(spacing)</code> and <code>set_column_spacing(spacing)</" 12642"code> force a spacing between (respectively) rows or columns. The value of " 12643"<code>spacing</code> can be between <code>0</code>, which is the default " 12644"value, and <code>32767</code>." 12645msgstr "" 12646 12647#. (itstool) path: item/p 12648#: C/grid.py.page:59 C/label.py.page:105 C/separator.c.page:41 12649#: C/separator.py.page:42 C/switch.py.page:46 12650msgid "" 12651"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkLabel.html" 12652"\">GtkLabel</link>" 12653msgstr "" 12654 12655#. (itstool) path: item/p 12656#: C/grid.py.page:60 C/paned.c.page:38 C/paned.py.page:44 12657#: C/scrolledwindow.py.page:47 12658msgid "" 12659"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkImage.html" 12660"\">GtkImage</link>" 12661msgstr "" 12662 12663#. (itstool) path: item/p 12664#: C/grid.py.page:61 C/radiobutton.py.page:50 C/separator.c.page:40 12665#: C/separator.py.page:41 C/switch.py.page:47 C/toolbar_builder.py.page:196 12666msgid "" 12667"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkGrid.html" 12668"\">GtkGrid</link>" 12669msgstr "" 12670 12671#. (itstool) path: info/title 12672#: C/grid.vala.page:8 12673msgctxt "text" 12674msgid "Grid (Vala)" 12675msgstr "Grid (Vala)" 12676 12677#. (itstool) path: page/title 12678#: C/grid.vala.page:23 12679#, fuzzy 12680msgid "Grid widget" 12681msgstr "Widget:" 12682 12683#. (itstool) path: page/code 12684#: C/grid.vala.page:27 12685#, no-wrap 12686msgid "" 12687"public class MyWindow : Gtk.ApplicationWindow {\n" 12688"\n" 12689"\tGtk.Widget progress_bar;\n" 12690"\n" 12691"\tinternal MyWindow (MyApplication app) {\n" 12692"\t\tObject (application: app, title: \"Grid Example\");\n" 12693"\t\tvar grid = new Gtk.Grid();\n" 12694"\t\tprogress_bar = new Gtk.ProgressBar ();\n" 12695"\t\tprogress_bar.show ();\n" 12696"\n" 12697"\t\tvar button = new Gtk.Button.with_label (\"Button\");\n" 12698"\t\tbutton.clicked.connect (on_button_click);\n" 12699"\t\tbutton.show ();\n" 12700"\n" 12701"\t\tthis.add(grid);\n" 12702"\t\tgrid.attach(button, 0, 1, 1, 1);\n" 12703"\t\tgrid.attach_next_to (progress_bar, button, Gtk.PositionType.BOTTOM, 1, 1);\n" 12704"\t\tgrid.show ();\n" 12705"\t}\n" 12706"\n" 12707"\tvoid on_button_click (Gtk.Button button) {\n" 12708"\t\t(progress_bar as Gtk.ProgressBar).pulse ();\n" 12709"\t}\n" 12710"}\n" 12711"\n" 12712"public class MyApplication : Gtk.Application {\n" 12713"\tprotected override void activate () {\n" 12714"\n" 12715"\t\tnew MyWindow (this).show ();\n" 12716"\t}\n" 12717"\n" 12718"\tinternal MyApplication () {\n" 12719"\t\tObject (application_id: \"org.example.MyApplication\");\n" 12720"\n" 12721"\t}\n" 12722"}\n" 12723"\n" 12724"public int main (string[] args) {\n" 12725"\treturn new MyApplication ().run (args);\n" 12726"}\n" 12727msgstr "" 12728 12729#. (itstool) path: item/p 12730#: C/grid.vala.page:32 12731msgid "" 12732"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Grid.html\">Gtk.Grid</link>" 12733msgstr "" 12734 12735#. (itstool) path: info/title 12736#: C/GtkApplicationWindow.c.page:8 12737msgctxt "text" 12738msgid "ApplicationWindow (C)" 12739msgstr "ApplicationWindow (C)" 12740 12741#. (itstool) path: info/desc 12742#: C/GtkApplicationWindow.c.page:18 12743msgid "A toplevel window which can contain other widgets, and support GMenu" 12744msgstr "" 12745 12746#. (itstool) path: page/title 12747#: C/GtkApplicationWindow.c.page:21 C/GtkApplicationWindow.js.page:21 12748#: C/GtkApplicationWindow.py.page:28 C/GtkApplicationWindow.vala.page:21 12749#, fuzzy 12750msgid "ApplicationWindow" 12751msgstr "" 12752"Esse é o começo de um aplicativo em si e a função _init que cria-o. Ela fala " 12753"para _buildUI criar um ApplicationWindow, com o qual nós vamos chamar " 12754"_window, e fala para nossa janela para se apresentar quando for necessário." 12755 12756#. (itstool) path: page/media 12757#. (itstool) path: td/media 12758#. This is a reference to an external file such as an image or video. When 12759#. the file changes, the md5 hash will change to let you know you need to 12760#. update your localized copy. The msgstr is not used at all. Set it to 12761#. whatever you like once you have updated your copy of the file. 12762#: C/GtkApplicationWindow.c.page:22 C/GtkApplicationWindow.js.page:22 12763#: C/GtkApplicationWindow.py.page:29 C/GtkApplicationWindow.vala.page:22 12764#: C/window.c.page:22 C/window.js.page:25 C/window.py.page:33 12765#: C/window.vala.page:25 12766msgctxt "_" 12767msgid "external ref='media/window.png' md5='eb0cde3530978619c25bddfaeb453345'" 12768msgstr "external ref='media/window.png' md5='eb0cde3530978619c25bddfaeb453345'" 12769 12770#. (itstool) path: page/p 12771#: C/GtkApplicationWindow.c.page:23 12772#, fuzzy 12773msgid "A minimal GtkApplication with a GtkApplicationWindow" 12774msgstr "GtkApplication" 12775 12776#. (itstool) path: page/code 12777#: C/GtkApplicationWindow.c.page:25 12778#, no-wrap 12779msgid "" 12780"#include <gtk/gtk.h>\n" 12781"\n" 12782"static void\n" 12783"activate (GtkApplication *app,\n" 12784" gpointer user_data)\n" 12785"{\n" 12786" GtkWidget *window;\n" 12787"\n" 12788" window = gtk_application_window_new (app);\n" 12789" gtk_window_set_title (GTK_WINDOW (window), \"Hello GNOME\");\n" 12790" gtk_widget_show_all (window);\n" 12791"}\n" 12792"\n" 12793"int\n" 12794"main (int argc, char **argv)\n" 12795"{\n" 12796" GtkApplication *app;\n" 12797" int status;\n" 12798"\n" 12799" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 12800" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 12801" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 12802" g_object_unref (app);\n" 12803" return status;\n" 12804"}\n" 12805msgstr "" 12806 12807#. (itstool) path: item/p 12808#: C/GtkApplicationWindow.c.page:31 12809msgid "" 12810"<link href=\"http://developer.gnome.org/gtk3/3.4/GtkApplicationWindow.html" 12811"\">GtkApplicationWindow</link>" 12812msgstr "" 12813 12814#. (itstool) path: info/title 12815#: C/GtkApplicationWindow.js.page:8 12816msgctxt "text" 12817msgid "ApplicationWindow (JavaScript)" 12818msgstr "ApplicationWindow (JavaScript)" 12819 12820#. (itstool) path: info/desc 12821#: C/GtkApplicationWindow.js.page:18 C/GtkApplicationWindow.py.page:25 12822#: C/GtkApplicationWindow.vala.page:18 12823msgid "GtkWindow subclass with GtkApplication support" 12824msgstr "" 12825 12826#. (itstool) path: page/p 12827#: C/GtkApplicationWindow.js.page:23 12828msgid "A simple GtkApplicationWindow which can support Menus." 12829msgstr "" 12830 12831#. (itstool) path: page/code 12832#: C/GtkApplicationWindow.js.page:25 12833#, fuzzy, no-wrap 12834#| msgid "" 12835#| "#!/usr/bin/gjs\n" 12836#| "\n" 12837#| "const GLib = imports.gi.GLib;\n" 12838#| "const Gtk = imports.gi.Gtk;\n" 12839#| "const Lang = imports.lang;\n" 12840#| "const Webkit = imports.gi.WebKit;\n" 12841#| "\n" 12842#| "const HelloGNOME = new Lang.Class ({\n" 12843#| " Name: 'Hello GNOME',\n" 12844#| "\n" 12845#| " // Create the application itself\n" 12846#| " _init: function () {\n" 12847#| " this.application = new Gtk.Application ();\n" 12848#| "\n" 12849#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 12850#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 12851#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 12852#| " },\n" 12853#| "\n" 12854#| " // Callback function for 'activate' signal presents windows when active\n" 12855#| " _onActivate: function () {\n" 12856#| " this._window.present ();\n" 12857#| " },\n" 12858#| "\n" 12859#| " // Callback function for 'startup' signal builds the UI\n" 12860#| " _onStartup: function () {\n" 12861#| " this._buildUI ();\n" 12862#| " },\n" 12863#| "\n" 12864#| " // Build the application's UI\n" 12865#| " _buildUI: function () {\n" 12866#| "\n" 12867#| " // Create the application window\n" 12868#| " this._window = new Gtk.ApplicationWindow ({\n" 12869#| " application: this.application,\n" 12870#| " title: \"Welcome to GNOME\",\n" 12871#| " default_height: 200,\n" 12872#| " default_width: 400,\n" 12873#| " window_position: Gtk.WindowPosition.CENTER });\n" 12874#| "\n" 12875#| " // Create a webview to show the web app\n" 12876#| " this._webView = new Webkit.WebView ();\n" 12877#| "\n" 12878#| " // Put the web app into the webview\n" 12879#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 12880#| " \"/hellognome.html\", null));\n" 12881#| "\n" 12882#| " // Put the webview into the window\n" 12883#| " this._window.add (this._webView);\n" 12884#| "\n" 12885#| " // Show the window and all child widgets\n" 12886#| " this._window.show_all();\n" 12887#| " },\n" 12888#| "\n" 12889#| "});\n" 12890#| "\n" 12891#| "// Run the application\n" 12892#| "let app = new HelloGNOME ();\n" 12893#| "app.application.run (ARGV);\n" 12894msgid "" 12895"\n" 12896"#!/usr/bin/gjs\n" 12897"\n" 12898"imports.gi.versions.Gtk = '3.0';\n" 12899"\n" 12900"const Gio = imports.gi.Gio;\n" 12901"const GLib = imports.gi.GLib;\n" 12902"const Gtk = imports.gi.Gtk;\n" 12903"\n" 12904"class Application {\n" 12905"\n" 12906" //create the application\n" 12907" constructor() {\n" 12908" this.application = new Gtk.Application ({\n" 12909" application_id: 'org.example.myapp',\n" 12910" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 12911" });\n" 12912"\n" 12913" //connect to 'activate' and 'startup' signals to the callback functions\n" 12914" this.application.connect('activate', this._onActivate.bind(this));\n" 12915" this.application.connect('startup', this._onStartup.bind(this));\n" 12916" }\n" 12917"\n" 12918" //create the UI (in this case it's just the ApplicationWindow\n" 12919" _buildUI() {\n" 12920" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 12921" window_position: Gtk.WindowPosition.CENTER,\n" 12922" title: \"Welcome to GNOME\" });\n" 12923"\n" 12924" //uncommenting the line below will change the window size\n" 12925" //this._window.set_default_size(600, 400);\n" 12926"\n" 12927" //show the window and all child widgets (none in this case)\n" 12928" this._window.show_all();\n" 12929" }\n" 12930"\n" 12931" //callback function for 'activate' signal\n" 12932" _onActivate() {\n" 12933" this._window.present();\n" 12934" }\n" 12935"\n" 12936" //callback function for 'startup' signal\n" 12937" _onStartup() {\n" 12938" this._buildUI();\n" 12939" }\n" 12940"};\n" 12941"\n" 12942"//run the application\n" 12943"let app = new Application ();\n" 12944"app.application.run (ARGV);\n" 12945msgstr "" 12946"#!/usr/bin/gjs\n" 12947"\n" 12948"const GLib = imports.gi.GLib;\n" 12949"const Gtk = imports.gi.Gtk;\n" 12950"const Lang = imports.lang;\n" 12951"const Webkit = imports.gi.WebKit;\n" 12952"\n" 12953"const HelloGNOME = new Lang.Class ({\n" 12954" Name: 'Olá, GNOME',\n" 12955"\n" 12956" // Cria o aplicativo em si\n" 12957" _init: function () {\n" 12958" this.application = new Gtk.Application ();\n" 12959"\n" 12960" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 12961" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 12962" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 12963" },\n" 12964"\n" 12965" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 12966" _onActivate: function () {\n" 12967" this._window.present ();\n" 12968" },\n" 12969"\n" 12970" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 12971" _onStartup: function () {\n" 12972" this._buildUI ();\n" 12973" },\n" 12974"\n" 12975" // Constrói a interface gráfica do aplicativo\n" 12976" _buildUI: function () {\n" 12977"\n" 12978" // Cria a janela do aplicativo\n" 12979" this._window = new Gtk.ApplicationWindow ({\n" 12980" application: this.application,\n" 12981" title: \"Bem-vindo ao GNOME\",\n" 12982" default_height: 200,\n" 12983" default_width: 400,\n" 12984" window_position: Gtk.WindowPosition.CENTER });\n" 12985"\n" 12986" // Cria um webview para mostrar o aplicativo web\n" 12987" this._webView = new Webkit.WebView ();\n" 12988"\n" 12989" // Coloca o aplicativo web no webview\n" 12990" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 12991" \"/hellognome.html\", null));\n" 12992"\n" 12993" // Coloca o webview na janela\n" 12994" this._window.add (this._webView);\n" 12995"\n" 12996" // Mostra a janela e todos seus widgets filhos\n" 12997" this._window.show_all();\n" 12998" },\n" 12999"\n" 13000"});\n" 13001"\n" 13002"// Executa o aplicativo\n" 13003"let app = new HelloGNOME ();\n" 13004"app.application.run (ARGV);\n" 13005 13006#. (itstool) path: info/title 13007#: C/GtkApplicationWindow.py.page:8 13008msgctxt "text" 13009msgid "ApplicationWindow (Python)" 13010msgstr "ApplicationWindow (Python)" 13011 13012#. (itstool) path: page/p 13013#: C/GtkApplicationWindow.py.page:30 13014msgid "" 13015"The simplest GtkApplication Window which can support <link xref=\"gmenu.py\"/" 13016">." 13017msgstr "" 13018 13019#. (itstool) path: section/code 13020#: C/GtkApplicationWindow.py.page:37 13021#, no-wrap 13022msgid "" 13023"from gi.repository import Gtk\n" 13024"import sys\n" 13025"\n" 13026"# a Gtk ApplicationWindow\n" 13027"\n" 13028"\n" 13029"class MyWindow(Gtk.ApplicationWindow):\n" 13030" # constructor: the title is \"Welcome to GNOME\" and the window belongs\n" 13031" # to the application app\n" 13032"\n" 13033" def __init__(self, app):\n" 13034" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 13035"\n" 13036"\n" 13037"class MyApplication(Gtk.Application):\n" 13038" # constructor of the Gtk Application\n" 13039"\n" 13040" def __init__(self):\n" 13041" Gtk.Application.__init__(self)\n" 13042"\n" 13043" # create and activate a MyWindow, with self (the MyApplication) as\n" 13044" # application the window belongs to.\n" 13045" # Note that the function in C activate() becomes do_activate() in Python\n" 13046" def do_activate(self):\n" 13047" win = MyWindow(self)\n" 13048" # show the window and all its content\n" 13049" # this line could go in the constructor of MyWindow as well\n" 13050" win.show_all()\n" 13051"\n" 13052" # start up the application\n" 13053" # Note that the function in C startup() becomes do_startup() in Python\n" 13054" def do_startup(self):\n" 13055" Gtk.Application.do_startup(self)\n" 13056"\n" 13057"# create and run the application, exit with the value returned by\n" 13058"# running the program\n" 13059"app = MyApplication()\n" 13060"exit_status = app.run(sys.argv)\n" 13061"sys.exit(exit_status)\n" 13062msgstr "" 13063 13064#. (itstool) path: section/title 13065#: C/GtkApplicationWindow.py.page:41 13066#, fuzzy 13067msgid "Useful methods for a Gtk.ApplicationWindow widget" 13068msgstr "Métodos úteis" 13069 13070#. (itstool) path: item/p 13071#: C/GtkApplicationWindow.py.page:44 C/window.py.page:54 13072msgid "" 13073"<code>set_default_size(200, 100)</code> sets the default size of the window " 13074"to a width of <code>200</code> and a height of <code>100</code>; if instead " 13075"of a positive number we pass <code>-1</code> we have the default size." 13076msgstr "" 13077 13078#. (itstool) path: item/p 13079#: C/GtkApplicationWindow.py.page:45 C/window.py.page:55 13080msgid "" 13081"<code>set_position(Gtk.WindowPosition.CENTER)</code> centers the window. " 13082"Other options are <code>Gtk.WindowPosition.NONE, Gtk.WindowPosition.MOUSE, " 13083"Gtk.WindowPosition.CENTER_ALWAYS, Gtk.WindowPosition.CENTER_ON_PARENT</code>." 13084msgstr "" 13085 13086#. (itstool) path: info/title 13087#: C/GtkApplicationWindow.vala.page:8 13088msgctxt "text" 13089msgid "ApplicationWindow (Vala)" 13090msgstr "ApplicationWindow (Vala)" 13091 13092#. (itstool) path: page/p 13093#: C/GtkApplicationWindow.vala.page:23 13094msgid "The simplest GtkApplication Window which can support Menus." 13095msgstr "" 13096 13097#. (itstool) path: page/code 13098#: C/GtkApplicationWindow.vala.page:25 13099#, no-wrap 13100msgid "" 13101"\n" 13102"/* This is the application. */\n" 13103"public class MyApplication : Gtk.Application {\n" 13104"\t/* Override the 'activate' signal of GLib.Application. */\n" 13105"\tprotected override void activate () {\n" 13106"\t\t/* Create the window of this application and show it. */\n" 13107"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 13108"\t\twindow.title = \"Welcome to GNOME\";\n" 13109"\t\twindow.show ();\n" 13110"\t}\n" 13111"}\n" 13112"\n" 13113"/* main creates and runs the application. */\n" 13114"public int main (string[] args) {\n" 13115"\treturn new MyApplication ().run (args);\n" 13116"}\n" 13117msgstr "" 13118 13119#. (itstool) path: item/p 13120#: C/GtkApplicationWindow.vala.page:31 C/label.vala.page:31 13121msgid "" 13122"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Application.html.content.tpl" 13123"\">Gtk.Application</link>" 13124msgstr "" 13125 13126#. (itstool) path: info/title 13127#: C/guitar-tuner.c.page:8 13128msgctxt "text" 13129msgid "Guitar tuner (C)" 13130msgstr "Guitar tuner (C)" 13131 13132#. (itstool) path: info/desc 13133#: C/guitar-tuner.c.page:11 C/guitar-tuner.py.page:11 13134msgid "" 13135"Use GTK+ and GStreamer to build a simple guitar tuner application for GNOME. " 13136"Shows off how to use the interface designer." 13137msgstr "" 13138"Use o GTK+ e o GStreamer para criar um aplicativo simples de sintonizador de " 13139"violão para o GNOME. Mostra como usar o designer de interface." 13140 13141#. (itstool) path: credit/name 13142#: C/guitar-tuner.c.page:19 C/guitar-tuner.cpp.page:17 13143#: C/guitar-tuner.py.page:19 C/guitar-tuner.vala.page:18 13144#: C/image-viewer.c.page:19 C/image-viewer.cpp.page:17 13145#: C/image-viewer.js.page:19 C/image-viewer.py.page:19 13146#: C/image-viewer.vala.page:19 C/index.page:18 C/magic-mirror.vala.page:19 13147#: C/photo-wall.c.page:18 C/record-collection.js.page:19 13148msgid "Johannes Schmid" 13149msgstr "Johannes Schmid" 13150 13151#. (itstool) path: page/title 13152#: C/guitar-tuner.c.page:29 C/guitar-tuner.cpp.page:27 13153#: C/guitar-tuner.js.page:20 C/guitar-tuner.py.page:34 13154#: C/guitar-tuner.vala.page:32 13155msgid "Guitar tuner" 13156msgstr "Guitar tuner" 13157 13158#. (itstool) path: synopsis/p 13159#: C/guitar-tuner.c.page:32 C/guitar-tuner.cpp.page:30 13160#: C/guitar-tuner.py.page:37 13161msgid "" 13162"In this tutorial, we're going to make a program which plays tones that you " 13163"can use to tune a guitar. You will learn how to:" 13164msgstr "" 13165 13166#. (itstool) path: item/p 13167#: C/guitar-tuner.c.page:34 C/guitar-tuner.cpp.page:32 13168#: C/guitar-tuner.py.page:39 13169msgid "Set up a basic project in Anjuta" 13170msgstr "" 13171 13172#. (itstool) path: item/p 13173#: C/guitar-tuner.c.page:35 C/guitar-tuner.cpp.page:33 13174#: C/guitar-tuner.py.page:40 13175msgid "Create a simple GUI with Anjuta's UI designer" 13176msgstr "" 13177 13178#. (itstool) path: item/p 13179#: C/guitar-tuner.c.page:36 C/guitar-tuner.cpp.page:34 13180#: C/guitar-tuner.py.page:41 13181#, fuzzy 13182msgid "Use GStreamer to play sounds" 13183msgstr "Reproduzir sons enquanto captura" 13184 13185#. (itstool) path: synopsis/p 13186#: C/guitar-tuner.c.page:38 C/guitar-tuner.cpp.page:36 13187#: C/guitar-tuner.py.page:43 C/guitar-tuner.vala.page:41 13188#: C/image-viewer.js.page:39 C/image-viewer.py.page:39 13189#: C/image-viewer.vala.page:46 C/magic-mirror.vala.page:39 13190msgid "You'll need the following to be able to follow this tutorial:" 13191msgstr "" 13192 13193#. (itstool) path: item/p 13194#: C/guitar-tuner.c.page:40 C/guitar-tuner.cpp.page:38 13195#: C/guitar-tuner.py.page:45 C/image-viewer.js.page:41 13196#: C/image-viewer.py.page:41 C/magic-mirror.vala.page:41 13197msgid "An installed copy of the <link xref=\"getting-ready\">Anjuta IDE</link>" 13198msgstr "" 13199 13200#. (itstool) path: item/p 13201#: C/guitar-tuner.c.page:41 13202msgid "Basic knowledge of the C programming language" 13203msgstr "" 13204 13205#. (itstool) path: page/media 13206#. This is a reference to an external file such as an image or video. When 13207#. the file changes, the md5 hash will change to let you know you need to 13208#. update your localized copy. The msgstr is not used at all. Set it to 13209#. whatever you like once you have updated your copy of the file. 13210#: C/guitar-tuner.c.page:45 C/guitar-tuner.cpp.page:43 13211#: C/guitar-tuner.js.page:37 C/guitar-tuner.py.page:50 13212#: C/guitar-tuner.vala.page:48 13213msgctxt "_" 13214msgid "" 13215"external ref='media/guitar-tuner.png' md5='35e615e0f5e293671d00c5c414ac2f6b'" 13216msgstr "" 13217 13218#. (itstool) path: section/title 13219#: C/guitar-tuner.c.page:48 C/guitar-tuner.cpp.page:46 13220#: C/guitar-tuner.py.page:53 C/image-viewer.c.page:42 13221#: C/image-viewer.cpp.page:40 C/image-viewer.js.page:50 13222#: C/image-viewer.py.page:49 C/image-viewer.vala.page:57 13223#: C/magic-mirror.vala.page:50 C/message-board.c.page:46 C/photo-wall.c.page:52 13224#: C/record-collection.js.page:53 13225#, fuzzy 13226msgid "Create a project in Anjuta" 13227msgstr "Importe um projeto para o <app>Anjuta</app>." 13228 13229#. (itstool) path: section/p 13230#: C/guitar-tuner.c.page:49 C/guitar-tuner.cpp.page:47 13231#: C/guitar-tuner.py.page:54 C/guitar-tuner.vala.page:52 13232#: C/image-viewer.c.page:43 C/image-viewer.cpp.page:41 13233#: C/image-viewer.js.page:51 C/image-viewer.py.page:50 13234#: C/image-viewer.vala.page:58 C/magic-mirror.vala.page:51 13235#: C/photo-wall.c.page:53 C/record-collection.js.page:54 13236msgid "" 13237"Before you start coding, you'll need to set up a new project in Anjuta. This " 13238"will create all of the files you need to build and run the code later on. " 13239"It's also useful for keeping everything together." 13240msgstr "" 13241 13242#. (itstool) path: item/p 13243#: C/guitar-tuner.c.page:52 C/guitar-tuner.cpp.page:50 13244#: C/guitar-tuner.py.page:57 C/image-viewer.c.page:46 13245#: C/image-viewer.cpp.page:44 C/image-viewer.js.page:54 13246#: C/image-viewer.py.page:53 C/magic-mirror.vala.page:54 C/photo-wall.c.page:56 13247#: C/record-collection.js.page:57 13248msgid "" 13249"Start Anjuta and click <guiseq><gui>File</gui><gui>New</gui><gui>Project</" 13250"gui></guiseq> to open the project wizard." 13251msgstr "" 13252 13253#. (itstool) path: item/p 13254#: C/guitar-tuner.c.page:55 13255msgid "" 13256"Choose <gui>GTK+ (Simple)</gui> from the <gui>C</gui> tab, click " 13257"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 13258"<file>guitar-tuner</file> as project name and directory." 13259msgstr "" 13260 13261#. (itstool) path: item/p 13262#: C/guitar-tuner.c.page:58 13263msgid "" 13264"Make sure that <gui>Configure external packages</gui> is switched <gui>ON</" 13265"gui>. On the next page, select <em>gstreamer-0.10</em> from the list to " 13266"include the GStreamer library in your project." 13267msgstr "" 13268 13269#. (itstool) path: item/p 13270#: C/guitar-tuner.c.page:62 C/image-viewer.c.page:57 C/photo-wall.c.page:71 13271msgid "" 13272"Click <gui>Apply</gui> and the project will be created for you. Open " 13273"<file>src/main.c</file> from the <gui>Project</gui> or <gui>File</gui> tabs. " 13274"You should see some code which starts with the lines:" 13275msgstr "" 13276 13277#. (itstool) path: item/code 13278#: C/guitar-tuner.c.page:63 C/image-viewer.c.page:58 C/photo-wall.c.page:72 13279#, no-wrap 13280msgid "" 13281"\n" 13282"#include <config.h>\n" 13283"#include <gtk/gtk.h>" 13284msgstr "" 13285 13286#. (itstool) path: section/title 13287#: C/guitar-tuner.c.page:71 C/guitar-tuner.cpp.page:69 13288#: C/guitar-tuner.vala.page:74 C/image-viewer.c.page:66 13289#: C/image-viewer.cpp.page:66 C/image-viewer.vala.page:113 13290#: C/magic-mirror.vala.page:78 13291#, fuzzy 13292msgid "Build the code for the first time" 13293msgstr "Opções de primeira execução:" 13294 13295#. (itstool) path: section/p 13296#: C/guitar-tuner.c.page:72 13297msgid "" 13298"C is a rather verbose language, so don't be surprised that the file contains " 13299"quite a lot of code. Most of it is template code. It loads an (empty) window " 13300"from the user interface description file and shows it. More details are " 13301"given below; skip this list if you understand the basics:" 13302msgstr "" 13303 13304#. (itstool) path: item/p 13305#: C/guitar-tuner.c.page:76 C/image-viewer.c.page:71 13306msgid "" 13307"The three <code>#include</code> lines at the top include the <code>config</" 13308"code> (useful autoconf build defines), <code>gtk</code> (user interface) and " 13309"<code>gi18n</code> (internationalization) libraries. Functions from these " 13310"libraries are used in the rest of the code." 13311msgstr "" 13312 13313#. (itstool) path: item/p 13314#: C/guitar-tuner.c.page:79 13315msgid "" 13316"The <code>create_window</code> function creates a new window by opening a " 13317"GtkBuilder file (<file>src/guitar-tuner.ui</file>, defined a few lines " 13318"above), connecting its signals and then displaying it in a window. The " 13319"GtkBuilder file contains a description of a user interface and all of its " 13320"elements. You can use Anjuta's editor to design GtkBuilder user interfaces." 13321msgstr "" 13322 13323#. (itstool) path: item/p 13324#: C/guitar-tuner.c.page:80 C/image-viewer.c.page:75 13325#: C/image-viewer.vala.page:123 13326msgid "" 13327"Connecting signals is how you define what happens when you push a button, or " 13328"when some other event happens. Here, the <code>destroy</code> function is " 13329"called (and quits the app) when you close the window." 13330msgstr "" 13331 13332#. (itstool) path: item/p 13333#: C/guitar-tuner.c.page:83 C/image-viewer.c.page:78 13334msgid "" 13335"The <code>main</code> function is run by default when you start a C " 13336"application. It calls a few functions which set up and then run the " 13337"application. The <code>gtk_main</code> function starts the GTK main loop, " 13338"which runs the user interface and starts listening for events (like clicks " 13339"and key presses)." 13340msgstr "" 13341 13342#. (itstool) path: item/p 13343#: C/guitar-tuner.c.page:86 C/image-viewer.c.page:81 13344msgid "" 13345"The <code>ENABLE_NLS</code> conditional definition sets up <code>gettext</" 13346"code>, which is a framework for translating applications. These functions " 13347"specify how translation tools should handle your app when you run them." 13348msgstr "" 13349 13350#. (itstool) path: section/p 13351#: C/guitar-tuner.c.page:90 C/guitar-tuner.cpp.page:84 C/image-viewer.c.page:85 13352#: C/image-viewer.cpp.page:82 C/image-viewer.vala.page:133 13353#: C/magic-mirror.vala.page:93 13354msgid "" 13355"This code is ready to be used, so you can compile it by clicking " 13356"<guiseq><gui>Build</gui><gui>Build Project</gui></guiseq> (or press " 13357"<keyseq><key>Shift</key><key>F7</key></keyseq>)." 13358msgstr "" 13359 13360#. (itstool) path: section/p 13361#: C/guitar-tuner.c.page:91 C/guitar-tuner.cpp.page:85 C/image-viewer.c.page:86 13362#: C/image-viewer.cpp.page:83 13363msgid "" 13364"Press <gui>Execute</gui> on the next window that appears to configure a " 13365"debug build. You only need to do this once, for the first build." 13366msgstr "" 13367 13368#. (itstool) path: section/title 13369#: C/guitar-tuner.c.page:95 C/guitar-tuner.cpp.page:89 13370#: C/guitar-tuner.py.page:96 C/guitar-tuner.vala.page:96 13371#, fuzzy 13372msgid "Create the user interface" 13373msgstr "Criando uma interface de usuário" 13374 13375#. (itstool) path: section/p 13376#: C/guitar-tuner.c.page:96 C/guitar-tuner.cpp.page:90 13377msgid "" 13378"A description of the user interface (UI) is contained in the GtkBuilder " 13379"file. To edit the user interface, open <file>src/guitar_tuner.ui</file>. " 13380"This will switch to the interface designer. The design window is in the " 13381"center; widgets and widgets' properties are on the left, and the palette of " 13382"available widgets is on the right." 13383msgstr "" 13384 13385#. (itstool) path: section/p 13386#: C/guitar-tuner.c.page:98 C/guitar-tuner.cpp.page:92 13387#: C/guitar-tuner.py.page:99 13388msgid "" 13389"The layout of every UI in GTK+ is organized using boxes and tables. Let's " 13390"use a vertical <gui>GtkButtonBox</gui> here to assign six <gui>GtkButtons</" 13391"gui>, one for each of the six guitar strings." 13392msgstr "" 13393 13394#. (itstool) path: section/media 13395#. This is a reference to an external file such as an image or video. When 13396#. the file changes, the md5 hash will change to let you know you need to 13397#. update your localized copy. The msgstr is not used at all. Set it to 13398#. whatever you like once you have updated your copy of the file. 13399#: C/guitar-tuner.c.page:100 C/guitar-tuner.cpp.page:94 13400#: C/guitar-tuner.py.page:101 C/guitar-tuner.vala.page:101 13401msgctxt "_" 13402msgid "" 13403"external ref='media/guitar-tuner-glade.png' " 13404"md5='f6606525443ab2160f53a87a454364d0'" 13405msgstr "" 13406 13407#. (itstool) path: item/p 13408#: C/guitar-tuner.c.page:104 C/guitar-tuner.cpp.page:98 13409#: C/guitar-tuner.py.page:105 13410msgid "" 13411"Select a <gui>GtkButtonBox</gui> from the <gui>Container</gui> section of " 13412"the <gui>Palette</gui> on the right and put it into the window. In the " 13413"<gui>Properties</gui> pane, set the number of elements to 6 (for the six " 13414"strings) and the orientation to vertical." 13415msgstr "" 13416 13417#. (itstool) path: item/p 13418#: C/guitar-tuner.c.page:108 C/guitar-tuner.cpp.page:102 13419#: C/guitar-tuner.py.page:109 13420msgid "" 13421"Now, choose a <gui>GtkButton</gui> from the palette and put it into the " 13422"first part of the box." 13423msgstr "" 13424 13425#. (itstool) path: item/p 13426#: C/guitar-tuner.c.page:111 C/guitar-tuner.py.page:112 13427msgid "" 13428"While the button is still selected, change the <gui>Label</gui> property in " 13429"the <gui>Widgets</gui> tab to <gui>E</gui>. This will be the low E string." 13430msgstr "" 13431 13432#. (itstool) path: item/p 13433#: C/guitar-tuner.c.page:114 C/guitar-tuner.py.page:115 13434msgid "" 13435"Switch to the <gui>Signals</gui> tab (inside the <gui>Widgets</gui> tab) and " 13436"look for the <code>clicked</code> signal of the button. You can use this to " 13437"connect a signal handler that will be called when the button is clicked by " 13438"the user. To do this, click on the signal and type <code>on_button_clicked</" 13439"code> in the <gui>Handler</gui> column and press <key>Return</key>." 13440msgstr "" 13441 13442#. (itstool) path: item/p 13443#: C/guitar-tuner.c.page:117 C/guitar-tuner.py.page:118 13444#: C/guitar-tuner.vala.page:122 13445msgid "" 13446"Repeat the above steps for the other buttons, adding the next 5 strings with " 13447"the names <em>A</em>, <em>D</em>, <em>G</em>, <em>B</em>, and <em>e</em>." 13448msgstr "" 13449 13450#. (itstool) path: item/p 13451#: C/guitar-tuner.c.page:120 C/guitar-tuner.py.page:121 13452#: C/guitar-tuner.vala.page:125 13453msgid "" 13454"Save the UI design (by clicking <guiseq><gui>File</gui><gui>Save</gui></" 13455"guiseq>) and keep it open." 13456msgstr "" 13457 13458#. (itstool) path: section/title 13459#: C/guitar-tuner.c.page:126 C/guitar-tuner.vala.page:203 13460#, fuzzy 13461msgid "Creating the signal handler" 13462msgstr "O manipulador para este sinal" 13463 13464#. (itstool) path: section/p 13465#: C/guitar-tuner.c.page:127 C/guitar-tuner.py.page:128 13466msgid "" 13467"In the UI designer, you made it so that all of the buttons will call the " 13468"same function, <gui>on_button_clicked</gui>, when they are clicked. We need " 13469"to add that function in the source file." 13470msgstr "" 13471 13472#. (itstool) path: section/p 13473#: C/guitar-tuner.c.page:128 13474msgid "" 13475"To do this, open <file>main.c</file> while the user interface file is still " 13476"open. Switch to the <gui>Signals</gui> tab, which you already used to set " 13477"the signal name. Now take the row where you set the <gui>clicked</gui> " 13478"signal and drag it into to the source file at a position that is outside any " 13479"function. The following code will be added to your source file:" 13480msgstr "" 13481 13482#. (itstool) path: section/code 13483#: C/guitar-tuner.c.page:131 13484#, no-wrap 13485msgid "" 13486"\n" 13487"void on_button_clicked (GtkWidget* button, gpointer user_data)\n" 13488"{\n" 13489"\n" 13490"}" 13491msgstr "" 13492 13493#. (itstool) path: section/p 13494#: C/guitar-tuner.c.page:136 13495msgid "" 13496"This signal handler has two arguments: a pointer to the <code>GtkWidget</" 13497"code> that called the function (in our case, always a <code>GtkButton</" 13498"code>), and a pointer to some \"user data\" that you can define, but which " 13499"we won't be using here. (You can set the user data by calling " 13500"<code>gtk_builder_connect_signals</code>; it is normally used to pass a " 13501"pointer to a data structure that you might need to access inside the signal " 13502"handler.)" 13503msgstr "" 13504 13505#. (itstool) path: section/p 13506#: C/guitar-tuner.c.page:137 C/guitar-tuner.py.page:136 13507msgid "" 13508"For now, we'll leave the signal handler empty while we work on writing the " 13509"code to produce sounds." 13510msgstr "" 13511 13512#. (itstool) path: section/title 13513#: C/guitar-tuner.c.page:141 C/guitar-tuner.cpp.page:118 13514#: C/guitar-tuner.js.page:39 C/guitar-tuner.py.page:140 13515#: C/guitar-tuner.vala.page:131 13516#, fuzzy 13517msgid "GStreamer pipelines" 13518msgstr "" 13519"Você pode clicar no botão <guibutton>Editar Perfis</guibutton> para editar " 13520"os formatos de áudio disponíveis. A janela de diálogo do editor de perfil " 13521"fornece acesso direto à conversão de áudio. Os perfis são definidos com base " 13522"nas filas de processamento do <application>GStreamer</application>. O " 13523"<application>Sound Juicer</application> e outros aplicativos multimídia " 13524"utilizam como base a biblioteca multimídia <application>GStreamer</" 13525"application>. Uma explicação completa sobre os perfis de áudio está fora do " 13526"escopo deste documento." 13527 13528#. (itstool) path: section/p 13529#: C/guitar-tuner.c.page:142 C/guitar-tuner.js.page:40 13530#: C/guitar-tuner.py.page:141 13531msgid "" 13532"GStreamer is GNOME's multimedia framework — you can use it for playing, " 13533"recording, and processing video, audio, webcam streams and the like. Here, " 13534"we'll be using it to produce single-frequency tones." 13535msgstr "" 13536 13537#. (itstool) path: section/p 13538#: C/guitar-tuner.c.page:143 C/guitar-tuner.cpp.page:121 13539#: C/guitar-tuner.js.page:41 C/guitar-tuner.py.page:142 13540msgid "" 13541"Conceptually, GStreamer works as follows: You create a <em>pipeline</em> " 13542"containing several processing elements going from the <em>source</em> to the " 13543"<em>sink</em> (output). The source can be an image file, a video, or a music " 13544"file, for example, and the output could be a widget or the soundcard." 13545msgstr "" 13546 13547#. (itstool) path: section/p 13548#: C/guitar-tuner.c.page:144 C/guitar-tuner.cpp.page:122 13549#: C/guitar-tuner.js.page:42 C/guitar-tuner.py.page:143 13550#: C/guitar-tuner.vala.page:134 13551msgid "" 13552"Between source and sink, you can apply various filters and converters to " 13553"handle effects, format conversions and so on. Each element of the pipeline " 13554"has properties which can be used to change its behaviour." 13555msgstr "" 13556 13557#. (itstool) path: section/media 13558#. This is a reference to an external file such as an image or video. When 13559#. the file changes, the md5 hash will change to let you know you need to 13560#. update your localized copy. The msgstr is not used at all. Set it to 13561#. whatever you like once you have updated your copy of the file. 13562#: C/guitar-tuner.c.page:145 C/guitar-tuner.cpp.page:123 13563#: C/guitar-tuner.js.page:43 C/guitar-tuner.py.page:144 13564#: C/guitar-tuner.vala.page:135 13565msgctxt "_" 13566msgid "" 13567"external ref='media/guitar-tuner-pipeline.png' " 13568"md5='5adc952909d92af5dae6954781b4ad5f'" 13569msgstr "" 13570 13571#. (itstool) path: media/p 13572#: C/guitar-tuner.c.page:146 C/guitar-tuner.cpp.page:124 13573#: C/guitar-tuner.js.page:44 C/guitar-tuner.py.page:145 13574#: C/guitar-tuner.vala.page:136 13575#, fuzzy 13576msgid "An example GStreamer pipeline." 13577msgstr "pipeline" 13578 13579#. (itstool) path: section/title 13580#: C/guitar-tuner.c.page:151 C/guitar-tuner.py.page:150 13581#: C/guitar-tuner.vala.page:141 13582#, fuzzy 13583msgid "Set up the pipeline" 13584msgstr "" 13585"Não foi possível definir a linha \n" 13586"de processamento para o estado de gravação." 13587 13588#. (itstool) path: section/p 13589#: C/guitar-tuner.c.page:152 C/guitar-tuner.cpp.page:135 13590#: C/guitar-tuner.py.page:151 13591msgid "" 13592"In this simple example we will use a tone generator source called " 13593"<code>audiotestsrc</code> and send the output to the default system sound " 13594"device, <code>autoaudiosink</code>. We only need to configure the frequency " 13595"of the tone generator; this is accessible through the <code>freq</code> " 13596"property of <code>audiotestsrc</code>." 13597msgstr "" 13598 13599#. (itstool) path: section/p 13600#: C/guitar-tuner.c.page:154 13601msgid "" 13602"Insert the following line into <file>main.c</file>, just below the " 13603"<code>#include <gtk/gtk.h></code> line:" 13604msgstr "" 13605 13606#. (itstool) path: section/code 13607#: C/guitar-tuner.c.page:155 13608#, fuzzy, no-wrap 13609msgid "#include <gst/gst.h>" 13610msgstr "#include <gtkmm.h>" 13611 13612#. (itstool) path: section/p 13613#: C/guitar-tuner.c.page:156 13614msgid "" 13615"This includes the GStreamer library. You also need to add a line to " 13616"initialize GStreamer; put the following code on the line above the " 13617"<code>gtk_init</code> call in the <code>main</code> function:" 13618msgstr "" 13619 13620#. (itstool) path: section/code 13621#: C/guitar-tuner.c.page:157 13622#, no-wrap 13623msgid "gst_init (&argc, &argv);" 13624msgstr "" 13625 13626#. (itstool) path: section/p 13627#: C/guitar-tuner.c.page:158 13628msgid "" 13629"Then, copy the following function into <file>main.c</file> above the empty " 13630"<code>on_button_clicked</code> function:" 13631msgstr "" 13632 13633#. (itstool) path: section/code 13634#: C/guitar-tuner.c.page:159 13635#, no-wrap 13636msgid "" 13637"static void\n" 13638"play_sound (gdouble frequency)\n" 13639"{\n" 13640"\tGstElement *source, *sink;\n" 13641"\tGstElement *pipeline;\n" 13642"\n" 13643"\tpipeline = gst_pipeline_new (\"note\");\n" 13644"\tsource = gst_element_factory_make (\"audiotestsrc\",\n" 13645"\t \"source\");\n" 13646"\tsink = gst_element_factory_make (\"autoaudiosink\",\n" 13647"\t \"output\");\n" 13648"\n" 13649"\t/* set frequency */\n" 13650"\tg_object_set (source, \"freq\", frequency, NULL);\n" 13651"\n" 13652"\tgst_bin_add_many (GST_BIN (pipeline), source, sink, NULL);\n" 13653"\tgst_element_link (source, sink);\n" 13654"\n" 13655"\tgst_element_set_state (pipeline, GST_STATE_PLAYING);\n" 13656"\n" 13657"\t/* stop it after 500ms */\n" 13658"\tg_timeout_add (LENGTH, (GSourceFunc) pipeline_stop, pipeline);\n" 13659"}" 13660msgstr "" 13661 13662#. (itstool) path: item/p 13663#: C/guitar-tuner.c.page:185 13664msgid "" 13665"The first five lines create source and sink GStreamer elements " 13666"(<code>GstElement</code>), and a pipeline element (which will be used as a " 13667"container for the other two elements). The pipeline is given the name \"note" 13668"\"; the source is named \"source\" and is set to the <code>audiotestsrc</" 13669"code> source; and the sink is named \"output\" and set to the " 13670"<code>autoaudiosink</code> sink (default sound card output)." 13671msgstr "" 13672 13673#. (itstool) path: item/p 13674#: C/guitar-tuner.c.page:188 13675msgid "" 13676"The call to <code>g_object_set</code> sets the <code>freq</code> property of " 13677"the source element to <code>frequency</code>, which is passed as an argument " 13678"to the <code>play_sound</code> function. This is just the frequency of the " 13679"note in Hertz; some useful frequencies will be defined later on." 13680msgstr "" 13681 13682#. (itstool) path: item/p 13683#: C/guitar-tuner.c.page:191 13684msgid "" 13685"<code>gst_bin_add_many</code> puts the source and sink into the pipeline. " 13686"The pipeline is a <code>GstBin</code>, which is just an element that can " 13687"contain multiple other GStreamer elements. In general, you can add as many " 13688"elements as you like to the pipeline by adding more arguments to " 13689"<code>gst_bin_add_many</code>." 13690msgstr "" 13691 13692#. (itstool) path: item/p 13693#: C/guitar-tuner.c.page:194 13694msgid "" 13695"Next, <code>gst_element_link</code> is used to connect the elements " 13696"together, so the output of <code>source</code> (a tone) goes into the input " 13697"of <code>sink</code> (which is then output to the sound card). " 13698"<code>gst_element_set_state</code> is then used to start playback, by " 13699"setting the state of the pipeline to playing (<code>GST_STATE_PLAYING</" 13700"code>)." 13701msgstr "" 13702 13703#. (itstool) path: section/title 13704#: C/guitar-tuner.c.page:201 C/guitar-tuner.py.page:191 13705#, fuzzy 13706msgid "Stopping playback" 13707msgstr "Parando…" 13708 13709#. (itstool) path: section/p 13710#: C/guitar-tuner.c.page:202 13711msgid "" 13712"We don't want to play an annoying tone forever, so the last thing " 13713"<code>play_sound</code> does is to call <code>g_timeout_add</code>. This " 13714"sets a timeout for stopping the sound; it waits for <code>LENGTH</code> " 13715"milliseconds before calling the function <code>pipeline_stop</code>, and " 13716"will keep calling it until <code>pipeline_stop</code> returns <code>FALSE</" 13717"code>." 13718msgstr "" 13719 13720#. (itstool) path: section/p 13721#: C/guitar-tuner.c.page:203 13722msgid "" 13723"Now, we'll write the <code>pipeline_stop</code> function which is called by " 13724"<code>g_timeout_add</code>. Insert the following code <em>above</em> the " 13725"<code>play_sound</code> function:" 13726msgstr "" 13727 13728#. (itstool) path: section/code 13729#: C/guitar-tuner.c.page:204 13730#, no-wrap 13731msgid "" 13732"\n" 13733"#define LENGTH 500 /* Length of playing in ms */\n" 13734"\n" 13735"static gboolean\n" 13736"pipeline_stop (GstElement* pipeline)\n" 13737"{\n" 13738"\tgst_element_set_state (pipeline, GST_STATE_NULL);\n" 13739"\tg_object_unref (pipeline);\n" 13740"\n" 13741"\treturn FALSE;\n" 13742"}" 13743msgstr "" 13744 13745#. (itstool) path: section/p 13746#: C/guitar-tuner.c.page:215 13747msgid "" 13748"The call to <code>gst_element_set_state</code> stops the playback of the " 13749"pipeline and <code>g_object_unref</code> unreferences the pipeline, " 13750"destroying it and freeing its memory." 13751msgstr "" 13752 13753#. (itstool) path: section/title 13754#: C/guitar-tuner.c.page:219 C/guitar-tuner.py.page:208 13755#, fuzzy 13756msgid "Define the tones" 13757msgstr "Tons" 13758 13759#. (itstool) path: section/p 13760#: C/guitar-tuner.c.page:220 13761msgid "" 13762"We want to play the correct sound when the user clicks a button. First of " 13763"all, we need to know the frequencies for the six guitar strings, which are " 13764"defined (at the top of <file>main.c</file>) as follows:" 13765msgstr "" 13766 13767#. (itstool) path: section/code 13768#: C/guitar-tuner.c.page:221 13769#, no-wrap 13770msgid "" 13771"\n" 13772"/* Frequencies of the strings */\n" 13773"#define NOTE_E 329.63\n" 13774"#define NOTE_A 440\n" 13775"#define NOTE_D 587.33\n" 13776"#define NOTE_G 783.99\n" 13777"#define NOTE_B 987.77\n" 13778"#define NOTE_e 1318.5" 13779msgstr "" 13780 13781#. (itstool) path: section/p 13782#: C/guitar-tuner.c.page:229 C/guitar-tuner.py.page:222 13783msgid "" 13784"Now to flesh out the signal handler that we defined earlier, " 13785"<code>on_button_clicked</code>. We could have connected every button to a " 13786"different signal handler, but that would lead to a lot of code duplication. " 13787"Instead, we can use the label of the button to figure out which button was " 13788"clicked:" 13789msgstr "" 13790 13791#. (itstool) path: section/code 13792#: C/guitar-tuner.c.page:230 13793#, no-wrap 13794msgid "" 13795"\n" 13796"/* Callback for the buttons */\n" 13797"void on_button_clicked (GtkButton* button,\n" 13798" gpointer user_data)\n" 13799"{\n" 13800"\tconst gchar* text = gtk_button_get_label (button);\n" 13801"\n" 13802"\tif (g_str_equal (text, _(\"E\")))\n" 13803"\t play_sound (NOTE_E);\n" 13804"\telse if (g_str_equal (text, _(\"A\")))\n" 13805"\t play_sound (NOTE_A);\n" 13806"\telse if (g_str_equal (text, _(\"G\")))\n" 13807"\t play_sound (NOTE_G);\n" 13808"\telse if (g_str_equal (text, _(\"D\")))\n" 13809"\t play_sound (NOTE_D);\n" 13810"\telse if (g_str_equal (text, _(\"B\")))\n" 13811"\t play_sound (NOTE_B);\n" 13812"\telse if (g_str_equal (text, _(\"e\")))\n" 13813"\t play_sound (NOTE_e);\n" 13814"}\n" 13815msgstr "" 13816 13817#. (itstool) path: section/p 13818#: C/guitar-tuner.c.page:251 13819msgid "" 13820"A pointer to the <code>GtkButton</code> that was clicked is passed as an " 13821"argument (<code>button</code>) to <code>on_button_clicked</code>. We can get " 13822"the text of that button using <code>gtk_button_get_label</code>." 13823msgstr "" 13824 13825#. (itstool) path: section/p 13826#: C/guitar-tuner.c.page:252 13827msgid "" 13828"The text is then compared to the notes that we have using <code>g_str_equal</" 13829"code>, and <code>play_sound</code> is called with the frequency appropriate " 13830"for that note. This plays the tone; we have a working guitar tuner!" 13831msgstr "" 13832 13833#. (itstool) path: section/title 13834#: C/guitar-tuner.c.page:256 C/guitar-tuner.cpp.page:255 13835#: C/guitar-tuner.vala.page:253 C/image-viewer.c.page:222 13836#: C/image-viewer.cpp.page:210 C/image-viewer.vala.page:280 13837#: C/photo-wall.c.page:392 13838#, fuzzy 13839msgid "Build and run the application" 13840msgstr "Execute o aplicativo:" 13841 13842#. (itstool) path: section/p 13843#: C/guitar-tuner.c.page:257 C/guitar-tuner.vala.page:254 13844#: C/image-viewer.c.page:223 C/image-viewer.cpp.page:211 13845#: C/image-viewer.vala.page:281 13846msgid "" 13847"All of the code should now be ready to go. Click <guiseq><gui>Build</" 13848"gui><gui>Build Project</gui></guiseq> to build everything again, and then " 13849"<guiseq><gui>Run</gui><gui>Execute</gui></guiseq> to start the application." 13850msgstr "" 13851 13852#. (itstool) path: section/p 13853#: C/guitar-tuner.c.page:258 C/guitar-tuner.cpp.page:257 13854#: C/guitar-tuner.vala.page:255 13855msgid "" 13856"If you haven't already done so, choose the <file>Debug/src/guitar-tuner</" 13857"file> application in the dialog that appears. Finally, hit <gui>Run</gui> " 13858"and enjoy!" 13859msgstr "" 13860 13861#. (itstool) path: section/title 13862#: C/guitar-tuner.c.page:262 C/guitar-tuner.cpp.page:261 13863#: C/guitar-tuner.js.page:242 C/guitar-tuner.py.page:240 13864#: C/guitar-tuner.vala.page:259 C/image-viewer.c.page:228 13865#: C/image-viewer.cpp.page:216 C/image-viewer.js.page:316 13866#: C/image-viewer.py.page:230 C/image-viewer.vala.page:288 13867#: C/magic-mirror.vala.page:150 C/photo-wall.c.page:400 13868#: C/record-collection.js.page:297 13869#, fuzzy 13870msgid "Reference Implementation" 13871msgstr "Implementação referência" 13872 13873#. (itstool) path: section/p 13874#: C/guitar-tuner.c.page:263 13875msgid "" 13876"If you run into problems with the tutorial, compare your code with this " 13877"<link href=\"guitar-tuner/guitar-tuner.c\">reference code</link>." 13878msgstr "" 13879 13880#. (itstool) path: section/title 13881#: C/guitar-tuner.c.page:267 C/guitar-tuner.cpp.page:274 13882#: C/guitar-tuner.py.page:245 C/guitar-tuner.vala.page:270 13883#: C/image-viewer.c.page:233 C/image-viewer.cpp.page:221 13884#: C/image-viewer.js.page:321 C/image-viewer.py.page:235 13885#: C/image-viewer.vala.page:293 13886#, fuzzy 13887msgid "Next steps" 13888msgstr "" 13889"O plug-in do <app>gedit</app> contém um script python (<file>evince_dbus.py</" 13890"file>) que pode ser usado para fazer SyncTeX funcionar com o Vim. Para " 13891"utilizar vim-latex com o <app>Visualizador de documentos</app> você precisa " 13892"seguir os seguintes passos:" 13893 13894#. (itstool) path: section/p 13895#: C/guitar-tuner.c.page:268 C/guitar-tuner.cpp.page:275 13896#: C/guitar-tuner.py.page:246 C/guitar-tuner.vala.page:271 13897#: C/image-viewer.c.page:234 C/image-viewer.cpp.page:222 13898#: C/image-viewer.js.page:322 C/image-viewer.py.page:236 13899#: C/image-viewer.vala.page:294 13900msgid "Here are some ideas for how you can extend this simple demonstration:" 13901msgstr "" 13902 13903#. (itstool) path: item/p 13904#: C/guitar-tuner.c.page:271 C/guitar-tuner.cpp.page:278 13905#: C/guitar-tuner.py.page:249 C/guitar-tuner.vala.page:274 13906msgid "Have the program automatically cycle through the notes." 13907msgstr "" 13908 13909#. (itstool) path: item/p 13910#: C/guitar-tuner.c.page:274 C/guitar-tuner.cpp.page:281 13911#: C/guitar-tuner.py.page:252 C/guitar-tuner.vala.page:277 13912msgid "Make the program play recordings of real guitar strings being plucked." 13913msgstr "" 13914 13915#. (itstool) path: item/p 13916#: C/guitar-tuner.c.page:275 C/guitar-tuner.cpp.page:282 13917#: C/guitar-tuner.py.page:253 C/guitar-tuner.vala.page:278 13918msgid "" 13919"To do this, you would need to set up a more complicated GStreamer pipeline " 13920"which allows you to load and play back music files. You'll have to choose " 13921"<link href=\"http://gstreamer.freedesktop.org/documentation/plugins.html" 13922"\">decoder and demuxer</link> GStreamer elements based on the file format of " 13923"your recorded sounds — MP3s use different elements to Ogg Vorbis files, for " 13924"example." 13925msgstr "" 13926 13927#. (itstool) path: item/p 13928#: C/guitar-tuner.c.page:276 C/guitar-tuner.cpp.page:283 13929#: C/guitar-tuner.py.page:254 C/guitar-tuner.vala.page:279 13930msgid "" 13931"You might need to connect the elements in more complicated ways too. This " 13932"could involve using <link href=\"http://gstreamer.freedesktop.org/data/doc/" 13933"gstreamer/head/manual/html/chapter-intro-basics.html\">GStreamer concepts</" 13934"link> that we didn't cover in this tutorial, such as <link href=\"http://" 13935"gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-intro-" 13936"basics-pads.html\">pads</link>. You may also find the <cmd>gst-inspect</cmd> " 13937"command useful." 13938msgstr "" 13939 13940#. (itstool) path: item/p 13941#: C/guitar-tuner.c.page:279 C/guitar-tuner.cpp.page:286 13942#: C/guitar-tuner.py.page:257 C/guitar-tuner.vala.page:282 13943msgid "Automatically analyze notes that the user plays." 13944msgstr "" 13945 13946#. (itstool) path: item/p 13947#: C/guitar-tuner.c.page:280 C/guitar-tuner.cpp.page:287 13948#: C/guitar-tuner.py.page:258 C/guitar-tuner.vala.page:283 13949msgid "" 13950"You could connect a microphone and record sounds from it using an <link href=" 13951"\"http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-" 13952"plugins/html/gst-plugins-good-plugins-autoaudiosrc.html\">input source</" 13953"link>. Perhaps some form of <link href=\"http://gstreamer.freedesktop.org/" 13954"data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-" 13955"plugins-plugin-spectrum.html\">spectrum analysis</link> would allow you to " 13956"figure out what notes are being played?" 13957msgstr "" 13958 13959#. (itstool) path: info/desc 13960#: C/guitar-tuner.cpp.page:9 13961msgid "" 13962"Use GTKmm and GStreamermm to build a simple guitar tuner application for " 13963"GNOME. Shows off how to use the interface designer." 13964msgstr "" 13965 13966#. (itstool) path: item/p 13967#: C/guitar-tuner.cpp.page:39 13968msgid "Basic knowledge of the C++ programming language" 13969msgstr "" 13970 13971#. (itstool) path: item/p 13972#: C/guitar-tuner.cpp.page:53 13973msgid "" 13974"Choose <gui>GTKmm (Simple)</gui> from the <gui>C++</gui> tab, click " 13975"<gui>Forward</gui>, and fill out your details on the next few pages. Use " 13976"<file>guitar-tuner</file> as project name and directory." 13977msgstr "" 13978 13979#. (itstool) path: item/p 13980#: C/guitar-tuner.cpp.page:56 13981msgid "" 13982"Make sure that <gui>Configure external packages</gui> is selected. On the " 13983"next page, select <em>gstreamermm-0.10</em> from the list to include the " 13984"GStreamermm library in your project." 13985msgstr "" 13986 13987#. (itstool) path: item/p 13988#: C/guitar-tuner.cpp.page:60 13989msgid "" 13990"Click <gui>Finished</gui> and the project will be created for you. Open " 13991"<file>src/main.cc</file> from the <gui>Project</gui> or <gui>File</gui> " 13992"tabs. You should see some code which starts with the lines:" 13993msgstr "" 13994 13995#. (itstool) path: item/code 13996#: C/guitar-tuner.cpp.page:61 13997#, no-wrap 13998msgid "" 13999"\n" 14000"#include <gtkmm.h>\n" 14001"#include <iostream>" 14002msgstr "" 14003 14004#. (itstool) path: section/p 14005#: C/guitar-tuner.cpp.page:70 C/image-viewer.cpp.page:67 14006msgid "" 14007"This is a very basic C++ code setting up GTKmm. More details are given " 14008"below; skip this list if you understand the basics:" 14009msgstr "" 14010 14011#. (itstool) path: item/p 14012#: C/guitar-tuner.cpp.page:74 14013msgid "" 14014"The three <code>#include</code> lines at the top include the <code>config</" 14015"code> (useful autoconf build defines), <code>gtkmm</code> (user interface) " 14016"and <code>iostream</code> (STL). Functions from these libraries are used in " 14017"the rest of the code." 14018msgstr "" 14019 14020#. (itstool) path: item/p 14021#: C/guitar-tuner.cpp.page:77 14022msgid "" 14023"The <code>main</code> function creates a new window by opening a GtkBuilder " 14024"file (<file>src/guitar-tuner.ui</file>, defined a few lines above) and then " 14025"displaying it in a window. The GtkBuilder file contains a description of a " 14026"user interface and all of its elements. You can use Anjuta's editor to " 14027"design GtkBuilder user interfaces." 14028msgstr "" 14029 14030#. (itstool) path: item/p 14031#: C/guitar-tuner.cpp.page:80 14032msgid "" 14033"Afterwards it calls a few functions which set up and then run the " 14034"application. The <code>kit.run</code> function starts the GTKmm main loop, " 14035"which runs the user interface and starts listening for events (like clicks " 14036"and key presses)." 14037msgstr "" 14038 14039#. (itstool) path: item/p 14040#: C/guitar-tuner.cpp.page:105 14041msgid "" 14042"While the button is still selected, change the <gui>Label</gui> property in " 14043"the <gui>Widgets</gui> tab to <gui>E</gui>. This will be the low E string. " 14044"Also change the <gui>Name</gui> property to <gui>button_E</gui>. This is the " 14045"name we will refer to the widget later in code." 14046msgstr "" 14047 14048#. (itstool) path: item/p 14049#: C/guitar-tuner.cpp.page:109 14050msgid "" 14051"Repeat the above steps for the other buttons, adding the next 5 strings with " 14052"the labels <em>A</em>, <em>D</em>, <em>G</em>, <em>B</em>, and <em>e</em> " 14053"and the names <em>button_A</em>, etc." 14054msgstr "" 14055 14056#. (itstool) path: item/p 14057#: C/guitar-tuner.cpp.page:112 14058msgid "" 14059"Save the UI design (by clicking <guiseq><gui>File</gui><gui>Save</gui></" 14060"guiseq>) and close the file." 14061msgstr "" 14062 14063#. (itstool) path: section/p 14064#: C/guitar-tuner.cpp.page:119 14065msgid "" 14066"GStreamer is GNOME's multimedia framework — you can use it for playing, " 14067"recording, and processing video, audio, webcam streams and the like. Here, " 14068"we'll be using it to produce single-frequency tones. GStreamermm is the C++ " 14069"binding to GStreamer which we will use here." 14070msgstr "" 14071 14072#. (itstool) path: section/title 14073#: C/guitar-tuner.cpp.page:129 14074#, fuzzy 14075msgid "Using GStreamermm" 14076msgstr "Documentação da gstreamermm" 14077 14078#. (itstool) path: section/p 14079#: C/guitar-tuner.cpp.page:130 14080msgid "" 14081"To use GStreamermm, it has to be initialised. We do that by adding the " 14082"following line of code next to the <code>Gtk::Main kit(argc, argv);</code> " 14083"line in <file>main.cc</file>:" 14084msgstr "" 14085 14086#. (itstool) path: section/code 14087#: C/guitar-tuner.cpp.page:132 14088#, no-wrap 14089msgid "\tGst::init (argc, argv);" 14090msgstr "" 14091 14092#. (itstool) path: section/p 14093#: C/guitar-tuner.cpp.page:133 14094msgid "" 14095"While we are on it, also make sure that the <file>gstreamermm.h</file> is " 14096"included in <file>main.cc</file> properly." 14097msgstr "" 14098 14099#. (itstool) path: section/p 14100#: C/guitar-tuner.cpp.page:137 14101msgid "" 14102"To simplify the handling of the pipeline we will define a helper class " 14103"<code>Sound</code>. We do that in <file>main.cc</file> in order to keep this " 14104"example simple, whereas you might usually want to use a separate file:" 14105msgstr "" 14106 14107#. (itstool) path: section/code 14108#: C/guitar-tuner.cpp.page:140 14109#, no-wrap 14110msgid "" 14111"\n" 14112"class Sound\n" 14113"{\n" 14114"\tpublic:\n" 14115"\t\tSound();\n" 14116"\n" 14117"\t\tvoid start_playing(double frequency);\n" 14118"\t\tbool stop_playing();\n" 14119"\n" 14120"\tprivate:\n" 14121"\t\tGlib::RefPtr<Gst::Pipeline> m_pipeline;\n" 14122"\t\tGlib::RefPtr<Gst::Element> m_source;\n" 14123"\t\tGlib::RefPtr<Gst::Element> m_sink;\n" 14124"};\n" 14125"\n" 14126"Sound::Sound()\n" 14127"{\n" 14128"\tm_pipeline = Gst::Pipeline::create(\"note\");\n" 14129"\tm_source = Gst::ElementFactory::create_element(\"audiotestsrc\",\n" 14130"\t \"source\");\n" 14131"\tm_sink = Gst::ElementFactory::create_element(\"autoaudiosink\",\n" 14132"\t \"output\");\n" 14133"\tm_pipeline->add(m_source);\n" 14134"\tm_pipeline->add(m_sink);\n" 14135"\tm_source->link(m_sink);\n" 14136"}\n" 14137"\n" 14138"void Sound::start_playing (double frequency)\n" 14139"{\n" 14140"\tm_source->set_property(\"freq\", frequency);\n" 14141"\tm_pipeline->set_state(Gst::STATE_PLAYING);\n" 14142"\n" 14143"\t/* stop it after 200ms */\n" 14144"\tGlib::signal_timeout().connect(sigc::mem_fun(*this, &Sound::stop_playing),\n" 14145"\t 200);\n" 14146"}\n" 14147"\n" 14148"bool Sound::stop_playing()\n" 14149"{\n" 14150"\tm_pipeline->set_state(Gst::STATE_NULL);\n" 14151"\treturn false;\n" 14152"}\n" 14153msgstr "" 14154 14155#. (itstool) path: section/p 14156#: C/guitar-tuner.cpp.page:184 14157#, fuzzy 14158msgid "The code has the following purpose:" 14159msgstr "Esse guia tem um propósito duplo:" 14160 14161#. (itstool) path: item/p 14162#: C/guitar-tuner.cpp.page:187 14163msgid "" 14164"In the constructor, source and sink GStreamer elements (<code>Gst::Element</" 14165"code>) are created, and a pipeline element (which will be used as a " 14166"container for the other two elements). The pipeline is given the name \"note" 14167"\"; the source is named \"source\" and is set to the <code>audiotestsrc</" 14168"code> source; and the sink is named \"output\" and set to the " 14169"<code>autoaudiosink</code> sink (default sound card output). After the " 14170"elements have been added to the pipeline and linked together, the pipeline " 14171"is ready to run." 14172msgstr "" 14173 14174#. (itstool) path: item/p 14175#: C/guitar-tuner.cpp.page:190 14176msgid "" 14177"<code>start_playing</code> sets the source element to play a particular " 14178"frequency and then starts the pipeline so the sound actually starts playing. " 14179"As we don't want to have the annoying sound for ages, a timeout is set up to " 14180"stop the pipeline after 200 ms by calling <code>stop_playing</code>." 14181msgstr "" 14182 14183#. (itstool) path: item/p 14184#: C/guitar-tuner.cpp.page:195 14185msgid "" 14186"In <code>stop_playing</code> which is called when the timeout has elapsed, " 14187"the pipeline is stopped and as such there isn't any sound output anymore. As " 14188"GStreamermm uses reference counting through the <code>Glib::RefPtr</code> " 14189"object, the memory is automatically freed once the <code>Sound</code> class " 14190"is destroyed." 14191msgstr "" 14192 14193#. (itstool) path: section/title 14194#: C/guitar-tuner.cpp.page:203 14195msgid "Connecting the signals" 14196msgstr "Conectando os sinais" 14197 14198#. (itstool) path: section/p 14199#: C/guitar-tuner.cpp.page:204 14200msgid "" 14201"We want to play the correct sound when the user clicks a button. That means " 14202"that we have to connect to the signal that is fired when the user clicks the " 14203"button. We also want to provide information to the called function which " 14204"tone to play. GTKmm makes that quite easy as we can easily bind information " 14205"with the <em>sigc</em> library." 14206msgstr "" 14207 14208#. (itstool) path: section/p 14209#: C/guitar-tuner.cpp.page:209 14210msgid "" 14211"The function that is called when the user clicks a button can be pretty " 14212"simple, as all the interesting stuff is done in the helper class now:" 14213msgstr "" 14214 14215#. (itstool) path: section/code 14216#: C/guitar-tuner.cpp.page:211 14217#, no-wrap 14218msgid "" 14219"\n" 14220"static void\n" 14221"on_button_clicked(double frequency, Sound* sound)\n" 14222"{\n" 14223"\tsound->start_playing (frequency);\n" 14224"}\n" 14225msgstr "" 14226 14227#. (itstool) path: section/p 14228#: C/guitar-tuner.cpp.page:218 14229msgid "" 14230"It only calls the helper class we defined before to play the correct " 14231"frequencies. With some more clever code we would also have been able to " 14232"directly connect to the class without using the function but we will leave " 14233"that to use as an exercise." 14234msgstr "" 14235 14236#. (itstool) path: section/p 14237#: C/guitar-tuner.cpp.page:222 14238msgid "" 14239"The code to set up the signals should be added to the <code>main()</code> " 14240"function just after the <code>builder->get_widget(\"main_window\", " 14241"main_win);</code> line:" 14242msgstr "" 14243 14244#. (itstool) path: section/code 14245#: C/guitar-tuner.cpp.page:224 14246#, no-wrap 14247msgid "" 14248"\n" 14249"Sound sound;\n" 14250"Gtk::Button* button;\n" 14251"\n" 14252"builder->get_widget(\"button_E\", button);\n" 14253"button->signal_clicked().connect (sigc::bind<double, Sound*>(sigc::ptr_fun(&on_button_clicked),\n" 14254" 329.63, &sound));\n" 14255msgstr "" 14256 14257#. (itstool) path: item/p 14258#: C/guitar-tuner.cpp.page:234 14259msgid "" 14260"At first we create an instance of our helper class that we want to use now " 14261"and declare a variable for the button we want to connect to." 14262msgstr "" 14263 14264#. (itstool) path: item/p 14265#: C/guitar-tuner.cpp.page:238 14266msgid "" 14267"Next, we receive the button object from the user interface that was created " 14268"out of the user interface file. Remember that <em>button_E</em> is the name " 14269"we gave to the first button." 14270msgstr "" 14271 14272#. (itstool) path: item/p 14273#: C/guitar-tuner.cpp.page:242 14274msgid "" 14275"Finally we connect the <em>clicked</em> signal. This isn't fully " 14276"straightforward because this is done in a fully type-safe way and we " 14277"actually want to pass the frequency and our helper class to the signal " 14278"handler. <code>sigc::ptr_fun(&on_button_clicked)</code> creates a " 14279"<em>slot</em> for the <code>on_button_clicked</code> method we defined " 14280"above. With <code>sigc::bind</code> we are able to pass additional arguments " 14281"to the slot and in this case we pass the frequency (as double) and our " 14282"helper class." 14283msgstr "" 14284 14285#. (itstool) path: section/p 14286#: C/guitar-tuner.cpp.page:249 14287msgid "" 14288"Now that we have set up the <em>E</em> button we also need to connect the " 14289"other buttons according to their frequencies: 440 for A, 587.33 for D, " 14290"783.99 for G, 987.77 for B and 1318.5 for the high E. This is done in the " 14291"same way, just passing a different frequency to the handler." 14292msgstr "" 14293 14294#. (itstool) path: section/p 14295#: C/guitar-tuner.cpp.page:256 14296msgid "" 14297"All of the code should now be ready to go. Click <guiseq><gui>Build</" 14298"gui><gui>Build Project</gui></guiseq> to build everything again, and then " 14299"<guiseq><gui>Run</gui><gui>Run</gui></guiseq> to start the application." 14300msgstr "" 14301 14302#. (itstool) path: section/p 14303#: C/guitar-tuner.cpp.page:262 14304msgid "" 14305"If you run into problems with the tutorial, compare your code with this " 14306"<link href=\"guitar-tuner/guitar-tuner.cc\">reference code</link>." 14307msgstr "" 14308 14309#. (itstool) path: section/title 14310#: C/guitar-tuner.cpp.page:266 14311#, fuzzy 14312msgid "Further Reading" 14313msgstr "Para demais leituras, por favor selecione uma seção no menu acima." 14314 14315#. (itstool) path: section/p 14316#: C/guitar-tuner.cpp.page:267 14317msgid "" 14318"Many of the things shown above are explained in detail in the <link href=" 14319"\"http://library.gnome.org/devel/gtkmm-tutorial/stable/\">GTKmm book</link> " 14320"which also covers a lot more key concept for using the full power of GTKmm. " 14321"You might also be interested in the <link href=\"http://library.gnome.org/" 14322"devel/gstreamermm/\">GStreamermm reference documentation</link>." 14323msgstr "" 14324 14325#. (itstool) path: info/title 14326#: C/guitar-tuner.js.page:7 14327#, fuzzy 14328msgctxt "text" 14329msgid "Guitar tuner (JavaScript)" 14330msgstr "Guitar tuner (JavaScript)" 14331 14332#. (itstool) path: info/desc 14333#: C/guitar-tuner.js.page:17 14334msgid "" 14335"Use GTK+ and GStreamer to build a simple guitar tuner application for GNOME." 14336msgstr "" 14337 14338#. (itstool) path: synopsis/p 14339#: C/guitar-tuner.js.page:23 14340msgid "" 14341"In this tutorial we'll construct a small application, Guitar Tuner, using " 14342"JavaScript and GTK+ and GStreamer. To do and run all the code examples " 14343"yourself, you need an editor to write code in, terminal and GNOME 3. or " 14344"higher installed into your computer." 14345msgstr "" 14346 14347#. (itstool) path: item/p 14348#: C/guitar-tuner.js.page:25 14349#, fuzzy 14350msgid "<link xref=\"#gstreamer\">GStreamer pipelines</link>" 14351msgstr "" 14352"Falha ao conectar o novo fluxo dentro da linha de processamento do GStreamer" 14353 14354#. (itstool) path: item/p 14355#: C/guitar-tuner.js.page:26 C/weatherAppMain.js.page:23 14356msgid "<link xref=\"#script\">Script for running the application</link>" 14357msgstr "" 14358 14359#. (itstool) path: item/p 14360#: C/guitar-tuner.js.page:27 C/weatherAppMain.js.page:24 14361msgid "<link xref=\"#imports\">Libraries to import</link>" 14362msgstr "" 14363 14364#. (itstool) path: item/p 14365#: C/guitar-tuner.js.page:28 C/weatherAppMain.js.page:25 14366msgid "" 14367"<link xref=\"#mainwindow\">Creating the main window for the application</" 14368"link>" 14369msgstr "" 14370 14371#. (itstool) path: item/p 14372#: C/guitar-tuner.js.page:29 14373#, fuzzy 14374msgid "<link xref=\"#buttons\">Buttons for the tunes</link>" 14375msgstr "" 14376"Fornece botões apropriados para matemática avançada como <link xref=" 14377"\"trigonometry\"/>" 14378 14379#. (itstool) path: item/p 14380#: C/guitar-tuner.js.page:30 14381msgid "<link xref=\"#playSound\">Making the sounds with GStreamer</link>" 14382msgstr "" 14383 14384#. (itstool) path: item/p 14385#: C/guitar-tuner.js.page:31 14386msgid "<link xref=\"#connecting\">Connecting buttons to playSound</link>" 14387msgstr "" 14388 14389#. (itstool) path: item/p 14390#: C/guitar-tuner.js.page:32 14391msgid "<link xref=\"#guitarjs\">The whole program</link>" 14392msgstr "" 14393 14394#. (itstool) path: item/p 14395#: C/guitar-tuner.js.page:33 14396msgid "<link xref=\"#terminal\">Running the application form Terminal</link>" 14397msgstr "" 14398 14399#. (itstool) path: page/p 14400#: C/guitar-tuner.js.page:36 C/weatherApp.js.page:40 14401msgid "After reading this tutorial, you should see this in your screen:" 14402msgstr "" 14403 14404#. (itstool) path: section/title 14405#: C/guitar-tuner.js.page:48 C/hello-world.js.page:46 14406#: C/weatherAppMain.js.page:33 14407#, fuzzy 14408msgid "Script for running the application" 14409msgstr "Finalize o aplicativo e execute o script." 14410 14411#. (itstool) path: section/code 14412#: C/guitar-tuner.js.page:49 C/weatherAppMain.js.page:34 14413#, fuzzy, no-wrap 14414msgid "" 14415"\n" 14416" #!/usr/bin/gjs" 14417msgstr "" 14418"\n" 14419"#!/usr/bin/gjs\n" 14420 14421#. (itstool) path: section/p 14422#: C/guitar-tuner.js.page:51 14423msgid "" 14424"This line tells how to run the script. It needs to be the first line of the " 14425"code and it needs to be executable. To get the execution rights go to " 14426"terminal and run in right folder: chmod +x scriptname. Or you can use the " 14427"graphical filemanager. Just go to the right folder where your code is, right " 14428"click you code file, choose properties, click the permissions tab and check " 14429"the box for allow executing file as a program" 14430msgstr "" 14431 14432#. (itstool) path: section/code 14433#: C/guitar-tuner.js.page:56 14434#, no-wrap 14435msgid "" 14436"\n" 14437"var Gtk = imports.gi.Gtk;\n" 14438"var Gst = imports.gi.Gst;\n" 14439"\n" 14440"const Mainloop = imports.mainloop;" 14441msgstr "" 14442 14443#. (itstool) path: section/p 14444#: C/guitar-tuner.js.page:61 14445msgid "" 14446"In order to have a working program we need to import a few GObject " 14447"Introspection -libraries to our use. For working UI, we need Gtk and for " 14448"Gstreamer to work we need Gst. These are imported in the beginning so we " 14449"have them at use everywhere. Also in the beginning we import a construct " 14450"Mainloop to handle the timeout to be used with the tuning sounds." 14451msgstr "" 14452 14453#. (itstool) path: section/title 14454#: C/guitar-tuner.js.page:64 C/hello-world.js.page:59 C/hello-world.py.page:52 14455#: C/hello-world.vala.page:44 C/weatherAppMain.js.page:49 14456#, fuzzy 14457msgid "Creating the main window for the application" 14458msgstr "A janela principal para seu aplicativo" 14459 14460#. (itstool) path: section/code 14461#: C/guitar-tuner.js.page:65 14462#, no-wrap 14463msgid "" 14464"\n" 14465"Gtk.init(null, 0);\n" 14466"Gst.init(null, 0);\n" 14467"\n" 14468"var guitarwindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL, border_width: 100});\n" 14469"guitarwindow.title = \"Guitar Tuner\";\n" 14470"guitarwindow.connect(\"destroy\", function(){Gtk.main_quit()});\n" 14471"\n" 14472"guitarwindow.show();\n" 14473"Gtk.main();" 14474msgstr "" 14475 14476#. (itstool) path: section/p 14477#: C/guitar-tuner.js.page:75 14478msgid "" 14479"Importing Gtk and Gst is not enough, we need to initialize them in order to " 14480"get them working. When Gtk and Gst are up and running we need to create the " 14481"window for the application. Later we are going to put all the buttons for " 14482"making sounds inside this window. In order to get the window showing, we " 14483"need to tell it to show and we need also to run the code with the Gtk.main()" 14484msgstr "" 14485 14486#. (itstool) path: section/title 14487#: C/guitar-tuner.js.page:78 14488#, fuzzy 14489msgid "Buttons for the tunes" 14490msgstr "Os botões" 14491 14492#. (itstool) path: section/code 14493#: C/guitar-tuner.js.page:79 14494#, no-wrap 14495msgid "" 14496"\n" 14497"var guitar_box = new Gtk.ButtonBox ({orientation: Gtk.Orientation.VERTICAL, spacing: 10});\n" 14498"\n" 14499"var E = new Gtk.Button({label: \"E\"});\n" 14500"var A = new Gtk.Button({label: \"A\"});\n" 14501"var D = new Gtk.Button({label: \"D\"});\n" 14502"var G = new Gtk.Button({label: \"G\"});\n" 14503"var B = new Gtk.Button({label: \"B\"});\n" 14504"var e = new Gtk.Button({label: \"e\"});\n" 14505"\n" 14506"guitar_box.add(E);\n" 14507"guitar_box.add(A);\n" 14508"guitar_box.add(D);\n" 14509"guitar_box.add(G);\n" 14510"guitar_box.add(B);\n" 14511"guitar_box.add(e);\n" 14512"\n" 14513"guitarwindow.add(guitar_box);\n" 14514"\n" 14515"guitar_box.show_all();" 14516msgstr "" 14517 14518#. (itstool) path: section/p 14519#: C/guitar-tuner.js.page:99 14520msgid "" 14521"Because Gtk.Window can only contain a single widget, we need to create " 14522"something under it to be able to add all the necessary buttons inside it. In " 14523"this example we use Buttonbox. After creating the Buttonbox we create " 14524"buttons with necessary labels. After we have the buttons we need to add them " 14525"to the Buttonbox and the Buttonbox must be added to the Gtk.Window and " 14526"everything in the Buttonbox must be shown." 14527msgstr "" 14528 14529#. (itstool) path: section/p 14530#: C/guitar-tuner.js.page:100 14531msgid "" 14532"After this stage you should have a window appearing to your screen showing 6 " 14533"buttons. Right now the buttons don't do anything and we shall address that " 14534"issue later. Before we can connect the button signals to something we need " 14535"to code that something first." 14536msgstr "" 14537 14538#. (itstool) path: section/title 14539#: C/guitar-tuner.js.page:103 14540#, fuzzy 14541msgid "Making the sounds with GStreamer" 14542msgstr "gstreamer" 14543 14544#. (itstool) path: section/code 14545#: C/guitar-tuner.js.page:104 14546#, no-wrap 14547msgid "" 14548"\n" 14549"var frequencies = {E: 329.63, A: 440,\tD: 587.33,\tG: 783.99,\tB: 987.77,\te: 1318.5}\n" 14550"\n" 14551"function playSound(frequency){\n" 14552" var pipeline = new Gst.Pipeline({name: \"note\"});\n" 14553" var source = Gst.ElementFactory.make(\"audiotestsrc\",\"source\");\n" 14554" var sink = Gst.ElementFactory.make(\"autoaudiosink\",\"output\");\n" 14555"\n" 14556" source.set_property('freq', frequency);\n" 14557" pipeline.add(source);\n" 14558" pipeline.add(sink);\n" 14559" source.link(sink);\n" 14560" pipeline.set_state(Gst.State.PLAYING);\n" 14561"\n" 14562" Mainloop.timeout_add(500, function () {\n" 14563" pipeline.set_state(Gst.State.NULL);\n" 14564"\t return false;\n" 14565" });\n" 14566"}" 14567msgstr "" 14568 14569#. (itstool) path: section/p 14570#: C/guitar-tuner.js.page:123 14571msgid "" 14572"The first thing we need to do is decide what tunes we want to make when we " 14573"push a button. The frequencies list takes care of that. After that we get to " 14574"actually making the sounds with the function playSound. For function " 14575"playSound we give as an input a frequency (that we just defined in the " 14576"frequencies variable). First thing we need to construct is a pipeline, a " 14577"source and a sink. For the source we set the frequency. To the pipeline we " 14578"add both the source and the sink and then we tell it to keep playing. As a " 14579"last thing we use the const Mainloop to get the pipeline to stop after a " 14580"500ms." 14581msgstr "" 14582 14583#. (itstool) path: section/p 14584#: C/guitar-tuner.js.page:124 14585msgid "" 14586"Now we have the method of playing a tune when clicking a button. Next well " 14587"make the connections between pushing a button and playing the correct sound " 14588"from that button." 14589msgstr "" 14590 14591#. (itstool) path: section/title 14592#: C/guitar-tuner.js.page:127 14593#, fuzzy 14594msgid "Connecting buttons to playSound" 14595msgstr "Botões" 14596 14597#. (itstool) path: section/code 14598#: C/guitar-tuner.js.page:128 14599#, no-wrap 14600msgid "" 14601"\n" 14602"E.connect(\"clicked\", function() {\n" 14603" playSound(frequencies.E);\n" 14604"});\n" 14605"A.connect(\"clicked\", function(){\n" 14606" playSound(frequencies.A);\n" 14607"});\n" 14608"D.connect(\"clicked\", function(){\n" 14609" playSound(frequencies.D);\n" 14610"});\n" 14611"G.connect(\"clicked\", function(){\n" 14612" playSound(frequencies.G);\n" 14613"});\n" 14614"B.connect(\"clicked\", function(){\n" 14615" playSound(frequencies.B);\n" 14616"});\n" 14617"e.connect(\"clicked\", function(){\n" 14618" playSound(frequencies.e);\n" 14619"});" 14620msgstr "" 14621 14622#. (itstool) path: section/p 14623#: C/guitar-tuner.js.page:147 14624msgid "" 14625"The method of connecting button clicks to playSound with the correct tune is " 14626"by using the connect method of the button widget. So we choose a button to " 14627"be connected and type <code>E.connect(\"clicked\", function()" 14628"{playSound(frequencies.E);});</code> The <code>connect</code> tells that " 14629"when pushing E, something should happen. The <code>clicked</code> tells the " 14630"type of the signal happening to E and then in the <code>function(){};</code> " 14631"we call playSound with the correct note that should be associated with the " 14632"button." 14633msgstr "" 14634 14635#. (itstool) path: section/title 14636#: C/guitar-tuner.js.page:157 14637#, fuzzy 14638msgid "The whole program" 14639msgstr "" 14640"A descrição deve ser longa o suficiente para que as pessoas possam entender " 14641"todo o programa, mas não longa ao ponto deles ficarem entediados lendo-a. Se " 14642"um pacote consiste em vários programas menores, é melhor escrever uma " 14643"descrição de quais tipos de programas pertencem ao pacote e, então, escrever " 14644"descrições para cada programa." 14645 14646#. (itstool) path: section/p 14647#: C/guitar-tuner.js.page:158 14648msgid "" 14649"So this is what all the parts combined looks like. When running this code, " 14650"you should be able to tune your guitar (if you have correctly calibrated " 14651"speakers)." 14652msgstr "" 14653 14654#. (itstool) path: section/code 14655#: C/guitar-tuner.js.page:159 14656#, no-wrap 14657msgid "" 14658"\n" 14659"#!/usr/bin/gjs\n" 14660"var Gtk = imports.gi.Gtk;\n" 14661"var Gst = imports.gi.Gst;\n" 14662"\n" 14663"const Mainloop = imports.mainloop;\n" 14664"\n" 14665"Gtk.init(null, 0);\n" 14666"Gst.init(null, 0);\n" 14667"\n" 14668"var guitarwindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL, border_width: 100});\n" 14669"guitarwindow.title = \"Guitar Tuner\";\n" 14670"guitarwindow.connect(\"destroy\", function(){Gtk.main_quit()});\n" 14671"\n" 14672"var guitar_box = new Gtk.ButtonBox ({orientation: Gtk.Orientation.VERTICAL, spacing: 10});\n" 14673"\n" 14674"var E = new Gtk.Button({label: \"E\"});\n" 14675"var A = new Gtk.Button({label: \"A\"});\n" 14676"var D = new Gtk.Button({label: \"D\"});\n" 14677"var G = new Gtk.Button({label: \"G\"});\n" 14678"var B = new Gtk.Button({label: \"B\"});\n" 14679"var e = new Gtk.Button({label: \"e\"});\n" 14680"\n" 14681"var frequencies = {E: 329.63, A: 440,\tD: 587.33,\tG: 783.99,\tB: 987.77,\te: 1318.5}\n" 14682"\n" 14683"\n" 14684"function playSound(frequency){\n" 14685" var pipeline = new Gst.Pipeline({name: \"note\"});\n" 14686"\n" 14687" var source = Gst.ElementFactory.make(\"audiotestsrc\",\"source\");\n" 14688" var sink = Gst.ElementFactory.make(\"autoaudiosink\",\"output\");\n" 14689"\n" 14690" source.set_property('freq', frequency);\n" 14691" pipeline.add(source);\n" 14692" pipeline.add(sink);\n" 14693" source.link(sink);\n" 14694" pipeline.set_state(Gst.State.PLAYING);\n" 14695"\n" 14696" Mainloop.timeout_add(500, function () {\n" 14697" pipeline.set_state(Gst.State.NULL);\n" 14698"\t return false;\n" 14699"});\n" 14700"}\n" 14701"\n" 14702"E.connect(\"clicked\", function() {\n" 14703" playSound(frequencies.E);\n" 14704"});\n" 14705"A.connect(\"clicked\", function(){\n" 14706" playSound(frequencies.A);\n" 14707"});\n" 14708"D.connect(\"clicked\", function(){\n" 14709" playSound(frequencies.D);\n" 14710"});\n" 14711"G.connect(\"clicked\", function(){\n" 14712" playSound(frequencies.G);\n" 14713"});\n" 14714"B.connect(\"clicked\", function(){\n" 14715" playSound(frequencies.B);\n" 14716"});\n" 14717"e.connect(\"clicked\", function(){\n" 14718" playSound(frequencies.e);\n" 14719"});\n" 14720"\n" 14721"guitar_box.add(E);\n" 14722"guitar_box.add(A);\n" 14723"guitar_box.add(D);\n" 14724"guitar_box.add(G);\n" 14725"guitar_box.add(B);\n" 14726"guitar_box.add(e);\n" 14727"\n" 14728"guitarwindow.add(guitar_box);\n" 14729"\n" 14730"guitar_box.show_all();\n" 14731"guitarwindow.show();\n" 14732"Gtk.main();" 14733msgstr "" 14734 14735#. (itstool) path: section/title 14736#: C/guitar-tuner.js.page:237 14737#, fuzzy 14738msgid "Running the application form Terminal" 14739msgstr "Aplicativo no terminal" 14740 14741#. (itstool) path: section/p 14742#: C/guitar-tuner.js.page:238 14743msgid "" 14744"To run this application open Terminal, go to the folder where your " 14745"application is stored and then run" 14746msgstr "" 14747 14748#. (itstool) path: section/screen 14749#: C/guitar-tuner.js.page:238 14750#, no-wrap 14751msgid " <output style=\"prompt\">$ </output><input> GJS_PATH=`pwd` gjs guitarTuner.js</input> " 14752msgstr "" 14753 14754#. (itstool) path: section/p 14755#: C/guitar-tuner.js.page:243 14756msgid "" 14757"If you run into problems with the tutorial, compare your code with this " 14758"<link href=\"guitar-tuner/guitar-tuner.js\">reference code</link>." 14759msgstr "" 14760 14761#. (itstool) path: info/title 14762#: C/guitar-tuner.py.page:8 14763#, fuzzy 14764msgctxt "text" 14765msgid "Guitar tuner (Python)" 14766msgstr "Guitar tuner (Python)" 14767 14768#. (itstool) path: item/p 14769#: C/guitar-tuner.py.page:46 14770#, fuzzy 14771msgid "Basic knowledge of the Python programming language" 14772msgstr "Linguagem de programação Python" 14773 14774#. (itstool) path: item/p 14775#: C/guitar-tuner.py.page:60 14776msgid "" 14777"Choose <gui>PyGTK (automake)</gui> from the <gui>Python</gui> tab, click " 14778"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 14779"<file>guitar-tuner</file> as project name and directory." 14780msgstr "" 14781 14782#. (itstool) path: item/p 14783#: C/guitar-tuner.py.page:63 14784msgid "" 14785"Click <gui>Apply</gui> and the project will be created for you. Open " 14786"<file>src/guitar_tuner.py</file> from the <gui>Project</gui> or <gui>File</" 14787"gui> tabs. You should see some code which starts with the lines:" 14788msgstr "" 14789 14790#. (itstool) path: item/code 14791#: C/guitar-tuner.py.page:64 14792#, no-wrap 14793msgid "" 14794"\n" 14795"from gi.repository import Gtk, GdkPixbuf, Gdk\n" 14796"import os, sys" 14797msgstr "" 14798 14799#. (itstool) path: section/title 14800#: C/guitar-tuner.py.page:72 14801#, fuzzy 14802msgid "Run the code for the first time" 14803msgstr "Instrui o usuário na primeira vez que ele executar sudo" 14804 14805#. (itstool) path: section/p 14806#: C/guitar-tuner.py.page:73 14807msgid "" 14808"Most of the code in the file is template code. It loads an (empty) window " 14809"from the user interface description file and shows it. More details are " 14810"given below; skip this list if you understand the basics:" 14811msgstr "" 14812 14813#. (itstool) path: item/p 14814#: C/guitar-tuner.py.page:77 14815msgid "" 14816"The <code>import</code> lines at the top include the tell Python to load the " 14817"user interface and system libraries needed." 14818msgstr "" 14819 14820#. (itstool) path: item/p 14821#: C/guitar-tuner.py.page:81 14822msgid "" 14823"A class is declared that will be the main class for our application. In the " 14824"<code>__init__</code> method the main window is loaded from the GtkBuilder " 14825"file (<file>src/guitar-tuner.ui</file>) and the signals are connected." 14826msgstr "" 14827 14828#. (itstool) path: item/p 14829#: C/guitar-tuner.py.page:84 14830msgid "" 14831"Connecting signals is how you define what happens when you push a button, or " 14832"when some other event happens. Here, the <code>destroy</code> method is " 14833"called (and quits the app) when you close the window." 14834msgstr "" 14835 14836#. (itstool) path: item/p 14837#: C/guitar-tuner.py.page:87 14838msgid "" 14839"The <code>main</code> function is run by default when you start a Python " 14840"application. It just creates an instance of the main class and starts the " 14841"main loop to bring up the window." 14842msgstr "" 14843 14844#. (itstool) path: section/p 14845#: C/guitar-tuner.py.page:92 14846msgid "" 14847"This code is ready to be used, so you can run it by clicking " 14848"<guiseq><gui>Run</gui><gui>Execute</gui></guiseq>." 14849msgstr "" 14850 14851#. (itstool) path: section/p 14852#: C/guitar-tuner.py.page:97 14853msgid "" 14854"A description of the user interface (UI) is contained in the GtkBuilder " 14855"file. To edit the user interface, open <file>src/guitar_tuner.ui</file>. " 14856"This will switch to the interface designer. The design window is in the " 14857"center; widgets and widgets' properties are on the right, and the palette of " 14858"available widgets is on the left." 14859msgstr "" 14860 14861#. (itstool) path: section/title 14862#: C/guitar-tuner.py.page:127 14863#, fuzzy 14864msgid "Write the signal handler" 14865msgstr "O manipulador para este sinal" 14866 14867#. (itstool) path: section/p 14868#: C/guitar-tuner.py.page:129 14869msgid "" 14870"To do this, open <file>guitar_tuner.py</file> while the user interface file " 14871"is still open. Switch to the <gui>Signals</gui> tab, which you already used " 14872"to set the signal name. Now take the row where you set the <gui>clicked</" 14873"gui> signal and drag it into to the source file inside the class. The " 14874"following code will be added to your source file:" 14875msgstr "" 14876 14877#. (itstool) path: section/code 14878#: C/guitar-tuner.py.page:131 14879#, fuzzy, no-wrap 14880msgid "" 14881"\n" 14882"def on_button_clicked (self, button):\n" 14883msgstr "Aguarde até o botão de finalizar ser clicado." 14884 14885#. (itstool) path: section/p 14886#: C/guitar-tuner.py.page:135 14887msgid "" 14888"This signal handler has two arguments: the usual Python class pointer, and " 14889"the <code>Gtk.Button</code> that called the function." 14890msgstr "" 14891 14892#. (itstool) path: section/p 14893#: C/guitar-tuner.py.page:153 14894msgid "" 14895"Change the import line in <file>guitar_tuner.py</file>, just at the " 14896"beginning to :" 14897msgstr "" 14898 14899#. (itstool) path: section/code 14900#: C/guitar-tuner.py.page:154 14901#, no-wrap 14902msgid "from gi.repository import Gtk, Gst, GObject " 14903msgstr "" 14904 14905#. (itstool) path: section/p 14906#: C/guitar-tuner.py.page:155 14907msgid "" 14908"The <code>Gst</code> includes the GStreamer library. You also need to " 14909"initialise GStreamer properly which is done in the <code>main()</code> " 14910"method with this call added above the <code>app = GUI()</code> line:" 14911msgstr "" 14912 14913#. (itstool) path: section/code 14914#: C/guitar-tuner.py.page:158 14915#, fuzzy, no-wrap 14916msgid "Gst.init_check(sys.argv)" 14917msgstr "caixa de seleção" 14918 14919#. (itstool) path: section/p 14920#: C/guitar-tuner.py.page:159 14921msgid "" 14922"Then, copy the following function into the class in <file>guitar_tuner.py</" 14923"file> somewhere:" 14924msgstr "" 14925 14926#. (itstool) path: section/code 14927#: C/guitar-tuner.py.page:160 14928#, no-wrap 14929msgid "" 14930"\n" 14931"def play_sound(self, frequency):\n" 14932"\tpipeline = Gst.Pipeline(name='note')\n" 14933"\tsource = Gst.ElementFactory.make('audiotestsrc', 'src')\n" 14934"\tsink = Gst.ElementFactory.make('autoaudiosink', 'output')\n" 14935"\n" 14936"\tsource.set_property('freq', frequency)\n" 14937"\tpipeline.add(source)\n" 14938"\tpipeline.add(sink)\n" 14939"\tsource.link(sink)\n" 14940"\tpipeline.set_state(Gst.State.PLAYING)\n" 14941"\n" 14942"\tGObject.timeout_add(self.LENGTH, self.pipeline_stop, pipeline)" 14943msgstr "" 14944 14945#. (itstool) path: item/p 14946#: C/guitar-tuner.py.page:175 14947msgid "" 14948"The first three lines create source and sink GStreamer elements and a " 14949"pipeline element (which will be used as a container for the other two " 14950"elements). The pipeline is given the name \"note\"; the source is named " 14951"\"source\" and is set to the <code>audiotestsrc</code> source; and the sink " 14952"is named \"output\" and set to the <code>autoaudiosink</code> sink (default " 14953"sound card output)." 14954msgstr "" 14955 14956#. (itstool) path: item/p 14957#: C/guitar-tuner.py.page:178 14958msgid "" 14959"The call to <code>source.set_property</code> sets the <code>freq</code> " 14960"property of the source element to <code>frequency</code>, which was passed " 14961"as an argument to the <code>play_sound</code> function. This is just the " 14962"frequency of the note in Hertz; some useful frequencies will be defined " 14963"later on." 14964msgstr "" 14965 14966#. (itstool) path: item/p 14967#: C/guitar-tuner.py.page:181 14968msgid "" 14969"The next two lines call <code>pipeline.add</code>, putting the source and " 14970"sink into the pipeline. The pipeline can contain multiple other GStreamer " 14971"elements. In general, you can add as many elements as you like to the " 14972"pipeline by calling its <code>add</code> method repeatedly." 14973msgstr "" 14974 14975#. (itstool) path: item/p 14976#: C/guitar-tuner.py.page:184 14977msgid "" 14978"Next <code>pipeline.set_state</code> is used to start playback, by setting " 14979"the state of the pipeline to playing (<code>Gst.State.PLAYING</code>)." 14980msgstr "" 14981 14982#. (itstool) path: section/p 14983#: C/guitar-tuner.py.page:192 14984msgid "" 14985"We don't want to play an annoying tone forever, so the last thing " 14986"<code>play_sound</code> does is to call <code>GObject.timeout_add</code>. " 14987"This sets a timeout for stopping the sound; it waits for <code>LENGTH</code> " 14988"milliseconds before calling the function <code>pipeline_stop</code>, and " 14989"will keep calling it until <code>pipeline_stop</code> returns <code>False</" 14990"code>." 14991msgstr "" 14992 14993#. (itstool) path: section/p 14994#: C/guitar-tuner.py.page:193 14995msgid "" 14996"Now, we'll write the <code>pipeline_stop</code> function which is called by " 14997"<code>GObject.timeout_add</code>. Insert the following code <em>above</em> " 14998"the <code>play_sound</code> function:" 14999msgstr "" 15000 15001#. (itstool) path: section/code 15002#: C/guitar-tuner.py.page:194 15003#, no-wrap 15004msgid "" 15005"\n" 15006"def pipeline_stop(self, pipeline):\n" 15007"\tpipeline.set_state(Gst.State.NULL)\n" 15008"\treturn False\n" 15009msgstr "" 15010 15011#. (itstool) path: section/p 15012#: C/guitar-tuner.py.page:199 15013msgid "" 15014"You need to define the <code>LENGTH</code> constant inside the class, so add " 15015"this code at the beginning of the main class:" 15016msgstr "" 15017 15018#. (itstool) path: section/code 15019#: C/guitar-tuner.py.page:201 15020#, fuzzy, no-wrap 15021msgid "" 15022"\n" 15023"LENGTH = 500\n" 15024msgstr "500 MB de RAM." 15025 15026#. (itstool) path: section/p 15027#: C/guitar-tuner.py.page:204 15028msgid "" 15029"The call to <code>pipeline.set_state</code> stops the playback of the " 15030"pipeline." 15031msgstr "" 15032 15033#. (itstool) path: section/p 15034#: C/guitar-tuner.py.page:209 15035msgid "" 15036"We want to play the correct sound when the user clicks a button. First of " 15037"all, we need to know the frequencies for the six guitar strings, which are " 15038"defined (at the beginning of the main class) inside a dictionary so we can " 15039"easily map them to the names of the strings:" 15040msgstr "" 15041 15042#. (itstool) path: section/code 15043#: C/guitar-tuner.py.page:211 15044#, no-wrap 15045msgid "" 15046"\n" 15047"# Frequencies of the strings\n" 15048"frequencies = {\n" 15049"\t'E': 329.63,\n" 15050"\t'A': 440,\n" 15051"\t'D': 587.33,\n" 15052"\t'G': 783.99,\n" 15053"\t'B': 987.77,\n" 15054"\t'e': 1318.5\n" 15055"}\n" 15056msgstr "" 15057 15058#. (itstool) path: section/code 15059#: C/guitar-tuner.py.page:223 15060#, no-wrap 15061msgid "" 15062"\n" 15063"def on_button_clicked(self, button):\n" 15064"\tlabel = button.get_child()\n" 15065"\ttext = label.get_label()\n" 15066"\n" 15067"\tself.play_sound (self.frequencies[text])\n" 15068msgstr "" 15069 15070#. (itstool) path: section/p 15071#: C/guitar-tuner.py.page:230 15072msgid "" 15073"The button that was clicked is passed as an argument (<code>button</code>) " 15074"to <code>on_button_clicked</code>. We can get the label of that button by " 15075"using <code>button.get_child</code>, and then get the text from that label " 15076"using <code>label.get_label</code>." 15077msgstr "" 15078 15079#. (itstool) path: section/p 15080#: C/guitar-tuner.py.page:231 15081msgid "" 15082"The label text is then used as a key for the dictionary and " 15083"<code>play_sound</code> is called with the frequency appropriate for that " 15084"note. This plays the tone; we have a working guitar tuner!" 15085msgstr "" 15086 15087#. (itstool) path: section/title 15088#: C/guitar-tuner.py.page:235 C/image-viewer.js.page:311 15089#: C/image-viewer.py.page:225 C/record-collection.js.page:292 15090#, fuzzy 15091msgid "Run the application" 15092msgstr "Execute o aplicativo:" 15093 15094#. (itstool) path: section/p 15095#: C/guitar-tuner.py.page:236 15096msgid "" 15097"All of the code should now be ready to go. Click <guiseq><gui>Run</" 15098"gui><gui>Execute</gui></guiseq> to start the application. Enjoy!" 15099msgstr "" 15100 15101#. (itstool) path: section/p 15102#: C/guitar-tuner.py.page:241 15103msgid "" 15104"If you run into problems with the tutorial, compare your code with this " 15105"<link href=\"guitar-tuner/guitar-tuner.py\">reference code</link>." 15106msgstr "" 15107 15108#. (itstool) path: info/desc 15109#: C/guitar-tuner.vala.page:10 15110msgid "" 15111"Use <link href=\"http://developer.gnome.org/platform-overview/stable/gtk" 15112"\">GTK+</link> and <link href=\"http://developer.gnome.org/platform-overview/" 15113"stable/gstreamer\">GStreamer</link> to build a simple guitar tuner " 15114"application for GNOME. Shows off how to use the interface designer." 15115msgstr "" 15116 15117#. (itstool) path: synopsis/p 15118#: C/guitar-tuner.vala.page:35 15119msgid "" 15120"In this tutorial you will create an application which plays tones that you " 15121"can use to tune a guitar. You will learn how to:" 15122msgstr "" 15123 15124#. (itstool) path: item/p 15125#: C/guitar-tuner.vala.page:37 15126msgid "" 15127"Set up a basic project using the <link xref=\"getting-ready\">Anjuta IDE</" 15128"link>." 15129msgstr "" 15130 15131#. (itstool) path: item/p 15132#: C/guitar-tuner.vala.page:38 15133msgid "Create a simple GUI with <app>Anjuta</app>'s UI designer." 15134msgstr "" 15135 15136#. (itstool) path: item/p 15137#: C/guitar-tuner.vala.page:39 15138msgid "" 15139"Use the <link href=\"http://developer.gnome.org/platform-overview/stable/" 15140"gstreamer\">GStreamer</link> library to play sounds." 15141msgstr "" 15142 15143#. (itstool) path: item/p 15144#: C/guitar-tuner.vala.page:43 C/image-viewer.vala.page:48 15145msgid "" 15146"Basic knowledge of the <link href=\"https://live.gnome.org/Vala/Tutorial" 15147"\">Vala</link> programming language." 15148msgstr "" 15149 15150#. (itstool) path: item/p 15151#: C/guitar-tuner.vala.page:44 C/image-viewer.vala.page:49 15152#, fuzzy 15153msgid "An installed copy of <app>Anjuta</app>." 15154msgstr "Importe um projeto para o <app>Anjuta</app>." 15155 15156#. (itstool) path: section/title 15157#: C/guitar-tuner.vala.page:51 15158#, fuzzy 15159msgid "Create a project in <app>Anjuta</app>" 15160msgstr "Importe um projeto para o <app>Anjuta</app>." 15161 15162#. (itstool) path: item/p 15163#: C/guitar-tuner.vala.page:55 C/image-viewer.vala.page:63 15164msgid "" 15165"Start <app>Anjuta</app> and click <gui>Create a new project</gui> or " 15166"<guiseq><gui>File</gui><gui>New</gui><gui>Project</gui></guiseq> to open the " 15167"project wizard." 15168msgstr "" 15169 15170#. (itstool) path: item/p 15171#: C/guitar-tuner.vala.page:58 15172msgid "" 15173"Click on the <gui>Vala</gui> tab and select <gui>GTK+ (Simple)</gui>. Click " 15174"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 15175"<file>guitar-tuner</file> as project name and directory." 15176msgstr "" 15177 15178#. (itstool) path: item/p 15179#: C/guitar-tuner.vala.page:61 15180msgid "" 15181"Make sure that <gui>Configure external packages</gui> is switched <gui>ON</" 15182"gui>. On the next page, select <link href=\"http://valadoc.org/" 15183"gstreamer-0.10/index.htm\"><em>gstreamer-0.10</em></link> from the list to " 15184"include the GStreamer library in your project. Click <gui>Continue</gui>" 15185msgstr "" 15186 15187#. (itstool) path: item/p 15188#: C/guitar-tuner.vala.page:65 15189msgid "" 15190"Click <gui>Apply</gui> and the project will be created for you. From the " 15191"<gui>Project</gui> or <gui>Files</gui> tab, open <file>src/guitar_tuner." 15192"vala</file> by double-clicking on it. You should see some code which starts " 15193"with the lines:" 15194msgstr "" 15195 15196#. (itstool) path: item/code 15197#: C/guitar-tuner.vala.page:66 C/magic-mirror.vala.page:70 15198#, fuzzy, no-wrap 15199msgid "" 15200"\n" 15201"using GLib;\n" 15202"using Gtk;" 15203msgstr "usando GTK+-%d.%d.%d.\n" 15204 15205#. (itstool) path: section/p 15206#: C/guitar-tuner.vala.page:75 15207msgid "" 15208"The code loads an (empty) window from the user interface description file " 15209"and displays it. More details are given below; you may choose to skip this " 15210"list if you understand the basics:" 15211msgstr "" 15212 15213#. (itstool) path: item/p 15214#: C/guitar-tuner.vala.page:79 C/magic-mirror.vala.page:82 15215msgid "" 15216"The two <code>using</code> lines import namespaces so we don't have to name " 15217"them explicitly." 15218msgstr "" 15219 15220#. (itstool) path: item/p 15221#: C/guitar-tuner.vala.page:82 15222msgid "" 15223"The constructor of the <code>Main</code> class creates a new window by " 15224"opening a GtkBuilder file (<file>src/guitar-tuner.ui</file>, defined a few " 15225"lines above), connecting its signals and then displaying it in a window. " 15226"This GtkBuilder file contains a description of a user interface and all of " 15227"its elements. You can use Anjuta's editor to design GtkBuilder user " 15228"interfaces." 15229msgstr "" 15230 15231#. (itstool) path: note/p 15232#: C/guitar-tuner.vala.page:84 15233msgid "" 15234"Connecting signals is how you define what happens when you push a button, or " 15235"when some other event happens. Here, the <code>on_destroy</code> function is " 15236"called (and quits the app) when you close the window." 15237msgstr "" 15238 15239#. (itstool) path: item/p 15240#: C/guitar-tuner.vala.page:88 15241msgid "" 15242"The static <code>main</code> function is run by default when you start a " 15243"Vala application. It calls a few functions which create the Main class, set " 15244"up and then run the application. The <code>Gtk.main</code> function starts " 15245"the GTK main loop, which runs the user interface and starts listening for " 15246"events (like clicks and key presses)." 15247msgstr "" 15248 15249#. (itstool) path: section/p 15250#: C/guitar-tuner.vala.page:92 15251msgid "" 15252"This code is ready to be used, so you can compile it by clicking " 15253"<guiseq><gui>Build</gui><gui>Build Project</gui></guiseq> (or press " 15254"<keyseq><key>Shift</key><key>F7</key></keyseq>). When you do this, a dialog " 15255"will appear. Change the <gui>Configuration</gui> to <gui>Default</gui> and " 15256"then click <gui>Execute</gui> to configure the build directory. You only " 15257"need to do this once, for the first build." 15258msgstr "" 15259 15260#. (itstool) path: section/p 15261#: C/guitar-tuner.vala.page:97 15262msgid "" 15263"A description of the user interface (UI) is contained in the GtkBuilder file " 15264"<file>src/guitar_tuner.ui</file> defined at the top of the class. To edit " 15265"the user interface, open <file>src/guitar_tuner.ui</file> by double-clicking " 15266"on it in the <gui>Project</gui> or <gui>Files</gui> section. This will " 15267"switch to the interface designer. The design window is in the center; " 15268"<gui>Widgets</gui> and the widget properties are on the right, and the " 15269"<gui>Palette</gui> of available widgets is on the left." 15270msgstr "" 15271 15272#. (itstool) path: section/p 15273#: C/guitar-tuner.vala.page:99 15274msgid "" 15275"The layout of every UI in GTK+ is organized using boxes and tables. Let's " 15276"use a vertical GtkButtonBox here to assign six GtkButtons, one for each of " 15277"the six guitar strings." 15278msgstr "" 15279 15280#. (itstool) path: item/p 15281#: C/guitar-tuner.vala.page:105 15282msgid "" 15283"In the <gui>Palette</gui> tab, from the <gui>Containers</gui> section, " 15284"select a <gui>Button Box</gui> (GtkButtonBox) by clicking on the icon. Then " 15285"click on the design window in the center to place it into the window. A " 15286"dialog will display where you can set the <gui>Number of items</gui> to " 15287"<input>6</input>. Then click <gui>Create</gui>." 15288msgstr "" 15289 15290#. (itstool) path: note/p 15291#: C/guitar-tuner.vala.page:106 15292msgid "" 15293"You can also change the <gui>Number of elements</gui> and the " 15294"<gui>Orientation</gui> in the <gui>General</gui> tab on the right." 15295msgstr "" 15296 15297#. (itstool) path: item/p 15298#: C/guitar-tuner.vala.page:110 15299msgid "" 15300"Now, from the <gui>Control and Display</gui> section of the <gui>Palette</" 15301"gui> choose a <gui>Button</gui> (GtkButton) by clicking on it. Place it into " 15302"the first section of the GtkButtonBox by clicking in the first section." 15303msgstr "" 15304 15305#. (itstool) path: item/p 15306#: C/guitar-tuner.vala.page:113 15307msgid "" 15308"While the button is still selected, scroll down in the <gui>General</gui> " 15309"tab on the right to the <gui>Label</gui> property, and change it to <gui>E</" 15310"gui>. This will be the low E guitar string." 15311msgstr "" 15312 15313#. (itstool) path: note/p 15314#: C/guitar-tuner.vala.page:114 15315msgid "" 15316"The <gui>General</gui> tab is located in the <gui>Widgets</gui> section on " 15317"the right." 15318msgstr "" 15319 15320#. (itstool) path: item/p 15321#: C/guitar-tuner.vala.page:119 15322msgid "" 15323"Click on the <gui>Signals</gui> tab in the <gui>Widgets</gui> section on the " 15324"right, and look for the <code>clicked</code> signal of the button. You can " 15325"use this to connect a signal handler that will be called when the button is " 15326"clicked by the user. To do this, click on the signal and type " 15327"<code>main_on_button_clicked</code> in the <gui>Handler</gui> column and " 15328"press the <key>Enter</key>." 15329msgstr "" 15330 15331#. (itstool) path: section/p 15332#: C/guitar-tuner.vala.page:132 15333msgid "" 15334"This section will show you how to create the code to produce sounds. <link " 15335"href=\"http://developer.gnome.org/platform-overview/stable/gstreamer" 15336"\">GStreamer</link> is GNOME's multimedia framework — you can use it for " 15337"playing, recording, and processing video, audio, webcam streams and the " 15338"like. Here, we'll be using it to produce single-frequency tones." 15339msgstr "" 15340 15341#. (itstool) path: section/p 15342#: C/guitar-tuner.vala.page:133 15343msgid "" 15344"Conceptually, GStreamer works as follows: You create a <link href=\"http://" 15345"gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-intro-" 15346"basics-bins.html\"><em>pipeline</em></link> containing several processing " 15347"elements going from the <em>source</em> to the <em>sink</em> (output). The " 15348"source can be an image file, a video, or a music file, for example, and the " 15349"output could be a widget or the soundcard." 15350msgstr "" 15351 15352#. (itstool) path: section/p 15353#: C/guitar-tuner.vala.page:142 15354msgid "" 15355"In this example we will use a tone generator source called " 15356"<code>audiotestsrc</code> and send the output to the default system sound " 15357"device, <code>autoaudiosink</code>. We only need to configure the frequency " 15358"of the tone generator; this is accessible through the <code>freq</code> " 15359"property of <code>audiotestsrc</code>." 15360msgstr "" 15361 15362#. (itstool) path: section/p 15363#: C/guitar-tuner.vala.page:144 15364msgid "" 15365"We need to add a line to initialize GStreamer; put the following code on the " 15366"line above the <code>Gtk.init</code> call in the <code>main</code> function:" 15367msgstr "" 15368 15369#. (itstool) path: section/code 15370#: C/guitar-tuner.vala.page:145 15371#, fuzzy, no-wrap 15372msgid "Gst.init (ref args);" 15373msgstr "[~]NOME [ARGS] [+ [~]NOME [ARGS]…]" 15374 15375#. (itstool) path: section/p 15376#: C/guitar-tuner.vala.page:146 15377msgid "" 15378"Then, copy the following function into <file>guitar_tuner.vala</file> inside " 15379"our <code>Main</code> class:" 15380msgstr "" 15381 15382#. (itstool) path: section/code 15383#: C/guitar-tuner.vala.page:147 15384#, no-wrap 15385msgid "" 15386"\n" 15387"Gst.Element sink;\n" 15388"Gst.Element source;\n" 15389"Gst.Pipeline pipeline;\n" 15390"\n" 15391"private void play_sound(double frequency)\n" 15392"{\n" 15393"\tpipeline = new Gst.Pipeline (\"note\");\n" 15394"\tsource = Gst.ElementFactory.make (\"audiotestsrc\",\n" 15395"\t \"source\");\n" 15396"\tsink = Gst.ElementFactory.make (\"autoaudiosink\",\n" 15397"\t \"output\");\n" 15398"\n" 15399"\t/* set frequency */\n" 15400"\tsource.set (\"freq\", frequency);\n" 15401"\n" 15402"\tpipeline.add (source);\n" 15403"\tpipeline.add (sink);\n" 15404"\tsource.link (sink);\n" 15405"\n" 15406"\tpipeline.set_state (Gst.State.PLAYING);\n" 15407"\n" 15408"\t/* stop it after 200ms */\n" 15409"\tvar time = new TimeoutSource(200);\n" 15410"\n" 15411"\ttime.set_callback(() => {\n" 15412"\t\tpipeline.set_state (Gst.State.NULL);\n" 15413"\t\treturn false;\n" 15414"\t});\n" 15415"\ttime.attach(null);\n" 15416"}" 15417msgstr "" 15418 15419#. (itstool) path: item/p 15420#: C/guitar-tuner.vala.page:181 15421msgid "" 15422"The first three lines create source and sink GStreamer elements (<link href=" 15423"\"http://valadoc.org/gstreamer-0.10/Gst.Element.html\"><code>Gst.Element</" 15424"code></link>), and a <link href=\"http://valadoc.org/gstreamer-0.10/Gst." 15425"Pipeline.html\">pipeline element</link> (which will be used as a container " 15426"for the other two elements). Those are class variables so they are defined " 15427"outside the method. The pipeline is given the name \"note\"; the source is " 15428"named \"source\" and is set to the <code>audiotestsrc</code> source; and the " 15429"sink is named \"output\" and set to the <code>autoaudiosink</code> sink " 15430"(default sound card output)." 15431msgstr "" 15432 15433#. (itstool) path: item/p 15434#: C/guitar-tuner.vala.page:184 15435msgid "" 15436"The call to <link href=\"http://valadoc.org/gobject-2.0/GLib.Object.set.html" 15437"\"><code>source.set</code></link> sets the <code>freq</code> property of the " 15438"source element to <code>frequency</code>, which is passed in as an argument " 15439"to the <code>play_sound</code> function. This is just the frequency of the " 15440"note in Hertz; some useful frequencies will be defined later on." 15441msgstr "" 15442 15443#. (itstool) path: item/p 15444#: C/guitar-tuner.vala.page:187 15445msgid "" 15446"<link href=\"http://valadoc.org/gstreamer-0.10/Gst.Bin.add.html" 15447"\"><code>pipeline.add</code></link> puts the source and sink into the " 15448"pipeline. The pipeline is a <link href=\"http://valadoc.org/gstreamer-0.10/" 15449"Gst.Bin.html\"><code>Gst.Bin</code></link>, which is just an element that " 15450"can contain multiple other GStreamer elements. In general, you can add as " 15451"many elements as you like to the pipeline by adding more calls to " 15452"<code>pipeline.add</code>." 15453msgstr "" 15454 15455#. (itstool) path: item/p 15456#: C/guitar-tuner.vala.page:190 15457msgid "" 15458"Next, <link href=\"http://valadoc.org/gstreamer-0.10/Gst.Element.link.html" 15459"\"><code>sink.link</code></link> is used to connect the elements together, " 15460"so the output of source (a tone) goes into the input of sink (which is then " 15461"output to the sound card). <link href=\"http://www.valadoc.org/" 15462"gstreamer-0.10/Gst.Element.set_state.html\"><code>pipeline.set_state</code></" 15463"link> is then used to start playback, by setting the <link href=\"http://www." 15464"valadoc.org/gstreamer-0.10/Gst.State.html\">state of the pipeline</link> to " 15465"playing (<code>Gst.State.PLAYING</code>)." 15466msgstr "" 15467 15468#. (itstool) path: item/p 15469#: C/guitar-tuner.vala.page:193 15470msgid "" 15471"We don't want to play an annoying tone forever, so the last thing " 15472"<code>play_sound</code> does is to add a <link href=\"http://www.valadoc.org/" 15473"glib-2.0/GLib.TimeoutSource.html\"><code>TimeoutSource</code></link>. This " 15474"sets a timeout for stopping the sound; it waits for 200 milliseconds before " 15475"calling a signal handler defined inline that stops and destroys the " 15476"pipeline. It returns <code>false</code> to remove itself from the timeout, " 15477"otherwise it would continue to be called every 200 ms." 15478msgstr "" 15479 15480#. (itstool) path: section/p 15481#: C/guitar-tuner.vala.page:204 15482msgid "" 15483"In the UI designer, you made it so that all of the buttons will call the " 15484"same function, <gui>on_button_clicked</gui>, when they are clicked. Actually " 15485"we type <gui>main_on_button_clicked</gui> which tells the UI designer that " 15486"this method is part of our <code>Main</code>. We need to add that function " 15487"in the source file." 15488msgstr "" 15489 15490#. (itstool) path: section/p 15491#: C/guitar-tuner.vala.page:205 15492msgid "" 15493"To do this, in the user interface file (guitar_tuner.ui) select one of the " 15494"buttons by clicking on it, then open <file>guitar_tuner.vala</file> (by " 15495"clicking on the tab in the center). Switch to the <gui>Signals</gui> tab on " 15496"the right, which you used to set the signal name. Now take the row where you " 15497"set the <gui>clicked</gui> signal and drag and drop it into to the source " 15498"file at the beginning of the class. The following code will be added to your " 15499"source file:" 15500msgstr "" 15501 15502#. (itstool) path: section/code 15503#: C/guitar-tuner.vala.page:207 15504#, no-wrap 15505msgid "" 15506"\n" 15507"public void on_button_clicked (Gtk.Button sender) {\n" 15508"\n" 15509"}" 15510msgstr "" 15511 15512#. (itstool) path: note/p 15513#: C/guitar-tuner.vala.page:212 15514msgid "" 15515"You can also just type the code at the beginning of the class instead of " 15516"using the drag and drop." 15517msgstr "" 15518 15519#. (itstool) path: section/p 15520#: C/guitar-tuner.vala.page:213 15521msgid "" 15522"This signal handler has only one argument: the <link href=\"http://valadoc." 15523"org/gtk+-3.0/Gtk.Widget.html\"><code>Gtk.Widget</code></link> that called " 15524"the function (in our case, always a <link href=\"http://valadoc.org/gtk+-3.0/" 15525"Gtk.Button.html\"><code>Gtk.Button</code></link>)." 15526msgstr "" 15527 15528#. (itstool) path: section/title 15529#: C/guitar-tuner.vala.page:219 15530#, fuzzy 15531msgid "Define the signal handler" 15532msgstr "O manipulador para este sinal" 15533 15534#. (itstool) path: section/p 15535#: C/guitar-tuner.vala.page:220 15536msgid "" 15537"We want to play the correct sound when the user clicks a button. For this, " 15538"we flesh out the signal handler which we defined above, " 15539"<code>on_button_clicked</code>. We could have connected every button to a " 15540"different signal handler, but that would lead to a lot of code duplication. " 15541"Instead, we can use the label of the button to figure out which button was " 15542"clicked:" 15543msgstr "" 15544 15545#. (itstool) path: section/code 15546#: C/guitar-tuner.vala.page:221 15547#, no-wrap 15548msgid "" 15549"\n" 15550"public void on_button_clicked (Gtk.Button sender) {\n" 15551"\tvar label = sender.get_child () as Gtk.Label;\n" 15552"\tswitch (label.get_label()) {\n" 15553"\t\tcase \"E\":\n" 15554"\t\t\tplay_sound (329.63);\n" 15555"\t\t\tbreak;\n" 15556"\t\tcase \"A\":\n" 15557"\t\t\tplay_sound (440);\n" 15558"\t\t\tbreak;\n" 15559"\t\tcase \"D\":\n" 15560"\t\t\tplay_sound (587.33);\n" 15561"\t\t\tbreak;\n" 15562"\t\tcase \"G\":\n" 15563"\t\t\tplay_sound (783.99);\n" 15564"\t\t\tbreak;\n" 15565"\t\tcase \"B\":\n" 15566"\t\t\tplay_sound (987.77);\n" 15567"\t\t\tbreak;\n" 15568"\t\tcase \"e\":\n" 15569"\t\t\tplay_sound (1318);\n" 15570"\t\t\tbreak;\n" 15571"\t\tdefault:\n" 15572"\t\t\tbreak;\n" 15573"\t}\n" 15574"}\n" 15575msgstr "" 15576 15577#. (itstool) path: section/p 15578#: C/guitar-tuner.vala.page:248 15579msgid "" 15580"The <code>Gtk.Button</code> that was clicked is passed as an argument " 15581"(<code>sender</code>) to <code>on_button_clicked</code>. We can get the " 15582"label of that button by using <code>get_child</code>, and then get the text " 15583"from that label using <code>get_label</code>." 15584msgstr "" 15585 15586#. (itstool) path: section/p 15587#: C/guitar-tuner.vala.page:249 15588msgid "" 15589"The switch statement compares the label text to the notes that we can play, " 15590"and <code>play_sound</code> is called with the frequency appropriate for " 15591"that note. This plays the tone; we have a working guitar tuner!" 15592msgstr "" 15593 15594#. (itstool) path: section/p 15595#: C/guitar-tuner.vala.page:260 15596msgid "" 15597"If you run into problems with the tutorial, compare your code with this " 15598"<link href=\"guitar-tuner/guitar-tuner.vala\">reference code</link>." 15599msgstr "" 15600 15601#. (itstool) path: section/title 15602#: C/guitar-tuner.vala.page:264 C/magic-mirror.vala.page:157 15603#, fuzzy 15604msgid "Further reading" 15605msgstr "Para demais leituras, por favor selecione uma seção no menu acima." 15606 15607#. (itstool) path: section/p 15608#: C/guitar-tuner.vala.page:265 15609msgid "" 15610"To find out more about the Vala programming language you might want to check " 15611"out the <link href=\"http://live.gnome.org/Vala/Tutorial\">Vala Tutorial</" 15612"link> and the <link href=\"http://valadoc.org/\">Vala API Documentation</" 15613"link>" 15614msgstr "" 15615 15616#. (itstool) path: info/desc 15617#: C/hellognome.js.page:17 15618msgid "Your first GNOME application!" 15619msgstr "Seu primeiro aplicativo do GNOME!" 15620 15621#. (itstool) path: page/title 15622#: C/hellognome.js.page:20 15623msgid "1. Hello, GNOME!" 15624msgstr "1. Olá, GNOME!" 15625 15626#. (itstool) path: synopsis/p 15627#: C/hellognome.js.page:22 15628msgid "" 15629"This tutorial will show you how to write your first GNOME application in " 15630"JavaScript. You will use JavaScript to write for GNOME the same way you " 15631"would for the web. Afterwards, you will learn how to use \"native\" widgets, " 15632"to write applications that look and feel like other GNOME apps." 15633msgstr "" 15634"Este tutorial vai mostrar como escrever o seu primeiro aplicativo do GNOME " 15635"em JavaScript. Você vai usar o JavaScript para escrever para o GNOME da " 15636"mesma forma que você faria para a web. Em seguida, você aprenderá como usar " 15637"widgets “nativos”, para escrever aplicativos que parecem com outros " 15638"aplicativos do GNOME." 15639 15640#. (itstool) path: note/p 15641#: C/hellognome.js.page:23 15642msgid "" 15643"Have you gotten GNOME installed on your computer, and <link xref=\"set-up-" 15644"gedit.js\">gedit</link> set up to write code with? You'll want to do these " 15645"things first." 15646msgstr "" 15647"Você instalou o GNOME no seu computador e configurou o <link xref=\"set-up-" 15648"gedit.js\">gedit</link> para com ele escrever códigos? Você vai querer fazer " 15649"essas coisas primeiro." 15650 15651#. (itstool) path: section/title 15652#: C/hellognome.js.page:29 15653msgid "Let's start with a web page" 15654msgstr "Vamos começar com uma página web" 15655 15656#. (itstool) path: section/p 15657#: C/hellognome.js.page:31 15658msgid "" 15659"Here's some basic HTML, CSS, and JavaScript code. Does this look familiar?" 15660msgstr "" 15661"Aqui estão alguns códigos básicos de HTML, CSS e JavaScript. Eles parecem " 15662"familiar?" 15663 15664#. (itstool) path: section/code 15665#: C/hellognome.js.page:32 15666#, fuzzy, no-wrap 15667#| msgid "" 15668#| "\n" 15669#| "<!DOCTYPE html>\n" 15670#| "<html>\n" 15671#| " <head>\n" 15672#| " <title>Hello, GNOME!</title>\n" 15673#| "\n" 15674#| " <!-- Use JavaScript to show a greeting when someone clicks the button -->\n" 15675#| " <script type=\"application/javascript\">\n" 15676#| " function greeting () {\n" 15677#| " document.getElementById (\"greeting\").innerHTML = (\"O hai!\");\n" 15678#| " }\n" 15679#| " </script>\n" 15680#| "\n" 15681#| " <!-- Very basic CSS style using the GNOME font -->\n" 15682#| " <style type=\"text/css\">\n" 15683#| " body {\n" 15684#| " font-face: Cantarell, sans-serif;\n" 15685#| " text-align: center; }\n" 15686#| " </style>\n" 15687#| "\n" 15688#| " </head>\n" 15689#| " <body>\n" 15690#| " <br /> <br />\n" 15691#| " <button type=\"button\" onclick=\"greeting()\">Hello, GNOME!</button>\n" 15692#| "\n" 15693#| " <!-- Empty H1 element gets filled in when the button is clicked -->\n" 15694#| " <h1 id=\"greeting\"></h1>\n" 15695#| " </body>\n" 15696#| "</html>\n" 15697msgid "" 15698"\n" 15699"<!DOCTYPE html>\n" 15700"<html>\n" 15701" <head>\n" 15702" <meta charset=\"utf-8\">\n" 15703" <title>Hello, GNOME!</title>\n" 15704"\n" 15705" <!-- Use JavaScript to show a greeting when someone clicks the button -->\n" 15706" <script type=\"application/javascript\">\n" 15707" function greeting () {\n" 15708" document.getElementById (\"greeting\").innerHTML = (\"O hai!\");\n" 15709" }\n" 15710" </script>\n" 15711"\n" 15712" <!-- Very basic CSS style using the GNOME font -->\n" 15713" <style type=\"text/css\">\n" 15714" body {\n" 15715" font-face: Cantarell, sans-serif;\n" 15716" text-align: center; }\n" 15717" </style>\n" 15718"\n" 15719" </head>\n" 15720" <body>\n" 15721" <br /> <br />\n" 15722" <button type=\"button\" onclick=\"greeting()\">Hello, GNOME!</button>\n" 15723"\n" 15724" <!-- Empty H1 element gets filled in when the button is clicked -->\n" 15725" <h1 id=\"greeting\"></h1>\n" 15726" </body>\n" 15727"</html>\n" 15728msgstr "" 15729"\n" 15730"<!DOCTYPE html>\n" 15731"<html>\n" 15732" <head>\n" 15733" <title>Olá, GNOME!</title>\n" 15734"\n" 15735" <!-- Usa o JavaScript para mostrar os comprimentos quando alguém clica o botão -->\n" 15736" <script type=\"application/javascript\">\n" 15737" function greeting () {\n" 15738" document.getElementById (\"greeting\").innerHTML = (\"O hai!\");\n" 15739" }\n" 15740" </script>\n" 15741"\n" 15742" <!-- Estilo bem básico de CSS usando a fonte do GNOME -->\n" 15743" <style type=\"text/css\">\n" 15744" body {\n" 15745" font-face: Cantarell, sans-serif;\n" 15746" text-align: center; }\n" 15747" </style>\n" 15748"\n" 15749" </head>\n" 15750" <body>\n" 15751" <br /> <br />\n" 15752" <button type=\"button\" onclick=\"greeting()\">Olá, GNOME!</button>\n" 15753"\n" 15754" <!-- Um elemento H1 vazio é preenchido quando o botão for clicado -->\n" 15755" <h1 id=\"greeting\"></h1>\n" 15756" </body>\n" 15757"</html>\n" 15758 15759#. (itstool) path: section/p 15760#: C/hellognome.js.page:64 15761msgid "" 15762"Let's save this as <file>hellognome.html</file>, and see what it looks like " 15763"when we run it!" 15764msgstr "" 15765"Vamos salvar isso como <file>hellognome.html</file> e vejamos com o que ele " 15766"se parece quando nós executamo-o!" 15767 15768#. (itstool) path: section/media 15769#. This is a reference to an external file such as an image or video. When 15770#. the file changes, the md5 hash will change to let you know you need to 15771#. update your localized copy. The msgstr is not used at all. Set it to 15772#. whatever you like once you have updated your copy of the file. 15773#: C/hellognome.js.page:66 15774msgctxt "_" 15775msgid "" 15776"external ref='media/hellognomewebapp.png' " 15777"md5='948efb6148ede3bc6b47b4b0bbe4a74f'" 15778msgstr "" 15779"external ref='media/hellognomewebapp.png' " 15780"md5='948efb6148ede3bc6b47b4b0bbe4a74f'" 15781 15782#. (itstool) path: section/p 15783#: C/hellognome.js.page:68 15784msgid "" 15785"You <em>can</em> run the above code by opening <file>hellognome.html</file> " 15786"in a web browser. But here, we're going to create a GNOME application that " 15787"runs our web app inside of it, just like you see in the screenshot. You'll " 15788"be able to resize and maximize the window, and click the X in the corner to " 15789"close it, just like you'd expect from any other GNOME app. The difference is " 15790"that this one will run our web code inside of it." 15791msgstr "" 15792"Você <em>pode</em> executar o código acima abrindo <file>hellognome.html</" 15793"file> em um navegador web. Mas aqui, nós vamos criar um aplicativo do GNOME " 15794"que executa nosso aplicativo web dentro dele, da mesma forma que você vê na " 15795"captura de tela. Você vai poder redimensionar e maximizar a janela e clicar " 15796"no X na esquina para fechá-lo, da mesma forma que você esperaria de um outro " 15797"aplicativo GNOME. A diferença é que este aqui vai executar um código web " 15798"dentro dele." 15799 15800#. (itstool) path: section/p 15801#: C/hellognome.js.page:69 15802msgid "" 15803"The best part? We're going to continue to use JavaScript, to write all the " 15804"parts that make our app work with GNOME. Let's look at the code, and see how " 15805"it's done!" 15806msgstr "" 15807"A melhor parte? Nós vamos continuar a usar JavaScript, para escrever todas " 15808"as partes que fazem do seu aplicativo funcionar com GNOME. Vamos olhar o " 15809"código e ver como isso é feito!" 15810 15811#. (itstool) path: section/title 15812#: C/hellognome.js.page:73 15813msgid "Creating a GNOME window to frame our web app" 15814msgstr "Criando uma janela do GNOME para enquadrar nosso aplicativo web" 15815 15816#. (itstool) path: section/p 15817#: C/hellognome.js.page:75 15818msgid "" 15819"First, we need to tell GNOME that this is a JavaScript application, which " 15820"uses gjs. Gjs is GNOME's way of turning your JavaScript code into " 15821"instructions it understands, so this line always has to go at the start of " 15822"your applications." 15823msgstr "" 15824"Primeiro, nós precisamos informar o GNOME que este é um aplicativo " 15825"JavaScript, o qual usa gjs. Gjs é a forma do GNOMe de transformar o seu " 15826"código em instruções que ele entende, de forma que esta linha sempre tem que " 15827"ir no começo dos aplicativos." 15828 15829#. (itstool) path: section/code 15830#: C/hellognome.js.page:76 15831#, no-wrap 15832msgid "" 15833"\n" 15834"#!/usr/bin/gjs\n" 15835msgstr "" 15836"\n" 15837"#!/usr/bin/gjs\n" 15838 15839#. (itstool) path: section/p 15840#: C/hellognome.js.page:79 15841msgid "Then we should set the versions of the libraries we'll be using." 15842msgstr "" 15843 15844#. (itstool) path: section/code 15845#: C/hellognome.js.page:80 15846#, fuzzy, no-wrap 15847msgid "" 15848"\n" 15849"imports.gi.versions.Gtk = '3.0';\n" 15850"imports.gi.versions.WebKit2 = '4.0';\n" 15851msgstr "" 15852"\n" 15853"imports.gi.versions.Gtk = '3.0';\n" 15854"const Gtk = imports.gi.Gtk;\n" 15855 15856#. (itstool) path: section/p 15857#: C/hellognome.js.page:84 15858msgid "After that, we need to tell GNOME which libraries we want to import." 15859msgstr "" 15860"Depois disso, nós precisamos informar o GNOME quais bibliotecas nós queremos " 15861"importar." 15862 15863#. (itstool) path: section/code 15864#: C/hellognome.js.page:85 15865#, fuzzy, no-wrap 15866#| msgid "" 15867#| "\n" 15868#| "const GLib = imports.gi.GLib;\n" 15869#| "const Gtk = imports.gi.Gtk;\n" 15870#| "const Lang = imports.lang;\n" 15871#| "const Webkit = imports.gi.WebKit;\n" 15872msgid "" 15873"\n" 15874"const GLib = imports.gi.GLib;\n" 15875"const Gtk = imports.gi.Gtk;\n" 15876"const Webkit = imports.gi.WebKit2;\n" 15877msgstr "" 15878"\n" 15879"const GLib = imports.gi.GLib;\n" 15880"const Gtk = imports.gi.Gtk;\n" 15881"const Lang = imports.lang;\n" 15882"const Webkit = imports.gi.WebKit;\n" 15883 15884#. (itstool) path: section/p 15885#: C/hellognome.js.page:90 15886msgid "" 15887"Just like how add-on libraries like jQuery let us do extra things with " 15888"JavaScript, each of these libraries gives us new capabilities for our GNOME " 15889"apps:" 15890msgstr "" 15891"Da mesma forma que as bibliotecas complementares tipo jQuery nos permitem " 15892"fazer coisas com JavaScript, cada um destas bibliotecas nos dá novas " 15893"capacidades para nossos aplicativos do GNOME:" 15894 15895#. (itstool) path: item/p 15896#: C/hellognome.js.page:92 15897#, fuzzy 15898#| msgid "" 15899#| "<file>Gtk</file> and <file>Lang</file> are basic parts of any GNOME " 15900#| "application, which let you create windows and widgets and tie them " 15901#| "together." 15902msgid "" 15903"<file>Gtk</file> is the basic part of any GNOME application, which lets you " 15904"create windows and widgets and tie them together." 15905msgstr "" 15906"O <file>Gtk</file> e <file>Lang</file> são partes básicas de qualquer " 15907"aplicativo do GNOME o que permite que você cria janelas e widgets e vincula-" 15908"as." 15909 15910#. (itstool) path: item/p 15911#: C/hellognome.js.page:93 15912msgid "" 15913"<file>GLib</file> is a helper library, which lets us do things like tell " 15914"GNOME where the <file>hellognome.html</file> file we created is." 15915msgstr "" 15916"O <file>GLib</file> é uma biblioteca de ajuda, o que nos permite fazer " 15917"coisas como informar o GNOME onde o arquivo <file>hellognome.html</file> foi " 15918"criado." 15919 15920#. (itstool) path: item/p 15921#: C/hellognome.js.page:94 15922msgid "" 15923"And <file>Webkit</file> is a web rendering engine, which we'll use to " 15924"basically create a browser window to open our HTML file with." 15925msgstr "" 15926"E o <file>Webkit</file> é um motor web de renderização, que nós vamos usar " 15927"para basicamente criar uma janela de navegador para abrir o nosso arquivo " 15928"HTML." 15929 15930#. (itstool) path: section/p 15931#: C/hellognome.js.page:97 15932msgid "Now we create the application itself:" 15933msgstr "Nós vamos criar o aplicativo em si:" 15934 15935#. (itstool) path: section/code 15936#: C/hellognome.js.page:98 15937#, fuzzy, no-wrap 15938#| msgid "1. Hello, GNOME!" 15939msgid "" 15940"\n" 15941"class HelloGNOME {\n" 15942msgstr "1. Olá, GNOME!" 15943 15944#. (itstool) path: section/p 15945#: C/hellognome.js.page:101 15946#, fuzzy 15947#| msgid "" 15948#| "This will look familiar to you if you've worked with object-oriented " 15949#| "JavaScript before. That's right; our whole application is a class called " 15950#| "HelloGNOME. And as you can see, we've given it a property that says what " 15951#| "its name is." 15952msgid "" 15953"This will look familiar to you if you've worked with object-oriented " 15954"JavaScript before. That's right; our whole application is a class called " 15955"HelloGNOME." 15956msgstr "" 15957"Isso vai parecer familiar para você se você trabalhou antes com JavaScript " 15958"orientado a objeto. É isso mesmo; todo o seu aplicativo é uma classe chamada " 15959"HelloGNOME. E como você pode ver, nós damos a ela uma propriedade que " 15960"informa qual o nome e do aplicativo." 15961 15962#. (itstool) path: section/code 15963#: C/hellognome.js.page:103 15964#, fuzzy, no-wrap 15965#| msgid "" 15966#| "\n" 15967#| " // Create the application itself\n" 15968#| " _init: function () {\n" 15969#| " this.application = new Gtk.Application ();\n" 15970#| "\n" 15971#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 15972#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 15973#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 15974#| " },\n" 15975#| "\n" 15976#| " // Callback function for 'activate' signal presents windows when active\n" 15977#| " _onActivate: function () {\n" 15978#| " this._window.present ();\n" 15979#| " },\n" 15980#| "\n" 15981#| " // Callback function for 'startup' signal builds the UI\n" 15982#| " _onStartup: function () {\n" 15983#| " this._buildUI ();\n" 15984#| " },\n" 15985msgid "" 15986"\n" 15987" // Create the application itself\n" 15988" constructor() {\n" 15989" this.application = new Gtk.Application();\n" 15990"\n" 15991" // Connect 'activate' and 'startup' signals to the callback functions\n" 15992" this.application.connect('activate', this._onActivate.bind(this));\n" 15993" this.application.connect('startup', this._onStartup.bind(this));\n" 15994" }\n" 15995"\n" 15996" // Callback function for 'activate' signal presents windows when active\n" 15997" _onActivate() {\n" 15998" this._window.present();\n" 15999" }\n" 16000"\n" 16001" // Callback function for 'startup' signal builds the UI\n" 16002" _onStartup() {\n" 16003" this._buildUI();\n" 16004" }\n" 16005msgstr "" 16006"\n" 16007" // Cria o aplicativo em si\n" 16008" _init: function () {\n" 16009" this.application = new Gtk.Application ();\n" 16010"\n" 16011" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 16012" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 16013" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 16014" },\n" 16015"\n" 16016" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 16017" _onActivate: function () {\n" 16018" this._window.present ();\n" 16019" },\n" 16020"\n" 16021" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 16022" _onStartup: function () {\n" 16023" this._buildUI ();\n" 16024" },\n" 16025 16026#. (itstool) path: section/p 16027#: C/hellognome.js.page:123 16028msgid "" 16029"Here's some code you will more or less copy-and-paste for every JavaScript " 16030"application you build. It creates a new Application, and then binds its " 16031"activate and startup signals to functions that make the window show itself " 16032"and build its user interface, respectively." 16033msgstr "" 16034"Aqui está um código que você que você vai copiar para quase todo aplicativo " 16035"JavaScript que você construir. Ele cria um novo Aplicativo e, então, vincula " 16036"seus sinais de ativação e inicialização a funções que fazem a janela se " 16037"mostrar e construir sua interface gráfica, respectivamente." 16038 16039#. (itstool) path: section/p 16040#: C/hellognome.js.page:124 16041#, fuzzy 16042#| msgid "" 16043#| "What does that mean? Well, everything in a GNOME application sends out a " 16044#| "signal when something important happens. A button might send out the " 16045#| "clicked signal when you click on it, for instance. Our job is to connect " 16046#| "the signals to functions which handle them, and make the things that we " 16047#| "want to have happen occur. We do this using each object's connect method, " 16048#| "which takes two arguments: The signal we want to handle, and the Lang." 16049#| "bind function, which we have to use to tell connect which function we " 16050#| "want to have handle the signal." 16051msgid "" 16052"What does that mean? Well, everything in a GNOME application sends out a " 16053"signal when something important happens. A button might send out the clicked " 16054"signal when you click on it, for instance. Our job is to connect the signals " 16055"to functions which handle them, and make the things that we want to have " 16056"happen occur. We do this using each object's connect method, which takes two " 16057"arguments: The signal we want to handle, and the bound function, which we " 16058"have to use to tell connect which function we want to have handle the signal." 16059msgstr "" 16060"O que isso significa? Bom, tudo em um aplicativo do GNOME envia um sinal " 16061"quando alguma coisa de importante acontece. Um botão pode enviar o sinal de " 16062"clicado quando você clica nele, por exemplo. Nosso trabalho é conectar os " 16063"sinais às funções que lidam com eles e fazer as coisas que nós queremos que " 16064"ocorram. Nós fazemos isso usando método de conexão de objeto, o qual leva " 16065"dois argumentos: O sinal que nós queremos lidar e a função Lang.bind, a qual " 16066"nós temos que usar para informar a conexão qual a função nós queremos que " 16067"lide com o sinal." 16068 16069#. (itstool) path: section/p 16070#: C/hellognome.js.page:125 16071msgid "" 16072"In this case, we want _onActivate to handle the activate signal, and " 16073"_onStartup to handle the startup signal. _onActivate just tells the window " 16074"to present itself; so basically, whenever you <keyseq><key>Alt</key> " 16075"<key>Tab</key></keyseq> to the application it appears, like you would expect " 16076"it to. _onStartup calls _buildUI, which is the function that creates our " 16077"user interface and is the next part that we will look at." 16078msgstr "" 16079"Neste caso, nós queremos que o _onActivate lide com o sinal de ativação e " 16080"que o _onStartup lide com o sinal de inicialização. O _onActivate apenas " 16081"informa à janela para se apresentar; então, basicamente, quando você " 16082"pressiona <keyseq><key>Alt</key> <key>Tab</key></keyseq>, o aplicativo " 16083"aparece, como você esperaria. O _onStartup chama _buildUI, a qual é a função " 16084"que cria nossa interface gráfica e é a próxima parte que vamos olhar." 16085 16086#. (itstool) path: note/p 16087#: C/hellognome.js.page:126 16088#, fuzzy 16089#| msgid "" 16090#| "When you copy and paste the above code for your own applications, be sure " 16091#| "to change the name to a unique one each time." 16092msgid "" 16093"When you copy and paste the above code for your own applications, be sure to " 16094"change the class name to a unique one each time." 16095msgstr "" 16096"Quando você copiar e colar o código acima para nossos aplicativos, " 16097"certifique-se de alterar o nome para um único a cada vez." 16098 16099#. (itstool) path: section/title 16100#: C/hellognome.js.page:130 16101msgid "Designing our window's UI" 16102msgstr "Desenhando a interface gráfica da nossa janela" 16103 16104#. (itstool) path: section/p 16105#: C/hellognome.js.page:131 16106msgid "" 16107"In the _buildUI function, we're going to tell GNOME about our window and the " 16108"things inside it, one at a time. After that, we're going to connect " 16109"everything together and put it all on display." 16110msgstr "" 16111"Na função _buildUI, nós vamos informar o GNOME sobre nossa janela e as " 16112"coisas dentro dela, uma coisa de cada vez. Depois disso, nós vamos conectar " 16113"tudo e colocar na exibição." 16114 16115#. (itstool) path: section/code 16116#: C/hellognome.js.page:133 16117#, fuzzy, no-wrap 16118#| msgid "" 16119#| "\n" 16120#| " // Build the application's UI\n" 16121#| " _buildUI: function () {\n" 16122#| "\n" 16123#| " // Create the application window\n" 16124#| " this._window = new Gtk.ApplicationWindow ({\n" 16125#| " application: this.application,\n" 16126#| " title: \"Welcome to GNOME\",\n" 16127#| " default_height: 200,\n" 16128#| " default_width: 400,\n" 16129#| " window_position: Gtk.WindowPosition.CENTER });\n" 16130msgid "" 16131"\n" 16132" // Build the application's UI\n" 16133" _buildUI() {\n" 16134"\n" 16135" // Create the application window\n" 16136" this._window = new Gtk.ApplicationWindow ({\n" 16137" application: this.application,\n" 16138" title: \"Welcome to GNOME\",\n" 16139" default_height: 200,\n" 16140" default_width: 400,\n" 16141" window_position: Gtk.WindowPosition.CENTER });\n" 16142msgstr "" 16143"\n" 16144" // Constrói a interface gráfica do aplicativo\n" 16145" _buildUI: function () {\n" 16146"\n" 16147" // Cria a janela do aplicativo\n" 16148" this._window = new Gtk.ApplicationWindow ({\n" 16149" application: this.application,\n" 16150" title: \"Bem-vindo ao GNOME\",\n" 16151" default_height: 200,\n" 16152" default_width: 400,\n" 16153" window_position: Gtk.WindowPosition.CENTER });\n" 16154 16155#. (itstool) path: section/p 16156#: C/hellognome.js.page:146 16157msgid "" 16158"The first object we create is an ApplicationWindow. It needs a title to go " 16159"in the title bar, and its application property needs to be the application " 16160"that we created, above. Beyond that, there are various ways of customizing " 16161"how it looks, which the <link xref=\"GtkApplicationWindow.js" 16162"\">ApplicationWindow</link> reference page will go into more detail about. " 16163"As you can see here, we gave it a default height and width (measured in " 16164"pixels), and told GNOME we want our window to appear in the center of the " 16165"screen." 16166msgstr "" 16167"O primeiro objeto que nós criamos é uma ApplicationWindow. Ele precisa de um " 16168"título para a barra de título e a propriedade do seu aplicativo precisa ser " 16169"o aplicativo que nós criamos, acima. Além disso, há várias formas de " 16170"personalizar sua a aparência, o que será tratado na página de referência " 16171"<link xref=\"GtkApplicationWindow.js\">ApplicationWindow</link> em mais " 16172"detalhes. Como você pode ver aqui, nós damos a ele uma altura e largura " 16173"(medidas em pixels) e informamos ao GNOME que nós queremos que nossa janela " 16174"apareça no centro da janela." 16175 16176#. (itstool) path: section/code 16177#: C/hellognome.js.page:147 16178#, no-wrap 16179msgid "" 16180"\n" 16181" // Create a webview to show the web app\n" 16182" this._webView = new Webkit.WebView ();\n" 16183"\n" 16184" // Put the web app into the webview\n" 16185" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 16186" \"/hellognome.html\", null));\n" 16187msgstr "" 16188"\n" 16189" // Cria um webview para mostrar o aplicativo web\n" 16190" this._webView = new Webkit.WebView ();\n" 16191"\n" 16192" // Coloca o aplicativo web no webview\n" 16193" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 16194" \"/hellognome.html\", null));\n" 16195 16196#. (itstool) path: section/p 16197#: C/hellognome.js.page:155 16198msgid "" 16199"Remember how we imported Webkit right at the start? Here we're creating a " 16200"new instance of a Webkit class called a WebView, which is more or less a " 16201"browser window you can put inside of your app. After that, we then give it " 16202"the URI that we want it to load when the application starts up." 16203msgstr "" 16204"Lembra-se que nós importamos o Webkit bem no começo? Aqui nós estamos " 16205"criando uma nova instância de uma classe do Webkit chamada WebView, a qual é " 16206"mais ou menos como uma janela de navegador que nós podemos colocar as coisas " 16207"dentro do seu aplicativo. Depois disso, nós podemos, então, informar a URI " 16208"que nós queremos carregar quando o aplicativo inicia." 16209 16210#. (itstool) path: section/p 16211#: C/hellognome.js.page:156 16212msgid "" 16213"We <em>could</em> just give it a web URI, like <link href=\"http://gnome.org" 16214"\">http://gnome.org</link>. Instead, here we use a couple of GLib helper " 16215"functions to tell the WebView where our <file>hellognome.html</file> file " 16216"is. GLib.get_current_dir returns the directory that our app's running in, " 16217"and GLib.filename_to_uri turns our file's path and filename into a URI that " 16218"the WebView's load_uri function understands. (filename_to_uri's second " 16219"parameter should be null unless you know what it's used for and have a " 16220"reason for changing it.)" 16221msgstr "" 16222"Nós <em>poderíamos</em> simplesmente informar uma URI web, como <link href=" 16223"\"http://gnome.org\">http://gnome.org</link>. Em vez disso, aqui nós usamos " 16224"algumas funções de apoio do GLib para informar o WebView onde nosso arquivo " 16225"<file>hellognome.html</file> está. O GLib.get_current_dir retorna o " 16226"diretório no qual nosso aplicativo está sendo executado e GLib." 16227"filename_to_uri transforma nosso caminho e nome de arquivo em uma URI que a " 16228"função load_uri do WebView entende. (o segundo parâmetro do filename_to_uri " 16229"deveria ser nulo, a menos que você saiba para que serve e tenha um motivo " 16230"para alterá-lo.)" 16231 16232#. (itstool) path: section/code 16233#: C/hellognome.js.page:157 16234#, no-wrap 16235msgid "" 16236"\n" 16237" // Put the webview into the window\n" 16238" this._window.add (this._webView);\n" 16239"\n" 16240" // Show the window and all child widgets\n" 16241" this._window.show_all();\n" 16242" },\n" 16243"\n" 16244"});\n" 16245msgstr "" 16246"\n" 16247" // Coloca o webview na janela\n" 16248" this._window.add (this._webView);\n" 16249"\n" 16250" // Mostra a janela e todos seus widgets filhos\n" 16251" this._window.show_all();\n" 16252" },\n" 16253"\n" 16254"});\n" 16255 16256#. (itstool) path: section/p 16257#: C/hellognome.js.page:167 16258msgid "" 16259"Each window can hold one, and only one, widget. Normally, we'd use a " 16260"container widget like a <link xref=\"grid.js\">Grid</link> to put multiple " 16261"widgets into, then use the window's add function to add the Grid to it. " 16262"Here, we just need the WebView, so that's all we add to the window. After " 16263"that, as the last part of the _buildUI function that creates our window, we " 16264"tell the window to show itself and its contents." 16265msgstr "" 16266"Cada janela pode conter um, e apenas um, widget. Normalmente, nós usamos um " 16267"contêiner de widgets, como uma <link xref=\"grid.js\">Grid</link>, para " 16268"colocar múltiplos widgets dentro e, então, usar a função de adicionar da " 16269"janela para adicionar a Grid a ela. Aqui, nós precisamos apenas do WebView, " 16270"de forma que é tudo que nós adicionamentos à janela. Depois disso, como a " 16271"última parte da função _buildUI que cria nossa janela, nós informamos à " 16272"janela para se mostrar e também mostrar o seu conteúdo." 16273 16274#. (itstool) path: section/code 16275#: C/hellognome.js.page:168 16276#, no-wrap 16277msgid "" 16278"\n" 16279"// Run the application\n" 16280"let app = new HelloGNOME ();\n" 16281"app.application.run (ARGV);\n" 16282msgstr "" 16283"\n" 16284"// Executa o aplicativo\n" 16285"let app = new HelloGNOME ();\n" 16286"app.application.run (ARGV);\n" 16287 16288#. (itstool) path: section/p 16289#: C/hellognome.js.page:173 16290msgid "" 16291"Finally, we create a new instance of our HelloGNOME class, and tell GNOME to " 16292"run it." 16293msgstr "" 16294"Finalmente, nós criamos uma nova instância de nossa classe HelloGNOME e " 16295"informamos ao GNOME para executá-la." 16296 16297#. (itstool) path: section/title 16298#: C/hellognome.js.page:177 16299msgid "Running your GNOME application" 16300msgstr "Executando seu aplicativo do GNOME" 16301 16302#. (itstool) path: section/p 16303#: C/hellognome.js.page:179 16304msgid "" 16305"Now that we've created our first GNOME application, it's time to test it " 16306"out! You don't need to compile your app or install any special software for " 16307"this; GNOME has gjs built in, to let it run GNOME Shell. Just save " 16308"<file>hellognome.html</file> and our actual application, <file>hellognome." 16309"js</file>, to a directory you can get to with the terminal. (They usually " 16310"open onto your home directory, the one that's called by your username.) " 16311"After that, open a terminal, go there, and type:" 16312msgstr "" 16313"Agora que nós criamos nosso primeiro aplicativo do GNOME, é hora de testá-" 16314"lo! Você não precisa compilar o seu aplicativo ou instalar qualquer software " 16315"especial para isso; O GNOME possui gjs embutido, para permiti-lo executar o " 16316"GNOME Shell. Basta salvar o <file>hellognome.html</file> e o aplicativo, " 16317"<file>hellognome.js</file>, em um diretório que você pode obter com o " 16318"terminal. (Eles normalmente abrem na sua pasta pessoal, aquela que tem o " 16319"mesmo nome do seu usuário.) Depois disso, abra um terminal e digite:" 16320 16321#. (itstool) path: section/screen 16322#: C/hellognome.js.page:180 16323#, no-wrap 16324msgid " <output style=\"prompt\">$ </output>gjs hellognome.js " 16325msgstr " <output style=\"prompt\">$ </output>gjs hellognome.js " 16326 16327#. (itstool) path: section/p 16328#: C/hellognome.js.page:181 16329msgid "" 16330"You should see more or less the same screenshot as before, with a button " 16331"that you can click to make a short message appear." 16332msgstr "" 16333"Você deveria ver mais ou menos a mesma captura de tela de antes, com um " 16334"botão que você possa clicar para fazer uma curta mensagem aparecer." 16335 16336#. (itstool) path: note/p 16337#: C/hellognome.js.page:184 16338msgid "You can use the terminal command" 16339msgstr "Você pode usar comando de terminal" 16340 16341#. (itstool) path: note/screen 16342#: C/hellognome.js.page:185 16343#, no-wrap 16344msgid " <output style=\"prompt\">$ </output>cd <var>(directory name)</var> " 16345msgstr " <output style=\"prompt\">$ </output>cd <var>(nome do diretório)</var> " 16346 16347# Referência às ferramentas de instalação do Windows XP e do Ubuntu, respectivamente? Traduzi segundo essa linha, mantendo como se encontra a tradução hoje (inclusive no que tange aos caracteres maiúsculos) 16348#. (itstool) path: note/p 16349#: C/hellognome.js.page:186 16350msgid "" 16351"to navigate between directories inside the Terminal, in order to get to " 16352"where you saved the files. There is also an extension for Nautilus, GNOME's " 16353"file manager, which lets you right-click anywhere inside it to open a " 16354"terminal window right there. Check the app you use to install new software " 16355"(like Add/Remove Programs or the Software Center) for it." 16356msgstr "" 16357"para navegar entre diretórios dentro do Terminal, para chegar onde você " 16358"salvou o arquivo. Há também uma extensão para o Nautilus, o gerenciador de " 16359"arquivos do GNOME, que permite que você clique com botão direito do mouse em " 16360"qualquer lugar nele para abrir uma janela de terminal ali mesmo. Verifique " 16361"no aplicativo que você usa para instalar novos softwares (tipo Adicionar ou " 16362"Remover Programas ou Central de Programas) pela extensão." 16363 16364#. (itstool) path: section/p 16365#: C/hellognome.js.page:193 16366msgid "" 16367"<link xref=\"02_welcome_to_the_grid.js\">Continue on to the next tutorial</" 16368"link> to learn how to build \"native\" GNOME applications that look and feel " 16369"like the others, instead of a webview with HTML code inside. Or take a look " 16370"at some <link xref=\"beginner.js#samples\">code samples</link>, if you'd " 16371"like to see example code for each Gtk widget." 16372msgstr "" 16373"<link xref=\"02_welcome_to_the_grid.js\">Continue com o próximo tutorial</" 16374"link> para aprender a criar aplicativos “nativos” do GNOME que se parecem " 16375"com os outros, em vez de um webview com código HTML inserido. Ou veja " 16376"algumas <link xref=\"beginner.js#samples\">amostras de código</link>, se " 16377"você gostaria de ver um código exemplo para widget Gtk." 16378 16379#. (itstool) path: section/p 16380#: C/hellognome.js.page:194 16381msgid "" 16382"Finally, if you want to just build GNOME applications using JavaScript " 16383"libraries designed for the web, you can basically stop here and go do that! " 16384"Check out <link xref=\"beginner.js#tutorials\">the later tutorials</link> if " 16385"you'd like to see how to create a .desktop file for your application, which " 16386"will let it appear in your desktop's Activities menu with all your other " 16387"apps." 16388msgstr "" 16389"Finalmente, se você deseja apenas construir aplicativos do GNOME usando " 16390"bibliotecas do JavaScript projetadas para web, você pode basicamente parar " 16391"aqui e fazer mais nada! Veja <link xref=\"beginner.js#tutorials\">os últimos " 16392"tutoriais</link>, se você gostaria de ver como criar um arquivo .desktop " 16393"para seu aplicativo, o que vai permiti-lo aparecer no seu menu de Atividades " 16394"do seu computador com todos os seus outros aplicativos." 16395 16396#. (itstool) path: section/code 16397#: C/hellognome.js.page:199 16398#, fuzzy, no-wrap 16399#| msgid "" 16400#| "#!/usr/bin/gjs\n" 16401#| "\n" 16402#| "const GLib = imports.gi.GLib;\n" 16403#| "const Gtk = imports.gi.Gtk;\n" 16404#| "const Lang = imports.lang;\n" 16405#| "const Webkit = imports.gi.WebKit;\n" 16406#| "\n" 16407#| "const HelloGNOME = new Lang.Class ({\n" 16408#| " Name: 'Hello GNOME',\n" 16409#| "\n" 16410#| " // Create the application itself\n" 16411#| " _init: function () {\n" 16412#| " this.application = new Gtk.Application ();\n" 16413#| "\n" 16414#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 16415#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 16416#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 16417#| " },\n" 16418#| "\n" 16419#| " // Callback function for 'activate' signal presents windows when active\n" 16420#| " _onActivate: function () {\n" 16421#| " this._window.present ();\n" 16422#| " },\n" 16423#| "\n" 16424#| " // Callback function for 'startup' signal builds the UI\n" 16425#| " _onStartup: function () {\n" 16426#| " this._buildUI ();\n" 16427#| " },\n" 16428#| "\n" 16429#| " // Build the application's UI\n" 16430#| " _buildUI: function () {\n" 16431#| "\n" 16432#| " // Create the application window\n" 16433#| " this._window = new Gtk.ApplicationWindow ({\n" 16434#| " application: this.application,\n" 16435#| " title: \"Welcome to GNOME\",\n" 16436#| " default_height: 200,\n" 16437#| " default_width: 400,\n" 16438#| " window_position: Gtk.WindowPosition.CENTER });\n" 16439#| "\n" 16440#| " // Create a webview to show the web app\n" 16441#| " this._webView = new Webkit.WebView ();\n" 16442#| "\n" 16443#| " // Put the web app into the webview\n" 16444#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 16445#| " \"/hellognome.html\", null));\n" 16446#| "\n" 16447#| " // Put the webview into the window\n" 16448#| " this._window.add (this._webView);\n" 16449#| "\n" 16450#| " // Show the window and all child widgets\n" 16451#| " this._window.show_all();\n" 16452#| " },\n" 16453#| "\n" 16454#| "});\n" 16455#| "\n" 16456#| "// Run the application\n" 16457#| "let app = new HelloGNOME ();\n" 16458#| "app.application.run (ARGV);\n" 16459msgid "" 16460"#!/usr/bin/gjs\n" 16461"\n" 16462"imports.gi.versions.Gtk = '3.0';\n" 16463"imports.gi.versions.WebKit2 = '4.0';\n" 16464"\n" 16465"const GLib = imports.gi.GLib;\n" 16466"const Gtk = imports.gi.Gtk;\n" 16467"const Webkit = imports.gi.WebKit2;\n" 16468"\n" 16469"class HelloGNOME {\n" 16470"\n" 16471" // Create the application itself\n" 16472" constructor() {\n" 16473" this.application = new Gtk.Application ();\n" 16474"\n" 16475" // Connect 'activate' and 'startup' signals to the callback functions\n" 16476" this.application.connect('activate', this._onActivate.bind(this));\n" 16477" this.application.connect('startup', this._onStartup.bind(this));\n" 16478" }\n" 16479"\n" 16480" // Callback function for 'activate' signal presents windows when active\n" 16481" _onActivate() {\n" 16482" this._window.present();\n" 16483" }\n" 16484"\n" 16485" // Callback function for 'startup' signal builds the UI\n" 16486" _onStartup() {\n" 16487" this._buildUI();\n" 16488" }\n" 16489"\n" 16490" // Build the application's UI\n" 16491" _buildUI() {\n" 16492"\n" 16493" // Create the application window\n" 16494" this._window = new Gtk.ApplicationWindow ({\n" 16495" application: this.application,\n" 16496" title: \"Welcome to GNOME\",\n" 16497" default_height: 200,\n" 16498" default_width: 400,\n" 16499" window_position: Gtk.WindowPosition.CENTER });\n" 16500"\n" 16501" // Create a webview to show the web app\n" 16502" this._webView = new Webkit.WebView ();\n" 16503"\n" 16504" // Put the web app into the webview\n" 16505" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 16506" \"/hellognome.html\", null));\n" 16507"\n" 16508" // Put the webview into the window\n" 16509" this._window.add (this._webView);\n" 16510"\n" 16511" // Show the window and all child widgets\n" 16512" this._window.show_all();\n" 16513" }\n" 16514"\n" 16515"};\n" 16516"\n" 16517"// Run the application\n" 16518"let app = new HelloGNOME ();\n" 16519"app.application.run (ARGV);\n" 16520msgstr "" 16521"#!/usr/bin/gjs\n" 16522"\n" 16523"const GLib = imports.gi.GLib;\n" 16524"const Gtk = imports.gi.Gtk;\n" 16525"const Lang = imports.lang;\n" 16526"const Webkit = imports.gi.WebKit;\n" 16527"\n" 16528"const HelloGNOME = new Lang.Class ({\n" 16529" Name: 'Olá, GNOME',\n" 16530"\n" 16531" // Cria o aplicativo em si\n" 16532" _init: function () {\n" 16533" this.application = new Gtk.Application ();\n" 16534"\n" 16535" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 16536" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 16537" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 16538" },\n" 16539"\n" 16540" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 16541" _onActivate: function () {\n" 16542" this._window.present ();\n" 16543" },\n" 16544"\n" 16545" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 16546" _onStartup: function () {\n" 16547" this._buildUI ();\n" 16548" },\n" 16549"\n" 16550" // Constrói a interface gráfica do aplicativo\n" 16551" _buildUI: function () {\n" 16552"\n" 16553" // Cria a janela do aplicativo\n" 16554" this._window = new Gtk.ApplicationWindow ({\n" 16555" application: this.application,\n" 16556" title: \"Bem-vindo ao GNOME\",\n" 16557" default_height: 200,\n" 16558" default_width: 400,\n" 16559" window_position: Gtk.WindowPosition.CENTER });\n" 16560"\n" 16561" // Cria um webview para mostrar o aplicativo web\n" 16562" this._webView = new Webkit.WebView ();\n" 16563"\n" 16564" // Coloca o aplicativo web no webview\n" 16565" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 16566" \"/hellognome.html\", null));\n" 16567"\n" 16568" // Coloca o webview na janela\n" 16569" this._window.add (this._webView);\n" 16570"\n" 16571" // Mostra a janela e todos seus widgets filhos\n" 16572" this._window.show_all();\n" 16573" },\n" 16574"\n" 16575"});\n" 16576"\n" 16577"// Executa o aplicativo\n" 16578"let app = new HelloGNOME ();\n" 16579"app.application.run (ARGV);\n" 16580 16581#. (itstool) path: info/title 16582#: C/hello-world.c.page:10 16583#, fuzzy 16584msgctxt "link" 16585msgid "Hello World (C)" 16586msgstr "Olá, mundo!" 16587 16588#. (itstool) path: credit/name 16589#: C/hello-world.c.page:24 16590msgid "Bastian Ilsø" 16591msgstr "" 16592 16593#. (itstool) path: info/desc 16594#: C/hello-world.c.page:28 16595msgid "Creating a small \"Hello, World\" application using GTK+." 16596msgstr "" 16597 16598#. (itstool) path: page/title 16599#: C/hello-world.c.page:31 16600#, fuzzy 16601msgid "Hello world" 16602msgstr "Olá mundo!" 16603 16604#. (itstool) path: note/p 16605#: C/hello-world.c.page:34 16606msgid "" 16607"For a detailed walk-through of creating a GTK+ dialog in C, see <link href=" 16608"\"https://developer.gnome.org/gtk3/stable/gtk-getting-started.html\">Getting " 16609"Started with GTK+</link>" 16610msgstr "" 16611 16612#. (itstool) path: page/p 16613#: C/hello-world.c.page:38 16614msgid "" 16615"Writing a hello world GTK+ dialog in C can be done as seen in the code " 16616"sample below:" 16617msgstr "" 16618 16619#. (itstool) path: page/code 16620#: C/hello-world.c.page:39 16621#, no-wrap 16622msgid "" 16623"\n" 16624" #include <gtk/gtk.h>\n" 16625"\n" 16626"static void\n" 16627"activate (GtkApplication* app,\n" 16628" gpointer user_data)\n" 16629"{\n" 16630" GtkWidget *window;\n" 16631" GtkWidget *label;\n" 16632"\n" 16633" window = gtk_application_window_new (app);\n" 16634" label = gtk_label_new (\"Hello GNOME!\");\n" 16635" gtk_container_add (GTK_CONTAINER (window), label);\n" 16636" gtk_window_set_title (GTK_WINDOW (window), \"Welcome to GNOME\");\n" 16637" gtk_window_set_default_size (GTK_WINDOW (window), 200, 100);\n" 16638" gtk_widget_show_all (window);\n" 16639"}\n" 16640"\n" 16641"int\n" 16642"main (int argc,\n" 16643" char **argv)\n" 16644"{\n" 16645" GtkApplication *app;\n" 16646" int status;\n" 16647"\n" 16648" app = gtk_application_new (NULL, G_APPLICATION_FLAGS_NONE);\n" 16649" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 16650" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 16651" g_object_unref (app);\n" 16652"\n" 16653" return status;\n" 16654"}\n" 16655"\n" 16656" " 16657msgstr "" 16658 16659#. (itstool) path: page/p 16660#: C/hello-world.c.page:43 16661msgid "" 16662"GtkApplication initializes GTK+. It also connects the <gui>x</gui> button " 16663"that's automatically generated along with the window to the \"destroy\" " 16664"signal. We can start building our first window. We do this by creating a " 16665"variable called <var>window</var> and assigning it a " 16666"gtk_application_window_new. The window title can be any string you want it " 16667"to be. To be on the safe side, it's best to stick to UTF-8 encoding. The " 16668"code above will create a dialog window similar to what can be seen below:" 16669msgstr "" 16670 16671#. (itstool) path: page/media 16672#. This is a reference to an external file such as an image or video. When 16673#. the file changes, the md5 hash will change to let you know you need to 16674#. update your localized copy. The msgstr is not used at all. Set it to 16675#. whatever you like once you have updated your copy of the file. 16676#: C/hello-world.c.page:51 C/hello-world.js.page:28 C/hello-world.py.page:28 16677#: C/hello-world.vala.page:28 16678msgctxt "_" 16679msgid "" 16680"external ref='media/hello-world.png' md5='4c88a27211dfd1b33e504c9f78602f2d'" 16681msgstr "" 16682 16683#. (itstool) path: info/title 16684#: C/hello-world.js.page:9 16685#, fuzzy 16686msgctxt "text" 16687msgid "Hello World (JavaScript)" 16688msgstr "Hello World (JavaScript)" 16689 16690#. (itstool) path: info/desc 16691#: C/hello-world.js.page:24 C/hello-world.py.page:24 C/hello-world.vala.page:24 16692#, fuzzy 16693msgid "A basic \"hello, world\" application" 16694msgstr "Olá mundo em <application>gtkmm</application>" 16695 16696#. (itstool) path: page/title 16697#: C/hello-world.js.page:27 C/hello-world.py.page:27 C/hello-world.vala.page:27 16698msgid "" 16699"How to build, install and create a <file>tar.xz</file> of a Hello World " 16700"program" 16701msgstr "" 16702 16703#. (itstool) path: synopsis/p 16704#: C/hello-world.js.page:30 C/hello-world.py.page:30 C/hello-world.vala.page:30 16705#, fuzzy 16706msgid "This tutorial will demonstrate how to:" 16707msgstr "Tutorial: como desenhar linhas retas" 16708 16709#. (itstool) path: item/p 16710#: C/hello-world.js.page:32 16711msgid "create a small \"Hello, World\" application using JavaScript and GTK+" 16712msgstr "" 16713 16714#. (itstool) path: item/p 16715#: C/hello-world.js.page:33 C/hello-world.py.page:33 C/hello-world.vala.page:33 16716#, fuzzy 16717msgid "make the <file>.desktop</file> file" 16718msgstr "Seu diretório de <file>Área de trabalho</file>" 16719 16720#. (itstool) path: item/p 16721#: C/hello-world.js.page:34 C/hello-world.py.page:34 C/hello-world.vala.page:34 16722#, fuzzy 16723msgid "how to set up the build system" 16724msgstr "Configurando seu sistema de compilação" 16725 16726#. (itstool) path: section/title 16727#: C/hello-world.js.page:42 C/hello-world.py.page:42 C/hello-world.vala.page:40 16728#, fuzzy 16729msgid "Create the program" 16730msgstr "Cria a aba de um novo programa" 16731 16732#. (itstool) path: section/p 16733#: C/hello-world.js.page:47 16734#, fuzzy 16735msgid "This needs to be the first line of your script:" 16736msgstr "Seu primeiro Script de Script-Fu" 16737 16738#. (itstool) path: section/code 16739#: C/hello-world.js.page:48 16740#, fuzzy, no-wrap 16741msgid "#!/usr/bin/gjs" 16742msgstr "" 16743"\n" 16744"#!/usr/bin/gjs\n" 16745 16746#. (itstool) path: section/p 16747#: C/hello-world.js.page:49 16748msgid "" 16749"It tells the script to use <link href=\"https://live.gnome.org/Gjs/\">Gjs</" 16750"link>. Gjs is a JavaScript binding for GNOME." 16751msgstr "" 16752 16753#. (itstool) path: section/code 16754#: C/hello-world.js.page:54 16755#, no-wrap 16756msgid "" 16757"const Lang = imports.lang;\n" 16758"const Gtk = imports.gi.Gtk;" 16759msgstr "" 16760 16761#. (itstool) path: section/p 16762#: C/hello-world.js.page:56 C/hello-world.py.page:49 16763msgid "" 16764"In order for our script to work with GNOME, we need to import GNOME " 16765"libraries via GObject Introspection. Here we import the language bindings " 16766"and GTK+, the library which contains the graphical widgets used to make " 16767"GNOME applications." 16768msgstr "" 16769 16770#. (itstool) path: section/code 16771#: C/hello-world.js.page:60 16772#, no-wrap 16773msgid "" 16774"const Application = new Lang.Class({\n" 16775" //A Class requires an explicit Name parameter. This is the Class Name.\n" 16776" Name: 'Application',\n" 16777"\n" 16778" //create the application\n" 16779" _init: function() {\n" 16780" this.application = new Gtk.Application();\n" 16781"\n" 16782" //connect to 'activate' and 'startup' signals to handlers.\n" 16783" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 16784" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 16785" },\n" 16786"\n" 16787" //create the UI\n" 16788" _buildUI: function() {\n" 16789" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 16790" title: \"Hello World!\" });\n" 16791" },\n" 16792"\n" 16793" //handler for 'activate' signal\n" 16794" _onActivate: function() {\n" 16795" //show the window and all child widgets\n" 16796" this._window.show_all();\n" 16797" },\n" 16798"\n" 16799" //handler for 'startup' signal\n" 16800" _onStartup: function() {\n" 16801" this._buildUI();\n" 16802" }\n" 16803"});\n" 16804msgstr "" 16805 16806#. (itstool) path: section/p 16807#: C/hello-world.js.page:92 16808msgid "" 16809"GtkApplication initializes GTK+. It also connects the <gui>x</gui> button " 16810"that's automatically generated along with the window to the \"destroy\" " 16811"signal." 16812msgstr "" 16813 16814#. (itstool) path: section/p 16815#: C/hello-world.js.page:93 16816msgid "" 16817"We can start building our first window. We do this by creating a variable " 16818"called <var>_window</var> and assigning it a new Gtk.ApplicationWindow." 16819msgstr "" 16820 16821#. (itstool) path: section/p 16822#: C/hello-world.js.page:94 C/hello-world.py.page:73 16823msgid "" 16824"We give the window a property called <var>title</var>. The title can be any " 16825"string you want it to be. To be on the safe side, it's best to stick to " 16826"UTF-8 encoding." 16827msgstr "" 16828 16829#. (itstool) path: section/p 16830#: C/hello-world.js.page:95 C/hello-world.py.page:74 C/hello-world.vala.page:57 16831msgid "" 16832"Now we have a window which has a title and a working \"close\" button. Let's " 16833"add the actual \"Hello World\" text." 16834msgstr "" 16835 16836#. (itstool) path: section/title 16837#: C/hello-world.js.page:98 C/hello-world.py.page:77 C/hello-world.vala.page:60 16838#, fuzzy 16839msgid "Label for the window" 16840msgstr " rótulo: ~a~%" 16841 16842#. (itstool) path: section/code 16843#: C/hello-world.js.page:99 16844#, no-wrap 16845msgid "" 16846"// Add a label widget to your window\n" 16847"this.label = new Gtk.Label({ label: \"Hello World\" });\n" 16848"this._window.add(this.label);\n" 16849"this._window.set_default_size(200, 200);" 16850msgstr "" 16851 16852#. (itstool) path: section/p 16853#: C/hello-world.js.page:104 16854msgid "" 16855"A text label is one of the GTK+ widgets we can use, on account of having " 16856"imported the GTK+ library. To use it, we create a new variable called label, " 16857"and assign it a new Gtk.Label. Then we give it properties inside the curly " 16858"braces {}. In this case, we're setting the text that the label will hold. " 16859"Finally, we create and run the application:" 16860msgstr "" 16861 16862#. (itstool) path: section/code 16863#: C/hello-world.js.page:106 16864#, fuzzy, no-wrap 16865msgid "" 16866"//run the application\n" 16867"let app = new Application();\n" 16868"app.application.run(ARGV);" 16869msgstr "" 16870"\n" 16871"// Executa o aplicativo\n" 16872"let app = new HelloGNOME ();\n" 16873"app.application.run (ARGV);\n" 16874 16875#. (itstool) path: section/p 16876#: C/hello-world.js.page:110 C/hello-world.py.page:97 16877#: C/hello-world.vala.page:71 16878msgid "" 16879"Gtk.ApplicationWindow can only hold one widget at a time. To construct more " 16880"elaborate programs you need to create a holder widget like Gtk.Grid inside " 16881"the window, and then add all the other widgets to it." 16882msgstr "" 16883 16884#. (itstool) path: section/title 16885#: C/hello-world.js.page:114 16886#, fuzzy 16887msgid "hello-world.js" 16888msgstr "Olá," 16889 16890#. (itstool) path: section/p 16891#: C/hello-world.js.page:115 C/hello-world.py.page:102 16892#: C/hello-world.vala.page:76 16893#, fuzzy 16894msgid "The complete file:" 16895msgstr "" 16896"Avalia expressão condicional.\n" 16897" \n" 16898" Sai com um status de 0 (verdadeiro) ou 1 (falso) dependendo da " 16899"avaliação\n" 16900" de EXPR. As expressões podem ser unárias ou binárias. Expressões " 16901"unárias\n" 16902" são normalmente usadas para examinar o status de um arquivo. Há\n" 16903" operadores de strings e também há operadores de comparação numérica.\n" 16904" \n" 16905" O comportamento do teste depende do número de argumentos. Leia a página\n" 16906" de manual do `bash' para a especificação completa.\n" 16907" \n" 16908" Operadores de arquivos:\n" 16909" \n" 16910" -a ARQUIVO Verdadeiro, se arquivo existir.\n" 16911" -b ARQUIVO Verdadeiro, se arquivo for um bloco especial.\n" 16912" -c ARQUIVO Verdadeiro, se arquivo for um caractere especial.\n" 16913" -d ARQUIVO Verdadeiro, se arquivo for um diretório.\n" 16914" -e ARQUIVO Verdadeiro, se arquivo existir.\n" 16915" -f ARQUIVO Verdadeiro, se arquivo existir e for um arquivo " 16916"normal.\n" 16917" -g ARQUIVO Verdadeiro, se arquivo for set-group-id.\n" 16918" -h ARQUIVO Verdadeiro, se arquivo for um link simbólico.\n" 16919" -L ARQUIVO Verdadeiro, se arquivo for um link simbólico.\n" 16920" -k ARQUIVO Verdadeiro, se arquivo tiver o bit `sticky' definido.\n" 16921" -p ARQUIVO Verdadeiro, se arquivo for um `pipe' dado.\n" 16922" -r ARQUIVO Verdadeiro, se arquivo for um legível por você.\n" 16923" -s ARQUIVO Verdadeiro, se arquivo existir e não estiver vazio.\n" 16924" -S ARQUIVO Verdadeiro, se arquivo for um socket.\n" 16925" -t FD Verdadeiro, se FD estiver aberto em um terminal.\n" 16926" -u ARQUIVO Verdadeiro, se arquivo estiver com set-user-id.\n" 16927" -w ARQUIVO Verdadeiro, se arquivo puder ser escrito por você.\n" 16928" -x ARQUIVO Verdadeiro, se arquivo puder ser executado por você.\n" 16929" -O ARQUIVO Verdadeiro, se arquivo efetivamente for seu (owned).\n" 16930" -G ARQUIVO Verdadeiro, se arquivo efetivamente for do seu grupo.\n" 16931" -N ARQUIVO Verdadeiro, se arquivo foi modificado desde a última\n" 16932" leitura.\n" 16933" \n" 16934" ARQ1 -nt ARQ2 Verdadeiro se ARQ1 for mais novo que ARQ2, conforme\n" 16935" última data de modificação.\n" 16936" \n" 16937" ARQ1 -ot ARQ2 Verdadeiro, se ARQ1 for mais velho que ARQ2.\n" 16938" \n" 16939" ARQ1 -ef ARQ2 Verdadeiro, se ARQ1 for um link rígido para ARQ2.\n" 16940" \n" 16941" Operadores de string:\n" 16942" \n" 16943" -z STRING Verdadeiro, se string estiver vazia.\n" 16944" \n" 16945" -n STRING\n" 16946" STRING Verdadeiro, se string não estiver vazia.\n" 16947" \n" 16948" STRING1 = STRING2\n" 16949" Verdadeiro, se strings forem iguais.\n" 16950" STRING1 != STRING2\n" 16951" Verdadeiro, se strings não forem iguais.\n" 16952" STRING1 < STRING2\n" 16953" Verdadeiro, se STRING1 estiver antes de STRING2, de\n" 16954" acordo com a ordem alfabética.\n" 16955" STRING1 > STRING2\n" 16956" Verdadeiro, se STRING1 estiver depois de STRING2, de\n" 16957" acordo com a ordem alfabética.\n" 16958" \n" 16959" Outros operadores:\n" 16960" \n" 16961" -o OPÇÃO Verdadeiro, se a opção shell OPÇÃO estiver habilitada.\n" 16962" -v VAR Verdadeiro, se a variável shell VAR estiver definida.\n" 16963" -R VAR Verdadeiro, se a variável shell VAR estiver definida\n" 16964" e for uma referência de nome.\n" 16965" ! EXPR Verdadeiro, se a expressão EXPR for falsa.\n" 16966" EXPR1 -a EXPR2 Verdadeiro, se ambas EXPR1 e EXPR2 forem verdadeiras.\n" 16967" EXPR1 -o EXPR2 Verdadeiro, se ao menos uma das expressões for " 16968"verdadeira.\n" 16969" \n" 16970" arg1 OP arg2 Testes aritméticos. OP é um dentre -eq, -ne, -lt, -" 16971"le,\n" 16972" -gt, or -ge.\n" 16973" \n" 16974" Operadores binários de aritmética retornam verdadeiro se ARG1 for " 16975"igual,\n" 16976" não-igual, menor-que, menor-ou-igual-a ou maior-ou-igual-a ARG2.\n" 16977" \n" 16978" Status de saída:\n" 16979" Retorna sucesso, se EXPR for avaliada como verdadeira; falha, se EXPR " 16980"for\n" 16981" avaliada como falsa ou um argumento inválido for informado." 16982 16983#. (itstool) path: section/code 16984#: C/hello-world.js.page:116 16985#, no-wrap 16986msgid "" 16987"#!/usr/bin/gjs\n" 16988"\n" 16989"imports.gi.versions.Gtk = '3.0'\n" 16990"const Gtk = imports.gi.Gtk;\n" 16991"\n" 16992"class Application {\n" 16993"\n" 16994" //create the application\n" 16995" constructor() {\n" 16996" this.application = new Gtk.Application();\n" 16997"\n" 16998" //connect to 'activate' and 'startup' signals to handlers.\n" 16999" this.application.connect('activate', this._onActivate.bind(this));\n" 17000" this.application.connect('startup', this._onStartup.bind(this));\n" 17001" }\n" 17002"\n" 17003" //create the UI\n" 17004" _buildUI() {\n" 17005" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 17006" title: \"Hello World!\" });\n" 17007" this._window.set_default_size(200, 200);\n" 17008" this.label = new Gtk.Label({ label: \"Hello World\" });\n" 17009" this._window.add(this.label);\n" 17010" }\n" 17011"\n" 17012" //handler for 'activate' signal\n" 17013" _onActivate() {\n" 17014" //show the window and all child widgets\n" 17015" this._window.show_all();\n" 17016" }\n" 17017"\n" 17018" //handler for 'startup' signal\n" 17019" _onStartup() {\n" 17020" this._buildUI();\n" 17021" }\n" 17022"};\n" 17023"\n" 17024"//run the application\n" 17025"let app = new Application();\n" 17026"app.application.run(ARGV);\n" 17027msgstr "" 17028 17029#. (itstool) path: section/title 17030#: C/hello-world.js.page:119 C/hello-world.py.page:106 17031#: C/hello-world.vala.page:80 17032#, fuzzy 17033msgid "Running the application from terminal" 17034msgstr "Aplicativo no terminal" 17035 17036#. (itstool) path: section/p 17037#: C/hello-world.js.page:120 17038msgid "" 17039"To run this application, first save it as hello-world.js. Then open " 17040"Terminal, go to the folder where your application is stored and run:" 17041msgstr "" 17042 17043#. (itstool) path: section/screen 17044#: C/hello-world.js.page:121 17045#, no-wrap 17046msgid "<output style=\"prompt\">$ </output><input>gjs hello-world.js</input>" 17047msgstr "" 17048 17049#. (itstool) path: section/title 17050#: C/hello-world.js.page:127 C/hello-world.py.page:112 17051#: C/hello-world.vala.page:89 17052msgid "The <file>.desktop.in</file> file" 17053msgstr "" 17054 17055#. (itstool) path: section/p 17056#: C/hello-world.js.page:128 C/hello-world.py.page:113 17057#: C/hello-world.vala.page:90 17058msgid "" 17059"Running applications from the Terminal is useful at the beginning of the " 17060"application making process. To have fully working <link href=\"https://" 17061"developer.gnome.org/integration-guide/stable/mime.html.en\">application " 17062"integration</link> in GNOME 3 requires a desktop launcher. For this you need " 17063"to create a <file>.desktop</file> file. The <file>.desktop</file> file " 17064"describes the application name, the used icon and various integration bits. " 17065"A deeper insight into the <file>.desktop</file> file can be found <link href=" 17066"\"http://developer.gnome.org/desktop-entry-spec/\">here</link>. The <file>." 17067"desktop.in</file> file will create the <file>.desktop</file>." 17068msgstr "" 17069 17070#. (itstool) path: note/p 17071#: C/hello-world.js.page:131 17072msgid "" 17073"Before continuing, resave <file>hello-world.js</file> as <file>hello-world</" 17074"file>. Then run this in the command line:" 17075msgstr "" 17076 17077#. (itstool) path: note/screen 17078#: C/hello-world.js.page:132 17079#, no-wrap 17080msgid "<output style=\"prompt\">$ </output><input>chmod +x hello-world</input>" 17081msgstr "" 17082 17083#. (itstool) path: section/p 17084#: C/hello-world.js.page:135 C/hello-world.py.page:115 17085#: C/hello-world.vala.page:92 17086msgid "" 17087"The example shows you the minimum requirements for a <code>.desktop.in</" 17088"code> file." 17089msgstr "" 17090 17091#. (itstool) path: section/code 17092#: C/hello-world.js.page:136 C/hello-world.py.page:116 17093#: C/hello-world.vala.page:93 17094#, no-wrap 17095msgid "" 17096"[Desktop Entry]\n" 17097"Version=1.0\n" 17098"Encoding=UTF-8\n" 17099"Name=Hello World\n" 17100"Comment=Say Hello\n" 17101"Exec=@prefix@/bin/hello-world\n" 17102"Icon=application-default-icon\n" 17103"Terminal=false\n" 17104"Type=Application\n" 17105"StartupNotify=true\n" 17106"Categories=GNOME;GTK;Utility;\n" 17107msgstr "" 17108 17109#. (itstool) path: section/p 17110#: C/hello-world.js.page:138 C/hello-world.py.page:118 17111#: C/hello-world.vala.page:95 17112msgid "Now let's go through some parts of the <code>.desktop.in</code> file." 17113msgstr "" 17114 17115#. (itstool) path: item/title 17116#. (itstool) path: td/p 17117#: C/hello-world.js.page:140 C/hello-world.py.page:120 17118#: C/hello-world.vala.page:97 C/toolbar_builder.py.page:95 17119#: C/toolbar_builder.vala.page:78 17120#, fuzzy 17121msgid "Name" 17122msgstr "nome" 17123 17124#. (itstool) path: item/p 17125#: C/hello-world.js.page:140 C/hello-world.py.page:120 17126#: C/hello-world.vala.page:97 17127#, fuzzy 17128msgid "The application name." 17129msgstr "nome do aplicativo" 17130 17131#. (itstool) path: item/title 17132#: C/hello-world.js.page:141 C/hello-world.py.page:121 17133#: C/hello-world.vala.page:98 17134#, fuzzy 17135msgid "Comment" 17136msgstr "Comentário" 17137 17138#. (itstool) path: item/p 17139#: C/hello-world.js.page:141 C/hello-world.py.page:121 17140#: C/hello-world.vala.page:98 17141#, fuzzy 17142msgid "A short description of the application." 17143msgstr "" 17144"\n" 17145"/**\n" 17146" * SECTION:meepapp\n" 17147" * @short_description: A classe do aplicativo\n" 17148" * @title: Aplicativo Meep\n" 17149" * @section_id:\n" 17150" * @see_also: #MeepSettings\n" 17151" * @stability: Estável\n" 17152" * @include: meep/app.h\n" 17153" * @image: aplicativo.png\n" 17154" *\n" 17155" * A classe do aplicativo cuida de ...\n" 17156" */\n" 17157 17158#. (itstool) path: item/title 17159#: C/hello-world.js.page:142 C/hello-world.py.page:122 17160#: C/hello-world.vala.page:99 17161msgid "Exec" 17162msgstr "Exec" 17163 17164#. (itstool) path: item/p 17165#: C/hello-world.js.page:142 C/hello-world.py.page:122 17166#: C/hello-world.vala.page:99 17167msgid "" 17168"Specifies a command to execute when you choose the application from the " 17169"menu. In this example exec just tells where to find the <file>hello-world</" 17170"file> file and the file takes care of the rest." 17171msgstr "" 17172 17173#. (itstool) path: item/title 17174#: C/hello-world.js.page:143 C/hello-world.py.page:123 17175#: C/hello-world.vala.page:100 17176#, fuzzy 17177msgid "Terminal" 17178msgstr "Terminal" 17179 17180#. (itstool) path: item/p 17181#: C/hello-world.js.page:143 C/hello-world.py.page:123 17182#: C/hello-world.vala.page:100 17183msgid "" 17184"Specifies whether the command in the Exec key runs in a terminal window." 17185msgstr "" 17186 17187#. (itstool) path: section/p 17188#: C/hello-world.js.page:146 C/hello-world.py.page:126 17189#: C/hello-world.vala.page:103 17190msgid "" 17191"To put your application into the appropriate category, you need to add the " 17192"necessary categories to the Categories line. More information on the " 17193"different categories can be found in the <link href=\"http://standards." 17194"freedesktop.org/menu-spec/latest/apa.html\">menu specification</link>." 17195msgstr "" 17196 17197#. (itstool) path: section/p 17198#: C/hello-world.js.page:147 C/hello-world.py.page:127 17199#: C/hello-world.vala.page:104 17200msgid "" 17201"In this example we use an existing icon. For a custom icon you need to have " 17202"a .svg file of your icon, stored in <file>/usr/share/icons/hicolor/scalable/" 17203"apps</file>. Write the name of your icon file to the .desktop.in file, on " 17204"line 7. More information on icons in: <link href=\"https://live.gnome.org/" 17205"GnomeGoals/AppIcon\">Installing Icons for Themes</link> and <link href=" 17206"\"http://freedesktop.org/wiki/Specifications/icon-theme-spec\">on " 17207"freedesktop.org: Specifications/icon-theme-spec</link>." 17208msgstr "" 17209 17210#. (itstool) path: section/title 17211#: C/hello-world.js.page:150 C/hello-world.py.page:130 17212#: C/hello-world.vala.page:107 17213#, fuzzy 17214msgid "The build system" 17215msgstr "Sistema de compilação" 17216 17217#. (itstool) path: section/p 17218#: C/hello-world.js.page:151 C/hello-world.py.page:131 17219#: C/hello-world.vala.page:108 17220msgid "" 17221"To make your application truly a part of the GNOME 3 system you need to " 17222"install it with the help of autotools. The autotools build will install all " 17223"the necessary files to all the right places." 17224msgstr "" 17225 17226#. (itstool) path: section/p 17227#: C/hello-world.js.page:152 C/hello-world.py.page:132 17228#: C/hello-world.vala.page:109 17229#, fuzzy 17230msgid "For this you need to have the following files:" 17231msgstr "Você precisará das seguintes informações:" 17232 17233#. (itstool) path: section/title 17234#. (itstool) path: item/p 17235#. (itstool) path: section/p 17236#: C/hello-world.js.page:155 C/hello-world.py.page:135 17237#: C/hello-world.vala.page:112 C/weatherAutotools.js.page:40 17238#: C/weatherAutotools.js.page:138 17239#, fuzzy 17240msgid "autogen.sh" 17241msgstr "" 17242"\n" 17243"./autogen.sh --enable-gtk-doc\n" 17244"make\n" 17245 17246#. (itstool) path: section/code 17247#: C/hello-world.js.page:156 C/hello-world.py.page:136 17248#: C/hello-world.vala.page:113 17249#, no-wrap 17250msgid "" 17251"#!/bin/sh\n" 17252"\n" 17253"set -e\n" 17254"\n" 17255"test -n \"$srcdir\" || srcdir=`dirname \"$0\"`\n" 17256"test -n \"$srcdir\" || srcdir=.\n" 17257"\n" 17258"olddir=`pwd`\n" 17259"cd \"$srcdir\"\n" 17260"\n" 17261"# This will run autoconf, automake, etc. for us\n" 17262"autoreconf --force --install\n" 17263"\n" 17264"cd \"$olddir\"\n" 17265"\n" 17266"if test -z \"$NOCONFIGURE\"; then\n" 17267" \"$srcdir\"/configure \"$@\"\n" 17268"fi\n" 17269msgstr "" 17270 17271#. (itstool) path: section/p 17272#: C/hello-world.js.page:158 C/hello-world.py.page:138 17273#: C/hello-world.vala.page:115 17274msgid "After the <file>autogen.sh</file> file is ready and saved, run:" 17275msgstr "" 17276 17277#. (itstool) path: section/screen 17278#: C/hello-world.js.page:159 C/hello-world.py.page:139 17279#: C/hello-world.vala.page:116 17280#, no-wrap 17281msgid "<output style=\"prompt\">$ </output><input>chmod +x autogen.sh</input>" 17282msgstr "" 17283 17284#. (itstool) path: section/title 17285#. (itstool) path: item/p 17286#. (itstool) path: section/p 17287#: C/hello-world.js.page:163 C/hello-world.py.page:143 17288#: C/hello-world.vala.page:120 C/weatherAutotools.js.page:38 17289#: C/weatherAutotools.js.page:64 17290#, fuzzy 17291msgid "Makefile.am" 17292msgstr "Arquivos Makefile.am" 17293 17294#. (itstool) path: section/code 17295#: C/hello-world.js.page:164 17296#, no-wrap 17297msgid "" 17298"# The actual runnable program is set to the SCRIPTS primitive.\n" 17299"# # Prefix bin_ tells where to copy this\n" 17300"bin_SCRIPTS = hello-world\n" 17301"# # List of files to be distributed\n" 17302"EXTRA_DIST = \\\n" 17303"\t$(bin_SCRIPTS)\n" 17304"#\n" 17305"# # The desktop files\n" 17306"desktopdir = $(datadir)/applications\n" 17307"desktop_DATA = \\\n" 17308"\thello-world.desktop\n" 17309msgstr "" 17310 17311#. (itstool) path: section/title 17312#. (itstool) path: item/p 17313#. (itstool) path: section/p 17314#: C/hello-world.js.page:168 C/hello-world.py.page:148 17315#: C/hello-world.vala.page:125 C/weatherAutotools.js.page:39 17316#: C/weatherAutotools.js.page:131 17317#, fuzzy 17318msgid "configure.ac" 17319msgstr "configure.ac" 17320 17321#. (itstool) path: section/code 17322#: C/hello-world.js.page:169 C/hello-world.py.page:149 17323#, no-wrap 17324msgid "" 17325"# This file is processed by autoconf to create a configure script\n" 17326"AC_INIT([Hello World], 1.0)\n" 17327"AM_INIT_AUTOMAKE([1.10 no-define foreign dist-xz no-dist-gzip])\n" 17328"AC_CONFIG_FILES([Makefile hello-world.desktop])\n" 17329"AC_OUTPUT\n" 17330msgstr "" 17331 17332#. (itstool) path: section/title 17333#: C/hello-world.js.page:173 C/hello-world.py.page:153 17334#: C/hello-world.vala.page:130 17335#, fuzzy 17336msgid "README" 17337msgstr "Documento README" 17338 17339#. (itstool) path: section/p 17340#: C/hello-world.js.page:174 C/hello-world.py.page:154 17341#: C/hello-world.vala.page:131 17342msgid "Information users should read first. This file can be blank." 17343msgstr "" 17344 17345#. (itstool) path: section/p 17346#: C/hello-world.js.page:176 C/hello-world.py.page:156 17347msgid "" 17348"When you have the <file>hello-world</file>, <file>hello-world.desktop.in</" 17349"file>, <file>Makefile.am</file>, <file>configure.ac</file> and <file>autogen." 17350"sh</file> files with correct information and rights, the <file>README</file> " 17351"file can include the following instructions:" 17352msgstr "" 17353 17354#. (itstool) path: section/code 17355#: C/hello-world.js.page:177 C/hello-world.py.page:157 17356#, no-wrap 17357msgid "" 17358"To build and install this program:\n" 17359"\n" 17360"./autogen.sh --prefix=/home/your_username/.local\n" 17361"make install\n" 17362"\n" 17363"-------------\n" 17364"Running the first line above creates the following files:\n" 17365"\n" 17366"aclocal.m4\n" 17367"autom4te.cache\n" 17368"config.log\n" 17369"config.status\n" 17370"configure\n" 17371"hello-world.desktop\n" 17372"install-sh\n" 17373"missing\n" 17374"Makefile.in\n" 17375"Makefile\n" 17376"\n" 17377"Running \"make install\", installs the application in /home/your_username/.local/bin\n" 17378"and installs the hello-world.desktop file in /home/your_username/.local/share/applications\n" 17379"\n" 17380"You can now run the application by typing \"Hello World\" in the Overview.\n" 17381"\n" 17382"----------------\n" 17383"To uninstall, type:\n" 17384"\n" 17385"make uninstall\n" 17386"\n" 17387"----------------\n" 17388"To create a tarball type:\n" 17389"\n" 17390"make distcheck\n" 17391"\n" 17392"This will create hello-world-1.0.tar.xz\n" 17393msgstr "" 17394 17395#. (itstool) path: info/title 17396#: C/hello-world.py.page:9 17397#, fuzzy 17398msgctxt "text" 17399msgid "Hello World (Python)" 17400msgstr "Olá, mundo!" 17401 17402#. (itstool) path: item/p 17403#: C/hello-world.py.page:32 17404msgid "create a small \"Hello, World\" application using Python and GTK+" 17405msgstr "" 17406 17407#. (itstool) path: section/code 17408#: C/hello-world.py.page:47 17409#, no-wrap 17410msgid "" 17411"from gi.repository import Gtk\n" 17412"import sys" 17413msgstr "" 17414 17415#. (itstool) path: section/code 17416#: C/hello-world.py.page:53 17417#, no-wrap 17418msgid "" 17419"class MyWindow(Gtk.ApplicationWindow):\n" 17420"\n" 17421" # constructor for a Gtk.ApplicationWindow\n" 17422" def __init__(self, app):\n" 17423" Gtk.Window.__init__(self, title=\"Hello World!\", application=app)\n" 17424" self.set_default_size(200, 100)\n" 17425"\n" 17426"class MyApplication(Gtk.Application):\n" 17427" def __init__(self):\n" 17428" Gtk.Application.__init__(self)\n" 17429"\n" 17430" def do_activate(self):\n" 17431" win = MyWindow(self)\n" 17432" win.show_all()\n" 17433"\n" 17434" def do_startup(self):\n" 17435" Gtk.Application.do_startup(self)" 17436msgstr "" 17437 17438#. (itstool) path: section/p 17439#: C/hello-world.py.page:71 C/hello-world.vala.page:54 17440msgid "" 17441"Gtk.Application initializes GTK+. It also connects the <gui>x</gui> button " 17442"that's automatically generated along with the window to the \"destroy\" " 17443"signal." 17444msgstr "" 17445 17446#. (itstool) path: section/p 17447#: C/hello-world.py.page:72 17448msgid "" 17449"We can start building our first window. We do this by creating a class " 17450"called <var>MyWindow</var> and assigning it a Gtk.ApplicationWindow." 17451msgstr "" 17452 17453#. (itstool) path: section/code 17454#: C/hello-world.py.page:78 17455#, no-wrap 17456msgid "" 17457"# Add a label widget to your window\n" 17458"\n" 17459" # create a label\n" 17460" label = Gtk.Label()\n" 17461"\n" 17462" # set the text of the label\n" 17463" label.set_text(\"Hello GNOME!\")\n" 17464"\n" 17465" # add the label to the window\n" 17466" self.add(label)" 17467msgstr "" 17468 17469#. (itstool) path: section/p 17470#: C/hello-world.py.page:89 17471msgid "" 17472"A text label is one of the GTK+ widgets we can use, on account of having " 17473"imported the GTK+ library. To use it, we create a variable called " 17474"<var>label</var> and set the text that the label will hold. Finally, we " 17475"create and run the application:" 17476msgstr "" 17477 17478#. (itstool) path: section/code 17479#: C/hello-world.py.page:91 17480#, no-wrap 17481msgid "" 17482"#run the application\n" 17483"\n" 17484"app = MyApplication()\n" 17485"exit_status = app.run(sys.argv)\n" 17486"sys.exit(exit_status)" 17487msgstr "" 17488 17489#. (itstool) path: section/title 17490#: C/hello-world.py.page:101 17491#, fuzzy 17492msgid "hello-world.py" 17493msgstr "Olá," 17494 17495#. (itstool) path: section/code 17496#: C/hello-world.py.page:103 C/label.py.page:39 17497#, no-wrap 17498msgid "" 17499"from gi.repository import Gtk\n" 17500"import sys\n" 17501"\n" 17502"\n" 17503"class MyWindow(Gtk.ApplicationWindow):\n" 17504" # constructor for a Gtk.ApplicationWindow\n" 17505"\n" 17506" def __init__(self, app):\n" 17507" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 17508" self.set_default_size(200, 100)\n" 17509"\n" 17510" # create a label\n" 17511" label = Gtk.Label()\n" 17512" # set the text of the label\n" 17513" label.set_text(\"Hello GNOME!\")\n" 17514" # add the label to the window\n" 17515" self.add(label)\n" 17516"\n" 17517"\n" 17518"class MyApplication(Gtk.Application):\n" 17519"\n" 17520" def __init__(self):\n" 17521" Gtk.Application.__init__(self)\n" 17522"\n" 17523" def do_activate(self):\n" 17524" win = MyWindow(self)\n" 17525" win.show_all()\n" 17526"\n" 17527" def do_startup(self):\n" 17528" Gtk.Application.do_startup(self)\n" 17529"\n" 17530"app = MyApplication()\n" 17531"exit_status = app.run(sys.argv)\n" 17532"sys.exit(exit_status)\n" 17533msgstr "" 17534 17535#. (itstool) path: section/p 17536#: C/hello-world.py.page:107 17537msgid "" 17538"To run this application, first save it as hello-world.py. Then open " 17539"Terminal, go to the folder where your application is stored and run:" 17540msgstr "" 17541 17542#. (itstool) path: section/screen 17543#: C/hello-world.py.page:108 17544#, no-wrap 17545msgid "<output style=\"prompt\">$ </output><input>python hello-world.py</input>" 17546msgstr "" 17547 17548#. (itstool) path: section/code 17549#: C/hello-world.py.page:144 17550#, no-wrap 17551msgid "" 17552"# The actual runnable program is set to the SCRIPTS primitive.\n" 17553"# # Prefix bin_ tells where to copy this\n" 17554"bin_SCRIPTS = hello-world.py\n" 17555"# # List of files to be distributed\n" 17556"EXTRA_DIST= \\\n" 17557"\t$(bin_SCRIPTS)\n" 17558"#\n" 17559"# # The desktop files\n" 17560"desktopdir = $(datadir)/applications\n" 17561"desktop_DATA = \\\n" 17562"\thello-world.desktop\n" 17563msgstr "" 17564 17565#. (itstool) path: info/title 17566#: C/hello-world.vala.page:9 17567#, fuzzy 17568msgctxt "text" 17569msgid "Hello World (Vala)" 17570msgstr "Olá, mundo!" 17571 17572#. (itstool) path: item/p 17573#: C/hello-world.vala.page:32 17574msgid "create a small \"Hello, World\" application using GTK+" 17575msgstr "" 17576 17577#. (itstool) path: section/code 17578#: C/hello-world.vala.page:45 17579#, no-wrap 17580msgid "" 17581"class MyApplication : Gtk.Application {\n" 17582" protected override void activate () {\n" 17583" var window = new Gtk.ApplicationWindow (this);\n" 17584" window.set_title (\"Welcome to GNOME\");\n" 17585" window.set_default_size (200, 100);\n" 17586" window.show_all ();\n" 17587" }\n" 17588"}" 17589msgstr "" 17590 17591#. (itstool) path: section/p 17592#: C/hello-world.vala.page:55 17593msgid "" 17594"We can start building our first window. We do this by creating a variable " 17595"called <var>window</var> and assigning it a new Gtk.ApplicationWindow." 17596msgstr "" 17597 17598#. (itstool) path: section/p 17599#: C/hello-world.vala.page:56 17600msgid "" 17601"We give the window a title using <code>set_title</code>. The title can be " 17602"any string you want it to be. To be on the safe side, it's best to stick to " 17603"UTF-8 encoding." 17604msgstr "" 17605 17606#. (itstool) path: section/code 17607#: C/hello-world.vala.page:61 17608#, no-wrap 17609msgid "" 17610"var label = new Gtk.Label (\"Hello GNOME!\");\n" 17611" window.add (label);\n" 17612msgstr "" 17613 17614#. (itstool) path: section/p 17615#: C/hello-world.vala.page:65 17616#, fuzzy 17617msgid "Finally, we create and run the application:" 17618msgstr "Nós vamos criar o aplicativo em si:" 17619 17620#. (itstool) path: section/code 17621#: C/hello-world.vala.page:67 17622#, no-wrap 17623msgid "" 17624"int main (string[] args) {\n" 17625" return new MyApplication ().run (args);\n" 17626"}" 17627msgstr "" 17628 17629#. (itstool) path: section/title 17630#: C/hello-world.vala.page:75 17631#, fuzzy 17632msgid "hello-world.vala" 17633msgstr "<a href=\"/software/hello/\">Hello</a>" 17634 17635#. (itstool) path: section/code 17636#: C/hello-world.vala.page:77 17637#, no-wrap 17638msgid "" 17639"public class MyApplication : Gtk.Application {\n" 17640"\tprotected override void activate () {\n" 17641"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 17642"\t\tvar label = new Gtk.Label (\"Hello GNOME!\");\n" 17643"\t\twindow.add (label);\n" 17644"\t\twindow.set_title (\"Welcome to GNOME\");\n" 17645"\t\twindow.set_default_size (200, 100);\n" 17646"\t\twindow.show_all ();\n" 17647"\t}\n" 17648"}\n" 17649"\n" 17650"public int main (string[] args) {\n" 17651"\treturn new MyApplication ().run (args);\n" 17652"}\n" 17653msgstr "" 17654 17655#. (itstool) path: section/p 17656#: C/hello-world.vala.page:81 17657msgid "" 17658"To run this application, first save it as hello-world.vala. Then open " 17659"Terminal, go to the folder where your application is stored." 17660msgstr "" 17661 17662#. (itstool) path: section/p 17663#: C/hello-world.vala.page:82 17664#, fuzzy 17665msgid "Compile the program:" 17666msgstr "" 17667"Quando você usa o GCC para compilar um programa, o GCC pode combinar porções " 17668"de certos arquivos de cabeçalho GCC e bibliotecas de tempo de execução com o " 17669"programa compilado. O objetivo desta Exceção é permitir a compilação de " 17670"programas que estejam cobertos pela GPL (incluindo proprietários) para usar, " 17671"desta forma, os arquivos de cabeçalho e as bibliotecas de tempo de execução " 17672"cobertas por esta Exceção." 17673 17674#. (itstool) path: section/screen 17675#: C/hello-world.vala.page:83 17676#, no-wrap 17677msgid "valac --pkg gtk+-3.0 <file>hello-world.vala</file>" 17678msgstr "" 17679 17680#. (itstool) path: section/p 17681#: C/hello-world.vala.page:84 17682#, fuzzy 17683msgid "Run the program:" 17684msgstr "Executa um programa" 17685 17686#. (itstool) path: section/screen 17687#: C/hello-world.vala.page:85 17688#, fuzzy, no-wrap 17689msgid "./<var>hello-world</var>" 17690msgstr "olá, mundo" 17691 17692#. (itstool) path: section/code 17693#: C/hello-world.vala.page:121 17694#, no-wrap 17695msgid "" 17696"# The actual runnable program is set to the SCRIPTS primitive.\n" 17697"# # Prefix bin_ tells where to copy this\n" 17698"bin_PROGRAMS = hello-world\n" 17699"hello_world_CFLAGS = $(gtk_CFLAGS)\n" 17700"hello_world_LDADD = $(gtk_LIBS)\n" 17701"hello_world_VALAFLAGS = --pkg gtk+-3.0\n" 17702"hello_world_SOURCES = hello-world.vala\n" 17703"\n" 17704"desktopdir = $(datadir)/applications\n" 17705"desktop_DATA = \\\n" 17706"\thello-world.desktop\n" 17707msgstr "" 17708 17709#. (itstool) path: section/code 17710#: C/hello-world.vala.page:126 17711#, no-wrap 17712msgid "" 17713"# This file is processed by autoconf to create a configure script\n" 17714"AC_INIT([Hello World], 1.0)\n" 17715"AM_INIT_AUTOMAKE([1.10 no-define foreign dist-xz no-dist-gzip])\n" 17716"AC_PROG_CC\n" 17717"AM_PROG_VALAC([0.16])\n" 17718"PKG_CHECK_MODULES(gtk, gtk+-3.0)\n" 17719"AC_CONFIG_FILES([Makefile hello-world.desktop])\n" 17720"\n" 17721"AC_OUTPUT\n" 17722msgstr "" 17723 17724#. (itstool) path: section/p 17725#: C/hello-world.vala.page:133 17726msgid "" 17727"When you have the <file>hello-world.c</file>, <file>hello-world.desktop.in</" 17728"file>, <file>Makefile.am</file>, <file>configure.ac</file> and <file>autogen." 17729"sh</file> files with correct information and rights, the <file>README</file> " 17730"file can include the following instructions:" 17731msgstr "" 17732 17733#. (itstool) path: section/code 17734#: C/hello-world.vala.page:134 17735#, no-wrap 17736msgid "" 17737"To build and install this program:\n" 17738"\n" 17739"./autogen.sh --prefix=/home/your_username/.local\n" 17740"make\n" 17741"make install\n" 17742"\n" 17743"-------------\n" 17744"Running the first line above creates the following files:\n" 17745"\n" 17746"aclocal.m4\n" 17747"autom4te.cache\n" 17748"config.log\n" 17749"config.status\n" 17750"configure\n" 17751"depcomp\n" 17752"hello-world\n" 17753"hello-world.c\n" 17754"hello-world.desktop\n" 17755"hello_world-hello-world.o\n" 17756"hello_world_vala.stamp\n" 17757"install-sh\n" 17758"missing\n" 17759"Makefile.in\n" 17760"Makefile\n" 17761"\n" 17762"Running \"make\" links all the appropriate libraries.\n" 17763"\n" 17764"Running \"make install\", installs the application in /home/your_username/.local/bin\n" 17765"and installs the hello-world.desktop file in /home/your_username/.local/share/applications\n" 17766"\n" 17767"You can now run the application by typing \"Hello World\" in the Overview.\n" 17768"\n" 17769"----------------\n" 17770"To uninstall, type:\n" 17771"\n" 17772"make uninstall\n" 17773"\n" 17774"----------------\n" 17775"To create a tarball type:\n" 17776"\n" 17777"make distcheck\n" 17778"\n" 17779"This will create hello-world-1.0.tar.xz\n" 17780msgstr "" 17781 17782#. (itstool) path: info/title 17783#: C/image.c.page:8 17784#, fuzzy 17785msgctxt "text" 17786msgid "Image (C)" 17787msgstr "Escol_her imagem" 17788 17789#. (itstool) path: info/desc 17790#: C/image.c.page:18 C/image.js.page:17 C/image.py.page:25 C/image.vala.page:18 17791#, fuzzy 17792msgid "A widget displaying an image" 17793msgstr "Widget:" 17794 17795#. (itstool) path: page/title 17796#: C/image.c.page:21 C/image.js.page:20 C/image.py.page:28 C/image.vala.page:21 17797#, fuzzy 17798msgid "Image" 17799msgstr "@image" 17800 17801#. (itstool) path: page/media 17802#. This is a reference to an external file such as an image or video. When 17803#. the file changes, the md5 hash will change to let you know you need to 17804#. update your localized copy. The msgstr is not used at all. Set it to 17805#. whatever you like once you have updated your copy of the file. 17806#: C/image.c.page:22 C/image.js.page:21 C/image.py.page:29 C/image.vala.page:22 17807msgctxt "_" 17808msgid "external ref='media/image.png' md5='9416aa74d9d6a857783f7a36338e7a02'" 17809msgstr "external ref='media/image.png' md5='9416aa74d9d6a857783f7a36338e7a02'" 17810 17811#. (itstool) path: page/p 17812#: C/image.c.page:23 C/image.js.page:22 C/image.py.page:30 C/image.vala.page:23 17813msgid "This GtkApplication displays an image file from the current directory." 17814msgstr "" 17815 17816#. (itstool) path: note/p 17817#: C/image.c.page:24 C/image.js.page:23 C/image.vala.page:24 17818msgid "" 17819"If the image file isn't loaded successfully, the image will contain a " 17820"\"broken image\" icon. The <file>filename.png</file> needs to be in the " 17821"current directory for this code to work. Use your favorite picture!" 17822msgstr "" 17823 17824#. (itstool) path: page/code 17825#: C/image.c.page:28 17826#, no-wrap 17827msgid "" 17828"#include <gtk/gtk.h>\n" 17829"\n" 17830"\n" 17831"\n" 17832"static void\n" 17833"activate (GtkApplication *app,\n" 17834" gpointer user_data)\n" 17835"{\n" 17836" GtkWidget *window;\n" 17837" GtkWidget *image;\n" 17838"\n" 17839" /*Create a window with a title and a default size*/\n" 17840" window = gtk_application_window_new (app);\n" 17841" gtk_window_set_title (GTK_WINDOW (window), \"Welcome to GNOME\");\n" 17842" gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);\n" 17843"\n" 17844" image = gtk_image_new_from_file (\"gnome-image.png\");\n" 17845"\n" 17846" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (image));\n" 17847"\n" 17848" gtk_widget_show_all (GTK_WIDGET (window));\n" 17849"}\n" 17850"\n" 17851"\n" 17852"\n" 17853"int\n" 17854"main (int argc, char **argv)\n" 17855"{\n" 17856" GtkApplication *app;\n" 17857" int status;\n" 17858"\n" 17859" app = gtk_application_new (\"org.gtk.example\",G_APPLICATION_FLAGS_NONE);\n" 17860" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 17861" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 17862" g_object_unref (app);\n" 17863" return status;\n" 17864"}\n" 17865msgstr "" 17866 17867#. (itstool) path: item/p 17868#: C/image.c.page:35 17869msgid "" 17870"<link href=\"http://developer.gnome.org/gtk3/stable/GtkImage.html" 17871"\">GtkImage</link>" 17872msgstr "" 17873"<link href=\"http://developer.gnome.org/gtk3/stable/GtkImage.html" 17874"\">GtkImage</link>" 17875 17876#. (itstool) path: info/title 17877#: C/image.js.page:7 17878#, fuzzy 17879msgctxt "text" 17880msgid "Image (JavaScript)" 17881msgstr "_JavaScript" 17882 17883#. (itstool) path: page/code 17884#: C/image.js.page:27 17885#, fuzzy, no-wrap 17886#| msgid "" 17887#| "#!/usr/bin/gjs\n" 17888#| "\n" 17889#| "const GLib = imports.gi.GLib;\n" 17890#| "const Gtk = imports.gi.Gtk;\n" 17891#| "const Lang = imports.lang;\n" 17892#| "const Webkit = imports.gi.WebKit;\n" 17893#| "\n" 17894#| "const HelloGNOME = new Lang.Class ({\n" 17895#| " Name: 'Hello GNOME',\n" 17896#| "\n" 17897#| " // Create the application itself\n" 17898#| " _init: function () {\n" 17899#| " this.application = new Gtk.Application ();\n" 17900#| "\n" 17901#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 17902#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 17903#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 17904#| " },\n" 17905#| "\n" 17906#| " // Callback function for 'activate' signal presents windows when active\n" 17907#| " _onActivate: function () {\n" 17908#| " this._window.present ();\n" 17909#| " },\n" 17910#| "\n" 17911#| " // Callback function for 'startup' signal builds the UI\n" 17912#| " _onStartup: function () {\n" 17913#| " this._buildUI ();\n" 17914#| " },\n" 17915#| "\n" 17916#| " // Build the application's UI\n" 17917#| " _buildUI: function () {\n" 17918#| "\n" 17919#| " // Create the application window\n" 17920#| " this._window = new Gtk.ApplicationWindow ({\n" 17921#| " application: this.application,\n" 17922#| " title: \"Welcome to GNOME\",\n" 17923#| " default_height: 200,\n" 17924#| " default_width: 400,\n" 17925#| " window_position: Gtk.WindowPosition.CENTER });\n" 17926#| "\n" 17927#| " // Create a webview to show the web app\n" 17928#| " this._webView = new Webkit.WebView ();\n" 17929#| "\n" 17930#| " // Put the web app into the webview\n" 17931#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 17932#| " \"/hellognome.html\", null));\n" 17933#| "\n" 17934#| " // Put the webview into the window\n" 17935#| " this._window.add (this._webView);\n" 17936#| "\n" 17937#| " // Show the window and all child widgets\n" 17938#| " this._window.show_all();\n" 17939#| " },\n" 17940#| "\n" 17941#| "});\n" 17942#| "\n" 17943#| "// Run the application\n" 17944#| "let app = new HelloGNOME ();\n" 17945#| "app.application.run (ARGV);\n" 17946msgid "" 17947"#!/usr/bin/gjs\n" 17948"\n" 17949"imports.gi.versions.Gtk = '3.0';\n" 17950"\n" 17951"const Gio = imports.gi.Gio;\n" 17952"const GLib = imports.gi.GLib;\n" 17953"const Gtk = imports.gi.Gtk;\n" 17954"\n" 17955"class ImageExample {\n" 17956"\n" 17957" /* Create the application itself\n" 17958" This boilerplate code is needed to build any GTK+ application. */\n" 17959" constructor() {\n" 17960" this.application = new Gtk.Application ({\n" 17961" application_id: 'org.example.jsimage',\n" 17962" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 17963" });\n" 17964"\n" 17965" // Connect 'activate' and 'startup' signals to the callback functions\n" 17966" this.application.connect('activate', this._onActivate.bind(this));\n" 17967" this.application.connect('startup', this._onStartup.bind(this));\n" 17968" }\n" 17969"\n" 17970" // Callback function for 'activate' signal presents windows when active\n" 17971" _onActivate() {\n" 17972" this._window.present();\n" 17973" }\n" 17974"\n" 17975" // Callback function for 'startup' signal initializes menus and builds the UI\n" 17976" _onStartup() {\n" 17977" this._buildUI();\n" 17978" }\n" 17979"\n" 17980" // Build the application's UI\n" 17981" _buildUI() {\n" 17982"\n" 17983" // Create the application window\n" 17984" this._window = new Gtk.ApplicationWindow({\n" 17985" application: this.application,\n" 17986" window_position: Gtk.WindowPosition.CENTER,\n" 17987" title: \"Welcome to GNOME\",\n" 17988" default_height: 300,\n" 17989" default_width: 300\n" 17990" });\n" 17991"\n" 17992" // Create the label\n" 17993" this.jsimage = new Gtk.Image ({file: \"gnome-image.png\"});\n" 17994" this._window.add (this.jsimage);\n" 17995"\n" 17996" // Show the window and all child widgets\n" 17997" this._window.show_all();\n" 17998" }\n" 17999"};\n" 18000"\n" 18001"// Run the application\n" 18002"let app = new ImageExample ();\n" 18003"app.application.run (ARGV);\n" 18004msgstr "" 18005"#!/usr/bin/gjs\n" 18006"\n" 18007"const GLib = imports.gi.GLib;\n" 18008"const Gtk = imports.gi.Gtk;\n" 18009"const Lang = imports.lang;\n" 18010"const Webkit = imports.gi.WebKit;\n" 18011"\n" 18012"const HelloGNOME = new Lang.Class ({\n" 18013" Name: 'Olá, GNOME',\n" 18014"\n" 18015" // Cria o aplicativo em si\n" 18016" _init: function () {\n" 18017" this.application = new Gtk.Application ();\n" 18018"\n" 18019" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 18020" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 18021" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 18022" },\n" 18023"\n" 18024" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 18025" _onActivate: function () {\n" 18026" this._window.present ();\n" 18027" },\n" 18028"\n" 18029" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 18030" _onStartup: function () {\n" 18031" this._buildUI ();\n" 18032" },\n" 18033"\n" 18034" // Constrói a interface gráfica do aplicativo\n" 18035" _buildUI: function () {\n" 18036"\n" 18037" // Cria a janela do aplicativo\n" 18038" this._window = new Gtk.ApplicationWindow ({\n" 18039" application: this.application,\n" 18040" title: \"Bem-vindo ao GNOME\",\n" 18041" default_height: 200,\n" 18042" default_width: 400,\n" 18043" window_position: Gtk.WindowPosition.CENTER });\n" 18044"\n" 18045" // Cria um webview para mostrar o aplicativo web\n" 18046" this._webView = new Webkit.WebView ();\n" 18047"\n" 18048" // Coloca o aplicativo web no webview\n" 18049" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 18050" \"/hellognome.html\", null));\n" 18051"\n" 18052" // Coloca o webview na janela\n" 18053" this._window.add (this._webView);\n" 18054"\n" 18055" // Mostra a janela e todos seus widgets filhos\n" 18056" this._window.show_all();\n" 18057" },\n" 18058"\n" 18059"});\n" 18060"\n" 18061"// Executa o aplicativo\n" 18062"let app = new HelloGNOME ();\n" 18063"app.application.run (ARGV);\n" 18064 18065#. (itstool) path: item/p 18066#: C/image.js.page:34 18067msgid "" 18068"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Image.html" 18069"\">Gtk.Image</link>" 18070msgstr "" 18071 18072#. (itstool) path: info/title 18073#: C/image.py.page:8 18074#, fuzzy 18075msgctxt "text" 18076msgid "Image (Python)" 18077msgstr "_Python" 18078 18079#. (itstool) path: credit/name 18080#: C/image.py.page:20 18081#, fuzzy 18082msgid "Sindhu S" 18083msgstr "Sindhu S" 18084 18085#. (itstool) path: credit/years 18086#: C/image.py.page:22 18087#, fuzzy 18088msgid "2014" 18089msgstr "2014" 18090 18091#. (itstool) path: note/p 18092#: C/image.py.page:32 18093msgid "" 18094"If the image file is not loaded successfully, the image will contain a " 18095"\"broken image\" icon. <file>filename.png</file> needs to be in the current " 18096"directory for this code to work." 18097msgstr "" 18098 18099#. (itstool) path: section/code 18100#: C/image.py.page:43 18101#, no-wrap 18102msgid "" 18103"\n" 18104" from gi.repository import Gtk\n" 18105"import sys\n" 18106"\n" 18107"\n" 18108"class MyWindow(Gtk.ApplicationWindow):\n" 18109" # create a window\n" 18110"\n" 18111" def __init__(self, app):\n" 18112" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 18113" self.set_default_size(300, 300)\n" 18114"\n" 18115" # create an image\n" 18116" image = Gtk.Image()\n" 18117" # set the content of the image as the file filename.png\n" 18118" image.set_from_file(\"gnome-image.png\")\n" 18119" # add the image to the window\n" 18120" self.add(image)\n" 18121"\n" 18122"\n" 18123"class MyApplication(Gtk.Application):\n" 18124"\n" 18125" def __init__(self):\n" 18126" Gtk.Application.__init__(self)\n" 18127"\n" 18128" def do_activate(self):\n" 18129" win = MyWindow(self)\n" 18130" win.show_all()\n" 18131"\n" 18132" def do_startup(self):\n" 18133" Gtk.Application.do_startup(self)\n" 18134"\n" 18135"app = MyApplication()\n" 18136"exit_status = app.run(sys.argv)\n" 18137"sys.exit(exit_status)\n" 18138"\n" 18139" " 18140msgstr "" 18141 18142#. (itstool) path: section/p 18143#: C/image.py.page:47 18144msgid "" 18145"Another way to obtain what we have in the example is to create the image as " 18146"an instance of another class and add it to the instance of <code>MyWindow</" 18147"code> in the <code>do_activate(self)</code> method:" 18148msgstr "" 18149 18150#. (itstool) path: section/code 18151#: C/image.py.page:51 18152#, no-wrap 18153msgid "" 18154"\n" 18155" # a class to create a window\n" 18156" class MyWindow(Gtk.ApplicationWindow):\n" 18157" def __init__(self, app):\n" 18158" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 18159" self.set_default_size(300, 300)\n" 18160"\n" 18161" # a class to create an image\n" 18162" class MyImage(Gtk.Image):\n" 18163" def __init__(self):\n" 18164" Gtk.Image.__init__(self)\n" 18165" self.set_from_file(\"gnome-image.png\")\n" 18166"\n" 18167" class MyApplication(Gtk.Application):\n" 18168" def __init__(self):\n" 18169" Gtk.Application.__init__(self)\n" 18170"\n" 18171" def do_activate(self):\n" 18172" # create an instance of MyWindow\n" 18173" win = MyWindow(self)\n" 18174" # create an instance of MyImage and add it to the window\n" 18175" win.add(MyImage())\n" 18176" # show the window and everything on it\n" 18177" win.show_all()\n" 18178" " 18179msgstr "" 18180 18181#. (itstool) path: note/p 18182#: C/image.py.page:78 18183msgid "" 18184"To use this code snippet, you will need to add the code that imports " 18185"<code>Gtk</code> and <code>GdkPixbuf</code> from <code>gi.repository</code> " 18186"and lines that instantiate the <code>MyApplication</code> window." 18187msgstr "" 18188 18189#. (itstool) path: section/title 18190#: C/image.py.page:85 18191#, fuzzy 18192msgid "Useful methods for an Image widget" 18193msgstr "Métodos úteis" 18194 18195#. (itstool) path: item/p 18196#: C/image.py.page:89 18197msgid "" 18198"To load an image over a network use <code>set_from_pixbuf(pixbuf)</code>, " 18199"where <code>pixbuf</code> is a <link href=\"https://developer.gnome.org/gdk-" 18200"pixbuf/unstable/index.html\"> GdkPixbuf</link>." 18201msgstr "" 18202 18203#. (itstool) path: item/code 18204#: C/image.py.page:93 18205#, no-wrap 18206msgid "" 18207"\n" 18208" from gi.repository import Gtk\n" 18209" from gi.repository import GdkPixbuf\n" 18210" import sys\n" 18211"\n" 18212" class MyWindow(Gtk.ApplicationWindow):\n" 18213" # create a window\n" 18214" def __init__(self, app):\n" 18215" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 18216" self.set_default_size(300, 300)\n" 18217"\n" 18218" # create a pixbuf from file filename=\"gnome-image.png\", with width=32\n" 18219" # and height=64 amd boolean preserve_aspect_ratio=False.\n" 18220" pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(\"gnome-image.png\", 64, 128, False)\n" 18221"\n" 18222" # create an image\n" 18223" image = Gtk.Image()\n" 18224" # set the content of the image as the pixbuf\n" 18225" image.set_from_pixbuf(pixbuf)\n" 18226" # add the image to the window\n" 18227" self.add(image)\n" 18228" " 18229msgstr "" 18230 18231#. (itstool) path: item/p 18232#: C/image.py.page:115 18233msgid "" 18234"If <code>preserve_aspect_ratio=True</code> we can use " 18235"<code>new_from_file_at_size(filename, width, height)</code>. If <code>width</" 18236"code> or <code>height</code> is <code>-1</code>, it is not constrained." 18237msgstr "" 18238 18239#. (itstool) path: item/p 18240#: C/image.py.page:119 18241msgid "" 18242"For loading from an input stream, see <code>new_from_stream()</code> and " 18243"<code>new_from_stream_at_scale()</code> in the documentation." 18244msgstr "" 18245 18246#. (itstool) path: item/p 18247#: C/image.py.page:131 18248msgid "" 18249"<link href=\"https://developer.gnome.org/gtk3/unstable/GtkImage.html\"> " 18250"GtkImage</link>" 18251msgstr "" 18252"<link href=\"https://developer.gnome.org/gtk3/unstable/GtkImage.html\"> " 18253"GtkImage</link>" 18254 18255#. (itstool) path: item/p 18256#: C/image.py.page:135 18257msgid "" 18258"<link href=\"https://developer.gnome.org/gtk3/unstable/GtkWindow.html\"> " 18259"GtkWindow</link>" 18260msgstr "" 18261"<link href=\"https://developer.gnome.org/gtk3/unstable/GtkWindow.html\"> " 18262"GtkWindow</link>" 18263 18264#. (itstool) path: info/title 18265#: C/image.vala.page:8 18266#, fuzzy 18267msgctxt "text" 18268msgid "Image (Vala)" 18269msgstr "_Vala" 18270 18271#. (itstool) path: page/code 18272#: C/image.vala.page:27 18273#, no-wrap 18274msgid "" 18275"public class MyWindow : Gtk.ApplicationWindow {\n" 18276"\tinternal MyWindow (MyApplication app) {\n" 18277"\t\tObject (application: app, title: \"Welcome to GNOME\");\n" 18278"\n" 18279"\t\tvar image = new Gtk.Image ();\n" 18280"\t\timage.set_from_file (\"gnome-image.png\");\n" 18281"\t\tthis.add (image);\n" 18282"\t\tthis.set_default_size (300, 300);\n" 18283"\t}\n" 18284"}\n" 18285"\n" 18286"public class MyApplication : Gtk.Application {\n" 18287"\tprotected override void activate () {\n" 18288"\t\tnew MyWindow (this).show_all ();\n" 18289"\t}\n" 18290"\n" 18291"\tinternal MyApplication () {\n" 18292"\t\tObject (application_id: \"org.example.MyApplication\");\n" 18293"\t}\n" 18294"}\n" 18295"\n" 18296"public int main (string[] args) {\n" 18297"\treturn new MyApplication ().run (args);\n" 18298"}\n" 18299msgstr "" 18300 18301#. (itstool) path: item/p 18302#: C/image.vala.page:32 C/separator.vala.page:40 18303msgid "" 18304"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Application.html" 18305"\">GtkApplication</link>" 18306msgstr "" 18307 18308#. (itstool) path: item/p 18309#: C/image.vala.page:33 18310msgid "" 18311"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ApplicationWindow.html" 18312"\">GtkApplicationWindow</link>" 18313msgstr "" 18314 18315#. (itstool) path: item/p 18316#: C/image.vala.page:34 C/paned.vala.page:38 18317msgid "" 18318"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Image.html\">GtkImage</link>" 18319msgstr "" 18320 18321#. (itstool) path: info/title 18322#: C/image-viewer.c.page:8 18323msgctxt "text" 18324msgid "Image viewer (C)" 18325msgstr "Visualizador de imagens (C)" 18326 18327#. (itstool) path: info/desc 18328#: C/image-viewer.c.page:11 18329msgid "A little bit more than a simple \"Hello world\" Gtk application." 18330msgstr "Um pouco mais do que um simples aplicativo Gtk “Hello world”." 18331 18332#. (itstool) path: page/title 18333#: C/image-viewer.c.page:29 C/image-viewer.cpp.page:27 18334#: C/image-viewer.js.page:29 C/image-viewer.py.page:29 18335#: C/image-viewer.vala.page:37 18336msgid "Image viewer" 18337msgstr "Visualizador de imagens" 18338 18339#. (itstool) path: synopsis/p 18340#: C/image-viewer.c.page:32 C/image-viewer.cpp.page:30 18341#: C/message-board.c.page:29 C/record-collection.js.page:32 18342msgid "In this tutorial, you will learn:" 18343msgstr "Neste tutorial, você aprenderá:" 18344 18345#. (itstool) path: item/p 18346#: C/image-viewer.c.page:34 18347msgid "Some basic concepts of C/GObject programming" 18348msgstr "" 18349 18350#. (itstool) path: item/p 18351#: C/image-viewer.c.page:35 18352msgid "How to write a Gtk application in C" 18353msgstr "" 18354 18355#. (itstool) path: page/media 18356#. This is a reference to an external file such as an image or video. When 18357#. the file changes, the md5 hash will change to let you know you need to 18358#. update your localized copy. The msgstr is not used at all. Set it to 18359#. whatever you like once you have updated your copy of the file. 18360#: C/image-viewer.c.page:39 C/image-viewer.cpp.page:37 18361#: C/image-viewer.js.page:47 C/image-viewer.py.page:46 18362#: C/image-viewer.vala.page:54 18363msgctxt "_" 18364msgid "" 18365"external ref='media/image-viewer.png' md5='7720360611243b14283b83527be968c2'" 18366msgstr "" 18367 18368#. (itstool) path: item/p 18369#: C/image-viewer.c.page:49 18370msgid "" 18371"Choose <gui>GTK+ (Simple)</gui> from the <gui>C</gui> tab, click " 18372"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 18373"<file>image-viewer</file> as project name and directory." 18374msgstr "" 18375 18376#. (itstool) path: item/p 18377#: C/image-viewer.c.page:52 18378msgid "" 18379"Make sure that <gui>Use GtkBuilder for user interface</gui> is disabled as " 18380"we will create the UI manually in this tutorial. Check the <link xref=" 18381"\"guitar-tuner.c\">Guitar-Tuner</link> tutorial if you want to learn how to " 18382"use the interface builder." 18383msgstr "" 18384 18385#. (itstool) path: section/p 18386#: C/image-viewer.c.page:67 18387msgid "" 18388"C is a rather verbose language, so don't be surprised that the file contains " 18389"quite a lot of code. Most of it is template code. It loads an (empty) window " 18390"and shows it. More details are given below; skip this list if you understand " 18391"the basics:" 18392msgstr "" 18393 18394#. (itstool) path: item/p 18395#: C/image-viewer.c.page:74 18396msgid "" 18397"The <code>create_window</code> function creates a new (empty) window and " 18398"connects a signal to exit the application when that window is closed." 18399msgstr "" 18400 18401#. (itstool) path: section/title 18402#: C/image-viewer.c.page:90 C/image-viewer.cpp.page:87 18403#: C/image-viewer.vala.page:139 18404#, fuzzy 18405msgid "Creating the user interface" 18406msgstr "A interface gráfica" 18407 18408#. (itstool) path: section/p 18409#: C/image-viewer.c.page:91 18410msgid "" 18411"Now we will bring life into the empty window. GTK organizes the user " 18412"interface with <code>GtkContainer</code>s that can contain other widgets and " 18413"even other containers. Here we will use the simplest available container, a " 18414"<code>GtkBox</code>:" 18415msgstr "" 18416 18417#. (itstool) path: section/code 18418#: C/image-viewer.c.page:94 18419#, no-wrap 18420msgid "" 18421"\n" 18422"static GtkWidget*\n" 18423"create_window (void)\n" 18424"{\n" 18425"\tGtkWidget *window;\n" 18426"\tGtkWidget *button;\n" 18427"\tGtkWidget *image;\n" 18428"\tGtkWidget *box;\n" 18429"\n" 18430"\t/* Set up the UI */\n" 18431"\twindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);\n" 18432"\tgtk_window_set_title (GTK_WINDOW (window), \"image-viewer-c\");\n" 18433"\n" 18434"\tbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);\n" 18435"\tbutton = gtk_button_new_with_label (_(\"Open image\"));\n" 18436"\timage = gtk_image_new ();\n" 18437"\n" 18438"\tgtk_box_pack_start (GTK_BOX (box), image, TRUE, TRUE, 0);\n" 18439"\tgtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);\n" 18440"\n" 18441"\tgtk_container_add (GTK_CONTAINER (window), box);\n" 18442"\n" 18443"\t/* Connect signals */\n" 18444"\n" 18445"\t/* Show open dialog when opening a file */\n" 18446"\tg_signal_connect (button, \"clicked\", G_CALLBACK (on_open_image), image);\n" 18447"\n" 18448"\t/* Exit when the window is closed */\n" 18449"\tg_signal_connect (window, \"destroy\", G_CALLBACK (gtk_main_quit), NULL);\n" 18450"\n" 18451"\treturn window;\n" 18452"}\n" 18453msgstr "" 18454 18455#. (itstool) path: item/p 18456#: C/image-viewer.c.page:129 18457msgid "" 18458"The first lines create the widgets we want to use: a button for opening up " 18459"an image, the image view widget itself and the box we will use as a " 18460"container. The macros like <code>GTK_BOX</code> are used for dynamic type " 18461"checking and casting which is needed as C doesn't support object-orientation " 18462"out-of-the-box." 18463msgstr "" 18464 18465#. (itstool) path: item/p 18466#: C/image-viewer.c.page:134 18467msgid "" 18468"The calls to <code>gtk_box_pack_start</code> add the two widgets to the box " 18469"and define their behaviour. The image will expand into any available space " 18470"while the button will just be as big as needed. You will notice that we " 18471"don't set explicit sizes on the widgets. In GTK this is usually not needed " 18472"as it makes it much easier to have a layout that looks good in different " 18473"window sizes. Next, the box is added to the window." 18474msgstr "" 18475 18476#. (itstool) path: item/p 18477#: C/image-viewer.c.page:140 18478msgid "" 18479"We need to define what happens when the user clicks on the button. GTK uses " 18480"the concept of <em>signals</em>. When the button is clicked, it fires the " 18481"<em>clicked</em> signal, which we can connect to some action. This is done " 18482"using the <code>g_signal_connect</code> function which tells GTK to call the " 18483"<code>on_image_open</code> function when the button is clicked and to pass " 18484"the image as an additional argument to that function. We will define the " 18485"<em>callback</em> in the next section." 18486msgstr "" 18487 18488#. (itstool) path: item/p 18489#: C/image-viewer.c.page:145 18490msgid "" 18491"The last <code>g_signal_connect()</code> makes sure that the application " 18492"exits when the window is closed." 18493msgstr "" 18494 18495#. (itstool) path: item/p 18496#: C/image-viewer.c.page:148 18497msgid "" 18498"As a last step, make sure to replace the <code>gtk_widget_show</code> call " 18499"in the <code>main()</code> function by <code>gtk_widget_show_all()</code> to " 18500"show the window and all the widgets it contains." 18501msgstr "" 18502 18503#. (itstool) path: section/title 18504#: C/image-viewer.c.page:155 C/image-viewer.cpp.page:142 18505#: C/image-viewer.vala.page:210 18506#, fuzzy 18507msgid "Showing the image" 18508msgstr "" 18509"<emphasis>Exibição da imagem:</emphasis> A parte mais importante da janela " 18510"de imagem, é claro, a visualização da imagem ou <quote>tela de pintura</" 18511"quote>. Ocupa a área central da janela, rodeada por uma linha pontilhada " 18512"amarela mostrando o limite da imagem, de encontro a um fundo cinzento " 18513"neutro. Você pode mudar o nível de zoom de exibição da imagem de várias " 18514"formas, incluindo o controle de de Zoom descrito abaixo." 18515 18516#. (itstool) path: section/p 18517#: C/image-viewer.c.page:156 18518msgid "" 18519"We will now define the signal handler for the <em>clicked</em> signal or the " 18520"button we mentioned before. Add this code before the <code>create_window()</" 18521"code> method." 18522msgstr "" 18523 18524#. (itstool) path: section/code 18525#: C/image-viewer.c.page:159 18526#, no-wrap 18527msgid "" 18528"\n" 18529"static void\n" 18530"on_open_image (GtkButton* button, gpointer user_data)\n" 18531"{\n" 18532"\tGtkWidget *image = GTK_WIDGET (user_data);\n" 18533"\tGtkWidget *toplevel = gtk_widget_get_toplevel (image);\n" 18534"\tGtkFileFilter *filter = gtk_file_filter_new ();\n" 18535"\tGtkWidget *dialog = gtk_file_chooser_dialog_new (_(\"Open image\"),\n" 18536"\t GTK_WINDOW (toplevel),\n" 18537"\t GTK_FILE_CHOOSER_ACTION_OPEN,\n" 18538"\t GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,\n" 18539"\t GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,\n" 18540"\t NULL);\n" 18541"\n" 18542"\tgtk_file_filter_add_pixbuf_formats (filter);\n" 18543"\tgtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog),\n" 18544"\t filter);\n" 18545"\n" 18546"\tswitch (gtk_dialog_run (GTK_DIALOG (dialog)))\n" 18547"\t{\n" 18548"\t\tcase GTK_RESPONSE_ACCEPT:\n" 18549"\t\t{\n" 18550"\t\t\tgchar *filename =\n" 18551"\t\t\t\tgtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));\n" 18552"\t\t\tgtk_image_set_from_file (GTK_IMAGE (image), filename);\n" 18553"\t\t\tbreak;\n" 18554"\t\t}\n" 18555"\t\tdefault:\n" 18556"\t\t\tbreak;\n" 18557"\t}\n" 18558"\tgtk_widget_destroy (dialog);\n" 18559"}\n" 18560msgstr "" 18561 18562#. (itstool) path: section/p 18563#: C/image-viewer.c.page:192 C/image-viewer.cpp.page:178 18564#: C/image-viewer.js.page:283 C/image-viewer.py.page:197 18565msgid "" 18566"This is a bit more complicated than anything we've attempted so far, so " 18567"let's break it down:" 18568msgstr "" 18569 18570#. (itstool) path: item/p 18571#: C/image-viewer.c.page:194 18572msgid "" 18573"The first argument of the signal is always the widget that sent the signal. " 18574"Sometimes other arguments related to the signal come after that, but " 18575"<em>clicked</em> doesn't have any. Next is the <code>user_data</code> " 18576"argument which is a pointer to the data we passed when connecting the " 18577"signal. In this case it is our <code>GtkImage</code> object." 18578msgstr "" 18579 18580#. (itstool) path: item/p 18581#: C/image-viewer.c.page:200 18582msgid "" 18583"The next interesting line is where the dialog for choosing the file is " 18584"created using <code>gtk_file_chooser_dialog_new</code>. The function takes " 18585"the title of the dialog, the parent window of the dialog and several options " 18586"like the number of buttons and their corresponding values." 18587msgstr "" 18588 18589#. (itstool) path: item/p 18590#: C/image-viewer.c.page:204 C/image-viewer.cpp.page:186 18591#: C/image-viewer.js.page:290 C/image-viewer.py.page:204 18592msgid "" 18593"Notice that we are using <em>stock</em> button names from Gtk, instead of " 18594"manually typing \"Cancel\" or \"Open\". The advantage of using stock names " 18595"is that the button labels will already be translated into the user's " 18596"language." 18597msgstr "" 18598 18599#. (itstool) path: item/p 18600#: C/image-viewer.c.page:207 18601msgid "" 18602"The next two lines restrict the <gui>Open</gui> dialog to only display files " 18603"which can be opened by GtkImage. A filter object is created first; we then " 18604"add all kinds of files supported by <code>GdkPixbuf</code> (which includes " 18605"most image formats like PNG and JPEG) to the filter. Finally, we set this " 18606"filter to be the <gui>Open</gui> dialog's filter." 18607msgstr "" 18608 18609#. (itstool) path: item/p 18610#: C/image-viewer.c.page:210 18611msgid "" 18612"<code>gtk_dialog_run</code> displays the <gui>Open</gui> dialog. The dialog " 18613"will wait for the user to choose an image; when they do, " 18614"<code>gtk_dialog_run</code> will return the value <code>GTK_RESPONSE_ACCEPT</" 18615"code> (it would return <code>GTK_RESPONSE_CANCEL</code> if the user clicked " 18616"<gui>Cancel</gui>). The <code>switch</code> statement tests for this." 18617msgstr "" 18618 18619#. (itstool) path: item/p 18620#: C/image-viewer.c.page:212 18621msgid "" 18622"Assuming that the user did click <gui>Open</gui>, the next line sets the " 18623"<code>file</code> property of the GtkImage to the filename of the image " 18624"selected by the user. The GtkImage will then load and display the chosen " 18625"image." 18626msgstr "" 18627 18628#. (itstool) path: item/p 18629#: C/image-viewer.c.page:215 18630msgid "" 18631"In the final line of this method, we destroy the <gui>Open</gui> dialog " 18632"because we don't need it any more. Destroying automatically hides the dialog." 18633msgstr "" 18634 18635#. (itstool) path: section/p 18636#: C/image-viewer.c.page:224 C/image-viewer.cpp.page:212 18637msgid "" 18638"If you haven't already done so, choose the <file>Debug/src/image-viewer</" 18639"file> application in the dialog that appears. Finally, hit <gui>Run</gui> " 18640"and enjoy!" 18641msgstr "" 18642 18643#. (itstool) path: section/p 18644#: C/image-viewer.c.page:229 18645msgid "" 18646"If you run into problems with the tutorial, compare your code with this " 18647"<link href=\"image-viewer/image-viewer.c\">reference code</link>." 18648msgstr "" 18649 18650#. (itstool) path: item/p 18651#: C/image-viewer.c.page:237 C/image-viewer.cpp.page:225 18652#: C/image-viewer.js.page:325 C/image-viewer.py.page:239 18653#: C/image-viewer.vala.page:298 18654msgid "" 18655"Have the user select a directory rather than a file, and provide controls to " 18656"cycle through all of the images in a directory." 18657msgstr "" 18658 18659#. (itstool) path: item/p 18660#: C/image-viewer.c.page:240 C/image-viewer.cpp.page:228 18661#: C/image-viewer.js.page:328 C/image-viewer.py.page:242 18662#: C/image-viewer.vala.page:301 18663msgid "" 18664"Apply random filters and effects to the image when it is loaded and allow " 18665"the user to save the modified image." 18666msgstr "" 18667 18668#. (itstool) path: item/p 18669#: C/image-viewer.c.page:241 C/image-viewer.cpp.page:229 18670#: C/image-viewer.js.page:329 C/image-viewer.py.page:243 18671#: C/image-viewer.vala.page:302 18672msgid "" 18673"<link href=\"http://www.gegl.org/api.html\">GEGL</link> provides powerful " 18674"image manipulation capabilities." 18675msgstr "" 18676 18677#. (itstool) path: item/p 18678#: C/image-viewer.c.page:244 C/image-viewer.cpp.page:232 18679#: C/image-viewer.js.page:332 C/image-viewer.py.page:246 18680#: C/image-viewer.vala.page:305 18681msgid "" 18682"Allow the user to load images from network shares, scanners, and other more " 18683"complicated sources." 18684msgstr "" 18685 18686#. (itstool) path: item/p 18687#: C/image-viewer.c.page:245 C/image-viewer.cpp.page:233 18688#: C/image-viewer.js.page:333 C/image-viewer.py.page:247 18689#: C/image-viewer.vala.page:306 18690msgid "" 18691"You can use <link href=\"http://library.gnome.org/devel/gio/unstable/\">GIO</" 18692"link> to handle network file transfers and the like, and <link href=\"http://" 18693"library.gnome.org/devel/gnome-scan/unstable/\">GNOME Scan</link> to handle " 18694"scanning." 18695msgstr "" 18696 18697#. (itstool) path: info/desc 18698#: C/image-viewer.cpp.page:9 18699msgid "A little bit more than a simple \"Hello world\" GTKmm application." 18700msgstr "" 18701 18702#. (itstool) path: item/p 18703#: C/image-viewer.cpp.page:32 18704msgid "Some basic concepts of C++/GObject programming" 18705msgstr "" 18706 18707#. (itstool) path: item/p 18708#: C/image-viewer.cpp.page:33 18709msgid "How to write a Gtk application in C++" 18710msgstr "" 18711 18712#. (itstool) path: item/p 18713#: C/image-viewer.cpp.page:47 18714msgid "" 18715"Choose <gui>GTKmm (Simple)</gui> from the <gui>C++</gui> tab, click " 18716"<gui>Forward</gui>, and fill out your details on the next few pages. Use " 18717"<file>image-viewer</file> as project name and directory." 18718msgstr "" 18719 18720#. (itstool) path: item/p 18721#: C/image-viewer.cpp.page:50 18722msgid "" 18723"Make sure that <gui>Use GtkBuilder for user interface</gui> is disabled as " 18724"we will create the UI manually in this tutorial. Check the <link xref=" 18725"\"guitar-tuner.cpp\">Guitar-Tuner</link> tutorial if you want to learn how " 18726"to use the interface builder." 18727msgstr "" 18728 18729#. (itstool) path: item/p 18730#: C/image-viewer.cpp.page:55 18731msgid "" 18732"Click <gui>Apply</gui> and the project will be created for you. Open " 18733"<file>src/main.cc</file> from the <gui>Project</gui> or <gui>File</gui> " 18734"tabs. You should see some code which starts with the lines:" 18735msgstr "" 18736 18737#. (itstool) path: item/code 18738#: C/image-viewer.cpp.page:56 18739#, no-wrap 18740msgid "" 18741"\n" 18742"#include <gtkmm.h>\n" 18743"#include <iostream>\n" 18744"\n" 18745"#include \"config.h\">" 18746msgstr "" 18747 18748#. (itstool) path: item/p 18749#: C/image-viewer.cpp.page:70 18750msgid "" 18751"The three <code>#include</code> lines at the top include the <code>config</" 18752"code> (useful autoconf build defines), <code>gtkmm</code> (user interface) " 18753"and <code>iostream</code> (C++-STL) libraries. Functions from these " 18754"libraries are used in the rest of the code." 18755msgstr "" 18756 18757#. (itstool) path: item/p 18758#: C/image-viewer.cpp.page:73 18759msgid "" 18760"The <code>main</code> function creates a new (empty) window and sets the " 18761"window title." 18762msgstr "" 18763 18764#. (itstool) path: item/p 18765#: C/image-viewer.cpp.page:76 18766msgid "" 18767"The <code>kit::run()</code> call starts the GTKmm main loop, which runs the " 18768"user interface and starts listening for events (like clicks and key " 18769"presses). As we give the window as an argument to that function, the " 18770"application will automatically exit when that window is closed." 18771msgstr "" 18772 18773#. (itstool) path: section/p 18774#: C/image-viewer.cpp.page:88 18775msgid "" 18776"Now we will bring life into the empty window. GTKmm organizes the user " 18777"interface with <code>Gtk::Container</code>s that can contain other widgets " 18778"and even other containers. Here we will use the simplest available " 18779"container, a <code>Gtk::Box</code>:" 18780msgstr "" 18781 18782#. (itstool) path: section/code 18783#: C/image-viewer.cpp.page:91 18784#, no-wrap 18785msgid "" 18786"\n" 18787"int\n" 18788"main (int argc, char *argv[])\n" 18789"{\n" 18790"\tGtk::Main kit(argc, argv);\n" 18791"\n" 18792"\tGtk::Window main_win;\n" 18793"\tmain_win.set_title (\"image-viewer-cpp\");\n" 18794"\n" 18795"\tGtk::Box* box = Gtk::manage(new Gtk::Box());\n" 18796"\tbox->set_orientation (Gtk::ORIENTATION_VERTICAL);\n" 18797"\tbox->set_spacing(6);\n" 18798"\tmain_win.add(*box);\n" 18799"\n" 18800"\timage = Gtk::manage(new Gtk::Image());\n" 18801"\tbox->pack_start (*image, true, true);\n" 18802"\n" 18803"\tGtk::Button* button = Gtk::manage(new Gtk::Button(\"Open Image…\"));\n" 18804"\tbutton->signal_clicked().connect (\n" 18805"\t\tsigc::ptr_fun(&on_open_image));\n" 18806"\tbox->pack_start (*button, false, false);\n" 18807"\n" 18808"\tmain_win.show_all_children();\n" 18809"\tkit.run(main_win);\n" 18810"\n" 18811"\treturn 0;\n" 18812"}\n" 18813msgstr "" 18814 18815#. (itstool) path: item/p 18816#: C/image-viewer.cpp.page:121 18817msgid "" 18818"The first lines create the widgets we want to use: a button for opening up " 18819"an image, the image view widget itself and the box we will use as a " 18820"container." 18821msgstr "" 18822 18823#. (itstool) path: item/p 18824#: C/image-viewer.cpp.page:124 18825msgid "" 18826"The calls to <code>pack_start</code> add the two widgets to the box and " 18827"define their behaviour. The image will expand into any available space while " 18828"the button will just be as big as needed. You will notice that we don't set " 18829"explicit sizes on the widgets. In GTKmm this is usually not needed as it " 18830"makes it much easier to have a layout that looks good in different window " 18831"sizes. Next, the box is added to the window." 18832msgstr "" 18833 18834#. (itstool) path: item/p 18835#: C/image-viewer.cpp.page:130 18836msgid "" 18837"We need to define what happens when the user clicks on the button. GTKmm " 18838"uses the concept of <em>signals</em>. When the button is clicked, it fires " 18839"the <em>clicked</em> signal, which we can connect to some action. This is " 18840"done using the <code>signal_clicked().connect</code> method which tells " 18841"GTKmm to call the <code>on_open_image</code> function when the button is " 18842"clicked. We will define the <em>callback</em> in the next section." 18843msgstr "" 18844 18845#. (itstool) path: item/p 18846#: C/image-viewer.cpp.page:134 18847msgid "" 18848"The last step is to show all widgets in the window using " 18849"<code>show_all_children()</code>. This is equivalent to using the " 18850"<code>show()</code> method on all our child widgets." 18851msgstr "" 18852 18853#. (itstool) path: section/p 18854#: C/image-viewer.cpp.page:143 18855msgid "" 18856"We will now define the signal handler for the <em>clicked</em> signal or the " 18857"button we mentioned before. Add this code before the <code>main</code> " 18858"method." 18859msgstr "" 18860 18861#. (itstool) path: section/code 18862#: C/image-viewer.cpp.page:146 18863#, no-wrap 18864msgid "" 18865"\n" 18866"Gtk::Image* image = 0;\n" 18867"\n" 18868"static void\n" 18869"on_open_image ()\n" 18870"{\n" 18871"\tGtk::FileChooserDialog dialog(\"Open image\",\n" 18872"\t Gtk::FILE_CHOOSER_ACTION_OPEN);\n" 18873"\tdialog.add_button (Gtk::Stock::OPEN,\n" 18874"\t Gtk::RESPONSE_ACCEPT);\n" 18875"\tdialog.add_button (Gtk::Stock::CANCEL,\n" 18876"\t Gtk::RESPONSE_CANCEL);\n" 18877"\n" 18878"\tGlib::RefPtr<Gtk::FileFilter> filter =\n" 18879"\t\tGtk::FileFilter::create();\n" 18880"\tfilter->add_pixbuf_formats();\n" 18881"\tfilter->set_name(\"Images\");\n" 18882"\tdialog.add_filter (filter);\n" 18883"\n" 18884"\tconst int response = dialog.run();\n" 18885"\tdialog.hide();\n" 18886"\n" 18887"\tswitch (response)\n" 18888"\t{\n" 18889"\t\tcase Gtk::RESPONSE_ACCEPT:\n" 18890"\t\t\timage->set(dialog.get_filename());\n" 18891"\t\t\tbreak;\n" 18892"\t\tdefault:\n" 18893"\t\t\tbreak;\n" 18894"\t}\n" 18895"}\n" 18896msgstr "" 18897 18898#. (itstool) path: item/p 18899#: C/image-viewer.cpp.page:181 18900msgid "" 18901"The dialog for choosing the file is created using the <code>Gtk::" 18902"FileChooserDialog</code> constructor. This takes the title and type of the " 18903"dialog. In our case, it is an <em>Open</em> dialog." 18904msgstr "" 18905 18906#. (itstool) path: item/p 18907#: C/image-viewer.cpp.page:185 18908msgid "" 18909"The next two lines add an <em>Open</em> and a <em>Close</em> button to the " 18910"dialog." 18911msgstr "" 18912 18913#. (itstool) path: item/p 18914#: C/image-viewer.cpp.page:187 18915msgid "" 18916"The second argument to the <code>add_button()</code> method is a value to " 18917"identify the clicked button. We use predefined values provided by GTKmm " 18918"here, too." 18919msgstr "" 18920 18921#. (itstool) path: item/p 18922#: C/image-viewer.cpp.page:192 18923msgid "" 18924"The next two lines restrict the <gui>Open</gui> dialog to only display files " 18925"which can be opened by <code>Gtk::Image</code>. A filter object is created " 18926"first; we then add all kinds of files supported by <code>Gdk::Pixbuf</code> " 18927"(which includes most image formats like PNG and JPEG) to the filter. " 18928"Finally, we set this filter to be the <gui>Open</gui> dialog's filter." 18929msgstr "" 18930 18931#. (itstool) path: item/p 18932#: C/image-viewer.cpp.page:193 18933msgid "" 18934"<code>Glib::RefPtr</code> is a smart pointer used here, that makes sure that " 18935"the filter is destroyed when there is no reference to it anymore." 18936msgstr "" 18937 18938#. (itstool) path: item/p 18939#: C/image-viewer.cpp.page:197 18940msgid "" 18941"<code>dialog.run</code> displays the <gui>Open</gui> dialog. The dialog will " 18942"wait for the user to choose an image; when they do, <code>dialog.run</code> " 18943"will return the value <code>Gtk::RESPONSE_ACCEPT</code> (it would return " 18944"<code>Gtk::RESPONSE_CANCEL</code> if the user clicked <gui>Cancel</gui>). " 18945"The <code>switch</code> statement tests for this." 18946msgstr "" 18947 18948#. (itstool) path: item/p 18949#: C/image-viewer.cpp.page:200 18950msgid "" 18951"We hide the <gui>Open</gui> dialog because we don't need it any more. The " 18952"dialog would be hidden later anyway, as it is only a local variable and is " 18953"destroyed (and therefore hidden) when the scope ends." 18954msgstr "" 18955 18956#. (itstool) path: item/p 18957#: C/image-viewer.cpp.page:203 18958msgid "" 18959"Assuming that the user did click <gui>Open</gui>, the next line loads the " 18960"file into the <code>Gtk::Image</code> so that it is displayed." 18961msgstr "" 18962 18963#. (itstool) path: section/p 18964#: C/image-viewer.cpp.page:217 18965msgid "" 18966"If you run into problems with the tutorial, compare your code with this " 18967"<link href=\"image-viewer/image-viewer.cc\">reference code</link>." 18968msgstr "" 18969 18970#. (itstool) path: info/title 18971#: C/image-viewer.js.page:8 18972#, fuzzy 18973msgctxt "text" 18974msgid "Image viewer (JavaScript)" 18975msgstr "Visualizador de imagens gThumb" 18976 18977#. (itstool) path: info/desc 18978#: C/image-viewer.js.page:11 18979msgid "" 18980"A little bit more than a simple \"Hello world\" application - write an image " 18981"viewer in GTK+. Includes an introduction to the JavaScript language." 18982msgstr "" 18983 18984#. (itstool) path: credit/name 18985#: C/image-viewer.js.page:15 C/image-viewer.py.page:15 18986msgid "Jonh Wendell" 18987msgstr "" 18988 18989#. (itstool) path: synopsis/p 18990#: C/image-viewer.js.page:32 C/image-viewer.py.page:32 18991msgid "" 18992"In this tutorial, we're going to write a very simple GTK application that " 18993"loads and displays an image file. You will learn how to:" 18994msgstr "" 18995 18996#. (itstool) path: item/p 18997#: C/image-viewer.js.page:34 18998msgid "Write a basic GTK user interface in JavaScript" 18999msgstr "" 19000 19001#. (itstool) path: item/p 19002#: C/image-viewer.js.page:35 C/image-viewer.py.page:35 19003msgid "Deal with events by connecting signals to signal handlers" 19004msgstr "" 19005 19006#. (itstool) path: item/p 19007#: C/image-viewer.js.page:36 C/image-viewer.py.page:36 19008msgid "Lay out GTK user interfaces using containers" 19009msgstr "" 19010 19011#. (itstool) path: item/p 19012#: C/image-viewer.js.page:37 C/image-viewer.py.page:37 19013#, fuzzy 19014msgid "Load and display image files" 19015msgstr "Nome de arquivo a ser carregado e exibido" 19016 19017#. (itstool) path: item/p 19018#: C/image-viewer.js.page:42 19019msgid "An installed copy of the <em>gjs</em> interpreter" 19020msgstr "" 19021 19022#. (itstool) path: item/p 19023#: C/image-viewer.js.page:43 19024msgid "Basic knowledge of any object-orientated programming language" 19025msgstr "" 19026 19027#. (itstool) path: item/p 19028#: C/image-viewer.js.page:57 19029msgid "" 19030"Choose <gui>Generic Javascript</gui> from the <gui>JS</gui> tab, click " 19031"<gui>Forward</gui>, and fill out your details on the next few pages. Use " 19032"<file>image-viewer</file> as project name and directory." 19033msgstr "" 19034 19035#. (itstool) path: item/p 19036#: C/image-viewer.js.page:60 19037msgid "" 19038"Click <gui>Apply</gui> and the project will be created for you. Open " 19039"<file>src/main.js</file> from the <gui>Project</gui> or <gui>File</gui> " 19040"tabs. It contains very basic example code." 19041msgstr "" 19042 19043#. (itstool) path: section/title 19044#: C/image-viewer.js.page:67 19045#, fuzzy 19046msgid "JavaScript basics: Hello World" 19047msgstr "Olá mundo exemplo" 19048 19049#. (itstool) path: section/p 19050#: C/image-viewer.js.page:68 19051msgid "" 19052"Before we start writing the image viewer, let's find out more about the way " 19053"JavaScript is used in GNOME. Of course, your very first contact with any " 19054"programming language should be the Hello World program which can already be " 19055"found in <file>main.js</file>:" 19056msgstr "" 19057 19058#. (itstool) path: section/code 19059#: C/image-viewer.js.page:69 19060#, fuzzy, no-wrap 19061msgid "print (\"Hello world!\");" 19062msgstr "Olá mundo exemplo" 19063 19064#. (itstool) path: section/p 19065#: C/image-viewer.js.page:70 19066msgid "" 19067"This should look quite natural if you're familiar with almost any other " 19068"programming language. The function <code>print</code> is called with the " 19069"argument <code>\"Hello world!\"</code>, which will be printed on the screen. " 19070"Note that each line of code ends with a semicolon." 19071msgstr "" 19072 19073#. (itstool) path: section/title 19074#: C/image-viewer.js.page:74 19075#, fuzzy 19076msgid "Classes in JavaScript" 19077msgstr "JavaScript" 19078 19079#. (itstool) path: section/p 19080#: C/image-viewer.js.page:75 19081msgid "This is the standard way to define a class in JavaScript:" 19082msgstr "" 19083 19084#. (itstool) path: section/code 19085#: C/image-viewer.js.page:76 19086#, no-wrap 19087msgid "" 19088"\n" 19089"function MyClass () {\n" 19090" this._init ();\n" 19091"}\n" 19092"\n" 19093"MyClass.prototype = {\n" 19094"\n" 19095" _init: function () {\n" 19096" this.propertyA = \"This is an object's field\";\n" 19097" this.propertyB = 10;\n" 19098" },\n" 19099"\n" 19100" aMethod: function (arg1, arg2) {\n" 19101" print (\"inside aMethod: \" + arg1 + \" \" + arg2);\n" 19102" },\n" 19103"\n" 19104" dumpProperties: function () {\n" 19105" print (this.propertyA);\n" 19106" print (this.propertyB);\n" 19107" }\n" 19108"\n" 19109"}" 19110msgstr "" 19111 19112#. (itstool) path: section/p 19113#: C/image-viewer.js.page:98 19114msgid "" 19115"This defines a class called <code>MyClass</code>. Let's go through each part " 19116"of the class definition:" 19117msgstr "" 19118 19119#. (itstool) path: item/p 19120#: C/image-viewer.js.page:101 19121msgid "" 19122"<code>function MyClass</code> is the constructor of the class — its name " 19123"must match the class's name. You can access any member of the class by using " 19124"the <code>this</code> object; here, the constructor calls the class's " 19125"<code>_init</code> method." 19126msgstr "" 19127 19128#. (itstool) path: item/p 19129#: C/image-viewer.js.page:104 19130msgid "" 19131"The <code>MyClass.prototype</code> block is where you define the " 19132"<em>structure</em> of the class. Each class is made up of methods " 19133"(functions) and fields (variables); there are three methods and two fields " 19134"in this example." 19135msgstr "" 19136 19137#. (itstool) path: item/p 19138#: C/image-viewer.js.page:107 19139msgid "" 19140"The first method defined here is called <code>_init</code>, and we specify " 19141"that it is a function with no arguments:" 19142msgstr "" 19143 19144#. (itstool) path: item/code 19145#: C/image-viewer.js.page:108 19146#, fuzzy, no-wrap 19147msgid "_init: function ()" 19148msgstr "Uma função <function>init()</function> personalizada" 19149 19150#. (itstool) path: item/p 19151#: C/image-viewer.js.page:109 19152msgid "" 19153"We write the function inside some curly braces. Two fields are defined here, " 19154"<code>propertyA</code> and <code>propertyB</code>. The first is set to a " 19155"string and the second is set to an integer (10). The function doesn't return " 19156"any value." 19157msgstr "" 19158 19159#. (itstool) path: item/p 19160#: C/image-viewer.js.page:112 19161msgid "" 19162"The next method is called <code>aMethod</code> and has two arguments, which " 19163"it prints out when you call it. The final method is <code>dumpProperties</" 19164"code>, and prints the fields <code>propertyA</code> and <code>propertyB</" 19165"code>." 19166msgstr "" 19167 19168#. (itstool) path: item/p 19169#: C/image-viewer.js.page:115 19170msgid "" 19171"Note how the class definition (prototype) is arranged; each function " 19172"definition is separated by a comma." 19173msgstr "" 19174 19175#. (itstool) path: section/p 19176#: C/image-viewer.js.page:119 19177msgid "Now that MyClass has been defined, we can play with it:" 19178msgstr "" 19179 19180#. (itstool) path: section/code 19181#: C/image-viewer.js.page:120 19182#, no-wrap 19183msgid "" 19184"\n" 19185"var o = new MyClass ();\n" 19186"o.aMethod (\"Hello\", \"world\");\n" 19187"o.propertyA = \"Just changed its value!\";\n" 19188"o.dumpProperties ();" 19189msgstr "" 19190 19191#. (itstool) path: section/p 19192#: C/image-viewer.js.page:125 19193msgid "" 19194"This code creates a new instance of the class called <code>o</code>, runs " 19195"<code>aMethod</code>, changes <code>propertyA</code> to a different string, " 19196"and then calls <code>dumpProperties</code> (which outputs the fields)." 19197msgstr "" 19198 19199#. (itstool) path: section/p 19200#: C/image-viewer.js.page:126 19201msgid "" 19202"Save the code in the <file>main.js</file> and then run it by using " 19203"<guiseq><gui>Run</gui><gui>Execute</gui></guiseq> from the menu or using the " 19204"toolbar." 19205msgstr "" 19206 19207#. (itstool) path: section/title 19208#: C/image-viewer.js.page:131 C/image-viewer.py.page:70 19209#, fuzzy 19210msgid "A first Gtk application" 19211msgstr "GTK+ (Aplicativo)" 19212 19213#. (itstool) path: section/p 19214#: C/image-viewer.js.page:132 19215msgid "Let's see what a very basic Gtk application looks like in JavaScript:" 19216msgstr "" 19217 19218#. (itstool) path: section/code 19219#: C/image-viewer.js.page:133 19220#, no-wrap 19221msgid "" 19222"\n" 19223"const Gtk = imports.gi.Gtk;\n" 19224"\n" 19225"Gtk.init (null, null);\n" 19226"\n" 19227"var w = new Gtk.Window ({title: \"Image Viewer Demo\"});\n" 19228"w.show ();\n" 19229"\n" 19230"Gtk.main ();" 19231msgstr "" 19232 19233#. (itstool) path: section/p 19234#: C/image-viewer.js.page:142 C/image-viewer.py.page:95 19235msgid "Let's take a look at what's happening:" 19236msgstr "" 19237 19238#. (itstool) path: item/p 19239#: C/image-viewer.js.page:145 C/image-viewer.py.page:98 19240msgid "" 19241"The first line imports the Gtk namespace (that is, it includes the Gtk " 19242"library). The libraries are provided by GObject Introspection (gi), which " 19243"provides language bindings for many GNOME libraries." 19244msgstr "" 19245 19246#. (itstool) path: item/p 19247#: C/image-viewer.js.page:148 19248msgid "" 19249"<code>Gtk.init</code> initializes the Gtk library; this statement is " 19250"mandatory for all Gtk programs." 19251msgstr "" 19252 19253#. (itstool) path: item/p 19254#: C/image-viewer.js.page:151 19255msgid "" 19256"The next line creates the main window by creating a new <code>Gtk.Window</" 19257"code> object. You can pass several properties to the window's constructor by " 19258"using the syntax <code>{property: value, property: value, ...}</code>. In " 19259"this case we are setting the title of the window." 19260msgstr "" 19261 19262#. (itstool) path: item/p 19263#: C/image-viewer.js.page:152 19264msgid "" 19265"The next line explicitly shows the window. In Gtk, every widget is hidden by " 19266"default." 19267msgstr "" 19268 19269#. (itstool) path: item/p 19270#: C/image-viewer.js.page:153 19271msgid "" 19272"Finally, <code>Gtk.main</code> runs the main loop — in other words, it " 19273"executes the program. The main loop listens for events (signals) from the " 19274"user interface and then calls a signal handler which will do something " 19275"useful. We'll learn more about signals shortly." 19276msgstr "" 19277 19278#. (itstool) path: section/p 19279#: C/image-viewer.js.page:156 19280msgid "" 19281"Save the code in <file>main.js</file> and run it. You will notice that the " 19282"application does not quit when you close the window. This is because we " 19283"haven't set up a signal handler to deal with the window's <code>destroy</" 19284"code> (close) signal yet. We'll do this shortly, but for now you can just " 19285"hit <keyseq><key>Ctrl</key><key>C</key></keyseq> in the terminal window to " 19286"quit the program." 19287msgstr "" 19288 19289#. (itstool) path: section/title 19290#: C/image-viewer.js.page:161 19291#, fuzzy 19292msgid "Adding classes" 19293msgstr "CLASSES" 19294 19295#. (itstool) path: section/p 19296#: C/image-viewer.js.page:162 19297msgid "" 19298"The proper way of doing Gtk programming is by using classes. Let's rewrite " 19299"the simple code you just wrote using classes:" 19300msgstr "" 19301 19302#. (itstool) path: section/code 19303#: C/image-viewer.js.page:163 19304#, no-wrap 19305msgid "" 19306"\n" 19307"const Gtk = imports.gi.Gtk;\n" 19308"\n" 19309"function ImageViewer () {\n" 19310" this._init ();\n" 19311"}\n" 19312"\n" 19313"ImageViewer.prototype = {\n" 19314" _init: function () {\n" 19315" this.window = new Gtk.Window ({title: \"Image Viewer Demo\"});\n" 19316" this.window.show ();\n" 19317" }\n" 19318"}\n" 19319"\n" 19320"Gtk.init (null, null);\n" 19321"var iv = new ImageViewer ();\n" 19322"Gtk.main ();" 19323msgstr "" 19324 19325#. (itstool) path: section/p 19326#: C/image-viewer.js.page:181 19327msgid "" 19328"Notice that the program is the same; we just moved the window creation code " 19329"to our own <code>ImageViewer</code> class. The class's constructor calls the " 19330"<code>_init</code> method, which creates and shows the window. We then " 19331"create an instance of the class before running the main loop (<code>Gtk." 19332"main</code>)." 19333msgstr "" 19334 19335#. (itstool) path: section/p 19336#: C/image-viewer.js.page:182 19337msgid "" 19338"This code is modular and can be split into multiple files easily. This makes " 19339"it cleaner and easier to read." 19340msgstr "" 19341 19342#. (itstool) path: section/title 19343#: C/image-viewer.js.page:186 C/image-viewer.py.page:119 19344#, fuzzy 19345msgid "Signals" 19346msgstr "Sinais" 19347 19348#. (itstool) path: section/p 19349#: C/image-viewer.js.page:187 C/image-viewer.py.page:120 19350msgid "" 19351"Signals are one of the key concepts in Gtk programming. Whenever something " 19352"happens to an object, it emits a signal; for example, when a button is " 19353"clicked it gives off the <code>clicked</code> signal. If you want your " 19354"program to do something when that event occurs, you must connect a function " 19355"(a \"signal handler\") to that signal. Here's an example:" 19356msgstr "" 19357 19358#. (itstool) path: section/code 19359#: C/image-viewer.js.page:188 19360#, no-wrap 19361msgid "" 19362"\n" 19363"function button_clicked () {\n" 19364" print (\"you clicked me!\");\n" 19365"}\n" 19366"var b = new Gtk.Button ({label:\"Click me\"});\n" 19367"b.connect (\"clicked\", button_clicked);" 19368msgstr "" 19369 19370#. (itstool) path: section/p 19371#: C/image-viewer.js.page:194 C/image-viewer.py.page:127 19372msgid "" 19373"The last two lines create a <code>Gtk.Button</code> called <code>b</code> " 19374"and connect its <code>clicked</code> signal to the <code>button_clicked</" 19375"code> function, which is defined above. Every time the button is clicked, " 19376"the code in the <code>button_clicked</code> function will be executed. It " 19377"just prints a message here." 19378msgstr "" 19379 19380#. (itstool) path: section/p 19381#: C/image-viewer.js.page:195 19382msgid "The syntax for connecting any signal to a function is:" 19383msgstr "" 19384 19385#. (itstool) path: section/code 19386#: C/image-viewer.js.page:196 19387#, no-wrap 19388msgid "" 19389"\n" 19390"object.connect (<signal_name>, <function_to_be_called>);" 19391msgstr "" 19392 19393#. (itstool) path: section/p 19394#: C/image-viewer.js.page:198 19395msgid "" 19396"You can find signal definitions for any object in the <link href=\"https://" 19397"developer.gnome.org/gtk3/stable/gtkobjects.html\">GTK class reference</link>." 19398msgstr "" 19399 19400#. (itstool) path: note/p 19401#: C/image-viewer.js.page:201 19402msgid "" 19403"You can simplify the code by making use of an inline function definition:" 19404msgstr "" 19405 19406#. (itstool) path: note/code 19407#: C/image-viewer.js.page:202 19408#, no-wrap 19409msgid "" 19410"\n" 19411"b.connect (\"clicked\", function () { print (\"you clicked me!\"); });" 19412msgstr "" 19413 19414#. (itstool) path: section/title 19415#: C/image-viewer.js.page:209 19416#, fuzzy 19417msgid "Closing the window" 19418msgstr "" 19419"Ainda existem processos em execução em algumas abas.\n" 19420"Ao fechar esta janela eles serão eliminados." 19421 19422#. (itstool) path: section/p 19423#: C/image-viewer.js.page:210 19424msgid "" 19425"When you close a Gtk window it's not really closed, it's hidden. This allows " 19426"you to keep the window around (which is useful if you want to ask the user " 19427"if they really want to close the window, for example)." 19428msgstr "" 19429 19430#. (itstool) path: section/p 19431#: C/image-viewer.js.page:211 19432msgid "" 19433"In our case, we really do just want to close the window. The simplest way of " 19434"doing this is by connecting the <code>hide</code> signal of the GtkWindow " 19435"object to a function that closes the application. Go back to the <file>image-" 19436"viewer.js</file> file and add the following code to the <code>_init</code> " 19437"method, on the line above <code>this.window.show</code>:" 19438msgstr "" 19439 19440#. (itstool) path: section/code 19441#: C/image-viewer.js.page:212 19442#, no-wrap 19443msgid "this.window.connect (\"hide\", Gtk.main_quit);" 19444msgstr "" 19445 19446#. (itstool) path: section/p 19447#: C/image-viewer.js.page:213 19448msgid "" 19449"This connects the <code>hide</code> signal of the window to Gtk's " 19450"<code>main_quit</code> function, which ends the execution of the Gtk main " 19451"loop. Once the main loop finishes, the function <code>Gtk.main</code> " 19452"returns. Our program would continue to run any code written after the " 19453"<code>Gtk.main ();</code> line, but since we don't have any code after that " 19454"point, the program just ends." 19455msgstr "" 19456 19457#. (itstool) path: section/title 19458#: C/image-viewer.js.page:217 C/image-viewer.py.page:131 19459msgid "Containers: Laying-out the user interface" 19460msgstr "" 19461 19462#. (itstool) path: section/p 19463#: C/image-viewer.js.page:218 C/image-viewer.py.page:132 19464msgid "" 19465"Widgets (controls, such as buttons and labels) can be arranged in the window " 19466"by making use of <em>containers</em>. You can organize the layout by mixing " 19467"different types of containers, like boxes and grids." 19468msgstr "" 19469 19470#. (itstool) path: section/p 19471#: C/image-viewer.js.page:219 C/image-viewer.py.page:133 19472msgid "" 19473"A <code>Gtk.Window</code> is itself a type of container, but you can only " 19474"put one widget directly into it. We would like to have two widgets, an image " 19475"and a button, so we must put a \"higher-capacity\" container inside the " 19476"window to hold the other widgets. A number of <link href=\"http://library." 19477"gnome.org/devel/gtk/stable/GtkContainer.html\">container types</link> are " 19478"available, but we will use a <code>Gtk.Box</code> here. A <code>Gtk.Box</" 19479"code> can hold several widgets, organized horizontally or vertically. You " 19480"can do more complicated layouts by putting several boxes inside another box " 19481"and so on." 19482msgstr "" 19483 19484#. (itstool) path: note/p 19485#: C/image-viewer.js.page:221 C/image-viewer.py.page:135 19486msgid "" 19487"There is a graphical user interface designer called <app>Glade</app> " 19488"integrated in <app>Anjuta</app> which makes UI design really easy. For this " 19489"simple example, however, we will code everything manually." 19490msgstr "" 19491 19492#. (itstool) path: section/p 19493#: C/image-viewer.js.page:223 19494msgid "" 19495"Let's add the box and widgets to the window. Insert the following code into " 19496"the <code>_init</code> method, immediately above the <code>this.window.show</" 19497"code> line:" 19498msgstr "" 19499 19500#. (itstool) path: section/code 19501#: C/image-viewer.js.page:224 19502#, no-wrap 19503msgid "" 19504"\n" 19505"var main_box = new Gtk.Box ({orientation: Gtk.Orientation.VERTICAL, spacing: 0});\n" 19506"this.window.add (main_box);" 19507msgstr "" 19508 19509#. (itstool) path: section/p 19510#: C/image-viewer.js.page:227 19511msgid "" 19512"The first line creates a <code>Gtk.Box</code> called <code>main_box</code> " 19513"and sets two of its properties: the <code>orientation</code> is set to " 19514"vertical (so widgets are arranged in a column), and the <code>spacing</code> " 19515"between the widgets is set to 0 pixels. The next line then adds the newly-" 19516"created <code>Gtk.Box</code> to the window." 19517msgstr "" 19518 19519#. (itstool) path: section/p 19520#: C/image-viewer.js.page:228 C/image-viewer.py.page:146 19521msgid "" 19522"So far the window only contains an empty <code>Gtk.Box</code>, and if you " 19523"run the program now you will see no changes at all (the <code>Gtk.Box</code> " 19524"is a transparent container, so you can't see that it's there)." 19525msgstr "" 19526 19527#. (itstool) path: section/title 19528#: C/image-viewer.js.page:232 C/image-viewer.py.page:150 19529#, fuzzy 19530msgid "Packing: Adding widgets to the container" 19531msgstr "Opções de empacotamento por recipiente" 19532 19533#. (itstool) path: section/p 19534#: C/image-viewer.js.page:233 19535msgid "" 19536"To add some widgets to the <code>Gtk.Box</code>, insert the following code " 19537"directly below the <code>this.window.add (main_box)</code> line:" 19538msgstr "" 19539 19540#. (itstool) path: section/code 19541#: C/image-viewer.js.page:234 19542#, no-wrap 19543msgid "" 19544"\n" 19545"this.image = new Gtk.Image ();\n" 19546"main_box.pack_start (this.image, true, true, 0);" 19547msgstr "" 19548 19549#. (itstool) path: section/p 19550#: C/image-viewer.js.page:237 19551msgid "" 19552"The first line creates a new <code>Gtk.Image</code> called <code>image</" 19553"code>, which will be used to display an image file. Then, the image widget " 19554"is added (<em>packed</em>) into the <code>main_box</code> container using " 19555"<code>Gtk.Box</code>'s <link href=\"http://library.gnome.org/devel/gtk/" 19556"stable/GtkBox.html#gtk-box-pack-start\"><code>pack_start</code></link> " 19557"method." 19558msgstr "" 19559 19560#. (itstool) path: section/p 19561#: C/image-viewer.js.page:238 19562msgid "" 19563"<code>pack_start</code> takes 4 arguments: the widget that is to be added to " 19564"the <code>Gtk.Box</code> (<code>child</code>); whether the <code>Gtk.Box</" 19565"code> should grow larger when the new widget is added (<code>expand</code>); " 19566"whether the new widget should take up all of the extra space created if the " 19567"<code>Gtk.Box</code> gets bigger (<code>fill</code>); and how much space " 19568"there should be, in pixels, between the widget and its neighbors inside the " 19569"<code>Gtk.Box</code> (<code>padding</code>)." 19570msgstr "" 19571 19572#. (itstool) path: section/p 19573#: C/image-viewer.js.page:239 C/image-viewer.py.page:158 19574msgid "" 19575"Gtk containers (and widgets) dynamically expand to fill the available space, " 19576"if you let them. You don't position widgets by giving them a precise x,y-" 19577"coordinate location in the window; rather, they are positioned relative to " 19578"one another. This makes handling window resizing much easier, and widgets " 19579"should automatically take a sensible size in most situations." 19580msgstr "" 19581 19582#. (itstool) path: section/p 19583#: C/image-viewer.js.page:240 C/image-viewer.py.page:159 19584msgid "" 19585"Also note how the widgets are organized in a hierarchy. Once packed in the " 19586"<code>Gtk.Box</code>, the <code>Gtk.Image</code> is considered a <em>child</" 19587"em> of the <code>Gtk.Box</code>. This allows you to treat all of the " 19588"children of a widget as a group; for example, you could hide the <code>Gtk." 19589"Box</code>, which would also hide all of its children at the same time." 19590msgstr "" 19591 19592#. (itstool) path: section/p 19593#: C/image-viewer.js.page:241 C/image-viewer.py.page:160 19594msgid "Now insert these two lines, below the two you just added:" 19595msgstr "" 19596 19597#. (itstool) path: section/code 19598#: C/image-viewer.js.page:242 19599#, no-wrap 19600msgid "" 19601"\n" 19602"var open_button = new Gtk.Button ({label: \"Open a picture...\"});\n" 19603"main_box.pack_start (open_button, false, false, 0);" 19604msgstr "" 19605 19606#. (itstool) path: section/p 19607#: C/image-viewer.js.page:245 19608msgid "" 19609"These lines are similar to the first two, but this time they create a " 19610"<code>Gtk.Button</code> and add it to <code>main_box</code>. Notice that we " 19611"are setting the <code>expand</code> argument (the second one) to " 19612"<code>false</code> here, whereas it was set to <code>true</code> for the " 19613"<code>Gtk.Image</code>. This will cause the image to take up all available " 19614"space and the button to take only the space it needs. When you maximize the " 19615"window, the button size will remain the same, but the image size will " 19616"increase, taking up all of the rest of the window." 19617msgstr "" 19618 19619#. (itstool) path: section/p 19620#: C/image-viewer.js.page:246 19621msgid "" 19622"Finally, we must change the <code>this.window.show ();</code> line to read:" 19623msgstr "" 19624 19625#. (itstool) path: section/code 19626#: C/image-viewer.js.page:247 19627#, fuzzy, no-wrap 19628msgid "this.window.show_all ();" 19629msgstr "De _modo algum" 19630 19631#. (itstool) path: section/p 19632#: C/image-viewer.js.page:248 19633msgid "" 19634"This will show the child of the Gtk window, and all of its children, and its " 19635"children's children, and so on. (Remember that Gtk widgets are all hidden by " 19636"default.)" 19637msgstr "" 19638 19639#. (itstool) path: section/title 19640#: C/image-viewer.js.page:252 C/image-viewer.py.page:169 19641msgid "" 19642"Loading the image: Connecting to the button's <code>clicked</code> signal" 19643msgstr "" 19644 19645#. (itstool) path: section/p 19646#: C/image-viewer.js.page:253 19647msgid "" 19648"When the user clicks on the <gui>Open</gui> button, a dialog should appear " 19649"so that the user can choose a picture. Once chosen, the picture should be " 19650"loaded and shown in the image widget." 19651msgstr "" 19652 19653#. (itstool) path: section/p 19654#: C/image-viewer.js.page:254 19655msgid "" 19656"The first step is to connect the <code>clicked</code> signal of the button " 19657"to a signal handler function, which we call <code>_openClicked</code>. Put " 19658"this code immediately after the <code>var open_button = new Gtk.Button</" 19659"code> line where the button was created:" 19660msgstr "" 19661 19662#. (itstool) path: section/code 19663#: C/image-viewer.js.page:255 19664#, no-wrap 19665msgid "" 19666"\n" 19667"open_button.connect (\"clicked\", Lang.bind (this, this._openClicked));" 19668msgstr "" 19669 19670#. (itstool) path: section/p 19671#: C/image-viewer.js.page:257 19672msgid "" 19673"We are using the <em>Lang</em> JavaScript helper here. It allows us to " 19674"connect a <em>class method</em> to the signal, rather than a plain function " 19675"(without a class) which we had used before for the window's <code>hide</" 19676"code> signal. Don't worry about this for now, it's just a technical detail. " 19677"For it to work, you also need to put the following line at the top of the " 19678"file:" 19679msgstr "" 19680 19681#. (itstool) path: section/code 19682#: C/image-viewer.js.page:258 19683#, fuzzy, no-wrap 19684msgid "const Lang = imports.lang;" 19685msgstr "" 19686"\n" 19687"#!/usr/bin/gjs\n" 19688"\n" 19689"const Gtk = imports.gi.Gtk;\n" 19690"const Lang = imports.lang;\n" 19691 19692#. (itstool) path: section/title 19693#: C/image-viewer.js.page:262 C/image-viewer.py.page:180 19694msgid "Loading the image: Writing the signal's callback" 19695msgstr "" 19696 19697#. (itstool) path: section/p 19698#: C/image-viewer.js.page:263 19699msgid "" 19700"Now we can create the <code>_openClicked()</code> method. Insert the " 19701"following into the <code>ImageViewer.prototype</code> code block, after the " 19702"<code>_init</code> method (and not forgetting the comma):" 19703msgstr "" 19704 19705#. (itstool) path: section/code 19706#: C/image-viewer.js.page:264 19707#, no-wrap 19708msgid "" 19709"\n" 19710" _openClicked: function () {\n" 19711" var chooser = new Gtk.FileChooserDialog ({title: \"Select an image\",\n" 19712" action: Gtk.FileChooserAction.OPEN,\n" 19713" transient_for: this.window,\n" 19714" modal: true});\n" 19715" chooser.add_button (Gtk.STOCK_CANCEL, 0);\n" 19716" chooser.add_button (Gtk.STOCK_OPEN, 1);\n" 19717" chooser.set_default_response (1);\n" 19718"\n" 19719" var filter = new Gtk.FileFilter ();\n" 19720" filter.add_pixbuf_formats ();\n" 19721" chooser.filter = filter;\n" 19722"\n" 19723" if (chooser.run () == 1)\n" 19724" this.image.file = chooser.get_filename ();\n" 19725"\n" 19726" chooser.destroy ();\n" 19727" }" 19728msgstr "" 19729 19730#. (itstool) path: item/p 19731#: C/image-viewer.js.page:286 19732msgid "" 19733"The line beginning with <code>var chooser</code> creates an <gui>Open</gui> " 19734"dialog, which the user can use to choose files. We set four properties: the " 19735"title of the dialog; the action (type) of the dialog (it's an \"open\" " 19736"dialog, but we could have used <code>SAVE</code> if the intention was to " 19737"save a file; <code>transient_for</code>, which sets the parent window of the " 19738"dialog; and <code>modal</code> which, if set to <code>true</code>, prevents " 19739"the user from clicking on another area of the application until the dialog " 19740"is closed." 19741msgstr "" 19742 19743#. (itstool) path: item/p 19744#: C/image-viewer.js.page:289 C/image-viewer.py.page:203 19745msgid "" 19746"The next two lines add <gui>Cancel</gui> and <gui>Open</gui> buttons to the " 19747"dialog. The second argument of the <code>add_button</code> method is the " 19748"(integer) value that is returned when the button is pressed: 0 for " 19749"<gui>Cancel</gui> and 1 for <gui>Open</gui>." 19750msgstr "" 19751 19752#. (itstool) path: item/p 19753#: C/image-viewer.js.page:293 C/image-viewer.py.page:207 19754msgid "" 19755"<code>set_default_response</code> determines the button that will be " 19756"activated if the user double-clicks a file or presses <key>Enter</key>. In " 19757"our case, we are using the <gui>Open</gui> button as default (which has the " 19758"value 1)." 19759msgstr "" 19760 19761#. (itstool) path: item/p 19762#: C/image-viewer.js.page:296 C/image-viewer.py.page:210 19763msgid "" 19764"The next three lines restrict the <gui>Open</gui> dialog to only display " 19765"files which can be opened by <code>Gtk.Image</code>. A filter object is " 19766"created first; we then add all kinds of files supported by <code>Gdk.Pixbuf</" 19767"code> (which includes most image formats like PNG and JPEG) to the filter. " 19768"Finally, we set this filter to be the <gui>Open</gui> dialog's filter." 19769msgstr "" 19770 19771#. (itstool) path: item/p 19772#: C/image-viewer.js.page:299 19773msgid "" 19774"<code>chooser.run</code> displays the <gui>Open</gui> dialog. The dialog " 19775"will wait for the user to choose an image; when they do, <code>chooser.run</" 19776"code> will return the value <output>1</output> (it would return <output>0</" 19777"output> if the user clicked <gui>Cancel</gui>). The <code>if</code> " 19778"statement tests for this." 19779msgstr "" 19780 19781#. (itstool) path: item/p 19782#: C/image-viewer.js.page:301 C/image-viewer.py.page:215 19783msgid "" 19784"Assuming that the user did click <gui>Open</gui>, the next line sets the " 19785"<code>file</code> property of the <code>Gtk.Image</code> to the filename of " 19786"the image selected by the user. The <code>Gtk.Image</code> will then load " 19787"and display the chosen image." 19788msgstr "" 19789 19790#. (itstool) path: item/p 19791#: C/image-viewer.js.page:304 C/image-viewer.py.page:218 19792#: C/image-viewer.vala.page:273 19793msgid "" 19794"In the final line of this method, we destroy the <gui>Open</gui> dialog " 19795"because we don't need it any more." 19796msgstr "" 19797 19798#. (itstool) path: section/p 19799#: C/image-viewer.js.page:312 19800msgid "" 19801"All of the code you need should now be in place, so try running the code. " 19802"That should be it; a fully-functioning image viewer (and a whistlestop tour " 19803"of JavaScript and Gtk) in not much time at all!" 19804msgstr "" 19805 19806#. (itstool) path: section/p 19807#: C/image-viewer.js.page:317 19808msgid "" 19809"If you run into problems with the tutorial, compare your code with this " 19810"<link href=\"image-viewer/image-viewer.js\">reference code</link>." 19811msgstr "" 19812 19813#. (itstool) path: info/title 19814#: C/image-viewer.py.page:8 19815#, fuzzy 19816msgctxt "text" 19817msgid "Image viewer (Python)" 19818msgstr "Visualizador de imagens gThumb" 19819 19820#. (itstool) path: info/desc 19821#: C/image-viewer.py.page:11 19822msgid "" 19823"A little bit more than a simple \"Hello world\" application - write an image " 19824"viewer in GTK." 19825msgstr "" 19826 19827#. (itstool) path: item/p 19828#: C/image-viewer.py.page:34 19829msgid "Write a basic GTK user interface in Python" 19830msgstr "" 19831 19832#. (itstool) path: item/p 19833#: C/image-viewer.py.page:42 19834#, fuzzy 19835msgid "Basic knowledge of the python programming language" 19836msgstr "Linguagem de programação Python" 19837 19838#. (itstool) path: item/p 19839#: C/image-viewer.py.page:56 19840msgid "" 19841"Choose <gui>PyGTK (automake)</gui> from the <gui>Python</gui> tab, click " 19842"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 19843"<file>image-viewer</file> as project name and directory." 19844msgstr "" 19845 19846#. (itstool) path: item/p 19847#: C/image-viewer.py.page:59 19848msgid "" 19849"Be sure to disable <gui>Use GtkBuilder for user interface</gui> as we will " 19850"build the user interface manually in this example. For an example of using " 19851"the interface designer, check the <link xref=\"guitar-tuner.py\">Guitar-" 19852"Tuner demo</link>." 19853msgstr "" 19854 19855#. (itstool) path: item/p 19856#: C/image-viewer.py.page:64 19857msgid "" 19858"Click <gui>Apply</gui> and the project will be created for you. Open " 19859"<file>src/image_viewer.py</file> from the <gui>Project</gui> or <gui>File</" 19860"gui> tabs. It contains very basic example code." 19861msgstr "" 19862 19863#. (itstool) path: section/p 19864#: C/image-viewer.py.page:71 19865msgid "Let's see what a very basic Gtk application looks like in Python:" 19866msgstr "" 19867 19868#. (itstool) path: section/code 19869#: C/image-viewer.py.page:72 19870#, no-wrap 19871msgid "" 19872"\n" 19873"from gi.repository import Gtk, GdkPixbuf, Gdk\n" 19874"import os, sys\n" 19875"\n" 19876"class GUI:\n" 19877"\tdef __init__(self):\n" 19878"\t\twindow = Gtk.Window()\n" 19879"\t\twindow.set_title (\"Hello World\")\n" 19880"\t\twindow.connect_after('destroy', self.destroy)\n" 19881"\n" 19882"\t\twindow.show_all()\n" 19883"\n" 19884"\tdef destroy(window, self):\n" 19885"\t\tGtk.main_quit()\n" 19886"\n" 19887"def main():\n" 19888"\tapp = GUI()\n" 19889"\tGtk.main()\n" 19890"\n" 19891"if __name__ == \"__main__\":\n" 19892" sys.exit(main())\n" 19893"\n" 19894" " 19895msgstr "" 19896 19897#. (itstool) path: item/p 19898#: C/image-viewer.py.page:101 19899msgid "" 19900"In the <code>__init__</code> method of the <code>GUI</code> class creates an " 19901"(empty) <code>Gtk.Window</code>, sets its title and then connects a signal " 19902"to quit the application once the window is closed. That's pretty simple " 19903"overall, more on signals later." 19904msgstr "" 19905 19906#. (itstool) path: item/p 19907#: C/image-viewer.py.page:106 19908msgid "" 19909"Next, <code>destroy</code> is defined which just quits the application. It " 19910"is called by the <code>destroy</code> signal connected above." 19911msgstr "" 19912 19913#. (itstool) path: item/p 19914#: C/image-viewer.py.page:110 19915msgid "The rest of the file does initialisation for Gtk and displays the GUI." 19916msgstr "" 19917 19918#. (itstool) path: section/p 19919#: C/image-viewer.py.page:114 19920msgid "" 19921"This code is ready to run, so try it using <guiseq><gui>Run</" 19922"gui><gui>Execute</gui></guiseq>. It should show you an empty window." 19923msgstr "" 19924 19925#. (itstool) path: section/code 19926#: C/image-viewer.py.page:121 19927#, no-wrap 19928msgid "" 19929"\n" 19930"def button_clicked () :\n" 19931" print \"you clicked me!\"\n" 19932"\n" 19933"b = new Gtk.Button (\"Click me\")\n" 19934"b.connect_after ('clicked', button_clicked)" 19935msgstr "" 19936 19937#. (itstool) path: section/p 19938#: C/image-viewer.py.page:137 19939msgid "" 19940"Let's add the box and widgets to the window. Insert the following code into " 19941"the <code>__init__</code> method, immediately after the <code>window." 19942"connect_after</code> line:" 19943msgstr "" 19944 19945#. (itstool) path: section/code 19946#: C/image-viewer.py.page:138 19947#, no-wrap 19948msgid "" 19949"\n" 19950"box = Gtk.Box()\n" 19951"box.set_spacing (5)\n" 19952"box.set_orientation (Gtk.Orientation.VERTICAL)\n" 19953"window.add (box)\n" 19954"\n" 19955msgstr "" 19956 19957#. (itstool) path: section/p 19958#: C/image-viewer.py.page:145 19959msgid "" 19960"The first line creates a <code>Gtk.Box</code> called <code>box</code> and " 19961"the following lines set two of its properties: the <code>orientation</code> " 19962"is set to vertical (so the widgets are arranged in a column), and the " 19963"<code>spacing</code> between the widgets is set to 5 pixels. The next line " 19964"then adds the newly-created <code>Gtk.Box</code> to the window." 19965msgstr "" 19966 19967#. (itstool) path: section/p 19968#: C/image-viewer.py.page:151 19969msgid "" 19970"To add some widgets to the <code>Gtk.Box</code>, insert the following code " 19971"directly below the <code>window.add (box)</code> line:" 19972msgstr "" 19973 19974#. (itstool) path: section/code 19975#: C/image-viewer.py.page:152 19976#, no-wrap 19977msgid "" 19978"\n" 19979"self.image = Gtk.Image()\n" 19980"box.pack_start (self.image, False, False, 0)" 19981msgstr "" 19982 19983#. (itstool) path: section/p 19984#: C/image-viewer.py.page:155 19985msgid "" 19986"The first line creates a new <code>Gtk.Image</code> called <code>image</" 19987"code>, which will be used to display an image file. As we need that later on " 19988"in the signal handler, we will define it as a class-wide variable. You need " 19989"to add <code>image = 0</code> to the beginning of the <code>GUI</code> " 19990"class. Then, the image widget is added (<em>packed</em>) into the <code>box</" 19991"code> container using GtkBox's <link href=\"http://library.gnome.org/devel/" 19992"gtk/stable/GtkBox.html#gtk-box-pack-start\"><code>pack_start</code></link> " 19993"method." 19994msgstr "" 19995 19996#. (itstool) path: section/p 19997#: C/image-viewer.py.page:157 19998msgid "" 19999"<code>pack_start</code> takes 4 arguments: the widget that is to be added to " 20000"the GtkBox (<code>child</code>); whether the <code>Gtk.Box</code> should " 20001"grow larger when the new widget is added (<code>expand</code>); whether the " 20002"new widget should take up all of the extra space created if the <code>Gtk." 20003"Box</code> gets bigger (<code>fill</code>); and how much space there should " 20004"be, in pixels, between the widget and its neighbors inside the <code>Gtk." 20005"Box</code> (<code>padding</code>)." 20006msgstr "" 20007 20008#. (itstool) path: section/code 20009#: C/image-viewer.py.page:161 20010#, no-wrap 20011msgid "" 20012"\n" 20013"button = Gtk.Button (\"Open a picture...\")\n" 20014"box.pack_start (button, False, False, 0)\n" 20015msgstr "" 20016 20017#. (itstool) path: section/p 20018#: C/image-viewer.py.page:165 20019msgid "" 20020"These lines are similar to the first two, but this time they create a " 20021"<code>Gtk.Button</code> and add it to <code>box</code>. Notice that we are " 20022"setting the <code>expand</code> argument (the second one) to <code>False</" 20023"code> here, whereas it was set to <code>True</code> for the <code>Gtk.Image</" 20024"code>. This will cause the image to take up all available space and the " 20025"button to take only the space it needs. When you maximize the window, the " 20026"button size will remain the same, but the image size will increase, taking " 20027"up all of the rest of the window." 20028msgstr "" 20029 20030#. (itstool) path: section/p 20031#: C/image-viewer.py.page:170 20032msgid "" 20033"When the user clicks on the <gui>Open Image...</gui> button, a dialog should " 20034"appear so that the user can choose a picture. Once chosen, the picture " 20035"should be loaded and shown in the image widget." 20036msgstr "" 20037 20038#. (itstool) path: section/p 20039#: C/image-viewer.py.page:171 20040msgid "" 20041"The first step is to connect the <code>clicked</code> signal of the button " 20042"to a signal handler function, which we call <code>on_open_clicked</code>. " 20043"Put this code immediately after the <code>button = Gtk.Button()</code> line " 20044"where the button was created:" 20045msgstr "" 20046 20047#. (itstool) path: section/code 20048#: C/image-viewer.py.page:172 20049#, no-wrap 20050msgid "" 20051"\n" 20052"button.connect_after('clicked', self.on_open_clicked)\n" 20053msgstr "" 20054 20055#. (itstool) path: section/p 20056#: C/image-viewer.py.page:175 20057msgid "" 20058"This will connect the <code>clicked</code> signal to <code>on_open_clicked</" 20059"code> method that we will define below." 20060msgstr "" 20061 20062#. (itstool) path: section/p 20063#: C/image-viewer.py.page:181 20064msgid "" 20065"Now we can create the <code>on_open_clicked</code> method. Insert the " 20066"following into the <code>GUI</code> class code block, after the " 20067"<code>__init__</code> method:" 20068msgstr "" 20069 20070#. (itstool) path: section/code 20071#: C/image-viewer.py.page:182 20072#, no-wrap 20073msgid "" 20074"\n" 20075"def on_open_clicked (self, button):\n" 20076"\tdialog = Gtk.FileChooserDialog (\"Open Image\", button.get_toplevel(), Gtk.FileChooserAction.OPEN);\n" 20077"\tdialog.add_button (Gtk.STOCK_CANCEL, 0)\n" 20078"\tdialog.add_button (Gtk.STOCK_OK, 1)\n" 20079"\tdialog.set_default_response(1)\n" 20080"\n" 20081"\tfilefilter = Gtk.FileFilter ()\n" 20082"\tfilefilter.add_pixbuf_formats ()\n" 20083"\tdialog.set_filter(filefilter)\n" 20084"\n" 20085"\tif dialog.run() == 1:\n" 20086"\t\tself.image.set_from_file(dialog.get_filename())\n" 20087"\n" 20088"\tdialog.destroy()" 20089msgstr "" 20090 20091#. (itstool) path: item/p 20092#: C/image-viewer.py.page:200 20093msgid "" 20094"The line beginning with <code>dialog</code> creates an <gui>Open</gui> " 20095"dialog, which the user can use to choose files. We set three properties: the " 20096"title of the dialog; the action (type) of the dialog (it's an \"open\" " 20097"dialog, but we could have used <code>SAVE</code> if the intention was to " 20098"save a file; and <code>transient_for</code>, which sets the parent window of " 20099"the dialog." 20100msgstr "" 20101 20102#. (itstool) path: item/p 20103#: C/image-viewer.py.page:213 20104msgid "" 20105"<code>dialog.run</code> displays the <gui>Open</gui> dialog. The dialog will " 20106"wait for the user to choose an image; when they do, <code>dialog.run</code> " 20107"will return the value <output>1</output> (it would return <output>0</output> " 20108"if the user clicked <gui>Cancel</gui>). The <code>if</code> statement tests " 20109"for this." 20110msgstr "" 20111 20112#. (itstool) path: section/p 20113#: C/image-viewer.py.page:226 20114msgid "" 20115"All of the code you need should now be in place, so try running the code. " 20116"That should be it; a fully-functioning image viewer (and a whistlestop tour " 20117"of Python and Gtk) in not much time at all!" 20118msgstr "" 20119 20120#. (itstool) path: section/p 20121#: C/image-viewer.py.page:231 20122msgid "" 20123"If you run into problems with the tutorial, compare your code with this " 20124"<link href=\"image-viewer/image-viewer.py\">reference code</link>." 20125msgstr "" 20126 20127#. (itstool) path: info/title 20128#: C/image-viewer.vala.page:8 20129#, fuzzy 20130msgctxt "text" 20131msgid "Image viewer (Vala)" 20132msgstr "Vala" 20133 20134#. (itstool) path: info/desc 20135#: C/image-viewer.vala.page:11 20136msgid "A little bit more than a simple \"Hello world\" GTK+ application." 20137msgstr "" 20138 20139#. (itstool) path: credit/name 20140#: C/image-viewer.vala.page:23 20141msgid "Philip Chimento" 20142msgstr "Philip Chimento" 20143 20144#. (itstool) path: synopsis/p 20145#: C/image-viewer.vala.page:39 20146msgid "" 20147"In this tutorial you will create an application which opens and displays an " 20148"image file. You will learn:" 20149msgstr "" 20150 20151#. (itstool) path: item/p 20152#: C/image-viewer.vala.page:41 20153msgid "" 20154"How to set up a basic project using the <link xref=\"getting-ready\">Anjuta " 20155"IDE</link>." 20156msgstr "" 20157 20158#. (itstool) path: item/p 20159#: C/image-viewer.vala.page:42 20160msgid "" 20161"How to write a <link href=\"http://developer.gnome.org/platform-overview/" 20162"stable/gtk\">Gtk application</link> in Vala" 20163msgstr "" 20164 20165#. (itstool) path: item/p 20166#: C/image-viewer.vala.page:43 20167msgid "" 20168"Some basic concepts of <link href=\"http://developer.gnome.org/gobject/" 20169"stable/\">GObject</link> programming" 20170msgstr "" 20171 20172#. (itstool) path: item/p 20173#: C/image-viewer.vala.page:50 20174msgid "" 20175"You may find the <link href=\"http://valadoc.org/gtk+-3.0/\">gtk+-3.0</link> " 20176"API Reference useful, although it is not necessary to follow the tutorial." 20177msgstr "" 20178 20179#. (itstool) path: item/p 20180#: C/image-viewer.vala.page:66 20181msgid "" 20182"From the <gui>Vala</gui> tab choose <gui>GTK+ (Simple)</gui>, click " 20183"<gui>Continue</gui>, and fill out your details on the next page. Use " 20184"<file>image-viewer</file> as project name and directory." 20185msgstr "" 20186 20187#. (itstool) path: item/p 20188#: C/image-viewer.vala.page:70 20189msgid "" 20190"Make sure that <gui>Use GtkBuilder for user interface</gui> is unchecked as " 20191"we will create the UI manually in this tutorial." 20192msgstr "" 20193 20194#. (itstool) path: note/p 20195#: C/image-viewer.vala.page:71 20196msgid "" 20197"You will learn how to use the interface builder in the <link xref=\"guitar-" 20198"tuner.vala\">Guitar-Tuner</link> tutorial." 20199msgstr "" 20200 20201#. (itstool) path: item/p 20202#: C/image-viewer.vala.page:75 20203msgid "" 20204"Click <gui>Continue</gui> then <gui>Apply</gui> and the project will be " 20205"created for you. Open <file>src/image_viewer.vala</file> from the " 20206"<gui>Project</gui> or <gui>File</gui> tabs. You will see this code:" 20207msgstr "" 20208 20209#. (itstool) path: item/code 20210#: C/image-viewer.vala.page:78 20211#, no-wrap 20212msgid "" 20213"\n" 20214"using GLib;\n" 20215"using Gtk;\n" 20216"\n" 20217"public class Main : Object\n" 20218"{\n" 20219"\n" 20220"\tpublic Main ()\n" 20221"\t{\n" 20222"\t\tWindow window = new Window();\n" 20223"\t\twindow.set_title (\"Hello World\");\n" 20224"\t\twindow.show_all();\n" 20225"\t\twindow.destroy.connect(on_destroy);\n" 20226"\t}\n" 20227"\n" 20228"\tpublic void on_destroy (Widget window)\n" 20229"\t{\n" 20230"\t\tGtk.main_quit();\n" 20231"\t}\n" 20232"\n" 20233"\tstatic int main (string[] args)\n" 20234"\t{\n" 20235"\t\tGtk.init (ref args);\n" 20236"\t\tvar app = new Main ();\n" 20237"\n" 20238"\t\tGtk.main ();\n" 20239"\n" 20240"\t\treturn 0;\n" 20241"\t}\n" 20242"}" 20243msgstr "" 20244 20245#. (itstool) path: section/p 20246#: C/image-viewer.vala.page:114 20247msgid "" 20248"The code loads an (empty) window from the user interface description file " 20249"and shows it. More details are given below; skip this list if you understand " 20250"the basics:" 20251msgstr "" 20252 20253#. (itstool) path: item/p 20254#: C/image-viewer.vala.page:119 20255msgid "" 20256"The two <code>using</code> lines at the top import namespaces so we don't " 20257"have to name them explicitly." 20258msgstr "" 20259 20260#. (itstool) path: item/p 20261#: C/image-viewer.vala.page:122 20262msgid "" 20263"The constructor of the <code>Main</code> class creates a new (empty) window " 20264"and connects a <link href=\"https://live.gnome.org/Vala/SignalsAndCallbacks" 20265"\">signal</link> to exit the application when that window is closed." 20266msgstr "" 20267 20268#. (itstool) path: item/p 20269#: C/image-viewer.vala.page:127 20270msgid "" 20271"The <code>static main</code> function is run by default when you start a " 20272"Vala application. It calls a few functions which create the <code>Main</" 20273"code> class, set up and then run the application. The <link href=\"http://" 20274"valadoc.org/gtk+-3.0/Gtk.main.html\"><code>Gtk.main</code></link> function " 20275"starts the GTK <link href=\"http://en.wikipedia.org/wiki/Event_loop\">main " 20276"loop</link>, which runs the user interface and starts listening for events " 20277"(like clicks and key presses)." 20278msgstr "" 20279 20280#. (itstool) path: section/p 20281#: C/image-viewer.vala.page:134 C/magic-mirror.vala.page:94 20282msgid "" 20283"Change the <gui>Configuration</gui> to <gui>Default</gui> and then press " 20284"<gui>Execute</gui> to configure the build directory. You only need to do " 20285"this once, for the first build." 20286msgstr "" 20287 20288#. (itstool) path: section/p 20289#: C/image-viewer.vala.page:140 20290msgid "" 20291"Now we will bring life into the empty window. GTK organizes the user " 20292"interface with <link href=\"http://www.valadoc.org/gtk+-2.0/Gtk.Container." 20293"html\"><code>Gtk.Container</code></link>s that can contain other widgets and " 20294"even other containers. Here we will use the simplest available container, a " 20295"<link href=\"http://unstable.valadoc.org/gtk+-2.0/Gtk.Box.html\"><code>Gtk." 20296"Box</code></link>." 20297msgstr "" 20298 20299#. (itstool) path: section/p 20300#: C/image-viewer.vala.page:144 20301#, fuzzy 20302msgid "Add the following lines to the top of the <code>Main</code> class:" 20303msgstr "Então, adicione as seguintes linhas à sua função <code>main()</code>:" 20304 20305#. (itstool) path: section/code 20306#: C/image-viewer.vala.page:145 20307#, fuzzy, no-wrap 20308msgid "" 20309"\n" 20310"private Window window;\n" 20311"private Image image;\n" 20312msgstr "Abre uma nova janela de navegação privada (anônima)" 20313 20314#. (itstool) path: section/p 20315#: C/image-viewer.vala.page:150 20316msgid "Now replace the current constructor with the one below:" 20317msgstr "" 20318 20319#. (itstool) path: section/code 20320#: C/image-viewer.vala.page:151 20321#, no-wrap 20322msgid "" 20323"\n" 20324"\n" 20325"public Main () {\n" 20326"\n" 20327"\twindow = new Window ();\n" 20328"\twindow.set_title (\"Image Viewer in Vala\");\n" 20329"\n" 20330"\t// Set up the UI\n" 20331"\tvar box = new Box (Orientation.VERTICAL, 5);\n" 20332"\tvar button = new Button.with_label (\"Open image\");\n" 20333"\timage = new Image ();\n" 20334"\n" 20335"\tbox.pack_start (image, true, true, 0);\n" 20336"\tbox.pack_start (button, false, false, 0);\n" 20337"\twindow.add (box);\n" 20338"\n" 20339"\t// Show open dialog when opening a file\n" 20340"\tbutton.clicked.connect (on_open_image);\n" 20341"\n" 20342"\twindow.show_all ();\n" 20343"\twindow.destroy.connect (main_quit);\n" 20344"}\n" 20345msgstr "" 20346 20347#. (itstool) path: item/p 20348#: C/image-viewer.vala.page:176 20349msgid "" 20350"The first two lines are the parts of the GUI that we will need to access " 20351"from more than one method. We declare them up here so that they are " 20352"accessible throughout the class instead of only in the method where they are " 20353"created." 20354msgstr "" 20355 20356#. (itstool) path: item/p 20357#: C/image-viewer.vala.page:180 20358msgid "" 20359"The first lines of the constructor create the empty window. The next lines " 20360"create the widgets we want to use: a button for opening up an image, the " 20361"image view widget itself and the box we will use as a container." 20362msgstr "" 20363 20364#. (itstool) path: item/p 20365#: C/image-viewer.vala.page:184 20366msgid "" 20367"The calls to <link href=\"http://unstable.valadoc.org/gtk+-2.0/Gtk.Box." 20368"pack_start.html\"><code>pack_start</code></link> add the two widgets to the " 20369"box and define their behaviour. The image will expand into any available " 20370"space whereas the button will just be as big as needed. You will notice that " 20371"we don't set explicit sizes on the widgets. In GTK this is usually not " 20372"needed as it makes it much easier to have a layout that looks good in " 20373"different window sizes. Next, the box is added to the window." 20374msgstr "" 20375 20376#. (itstool) path: item/p 20377#: C/image-viewer.vala.page:191 20378msgid "" 20379"We need to define what happens when the user clicks on the button. GTK uses " 20380"the concept of <em>signals</em>." 20381msgstr "" 20382 20383#. (itstool) path: item/p 20384#: C/image-viewer.vala.page:192 20385msgid "" 20386"When the <link href=\"http://valadoc.org/gtk+-3.0/Gtk.Button.html\">button</" 20387"link> is clicked, it fires the <link href=\"http://valadoc.org/gtk+-3.0/Gtk." 20388"Button.clicked.html\"><code>clicked</code></link> signal, which we can " 20389"connect to some action (defined in a <link href=\"https://live.gnome.org/" 20390"Vala/SignalsAndCallbacks\">callback</link> method)." 20391msgstr "" 20392 20393#. (itstool) path: item/p 20394#: C/image-viewer.vala.page:195 20395msgid "" 20396"This is done using the <code>connect</code> method of the button's " 20397"<code>clicked</code> signal, which in this case tells GTK to call the (yet " 20398"undefined) <code>on_image_open</code> callback method when the button is " 20399"clicked. We will define the <em>callback</em> in the next section." 20400msgstr "" 20401 20402#. (itstool) path: item/p 20403#: C/image-viewer.vala.page:199 20404msgid "" 20405"In the callback, we need to access the <code>window</code> and <code>image</" 20406"code> widgets, which is why we defined them as private members at the top of " 20407"our class." 20408msgstr "" 20409 20410#. (itstool) path: item/p 20411#: C/image-viewer.vala.page:203 20412msgid "" 20413"The last <code>connect</code> call makes sure that the application exits " 20414"when the window is closed. The code generated by Anjuta called an " 20415"<code>on_destroy</code> callback method which called <link href=\"http://www." 20416"valadoc.org/gtk+-2.0/Gtk.main_quit.html\"><code>Gtk.main_quit</code></link>, " 20417"but just connecting our signal to <code>main_quit</code> directly is easier. " 20418"You can delete the <code>on_destroy</code> method." 20419msgstr "" 20420 20421#. (itstool) path: section/p 20422#: C/image-viewer.vala.page:211 20423msgid "" 20424"We will now define the signal handler for the <code>clicked</code> signal " 20425"for the button we mentioned before. Add this code after the constructor:" 20426msgstr "" 20427 20428#. (itstool) path: section/code 20429#: C/image-viewer.vala.page:214 20430#, no-wrap 20431msgid "" 20432"\n" 20433"public void on_open_image (Button self) {\n" 20434"\tvar filter = new FileFilter ();\n" 20435"\tvar dialog = new FileChooserDialog (\"Open image\",\n" 20436"\t window,\n" 20437"\t FileChooserAction.OPEN,\n" 20438"\t Stock.OK, ResponseType.ACCEPT,\n" 20439"\t Stock.CANCEL, ResponseType.CANCEL);\n" 20440"\tfilter.add_pixbuf_formats ();\n" 20441"\tdialog.add_filter (filter);\n" 20442"\n" 20443"\tswitch (dialog.run ())\n" 20444"\t{\n" 20445"\t\tcase ResponseType.ACCEPT:\n" 20446"\t\t\tvar filename = dialog.get_filename ();\n" 20447"\t\t\timage.set_from_file (filename);\n" 20448"\t\t\tbreak;\n" 20449"\t\tdefault:\n" 20450"\t\t\tbreak;\n" 20451"\t}\n" 20452"\tdialog.destroy ();\n" 20453"}\n" 20454msgstr "" 20455 20456#. (itstool) path: section/p 20457#: C/image-viewer.vala.page:237 20458msgid "This is a bit complicated, so let's break it down:" 20459msgstr "" 20460 20461#. (itstool) path: note/p 20462#: C/image-viewer.vala.page:238 20463msgid "" 20464"A signal handler is a type of callback method that is called when a signal " 20465"is emitted. Here the terms are used interchangeably." 20466msgstr "" 20467 20468#. (itstool) path: item/p 20469#: C/image-viewer.vala.page:241 20470msgid "" 20471"The first argument of the callback method is always the widget that sent the " 20472"signal. Sometimes other arguments related to the signal come after that, but " 20473"<em>clicked</em> doesn't have any." 20474msgstr "" 20475 20476#. (itstool) path: item/p 20477#: C/image-viewer.vala.page:243 20478msgid "" 20479"In this case the <code>button</code> sent the <code>clicked</code> signal, " 20480"which is connected to the <code>on_open_image</code> callback method:" 20481msgstr "" 20482 20483#. (itstool) path: item/code 20484#: C/image-viewer.vala.page:244 20485#, fuzzy, no-wrap 20486msgid "" 20487"\n" 20488" button.clicked.connect (on_open_image);\n" 20489msgstr "Abrir imagem como uma nova camada" 20490 20491#. (itstool) path: item/p 20492#: C/image-viewer.vala.page:248 20493msgid "" 20494"The <code>on_open_image</code> method takes the button that emitted the " 20495"signal as an argument:" 20496msgstr "" 20497 20498#. (itstool) path: item/code 20499#: C/image-viewer.vala.page:249 20500#, no-wrap 20501msgid "" 20502"\n" 20503" public void on_open_image (Button self)\n" 20504msgstr "" 20505 20506#. (itstool) path: item/p 20507#: C/image-viewer.vala.page:254 20508msgid "" 20509"The next interesting line is where the dialog for choosing the file is " 20510"created. <link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.FileChooserDialog." 20511"html\"><code>FileChooserDialog</code></link>'s constructor takes the title " 20512"of the dialog, the parent window of the dialog and several options like the " 20513"number of buttons and their corresponding values." 20514msgstr "" 20515 20516#. (itstool) path: item/p 20517#: C/image-viewer.vala.page:256 20518msgid "" 20519"Notice that we are using <link href=\"http://unstable.valadoc.org/gtk+-3.0/" 20520"Gtk.Stock.html\"><em>stock</em></link> button names from Gtk, instead of " 20521"manually typing \"Cancel\" or \"Open\". The advantage of using stock names " 20522"is that the button labels will already be translated into the user's " 20523"language." 20524msgstr "" 20525 20526#. (itstool) path: item/p 20527#: C/image-viewer.vala.page:260 20528msgid "" 20529"The next two lines restrict the <gui>Open</gui> dialog to only display files " 20530"which can be opened by <em>GtkImage</em>. GtkImage is a widget which " 20531"displays an image. A filter object is created first; we then add all kinds " 20532"of files supported by <link href=\"http://www.valadoc.org/gdk-pixbuf-2.0/Gdk." 20533"Pixbuf.html\"><code>Gdk.Pixbuf</code></link> (which includes most image " 20534"formats like PNG and JPEG) to the filter. Finally, we set this filter to be " 20535"the <gui>Open</gui> dialog's filter." 20536msgstr "" 20537 20538#. (itstool) path: item/p 20539#: C/image-viewer.vala.page:265 20540msgid "" 20541"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Dialog.run.html" 20542"\"><code>dialog.run</code></link> displays the <gui>Open</gui> dialog. The " 20543"dialog will wait for the user to choose an image; when they do, <code>dialog." 20544"run</code> will return the <link href=\"http://www.valadoc.org/gtk+-3.0/Gtk." 20545"ResponseType.html\">ResponseType</link> value <code>ResponseType.ACCEPT</" 20546"code> (it would return <code>ResponseType.CANCEL</code> if the user clicked " 20547"<gui>Cancel</gui>). The <code>switch</code> statement tests for this." 20548msgstr "" 20549 20550#. (itstool) path: item/p 20551#: C/image-viewer.vala.page:270 20552msgid "" 20553"Assuming that the user did click <gui>Open</gui>, the next lines get the " 20554"filename of the image selected by the user, and tell the <code>GtkImage</" 20555"code> widget to load and display the selected image." 20556msgstr "" 20557 20558#. (itstool) path: item/p 20559#: C/image-viewer.vala.page:274 20560msgid "Destroying automatically hides the dialog." 20561msgstr "" 20562 20563#. (itstool) path: section/p 20564#: C/image-viewer.vala.page:283 20565msgid "" 20566"If you haven't already done so, choose the <file>src/image-viewer</file> " 20567"application in the dialog that appears. Finally, hit <gui>Run</gui> and " 20568"enjoy!" 20569msgstr "" 20570 20571#. (itstool) path: section/p 20572#: C/image-viewer.vala.page:289 20573msgid "" 20574"If you run into problems with the tutorial, compare your code with this " 20575"<link href=\"image-viewer/image-viewer.vala\">reference code</link>." 20576msgstr "" 20577 20578#. (itstool) path: item/p 20579#: C/image-viewer.vala.page:296 20580msgid "" 20581"Set it up so that when the window opens it is of a specific size to start " 20582"off with. For example, 200 X 200 pixels." 20583msgstr "" 20584 20585#. (itstool) path: credit/name 20586#: C/index.page:8 20587msgid "GNOME Documentation Team" 20588msgstr "Equipe de documentação GNOME" 20589 20590#. (itstool) path: credit/years 20591#: C/index.page:10 20592msgid "2010, 2011" 20593msgstr "2010, 2011" 20594 20595#. (itstool) path: credit/name 20596#: C/index.page:13 C/message-board.c.page:15 20597msgid "Shaun McCance" 20598msgstr "Shaun McCance" 20599 20600#. (itstool) path: credit/years 20601#: C/index.page:15 C/message-board.c.page:17 20602msgid "2010" 20603msgstr "2010" 20604 20605#. (itstool) path: page/title 20606#: C/index.page:28 20607msgid "GNOME Developer Platform Demos" 20608msgstr "Demonstrações da plataforma de desenvolvimento do GNOME" 20609 20610#. (itstool) path: page/p 20611#: C/index.page:30 20612msgid "" 20613"This guide includes a variety of coding examples, such writing an image " 20614"viewer or weather application. Each demo comes with code that you can try, " 20615"and explains how each example works. They are a great way to get started " 20616"with the GNOME developer platform." 20617msgstr "" 20618"Este guia inclui uma variedade de exemplos de codificação, como escrever um " 20619"visualizador de imagens ou aplicativo de meteorologia. Cada demonstração vem " 20620"com código que você pode tentar e explica como cada exemplo funciona. Eles " 20621"são uma ótima maneira de começar a usar a plataforma de desenvolvedores do " 20622"GNOME." 20623 20624#. (itstool) path: section/title 20625#: C/index.page:36 20626msgid "Pick a Language" 20627msgstr "Selecione uma linguagem" 20628 20629#. (itstool) path: section/p 20630#: C/index.page:37 20631msgid "" 20632"These developer demos are available in a range of programming languages. " 20633"Pick one to get started:" 20634msgstr "" 20635"Essas demonstrações de desenvolvimento estão disponíveis em várias " 20636"linguagens de programação. Escolha uma para começar:" 20637 20638#. (itstool) path: info/title 20639#: C/js.page:8 20640msgctxt "link" 20641msgid "JavaScript" 20642msgstr "JavaScript" 20643 20644#. (itstool) path: credit/name 20645#: C/js.page:21 20646msgid "Ekaterina Gerasimova" 20647msgstr "Ekaterina Gerasimova" 20648 20649#. (itstool) path: page/title 20650#: C/js.page:26 20651msgid "Tutorials, code samples and platform demos in JavaScript" 20652msgstr "" 20653"Tutoriais, amostras de código e demonstrações da plataforma em JavaScript" 20654 20655#. (itstool) path: section/title 20656#: C/js.page:31 20657msgid "Code samples and tutorials" 20658msgstr "Amostras de códigos e tutoriais" 20659 20660#. (itstool) path: info/title 20661#: C/label.c.page:8 20662#, fuzzy 20663msgctxt "text" 20664msgid "Label (C)" 20665msgstr "Rótulo para" 20666 20667#. (itstool) path: info/desc 20668#: C/label.c.page:19 C/label.vala.page:18 20669#, fuzzy 20670msgid "A widget which displays text" 20671msgstr "Exibe o texto resumido de ajuda." 20672 20673#. (itstool) path: page/title 20674#. (itstool) path: td/p 20675#: C/label.c.page:22 C/label.js.page:21 C/label.py.page:30 C/label.vala.page:21 20676#: C/toolbar_builder.py.page:98 C/toolbar_builder.vala.page:81 20677#, fuzzy 20678msgid "Label" 20679msgstr "Rótulo" 20680 20681#. (itstool) path: td/media 20682#. (itstool) path: page/media 20683#. This is a reference to an external file such as an image or video. When 20684#. the file changes, the md5 hash will change to let you know you need to 20685#. update your localized copy. The msgstr is not used at all. Set it to 20686#. whatever you like once you have updated your copy of the file. 20687#: C/label.c.page:26 C/label.js.page:22 C/label.py.page:31 C/label.vala.page:22 20688msgctxt "_" 20689msgid "external ref='media/label.png' md5='734975c18653d88379f983e4501c3fc0'" 20690msgstr "external ref='media/label.png' md5='734975c18653d88379f983e4501c3fc0'" 20691 20692#. (itstool) path: td/p 20693#. (itstool) path: page/p 20694#: C/label.c.page:27 C/label.py.page:32 C/label.vala.page:23 20695msgid "A simple label" 20696msgstr "Um rótulo simples" 20697 20698#. (itstool) path: page/code 20699#: C/label.c.page:32 20700#, no-wrap 20701msgid "" 20702"#include <gtk/gtk.h>\n" 20703"\n" 20704"\n" 20705"\n" 20706"static void\n" 20707"activate (GtkApplication *app,\n" 20708" gpointer user_data)\n" 20709"{\n" 20710" GtkWidget *window;\n" 20711" GtkWidget *label;\n" 20712"\n" 20713" /*Create a window with a title and a default size*/\n" 20714" window = gtk_application_window_new (app);\n" 20715" gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));\n" 20716" gtk_window_set_title (GTK_WINDOW (window), \"Welcome to GNOME\");\n" 20717" gtk_window_set_default_size (GTK_WINDOW (window), 200,100);\n" 20718" \n" 20719" /*Create a label and set its alignment. Setting the line wrap to TRUE makes \n" 20720" the label break lines if the text exceeds the widget's size. When set to \n" 20721" FALSE the text gets cut off by the edge of the widget*/\n" 20722" label = gtk_label_new (\"Hello GNOME!\");\n" 20723" gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);\n" 20724" gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);\n" 20725"\n" 20726" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (label));\n" 20727"\n" 20728" gtk_widget_show_all (GTK_WIDGET (window));\n" 20729"}\n" 20730"\n" 20731"\n" 20732"\n" 20733"int\n" 20734"main (int argc, char **argv)\n" 20735"{\n" 20736" GtkApplication *app;\n" 20737" int status;\n" 20738"\n" 20739" app = gtk_application_new (\"org.gtk.example\",G_APPLICATION_FLAGS_NONE);\n" 20740" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 20741" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 20742" g_object_unref (app);\n" 20743" return status;\n" 20744"}\n" 20745msgstr "" 20746 20747#. (itstool) path: item/p 20748#: C/label.c.page:39 20749msgid "" 20750"<link href=\"http://developer.gnome.org/gtk3/3.4/GtkLabel.html\">GtkLabel</" 20751"link>" 20752msgstr "" 20753 20754#. (itstool) path: info/title 20755#: C/label.js.page:8 20756#, fuzzy 20757msgctxt "text" 20758msgid "Label (JavaScript)" 20759msgstr "_JavaScript" 20760 20761#. (itstool) path: info/desc 20762#: C/label.js.page:18 20763#, fuzzy 20764msgid "A label which can contain text" 20765msgstr "Se o texto do rótulo pode ser selecionado com o mouse" 20766 20767#. (itstool) path: page/p 20768#: C/label.js.page:23 20769#, fuzzy 20770msgid "A label displaying a friendly message." 20771msgstr "Não foi possível analisar a mensagem MIME. Exibindo como a origem." 20772 20773#. (itstool) path: page/code 20774#: C/label.js.page:25 20775#, fuzzy, no-wrap 20776#| msgid "" 20777#| "#!/usr/bin/gjs\n" 20778#| "\n" 20779#| "const GLib = imports.gi.GLib;\n" 20780#| "const Gtk = imports.gi.Gtk;\n" 20781#| "const Lang = imports.lang;\n" 20782#| "const Webkit = imports.gi.WebKit;\n" 20783#| "\n" 20784#| "const HelloGNOME = new Lang.Class ({\n" 20785#| " Name: 'Hello GNOME',\n" 20786#| "\n" 20787#| " // Create the application itself\n" 20788#| " _init: function () {\n" 20789#| " this.application = new Gtk.Application ();\n" 20790#| "\n" 20791#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 20792#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 20793#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 20794#| " },\n" 20795#| "\n" 20796#| " // Callback function for 'activate' signal presents windows when active\n" 20797#| " _onActivate: function () {\n" 20798#| " this._window.present ();\n" 20799#| " },\n" 20800#| "\n" 20801#| " // Callback function for 'startup' signal builds the UI\n" 20802#| " _onStartup: function () {\n" 20803#| " this._buildUI ();\n" 20804#| " },\n" 20805#| "\n" 20806#| " // Build the application's UI\n" 20807#| " _buildUI: function () {\n" 20808#| "\n" 20809#| " // Create the application window\n" 20810#| " this._window = new Gtk.ApplicationWindow ({\n" 20811#| " application: this.application,\n" 20812#| " title: \"Welcome to GNOME\",\n" 20813#| " default_height: 200,\n" 20814#| " default_width: 400,\n" 20815#| " window_position: Gtk.WindowPosition.CENTER });\n" 20816#| "\n" 20817#| " // Create a webview to show the web app\n" 20818#| " this._webView = new Webkit.WebView ();\n" 20819#| "\n" 20820#| " // Put the web app into the webview\n" 20821#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 20822#| " \"/hellognome.html\", null));\n" 20823#| "\n" 20824#| " // Put the webview into the window\n" 20825#| " this._window.add (this._webView);\n" 20826#| "\n" 20827#| " // Show the window and all child widgets\n" 20828#| " this._window.show_all();\n" 20829#| " },\n" 20830#| "\n" 20831#| "});\n" 20832#| "\n" 20833#| "// Run the application\n" 20834#| "let app = new HelloGNOME ();\n" 20835#| "app.application.run (ARGV);\n" 20836msgid "" 20837"#!/usr/bin/gjs\n" 20838"\n" 20839"imports.gi.versions.Gtk = '3.0';\n" 20840"\n" 20841"const Gio = imports.gi.Gio;\n" 20842"const GLib = imports.gi.GLib;\n" 20843"const Gtk = imports.gi.Gtk;\n" 20844"\n" 20845"class LabelExample {\n" 20846"\n" 20847" /* Create the application itself\n" 20848" This boilerplate code is needed to build any GTK+ application. */\n" 20849" constructor() {\n" 20850" this.application = new Gtk.Application ({\n" 20851" application_id: 'org.example.jslabel',\n" 20852" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 20853" });\n" 20854"\n" 20855" // Connect 'activate' and 'startup' signals to the callback functions\n" 20856" this.application.connect('activate', this._onActivate.bind(this));\n" 20857" this.application.connect('startup', this._onStartup.bind(this));\n" 20858" }\n" 20859"\n" 20860" // Callback function for 'activate' signal presents windows when active\n" 20861" _onActivate() {\n" 20862" this._window.present();\n" 20863" }\n" 20864"\n" 20865" // Callback function for 'startup' signal initializes menus and builds the UI\n" 20866" _onStartup() {\n" 20867" this._buildUI();\n" 20868" }\n" 20869"\n" 20870" // Build the application's UI\n" 20871" _buildUI() {\n" 20872"\n" 20873" // Create the application window\n" 20874" this._window = new Gtk.ApplicationWindow({\n" 20875" application: this.application,\n" 20876" window_position: Gtk.WindowPosition.CENTER,\n" 20877" title: \"Welcome to GNOME\",\n" 20878" default_height: 100,\n" 20879" default_width: 200\n" 20880" });\n" 20881"\n" 20882" // Create the label\n" 20883" this.label = new Gtk.Label({ label: \"Hello GNOME!\" });\n" 20884" this._window.add(this.label);\n" 20885"\n" 20886" // Show the window and all child widgets\n" 20887" this._window.show_all();\n" 20888" }\n" 20889"\n" 20890"\n" 20891"};\n" 20892"\n" 20893"// Run the application\n" 20894"let app = new LabelExample ();\n" 20895"app.application.run (ARGV);\n" 20896msgstr "" 20897"#!/usr/bin/gjs\n" 20898"\n" 20899"const GLib = imports.gi.GLib;\n" 20900"const Gtk = imports.gi.Gtk;\n" 20901"const Lang = imports.lang;\n" 20902"const Webkit = imports.gi.WebKit;\n" 20903"\n" 20904"const HelloGNOME = new Lang.Class ({\n" 20905" Name: 'Olá, GNOME',\n" 20906"\n" 20907" // Cria o aplicativo em si\n" 20908" _init: function () {\n" 20909" this.application = new Gtk.Application ();\n" 20910"\n" 20911" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 20912" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 20913" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 20914" },\n" 20915"\n" 20916" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 20917" _onActivate: function () {\n" 20918" this._window.present ();\n" 20919" },\n" 20920"\n" 20921" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 20922" _onStartup: function () {\n" 20923" this._buildUI ();\n" 20924" },\n" 20925"\n" 20926" // Constrói a interface gráfica do aplicativo\n" 20927" _buildUI: function () {\n" 20928"\n" 20929" // Cria a janela do aplicativo\n" 20930" this._window = new Gtk.ApplicationWindow ({\n" 20931" application: this.application,\n" 20932" title: \"Bem-vindo ao GNOME\",\n" 20933" default_height: 200,\n" 20934" default_width: 400,\n" 20935" window_position: Gtk.WindowPosition.CENTER });\n" 20936"\n" 20937" // Cria um webview para mostrar o aplicativo web\n" 20938" this._webView = new Webkit.WebView ();\n" 20939"\n" 20940" // Coloca o aplicativo web no webview\n" 20941" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 20942" \"/hellognome.html\", null));\n" 20943"\n" 20944" // Coloca o webview na janela\n" 20945" this._window.add (this._webView);\n" 20946"\n" 20947" // Mostra a janela e todos seus widgets filhos\n" 20948" this._window.show_all();\n" 20949" },\n" 20950"\n" 20951"});\n" 20952"\n" 20953"// Executa o aplicativo\n" 20954"let app = new HelloGNOME ();\n" 20955"app.application.run (ARGV);\n" 20956 20957#. (itstool) path: item/p 20958#: C/label.js.page:32 20959msgid "" 20960"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Label.html" 20961"\">Gtk.Label</link>" 20962msgstr "" 20963 20964#. (itstool) path: info/title 20965#: C/label.py.page:9 20966#, fuzzy 20967msgctxt "text" 20968msgid "Label (Python)" 20969msgstr "Rótulo" 20970 20971#. (itstool) path: info/desc 20972#: C/label.py.page:27 20973msgid "A widget that displays a small to medium amount of text" 20974msgstr "" 20975 20976#. (itstool) path: section/p 20977#: C/label.py.page:41 20978msgid "" 20979"Another way to obtain what we have in the example is to create the label as " 20980"an instance of another class and add it to the instance of <code>MyWindow</" 20981"code> in the <code>do_activate(self)</code> method:" 20982msgstr "" 20983 20984#. (itstool) path: note/p 20985#: C/label.py.page:43 20986msgid "" 20987"The highlighted lines indicate code that is different from the previous " 20988"snippet." 20989msgstr "" 20990 20991#. (itstool) path: section/code 20992#: C/label.py.page:45 20993#, no-wrap 20994msgid "" 20995"\n" 20996"# a class to define a window\n" 20997"class MyWindow(Gtk.ApplicationWindow):\n" 20998" def __init__(self, app):\n" 20999" Gtk.Window.__init__(self, title=\"Welcome to GNOME\", application=app)\n" 21000" self.set_default_size(200, 100)\n" 21001"\n" 21002"# a class to define a label\n" 21003"<e:hi>\n" 21004"class MyLabel(Gtk.Label):\n" 21005" def __init__(self):\n" 21006" Gtk.Label.__init__(self)\n" 21007" self.set_text(\"Hello GNOME!\")\n" 21008"</e:hi>\n" 21009"\n" 21010"class MyApplication(Gtk.Application):\n" 21011" def __init__(self):\n" 21012" Gtk.Application.__init__(self)\n" 21013"\n" 21014" def do_activate(self):\n" 21015" # create an instance of MyWindow\n" 21016" win = MyWindow(self)\n" 21017"\n" 21018" # create an instance of MyLabel\n" 21019"<e:hi>\n" 21020" label = MyLabel()\n" 21021"</e:hi>\n" 21022" # and add it to the window\n" 21023"<e:hi>\n" 21024" win.add(label)\n" 21025"</e:hi>\n" 21026" # show the window and everything on it\n" 21027" win.show_all()" 21028msgstr "" 21029 21030#. (itstool) path: section/title 21031#: C/label.py.page:82 21032#, fuzzy 21033msgid "Useful methods for a Label widget" 21034msgstr "Componente do rótulo" 21035 21036#. (itstool) path: note/p 21037#: C/label.py.page:85 21038msgid "" 21039"An explanation of how to work with strings in GTK+ can be found in <link " 21040"xref=\"strings.py\"/>." 21041msgstr "" 21042 21043#. (itstool) path: item/p 21044#: C/label.py.page:89 21045msgid "" 21046"<code>set_line_wrap(True)</code> breaks lines if the text of the label " 21047"exceeds the size of the widget." 21048msgstr "" 21049 21050#. (itstool) path: item/p 21051#: C/label.py.page:90 21052msgid "" 21053"<code>set_justify(Gtk.Justification.LEFT)</code> (or <code>Gtk.Justification." 21054"RIGHT, Gtk.Justification.CENTER, Gtk.Justification.FILL</code>) sets the " 21055"alignment of the lines in the text of the label relative to each other. The " 21056"method has no effect on a single-line label." 21057msgstr "" 21058 21059#. (itstool) path: item/p 21060#: C/label.py.page:91 21061msgid "" 21062"For decorated text we can use <code>set_markup(\"text\")</code>, where <code>" 21063"\"text\"</code> is a text in the <link href=\"http://developer.gnome.org/" 21064"pango/stable/PangoMarkupFormat.html\">Pango Markup Language</link>. An " 21065"example:" 21066msgstr "" 21067 21068#. (itstool) path: item/code 21069#: C/label.py.page:92 21070#, no-wrap 21071msgid "" 21072"\n" 21073"label.set_markup(\"Text can be <small>small</small>, <big>big</big>, \"\n" 21074" \"<b>bold</b>, <i>italic</i> and even point to somewhere \"\n" 21075" \"on the <a href=\\\"http://www.gtk.org\\\" \"\n" 21076" \"title=\\\"Click to find out more\\\">internet</a>.\")" 21077msgstr "" 21078 21079#. (itstool) path: info/title 21080#: C/label.vala.page:8 21081#, fuzzy 21082msgctxt "text" 21083msgid "Label (Vala)" 21084msgstr "_Vala" 21085 21086#. (itstool) path: page/code 21087#: C/label.vala.page:25 21088#, no-wrap 21089msgid "" 21090"\n" 21091"public class MyWindow : Gtk.ApplicationWindow {\n" 21092"\tinternal MyWindow (MyApplication app) {\n" 21093"\t\tObject (application: app, title: \"Welcome to GNOME\");\n" 21094"\n" 21095"\t\tvar label = new Gtk.Label (\"Hello GNOME!\");\n" 21096"\n" 21097"\t\tthis.add (label);\n" 21098"\t\tthis.set_default_size (200, 100);\n" 21099"\t\tthis.show_all ();\n" 21100"\t}\n" 21101"}\n" 21102"\n" 21103"public class MyApplication : Gtk.Application {\n" 21104"\tprotected override void activate () {\n" 21105"\t\tnew MyWindow (this).show ();\n" 21106"\t}\n" 21107"\n" 21108"\tinternal MyApplication () {\n" 21109"\t\tObject (application_id: \"org.example.MyApplication\");\n" 21110"\t}\n" 21111"}\n" 21112"\n" 21113"public int main (string[] args) {\n" 21114"\treturn new MyApplication ().run (args);\n" 21115"}\n" 21116msgstr "" 21117 21118#. (itstool) path: p/link 21119#: C/legal.xml:3 21120#, fuzzy 21121#| msgid "" 21122#| "This work is distributed under a CreativeCommons Attribution-Share Alike " 21123#| "3.0 Unported license." 21124msgid "Creative Commons Attribution-ShareAlike 3.0 Unported License" 21125msgstr "" 21126"Este trabalho está licenciado sob a Licença Creative Commons Atribuição-" 21127"Compartilhada Igual 3.0 Não Adaptada. Para ver uma cópia desta licença, " 21128"visite <_:link-1/> ou envie uma carta para Creative Commons, 444 Castro " 21129"Street, Suite 900, Mountain View, California, 94041, USA." 21130 21131#. (itstool) path: license/p 21132#: C/legal.xml:3 21133#, fuzzy 21134#| msgid "" 21135#| "As a special exception, the copyright holders give you permission to " 21136#| "copy, modify, and distribute the example code contained in this " 21137#| "documentation under the terms of your choosing, without restriction." 21138msgid "" 21139"This work is licensed under a <_:link-1/>. As a special exception, the " 21140"copyright holders give you permission to copy, modify, and distribute the " 21141"example code contained in this documentation under the terms of your " 21142"choosing, without restriction." 21143msgstr "" 21144"Como uma exceção especial, os mantenedores do copyright dão a você permissão " 21145"para copiar, modificar e distribuir o código exemplo contido nesta " 21146"documentação sob os termos de sua escolha, sem restrição." 21147 21148#. (itstool) path: info/desc 21149#: C/license.page:8 21150msgid "Legal information." 21151msgstr "Informações legais." 21152 21153#. (itstool) path: page/title 21154#: C/license.page:11 21155msgid "License" 21156msgstr "Licença" 21157 21158#. (itstool) path: page/p 21159#: C/license.page:12 21160msgid "" 21161"This work is distributed under a CreativeCommons Attribution-Share Alike 3.0 " 21162"Unported license." 21163msgstr "" 21164"Esta obra é distribuída sob uma licença CreativeCommons Atribuição-" 21165"Compartilhada Igual 3.0 Não Adaptada." 21166 21167#. (itstool) path: page/p 21168#: C/license.page:20 21169msgid "You are free:" 21170msgstr "Você tem liberdade de:" 21171 21172#. (itstool) path: item/title 21173#: C/license.page:25 21174msgid "<em>To share</em>" 21175msgstr "<em>Compartilhar</em>" 21176 21177#. (itstool) path: item/p 21178#: C/license.page:26 21179msgid "To copy, distribute and transmit the work." 21180msgstr "Copiar, distribuir e transmitir a obra." 21181 21182#. (itstool) path: item/title 21183#: C/license.page:29 21184msgid "<em>To remix</em>" 21185msgstr "<em>Remixar</em>" 21186 21187#. (itstool) path: item/p 21188#: C/license.page:30 21189msgid "To adapt the work." 21190msgstr "Criar obras derivadas." 21191 21192#. (itstool) path: page/p 21193#: C/license.page:33 21194msgid "Under the following conditions:" 21195msgstr "Sob as seguintes condições:" 21196 21197#. (itstool) path: item/title 21198#: C/license.page:38 21199msgid "<em>Attribution</em>" 21200msgstr "<em>Atribuição</em>" 21201 21202#. (itstool) path: item/p 21203#: C/license.page:39 21204msgid "" 21205"You must attribute the work in the manner specified by the author or " 21206"licensor (but not in any way that suggests that they endorse you or your use " 21207"of the work)." 21208msgstr "" 21209"Você deve creditar a obra de forma especificada pelo autor ou licenciante " 21210"(mas não de maneiras que estes concedem qualquer aval a você ou ao seu uso " 21211"da obra)." 21212 21213#. (itstool) path: item/title 21214#: C/license.page:46 21215msgid "<em>Share Alike</em>" 21216msgstr "<em>Compartilhamento pela mesma licença</em>" 21217 21218#. (itstool) path: item/p 21219#: C/license.page:47 21220msgid "" 21221"If you alter, transform, or build upon this work, you may distribute the " 21222"resulting work only under the same, similar or a compatible license." 21223msgstr "" 21224"Se você alterar, transformar ou criar em cima desta obra, você poderá " 21225"distribuir a obra resultante apenas sob a mesma licença, ou sob uma licença " 21226"similar à presente." 21227 21228# URL alterada para Português 21229#. (itstool) path: page/p 21230#: C/license.page:53 21231msgid "" 21232"For the full text of the license, see the <link href=\"http://" 21233"creativecommons.org/licenses/by-sa/3.0/legalcode\">CreativeCommons website</" 21234"link>, or read the full <link href=\"http://creativecommons.org/licenses/by-" 21235"sa/3.0/\">Commons Deed</link>." 21236msgstr "" 21237"Para o texto completo da licença, veja o <link href=\"http://creativecommons." 21238"org/licenses/by-sa/3.0/legalcode\">site do CreativeCommons</link> ou leia as " 21239"<link href=\"http://creativecommons.org/licenses/by-sa/3.0/deed.pt_BR" 21240"\">Commons Deed</link>." 21241 21242#. (itstool) path: note/p 21243#: C/license.page:60 21244msgid "" 21245"As a special exception, the copyright holders give you permission to copy, " 21246"modify, and distribute the example code contained in this documentation " 21247"under the terms of your choosing, without restriction." 21248msgstr "" 21249"Como uma exceção especial, os mantenedores do copyright dão a você permissão " 21250"para copiar, modificar e distribuir o código exemplo contido nesta " 21251"documentação sob os termos de sua escolha, sem restrição." 21252 21253#. (itstool) path: info/title 21254#: C/linkbutton.c.page:8 21255msgctxt "text" 21256msgid "LinkButton (C)" 21257msgstr "LinkButton (C)" 21258 21259#. (itstool) path: info/desc 21260#: C/linkbutton.c.page:18 C/linkbutton.vala.page:18 21261#, fuzzy 21262msgid "Create buttons bound to a URL" 21263msgstr "não foi possível criar URL para %s: %s" 21264 21265#. (itstool) path: page/title 21266#: C/linkbutton.c.page:21 C/linkbutton.js.page:21 C/linkbutton.py.page:22 21267#: C/linkbutton.vala.page:21 21268msgid "LinkButton" 21269msgstr "" 21270 21271#. (itstool) path: page/media 21272#. This is a reference to an external file such as an image or video. When 21273#. the file changes, the md5 hash will change to let you know you need to 21274#. update your localized copy. The msgstr is not used at all. Set it to 21275#. whatever you like once you have updated your copy of the file. 21276#: C/linkbutton.c.page:23 C/linkbutton.js.page:22 C/linkbutton.py.page:24 21277#: C/linkbutton.vala.page:22 21278msgctxt "_" 21279msgid "" 21280"external ref='media/linkbutton.png' md5='3712eae8953e87c65a6aa74503b8e32b'" 21281msgstr "" 21282"external ref='media/linkbutton.png' md5='3712eae8953e87c65a6aa74503b8e32b'" 21283 21284#. (itstool) path: page/p 21285#: C/linkbutton.c.page:24 21286msgid "This button links to the GNOME live webpage." 21287msgstr "" 21288 21289#. (itstool) path: page/code 21290#: C/linkbutton.c.page:26 21291#, no-wrap 21292msgid "" 21293"\n" 21294"#include <gtk/gtk.h>\n" 21295"\n" 21296"static void\n" 21297"activate (GtkApplication *app,\n" 21298" gpointer user_data)\n" 21299"{\n" 21300" GtkWidget *window;\n" 21301" GtkWidget *linkbutton;\n" 21302"\n" 21303" window = gtk_application_window_new (app);\n" 21304"\n" 21305" gtk_window_set_title (GTK_WINDOW (window), \"GNOME LinkButton\");\n" 21306" gtk_window_set_default_size (GTK_WINDOW (window), 250, 50);\n" 21307"\n" 21308" linkbutton = gtk_link_button_new (\"Link to GNOME live!\");\n" 21309" gtk_link_button_set_uri (GTK_LINK_BUTTON(linkbutton), \"http://live.gnome.org\");\n" 21310"\n" 21311" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (linkbutton));\n" 21312"\n" 21313" gtk_widget_show_all (window);\n" 21314"}\n" 21315"\n" 21316"int\n" 21317"main (int argc, char **argv)\n" 21318"{\n" 21319" GtkApplication *app;\n" 21320" int status;\n" 21321"\n" 21322" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 21323" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 21324" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 21325" g_object_unref (app);\n" 21326"\n" 21327" return status;\n" 21328"}\n" 21329msgstr "" 21330 21331#. (itstool) path: item/p 21332#: C/linkbutton.c.page:34 21333#, fuzzy 21334msgid "" 21335"<link href=\"http://developer.gnome.org/gtk3/stable/GtkLinkButton.html" 21336"\">GtkLinkButton</link>" 21337msgstr "" 21338"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 21339"link>" 21340 21341#. (itstool) path: info/title 21342#: C/linkbutton.js.page:8 21343msgctxt "text" 21344msgid "LinkButton (JavaScript)" 21345msgstr "LinkButton (JavaScript)" 21346 21347#. (itstool) path: info/desc 21348#: C/linkbutton.js.page:18 21349#, fuzzy 21350msgid "A button that links to a web page" 21351msgstr "Página de ligações visitadas" 21352 21353#. (itstool) path: page/p 21354#: C/linkbutton.js.page:23 21355#, fuzzy 21356msgid "A button that links to live.gnome.org." 21357msgstr "Ligações simbólicas" 21358 21359#. (itstool) path: page/code 21360#: C/linkbutton.js.page:25 21361#, fuzzy, no-wrap 21362#| msgid "" 21363#| "#!/usr/bin/gjs\n" 21364#| "\n" 21365#| "const GLib = imports.gi.GLib;\n" 21366#| "const Gtk = imports.gi.Gtk;\n" 21367#| "const Lang = imports.lang;\n" 21368#| "const Webkit = imports.gi.WebKit;\n" 21369#| "\n" 21370#| "const HelloGNOME = new Lang.Class ({\n" 21371#| " Name: 'Hello GNOME',\n" 21372#| "\n" 21373#| " // Create the application itself\n" 21374#| " _init: function () {\n" 21375#| " this.application = new Gtk.Application ();\n" 21376#| "\n" 21377#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 21378#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 21379#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 21380#| " },\n" 21381#| "\n" 21382#| " // Callback function for 'activate' signal presents windows when active\n" 21383#| " _onActivate: function () {\n" 21384#| " this._window.present ();\n" 21385#| " },\n" 21386#| "\n" 21387#| " // Callback function for 'startup' signal builds the UI\n" 21388#| " _onStartup: function () {\n" 21389#| " this._buildUI ();\n" 21390#| " },\n" 21391#| "\n" 21392#| " // Build the application's UI\n" 21393#| " _buildUI: function () {\n" 21394#| "\n" 21395#| " // Create the application window\n" 21396#| " this._window = new Gtk.ApplicationWindow ({\n" 21397#| " application: this.application,\n" 21398#| " title: \"Welcome to GNOME\",\n" 21399#| " default_height: 200,\n" 21400#| " default_width: 400,\n" 21401#| " window_position: Gtk.WindowPosition.CENTER });\n" 21402#| "\n" 21403#| " // Create a webview to show the web app\n" 21404#| " this._webView = new Webkit.WebView ();\n" 21405#| "\n" 21406#| " // Put the web app into the webview\n" 21407#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 21408#| " \"/hellognome.html\", null));\n" 21409#| "\n" 21410#| " // Put the webview into the window\n" 21411#| " this._window.add (this._webView);\n" 21412#| "\n" 21413#| " // Show the window and all child widgets\n" 21414#| " this._window.show_all();\n" 21415#| " },\n" 21416#| "\n" 21417#| "});\n" 21418#| "\n" 21419#| "// Run the application\n" 21420#| "let app = new HelloGNOME ();\n" 21421#| "app.application.run (ARGV);\n" 21422msgid "" 21423"#!/usr/bin/gjs\n" 21424"\n" 21425"imports.gi.versions.Gtk = '3.0';\n" 21426"\n" 21427"const Gio = imports.gi.Gio;\n" 21428"const GLib = imports.gi.GLib;\n" 21429"const Gtk = imports.gi.Gtk;\n" 21430"\n" 21431"class LinkButtonExample {\n" 21432"\n" 21433" // Create the application itself\n" 21434" constructor() {\n" 21435" this.application = new Gtk.Application({\n" 21436" application_id: 'org.example.jslinkbutton',\n" 21437" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 21438" });\n" 21439"\n" 21440" // Connect 'activate' and 'startup' signals to the callback functions\n" 21441" this.application.connect('activate', this._onActivate.bind(this));\n" 21442" this.application.connect('startup', this._onStartup.bind(this));\n" 21443" }\n" 21444"\n" 21445" // Callback function for 'activate' signal presents window when active\n" 21446" _onActivate() {\n" 21447" this._window.present();\n" 21448" }\n" 21449"\n" 21450" // Callback function for 'startup' signal initializes menus and builds the UI\n" 21451" _onStartup() {\n" 21452" this._buildUI();\n" 21453" }\n" 21454"\n" 21455" // Build the application's UI\n" 21456" _buildUI() {\n" 21457"\n" 21458" // Create the application window\n" 21459" this._window = new Gtk.ApplicationWindow ({ application: this.application,\n" 21460" window_position: Gtk.WindowPosition.CENTER,\n" 21461" title: \"GNOME LinkButton\",\n" 21462" default_height: 50,\n" 21463" default_width: 250 });\n" 21464"\n" 21465" // Create the LinkButton and have it link to live.gnome.org\n" 21466" this.LinkButton = new Gtk.LinkButton ({label: \"Link to GNOME live!\",\n" 21467" uri: \"http://live.gnome.org\"});\n" 21468" this._window.add (this.LinkButton);\n" 21469"\n" 21470" // Show the window and all child widgets\n" 21471" this._window.show_all();\n" 21472" }\n" 21473"};\n" 21474"\n" 21475"// Run the application\n" 21476"let app = new LinkButtonExample ();\n" 21477"app.application.run (ARGV);\n" 21478msgstr "" 21479"#!/usr/bin/gjs\n" 21480"\n" 21481"const GLib = imports.gi.GLib;\n" 21482"const Gtk = imports.gi.Gtk;\n" 21483"const Lang = imports.lang;\n" 21484"const Webkit = imports.gi.WebKit;\n" 21485"\n" 21486"const HelloGNOME = new Lang.Class ({\n" 21487" Name: 'Olá, GNOME',\n" 21488"\n" 21489" // Cria o aplicativo em si\n" 21490" _init: function () {\n" 21491" this.application = new Gtk.Application ();\n" 21492"\n" 21493" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 21494" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 21495" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 21496" },\n" 21497"\n" 21498" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 21499" _onActivate: function () {\n" 21500" this._window.present ();\n" 21501" },\n" 21502"\n" 21503" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 21504" _onStartup: function () {\n" 21505" this._buildUI ();\n" 21506" },\n" 21507"\n" 21508" // Constrói a interface gráfica do aplicativo\n" 21509" _buildUI: function () {\n" 21510"\n" 21511" // Cria a janela do aplicativo\n" 21512" this._window = new Gtk.ApplicationWindow ({\n" 21513" application: this.application,\n" 21514" title: \"Bem-vindo ao GNOME\",\n" 21515" default_height: 200,\n" 21516" default_width: 400,\n" 21517" window_position: Gtk.WindowPosition.CENTER });\n" 21518"\n" 21519" // Cria um webview para mostrar o aplicativo web\n" 21520" this._webView = new Webkit.WebView ();\n" 21521"\n" 21522" // Coloca o aplicativo web no webview\n" 21523" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 21524" \"/hellognome.html\", null));\n" 21525"\n" 21526" // Coloca o webview na janela\n" 21527" this._window.add (this._webView);\n" 21528"\n" 21529" // Mostra a janela e todos seus widgets filhos\n" 21530" this._window.show_all();\n" 21531" },\n" 21532"\n" 21533"});\n" 21534"\n" 21535"// Executa o aplicativo\n" 21536"let app = new HelloGNOME ();\n" 21537"app.application.run (ARGV);\n" 21538 21539#. (itstool) path: item/p 21540#: C/linkbutton.js.page:32 21541msgid "" 21542"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.LinkButton." 21543"html\">Gtk.LinkButton</link>" 21544msgstr "" 21545 21546#. (itstool) path: info/title 21547#: C/linkbutton.py.page:8 21548msgctxt "text" 21549msgid "LinkButton (Python)" 21550msgstr "LinkButton (Python)" 21551 21552#. (itstool) path: info/desc 21553#: C/linkbutton.py.page:19 21554#, fuzzy 21555msgid "A button bound to an URL" 21556msgstr "O URI ligado a botão" 21557 21558#. (itstool) path: page/p 21559#: C/linkbutton.py.page:25 21560#, fuzzy 21561msgid "A button that links to a web page." 21562msgstr "Página de ligações visitadas" 21563 21564#. (itstool) path: section/code 21565#: C/linkbutton.py.page:32 21566#, no-wrap 21567msgid "" 21568"from gi.repository import Gtk\n" 21569"import sys\n" 21570"\n" 21571"\n" 21572"class MyWindow(Gtk.ApplicationWindow):\n" 21573" # a window\n" 21574"\n" 21575" def __init__(self, app):\n" 21576" Gtk.Window.__init__(self, title=\"GNOME LinkButton\", application=app)\n" 21577" self.set_default_size(250, 50)\n" 21578"\n" 21579" # a linkbutton pointing to the given URI\n" 21580" button = Gtk.LinkButton(uri=\"http://live.gnome.org\")\n" 21581" # with given text\n" 21582" button.set_label(\"Link to GNOME live!\")\n" 21583"\n" 21584" # add the button to the window\n" 21585" self.add(button)\n" 21586"\n" 21587"\n" 21588"class MyApplication(Gtk.Application):\n" 21589"\n" 21590" def __init__(self):\n" 21591" Gtk.Application.__init__(self)\n" 21592"\n" 21593" def do_activate(self):\n" 21594" win = MyWindow(self)\n" 21595" win.show_all()\n" 21596"\n" 21597" def do_startup(self):\n" 21598" Gtk.Application.do_startup(self)\n" 21599"\n" 21600"app = MyApplication()\n" 21601"exit_status = app.run(sys.argv)\n" 21602"sys.exit(exit_status)\n" 21603msgstr "" 21604 21605#. (itstool) path: section/title 21606#: C/linkbutton.py.page:36 21607#, fuzzy 21608msgid "Useful methods for a LinkButton widget" 21609msgstr "Métodos úteis" 21610 21611#. (itstool) path: item/p 21612#: C/linkbutton.py.page:38 21613msgid "" 21614"<code>get_visited()</code> returns the 'visited' state (<code>True</code> or " 21615"<code>False</code>) of the URI where the LinkButton points. The button " 21616"becomes visited when it is clicked." 21617msgstr "" 21618 21619#. (itstool) path: item/p 21620#: C/linkbutton.py.page:39 21621msgid "" 21622"<code>set_visited(True)</code> sets the 'visited' state of the URI where the " 21623"LinkButton points as <code>True</code> (analogously for <code>False</code>)." 21624msgstr "" 21625 21626#. (itstool) path: item/p 21627#: C/linkbutton.py.page:40 21628msgid "" 21629"Each time the button is clicked, the signal <code>\"activate-link\"</code> " 21630"is emitted. For an explanation of signals and callback functions, see <link " 21631"xref=\"signals-callbacks.py\"/>." 21632msgstr "" 21633 21634#. (itstool) path: item/p 21635#: C/linkbutton.py.page:48 21636msgid "" 21637"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkLinkButton.html" 21638"\">GtkLinkButton</link>" 21639msgstr "" 21640 21641#. (itstool) path: info/title 21642#: C/linkbutton.vala.page:8 21643msgctxt "text" 21644msgid "LinkButton (Vala)" 21645msgstr "LinkButton (Vala)" 21646 21647#. (itstool) path: page/p 21648#: C/linkbutton.vala.page:23 21649msgid "This button links to GNOME live." 21650msgstr "" 21651 21652#. (itstool) path: page/code 21653#: C/linkbutton.vala.page:25 21654#, no-wrap 21655msgid "" 21656"/* This is the application. */\n" 21657"public class MyApplication : Gtk.Application {\n" 21658"\t/* Override the 'activate' signal of GLib.Application. */\n" 21659"\tprotected override void activate () {\n" 21660"\n" 21661"\t\t/* Create the window of this application and child widget and show all the things. */\n" 21662"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 21663"\t\twindow.set_default_size (250, 50);\n" 21664"\t\twindow.title = \"GNOME LinkButton\";\n" 21665"\n" 21666"\t\tvar linkbutton = new Gtk.LinkButton.with_label (\"http://live.gnome.org\", \"Link to GNOME live!\");\n" 21667"\n" 21668"\t\twindow.add (linkbutton);\n" 21669"\t\twindow.show_all ();\n" 21670"\t}\n" 21671"}\n" 21672"\n" 21673"/* main creates and runs the application. */\n" 21674"public int main (string[] args) {\n" 21675"\treturn new MyApplication ().run (args);\n" 21676"}\n" 21677msgstr "" 21678 21679#. (itstool) path: item/p 21680#: C/linkbutton.vala.page:30 21681msgid "" 21682"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.LinkButton.html\">Gtk." 21683"LinkButton</link>" 21684msgstr "" 21685 21686#. (itstool) path: info/title 21687#: C/magic-mirror.vala.page:8 21688#, fuzzy 21689msgctxt "text" 21690msgid "Magic mirror (Vala)" 21691msgstr "_Espelhar" 21692 21693#. (itstool) path: info/desc 21694#: C/magic-mirror.vala.page:11 21695msgid "Use your webcam as a mirror using the GStreamer framework and GTK+" 21696msgstr "" 21697 21698#. (itstool) path: credit/name 21699#: C/magic-mirror.vala.page:15 21700msgid "Daniel G. Siegel" 21701msgstr "Daniel G. Siegel" 21702 21703#. (itstool) path: page/title 21704#: C/magic-mirror.vala.page:29 21705#, fuzzy 21706msgid "Magic mirror" 21707msgstr "_Espelhar" 21708 21709#. (itstool) path: synopsis/p 21710#: C/magic-mirror.vala.page:32 21711msgid "" 21712"<em>Your mirror just fell off the wall and broke into a thousand pieces — " 21713"but you need a mirror to shave your beard off or add some makeup! You only " 21714"have 15 minutes left before catching the bus to work. So what can you do?</" 21715"em>" 21716msgstr "" 21717 21718#. (itstool) path: synopsis/p 21719#: C/magic-mirror.vala.page:33 21720msgid "" 21721"In this tutorial, we're going to make a program which lets you use your " 21722"webcam as a mirror. You will learn how to:" 21723msgstr "" 21724 21725#. (itstool) path: item/p 21726#: C/magic-mirror.vala.page:35 21727#, fuzzy 21728msgid "Create a GTK+ application" 21729msgstr "GTK+ (Aplicativo)" 21730 21731#. (itstool) path: item/p 21732#: C/magic-mirror.vala.page:36 21733msgid "Access your webcam using GStreamer and embed the result into a window" 21734msgstr "" 21735 21736#. (itstool) path: item/p 21737#: C/magic-mirror.vala.page:37 21738#, fuzzy 21739msgid "Grab photos off your webcam" 21740msgstr "Usando a sua webcam para tirar fotos em vez de gravar vídeos." 21741 21742#. (itstool) path: item/p 21743#: C/magic-mirror.vala.page:42 21744msgid "Installed copies of GTK, GStreamer, and a Vala compiler" 21745msgstr "" 21746 21747#. (itstool) path: item/p 21748#: C/magic-mirror.vala.page:43 21749msgid "Basic knowledge of an object-oriented programming language" 21750msgstr "" 21751 21752#. (itstool) path: page/media 21753#. This is a reference to an external file such as an image or video. When 21754#. the file changes, the md5 hash will change to let you know you need to 21755#. update your localized copy. The msgstr is not used at all. Set it to 21756#. whatever you like once you have updated your copy of the file. 21757#: C/magic-mirror.vala.page:47 21758msgctxt "_" 21759msgid "" 21760"external ref='media/magic-mirror.png' md5='8171faea6ed3b6ddac0da084c29e4e22'" 21761msgstr "" 21762 21763#. (itstool) path: item/p 21764#: C/magic-mirror.vala.page:57 21765msgid "" 21766"Choose <gui>GTK+ (simple)</gui> from the <gui>Vala</gui> tab, click " 21767"<gui>Forward</gui>, and fill out your details on the next few pages. Use " 21768"<file>magic-mirror</file> as project name and directory." 21769msgstr "" 21770 21771#. (itstool) path: item/p 21772#: C/magic-mirror.vala.page:60 21773msgid "" 21774"Disable <gui>Use GtkBuilder for user interface</gui> as we will create the " 21775"UI manually in this tutorial. Check the <link xref=\"guitar-tuner.vala" 21776"\">Guitar-Tuner</link> tutorial using the interface builder." 21777msgstr "" 21778 21779#. (itstool) path: item/p 21780#: C/magic-mirror.vala.page:65 21781msgid "" 21782"Make sure that <gui>Configure external packages</gui> is selected. On the " 21783"next page, select <em>gstreamer-0.10</em> from the list to include the " 21784"<app>GStreamer</app> library into your project." 21785msgstr "" 21786 21787#. (itstool) path: item/p 21788#: C/magic-mirror.vala.page:69 21789msgid "" 21790"Click <gui>Apply</gui> and the project will be created for you. Open " 21791"<file>src/magic_mirror.vala</file> from the <gui>Project</gui> or <gui>File</" 21792"gui> tabs. You should see some code which starts with the lines:" 21793msgstr "" 21794 21795#. (itstool) path: section/p 21796#: C/magic-mirror.vala.page:79 21797msgid "" 21798"The code loads an (empty) window and shows it. More details are given below; " 21799"skip this list if you understand the basics:" 21800msgstr "" 21801 21802#. (itstool) path: item/p 21803#: C/magic-mirror.vala.page:85 21804msgid "" 21805"The constructor of the <code>Main</code> class creates a new window and sets " 21806"its title. Afterwards the window is shown and a signal is connected which " 21807"quits the application if the window is closed. More on signals later on." 21808msgstr "" 21809 21810#. (itstool) path: item/p 21811#: C/magic-mirror.vala.page:89 21812msgid "" 21813"The static <code>main</code> function is run by default when you start a " 21814"Vala application. It calls a few functions which create the Main class, set " 21815"up and then run the application. The <code>Gtk.Main</code> function starts " 21816"the GTK main loop, which runs the user interface and starts listening for " 21817"events (like clicks and key presses)." 21818msgstr "" 21819 21820#. (itstool) path: section/title 21821#: C/magic-mirror.vala.page:98 21822msgid "Access the webcam video stream with GStreamer" 21823msgstr "" 21824 21825#. (itstool) path: section/p 21826#: C/magic-mirror.vala.page:99 21827msgid "" 21828"The GStreamer multimedia framework is able to handle video from webcams. " 21829"Let's add GStreamer to our application and so we can access the video stream." 21830msgstr "" 21831 21832#. (itstool) path: section/code 21833#: C/magic-mirror.vala.page:101 21834#, no-wrap 21835msgid "" 21836"\n" 21837"using GLib;\n" 21838"using Gtk;\n" 21839"\n" 21840"public class Main : Object\n" 21841"{\n" 21842"\tprivate Gst.Element camerabin;\n" 21843"\n" 21844"\tpublic Main () {\n" 21845"\t\tthis.camerabin = Gst.ElementFactory.make (\"camerabin\", \"camera\");\n" 21846"\t\tthis.camerabin.set_state (Gst.State.PLAYING);\n" 21847"\t}\n" 21848"\n" 21849"\tstatic int main (string[] args) {\n" 21850"\t\tGtk.init (ref args);\n" 21851"\t\tGst.init (ref args);\n" 21852"\t\tvar app = new Main ();\n" 21853"\n" 21854"\t\tGtk.main ();\n" 21855"\n" 21856"\t\treturn 0;\n" 21857"\t}\n" 21858"}\n" 21859msgstr "" 21860 21861#. (itstool) path: item/p 21862#: C/magic-mirror.vala.page:126 21863msgid "" 21864"First we remove the window we created before because GStreamer will take " 21865"care of showing the picture on screen." 21866msgstr "" 21867 21868#. (itstool) path: item/p 21869#: C/magic-mirror.vala.page:130 21870msgid "" 21871"Now we are creating a GStreamer element which accesses our webcam. We are " 21872"using the Camerabin element, which is an all-in-one camera element and is " 21873"capable of taking photos, videos, applying effects and much more. Perfect " 21874"for our use case! With <code>this.camerabin.set_state (Gst.State.PLAYING)</" 21875"code> we tell the GStreamer pipeline we just created to start playing. Easy, " 21876"no?" 21877msgstr "" 21878 21879#. (itstool) path: item/p 21880#: C/magic-mirror.vala.page:137 21881msgid "" 21882"Of course it is also possible to integrate the video more tightly into other " 21883"windows but that is an advanced topic that includes some details of the X " 21884"Window System we will omit here." 21885msgstr "" 21886 21887#. (itstool) path: item/p 21888#: C/magic-mirror.vala.page:141 21889msgid "" 21890"Compile and run it again. You will end up with two windows. In the next step " 21891"we will integrate the video into the GTK+ window." 21892msgstr "" 21893 21894#. (itstool) path: section/p 21895#: C/magic-mirror.vala.page:151 21896msgid "" 21897"If you run into problems with the tutorial, compare your code with this " 21898"<link href=\"magic-mirror/magic-mirror.vala\">reference code</link>. There " 21899"is also a more <link href=\"magic-mirror/magic-mirror-advanced.vala" 21900"\">extensive implementation</link> that embeds the window into a regular Gtk." 21901"Window which involves some advanced techniques, and adds buttons to start/" 21902"stop the picture." 21903msgstr "" 21904 21905#. (itstool) path: section/p 21906#: C/magic-mirror.vala.page:158 21907msgid "" 21908"To find out more about the Vala programming language you might want to check " 21909"out the <link href=\"http://live.gnome.org/Vala/Tutorial\">Vala Tutorial</" 21910"link>." 21911msgstr "" 21912 21913#. (itstool) path: section/title 21914#: C/magic-mirror.vala.page:163 21915#, fuzzy 21916msgid "Conclusion" 21917msgstr "Conclusão" 21918 21919#. (itstool) path: section/p 21920#: C/magic-mirror.vala.page:164 21921msgid "" 21922"That's it, you have managed to create a full-featured webcam photo " 21923"application in 15 minutes. Now you can shave your beard off or add some " 21924"makeup to your beautiful face, right before having a beautiful day at your " 21925"workplace, where you can impress your friends and colleagues with an awesome " 21926"application you just made in 15 minutes." 21927msgstr "" 21928 21929#. (itstool) path: info/title 21930#: C/menubar.c.page:8 21931msgctxt "text" 21932msgid "MenuBar (C)" 21933msgstr "MenuBar (C)" 21934 21935#. (itstool) path: info/desc 21936#: C/menubar.c.page:20 C/menubar.py.page:25 C/menubar.vala.page:20 21937msgid "A widget which holds GtkMenuItem widgets" 21938msgstr "" 21939 21940#. (itstool) path: page/title 21941#: C/menubar.c.page:23 C/menubar.vala.page:23 21942msgid "MenuBar" 21943msgstr "MenuBar" 21944 21945#. (itstool) path: page/media 21946#. This is a reference to an external file such as an image or video. When 21947#. the file changes, the md5 hash will change to let you know you need to 21948#. update your localized copy. The msgstr is not used at all. Set it to 21949#. whatever you like once you have updated your copy of the file. 21950#: C/menubar.c.page:25 C/menubar.py.page:29 C/menubar.vala.page:24 21951msgctxt "_" 21952msgid "external ref='media/menubar.png' md5='7b642aaa1628d5e43ab85ac230ac1c78'" 21953msgstr "" 21954"external ref='media/menubar.png' md5='7b642aaa1628d5e43ab85ac230ac1c78'" 21955 21956#. (itstool) path: page/p 21957#: C/menubar.c.page:26 C/menubar.py.page:30 C/menubar.vala.page:25 21958msgid "A MenuBar created using XML and GtkBuilder." 21959msgstr "" 21960 21961#. (itstool) path: note/p 21962#: C/menubar.c.page:27 21963msgid "" 21964"For a more in-depth look at this sample, please do not hesitate to check out " 21965"the <link xref=\"menubar.vala\">Vala MenuBar</link> and/or <link xref=" 21966"\"menubar.py\">Python MenuBar</link> tutorials." 21967msgstr "" 21968 21969#. (itstool) path: page/code 21970#: C/menubar.c.page:31 21971#, no-wrap 21972msgid "" 21973"\n" 21974"#include <gtk/gtk.h>\n" 21975"\n" 21976"\n" 21977"\n" 21978"/* Callback function for the \"copy\" action */\n" 21979"static void\n" 21980"copy_callback (GSimpleAction *simple,\n" 21981" GVariant *parameter,\n" 21982" gpointer user_data)\n" 21983"{\n" 21984" g_print (\"\\\"Copy\\\" activated\\n\");\n" 21985"}\n" 21986"\n" 21987"\n" 21988"\n" 21989"/* Callback function for the \"paste\" action */\n" 21990"static void\n" 21991"paste_callback (GSimpleAction *simple,\n" 21992" GVariant *parameter,\n" 21993" gpointer user_data)\n" 21994"{\n" 21995" g_print (\"\\\"Paste\\\" activated\\n\");\n" 21996"}\n" 21997"\n" 21998"\n" 21999"\n" 22000"/* Callback function for the \"shape\" action */\n" 22001"static void\n" 22002"shape_callback (GSimpleAction *simple,\n" 22003" GVariant *parameter,\n" 22004" gpointer user_data)\n" 22005"{\n" 22006" /* We first gather the value of the GVariant instance with a string type.\n" 22007" * The overall goal here is to see if shape is set to line, triangle, etc,\n" 22008" * and put that value within the variable \"answer\".\n" 22009" */\n" 22010" const gchar *answer = g_variant_get_string (parameter, NULL);\n" 22011" g_printf (\"Shape is set to %s.\\n\", answer);\n" 22012" /* Note that we set the state of the action */\n" 22013" g_simple_action_set_state (simple, parameter);\n" 22014"}\n" 22015"\n" 22016"\n" 22017"\n" 22018"/* Callback function in which closes the about_dialog created below */\n" 22019"static void\n" 22020"on_close (GtkDialog *dialog,\n" 22021" gint response_id,\n" 22022" gpointer user_data)\n" 22023"{\n" 22024" gtk_widget_destroy (GTK_WIDGET (dialog));\n" 22025"}\n" 22026"\n" 22027"\n" 22028"\n" 22029"/* Callback function for the about action (see aboutdialog.c example) */\n" 22030"static void\n" 22031"about_callback (GSimpleAction *simple,\n" 22032" GVariant *parameter,\n" 22033" gpointer user_data)\n" 22034"{\n" 22035" GtkWidget *about_dialog;\n" 22036"\n" 22037" about_dialog = gtk_about_dialog_new ();\n" 22038"\n" 22039" const gchar *authors[] = {\"GNOME Documentation Team\", NULL};\n" 22040" const gchar *documenters[] = {\"GNOME Documentation Team\", NULL};\n" 22041"\n" 22042" /* Fill in the about_dialog with the desired information */\n" 22043" gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), \"AboutDialog Example\");\n" 22044" gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), \"Copyright \\xc2\\xa9 2012 GNOME Documentation Team\");\n" 22045" gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), authors);\n" 22046" gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG (about_dialog), documenters);\n" 22047" gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (about_dialog), \"GNOME Developer Website\");\n" 22048" gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about_dialog), \"http://developer.gnome.org\");\n" 22049"\n" 22050" /* The \"response\" signal is emitted when the dialog receives a delete event,\n" 22051" * therefore we connect that signal to the on_close callback function\n" 22052" * created above.\n" 22053" */\n" 22054" g_signal_connect (GTK_DIALOG (about_dialog), \"response\",\n" 22055" G_CALLBACK (on_close), NULL);\n" 22056"\n" 22057" /* Show the about dialog */\n" 22058" gtk_widget_show (about_dialog);\n" 22059"}\n" 22060"\n" 22061"\n" 22062"\n" 22063"static void\n" 22064"activate (GtkApplication *app,\n" 22065" gpointer user_data)\n" 22066"{\n" 22067" GtkWidget *window;\n" 22068"\n" 22069" GSimpleAction *copy_action;\n" 22070" GSimpleAction *paste_action;\n" 22071" GSimpleAction *shape_action;\n" 22072" GSimpleAction *about_action;\n" 22073"\n" 22074" /* Create a window with a title and a default size */\n" 22075" window = gtk_application_window_new (app);\n" 22076" gtk_window_set_title (GTK_WINDOW (window), \"MenuBar Example\");\n" 22077" gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);\n" 22078"\n" 22079" /* Begin creating the \"copy\" action.\n" 22080" * Note that it is an action without a state.\n" 22081" */\n" 22082" copy_action = g_simple_action_new (\"copy\", NULL);\n" 22083" /* Connected to a callback function */\n" 22084" g_signal_connect (copy_action, \"activate\", G_CALLBACK (copy_callback),\n" 22085" GTK_WINDOW (window));\n" 22086" /* Added to the window */\n" 22087" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (copy_action));\n" 22088"\n" 22089" /* Begin creating the \"paste\" action.\n" 22090" * Note that it is an action without a state.\n" 22091" */\n" 22092" paste_action = g_simple_action_new (\"paste\", NULL);\n" 22093" /* Connect the action to a callback function */\n" 22094" g_signal_connect (paste_action, \"activate\", G_CALLBACK (paste_callback),\n" 22095" GTK_WINDOW (window));\n" 22096" /* Add it to the window */\n" 22097" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (paste_action));\n" 22098"\n" 22099" /* Begin creating the \"shape\" action.\n" 22100" * Note that it is an action with a state.\n" 22101" * First we state that the parameter type of the simple action is a string.\n" 22102" * When using g_variant_type_new, it is appropriate to free the return value\n" 22103" * once you're done with it.\n" 22104" */\n" 22105" GVariantType *type_string = g_variant_type_new (\"s\");\n" 22106" /* parameters for the g_simple_action_new_stateful are: (name, parameter type,\n" 22107" * initial state).\n" 22108" */\n" 22109" shape_action = g_simple_action_new_stateful (\"shape\", type_string,\n" 22110" g_variant_new_string (\"line\"));\n" 22111" /* Connect the action to a callback function */\n" 22112" g_signal_connect (shape_action, \"activate\", G_CALLBACK (shape_callback),\n" 22113" GTK_WINDOW (window));\n" 22114" /* Add it to the window */\n" 22115" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (shape_action));\n" 22116" g_variant_type_free (type_string);\n" 22117"\n" 22118" /* Begin creating the \"about\" action.\n" 22119" * Note that it is an action without a state.\n" 22120" */\n" 22121" about_action = g_simple_action_new (\"about\", NULL);\n" 22122" /* Connect the action to a callback function */\n" 22123" g_signal_connect (about_action, \"activate\", G_CALLBACK (about_callback),\n" 22124" GTK_WINDOW (window));\n" 22125" /* Add it to the window */\n" 22126" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));\n" 22127"\n" 22128" gtk_widget_show_all (window);\n" 22129"}\n" 22130"\n" 22131"\n" 22132"\n" 22133"/* Callback function for the \"new\" action */\n" 22134"static void\n" 22135"new_callback (GSimpleAction *simple,\n" 22136" GVariant *parameter,\n" 22137" gpointer user_data)\n" 22138"{\n" 22139" g_print (\"You clicked \\\"New\\\"\\n\");\n" 22140"}\n" 22141"\n" 22142"\n" 22143"\n" 22144"/* Callback function for the \"quit\" action */\n" 22145"static void\n" 22146"quit_callback (GSimpleAction *simple,\n" 22147" GVariant *parameter,\n" 22148" gpointer user_data)\n" 22149"{\n" 22150" GApplication *application = user_data;\n" 22151"\n" 22152" g_print (\"You clicked \\\"Quit\\\"\\n\");\n" 22153" g_application_quit (application);\n" 22154"}\n" 22155"\n" 22156"\n" 22157"\n" 22158"/* Callback function for the \"state\" action */\n" 22159"static void\n" 22160"state_callback (GSimpleAction *simple,\n" 22161" GVariant *parameter,\n" 22162" gpointer user_data)\n" 22163"{\n" 22164" /* The two possibilities in this case for the \"answer\" variable are either\n" 22165" * \"on\" or \"off\".\n" 22166" */\n" 22167" const gchar *answer = g_variant_get_string (parameter, NULL);\n" 22168" /* We print the information to the user */\n" 22169" g_printf (\"State is set to %s.\\n\", answer);\n" 22170" /* Note that we set the state of the action */\n" 22171" g_simple_action_set_state (simple, parameter);\n" 22172"}\n" 22173"\n" 22174"\n" 22175"\n" 22176"/* Callback function for the \"awesome\" action */\n" 22177"static void\n" 22178"awesome_callback (GSimpleAction *simple,\n" 22179" GVariant *parameter,\n" 22180" gpointer user_data)\n" 22181"{\n" 22182" GVariant *action_state = g_action_get_state (G_ACTION (simple));\n" 22183" gboolean active = g_variant_get_boolean (action_state);\n" 22184" GVariant *new_state = g_variant_new_boolean (!active);\n" 22185" /* Set the new state for the action.\n" 22186" * (Keeps track of whether it was last checked or unchecked).\n" 22187" */\n" 22188" g_simple_action_set_state (simple, new_state);\n" 22189"\n" 22190" if (active)\n" 22191" g_print (\"You unchecked \\\"Awesome\\\"\\n\");\n" 22192" else\n" 22193" g_print (\"You checked \\\"Awesome\\\"\\n\");\n" 22194"}\n" 22195"\n" 22196"\n" 22197"\n" 22198"/* Startup function for the menu we are creating in this sample */\n" 22199"static void\n" 22200"startup (GApplication *app,\n" 22201" gpointer user_data)\n" 22202"{\n" 22203" /* Initialize variables */\n" 22204" GSimpleAction *new_action;\n" 22205" GSimpleAction *quit_action;\n" 22206" GSimpleAction *state_action;\n" 22207" GSimpleAction *awesome_action;\n" 22208"\n" 22209" GtkBuilder *builder;\n" 22210"\n" 22211" GError *error = NULL;\n" 22212"\n" 22213" /* Begin creating the \"new\" action.\n" 22214" * Note that it is an action without a state.\n" 22215" */\n" 22216" new_action = g_simple_action_new (\"new\", NULL);\n" 22217" g_signal_connect (new_action, \"activate\", G_CALLBACK (new_callback), app);\n" 22218" /* It is added to the overall application */\n" 22219" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));\n" 22220"\n" 22221" /* Begin creating the \"quit\" action.\n" 22222" * Note that it is an action without a state.\n" 22223" */\n" 22224" quit_action = g_simple_action_new (\"quit\", NULL);\n" 22225" g_signal_connect (quit_action, \"activate\", G_CALLBACK (quit_callback), app);\n" 22226" /* It is added to the overall application */\n" 22227" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));\n" 22228"\n" 22229" /* Begin creating the \"state\" action.\n" 22230" * Note that it is an action with a state.\n" 22231" */\n" 22232" GVariantType *type_string2 = g_variant_type_new (\"s\");\n" 22233" state_action = g_simple_action_new_stateful (\"state\", type_string2,\n" 22234" g_variant_new_string (\"off\"));\n" 22235" g_signal_connect (state_action, \"activate\", G_CALLBACK (state_callback), app);\n" 22236" /* It is added to the overall application */\n" 22237" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (state_action));\n" 22238" g_variant_type_free (type_string2);\n" 22239"\n" 22240" /* Begin creating the \"awesome\" action.\n" 22241" * Note that it is an action with a state.\n" 22242" */\n" 22243" awesome_action = g_simple_action_new_stateful (\"awesome\", NULL, g_variant_new_boolean (FALSE));\n" 22244" g_signal_connect (awesome_action, \"activate\", G_CALLBACK (awesome_callback), app);\n" 22245" /* It is added to the overall application */\n" 22246" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (awesome_action));\n" 22247"\n" 22248" /* A builder to add the User Interface designed with GLADE to the grid: */\n" 22249" builder = gtk_builder_new ();\n" 22250" /* Get the file (if it is there):\n" 22251" * Note: you must make sure that the file is in the current directory for\n" 22252" * this to work. The function used here returns a non-null value within\n" 22253" * our variable \"error\" if an error is indeed found.\n" 22254" */\n" 22255" gtk_builder_add_from_file (builder, \"menubar.ui\", &error);\n" 22256" if (error != NULL) {\n" 22257" g_print (\"%s\\n\", error->message);\n" 22258" g_error_free (error);\n" 22259" }\n" 22260"\n" 22261" /* Extract the menubar */\n" 22262" GObject *menubar = gtk_builder_get_object (builder, \"menubar\");\n" 22263" gtk_application_set_menubar (GTK_APPLICATION (app), G_MENU_MODEL (menubar));\n" 22264"\n" 22265" /* Extract the appmenu */\n" 22266" GObject *appmenu = gtk_builder_get_object (builder, \"appmenu\");\n" 22267" gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (appmenu));\n" 22268"}\n" 22269"\n" 22270"\n" 22271"\n" 22272"/* Startup function for the application */\n" 22273"int\n" 22274"main (int argc, char **argv)\n" 22275"{\n" 22276" GtkApplication *app;\n" 22277" int status;\n" 22278"\n" 22279" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 22280" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 22281" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 22282" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 22283" g_object_unref (app);\n" 22284"\n" 22285" return status;\n" 22286"}\n" 22287msgstr "" 22288 22289#. (itstool) path: item/p 22290#: C/menubar.c.page:37 C/scrolledwindow.c.page:34 22291#, fuzzy 22292msgid "" 22293"<link href=\"http://developer.gnome.org/gtk3/stable/GtkApplication.html" 22294"\">GtkApplication</link>" 22295msgstr "" 22296"<link href=\"https://developer.gnome.org/gtk3/stable/GtkApplication.html" 22297"\">GtkApplication</link>" 22298 22299#. (itstool) path: item/p 22300#: C/menubar.c.page:40 22301msgid "" 22302"<link href=\"http://developer.gnome.org/gtk/stable/GtkAboutDialog.html" 22303"\">GtkAboutDialog</link>" 22304msgstr "" 22305 22306#. (itstool) path: item/p 22307#: C/menubar.c.page:41 22308#, fuzzy 22309msgid "" 22310"<link href=\"http://developer.gnome.org/glib/stable/glib-GVariantType.html" 22311"\">GtkVariantType</link>" 22312msgstr "" 22313"<link href=\"http://developer.gnome.org/glib/stable/\">Manual de referência " 22314"do GLib</link>" 22315 22316#. (itstool) path: info/title 22317#: C/menubar.py.page:8 22318msgctxt "text" 22319msgid "MenuBar (Python)" 22320msgstr "MenuBar (Python)" 22321 22322#. (itstool) path: page/title 22323#: C/menubar.py.page:28 22324msgid "MenuBar created using XML and GtkBuilder" 22325msgstr "" 22326 22327#. (itstool) path: section/title 22328#: C/menubar.py.page:34 C/menubar.vala.page:29 22329#, fuzzy 22330msgid "Create a MenuBar using XML" 22331msgstr "Usando as descrições em XML em %s\n" 22332 22333#. (itstool) path: section/p 22334#: C/menubar.py.page:35 C/menubar.vala.page:30 22335#, fuzzy 22336msgid "To create the menubar using XML:" 22337msgstr "Usando as descrições em XML em %s\n" 22338 22339#. (itstool) path: item/p 22340#: C/menubar.py.page:37 C/menubar.vala.page:32 22341msgid "Create <file>menubar.ui</file> using your favorite text editor." 22342msgstr "" 22343 22344#. (itstool) path: item/p 22345#: C/menubar.py.page:38 C/menubar.vala.page:33 22346#, fuzzy 22347msgid "Enter the following line at the top of the file:" 22348msgstr "Adicione a seguinte linha no <file>Makefile.am</file>:" 22349 22350#. (itstool) path: item/code 22351#: C/menubar.py.page:39 C/menubar.vala.page:34 22352#, no-wrap 22353msgid "" 22354"\n" 22355"<?xml version=\"1.0\"? encoding=\"UTF-8\"?>" 22356msgstr "" 22357"\n" 22358"<?xml version=\"1.0\"? encoding=\"UTF-8\"?>" 22359 22360#. (itstool) path: item/p 22361#: C/menubar.py.page:42 C/menubar.vala.page:37 22362msgid "" 22363"We want to create the interface which will contain our menubar and its " 22364"submenus. Our menubar will contain <gui>File</gui>, <gui>Edit</gui>, " 22365"<gui>Choices</gui> and <gui>Help</gui> submenus. We add the following XML " 22366"code to the file:" 22367msgstr "" 22368 22369#. (itstool) path: item/code 22370#: C/menubar.py.page:43 C/menubar.vala.page:38 22371#, no-wrap 22372msgid "" 22373"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 22374"<interface>\n" 22375" <menu id=\"menubar\">\n" 22376" <submenu>\n" 22377" <attribute name=\"label\">File</attribute>\n" 22378" </submenu>\n" 22379" <submenu>\n" 22380" <attribute name=\"label\">Edit</attribute>\n" 22381" </submenu>\n" 22382" <submenu>\n" 22383" <attribute name=\"label\">Choices</attribute>\n" 22384" </submenu>\n" 22385" <submenu>\n" 22386" <attribute name=\"label\">Help</attribute>\n" 22387" </submenu>\n" 22388" </menu>\n" 22389"</interface>\n" 22390msgstr "" 22391 22392#. (itstool) path: item/p 22393#: C/menubar.py.page:45 22394msgid "" 22395"Now we will create the .py file and use GtkBuilder to import the " 22396"<file>menubar.ui</file> we just created." 22397msgstr "" 22398 22399#. (itstool) path: section/title 22400#: C/menubar.py.page:49 C/menubar.vala.page:43 22401msgid "Add the MenuBar to the window using GtkBuilder" 22402msgstr "" 22403 22404#. (itstool) path: section/code 22405#: C/menubar.py.page:50 22406#, no-wrap 22407msgid "" 22408"from gi.repository import Gtk\n" 22409"import sys\n" 22410"\n" 22411"\n" 22412"class MyWindow(Gtk.ApplicationWindow):\n" 22413"\n" 22414" def __init__(self, app):\n" 22415" Gtk.Window.__init__(self, title=\"MenuBar Example\", application=app)\n" 22416" self.set_default_size(200, 200)\n" 22417"\n" 22418"\n" 22419"class MyApplication(Gtk.Application):\n" 22420"\n" 22421" def __init__(self):\n" 22422" Gtk.Application.__init__(self)\n" 22423"\n" 22424" def do_activate(self):\n" 22425" win = MyWindow(self)\n" 22426" win.show_all()\n" 22427"\n" 22428" def do_startup(self):\n" 22429" Gtk.Application.do_startup(self)\n" 22430"\n" 22431" # a builder to add the UI designed with Glade to the grid:\n" 22432" builder = Gtk.Builder()\n" 22433" # get the file (if it is there)\n" 22434" try:\n" 22435" builder.add_from_file(\"menubar_basis.ui\")\n" 22436" except:\n" 22437" print(\"file not found\")\n" 22438" sys.exit()\n" 22439"\n" 22440" # we use the method Gtk.Application.set_menubar(menubar) to add the menubar\n" 22441" # to the application (Note: NOT the window!)\n" 22442" self.set_menubar(builder.get_object(\"menubar\"))\n" 22443"\n" 22444"app = MyApplication()\n" 22445"exit_status = app.run(sys.argv)\n" 22446"sys.exit(exit_status)\n" 22447msgstr "" 22448 22449#. (itstool) path: section/p 22450#: C/menubar.py.page:51 22451msgid "" 22452"Now run the python application. It should look like the picture at the top " 22453"of this page." 22454msgstr "" 22455 22456#. (itstool) path: section/title 22457#: C/menubar.py.page:55 C/menubar.vala.page:51 22458#, fuzzy 22459msgid "Add items to the menus" 22460msgstr "Adicionar _novos itens…" 22461 22462#. (itstool) path: section/p 22463#: C/menubar.py.page:56 C/menubar.vala.page:52 22464msgid "" 22465"We start off by adding 2 menuitems to the <gui>File</gui> menu: <gui>New</" 22466"gui> and <gui>Quit</gui>. We do this by adding a <code>section</code> to the " 22467"the <code>File</code> submenu with these items. The <file>menubar.ui</file> " 22468"should look like this (lines 6 to 13 inclusive comprise the newly added " 22469"section):" 22470msgstr "" 22471 22472#. (itstool) path: listing/title 22473#: C/menubar.py.page:59 22474msgid "menubar.ui" 22475msgstr "" 22476 22477#. (itstool) path: listing/code 22478#. (itstool) path: section/code 22479#: C/menubar.py.page:60 C/menubar.vala.page:53 22480#, no-wrap 22481msgid "" 22482"\n" 22483"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 22484"<interface>\n" 22485" <menu id=\"menubar\">\n" 22486" <submenu>\n" 22487" <attribute name=\"label\">File</attribute>\n" 22488" <section>\n" 22489" <item>\n" 22490" <attribute name=\"label\">New</attribute>\n" 22491" </item>\n" 22492" <item>\n" 22493" <attribute name =\"label\">Quit</attribute>\n" 22494" </item>\n" 22495" </section>\n" 22496" </submenu>\n" 22497" <submenu>\n" 22498" <attribute name=\"label\">Edit</attribute>\n" 22499" </submenu>\n" 22500" <submenu>\n" 22501" <attribute name=\"label\">Choices</attribute>\n" 22502" </submenu>\n" 22503" <submenu>\n" 22504" <attribute name=\"label\">Help</attribute>\n" 22505" </submenu>\n" 22506" </menu>\n" 22507"</interface>" 22508msgstr "" 22509 22510#. (itstool) path: section/p 22511#: C/menubar.py.page:88 22512msgid "" 22513"Following this pattern, you can now add a <code>Copy</code> and a " 22514"<code>Paste</code> item to the <code>Edit</code> submenu, and an " 22515"<code>About</code> item to the <code>Help</code> submenu." 22516msgstr "" 22517 22518#. (itstool) path: section/title 22519#: C/menubar.py.page:93 C/menubar.vala.page:87 22520#, fuzzy 22521msgid "Setup actions" 22522msgstr "" 22523"Ajustar ações personalizadas que aparecerão nos menus de contexto do " 22524"gerenciador de arquivos" 22525 22526#. (itstool) path: section/p 22527#: C/menubar.py.page:95 22528msgid "" 22529"We now create the actions for \"New\" and \"Quit\" connected to a callback " 22530"function in the Python file; for instance we create \"new\" as:" 22531msgstr "" 22532 22533#. (itstool) path: section/code 22534#: C/menubar.py.page:96 22535#, no-wrap 22536msgid "" 22537"\n" 22538"new_action = Gio.SimpleAction.new(\"new\", None)\n" 22539"new_action.connect(\"activate\", self.new_callback)" 22540msgstr "" 22541 22542#. (itstool) path: section/p 22543#: C/menubar.py.page:100 22544msgid "And we create the callback function of \"new\" as" 22545msgstr "" 22546 22547#. (itstool) path: section/code 22548#: C/menubar.py.page:101 22549#, no-wrap 22550msgid "" 22551"\n" 22552"def new_callback(self, action, parameter):\n" 22553" print \"You clicked \\\"New\\\"\"" 22554msgstr "" 22555 22556#. (itstool) path: section/p 22557#: C/menubar.py.page:105 22558msgid "" 22559"Now, in the XML file, we connect the menu items to the actions in the XML " 22560"file by adding the \"action\" attribute:" 22561msgstr "" 22562 22563#. (itstool) path: section/code 22564#: C/menubar.py.page:106 22565#, no-wrap 22566msgid "" 22567"\n" 22568"<item>\n" 22569" <attribute name=\"label\">New</attribute>\n" 22570" <attribute name=\"action\">app.new</attribute>\n" 22571"</item>" 22572msgstr "" 22573 22574#. (itstool) path: section/p 22575#: C/menubar.py.page:112 22576msgid "" 22577"Note that for an action that is relative to the application, we use the " 22578"prefix <code>app.</code>; for actions that are relative to the window we use " 22579"the prefix <code>win.</code>." 22580msgstr "" 22581 22582#. (itstool) path: section/p 22583#: C/menubar.py.page:114 22584msgid "" 22585"Finally, in the Python file, we add the action to the application or to the " 22586"window - so for instance <code>app.new</code> will be added to the " 22587"application in the method <code>do_startup(self)</code> as" 22588msgstr "" 22589 22590#. (itstool) path: section/code 22591#: C/menubar.py.page:115 22592#, fuzzy, no-wrap 22593msgid "" 22594"\n" 22595"self.add_action(new_action)" 22596msgstr "Nova _ação" 22597 22598#. (itstool) path: section/p 22599#: C/menubar.py.page:118 22600msgid "" 22601"See <link xref=\"signals-callbacks.py\"/> for a more detailed explanation of " 22602"signals and callbacks." 22603msgstr "" 22604 22605#. (itstool) path: section/title 22606#: C/menubar.py.page:122 C/menubar.vala.page:139 22607#, fuzzy 22608msgid "Actions: Application or Window?" 22609msgstr "_Ações de janelas" 22610 22611#. (itstool) path: section/p 22612#: C/menubar.py.page:123 C/menubar.vala.page:140 22613msgid "" 22614"Above, we created the \"new\" and \"open\" actions as part of the " 22615"MyApplication class. Actions which control the application itself, such as " 22616"\"quit\" should be created similarly." 22617msgstr "" 22618 22619#. (itstool) path: section/p 22620#: C/menubar.py.page:125 C/menubar.vala.page:143 22621msgid "" 22622"Some actions, such as \"copy\" and \"paste\" deal with the window, not the " 22623"application. Window actions should be created as part of the window class." 22624msgstr "" 22625 22626#. (itstool) path: section/p 22627#: C/menubar.py.page:127 22628msgid "" 22629"The complete example files contain both application actions and window " 22630"actions. The window actions are the ones usually included in the <link xref=" 22631"\"gmenu.py\">application menu</link> also. It is not good practice to " 22632"include window actions in the application menu. For demonstration purposes, " 22633"the complete example files which follow include XML in the UI file which " 22634"creates the application menu which includes a \"New\" and \"Open\" item, and " 22635"these are hooked up to the same actions as the menubar items of the same " 22636"name." 22637msgstr "" 22638 22639#. (itstool) path: section/title 22640#: C/menubar.py.page:131 C/menubar.vala.page:133 22641msgid "Choices submenu and items with state" 22642msgstr "" 22643 22644#. (itstool) path: section/media 22645#. This is a reference to an external file such as an image or video. When 22646#. the file changes, the md5 hash will change to let you know you need to 22647#. update your localized copy. The msgstr is not used at all. Set it to 22648#. whatever you like once you have updated your copy of the file. 22649#: C/menubar.py.page:132 C/menubar.vala.page:134 22650msgctxt "_" 22651msgid "" 22652"external ref='media/menubar_choices.png' " 22653"md5='47cdfa12caf85ba20dd3e835bd7f893f'" 22654msgstr "" 22655 22656#. (itstool) path: section/p 22657#: C/menubar.py.page:133 22658msgid "" 22659"Lines 30 to 80 inclusive of the <link xref=\"menubar.py#xml-code\"/> " 22660"demonstrate the XML code used to create the UI for <gui>Choices</gui> menu." 22661msgstr "" 22662 22663#. (itstool) path: section/p 22664#: C/menubar.py.page:135 22665msgid "" 22666"The actions created so far are <em>stateless</em>, that is they do not " 22667"retain or depend on a state given by the action itself. The actions we need " 22668"to create for the Choices submenu, on the other hand, are <em>stateful</em>. " 22669"An example of creation of a stateful action is:" 22670msgstr "" 22671 22672#. (itstool) path: section/code 22673#: C/menubar.py.page:136 22674#, no-wrap 22675msgid "" 22676"\n" 22677"shape_action = Gio.SimpleAction.new_stateful(\"shape\", GLib.VariantType.new('s'), GLib.Variant.new_string('line'))" 22678msgstr "" 22679 22680#. (itstool) path: section/p 22681#: C/menubar.py.page:139 22682msgid "" 22683"where the variables of the method are: name, parameter type (in this case, a " 22684"string - see <link href=\"http://developer.gnome.org/glib/unstable/glib-" 22685"GVariantType.html\">here</link> for a complete list of character meanings), " 22686"initial state (in this case, 'line' - in case of a <code>True</code> boolean " 22687"value it should be <code>Glib.Variant.new_boolean(True)</code>, and so on, " 22688"see <link href=\"http://developer.gnome.org/glib/unstable/glib-GVariant.html" 22689"\">here</link> for a complete list)" 22690msgstr "" 22691 22692#. (itstool) path: section/p 22693#: C/menubar.py.page:141 22694msgid "" 22695"After creating the stateful SimpleAction we connect it to the callback " 22696"function and we add it to the window (or the application, if it is the " 22697"case), as before:" 22698msgstr "" 22699 22700#. (itstool) path: section/code 22701#: C/menubar.py.page:143 22702#, no-wrap 22703msgid "" 22704"\n" 22705"shape_action.connect(\"activate\", self.shape_callback)\n" 22706"self.add_action(shape_action)" 22707msgstr "" 22708 22709#. (itstool) path: section/title 22710#: C/menubar.py.page:150 C/menubar.vala.page:154 22711#, fuzzy 22712msgid "Complete XML UI file for this example" 22713msgstr "Não foi possível mesclar o arquivo xml de interface: %s" 22714 22715#. (itstool) path: section/code 22716#: C/menubar.py.page:151 C/menubar.vala.page:155 22717#, no-wrap 22718msgid "" 22719"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 22720"<interface>\n" 22721" <menu id=\"menubar\">\n" 22722" <submenu>\n" 22723" <attribute name=\"label\">File</attribute>\n" 22724" <section>\n" 22725" <item>\n" 22726" <attribute name=\"label\">New</attribute>\n" 22727" <attribute name=\"action\">app.new</attribute>\n" 22728" </item>\n" 22729" <item>\n" 22730" <attribute name=\"label\">Quit</attribute>\n" 22731" <attribute name=\"action\">app.quit</attribute>\n" 22732" </item>\n" 22733" </section>\n" 22734" </submenu>\n" 22735" <submenu>\n" 22736" <attribute name=\"label\">Edit</attribute>\n" 22737" <section>\n" 22738" <item>\n" 22739" <attribute name=\"label\">Copy</attribute>\n" 22740" <attribute name=\"action\">win.copy</attribute>\n" 22741" </item>\n" 22742" <item>\n" 22743" <attribute name=\"label\">Paste</attribute>\n" 22744" <attribute name=\"action\">win.paste</attribute>\n" 22745" </item>\n" 22746" </section>\n" 22747" </submenu>\n" 22748" <submenu>\n" 22749" <attribute name=\"label\">Choices</attribute>\n" 22750" <submenu>\n" 22751" <attribute name=\"label\">Shapes</attribute>\n" 22752" <section>\n" 22753" <item>\n" 22754" <attribute name=\"label\">Line</attribute>\n" 22755" <attribute name=\"action\">win.shape</attribute>\n" 22756" <attribute name=\"target\">line</attribute>\n" 22757" </item>\n" 22758" <item>\n" 22759" <attribute name=\"label\">Triangle</attribute>\n" 22760" <attribute name=\"action\">win.shape</attribute>\n" 22761" <attribute name=\"target\">triangle</attribute>\n" 22762" </item>\n" 22763" <item>\n" 22764" <attribute name=\"label\">Square</attribute>\n" 22765" <attribute name=\"action\">win.shape</attribute>\n" 22766" <attribute name=\"target\">square</attribute>\n" 22767" </item>\n" 22768" <item>\n" 22769" <attribute name=\"label\">Polygon</attribute>\n" 22770" <attribute name=\"action\">win.shape</attribute>\n" 22771" <attribute name=\"target\">polygon</attribute>\n" 22772" </item>\n" 22773" <item>\n" 22774" <attribute name=\"label\">Circle</attribute>\n" 22775" <attribute name=\"action\">win.shape</attribute>\n" 22776" <attribute name=\"target\">circle</attribute>\n" 22777" </item>\n" 22778" </section>\n" 22779" </submenu>\n" 22780" <section>\n" 22781" <item>\n" 22782" <attribute name=\"label\">On</attribute>\n" 22783" <attribute name=\"action\">app.state</attribute>\n" 22784" <attribute name=\"target\">on</attribute>\n" 22785" </item>\n" 22786" <item>\n" 22787" <attribute name=\"label\">Off</attribute>\n" 22788" <attribute name=\"action\">app.state</attribute>\n" 22789" <attribute name=\"target\">off</attribute>\n" 22790" </item>\n" 22791" </section>\n" 22792" <section>\n" 22793" <item>\n" 22794" <attribute name=\"label\">Awesome</attribute>\n" 22795" <attribute name=\"action\">app.awesome</attribute>\n" 22796" </item>\n" 22797" </section>\n" 22798" </submenu>\n" 22799" <submenu>\n" 22800" <attribute name=\"label\">Help</attribute>\n" 22801" <section>\n" 22802" <item>\n" 22803" <attribute name=\"label\">About</attribute>\n" 22804" <attribute name=\"action\">win.about</attribute>\n" 22805" </item>\n" 22806" </section>\n" 22807" </submenu>\n" 22808" </menu>\n" 22809" <menu id=\"appmenu\">\n" 22810" <section>\n" 22811" <item>\n" 22812" <attribute name=\"label\">New</attribute>\n" 22813" <attribute name=\"action\">app.new</attribute>\n" 22814" </item>\n" 22815" <item>\n" 22816" <attribute name=\"label\">Quit</attribute>\n" 22817" <attribute name=\"action\">app.quit</attribute>\n" 22818" </item>\n" 22819" </section>\n" 22820" </menu>\n" 22821"</interface>\n" 22822msgstr "" 22823 22824#. (itstool) path: section/title 22825#: C/menubar.py.page:155 22826#, fuzzy 22827msgid "Complete Python file for this example" 22828msgstr "Arquivo %s concluiu" 22829 22830#. (itstool) path: section/code 22831#: C/menubar.py.page:156 22832#, no-wrap 22833msgid "" 22834"from gi.repository import Gtk\n" 22835"from gi.repository import GLib\n" 22836"from gi.repository import Gio\n" 22837"import sys\n" 22838"\n" 22839"\n" 22840"class MyWindow(Gtk.ApplicationWindow):\n" 22841"\n" 22842" def __init__(self, app):\n" 22843" Gtk.Window.__init__(self, title=\"MenuBar Example\", application=app)\n" 22844" self.set_default_size(200, 200)\n" 22845"\n" 22846" # action without a state created (name, parameter type)\n" 22847" copy_action = Gio.SimpleAction.new(\"copy\", None)\n" 22848" # connected with the callback function\n" 22849" copy_action.connect(\"activate\", self.copy_callback)\n" 22850" # added to the window\n" 22851" self.add_action(copy_action)\n" 22852"\n" 22853" # action without a state created (name, parameter type)\n" 22854" paste_action = Gio.SimpleAction.new(\"paste\", None)\n" 22855" # connected with the callback function\n" 22856" paste_action.connect(\"activate\", self.paste_callback)\n" 22857" # added to the window\n" 22858" self.add_action(paste_action)\n" 22859"\n" 22860" # action with a state created (name, parameter type, initial state)\n" 22861" shape_action = Gio.SimpleAction.new_stateful(\n" 22862" \"shape\", GLib.VariantType.new('s'), GLib.Variant.new_string('line'))\n" 22863" # connected to the callback function\n" 22864" shape_action.connect(\"activate\", self.shape_callback)\n" 22865" # added to the window\n" 22866" self.add_action(shape_action)\n" 22867"\n" 22868" # action with a state created\n" 22869" about_action = Gio.SimpleAction.new(\"about\", None)\n" 22870" # action connected to the callback function\n" 22871" about_action.connect(\"activate\", self.about_callback)\n" 22872" # action added to the application\n" 22873" self.add_action(about_action)\n" 22874"\n" 22875" # callback function for copy_action\n" 22876" def copy_callback(self, action, parameter):\n" 22877" print(\"\\\"Copy\\\" activated\")\n" 22878"\n" 22879" # callback function for paste_action\n" 22880" def paste_callback(self, action, parameter):\n" 22881" print(\"\\\"Paste\\\" activated\")\n" 22882"\n" 22883" # callback function for shape_action\n" 22884" def shape_callback(self, action, parameter):\n" 22885" print(\"Shape is set to\", parameter.get_string())\n" 22886" # Note that we set the state of the action!\n" 22887" action.set_state(parameter)\n" 22888"\n" 22889" # callback function for about (see the AboutDialog example)\n" 22890" def about_callback(self, action, parameter):\n" 22891" # a Gtk.AboutDialog\n" 22892" aboutdialog = Gtk.AboutDialog()\n" 22893"\n" 22894" # lists of authors and documenters (will be used later)\n" 22895" authors = [\"GNOME Documentation Team\"]\n" 22896" documenters = [\"GNOME Documentation Team\"]\n" 22897"\n" 22898" # we fill in the aboutdialog\n" 22899" aboutdialog.set_program_name(\"MenuBar Example\")\n" 22900" aboutdialog.set_copyright(\n" 22901" \"Copyright \\xc2\\xa9 2012 GNOME Documentation Team\")\n" 22902" aboutdialog.set_authors(authors)\n" 22903" aboutdialog.set_documenters(documenters)\n" 22904" aboutdialog.set_website(\"http://developer.gnome.org\")\n" 22905" aboutdialog.set_website_label(\"GNOME Developer Website\")\n" 22906"\n" 22907" # to close the aboutdialog when \"close\" is clicked we connect the\n" 22908" # \"response\" signal to on_close\n" 22909" aboutdialog.connect(\"response\", self.on_close)\n" 22910" # show the aboutdialog\n" 22911" aboutdialog.show()\n" 22912"\n" 22913" # a callback function to destroy the aboutdialog\n" 22914" def on_close(self, action, parameter):\n" 22915" action.destroy()\n" 22916"\n" 22917"\n" 22918"class MyApplication(Gtk.Application):\n" 22919"\n" 22920" def __init__(self):\n" 22921" Gtk.Application.__init__(self)\n" 22922"\n" 22923" def do_activate(self):\n" 22924" win = MyWindow(self)\n" 22925" win.show_all()\n" 22926"\n" 22927" def do_startup(self):\n" 22928" # FIRST THING TO DO: do_startup()\n" 22929" Gtk.Application.do_startup(self)\n" 22930"\n" 22931" # action without a state created\n" 22932" new_action = Gio.SimpleAction.new(\"new\", None)\n" 22933" # action connected to the callback function\n" 22934" new_action.connect(\"activate\", self.new_callback)\n" 22935" # action added to the application\n" 22936" self.add_action(new_action)\n" 22937"\n" 22938" # action without a state created\n" 22939" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 22940" # action connected to the callback function\n" 22941" quit_action.connect(\"activate\", self.quit_callback)\n" 22942" # action added to the application\n" 22943" self.add_action(quit_action)\n" 22944"\n" 22945" # action with a state created\n" 22946" state_action = Gio.SimpleAction.new_stateful(\n" 22947" \"state\", GLib.VariantType.new('s'), GLib.Variant.new_string('off'))\n" 22948" # action connected to the callback function\n" 22949" state_action.connect(\"activate\", self.state_callback)\n" 22950" # action added to the application\n" 22951" self.add_action(state_action)\n" 22952"\n" 22953" # action with a state created\n" 22954" awesome_action = Gio.SimpleAction.new_stateful(\n" 22955" \"awesome\", None, GLib.Variant.new_boolean(False))\n" 22956" # action connected to the callback function\n" 22957" awesome_action.connect(\"activate\", self.awesome_callback)\n" 22958" # action added to the application\n" 22959" self.add_action(awesome_action)\n" 22960"\n" 22961" # a builder to add the UI designed with Glade to the grid:\n" 22962" builder = Gtk.Builder()\n" 22963" # get the file (if it is there)\n" 22964" try:\n" 22965" builder.add_from_file(\"menubar.ui\")\n" 22966" except:\n" 22967" print(\"file not found\")\n" 22968" sys.exit()\n" 22969"\n" 22970" # we use the method Gtk.Application.set_menubar(menubar) to add the menubar\n" 22971" # and the menu to the application (Note: NOT the window!)\n" 22972" self.set_menubar(builder.get_object(\"menubar\"))\n" 22973" self.set_app_menu(builder.get_object(\"appmenu\"))\n" 22974"\n" 22975" # callback function for new\n" 22976" def new_callback(self, action, parameter):\n" 22977" print(\"You clicked \\\"New\\\"\")\n" 22978"\n" 22979" # callback function for quit\n" 22980" def quit_callback(self, action, parameter):\n" 22981" print(\"You clicked \\\"Quit\\\"\")\n" 22982" sys.exit()\n" 22983"\n" 22984" # callback function for state\n" 22985" def state_callback(self, action, parameter):\n" 22986" print(\"State is set to\", parameter.get_string())\n" 22987" action.set_state(parameter)\n" 22988"\n" 22989" # callback function for awesome\n" 22990" def awesome_callback(self, action, parameter):\n" 22991" action.set_state(GLib.Variant.new_boolean(not action.get_state()))\n" 22992" if action.get_state().get_boolean() is True:\n" 22993" print(\"You checked \\\"Awesome\\\"\")\n" 22994" else:\n" 22995" print(\"You unchecked \\\"Awesome\\\"\")\n" 22996"\n" 22997"\n" 22998"app = MyApplication()\n" 22999"exit_status = app.run(sys.argv)\n" 23000"sys.exit(exit_status)\n" 23001msgstr "" 23002 23003#. (itstool) path: section/title 23004#: C/menubar.py.page:159 23005#, fuzzy 23006msgid "Mnemonics and Accelerators" 23007msgstr "" 23008"A maioria das funcionalidades deve ser fácil de tornar acessível usando " 23009"aceleradores e mnemônicos de teclado e usando os recursos de navegação " 23010"embarcados do kit de ferramentas. Porém, as operações que dependem de " 23011"arrastar e soltar, por exemplo, podem exigir mais esforço." 23012 23013#. (itstool) path: section/p 23014#: C/menubar.py.page:160 C/menubar.vala.page:162 23015msgid "" 23016"Labels may contain mnemonics. Mnemonics are underlined characters in the " 23017"label, used for keyboard navigation. Mnemonics are created by placing an " 23018"underscore before the mnemonic character. For example \"_File\" instead of " 23019"just \"File\" in the menubar.ui label attribute." 23020msgstr "" 23021 23022#. (itstool) path: section/p 23023#: C/menubar.py.page:161 C/menubar.vala.page:163 23024msgid "" 23025"The mnemonics are visible when you press the <key>Alt</key> key. Pressing " 23026"<keyseq><key>Alt</key><key>F</key></keyseq> will open the <gui>File</gui> " 23027"menu." 23028msgstr "" 23029 23030#. (itstool) path: section/p 23031#: C/menubar.py.page:163 C/menubar.vala.page:168 23032msgid "" 23033"Accelerators can be explicitly added in the UI definitions. For example, it " 23034"is common to be able to quit an application by pressing <keyseq><key>Ctrl</" 23035"key><key>Q</key></keyseq> or to save a file by pressing <keyseq><key>Ctrl</" 23036"key><key>S</key></keyseq>. To add an accelerator to the UI definition, you " 23037"simply need add an \"accel\" attribute to the item." 23038msgstr "" 23039 23040#. (itstool) path: section/p 23041#: C/menubar.py.page:164 C/menubar.vala.page:169 23042msgid "" 23043"<code mime=\"application/xml\"><attribute name=\"accel\">&lt;" 23044"Primary&gt;q</attribute></code> will create the <keyseq><key>Ctrl</" 23045"key><key>Q</key></keyseq> sequence when added to the <code>Quit</code> label " 23046"item. Here, \"Primary\" refers to the <key>Ctrl</key> key on a PC or the " 23047"<key>⌘</key> key on a Mac." 23048msgstr "" 23049 23050#. (itstool) path: section/code 23051#: C/menubar.py.page:166 C/menubar.vala.page:171 23052#, no-wrap 23053msgid "" 23054"\n" 23055"<item>\n" 23056" <attribute name=\"label\">_Quit</attribute>\n" 23057" <attribute name=\"action\">app.quit</attribute>\n" 23058" <attribute name=\"accel\">&lt;Primary&gt;q</attribute>\n" 23059"</item>" 23060msgstr "" 23061 23062#. (itstool) path: section/title 23063#: C/menubar.py.page:174 C/menubar.vala.page:179 23064#, fuzzy 23065msgid "Translatable strings" 23066msgstr "Extrai strings traduzíveis dos arquivos de entrada passados.\n" 23067 23068#. (itstool) path: section/p 23069#: C/menubar.py.page:175 C/menubar.vala.page:180 23070msgid "" 23071"Since GNOME applications are being translated into <link href=\"http://l10n." 23072"gnome.org/languages/\">many languages</link>, it is important that the " 23073"strings in your application are translatable. To make a label translatable, " 23074"simple set <code>translatable=\"yes\"</code>:" 23075msgstr "" 23076 23077#. (itstool) path: section/code 23078#: C/menubar.py.page:179 23079#, no-wrap 23080msgid "<attribute name=\"label\" translatable=\"yes\">Quit</attribute>" 23081msgstr "" 23082 23083#. (itstool) path: item/p 23084#: C/menubar.py.page:186 23085msgid "" 23086"<link href=\"http://developer.gnome.org/gio/unstable/GSimpleAction.html" 23087"\">GSimpleAction</link>" 23088msgstr "" 23089 23090#. (itstool) path: item/p 23091#: C/menubar.py.page:187 C/toolbar_builder.py.page:197 23092msgid "" 23093"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkBuilder.html" 23094"\">GtkBuilder</link>" 23095msgstr "" 23096 23097#. (itstool) path: info/title 23098#: C/menubar.vala.page:8 23099msgctxt "text" 23100msgid "MenuBar (Vala)" 23101msgstr "MenuBar (Vala)" 23102 23103#. (itstool) path: item/p 23104#: C/menubar.vala.page:40 23105msgid "" 23106"Now we will create the .vala file and use GtkBuilder to import the " 23107"<file>menubar.ui</file> we just created." 23108msgstr "" 23109 23110#. (itstool) path: section/code 23111#: C/menubar.vala.page:44 23112#, no-wrap 23113msgid "" 23114"public class MyWindow : Gtk.ApplicationWindow {\n" 23115"\tinternal MyWindow (MyApplication app) {\n" 23116"\t\tObject (application: app, title: \"MenuBar Example\");\n" 23117"\t\tthis.set_default_size (200, 200);\n" 23118"\t}\n" 23119"}\n" 23120"\n" 23121"class MyApplication: Gtk.Application {\n" 23122"\tprotected override void activate () {\n" 23123"\t\tnew MyWindow (this).show ();\n" 23124"\t}\n" 23125"\tprotected override void startup () {\n" 23126"\t\tbase.startup ();\n" 23127"\n" 23128"\t\t/* Setup menubar. */\n" 23129"\t\t/* Get the UI file. */\n" 23130"\t\tvar builder = new Gtk.Builder ();\n" 23131"\t\ttry {\n" 23132"\t\t\tbuilder.add_from_file (\"menubar_basis.ui\");\n" 23133"\t\t/* Handle the exception. */\n" 23134"\t\t} catch (Error e) {\n" 23135"\t\t\terror (\"Unable to load file: %s\", e.message);\n" 23136"\t\t}\n" 23137"\n" 23138"\t\t/* Get the menubar from the builder. */\n" 23139"\t\tthis.menubar = builder.get_object (\"menubar\") as MenuModel;\n" 23140"\t}\n" 23141"}\n" 23142"\n" 23143"/* main creates and runs the application. */\n" 23144"public int main (string[] args) {\n" 23145"\treturn new MyApplication ().run (args);\n" 23146"}\n" 23147msgstr "" 23148 23149#. (itstool) path: section/p 23150#: C/menubar.vala.page:45 23151msgid "" 23152"Now, compile the vala file, and run it. The application should look like the " 23153"picture at the top of this page." 23154msgstr "" 23155 23156#. (itstool) path: section/p 23157#: C/menubar.vala.page:80 23158msgid "" 23159"Following this pattern, you can now add a <code>Copy</code> and a " 23160"<code>Paste</code> item to the <code>Edit</code> submenu, and an " 23161"<code>About</code> item to the <code>Help</code> submenu. We will hold off " 23162"on adding items to the <link xref=\"menubar.vala#choices\">Choices submenu</" 23163"link> until further in the tutorial." 23164msgstr "" 23165 23166#. (itstool) path: note/p 23167#: C/menubar.vala.page:82 23168msgid "" 23169"You do not need to recompile the vala program if you only made changes to " 23170"the UI file. Just run your previously compiled application, and the UI " 23171"changes will be reflected." 23172msgstr "" 23173 23174#. (itstool) path: section/p 23175#: C/menubar.vala.page:88 23176#, fuzzy 23177msgid "This is a three step process." 23178msgstr "três" 23179 23180#. (itstool) path: item/p 23181#: C/menubar.vala.page:90 23182msgid "" 23183"First we create the ActionEntry array in the MyApplication class. An " 23184"ActionEntry consists of:" 23185msgstr "" 23186 23187#. (itstool) path: item/p 23188#: C/menubar.vala.page:93 23189#, fuzzy 23190msgid "the \"action name\" (mandatory)" 23191msgstr "Erro: id de uma ação é obrigatória.\n" 23192 23193#. (itstool) path: item/p 23194#: C/menubar.vala.page:94 23195msgid "" 23196"the callback function to connect to the \"activate\" signal of the action " 23197"(if applicable)" 23198msgstr "" 23199 23200#. (itstool) path: item/p 23201#: C/menubar.vala.page:95 23202msgid "" 23203"the type of the parameter that must be passed to the activate function for " 23204"the action (if applicable)" 23205msgstr "" 23206 23207#. (itstool) path: item/p 23208#: C/menubar.vala.page:96 23209#, fuzzy 23210msgid "the initial state for this action (if applicable)" 23211msgstr "Estado inicial da janela:" 23212 23213#. (itstool) path: item/p 23214#: C/menubar.vala.page:97 23215msgid "the callback to connect to \"change-state\" signal (if applicable)" 23216msgstr "" 23217 23218#. (itstool) path: item/code 23219#: C/menubar.vala.page:99 23220#, no-wrap 23221msgid "" 23222"\n" 23223"const ActionEntry[] actions = {\n" 23224" { \"new\", new_cb }, // {\"action name\", callback_function}\n" 23225" { \"quit\", quit_cb }\n" 23226"};" 23227msgstr "" 23228 23229#. (itstool) path: item/p 23230#: C/menubar.vala.page:106 23231msgid "Second, we create the callback functions the actions are connected to." 23232msgstr "" 23233 23234#. (itstool) path: item/code 23235#: C/menubar.vala.page:107 23236#, no-wrap 23237msgid "" 23238"\n" 23239"void new_cb (SimpleAction action, Variant? parameter) {\n" 23240" print (\"You clicked \\\"New\\\"\\n\");\n" 23241" //new MyWindow (this).show ();\n" 23242"}\n" 23243"\n" 23244"void quit_cb (SimpleAction action, Variant? parameter) {\n" 23245" print (\"You clicked \\\"Quit\\\"\\n\");\n" 23246" this.quit ();\n" 23247"}" 23248msgstr "" 23249 23250#. (itstool) path: item/p 23251#: C/menubar.vala.page:118 23252msgid "" 23253"And lastly, we connect the menu items to the actions in the XML file by " 23254"adding the \"action\" attribute:" 23255msgstr "" 23256 23257#. (itstool) path: item/code 23258#: C/menubar.vala.page:119 23259#, no-wrap 23260msgid "" 23261"\n" 23262"<item>\n" 23263" <attribute name=\"label\">New</attribute>\n" 23264" <attribute name=\"action\">app.new</attribute>\n" 23265"</item>\n" 23266"<item>\n" 23267" <attribute name=\"label\">Quit</attribute>\n" 23268" <attribute name=\"action\">app.quit</attribute>\n" 23269"</item>" 23270msgstr "" 23271 23272#. (itstool) path: section/p 23273#: C/menubar.vala.page:135 23274msgid "" 23275"Lines 30 to 80 inclusive of the <link xref=\"menubar.vala#xml-code\"/> " 23276"demonstrate the XML code used to create the UI for <gui>Choices</gui> menu." 23277msgstr "" 23278 23279#. (itstool) path: section/p 23280#: C/menubar.vala.page:146 23281msgid "" 23282"The complete example files contain both application actions and window " 23283"applications. The window actions are the ones usually included in the <link " 23284"xref=\"gmenu.vala\">application menu</link> also. It is not good practice to " 23285"include window actions in the application menu. For demonstration purposes, " 23286"the complete example files which follow include XML in the UI file which " 23287"creates the application menu which includes a \"New\" and \"Open\" item, and " 23288"these are hooked up to the same actions as the menubar items of the same " 23289"name." 23290msgstr "" 23291 23292#. (itstool) path: section/title 23293#: C/menubar.vala.page:157 23294#, fuzzy 23295msgid "Complete Vala file for this example" 23296msgstr "Arquivos de código fonte em Vala" 23297 23298#. (itstool) path: section/code 23299#: C/menubar.vala.page:158 23300#, no-wrap 23301msgid "" 23302"public class MyWindow : Gtk.ApplicationWindow {\n" 23303"\n" 23304"\t/* Callback functions for the window actions. */\n" 23305"\tvoid copy_cb (SimpleAction action, Variant? parameter) {\n" 23306"\t\tprint (\"\\\"Copy\\\" activated\\n\");\n" 23307"\t}\n" 23308"\n" 23309"\tvoid paste_cb (SimpleAction action, Variant? parameter) {\n" 23310"\t\tprint (\"\\\"Paste\\\" activated\\n\");\n" 23311"\t}\n" 23312"\n" 23313"\tvoid shape_cb (SimpleAction action, Variant? parameter) {\n" 23314"\t\tprint (\"shape is set to %s\\n\", parameter.get_string(null));\n" 23315"\t\taction.set_state (parameter);\n" 23316"\t}\n" 23317"\n" 23318"\t/* Create the window actions. */\n" 23319"\tconst ActionEntry[] actions = {\n" 23320"\t\t/*{ \"action name\", cb to connect to \"activate\" signal, parameter type,\n" 23321"\t\t initial state, cb to connect to \"change-state\" signal } */\n" 23322"\t\t{ \"copy\", copy_cb },\n" 23323"\t\t{ \"paste\", paste_cb },\n" 23324"\t\t{ \"shape\", shape_cb, \"s\", \"'line'\"}\n" 23325"\t};\n" 23326"\n" 23327"\tinternal MyWindow (MyApplication app) {\n" 23328"\t\tObject (application: app, title: \"MenuBar Example\");\n" 23329"\t\tthis.set_default_size (200, 200);\n" 23330"\n" 23331"\t\t/* Setup window actions. */\n" 23332"\t\tthis.add_action_entries (actions, this);\n" 23333"\t}\n" 23334"}\n" 23335"\n" 23336"class MyApplication: Gtk.Application {\n" 23337"\tprotected override void activate () {\n" 23338"\t\tnew MyWindow (this).show ();\n" 23339"\t}\n" 23340"\n" 23341"\t/* Callback functions for the application actions. */\n" 23342"\tvoid new_cb (SimpleAction action, Variant? parameter) {\n" 23343"\t\t//new MyWindow (this).show ();\n" 23344"\t\tprint (\"You clicked \\\"New\\\"\\n\");\n" 23345"\t}\n" 23346"\n" 23347"\tvoid quit_cb (SimpleAction action, Variant? parameter) {\n" 23348"\t\tprint (\"You clicked \\\"Quit\\\"\\n\");\n" 23349"\t\tthis.quit ();\n" 23350"\t}\n" 23351"\n" 23352"\tvoid awesome_cb (SimpleAction action, Variant? parameter) {\n" 23353"\t\tvar active = action.get_state ().get_boolean ();\n" 23354"\t\taction.set_state (new Variant.boolean (!active));\n" 23355"\t\tif (active)\n" 23356"\t\t\tprint (\"You unchecked \\\"Awesome\\\"\\n\");\n" 23357"\t\telse\n" 23358"\t\t\tprint (\"You checked \\\"Awesome\\\"\\n\");\n" 23359"\t}\n" 23360"\n" 23361"\tvoid state_cb (SimpleAction action, Variant? parameter) {\n" 23362"\t\tprint (\"state is set to %s\\n\", parameter.get_string(null));\n" 23363"\t\taction.set_state (parameter);\n" 23364"\t}\n" 23365"\n" 23366"\t/* Create the application actions. */\n" 23367"\tconst ActionEntry[] actions = {\n" 23368"\t\t{ \"new\", new_cb },\n" 23369"\t\t{ \"quit\", quit_cb },\n" 23370"\t\t{ \"awesome\", awesome_cb, null, \"false\" },\n" 23371"\t\t{ \"state\", state_cb, \"s\", \"'off'\" }\n" 23372"\t};\n" 23373"\n" 23374"\tprotected override void startup () {\n" 23375"\t\tbase.startup ();\n" 23376"\n" 23377"\t\t/* Setup application actions. */\n" 23378"\t\tthis.add_action_entries (actions, this);\n" 23379"\n" 23380"\t\t/* Setup menubar and app_menu. */\n" 23381"\t\t/* Get the UI file. */\n" 23382"\t\tvar builder = new Gtk.Builder ();\n" 23383"\t\ttry {\n" 23384"\t\t\tbuilder.add_from_file (\"menubar.ui\");\n" 23385"\t\t} catch (Error e) {\n" 23386"\t\t\terror (\"Unable to load file: %s\", e.message);\n" 23387"\t\t}\n" 23388"\n" 23389"\t\t/* Get the menubar from the builder. */\n" 23390"\t\tthis.menubar = builder.get_object (\"menubar\") as MenuModel;\n" 23391"\n" 23392"\t\t/* Get the app_menu from the builder. */\n" 23393"\t\tthis.app_menu = builder.get_object (\"appmenu\") as MenuModel;\n" 23394"\t}\n" 23395"}\n" 23396"\n" 23397"/* main creates and runs the application. */\n" 23398"public int main (string[] args) {\n" 23399"\treturn new MyApplication ().run (args);\n" 23400"}\n" 23401msgstr "" 23402 23403#. (itstool) path: section/title 23404#: C/menubar.vala.page:161 23405#, fuzzy 23406msgid "Mnemonics" 23407msgstr "Mnemônicos (teclas de acesso)" 23408 23409#. (itstool) path: section/title 23410#: C/menubar.vala.page:167 23411#, fuzzy 23412msgid "Accelerators" 23413msgstr "Aceleradores" 23414 23415#. (itstool) path: section/p 23416#: C/menubar.vala.page:183 23417msgid "" 23418"<code mime=\"application/xml\"><attribute name=\"label\" translatable=" 23419"\"yes\">Quit</attribute></code>" 23420msgstr "" 23421 23422#. (itstool) path: item/p 23423#: C/menubar.vala.page:192 23424msgid "" 23425"<link href=\"http://valadoc.org/gio-2.0/GLib.ActionEntry.html\">Glib." 23426"ActionEntry</link>" 23427msgstr "" 23428 23429#. (itstool) path: item/p 23430#: C/menubar.vala.page:193 23431msgid "" 23432"<link href=\"http://valadoc.org/gio-2.0/Gtk.Builder.html\">Gtk.Builder</link>" 23433msgstr "" 23434 23435#. (itstool) path: info/title 23436#: C/menubutton.c.page:8 C/menubutton.py.page:8 23437msgctxt "text" 23438msgid "MenuButton" 23439msgstr "" 23440 23441#. (itstool) path: info/desc 23442#: C/menubutton.c.page:18 C/menubutton.js.page:18 C/menubutton.py.page:25 23443#: C/menubutton.vala.page:18 23444msgid "A widget that shows a menu when clicked on" 23445msgstr "" 23446 23447#. (itstool) path: page/title 23448#: C/menubutton.c.page:21 C/menubutton.js.page:21 C/menubutton.py.page:28 23449#: C/menubutton.vala.page:21 23450msgid "MenuButton" 23451msgstr "" 23452 23453#. (itstool) path: page/media 23454#. This is a reference to an external file such as an image or video. When 23455#. the file changes, the md5 hash will change to let you know you need to 23456#. update your localized copy. The msgstr is not used at all. Set it to 23457#. whatever you like once you have updated your copy of the file. 23458#: C/menubutton.c.page:22 C/menubutton.js.page:22 C/menubutton.py.page:29 23459#: C/menubutton.vala.page:22 23460msgctxt "_" 23461msgid "" 23462"external ref='media/menubutton.png' md5='99eedc5ef2d6c56d32ca9ae7f3f3320f'" 23463msgstr "" 23464"external ref='media/menubutton.png' md5='99eedc5ef2d6c56d32ca9ae7f3f3320f'" 23465 23466#. (itstool) path: page/p 23467#: C/menubutton.c.page:23 C/menubutton.js.page:23 C/menubutton.py.page:30 23468#: C/menubutton.vala.page:23 23469msgid "" 23470"The GtkMenuButton widget is used to display a menu when clicked on. This " 23471"menu can be provided either as a GtkMenu, or an abstract GMenuModel. The " 23472"GtkMenuButton widget can hold any valid child widget. That is, it can hold " 23473"almost any other standard GtkWidget. The most commonly used child is the " 23474"provided GtkArrow." 23475msgstr "" 23476 23477#. (itstool) path: note/p 23478#: C/menubutton.c.page:25 C/menubutton.js.page:27 23479msgid "You need to be running GNOME 3.6 or later for the MenuButton to work." 23480msgstr "" 23481 23482#. (itstool) path: section/code 23483#: C/menubutton.c.page:31 23484#, no-wrap 23485msgid "" 23486"#include <gtk/gtk.h>\n" 23487"\n" 23488"/* Callback function for the undo action */\n" 23489"static void\n" 23490"about_callback (GSimpleAction *simple,\n" 23491" GVariant *parameter,\n" 23492" gpointer user_data)\n" 23493"{\n" 23494" g_print (\"You clicked \\\"About\\\"\\n\");\n" 23495"}\n" 23496"\n" 23497"static void\n" 23498"activate (GtkApplication *app,\n" 23499" gpointer user_data)\n" 23500"{\n" 23501" GMenu *submenu;\n" 23502" GtkWidget *grid;\n" 23503" GMenu *menumodel;\n" 23504" GtkWidget *window;\n" 23505" GtkWidget *menubutton;\n" 23506" GSimpleAction *about_action;\n" 23507"\n" 23508" window = gtk_application_window_new (app);\n" 23509" grid = gtk_grid_new ();\n" 23510"\n" 23511" gtk_window_set_title (GTK_WINDOW (window), \"MenuButton Example\");\n" 23512" gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);\n" 23513"\n" 23514" menubutton = gtk_menu_button_new ();\n" 23515" gtk_widget_set_size_request (menubutton, 80, 35);\n" 23516"\n" 23517" gtk_grid_attach (GTK_GRID (grid), menubutton, 0, 0, 1, 1);\n" 23518" gtk_container_add (GTK_CONTAINER (window), grid);\n" 23519"\n" 23520" menumodel = g_menu_new ();\n" 23521" g_menu_append (menumodel, \"New\", \"app.new\");\n" 23522" g_menu_append (menumodel, \"About\", \"win.about\");\n" 23523"\n" 23524" submenu = g_menu_new ();\n" 23525" g_menu_append_submenu (menumodel, \"Other\", G_MENU_MODEL (submenu));\n" 23526" g_menu_append (submenu, \"Quit\", \"app.quit\");\n" 23527" gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menubutton), G_MENU_MODEL (menumodel));\n" 23528"\n" 23529" about_action = g_simple_action_new (\"about\", NULL);\n" 23530" g_signal_connect (about_action, \"activate\", G_CALLBACK (about_callback),\n" 23531" GTK_WINDOW (window));\n" 23532" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));\n" 23533"\n" 23534" gtk_widget_show_all (window);\n" 23535"}\n" 23536"\n" 23537"\n" 23538"static void\n" 23539"new_callback (GSimpleAction *simple,\n" 23540" GVariant *parameter,\n" 23541" gpointer user_data)\n" 23542"{\n" 23543" g_print (\"You clicked \\\"New\\\"\\n\");\n" 23544"}\n" 23545"\n" 23546"static void\n" 23547"quit_callback (GSimpleAction *simple,\n" 23548" GVariant *parameter,\n" 23549" gpointer user_data)\n" 23550"{\n" 23551" GApplication *application = user_data;\n" 23552"\n" 23553" g_application_quit (application);\n" 23554"}\n" 23555"\n" 23556"static void\n" 23557"startup (GApplication *app,\n" 23558" gpointer user_data)\n" 23559"{\n" 23560" GSimpleAction *new_action;\n" 23561" GSimpleAction *quit_action;\n" 23562"\n" 23563" new_action = g_simple_action_new (\"new\", NULL);\n" 23564" g_signal_connect (new_action, \"activate\", G_CALLBACK (new_callback), app);\n" 23565" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));\n" 23566"\n" 23567" quit_action = g_simple_action_new (\"quit\", NULL);\n" 23568" g_signal_connect (quit_action, \"activate\", G_CALLBACK (quit_callback), app);\n" 23569" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));\n" 23570"}\n" 23571"\n" 23572"\n" 23573"int\n" 23574"main (int argc, char **argv)\n" 23575"{\n" 23576" GtkApplication *app;\n" 23577" int status;\n" 23578"\n" 23579" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 23580" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 23581" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 23582" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 23583" g_object_unref (app);\n" 23584" return status;\n" 23585"}\n" 23586msgstr "" 23587 23588#. (itstool) path: item/p 23589#: C/menubutton.c.page:38 23590#, fuzzy 23591msgid "" 23592"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMenuButton.html" 23593"\">GtkMenuButton</link>" 23594msgstr "" 23595"<link href=\"https://developer.gnome.org/gtk3/stable/GtkMenuButton.html" 23596"\">GtkMenuButton</link>" 23597 23598#. (itstool) path: item/p 23599#: C/menubutton.c.page:39 23600msgid "" 23601"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMenu.html" 23602"\">GtkMenu</link>" 23603msgstr "" 23604"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMenu.html" 23605"\">GtkMenu</link>" 23606 23607#. (itstool) path: item/p 23608#: C/menubutton.c.page:40 23609msgid "" 23610"<link href=\"https://developer.gnome.org/gio/unstable/GMenuModel.html" 23611"\">GMenuModel</link>" 23612msgstr "" 23613 23614#. (itstool) path: item/p 23615#: C/menubutton.c.page:41 23616msgid "" 23617"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkArrow.html" 23618"\">GtkArrow</link>" 23619msgstr "" 23620 23621#. (itstool) path: info/title 23622#: C/menubutton.js.page:8 23623msgctxt "text" 23624msgid "MenuButton (JavaScript)" 23625msgstr "MenuButton (JavaScript)" 23626 23627#. (itstool) path: credit/name 23628#: C/menubutton.js.page:13 23629#, fuzzy 23630msgid "Anna Zacchi" 23631msgstr "Anna Philips" 23632 23633#. (itstool) path: page/code 23634#: C/menubutton.js.page:28 23635#, no-wrap 23636msgid "" 23637"#!/usr/bin/gjs\n" 23638"\n" 23639"imports.gi.versions.Gtk = '3.0';\n" 23640"\n" 23641"const Gio = imports.gi.Gio;\n" 23642"const GLib = imports.gi.GLib;\n" 23643"const Gtk = imports.gi.Gtk;\n" 23644"\n" 23645"class Application {\n" 23646"\n" 23647" //create the application\n" 23648" constructor() {\n" 23649" this.application = new Gtk.Application({\n" 23650" application_id: 'org.example.myapp',\n" 23651" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 23652" });\n" 23653"\n" 23654" //connect to 'activate' and 'startup' signals to the callback functions\n" 23655" this.application.connect('activate', this._onActivate.bind(this));\n" 23656" this.application.connect('startup', this._onStartup.bind(this));\n" 23657" }\n" 23658"\n" 23659" //create the UI (in this case it's just the ApplicationWindow)\n" 23660" _buildUI() {\n" 23661" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 23662" window_position: Gtk.WindowPosition.CENTER,\n" 23663" title: \"MenuButton Example\" });\n" 23664" this._window.set_default_size(600, 400);\n" 23665" this.grid = new Gtk.Grid();\n" 23666" this._window.add(this.grid);\n" 23667"\n" 23668"\n" 23669" this._menuButton = new Gtk.MenuButton();\n" 23670" this.grid.attach(this._menuButton, 0, 0, 1, 1 );\n" 23671" this.menu = Gtk.Menu.new_from_model(this.menuModel);\n" 23672"\n" 23673" this.menu.show();\n" 23674" this._menuButton.set_menu_model (this.menuModel);\n" 23675" this._menuButton.set_size_request(80, 35);\n" 23676" this._menuButton.show();\n" 23677"\n" 23678" this._window.show_all();\n" 23679" }\n" 23680"\n" 23681" _showNew() {\n" 23682" print(\"You clicked \\\"New\\\"\");\n" 23683" }\n" 23684"\n" 23685" _showAbout() {\n" 23686" print(\"You clicked \\\"About\\\"\");\n" 23687" }\n" 23688"\n" 23689" //create the menu items and connect the signals to the callback functions.\n" 23690" _initMenus() {\n" 23691" let newAction = new Gio.SimpleAction({ name: 'new' });\n" 23692" newAction.connect('activate', () => { this._showNew(); });\n" 23693" this.application.add_action(newAction);\n" 23694"\n" 23695" let aboutAction = new Gio.SimpleAction({ name: 'about' });\n" 23696" aboutAction.connect('activate', () => { this._showAbout(); });\n" 23697" this.application.add_action(aboutAction);\n" 23698"\n" 23699" let quitAction = new Gio.SimpleAction({ name: 'quit' });\n" 23700" quitAction.connect('activate', () => { this._window.destroy(); });\n" 23701" this.application.add_action(quitAction);\n" 23702"\n" 23703" this.menuModel = new Gio.Menu();\n" 23704"\n" 23705" this.menuItemNew = Gio.MenuItem.new(\"New\", 'app.new');\n" 23706" this.menuItemAbout = Gio.MenuItem.new(\"About\", 'app.about');\n" 23707" this.fileMenuItem = Gio.MenuItem.new(\"Other\", null);\n" 23708"\n" 23709" this.menuModel.append_item(this.menuItemNew);\n" 23710" this.menuModel.append_item(this.menuItemAbout);\n" 23711"\n" 23712" //submenu\n" 23713" this.subMenu = new Gio.Menu();\n" 23714" this.fileMenuItem.set_submenu(this.subMenu);\n" 23715" this.menuItemQuit = Gio.MenuItem.new(\"Quit\", 'app.quit');\n" 23716" this.subMenu.append_item(this.menuItemQuit);\n" 23717" this.menuModel.append_item(this.fileMenuItem);\n" 23718" }\n" 23719"\n" 23720" //callback function for 'activate' signal\n" 23721" _onActivate() {\n" 23722" this._window.present();\n" 23723" }\n" 23724"\n" 23725" //callback function for 'startup' signal\n" 23726" _onStartup() {\n" 23727" //You must call _initMenus() before calling _buildUI().\n" 23728" this._initMenus();\n" 23729" this._buildUI();\n" 23730" }\n" 23731"};\n" 23732"\n" 23733"//run the application\n" 23734"let app = new Application();\n" 23735"app.application.run(ARGV);\n" 23736msgstr "" 23737 23738#. (itstool) path: item/p 23739#: C/menubutton.js.page:33 C/menubutton.vala.page:33 23740msgid "" 23741"<link href=\"http://developer.gnome.org/gtk3/3.5/gtk3-GtkMenuButton.html" 23742"\">MenuButton</link>" 23743msgstr "" 23744 23745#. (itstool) path: note/p 23746#: C/menubutton.py.page:32 C/menubutton.vala.page:27 23747msgid "You need to be running GNOME 3.6 for the MenuButton to work." 23748msgstr "" 23749 23750#. (itstool) path: section/code 23751#: C/menubutton.py.page:38 23752#, no-wrap 23753msgid "" 23754"from gi.repository import Gtk\n" 23755"from gi.repository import Gio\n" 23756"import sys\n" 23757"\n" 23758"\n" 23759"class MyWindow(Gtk.ApplicationWindow):\n" 23760"\n" 23761" def __init__(self, app):\n" 23762" Gtk.Window.__init__(self, title=\"Menubutton Example\", application=app)\n" 23763" self.set_default_size(600, 400)\n" 23764"\n" 23765" grid = Gtk.Grid()\n" 23766"\n" 23767" # a menubutton\n" 23768" menubutton = Gtk.MenuButton()\n" 23769" menubutton.set_size_request(80, 35)\n" 23770"\n" 23771" grid.attach(menubutton, 0, 0, 1, 1)\n" 23772"\n" 23773" # a menu with two actions\n" 23774" menumodel = Gio.Menu()\n" 23775" menumodel.append(\"New\", \"app.new\")\n" 23776" menumodel.append(\"About\", \"win.about\")\n" 23777"\n" 23778" # a submenu with one action for the menu\n" 23779" submenu = Gio.Menu()\n" 23780" submenu.append(\"Quit\", \"app.quit\")\n" 23781" menumodel.append_submenu(\"Other\", submenu)\n" 23782"\n" 23783" # the menu is set as the menu of the menubutton\n" 23784" menubutton.set_menu_model(menumodel)\n" 23785"\n" 23786" # the action related to the window (about)\n" 23787" about_action = Gio.SimpleAction.new(\"about\", None)\n" 23788" about_action.connect(\"activate\", self.about_callback)\n" 23789" self.add_action(about_action)\n" 23790"\n" 23791" self.add(grid)\n" 23792"\n" 23793" # callback for \"about\"\n" 23794" def about_callback(self, action, parameter):\n" 23795" print(\"You clicked \\\"About\\\"\")\n" 23796"\n" 23797"\n" 23798"class MyApplication(Gtk.Application):\n" 23799"\n" 23800" def __init__(self):\n" 23801" Gtk.Application.__init__(self)\n" 23802"\n" 23803" def do_activate(self):\n" 23804" win = MyWindow(self)\n" 23805" win.show_all()\n" 23806"\n" 23807" def do_startup(self):\n" 23808" Gtk.Application.do_startup(self)\n" 23809"\n" 23810" # the actions related to the application\n" 23811" new_action = Gio.SimpleAction.new(\"new\", None)\n" 23812" new_action.connect(\"activate\", self.new_callback)\n" 23813" self.add_action(new_action)\n" 23814"\n" 23815" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 23816" quit_action.connect(\"activate\", self.quit_callback)\n" 23817" self.add_action(quit_action)\n" 23818"\n" 23819" # callback functions for the actions related to the application\n" 23820" def new_callback(self, action, parameter):\n" 23821" print(\"You clicked \\\"New\\\"\")\n" 23822"\n" 23823" def quit_callback(self, action, parameter):\n" 23824" print(\"You clicked \\\"Quit\\\"\")\n" 23825" self.quit()\n" 23826"\n" 23827"app = MyApplication()\n" 23828"exit_status = app.run(sys.argv)\n" 23829"sys.exit(exit_status)\n" 23830msgstr "" 23831 23832#. (itstool) path: section/title 23833#: C/menubutton.py.page:42 23834#, fuzzy 23835msgid "Useful methods for a MenuButton widget" 23836msgstr "Métodos úteis" 23837 23838#. (itstool) path: section/p 23839#: C/menubutton.py.page:43 23840msgid "" 23841"In line 33 the signal <code>\"activate\"</code> from the action " 23842"<code>about_action</code> is connected to the callback function " 23843"<code>about_callback()</code> using <code><var>action</var>." 23844"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 23845"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 23846msgstr "" 23847 23848#. (itstool) path: section/p 23849#: C/menubutton.py.page:45 23850msgid "" 23851"The positioning of the menu is determined by the \"direction\" property of " 23852"the menu button and the \"halign\" or \"valign\" properties of the menu. For " 23853"example, when the direction is <code>Gtk.ArrowType.DOWN</code> (other " 23854"option: <code>UP</code>) and the horizontal alignment is <code>Gtk.Align." 23855"START</code> (other options: <code>CENTER</code> and <code>END</code>), the " 23856"menu will be positioned below the button, with the starting edge (depending " 23857"on the text direction) of the menu aligned with the starting edge of the " 23858"button. If there is not enough space below the button, the menu is popped up " 23859"above the button instead. If the alignment would move part of the menu " 23860"offscreen, it is 'pushed in'." 23861msgstr "" 23862 23863#. (itstool) path: section/p 23864#: C/menubutton.py.page:47 23865msgid "" 23866"In the case of vertical alignment, the possible ArrowType directions are " 23867"<code>LEFT</code> and <code>RIGHT</code> and the vertical alignment is again " 23868"<code>START</code>, <code>CENTER</code> or <code>END</code>." 23869msgstr "" 23870 23871#. (itstool) path: section/p 23872#: C/menubutton.py.page:49 23873msgid "" 23874"<code>set_align_widget(alignment)</code> and <code>set_direction(direction)</" 23875"code> can be used to set these properties." 23876msgstr "" 23877 23878#. (itstool) path: item/p 23879#: C/menubutton.py.page:56 23880msgid "" 23881"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMenuButton.html" 23882"\">MenuButton</link>" 23883msgstr "" 23884 23885#. (itstool) path: info/title 23886#: C/menubutton.vala.page:8 23887msgctxt "text" 23888msgid "MenuButton (Vala)" 23889msgstr "MenuButton (Vala)" 23890 23891#. (itstool) path: page/code 23892#: C/menubutton.vala.page:28 23893#, no-wrap 23894msgid "" 23895"public class MyWindow : Gtk.ApplicationWindow {\n" 23896"\n" 23897"\tinternal MyWindow (MyApplication app) {\n" 23898"\t\tObject (application: app, title: \"MenuButton Example\");\n" 23899"\t\tthis.set_default_size (600, 400);\n" 23900"\t\tvar grid = new Gtk.Grid ();\n" 23901"\n" 23902"\t\tvar menubutton = new Gtk.MenuButton();\n" 23903"\t\tmenubutton.set_size_request (80, 35);\n" 23904"\n" 23905"\t\tvar menumodel = new Menu ();\n" 23906"\t\tmenumodel.append (\"New\", \"app.new\");\n" 23907"\t\tmenumodel.append (\"About\", \"win.about\");\n" 23908"\n" 23909"\t\t/* We create the last item as a MenuItem, so that\n" 23910"\t\t * a submenu can be appended to this menu item.\n" 23911"\t\t */\n" 23912"\t\tvar submenu = new Menu ();\n" 23913"\t\tmenumodel.append_submenu (\"Other\", submenu);\n" 23914"\t\tsubmenu.append (\"Quit\", \"app.quit\");\n" 23915"\t\tmenubutton.set_menu_model (menumodel);\n" 23916"\n" 23917"\t\tvar about_action = new SimpleAction (\"about\", null);\n" 23918"\t\tabout_action.activate.connect (this.about_cb);\n" 23919"\t\tthis.add_action (about_action);\n" 23920"\n" 23921"\t\tthis.add(grid);\n" 23922"\t\tgrid.attach(menubutton, 0, 0, 1, 1);\n" 23923"\t}\n" 23924"\n" 23925"\tvoid about_cb (SimpleAction simple, Variant? parameter) {\n" 23926"\t\tprint (\"You clicked \\\"About\\\"\\n\");\n" 23927"\t}\n" 23928"}\n" 23929"\n" 23930"public class MyApplication : Gtk.Application {\n" 23931"\tprotected override void activate () {\n" 23932"\t\tnew MyWindow (this).show_all ();\n" 23933"\t}\n" 23934"\n" 23935"\tinternal MyApplication () {\n" 23936"\t\tObject (application_id: \"org.example.MyApplication\");\n" 23937"\t}\n" 23938"\n" 23939"\t/* Override the 'startup' signal of GLib.Application. */\n" 23940"\tprotected override void startup () {\n" 23941"\t\tbase.startup ();\n" 23942"\n" 23943"\t\tvar new_action = new SimpleAction (\"new\", null);\n" 23944"\t\tnew_action.activate.connect (this.new_cb);\n" 23945"\t\tthis.add_action (new_action);\n" 23946"\n" 23947"\t\tvar quit_action = new SimpleAction (\"quit\", null);\n" 23948"\t\tquit_action.activate.connect (this.quit);\n" 23949"\t\tthis.add_action (quit_action);\n" 23950"\t}\n" 23951"\n" 23952"\tvoid new_cb (SimpleAction simple, Variant? parameter) {\n" 23953"\t\tprint (\"You clicked \\\"New\\\"\\n\");\n" 23954"\t}\n" 23955"}\n" 23956"\n" 23957"public int main (string[] args) {\n" 23958"\treturn new MyApplication ().run (args);\n" 23959"}\n" 23960msgstr "" 23961 23962#. (itstool) path: info/title 23963#: C/message-board.c.page:8 23964#, fuzzy 23965msgctxt "text" 23966msgid "Message board (C)" 23967msgstr " board – exibe o tabuleiro atual" 23968 23969#. (itstool) path: info/desc 23970#: C/message-board.c.page:11 23971msgid "A simple program using WebKitGTK+ and the DOM." 23972msgstr "" 23973 23974#. (itstool) path: page/title 23975#: C/message-board.c.page:26 23976#, fuzzy 23977msgid "Message board" 23978msgstr " board – exibe o tabuleiro atual" 23979 23980#. (itstool) path: item/p 23981#: C/message-board.c.page:31 23982msgid "How to display a web page with WebKit." 23983msgstr "" 23984 23985#. (itstool) path: item/p 23986#: C/message-board.c.page:32 23987msgid "" 23988"How to manipulate the contents of a web page using WebKit's DOM functions." 23989msgstr "" 23990 23991#. (itstool) path: synopsis/p 23992#: C/message-board.c.page:35 23993msgid "" 23994"This tutorial assumes you are familiar with the C programming language and " 23995"have a basic understanding of GTK+, including how to create and place " 23996"widgets and how to connect callback functions to signals. See <link xref=" 23997"\"image-viewer.c\"/> to learn the basics of GTK+." 23998msgstr "" 23999 24000#. (itstool) path: page/media 24001#. This is a reference to an external file such as an image or video. When 24002#. the file changes, the md5 hash will change to let you know you need to 24003#. update your localized copy. The msgstr is not used at all. Set it to 24004#. whatever you like once you have updated your copy of the file. 24005#: C/message-board.c.page:41 24006msgctxt "_" 24007msgid "" 24008"external ref='media/message-board.ogv' md5='beb80c4538776dc2cdd26c95abea5027'" 24009msgstr "" 24010 24011#. (itstool) path: section/p 24012#: C/message-board.c.page:48 24013msgid "" 24014"The GNOME platform includes WebKitGTK+, built on top of the powerful WebKit " 24015"HTML framework. WebKit is used throughout GNOME, not just to view web pages " 24016"on the Internet, but also to create rich user interfaces that can be easily " 24017"styled with CSS." 24018msgstr "" 24019 24020#. (itstool) path: section/p 24021#: C/message-board.c.page:53 24022msgid "" 24023"In this tutorial, you will create a simple message board using WebKit. The " 24024"message board will allow you to enter some text and have it added to a list " 24025"of messages in HTML. Before you begin, you need to set up a project in " 24026"Anjuta." 24027msgstr "" 24028 24029#. (itstool) path: item/p 24030#: C/message-board.c.page:59 24031msgid "" 24032"In Anjuta, click <guiseq><gui>File</gui><gui>New</gui> <gui>Project</gui></" 24033"guiseq> to open the new project assistant." 24034msgstr "" 24035 24036#. (itstool) path: item/p 24037#: C/message-board.c.page:61 24038msgid "" 24039"Select <gui>GTK+ (simple)</gui> on the <gui>C</gui> tab, and click " 24040"<gui>Continue</gui>." 24041msgstr "" 24042 24043#. (itstool) path: item/p 24044#: C/message-board.c.page:63 24045msgid "" 24046"Fill out your details on the <gui>Basic information</gui> page. Use " 24047"<input>message-board</input> for the project name. Click <gui>Continue</gui>." 24048msgstr "" 24049 24050#. (itstool) path: item/p 24051#: C/message-board.c.page:66 24052msgid "" 24053"Disable the <gui>Use GtkBuilder for user interface</gui> option as this " 24054"tutorial builds the user-interface manually." 24055msgstr "" 24056 24057#. (itstool) path: item/p 24058#: C/message-board.c.page:69 24059msgid "" 24060"You need to tell Anjuta you're using WebKitGTK+ on this project. On the " 24061"<gui>Project options</gui> page, select <gui>Configure external packages</" 24062"gui>. Click <gui>Continue</gui>. On the <gui>Configure external packages</" 24063"gui> page, check <gui>webkitgtk-3.0</gui>." 24064msgstr "" 24065 24066#. (itstool) path: section/p 24067#: C/message-board.c.page:75 24068msgid "" 24069"After you finish the new project assistant, open the file <file>src/main.c</" 24070"file> from either the <gui>Project</gui> or the <gui>File</gui> tab. Anjuta " 24071"will have filled this in with some basic GTK+ code from its templates. Since " 24072"you are creating a WebKit project, you first need to include the WebKit " 24073"headers. After the line that includes <code>gtk/gtk.h</code>, add the " 24074"following line:" 24075msgstr "" 24076 24077#. (itstool) path: section/code 24078#: C/message-board.c.page:82 24079#, fuzzy, no-wrap 24080msgid "#include <webkit/webkit.h>" 24081msgstr "#include <gtkmm.h>" 24082 24083#. (itstool) path: section/p 24084#: C/message-board.c.page:84 24085msgid "" 24086"Verify that everything works by building what you have so far. Click " 24087"<guiseq><gui>Build</gui><gui>Build Project</gui></guiseq> or just press " 24088"<keyseq><key>Shift</key><key>F7</key></keyseq>. The first time you build, " 24089"you will be asked for some configure options. Just accept the defaults and " 24090"click <gui>Execute</gui>." 24091msgstr "" 24092 24093#. (itstool) path: section/p 24094#: C/message-board.c.page:90 24095msgid "" 24096"You should now be able to run the program. Click <guiseq> <gui>Run</" 24097"gui><gui>Execute</gui></guiseq> or just press <key>F3</key>. You should see " 24098"an empty window appear." 24099msgstr "" 24100 24101#. (itstool) path: section/title 24102#: C/message-board.c.page:96 24103msgid "Lay out your window and web view" 24104msgstr "" 24105 24106#. (itstool) path: section/p 24107#: C/message-board.c.page:98 24108msgid "" 24109"Now that you can show a window, it's time to start working with WebKit. For " 24110"this tutorial, you'll create a text entry and a web view and pack them both " 24111"into a window. Find the function <code>create_window</code> and replace it " 24112"with the following:" 24113msgstr "" 24114 24115#. (itstool) path: section/code 24116#: C/message-board.c.page:103 24117#, no-wrap 24118msgid "" 24119"\n" 24120"static GtkWidget*\n" 24121"create_window (void)\n" 24122"{\n" 24123" GtkWidget *window, *box, *scroll, *view, *entry;\n" 24124"\n" 24125" window = gtk_window_new (GTK_WINDOW_TOPLEVEL);\n" 24126" gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);\n" 24127" gtk_window_set_title (GTK_WINDOW (window), \"Message Board\");\n" 24128" g_signal_connect (window, \"delete-event\", G_CALLBACK (gtk_main_quit), NULL);\n" 24129"\n" 24130" box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);\n" 24131" gtk_container_set_border_width (GTK_CONTAINER (box), 6);\n" 24132" gtk_container_add (GTK_CONTAINER (window), box);\n" 24133"\n" 24134" entry = gtk_entry_new ();\n" 24135" gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 0);\n" 24136"\n" 24137" scroll = gtk_scrolled_window_new (NULL, NULL);\n" 24138" g_object_set (scroll, \"shadow-type\", GTK_SHADOW_IN, NULL);\n" 24139" gtk_box_pack_start (GTK_BOX (box), scroll, TRUE, TRUE, 0);\n" 24140"\n" 24141" view = webkit_web_view_new ();\n" 24142" gtk_container_add (GTK_CONTAINER (scroll), view);\n" 24143" webkit_web_view_load_string (WEBKIT_WEB_VIEW (view),\n" 24144" \"<html><body></body></html>\",\n" 24145" \"text/html\",\n" 24146" \"UTF-8\",\n" 24147" NULL);\n" 24148"\n" 24149" gtk_widget_show_all (GTK_WIDGET (box));\n" 24150" return window;\n" 24151"}\n" 24152msgstr "" 24153 24154#. (itstool) path: section/p 24155#: C/message-board.c.page:138 24156msgid "" 24157"You first create a <code>GtkWindow</code> object and set its title and " 24158"default size. You also connect the <code>gtk_main_quit</code> function to " 24159"the <code>delete-event</code> signal. The <code>delete-event</code> signal " 24160"is emitted when the window is closed. The <code>gtk_main_quit</code> " 24161"function is part of GTK, and it quits the application." 24162msgstr "" 24163 24164#. (itstool) path: section/p 24165#: C/message-board.c.page:144 24166msgid "" 24167"You then create a vertical box and add it to the window. A window can only " 24168"hold a single child widget, so you need to use a box to add multiple " 24169"widgets. The second argument to <code>gtk_box_new</code> sets the amount of " 24170"padding (in pixels) between each child, and the next line puts a six-pixel " 24171"border around the entire thing." 24172msgstr "" 24173 24174#. (itstool) path: section/p 24175#: C/message-board.c.page:150 24176msgid "" 24177"You next create a <code>GtkEntry</code> object and pack it into the box. The " 24178"third and fourth arguments to <code>gtk_box_pack_start</code> specify that " 24179"the entry shouldn't take up any extra space the box has available. The " 24180"fourth argument is the amount of padding you want around the entry. In this " 24181"case, you set the padding to zero, because you're allowing the box to handle " 24182"all the padding." 24183msgstr "" 24184 24185#. (itstool) path: section/p 24186#: C/message-board.c.page:157 24187msgid "" 24188"Before you add a web view, you have to create a scrolled window to put it " 24189"inside of. The scrolled window will place scrollbars on the right and bottom " 24190"when necessary, and prevent your web view from filling your entire screen. " 24191"This time, you pass <code>TRUE</code> and <code>TRUE</code> to " 24192"<code>gtk_box_pack_start</code> to allow the scrolled window (and thus, the " 24193"web view) to use any extra space available in the box." 24194msgstr "" 24195 24196#. (itstool) path: section/p 24197#: C/message-board.c.page:164 24198msgid "" 24199"Finally, you create a <code>WebKitWebView</code> and add it to the scrolled " 24200"window. Then load a very basic HTML page into the web view by calling " 24201"<code>webkit_web_view_load_string</code> with the following arguments:" 24202msgstr "" 24203 24204#. (itstool) path: item/title 24205#: C/message-board.c.page:170 24206#, fuzzy 24207msgid "<code>WEBKIT_WEB_VIEW (view)</code>" 24208msgstr "<em>Visualização de código fonte</em>" 24209 24210#. (itstool) path: item/p 24211#: C/message-board.c.page:171 24212msgid "" 24213"The view itself. Because <code>view</code> is typed as a <code>GtkWidget*</" 24214"code>, you have to use <code>WEBKIT_WEB_VIEW</code> to safely cast the " 24215"object." 24216msgstr "" 24217 24218#. (itstool) path: item/title 24219#: C/message-board.c.page:176 24220msgid "<code>\"<html><body></body></html>\"</code>" 24221msgstr "" 24222 24223#. (itstool) path: item/p 24224#: C/message-board.c.page:177 24225msgid "The simplest HTML file you could possibly write." 24226msgstr "" 24227 24228#. (itstool) path: item/title 24229#: C/message-board.c.page:180 24230#, fuzzy 24231msgid "<code>\"text/html\"</code>" 24232msgstr "" 24233"Consulte o arquivo <file>/usr/share/applications/defaults.list</file> para " 24234"determinar os tipos MIME para os quais você deseja alterar o aplicativo " 24235"registrado padrão. Por exemplo, o exemplo a seguir de arquivo <file>defaults." 24236"list</file> especifica o aplicativo registrado padrão para os tipos MIME " 24237"<code>text/html</code> e <code>application/xhtml+xml</code>:" 24238 24239#. (itstool) path: item/p 24240#: C/message-board.c.page:181 24241msgid "" 24242"The MIME type of the content you provided. In this case, you're using plain " 24243"HTML." 24244msgstr "" 24245 24246#. (itstool) path: item/title 24247#: C/message-board.c.page:185 24248#, fuzzy 24249msgid "<code>\"UTF-8\"</code>" 24250msgstr "CÓDIGO[:…]" 24251 24252#. (itstool) path: item/p 24253#: C/message-board.c.page:186 24254msgid "" 24255"The character encoding of the content you provided. Although you only used " 24256"ASCII characters, it's a good idea to specify UTF-8. UTF-8 is used as the " 24257"default encoding throughout the GNOME platform." 24258msgstr "" 24259 24260#. (itstool) path: item/title 24261#: C/message-board.c.page:191 24262#, fuzzy 24263msgid "<code>NULL</code>" 24264msgstr "" 24265"Em comentários de gtk-doc, anotações devem ser preferidos a equivalentes " 24266"legíveis por humanos, Por exemplo, ao documentar o parâmetro de uma função " 24267"que pode ser <code>NULL</code>, use a anotação <code>(nullable)</code> e, " 24268"vez de algum texto:" 24269 24270#. (itstool) path: item/p 24271#: C/message-board.c.page:192 24272msgid "" 24273"The base URI. You don't need it in this simple example, but you might want " 24274"to provide a <sys>file:</sys> URI if you add images or other features where " 24275"you want to use relative URI references." 24276msgstr "" 24277 24278#. (itstool) path: note/p 24279#: C/message-board.c.page:199 24280msgid "" 24281"Every time you add a widget, you have to call <code>gtk_widget_show</code> " 24282"on it for it to be visible. If you call <code>gtk_widget_show_all</code> on " 24283"a container widget like a <code>GtkBox</code>, GTK+ will automatically show " 24284"all the widgets inside the container, to any depth. Sometimes you don't want " 24285"to call <code>gtk_widget_show_all</code>, such as when you want to " 24286"dynamically hide and show some widgets in response to events." 24287msgstr "" 24288 24289#. (itstool) path: section/p 24290#: C/message-board.c.page:207 24291msgid "" 24292"Finally, you have to call <code>gtk_widget_show_all</code> on the box. " 24293"Otherwise, none of the widgets you created will be visible. (The window is " 24294"shown in the <code>main</code> function with <code>gtk_widget_show</code>.)" 24295msgstr "" 24296 24297#. (itstool) path: section/p 24298#: C/message-board.c.page:211 24299msgid "" 24300"Build and run the message board again. You should see a window with a text " 24301"entry and a web view. It doesn't do anything yet because the text entry and " 24302"the web view don't know anything about each other." 24303msgstr "" 24304 24305#. (itstool) path: section/title 24306#: C/message-board.c.page:217 24307#, fuzzy 24308msgid "Hook up signals" 24309msgstr "sinais" 24310 24311#. (itstool) path: section/p 24312#: C/message-board.c.page:219 24313msgid "" 24314"Now you want to make the message board actually <em>do</em> something when " 24315"you enter text into the text entry. To do this, connect a callback function " 24316"to the <code>activate</code> signal of <code>entry</code>. GTK+ emits the " 24317"<code>activate</code> signal whenever the user presses <key>Enter</key> in " 24318"the entry. Add the following into <code>create_window</code>, anywhere after " 24319"both <code>entry</code> and <code>view</code> have been defined:" 24320msgstr "" 24321 24322#. (itstool) path: section/code 24323#: C/message-board.c.page:226 24324#, no-wrap 24325msgid "" 24326"\n" 24327"g_signal_connect (entry, \"activate\", G_CALLBACK (entry_activate_cb), view);\n" 24328msgstr "" 24329 24330#. (itstool) path: section/p 24331#: C/message-board.c.page:230 24332msgid "" 24333"You then have to actually define <code>entry_activate_cb</code>. Define it " 24334"as follows, anywhere above <code>create_window</code>:" 24335msgstr "" 24336 24337#. (itstool) path: section/code 24338#: C/message-board.c.page:233 24339#, no-wrap 24340msgid "" 24341"\n" 24342"static void\n" 24343"entry_activate_cb (GtkEntry *entry, WebKitWebView *view)\n" 24344"{\n" 24345" WebKitDOMDocument *document;\n" 24346" WebKitDOMElement *body, *div;\n" 24347"\n" 24348" document = webkit_web_view_get_dom_document (view);\n" 24349" body = webkit_dom_document_query_selector (document, \"body\", NULL);\n" 24350" div = webkit_dom_document_create_element (document, \"div\", NULL);\n" 24351" webkit_dom_node_set_text_content (WEBKIT_DOM_NODE (div),\n" 24352" gtk_entry_get_text (entry),\n" 24353" NULL);\n" 24354" webkit_dom_node_append_child (WEBKIT_DOM_NODE (body),\n" 24355" WEBKIT_DOM_NODE (div),\n" 24356" NULL);\n" 24357" gtk_entry_set_text (entry, \"\");\n" 24358"}\n" 24359msgstr "" 24360 24361#. (itstool) path: section/p 24362#: C/message-board.c.page:253 24363msgid "" 24364"The first thing you do is get a <code>WebKitDOMDocument</code> object that " 24365"represents the HTML document displayed in <code>view</code>. The DOM classes " 24366"and methods in WebKit allow you to inspect and manipulate the HTML document, " 24367"and work very similarly to the DOM APIs you might already know from " 24368"JavaScript." 24369msgstr "" 24370 24371#. (itstool) path: section/p 24372#: C/message-board.c.page:259 24373msgid "" 24374"Once you have the document, you want to get the <code>body</code> element so " 24375"that you can add <code>div</code> elements to it. The " 24376"<code>webkit_dom_document_query_selector</code> function lets you find an " 24377"element in the document using CSS selectors. This keeps you from having to " 24378"write tedious loops to traverse the document." 24379msgstr "" 24380 24381#. (itstool) path: section/p 24382#: C/message-board.c.page:270 24383msgid "" 24384"Next, you create a new <code>div</code> element to hold the message. Every " 24385"element you create has to be attached to a document, so the function to " 24386"create an element takes the <code>WebKitDOMDocument</code> as its first " 24387"arguments. You then set the text content of the element to the contents of " 24388"the text entry. Because <code>gtk_entry_get_text</code> returns a " 24389"<code>const gchar*</code>, you don't have to free the result." 24390msgstr "" 24391 24392#. (itstool) path: section/p 24393#: C/message-board.c.page:283 24394msgid "" 24395"Finally, you append the new <code>div</code> element to the body and clear " 24396"out the text entry so you can type something new. Build and run the program " 24397"again and test it for yourself." 24398msgstr "" 24399 24400#. (itstool) path: section/title 24401#: C/message-board.c.page:290 24402msgid "Make it look better with CSS" 24403msgstr "" 24404 24405#. (itstool) path: section/p 24406#: C/message-board.c.page:292 24407msgid "" 24408"At this point, your program is completely functional, but not very pretty. " 24409"You can style the message display with CSS, just like you can with any other " 24410"HTML page. There are many ways you could attach some CSS to the page: You " 24411"could add it in the initial HTML document. You could inline it in the " 24412"<code>style</code> attribute of the <code>div</code> elements. You could " 24413"even programmatically construct it using the DOM APIs." 24414msgstr "" 24415 24416#. (itstool) path: section/p 24417#: C/message-board.c.page:299 24418msgid "" 24419"In this tutorial, you'll attach the CSS using the <code>user-stylesheet-uri</" 24420"code> property of the <code>WebKitWebSetting</code> object attached to your " 24421"web view. In a more complete application, you would want to save and load " 24422"your HTML file. Keeping the style information outside the actual HTML means " 24423"that you can change the styling completely within your application, without " 24424"having to change users' files. You would normally just install a file along " 24425"with your application, but just to keep everything in one file for this " 24426"demo, we'll use a trick called a data URI. First, define the CSS as a static " 24427"string near the top of your file." 24428msgstr "" 24429 24430#. (itstool) path: section/code 24431#: C/message-board.c.page:308 24432#, no-wrap 24433msgid "" 24434"\n" 24435"static const guchar CSS[] =\n" 24436"\"body { margin: 0; padding: 0; }\\n\"\n" 24437"\"div { \"\n" 24438"\" -webkit-border-radius: 2px;\"\n" 24439"\" background: -webkit-gradient(linear, 0% 100%, 0% 0%,\"\n" 24440"\" from(#f1f1f1), to(white));\"\n" 24441"\" border: solid 1px #c6c6c6;\"\n" 24442"\" -webkit-box-shadow: 0px 0px 2px #c6c6c6;\"\n" 24443"\" margin: 12px; padding: 6px;\"\n" 24444"\"}\";\n" 24445msgstr "" 24446 24447#. (itstool) path: section/p 24448#: C/message-board.c.page:321 24449msgid "" 24450"All you have in this example are <code>div</code> elements inside a " 24451"<code>body</code> element. If you created more complicated HTML, you could " 24452"use whatever CSS is necessary. In fact, if you're comfortable with CSS, you " 24453"should trying changing this to something you like better." 24454msgstr "" 24455 24456#. (itstool) path: section/p 24457#: C/message-board.c.page:326 24458msgid "" 24459"To apply the CSS, you set the <code>user-stylesheet-uri</code> in the " 24460"<code>create_window</code> function, anywhere after <code>view</code> has " 24461"already been defined." 24462msgstr "" 24463 24464#. (itstool) path: section/code 24465#: C/message-board.c.page:332 24466#, no-wrap 24467msgid "" 24468"\n" 24469"tmp = g_base64_encode (CSS, strlen((gchar *) CSS));\n" 24470"css = g_strconcat (\"data:text/css;charset=utf-8;base64,\",\n" 24471" tmp, NULL);\n" 24472"g_object_set (webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view)),\n" 24473" \"user-stylesheet-uri\", css, NULL);\n" 24474"g_free (css);\n" 24475"g_free (tmp);\n" 24476msgstr "" 24477 24478#. (itstool) path: section/p 24479#: C/message-board.c.page:342 24480msgid "" 24481"Also, make sure to add variable declarations for <code>tmp</code> and " 24482"<code>css</code> to the top of <code>create_window</code>." 24483msgstr "" 24484 24485#. (itstool) path: section/code 24486#: C/message-board.c.page:345 24487#, fuzzy, no-wrap 24488msgid "" 24489"\n" 24490"gchar *tmp, *css;\n" 24491msgstr "gchar*" 24492 24493#. (itstool) path: section/p 24494#: C/message-board.c.page:349 24495msgid "" 24496"A data URI starts with <sys>data:</sys> and some information about the " 24497"content type and how the data is encoded. The actual data follows after a " 24498"comma, in this case encoded in Base64. Unlike other URI schemes like " 24499"<sys>http:</sys>, <sys>ftp:</sys>, and <sys>file:</sys>, the <sys>data:</" 24500"sys> URI scheme doesn't specify where to find a file to load. Rather, it " 24501"gives the entire contents of the file." 24502msgstr "" 24503 24504#. (itstool) path: section/p 24505#: C/message-board.c.page:356 24506msgid "" 24507"The code above first encodes your CSS definitions in Base64, then combines " 24508"that with a fixed string to create a data URI. The <code>g_strconcat</code> " 24509"function can take any number of string arguments and concatenate them all " 24510"together, so you have to pass <code>NULL</code> as the final argument so it " 24511"knows when to stop. And don't forget to free those temporary strings after " 24512"you set the stylesheet property." 24513msgstr "" 24514 24515#. (itstool) path: section/p 24516#: C/message-board.c.page:363 24517msgid "" 24518"Build and run the program again. It should now work exactly the same as at " 24519"the end of the last section, except the messages will be nicely styled with " 24520"a border and a subtle background gradient." 24521msgstr "" 24522 24523#. (itstool) path: section/title 24524#: C/message-board.c.page:369 24525#, fuzzy 24526msgid "Learn more" 24527msgstr "A_prenda mais" 24528 24529#. (itstool) path: section/p 24530#: C/message-board.c.page:371 24531msgid "" 24532"This tutorial showed you how to create a basic application using GTK+ and " 24533"WebKit, including showing a document and manipulating its contents. To " 24534"create a real application, you probably want to do a little bit more. Try " 24535"adding features on your own. Here are a few ideas:" 24536msgstr "" 24537 24538#. (itstool) path: item/p 24539#: C/message-board.c.page:377 24540msgid "" 24541"If you're comfortable with CSS, try changing the style of the message " 24542"display. CSS is easy to get started with, but increasingly more powerful. " 24543"There is a wealth of CSS tutorials on the Internet, and just about " 24544"everything you can do on the web, you can do in this application." 24545msgstr "" 24546 24547#. (itstool) path: item/p 24548#: C/message-board.c.page:383 24549msgid "" 24550"Right now, you lose all your messages whenever you close the message board. " 24551"Try saving the HTML contents after each post, and loading the saved file (if " 24552"it exists) on startup." 24553msgstr "" 24554 24555#. (itstool) path: item/p 24556#: C/message-board.c.page:391 24557msgid "" 24558"If you keep your messages around for a long time, you'll start wondering " 24559"when you posted them. Add a timestamp to each message when it's posted. " 24560"You'll probably want to create some additional child <code>div</code> " 24561"elements with different classes that you can style in the CSS." 24562msgstr "" 24563 24564#. (itstool) path: item/p 24565#: C/message-board.c.page:398 24566msgid "" 24567"This program keeps messages around forever. Think about ways you could allow " 24568"the user to delete messages. Perhaps you want messages to disappear " 24569"automatically after they're too old, or after there are a certain number of " 24570"messages before them. Or you could add a link in each message to delete it. " 24571"You could even override the context menu when you right-click on a message. " 24572"These features involve exploring WebKit's DOM API more." 24573msgstr "" 24574 24575#. (itstool) path: info/title 24576#: C/messagedialog.c.page:8 24577msgctxt "text" 24578msgid "MessageDialog (C)" 24579msgstr "MessageDialog (C)" 24580 24581#. (itstool) path: info/desc 24582#: C/messagedialog.c.page:19 C/messagedialog.py.page:19 24583#: C/messagedialog.vala.page:18 24584#, fuzzy 24585msgid "A message window" 24586msgstr "Janela de mensagem" 24587 24588#. (itstool) path: page/title 24589#: C/messagedialog.c.page:22 C/messagedialog.js.page:24 24590#: C/messagedialog.py.page:22 C/messagedialog.vala.page:21 24591msgid "MessageDialog" 24592msgstr "" 24593 24594#. (itstool) path: page/media 24595#. This is a reference to an external file such as an image or video. When 24596#. the file changes, the md5 hash will change to let you know you need to 24597#. update your localized copy. The msgstr is not used at all. Set it to 24598#. whatever you like once you have updated your copy of the file. 24599#: C/messagedialog.c.page:24 C/messagedialog.js.page:25 24600#: C/messagedialog.py.page:23 C/messagedialog.vala.page:22 24601msgctxt "_" 24602msgid "" 24603"external ref='media/messagedialog.png' md5='1956288274018e2386d9cba96a2101de'" 24604msgstr "" 24605"external ref='media/messagedialog.png' md5='1956288274018e2386d9cba96a2101de'" 24606 24607#. (itstool) path: page/p 24608#: C/messagedialog.c.page:25 C/messagedialog.vala.page:23 24609msgid "A modal message dialog which can cause the world to explode." 24610msgstr "" 24611 24612#. (itstool) path: note/p 24613#: C/messagedialog.c.page:26 24614msgid "" 24615"To test out the application once it has started running, you can click on " 24616"the \"Message Dialog\" tab that appears in the top menubar of the screen." 24617msgstr "" 24618 24619#. (itstool) path: page/code 24620#: C/messagedialog.c.page:30 24621#, no-wrap 24622msgid "" 24623"\n" 24624"#include <gtk/gtk.h>\n" 24625"\n" 24626"\n" 24627"\n" 24628"/* Callback function in which reacts to the \"response\" signal from the user in\n" 24629" * the message dialog window.\n" 24630" * This function is used to interact with the user in the terminal.\n" 24631" */\n" 24632"static void\n" 24633"on_response (GtkDialog *dialog,\n" 24634" gint response_id,\n" 24635" gpointer user_data)\n" 24636"{\n" 24637" /* If the button clicked gives response OK (response_id being -5) */\n" 24638" if (response_id == GTK_RESPONSE_OK) \n" 24639" g_print (\"*boom*\\n\");\n" 24640"\n" 24641" /* If the button clicked gives response CANCEL (response_id being -6) */\n" 24642" else if (response_id == GTK_RESPONSE_CANCEL)\n" 24643" g_print (\"good choice\\n\");\n" 24644"\n" 24645" /* If the message dialog is destroyed (for example by pressing escape) */\n" 24646" else if (response_id == GTK_RESPONSE_DELETE_EVENT)\n" 24647" g_print (\"dialog closed or cancelled\\n\");\n" 24648"\n" 24649" /* Destroy the dialog after one of the above actions have taken place */\n" 24650" gtk_widget_destroy (GTK_WIDGET (dialog));\n" 24651"\n" 24652"}\n" 24653"\n" 24654"\n" 24655"\n" 24656"/* Callback function for the response signal \"activate\" related to the SimpleAction\n" 24657" * message_action.\n" 24658" * This function is used to cause the message dialog window to popup.\n" 24659" */\n" 24660"static void\n" 24661"message_cb (GSimpleAction *simple,\n" 24662" GVariant *parameter,\n" 24663" gpointer user_data)\n" 24664"{\n" 24665" /* the parent variable in this case represents the window */\n" 24666" GtkWidget *message_dialog;\n" 24667" GtkWindow *parent = user_data;\n" 24668" \n" 24669" /* Create a new message dialog, and set the parameters as follows:\n" 24670" * Dialog Flags - make the constructed dialog modal \n" 24671" * (modal windows prevent interaction with other windows in the application)\n" 24672" * Message Type - nonfatal warning message\n" 24673" * Buttons Type - use the ok and cancel buttons\n" 24674" * message_format - text that you want the user to see in the window \n" 24675" */\n" 24676" message_dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL, \n" 24677" GTK_MESSAGE_WARNING, \n" 24678" GTK_BUTTONS_OK_CANCEL, \n" 24679" \"This action will cause the universe to stop existing.\");\n" 24680"\n" 24681" gtk_widget_show_all (message_dialog);\n" 24682"\n" 24683" g_signal_connect (GTK_DIALOG (message_dialog), \"response\", \n" 24684" G_CALLBACK (on_response), NULL);\n" 24685"\n" 24686"}\n" 24687"\n" 24688"\n" 24689"\n" 24690"static void\n" 24691"activate (GtkApplication *app,\n" 24692" gpointer user_data)\n" 24693"{\n" 24694" GtkWidget *window;\n" 24695" GtkWidget *label;\n" 24696"\n" 24697" GSimpleAction *message_action;\n" 24698"\n" 24699" /* Create a window with a title and a default size */\n" 24700" window = gtk_application_window_new (app);\n" 24701" gtk_window_set_title (GTK_WINDOW (window), \"GMenu Example\");\n" 24702" gtk_window_set_default_size (GTK_WINDOW (window), 400, 200);\n" 24703"\n" 24704" /* Create a label and add it to the window */\n" 24705" label = gtk_label_new (\"This application goes boom!\");\n" 24706" gtk_container_add (GTK_CONTAINER (window), label);\n" 24707"\n" 24708" /* Create a new simple action, giving it a NULL parameter type. It will \n" 24709" * always be NULL for actions invoked from a menu. (e.g clicking on an \"ok\" \n" 24710" * or \"cancel\" button)\n" 24711" */\n" 24712" message_action = g_simple_action_new (\"message\", NULL); \n" 24713"\n" 24714" /* Connect the \"activate\" signal to the appropriate callback function */\n" 24715" g_signal_connect (message_action, \"activate\", G_CALLBACK (message_cb), \n" 24716" GTK_WINDOW (window));\n" 24717"\n" 24718" /* Adds the message_action to the overall action map. An Action map is an \n" 24719" * interface that contains a number of named GAction instances \n" 24720" * (such as message_action) \n" 24721" */\n" 24722" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (message_action));\n" 24723"\n" 24724" gtk_widget_show_all (window);\n" 24725"}\n" 24726"\n" 24727"\n" 24728"\n" 24729"/* Callback function for the response signal \"activate\" from the \"quit\" action \n" 24730" * in the function directly below.\n" 24731" */ \n" 24732"static void\n" 24733"quit_cb (GSimpleAction *simple,\n" 24734" GVariant *parameter,\n" 24735" gpointer user_data)\n" 24736"{\n" 24737" GApplication *application = user_data;\n" 24738"\n" 24739" g_application_quit (application);\n" 24740"}\n" 24741"\n" 24742"\n" 24743"\n" 24744"/* Startup function for the menu we are creating in this sample */\n" 24745"static void\n" 24746"startup (GApplication *app,\n" 24747" gpointer user_data)\n" 24748"{\n" 24749" GMenu *menu;\n" 24750" GSimpleAction *quit_action;\n" 24751"\n" 24752" /* Initialize the GMenu, and add a menu item with label \"Message\" and action \n" 24753" * \"win.message\". Also add another menu item with label \"Quit\" and action \n" 24754" * \"app.quit\" \n" 24755" */\n" 24756" menu = g_menu_new ();\n" 24757" g_menu_append (menu, \"Message\", \"win.message\");\n" 24758" g_menu_append (menu, \"Quit\", \"app.quit\");\n" 24759"\n" 24760" /* Create a new simple action for the application. (In this case it is the \n" 24761" * \"quit\" action.\n" 24762" */\n" 24763" quit_action = g_simple_action_new (\"quit\", NULL);\n" 24764"\n" 24765" /* Ensure that the menu we have just created is set for the overall application */\n" 24766" gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));\n" 24767"\n" 24768" g_signal_connect (quit_action, \n" 24769" \"activate\", \n" 24770" G_CALLBACK (quit_cb), \n" 24771" app);\n" 24772"\n" 24773" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));\n" 24774"\n" 24775"}\n" 24776"\n" 24777"\n" 24778"\n" 24779"/* Startup function for the application */\n" 24780"int\n" 24781"main (int argc, char **argv)\n" 24782"{\n" 24783" GtkApplication *app;\n" 24784" int status;\n" 24785"\n" 24786" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 24787" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 24788" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 24789" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 24790" g_object_unref (app);\n" 24791"\n" 24792" return status;\n" 24793"}\n" 24794msgstr "" 24795 24796#. (itstool) path: item/p 24797#: C/messagedialog.c.page:37 24798msgid "" 24799"<link href=\"http://developer.gnome.org/gio/stable/GApplication.html" 24800"\">GApplication</link>" 24801msgstr "" 24802"<link href=\"http://developer.gnome.org/gio/stable/GApplication.html" 24803"\">GApplication</link>" 24804 24805#. (itstool) path: item/p 24806#: C/messagedialog.c.page:39 24807msgid "" 24808"<link href=\"http://developer.gnome.org/gtk3/stable/GtkMessageDialog.html" 24809"\">GtkMessageDialog</link>" 24810msgstr "" 24811"<link href=\"http://developer.gnome.org/gtk3/stable/GtkMessageDialog.html" 24812"\">GtkMessageDialog</link>" 24813 24814#. (itstool) path: item/p 24815#: C/messagedialog.c.page:40 24816msgid "" 24817"<link href=\"http://developer.gnome.org/gio/stable/GSimpleAction.html#g-" 24818"simple-action-new\">GSimpleAction</link>" 24819msgstr "" 24820 24821#. (itstool) path: info/title 24822#: C/messagedialog.js.page:8 24823msgctxt "text" 24824msgid "MessageDialog (JavaScript)" 24825msgstr "MessageDialog (JavaScript)" 24826 24827#. (itstool) path: info/desc 24828#: C/messagedialog.js.page:21 24829#, fuzzy 24830msgid "A popup message attached to a window" 24831msgstr "Mensagem instantânea junto com ícone." 24832 24833#. (itstool) path: page/p 24834#: C/messagedialog.js.page:26 24835msgid "" 24836"A MessageDialog is a modal message dialog, which means a popup that you have " 24837"to respond to before you get back to what you were doing in the window that " 24838"it's attached to. This one can cause the world to explode (or at least it " 24839"says that it can). To make the popup appear when you run this sample, click " 24840"on \"Message\" inside of its application menu -- that's the menu that " 24841"appears when you click on an application's name in the upper-left screen " 24842"corner, next to Activities." 24843msgstr "" 24844 24845#. (itstool) path: note/p 24846#: C/messagedialog.js.page:27 24847msgid "" 24848"The difference between a MessageDialog and a <link xref=\"dialog.js" 24849"\">Dialog</link> is that a Dialog can contain whatever widgets and content " 24850"you want to put in it, whereas a MessageDialog is just a convenient way to " 24851"make popups appear with a basic message and buttons." 24852msgstr "" 24853 24854#. (itstool) path: section/code 24855#: C/messagedialog.js.page:32 C/radiobutton.js.page:29 C/scale.js.page:29 24856#: C/spinbutton.js.page:32 C/statusbar.js.page:29 C/switch.js.page:36 24857#: C/togglebutton.js.page:29 24858#, no-wrap 24859msgid "" 24860"\n" 24861"#!/usr/bin/gjs\n" 24862"\n" 24863"const Gio = imports.gi.Gio;\n" 24864"const Gtk = imports.gi.Gtk;\n" 24865"const Lang = imports.lang;\n" 24866msgstr "" 24867 24868#. (itstool) path: section/code 24869#: C/messagedialog.js.page:44 24870#, no-wrap 24871msgid "" 24872"\n" 24873"const MessageDialogExample = new Lang.Class ({\n" 24874" Name: 'MessageDialog Example',\n" 24875"\n" 24876" // Create the application itself\n" 24877" _init: function () {\n" 24878" this.application = new Gtk.Application ({\n" 24879" application_id: 'org.example.jsmessagedialog',\n" 24880" flags: Gio.ApplicationFlags.FLAGS_NONE });\n" 24881"\n" 24882" // Connect 'activate' and 'startup' signals to the callback functions\n" 24883" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 24884" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 24885" },\n" 24886"\n" 24887" // Callback function for 'activate' signal presents windows when active\n" 24888" _onActivate: function () {\n" 24889" this._window.present ();\n" 24890" },\n" 24891"\n" 24892" // Callback function for 'startup' signal initializes menus and builds the UI\n" 24893" _onStartup: function () {\n" 24894" this._initMenus();\n" 24895" this._buildUI ();\n" 24896" },\n" 24897msgstr "" 24898 24899#. (itstool) path: note/p 24900#: C/messagedialog.js.page:71 C/switch.js.page:76 24901msgid "" 24902"Before we call _buildUI to create the window and the widgets inside it, we " 24903"need to call _initMenus, which tells GNOME to create the menu. We can put " 24904"the actual code for _initMenus after the code for _buildUI, since it doesn't " 24905"matter what order we put them in so long as _initMenus is called first in " 24906"_onStartup." 24907msgstr "" 24908 24909#. (itstool) path: section/code 24910#: C/messagedialog.js.page:72 24911#, no-wrap 24912msgid "" 24913"\n" 24914" // Build the application's UI\n" 24915" _buildUI: function () {\n" 24916"\n" 24917" // Create the application window\n" 24918" this._window = new Gtk.ApplicationWindow ({\n" 24919" application: this.application,\n" 24920" window_position: Gtk.WindowPosition.CENTER,\n" 24921" title: \"Gtk.MessageDialog Example\",\n" 24922" default_height: 200,\n" 24923" default_width: 400 });\n" 24924msgstr "" 24925 24926#. (itstool) path: section/code 24927#: C/messagedialog.js.page:86 24928#, no-wrap 24929msgid "" 24930"\n" 24931" // Create a silly warning message and add it to the window\n" 24932" this.warningLabel = new Gtk.Label ({\n" 24933" label: \"This application goes boom! (Not really.)\"});\n" 24934" this._window.add (this.warningLabel);\n" 24935msgstr "" 24936 24937#. (itstool) path: section/p 24938#: C/messagedialog.js.page:92 24939msgid "" 24940"For this example, all that we have in the window the popup comes out of is a " 24941"silly warning <link xref=\"label.js\">Label</link>." 24942msgstr "" 24943 24944#. (itstool) path: section/title 24945#: C/messagedialog.js.page:96 24946#, fuzzy 24947msgid "Creating the application's menu" 24948msgstr "Criando janela de aplicativo" 24949 24950#. (itstool) path: section/code 24951#: C/messagedialog.js.page:97 24952#, no-wrap 24953msgid "" 24954"\n" 24955" // Build the application menu, including the button that calls the dialog\n" 24956" _initMenus: function() {\n" 24957" let menu = new Gio.Menu();\n" 24958" menu.append(\"Message\",'app.message');\n" 24959" menu.append(\"Quit\",'app.quit');\n" 24960" this.application.set_app_menu(menu);\n" 24961"\n" 24962" // This pops up a MessageDialog when \"Message\" is clicked in the menu\n" 24963" let messageAction = new Gio.SimpleAction ({ name: 'message' });\n" 24964" messageAction.connect('activate', Lang.bind(this,\n" 24965" function() {\n" 24966" this._showMessageDialog();\n" 24967" }));\n" 24968" this.application.add_action(messageAction);\n" 24969"\n" 24970" // This closes the window when \"Quit\" is clicked in the menu\n" 24971" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 24972" quitAction.connect('activate', Lang.bind(this,\n" 24973" function() {\n" 24974" this._window.destroy();\n" 24975" }));\n" 24976" this.application.add_action(quitAction);\n" 24977" },\n" 24978msgstr "" 24979 24980#. (itstool) path: section/p 24981#: C/messagedialog.js.page:122 24982msgid "" 24983"Here, we build the <link xref=\"gmenu.js\">GMenu</link> where we'll be " 24984"putting the \"Message\" button which triggers the popup MessageDialog. The " 24985"GMenu is the menu that appears when you click the application's name in the " 24986"upper-left corner of the screen, next to the Activities menu. Our menu only " 24987"has two options in it: Message, and Quit." 24988msgstr "" 24989 24990#. (itstool) path: section/title 24991#: C/messagedialog.js.page:126 24992#, fuzzy 24993msgid "Creating the MessageDialog" 24994msgstr "sem tabelas, criando …" 24995 24996#. (itstool) path: section/code 24997#: C/messagedialog.js.page:127 24998#, no-wrap 24999msgid "" 25000"\n" 25001" _showMessageDialog: function () {\n" 25002"\n" 25003" // Create a modal MessageDialog whose parent is the window\n" 25004" this._messageDialog = new Gtk.MessageDialog ({\n" 25005" transient_for: this._window,\n" 25006" modal: true,\n" 25007" buttons: Gtk.ButtonsType.OK_CANCEL,\n" 25008" message_type: Gtk.MessageType.WARNING,\n" 25009" text: \"This action will cause the universe to stop existing.\" });\n" 25010"\n" 25011" this._messageDialog.connect ('response', Lang.bind(this, this._response_cb));\n" 25012" this._messageDialog.show();\n" 25013" },\n" 25014msgstr "" 25015 25016#. (itstool) path: section/p 25017#: C/messagedialog.js.page:142 25018msgid "" 25019"To make our MessageDialog a popup attached to the main window, we set its " 25020"modal property to true and set it to be \"transient_for\" _window. After " 25021"that, we can set what kind of buttons it has and what kind of message it is " 25022"(which determines what icon appears next to the message), and write out the " 25023"text inside it, before connecting its \"response\" signal to the callback " 25024"function which handles it." 25025msgstr "" 25026 25027#. (itstool) path: note/p 25028#: C/messagedialog.js.page:143 25029msgid "Here are some resources for making your own MessageDialogs:" 25030msgstr "" 25031 25032#. (itstool) path: item/p 25033#: C/messagedialog.js.page:145 25034msgid "" 25035"<link href=\"http://developer.gnome.org/gtk3/stable/GtkMessageDialog." 25036"html#GtkButtonsType\">List of button types</link>" 25037msgstr "" 25038 25039#. (itstool) path: item/p 25040#: C/messagedialog.js.page:146 25041msgid "" 25042"<link href=\"http://developer.gnome.org/gtk3/stable/GtkMessageDialog." 25043"html#GtkMessageType\">List of message types</link>" 25044msgstr "" 25045 25046#. (itstool) path: section/code 25047#: C/messagedialog.js.page:150 25048#, no-wrap 25049msgid "" 25050"\n" 25051" // Callback function (aka signal handler) for the response signal\n" 25052" _response_cb: function (messagedialog, response_id) {\n" 25053"\n" 25054" // A simple switch that changes the main window's label\n" 25055" switch (response_id) {\n" 25056" case Gtk.ResponseType.OK:\n" 25057" this.warningLabel.set_label (\"*BOOM*\\n\");\n" 25058" break;\n" 25059" case Gtk.ResponseType.CANCEL:\n" 25060" this.warningLabel.set_label (\"Good choice!\\n\");\n" 25061" break;\n" 25062" case Gtk.ResponseType.DELETE_EVENT:\n" 25063" this.warningLabel.set_label (\"Dialog closed or cancelled.\\n\");\n" 25064" break;\n" 25065" }\n" 25066"\n" 25067" this._messageDialog.destroy();\n" 25068"\n" 25069" }\n" 25070"\n" 25071"});\n" 25072msgstr "" 25073 25074#. (itstool) path: section/p 25075#: C/messagedialog.js.page:173 25076msgid "" 25077"This function takes two parameters, the MessageDialog and its response_id, " 25078"both of which are automatically supplied (you don't have to manually pass " 25079"them to it for it to work). Here we use a simple switch to change the " 25080"\"warning label\"'s text, depending on which option you select. The " 25081"DELETE_EVENT occurs if you press Escape to cancel the MessageDialog, instead " 25082"of clicking OK or Cancel. Whatever you select, the popup is destroyed " 25083"afterwards." 25084msgstr "" 25085 25086#. (itstool) path: section/code 25087#: C/messagedialog.js.page:175 25088#, fuzzy, no-wrap 25089msgid "" 25090"\n" 25091"// Run the application\n" 25092"let app = new MessageDialogExample ();\n" 25093"app.application.run (ARGV);\n" 25094msgstr "" 25095"\n" 25096"// Executa o aplicativo\n" 25097"let app = new GettingTheSignal ();\n" 25098"app.application.run (ARGV);\n" 25099 25100#. (itstool) path: section/p 25101#: C/messagedialog.js.page:180 25102msgid "" 25103"Finally, we create a new instance of the finished MessageDialogExample " 25104"class, and set the application running." 25105msgstr "" 25106 25107#. (itstool) path: section/code 25108#: C/messagedialog.js.page:185 25109#, no-wrap 25110msgid "" 25111"#!/usr/bin/gjs\n" 25112"\n" 25113"imports.gi.versions.Gtk = '3.0';\n" 25114"\n" 25115"const Gio = imports.gi.Gio;\n" 25116"const Gtk = imports.gi.Gtk;\n" 25117"\n" 25118"class MessageDialogExample {\n" 25119"\n" 25120" // Create the application itself\n" 25121" constructor() {\n" 25122" this.application = new Gtk.Application({\n" 25123" application_id: 'org.example.jsmessagedialog',\n" 25124" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 25125" });\n" 25126"\n" 25127" // Connect 'activate' and 'startup' signals to the callback functions\n" 25128" this.application.connect('activate', this._onActivate.bind(this));\n" 25129" this.application.connect('startup', this._onStartup.bind(this));\n" 25130" }\n" 25131"\n" 25132" // Callback function for 'activate' signal presents windows when active\n" 25133" _onActivate() {\n" 25134" this._window.present();\n" 25135" }\n" 25136"\n" 25137" // Callback function for 'startup' signal initializes menus and builds the UI\n" 25138" _onStartup() {\n" 25139" this._initMenus();\n" 25140" this._buildUI ();\n" 25141" }\n" 25142"\n" 25143" // Build the application's UI\n" 25144" _buildUI() {\n" 25145"\n" 25146" // Create the application window\n" 25147" this._window = new Gtk.ApplicationWindow({\n" 25148" application: this.application,\n" 25149" window_position: Gtk.WindowPosition.CENTER,\n" 25150" title: \"Gtk.MessageDialog Example\",\n" 25151" default_height: 200,\n" 25152" default_width: 400\n" 25153" });\n" 25154"\n" 25155" // Create a silly warning message and add it to the window\n" 25156" this.warningLabel = new Gtk.Label({\n" 25157" label: \"This application goes boom! (Not really.)\"\n" 25158" });\n" 25159" this._window.add (this.warningLabel);\n" 25160"\n" 25161" // Show the window and all child widgets\n" 25162" this._window.show_all();\n" 25163" }\n" 25164"\n" 25165" // Build the application menu, including the button that calls the dialog\n" 25166" _initMenus() {\n" 25167" let menu = new Gio.Menu();\n" 25168" menu.append(\"Message\",'app.message');\n" 25169" menu.append(\"Quit\",'app.quit');\n" 25170" this.application.set_app_menu(menu);\n" 25171"\n" 25172" // This pops up a MessageDialog when \"Message\" is clicked in the menu\n" 25173" let messageAction = new Gio.SimpleAction ({ name: 'message' });\n" 25174" messageAction.connect('activate', () => { this._showMessageDialog(); });\n" 25175" this.application.add_action(messageAction);\n" 25176"\n" 25177" // This closes the window when \"Quit\" is clicked in the menu\n" 25178" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 25179" quitAction.connect('activate', () => { this._window.destroy(); });\n" 25180" this.application.add_action(quitAction);\n" 25181" }\n" 25182"\n" 25183" _showMessageDialog() {\n" 25184"\n" 25185" // Create a modal MessageDialog whose parent is the window\n" 25186" this._messageDialog = new Gtk.MessageDialog ({\n" 25187" transient_for: this._window,\n" 25188" modal: true,\n" 25189" buttons: Gtk.ButtonsType.OK_CANCEL,\n" 25190" message_type: Gtk.MessageType.WARNING,\n" 25191" text: \"This action will cause the universe to stop existing.\" });\n" 25192"\n" 25193" this._messageDialog.connect ('response', this._response_cb.bind(this));\n" 25194" this._messageDialog.show();\n" 25195" }\n" 25196"\n" 25197" // Callback function (aka signal handler) for the response signal\n" 25198" _response_cb(messagedialog, response_id) {\n" 25199"\n" 25200" // A simple switch that changes the main window's label\n" 25201" switch (response_id) {\n" 25202" case Gtk.ResponseType.OK:\n" 25203" this.warningLabel.set_label (\"*BOOM*\\n\");\n" 25204" break;\n" 25205" case Gtk.ResponseType.CANCEL:\n" 25206" this.warningLabel.set_label (\"Good choice!\\n\");\n" 25207" break;\n" 25208" case Gtk.ResponseType.DELETE_EVENT:\n" 25209" this.warningLabel.set_label (\"Dialog closed or cancelled.\\n\");\n" 25210" break;\n" 25211" }\n" 25212"\n" 25213" this._messageDialog.destroy();\n" 25214"\n" 25215" }\n" 25216"};\n" 25217"\n" 25218"// Run the application\n" 25219"let app = new MessageDialogExample ();\n" 25220"app.application.run (ARGV);\n" 25221msgstr "" 25222 25223#. (itstool) path: info/title 25224#: C/messagedialog.py.page:8 25225msgctxt "text" 25226msgid "MessageDialog (Python)" 25227msgstr "MessageDialog (Python)" 25228 25229#. (itstool) path: page/p 25230#: C/messagedialog.py.page:24 25231msgid "" 25232"A message dialog which prints messages on the terminal, depending on your " 25233"choices." 25234msgstr "" 25235 25236#. (itstool) path: section/code 25237#: C/messagedialog.py.page:31 25238#, no-wrap 25239msgid "" 25240"from gi.repository import Gtk\n" 25241"from gi.repository import Gio\n" 25242"import sys\n" 25243"\n" 25244"\n" 25245"class MyWindow(Gtk.ApplicationWindow):\n" 25246"\n" 25247" # constructor for a window (the parent window) with a label\n" 25248" def __init__(self, app):\n" 25249" Gtk.Window.__init__(self, title=\"GMenu Example\", application=app)\n" 25250" self.set_default_size(400, 200)\n" 25251" label = Gtk.Label()\n" 25252" label.set_text(\"This application goes boom!\")\n" 25253" self.add(label)\n" 25254"\n" 25255" # create the message_action (a Gio.SimpleAction) - for the window\n" 25256" message_action = Gio.SimpleAction.new(\"message\", None)\n" 25257" # connect the signal from the action to the function message_cb()\n" 25258" message_action.connect(\"activate\", self.message_cb)\n" 25259" # add the action to the application\n" 25260" app.add_action(message_action)\n" 25261"\n" 25262" # callback function for the signal \"activate\" from the message_action\n" 25263" # in the menu of the parent window\n" 25264" def message_cb(self, action, parameter):\n" 25265" # a Gtk.MessageDialog\n" 25266" messagedialog = Gtk.MessageDialog(parent=self,\n" 25267" flags=Gtk.DialogFlags.MODAL,\n" 25268" type=Gtk.MessageType.WARNING,\n" 25269" buttons=Gtk.ButtonsType.OK_CANCEL,\n" 25270" message_format=\"This action will cause the universe to stop existing.\")\n" 25271" # connect the response (of the button clicked) to the function\n" 25272" # dialog_response()\n" 25273" messagedialog.connect(\"response\", self.dialog_response)\n" 25274" # show the messagedialog\n" 25275" messagedialog.show()\n" 25276"\n" 25277" def dialog_response(self, widget, response_id):\n" 25278" # if the button clicked gives response OK (-5)\n" 25279" if response_id == Gtk.ResponseType.OK:\n" 25280" print(\"*boom*\")\n" 25281" # if the button clicked gives response CANCEL (-6)\n" 25282" elif response_id == Gtk.ResponseType.CANCEL:\n" 25283" print(\"good choice\")\n" 25284" # if the messagedialog is destroyed (by pressing ESC)\n" 25285" elif response_id == Gtk.ResponseType.DELETE_EVENT:\n" 25286" print(\"dialog closed or cancelled\")\n" 25287" # finally, destroy the messagedialog\n" 25288" widget.destroy()\n" 25289"\n" 25290"\n" 25291"class MyApplication(Gtk.Application):\n" 25292"\n" 25293" def __init__(self):\n" 25294" Gtk.Application.__init__(self)\n" 25295"\n" 25296" def do_activate(self):\n" 25297" win = MyWindow(self)\n" 25298" win.show_all()\n" 25299"\n" 25300" def quit_cb(self, action, parameter):\n" 25301" self.quit()\n" 25302"\n" 25303" def do_startup(self):\n" 25304" Gtk.Application.do_startup(self)\n" 25305"\n" 25306" # create a menu (a Gio.Menu)\n" 25307" menu = Gio.Menu()\n" 25308" # append a menu item with label \"Message\" and action \"app.message\"\n" 25309" menu.append(\"Message\", \"app.message\")\n" 25310" # append a menu item with label \"Quit\" and action \"app.quit\"\n" 25311" menu.append(\"Quit\", \"app.quit\")\n" 25312" # set menu as the menu for the application\n" 25313" self.set_app_menu(menu)\n" 25314"\n" 25315" # a new simpleaction - for the application\n" 25316" quit_action = Gio.SimpleAction.new(\"quit\", None)\n" 25317" quit_action.connect(\"activate\", self.quit_cb)\n" 25318" self.add_action(quit_action)\n" 25319"\n" 25320"app = MyApplication()\n" 25321"exit_status = app.run(sys.argv)\n" 25322"sys.exit(exit_status)\n" 25323msgstr "" 25324 25325#. (itstool) path: section/title 25326#: C/messagedialog.py.page:36 25327#, fuzzy 25328msgid "Useful methods for a MessageDialog widget" 25329msgstr "Métodos úteis" 25330 25331#. (itstool) path: section/p 25332#: C/messagedialog.py.page:37 25333msgid "" 25334"In line 18 the signal <code>\"activate\"</code> is connected to the callback " 25335"function <code>message_cb()</code> using <code><var>widget</var>." 25336"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 25337"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 25338msgstr "" 25339 25340#. (itstool) path: item/p 25341#: C/messagedialog.py.page:39 25342msgid "" 25343"In the constructor of MessageDialog we could set flags as <code>Gtk." 25344"DialogFlags.DESTROY_WITH_PARENT</code> (to destroy the messagedialog window " 25345"when its parent window is destroyed) or as <code>Gtk.DialogFlags.MODAL</" 25346"code> (no interaction with other windows of the application)." 25347msgstr "" 25348 25349#. (itstool) path: item/p 25350#: C/messagedialog.py.page:40 25351msgid "" 25352"In the constructor of MessageDialog we could set type as any of <code>Gtk." 25353"MessageType.INFO, Gtk.MessageType.WARNING, Gtk.MessageType.QUESTION, Gtk." 25354"MessageType.ERROR, Gtk.MessageType.OTHER</code> depending on what type of " 25355"message we want." 25356msgstr "" 25357 25358#. (itstool) path: item/p 25359#: C/messagedialog.py.page:41 25360msgid "" 25361"In the constructor of MessageDialog we could set buttons as any of <code>Gtk." 25362"ButtonsType.NONE, Gtk.ButtonsType.OK, Gtk.ButtonsType.CLOSE, Gtk.ButtonsType." 25363"CANCEL, Gtk.ButtonsType.YES_NO, Gtk.ButtonsType.OK_CANCEL</code>, or any " 25364"button using <code>add_button()</code> as in Gtk.Dialog." 25365msgstr "" 25366 25367#. (itstool) path: item/p 25368#: C/messagedialog.py.page:42 25369msgid "" 25370"We could substitute the default image of the MessageDialog with another " 25371"image using" 25372msgstr "" 25373 25374#. (itstool) path: item/code 25375#: C/messagedialog.py.page:43 25376#, no-wrap 25377msgid "" 25378"\n" 25379"image = Gtk.Image()\n" 25380"image.set_from_stock(Gtk.STOCK_CAPS_LOCK_WARNING, Gtk.IconSize.DIALOG)\n" 25381"image.show()\n" 25382"messagedialog.set_image(image)" 25383msgstr "" 25384 25385#. (itstool) path: item/p 25386#: C/messagedialog.py.page:48 25387msgid "" 25388"where <code>Gtk.STOCK_CAPS_LOCK_WARNING</code> is any image from <link href=" 25389"\"http://developer.gnome.org/gtk3/unstable/gtk3-Stock-Items.html\">Stock " 25390"Items</link>. We could also set any image as in the Image widget, as " 25391"<code>image.set_from_file(\"filename.png\")</code>." 25392msgstr "" 25393 25394#. (itstool) path: item/p 25395#: C/messagedialog.py.page:49 25396msgid "" 25397"<code>format_secondary_text(\"some secondary message\")</code> sets a " 25398"secondary message. The primary text becomes bold." 25399msgstr "" 25400 25401#. (itstool) path: item/p 25402#: C/messagedialog.py.page:59 25403msgid "" 25404"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMessageDialog.html" 25405"\">GtkMessageDialog</link>" 25406msgstr "" 25407"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkMessageDialog.html" 25408"\">GtkMessageDialog</link>" 25409 25410#. (itstool) path: item/p 25411#: C/messagedialog.py.page:63 25412msgid "" 25413"<link href=\"http://developer.gnome.org/gio/unstable/GActionMap.html" 25414"\">GActionMap</link>" 25415msgstr "" 25416 25417#. (itstool) path: info/title 25418#: C/messagedialog.vala.page:8 25419msgctxt "text" 25420msgid "MessageDialog (Vala)" 25421msgstr "MessageDialog (Vala)" 25422 25423#. (itstool) path: page/code 25424#: C/messagedialog.vala.page:25 25425#, no-wrap 25426msgid "" 25427"\n" 25428"//A window in the application\n" 25429"public class Window : Gtk.ApplicationWindow {\n" 25430"\tpublic Window (Application app) {\n" 25431"\t\tObject (application: app, title: \"Gtk.MessageDialog Example\");\n" 25432"\n" 25433"\t\tvar label = new Gtk.Label (\"This application goes boom!\");\n" 25434"\t\tthis.add (label);\n" 25435"\n" 25436"\t\tvar message_action = new SimpleAction (\"message\", null);\n" 25437"\t\tmessage_action.activate.connect (message);\n" 25438"\t\tthis.add_action (message_action);\n" 25439"\n" 25440"\t\tthis.set_default_size (400, 200);\n" 25441"\t\tthis.show_all ();\n" 25442"\t}\n" 25443"\n" 25444"\tvoid dialog_response (Gtk.Dialog dialog, int response_id) {\n" 25445"\t\tswitch (response_id) {\n" 25446"\t\t\tcase Gtk.ResponseType.OK:\n" 25447"\t\t\t\tprint (\"*boom*\\n\");\n" 25448"\t\t\t\tbreak;\n" 25449"\t\t\tcase Gtk.ResponseType.CANCEL:\n" 25450"\t\t\t\tprint (\"good choice\\n\");\n" 25451"\t\t\t\tbreak;\n" 25452"\t\t\tcase Gtk.ResponseType.DELETE_EVENT:\n" 25453"\t\t\t\tprint (\"dialog closed or cancelled\\n\");\n" 25454"\t\t\t\tbreak;\n" 25455"\t\t}\n" 25456"\t\t\tdialog.destroy();\n" 25457"\t}\n" 25458"\n" 25459"\tvoid message (SimpleAction simple, Variant? parameter) {\n" 25460"\t\tvar messagedialog = new Gtk.MessageDialog (this,\n" 25461" Gtk.DialogFlags.MODAL,\n" 25462" Gtk.MessageType.WARNING,\n" 25463" Gtk.ButtonsType.OK_CANCEL,\n" 25464" \"This action will cause the universe to stop existing.\");\n" 25465"\n" 25466"\t\tmessagedialog.response.connect (dialog_response);\n" 25467"\t\tmessagedialog.show ();\n" 25468"\t}\n" 25469"}\n" 25470"\n" 25471"//This is the Application\n" 25472"public class Application : Gtk.Application {\n" 25473"\tprotected override void activate () {\n" 25474"\t\tnew Window (this);\n" 25475"\t}\n" 25476"\n" 25477"\tprotected override void startup () {\n" 25478"\t\tbase.startup ();\n" 25479"\n" 25480"\t\tvar menu = new Menu ();\n" 25481"\t\tmenu.append (\"Message\", \"win.message\");\n" 25482"\t\tmenu.append (\"Quit\", \"app.quit\");\n" 25483"\t\tthis.app_menu = menu;\n" 25484"\n" 25485"\t\tvar quit_action = new SimpleAction (\"quit\", null);\n" 25486"\t\t//quit_action.activate.connect (this.quit);\n" 25487"\t\tthis.add_action (quit_action);\n" 25488"\t}\n" 25489"\n" 25490"\tpublic Application () {\n" 25491"\t\tObject (application_id: \"org.example.application\");\n" 25492"\t}\n" 25493"}\n" 25494"\n" 25495"//main function creates Application and runs it\n" 25496"int main (string[] args) {\n" 25497"\treturn new Application ().run (args);\n" 25498"}\n" 25499msgstr "" 25500 25501#. (itstool) path: item/p 25502#: C/messagedialog.vala.page:31 25503msgid "" 25504"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ResponseType.html\">Gtk." 25505"ResponseType</link>" 25506msgstr "" 25507 25508#. (itstool) path: item/p 25509#: C/messagedialog.vala.page:32 25510msgid "" 25511"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.MessageDialog.html\">Gtk." 25512"MessageDialog</link>" 25513msgstr "" 25514 25515#. (itstool) path: item/p 25516#: C/messagedialog.vala.page:33 25517msgid "" 25518"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.DialogFlags.html\">Gtk." 25519"DialogFlags</link>" 25520msgstr "" 25521 25522#. (itstool) path: item/p 25523#: C/messagedialog.vala.page:34 25524msgid "" 25525"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.MessageType.html\">Gtk." 25526"MessageType</link>" 25527msgstr "" 25528 25529#. (itstool) path: item/p 25530#: C/messagedialog.vala.page:35 25531msgid "" 25532"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ButtonsType.html\">Gtk." 25533"ButtonsType</link>" 25534msgstr "" 25535 25536#. (itstool) path: info/title 25537#: C/model-view-controller.py.page:9 25538msgctxt "text" 25539msgid "The Model/View/Controller design (Python)" 25540msgstr "" 25541 25542#. (itstool) path: info/desc 25543#. (itstool) path: page/title 25544#: C/model-view-controller.py.page:14 C/model-view-controller.py.page:27 25545#, fuzzy 25546msgid "The Model/View/Controller design" 25547msgstr "O modelo para a visão em árvore" 25548 25549#. (itstool) path: section/title 25550#: C/model-view-controller.py.page:32 C/properties.py.page:32 25551#: C/signals-callbacks.py.page:32 25552#, fuzzy 25553msgid "Overview" 25554msgstr "Visão geral" 25555 25556#. (itstool) path: section/p 25557#: C/model-view-controller.py.page:34 25558msgid "" 25559"Both the <link xref=\"treeview_simple_liststore.py\">TreeView</link> and the " 25560"<link xref=\"combobox.py\">ComboBox</link> widgets are built on the " 25561"<em>Model/View/Controller</em> design. The <em>Model</em> (an implementation " 25562"of <code>Gtk.TreeModel</code>, usually <code>Gtk.TreeStore</code> or " 25563"<code>Gtk.ListStore</code>) stores the data; the <em>View</em> (e.g. " 25564"<code>Gtk.TreeView</code>, <code>Gtk.ComboBox</code>, or <code>Gtk." 25565"ComboBoxText</code>) gets change notifications and displays the content of " 25566"the model. The <em>Controller</em>, finally, changes the state of the model " 25567"(via some methods in the model's implementation - such as <code>append()</" 25568"code> or <code>remove()</code>) and notifies the view of these changes (via " 25569"signals like <code>\"changed\"</code>)." 25570msgstr "" 25571 25572#. (itstool) path: section/title 25573#: C/model-view-controller.py.page:39 25574#, fuzzy 25575msgid "The Model" 25576msgstr "Modelo" 25577 25578#. (itstool) path: section/p 25579#: C/model-view-controller.py.page:41 25580msgid "" 25581"The main difference between the two main implementations of <code>Gtk." 25582"TreeModel</code> is that <code>Gtk.ListStore</code> contains simple rows of " 25583"data without children, whereas <code>Gtk.TreeStore</code> also contains rows " 25584"of data, but each row may have child rows (which in turn can have child " 25585"rows, and so on)." 25586msgstr "" 25587 25588#. (itstool) path: section/p 25589#: C/model-view-controller.py.page:43 25590msgid "" 25591"The data in the Model can be retrieved or modified using the tree iter and " 25592"column index, or <code>Gtk.TreeIter</code>, or <code>Gtk.TreePath</code>." 25593msgstr "" 25594 25595#. (itstool) path: section/p 25596#: C/model-view-controller.py.page:45 25597msgid "" 25598"As with Python's built-in list object you can use <code>len()</code> to get " 25599"the number of rows and use slices to retrieve or set values. Otherwise, the " 25600"method <code>append()</code> returns a <code>Gtk.TreeIter</code> instance, " 25601"which points to the location of the newly inserted row. You can also " 25602"retrieve a <code>Gtk.TreeIter</code> by calling <code>get_iter()</code>." 25603msgstr "" 25604 25605#. (itstool) path: section/p 25606#: C/model-view-controller.py.page:47 25607msgid "" 25608"As <code>Gtk.ListStore</code> contains only one level, i.e. nodes do not " 25609"have any child nodes, a path is essentially the index of the row you want to " 25610"access. In the case of <code>Gtk.TreeStore</code>, a path is a list of " 25611"indexes or a string. The string form is a list of numbers separated by a " 25612"colon. Each number refers to the offset at that level. Thus, the path <code>" 25613"\"0\"</code> refers to the root node and the path <code>\"2:4\"</code> " 25614"refers to the fifth child of the third node." 25615msgstr "" 25616 25617#. (itstool) path: section/p 25618#: C/model-view-controller.py.page:49 25619msgid "Useful methods for a <code>Gtk.TreeModel</code>:" 25620msgstr "" 25621 25622#. (itstool) path: item/p 25623#: C/model-view-controller.py.page:51 25624msgid "" 25625"<code>get_iter(path)</code> returns a <code>Gtk.TreeIter</code> instance " 25626"pointing to <code>path</code>. This is expected to be a colon-separated list " 25627"of numbers, or a tuple. For example, the string <code>\"10:4:0\"</code> is " 25628"equivalent to the tuple <code>(10, 4, 0)</code>, as both would create a path " 25629"of depth 3 pointing to the 11th child of the root node, the 5th child of " 25630"that 11th child, and the 1st child of that 5th child." 25631msgstr "" 25632 25633#. (itstool) path: item/p 25634#: C/model-view-controller.py.page:52 25635msgid "" 25636"<code>iter_next(treeiter)</code> returns a <code>Gtk.TreeIter</code> " 25637"instance pointing the node following treeiter at the current level or " 25638"<code>None</code> if there is no next iter." 25639msgstr "" 25640 25641#. (itstool) path: item/p 25642#: C/model-view-controller.py.page:53 25643msgid "" 25644"<code>iter_has_child(treeiter)</code> returns <code>True</code> if " 25645"<code>treeiter</code> has children, <code>False</code> otherwise." 25646msgstr "" 25647 25648#. (itstool) path: item/p 25649#: C/model-view-controller.py.page:54 25650msgid "" 25651"<code>iter_children(treeiter)</code> returns a <code>Gtk.TreeIter</code> " 25652"instance pointing to the first child of <code>treeiter</code> or <code>None</" 25653"code> if <code>treeiter</code> has no children." 25654msgstr "" 25655 25656#. (itstool) path: item/p 25657#: C/model-view-controller.py.page:55 25658msgid "" 25659"<code>get_iter_first()</code> returns a <code>Gtk.TreeIter</code> instance " 25660"pointing to the first iterator in the tree (the one at the path <code>\"0\"</" 25661"code>) or <code>None</code> if the tree is empty." 25662msgstr "" 25663 25664#. (itstool) path: section/p 25665#: C/model-view-controller.py.page:58 25666msgid "Useful methods for a <code>Gtk.ListStore</code>:" 25667msgstr "" 25668 25669#. (itstool) path: item/p 25670#: C/model-view-controller.py.page:60 25671msgid "" 25672"<code>append(row)</code> appends a new row to this list store, where " 25673"<code>row</code> can be a list of values for each column; <code>row</code> " 25674"can also be omitted or <code>None</code>, and in that case an empty row will " 25675"be appended. The method returns a <code>Gtk.TreeIter</code> pointing to the " 25676"appended row." 25677msgstr "" 25678 25679#. (itstool) path: item/p 25680#: C/model-view-controller.py.page:61 C/model-view-controller.py.page:67 25681msgid "" 25682"<code>remove(iter)</code> removes <code>iter</code> from the <code>Gtk." 25683"ListStore</code>, and returns <code>True</code> if the iter is valid, and " 25684"<code>False</code> if the iter is not. After being removed, <code>iter</" 25685"code> is set to be the next valid row." 25686msgstr "" 25687 25688#. (itstool) path: section/p 25689#: C/model-view-controller.py.page:64 25690msgid "Useful methods for a <code>Gtk.TreeStore</code>:" 25691msgstr "" 25692 25693#. (itstool) path: item/p 25694#: C/model-view-controller.py.page:66 25695msgid "" 25696"<code>append(parent, row)</code> appends a new row to this tree store; " 25697"<code>parent</code> must be a valid Gtk.TreeIter. If parent is not " 25698"<code>None</code>, then it will append the new row after the last child of " 25699"parent, otherwise it will append a row to the top level; <code>row</code> " 25700"can be a list of values for each column, or it can be omitted or <code>None</" 25701"code>; in this latter case an empty row will be appended. The method returns " 25702"a <code>Gtk.TreeIter</code> pointing to the appended row." 25703msgstr "" 25704 25705#. (itstool) path: section/title 25706#: C/model-view-controller.py.page:73 25707#, fuzzy 25708msgid "The View: the TreeView case" 25709msgstr "TreeView – TreeStore" 25710 25711#. (itstool) path: section/p 25712#: C/model-view-controller.py.page:75 25713msgid "" 25714"A Treeview shows the structure of children and parent items as a tree. See " 25715"for instance <link xref=\"treeview_treestore.py\">this example</link>." 25716msgstr "" 25717 25718#. (itstool) path: section/p 25719#: C/model-view-controller.py.page:77 25720msgid "" 25721"The <code>Gtk.TreeViewColumn</code> is used to organize the vertical columns." 25722msgstr "" 25723 25724#. (itstool) path: section/p 25725#: C/model-view-controller.py.page:79 25726msgid "Useful methods for a <code>Gtk.TreeView</code>:" 25727msgstr "" 25728 25729#. (itstool) path: item/p 25730#: C/model-view-controller.py.page:81 25731msgid "" 25732"<code>set_model(model)</code> sets the model for this tree view. If this " 25733"tree view already has a model set, it will remove it before setting the new " 25734"model. If model is <code>None</code>, then it will unset the old model." 25735msgstr "" 25736 25737#. (itstool) path: item/p 25738#: C/model-view-controller.py.page:82 25739msgid "" 25740"<code>get_model()</code> returns the model this tree view is based on, " 25741"<code>None</code> if the model is unset." 25742msgstr "" 25743 25744#. (itstool) path: item/p 25745#: C/model-view-controller.py.page:83 25746msgid "" 25747"<code>append_column(column)</code> appends <code>column</code> to the list " 25748"of columns." 25749msgstr "" 25750 25751#. (itstool) path: item/p 25752#: C/model-view-controller.py.page:84 25753msgid "" 25754"<code>get_selection()</code> gets the <code>Gtk.TreeSelection</code> " 25755"associated with this tree view." 25756msgstr "" 25757 25758#. (itstool) path: section/p 25759#: C/model-view-controller.py.page:87 25760msgid "Useful methods for a <code>Gtk.TreeViewColumn</code>:" 25761msgstr "" 25762 25763#. (itstool) path: item/p 25764#: C/model-view-controller.py.page:89 25765msgid "" 25766"<code>add_attribute(renderer, attribute, value)</code> adds an attribute " 25767"mapping to this column. <code>attribute</code> is the parameter on " 25768"<code>renderer</code> to be set from the <code>value</code>" 25769msgstr "" 25770 25771#. (itstool) path: item/p 25772#: C/model-view-controller.py.page:90 25773msgid "" 25774"<code>pack_start(renderer, expand)</code> packs <code>renderer</code> into " 25775"the beginning of this column. If <code>expand</code> is <code>False</code>, " 25776"then <code>renderer</code> is allocated no more space than it needs. Any " 25777"unused space is divided evenly between cells for which expand is <code>True</" 25778"code>." 25779msgstr "" 25780 25781#. (itstool) path: item/p 25782#: C/model-view-controller.py.page:91 25783msgid "" 25784"<code>pack_end(renderer, expand)</code> adds <code>renderer</code> to end of " 25785"this column. If <code>expand</code> is <code>False</code>, then " 25786"<code>renderer</code> is allocated no more space than it needs. Any unused " 25787"space is divided evenly between cells for which <code>expand</code> is " 25788"<code>True</code>." 25789msgstr "" 25790 25791#. (itstool) path: item/p 25792#: C/model-view-controller.py.page:92 25793msgid "" 25794"<code>set_sort_column_id(sort_column_id)</code> sets the column of the model " 25795"by which this column (of the view) should be sorted. This also makes the " 25796"column header clickable." 25797msgstr "" 25798 25799#. (itstool) path: item/p 25800#: C/model-view-controller.py.page:93 25801msgid "" 25802"<code>set_sort_indicator(setting)</code> sets whether a little arrow is " 25803"displayed in the column header; <code>setting</code> can either be " 25804"<code>True</code> (indicator is shown) or <code>False</code>." 25805msgstr "" 25806 25807#. (itstool) path: item/p 25808#: C/model-view-controller.py.page:94 25809msgid "" 25810"<code>set_sort_order(order)</code> changes the order by which the column is " 25811"sorted; <code>order</code> can either be <code>Gtk.SortType.ASCENDING</code> " 25812"or <code>Gtk.SortType.DESCENDING</code>." 25813msgstr "" 25814 25815#. (itstool) path: section/title 25816#: C/model-view-controller.py.page:100 25817#, fuzzy 25818msgid "The View: the ComboBox case" 25819msgstr "Caixa de combinação" 25820 25821#. (itstool) path: section/p 25822#: C/model-view-controller.py.page:102 25823msgid "" 25824"A <code>Gtk.ComboBox</code> allows for the selection of an item from a " 25825"dropdown menu, see for instance <link xref=\"combobox.py\">this example</" 25826"link>. For a list of textual choices, one can also use the simpler <code>Gtk." 25827"ComboBoxText</code>. Both <code>Gtk.ComboBox</code> and <code>Gtk." 25828"ComboBoxText</code> can contain an entry." 25829msgstr "" 25830 25831#. (itstool) path: section/p 25832#: C/model-view-controller.py.page:104 25833msgid "Useful methods for a <code>Gtk.ComboBox</code>:" 25834msgstr "" 25835 25836#. (itstool) path: item/p 25837#: C/model-view-controller.py.page:106 25838msgid "" 25839"The static method <code>new_with_entry()</code> creates a new empty " 25840"<code>Gtk.ComboBox</code> with an entry; the static method " 25841"<code>new_with_model(model)</code> creates a new one with the model " 25842"initialized to <code>model</code>; and the static method " 25843"<code>new_with_model_and_entry(model)</code> is a combination of the two." 25844msgstr "" 25845 25846#. (itstool) path: item/p 25847#: C/model-view-controller.py.page:107 25848msgid "" 25849"<code>get_active_iter()</code> returns a <code>Gtk.TreeIter</code> pointing " 25850"to the current active item. If no active item exists, <code>None</code> is " 25851"returned." 25852msgstr "" 25853 25854#. (itstool) path: item/p 25855#: C/model-view-controller.py.page:108 25856msgid "" 25857"<code>set_model(model)</code> sets the model used by this combo box to be " 25858"<code>model</code>, and it will unset a previously set model (if there is " 25859"any). If <code>model</code> is <code>None</code>, then it will unset the " 25860"model. Note that this function does not clear the cell renderers." 25861msgstr "" 25862 25863#. (itstool) path: item/p 25864#: C/model-view-controller.py.page:109 25865msgid "" 25866"<code>set_entry_text_column(text_column)</code> sets the model column which " 25867"this combo box should use to get strings from to be <code>text_column</" 25868"code>. The column <code>text_column</code> in the model of this combo box " 25869"must be of type <code>str</code> (this is only relevant if this combo box " 25870"has been created with the “has-entry” property set to True)." 25871msgstr "" 25872 25873#. (itstool) path: item/p 25874#: C/model-view-controller.py.page:110 25875msgid "" 25876"<code>set_wrap_width(width)</code> sets the wrap width of this combo box to " 25877"be <code>width</code>. The wrap width is basically the preferred number of " 25878"columns when you want the popup to be laid out in a grid." 25879msgstr "" 25880 25881#. (itstool) path: section/p 25882#: C/model-view-controller.py.page:113 25883msgid "Useful methods for a <code>Gtk.ComboBoxText</code>:" 25884msgstr "" 25885 25886#. (itstool) path: item/p 25887#: C/model-view-controller.py.page:115 25888msgid "" 25889"The static method <code>new_with_entry()</code> creates a new empty " 25890"<code>Gtk.ComboBoxText</code> with an entry." 25891msgstr "" 25892 25893#. (itstool) path: item/p 25894#: C/model-view-controller.py.page:116 25895msgid "" 25896"<code>append_text(text)</code> appends <code>text</code> to the list of " 25897"strings stored in this combo box." 25898msgstr "" 25899 25900#. (itstool) path: item/p 25901#: C/model-view-controller.py.page:117 25902msgid "" 25903"<code>get_active_text()</code> returns the currently active string in this " 25904"combo box, or <code>None</code> if none is selected. If this combo box " 25905"contains an entry, this function will return its contents (which will not " 25906"necessarily be an item from the list)." 25907msgstr "" 25908 25909#. (itstool) path: section/title 25910#: C/model-view-controller.py.page:123 25911#, fuzzy 25912msgid "The View: the Cellrenderers" 25913msgstr "/_Ver com…" 25914 25915#. (itstool) path: section/p 25916#: C/model-view-controller.py.page:125 25917msgid "" 25918"The View makes use of <code>Gtk.CellRenderer</code>s of various types to " 25919"draw the data." 25920msgstr "" 25921 25922#. (itstool) path: section/p 25923#: C/model-view-controller.py.page:127 25924msgid "Implementations of <code>Gtk.CellRenderer</code> and useful methods:" 25925msgstr "" 25926 25927#. (itstool) path: item/p 25928#: C/model-view-controller.py.page:129 25929msgid "<code>Gtk.CellRendererText</code> - renders text in a cell" 25930msgstr "" 25931 25932#. (itstool) path: item/p 25933#: C/model-view-controller.py.page:130 25934msgid "" 25935"<code>Gtk.CellRendererToggle</code> - renders a toggle or radio button in a " 25936"cell. Useful methods:" 25937msgstr "" 25938 25939#. (itstool) path: item/p 25940#: C/model-view-controller.py.page:132 25941msgid "" 25942"<code>set_active(setting)</code> - activates or deactivates a cell renderer" 25943msgstr "" 25944 25945#. (itstool) path: item/p 25946#: C/model-view-controller.py.page:133 25947msgid "<code>get_active()</code> - returns whether the cell renderer is active" 25948msgstr "" 25949 25950#. (itstool) path: item/p 25951#: C/model-view-controller.py.page:134 25952msgid "" 25953"<code>set_radio(radio)</code> - if radio is <code>True</code>, the cell " 25954"renderer renders a radio toggle (i.e. a toggle in a group of mutually-" 25955"exclusive toggles); if <code>False</code>, it renders a check toggle (a " 25956"standalone boolean option)" 25957msgstr "" 25958 25959#. (itstool) path: item/p 25960#: C/model-view-controller.py.page:135 25961msgid "" 25962"<code>get_radio()</code> - returns whether we are rendering radio toggles " 25963"rather than checkboxes." 25964msgstr "" 25965 25966#. (itstool) path: item/p 25967#: C/model-view-controller.py.page:138 25968msgid "<code>Gtk.CellRendererPixbuf</code> - renders an image in a cell" 25969msgstr "" 25970 25971#. (itstool) path: item/p 25972#: C/model-view-controller.py.page:139 25973msgid "" 25974"<code>Gtk.CellRendererCombo</code> - renders text in a cell; but while " 25975"<code>Gtk.CellRendererText</code> offers a simple entry to edit the text, " 25976"<code>Gtk.CellRendererCombo</code> offers a <code>Gtk.ComboBox</code> widget " 25977"to edit the text. It can be used with and without an associated Gtk.Entry " 25978"widget, depending on the value of the “has-entry” property." 25979msgstr "" 25980 25981#. (itstool) path: item/p 25982#: C/model-view-controller.py.page:140 25983msgid "" 25984"<code>Gtk.CellRendererProgress</code> - renders a numeric value as a " 25985"progress bar in a cell; it can display a text on top of the progress bar" 25986msgstr "" 25987 25988#. (itstool) path: item/p 25989#: C/model-view-controller.py.page:141 25990msgid "" 25991"<code>Gtk.CellRendererSpinner</code> - renders a spinning animation in a cell" 25992msgstr "" 25993 25994#. (itstool) path: item/p 25995#: C/model-view-controller.py.page:142 25996msgid "<code>Gtk.CellRendererSpin</code> - renders a spin button in a cell" 25997msgstr "" 25998 25999#. (itstool) path: item/p 26000#: C/model-view-controller.py.page:143 26001msgid "" 26002"<code>Gtk.CellRendererAccel</code> - renders a keyboard accelerator in a cell" 26003msgstr "" 26004 26005#. (itstool) path: section/title 26006#: C/model-view-controller.py.page:149 26007#, fuzzy 26008msgid "The Controller: the Selection" 26009msgstr "Controlador para" 26010 26011#. (itstool) path: section/p 26012#: C/model-view-controller.py.page:151 26013msgid "" 26014"Most applications will need to not only deal with displaying data, but also " 26015"receiving input events from users. To do this, simply get a reference to a " 26016"selection object and connect to the <code>\"changed\"</code> signal." 26017msgstr "" 26018 26019#. (itstool) path: section/code 26020#: C/model-view-controller.py.page:153 26021#, no-wrap 26022msgid "" 26023"\n" 26024"select = tree.get_selection()\n" 26025"select.connect(\"changed\", on_tree_selection_changed)\n" 26026msgstr "" 26027 26028#. (itstool) path: section/p 26029#: C/model-view-controller.py.page:158 26030#, fuzzy 26031msgid "Then to retrieve data for the row selected:" 26032msgstr "Não foi capaz de obter os dados após as modificações" 26033 26034#. (itstool) path: section/code 26035#: C/model-view-controller.py.page:160 26036#, no-wrap 26037msgid "" 26038"\n" 26039"def on_tree_selection_changed(selection):\n" 26040" model, treeiter = selection.get_selected()\n" 26041" if treeiter != None:\n" 26042" print \"You selected\", model[treeiter][0]\n" 26043msgstr "" 26044 26045#. (itstool) path: section/p 26046#: C/model-view-controller.py.page:167 26047msgid "Useful methods for a <code>Gtk.TreeSelection</code>:" 26048msgstr "" 26049 26050#. (itstool) path: item/p 26051#: C/model-view-controller.py.page:170 26052msgid "" 26053"<code>set_mode(type)</code> sets the type of selection, where type is one of" 26054msgstr "" 26055 26056#. (itstool) path: item/p 26057#: C/model-view-controller.py.page:172 26058msgid "<code>Gtk.SelectionMode.NONE</code> - no selection is possible" 26059msgstr "" 26060 26061#. (itstool) path: item/p 26062#: C/model-view-controller.py.page:173 26063msgid "" 26064"<code>Gtk.SelectionMode.SINGLE</code> - zero or one element may be selected" 26065msgstr "" 26066 26067#. (itstool) path: item/p 26068#: C/model-view-controller.py.page:174 26069msgid "" 26070"<code>Gtk.SelectionMode.BROWSE</code> - exactly one element is selected. In " 26071"some circumstances, such as initially or during a search operation, it’s " 26072"possible for no element to be selected. What is really enforced is that the " 26073"user can’t deselect a currently selected element except by selecting another " 26074"element." 26075msgstr "" 26076 26077#. (itstool) path: item/p 26078#: C/model-view-controller.py.page:175 26079msgid "" 26080"<code>Gtk.SelectionMode.MULTIPLE</code> -any number of elements may be " 26081"selected. Clicks toggle the state of an item. The Ctrl key may be used to " 26082"enlarge the selection, and Shift key to select between the focus and the " 26083"child pointed to. Some widgets may also allow Click-drag to select a range " 26084"of elements." 26085msgstr "" 26086 26087#. (itstool) path: item/p 26088#: C/model-view-controller.py.page:178 26089msgid "" 26090"<code>get_selected()</code> returns a tuple <code>(model, treeiter)</code>, " 26091"where <code>model</code> is the current model and <code>treeiter</code> a " 26092"<code>Gtk.TreeIter</code> pointing to the currently selected row, or None if " 26093"no rows are selected. The method does not work if the selection mode is set " 26094"to <code>Gtk.SelectionMode.MULTIPLE</code>; in that case, use " 26095"<code>get_selected_rows()</code> instead, which Returns a list of <code>Gtk." 26096"TreePath</code> instances of all selected rows." 26097msgstr "" 26098 26099#. (itstool) path: section/title 26100#: C/model-view-controller.py.page:184 C/properties.py.page:57 26101#: C/signals-callbacks.py.page:46 C/strings.py.page:112 26102#, fuzzy 26103msgid "References" 26104msgstr "Referências" 26105 26106#. (itstool) path: item/p 26107#: C/model-view-controller.py.page:187 C/treeview_advanced_liststore.py.page:45 26108#: C/treeview_cellrenderertoggle.py.page:45 26109#: C/treeview_simple_liststore.py.page:46 C/treeview_treestore.py.page:45 26110msgid "" 26111"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTreeModel.html" 26112"\">GtkTreeModel</link>" 26113msgstr "" 26114 26115#. (itstool) path: item/p 26116#: C/model-view-controller.py.page:188 C/treeview_advanced_liststore.py.page:44 26117#: C/treeview_cellrenderertoggle.py.page:44 26118#: C/treeview_simple_liststore.py.page:45 C/treeview_treestore.py.page:44 26119msgid "" 26120"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTreeView.html" 26121"\">GtkTreeView</link>" 26122msgstr "" 26123"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTreeView.html" 26124"\">GtkTreeView</link>" 26125 26126#. (itstool) path: item/p 26127#: C/model-view-controller.py.page:189 C/treeview_advanced_liststore.py.page:48 26128#: C/treeview_cellrenderertoggle.py.page:49 26129#: C/treeview_simple_liststore.py.page:49 C/treeview_treestore.py.page:48 26130msgid "" 26131"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTreeViewColumn.html" 26132"\">GtkTreeViewColumn</link>" 26133msgstr "" 26134 26135#. (itstool) path: item/p 26136#: C/model-view-controller.py.page:191 26137msgid "" 26138"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCellRenderer.html" 26139"\">GtkCellRenderer</link>" 26140msgstr "" 26141 26142#. (itstool) path: info/title 26143#: C/paned.c.page:8 26144#, fuzzy 26145msgctxt "text" 26146msgid "Paned (C)" 26147msgstr "Um gerenciador de arquivos com dois painéis" 26148 26149#. (itstool) path: info/desc 26150#: C/paned.c.page:18 C/paned.js.page:18 C/paned.py.page:19 C/paned.vala.page:18 26151msgid "A widget with two adjustable panes" 26152msgstr "" 26153 26154#. (itstool) path: page/title 26155#: C/paned.c.page:21 C/paned.js.page:21 C/paned.py.page:22 C/paned.vala.page:21 26156#, fuzzy 26157msgid "Paned" 26158msgstr "Posição do grabber do Paned da lista de pastas." 26159 26160#. (itstool) path: page/media 26161#. This is a reference to an external file such as an image or video. When 26162#. the file changes, the md5 hash will change to let you know you need to 26163#. update your localized copy. The msgstr is not used at all. Set it to 26164#. whatever you like once you have updated your copy of the file. 26165#: C/paned.c.page:22 C/paned.js.page:22 C/paned.py.page:23 C/paned.vala.page:22 26166msgctxt "_" 26167msgid "external ref='media/paned.png' md5='8c7e1df065395c9aafcd65036a293d8a'" 26168msgstr "external ref='media/paned.png' md5='8c7e1df065395c9aafcd65036a293d8a'" 26169 26170#. (itstool) path: page/p 26171#: C/paned.c.page:23 C/paned.js.page:23 C/paned.py.page:24 C/paned.vala.page:23 26172msgid "Two images in two adjustable panes, horizontally aligned." 26173msgstr "" 26174 26175#. (itstool) path: section/code 26176#: C/paned.c.page:29 26177#, no-wrap 26178msgid "" 26179"#include <gtk/gtk.h>\n" 26180"\n" 26181"static void\n" 26182"activate (GtkApplication *app,\n" 26183" gpointer user_data)\n" 26184"{\n" 26185" GtkWidget *paned;\n" 26186" GtkWidget *window;\n" 26187" GtkWidget *image1;\n" 26188" GtkWidget *image2;\n" 26189"\n" 26190" window = gtk_application_window_new (app);\n" 26191" gtk_window_set_title (GTK_WINDOW (window), \"Paned Example\");\n" 26192" gtk_window_set_default_size (GTK_WINDOW (window), 450, 350);\n" 26193"\n" 26194" paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);\n" 26195" image1 = gtk_image_new_from_file (\"gnome-image.png\");\n" 26196" image2 = gtk_image_new_from_file (\"tux.png\");\n" 26197"\n" 26198" gtk_paned_add1 (GTK_PANED (paned), image1);\n" 26199" gtk_paned_add2 (GTK_PANED (paned), image2);\n" 26200"\n" 26201" gtk_container_add (GTK_CONTAINER (window), paned);\n" 26202"\n" 26203" gtk_widget_show_all (window);\n" 26204"}\n" 26205"\n" 26206"int\n" 26207"main (int argc, char **argv)\n" 26208"{\n" 26209" GtkApplication *app;\n" 26210" int status;\n" 26211"\n" 26212" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 26213" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 26214" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 26215" g_object_unref (app);\n" 26216" return status;\n" 26217"}\n" 26218msgstr "" 26219 26220#. (itstool) path: item/p 26221#: C/paned.c.page:36 C/paned.py.page:42 26222msgid "" 26223"<link href=\"http://developer.gnome.org/gtk3/stable/GtkPaned.html" 26224"\">GtkPaned</link>" 26225msgstr "" 26226"<link href=\"http://developer.gnome.org/gtk3/stable/GtkPaned.html" 26227"\">GtkPaned</link>" 26228 26229#. (itstool) path: item/p 26230#: C/paned.c.page:37 C/paned.js.page:37 C/paned.py.page:43 C/paned.vala.page:37 26231msgid "" 26232"<link href=\"http://developer.gnome.org/gtk3/stable/gtk3-Standard-" 26233"Enumerations.html#GtkOrientation\">Standard Enumerations</link>" 26234msgstr "" 26235 26236#. (itstool) path: info/title 26237#: C/paned.js.page:8 26238#, fuzzy 26239msgctxt "text" 26240msgid "Paned (JavaScript)" 26241msgstr "_JavaScript" 26242 26243#. (itstool) path: section/code 26244#: C/paned.js.page:29 26245#, fuzzy, no-wrap 26246#| msgid "" 26247#| "#!/usr/bin/gjs\n" 26248#| "\n" 26249#| "const GLib = imports.gi.GLib;\n" 26250#| "const Gtk = imports.gi.Gtk;\n" 26251#| "const Lang = imports.lang;\n" 26252#| "const Webkit = imports.gi.WebKit;\n" 26253#| "\n" 26254#| "const HelloGNOME = new Lang.Class ({\n" 26255#| " Name: 'Hello GNOME',\n" 26256#| "\n" 26257#| " // Create the application itself\n" 26258#| " _init: function () {\n" 26259#| " this.application = new Gtk.Application ();\n" 26260#| "\n" 26261#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 26262#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 26263#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 26264#| " },\n" 26265#| "\n" 26266#| " // Callback function for 'activate' signal presents windows when active\n" 26267#| " _onActivate: function () {\n" 26268#| " this._window.present ();\n" 26269#| " },\n" 26270#| "\n" 26271#| " // Callback function for 'startup' signal builds the UI\n" 26272#| " _onStartup: function () {\n" 26273#| " this._buildUI ();\n" 26274#| " },\n" 26275#| "\n" 26276#| " // Build the application's UI\n" 26277#| " _buildUI: function () {\n" 26278#| "\n" 26279#| " // Create the application window\n" 26280#| " this._window = new Gtk.ApplicationWindow ({\n" 26281#| " application: this.application,\n" 26282#| " title: \"Welcome to GNOME\",\n" 26283#| " default_height: 200,\n" 26284#| " default_width: 400,\n" 26285#| " window_position: Gtk.WindowPosition.CENTER });\n" 26286#| "\n" 26287#| " // Create a webview to show the web app\n" 26288#| " this._webView = new Webkit.WebView ();\n" 26289#| "\n" 26290#| " // Put the web app into the webview\n" 26291#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 26292#| " \"/hellognome.html\", null));\n" 26293#| "\n" 26294#| " // Put the webview into the window\n" 26295#| " this._window.add (this._webView);\n" 26296#| "\n" 26297#| " // Show the window and all child widgets\n" 26298#| " this._window.show_all();\n" 26299#| " },\n" 26300#| "\n" 26301#| "});\n" 26302#| "\n" 26303#| "// Run the application\n" 26304#| "let app = new HelloGNOME ();\n" 26305#| "app.application.run (ARGV);\n" 26306msgid "" 26307"#!/usr/bin/gjs\n" 26308"\n" 26309"imports.gi.versions.Gtk = '3.0';\n" 26310"const Gtk = imports.gi.Gtk;\n" 26311"\n" 26312"class PanedExample {\n" 26313"\n" 26314" // Create the application itself\n" 26315" constructor() {\n" 26316" this.application = new Gtk.Application({ application_id: 'org.example.panedexample' });\n" 26317"\n" 26318" // Connect 'activate' and 'startup' signals to the callback functions\n" 26319" this.application.connect('activate', this._onActivate.bind(this));\n" 26320" this.application.connect('startup', this._onStartup.bind(this));\n" 26321" }\n" 26322"\n" 26323" // Callback function for 'activate' signal presents windows when active\n" 26324" _onActivate() {\n" 26325" this.window.present();\n" 26326" }\n" 26327"\n" 26328" // Callback function for 'startup' signal builds the UI\n" 26329" _onStartup() {\n" 26330" this._buildUI();\n" 26331" }\n" 26332"\n" 26333" // Build the application's UI\n" 26334" _buildUI() {\n" 26335" // Create the application window\n" 26336" this.window = new Gtk.ApplicationWindow ({ application: this.application,\n" 26337" window_position: Gtk.WindowPosition.CENTER,\n" 26338" title: \"Paned Window Example\",\n" 26339" default_width: 450,\n" 26340" default_height: 350,\n" 26341" border_width: 10 });\n" 26342"\n" 26343" // a new widget with two adjustable panes,\n" 26344" // one on the left and one on the right\n" 26345" this.paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL);\n" 26346"\n" 26347" // two images\n" 26348" this.image1 = new Gtk.Image();\n" 26349" this.image1.set_from_file(\"gnome-image.png\");\n" 26350" this.image2 = new Gtk.Image();\n" 26351" this.image2.set_from_file(\"tux.png\");\n" 26352"\n" 26353" // add the first image to the left pane\n" 26354" this.paned.add1(this.image1);\n" 26355" // add the second image to the right pane\n" 26356" this.paned.add2(this.image2)\n" 26357"\n" 26358" // add the panes to the window\n" 26359" this.window.add(this.paned)\n" 26360" this.window.show_all();\n" 26361" }\n" 26362"};\n" 26363"\n" 26364"// Run the application\n" 26365"let app = new PanedExample();\n" 26366"app.application.run (ARGV);\n" 26367msgstr "" 26368"#!/usr/bin/gjs\n" 26369"\n" 26370"const GLib = imports.gi.GLib;\n" 26371"const Gtk = imports.gi.Gtk;\n" 26372"const Lang = imports.lang;\n" 26373"const Webkit = imports.gi.WebKit;\n" 26374"\n" 26375"const HelloGNOME = new Lang.Class ({\n" 26376" Name: 'Olá, GNOME',\n" 26377"\n" 26378" // Cria o aplicativo em si\n" 26379" _init: function () {\n" 26380" this.application = new Gtk.Application ();\n" 26381"\n" 26382" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 26383" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 26384" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 26385" },\n" 26386"\n" 26387" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 26388" _onActivate: function () {\n" 26389" this._window.present ();\n" 26390" },\n" 26391"\n" 26392" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 26393" _onStartup: function () {\n" 26394" this._buildUI ();\n" 26395" },\n" 26396"\n" 26397" // Constrói a interface gráfica do aplicativo\n" 26398" _buildUI: function () {\n" 26399"\n" 26400" // Cria a janela do aplicativo\n" 26401" this._window = new Gtk.ApplicationWindow ({\n" 26402" application: this.application,\n" 26403" title: \"Bem-vindo ao GNOME\",\n" 26404" default_height: 200,\n" 26405" default_width: 400,\n" 26406" window_position: Gtk.WindowPosition.CENTER });\n" 26407"\n" 26408" // Cria um webview para mostrar o aplicativo web\n" 26409" this._webView = new Webkit.WebView ();\n" 26410"\n" 26411" // Coloca o aplicativo web no webview\n" 26412" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 26413" \"/hellognome.html\", null));\n" 26414"\n" 26415" // Coloca o webview na janela\n" 26416" this._window.add (this._webView);\n" 26417"\n" 26418" // Mostra a janela e todos seus widgets filhos\n" 26419" this._window.show_all();\n" 26420" },\n" 26421"\n" 26422"});\n" 26423"\n" 26424"// Executa o aplicativo\n" 26425"let app = new HelloGNOME ();\n" 26426"app.application.run (ARGV);\n" 26427 26428#. (itstool) path: item/p 26429#: C/paned.js.page:36 26430msgid "" 26431"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Paned.html" 26432"\">GtkPaned</link>" 26433msgstr "" 26434 26435#. (itstool) path: item/p 26436#: C/paned.js.page:38 C/scrolledwindow.js.page:38 26437msgid "" 26438"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Image.html" 26439"\">GtkImage</link>" 26440msgstr "" 26441 26442#. (itstool) path: info/title 26443#: C/paned.py.page:8 26444#, fuzzy 26445msgctxt "text" 26446msgid "Paned (Python)" 26447msgstr "Um gerenciador de arquivos com dois painéis" 26448 26449#. (itstool) path: section/code 26450#: C/paned.py.page:30 26451#, no-wrap 26452msgid "" 26453"from gi.repository import Gtk\n" 26454"import sys\n" 26455"\n" 26456"\n" 26457"class MyWindow(Gtk.ApplicationWindow):\n" 26458"\n" 26459" def __init__(self, app):\n" 26460" Gtk.Window.__init__(self, title=\"Paned Example\", application=app)\n" 26461" self.set_default_size(450, 350)\n" 26462"\n" 26463" # a new widget with two adjustable panes,\n" 26464" # one on the left and one on the right\n" 26465" paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)\n" 26466"\n" 26467" # two images\n" 26468" image1 = Gtk.Image()\n" 26469" image1.set_from_file(\"gnome-image.png\")\n" 26470" image2 = Gtk.Image()\n" 26471" image2.set_from_file(\"tux.png\")\n" 26472"\n" 26473" # add the first image to the left pane\n" 26474" paned.add1(image1)\n" 26475" # add the second image to the right pane\n" 26476" paned.add2(image2)\n" 26477"\n" 26478" # add the panes to the window\n" 26479" self.add(paned)\n" 26480"\n" 26481"\n" 26482"class MyApplication(Gtk.Application):\n" 26483"\n" 26484" def __init__(self):\n" 26485" Gtk.Application.__init__(self)\n" 26486"\n" 26487" def do_activate(self):\n" 26488" win = MyWindow(self)\n" 26489" win.show_all()\n" 26490"\n" 26491" def do_startup(self):\n" 26492" Gtk.Application.do_startup(self)\n" 26493"\n" 26494"app = MyApplication()\n" 26495"exit_status = app.run(sys.argv)\n" 26496"sys.exit(exit_status)\n" 26497msgstr "" 26498 26499#. (itstool) path: section/title 26500#: C/paned.py.page:34 26501#, fuzzy 26502msgid "Useful methods for a Paned widget" 26503msgstr "Métodos úteis" 26504 26505#. (itstool) path: section/p 26506#: C/paned.py.page:35 26507msgid "" 26508"To have two vertically aligned panes, use <code>Gtk.Orientation.VERTICAL</" 26509"code> instead of <code>Gtk.Orientation.HORIZONTAL</code>. The method " 26510"<code>add1(widget1)</code> will add the <code>widget1</code> to the top " 26511"pane, and <code>add2(widget2)</code> will add the <code>widget2</code> to " 26512"the bottom pane." 26513msgstr "" 26514 26515#. (itstool) path: info/title 26516#: C/paned.vala.page:8 26517#, fuzzy 26518msgctxt "text" 26519msgid "Paned (Vala)" 26520msgstr "_Vala" 26521 26522#. (itstool) path: section/code 26523#: C/paned.vala.page:29 26524#, no-wrap 26525msgid "" 26526"/* This is the application. */\n" 26527"public class MyApplication : Gtk.Application {\n" 26528"\t/* Override the 'activate' signal of GLib.Application. */\n" 26529"\tprotected override void activate () {\n" 26530"\n" 26531"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 26532"\t\twindow.title = \"Paned Example\";\n" 26533"\t\twindow.set_default_size (450,350);\n" 26534"\n" 26535"\t\t// a new widget with two adjustable panes,\n" 26536"\t\t// one on the left and one on the right\n" 26537"\t\tvar paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);\n" 26538"\n" 26539"\t\t/* two images */\n" 26540"\t\tvar image1 = new Gtk.Image ();\n" 26541"\t\timage1.set_from_file (\"gnome-image.png\");\n" 26542"\t\tvar image2 = new Gtk.Image ();\n" 26543"\t\timage2.set_from_file (\"tux.png\");\n" 26544"\n" 26545"\t\t/* add the first image to the left pane */\n" 26546"\t\tpaned.add1 (image1);\n" 26547"\n" 26548"\t\t/* add the second image to the right pane */\n" 26549"\t\tpaned.add2 (image2);\n" 26550"\n" 26551"\t\t/* add the panes to the window */\n" 26552"\t\twindow.add (paned);\n" 26553"\t\twindow.show_all ();\n" 26554"\t}\n" 26555"}\n" 26556"\n" 26557"/* main creates and runs the application. */\n" 26558"public int main (string[] args) {\n" 26559"\treturn new MyApplication ().run (args);\n" 26560"}\n" 26561msgstr "" 26562 26563#. (itstool) path: item/p 26564#: C/paned.vala.page:36 26565msgid "" 26566"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Paned.html\">GtkPaned</link>" 26567msgstr "" 26568 26569#. (itstool) path: info/title 26570#: C/photo-wall.c.page:7 26571#, fuzzy 26572msgctxt "text" 26573msgid "Photo wall (C)" 26574msgstr "Wall" 26575 26576#. (itstool) path: info/desc 26577#: C/photo-wall.c.page:10 26578#, fuzzy 26579msgid "A Clutter image viewer" 26580msgstr "Clutter" 26581 26582#. (itstool) path: credit/name 26583#: C/photo-wall.c.page:14 26584#, fuzzy 26585msgid "Chris Kühl" 26586msgstr "Chris" 26587 26588#. (itstool) path: page/title 26589#: C/photo-wall.c.page:28 26590#, fuzzy 26591msgid "Photo wall" 26592msgstr "Wall" 26593 26594#. (itstool) path: synopsis/p 26595#: C/photo-wall.c.page:31 26596msgid "" 26597"For this example we will build a simple image viewer using Clutter. You will " 26598"learn:" 26599msgstr "" 26600 26601#. (itstool) path: item/p 26602#: C/photo-wall.c.page:33 26603msgid "How to size and position <code>ClutterActor</code>s" 26604msgstr "" 26605 26606#. (itstool) path: item/p 26607#: C/photo-wall.c.page:34 26608msgid "How to place an image in a <code>ClutterActor</code>" 26609msgstr "" 26610 26611#. (itstool) path: item/p 26612#: C/photo-wall.c.page:35 26613msgid "How to do simple transitions using Clutter's animation framework" 26614msgstr "" 26615 26616#. (itstool) path: item/p 26617#: C/photo-wall.c.page:36 26618msgid "How to make <code>ClutterActor</code>s respond to mouse events" 26619msgstr "" 26620 26621#. (itstool) path: item/p 26622#: C/photo-wall.c.page:37 26623#, fuzzy 26624msgid "How to get file names from a directory" 26625msgstr "obtém nomes para extrair ou criar a partir de ARQUIVO" 26626 26627#. (itstool) path: section/title 26628#: C/photo-wall.c.page:42 C/record-collection.js.page:40 26629#, fuzzy 26630msgid "Introduction" 26631msgstr "Introdução" 26632 26633#. (itstool) path: section/p 26634#: C/photo-wall.c.page:43 26635msgid "" 26636"Clutter is a library for creating dynamic user interfaces using OpenGL for " 26637"hardware acceleration. This example demonstrates a small, but central, part " 26638"of the Clutter library to create a simple but attractive image viewing " 26639"program." 26640msgstr "" 26641 26642#. (itstool) path: section/p 26643#: C/photo-wall.c.page:46 26644msgid "" 26645"To help us reach our goal we will be utilising a few other common pieces of " 26646"GLib as well. Most importantly, we'll use one <code>GPtrArray</code>, a " 26647"dynamic array of pointers, to hold the file path names. We will also use " 26648"<code>GDir</code>, a utility for working with directories, to access our " 26649"image directory and gather file paths." 26650msgstr "" 26651 26652#. (itstool) path: item/p 26653#: C/photo-wall.c.page:59 26654msgid "" 26655"Choose <gui>GTK+ (simple)</gui> from the <gui>C</gui> tab, click " 26656"<gui>Continue</gui>, and fill out your details on the next few pages. Use " 26657"<file>photo-wall</file> as project name and directory." 26658msgstr "" 26659 26660#. (itstool) path: item/p 26661#: C/photo-wall.c.page:62 26662msgid "" 26663"Make sure that <gui>Use GtkBuilder for user interface</gui> is disabled as " 26664"we will create the UI manually in this tutorial. Check the <link xref=" 26665"\"guitar-tuner.c\">Guitar-Tuner</link> tutorial using the interface builder." 26666msgstr "" 26667 26668#. (itstool) path: item/p 26669#: C/photo-wall.c.page:67 26670msgid "" 26671"Enable <gui>Configure external packages</gui>. On the next page, select " 26672"<em>clutter-1.0</em> from the list to include the Clutter library in your " 26673"project." 26674msgstr "" 26675 26676#. (itstool) path: section/title 26677#: C/photo-wall.c.page:80 26678#, fuzzy 26679msgid "A look at Photo Wall" 26680msgstr "Tenta procurar por foto do usuário" 26681 26682#. (itstool) path: section/p 26683#: C/photo-wall.c.page:81 26684msgid "Our image viewer presents the user with a wall of images." 26685msgstr "" 26686 26687#. (itstool) path: section/media 26688#. This is a reference to an external file such as an image or video. When 26689#. the file changes, the md5 hash will change to let you know you need to 26690#. update your localized copy. The msgstr is not used at all. Set it to 26691#. whatever you like once you have updated your copy of the file. 26692#: C/photo-wall.c.page:84 26693msgctxt "_" 26694msgid "" 26695"external ref='media/photo-wall.png' md5='f19590d97e8ec029cda3c44b769c11cd'" 26696msgstr "" 26697 26698#. (itstool) path: section/p 26699#: C/photo-wall.c.page:85 26700msgid "" 26701"When an image is clicked, it is animated to fill the viewing area. When the " 26702"image having focus is clicked it is returned to its original position using " 26703"an animation with the same duration of 500 milliseconds." 26704msgstr "" 26705 26706#. (itstool) path: section/media 26707#. This is a reference to an external file such as an image or video. When 26708#. the file changes, the md5 hash will change to let you know you need to 26709#. update your localized copy. The msgstr is not used at all. Set it to 26710#. whatever you like once you have updated your copy of the file. 26711#: C/photo-wall.c.page:87 26712msgctxt "_" 26713msgid "" 26714"external ref='media/photo-wall-focused.png' " 26715"md5='9f1ceecf3a28c1e468597b093a10cbae'" 26716msgstr "" 26717 26718#. (itstool) path: section/title 26719#: C/photo-wall.c.page:91 26720#, fuzzy 26721msgid "Initial setup" 26722msgstr "— definições iniciais do GNOME" 26723 26724#. (itstool) path: section/p 26725#: C/photo-wall.c.page:92 26726msgid "" 26727"The following code segment contains many of the defines and variables we " 26728"will be using in the following sections. Use this as a reference for later " 26729"sections. Copy this code to the beginning of <file>src/main.c</file>:" 26730msgstr "" 26731 26732#. (itstool) path: section/code 26733#: C/photo-wall.c.page:95 26734#, no-wrap 26735msgid "" 26736"\n" 26737"#include <gdk-pixbuf/gdk-pixbuf.h>\n" 26738"#include <clutter/clutter.h>\n" 26739"\n" 26740"#define STAGE_WIDTH 800\n" 26741"#define STAGE_HEIGHT 600\n" 26742"\n" 26743"#define THUMBNAIL_SIZE 200\n" 26744"#define ROW_COUNT (STAGE_HEIGHT / THUMBNAIL_SIZE)\n" 26745"#define COL_COUNT (STAGE_WIDTH / THUMBNAIL_SIZE)\n" 26746"#define THUMBNAIL_COUNT (ROW_COUNT * COL_COUNT)\n" 26747"\n" 26748"#define ANIMATION_DURATION_MS 500\n" 26749"\n" 26750"#define IMAGE_DIR_PATH \"./berlin_images/\"\n" 26751"\n" 26752"static GPtrArray *img_paths;\n" 26753"\n" 26754"static ClutterPoint unfocused_pos;\n" 26755"\n" 26756msgstr "" 26757 26758#. (itstool) path: section/title 26759#: C/photo-wall.c.page:119 26760#, fuzzy 26761msgid "Jumping into the code" 26762msgstr "saltando" 26763 26764#. (itstool) path: section/p 26765#: C/photo-wall.c.page:120 26766msgid "" 26767"We will start by taking a look at the <code>main()</code> function as a " 26768"whole. Then we'll discuss the other code sections in detail. Change the " 26769"<file>src/main.c</file> to contain this <code>main()</code> function. You " 26770"can delete the <code>create_window()</code> function as we don't need it in " 26771"this example." 26772msgstr "" 26773 26774#. (itstool) path: section/code 26775#: C/photo-wall.c.page:123 26776#, no-wrap 26777msgid "" 26778"\n" 26779"int\n" 26780"main(int argc, char *argv[])\n" 26781"{\n" 26782" ClutterColor stage_color = { 16, 16, 16, 255 };\n" 26783" ClutterActor *stage = NULL;\n" 26784"\n" 26785" if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)\n" 26786" return 1;\n" 26787"\n" 26788" stage = clutter_stage_new();\n" 26789" clutter_actor_set_size(stage, STAGE_WIDTH, STAGE_HEIGHT);\n" 26790" clutter_actor_set_background_color(stage, &stage_color);\n" 26791" clutter_stage_set_title(CLUTTER_STAGE (stage), \"Photo Wall\");\n" 26792" g_signal_connect(stage, \"destroy\", G_CALLBACK(clutter_main_quit), NULL);\n" 26793"\n" 26794" load_image_path_names();\n" 26795"\n" 26796" guint row = 0;\n" 26797" guint col = 0;\n" 26798" for(row=0; row < ROW_COUNT; ++row)\n" 26799" {\n" 26800" for(col=0; col < COL_COUNT; ++col)\n" 26801" {\n" 26802" const char *img_path = g_ptr_array_index(img_paths, (row * COL_COUNT) + col);\n" 26803" GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(img_path, STAGE_HEIGHT, STAGE_HEIGHT, NULL);\n" 26804" ClutterContent *image = clutter_image_new ();\n" 26805" ClutterActor *actor = clutter_actor_new ();\n" 26806"\n" 26807" if (pixbuf != NULL)\n" 26808" {\n" 26809" clutter_image_set_data(CLUTTER_IMAGE(image),\n" 26810" gdk_pixbuf_get_pixels(pixbuf),\n" 26811" gdk_pixbuf_get_has_alpha(pixbuf)\n" 26812" ? COGL_PIXEL_FORMAT_RGBA_8888\n" 26813" : COGL_PIXEL_FORMAT_RGB_888,\n" 26814" gdk_pixbuf_get_width(pixbuf),\n" 26815" gdk_pixbuf_get_height(pixbuf),\n" 26816" gdk_pixbuf_get_rowstride(pixbuf),\n" 26817" NULL);\n" 26818" }\n" 26819"\n" 26820" clutter_actor_set_content(actor, image);\n" 26821" g_object_unref(image);\n" 26822" g_object_unref(pixbuf);\n" 26823"\n" 26824" initialize_actor(actor, row, col);\n" 26825" clutter_actor_add_child(stage, actor);\n" 26826" }\n" 26827" }\n" 26828"\n" 26829" /* Show the stage. */\n" 26830" clutter_actor_show(stage);\n" 26831"\n" 26832" /* Start the clutter main loop. */\n" 26833" clutter_main();\n" 26834"\n" 26835" g_ptr_array_unref(img_paths);\n" 26836"\n" 26837" return 0;\n" 26838"}" 26839msgstr "" 26840 26841#. (itstool) path: item/p 26842#: C/photo-wall.c.page:185 26843msgid "" 26844"Line 4: <code>ClutterColor</code> is defined by setting the red, green, blue " 26845"and transparency (alpha) values. The values range from 0-255. For " 26846"transparency a value of 255 is opaque." 26847msgstr "" 26848 26849#. (itstool) path: item/p 26850#: C/photo-wall.c.page:186 26851msgid "" 26852"Line 7: You must initialize Clutter. If you forget to do this, you will get " 26853"very strange errors. Be warned." 26854msgstr "" 26855 26856#. (itstool) path: item/p 26857#: C/photo-wall.c.page:187 26858msgid "" 26859"Lines 10‒14: Here we create a new <code>ClutterStage</code> . We then set " 26860"the size using the defines from the previous section and the address of the " 26861"<code>ClutterColor</code> we just defined." 26862msgstr "" 26863 26864#. (itstool) path: note/p 26865#: C/photo-wall.c.page:188 26866msgid "" 26867"A <code>ClutterStage</code> is the top-level <code>ClutterActor</code> onto " 26868"which other <code>ClutterActor</code>s are placed." 26869msgstr "" 26870 26871#. (itstool) path: item/p 26872#: C/photo-wall.c.page:190 26873msgid "" 26874"Line 16: Here we call our function for getting the image file paths. We'll " 26875"look at this in a bit." 26876msgstr "" 26877 26878#. (itstool) path: item/p 26879#: C/photo-wall.c.page:191 26880msgid "" 26881"Lines 18‒49: This is where we set up the <code>ClutterActor</code>s, load " 26882"the images and place them into their spot in the image wall. We will look at " 26883"this in detail in the next section." 26884msgstr "" 26885 26886#. (itstool) path: item/p 26887#: C/photo-wall.c.page:192 26888msgid "" 26889"Line 52: Show the stage and <em>all its children</em>, meaning our images." 26890msgstr "" 26891 26892#. (itstool) path: item/p 26893#: C/photo-wall.c.page:193 26894msgid "Line 55: Start the Clutter main loop." 26895msgstr "" 26896 26897#. (itstool) path: section/title 26898#: C/photo-wall.c.page:198 26899#, fuzzy 26900msgid "Setting up our image actors" 26901msgstr "Configurando seu aplicativo" 26902 26903#. (itstool) path: note/p 26904#: C/photo-wall.c.page:199 26905msgid "" 26906"In Clutter, an actor is the most basic visual element. Basically, everything " 26907"you see is an actor." 26908msgstr "" 26909 26910#. (itstool) path: section/p 26911#: C/photo-wall.c.page:200 26912msgid "" 26913"In this section, we are going to take a closer look at the loop used for " 26914"setting up the <code>ClutterActor</code>s that will display our images." 26915msgstr "" 26916 26917#. (itstool) path: section/code 26918#: C/photo-wall.c.page:203 26919#, no-wrap 26920msgid "" 26921"\n" 26922"guint row = 0;\n" 26923"guint col = 0;\n" 26924"for(row=0; row < ROW_COUNT; ++row)\n" 26925"{\n" 26926" for(col=0; col < COL_COUNT; ++col)\n" 26927" {\n" 26928" const char *img_path = g_ptr_array_index(img_paths, (row * COL_COUNT) + col);\n" 26929" GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(img_path, STAGE_HEIGHT, STAGE_HEIGHT, NULL);\n" 26930" ClutterContent *image = clutter_image_new ();\n" 26931" ClutterActor *actor = clutter_actor_new ();\n" 26932"\n" 26933" if (pixbuf != NULL)\n" 26934" {\n" 26935" clutter_image_set_data(CLUTTER_IMAGE(image),\n" 26936" gdk_pixbuf_get_pixels(pixbuf),\n" 26937" gdk_pixbuf_get_has_alpha(pixbuf)\n" 26938" ? COGL_PIXEL_FORMAT_RGBA_8888\n" 26939" : COGL_PIXEL_FORMAT_RGB_888,\n" 26940" gdk_pixbuf_get_width(pixbuf),\n" 26941" gdk_pixbuf_get_height(pixbuf),\n" 26942" gdk_pixbuf_get_rowstride(pixbuf),\n" 26943" NULL);\n" 26944" }\n" 26945"\n" 26946" clutter_actor_set_content(actor, image);\n" 26947" g_object_unref(image);\n" 26948" g_object_unref(pixbuf);\n" 26949"\n" 26950" initialize_actor(actor, row, col);\n" 26951" clutter_actor_add_child(stage, actor);\n" 26952" }\n" 26953"}\n" 26954"\n" 26955msgstr "" 26956 26957#. (itstool) path: item/p 26958#: C/photo-wall.c.page:239 26959msgid "" 26960"Line 7: Here we want to get the path at the <var>n</var>th location in the " 26961"<code>GPtrArray</code> that is holding our image path names. The <var>n</" 26962"var>th position is calculated based on <code>row</code> and <code>col</code>." 26963msgstr "" 26964 26965#. (itstool) path: item/p 26966#: C/photo-wall.c.page:241 26967msgid "" 26968"Line 8‒23: This is where we actually create the <code>ClutterActor</code> " 26969"and place the image into the actor. The first argument is the path which we " 26970"access through our <code>GSList</code> node. The second argument is for " 26971"error reporting but we are ignoring that to keep things short." 26972msgstr "" 26973 26974#. (itstool) path: item/p 26975#: C/photo-wall.c.page:243 26976msgid "" 26977"Line 47: This adds the <code>ClutterActor</code> to the stage, which is a " 26978"container. It also assumes ownership of the <code>ClutterActor</code> which " 26979"is something you'll want to look into as you get deeper into GNOME " 26980"development. See the <link href=\"http://library.gnome.org/devel/gobject/" 26981"stable/gobject-memory.html\"><code>GObject</code> documentation</link> for " 26982"the gory details." 26983msgstr "" 26984 26985#. (itstool) path: section/title 26986#: C/photo-wall.c.page:249 26987#, fuzzy 26988msgid "Loading the images" 26989msgstr "Adicionado plug-in para abrir imagens JPEG2000" 26990 26991#. (itstool) path: section/p 26992#: C/photo-wall.c.page:250 26993msgid "" 26994"Let's take a short break from Clutter to see how we can get the file names " 26995"from our image directory." 26996msgstr "" 26997 26998#. (itstool) path: section/code 26999#: C/photo-wall.c.page:251 27000#, no-wrap 27001msgid "" 27002"\n" 27003"static void\n" 27004"load_image_path_names()\n" 27005"{\n" 27006" /* Ensure we can access the directory. */\n" 27007" GError *error = NULL;\n" 27008" GDir *dir = g_dir_open(IMAGE_DIR_PATH, 0, &error);\n" 27009" if(error)\n" 27010" {\n" 27011" g_warning(\"g_dir_open() failed with error: %s\\n\", error->message);\n" 27012" g_clear_error(&error);\n" 27013" return;\n" 27014" }\n" 27015"\n" 27016" img_paths = g_ptr_array_new_with_free_func (g_free);\n" 27017"\n" 27018" const gchar *filename = g_dir_read_name(dir);\n" 27019" while(filename)\n" 27020" {\n" 27021" if(g_str_has_suffix(filename, \".jpg\") || g_str_has_suffix(filename, \".png\"))\n" 27022" {\n" 27023" gchar *path = g_build_filename(IMAGE_DIR_PATH, filename, NULL);\n" 27024" g_ptr_array_add (img_paths, path);\n" 27025" }\n" 27026" filename = g_dir_read_name(dir);\n" 27027" }\n" 27028"}" 27029msgstr "" 27030 27031#. (itstool) path: item/p 27032#: C/photo-wall.c.page:279 27033msgid "" 27034"Lines 5 and 12: This opens our directory or, if an error occurred, returns " 27035"after printing an error message." 27036msgstr "" 27037 27038#. (itstool) path: item/p 27039#: C/photo-wall.c.page:280 27040msgid "" 27041"Lines 16‒25: The first line gets another file name from the <code>GDir</" 27042"code> we opened earlier. If there was an image file (which we check by " 27043"looking at its extension, \".png\" or \".jpg\") in the directory we proceed " 27044"to prepend the image directory path to the filename and prepend that to the " 27045"list we set up earlier. Lastly we attempt to get the next path name and " 27046"reenter the loop if another file was found." 27047msgstr "" 27048 27049#. (itstool) path: section/title 27050#: C/photo-wall.c.page:285 27051#, fuzzy 27052msgid "Set up the actors" 27053msgstr "Clique para configurar" 27054 27055#. (itstool) path: section/p 27056#: C/photo-wall.c.page:286 27057msgid "" 27058"We now take a look at the sizing and positioning of <code>ClutterActor</" 27059"code>s and also readying the <code>ClutterActor</code> for user interaction." 27060msgstr "" 27061 27062#. (itstool) path: section/code 27063#: C/photo-wall.c.page:289 27064#, no-wrap 27065msgid "" 27066"\n" 27067"/* This function handles setting up and placing the rectangles. */\n" 27068"static void\n" 27069"initialize_actor(ClutterActor *actor, guint row, guint col)\n" 27070"{\n" 27071" clutter_actor_set_size(actor, THUMBNAIL_SIZE, THUMBNAIL_SIZE);\n" 27072" clutter_actor_set_position(actor, col * THUMBNAIL_SIZE, row * THUMBNAIL_SIZE);\n" 27073" clutter_actor_set_reactive(actor, TRUE);\n" 27074"\n" 27075" g_signal_connect(actor,\n" 27076" \"button-press-event\",\n" 27077" G_CALLBACK(actor_clicked_cb),\n" 27078" NULL);\n" 27079"}" 27080msgstr "" 27081 27082#. (itstool) path: item/p 27083#: C/photo-wall.c.page:305 27084msgid "" 27085"Line 7: Setting an actor reactive means that it reacts to events, such as " 27086"<code>button-press-event</code> in our case. For Photo Wall, all " 27087"<code>ClutterActor</code>s in the wall should initially be reactive." 27088msgstr "" 27089 27090#. (itstool) path: item/p 27091#: C/photo-wall.c.page:308 27092msgid "" 27093"Line 9‒12: Now we connect the <code>button-press-event</code> to the " 27094"<code>actor_clicked_cb</code> callback which we will look at next." 27095msgstr "" 27096 27097#. (itstool) path: section/p 27098#: C/photo-wall.c.page:311 27099msgid "At this point we've got a wall of images that are ready to be viewed." 27100msgstr "" 27101 27102#. (itstool) path: section/title 27103#: C/photo-wall.c.page:315 27104#, fuzzy 27105msgid "Reacting to the clicks" 27106msgstr "Clica no item de menu" 27107 27108#. (itstool) path: section/code 27109#: C/photo-wall.c.page:319 27110#, no-wrap 27111msgid "" 27112"\n" 27113"static gboolean\n" 27114"actor_clicked_cb(ClutterActor *actor,\n" 27115" ClutterEvent *event,\n" 27116" gpointer user_data)\n" 27117"{\n" 27118" /* Flag to keep track of our state. */\n" 27119" static gboolean is_focused = FALSE;\n" 27120" ClutterActorIter iter;\n" 27121" ClutterActor *child;\n" 27122"\n" 27123" /* Reset the focus state on all the images */\n" 27124" clutter_actor_iter_init (&iter, clutter_actor_get_parent(actor));\n" 27125" while (clutter_actor_iter_next(&iter, &child))\n" 27126" clutter_actor_set_reactive(child, is_focused);\n" 27127"\n" 27128" clutter_actor_save_easing_state(actor);\n" 27129" clutter_actor_set_easing_duration(actor, ANIMATION_DURATION_MS);\n" 27130"\n" 27131" if(is_focused)\n" 27132" {\n" 27133" /* Restore the old location and size. */\n" 27134" clutter_actor_set_position(actor, unfocused_pos.x, unfocused_pos.y);\n" 27135" clutter_actor_set_size(actor, THUMBNAIL_SIZE, THUMBNAIL_SIZE);\n" 27136" }\n" 27137" else\n" 27138" {\n" 27139" /* Save the current location before animating. */\n" 27140" clutter_actor_get_position(actor, &unfocused_pos.x, &unfocused_pos.y);\n" 27141" /* Only the currently focused image should receive events. */\n" 27142" clutter_actor_set_reactive(actor, TRUE);\n" 27143"\n" 27144" /* Put the focused image on top. */\n" 27145" clutter_actor_set_child_above_sibling(clutter_actor_get_parent(actor), actor, NULL);\n" 27146"\n" 27147" clutter_actor_set_position(actor, (STAGE_WIDTH - STAGE_HEIGHT) / 2.0, 0);\n" 27148" clutter_actor_set_size(actor, STAGE_HEIGHT, STAGE_HEIGHT);\n" 27149" }\n" 27150"\n" 27151" clutter_actor_restore_easing_state(actor);\n" 27152"\n" 27153" /* Toggle our flag. */\n" 27154" is_focused = !is_focused;\n" 27155"\n" 27156" return TRUE;\n" 27157"}" 27158msgstr "" 27159 27160#. (itstool) path: item/p 27161#: C/photo-wall.c.page:366 27162msgid "" 27163"Lines 1‒4: We have to make sure our callback function matches the signature " 27164"required for the <code>button_clicked_event</code> signal. For our example, " 27165"we will only use the first argument, the <code>ClutterActor</code> that is " 27166"actually clicked." 27167msgstr "" 27168 27169#. (itstool) path: note/p 27170#: C/photo-wall.c.page:368 27171msgid "" 27172"A few words on the arguments we are not using in this example. The " 27173"<code>ClutterEvent</code> is different depending on what event is being " 27174"handled. For example, a key event produces a <code>ClutterKeyEvent</code> " 27175"from which you can get the key being pressed among other information. For " 27176"mouse click events you get a <code>ClutterButtonEvent</code> from which you " 27177"can get the <code>x</code> and <code>y</code> values. See the Clutter " 27178"documentation for other <code>ClutterEvent</code> types." 27179msgstr "" 27180 27181#. (itstool) path: note/p 27182#: C/photo-wall.c.page:369 27183msgid "" 27184"The <code>user_data</code> is what one uses to pass data into the function. " 27185"A pointer to any data type can be passed in. If you need multiple data to be " 27186"passed into the callback, you can place the data into a struct and pass its " 27187"address in." 27188msgstr "" 27189 27190#. (itstool) path: item/p 27191#: C/photo-wall.c.page:373 27192msgid "" 27193"Line 7: We set up a static flag to track which state we are in: wall mode or " 27194"focus mode. We start out in wall mode so no image has focus. Thus, we set " 27195"the flag to <code>FALSE</code> initially." 27196msgstr "" 27197 27198#. (itstool) path: item/p 27199#: C/photo-wall.c.page:374 27200msgid "" 27201"Line 12‒14: These set the image actors to receive events if they are focused." 27202msgstr "" 27203 27204#. (itstool) path: item/p 27205#: C/photo-wall.c.page:375 27206msgid "" 27207"Line 16‒17: Here we set the animation duration and save the current state." 27208msgstr "" 27209 27210#. (itstool) path: item/p 27211#: C/photo-wall.c.page:376 27212msgid "" 27213"Lines 21‒23: Reaching this code means that one image currently has focus and " 27214"we want to return to wall mode. Setting a position on a <code>ClutterActor</" 27215"code> begins an animation with the duration that we set in line 17." 27216msgstr "" 27217 27218#. (itstool) path: item/p 27219#: C/photo-wall.c.page:378 27220msgid "" 27221"Line 24: Reaching this line of code means we are currently in the wall state " 27222"and are about to give a <code>ClutterActor</code> focus. Here we save the " 27223"starting position so that we can return to it later." 27224msgstr "" 27225 27226#. (itstool) path: item/p 27227#: C/photo-wall.c.page:379 27228msgid "" 27229"Line 25: Setting the <code>ClutterActor</code>'s <code>reactive</code> " 27230"property to <code>TRUE</code> makes this <code>ClutterActor</code> react to " 27231"events. In this focused state the only <code>ClutterActor</code> that we " 27232"want to receive events will be the <code>ClutterActor</code> being viewed. " 27233"Clicking on the <code>ClutterActor</code> will return it to its starting " 27234"position." 27235msgstr "" 27236 27237#. (itstool) path: item/p 27238#: C/photo-wall.c.page:380 27239msgid "" 27240"Lines 27‒36: This is where we save the current position of the image, set it " 27241"to receive events and then make it appear above the other images and start " 27242"animating it to fill the stage." 27243msgstr "" 27244 27245#. (itstool) path: item/p 27246#: C/photo-wall.c.page:381 27247msgid "" 27248"Line 39: Here we restore the easing state to what was set before we changed " 27249"it in line 16." 27250msgstr "" 27251 27252#. (itstool) path: item/p 27253#: C/photo-wall.c.page:382 27254msgid "" 27255"Line 42: Here we toggle the <code>is_focused</code> flag to the current " 27256"state." 27257msgstr "" 27258 27259#. (itstool) path: item/p 27260#: C/photo-wall.c.page:383 27261msgid "" 27262"As mentioned previously, the <code>ClutterActor</code>s with higher " 27263"<code>depth</code> values receive events but can allow <code>ClutterActor</" 27264"code>s below them to also receive events. Returning <code>TRUE</code> will " 27265"stop events from being passed down, while <code>FALSE</code> will pass " 27266"events down." 27267msgstr "" 27268 27269#. (itstool) path: note/p 27270#: C/photo-wall.c.page:385 27271msgid "" 27272"Remember, however, that to receive events the <code>ClutterActor</code>s " 27273"must be set <code>reactive</code>." 27274msgstr "" 27275 27276#. (itstool) path: section/p 27277#: C/photo-wall.c.page:393 27278msgid "" 27279"All of the code should now be ready to go. All you need now is some pictures " 27280"to load. By default, the pictures are loaded from a <file>berlin_images</" 27281"file> directory. If you want, you can change the <code>#define " 27282"IMAGE_DIR_PATH</code> line near the top to refer to your photo directory, or " 27283"create a <file>berlin_images</file> directory by clicking " 27284"<guiseq><gui>Project</gui><gui>New Directory...</gui></guiseq> and creating " 27285"a <file>berlin_images</file> directory as a subdirectory of the <file>photo-" 27286"wall</file> directory. Make sure to put at least twelve images in the " 27287"directory!" 27288msgstr "" 27289 27290#. (itstool) path: section/p 27291#: C/photo-wall.c.page:395 27292msgid "" 27293"When you have done that, click <guiseq><gui>Build</gui><gui>Build Project</" 27294"gui></guiseq> to build everything again, then <guiseq><gui>Run</" 27295"gui><gui>Execute</gui></guiseq> to start the application." 27296msgstr "" 27297 27298#. (itstool) path: section/p 27299#: C/photo-wall.c.page:396 27300msgid "" 27301"If you haven't already done so, choose the <file>Debug/src/photo-wall</file> " 27302"application in the dialog that appears. Finally, hit <gui>Run</gui> and " 27303"enjoy!" 27304msgstr "" 27305 27306#. (itstool) path: section/p 27307#: C/photo-wall.c.page:401 27308msgid "" 27309"If you run into problems with the tutorial, compare your code with this " 27310"<link href=\"photo-wall/photo-wall.c\">reference code</link>." 27311msgstr "" 27312 27313#. (itstool) path: info/title 27314#: C/progressbar.c.page:8 27315#, fuzzy 27316msgctxt "text" 27317msgid "ProgressBar (C)" 27318msgstr "Esta barra de progresso não mostra um texto" 27319 27320#. (itstool) path: info/desc 27321#: C/progressbar.c.page:19 C/progressbar.vala.page:18 27322msgid "A widget which indicates progress visually" 27323msgstr "" 27324 27325#. (itstool) path: page/title 27326#: C/progressbar.c.page:22 C/progressbar.js.page:20 C/progressbar.py.page:22 27327#: C/progressbar.vala.page:21 27328#, fuzzy 27329msgid "ProgressBar" 27330msgstr "Esta barra de progresso não mostra um texto" 27331 27332#. (itstool) path: page/media 27333#. This is a reference to an external file such as an image or video. When 27334#. the file changes, the md5 hash will change to let you know you need to 27335#. update your localized copy. The msgstr is not used at all. Set it to 27336#. whatever you like once you have updated your copy of the file. 27337#: C/progressbar.c.page:24 C/progressbar.vala.page:22 27338msgctxt "_" 27339msgid "" 27340"external ref='media/progressbar_fill.ogv' " 27341"md5='287763d1d3f4a328212ea2243910f5e4'" 27342msgstr "" 27343 27344#. (itstool) path: page/p 27345#: C/progressbar.c.page:25 C/progressbar.vala.page:23 27346msgid "" 27347"This ProgressBar \"fills in\" by a fraction of the bar until it is full." 27348msgstr "" 27349 27350#. (itstool) path: page/code 27351#: C/progressbar.c.page:27 27352#, no-wrap 27353msgid "" 27354"\n" 27355"#include <gtk/gtk.h>\n" 27356"\n" 27357"\n" 27358"static gboolean\n" 27359"fill (gpointer user_data)\n" 27360"{\n" 27361" GtkWidget *progress_bar = user_data;\n" 27362"\n" 27363" /*Get the current progress*/\n" 27364" gdouble fraction;\n" 27365" fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));\n" 27366"\n" 27367" /*Increase the bar by 10% each time this function is called*/\n" 27368" fraction += 0.1;\n" 27369"\n" 27370" /*Fill in the bar with the new fraction*/\n" 27371" gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);\n" 27372"\n" 27373" /*Ensures that the fraction stays below 1.0*/\n" 27374" if (fraction < 1.0) \n" 27375" return TRUE;\n" 27376" \n" 27377" return FALSE;\n" 27378"}\n" 27379"\n" 27380"\n" 27381"\n" 27382"static void\n" 27383"activate (GtkApplication *app,\n" 27384" gpointer user_data)\n" 27385"{\n" 27386" GtkWidget *window;\n" 27387" GtkWidget *progress_bar;\n" 27388"\n" 27389" gdouble fraction = 0.0;\n" 27390"\n" 27391" /*Create a window with a title, and a default size*/\n" 27392" window = gtk_application_window_new (app);\n" 27393" gtk_window_set_title (GTK_WINDOW (window), \"ProgressBar Example\");\n" 27394" gtk_window_set_default_size (GTK_WINDOW (window), 220, 20);\n" 27395" \n" 27396" /*Create a progressbar and add it to the window*/\n" 27397" progress_bar = gtk_progress_bar_new ();\n" 27398" gtk_container_add (GTK_CONTAINER (window), progress_bar);\n" 27399"\n" 27400" /*Fill in the given fraction of the bar. Has to be between 0.0-1.0 inclusive*/\n" 27401" gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);\n" 27402"\n" 27403" /*Use the created fill function every 500 milliseconds*/\n" 27404" g_timeout_add (500, fill, GTK_PROGRESS_BAR (progress_bar));\n" 27405" \n" 27406" gtk_widget_show_all (window);\n" 27407"}\n" 27408" \n" 27409"\n" 27410"\n" 27411"int\n" 27412"main (int argc, char **argv)\n" 27413"{\n" 27414" GtkApplication *app;\n" 27415" int status;\n" 27416" \n" 27417" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 27418" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 27419" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 27420" g_object_unref (app);\n" 27421" \n" 27422" return status;\n" 27423"}\n" 27424msgstr "" 27425 27426#. (itstool) path: item/p 27427#: C/progressbar.c.page:36 27428msgid "" 27429"<link href=\"http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop." 27430"html#g-timeout-add\">G_Timeout</link>" 27431msgstr "" 27432 27433#. (itstool) path: info/title 27434#: C/progressbar.js.page:7 27435#, fuzzy 27436msgctxt "text" 27437msgid "ProgressBar (JavaScript)" 27438msgstr "Esta barra de progresso não mostra um texto" 27439 27440#. (itstool) path: info/desc 27441#: C/progressbar.js.page:17 27442#, fuzzy 27443msgid "A bar which animates to indicate progress" 27444msgstr "Inverter a direção de crescimento da barra de progresso" 27445 27446#. (itstool) path: page/media 27447#. This is a reference to an external file such as an image or video. When 27448#. the file changes, the md5 hash will change to let you know you need to 27449#. update your localized copy. The msgstr is not used at all. Set it to 27450#. whatever you like once you have updated your copy of the file. 27451#: C/progressbar.js.page:21 C/progressbar.py.page:23 27452msgctxt "_" 27453msgid "" 27454"external ref='media/progressbar.ogv' md5='36deab3dd4b5be968828fa2ef416d612'" 27455msgstr "" 27456"external ref='media/progressbar.ogv' md5='36deab3dd4b5be968828fa2ef416d612'" 27457 27458#. (itstool) path: div/p 27459#: C/progressbar.js.page:25 C/progressbar.py.page:27 27460msgid "Pressing any key stops and starts this ProgressBar." 27461msgstr "" 27462 27463#. (itstool) path: page/p 27464#: C/progressbar.js.page:32 C/progressbar.py.page:34 27465msgid "This ProgressBar is stopped and started by pressing any key." 27466msgstr "" 27467 27468#. (itstool) path: page/code 27469#: C/progressbar.js.page:34 27470#, fuzzy, no-wrap 27471#| msgid "" 27472#| "#!/usr/bin/gjs\n" 27473#| "\n" 27474#| "const Gtk = imports.gi.Gtk;\n" 27475#| "const Lang = imports.lang;\n" 27476#| "\n" 27477#| "const WelcomeToTheGrid = new Lang.Class({\n" 27478#| " Name: 'Welcome to the Grid',\n" 27479#| "\n" 27480#| " // Create the application itself\n" 27481#| " _init: function() {\n" 27482#| " this.application = new Gtk.Application();\n" 27483#| "\n" 27484#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 27485#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 27486#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 27487#| " },\n" 27488#| "\n" 27489#| " // Callback function for 'activate' signal presents windows when active\n" 27490#| " _onActivate: function() {\n" 27491#| " this._window.present();\n" 27492#| " },\n" 27493#| "\n" 27494#| " // Callback function for 'startup' signal builds the UI\n" 27495#| " _onStartup: function() {\n" 27496#| " this._buildUI ();\n" 27497#| " },\n" 27498#| "\n" 27499#| "\n" 27500#| "\n" 27501#| " // Build the application's UI\n" 27502#| " _buildUI: function() {\n" 27503#| "\n" 27504#| " // Create the application window\n" 27505#| " this._window = new Gtk.ApplicationWindow({\n" 27506#| " application: this.application,\n" 27507#| " window_position: Gtk.WindowPosition.CENTER,\n" 27508#| " border_width: 10,\n" 27509#| " title: \"Welcome to the Grid\"});\n" 27510#| "\n" 27511#| " // Create the Grid\n" 27512#| " this._grid = new Gtk.Grid ({\n" 27513#| " // column_homogeneous: true,\n" 27514#| " // column_spacing: 20,\n" 27515#| " row_spacing: 20 });\n" 27516#| "\n" 27517#| " // Create an image\n" 27518#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 27519#| "\n" 27520#| " // Create a second image using a stock icon\n" 27521#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 27522#| "\n" 27523#| " // Create a label\n" 27524#| " this._label = new Gtk.Label ({\n" 27525#| " label: \"Welcome to GNOME, too!\",\n" 27526#| " /* margin_top: 20 */ });\n" 27527#| "\n" 27528#| " /* Create a second label\n" 27529#| " this._labelTwo = new Gtk.Label ({\n" 27530#| " label: \"The cake is a pie.\" }); */\n" 27531#| "\n" 27532#| " /* Create a button\n" 27533#| " this._button = new Gtk.Button ({\n" 27534#| " label: \"Welcome to GNOME, too!\"}); */\n" 27535#| "\n" 27536#| " // Attach the images and button to the grid\n" 27537#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 27538#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 27539#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 27540#| "\n" 27541#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 27542#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 27543#| "\n" 27544#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 27545#| "\n" 27546#| " // Add the grid to the window\n" 27547#| " this._window.add (this._grid);\n" 27548#| "\n" 27549#| " // Show the window and all child widgets\n" 27550#| " this._window.show_all();\n" 27551#| " }\n" 27552#| "\n" 27553#| "});\n" 27554#| "\n" 27555#| "// Run the application\n" 27556#| "let app = new WelcomeToTheGrid ();\n" 27557#| "app.application.run (ARGV);\n" 27558msgid "" 27559"#!/usr/bin/gjs\n" 27560"\n" 27561"imports.gi.versions.Gtk = '3.0';\n" 27562"\n" 27563"const Gio = imports.gi.Gio;\n" 27564"const GLib = imports.gi.GLib;\n" 27565"const Gtk = imports.gi.Gtk;\n" 27566"\n" 27567"class ProgressBarExample {\n" 27568"\n" 27569" // Create the application itself\n" 27570" constructor() {\n" 27571" this.application = new Gtk.Application({\n" 27572" application_id: 'org.example.jsprogressbar',\n" 27573" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 27574" });\n" 27575"\n" 27576" // Connect 'activate' and 'startup' signals to the callback functions\n" 27577" this.application.connect('activate', this._onActivate.bind(this));\n" 27578" this.application.connect('startup', this._onStartup.bind(this));\n" 27579" }\n" 27580"\n" 27581" // Callback function for 'activate' signal presents windows when active\n" 27582" _onActivate() {\n" 27583" this._window.present();\n" 27584" }\n" 27585"\n" 27586" // Callback function for 'startup' signal builds the UI\n" 27587" _onStartup() {\n" 27588" this._buildUI();\n" 27589" }\n" 27590"\n" 27591" // Build the application's UI\n" 27592" _buildUI() {\n" 27593"\n" 27594" // Create the application window\n" 27595" this._window = new Gtk.ApplicationWindow({ application: this.application,\n" 27596" window_position: Gtk.WindowPosition.CENTER,\n" 27597" default_height: 20,\n" 27598" default_width: 220,\n" 27599" title: \"ProgressBar Example\"});\n" 27600"\n" 27601" // Create the progress bar\n" 27602" this.progressBar = new Gtk.ProgressBar ();\n" 27603" this._window.add(this.progressBar);\n" 27604"\n" 27605" // Start the function that pulses the bar every 100 milliseconds\n" 27606" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n" 27607" this._barPulse.bind(this));\n" 27608"\n" 27609" // Connect a keypress event to the function that toggles the bar to start or stop pulsing\n" 27610" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n" 27611"\n" 27612" // Show the window and all child widgets\n" 27613" this._window.show_all();\n" 27614" }\n" 27615"\n" 27616" // Pulse the progressbar (unless it has been disabled by a keypress)\n" 27617" _barPulse() {\n" 27618" this.progressBar.pulse();\n" 27619" return true;\n" 27620" }\n" 27621"\n" 27622" // Start or stop the progressbar when a key is pressed\n" 27623" _onKeyPress() {\n" 27624" if (this.sourceID == 0)\n" 27625" this.sourceID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100,\n" 27626" this._barPulse.bind(this));\n" 27627" else {\n" 27628" GLib.source_remove(this.sourceID);\n" 27629" this.sourceID = 0;\n" 27630" }\n" 27631" }\n" 27632"\n" 27633"};\n" 27634"\n" 27635"// Run the application\n" 27636"let app = new ProgressBarExample ();\n" 27637"app.application.run (ARGV);\n" 27638msgstr "" 27639"#!/usr/bin/gjs\n" 27640"\n" 27641"const Gtk = imports.gi.Gtk;\n" 27642"const Lang = imports.lang;\n" 27643"\n" 27644"const WelcomeToTheGrid = new Lang.Class({\n" 27645" Name: 'Bem-vindo à Grid',\n" 27646"\n" 27647" // Cria o aplicativo em si\n" 27648" _init: function() {\n" 27649" this.application = new Gtk.Application();\n" 27650"\n" 27651" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 27652" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 27653" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 27654" },\n" 27655"\n" 27656" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 27657" _onActivate: function() {\n" 27658" this._window.present();\n" 27659" },\n" 27660"\n" 27661" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 27662" _onStartup: function() {\n" 27663" this._buildUI ();\n" 27664" },\n" 27665"\n" 27666"\n" 27667"\n" 27668" // Constrói a interface gráfica do aplicativo\n" 27669" _buildUI: function() {\n" 27670"\n" 27671" // Cria a janela do aplicativo\n" 27672" this._window = new Gtk.ApplicationWindow({\n" 27673" application: this.application,\n" 27674" window_position: Gtk.WindowPosition.CENTER,\n" 27675" border_width: 10,\n" 27676" title: \"Bem-vindo à Grid\"});\n" 27677"\n" 27678" // Cria a Grid\n" 27679" this._grid = new Gtk.Grid ({\n" 27680" // column_homogeneous: true,\n" 27681" // column_spacing: 20,\n" 27682" row_spacing: 20 });\n" 27683"\n" 27684" // Cria uma imagem\n" 27685" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 27686"\n" 27687" // Cria uma segunda imagem usando um ícone padrão\n" 27688" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 27689"\n" 27690" // Cria um rótulo\n" 27691" this._label = new Gtk.Label ({\n" 27692" label: \"Bem-vindo ao GNOME, também!\",\n" 27693" /* margin_top: 20 */ });\n" 27694"\n" 27695" /* Cria um segundo rótulo\n" 27696" this._labelTwo = new Gtk.Label ({\n" 27697" label: \"O bolo é uma torta.\" }); */\n" 27698"\n" 27699" /* Cria um botão\n" 27700" this._button = new Gtk.Button ({\n" 27701" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 27702"\n" 27703" // Anexa as imagens e botão à grade\n" 27704" this._grid.attach (this._image, 0, 0, 2, 1);\n" 27705" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 27706" this._grid.attach (this._label, 1, 1, 1, 1);\n" 27707"\n" 27708" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 27709" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 27710"\n" 27711" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 27712"\n" 27713" // Adiciona a grade à janela\n" 27714" this._window.add (this._grid);\n" 27715"\n" 27716" // Mostra a janela e todos os widgets filhos\n" 27717" this._window.show_all();\n" 27718" }\n" 27719"\n" 27720"});\n" 27721"\n" 27722"// Executa o aplicativo\n" 27723"let app = new WelcomeToTheGrid ();\n" 27724"app.application.run (ARGV);\n" 27725 27726#. (itstool) path: item/p 27727#: C/progressbar.js.page:39 27728msgid "" 27729"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/GLib.html\">GLib</" 27730"link>" 27731msgstr "" 27732 27733#. (itstool) path: info/title 27734#: C/progressbar.py.page:8 27735#, fuzzy 27736msgctxt "text" 27737msgid "ProgressBar (Python)" 27738msgstr "_Python" 27739 27740#. (itstool) path: info/desc 27741#: C/progressbar.py.page:19 27742msgid "A widget which indicates progress visually." 27743msgstr "" 27744 27745#. (itstool) path: section/code 27746#: C/progressbar.py.page:41 27747#, no-wrap 27748msgid "" 27749"from gi.repository import GLib\n" 27750"from gi.repository import Gtk\n" 27751"import sys\n" 27752"\n" 27753"\n" 27754"class MyWindow(Gtk.ApplicationWindow):\n" 27755" # a window\n" 27756"\n" 27757" def __init__(self, app):\n" 27758" Gtk.Window.__init__(self, title=\"ProgressBar Example\", application=app)\n" 27759" self.set_default_size(220, 20)\n" 27760"\n" 27761" # a progressbar\n" 27762" self.progress_bar = Gtk.ProgressBar()\n" 27763" # add the progressbar to the window\n" 27764" self.add(self.progress_bar)\n" 27765"\n" 27766" # the method self.pulse is called each 100 milliseconds\n" 27767" # and self.source_id is set to be the ID of the event source\n" 27768" # (i.e. the bar changes position every 100 milliseconds)\n" 27769" self.source_id = GLib.timeout_add(100, self.pulse)\n" 27770"\n" 27771" # event handler\n" 27772" # any signal from the keyboard controls if the progressbar stops/starts\n" 27773" def do_key_press_event(self, event):\n" 27774" # if the progressbar has been stopped (therefore source_id == 0 - see\n" 27775" # \"else\" below), turn it back on\n" 27776" if (self.source_id == 0):\n" 27777" self.source_id = GLib.timeout_add(100, self.pulse)\n" 27778" # if the bar is moving, remove the source with the ID of source_id\n" 27779" # from the main context (stop the bar) and set the source_id to 0\n" 27780" else:\n" 27781" GLib.source_remove(self.source_id)\n" 27782" self.source_id = 0\n" 27783" # stop the signal emission\n" 27784" return True\n" 27785"\n" 27786" # source function\n" 27787" # the progressbar is in \"activity mode\" when this method is called\n" 27788" def pulse(self):\n" 27789" self.progress_bar.pulse()\n" 27790" # call the function again\n" 27791" return True\n" 27792"\n" 27793"\n" 27794"class MyApplication(Gtk.Application):\n" 27795"\n" 27796" def __init__(self):\n" 27797" Gtk.Application.__init__(self)\n" 27798"\n" 27799" def do_activate(self):\n" 27800" win = MyWindow(self)\n" 27801" win.show_all()\n" 27802"\n" 27803" def do_startup(self):\n" 27804" Gtk.Application.do_startup(self)\n" 27805"\n" 27806"app = MyApplication()\n" 27807"exit_status = app.run(sys.argv)\n" 27808"sys.exit(exit_status)\n" 27809msgstr "" 27810 27811#. (itstool) path: section/title 27812#: C/progressbar.py.page:46 27813#, fuzzy 27814msgid "Useful methods for a ProgressBar widget" 27815msgstr "Métodos úteis" 27816 27817#. (itstool) path: item/p 27818#: C/progressbar.py.page:48 27819msgid "" 27820"Instead of <code>pulse()</code>, that makes the bar go back and forth, if we " 27821"want the ProgressBar to \"fill in\" a fraction (a <code>float</code> between " 27822"<code>0.0</code> and <code>1.0</code> included) of the bar that has been " 27823"completed, use <code>set_fraction(fraction)</code>." 27824msgstr "" 27825 27826#. (itstool) path: item/p 27827#: C/progressbar.py.page:49 27828msgid "" 27829"To set a text and show it (superimposed over the bar) use " 27830"<code>set_text(<var>\"text\"</var>)</code> and <code>set_show_text(True)</" 27831"code>. If a text is not set and <code>set_show_text(True)</code> the text " 27832"will be the percentage of the work that has been completed." 27833msgstr "" 27834 27835#. (itstool) path: item/p 27836#: C/progressbar.py.page:57 27837msgid "" 27838"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkProgressBar.html" 27839"\">GtkProgressBar</link>" 27840msgstr "" 27841 27842#. (itstool) path: item/p 27843#: C/progressbar.py.page:58 27844msgid "" 27845"<link href=\"http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop." 27846"html\">GLib - The Main Event Loop</link>" 27847msgstr "" 27848 27849#. (itstool) path: item/p 27850#: C/progressbar.py.page:59 27851msgid "" 27852"<link href=\"http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling" 27853"\">Gdk - Key Values</link>" 27854msgstr "" 27855 27856#. (itstool) path: info/title 27857#: C/progressbar.vala.page:8 27858#, fuzzy 27859msgctxt "text" 27860msgid "ProgressBar (Vala)" 27861msgstr "Esta barra de progresso não mostra um texto" 27862 27863#. (itstool) path: page/code 27864#: C/progressbar.vala.page:25 27865#, no-wrap 27866msgid "" 27867"public class MyApplication : Gtk.Application {\n" 27868"\n" 27869"\tGtk.ProgressBar progress_bar;\n" 27870"\n" 27871"\tprotected override void activate () {\n" 27872"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 27873"\t\twindow.set_title (\"ProgressBar Example\");\n" 27874"\t\twindow.set_default_size (220, 20);\n" 27875"\n" 27876"\t\tprogress_bar = new Gtk.ProgressBar ();\n" 27877"\t\twindow.add (progress_bar);\n" 27878"\t\twindow.show_all ();\n" 27879"\n" 27880"\t\tdouble fraction = 0.0;\n" 27881"\t\tprogress_bar.set_fraction (fraction);\n" 27882"\t\tGLib.Timeout.add (500, fill);\n" 27883"\t}\n" 27884"\n" 27885"\tbool fill () {\n" 27886"\t\tdouble fraction = progress_bar.get_fraction (); //get current progress\n" 27887"\t\tfraction += 0.1; //increase by 10% each time this function is called\n" 27888"\n" 27889"\t\tprogress_bar.set_fraction (fraction);\n" 27890"\n" 27891"\t\t/* This function is only called by GLib.Timeout.add while it returns true; */\n" 27892"\t\tif (fraction < 1.0)\n" 27893"\t\t\treturn true;\n" 27894"\t\treturn false;\n" 27895"\t}\n" 27896"}\n" 27897"\n" 27898"public int main (string[] args) {\n" 27899"\tvar progress_bar_application = new MyApplication ();\n" 27900"\tint status = progress_bar_application.run (args);\n" 27901"\treturn status;\n" 27902"}\n" 27903msgstr "" 27904 27905#. (itstool) path: item/p 27906#: C/progressbar.vala.page:30 27907msgid "" 27908"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ProgressBar.html\">Gtk." 27909"ProgressBar</link>" 27910msgstr "" 27911 27912#. (itstool) path: item/p 27913#: C/progressbar.vala.page:31 27914msgid "" 27915"<link href=\"http://www.valadoc.org/glib-2.0/GLib.Timeout.html\">GLib." 27916"Timeout</link>" 27917msgstr "" 27918 27919#. (itstool) path: info/title 27920#: C/properties.py.page:9 27921#, fuzzy 27922msgctxt "text" 27923msgid "Properties (Python)" 27924msgstr "propriedades" 27925 27926#. (itstool) path: info/desc 27927#: C/properties.py.page:14 27928msgid "An explanation of properties, getters and setters." 27929msgstr "" 27930 27931#. (itstool) path: page/title 27932#: C/properties.py.page:27 27933#, fuzzy 27934msgid "Properties" 27935msgstr "Propriedades" 27936 27937#. (itstool) path: section/p 27938#: C/properties.py.page:34 27939msgid "" 27940"<em>Properties</em> describe the configuration and state of widgets. Each " 27941"widget has its own particular set of properties. For example, a widget such " 27942"as a button has the property <code>label</code> which contains the text of " 27943"the widget. You can specify the name and value of any number of properties " 27944"as keyword arguments when creating an instance of a widget. For example, to " 27945"create a label with the text “Hello World”, an angle of 25 degrees, and " 27946"aligned to the right, you can use:" 27947msgstr "" 27948 27949#. (itstool) path: section/code 27950#: C/properties.py.page:41 27951#, no-wrap 27952msgid "" 27953"\n" 27954"label = Gtk.Label(label=\"Hello World\", angle=25, halign=Gtk.Align.END)" 27955msgstr "" 27956 27957#. (itstool) path: section/p 27958#: C/properties.py.page:44 27959msgid "" 27960"Alternatively, you can define these properties separately by using the " 27961"method associated with it." 27962msgstr "" 27963 27964#. (itstool) path: section/code 27965#: C/properties.py.page:45 27966#, no-wrap 27967msgid "" 27968"\n" 27969"label = Gtk.Label()\n" 27970"label.set_label(\"Hello World\")\n" 27971"label.set_angle(25)\n" 27972"label.set_halign(Gtk.Align.END)" 27973msgstr "" 27974 27975#. (itstool) path: section/p 27976#: C/properties.py.page:51 27977msgid "" 27978"Once you have created such a label, you can get the text of the label with " 27979"<code>label.get_label()</code>, and analogously for the other properties." 27980msgstr "" 27981 27982#. (itstool) path: section/p 27983#: C/properties.py.page:53 27984msgid "" 27985"Instead of using getters and setters you can also get and set the properties " 27986"with <code>get_property(<var>\"prop-name\"</var>)</code> and " 27987"<code>set_property(<var>\"prop-name\"</var>, <var>value</var>)</code>, " 27988"respectively." 27989msgstr "" 27990 27991#. (itstool) path: section/p 27992#: C/properties.py.page:59 27993msgid "" 27994"<link href=\"http://python-gtk-3-tutorial.readthedocs.org/en/latest/basics." 27995"html\">Basics - Properties</link> in Python GTK+ 3 Tutorial" 27996msgstr "" 27997 27998#. (itstool) path: info/title 27999#: C/py.page:7 28000msgctxt "link" 28001msgid "Python" 28002msgstr "Python" 28003 28004#. (itstool) path: page/title 28005#: C/py.page:21 28006msgid "Tutorials, code samples and platform demos in Python" 28007msgstr "Tutoriais, amostras de código e demonstrações da plataforma em Python" 28008 28009#. (itstool) path: section/title 28010#. (itstool) path: page/title 28011#: C/py.page:26 C/tutorial.py.page:31 28012msgid "Tutorial for beginners" 28013msgstr "Tutorial para iniciantes" 28014 28015#. (itstool) path: info/title 28016#: C/radiobutton.c.page:8 28017msgctxt "text" 28018msgid "RadioButton (C)" 28019msgstr "RadioButton (C)" 28020 28021#. (itstool) path: info/desc 28022#: C/radiobutton.c.page:20 28023msgid "A choice from multiple checkbuttons" 28024msgstr "Uma escolha de vários botões de verificação" 28025 28026#. (itstool) path: page/title 28027#: C/radiobutton.c.page:23 C/radiobutton.js.page:21 C/radiobutton.py.page:23 28028#: C/radiobutton.vala.page:24 28029msgid "RadioButton" 28030msgstr "RadioButton" 28031 28032#. (itstool) path: page/media 28033#. This is a reference to an external file such as an image or video. When 28034#. the file changes, the md5 hash will change to let you know you need to 28035#. update your localized copy. The msgstr is not used at all. Set it to 28036#. whatever you like once you have updated your copy of the file. 28037#: C/radiobutton.c.page:25 C/radiobutton.py.page:24 C/radiobutton.vala.page:25 28038msgctxt "_" 28039msgid "" 28040"external ref='media/radiobutton.png' md5='d115460280d8e41493dd98054b5822a5'" 28041msgstr "" 28042"external ref='media/radiobutton.png' md5='d115460280d8e41493dd98054b5822a5'" 28043 28044#. (itstool) path: page/p 28045#: C/radiobutton.c.page:26 28046#, fuzzy 28047msgid "These radiobuttons report their activity in the terminal." 28048msgstr " -u USUÁRIO Relatório de atividades somente para o usuário" 28049 28050#. (itstool) path: page/code 28051#: C/radiobutton.c.page:28 28052#, no-wrap 28053msgid "" 28054"\n" 28055"#include <gtk/gtk.h>\n" 28056"\n" 28057"\n" 28058"\n" 28059"/*Signal handler for the \"toggled\" signal of the RadioButton*/\n" 28060"static void\n" 28061"button_toggled_cb (GtkWidget *button,\n" 28062" gpointer user_data)\n" 28063"{\n" 28064" char *b_state;\n" 28065" const char *button_label;\n" 28066"\n" 28067" if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))\n" 28068" b_state = \"on\";\n" 28069" else {\n" 28070" b_state = \"off\";\n" 28071" g_print (\"\\n\");\n" 28072" }\n" 28073"\n" 28074" button_label = gtk_button_get_label (GTK_BUTTON (button));\n" 28075"\n" 28076" g_print (\"%s was turned %s\\n\", button_label, b_state);\n" 28077"}\n" 28078"\n" 28079"\n" 28080"\n" 28081"static void\n" 28082"activate (GtkApplication *app,\n" 28083" gpointer user_data)\n" 28084"{\n" 28085" GtkWidget *grid;\n" 28086" GtkWidget *window;\n" 28087"\n" 28088" GtkWidget *button1;\n" 28089" GtkWidget *button2;\n" 28090" GtkWidget *button3;\n" 28091"\n" 28092" /*Create a window with a set title and default size.\n" 28093" Also, set a border width for the amount of space to leave\n" 28094" inside the window*/\n" 28095" window = gtk_application_window_new (app);\n" 28096" gtk_window_set_title (GTK_WINDOW (window), \"RadioButton Example\");\n" 28097" gtk_window_set_default_size (GTK_WINDOW (window), 250, 100);\n" 28098" gtk_container_set_border_width (GTK_CONTAINER(window), 20);\n" 28099"\n" 28100"\n" 28101" /*Create an initial radio button*/\n" 28102" button1 = gtk_radio_button_new_with_label (NULL, \"Button 1\");\n" 28103"\n" 28104" /*Create a second radio button, and add it to the same group as Button 1*/\n" 28105" button2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button1), \n" 28106" \"Button 2\");\n" 28107"\n" 28108" /*Create a third button, and add it to the same group as Button 1*/\n" 28109" button3 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button1), \n" 28110" \"Button 3\");\n" 28111"\n" 28112"\n" 28113" /*Create a grid, attach the buttons, and position them accordingly*/\n" 28114" grid = gtk_grid_new ();\n" 28115" gtk_grid_attach (GTK_GRID (grid), button1, 0, 0, 1, 1);\n" 28116" gtk_grid_attach (GTK_GRID (grid), button2, 0, 1, 1, 1);\n" 28117" gtk_grid_attach (GTK_GRID (grid), button3, 0, 2, 1, 1);\n" 28118"\n" 28119" /*Be sure to set the initial state of each button*/\n" 28120" gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button2), TRUE);\n" 28121" gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button1), FALSE);\n" 28122" gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button3), FALSE);\n" 28123"\n" 28124" /*Connect the signal handlers (aka Callback functions) to the buttons*/\n" 28125" g_signal_connect (GTK_TOGGLE_BUTTON (button1), \"toggled\", \n" 28126" G_CALLBACK (button_toggled_cb), window);\n" 28127" g_signal_connect (GTK_TOGGLE_BUTTON (button2), \"toggled\", \n" 28128" G_CALLBACK (button_toggled_cb), window);\n" 28129" g_signal_connect (GTK_TOGGLE_BUTTON (button3), \"toggled\", \n" 28130" G_CALLBACK (button_toggled_cb), window);\n" 28131"\n" 28132" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));\n" 28133"\n" 28134" gtk_widget_show_all (window);\n" 28135"}\n" 28136"\n" 28137"\n" 28138"\n" 28139"int\n" 28140"main (int argc, char **argv)\n" 28141"{\n" 28142" GtkApplication *app;\n" 28143" int status;\n" 28144"\n" 28145" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 28146" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 28147" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 28148" g_object_unref (app);\n" 28149"\n" 28150" return status;\n" 28151"}\n" 28152msgstr "" 28153 28154#. (itstool) path: item/p 28155#: C/radiobutton.c.page:38 C/switch.c.page:36 28156msgid "" 28157"<link href=\"http://developer.gnome.org/gtk3/stable/GtkSwitch.html" 28158"\">GtkSwitch</link>" 28159msgstr "" 28160"<link href=\"http://developer.gnome.org/gtk3/stable/GtkSwitch.html" 28161"\">GtkSwitch</link>" 28162 28163#. (itstool) path: info/title 28164#: C/radiobutton.js.page:8 28165msgctxt "text" 28166msgid "RadioButton (JavaScript)" 28167msgstr "RadioButton (JavaScript)" 28168 28169#. (itstool) path: info/desc 28170#: C/radiobutton.js.page:18 28171#, fuzzy 28172msgid "Only one can be selected at a time" 28173msgstr "Apenas uma opção pode ser fornecida por vez" 28174 28175#. (itstool) path: page/media 28176#. This is a reference to an external file such as an image or video. When 28177#. the file changes, the md5 hash will change to let you know you need to 28178#. update your localized copy. The msgstr is not used at all. Set it to 28179#. whatever you like once you have updated your copy of the file. 28180#: C/radiobutton.js.page:22 28181msgctxt "_" 28182msgid "" 28183"external ref='media/radiobuttontravel.png' " 28184"md5='0c5f01ee160bb42716ccf5dccbd080c0'" 28185msgstr "" 28186"external ref='media/radiobuttontravel.png' " 28187"md5='0c5f01ee160bb42716ccf5dccbd080c0'" 28188 28189#. (itstool) path: page/p 28190#: C/radiobutton.js.page:23 28191msgid "" 28192"RadioButtons are named after old-style car radios, which had buttons for " 28193"switching between channel presets. Because the radio could only be tuned to " 28194"one station at a time, only one button could be pressed in at a time; if you " 28195"pressed a new one, the one that was already pressed in would pop back out. " 28196"That's how these buttons work, too." 28197msgstr "" 28198 28199#. (itstool) path: page/p 28200#: C/radiobutton.js.page:24 28201msgid "" 28202"Each RadioButton needs a text label and a group. Only one button in a group " 28203"can be selected at a time. You don't name each group; you just set new " 28204"RadioButtons to be part of the same group as an existing one. If you create " 28205"a new one outside of a group, it automatically creates a new group for it to " 28206"be part of." 28207msgstr "" 28208 28209#. (itstool) path: section/code 28210#: C/radiobutton.js.page:41 28211#, no-wrap 28212msgid "" 28213"\n" 28214"const RadioButtonExample = new Lang.Class({\n" 28215" Name: 'RadioButton Example',\n" 28216"\n" 28217" // Create the application itself\n" 28218" _init: function() {\n" 28219" this.application = new Gtk.Application({\n" 28220" application_id: 'org.example.jsradiobutton',\n" 28221" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 28222" });\n" 28223"\n" 28224" // Connect 'activate' and 'startup' signals to the callback functions\n" 28225" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 28226" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 28227" },\n" 28228"\n" 28229" // Callback function for 'activate' signal presents window when active\n" 28230" _onActivate: function() {\n" 28231" this._window.present();\n" 28232" },\n" 28233"\n" 28234" // Callback function for 'startup' signal builds the UI\n" 28235" _onStartup: function() {\n" 28236" this._buildUI ();\n" 28237" },\n" 28238msgstr "" 28239 28240#. (itstool) path: section/p 28241#: C/radiobutton.js.page:67 C/togglebutton.js.page:67 28242msgid "" 28243"All the code for this sample goes in the RadioButtonExample class. The above " 28244"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 28245"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 28246"go in." 28247msgstr "" 28248 28249#. (itstool) path: section/code 28250#: C/radiobutton.js.page:68 28251#, no-wrap 28252msgid "" 28253"\n" 28254" // Build the application's UI\n" 28255" _buildUI: function() {\n" 28256"\n" 28257" // Create the application window\n" 28258" this._window = new Gtk.ApplicationWindow({\n" 28259" application: this.application,\n" 28260" window_position: Gtk.WindowPosition.CENTER,\n" 28261" border_width: 20,\n" 28262" title: \"Travel Planning\"});\n" 28263msgstr "" 28264 28265#. (itstool) path: section/title 28266#: C/radiobutton.js.page:83 28267#, fuzzy 28268msgid "Creating the radiobuttons" 28269msgstr "Criando um evento" 28270 28271#. (itstool) path: section/code 28272#: C/radiobutton.js.page:84 28273#, no-wrap 28274msgid "" 28275"\n" 28276" // Create a label for the first group of buttons\n" 28277" this._placeLabel = new Gtk.Label ({label: \"Where would you like to travel to?\"});\n" 28278msgstr "" 28279 28280#. (itstool) path: section/p 28281#: C/radiobutton.js.page:89 28282msgid "" 28283"We use a <link xref=\"label.js\">Gtk.Label</link> to set each group of " 28284"RadioButtons apart. Nothing will stop you from putting RadioButtons from all " 28285"different groups wherever you want, so if you want people to know which ones " 28286"go together you need to organize things accordingly." 28287msgstr "" 28288 28289#. (itstool) path: section/code 28290#: C/radiobutton.js.page:91 28291#, no-wrap 28292msgid "" 28293"\n" 28294" // Create three radio buttons three different ways\n" 28295" this._place1 = new Gtk.RadioButton ({label: \"The Beach\"});\n" 28296"\n" 28297" this._place2 = Gtk.RadioButton.new_from_widget (this._place1);\n" 28298" this._place2.set_label (\"The Moon\");\n" 28299"\n" 28300" this._place3 = Gtk.RadioButton.new_with_label_from_widget (this._place1, \"Antarctica\");\n" 28301" // this._place3.set_active (true);\n" 28302msgstr "" 28303 28304#. (itstool) path: section/p 28305#: C/radiobutton.js.page:102 28306msgid "" 28307"Here are three different ways to create RadioButtons. The first is the usual " 28308"way, where we create a new Gtk.RadioButton and assign its properties at the " 28309"same time. The second and third use functions which automatically handle " 28310"some of the properties; new_from_widget takes a single argument, the " 28311"RadioButton that you want to put this new one in the same group as. " 28312"Meanwhile, new_with_label_from_widget takes that and the RadioButton's label " 28313"at the same time." 28314msgstr "" 28315 28316#. (itstool) path: section/p 28317#: C/radiobutton.js.page:103 28318msgid "" 28319"The first RadioButton in a group is the one that's selected by default. Try " 28320"uncommenting the last line in this sample code to see how you can set a " 28321"different one to be the default selection." 28322msgstr "" 28323 28324#. (itstool) path: section/code 28325#: C/radiobutton.js.page:105 28326#, no-wrap 28327msgid "" 28328"\n" 28329" // Create a label for the second group of buttons\n" 28330" this._thingLabel = new Gtk.Label ({label: \"And what would you like to bring?\" });\n" 28331"\n" 28332" // Create three more radio buttons\n" 28333" this._thing1 = new Gtk.RadioButton ({label: \"Penguins\" });\n" 28334" this._thing2 = new Gtk.RadioButton ({label: \"Sunscreen\", group: this._thing1 });\n" 28335" this._thing3 = new Gtk.RadioButton ({label: \"A spacesuit\", group: this._thing1 });\n" 28336msgstr "" 28337 28338#. (itstool) path: section/p 28339#: C/radiobutton.js.page:114 28340msgid "" 28341"Here we create the label for the second group of buttons, and then create " 28342"them all the same way." 28343msgstr "" 28344 28345#. (itstool) path: section/title 28346#: C/radiobutton.js.page:118 C/textview.js.page:132 28347#, fuzzy 28348msgid "Creating the rest of the user interface" 28349msgstr "Mostra as opções para a interface do usuário" 28350 28351#. (itstool) path: section/code 28352#: C/radiobutton.js.page:120 28353#, no-wrap 28354msgid "" 28355"\n" 28356" // Create a stock OK button\n" 28357" this._okButton = new Gtk.Button ({\n" 28358" label: 'gtk-ok',\n" 28359" use_stock: 'true',\n" 28360" halign: Gtk.Align.END });\n" 28361"\n" 28362" // Connect the button to the function which handles clicking it\n" 28363" this._okButton.connect ('clicked', Lang.bind (this, this._okClicked));\n" 28364msgstr "" 28365 28366#. (itstool) path: section/p 28367#: C/radiobutton.js.page:130 28368msgid "" 28369"This code creates a <link xref=\"button.js\">Gtk.Button</link> and binds it " 28370"to a function which will show people a silly message when they click OK, " 28371"depending on which RadioButtons were selected." 28372msgstr "" 28373 28374#. (itstool) path: section/p 28375#: C/radiobutton.js.page:131 28376msgid "" 28377"To make sure the button's \"OK\" label shows up properly in every language " 28378"that GNOME is translated into, remember to use one of Gtk's <link href=" 28379"\"https://developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html\">stock button " 28380"types</link>." 28381msgstr "" 28382 28383#. (itstool) path: section/code 28384#: C/radiobutton.js.page:133 28385#, no-wrap 28386msgid "" 28387"\n" 28388" // Create a grid to put the \"place\" items in\n" 28389" this._places = new Gtk.Grid ();\n" 28390"\n" 28391" // Attach the \"place\" items to the grid\n" 28392" this._places.attach (this._placeLabel, 0, 0, 1, 1);\n" 28393" this._places.attach (this._place1, 0, 1, 1, 1);\n" 28394" this._places.attach (this._place2, 0, 2, 1, 1);\n" 28395" this._places.attach (this._place3, 0, 3, 1, 1);\n" 28396"\n" 28397" // Create a grid to put the \"thing\" items in\n" 28398" this._things = new Gtk.Grid ({ margin_top: 50 });\n" 28399"\n" 28400" // Attach the \"thing\" items to the grid\n" 28401" this._things.attach (this._thingLabel, 0, 0, 1, 1);\n" 28402" this._things.attach (this._thing1, 0, 1, 1, 1);\n" 28403" this._things.attach (this._thing2, 0, 2, 1, 1);\n" 28404" this._things.attach (this._thing3, 0, 3, 1, 1);\n" 28405"\n" 28406" // Create a grid to put everything in\n" 28407" this._grid = new Gtk.Grid ({\n" 28408" halign: Gtk.Align.CENTER,\n" 28409" valign: Gtk.Align.CENTER,\n" 28410" margin_left: 40,\n" 28411" margin_right: 50 });\n" 28412"\n" 28413" // Attach everything to the grid\n" 28414" this._grid.attach (this._places, 0, 0, 1, 1);\n" 28415" this._grid.attach (this._things, 0, 1, 1, 1);\n" 28416" this._grid.attach (this._okButton, 0, 2, 1, 1);\n" 28417"\n" 28418" // Add the grid to the window\n" 28419" this._window.add (this._grid);\n" 28420msgstr "" 28421 28422#. (itstool) path: section/p 28423#: C/radiobutton.js.page:167 28424msgid "" 28425"We use a separate <link xref=\"grid.js\">Gtk.Grid</link> to organize each " 28426"group of radio buttons. This way we can change the layout with less fuss " 28427"later on. The second Grid has a margin on top, to visually separate the two " 28428"sets of choices." 28429msgstr "" 28430 28431#. (itstool) path: section/p 28432#: C/radiobutton.js.page:168 28433msgid "" 28434"After we've organized them, we put them into a third, master Grid, along " 28435"with the OK button. Then we attach that to the window." 28436msgstr "" 28437 28438#. (itstool) path: section/code 28439#: C/radiobutton.js.page:170 28440#, fuzzy, no-wrap 28441msgid "" 28442"\n" 28443" // Show the window and all child widgets\n" 28444" this._window.show_all();\n" 28445" },\n" 28446msgstr "" 28447"\n" 28448" // Coloca o webview na janela\n" 28449" this._window.add (this._webView);\n" 28450"\n" 28451" // Mostra a janela e todos seus widgets filhos\n" 28452" this._window.show_all();\n" 28453" },\n" 28454"\n" 28455"});\n" 28456 28457#. (itstool) path: section/p 28458#: C/radiobutton.js.page:176 28459msgid "" 28460"Finally, we tell the window and everything inside it to become visible when " 28461"the application is run." 28462msgstr "" 28463 28464#. (itstool) path: section/code 28465#: C/radiobutton.js.page:182 28466#, no-wrap 28467msgid "" 28468"\n" 28469" _okClicked: function () {\n" 28470"\n" 28471" // Create a popup that shows a silly message\n" 28472" this._travel = new Gtk.MessageDialog ({\n" 28473" transient_for: this._window,\n" 28474" modal: true,\n" 28475" message_type: Gtk.MessageType.OTHER,\n" 28476" buttons: Gtk.ButtonsType.OK,\n" 28477" text: this._messageText() });\n" 28478"\n" 28479" // Show the popup\n" 28480" this._travel.show();\n" 28481"\n" 28482" // Bind the OK button to the function that closes the popup\n" 28483" this._travel.connect (\"response\", Lang.bind (this, this._clearTravelPopUp));\n" 28484"\n" 28485" },\n" 28486msgstr "" 28487 28488#. (itstool) path: section/p 28489#: C/radiobutton.js.page:201 28490msgid "" 28491"When you click OK, a <link xref=\"messagedialog.js\">Gtk.MessageDialog</" 28492"link> appears. This function creates and displays the popup window, then " 28493"binds its OK button to a function that closes it. What text appears in the " 28494"popup depends on the _messageText() function, which returns a different " 28495"value depending on which set of options you chose." 28496msgstr "" 28497 28498#. (itstool) path: section/code 28499#: C/radiobutton.js.page:203 28500#, no-wrap 28501msgid "" 28502"\n" 28503" _messageText: function() {\n" 28504"\n" 28505" // Create a silly message for the popup depending on what you selected\n" 28506" var stringMessage = \"\";\n" 28507"\n" 28508" if (this._place1.get_active()) {\n" 28509"\n" 28510" if (this._thing1.get_active())\n" 28511" stringMessage = \"Penguins love the beach, too!\";\n" 28512"\n" 28513" else if (this._thing2.get_active())\n" 28514" stringMessage = \"Make sure to put on that sunscreen!\";\n" 28515"\n" 28516" else stringMessage = \"Are you going to the beach in space?\";\n" 28517"\n" 28518" }\n" 28519"\n" 28520" else if (this._place2.get_active()) {\n" 28521"\n" 28522" if (this._thing1.get_active())\n" 28523" stringMessage = \"The penguins will take over the moon!\";\n" 28524"\n" 28525" else if (this._thing2.get_active())\n" 28526" stringMessage = \"A lack of sunscreen will be the least of your problems!\";\n" 28527"\n" 28528" else stringMessage = \"You'll probably want a spaceship, too!\";\n" 28529" }\n" 28530"\n" 28531" else if (this._place3.get_active()) {\n" 28532"\n" 28533" if (this._thing1.get_active())\n" 28534" stringMessage = \"The penguins will be happy to be back home!\";\n" 28535"\n" 28536" else if (this._thing2.get_active())\n" 28537" stringMessage = \"Antarctic sunbathing may be hazardous to your health!\";\n" 28538"\n" 28539" else stringMessage = \"Try bringing a parka instead!\";\n" 28540" }\n" 28541"\n" 28542" return stringMessage;\n" 28543"\n" 28544" },\n" 28545msgstr "" 28546 28547#. (itstool) path: section/p 28548#: C/radiobutton.js.page:247 28549msgid "" 28550"The get_active() method is how we can tell which RadioButton's pressed in. " 28551"This function returns a different silly message depending on which set of " 28552"buttons was pressed. Its return value is used as the MessageDialog's text " 28553"property." 28554msgstr "" 28555 28556#. (itstool) path: section/code 28557#: C/radiobutton.js.page:249 28558#, fuzzy, no-wrap 28559msgid "" 28560"\n" 28561" _clearTravelPopUp: function () {\n" 28562"\n" 28563" this._travel.destroy();\n" 28564"\n" 28565" }\n" 28566"\n" 28567"});\n" 28568msgstr "A função <function>car</function> " 28569 28570#. (itstool) path: section/p 28571#: C/radiobutton.js.page:258 28572msgid "" 28573"This function is called when the MessageDialog's OK button is pressed. It " 28574"simply makes the popup go away." 28575msgstr "" 28576 28577#. (itstool) path: section/code 28578#: C/radiobutton.js.page:260 28579#, fuzzy, no-wrap 28580msgid "" 28581"\n" 28582"// Run the application\n" 28583"let app = new RadioButtonExample ();\n" 28584"app.application.run (ARGV);\n" 28585msgstr "" 28586"\n" 28587"// Executa o aplicativo\n" 28588"let app = new GettingTheSignal ();\n" 28589"app.application.run (ARGV);\n" 28590 28591#. (itstool) path: section/p 28592#: C/radiobutton.js.page:265 C/togglebutton.js.page:144 28593msgid "" 28594"Finally, we create a new instance of the finished RadioButtonExample class, " 28595"and set the application running." 28596msgstr "" 28597 28598#. (itstool) path: section/code 28599#: C/radiobutton.js.page:270 28600#, no-wrap 28601msgid "" 28602"#!/usr/bin/gjs\n" 28603"\n" 28604"imports.gi.versions.Gtk = '3.0';\n" 28605"\n" 28606"const Gio = imports.gi.Gio;\n" 28607"const Gtk = imports.gi.Gtk;\n" 28608"\n" 28609"class RadioButtonExample {\n" 28610"\n" 28611" // Create the application itself\n" 28612" constructor() {\n" 28613" this.application = new Gtk.Application({\n" 28614" application_id: 'org.example.jsradiobutton',\n" 28615" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 28616" });\n" 28617"\n" 28618" // Connect 'activate' and 'startup' signals to the callback functions\n" 28619" this.application.connect('activate', this._onActivate.bind(this));\n" 28620" this.application.connect('startup', this._onStartup.bind(this));\n" 28621" }\n" 28622"\n" 28623" // Callback function for 'activate' signal presents window when active\n" 28624" _onActivate() {\n" 28625" this._window.present();\n" 28626" }\n" 28627"\n" 28628" // Callback function for 'startup' signal builds the UI\n" 28629" _onStartup() {\n" 28630" this._buildUI();\n" 28631" }\n" 28632"\n" 28633" // Build the application's UI\n" 28634" _buildUI() {\n" 28635"\n" 28636" // Create the application window\n" 28637" this._window = new Gtk.ApplicationWindow({\n" 28638" application: this.application,\n" 28639" window_position: Gtk.WindowPosition.CENTER,\n" 28640" border_width: 20,\n" 28641" title: \"Travel Planning\"});\n" 28642"\n" 28643" // Create a label for the first group of buttons\n" 28644" this._placeLabel = new Gtk.Label ({label: \"Where would you like to travel to?\"});\n" 28645"\n" 28646" // Create three radio buttons three different ways\n" 28647" this._place1 = new Gtk.RadioButton ({label: \"The Beach\"});\n" 28648"\n" 28649" this._place2 = Gtk.RadioButton.new_from_widget (this._place1);\n" 28650" this._place2.set_label (\"The Moon\");\n" 28651"\n" 28652" this._place3 = Gtk.RadioButton.new_with_label_from_widget (this._place1, \"Antarctica\");\n" 28653" // this._place3.set_active (true);\n" 28654"\n" 28655" // Create a label for the second group of buttons\n" 28656" this._thingLabel = new Gtk.Label ({label: \"And what would you like to bring?\" });\n" 28657"\n" 28658" // Create three more radio buttons\n" 28659" this._thing1 = new Gtk.RadioButton ({label: \"Penguins\" });\n" 28660" this._thing2 = new Gtk.RadioButton ({label: \"Sunscreen\", group: this._thing1 });\n" 28661" this._thing3 = new Gtk.RadioButton ({label: \"A spacesuit\", group: this._thing1 });\n" 28662"\n" 28663" // Create a stock OK button\n" 28664" this._okButton = new Gtk.Button ({\n" 28665" label: 'gtk-ok',\n" 28666" use_stock: 'true',\n" 28667" halign: Gtk.Align.END });\n" 28668"\n" 28669" // Connect the button to the function which handles clicking it\n" 28670" this._okButton.connect ('clicked', this._okClicked.bind(this));\n" 28671"\n" 28672" // Create a grid to put the \"place\" items in\n" 28673" this._places = new Gtk.Grid ();\n" 28674"\n" 28675" // Attach the \"place\" items to the grid\n" 28676" this._places.attach (this._placeLabel, 0, 0, 1, 1);\n" 28677" this._places.attach (this._place1, 0, 1, 1, 1);\n" 28678" this._places.attach (this._place2, 0, 2, 1, 1);\n" 28679" this._places.attach (this._place3, 0, 3, 1, 1);\n" 28680"\n" 28681" // Create a grid to put the \"thing\" items in\n" 28682" this._things = new Gtk.Grid ({ margin_top: 50 });\n" 28683"\n" 28684" // Attach the \"thing\" items to the grid\n" 28685" this._things.attach (this._thingLabel, 0, 0, 1, 1);\n" 28686" this._things.attach (this._thing1, 0, 1, 1, 1);\n" 28687" this._things.attach (this._thing2, 0, 2, 1, 1);\n" 28688" this._things.attach (this._thing3, 0, 3, 1, 1);\n" 28689"\n" 28690" // Create a grid to put everything in\n" 28691" this._grid = new Gtk.Grid ({\n" 28692" halign: Gtk.Align.CENTER,\n" 28693" valign: Gtk.Align.CENTER,\n" 28694" margin_left: 40,\n" 28695" margin_right: 50 });\n" 28696"\n" 28697" // Attach everything to the grid\n" 28698" this._grid.attach (this._places, 0, 0, 1, 1);\n" 28699" this._grid.attach (this._things, 0, 1, 1, 1);\n" 28700" this._grid.attach (this._okButton, 0, 2, 1, 1);\n" 28701"\n" 28702" // Add the grid to the window\n" 28703" this._window.add (this._grid);\n" 28704"\n" 28705" // Show the window and all child widgets\n" 28706" this._window.show_all();\n" 28707" }\n" 28708"\n" 28709" _okClicked() {\n" 28710"\n" 28711" // Create a popup that shows a silly message\n" 28712" this._travel = new Gtk.MessageDialog ({\n" 28713" transient_for: this._window,\n" 28714" modal: true,\n" 28715" message_type: Gtk.MessageType.OTHER,\n" 28716" buttons: Gtk.ButtonsType.OK,\n" 28717" text: this._messageText() });\n" 28718"\n" 28719" // Show the popup\n" 28720" this._travel.show();\n" 28721"\n" 28722" // Bind the OK button to the function that closes the popup\n" 28723" this._travel.connect (\"response\", this._clearTravelPopUp.bind(this));\n" 28724"\n" 28725" }\n" 28726"\n" 28727" _messageText() {\n" 28728"\n" 28729" // Create a silly message for the popup depending on what you selected\n" 28730" var stringMessage = \"\";\n" 28731"\n" 28732" if (this._place1.get_active()) {\n" 28733"\n" 28734" if (this._thing1.get_active())\n" 28735" stringMessage = \"Penguins love the beach, too!\";\n" 28736"\n" 28737" else if (this._thing2.get_active())\n" 28738" stringMessage = \"Make sure to put on that sunscreen!\";\n" 28739"\n" 28740" else stringMessage = \"Are you going to the beach in space?\";\n" 28741"\n" 28742" }\n" 28743"\n" 28744" else if (this._place2.get_active()) {\n" 28745"\n" 28746" if (this._thing1.get_active())\n" 28747" stringMessage = \"The penguins will take over the moon!\";\n" 28748"\n" 28749" else if (this._thing2.get_active())\n" 28750" stringMessage = \"A lack of sunscreen will be the least of your problems!\";\n" 28751"\n" 28752" else stringMessage = \"You'll probably want a spaceship, too!\";\n" 28753" }\n" 28754"\n" 28755" else if (this._place3.get_active()) {\n" 28756"\n" 28757" if (this._thing1.get_active())\n" 28758" stringMessage = \"The penguins will be happy to be back home!\";\n" 28759"\n" 28760" else if (this._thing2.get_active())\n" 28761" stringMessage = \"Antarctic sunbathing may be hazardous to your health!\";\n" 28762"\n" 28763" else stringMessage = \"Try bringing a parka instead!\";\n" 28764" }\n" 28765"\n" 28766" return stringMessage;\n" 28767"\n" 28768" }\n" 28769"\n" 28770" _clearTravelPopUp() {\n" 28771" this._travel.destroy();\n" 28772" }\n" 28773"};\n" 28774"\n" 28775"// Run the application\n" 28776"let app = new RadioButtonExample ();\n" 28777"app.application.run (ARGV);\n" 28778msgstr "" 28779 28780#. (itstool) path: item/p 28781#: C/radiobutton.js.page:278 C/statusbar.js.page:225 C/textview.js.page:252 28782msgid "" 28783"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Button.html" 28784"\">Gtk.Button</link>" 28785msgstr "" 28786 28787#. (itstool) path: item/p 28788#: C/radiobutton.js.page:279 C/scale.js.page:213 C/spinbutton.js.page:204 28789#: C/switch.js.page:270 C/textview.js.page:253 C/togglebutton.js.page:157 28790msgid "" 28791"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Grid.html" 28792"\">Gtk.Grid</link>" 28793msgstr "" 28794 28795#. (itstool) path: item/p 28796#: C/radiobutton.js.page:280 C/scale.js.page:214 C/spinbutton.js.page:205 28797#: C/switch.js.page:272 C/textview.js.page:254 28798msgid "" 28799"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Label.html" 28800"\">Gtk.Label</link>" 28801msgstr "" 28802 28803#. (itstool) path: item/p 28804#: C/radiobutton.js.page:281 C/textview.js.page:255 28805msgid "" 28806"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.RadioButton." 28807"html\">Gtk.RadioButton</link>" 28808msgstr "" 28809 28810#. (itstool) path: info/title 28811#: C/radiobutton.py.page:8 28812msgctxt "text" 28813msgid "RadioButton (Python)" 28814msgstr "RadioButton (Python)" 28815 28816#. (itstool) path: info/desc 28817#: C/radiobutton.py.page:20 28818#, fuzzy 28819msgid "Mutually exclusive buttons." 28820msgstr "%s: argumentos mutuamente exclusivos:" 28821 28822#. (itstool) path: page/p 28823#: C/radiobutton.py.page:25 28824msgid "" 28825"Three RadioButtons. You can see in the terminal if they are turned off or on." 28826msgstr "" 28827 28828#. (itstool) path: section/code 28829#: C/radiobutton.py.page:31 28830#, no-wrap 28831msgid "" 28832"from gi.repository import Gtk\n" 28833"import sys\n" 28834"\n" 28835"\n" 28836"class MyWindow(Gtk.ApplicationWindow):\n" 28837"\n" 28838" def __init__(self, app):\n" 28839" Gtk.Window.__init__(self, title=\"RadioButton Example\", application=app)\n" 28840" self.set_default_size(250, 100)\n" 28841" self.set_border_width(20)\n" 28842"\n" 28843" # a new radiobutton with a label\n" 28844" button1 = Gtk.RadioButton(label=\"Button 1\")\n" 28845" # connect the signal \"toggled\" emitted by the radiobutton\n" 28846" # with the callback function toggled_cb\n" 28847" button1.connect(\"toggled\", self.toggled_cb)\n" 28848"\n" 28849" # another radiobutton, in the same group as button1\n" 28850" button2 = Gtk.RadioButton.new_from_widget(button1)\n" 28851" # with label \"Button 2\"\n" 28852" button2.set_label(\"Button 2\")\n" 28853" # connect the signal \"toggled\" emitted by the radiobutton\n" 28854" # with the callback function toggled_cb\n" 28855" button2.connect(\"toggled\", self.toggled_cb)\n" 28856" # set button2 not active by default\n" 28857" button2.set_active(False)\n" 28858"\n" 28859" # another radiobutton, in the same group as button1,\n" 28860" # with label \"Button 3\"\n" 28861" button3 = Gtk.RadioButton.new_with_label_from_widget(\n" 28862" button1, \"Button 3\")\n" 28863" # connect the signal \"toggled\" emitted by the radiobutton\n" 28864" # with the callback function toggled_cb\n" 28865" button3.connect(\"toggled\", self.toggled_cb)\n" 28866" # set button3 not active by default\n" 28867" button3.set_active(False)\n" 28868"\n" 28869" # a grid to place the buttons\n" 28870" grid = Gtk.Grid.new()\n" 28871" grid.attach(button1, 0, 0, 1, 1)\n" 28872" grid.attach(button2, 0, 1, 1, 1)\n" 28873" grid.attach(button3, 0, 2, 1, 1)\n" 28874" # add the grid to the window\n" 28875" self.add(grid)\n" 28876"\n" 28877" # callback function\n" 28878" def toggled_cb(self, button):\n" 28879" # a string to describe the state of the button\n" 28880" state = \"unknown\"\n" 28881" # whenever the button is turned on, state is on\n" 28882" if button.get_active():\n" 28883" state = \"on\"\n" 28884" # else state is off\n" 28885" else:\n" 28886" state = \"off\"\n" 28887" # whenever the function is called (a button is turned on or off)\n" 28888" # print on the terminal which button was turned on/off\n" 28889" print(button.get_label() + \" was turned \" + state)\n" 28890"\n" 28891"\n" 28892"class MyApplication(Gtk.Application):\n" 28893"\n" 28894" def __init__(self):\n" 28895" Gtk.Application.__init__(self)\n" 28896"\n" 28897" def do_activate(self):\n" 28898" win = MyWindow(self)\n" 28899" win.show_all()\n" 28900"\n" 28901" def do_startup(self):\n" 28902" Gtk.Application.do_startup(self)\n" 28903"\n" 28904"app = MyApplication()\n" 28905"exit_status = app.run(sys.argv)\n" 28906"sys.exit(exit_status)\n" 28907msgstr "" 28908 28909#. (itstool) path: section/title 28910#: C/radiobutton.py.page:35 28911#, fuzzy 28912msgid "Useful methods for a RadioButton widget" 28913msgstr "Métodos úteis" 28914 28915#. (itstool) path: section/p 28916#: C/radiobutton.py.page:36 28917msgid "" 28918"In line 16 the signal <code>\"toggled\"</code> is connected to the callback " 28919"function <code>toggled_cb()</code> using <code><var>widget</var>." 28920"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 28921"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 28922msgstr "" 28923 28924#. (itstool) path: section/p 28925#: C/radiobutton.py.page:38 28926msgid "" 28927"As seen in <link xref=\"properties.py\"/>, instead of <code>button1 = Gtk." 28928"RadioButton(label=\"Button 1\")</code> we could create the button and label " 28929"it with" 28930msgstr "" 28931 28932#. (itstool) path: section/code 28933#: C/radiobutton.py.page:39 28934#, no-wrap 28935msgid "" 28936"\n" 28937"button1 = Gtk.RadioButton()\n" 28938"button1.set_label(\"Button 1\")." 28939msgstr "" 28940 28941#. (itstool) path: section/p 28942#: C/radiobutton.py.page:42 28943msgid "" 28944"Yet another way to create a new RadioButton with a label is <code>button1 = " 28945"Gtk.RadioButton.new_with_label(None, \"Button 1\")</code> (the first " 28946"argument is the group of the radiobuttons, which we can get with " 28947"<code>get_group()</code>, the second argument is the label)." 28948msgstr "" 28949 28950#. (itstool) path: item/p 28951#: C/radiobutton.py.page:51 28952msgid "" 28953"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkRadioButton.html" 28954"\">GtkRadioButton</link>" 28955msgstr "" 28956 28957#. (itstool) path: info/title 28958#: C/radiobutton.vala.page:8 28959msgctxt "text" 28960msgid "RadioButton (Vala)" 28961msgstr "RadioButton (Vala)" 28962 28963#. (itstool) path: info/desc 28964#: C/radiobutton.vala.page:21 28965#, fuzzy 28966msgid "A choice from multiple CheckButtons." 28967msgstr "Respostas de múltiplas escolhas para músicas" 28968 28969#. (itstool) path: page/p 28970#: C/radiobutton.vala.page:26 28971#, fuzzy 28972msgid "These RadioButtons report their activity in the terminal." 28973msgstr " -u USUÁRIO Relatório de atividades somente para o usuário" 28974 28975#. (itstool) path: page/code 28976#: C/radiobutton.vala.page:28 28977#, no-wrap 28978msgid "" 28979"public class MyWindow : Gtk.ApplicationWindow {\n" 28980"\tinternal MyWindow (MyApplication app) {\n" 28981"\t\tObject (application: app, title: \"RadioButton Example\");\n" 28982"\n" 28983"\t\tthis.border_width = 20;\n" 28984"\t\tthis.set_default_size (250, 100);\n" 28985"\n" 28986"\t\t/* We demonstrate 3 different RadioButton creation methods */\n" 28987"\n" 28988"\t\t//Create a Radio Button\n" 28989"\t\tvar button1 = new Gtk.RadioButton (null);\n" 28990"\t\tbutton1.set_label (\"Button 1\");\n" 28991"\n" 28992"\t\t//Create a RadioButton with a label, and add it to the same group as button1.\n" 28993"\t\tvar button2 = new Gtk.RadioButton.with_label (button1.get_group(),\"Button 2\");\n" 28994"\n" 28995"\t\t//Create a RadioButton with a label, adding it to button1's group.\n" 28996"\t\tvar button3 = new Gtk.RadioButton.with_label_from_widget (button1, \"Button 3\");\n" 28997"\n" 28998"\t\t//Attach the buttons to a grid.\n" 28999"\t\tvar grid = new Gtk.Grid ();\n" 29000"\t\tgrid.attach (button1, 0, 0, 1, 1);\n" 29001"\t\tgrid.attach (button2, 0, 1, 1, 1);\n" 29002"\t\tgrid.attach (button3, 0, 2, 1, 1);\n" 29003"\n" 29004"\t\t//Add the button to the window.\n" 29005"\t\tthis.add (grid);\n" 29006"\n" 29007"\t\t//Connect the signal handlers (aka. callback functions) to the buttons.\n" 29008"\t\tbutton1.toggled.connect (button_toggled_cb);\n" 29009"\t\tbutton2.toggled.connect (button_toggled_cb);\n" 29010"\t\tbutton3.toggled.connect (button_toggled_cb);\n" 29011"\t}\n" 29012"\n" 29013"\tvoid button_toggled_cb (Gtk.ToggleButton button)\n" 29014"\t{\n" 29015"\t\tvar state = \"unknown\";\n" 29016"\n" 29017"\t\tif (button.get_active ())\n" 29018"\t\t\tstate = \"on\";\n" 29019"\t\telse {\n" 29020"\t\t\tstate = \"off\";\n" 29021"\t\t\tprint (\"\\n\");\n" 29022"\t\t}\n" 29023"\t\tprint (button.get_label() + \" was turned \" + state + \"\\n\");\n" 29024"\t}\n" 29025"}\n" 29026"\n" 29027"public class MyApplication : Gtk.Application {\n" 29028"\tprotected override void activate () {\n" 29029"\n" 29030"\t\t//Show all of the things.\n" 29031"\t\tnew MyWindow (this).show_all ();\n" 29032"\t}\n" 29033"\n" 29034"\tinternal MyApplication () {\n" 29035"\t\tObject (application_id: \"org.example.MyApplication\");\n" 29036"\t}\n" 29037"}\n" 29038"\n" 29039"public int main (string[] args) {\n" 29040"\treturn new MyApplication ().run (args);\n" 29041"}\n" 29042msgstr "" 29043 29044#. (itstool) path: item/p 29045#: C/radiobutton.vala.page:33 29046msgid "" 29047"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.RadioButton.html\">Gtk." 29048"RadioButton</link>" 29049msgstr "" 29050 29051#. (itstool) path: info/title 29052#: C/record-collection.js.page:8 29053#, fuzzy 29054msgctxt "text" 29055msgid "Record collection (JavaScript)" 29056msgstr "Coleção:" 29057 29058#. (itstool) path: info/desc 29059#: C/record-collection.js.page:11 29060msgid "Create a small database application for ordering your music collection" 29061msgstr "" 29062 29063#. (itstool) path: page/title 29064#: C/record-collection.js.page:29 29065#, fuzzy 29066msgid "Record collection" 29067msgstr "_Gravar" 29068 29069#. (itstool) path: item/p 29070#: C/record-collection.js.page:34 29071msgid "How to connect to a database using libgda" 29072msgstr "" 29073 29074#. (itstool) path: item/p 29075#: C/record-collection.js.page:35 29076msgid "How to insert and browse records in a database table" 29077msgstr "" 29078 29079#. (itstool) path: section/p 29080#: C/record-collection.js.page:41 29081msgid "" 29082"This demo uses the Javascript language. We are going to demonstrate how to " 29083"connect and use a database from a GTK program, by using the GDA (GNOME Data " 29084"Access) library. Thus you also need this library installed." 29085msgstr "" 29086 29087#. (itstool) path: section/p 29088#: C/record-collection.js.page:44 29089msgid "" 29090"GNOME Data Access (GDA) is library whose purpose is to provide universal " 29091"access to different kinds and types of data sources. This goes from " 29092"traditional relational database systems, to any imaginable kind of data " 29093"source such as a mail server, a LDAP directory, etc. For more information, " 29094"and for a full API and documentation, visit the <link href=\"http://library." 29095"gnome.org/devel/libgda/stable/\">GDA website</link>." 29096msgstr "" 29097 29098#. (itstool) path: section/p 29099#: C/record-collection.js.page:47 29100msgid "" 29101"Although a big part of the code is related to user interface (GUI), we are " 29102"going to focus our tutorial on the database parts (we might mention other " 29103"parts we think are relevant though). To know more about Javascript programs " 29104"in GNOME, see the <link xref=\"image-viewer.js\">Image Viewer program</link> " 29105"tutorial." 29106msgstr "" 29107 29108#. (itstool) path: item/p 29109#: C/record-collection.js.page:60 29110msgid "" 29111"Choose <gui>Generic Javascript</gui> from the <gui>JS</gui> tab, click " 29112"<gui>Forward</gui>, and fill-out your details on the next few pages. Use " 29113"<file>record-collection</file> as project name and directory." 29114msgstr "" 29115 29116#. (itstool) path: item/p 29117#: C/record-collection.js.page:63 29118msgid "" 29119"Click <gui>Finished</gui> and the project will be created for you. Open " 29120"<file>src/main.js</file> from the <gui>Project</gui> or <gui>File</gui> " 29121"tabs. It contains very basic example code." 29122msgstr "" 29123 29124#. (itstool) path: section/title 29125#: C/record-collection.js.page:69 29126#, fuzzy 29127msgid "Program Structure" 29128msgstr "Estrutura" 29129 29130#. (itstool) path: section/media 29131#. This is a reference to an external file such as an image or video. When 29132#. the file changes, the md5 hash will change to let you know you need to 29133#. update your localized copy. The msgstr is not used at all. Set it to 29134#. whatever you like once you have updated your copy of the file. 29135#: C/record-collection.js.page:70 29136msgctxt "_" 29137msgid "" 29138"external ref='media/record-collection.png' " 29139"md5='2d645997687ed5aacd36aafafc16e072'" 29140msgstr "" 29141 29142#. (itstool) path: section/p 29143#: C/record-collection.js.page:71 29144msgid "" 29145"This demo is a simple GTK application (with a single window) capable of " 29146"inserting records into a database table as well as browsing all records of " 29147"the table. The table has two fields: <code>id</code>, an integer, and " 29148"<code>name</code>, a varchar. The first section (on the top) of the " 29149"application allows you to insert a record into the table. The last section " 29150"(bottom) allows you to see all the records of that table. Its content is " 29151"refreshed every time a new record is inserted and on the application startup." 29152msgstr "" 29153 29154#. (itstool) path: section/title 29155#: C/record-collection.js.page:76 29156#, fuzzy 29157msgid "Starting the fun" 29158msgstr "Diversão" 29159 29160#. (itstool) path: section/p 29161#: C/record-collection.js.page:77 29162msgid "Let's start by examining the skeleton of the program:" 29163msgstr "" 29164 29165#. (itstool) path: section/code 29166#: C/record-collection.js.page:78 29167#, no-wrap 29168msgid "" 29169"\n" 29170"const GLib = imports.gi.GLib;\n" 29171"const Gtk = imports.gi.Gtk;\n" 29172"const Gda = imports.gi.Gda;\n" 29173"const Lang = imports.lang;\n" 29174"\n" 29175"function Demo () {\n" 29176" this._init ();\n" 29177"}\n" 29178"\n" 29179"Demo.prototype = {\n" 29180"\n" 29181" _init: function () {\n" 29182" this.setupWindow ();\n" 29183" this.setupDatabase ();\n" 29184" this.selectData ();\n" 29185" }\n" 29186"}\n" 29187"\n" 29188"Gtk.init (null, null);\n" 29189"\n" 29190"var demo = new Demo ();\n" 29191"\n" 29192"Gtk.main ();" 29193msgstr "" 29194 29195#. (itstool) path: item/p 29196#: C/record-collection.js.page:103 29197msgid "" 29198"Lines 1‒4: Initial imports. Pay special attention to line 3, which tells " 29199"Javascript to import the GDA library, our focus in this tutorial." 29200msgstr "" 29201 29202#. (itstool) path: item/p 29203#: C/record-collection.js.page:104 29204msgid "" 29205"Lines 6‒17: Define our <code>Demo</code> class. Pay special attention to " 29206"lines 13‒15, where we call 3 methods which will do the whole job. They will " 29207"be detailed below." 29208msgstr "" 29209 29210#. (itstool) path: item/p 29211#: C/record-collection.js.page:105 29212msgid "Lines 19‒23: Start the application." 29213msgstr "" 29214 29215#. (itstool) path: section/title 29216#: C/record-collection.js.page:110 29217#, fuzzy 29218msgid "Designing the application" 29219msgstr "" 29220"Mais informações sobre como criar um ícone de aplicativo podem ser " 29221"encontradas abaixo, na seção personalizada de ícones de cores." 29222 29223#. (itstool) path: section/p 29224#: C/record-collection.js.page:111 29225msgid "" 29226"Let's take a look at the <code>setupWindow</code> method. It is responsible " 29227"for creating the User Interface (UI). As UI is not our focus, we will " 29228"explain only the relevant parts." 29229msgstr "" 29230 29231#. (itstool) path: section/code 29232#: C/record-collection.js.page:112 29233#, no-wrap 29234msgid "" 29235"\n" 29236" setupWindow: function () {\n" 29237" this.window = new Gtk.Window ({title: \"Data Access Demo\", height_request: 350});\n" 29238" this.window.connect (\"delete-event\", function () {\n" 29239" Gtk.main_quit();\n" 29240" return true;\n" 29241" });\n" 29242"\n" 29243" // main box\n" 29244" var main_box = new Gtk.Box ({orientation: Gtk.Orientation.VERTICAL, spacing: 5});\n" 29245" this.window.add (main_box);\n" 29246"\n" 29247" // first label\n" 29248" var info1 = new Gtk.Label ({label: \"<b>Insert a record</b>\", xalign: 0, use_markup: true});\n" 29249" main_box.pack_start (info1, false, false, 5);\n" 29250"\n" 29251" // \"insert a record\" horizontal box\n" 29252" var insert_box = new Gtk.Box ({orientation: Gtk.Orientation.HORIZONTAL, spacing: 5});\n" 29253" main_box.pack_start (insert_box, false, false, 5);\n" 29254"\n" 29255" // ID field\n" 29256" insert_box.pack_start (new Gtk.Label ({label: \"ID:\"}), false, false, 5);\n" 29257" this.id_entry = new Gtk.Entry ();\n" 29258" insert_box.pack_start (this.id_entry, false, false, 5);\n" 29259"\n" 29260" // Name field\n" 29261" insert_box.pack_start (new Gtk.Label ({label: \"Name:\"}), false, false, 5);\n" 29262" this.name_entry = new Gtk.Entry ({activates_default: true});\n" 29263" insert_box.pack_start (this.name_entry, true, true, 5);\n" 29264"\n" 29265" // Insert button\n" 29266" var insert_button = new Gtk.Button ({label: \"Insert\", can_default: true});\n" 29267" insert_button.connect (\"clicked\", Lang.bind (this, this._insertClicked));\n" 29268" insert_box.pack_start (insert_button, false, false, 5);\n" 29269" insert_button.grab_default ();\n" 29270"\n" 29271" // Browse textview\n" 29272" var info2 = new Gtk.Label ({label: \"<b>Browse the table</b>\", xalign: 0, use_markup: true});\n" 29273" main_box.pack_start (info2, false, false, 5);\n" 29274" this.text = new Gtk.TextView ({editable: false});\n" 29275" var sw = new Gtk.ScrolledWindow ({shadow_type:Gtk.ShadowType.IN});\n" 29276" sw.add (this.text);\n" 29277" main_box.pack_start (sw, true, true, 5);\n" 29278"\n" 29279" this.count_label = new Gtk.Label ({label: \"\", xalign: 0, use_markup: true});\n" 29280" main_box.pack_start (this.count_label, false, false, 0);\n" 29281"\n" 29282" this.window.show_all ();\n" 29283" }," 29284msgstr "" 29285 29286#. (itstool) path: item/p 29287#: C/record-collection.js.page:162 29288msgid "" 29289"Lines 22 and 27: Create the 2 entries (for the two fields) in which users " 29290"will type something to get inserted in the database." 29291msgstr "" 29292 29293#. (itstool) path: item/p 29294#: C/record-collection.js.page:163 29295msgid "" 29296"Lines 31‒34: Create the Insert button. We connect its <code>clicked</code> " 29297"signal to the <code>_insertClicked</code> private method of the class. This " 29298"method is detailed below." 29299msgstr "" 29300 29301#. (itstool) path: item/p 29302#: C/record-collection.js.page:164 29303msgid "" 29304"Line 39: Create the widget (<code>TextView</code>) where we will show the " 29305"contents of the table." 29306msgstr "" 29307 29308#. (itstool) path: item/p 29309#: C/record-collection.js.page:165 29310msgid "" 29311"Line 44: Create the label where we will show the number of records in the " 29312"table. Initially it's empty, it will be updated later." 29313msgstr "" 29314 29315#. (itstool) path: section/title 29316#: C/record-collection.js.page:170 29317#, fuzzy 29318msgid "Connecting to and initializing the database" 29319msgstr "Erro ao iniciar o banco de dados com senha" 29320 29321#. (itstool) path: section/p 29322#: C/record-collection.js.page:171 29323msgid "" 29324"The code which makes the connection to the database is in the " 29325"<code>setupDatabase</code> method below:" 29326msgstr "" 29327 29328#. (itstool) path: section/code 29329#: C/record-collection.js.page:174 29330#, no-wrap 29331msgid "" 29332"\n" 29333" setupDatabase: function () {\n" 29334" this.connection = new Gda.Connection ({provider: Gda.Config.get_provider(\"SQLite\"),\n" 29335" cnc_string:\"DB_DIR=\" + GLib.get_home_dir () + \";DB_NAME=gnome_demo\"});\n" 29336" this.connection.open ();\n" 29337"\n" 29338" try {\n" 29339" var dm = this.connection.execute_select_command (\"select * from demo\");\n" 29340" } catch (e) {\n" 29341" this.connection.execute_non_select_command (\"create table demo (id integer, name varchar(100))\");\n" 29342" }\n" 29343" }," 29344msgstr "" 29345 29346#. (itstool) path: item/p 29347#: C/record-collection.js.page:188 29348msgid "" 29349"Lines 2‒3: Create the GDA's <code>Connection</code> object. We must supply " 29350"to its constructor some properties:" 29351msgstr "" 29352 29353#. (itstool) path: item/p 29354#: C/record-collection.js.page:191 29355msgid "" 29356"<code>provider</code>: One of GDA's supported providers. GDA supports " 29357"SQLite, MySQL, PostgreSQL, Oracle and many others. For demo purposes we will " 29358"use a SQLite database, as it comes installed by default in most " 29359"distributions and it is simple to use (it just uses a file as a database)." 29360msgstr "" 29361 29362#. (itstool) path: item/p 29363#: C/record-collection.js.page:194 29364msgid "" 29365"<code>cnc_string</code>: The connection string. It may change from provider " 29366"to provider. The syntax for SQLite is: <code>DB_DIR=<var>PATH</var>;" 29367"DB_NAME=<var>FILENAME</var></code>. In this demo we are accessing a database " 29368"called gnome_demo in the user home dir (note the call to GLib's " 29369"<code>get_home_dir</code> function)." 29370msgstr "" 29371 29372#. (itstool) path: note/p 29373#: C/record-collection.js.page:198 29374msgid "" 29375"If the provider is not supported by GDA, or if the connection string is " 29376"missing some element, line 2 will raise an exception. So, in real life we " 29377"should handle it with JavaScript's statement <code>try</code>...<code>catch</" 29378"code>." 29379msgstr "" 29380 29381#. (itstool) path: item/p 29382#: C/record-collection.js.page:202 29383msgid "" 29384"Line 4: Open the connection. In the SQLite provider, if the database does " 29385"not exist, it will be created in this step." 29386msgstr "" 29387 29388#. (itstool) path: item/p 29389#: C/record-collection.js.page:204 29390msgid "" 29391"Lines 6‒10: Try to do a simple select to check if the table exists (line 7). " 29392"If it does not exist (because the database was just created), this command " 29393"will raise an exception, which is handled by the <code>try</code>..." 29394"<code>catch</code> block. If it is the case, we run the create table " 29395"statement (line 9)." 29396msgstr "" 29397 29398#. (itstool) path: item/p 29399#: C/record-collection.js.page:205 29400msgid "" 29401"In order to run the SQL commands above we are using the GDA connection " 29402"methods <code>execute_select_command</code> and " 29403"<code>execute_non_select_command</code>. They are simple to use, and just " 29404"require two arguments: The <code>Connection</code> object and the SQL " 29405"command to be parsed." 29406msgstr "" 29407 29408#. (itstool) path: section/p 29409#: C/record-collection.js.page:209 29410msgid "At this point we have the database set up, and are ready to use it." 29411msgstr "" 29412 29413#. (itstool) path: section/title 29414#: C/record-collection.js.page:213 29415#, fuzzy 29416msgid "Selecting" 29417msgstr "Selecionando e copiando texto" 29418 29419#. (itstool) path: section/p 29420#: C/record-collection.js.page:214 29421msgid "" 29422"After connecting to the database, our demo's constructor calls the " 29423"<code>selectData</code> method. It is responsible for getting all the " 29424"records in the table and showing them on the <code>TextView</code> widget. " 29425"Let's take a look at it:" 29426msgstr "" 29427 29428#. (itstool) path: section/code 29429#: C/record-collection.js.page:217 29430#, no-wrap 29431msgid "" 29432"\n" 29433" selectData: function () {\n" 29434" var dm = this.connection.execute_select_command (\"select * from demo order by 1, 2\");\n" 29435" var iter = dm.create_iter ();\n" 29436"\n" 29437" var text = \"\";\n" 29438"\n" 29439" while (iter.move_next ()) {\n" 29440" var id_field = Gda.value_stringify (iter.get_value_at (0));\n" 29441" var name_field = Gda.value_stringify (iter.get_value_at (1));\n" 29442"\n" 29443" text += id_field + \"\\t=>\\t\" + name_field + '\\n';\n" 29444" }\n" 29445"\n" 29446" this.text.buffer.text = text;\n" 29447" this.count_label.label = \"<i>\" + dm.get_n_rows () + \" record(s)</i>\";\n" 29448" }," 29449msgstr "" 29450 29451#. (itstool) path: item/p 29452#: C/record-collection.js.page:235 29453msgid "" 29454"Line 2: The <code>SELECT</code> command. We are using the GDA connection's " 29455"<code>execute_select_command</code> method for that. It returns a " 29456"<code>DataModel</code> object, which is later used to retrieve the rows." 29457msgstr "" 29458 29459#. (itstool) path: item/p 29460#: C/record-collection.js.page:236 29461msgid "" 29462"Line 3: Create an <code>Iter</code> object, which is used to iterate over " 29463"the <code>DataModel</code>'s records." 29464msgstr "" 29465 29466#. (itstool) path: item/p 29467#: C/record-collection.js.page:237 29468msgid "" 29469"Line 7: Loop through all the records, fetching them with the help of the " 29470"<code>Iter</code> object. At this point, the <code>iter</code> variable " 29471"contains the actual, retrieved data. Its <code>move_next</code> method " 29472"returns <code>false</code> when it reaches the last record." 29473msgstr "" 29474 29475#. (itstool) path: item/p 29476#: C/record-collection.js.page:239 29477msgid "Lines 8‒9: We do two things in each line:" 29478msgstr "" 29479 29480#. (itstool) path: item/p 29481#: C/record-collection.js.page:241 29482msgid "" 29483"Use <code>Iter</code>'s method <code>get_value_at</code>, which requires " 29484"only one argument: the column number to retrieve, starting at 0. As our " 29485"<code>SELECT</code> command returns only two columns, we are retrieving " 29486"columns 0 and 1." 29487msgstr "" 29488 29489#. (itstool) path: item/p 29490#: C/record-collection.js.page:242 29491msgid "" 29492"The method <code>get_value_at</code> returns the field in GLib's " 29493"<code>GValue</code> format. A simple way to convert this format to a string " 29494"is by using GDA's global function <code>value_stringify</code>. That's what " 29495"we are doing here, and we store the results in the variables <code>id_field</" 29496"code> and <code>name_field</code>." 29497msgstr "" 29498 29499#. (itstool) path: item/p 29500#: C/record-collection.js.page:245 29501msgid "" 29502"Line 11: Concatenate the two fields to make one text line, separated by " 29503"<code>\"=>\"</code>, and store it in the <code>text</code> variable." 29504msgstr "" 29505 29506#. (itstool) path: item/p 29507#: C/record-collection.js.page:246 29508msgid "" 29509"Line 14: After the loop is finished, we have all the records formatted in " 29510"the <code>text</code> variable. In this line we just set the contents of the " 29511"<code>TextView</code> with that variable." 29512msgstr "" 29513 29514#. (itstool) path: item/p 29515#: C/record-collection.js.page:247 29516msgid "" 29517"Line 15: Display the number of records in the table, making use of the " 29518"<code>DataModel</code>'s <code>get_n_rows</code> method." 29519msgstr "" 29520 29521#. (itstool) path: section/title 29522#: C/record-collection.js.page:252 29523#, fuzzy 29524msgid "Inserting" 29525msgstr "erro ao inserir na área de pesquisa" 29526 29527#. (itstool) path: section/p 29528#: C/record-collection.js.page:253 29529msgid "" 29530"OK, we know how to connect to a database and how to select rows from a " 29531"table. Now it's time to do an <code>INSERT</code> on the table. Do you " 29532"remember above, in the method <code>setupWindow</code> we connected the " 29533"<gui>Insert</gui> button's <code>clicked</code> signal to the method " 29534"<code>_insertClicked</code>? Let's see the implementation of this method." 29535msgstr "" 29536 29537#. (itstool) path: section/code 29538#: C/record-collection.js.page:256 29539#, no-wrap 29540msgid "" 29541"\n" 29542" _insertClicked: function () {\n" 29543" if (!this._validateFields ())\n" 29544" return;\n" 29545"\n" 29546" // Gda.execute_non_select_command (this.connection,\n" 29547" // \"insert into demo values ('\" + this.id_entry.text + \"', '\" + this.name_entry.text + \"')\");\n" 29548"\n" 29549" var b = new Gda.SqlBuilder ({stmt_type:Gda.SqlStatementType.INSERT});\n" 29550" b.set_table (\"demo\");\n" 29551" b.add_field_value_as_gvalue (\"id\", this.id_entry.text);\n" 29552" b.add_field_value_as_gvalue (\"name\", this.name_entry.text);\n" 29553" var stmt = b.get_statement ();\n" 29554" this.connection.statement_execute_non_select (stmt, null);\n" 29555"\n" 29556" this._clearFields ();\n" 29557" this.selectData ();\n" 29558" }," 29559msgstr "" 29560 29561#. (itstool) path: section/p 29562#: C/record-collection.js.page:274 29563msgid "" 29564"We have learned how to use the GDA connection's methods " 29565"<code>execute_select_command</code> and <code>execute_non_select_command</" 29566"code> to quickly execute SQL commands on the database. GDA allows one to " 29567"build a SQL statement indirectly, by using its <code>SqlBuilder</code> " 29568"object. What are the benefits of this? GDA will generate the SQL statement " 29569"dynamically, and it will be valid for the connection provider used (it will " 29570"use the same SQL dialect the provider uses). Let's study the code:" 29571msgstr "" 29572 29573#. (itstool) path: item/p 29574#: C/record-collection.js.page:278 29575msgid "" 29576"Lines 2‒3: Check if the user filled all the fields. The code for the private " 29577"method <code>_validateFields</code> is really simple and you can read it in " 29578"the full demo source code." 29579msgstr "" 29580 29581#. (itstool) path: item/p 29582#: C/record-collection.js.page:279 29583msgid "" 29584"Line 5: The faster way of doing the <code>INSERT</code>. It's commented out " 29585"as we want to show how to use the <code>SqlBuilder</code> object to build a " 29586"SQL statement portable across databases." 29587msgstr "" 29588 29589#. (itstool) path: item/p 29590#: C/record-collection.js.page:280 29591msgid "" 29592"Line 7: Create the <code>SqlBuilder</code> object. We must pass the type of " 29593"statement we are going to build. It can be <code>SELECT</code>, " 29594"<code>UPDATE</code>, <code>INSERT</code> or <code>DELETE</code>." 29595msgstr "" 29596 29597#. (itstool) path: item/p 29598#: C/record-collection.js.page:281 29599msgid "" 29600"Line 8: Set the name of the table on which the built statement will operate " 29601"(it will generate <code>INSERT INTO demo</code>)" 29602msgstr "" 29603 29604#. (itstool) path: item/p 29605#: C/record-collection.js.page:282 29606msgid "" 29607"Lines 9‒10: Set the fields and its values that will be part of the " 29608"statement. The first argument is the field name (as in the table). The " 29609"second one is the value for that field." 29610msgstr "" 29611 29612#. (itstool) path: item/p 29613#: C/record-collection.js.page:283 29614msgid "" 29615"Line 11: Get the dynamically generated <code>Statement</code> object, which " 29616"represents a SQL statement." 29617msgstr "" 29618 29619#. (itstool) path: item/p 29620#: C/record-collection.js.page:284 29621msgid "Line 12: Finally, execute the SQL statement (<code>INSERT</code>)." 29622msgstr "" 29623 29624#. (itstool) path: item/p 29625#: C/record-collection.js.page:285 29626msgid "" 29627"Line 14: Clear the id and name fields on the screen. The code for the " 29628"private method <code>_clearFields</code> is really simple and you can read " 29629"it in the full demo source code." 29630msgstr "" 29631 29632#. (itstool) path: item/p 29633#: C/record-collection.js.page:286 29634msgid "" 29635"Line 15: Refresh the view on the screen by doing another <code>SELECT</code>." 29636msgstr "" 29637 29638#. (itstool) path: note/p 29639#: C/record-collection.js.page:288 29640msgid "" 29641"You can also make use of parameters while building the statement. By using " 29642"the <code>SqlBuilder</code> objects and parameters you are less subject to " 29643"attacks like SQL injection. Check the <link href=\"http://library.gnome.org/" 29644"devel/libgda/stable/\">GDA documentation</link> for more information about " 29645"parameters." 29646msgstr "" 29647 29648#. (itstool) path: section/p 29649#: C/record-collection.js.page:293 29650msgid "" 29651"All of the code you need should now be in place, so try running the code. " 29652"You now have a database for your record collection!" 29653msgstr "" 29654 29655#. (itstool) path: section/p 29656#: C/record-collection.js.page:298 29657msgid "" 29658"If you run into problems with the tutorial, compare your code with this " 29659"<link href=\"record-collection/record-collection.js\">reference code</link>." 29660msgstr "" 29661 29662#. (itstool) path: page/title 29663#: C/response-type.page:17 29664#, fuzzy 29665msgid "enum ResponseType" 29666msgstr "Enum" 29667 29668#. (itstool) path: item/title 29669#: C/response-type.page:21 29670msgid "ResponseType.NONE = -1" 29671msgstr "ResponseType.NONE = -1" 29672 29673#. (itstool) path: item/p 29674#: C/response-type.page:22 29675msgid "" 29676"Returned if an action widget has no response id, or if the dialog gets " 29677"programmatically hidden or destroyed" 29678msgstr "" 29679 29680#. (itstool) path: item/title 29681#: C/response-type.page:25 29682msgid "ResponseType.REJECT = -2" 29683msgstr "ResponseType.REJECT = -2" 29684 29685#. (itstool) path: item/p 29686#: C/response-type.page:26 C/response-type.page:30 29687msgid "Generic response id, not used by GTK+ dialogs" 29688msgstr "" 29689 29690#. (itstool) path: item/title 29691#: C/response-type.page:29 29692msgid "ResponseType.ACCEPT = -3" 29693msgstr "ResponseType.ACCEPT = -3" 29694 29695#. (itstool) path: item/title 29696#: C/response-type.page:33 29697msgid "ResponseType.DELETE_EVENT = -4" 29698msgstr "ResponseType.DELETE_EVENT = -4" 29699 29700#. (itstool) path: item/p 29701#: C/response-type.page:34 29702msgid "Returned if the dialog is deleted" 29703msgstr "" 29704 29705#. (itstool) path: item/title 29706#: C/response-type.page:37 29707msgid "ResponseType.OK = -5" 29708msgstr "ResponseType.OK = -5" 29709 29710#. (itstool) path: item/p 29711#: C/response-type.page:38 29712msgid "Returned by OK buttons in GTK+ dialogs" 29713msgstr "" 29714 29715#. (itstool) path: item/title 29716#: C/response-type.page:41 29717msgid "ResponseType.CANCEL = -6" 29718msgstr "ResponseType.CANCEL = -6" 29719 29720#. (itstool) path: item/p 29721#: C/response-type.page:42 29722msgid "Returned by Cancel buttons in GTK+ dialogs" 29723msgstr "" 29724 29725#. (itstool) path: item/title 29726#: C/response-type.page:45 29727msgid "ResponseType.CLOSE = -7" 29728msgstr "ResponseType.CLOSE = -7" 29729 29730#. (itstool) path: item/p 29731#: C/response-type.page:46 29732msgid "Returned by Close buttons in GTK+ dialogs" 29733msgstr "" 29734 29735#. (itstool) path: item/title 29736#: C/response-type.page:49 29737msgid "ResponseType.YES = -8" 29738msgstr "ResponseType.YES = -8" 29739 29740#. (itstool) path: item/p 29741#: C/response-type.page:50 29742msgid "Returned by Yes buttons in GTK+ dialogs" 29743msgstr "" 29744 29745#. (itstool) path: item/title 29746#: C/response-type.page:53 29747msgid "ResponseType.NO = -9" 29748msgstr "ResponseType.NO = -9" 29749 29750#. (itstool) path: item/p 29751#: C/response-type.page:54 29752msgid "Returned by No buttons in GTK+ dialogs" 29753msgstr "" 29754 29755#. (itstool) path: item/title 29756#: C/response-type.page:57 29757msgid "ResponseType.APPLY = -10" 29758msgstr "ResponseType.APPLY = -10" 29759 29760#. (itstool) path: item/p 29761#: C/response-type.page:58 29762msgid "Returned by Apply buttons in GTK+ dialogs" 29763msgstr "" 29764 29765#. (itstool) path: item/title 29766#: C/response-type.page:61 29767msgid "ResponseType.HELP = -11" 29768msgstr "ResponseType.HELP = -11" 29769 29770#. (itstool) path: item/p 29771#: C/response-type.page:62 29772msgid "Returned by Help buttons in GTK+ dialogs" 29773msgstr "" 29774 29775#. (itstool) path: info/title 29776#: C/scale.c.page:8 29777#, fuzzy 29778msgctxt "text" 29779msgid "Scale (C)" 29780msgstr "" 29781"Chamado assim após o astrônomo Anders Celsius, que foi quem inventou a " 29782"escala original em 1742, a escala Celsius é uma unidade padrão internacional " 29783"e hoje em dia é definida usando a escala Kelvin. 0 °C é equivalente a 273,15 " 29784"K e 1 °C de diferença na temperatura é exatamente a mesma diferença em 1 K. " 29785"É definido com o ponto de derretimento do gelo sendo por volta de 0 °C e " 29786"ponto de ebulição em 100 °C em uma atmosfera padrão (1 atm = 1013,5 hPa). " 29787"Até 1948, a unidade era conhecida como <i>centígrado</i> (de Latim " 29788"<i>centum</i> (100) e <i>gradus</i> (passo).\n" 29789"Na meteorologia e dia-a-dia, a escala Celsius é muito conveniente para " 29790"expressar temperaturas porque seus números podem um indicador fácil para a " 29791"formação de gelo preto e neve." 29792 29793#. (itstool) path: info/desc 29794#: C/scale.c.page:20 C/scale.py.page:20 C/scale.vala.page:20 29795msgid "A slider widget for selecting a value from a range" 29796msgstr "" 29797 29798#. (itstool) path: page/title 29799#: C/scale.c.page:23 C/scale.js.page:21 C/scale.py.page:23 C/scale.vala.page:23 29800#, fuzzy 29801msgid "Scale" 29802msgstr "Escalar" 29803 29804#. (itstool) path: page/media 29805#. This is a reference to an external file such as an image or video. When 29806#. the file changes, the md5 hash will change to let you know you need to 29807#. update your localized copy. The msgstr is not used at all. Set it to 29808#. whatever you like once you have updated your copy of the file. 29809#: C/scale.c.page:25 29810msgctxt "_" 29811msgid "external ref='media/scale2.png' md5='ae2ba0a6675f3d9cdcd961cdf32f1a5c'" 29812msgstr "external ref='media/scale2.png' md5='ae2ba0a6675f3d9cdcd961cdf32f1a5c'" 29813 29814#. (itstool) path: page/p 29815#: C/scale.c.page:26 C/scale.py.page:25 C/scale.vala.page:25 29816#, fuzzy 29817msgid "Slide the scales!" 29818msgstr "Escalas" 29819 29820#. (itstool) path: page/code 29821#: C/scale.c.page:28 29822#, no-wrap 29823msgid "" 29824"\n" 29825"#include <gtk/gtk.h>\n" 29826"\n" 29827"\n" 29828"\n" 29829"/* This is the callback function. \n" 29830" * It is a handler function which reacts to the signal. \n" 29831" * In this case, it will notify the user the value of their scale as a label.\n" 29832" */\n" 29833"static void\n" 29834"hscale_moved (GtkRange *range,\n" 29835" gpointer user_data)\n" 29836"{\n" 29837" GtkWidget *label = user_data;\n" 29838"\n" 29839" /* Get the value of the range, and convert it into a string which will be\n" 29840" * used as a new label for the horizontal scale.\n" 29841" * %.0f - stands for a double that will have 0 decimal places.\n" 29842" */\n" 29843" gdouble pos = gtk_range_get_value (range);\n" 29844" /* Note: Using g_strdup_printf returns a string that must be freed. \n" 29845" * (In which is done below)\n" 29846" */\n" 29847" gchar *str = g_strdup_printf (\"Horizontal scale is %.0f\", pos);\n" 29848" gtk_label_set_text (GTK_LABEL (label), str);\n" 29849"\n" 29850" g_free(str);\n" 29851"}\n" 29852"\n" 29853"\n" 29854"\n" 29855"/* This is the second callback function. It is a handler function which \n" 29856" * reacts to the signal. It does the same thing as the function above, except with\n" 29857" * the vertical scale.\n" 29858" */\n" 29859"vscale_moved (GtkRange *range,\n" 29860" gpointer user_data)\n" 29861"{\n" 29862" GtkWidget *label = user_data;\n" 29863" \n" 29864" gdouble pos = gtk_range_get_value (range);\n" 29865" /* %.1f - stands for a double that will have 1 decimal place */\n" 29866" gchar *str = g_strdup_printf (\"Vertical scale is %.1f\", pos);\n" 29867" gtk_label_set_text (GTK_LABEL (label), str);\n" 29868"\n" 29869" \n" 29870" g_free (str);\n" 29871"}\n" 29872"\n" 29873"\n" 29874"\n" 29875"static void\n" 29876"activate (GtkApplication *app,\n" 29877" gpointer user_data)\n" 29878"{\n" 29879" /* Declare variables */\n" 29880" GtkWidget *window;\n" 29881" GtkWidget *h_scale;\n" 29882" GtkWidget *v_scale;\n" 29883" GtkWidget *hlabel;\n" 29884" GtkWidget *vlabel;\n" 29885" GtkWidget *grid;\n" 29886"\n" 29887" /* The Adjustment object represents a value \n" 29888" * which has an associated lower and upper bound.\n" 29889" */\n" 29890" GtkAdjustment *hadjustment;\n" 29891" GtkAdjustment *vadjustment;\n" 29892"\n" 29893" /* Create a window with a title and a default size */\n" 29894" window = gtk_application_window_new (app);\n" 29895" gtk_window_set_title (GTK_WINDOW (window), \"Scale Example\");\n" 29896" gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);\n" 29897" gtk_container_set_border_width (GTK_CONTAINER (window), 5);\n" 29898"\n" 29899" /* Two labels to be shown in the window */\n" 29900" hlabel = gtk_label_new (\"Move the scale handle...\");\n" 29901" vlabel = gtk_label_new (\"Move the scale handle...\");\n" 29902"\n" 29903" \n" 29904" /* gtk_adjustment_new takes six parameters, three of which \n" 29905" * may be difficult to understand:\n" 29906" * step increment- move the handle with the arrow keys on your keyboard to see.\n" 29907" * page increment - move the handle by clicking away from it \n" 29908" * on the scale to see.\n" 29909" * page size - not used here.\n" 29910" */\n" 29911" hadjustment = gtk_adjustment_new (0, 0, 100, 5, 10, 0);\n" 29912" vadjustment = gtk_adjustment_new (50, 0, 100, 5, 10, 0); \n" 29913"\n" 29914" /* Create the Horizontal scale, making sure the \n" 29915" * digits used have no decimals.\n" 29916" */\n" 29917" h_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);\n" 29918" gtk_scale_set_digits (GTK_SCALE (h_scale), 0); \n" 29919"\n" 29920" /* Allow it to expand horizontally (if there's space), and \n" 29921" * set the vertical alignment\n" 29922" */\n" 29923" gtk_widget_set_hexpand (h_scale, TRUE);\n" 29924" gtk_widget_set_valign (h_scale, GTK_ALIGN_START);\n" 29925" \n" 29926" /* Connecting the \"value-changed\" signal for the horizontal scale \n" 29927" * to the appropriate callback function. \n" 29928" * take note that GtkRange is part of GtkScale's Object Hierarchy.\n" 29929" */\n" 29930" g_signal_connect (h_scale, \n" 29931" \"value-changed\", \n" 29932" G_CALLBACK (hscale_moved), \n" 29933" hlabel);\n" 29934"\n" 29935"\n" 29936"\n" 29937" /* Create the Vertical scale. This time, we will see what happens \n" 29938" * when the digits arent initially set.\n" 29939" */\n" 29940" v_scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, vadjustment);\n" 29941" gtk_widget_set_vexpand (v_scale, TRUE);\n" 29942"\n" 29943" /* Connecting the \"value-changed\" signal for the vertical scale to \n" 29944" * the appropriate callback function.\n" 29945" */\n" 29946" g_signal_connect (v_scale, \n" 29947" \"value-changed\", \n" 29948" G_CALLBACK (vscale_moved), \n" 29949" vlabel);\n" 29950"\n" 29951" /* Create a grid and arrange everything accordingly */\n" 29952" grid = gtk_grid_new ();\n" 29953" gtk_grid_set_column_spacing (GTK_GRID (grid), 10);\n" 29954" gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);\n" 29955" gtk_grid_attach (GTK_GRID (grid), h_scale, 0, 0, 1, 1);\n" 29956" gtk_grid_attach (GTK_GRID (grid), v_scale, 1, 0, 1, 1);\n" 29957" gtk_grid_attach (GTK_GRID (grid), hlabel, 0, 1, 1, 1);\n" 29958" gtk_grid_attach (GTK_GRID (grid), vlabel, 1, 1, 1, 1);\n" 29959" \n" 29960"\n" 29961" gtk_container_add (GTK_CONTAINER (window), grid);\n" 29962"\n" 29963" gtk_widget_show_all (window);\n" 29964"}\n" 29965"\n" 29966"\n" 29967"\n" 29968"int\n" 29969"main (int argc, char **argv)\n" 29970"{\n" 29971" GtkApplication *app;\n" 29972" int status;\n" 29973"\n" 29974" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 29975" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 29976" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 29977" g_object_unref (app);\n" 29978"\n" 29979" return status;\n" 29980"}\n" 29981msgstr "" 29982 29983#. (itstool) path: item/p 29984#: C/scale.c.page:36 29985msgid "" 29986"<link href=\"http://developer.gnome.org/gtk3/stable/GtkScale.html" 29987"\">GtkScale</link>" 29988msgstr "" 29989"<link href=\"http://developer.gnome.org/gtk3/stable/GtkScale.html" 29990"\">GtkScale</link>" 29991 29992#. (itstool) path: item/p 29993#: C/scale.c.page:37 29994msgid "" 29995"<link href=\"http://developer.gnome.org/gtk3/stable/GtkRange.html" 29996"\">GtkRange</link>" 29997msgstr "" 29998"<link href=\"http://developer.gnome.org/gtk3/stable/GtkRange.html" 29999"\">GtkRange</link>" 30000 30001#. (itstool) path: item/p 30002#: C/scale.c.page:38 C/spinbutton.c.page:39 30003msgid "" 30004"<link href=\"http://developer.gnome.org/gtk3/stable/GtkAdjustment.html" 30005"\">GtkAdjustment</link>" 30006msgstr "" 30007"<link href=\"http://developer.gnome.org/gtk3/stable/GtkAdjustment.html" 30008"\">GtkAdjustment</link>" 30009 30010#. (itstool) path: item/p 30011#: C/scale.c.page:39 30012msgid "" 30013"<link href=\"http://developer.gnome.org/glib/stable/glib-String-Utility-" 30014"Functions.html#g-strdup-printf\">String Utility Functions</link>" 30015msgstr "" 30016 30017#. (itstool) path: info/title 30018#: C/scale.js.page:8 30019#, fuzzy 30020msgctxt "text" 30021msgid "Scale (JavaScript)" 30022msgstr "_JavaScript" 30023 30024#. (itstool) path: info/desc 30025#: C/scale.js.page:18 30026msgid "A slider which corresponds to a numerical value" 30027msgstr "" 30028 30029#. (itstool) path: page/media 30030#. This is a reference to an external file such as an image or video. When 30031#. the file changes, the md5 hash will change to let you know you need to 30032#. update your localized copy. The msgstr is not used at all. Set it to 30033#. whatever you like once you have updated your copy of the file. 30034#: C/scale.js.page:22 30035msgctxt "_" 30036msgid "" 30037"external ref='media/scalepenguins.png' md5='2dbe6a833fec86fde71a5ddb421e2cd5'" 30038msgstr "" 30039"external ref='media/scalepenguins.png' md5='2dbe6a833fec86fde71a5ddb421e2cd5'" 30040 30041#. (itstool) path: page/p 30042#: C/scale.js.page:23 30043msgid "" 30044"A Scale is a horizontal or vertical slider, that represents a value inside a " 30045"numerical range. When you create a new Scale, you set what its default " 30046"position is, what the numbers at the top and bottom of the range are, and " 30047"things like how much it moves up or down when you click on the Scale to " 30048"either side of the knob. To keep from having to type all that in every time " 30049"you create a new Scale, you can create an object called an Adjustment which " 30050"keeps track of all that, then tell each new Scale to use that Adjustment." 30051msgstr "" 30052 30053#. (itstool) path: page/p 30054#: C/scale.js.page:24 30055msgid "" 30056"This scale is a simple widget that lets you adjust the size of an iceberg " 30057"that penguins live on. The number of penguins on the iceberg is the product " 30058"of the values of the two sliders. Try playing with them and seeing what " 30059"happens." 30060msgstr "" 30061 30062#. (itstool) path: section/code 30063#: C/scale.js.page:41 30064#, no-wrap 30065msgid "" 30066"\n" 30067"const ScaleExample = new Lang.Class({\n" 30068" Name: 'Scale Example',\n" 30069"\n" 30070" // Create the application itself\n" 30071" _init: function() {\n" 30072" this.application = new Gtk.Application({\n" 30073" application_id: 'org.example.jsscale'\n" 30074" });\n" 30075"\n" 30076" // Connect 'activate' and 'startup' signals to the callback functions\n" 30077" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 30078" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 30079" },\n" 30080"\n" 30081" // Callback function for 'activate' signal presents window when active\n" 30082" _onActivate: function() {\n" 30083" this._window.present();\n" 30084" },\n" 30085"\n" 30086" // Callback function for 'startup' signal builds the UI\n" 30087" _onStartup: function() {\n" 30088" this._buildUI ();\n" 30089" },\n" 30090msgstr "" 30091 30092#. (itstool) path: section/p 30093#: C/scale.js.page:66 30094msgid "" 30095"All the code for this sample goes in the ScaleExample class. The above code " 30096"creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk." 30097"Application.html\">Gtk.Application</link> for our widgets and window to go " 30098"in." 30099msgstr "" 30100 30101#. (itstool) path: section/code 30102#: C/scale.js.page:67 30103#, no-wrap 30104msgid "" 30105"\n" 30106" // Build the application's UI\n" 30107" _buildUI: function() {\n" 30108"\n" 30109" // Create the application window\n" 30110" this._window = new Gtk.ApplicationWindow({\n" 30111" application: this.application,\n" 30112" window_position: Gtk.WindowPosition.CENTER,\n" 30113" border_width: 20,\n" 30114" title: \"Birds on a Floe\"});\n" 30115msgstr "" 30116 30117#. (itstool) path: section/title 30118#: C/scale.js.page:82 30119#, fuzzy 30120msgid "Creating the scales" 30121msgstr "Escalas:" 30122 30123#. (itstool) path: section/code 30124#: C/scale.js.page:83 30125#, no-wrap 30126msgid "" 30127"\n" 30128" // Create the horizontal scale\n" 30129" this._hScale = Gtk.Scale.new_with_range (Gtk.Orientation.HORIZONTAL, 0.0, 100.0, 5.0);\n" 30130" this._hScale.set_valign (Gtk.Align.START);\n" 30131" this._hScale.set_value (50);\n" 30132" this._hScale.set_digits (0);\n" 30133" // this._hScale.set_draw_value (false);\n" 30134msgstr "" 30135 30136#. (itstool) path: section/p 30137#: C/scale.js.page:92 30138msgid "" 30139"The new_with_range method is one way to create a new Scale widget. The " 30140"parameters it takes are a <link href=\"http://www.roojs.org/seed/gir-1.2-" 30141"gtk-3.0/gjs/Gtk.Orientation.html\">Gtk.Orientation</link>, the minimum " 30142"value, the maximum value, and the increment for a single step. After that we " 30143"use the Scale's methods to set its starting value, and how many decimal " 30144"places it runs to. We also set its vertical alignment in this case, to " 30145"control where it appears in the window." 30146msgstr "" 30147 30148#. (itstool) path: section/p 30149#: C/scale.js.page:93 30150msgid "" 30151"We can use the set_draw_value method to tell it whether or not to show the " 30152"number next to the sliding scale. It's commented out in this example." 30153msgstr "" 30154 30155#. (itstool) path: section/code 30156#: C/scale.js.page:95 30157#, no-wrap 30158msgid "" 30159"\n" 30160" // Create a master adjustment to use for the vertical (or any other) scale\n" 30161" this._adjustment = new Gtk.Adjustment ({\n" 30162" value: 95,\n" 30163" lower: 0,\n" 30164" upper: 100,\n" 30165" step_increment: 5,\n" 30166" page_increment: 10 });\n" 30167msgstr "" 30168 30169#. (itstool) path: section/p 30170#: C/scale.js.page:105 30171msgid "" 30172"An Adjustment is an object we can use to simplify things when creating a new " 30173"Scale. The Adjustment's \"value\" property is what the Scale's default value " 30174"is, while \"upper\" and \"lower\" make the high and low ends of the " 30175"numerical range. Meanwhile, the increment values show how much the slider " 30176"moves when you do things like click on it." 30177msgstr "" 30178 30179#. (itstool) path: section/code 30180#: C/scale.js.page:107 30181#, no-wrap 30182msgid "" 30183"\n" 30184" // Create a vertical scale using the adjustment we just made\n" 30185" this._vScale = new Gtk.Scale ({\n" 30186" orientation: Gtk.Orientation.VERTICAL,\n" 30187" adjustment: this._adjustment,\n" 30188" digits: 0,\n" 30189" // draw_value: false,\n" 30190" margin_left: 10 });\n" 30191msgstr "" 30192 30193#. (itstool) path: section/p 30194#: C/scale.js.page:117 30195msgid "" 30196"Here we create a new Scale object using _adjustment as its \"adjustment\" " 30197"property. This is a great shortcut. We still have to tell it to round off " 30198"the decimal place, though. Note that the draw_value property is commented " 30199"out; this is how you tell it not to show the number next to the Scale when " 30200"you're creating one this way." 30201msgstr "" 30202 30203#. (itstool) path: section/code 30204#: C/scale.js.page:119 30205#, no-wrap 30206msgid "" 30207"\n" 30208" // Create the label that shows the product of the two values\n" 30209" this._product = (this._hScale.get_value() * this._vScale.get_value());\n" 30210" this._label = new Gtk.Label ({\n" 30211" label: (String(this._product) + \" penguins on the iceberg.\"),\n" 30212" height_request: 200,\n" 30213" width_request: 200,\n" 30214" wrap: true});\n" 30215"\n" 30216" // Connect the two scales to functions which recalculate the label\n" 30217" this._hScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n" 30218" this._vScale.connect (\"value-changed\", Lang.bind (this, this._recalc));\n" 30219msgstr "" 30220 30221#. (itstool) path: section/p 30222#: C/scale.js.page:133 30223msgid "" 30224"We can use the get_value method to find out the numerical value a Scale is " 30225"set at. We can then do whatever we want with it, including multiply the two " 30226"Scales' values together and have a <link xref=\"label.js\">Label</link> show " 30227"us the product. We set the label's text to wrap around, because we're having " 30228"it display a silly message too." 30229msgstr "" 30230 30231#. (itstool) path: section/p 30232#: C/scale.js.page:134 30233msgid "" 30234"After we create the Label, we connect the two Scales' \"value-changed\" " 30235"signals to _recalc, a function that will recalculate the number of penguins " 30236"on the iceberg and come up with a new message." 30237msgstr "" 30238 30239#. (itstool) path: section/code 30240#: C/scale.js.page:136 30241#, no-wrap 30242msgid "" 30243"\n" 30244" // Create a grid to arrange things in\n" 30245" this._UIGrid = new Gtk.Grid ({\n" 30246" halign: Gtk.Align.CENTER,\n" 30247" valign: Gtk.Align.CENTER,\n" 30248" margin_top: 20,\n" 30249" margin_left: 20});\n" 30250"\n" 30251" // Attach everything to the grid\n" 30252" this._UIGrid.attach (this._label, 0, 0, 1, 1);\n" 30253" this._UIGrid.attach (this._hScale, 0, 1, 1, 1);\n" 30254" this._UIGrid.attach (this._vScale, 1, 0, 1, 1);\n" 30255msgstr "" 30256 30257#. (itstool) path: section/p 30258#: C/scale.js.page:149 30259msgid "" 30260"Here we create a <link xref=\"grid.js\">Grid</link> to put everything in, " 30261"then attach all our widgets to it. Note that here and on some of the widgets " 30262"themselves we're using margins to keep things neatly spaced." 30263msgstr "" 30264 30265#. (itstool) path: section/code 30266#: C/scale.js.page:150 30267#, no-wrap 30268msgid "" 30269"\n" 30270" // Add the grid to the window\n" 30271" this._window.add (this._UIGrid);\n" 30272"\n" 30273" // Show the window and all child widgets\n" 30274" this._window.show_all();\n" 30275" },\n" 30276msgstr "" 30277 30278#. (itstool) path: section/p 30279#: C/scale.js.page:158 30280msgid "" 30281"Finally, we add the Grid to the window, then tell the window to show itself " 30282"and all the widgets inside of it." 30283msgstr "" 30284 30285#. (itstool) path: section/title 30286#: C/scale.js.page:162 30287msgid "Function which handles the scales' values changing" 30288msgstr "" 30289 30290#. (itstool) path: section/code 30291#: C/scale.js.page:164 30292#, no-wrap 30293msgid "" 30294"\n" 30295" _recalc: function() {\n" 30296"\n" 30297" // Figure out what the product of the two scales' values is\n" 30298" var product = (this._hScale.get_value() * this._vScale.get_value());\n" 30299"\n" 30300" // Create a blank comment line in case there isn't a silly comment to make\n" 30301" var comment = \"\";\n" 30302"\n" 30303" // Make a silly comment based on the number of penguins\n" 30304" if (product > 9000) {\n" 30305" comment = \"It's over 9000!\";\n" 30306" }\n" 30307" else if (product < 1000 && product > 0) {\n" 30308" comment = \"They're getting lonely.\";\n" 30309" }\n" 30310" else if (product == 0) {\n" 30311" comment = \"They're all gone ...\";\n" 30312" }\n" 30313" else comment = \"\";\n" 30314"\n" 30315" // Set ._label's new text\n" 30316" this._label.set_label (String (product) + \" penguins on the iceberg. \" + comment);\n" 30317"\n" 30318" }\n" 30319"\n" 30320"});\n" 30321msgstr "" 30322 30323#. (itstool) path: section/p 30324#: C/scale.js.page:192 30325msgid "" 30326"Remember, we can get a Scale's value using its get_value method. Here we " 30327"simply recalculate what the product of the two values is after one of the " 30328"Scales is moved, add in a silly message depending on how many penguins are " 30329"left, and change the wording on _label to show the new number and message." 30330msgstr "" 30331 30332#. (itstool) path: section/code 30333#: C/scale.js.page:194 30334#, fuzzy, no-wrap 30335msgid "" 30336"\n" 30337"// Run the application\n" 30338"let app = new ScaleExample ();\n" 30339"app.application.run (ARGV);\n" 30340msgstr "" 30341"\n" 30342"// Executa o aplicativo\n" 30343"let app = new HelloGNOME ();\n" 30344"app.application.run (ARGV);\n" 30345 30346#. (itstool) path: section/p 30347#: C/scale.js.page:199 30348msgid "" 30349"Finally, we create a new instance of the finished ScaleExample class, and " 30350"set the application running." 30351msgstr "" 30352 30353#. (itstool) path: section/code 30354#: C/scale.js.page:204 30355#, fuzzy, no-wrap 30356#| msgid "" 30357#| "#!/usr/bin/gjs\n" 30358#| "\n" 30359#| "const Gtk = imports.gi.Gtk;\n" 30360#| "const Lang = imports.lang;\n" 30361#| "\n" 30362#| "const WelcomeToTheGrid = new Lang.Class({\n" 30363#| " Name: 'Welcome to the Grid',\n" 30364#| "\n" 30365#| " // Create the application itself\n" 30366#| " _init: function() {\n" 30367#| " this.application = new Gtk.Application();\n" 30368#| "\n" 30369#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 30370#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 30371#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 30372#| " },\n" 30373#| "\n" 30374#| " // Callback function for 'activate' signal presents windows when active\n" 30375#| " _onActivate: function() {\n" 30376#| " this._window.present();\n" 30377#| " },\n" 30378#| "\n" 30379#| " // Callback function for 'startup' signal builds the UI\n" 30380#| " _onStartup: function() {\n" 30381#| " this._buildUI ();\n" 30382#| " },\n" 30383#| "\n" 30384#| "\n" 30385#| "\n" 30386#| " // Build the application's UI\n" 30387#| " _buildUI: function() {\n" 30388#| "\n" 30389#| " // Create the application window\n" 30390#| " this._window = new Gtk.ApplicationWindow({\n" 30391#| " application: this.application,\n" 30392#| " window_position: Gtk.WindowPosition.CENTER,\n" 30393#| " border_width: 10,\n" 30394#| " title: \"Welcome to the Grid\"});\n" 30395#| "\n" 30396#| " // Create the Grid\n" 30397#| " this._grid = new Gtk.Grid ({\n" 30398#| " // column_homogeneous: true,\n" 30399#| " // column_spacing: 20,\n" 30400#| " row_spacing: 20 });\n" 30401#| "\n" 30402#| " // Create an image\n" 30403#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 30404#| "\n" 30405#| " // Create a second image using a stock icon\n" 30406#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 30407#| "\n" 30408#| " // Create a label\n" 30409#| " this._label = new Gtk.Label ({\n" 30410#| " label: \"Welcome to GNOME, too!\",\n" 30411#| " /* margin_top: 20 */ });\n" 30412#| "\n" 30413#| " /* Create a second label\n" 30414#| " this._labelTwo = new Gtk.Label ({\n" 30415#| " label: \"The cake is a pie.\" }); */\n" 30416#| "\n" 30417#| " /* Create a button\n" 30418#| " this._button = new Gtk.Button ({\n" 30419#| " label: \"Welcome to GNOME, too!\"}); */\n" 30420#| "\n" 30421#| " // Attach the images and button to the grid\n" 30422#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 30423#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 30424#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 30425#| "\n" 30426#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 30427#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 30428#| "\n" 30429#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 30430#| "\n" 30431#| " // Add the grid to the window\n" 30432#| " this._window.add (this._grid);\n" 30433#| "\n" 30434#| " // Show the window and all child widgets\n" 30435#| " this._window.show_all();\n" 30436#| " }\n" 30437#| "\n" 30438#| "});\n" 30439#| "\n" 30440#| "// Run the application\n" 30441#| "let app = new WelcomeToTheGrid ();\n" 30442#| "app.application.run (ARGV);\n" 30443msgid "" 30444"#!/usr/bin/gjs\n" 30445"\n" 30446"imports.gi.versions.Gtk = '3.0';\n" 30447"\n" 30448"const Gio = imports.gi.Gio;\n" 30449"const Gtk = imports.gi.Gtk;\n" 30450"\n" 30451"class ScaleExample {\n" 30452"\n" 30453" // Create the application itself\n" 30454" constructor() {\n" 30455" this.application = new Gtk.Application({\n" 30456" application_id: 'org.example.jsscale'\n" 30457" });\n" 30458"\n" 30459" // Connect 'activate' and 'startup' signals to the callback functions\n" 30460" this.application.connect('activate', this._onActivate.bind(this));\n" 30461" this.application.connect('startup', this._onStartup.bind(this));\n" 30462" }\n" 30463"\n" 30464" // Callback function for 'activate' signal presents window when active\n" 30465" _onActivate() {\n" 30466" this._window.present();\n" 30467" }\n" 30468"\n" 30469" // Callback function for 'startup' signal builds the UI\n" 30470" _onStartup() {\n" 30471" this._buildUI();\n" 30472" }\n" 30473"\n" 30474" // Build the application's UI\n" 30475" _buildUI() {\n" 30476"\n" 30477" // Create the application window\n" 30478" this._window = new Gtk.ApplicationWindow({\n" 30479" application: this.application,\n" 30480" window_position: Gtk.WindowPosition.CENTER,\n" 30481" border_width: 20,\n" 30482" title: \"Birds on a Floe\"});\n" 30483"\n" 30484" // Create the horizontal scale\n" 30485" this._hScale = Gtk.Scale.new_with_range (Gtk.Orientation.HORIZONTAL, 0.0, 100.0, 5.0);\n" 30486" this._hScale.set_valign (Gtk.Align.START);\n" 30487" this._hScale.set_value (50);\n" 30488" this._hScale.set_digits (0);\n" 30489" // this._hScale.set_draw_value (false);\n" 30490"\n" 30491" // Create a master adjustment to use for the vertical (or any other) scale\n" 30492" this._adjustment = new Gtk.Adjustment ({\n" 30493" value: 95,\n" 30494" lower: 0,\n" 30495" upper: 100,\n" 30496" step_increment: 5,\n" 30497" page_increment: 10 });\n" 30498"\n" 30499" // Create a vertical scale using the adjustment we just made\n" 30500" this._vScale = new Gtk.Scale ({\n" 30501" orientation: Gtk.Orientation.VERTICAL,\n" 30502" adjustment: this._adjustment,\n" 30503" digits: 0,\n" 30504" // draw_value: false,\n" 30505" margin_left: 10 });\n" 30506"\n" 30507" // Create the label that shows the product of the two values\n" 30508" this._product = (this._hScale.get_value() * this._vScale.get_value());\n" 30509" this._label = new Gtk.Label ({\n" 30510" label: (String(this._product) + \" penguins on the iceberg.\"),\n" 30511" height_request: 200,\n" 30512" width_request: 200,\n" 30513" wrap: true});\n" 30514"\n" 30515" // Connect the two scales to functions which recalculate the label\n" 30516" this._hScale.connect (\"value-changed\", this._recalc.bind(this));\n" 30517" this._vScale.connect (\"value-changed\", this._recalc.bind(this));\n" 30518"\n" 30519" // Create a grid to arrange things in\n" 30520" this._UIGrid = new Gtk.Grid ({\n" 30521" halign: Gtk.Align.CENTER,\n" 30522" valign: Gtk.Align.CENTER,\n" 30523" margin_top: 20,\n" 30524" margin_left: 20});\n" 30525"\n" 30526" // Attach everything to the grid\n" 30527" this._UIGrid.attach (this._label, 0, 0, 1, 1);\n" 30528" this._UIGrid.attach (this._hScale, 0, 1, 1, 1);\n" 30529" this._UIGrid.attach (this._vScale, 1, 0, 1, 1);\n" 30530"\n" 30531" // Add the grid to the window\n" 30532" this._window.add (this._UIGrid);\n" 30533"\n" 30534" // Show the window and all child widgets\n" 30535" this._window.show_all();\n" 30536" }\n" 30537"\n" 30538" _recalc() {\n" 30539"\n" 30540" // Figure out what the product of the two scales' values is\n" 30541" var product = (this._hScale.get_value() * this._vScale.get_value());\n" 30542"\n" 30543" // Create a blank comment line in case there isn't a silly comment to make\n" 30544" var comment = \"\";\n" 30545"\n" 30546" // Make a silly comment based on the number of penguins\n" 30547" if (product > 9000) {\n" 30548" comment = \"It's over 9000!\";\n" 30549" }\n" 30550" else if (product < 1000 && product > 0) {\n" 30551" comment = \"They're getting lonely.\";\n" 30552" }\n" 30553" else if (product == 0) {\n" 30554" comment = \"They're all gone ...\";\n" 30555" }\n" 30556" else comment = \"\";\n" 30557"\n" 30558" // Set ._label's new text\n" 30559" this._label.set_label (String (product) + \" penguins on the iceberg. \" + comment);\n" 30560" }\n" 30561"};\n" 30562"\n" 30563"// Run the application\n" 30564"let app = new ScaleExample ();\n" 30565"app.application.run (ARGV);\n" 30566msgstr "" 30567"#!/usr/bin/gjs\n" 30568"\n" 30569"const Gtk = imports.gi.Gtk;\n" 30570"const Lang = imports.lang;\n" 30571"\n" 30572"const WelcomeToTheGrid = new Lang.Class({\n" 30573" Name: 'Bem-vindo à Grid',\n" 30574"\n" 30575" // Cria o aplicativo em si\n" 30576" _init: function() {\n" 30577" this.application = new Gtk.Application();\n" 30578"\n" 30579" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 30580" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 30581" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 30582" },\n" 30583"\n" 30584" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 30585" _onActivate: function() {\n" 30586" this._window.present();\n" 30587" },\n" 30588"\n" 30589" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 30590" _onStartup: function() {\n" 30591" this._buildUI ();\n" 30592" },\n" 30593"\n" 30594"\n" 30595"\n" 30596" // Constrói a interface gráfica do aplicativo\n" 30597" _buildUI: function() {\n" 30598"\n" 30599" // Cria a janela do aplicativo\n" 30600" this._window = new Gtk.ApplicationWindow({\n" 30601" application: this.application,\n" 30602" window_position: Gtk.WindowPosition.CENTER,\n" 30603" border_width: 10,\n" 30604" title: \"Bem-vindo à Grid\"});\n" 30605"\n" 30606" // Cria a Grid\n" 30607" this._grid = new Gtk.Grid ({\n" 30608" // column_homogeneous: true,\n" 30609" // column_spacing: 20,\n" 30610" row_spacing: 20 });\n" 30611"\n" 30612" // Cria uma imagem\n" 30613" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 30614"\n" 30615" // Cria uma segunda imagem usando um ícone padrão\n" 30616" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 30617"\n" 30618" // Cria um rótulo\n" 30619" this._label = new Gtk.Label ({\n" 30620" label: \"Bem-vindo ao GNOME, também!\",\n" 30621" /* margin_top: 20 */ });\n" 30622"\n" 30623" /* Cria um segundo rótulo\n" 30624" this._labelTwo = new Gtk.Label ({\n" 30625" label: \"O bolo é uma torta.\" }); */\n" 30626"\n" 30627" /* Cria um botão\n" 30628" this._button = new Gtk.Button ({\n" 30629" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 30630"\n" 30631" // Anexa as imagens e botão à grade\n" 30632" this._grid.attach (this._image, 0, 0, 2, 1);\n" 30633" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 30634" this._grid.attach (this._label, 1, 1, 1, 1);\n" 30635"\n" 30636" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 30637" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 30638"\n" 30639" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 30640"\n" 30641" // Adiciona a grade à janela\n" 30642" this._window.add (this._grid);\n" 30643"\n" 30644" // Mostra a janela e todos os widgets filhos\n" 30645" this._window.show_all();\n" 30646" }\n" 30647"\n" 30648"});\n" 30649"\n" 30650"// Executa o aplicativo\n" 30651"let app = new WelcomeToTheGrid ();\n" 30652"app.application.run (ARGV);\n" 30653 30654#. (itstool) path: item/p 30655#: C/scale.js.page:210 C/spinbutton.js.page:201 30656msgid "" 30657"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Adjustment." 30658"html\">Gtk.Adjustment</link>" 30659msgstr "" 30660 30661#. (itstool) path: item/p 30662#: C/scale.js.page:215 30663msgid "" 30664"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Scale.html" 30665"\">Gtk.Scale</link>" 30666msgstr "" 30667 30668#. (itstool) path: info/title 30669#: C/scale.py.page:8 30670#, fuzzy 30671msgctxt "text" 30672msgid "Scale (Python)" 30673msgstr "escala" 30674 30675#. (itstool) path: page/media 30676#. This is a reference to an external file such as an image or video. When 30677#. the file changes, the md5 hash will change to let you know you need to 30678#. update your localized copy. The msgstr is not used at all. Set it to 30679#. whatever you like once you have updated your copy of the file. 30680#: C/scale.py.page:24 C/scale.vala.page:24 30681msgctxt "_" 30682msgid "external ref='media/scale.png' md5='462c52a53b773cb9e8c62c646bf88452'" 30683msgstr "external ref='media/scale.png' md5='462c52a53b773cb9e8c62c646bf88452'" 30684 30685#. (itstool) path: section/code 30686#: C/scale.py.page:31 30687#, no-wrap 30688msgid "" 30689"from gi.repository import Gtk\n" 30690"import sys\n" 30691"\n" 30692"\n" 30693"class MyWindow(Gtk.ApplicationWindow):\n" 30694"\n" 30695" def __init__(self, app):\n" 30696" Gtk.Window.__init__(self, title=\"Scale Example\", application=app)\n" 30697" self.set_default_size(400, 300)\n" 30698" self.set_border_width(5)\n" 30699"\n" 30700" # two adjustments (initial value, min value, max value,\n" 30701" # step increment - press cursor keys to see!,\n" 30702" # page increment - click around the handle to see!,\n" 30703" # page size - not used here)\n" 30704" ad1 = Gtk.Adjustment(0, 0, 100, 5, 10, 0)\n" 30705" ad2 = Gtk.Adjustment(50, 0, 100, 5, 10, 0)\n" 30706"\n" 30707" # an horizontal scale\n" 30708" self.h_scale = Gtk.Scale(\n" 30709" orientation=Gtk.Orientation.HORIZONTAL, adjustment=ad1)\n" 30710" # of integers (no digits)\n" 30711" self.h_scale.set_digits(0)\n" 30712" # that can expand horizontally if there is space in the grid (see\n" 30713" # below)\n" 30714" self.h_scale.set_hexpand(True)\n" 30715" # that is aligned at the top of the space allowed in the grid (see\n" 30716" # below)\n" 30717" self.h_scale.set_valign(Gtk.Align.START)\n" 30718"\n" 30719" # we connect the signal \"value-changed\" emitted by the scale with the callback\n" 30720" # function scale_moved\n" 30721" self.h_scale.connect(\"value-changed\", self.scale_moved)\n" 30722"\n" 30723" # a vertical scale\n" 30724" self.v_scale = Gtk.Scale(\n" 30725" orientation=Gtk.Orientation.VERTICAL, adjustment=ad2)\n" 30726" # that can expand vertically if there is space in the grid (see below)\n" 30727" self.v_scale.set_vexpand(True)\n" 30728"\n" 30729" # we connect the signal \"value-changed\" emitted by the scale with the callback\n" 30730" # function scale_moved\n" 30731" self.v_scale.connect(\"value-changed\", self.scale_moved)\n" 30732"\n" 30733" # a label\n" 30734" self.label = Gtk.Label()\n" 30735" self.label.set_text(\"Move the scale handles...\")\n" 30736"\n" 30737" # a grid to attach the widgets\n" 30738" grid = Gtk.Grid()\n" 30739" grid.set_column_spacing(10)\n" 30740" grid.set_column_homogeneous(True)\n" 30741" grid.attach(self.h_scale, 0, 0, 1, 1)\n" 30742" grid.attach_next_to(\n" 30743" self.v_scale, self.h_scale, Gtk.PositionType.RIGHT, 1, 1)\n" 30744" grid.attach(self.label, 0, 1, 2, 1)\n" 30745"\n" 30746" self.add(grid)\n" 30747"\n" 30748" # any signal from the scales is signaled to the label the text of which is\n" 30749" # changed\n" 30750" def scale_moved(self, event):\n" 30751" self.label.set_text(\"Horizontal scale is \" + str(int(self.h_scale.get_value())) +\n" 30752" \"; vertical scale is \" + str(self.v_scale.get_value()) + \".\")\n" 30753"\n" 30754"\n" 30755"class MyApplication(Gtk.Application):\n" 30756"\n" 30757" def __init__(self):\n" 30758" Gtk.Application.__init__(self)\n" 30759"\n" 30760" def do_activate(self):\n" 30761" win = MyWindow(self)\n" 30762" win.show_all()\n" 30763"\n" 30764" def do_startup(self):\n" 30765" Gtk.Application.do_startup(self)\n" 30766"\n" 30767"app = MyApplication()\n" 30768"exit_status = app.run(sys.argv)\n" 30769"sys.exit(exit_status)\n" 30770msgstr "" 30771 30772#. (itstool) path: section/title 30773#: C/scale.py.page:35 30774#, fuzzy 30775msgid "Useful methods for a Scale widget" 30776msgstr "Métodos úteis" 30777 30778#. (itstool) path: section/p 30779#: C/scale.py.page:36 30780msgid "" 30781"A Gtk.Adjustment is needed to construct the Gtk.Scale. This is the " 30782"representation of a value with a lower and upper bound, together with step " 30783"and page increments, and a page size, and it is constructed as <code>Gtk." 30784"Adjustment(value, lower, upper, step_increment, page_increment, page_size)</" 30785"code> where the fields are of type <code>float</code>; <code>step_increment</" 30786"code> is the increment/decrement that is obtained by using the cursor keys, " 30787"<code>page_increment</code> the one that is obtained clicking on the scale " 30788"itself. Note that <code>page_size</code> is not used in this case, it should " 30789"be set to <code>0</code>." 30790msgstr "" 30791 30792#. (itstool) path: section/p 30793#: C/scale.py.page:37 30794msgid "" 30795"In line 28 the signal <code>\"value-changed\"</code> is connected to the " 30796"callback function <code>scale_moved()</code> using <code><var>widget</var>." 30797"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 30798"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 30799msgstr "" 30800 30801#. (itstool) path: item/p 30802#: C/scale.py.page:39 30803msgid "" 30804"<code>get_value()</code> retrieves the current value of the scale; " 30805"<code>set_value(value)</code> sets it (if the <code>value</code>, of type " 30806"<code>float</code>, is outside the minimum or maximum range, it will be " 30807"clamped to fit inside them). These are methods of the class Gtk.Range." 30808msgstr "" 30809 30810#. (itstool) path: item/p 30811#: C/scale.py.page:40 30812msgid "" 30813"Use <code>set_draw_value(False)</code> to avoid displaying the current value " 30814"as a string next to the slider." 30815msgstr "" 30816 30817#. (itstool) path: item/p 30818#: C/scale.py.page:41 30819msgid "" 30820"To highlight the part of the scale between the origin and the current value:" 30821msgstr "" 30822 30823#. (itstool) path: item/code 30824#: C/scale.py.page:42 30825#, no-wrap 30826msgid "" 30827"\n" 30828"self.h_scale.set_restrict_to_fill_level(False)\n" 30829"self.h_scale.set_fill_level(self.h_scale.get_value())\n" 30830"self.h_scale.set_show_fill_level(True)" 30831msgstr "" 30832 30833#. (itstool) path: item/p 30834#: C/scale.py.page:46 30835msgid "" 30836"in the callback function of the \"value-changed\" signal, so to have the new " 30837"filling every time the value is changed. These are methods of the class Gtk." 30838"Range." 30839msgstr "" 30840 30841#. (itstool) path: item/p 30842#: C/scale.py.page:48 30843msgid "" 30844"<code>add_mark(value, position, markup)</code> adds a mark at the " 30845"<code>value</code> (<code>float</code> or <code>int</code> if that is the " 30846"precision of the scale), in <code>position</code> (<code>Gtk.PositionType." 30847"LEFT, Gtk.PositionType.RIGHT, Gtk.PositionType.TOP, Gtk.PositionType.BOTTOM</" 30848"code>) with text <code>Null</code> or <code>markup</code> in the Pango " 30849"Markup Language. To clear marks, <code>clear_marks()</code>." 30850msgstr "" 30851 30852#. (itstool) path: item/p 30853#: C/scale.py.page:49 30854msgid "" 30855"<code>set_digits(digits)</code> sets the precision of the scale at " 30856"<code>digits</code> digits." 30857msgstr "" 30858 30859#. (itstool) path: item/p 30860#: C/scale.py.page:57 30861msgid "" 30862"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkScale.html" 30863"\">GtkScale</link>" 30864msgstr "" 30865 30866#. (itstool) path: item/p 30867#: C/scale.py.page:58 C/spinbutton.py.page:50 30868msgid "" 30869"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkAdjustment.html" 30870"\">GtkAdjustment</link>" 30871msgstr "" 30872 30873#. (itstool) path: item/p 30874#: C/scale.py.page:59 C/scrolledwindow.js.page:37 C/scrolledwindow.py.page:46 30875#: C/textview.py.page:100 30876msgid "" 30877"<link href=\"http://developer.gnome.org/gtk3/unstable/gtk3-Standard-" 30878"Enumerations.html\">Standard Enumerations</link>" 30879msgstr "" 30880 30881#. (itstool) path: info/title 30882#: C/scale.vala.page:8 30883#, fuzzy 30884msgctxt "text" 30885msgid "Scale (Vala)" 30886msgstr "_Vala" 30887 30888#. (itstool) path: page/code 30889#: C/scale.vala.page:27 30890#, no-wrap 30891msgid "" 30892"/* This is the application. */\n" 30893"public class MyApplication : Gtk.Application {\n" 30894"\tGtk.Scale h_scale;\n" 30895"\tGtk.Scale v_scale;\n" 30896"\tGtk.Label label;\n" 30897"\n" 30898"\t/* Override the 'activate' signal of GLib.Application. */\n" 30899"\tprotected override void activate () {\n" 30900"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 30901"\t\twindow.title = \"Scale Example\";\n" 30902"\t\twindow.set_default_size (400, 300);\n" 30903"\t\twindow.set_border_width (5);\n" 30904"\n" 30905"\t\th_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0.0, 100.0, 5.0);\n" 30906"\t\th_scale.set_digits (0); //number of decimal places displayed\n" 30907"\t\th_scale.set_valign (Gtk.Align.START); //horizontal alignment\n" 30908"\n" 30909"\t\tvar adjustment = new Gtk.Adjustment (42.0, 0.0, 100.0, 5.0, 10.0, 0.0);\n" 30910"\t\tv_scale = new Gtk.Scale (Gtk.Orientation.VERTICAL, adjustment);\n" 30911"\t\tv_scale.set_vexpand(true);\n" 30912"\n" 30913"\t\tlabel = new Gtk.Label (\"Move the scale handles...\");\n" 30914"\n" 30915"\t\tvar grid = new Gtk.Grid ();\n" 30916"\t\tgrid.set_column_spacing (10); //amount of space between columns\n" 30917"\t\tgrid.set_column_homogeneous (true); //all columns same width\n" 30918"\t\tgrid.attach (h_scale, 0, 0, 1, 1);\n" 30919"\t\tgrid.attach_next_to (v_scale, h_scale, Gtk.PositionType.RIGHT, 1, 1);\n" 30920"\t\tgrid.attach (label, 0, 1, 2, 1);\n" 30921"\n" 30922"\t\th_scale.value_changed.connect (scale_moved);\n" 30923"\t\tv_scale.value_changed.connect (scale_moved);\n" 30924"\n" 30925"\t\twindow.add (grid);\n" 30926"\t\twindow.show_all ();\n" 30927"\t}\n" 30928"\n" 30929"\t/* Callback function for \"value-changed\" signal.\n" 30930"\t * The parameter refers to the scale which emitted the signal.\n" 30931"\t * Since we are accessing the values of not one, but two scales,\n" 30932"\t * we made the ranges instance variables, and ignore the\n" 30933"\t * parameter.\n" 30934"\t */\n" 30935"\tvoid scale_moved (Gtk.Range range) {\n" 30936"\t\tlabel.set_text (\"Horizontal scale is %.1f; vertical scale is %.1f.\".printf (h_scale.get_value (), v_scale.get_value ()));\n" 30937"\t}\n" 30938"}\n" 30939"\n" 30940"/* main creates and runs the application. */\n" 30941"public int main (string[] args) {\n" 30942"\treturn new MyApplication ().run (args);\n" 30943"}\n" 30944msgstr "" 30945 30946#. (itstool) path: item/p 30947#: C/scale.vala.page:32 30948msgid "" 30949"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Scale.html\">Gtk.Scale</" 30950"link>" 30951msgstr "" 30952 30953#. (itstool) path: item/p 30954#: C/scale.vala.page:33 30955msgid "" 30956"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Adjustment.html\">Gtk." 30957"Adjustment</link>" 30958msgstr "" 30959 30960#. (itstool) path: item/p 30961#: C/scale.vala.page:34 30962msgid "" 30963"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.PositionType.html\">Gtk." 30964"PositionType</link>" 30965msgstr "" 30966 30967#. (itstool) path: item/p 30968#: C/scale.vala.page:35 30969msgid "" 30970"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Orientation.html\">Gtk." 30971"Orientation</link>" 30972msgstr "" 30973 30974#. (itstool) path: info/title 30975#: C/scrolledwindow.c.page:8 30976msgctxt "text" 30977msgid "ScrolledWindow (C)" 30978msgstr "ScrolledWindow (C)" 30979 30980#. (itstool) path: info/desc 30981#: C/scrolledwindow.c.page:20 C/scrolledwindow.js.page:18 30982#: C/scrolledwindow.py.page:19 C/scrolledwindow.vala.page:19 30983msgid "Adds scrollbars to its child widget" 30984msgstr "" 30985 30986#. (itstool) path: page/title 30987#: C/scrolledwindow.c.page:23 C/scrolledwindow.js.page:21 30988#: C/scrolledwindow.py.page:22 C/scrolledwindow.vala.page:22 30989msgid "ScrolledWindow" 30990msgstr "ScrolledWindow" 30991 30992#. (itstool) path: page/media 30993#. This is a reference to an external file such as an image or video. When 30994#. the file changes, the md5 hash will change to let you know you need to 30995#. update your localized copy. The msgstr is not used at all. Set it to 30996#. whatever you like once you have updated your copy of the file. 30997#: C/scrolledwindow.c.page:25 C/scrolledwindow.js.page:22 30998#: C/scrolledwindow.py.page:23 C/scrolledwindow.vala.page:23 30999msgctxt "_" 31000msgid "" 31001"external ref='media/scrolledwindow.png' " 31002"md5='697bb3205d5c4fb0b4ea8db435843157'" 31003msgstr "" 31004"external ref='media/scrolledwindow.png' " 31005"md5='697bb3205d5c4fb0b4ea8db435843157'" 31006 31007#. (itstool) path: page/p 31008#: C/scrolledwindow.c.page:26 C/scrolledwindow.js.page:23 31009#: C/scrolledwindow.py.page:24 C/scrolledwindow.vala.page:24 31010#, fuzzy 31011msgid "An image in a scrolled window." 31012msgstr "Atributos da janela de rolagem" 31013 31014#. (itstool) path: page/code 31015#: C/scrolledwindow.c.page:28 31016#, no-wrap 31017msgid "" 31018"\n" 31019"#include <gtk/gtk.h>\n" 31020"\n" 31021"\n" 31022"\n" 31023"static void\n" 31024"activate (GtkApplication *app,\n" 31025" gpointer user_data)\n" 31026"{\n" 31027" /* Declare variables */\n" 31028" GtkWidget *window;\n" 31029" GtkWidget *scrolled_window;\n" 31030" GtkWidget *image;\n" 31031"\n" 31032" /* Create a window with a title, and a default size */\n" 31033" window = gtk_application_window_new (app);\n" 31034" gtk_window_set_title (GTK_WINDOW (window), \"ScrolledWindow Example\");\n" 31035" gtk_window_set_default_size (GTK_WINDOW (window), 220, 200);\n" 31036"\n" 31037" /* Create the scrolled window. Usually NULL is passed for both parameters so\n" 31038" * that it creates the horizontal/vertical adjustments automatically. Setting\n" 31039" * the scrollbar policy to automatic allows the scrollbars to only show up\n" 31040" * when needed.\n" 31041" */\n" 31042" scrolled_window = gtk_scrolled_window_new (NULL, NULL);\n" 31043" /* Set the border width */\n" 31044" gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);\n" 31045" /* Extract our desired image from a file that we have */\n" 31046" image = gtk_image_new_from_file (\"gnome-image.png\");\n" 31047" /* And add it to the scrolled window */\n" 31048" gtk_container_add (GTK_CONTAINER (scrolled_window), image);\n" 31049" /* Set the policy of the horizontal and vertical scrollbars to automatic.\n" 31050" * What this means is that the scrollbars are only present if needed.\n" 31051" */\n" 31052" gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),\n" 31053" GTK_POLICY_AUTOMATIC,\n" 31054" GTK_POLICY_AUTOMATIC);\n" 31055"\n" 31056" gtk_container_add (GTK_CONTAINER (window), scrolled_window);\n" 31057"\n" 31058" gtk_widget_show_all (window);\n" 31059"}\n" 31060"\n" 31061"\n" 31062"\n" 31063"int\n" 31064"main (int argc, char **argv)\n" 31065"{\n" 31066" GtkApplication *app;\n" 31067" int status;\n" 31068"\n" 31069" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 31070" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 31071" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 31072" g_object_unref (app);\n" 31073"\n" 31074" return status;\n" 31075"}\n" 31076msgstr "" 31077 31078#. (itstool) path: item/p 31079#: C/scrolledwindow.c.page:37 31080msgid "" 31081"<link href=\"http://developer.gnome.org/gtk/stable/gtk3-Standard-" 31082"Enumerations.html#GtkPolicyType\">GtkPolicyType</link>" 31083msgstr "" 31084 31085#. (itstool) path: info/title 31086#: C/scrolledwindow.js.page:8 31087msgctxt "text" 31088msgid "ScrolledWindow (JavaScript)" 31089msgstr "ScrolledWindow (JavaScript)" 31090 31091#. (itstool) path: section/code 31092#: C/scrolledwindow.js.page:29 31093#, fuzzy, no-wrap 31094#| msgid "" 31095#| "#!/usr/bin/gjs\n" 31096#| "\n" 31097#| "const GLib = imports.gi.GLib;\n" 31098#| "const Gtk = imports.gi.Gtk;\n" 31099#| "const Lang = imports.lang;\n" 31100#| "const Webkit = imports.gi.WebKit;\n" 31101#| "\n" 31102#| "const HelloGNOME = new Lang.Class ({\n" 31103#| " Name: 'Hello GNOME',\n" 31104#| "\n" 31105#| " // Create the application itself\n" 31106#| " _init: function () {\n" 31107#| " this.application = new Gtk.Application ();\n" 31108#| "\n" 31109#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 31110#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 31111#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 31112#| " },\n" 31113#| "\n" 31114#| " // Callback function for 'activate' signal presents windows when active\n" 31115#| " _onActivate: function () {\n" 31116#| " this._window.present ();\n" 31117#| " },\n" 31118#| "\n" 31119#| " // Callback function for 'startup' signal builds the UI\n" 31120#| " _onStartup: function () {\n" 31121#| " this._buildUI ();\n" 31122#| " },\n" 31123#| "\n" 31124#| " // Build the application's UI\n" 31125#| " _buildUI: function () {\n" 31126#| "\n" 31127#| " // Create the application window\n" 31128#| " this._window = new Gtk.ApplicationWindow ({\n" 31129#| " application: this.application,\n" 31130#| " title: \"Welcome to GNOME\",\n" 31131#| " default_height: 200,\n" 31132#| " default_width: 400,\n" 31133#| " window_position: Gtk.WindowPosition.CENTER });\n" 31134#| "\n" 31135#| " // Create a webview to show the web app\n" 31136#| " this._webView = new Webkit.WebView ();\n" 31137#| "\n" 31138#| " // Put the web app into the webview\n" 31139#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 31140#| " \"/hellognome.html\", null));\n" 31141#| "\n" 31142#| " // Put the webview into the window\n" 31143#| " this._window.add (this._webView);\n" 31144#| "\n" 31145#| " // Show the window and all child widgets\n" 31146#| " this._window.show_all();\n" 31147#| " },\n" 31148#| "\n" 31149#| "});\n" 31150#| "\n" 31151#| "// Run the application\n" 31152#| "let app = new HelloGNOME ();\n" 31153#| "app.application.run (ARGV);\n" 31154msgid "" 31155"#!/usr/bin/gjs\n" 31156"\n" 31157"imports.gi.versions.Gtk = '3.0';\n" 31158"\n" 31159"const GObject = imports.gi.GObject;\n" 31160"const Gtk = imports.gi.Gtk;\n" 31161"\n" 31162"class ScrolledWindowExample {\n" 31163"\n" 31164" // Create the application itself\n" 31165" constructor() {\n" 31166" this.application = new Gtk.Application({\n" 31167" application_id: 'org.example.jscrolledwindow'\n" 31168" });\n" 31169"\n" 31170" // Connect 'activate' and 'startup' signals to the callback functions\n" 31171" this.application.connect('activate', this._onActivate.bind(this));\n" 31172" this.application.connect('startup', this._onStartup.bind(this));\n" 31173" }\n" 31174"\n" 31175" // Callback function for 'activate' signal presents windows when active\n" 31176" _onActivate() {\n" 31177" this.window.present();\n" 31178" }\n" 31179"\n" 31180" // Callback function for 'startup' signal builds the UI\n" 31181" _onStartup() {\n" 31182" this._buildUI();\n" 31183" }\n" 31184"\n" 31185" // Build the application's UI\n" 31186" _buildUI() {\n" 31187" // Create the application window\n" 31188" this.window = new Gtk.ApplicationWindow({\n" 31189" application: this.application,\n" 31190" window_position: Gtk.WindowPosition.CENTER,\n" 31191" title: \"ScrolledWindow Example\",\n" 31192" default_width: 200,\n" 31193" default_height: 200,\n" 31194" border_width: 10\n" 31195" });\n" 31196" // the scrolledwindow\n" 31197" this.scrolledWindow = new Gtk.ScrolledWindow();\n" 31198" this.scrolledWindow.set_border_width(10);\n" 31199" // there is always the scrollbar (otherwise: AUTOMATIC - only if needed - or NEVER)\n" 31200" this.scrolledWindow.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS);\n" 31201" // an image - slightly larger than the window\n" 31202" this.image = new Gtk.Image();\n" 31203" this.image.set_from_file(\"gnome-image.png\");\n" 31204"\n" 31205" // add the image to the scrolledwindow\n" 31206" this.scrolledWindow.add_with_viewport(this.image);\n" 31207"\n" 31208" // add the scrolledwindow to the window\n" 31209" this.window.add(this.scrolledWindow);\n" 31210" this.window.show_all();\n" 31211" }\n" 31212"};\n" 31213"\n" 31214"// Run the application\n" 31215"let app = new ScrolledWindowExample();\n" 31216"app.application.run (ARGV);\n" 31217msgstr "" 31218"#!/usr/bin/gjs\n" 31219"\n" 31220"const GLib = imports.gi.GLib;\n" 31221"const Gtk = imports.gi.Gtk;\n" 31222"const Lang = imports.lang;\n" 31223"const Webkit = imports.gi.WebKit;\n" 31224"\n" 31225"const HelloGNOME = new Lang.Class ({\n" 31226" Name: 'Olá, GNOME',\n" 31227"\n" 31228" // Cria o aplicativo em si\n" 31229" _init: function () {\n" 31230" this.application = new Gtk.Application ();\n" 31231"\n" 31232" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 31233" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 31234" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 31235" },\n" 31236"\n" 31237" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 31238" _onActivate: function () {\n" 31239" this._window.present ();\n" 31240" },\n" 31241"\n" 31242" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 31243" _onStartup: function () {\n" 31244" this._buildUI ();\n" 31245" },\n" 31246"\n" 31247" // Constrói a interface gráfica do aplicativo\n" 31248" _buildUI: function () {\n" 31249"\n" 31250" // Cria a janela do aplicativo\n" 31251" this._window = new Gtk.ApplicationWindow ({\n" 31252" application: this.application,\n" 31253" title: \"Bem-vindo ao GNOME\",\n" 31254" default_height: 200,\n" 31255" default_width: 400,\n" 31256" window_position: Gtk.WindowPosition.CENTER });\n" 31257"\n" 31258" // Cria um webview para mostrar o aplicativo web\n" 31259" this._webView = new Webkit.WebView ();\n" 31260"\n" 31261" // Coloca o aplicativo web no webview\n" 31262" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 31263" \"/hellognome.html\", null));\n" 31264"\n" 31265" // Coloca o webview na janela\n" 31266" this._window.add (this._webView);\n" 31267"\n" 31268" // Mostra a janela e todos seus widgets filhos\n" 31269" this._window.show_all();\n" 31270" },\n" 31271"\n" 31272"});\n" 31273"\n" 31274"// Executa o aplicativo\n" 31275"let app = new HelloGNOME ();\n" 31276"app.application.run (ARGV);\n" 31277 31278#. (itstool) path: item/p 31279#: C/scrolledwindow.js.page:36 31280msgid "" 31281"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk." 31282"ScrolledWindow.html\">GtkScrolledWindow</link>" 31283msgstr "" 31284 31285#. (itstool) path: info/title 31286#: C/scrolledwindow.py.page:8 31287msgctxt "text" 31288msgid "ScrolledWindow (Python)" 31289msgstr "ScrolledWindow (Python)" 31290 31291#. (itstool) path: section/code 31292#: C/scrolledwindow.py.page:30 31293#, no-wrap 31294msgid "" 31295"from gi.repository import Gtk\n" 31296"import sys\n" 31297"\n" 31298"\n" 31299"class MyWindow(Gtk.ApplicationWindow):\n" 31300"\n" 31301" def __init__(self, app):\n" 31302" Gtk.Window.__init__(\n" 31303" self, title=\"ScrolledWindow Example\", application=app)\n" 31304" self.set_default_size(200, 200)\n" 31305"\n" 31306" # the scrolledwindow\n" 31307" scrolled_window = Gtk.ScrolledWindow()\n" 31308" scrolled_window.set_border_width(10)\n" 31309" # there is always the scrollbar (otherwise: AUTOMATIC - only if needed\n" 31310" # - or NEVER)\n" 31311" scrolled_window.set_policy(\n" 31312" Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS)\n" 31313"\n" 31314" # an image - slightly larger than the window...\n" 31315" image = Gtk.Image()\n" 31316" image.set_from_file(\"gnome-image.png\")\n" 31317"\n" 31318" # add the image to the scrolledwindow\n" 31319" scrolled_window.add_with_viewport(image)\n" 31320"\n" 31321" # add the scrolledwindow to the window\n" 31322" self.add(scrolled_window)\n" 31323"\n" 31324"\n" 31325"class MyApplication(Gtk.Application):\n" 31326"\n" 31327" def __init__(self):\n" 31328" Gtk.Application.__init__(self)\n" 31329"\n" 31330" def do_activate(self):\n" 31331" win = MyWindow(self)\n" 31332" win.show_all()\n" 31333"\n" 31334" def do_startup(self):\n" 31335" Gtk.Application.do_startup(self)\n" 31336"\n" 31337"app = MyApplication()\n" 31338"exit_status = app.run(sys.argv)\n" 31339"sys.exit(exit_status)\n" 31340msgstr "" 31341 31342#. (itstool) path: section/title 31343#: C/scrolledwindow.py.page:33 31344#, fuzzy 31345msgid "Useful methods for a ScrolledWindow widget" 31346msgstr "Métodos úteis" 31347 31348#. (itstool) path: item/p 31349#: C/scrolledwindow.py.page:35 31350msgid "" 31351"<code>set_policy(hscrollbar_policy, vscrollbar_policy)</code> where each of " 31352"the arguments is one of <code>Gtk.Policy.AUTOMATIC, Gtk.Policy.ALWAYS, Gtk." 31353"Policy.NEVER</code> regulates whether the horizontal and vertical scrollbars " 31354"should appear: with <code>AUTOMATIC</code> they appear only if needed, " 31355"<code>ALWAYS</code> and <code>NEVER</code> are self-explanatory." 31356msgstr "" 31357 31358#. (itstool) path: item/p 31359#: C/scrolledwindow.py.page:36 31360msgid "" 31361"<code>add_with_viewport(widget)</code> is used to add the Gtk.Widget " 31362"<code>widget</code> without native scrolling capabilities inside the window." 31363msgstr "" 31364 31365#. (itstool) path: item/p 31366#: C/scrolledwindow.py.page:37 31367msgid "" 31368"<code>set_placement(window_placement)</code> sets the placement of the " 31369"contents with respect to the scrollbars for the scrolled window. The options " 31370"for the argument are <code>Gtk.CornerType.TOP_LEFT</code> (default: the " 31371"scrollbars are on the bottom and on the right of the window), <code>Gtk." 31372"CornerType.TOP_RIGHT, Gtk.CornerType.BOTTOM_LEFT, Gtk.CornerType." 31373"BOTTOM_RIGHT</code>." 31374msgstr "" 31375 31376#. (itstool) path: item/p 31377#: C/scrolledwindow.py.page:38 31378msgid "" 31379"<code>set_hadjustment(adjustment)</code> and " 31380"<code>set_vadjustment(adjustment)</code> set the Gtk.Adjustment " 31381"<code>adjustment</code>. This is the representation of a value with a lower " 31382"and upper bound, together with step and page increments, and a page size, " 31383"and it is constructed as <code>Gtk.Adjustment(value, lower, upper, " 31384"step_increment, page_increment, page_size)</code> where the fields are of " 31385"type <code>float</code>. (Note that <code>step_increment</code> is not used " 31386"in this case, it can be set to <code>0</code>.)" 31387msgstr "" 31388 31389#. (itstool) path: item/p 31390#: C/scrolledwindow.py.page:45 C/textview.py.page:99 31391msgid "" 31392"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkScrolledWindow.html" 31393"\">GtkScrolledWindow</link>" 31394msgstr "" 31395 31396#. (itstool) path: info/title 31397#: C/scrolledwindow.vala.page:8 31398msgctxt "text" 31399msgid "ScrolledWindow (Vala)" 31400msgstr "ScrolledWindow (Vala)" 31401 31402#. (itstool) path: page/code 31403#: C/scrolledwindow.vala.page:26 31404#, no-wrap 31405msgid "" 31406"/* This is the application. */\n" 31407"public class MyApplication : Gtk.Application {\n" 31408"\t/* Override the 'activate' signal of GLib.Application. */\n" 31409"\tprotected override void activate () {\n" 31410"\t\t/* Create the window of this application. */\n" 31411"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 31412"\t\twindow.title = \"ScrolledWindow Example\";\n" 31413"\t\twindow.set_default_size (200, 200);\n" 31414"\n" 31415"\t\tvar scrolled_window = new Gtk.ScrolledWindow (null, null);\n" 31416"\t\tscrolled_window.set_border_width (10);\n" 31417"\t\tscrolled_window.add_with_viewport (new Gtk.Image.from_file (\"gnome-image.png\"));\n" 31418"\t\tscrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n" 31419"\n" 31420"\t\twindow.add (scrolled_window);\n" 31421"\t\twindow.show_all ();\n" 31422"\t}\n" 31423"}\n" 31424"\n" 31425"/* main creates and runs the application. */\n" 31426"public int main (string[] args) {\n" 31427"\treturn new MyApplication ().run (args);\n" 31428"}\n" 31429msgstr "" 31430 31431#. (itstool) path: item/p 31432#: C/scrolledwindow.vala.page:31 C/textview.vala.page:37 31433msgid "" 31434"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ScrolledWindow.html\">Gtk." 31435"ScrolledWindow</link>" 31436msgstr "" 31437 31438#. (itstool) path: item/p 31439#: C/scrolledwindow.vala.page:32 C/textview.vala.page:39 31440msgid "" 31441"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.PolicyType.html\">Gtk." 31442"PolicyType</link>" 31443msgstr "" 31444 31445#. (itstool) path: info/title 31446#: C/separator.c.page:8 31447#, fuzzy 31448msgctxt "text" 31449msgid "Separator (C)" 31450msgstr "Separador “%c” inválido" 31451 31452#. (itstool) path: info/desc 31453#: C/separator.c.page:19 C/separator.py.page:20 C/separator.vala.page:21 31454#, fuzzy 31455msgid "A separator widget" 31456msgstr "_Separador:" 31457 31458#. (itstool) path: page/title 31459#: C/separator.c.page:22 C/separator.py.page:23 C/separator.vala.page:24 31460#, fuzzy 31461msgid "Separator" 31462msgstr "Separador" 31463 31464#. (itstool) path: page/media 31465#. This is a reference to an external file such as an image or video. When 31466#. the file changes, the md5 hash will change to let you know you need to 31467#. update your localized copy. The msgstr is not used at all. Set it to 31468#. whatever you like once you have updated your copy of the file. 31469#: C/separator.c.page:24 C/separator.py.page:25 C/separator.vala.page:26 31470msgctxt "_" 31471msgid "" 31472"external ref='media/separator.png' md5='8769b27662ce5c77f99e9ce33751a21a'" 31473msgstr "" 31474"external ref='media/separator.png' md5='8769b27662ce5c77f99e9ce33751a21a'" 31475 31476#. (itstool) path: page/p 31477#: C/separator.c.page:25 C/separator.py.page:26 C/separator.vala.page:27 31478msgid "A horizontal and a vertical separator divide some labels." 31479msgstr "" 31480 31481#. (itstool) path: section/code 31482#: C/separator.c.page:31 31483#, no-wrap 31484msgid "" 31485"#include <gtk/gtk.h>\n" 31486"\n" 31487"static void\n" 31488"activate (GtkApplication *app,\n" 31489" gpointer user_data)\n" 31490"{\n" 31491" GtkWidget *grid;\n" 31492" GtkWidget *window;\n" 31493" GtkWidget *label1;\n" 31494" GtkWidget *label2;\n" 31495" GtkWidget *label3;\n" 31496" GtkWidget *hseparator;\n" 31497" GtkWidget *vseparator;\n" 31498"\n" 31499" window = gtk_application_window_new (app);\n" 31500" gtk_window_set_title (GTK_WINDOW (window), \"Separator Example\");\n" 31501"\n" 31502" label1 = gtk_label_new (\"Below, a horizontal separator.\");\n" 31503" label2 = gtk_label_new (\"On the right, a vertical separator.\");\n" 31504" label3 = gtk_label_new (\"On the left, a vertical separator.\");\n" 31505"\n" 31506" vseparator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);\n" 31507" hseparator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);\n" 31508"\n" 31509" grid = gtk_grid_new ();\n" 31510"\n" 31511" gtk_grid_attach (GTK_GRID (grid), label1, 0, 0, 3, 1);\n" 31512" gtk_grid_attach (GTK_GRID (grid), hseparator, 0, 1, 3, 1);\n" 31513" gtk_grid_attach (GTK_GRID (grid), label2, 0, 2, 1, 1);\n" 31514" gtk_grid_attach (GTK_GRID (grid), vseparator, 1, 2, 1, 1);\n" 31515" gtk_grid_attach (GTK_GRID (grid), label3, 2, 2, 1, 1);\n" 31516"\n" 31517" gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);\n" 31518"\n" 31519" gtk_container_add (GTK_CONTAINER (window), grid);\n" 31520"\n" 31521" gtk_widget_show_all (window);\n" 31522"}\n" 31523"\n" 31524"int\n" 31525"main (int argc, char **argv)\n" 31526"{\n" 31527" GtkApplication *app;\n" 31528" int status;\n" 31529"\n" 31530" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 31531" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 31532" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 31533" g_object_unref (app);\n" 31534" return status;\n" 31535"}\n" 31536msgstr "" 31537 31538#. (itstool) path: section/title 31539#: C/separator.c.page:35 C/separator.py.page:36 C/separator.vala.page:37 31540#, fuzzy 31541msgid "API Reference" 31542msgstr "Referência de API" 31543 31544#. (itstool) path: item/p 31545#: C/separator.c.page:39 C/separator.py.page:40 31546msgid "" 31547"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkSeparator.html" 31548"\">GtkSeparator</link>" 31549msgstr "" 31550 31551#. (itstool) path: info/title 31552#: C/separator.py.page:8 31553#, fuzzy 31554msgctxt "text" 31555msgid "Separator (Python)" 31556msgstr "_Python" 31557 31558#. (itstool) path: section/code 31559#: C/separator.py.page:32 31560#, no-wrap 31561msgid "" 31562"from gi.repository import Gtk\n" 31563"import sys\n" 31564"\n" 31565"\n" 31566"class MyWindow(Gtk.ApplicationWindow):\n" 31567"\n" 31568" def __init__(self, app):\n" 31569" Gtk.Window.__init__(self, title=\"Separator Example\", application=app)\n" 31570"\n" 31571" # three labels\n" 31572" label1 = Gtk.Label()\n" 31573" label1.set_text(\"Below, a horizontal separator.\")\n" 31574"\n" 31575" label2 = Gtk.Label()\n" 31576" label2.set_text(\"On the right, a vertical separator.\")\n" 31577"\n" 31578" label3 = Gtk.Label()\n" 31579" label3.set_text(\"On the left, a vertical separator.\")\n" 31580"\n" 31581" # a horizontal separator\n" 31582" hseparator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)\n" 31583" # a vertical separator\n" 31584" vseparator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)\n" 31585"\n" 31586" # a grid to attach labels and separators\n" 31587" grid = Gtk.Grid()\n" 31588" grid.attach(label1, 0, 0, 3, 1)\n" 31589" grid.attach(hseparator, 0, 1, 3, 1)\n" 31590" grid.attach(label2, 0, 2, 1, 1)\n" 31591" grid.attach(vseparator, 1, 2, 1, 1)\n" 31592" grid.attach(label3, 2, 2, 1, 1)\n" 31593" grid.set_column_homogeneous(True)\n" 31594" # add the grid to the window\n" 31595" self.add(grid)\n" 31596"\n" 31597"\n" 31598"class MyApplication(Gtk.Application):\n" 31599"\n" 31600" def __init__(self):\n" 31601" Gtk.Application.__init__(self)\n" 31602"\n" 31603" def do_activate(self):\n" 31604" win = MyWindow(self)\n" 31605" win.show_all()\n" 31606"\n" 31607"app = MyApplication()\n" 31608"exit_status = app.run(sys.argv)\n" 31609"sys.exit(exit_status)\n" 31610msgstr "" 31611 31612#. (itstool) path: info/title 31613#: C/separator.vala.page:8 31614#, fuzzy 31615msgctxt "text" 31616msgid "Separator (Vala)" 31617msgstr "Separador" 31618 31619#. (itstool) path: section/code 31620#: C/separator.vala.page:33 31621#, no-wrap 31622msgid "" 31623"/* This is the application. */\n" 31624"public class Application : Gtk.Application {\n" 31625"\n" 31626"\tpublic Application () {\n" 31627"\t\tObject (application_id: \"org.example.window\");\n" 31628"\t}\n" 31629"\n" 31630"\t/* Override the 'activate' signal of GLib.Application,\n" 31631"\t * which is inherited by Gtk.Application. */\n" 31632"\tpublic override void activate () {\n" 31633"\n" 31634"\t\tvar window = new Gtk.Window ();\n" 31635"\t\twindow.title = \"Separator Example\";\n" 31636"\n" 31637"\t\tvar label1 = new Gtk.Label (\"Below, a horizontal separator.\");\n" 31638"\t\tvar label2 = new Gtk.Label (\"On the right, a vertical separator.\");\n" 31639"\t\tvar label3 = new Gtk.Label (\"On the left, a vertical separator.\");\n" 31640"\n" 31641"\t\tvar hseparator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);\n" 31642"\t\tvar vseparator = new Gtk.Separator (Gtk.Orientation.VERTICAL);\n" 31643"\n" 31644"\t\tvar grid = new Gtk.Grid();\n" 31645"\n" 31646"\t\tgrid.attach (label1, 0, 0, 3, 1);\n" 31647"\t\tgrid.attach (hseparator, 0, 1, 3, 1);\n" 31648"\t\tgrid.attach (label2, 0, 2, 1, 1);\n" 31649"\t\tgrid.attach (vseparator, 1, 2, 1, 1);\n" 31650"\t\tgrid.attach (label3, 2, 2, 1, 1);\n" 31651"\n" 31652"\t\tgrid.set_column_homogeneous(true);\n" 31653"\n" 31654"\t\twindow.add (grid);\n" 31655"\t\tthis.add_window (window);\n" 31656"\n" 31657"\t\twindow.show_all ();\n" 31658"\t}\n" 31659"}\n" 31660"\n" 31661"/* The main function creates the application and runs it.*/\n" 31662"int main (string[] args) {\n" 31663"\tvar app = new Application ();\n" 31664"\treturn app.run (args);\n" 31665"}\n" 31666msgstr "" 31667 31668#. (itstool) path: item/p 31669#: C/separator.vala.page:41 31670msgid "" 31671"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Window.html\">GtkWindow</" 31672"link>" 31673msgstr "" 31674 31675#. (itstool) path: item/p 31676#: C/separator.vala.page:42 31677msgid "" 31678"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Separator.html" 31679"\">GtkSeparator</link>" 31680msgstr "" 31681 31682#. (itstool) path: item/p 31683#: C/separator.vala.page:43 31684msgid "" 31685"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Grid.html\">GtkGrid</link>" 31686msgstr "" 31687 31688#. (itstool) path: item/p 31689#: C/separator.vala.page:44 31690msgid "" 31691"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Label.html\">GtkLabel</link>" 31692msgstr "" 31693 31694#. (itstool) path: page/title 31695#: C/set-up-gedit.js.page:19 31696msgid "Set up gedit for JavaScript development" 31697msgstr "" 31698 31699#. (itstool) path: page/p 31700#: C/set-up-gedit.js.page:20 31701msgid "" 31702"This tutorial will show you how to set up <link href=\"http://projects.gnome." 31703"org/gedit/\">gedit</link>, GNOME's basic text editor, so that it has a " 31704"handful of extra features which are useful for writing JavaScript code." 31705msgstr "" 31706 31707#. (itstool) path: section/title 31708#: C/set-up-gedit.js.page:23 31709msgid "Making code clearer" 31710msgstr "" 31711 31712#. (itstool) path: section/p 31713#: C/set-up-gedit.js.page:24 31714msgid "" 31715"Click on <gui>Edit</gui> in gedit's menu bar, then click on " 31716"<gui>Preferences</gui>. You should see something like this:" 31717msgstr "" 31718 31719#. (itstool) path: section/media 31720#. This is a reference to an external file such as an image or video. When 31721#. the file changes, the md5 hash will change to let you know you need to 31722#. update your localized copy. The msgstr is not used at all. Set it to 31723#. whatever you like once you have updated your copy of the file. 31724#: C/set-up-gedit.js.page:25 31725msgctxt "_" 31726msgid "" 31727"external ref='media/geditview.png' md5='f1438295662d95f56fcd1d8200efaaf2'" 31728msgstr "" 31729"external ref='media/geditview.png' md5='f1438295662d95f56fcd1d8200efaaf2'" 31730 31731#. (itstool) path: section/p 31732#: C/set-up-gedit.js.page:26 31733msgid "Here are the options you want to make sure are turned on." 31734msgstr "" 31735 31736#. (itstool) path: item/p 31737#: C/set-up-gedit.js.page:28 31738msgid "" 31739"<gui>Display line numbers</gui> will help you compare the code you type in " 31740"with the original, and make it easier to see which line is causing an error " 31741"if there is a bug." 31742msgstr "" 31743 31744#. (itstool) path: item/p 31745#: C/set-up-gedit.js.page:29 31746msgid "" 31747"<gui>Highlight current line</gui> makes it easier to see which line you're " 31748"on, when you have to go back and forth a lot." 31749msgstr "" 31750 31751#. (itstool) path: item/p 31752#: C/set-up-gedit.js.page:30 31753msgid "" 31754"<gui>Highlight matching brackets</gui> helps you make sure you didn't leave " 31755"out a bracket by accident." 31756msgstr "" 31757 31758#. (itstool) path: section/title 31759#: C/set-up-gedit.js.page:35 31760#, fuzzy 31761msgid "Making editing easier" 31762msgstr "Remove otimização para tornar a edição mais fácil" 31763 31764#. (itstool) path: section/p 31765#: C/set-up-gedit.js.page:36 31766msgid "" 31767"In gedit's <gui>Preferences</gui> dialog, click on the <gui>Editor</gui> " 31768"tab. You should see something like this:" 31769msgstr "" 31770 31771#. (itstool) path: section/media 31772#. This is a reference to an external file such as an image or video. When 31773#. the file changes, the md5 hash will change to let you know you need to 31774#. update your localized copy. The msgstr is not used at all. Set it to 31775#. whatever you like once you have updated your copy of the file. 31776#: C/set-up-gedit.js.page:37 31777msgctxt "_" 31778msgid "" 31779"external ref='media/gediteditor.png' md5='50db1ee8f2c545744879ee9fba5b4b24'" 31780msgstr "" 31781"external ref='media/gediteditor.png' md5='50db1ee8f2c545744879ee9fba5b4b24'" 31782 31783#. (itstool) path: section/p 31784#: C/set-up-gedit.js.page:38 31785msgid "" 31786"Here, you want to have <gui>Enable automatic indentation</gui> turned on. " 31787"This means that when you hit <key>Enter</key> the cursor stays indented as " 31788"far as the last line was. This is extremely useful when writing JavaScript " 31789"code, since it uses indentation to make it clearer which parts do what." 31790msgstr "" 31791 31792#. (itstool) path: note/p 31793#: C/set-up-gedit.js.page:39 31794msgid "" 31795"If you want to share code with other people who write GNOME JavaScript " 31796"applications, you'll also want to set <gui>Tab width</gui> to 4 and turn on " 31797"<gui>Insert spaces instead of tabs</gui>." 31798msgstr "" 31799 31800#. (itstool) path: info/title 31801#: C/signals-callbacks.py.page:9 31802#, fuzzy 31803msgctxt "text" 31804msgid "Signals and callbacks (Python)" 31805msgstr "_Python" 31806 31807#. (itstool) path: info/desc 31808#: C/signals-callbacks.py.page:14 31809msgid "An explanation of signals and callbacks in GTK+." 31810msgstr "" 31811 31812#. (itstool) path: page/title 31813#: C/signals-callbacks.py.page:27 31814#, fuzzy 31815msgid "Signals and callbacks" 31816msgstr "_Sinais" 31817 31818#. (itstool) path: section/p 31819#: C/signals-callbacks.py.page:34 31820msgid "" 31821"Like most GUI toolkits, GTK+ uses an event-driven programming model. When " 31822"the user is doing nothing, GTK+ sits in the main loop and waits for input. " 31823"If the user performs some action - say, a mouse click - then the main loop " 31824"\"wakes up\" and delivers an event to GTK+." 31825msgstr "" 31826 31827#. (itstool) path: section/p 31828#: C/signals-callbacks.py.page:36 31829msgid "" 31830"When widgets receive an event, they frequently emit one or more signals. " 31831"Signals notify your program that \"something interesting happened\" by " 31832"invoking functions you have connected to the signal. Such functions are " 31833"commonly known as callbacks. When your callbacks are invoked, you would " 31834"typically take some action. After a callback finishes, GTK+ will return to " 31835"the main loop and await more user input." 31836msgstr "" 31837 31838#. (itstool) path: section/p 31839#: C/signals-callbacks.py.page:38 31840msgid "" 31841"A generic example is: <code>handler_id = widget.connect(\"event\", callback, " 31842"data)</code>. <code>widget</code> is an instance of a widget we created " 31843"earlier. Next, the <code>event</code> we are interested in. Each widget has " 31844"its own particular events which can occur. For instance, if you have a Gtk." 31845"Button you usually want to connect to the \"clicked\" event: this means that " 31846"when the button is clicked, the signal is issued. Another example is the " 31847"<code>notify::property</code> signal: whenever a <link xref=\"properties.py" 31848"\">property</link> is modified on a GObject, instead of just emitting the " 31849"<code>notify</code> signal, GObject associates as a detail to this signal " 31850"emission the name of the property modified. This allows clients who wish to " 31851"be notified of changes to only one property to filter most events before " 31852"receiving them. Thirdly, the callback argument is the name of the callback " 31853"function, which contains the code which runs when signals of the specified " 31854"type are issued. Finally, the optional data argument includes any data which " 31855"should be passed when the signal is issued." 31856msgstr "" 31857 31858#. (itstool) path: section/p 31859#: C/signals-callbacks.py.page:40 31860msgid "" 31861"The function returns a number (the <code>handler_id</code>) that identifies " 31862"this particular signal-callback pair. This number is required to disconnect " 31863"from a signal such that the callback function will not be called during any " 31864"future or currently ongoing emissions of the signal it has been connected " 31865"to, as in <code>widget.disconnect(handler_id)</code>." 31866msgstr "" 31867 31868#. (itstool) path: section/p 31869#: C/signals-callbacks.py.page:47 31870msgid "" 31871"<link href=\"http://developer.gnome.org/gobject/stable/signal.html" 31872"\">Signals</link> in GObject documentation" 31873msgstr "" 31874 31875#. (itstool) path: section/p 31876#: C/signals-callbacks.py.page:48 31877msgid "" 31878"<link href=\"http://python-gtk-3-tutorial.readthedocs.org/en/latest/basics." 31879"html\">Basics - Main loop and Signals</link> in Python GTK+ 3 Tutorial" 31880msgstr "" 31881 31882#. (itstool) path: info/title 31883#: C/spinbutton.c.page:8 31884#, fuzzy 31885msgctxt "text" 31886msgid "SpinButton (C)" 31887msgstr "Botão de rolagem para atualização" 31888 31889#. (itstool) path: info/desc 31890#: C/spinbutton.c.page:21 31891#, fuzzy 31892msgid "Retrieve an integer or floating point number" 31893msgstr "Número de ponto flutuante" 31894 31895#. (itstool) path: page/title 31896#: C/spinbutton.c.page:24 C/spinbutton.js.page:24 C/spinbutton.py.page:23 31897#: C/spinbutton.vala.page:23 31898#, fuzzy 31899msgid "SpinButton" 31900msgstr "Botão de rolagem para atualização" 31901 31902#. (itstool) path: page/media 31903#. This is a reference to an external file such as an image or video. When 31904#. the file changes, the md5 hash will change to let you know you need to 31905#. update your localized copy. The msgstr is not used at all. Set it to 31906#. whatever you like once you have updated your copy of the file. 31907#: C/spinbutton.c.page:26 C/spinbutton.py.page:24 C/spinbutton.vala.page:24 31908msgctxt "_" 31909msgid "" 31910"external ref='media/spinbutton.png' md5='993cbb7d9bd271a329727a926195712a'" 31911msgstr "" 31912"external ref='media/spinbutton.png' md5='993cbb7d9bd271a329727a926195712a'" 31913 31914#. (itstool) path: page/p 31915#: C/spinbutton.c.page:27 C/spinbutton.py.page:25 C/spinbutton.vala.page:25 31916msgid "Choose a number, by entering it or by clicking on the -/+ buttons!" 31917msgstr "" 31918 31919#. (itstool) path: page/code 31920#: C/spinbutton.c.page:29 31921#, no-wrap 31922msgid "" 31923"\n" 31924"#include <gtk/gtk.h>\n" 31925"\n" 31926"\n" 31927"\n" 31928"/* This is the callback function. \n" 31929" * It is a handler function which reacts to the signal. \n" 31930" * In this case, it will notify the user the value of their spinbutton \n" 31931" * as a label.\n" 31932" */\n" 31933"static void\n" 31934"spin_clicked (GtkSpinButton *spinbutton,\n" 31935" gpointer user_data)\n" 31936"{\n" 31937" GtkWidget *label = user_data;\n" 31938" gint value = gtk_spin_button_get_value_as_int (spinbutton);\n" 31939"\n" 31940" /* %d - Is used when printing integers.\n" 31941" * Note: Using g_strdup_printf returns a string that must be freed. \n" 31942" * (In which is done below)\n" 31943" */\n" 31944" gchar *str = g_strdup_printf (\"The number you selected is %d.\", value);\n" 31945" gtk_label_set_text (GTK_LABEL (label), str);\n" 31946"\n" 31947" g_free(str);\n" 31948"}\n" 31949"\n" 31950"\n" 31951"\n" 31952"static void\n" 31953"activate (GtkApplication *app,\n" 31954" gpointer user_data)\n" 31955"{\n" 31956" /* Declare variables */\n" 31957" GtkWidget *window;\n" 31958" GtkWidget *label;\n" 31959" GtkWidget *grid;\n" 31960" GtkWidget *spin_button;\n" 31961" GtkAdjustment *adjustment;\n" 31962"\n" 31963"\n" 31964" /* Create a window with a title, a border width, and a default size */\n" 31965" window = gtk_application_window_new (app);\n" 31966" gtk_window_set_title (GTK_WINDOW (window), \"SpinButton Example\");\n" 31967" gtk_window_set_default_size (GTK_WINDOW (window), 210, 70);\n" 31968" gtk_container_set_border_width (GTK_CONTAINER (window), 5);\n" 31969"\n" 31970" /* Create a label to be shown in the window */\n" 31971" label = gtk_label_new (\"Choose a number\");\n" 31972"\n" 31973" /* Create an adjustment representing an adjustable bounded value */\n" 31974" adjustment = gtk_adjustment_new (0, 0, 100, 1, 0, 0);\n" 31975"\n" 31976"\n" 31977" /* Create a spin button that is to be as wide as possible */\n" 31978" spin_button = gtk_spin_button_new (adjustment, 1, 0);\n" 31979" gtk_widget_set_hexpand (spin_button, TRUE);\n" 31980" \n" 31981" /* Connecting the \"value-changed\" signal for the spinbutton \n" 31982" * to the appropriate callback function. \n" 31983" */\n" 31984" g_signal_connect (spin_button, \n" 31985" \"value-changed\", \n" 31986" G_CALLBACK (spin_clicked), \n" 31987" label);\n" 31988"\n" 31989"\n" 31990" /* Create a grid and arrange everything accordingly */\n" 31991" grid = gtk_grid_new ();\n" 31992" gtk_grid_set_column_spacing (GTK_GRID (grid), 10);\n" 31993" gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);\n" 31994" gtk_grid_attach (GTK_GRID (grid), spin_button, 0, 0, 1, 1);\n" 31995" gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);\n" 31996" \n" 31997"\n" 31998" gtk_container_add (GTK_CONTAINER (window), grid);\n" 31999"\n" 32000" gtk_widget_show_all (window);\n" 32001"}\n" 32002"\n" 32003"\n" 32004"\n" 32005"int\n" 32006"main (int argc, char **argv)\n" 32007"{\n" 32008" GtkApplication *app;\n" 32009" int status;\n" 32010"\n" 32011" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 32012" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 32013" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 32014" g_object_unref (app);\n" 32015"\n" 32016" return status;\n" 32017"}\n" 32018msgstr "" 32019 32020#. (itstool) path: item/p 32021#: C/spinbutton.c.page:37 32022#, fuzzy 32023msgid "" 32024"<link href=\"http://developer.gnome.org/gtk3/stable/GtkSpinButton.html" 32025"\">GtkSpinButton</link>" 32026msgstr "" 32027"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 32028"link>" 32029 32030#. (itstool) path: info/title 32031#: C/spinbutton.js.page:8 32032#, fuzzy 32033msgctxt "text" 32034msgid "SpinButton (JavaScript)" 32035msgstr "JavaScript" 32036 32037#. (itstool) path: info/desc 32038#: C/spinbutton.js.page:21 32039msgid "A number entry field that has + and - buttons" 32040msgstr "" 32041 32042#. (itstool) path: page/media 32043#. This is a reference to an external file such as an image or video. When 32044#. the file changes, the md5 hash will change to let you know you need to 32045#. update your localized copy. The msgstr is not used at all. Set it to 32046#. whatever you like once you have updated your copy of the file. 32047#: C/spinbutton.js.page:25 32048msgctxt "_" 32049msgid "" 32050"external ref='media/spinbuttonkittens.png' " 32051"md5='577cce8a902140aacbab73fe8a76a010'" 32052msgstr "" 32053"external ref='media/spinbuttonkittens.png' " 32054"md5='577cce8a902140aacbab73fe8a76a010'" 32055 32056#. (itstool) path: page/p 32057#: C/spinbutton.js.page:26 32058msgid "" 32059"A SpinButton is not related to a <link xref=\"spinner.js\">Spinner</link>. " 32060"It's a text entry field which only accepts numbers, and which has plus and " 32061"minus buttons to let you change the value without having to type anything in." 32062msgstr "" 32063 32064#. (itstool) path: page/p 32065#: C/spinbutton.js.page:27 32066msgid "" 32067"It's best used when it's obvious that only a number can be entered into it. " 32068"In this example, two SpinButtons are used for the number of kittens and " 32069"number of cans of tuna to give them." 32070msgstr "" 32071 32072#. (itstool) path: section/code 32073#: C/spinbutton.js.page:44 32074#, no-wrap 32075msgid "" 32076"\n" 32077"const SpinButtonExample = new Lang.Class({\n" 32078" Name: 'SpinButton Example',\n" 32079"\n" 32080" // Create the application itself\n" 32081" _init: function() {\n" 32082" this.application = new Gtk.Application({\n" 32083" application_id: 'org.example.jsspinbutton'\n" 32084" });\n" 32085"\n" 32086" // Connect 'activate' and 'startup' signals to the callback functions\n" 32087" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 32088" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 32089" },\n" 32090"\n" 32091" // Callback function for 'activate' signal presents window when active\n" 32092" _onActivate: function() {\n" 32093" this._window.present();\n" 32094" },\n" 32095"\n" 32096" // Callback function for 'startup' signal builds the UI\n" 32097" _onStartup: function() {\n" 32098" this._buildUI ();\n" 32099" },\n" 32100msgstr "" 32101 32102#. (itstool) path: section/p 32103#: C/spinbutton.js.page:69 32104msgid "" 32105"All the code for this sample goes in the SpinButtonExample class. The above " 32106"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 32107"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 32108"go in." 32109msgstr "" 32110 32111#. (itstool) path: section/code 32112#: C/spinbutton.js.page:70 32113#, no-wrap 32114msgid "" 32115"\n" 32116" // Build the application's UI\n" 32117" _buildUI: function() {\n" 32118"\n" 32119" // Create the application window\n" 32120" this._window = new Gtk.ApplicationWindow({\n" 32121" application: this.application,\n" 32122" window_position: Gtk.WindowPosition.CENTER,\n" 32123" border_width: 20,\n" 32124" title: \"Kitten Feeder\"});\n" 32125msgstr "" 32126 32127#. (itstool) path: section/title 32128#: C/spinbutton.js.page:85 32129#, fuzzy 32130msgid "Creating the SpinButtons" 32131msgstr "sem tabelas, criando …" 32132 32133#. (itstool) path: section/code 32134#: C/spinbutton.js.page:86 32135#, no-wrap 32136msgid "" 32137"\n" 32138" // Create the first spinbutton using a function\n" 32139" this._kittens = Gtk.SpinButton.new_with_range (1, 9001, 1);\n" 32140" this._kittens.connect (\"value-changed\", Lang.bind (this, this._newValue));\n" 32141msgstr "" 32142 32143#. (itstool) path: section/p 32144#: C/spinbutton.js.page:92 32145msgid "" 32146"We can use the new_with_range function to create a new SpinButton quickly. " 32147"Its first parameter is the SpinButton's starting value, its second is the " 32148"maximum value, and its third is how much to increment it when the plus or " 32149"minus buttons are pressed." 32150msgstr "" 32151 32152#. (itstool) path: section/p 32153#: C/spinbutton.js.page:93 32154msgid "" 32155"After we create the first SpinButton, we connect its value-changed signal to " 32156"a function which handles what happens when the number inside either " 32157"SpinButton changes." 32158msgstr "" 32159 32160#. (itstool) path: section/code 32161#: C/spinbutton.js.page:95 32162#, no-wrap 32163msgid "" 32164"\n" 32165" // Create an adjustment to use for the second spinbutton\n" 32166" this._adjustment = new Gtk.Adjustment ({\n" 32167" value: 1,\n" 32168" lower: 0,\n" 32169" upper: 9001,\n" 32170" step_increment: 1,\n" 32171" page_increment: 10 });\n" 32172"\n" 32173" // Create the second spinbutton\n" 32174" this._tuna = new Gtk.SpinButton ({ adjustment: this._adjustment });\n" 32175" this._tuna.connect (\"value-changed\", Lang.bind (this, this._newValue));\n" 32176"\n" 32177" // this._tuna.set_digits (1);\n" 32178" // this._tuna.set_wrap (true);\n" 32179msgstr "" 32180 32181#. (itstool) path: section/p 32182#: C/spinbutton.js.page:112 32183msgid "" 32184"If you want more fine-grained control over a SpinButton, or want to create a " 32185"bunch of SpinButtons which all use the same parameters, you can create an " 32186"object called an <link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/" 32187"Gtk.Adjustment.html\">Adjustment</link>. Then you can use that object as a " 32188"new SpinButton's adjustment property, and it sets all the values at once. " 32189"Afterwards, you can change all the SpinButtons which use that adjustment by " 32190"changing the Adjustment object's properties." 32191msgstr "" 32192 32193#. (itstool) path: section/p 32194#: C/spinbutton.js.page:113 32195msgid "" 32196"The commented-out lines here show things you can do to customize your " 32197"SpinButton. You can set the number of digits which go after the decimal " 32198"point, for example, or tell it to wrap the number around if it goes past the " 32199"upper or lower bounds that you set." 32200msgstr "" 32201 32202#. (itstool) path: note/p 32203#: C/spinbutton.js.page:114 32204msgid "" 32205"For the kitties' sake, please don't use set_digits to allow a decimal number " 32206"of kittens." 32207msgstr "" 32208 32209#. (itstool) path: section/title 32210#: C/spinbutton.js.page:118 32211#, fuzzy 32212msgid "Creating the rest of the UI" 32213msgstr "UI" 32214 32215#. (itstool) path: section/code 32216#: C/spinbutton.js.page:120 32217#, no-wrap 32218msgid "" 32219"\n" 32220" // Create the text labels to go with the spinbuttons\n" 32221" this._startLabel = new Gtk.Label ({ label: \"There are \" });\n" 32222" this._kittenLabel = new Gtk.Label ({ label: \" kitten(s), and \"});\n" 32223" this._tunaLabel = new Gtk.Label ({ label: \" can(s) of tuna.\"});\n" 32224" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()));\n" 32225" this._lastLabel = new Gtk.Label ({\n" 32226" label: \"That's \" + this.perKitten + \" can(s) of tuna per kitten.\" });\n" 32227msgstr "" 32228 32229#. (itstool) path: section/p 32230#: C/spinbutton.js.page:129 32231msgid "" 32232"We create each <link xref=\"label.js\">Label</link> individually, and then " 32233"string them together along with the SpinButtons. The last label needs to " 32234"show the number of cans of tuna per kitten, so it has a variable in the " 32235"middle, which corresponds to an equation that uses the SpinButtons' " 32236"get_value functions to find out what they're set at. JavaScript's Math " 32237"function's floor method is used to round the number of cans of tuna per " 32238"kitten down to the nearest whole number." 32239msgstr "" 32240 32241#. (itstool) path: section/code 32242#: C/spinbutton.js.page:131 32243#, no-wrap 32244msgid "" 32245"\n" 32246" // Create a grid to put the spinbuttons and their labels in\n" 32247" this._spinGrid = new Gtk.Grid ({\n" 32248" halign: Gtk.Align.CENTER,\n" 32249" valign: Gtk.Align.CENTER,\n" 32250" margin_bottom: 20 });\n" 32251"\n" 32252" // Attach everything to the grid\n" 32253" this._spinGrid.attach (this._startLabel, 0, 0, 1, 1);\n" 32254" this._spinGrid.attach (this._kittens, 1, 0, 1, 1);\n" 32255" this._spinGrid.attach (this._kittenLabel, 2, 0, 1, 1);\n" 32256" this._spinGrid.attach (this._tuna, 3, 0, 1, 1);\n" 32257" this._spinGrid.attach (this._tunaLabel, 4, 0, 1, 1);\n" 32258"\n" 32259" // Create a main grid to hold it and the last label\n" 32260" this._mainGrid = new Gtk.Grid ({\n" 32261" halign: Gtk.Align.CENTER,\n" 32262" valign: Gtk.Align.CENTER });\n" 32263"\n" 32264" // Attach the smaller grid and the last label to the main grid\n" 32265" this._mainGrid.attach (this._spinGrid, 0, 0, 1, 1);\n" 32266" this._mainGrid.attach (this._lastLabel, 0, 1, 1, 1);\n" 32267msgstr "" 32268 32269#. (itstool) path: section/p 32270#: C/spinbutton.js.page:155 32271msgid "" 32272"Here we use <link xref=\"grid.js\">Grid</link> widgets to keep everything " 32273"organized. One Grid holds the labels and SpinButtons in order, while the " 32274"next puts that Grid on top and the final Label on the bottom." 32275msgstr "" 32276 32277#. (itstool) path: section/p 32278#: C/spinbutton.js.page:156 32279msgid "" 32280"There isn't a wrong way to organize things in Grids, so long as you like how " 32281"it turns out. In this case, the top Grid has a margin on the bottom to keep " 32282"it evenly spaced from the bottom Label, and the bottom Label is inside a " 32283"separate Grid so it will be centered relative to the Labels and SpinButtons " 32284"on the top." 32285msgstr "" 32286 32287#. (itstool) path: section/code 32288#: C/spinbutton.js.page:158 32289#, no-wrap 32290msgid "" 32291"\n" 32292" // Add the main grid to the window\n" 32293" this._window.add (this._mainGrid);\n" 32294"\n" 32295" // Show the window and all child widgets\n" 32296" this._window.show_all();\n" 32297" },\n" 32298msgstr "" 32299 32300#. (itstool) path: section/p 32301#: C/spinbutton.js.page:166 C/switch.js.page:154 32302msgid "" 32303"Finally, we add the larger Grid to the window, then tell the window to show " 32304"itself and all the widgets inside of it." 32305msgstr "" 32306 32307#. (itstool) path: section/title 32308#: C/spinbutton.js.page:170 32309msgid "Function which handles the SpinButtons' numerical values being adjusted" 32310msgstr "" 32311 32312#. (itstool) path: section/code 32313#: C/spinbutton.js.page:172 32314#, no-wrap 32315msgid "" 32316"\n" 32317" _newValue: function () {\n" 32318"\n" 32319" // Update the label which shows how many cans there are per kitten\n" 32320" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()))\n" 32321" this._lastLabel.set_label (\"That's \" + this.perKitten + \" can(s) of tuna per kitten.\");\n" 32322"\n" 32323" }\n" 32324"\n" 32325"});\n" 32326msgstr "" 32327 32328#. (itstool) path: section/p 32329#: C/spinbutton.js.page:183 32330msgid "" 32331"Here we update the perKitten variable based on the SpinButtons' new values, " 32332"and use the set_label property to refresh what _lastLabel shows. Since both " 32333"SpinButtons have their value-changed signal connected to this function, " 32334"every time either of the numbers changes this function will update the Label." 32335msgstr "" 32336 32337#. (itstool) path: section/code 32338#: C/spinbutton.js.page:185 32339#, fuzzy, no-wrap 32340msgid "" 32341"\n" 32342"// Run the application\n" 32343"let app = new SpinButtonExample ();\n" 32344"app.application.run (ARGV);\n" 32345msgstr "" 32346"\n" 32347"// Executa o aplicativo\n" 32348"let app = new GettingTheSignal ();\n" 32349"app.application.run (ARGV);\n" 32350 32351#. (itstool) path: section/p 32352#: C/spinbutton.js.page:190 32353msgid "" 32354"Finally, we create a new instance of the finished SpinButtonExample class, " 32355"and set the application running." 32356msgstr "" 32357 32358#. (itstool) path: section/code 32359#: C/spinbutton.js.page:195 32360#, fuzzy, no-wrap 32361#| msgid "" 32362#| "#!/usr/bin/gjs\n" 32363#| "\n" 32364#| "const Gtk = imports.gi.Gtk;\n" 32365#| "const Lang = imports.lang;\n" 32366#| "\n" 32367#| "const WelcomeToTheGrid = new Lang.Class({\n" 32368#| " Name: 'Welcome to the Grid',\n" 32369#| "\n" 32370#| " // Create the application itself\n" 32371#| " _init: function() {\n" 32372#| " this.application = new Gtk.Application();\n" 32373#| "\n" 32374#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 32375#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 32376#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 32377#| " },\n" 32378#| "\n" 32379#| " // Callback function for 'activate' signal presents windows when active\n" 32380#| " _onActivate: function() {\n" 32381#| " this._window.present();\n" 32382#| " },\n" 32383#| "\n" 32384#| " // Callback function for 'startup' signal builds the UI\n" 32385#| " _onStartup: function() {\n" 32386#| " this._buildUI ();\n" 32387#| " },\n" 32388#| "\n" 32389#| "\n" 32390#| "\n" 32391#| " // Build the application's UI\n" 32392#| " _buildUI: function() {\n" 32393#| "\n" 32394#| " // Create the application window\n" 32395#| " this._window = new Gtk.ApplicationWindow({\n" 32396#| " application: this.application,\n" 32397#| " window_position: Gtk.WindowPosition.CENTER,\n" 32398#| " border_width: 10,\n" 32399#| " title: \"Welcome to the Grid\"});\n" 32400#| "\n" 32401#| " // Create the Grid\n" 32402#| " this._grid = new Gtk.Grid ({\n" 32403#| " // column_homogeneous: true,\n" 32404#| " // column_spacing: 20,\n" 32405#| " row_spacing: 20 });\n" 32406#| "\n" 32407#| " // Create an image\n" 32408#| " this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 32409#| "\n" 32410#| " // Create a second image using a stock icon\n" 32411#| " this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 32412#| "\n" 32413#| " // Create a label\n" 32414#| " this._label = new Gtk.Label ({\n" 32415#| " label: \"Welcome to GNOME, too!\",\n" 32416#| " /* margin_top: 20 */ });\n" 32417#| "\n" 32418#| " /* Create a second label\n" 32419#| " this._labelTwo = new Gtk.Label ({\n" 32420#| " label: \"The cake is a pie.\" }); */\n" 32421#| "\n" 32422#| " /* Create a button\n" 32423#| " this._button = new Gtk.Button ({\n" 32424#| " label: \"Welcome to GNOME, too!\"}); */\n" 32425#| "\n" 32426#| " // Attach the images and button to the grid\n" 32427#| " this._grid.attach (this._image, 0, 0, 2, 1);\n" 32428#| " this._grid.attach (this._icon, 0, 1, 1, 1);\n" 32429#| " this._grid.attach (this._label, 1, 1, 1, 1);\n" 32430#| "\n" 32431#| " // this._grid.attach (this._label, 0, 1, 1, 1);\n" 32432#| " // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 32433#| "\n" 32434#| " // this._grid.attach (this._button, 1, 1, 1, 1);\n" 32435#| "\n" 32436#| " // Add the grid to the window\n" 32437#| " this._window.add (this._grid);\n" 32438#| "\n" 32439#| " // Show the window and all child widgets\n" 32440#| " this._window.show_all();\n" 32441#| " }\n" 32442#| "\n" 32443#| "});\n" 32444#| "\n" 32445#| "// Run the application\n" 32446#| "let app = new WelcomeToTheGrid ();\n" 32447#| "app.application.run (ARGV);\n" 32448msgid "" 32449"#!/usr/bin/gjs\n" 32450"\n" 32451"imports.gi.versions.Gtk = '3.0';\n" 32452"\n" 32453"const Gio = imports.gi.Gio;\n" 32454"const Gtk = imports.gi.Gtk;\n" 32455"\n" 32456"class SpinButtonExample {\n" 32457"\n" 32458" // Create the application itself\n" 32459" constructor() {\n" 32460" this.application = new Gtk.Application({\n" 32461" application_id: 'org.example.jsspinbutton'\n" 32462" });\n" 32463"\n" 32464" // Connect 'activate' and 'startup' signals to the callback functions\n" 32465" this.application.connect('activate', this._onActivate.bind(this));\n" 32466" this.application.connect('startup', this._onStartup.bind(this));\n" 32467" }\n" 32468"\n" 32469" // Callback function for 'activate' signal presents window when active\n" 32470" _onActivate() {\n" 32471" this._window.present();\n" 32472" }\n" 32473"\n" 32474" // Callback function for 'startup' signal builds the UI\n" 32475" _onStartup() {\n" 32476" this._buildUI();\n" 32477" }\n" 32478"\n" 32479" // Build the application's UI\n" 32480" _buildUI() {\n" 32481"\n" 32482" // Create the application window\n" 32483" this._window = new Gtk.ApplicationWindow({\n" 32484" application: this.application,\n" 32485" window_position: Gtk.WindowPosition.CENTER,\n" 32486" border_width: 20,\n" 32487" title: \"Kitten Feeder\"});\n" 32488"\n" 32489" // Create the first spinbutton using a function\n" 32490" this._kittens = Gtk.SpinButton.new_with_range (1, 9001, 1);\n" 32491" this._kittens.connect (\"value-changed\", this._newValue.bind(this));\n" 32492"\n" 32493" // Create an adjustment to use for the second spinbutton\n" 32494" this._adjustment = new Gtk.Adjustment ({\n" 32495" value: 1,\n" 32496" lower: 0,\n" 32497" upper: 9001,\n" 32498" step_increment: 1,\n" 32499" page_increment: 10 });\n" 32500"\n" 32501" // Create the second spinbutton\n" 32502" this._tuna = new Gtk.SpinButton ({ adjustment: this._adjustment });\n" 32503" this._tuna.connect (\"value-changed\", this._newValue.bind(this));\n" 32504"\n" 32505" // this._tuna.set_digits (1);\n" 32506" // this._tuna.set_wrap (true);\n" 32507"\n" 32508" // Create the text labels to go with the spinbuttons\n" 32509" this._startLabel = new Gtk.Label ({ label: \"There are \" });\n" 32510" this._kittenLabel = new Gtk.Label ({ label: \" kitten(s), and \"});\n" 32511" this._tunaLabel = new Gtk.Label ({ label: \" can(s) of tuna.\"});\n" 32512" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()));\n" 32513" this._lastLabel = new Gtk.Label ({\n" 32514" label: \"That's \" + this.perKitten + \" can(s) of tuna per kitten.\" });\n" 32515"\n" 32516" // Create a grid to put the spinbuttons and their labels in\n" 32517" this._spinGrid = new Gtk.Grid ({\n" 32518" halign: Gtk.Align.CENTER,\n" 32519" valign: Gtk.Align.CENTER,\n" 32520" margin_bottom: 20 });\n" 32521"\n" 32522" // Attach everything to the grid\n" 32523" this._spinGrid.attach (this._startLabel, 0, 0, 1, 1);\n" 32524" this._spinGrid.attach (this._kittens, 1, 0, 1, 1);\n" 32525" this._spinGrid.attach (this._kittenLabel, 2, 0, 1, 1);\n" 32526" this._spinGrid.attach (this._tuna, 3, 0, 1, 1);\n" 32527" this._spinGrid.attach (this._tunaLabel, 4, 0, 1, 1);\n" 32528"\n" 32529" // Create a main grid to hold it and the last label\n" 32530" this._mainGrid = new Gtk.Grid ({\n" 32531" halign: Gtk.Align.CENTER,\n" 32532" valign: Gtk.Align.CENTER });\n" 32533"\n" 32534" // Attach the smaller grid and the last label to the main grid\n" 32535" this._mainGrid.attach (this._spinGrid, 0, 0, 1, 1);\n" 32536" this._mainGrid.attach (this._lastLabel, 0, 1, 1, 1);\n" 32537"\n" 32538" // Add the main grid to the window\n" 32539" this._window.add (this._mainGrid);\n" 32540"\n" 32541" // Show the window and all child widgets\n" 32542" this._window.show_all();\n" 32543" }\n" 32544"\n" 32545" _newValue() {\n" 32546" // Update the label which shows how many cans there are per kitten\n" 32547" this.perKitten = Math.floor((this._tuna.get_value() / this._kittens.get_value()))\n" 32548" this._lastLabel.set_label (\"That's \" + this.perKitten + \" can(s) of tuna per kitten.\");\n" 32549" }\n" 32550"};\n" 32551"\n" 32552"// Run the application\n" 32553"let app = new SpinButtonExample ();\n" 32554"app.application.run (ARGV);\n" 32555msgstr "" 32556"#!/usr/bin/gjs\n" 32557"\n" 32558"const Gtk = imports.gi.Gtk;\n" 32559"const Lang = imports.lang;\n" 32560"\n" 32561"const WelcomeToTheGrid = new Lang.Class({\n" 32562" Name: 'Bem-vindo à Grid',\n" 32563"\n" 32564" // Cria o aplicativo em si\n" 32565" _init: function() {\n" 32566" this.application = new Gtk.Application();\n" 32567"\n" 32568" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 32569" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 32570" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 32571" },\n" 32572"\n" 32573" // Função de chamada para o sinal 'activate' apresenta janelas quando ativo\n" 32574" _onActivate: function() {\n" 32575" this._window.present();\n" 32576" },\n" 32577"\n" 32578" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 32579" _onStartup: function() {\n" 32580" this._buildUI ();\n" 32581" },\n" 32582"\n" 32583"\n" 32584"\n" 32585" // Constrói a interface gráfica do aplicativo\n" 32586" _buildUI: function() {\n" 32587"\n" 32588" // Cria a janela do aplicativo\n" 32589" this._window = new Gtk.ApplicationWindow({\n" 32590" application: this.application,\n" 32591" window_position: Gtk.WindowPosition.CENTER,\n" 32592" border_width: 10,\n" 32593" title: \"Bem-vindo à Grid\"});\n" 32594"\n" 32595" // Cria a Grid\n" 32596" this._grid = new Gtk.Grid ({\n" 32597" // column_homogeneous: true,\n" 32598" // column_spacing: 20,\n" 32599" row_spacing: 20 });\n" 32600"\n" 32601" // Cria uma imagem\n" 32602" this._image = new Gtk.Image ({ file: \"gnome-image.png\" });\n" 32603"\n" 32604" // Cria uma segunda imagem usando um ícone padrão\n" 32605" this._icon = new Gtk.Image ({ stock: 'gtk-about' });\n" 32606"\n" 32607" // Cria um rótulo\n" 32608" this._label = new Gtk.Label ({\n" 32609" label: \"Bem-vindo ao GNOME, também!\",\n" 32610" /* margin_top: 20 */ });\n" 32611"\n" 32612" /* Cria um segundo rótulo\n" 32613" this._labelTwo = new Gtk.Label ({\n" 32614" label: \"O bolo é uma torta.\" }); */\n" 32615"\n" 32616" /* Cria um botão\n" 32617" this._button = new Gtk.Button ({\n" 32618" label: \"Bem-vindo ao GNOME, também!\"}); */\n" 32619"\n" 32620" // Anexa as imagens e botão à grade\n" 32621" this._grid.attach (this._image, 0, 0, 2, 1);\n" 32622" this._grid.attach (this._icon, 0, 1, 1, 1);\n" 32623" this._grid.attach (this._label, 1, 1, 1, 1);\n" 32624"\n" 32625" // this._grid.attach (this._label, 0, 1, 1, 1);\n" 32626" // this._grid.attach (this._labelTwo, 1, 1, 1, 1);\n" 32627"\n" 32628" // this._grid.attach (this._button, 1, 1, 1, 1);\n" 32629"\n" 32630" // Adiciona a grade à janela\n" 32631" this._window.add (this._grid);\n" 32632"\n" 32633" // Mostra a janela e todos os widgets filhos\n" 32634" this._window.show_all();\n" 32635" }\n" 32636"\n" 32637"});\n" 32638"\n" 32639"// Executa o aplicativo\n" 32640"let app = new WelcomeToTheGrid ();\n" 32641"app.application.run (ARGV);\n" 32642 32643#. (itstool) path: item/p 32644#: C/spinbutton.js.page:206 32645msgid "" 32646"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.SpinButton." 32647"html\">Gtk.SpinButton</link>" 32648msgstr "" 32649 32650#. (itstool) path: info/title 32651#: C/spinbutton.py.page:8 32652#, fuzzy 32653msgctxt "text" 32654msgid "SpinButton (Python)" 32655msgstr "Botão de rolagem para atualização" 32656 32657#. (itstool) path: info/desc 32658#: C/spinbutton.py.page:20 32659msgid "Retrieve an integer or floating-point number from the user." 32660msgstr "" 32661 32662#. (itstool) path: section/code 32663#: C/spinbutton.py.page:31 32664#, no-wrap 32665msgid "" 32666"from gi.repository import Gtk\n" 32667"import sys\n" 32668"\n" 32669"\n" 32670"class MyWindow(Gtk.ApplicationWindow):\n" 32671"\n" 32672" def __init__(self, app):\n" 32673" Gtk.Window.__init__(self, title=\"SpinButton Example\", application=app)\n" 32674" self.set_default_size(210, 70)\n" 32675" self.set_border_width(5)\n" 32676"\n" 32677" # an adjustment (initial value, min value, max value,\n" 32678" # step increment - press cursor keys or +/- buttons to see!,\n" 32679" # page increment - not used here,\n" 32680" # page size - not used here)\n" 32681" ad = Gtk.Adjustment(0, 0, 100, 1, 0, 0)\n" 32682"\n" 32683" # a spin button for integers (digits=0)\n" 32684" self.spin = Gtk.SpinButton(adjustment=ad, climb_rate=1, digits=0)\n" 32685" # as wide as possible\n" 32686" self.spin.set_hexpand(True)\n" 32687"\n" 32688" # we connect the signal \"value-changed\" emitted by the spinbutton with the callback\n" 32689" # function spin_selected\n" 32690" self.spin.connect(\"value-changed\", self.spin_selected)\n" 32691"\n" 32692" # a label\n" 32693" self.label = Gtk.Label()\n" 32694" self.label.set_text(\"Choose a number\")\n" 32695"\n" 32696" # a grid to attach the widgets\n" 32697" grid = Gtk.Grid()\n" 32698" grid.attach(self.spin, 0, 0, 1, 1)\n" 32699" grid.attach(self.label, 0, 1, 2, 1)\n" 32700"\n" 32701" self.add(grid)\n" 32702"\n" 32703" # callback function: the signal of the spinbutton is used to change the\n" 32704" # text of the label\n" 32705" def spin_selected(self, event):\n" 32706" self.label.set_text(\n" 32707" \"The number you selected is \" + str(self.spin.get_value_as_int()) + \".\")\n" 32708"\n" 32709"\n" 32710"class MyApplication(Gtk.Application):\n" 32711"\n" 32712" def __init__(self):\n" 32713" Gtk.Application.__init__(self)\n" 32714"\n" 32715" def do_activate(self):\n" 32716" win = MyWindow(self)\n" 32717" win.show_all()\n" 32718"\n" 32719" def do_startup(self):\n" 32720" Gtk.Application.do_startup(self)\n" 32721"\n" 32722"app = MyApplication()\n" 32723"exit_status = app.run(sys.argv)\n" 32724"sys.exit(exit_status)\n" 32725msgstr "" 32726 32727#. (itstool) path: section/title 32728#: C/spinbutton.py.page:35 32729#, fuzzy 32730msgid "Useful methods for a SpinButton widget" 32731msgstr "Métodos úteis" 32732 32733#. (itstool) path: section/p 32734#: C/spinbutton.py.page:36 32735msgid "" 32736"A Gtk.Adjustment is needed to construct the Gtk.SpinButton. This is the " 32737"representation of a value with a lower and upper bound, together with step " 32738"and page increments, and a page size, and it is constructed as <code>Gtk." 32739"Adjustment(value, lower, upper, step_increment, page_increment, page_size)</" 32740"code> where the fields are of type <code>float</code>; <code>step_increment</" 32741"code> is the increment/decrement that is obtained by using the cursor keys " 32742"or the buttons of the spinbutton. Note that <code>page_increment</code> and " 32743"<code>page_size</code> are not used in this case, and they should be set to " 32744"<code>0</code>." 32745msgstr "" 32746 32747#. (itstool) path: section/p 32748#: C/spinbutton.py.page:37 32749msgid "" 32750"In line 23 the signal <code>\"value-changed\"</code> is connected to the " 32751"callback function <code>spin_selected()</code> using <code><var>widget</var>." 32752"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 32753"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 32754msgstr "" 32755 32756#. (itstool) path: item/p 32757#: C/spinbutton.py.page:39 32758msgid "" 32759"If you want the value of the spinbutton to wrap around when they exceed the " 32760"maximum or the minimum, set <code>set_wrap(True)</code>. The <code>\"wrapped" 32761"\"</code> signal is emitted when this happens." 32762msgstr "" 32763 32764#. (itstool) path: item/p 32765#: C/spinbutton.py.page:40 32766msgid "" 32767"<code>set_digits(digits)</code> sets the precision to be displayed by the " 32768"spinbutton, up to 20 digits." 32769msgstr "" 32770 32771#. (itstool) path: item/p 32772#: C/spinbutton.py.page:41 32773msgid "" 32774"To get the value of the spinbutton as an integer, use " 32775"<code>get_value_as_int()</code>." 32776msgstr "" 32777 32778#. (itstool) path: item/p 32779#: C/spinbutton.py.page:49 32780msgid "" 32781"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkSpinButton.html" 32782"\">GtkSpinButton</link>" 32783msgstr "" 32784 32785#. (itstool) path: info/title 32786#: C/spinbutton.vala.page:8 32787#, fuzzy 32788msgctxt "text" 32789msgid "SpinButton (Vala)" 32790msgstr "Botão de rolagem para atualização" 32791 32792#. (itstool) path: info/desc 32793#: C/spinbutton.vala.page:20 32794#, fuzzy 32795msgid "Retrieve an integer or floating point number." 32796msgstr "Número de ponto flutuante" 32797 32798#. (itstool) path: page/code 32799#: C/spinbutton.vala.page:27 32800#, no-wrap 32801msgid "" 32802"/* This is the application. */\n" 32803"public class MyApplication : Gtk.Application {\n" 32804"\tGtk.Label label;\n" 32805"\n" 32806"\t/* Override the 'activate' signal of GLib.Application. */\n" 32807"\tprotected override void activate () {\n" 32808"\t\tvar window = new Gtk.ApplicationWindow (this);\n" 32809"\t\twindow.title = \"SpinButton Example\";\n" 32810"\t\twindow.set_default_size (210, 70);\n" 32811"\t\twindow.set_border_width (5);\n" 32812"\n" 32813"\t\tvar spinbutton = new Gtk.SpinButton.with_range (0, 100, 1);\n" 32814"\t\tspinbutton.set_hexpand (true);\n" 32815"\n" 32816"\t\tlabel = new Gtk.Label (\"Choose a number\");\n" 32817"\n" 32818"\t\tvar grid = new Gtk.Grid ();\n" 32819"\t\tgrid.attach (spinbutton, 0, 0, 1, 1);\n" 32820"\t\tgrid.attach (label, 0, 1, 1, 1);\n" 32821"\n" 32822"\t\tspinbutton.value_changed.connect (this.value_changed_cb);\n" 32823"\n" 32824"\t\twindow.add (grid);\n" 32825"\t\twindow.show_all ();\n" 32826"\t}\n" 32827"\n" 32828"\tvoid value_changed_cb (Gtk.SpinButton spin) {\n" 32829"\t\tlabel.set_text (\"The number you selected is %.0f.\".printf (spin.get_value()));\n" 32830"\t}\n" 32831"}\n" 32832"\n" 32833"/* main creates and runs the application. */\n" 32834"public int main (string[] args) {\n" 32835"\treturn new MyApplication ().run (args);\n" 32836"}\n" 32837msgstr "" 32838 32839#. (itstool) path: item/p 32840#: C/spinbutton.vala.page:32 32841msgid "" 32842"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.SpinButton.html\">Gtk." 32843"SpinButton</link>" 32844msgstr "" 32845 32846#. (itstool) path: info/title 32847#: C/spinner.c.page:8 32848#, fuzzy 32849msgctxt "text" 32850msgid "Spinner (C)" 32851msgstr "Spinner" 32852 32853#. (itstool) path: info/desc 32854#: C/spinner.c.page:19 C/spinner.js.page:18 C/spinner.py.page:19 32855#: C/spinner.vala.page:18 32856#, fuzzy 32857msgid "A spinner animation" 32858msgstr "Spinner" 32859 32860#. (itstool) path: page/title 32861#: C/spinner.c.page:22 C/spinner.js.page:21 C/spinner.py.page:22 32862#: C/spinner.vala.page:21 32863#, fuzzy 32864msgid "Spinner" 32865msgstr "Spinner" 32866 32867#. (itstool) path: page/media 32868#. This is a reference to an external file such as an image or video. When 32869#. the file changes, the md5 hash will change to let you know you need to 32870#. update your localized copy. The msgstr is not used at all. Set it to 32871#. whatever you like once you have updated your copy of the file. 32872#: C/spinner.c.page:24 C/spinner.js.page:22 C/spinner.py.page:23 32873#: C/spinner.vala.page:22 32874msgctxt "_" 32875msgid "external ref='media/spinner.png' md5='d04f2d81f1d72c6c2f97e8729947dfed'" 32876msgstr "" 32877"external ref='media/spinner.png' md5='d04f2d81f1d72c6c2f97e8729947dfed'" 32878 32879#. (itstool) path: page/p 32880#: C/spinner.c.page:25 C/spinner.js.page:23 C/spinner.py.page:24 32881#: C/spinner.vala.page:23 32882msgid "This Spinner is stopped and started by pressing the spacebar." 32883msgstr "" 32884 32885#. (itstool) path: page/code 32886#: C/spinner.c.page:27 32887#, no-wrap 32888msgid "" 32889"\n" 32890"#include <gtk/gtk.h>\n" 32891" \n" 32892"\n" 32893"\n" 32894" /*Global variable used to indicate active state of the\n" 32895"spinner. TRUE = active, FALSE = not-active. This is because \n" 32896"there isn't a current function for C that does this for us*/\n" 32897"gboolean active; \n" 32898" \n" 32899"\n" 32900"\n" 32901"/*This is the callback function. It is a handler function \n" 32902"which reacts to the signal. In this case, it will cause the \n" 32903"spinner to start and stop according to how many times the user \n" 32904"presses the spacebar.*/ \n" 32905"static gboolean\n" 32906"key_pressed_event (GtkWidget *widget,\n" 32907" GdkEvent *event,\n" 32908" gpointer user_data)\n" 32909"{\n" 32910" GtkWidget *spinner = user_data;\n" 32911" guint keyval;\n" 32912" \n" 32913" /*Extracts the keyval from an event. And stores it in the variable \n" 32914" \"keyval\" (we give the function the address). In this case, the \n" 32915" event is GdkEventKey, a key press event*/\n" 32916" gdk_event_get_keyval (event, &keyval); \n" 32917"\n" 32918" /*Grabbing the boolean value from the spinner*/\n" 32919" g_object_get (GTK_SPINNER (spinner), \"active\", &active, NULL);\n" 32920" \n" 32921" if (keyval == GDK_KEY_space) {\n" 32922" if (active) {\n" 32923" gtk_spinner_stop (GTK_SPINNER (spinner));\n" 32924" }\n" 32925" else {\n" 32926" gtk_spinner_start (GTK_SPINNER (spinner));\n" 32927" } \n" 32928" }\n" 32929" \n" 32930"return TRUE;\n" 32931"}\n" 32932" \n" 32933"\n" 32934"\n" 32935"static void\n" 32936"activate (GtkApplication *app,\n" 32937" gpointer user_data)\n" 32938"{\n" 32939" GtkWidget *window;\n" 32940" GtkWidget *spinner;\n" 32941" \n" 32942" /*Create a window with a title, border width and a default size*/\n" 32943" window = gtk_application_window_new (app);\n" 32944" \n" 32945" gtk_window_set_title (GTK_WINDOW (window), \"Spinner Example\");\n" 32946" gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);\n" 32947" gtk_container_set_border_width (GTK_CONTAINER(window), 30);\n" 32948" \n" 32949" /*Create a spinner, with extra horizontal and vertical space*/\n" 32950" spinner = gtk_spinner_new ();\n" 32951" gtk_spinner_start (GTK_SPINNER (spinner));\n" 32952" \n" 32953" gtk_container_add (GTK_CONTAINER (window), spinner);\n" 32954" \n" 32955" /*Connecting the key-press-event signal to the callback*/\n" 32956" g_signal_connect (GTK_WINDOW (window), \"key-press-event\", \n" 32957" G_CALLBACK (key_pressed_event), spinner);\n" 32958" \n" 32959" gtk_widget_show_all (window);\n" 32960"}\n" 32961" \n" 32962"\n" 32963"\n" 32964"\n" 32965"int\n" 32966"main (int argc, char **argv)\n" 32967"{\n" 32968" GtkApplication *app;\n" 32969" int status;\n" 32970" \n" 32971" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 32972" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 32973" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 32974" g_object_unref (app);\n" 32975" \n" 32976" return status;\n" 32977"}\n" 32978msgstr "" 32979 32980#. (itstool) path: item/p 32981#: C/spinner.c.page:35 32982msgid "" 32983"<link href=\"http://developer.gnome.org/gobject/stable/gobject-The-Base-" 32984"Object-Type.html#g-object-get\">GObject</link>" 32985msgstr "" 32986 32987#. (itstool) path: item/p 32988#: C/spinner.c.page:36 C/togglebutton.c.page:38 32989#, fuzzy 32990msgid "" 32991"<link href=\"http://developer.gnome.org/gtk3/stable/GtkSpinner.html" 32992"\">GtkSpinner</link>" 32993msgstr "" 32994"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 32995"link>" 32996 32997#. (itstool) path: info/title 32998#: C/spinner.js.page:8 32999#, fuzzy 33000msgctxt "text" 33001msgid "Spinner (JavaScript)" 33002msgstr "Spinner" 33003 33004#. (itstool) path: page/code 33005#: C/spinner.js.page:25 33006#, fuzzy, no-wrap 33007#| msgid "" 33008#| "#!/usr/bin/gjs\n" 33009#| "\n" 33010#| "const GLib = imports.gi.GLib;\n" 33011#| "const Gtk = imports.gi.Gtk;\n" 33012#| "const Lang = imports.lang;\n" 33013#| "const Webkit = imports.gi.WebKit;\n" 33014#| "\n" 33015#| "const HelloGNOME = new Lang.Class ({\n" 33016#| " Name: 'Hello GNOME',\n" 33017#| "\n" 33018#| " // Create the application itself\n" 33019#| " _init: function () {\n" 33020#| " this.application = new Gtk.Application ();\n" 33021#| "\n" 33022#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 33023#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 33024#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 33025#| " },\n" 33026#| "\n" 33027#| " // Callback function for 'activate' signal presents windows when active\n" 33028#| " _onActivate: function () {\n" 33029#| " this._window.present ();\n" 33030#| " },\n" 33031#| "\n" 33032#| " // Callback function for 'startup' signal builds the UI\n" 33033#| " _onStartup: function () {\n" 33034#| " this._buildUI ();\n" 33035#| " },\n" 33036#| "\n" 33037#| " // Build the application's UI\n" 33038#| " _buildUI: function () {\n" 33039#| "\n" 33040#| " // Create the application window\n" 33041#| " this._window = new Gtk.ApplicationWindow ({\n" 33042#| " application: this.application,\n" 33043#| " title: \"Welcome to GNOME\",\n" 33044#| " default_height: 200,\n" 33045#| " default_width: 400,\n" 33046#| " window_position: Gtk.WindowPosition.CENTER });\n" 33047#| "\n" 33048#| " // Create a webview to show the web app\n" 33049#| " this._webView = new Webkit.WebView ();\n" 33050#| "\n" 33051#| " // Put the web app into the webview\n" 33052#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 33053#| " \"/hellognome.html\", null));\n" 33054#| "\n" 33055#| " // Put the webview into the window\n" 33056#| " this._window.add (this._webView);\n" 33057#| "\n" 33058#| " // Show the window and all child widgets\n" 33059#| " this._window.show_all();\n" 33060#| " },\n" 33061#| "\n" 33062#| "});\n" 33063#| "\n" 33064#| "// Run the application\n" 33065#| "let app = new HelloGNOME ();\n" 33066#| "app.application.run (ARGV);\n" 33067msgid "" 33068"#!/usr/bin/gjs\n" 33069"\n" 33070"imports.gi.versions.Gdk = '3.0';\n" 33071"imports.gi.versions.Gtk = '3.0';\n" 33072"\n" 33073"const Gio = imports.gi.Gio;\n" 33074"const GLib = imports.gi.GLib;\n" 33075"const Gtk = imports.gi.Gtk;\n" 33076"const Gdk = imports.gi.Gdk;\n" 33077"\n" 33078"class SpinnerExample {\n" 33079"\n" 33080" // Create the application itself\n" 33081" constructor() {\n" 33082" this.application = new Gtk.Application({\n" 33083" application_id: 'org.example.jsspinner',\n" 33084" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 33085" });\n" 33086"\n" 33087" // Connect 'activate' and 'startup' signals to the callback functions\n" 33088" this.application.connect('activate', this._onActivate.bind(this));\n" 33089" this.application.connect('startup', this._onStartup.bind(this));\n" 33090" }\n" 33091"\n" 33092" // Callback function for 'activate' signal presents windows when active\n" 33093" _onActivate() {\n" 33094" this._window.present();\n" 33095" }\n" 33096"\n" 33097" // Callback function for 'startup' signal builds the UI\n" 33098" _onStartup() {\n" 33099" this._buildUI();\n" 33100" }\n" 33101"\n" 33102" // Build the application's UI\n" 33103" _buildUI() {\n" 33104"\n" 33105" // Create the application window\n" 33106" this._window = new Gtk.ApplicationWindow({\n" 33107" application: this.application,\n" 33108" window_position: Gtk.WindowPosition.CENTER,\n" 33109" title: \"Spinner Example\",\n" 33110" default_height: 200,\n" 33111" default_width: 200,\n" 33112" border_width: 30\n" 33113" });\n" 33114"\n" 33115" // Create a spinner which starts spinning automatically\n" 33116" this._spinner = new Gtk.Spinner ({active: true});\n" 33117" this._window.add (this._spinner);\n" 33118"\n" 33119" // Connect a keypress event to the function that makes it start or stop spinning\n" 33120" this._window.connect(\"key-press-event\", this._onKeyPress.bind(this));\n" 33121"\n" 33122" // Show the window and all child widgets\n" 33123" this._window.show_all();\n" 33124" }\n" 33125"\n" 33126" _onKeyPress(widget, event) {\n" 33127"\n" 33128" // Get the value of the key that was pressed\n" 33129" let [, keyval] = event.get_keyval();\n" 33130"\n" 33131" // If it was the spacebar, toggle the spinner to start or stop\n" 33132" if (keyval == Gdk.KEY_space) {\n" 33133" if (this._spinner.active == true)\n" 33134" this._spinner.stop();\n" 33135" else\n" 33136" this._spinner.start();\n" 33137" }\n" 33138" }\n" 33139"};\n" 33140"\n" 33141"// Run the application\n" 33142"let app = new SpinnerExample ();\n" 33143"app.application.run (ARGV);\n" 33144msgstr "" 33145"#!/usr/bin/gjs\n" 33146"\n" 33147"const GLib = imports.gi.GLib;\n" 33148"const Gtk = imports.gi.Gtk;\n" 33149"const Lang = imports.lang;\n" 33150"const Webkit = imports.gi.WebKit;\n" 33151"\n" 33152"const HelloGNOME = new Lang.Class ({\n" 33153" Name: 'Olá, GNOME',\n" 33154"\n" 33155" // Cria o aplicativo em si\n" 33156" _init: function () {\n" 33157" this.application = new Gtk.Application ();\n" 33158"\n" 33159" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 33160" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 33161" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 33162" },\n" 33163"\n" 33164" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 33165" _onActivate: function () {\n" 33166" this._window.present ();\n" 33167" },\n" 33168"\n" 33169" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 33170" _onStartup: function () {\n" 33171" this._buildUI ();\n" 33172" },\n" 33173"\n" 33174" // Constrói a interface gráfica do aplicativo\n" 33175" _buildUI: function () {\n" 33176"\n" 33177" // Cria a janela do aplicativo\n" 33178" this._window = new Gtk.ApplicationWindow ({\n" 33179" application: this.application,\n" 33180" title: \"Bem-vindo ao GNOME\",\n" 33181" default_height: 200,\n" 33182" default_width: 400,\n" 33183" window_position: Gtk.WindowPosition.CENTER });\n" 33184"\n" 33185" // Cria um webview para mostrar o aplicativo web\n" 33186" this._webView = new Webkit.WebView ();\n" 33187"\n" 33188" // Coloca o aplicativo web no webview\n" 33189" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 33190" \"/hellognome.html\", null));\n" 33191"\n" 33192" // Coloca o webview na janela\n" 33193" this._window.add (this._webView);\n" 33194"\n" 33195" // Mostra a janela e todos seus widgets filhos\n" 33196" this._window.show_all();\n" 33197" },\n" 33198"\n" 33199"});\n" 33200"\n" 33201"// Executa o aplicativo\n" 33202"let app = new HelloGNOME ();\n" 33203"app.application.run (ARGV);\n" 33204 33205#. (itstool) path: item/p 33206#: C/spinner.js.page:30 33207msgid "" 33208"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gdk.html\">Gdk - " 33209"Key Values</link>" 33210msgstr "" 33211 33212#. (itstool) path: item/p 33213#: C/spinner.js.page:33 C/togglebutton.js.page:158 33214msgid "" 33215"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Spinner.html" 33216"\">Gtk.Spinner</link>" 33217msgstr "" 33218 33219#. (itstool) path: info/title 33220#: C/spinner.py.page:8 33221#, fuzzy 33222msgctxt "text" 33223msgid "Spinner (Python)" 33224msgstr "Spinner" 33225 33226#. (itstool) path: section/code 33227#: C/spinner.py.page:31 33228#, no-wrap 33229msgid "" 33230"from gi.repository import Gtk\n" 33231"from gi.repository import Gdk\n" 33232"import sys\n" 33233"\n" 33234"\n" 33235"class MyWindow(Gtk.ApplicationWindow):\n" 33236" # a window\n" 33237"\n" 33238" def __init__(self, app):\n" 33239" Gtk.Window.__init__(self, title=\"Spinner Example\", application=app)\n" 33240" self.set_default_size(200, 200)\n" 33241" self.set_border_width(30)\n" 33242"\n" 33243" # a spinner\n" 33244" self.spinner = Gtk.Spinner()\n" 33245" # that by default spins\n" 33246" self.spinner.start()\n" 33247" # add the spinner to the window\n" 33248" self.add(self.spinner)\n" 33249"\n" 33250" # event handler\n" 33251" # a signal from the keyboard (space) controls if the spinner stops/starts\n" 33252" def do_key_press_event(self, event):\n" 33253" # keyname is the symbolic name of the key value given by the event\n" 33254" keyname = Gdk.keyval_name(event.keyval)\n" 33255" # if it is \"space\"\n" 33256" if keyname == \"space\":\n" 33257" # and the spinner is active\n" 33258" if self.spinner.get_property(\"active\"):\n" 33259" # stop the spinner\n" 33260" self.spinner.stop()\n" 33261" # if the spinner is not active\n" 33262" else:\n" 33263" # start it again\n" 33264" self.spinner.start()\n" 33265" # stop the signal emission\n" 33266" return True\n" 33267"\n" 33268"\n" 33269"class MyApplication(Gtk.Application):\n" 33270"\n" 33271" def __init__(self):\n" 33272" Gtk.Application.__init__(self)\n" 33273"\n" 33274" def do_activate(self):\n" 33275" win = MyWindow(self)\n" 33276" win.show_all()\n" 33277"\n" 33278" def do_startup(self):\n" 33279" Gtk.Application.do_startup(self)\n" 33280"\n" 33281"app = MyApplication()\n" 33282"exit_status = app.run(sys.argv)\n" 33283"sys.exit(exit_status)\n" 33284msgstr "" 33285 33286#. (itstool) path: note/p 33287#: C/spinner.py.page:33 33288msgid "" 33289"<code>Gdk.keyval_name(event.keyval)</code> converts the key value " 33290"<code>event.keyval</code> into a symbolic name. The names and corresponding " 33291"key values can be found <link href=\"http://git.gnome.org/browse/gtk+/tree/" 33292"gdk/gdkkeysyms.h\">here</link>,but for instance <code>GDK_KEY_BackSpace</" 33293"code> becomes the string <code>\"BackSpace\"</code>." 33294msgstr "" 33295 33296#. (itstool) path: item/p 33297#: C/spinner.py.page:42 C/togglebutton.py.page:46 33298msgid "" 33299"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkSpinner.html" 33300"\">GtkSpinner</link>" 33301msgstr "" 33302 33303#. (itstool) path: item/p 33304#: C/spinner.py.page:43 33305msgid "" 33306"<link href=\"http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html" 33307"\">Key Values</link>" 33308msgstr "" 33309 33310#. (itstool) path: info/title 33311#: C/spinner.vala.page:8 33312#, fuzzy 33313msgctxt "text" 33314msgid "Spinner (Vala)" 33315msgstr "Vala" 33316 33317#. (itstool) path: page/code 33318#: C/spinner.vala.page:25 33319#, no-wrap 33320msgid "" 33321"public class MyWindow : Gtk.ApplicationWindow {\n" 33322"\n" 33323"\tGtk.Widget spinner;\n" 33324"\n" 33325"\tinternal MyWindow (MyApplication app) {\n" 33326"\n" 33327"\t\tObject (application: app, title: \"Spinner Example\");\n" 33328"\n" 33329"\t\tthis.set_default_size (200, 200);\n" 33330"\t\tthis.border_width = 30;\n" 33331"\n" 33332"\t\tspinner = new Gtk.Spinner ();\n" 33333"\n" 33334"\t\tthis.add (spinner);\n" 33335"\t\t(spinner as Gtk.Spinner).active = true;\n" 33336"\t\tspinner.show ();\n" 33337"\t}\n" 33338"\n" 33339"\tprotected override bool key_press_event (Gdk.EventKey event) {\n" 33340"\n" 33341"\t\t//print (Gdk.keyval_name(event.keyval) +\"\\n\");\n" 33342"\t\tif (Gdk.keyval_name(event.keyval) == \"space\") {\n" 33343"\n" 33344"\t\t\tif ((spinner as Gtk.Spinner).active) {\n" 33345"\t\t\t\t(spinner as Gtk.Spinner).stop ();\n" 33346"\t\t\t\t//spinner.visible = false;\n" 33347"\t\t\t}\n" 33348"\t\t\telse {\n" 33349"\t\t\t\t(spinner as Gtk.Spinner).start ();\n" 33350"\t\t\t\t//spinner.visible = true;\n" 33351"\t\t\t}\n" 33352"\t\t}\n" 33353"\t\treturn true;\n" 33354"\t}\n" 33355"}\n" 33356"\n" 33357"public class MyApplication : Gtk.Application {\n" 33358"\n" 33359"\tprotected override void activate () {\n" 33360"\t\tMyWindow window = new MyWindow (this);\n" 33361"\t\twindow.show ();\n" 33362"\t}\n" 33363"\n" 33364"\tinternal MyApplication () {\n" 33365"\t\tObject (application_id: \"org.example.spinner\");\n" 33366"\t}\n" 33367"}\n" 33368"\n" 33369"public int main (string[] args) {\n" 33370"\treturn new MyApplication ().run (args);\n" 33371"}\n" 33372msgstr "" 33373 33374#. (itstool) path: item/p 33375#: C/spinner.vala.page:30 33376msgid "" 33377"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Widget.html\">Gtk.Widget</" 33378"link>" 33379msgstr "" 33380 33381#. (itstool) path: item/p 33382#: C/spinner.vala.page:31 33383msgid "" 33384"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Spinner.html\">Gtk.Spinner</" 33385"link>" 33386msgstr "" 33387 33388#. (itstool) path: item/p 33389#: C/spinner.vala.page:32 33390msgid "" 33391"<link href=\"http://www.valadoc.org/gdk-3.0/Gdk.keyval_name.html\">Gdk." 33392"keyval_name</link>" 33393msgstr "" 33394 33395#. (itstool) path: info/title 33396#: C/statusbar.c.page:8 33397#, fuzzy 33398msgctxt "text" 33399msgid "Statusbar (C)" 33400msgstr "A barra de status" 33401 33402#. (itstool) path: info/desc 33403#: C/statusbar.c.page:22 C/statusbar.py.page:20 C/statusbar.vala.page:21 33404msgid "Report messages of minor importance to the user" 33405msgstr "" 33406 33407#. (itstool) path: page/title 33408#: C/statusbar.c.page:25 C/statusbar.js.page:21 C/statusbar.py.page:23 33409#: C/statusbar.vala.page:24 33410#, fuzzy 33411msgid "Statusbar" 33412msgstr "Barra de status" 33413 33414#. (itstool) path: page/media 33415#. This is a reference to an external file such as an image or video. When 33416#. the file changes, the md5 hash will change to let you know you need to 33417#. update your localized copy. The msgstr is not used at all. Set it to 33418#. whatever you like once you have updated your copy of the file. 33419#: C/statusbar.c.page:27 33420msgctxt "_" 33421msgid "" 33422"external ref='media/statusbar3.png' md5='60c71604fb44656237ee66dfb39a8689'" 33423msgstr "" 33424"external ref='media/statusbar3.png' md5='60c71604fb44656237ee66dfb39a8689'" 33425 33426#. (itstool) path: page/p 33427#: C/statusbar.c.page:28 33428msgid "" 33429"This statusbar is used to demonstrate how messages are stacked in a last-in-" 33430"first-out order. The message at the top of the stack is always the one " 33431"displayed." 33432msgstr "" 33433 33434#. (itstool) path: page/code 33435#: C/statusbar.c.page:30 33436#, no-wrap 33437msgid "" 33438"\n" 33439"#include <gtk/gtk.h>\n" 33440"\n" 33441"\n" 33442"\n" 33443"/*Callback function in which pushes an item onto the statusbar*/\n" 33444"static void \n" 33445"push_item (GtkWidget *widget,\n" 33446" gpointer data)\n" 33447"{\n" 33448" GtkWidget *status_bar = data;\n" 33449"\n" 33450" /*Create a context id, which is used to uniquely identify \n" 33451" *the source of a message*/\n" 33452" guint context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (status_bar), \n" 33453" \"Statusbar example\");\n" 33454"\n" 33455" /*Count is used to keep track of the amount of items \n" 33456" the user is pushing/popping*/\n" 33457" static int count = 1;\n" 33458" char hold_output[20];\n" 33459" \n" 33460" /*This is a safer form of the standard sprintf () function. The output is \n" 33461" guaranteed in this case to not exceed 20 characters, and the result is stored\n" 33462" into the 'hold_output' variable*/\n" 33463" g_snprintf (hold_output, 20, \"Item %d\", count++);\n" 33464" gtk_statusbar_push (GTK_STATUSBAR (status_bar), \n" 33465" context_id, \n" 33466" hold_output);\n" 33467"}\n" 33468"\n" 33469"\n" 33470"\n" 33471"/*Callback function that is used to pop an item off the statusbar*/\n" 33472"static void \n" 33473"pop_item (GtkWidget *widget,\n" 33474" gpointer data )\n" 33475"{\n" 33476" GtkWidget *status_bar = data;\n" 33477" guint context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (status_bar), \n" 33478" \"Statusbar example\");\n" 33479"\n" 33480" gtk_statusbar_pop (GTK_STATUSBAR (status_bar), context_id);\n" 33481"}\n" 33482"\n" 33483"\n" 33484"\n" 33485"static void\n" 33486"activate (GtkApplication *app,\n" 33487" gpointer user_data)\n" 33488"{\n" 33489" GtkWidget *grid;\n" 33490" GtkWidget *window;\n" 33491" GtkWidget *status_bar;\n" 33492" GtkWidget *pop_button;\n" 33493" GtkWidget *push_button;\n" 33494"\n" 33495" /*Create a window with a title, border width, and a default size**/\n" 33496" window = gtk_application_window_new (app);\n" 33497" gtk_window_set_default_size (GTK_WINDOW (window), 220, 100);\n" 33498" gtk_window_set_title (GTK_WINDOW (window), \"Statusbar Example\");\n" 33499" gtk_container_set_border_width (GTK_CONTAINER(window), 10);\n" 33500" \n" 33501" /*Create the status bar, which is held in the global variable*/\n" 33502" status_bar = gtk_statusbar_new (); \n" 33503" \n" 33504" /*Create the buttons with labels*/\n" 33505" push_button = gtk_button_new_with_label (\"push item\");\n" 33506" pop_button = gtk_button_new_with_label (\"pop last item\");\n" 33507" \n" 33508" /*Create the grid, and attach the buttons/statusbar accordingly*/\n" 33509" grid = gtk_grid_new ();\n" 33510" gtk_grid_attach (GTK_GRID (grid), push_button, 0,1,1,1);\n" 33511" gtk_grid_attach (GTK_GRID (grid), pop_button, 0,2,1,1);\n" 33512" gtk_grid_attach (GTK_GRID (grid), status_bar, 0,3,1,1);\n" 33513" \n" 33514" /*Connecting the clicked signals to the corresponding callback functions*/\n" 33515" g_signal_connect (GTK_BUTTON (push_button), \"clicked\", \n" 33516" G_CALLBACK (push_item), status_bar);\n" 33517" g_signal_connect (GTK_BUTTON (pop_button), \"clicked\", \n" 33518" G_CALLBACK (pop_item), status_bar);\n" 33519" \n" 33520" /*Attach the grid holding the child widgets onto the window, and show all*/\n" 33521" gtk_container_add (GTK_CONTAINER (window), grid);\n" 33522" gtk_widget_show_all (window);\n" 33523"}\n" 33524"\n" 33525"\n" 33526"\n" 33527"int\n" 33528"main (int argc, char **argv)\n" 33529"{\n" 33530" GtkApplication *app;\n" 33531" int status;\n" 33532"\n" 33533" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 33534" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 33535" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 33536" g_object_unref (app);\n" 33537"\n" 33538" return status;\n" 33539"}\n" 33540msgstr "" 33541 33542#. (itstool) path: item/p 33543#: C/statusbar.c.page:38 33544#, fuzzy 33545msgid "" 33546"<link href=\"http://developer.gnome.org/gtk3/stable/GtkStatusbar.html" 33547"\">GtkStatusBar</link>" 33548msgstr "" 33549"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 33550"link>" 33551 33552#. (itstool) path: item/p 33553#: C/statusbar.c.page:39 33554msgid "" 33555"<link href=\"http://developer.gnome.org/glib/stable/glib-String-Utility-" 33556"Functions.html#g-snprintf\">String Utility Functions</link>" 33557msgstr "" 33558 33559#. (itstool) path: info/title 33560#: C/statusbar.js.page:8 33561#, fuzzy 33562msgctxt "text" 33563msgid "Statusbar (JavaScript)" 33564msgstr "JavaScript" 33565 33566#. (itstool) path: info/desc 33567#: C/statusbar.js.page:18 33568#, fuzzy 33569msgid "Show notifications in a dedicated statusbar" 33570msgstr "Mostrar notificações na" 33571 33572#. (itstool) path: page/media 33573#. This is a reference to an external file such as an image or video. When 33574#. the file changes, the md5 hash will change to let you know you need to 33575#. update your localized copy. The msgstr is not used at all. Set it to 33576#. whatever you like once you have updated your copy of the file. 33577#: C/statusbar.js.page:22 33578msgctxt "_" 33579msgid "" 33580"external ref='media/statusbar2.png' md5='ff6f7e5b270827ca98b2d5f7087aa766'" 33581msgstr "" 33582"external ref='media/statusbar2.png' md5='ff6f7e5b270827ca98b2d5f7087aa766'" 33583 33584#. (itstool) path: page/p 33585#: C/statusbar.js.page:23 33586msgid "" 33587"This statusbar keeps track of how many times you've clicked a button. " 33588"Applications like <link href=\"http://projects.gnome.org/gedit/\">gedit</" 33589"link> use statusbars to display information at a glance, and show " 33590"notifications without interrupting the user." 33591msgstr "" 33592 33593#. (itstool) path: page/p 33594#: C/statusbar.js.page:24 33595msgid "" 33596"Messages pushed to a statusbar go on top of its stack, and can be popped off " 33597"to show the next-most recent one. You can also clear away every message of a " 33598"specific type all at once. This sample application demonstrates these " 33599"functions." 33600msgstr "" 33601 33602#. (itstool) path: section/code 33603#: C/statusbar.js.page:41 33604#, no-wrap 33605msgid "" 33606"\n" 33607"const StatusbarExample = new Lang.Class({\n" 33608" Name: 'Statusbar Example',\n" 33609"\n" 33610" // Create the application itself\n" 33611" _init: function() {\n" 33612" this.application = new Gtk.Application({\n" 33613" application_id: 'org.example.jsstatusbar',\n" 33614" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 33615" });\n" 33616"\n" 33617" // Connect 'activate' and 'startup' signals to the callback functions\n" 33618" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 33619" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 33620" },\n" 33621"\n" 33622" // Callback function for 'activate' signal presents window when active\n" 33623" _onActivate: function() {\n" 33624" this._window.present();\n" 33625" },\n" 33626"\n" 33627" // Callback function for 'startup' signal builds the UI\n" 33628" _onStartup: function() {\n" 33629" this._buildUI ();\n" 33630" },\n" 33631msgstr "" 33632 33633#. (itstool) path: section/p 33634#: C/statusbar.js.page:67 33635msgid "" 33636"All the code for this sample goes in the StatusbarExample class. The above " 33637"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 33638"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 33639"go in." 33640msgstr "" 33641 33642#. (itstool) path: section/code 33643#: C/statusbar.js.page:68 33644#, no-wrap 33645msgid "" 33646"\n" 33647" // Build the application's UI\n" 33648" _buildUI: function() {\n" 33649"\n" 33650" // Create the application window\n" 33651" this._window = new Gtk.ApplicationWindow({\n" 33652" application: this.application,\n" 33653" window_position: Gtk.WindowPosition.CENTER,\n" 33654" default_height: 120,\n" 33655" default_width: 300,\n" 33656" title: \"Button Clicker\"});\n" 33657"\n" 33658" // Create a paned interface\n" 33659" this._panes = new Gtk.Paned ({\n" 33660" orientation: Gtk.Orientation.VERTICAL });\n" 33661msgstr "" 33662 33663#. (itstool) path: section/p 33664#: C/statusbar.js.page:84 33665msgid "" 33666"The _buildUI function is where we put all the code to create the " 33667"application's user interface. The first step is creating a new <link href=" 33668"\"GtkApplicationWindow.js.page\">Gtk.ApplicationWindow</link> to put all our " 33669"widgets into. The next step is to create a vertically-oriented Gtk.Paned " 33670"interface, to divide the window up into two sections. This way the statusbar " 33671"looks like those used in other applications, and it stays at the bottom of " 33672"the window, even if the user resizes it." 33673msgstr "" 33674 33675#. (itstool) path: section/title 33676#: C/statusbar.js.page:88 33677#, fuzzy 33678msgid "Creating the buttons" 33679msgstr "Os botões" 33680 33681#. (itstool) path: section/code 33682#: C/statusbar.js.page:89 33683#, no-wrap 33684msgid "" 33685"\n" 33686" // Create the main button\n" 33687" this._clickMe = new Gtk.Button ({\n" 33688" label: \"Click Me!\" });\n" 33689" this._clickMe.connect (\"clicked\", Lang.bind (this, this._clicked));\n" 33690"\n" 33691" // Create the back button\n" 33692" this._backButton = new Gtk.Button ({\n" 33693" label: \"gtk-go-back\",\n" 33694" use_stock: true });\n" 33695" this._backButton.connect (\"clicked\", Lang.bind (this, this._back));\n" 33696"\n" 33697" // Create the clear button\n" 33698" this._clearButton = new Gtk.Button ({\n" 33699" label: \"gtk-clear\",\n" 33700" use_stock: true });\n" 33701" this._clearButton.connect (\"clicked\", Lang.bind (this, this._clear));\n" 33702msgstr "" 33703 33704#. (itstool) path: section/p 33705#: C/statusbar.js.page:107 33706msgid "" 33707"This code creates the three <link href=\"button.js.page\">Gtk.Buttons</link> " 33708"we'll use to push a new message to the statusbar, pop the last one off, and " 33709"clear all existing messages. The \"back\" and \"clear\" buttons are <link " 33710"href=\"https://developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html\">stock " 33711"buttons</link>, which are automatically translated into any language GNOME " 33712"supports." 33713msgstr "" 33714 33715#. (itstool) path: section/code 33716#: C/statusbar.js.page:109 33717#, no-wrap 33718msgid "" 33719"\n" 33720" // Put the buttons in a grid\n" 33721" this._grid = new Gtk.Grid ({\n" 33722" halign: Gtk.Align.CENTER,\n" 33723" valign: Gtk.Align.CENTER });\n" 33724" this._grid.attach (this._backButton, 0, 0, 1, 1);\n" 33725" this._grid.attach_next_to (this._clickMe, this._backButton, Gtk.PositionType.RIGHT, 1, 1);\n" 33726" this._grid.attach_next_to (this._clearButton, this._clickMe, Gtk.PositionType.RIGHT, 1, 1);\n" 33727"\n" 33728" // Put the grid in a large frame that fills most of the window\n" 33729" this._topFrame = new Gtk.Frame ({\n" 33730" border_width: 20,\n" 33731" height_request: 90,\n" 33732" width_request: 300});\n" 33733" this._topFrame.add (this._grid);\n" 33734msgstr "" 33735 33736#. (itstool) path: section/p 33737#: C/statusbar.js.page:125 33738msgid "" 33739"This code creates the <link href=\"grid.js.page\">Gtk.Grid</link> that we'll " 33740"use to organize the buttons, and attaches the buttons to it in order. It " 33741"then creates a <link href=\"paned.js.page\">Gtk.Frame</link> which will take " 33742"up most of the window and has a large amount of padding around the buttons, " 33743"and adds the Grid to the Frame. Note that we still need to put the Frame " 33744"into the Paned interface, and then add it to the ApplicationWindow." 33745msgstr "" 33746 33747#. (itstool) path: section/title 33748#: C/statusbar.js.page:129 33749#, fuzzy 33750msgid "Creating the statusbar" 33751msgstr "A barra de status" 33752 33753#. (itstool) path: section/code 33754#: C/statusbar.js.page:130 33755#, no-wrap 33756msgid "" 33757"\n" 33758" // Create the statusbar\n" 33759" this._statusbar = new Gtk.Statusbar();\n" 33760"\n" 33761" // Keep track of the number of times the button has been clicked\n" 33762" this.Clicks = 0;\n" 33763" this.ContextID = this._statusbar.get_context_id (\"Number of Clicks\");\n" 33764"\n" 33765" // Give the statusbar an initial message\n" 33766" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 33767"\n" 33768" // Put the statusbar in its own frame at the bottom\n" 33769" this._barFrame = new Gtk.Frame ({\n" 33770" height_request: 30 });\n" 33771" this._barFrame.add (this._statusbar);\n" 33772msgstr "" 33773 33774#. (itstool) path: section/p 33775#: C/statusbar.js.page:146 33776msgid "" 33777"Here we create the Gtk.Statusbar, and push a message to it to start off " 33778"with. Then we give it its own narrow frame at the bottom of the window." 33779msgstr "" 33780 33781#. (itstool) path: section/p 33782#: C/statusbar.js.page:147 33783msgid "" 33784"Every message needs to have a context id, which is an integer value you can " 33785"get from the statusbar with the get_context_id() function. Its only " 33786"parameter is the string value you use to describe that particular context " 33787"id. Normally, you'll get a new context id for different kinds of messages, " 33788"so that you can use the remove() function to remove a specific message and " 33789"not just the most recent one on the stack. This is a simple example with " 33790"only one kind of message, though, so we're just using one for everything." 33791msgstr "" 33792 33793#. (itstool) path: section/p 33794#: C/statusbar.js.page:148 33795msgid "" 33796"We use the push() function to push a new message onto the stack. Its first " 33797"parameter is the context id, and its second is the message." 33798msgstr "" 33799 33800#. (itstool) path: section/code 33801#: C/statusbar.js.page:149 33802#, no-wrap 33803msgid "" 33804"\n" 33805" // Assemble the frames into the paned interface\n" 33806" this._panes.pack1 (this._topFrame, true, false);\n" 33807" this._panes.pack2 (this._barFrame, false, false);\n" 33808"\n" 33809" // Put the panes into the window\n" 33810" this._window.add (this._panes);\n" 33811"\n" 33812" // Show the window and all child widgets\n" 33813" this._window.show_all();\n" 33814" },\n" 33815msgstr "" 33816 33817#. (itstool) path: section/p 33818#: C/statusbar.js.page:161 33819msgid "" 33820"This code finishes up creating the window, by packing the frames into the " 33821"pane, adding it to the window, and telling the window to show all child " 33822"widgets." 33823msgstr "" 33824 33825#. (itstool) path: section/title 33826#: C/statusbar.js.page:165 33827#, fuzzy 33828msgid "Functions for interacting with the statusbar" 33829msgstr "A barra de status" 33830 33831#. (itstool) path: section/code 33832#: C/statusbar.js.page:166 33833#, no-wrap 33834msgid "" 33835"\n" 33836" _clicked: function() {\n" 33837"\n" 33838" // Increment the number of clicks by 1\n" 33839" this.Clicks++;\n" 33840"\n" 33841" // Update the statusbar with the new number of clicks\n" 33842" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 33843"\n" 33844" },\n" 33845"\n" 33846"\n" 33847"\n" 33848" _back: function () {\n" 33849"\n" 33850" // If there have been any clicks, decrement by 1 and remove last statusbar update\n" 33851" if (this.Clicks > 0 ) {\n" 33852" this.Clicks--;\n" 33853" this._statusbar.pop (this.ContextID);\n" 33854" };\n" 33855"\n" 33856" },\n" 33857"\n" 33858"\n" 33859"\n" 33860" _clear: function () {\n" 33861"\n" 33862" // Reset the number of clicks\n" 33863" this.Clicks = 0;\n" 33864"\n" 33865" // Wipe out all the messages pushed to the statusbar\n" 33866" this._statusbar.remove_all (this.ContextID);\n" 33867"\n" 33868" // Reset the statusbar's message\n" 33869" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 33870"\n" 33871" }\n" 33872"\n" 33873"});\n" 33874msgstr "" 33875 33876#. (itstool) path: section/p 33877#: C/statusbar.js.page:206 33878msgid "" 33879"Here we have functions which demonstrate pushing a message onto the stack, " 33880"popping the top one off of it, and clearing all messages of a particular " 33881"context id. The pop() function just takes one parameter, which is the " 33882"context id for the type of message you want to pop off the most recent one " 33883"of. The remove_all() function works the same way, except it removes all " 33884"messages of that type from the stack." 33885msgstr "" 33886 33887#. (itstool) path: section/code 33888#: C/statusbar.js.page:207 33889#, fuzzy, no-wrap 33890msgid "" 33891"\n" 33892"// Run the application\n" 33893"let app = new StatusbarExample ();\n" 33894"app.application.run (ARGV);\n" 33895msgstr "" 33896"\n" 33897"// Executa o aplicativo\n" 33898"let app = new GettingTheSignal ();\n" 33899"app.application.run (ARGV);\n" 33900 33901#. (itstool) path: section/p 33902#: C/statusbar.js.page:212 33903msgid "" 33904"Finally, we create a new instance of the finished StatusbarExample class, " 33905"and set the application running." 33906msgstr "" 33907 33908#. (itstool) path: section/code 33909#: C/statusbar.js.page:217 33910#, no-wrap 33911msgid "" 33912"#!/usr/bin/gjs\n" 33913"\n" 33914"imports.gi.versions.Gtk = '3.0';\n" 33915"\n" 33916"const Gio = imports.gi.Gio;\n" 33917"const Gtk = imports.gi.Gtk;\n" 33918"\n" 33919"class StatusbarExample {\n" 33920"\n" 33921" // Create the application itself\n" 33922" constructor() {\n" 33923" this.application = new Gtk.Application({\n" 33924" application_id: 'org.example.jsstatusbar',\n" 33925" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 33926" });\n" 33927"\n" 33928" // Connect 'activate' and 'startup' signals to the callback functions\n" 33929" this.application.connect('activate', this._onActivate.bind(this));\n" 33930" this.application.connect('startup', this._onStartup.bind(this));\n" 33931" }\n" 33932"\n" 33933" // Callback function for 'activate' signal presents window when active\n" 33934" _onActivate() {\n" 33935" this._window.present();\n" 33936" }\n" 33937"\n" 33938" // Callback function for 'startup' signal builds the UI\n" 33939" _onStartup() {\n" 33940" this._buildUI();\n" 33941" }\n" 33942"\n" 33943" // Build the application's UI\n" 33944" _buildUI() {\n" 33945"\n" 33946" // Create the application window\n" 33947" this._window = new Gtk.ApplicationWindow({\n" 33948" application: this.application,\n" 33949" window_position: Gtk.WindowPosition.CENTER,\n" 33950" default_height: 120,\n" 33951" default_width: 300,\n" 33952" title: \"Button Clicker\"});\n" 33953"\n" 33954" // Create a paned interface\n" 33955" this._panes = new Gtk.Paned ({\n" 33956" orientation: Gtk.Orientation.VERTICAL });\n" 33957"\n" 33958" // Create the main button\n" 33959" this._clickMe = new Gtk.Button ({\n" 33960" label: \"Click Me!\" });\n" 33961" this._clickMe.connect (\"clicked\", this._clicked.bind(this));\n" 33962"\n" 33963" // Create the back button\n" 33964" this._backButton = new Gtk.Button ({\n" 33965" label: \"gtk-go-back\",\n" 33966" use_stock: true });\n" 33967" this._backButton.connect (\"clicked\", this._back.bind(this));\n" 33968"\n" 33969" // Create the clear button\n" 33970" this._clearButton = new Gtk.Button ({\n" 33971" label: \"gtk-clear\",\n" 33972" use_stock: true });\n" 33973" this._clearButton.connect (\"clicked\", this._clear.bind(this));\n" 33974"\n" 33975" // Put the buttons in a grid\n" 33976" this._grid = new Gtk.Grid ({\n" 33977" halign: Gtk.Align.CENTER,\n" 33978" valign: Gtk.Align.CENTER });\n" 33979" this._grid.attach (this._backButton, 0, 0, 1, 1);\n" 33980" this._grid.attach_next_to (this._clickMe, this._backButton, Gtk.PositionType.RIGHT, 1, 1);\n" 33981" this._grid.attach_next_to (this._clearButton, this._clickMe, Gtk.PositionType.RIGHT, 1, 1);\n" 33982"\n" 33983" // Put the grid in a large frame that fills most of the window\n" 33984" this._topFrame = new Gtk.Frame ({\n" 33985" border_width: 20,\n" 33986" height_request: 90,\n" 33987" width_request: 300});\n" 33988" this._topFrame.add (this._grid);\n" 33989"\n" 33990" // Create the statusbar\n" 33991" this._statusbar = new Gtk.Statusbar();\n" 33992"\n" 33993" // Keep track of the number of times the button has been clicked\n" 33994" this.Clicks = 0;\n" 33995" this.ContextID = this._statusbar.get_context_id (\"Number of Clicks\");\n" 33996"\n" 33997" // Give the statusbar an initial message\n" 33998" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 33999"\n" 34000" // Put the statusbar in its own frame at the bottom\n" 34001" this._barFrame = new Gtk.Frame ({\n" 34002" height_request: 30 });\n" 34003" this._barFrame.add (this._statusbar);\n" 34004"\n" 34005" // Assemble the frames into the paned interface\n" 34006" this._panes.pack1 (this._topFrame, true, false);\n" 34007" this._panes.pack2 (this._barFrame, false, false);\n" 34008"\n" 34009" // Put the panes into the window\n" 34010" this._window.add (this._panes);\n" 34011"\n" 34012" // Show the window and all child widgets\n" 34013" this._window.show_all();\n" 34014" }\n" 34015"\n" 34016" _clicked() {\n" 34017"\n" 34018" // Increment the number of clicks by 1\n" 34019" this.Clicks++;\n" 34020"\n" 34021" // Update the statusbar with the new number of clicks\n" 34022" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 34023" }\n" 34024"\n" 34025" _back() {\n" 34026"\n" 34027" // If there have been any clicks, decrement by 1 and remove last statusbar update\n" 34028" if (this.Clicks > 0 ) {\n" 34029" this.Clicks--;\n" 34030" this._statusbar.pop (this.ContextID);\n" 34031" };\n" 34032" }\n" 34033"\n" 34034" _clear() {\n" 34035"\n" 34036" // Reset the number of clicks\n" 34037" this.Clicks = 0;\n" 34038"\n" 34039" // Wipe out all the messages pushed to the statusbar\n" 34040" this._statusbar.remove_all (this.ContextID);\n" 34041"\n" 34042" // Reset the statusbar's message\n" 34043" this._statusbar.push (this.ContextID, \"Number of clicks: \" + this.Clicks);\n" 34044" }\n" 34045"};\n" 34046"\n" 34047"// Run the application\n" 34048"let app = new StatusbarExample ();\n" 34049"app.application.run (ARGV);\n" 34050msgstr "" 34051 34052#. (itstool) path: item/p 34053#: C/statusbar.js.page:226 34054msgid "" 34055"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Frame.html" 34056"\">Gtk.Frame</link>" 34057msgstr "" 34058 34059#. (itstool) path: item/p 34060#: C/statusbar.js.page:227 34061msgid "" 34062"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Paned.html" 34063"\">Gtk.Paned</link>" 34064msgstr "" 34065 34066#. (itstool) path: item/p 34067#: C/statusbar.js.page:228 34068msgid "" 34069"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Statusbar.html" 34070"\">Gtk.Statusbar</link>" 34071msgstr "" 34072 34073#. (itstool) path: info/title 34074#: C/statusbar.py.page:8 34075#, fuzzy 34076msgctxt "text" 34077msgid "Statusbar (Python)" 34078msgstr "A barra de status" 34079 34080#. (itstool) path: page/media 34081#. This is a reference to an external file such as an image or video. When 34082#. the file changes, the md5 hash will change to let you know you need to 34083#. update your localized copy. The msgstr is not used at all. Set it to 34084#. whatever you like once you have updated your copy of the file. 34085#: C/statusbar.py.page:24 C/statusbar.vala.page:25 34086msgctxt "_" 34087msgid "" 34088"external ref='media/statusbar.png' md5='eb1aca55315d6cda57b12a5f36058ba8'" 34089msgstr "" 34090"external ref='media/statusbar.png' md5='eb1aca55315d6cda57b12a5f36058ba8'" 34091 34092#. (itstool) path: page/p 34093#: C/statusbar.py.page:25 34094msgid "" 34095"This statusbar tells you if you click the button or if you press any key " 34096"(and which key)." 34097msgstr "" 34098 34099#. (itstool) path: section/code 34100#: C/statusbar.py.page:32 34101#, no-wrap 34102msgid "" 34103"from gi.repository import Gtk\n" 34104"from gi.repository import Gdk\n" 34105"import sys\n" 34106"\n" 34107"\n" 34108"class MyWindow(Gtk.ApplicationWindow):\n" 34109" # a window\n" 34110"\n" 34111" def __init__(self, app):\n" 34112" Gtk.Window.__init__(self, title=\"StatusBar Example\", application=app)\n" 34113" self.set_default_size(200, 100)\n" 34114"\n" 34115" # a label\n" 34116" label = Gtk.Label(label=\"Press any key or \")\n" 34117"\n" 34118" # a button\n" 34119" button = Gtk.Button(label=\"click me.\")\n" 34120" # connected to a callback\n" 34121" button.connect(\"clicked\", self.button_clicked_cb)\n" 34122"\n" 34123" # the statusbar\n" 34124" self.statusbar = Gtk.Statusbar()\n" 34125" # its context_id - not shown in the UI but needed to uniquely identify\n" 34126" # the source of a message\n" 34127" self.context_id = self.statusbar.get_context_id(\"example\")\n" 34128" # we push a message onto the statusbar's stack\n" 34129" self.statusbar.push(\n" 34130" self.context_id, \"Waiting for you to do something...\")\n" 34131"\n" 34132" # a grid to attach the widgets\n" 34133" grid = Gtk.Grid()\n" 34134" grid.set_column_spacing(5)\n" 34135" grid.set_column_homogeneous(True)\n" 34136" grid.set_row_homogeneous(True)\n" 34137" grid.attach(label, 0, 0, 1, 1)\n" 34138" grid.attach_next_to(button, label, Gtk.PositionType.RIGHT, 1, 1)\n" 34139" grid.attach(self.statusbar, 0, 1, 2, 1)\n" 34140"\n" 34141" # add the grid to the window\n" 34142" self.add(grid)\n" 34143"\n" 34144" # callback function for the button clicked\n" 34145" # if the button is clicked the event is signaled to the statusbar\n" 34146" # onto which we push a new status\n" 34147" def button_clicked_cb(self, button):\n" 34148" self.statusbar.push(self.context_id, \"You clicked the button.\")\n" 34149"\n" 34150" # event handler\n" 34151" def do_key_press_event(self, event):\n" 34152" # any signal from the keyboard is signaled to the statusbar\n" 34153" # onto which we push a new status with the symbolic name\n" 34154" # of the key pressed\n" 34155" self.statusbar.push(self.context_id, Gdk.keyval_name(event.keyval) +\n" 34156" \" key was pressed.\")\n" 34157" # stop the signal emission\n" 34158" return True\n" 34159"\n" 34160"\n" 34161"class MyApplication(Gtk.Application):\n" 34162"\n" 34163" def __init__(self):\n" 34164" Gtk.Application.__init__(self)\n" 34165"\n" 34166" def do_activate(self):\n" 34167" win = MyWindow(self)\n" 34168" win.show_all()\n" 34169"\n" 34170" def do_startup(self):\n" 34171" Gtk.Application.do_startup(self)\n" 34172"\n" 34173"app = MyApplication()\n" 34174"exit_status = app.run(sys.argv)\n" 34175"sys.exit(exit_status)\n" 34176msgstr "" 34177 34178#. (itstool) path: note/p 34179#: C/statusbar.py.page:34 34180msgid "" 34181"<code>Gdk.keyval_name(event.keyval)</code> converts the key value " 34182"<code>event.keyval</code> into a symbolic name. The names and corresponding " 34183"key values can be found <link href=\"http://git.gnome.org/browse/gtk+/tree/" 34184"gdk/gdkkeysyms.h\">here</link>, but for instance <code>GDK_KEY_BackSpace</" 34185"code> becomes the string <code>\"BackSpace\"</code>." 34186msgstr "" 34187 34188#. (itstool) path: section/title 34189#: C/statusbar.py.page:40 34190#, fuzzy 34191msgid "Useful methods for a Statusbar widget" 34192msgstr "Métodos úteis" 34193 34194#. (itstool) path: section/p 34195#: C/statusbar.py.page:41 34196msgid "" 34197"In line 17 the signal <code>\"clicked\"</code> is connected to the callback " 34198"function <code>button_clicked_cb()</code> using <code><var>widget</var>." 34199"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 34200"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 34201msgstr "" 34202 34203#. (itstool) path: item/p 34204#: C/statusbar.py.page:43 34205msgid "" 34206"<code>pop(context_id)</code> removes the first message in the statusbar " 34207"stack with the given <code>context_id</code>." 34208msgstr "" 34209 34210#. (itstool) path: item/p 34211#: C/statusbar.py.page:44 34212msgid "" 34213"<code>remove_all(context_id)</code> removes all the messages in the " 34214"statusbar stack with the given <code>context_id</code>." 34215msgstr "" 34216 34217#. (itstool) path: item/p 34218#: C/statusbar.py.page:45 34219msgid "" 34220"<code>remove(context_id, message_id)</code> removes the message with the " 34221"given <code>message_id</code> in the statusbar stack with the given " 34222"<code>context_id</code>. The <code>message_id</code> is returned by " 34223"<code>push(context_id, \"the message\")</code> when pushing the message on " 34224"the statusbar." 34225msgstr "" 34226 34227#. (itstool) path: item/p 34228#: C/statusbar.py.page:53 34229msgid "" 34230"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkStatusbar.html" 34231"\">GtkStatusbar</link>" 34232msgstr "" 34233 34234#. (itstool) path: item/p 34235#: C/statusbar.py.page:54 34236msgid "" 34237"<link href=\"http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html" 34238"\">Gdk - Key Values</link>" 34239msgstr "" 34240 34241#. (itstool) path: info/title 34242#: C/statusbar.vala.page:8 34243#, fuzzy 34244msgctxt "text" 34245msgid "Statusbar (Vala)" 34246msgstr "Barra de status" 34247 34248#. (itstool) path: page/p 34249#: C/statusbar.vala.page:26 34250msgid "This statusbar tells you what's going on." 34251msgstr "" 34252 34253#. (itstool) path: page/code 34254#: C/statusbar.vala.page:28 34255#, no-wrap 34256msgid "" 34257"public class MyWindow : Gtk.ApplicationWindow {\n" 34258"\n" 34259"\tGtk.Statusbar statusbar;\n" 34260"\tuint context_id;\n" 34261"\n" 34262"\tinternal MyWindow (MyApplication app) {\n" 34263"\t\tObject (application: app, title: \"Statusbar Example\");\n" 34264"\n" 34265"\t\tstatusbar = new Gtk.Statusbar ();\n" 34266"\t\tcontext_id = statusbar.get_context_id (\"example\");\n" 34267"\t\tstatusbar.push (context_id, \"Waiting for you to do something...\");\n" 34268"\n" 34269"\t\t//set the default size of the window\n" 34270"\t\tthis.set_default_size (200, 100);\n" 34271"\t\tvar grid = new Gtk.Grid ();\n" 34272"\t\tvar label = new Gtk.Label (\"Press any key or \");\n" 34273"\n" 34274"\t\tgrid.attach (label, 0, 0, 1, 1);\n" 34275"\t\tlabel.show ();\n" 34276"\n" 34277"\t\tvar button = new Gtk.Button.with_label (\"click me.\");\n" 34278"\t\tgrid.attach_next_to (button, label, Gtk.PositionType.RIGHT, 1, 1);\n" 34279"\t\tbutton.show ();\n" 34280"\n" 34281"\t\tgrid.attach (statusbar, 0, 1, 2, 1);\n" 34282"\t\tstatusbar.show ();\n" 34283"\n" 34284"\t\tgrid.set_column_spacing (5);\n" 34285"\t\tgrid.set_column_homogeneous (true);\n" 34286"\t\tgrid.set_row_homogeneous (true);\n" 34287"\n" 34288"\t\tthis.add (grid);\n" 34289"\t\tgrid.show ();\n" 34290"\n" 34291"\t\tbutton.clicked.connect(button_clicked_cb);\n" 34292"\t}\n" 34293"\n" 34294"\t/* Since the key-press-event is a signal received by the window, we don't need to connect\n" 34295"\tthe window to a callback function. We can just override key_press_event. */\n" 34296"\tprotected override bool key_press_event (Gdk.EventKey event) {\n" 34297"\t\tstatusbar.push (context_id, Gdk.keyval_name(event.keyval) + \" key was pressed.\");\n" 34298"\t\treturn true;\n" 34299"\t}\n" 34300"\n" 34301"\tvoid button_clicked_cb (Gtk.Button button) {\n" 34302"\t\tstatusbar.push (context_id, \"You clicked the button.\");\n" 34303"\t}\n" 34304"}\n" 34305"\n" 34306"public class MyApplication : Gtk.Application {\n" 34307"\tprotected override void activate () {\n" 34308"\t\tnew MyWindow (this).show ();\n" 34309"\t}\n" 34310"\n" 34311"\tinternal MyApplication () {\n" 34312"\t\tObject (application_id: \"org.example.status\");\n" 34313"\t}\n" 34314"}\n" 34315"\n" 34316"public int main (string[] args) {\n" 34317"\treturn new MyApplication ().run (args);\n" 34318"}\n" 34319msgstr "" 34320 34321#. (itstool) path: item/p 34322#: C/statusbar.vala.page:33 34323msgid "" 34324"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Statusbar.html\">Gtk." 34325"Statusbar</link>" 34326msgstr "" 34327 34328#. (itstool) path: info/title 34329#: C/strings.py.page:9 34330msgctxt "text" 34331msgid "Strings (Python)" 34332msgstr "" 34333 34334#. (itstool) path: info/desc 34335#: C/strings.py.page:14 34336msgid "An explanation of how to deal with strings in Python and GTK+." 34337msgstr "" 34338 34339#. (itstool) path: page/title 34340#: C/strings.py.page:27 34341#, fuzzy 34342msgid "Strings" 34343msgstr "Strings" 34344 34345#. (itstool) path: note/p 34346#: C/strings.py.page:31 34347msgid "GNOME strongly encourages the use of Python 3 for writing applications!" 34348msgstr "" 34349 34350#. (itstool) path: section/title 34351#: C/strings.py.page:34 34352#, fuzzy 34353msgid "Strings in Python 2" 34354msgstr "Python (versão 2)" 34355 34356#. (itstool) path: section/p 34357#: C/strings.py.page:36 34358msgid "" 34359"Python 2 comes with two different kinds of objects that can be used to " 34360"represent strings, <code>str</code> and <code>unicode</code>. Instances of " 34361"<code>unicode</code> are used to express Unicode strings, whereas instances " 34362"of the <code>str</code> type are byte representations (the encoded string). " 34363"Under the hood, Python represents Unicode strings as either 16- or 32-bit " 34364"integers, depending on how the Python interpreter was compiled." 34365msgstr "" 34366 34367#. (itstool) path: section/code 34368#: C/strings.py.page:38 34369#, no-wrap 34370msgid "" 34371"\n" 34372">>> unicode_string = u\"Fu\\u00dfb\\u00e4lle\"\n" 34373">>> print unicode_string\n" 34374"Fußbälle\n" 34375msgstr "" 34376 34377#. (itstool) path: section/p 34378#: C/strings.py.page:44 34379msgid "" 34380"Unicode strings can be converted to 8-bit strings with <code>unicode." 34381"encode()</code>. Python’s 8-bit strings have a <code>str.decode()</code> " 34382"method that interprets the string using the given encoding (that is, it is " 34383"the inverse of the <code>unicode.encode()</code>):" 34384msgstr "" 34385 34386#. (itstool) path: section/code 34387#: C/strings.py.page:46 34388#, no-wrap 34389msgid "" 34390"\n" 34391">>> type(unicode_string)\n" 34392"<type 'unicode'>\n" 34393">>> unicode_string.encode(\"utf-8\")\n" 34394"'Fu\\xc3\\x9fb\\xc3\\xa4lle'\n" 34395">>> utf8_string = unicode_string.encode(\"utf-8\")\n" 34396">>> type(utf8_string)\n" 34397"<type 'str'>\n" 34398">>> unicode_string == utf8_string.decode(\"utf-8\")\n" 34399"True" 34400msgstr "" 34401 34402#. (itstool) path: section/p 34403#: C/strings.py.page:57 34404msgid "" 34405"Unfortunately, Python 2.x allows you to mix <code>unicode</code> and " 34406"<code>str</code> if the 8-bit string happened to contain only 7-bit (ASCII) " 34407"bytes, but would get <sys>UnicodeDecodeError</sys> if it contained non-ASCII " 34408"values." 34409msgstr "" 34410 34411#. (itstool) path: section/title 34412#: C/strings.py.page:62 34413#, fuzzy 34414msgid "Strings in Python 3" 34415msgstr "Habilitar folding de expressões python entre aspas" 34416 34417#. (itstool) path: section/p 34418#: C/strings.py.page:64 34419msgid "" 34420"Since Python 3.0, all strings are stored as Unicode in an instance of the " 34421"<code>str</code> type. Encoded strings on the other hand are represented as " 34422"binary data in the form of instances of the bytes type. Conceptually, " 34423"<code>str</code> refers to text, whereas bytes refers to data. Use " 34424"<code>encode()</code> to go from <code>str</code> to <code>bytes</code>, and " 34425"<code>decode()</code> to go from <code>bytes</code> to <code>str</code>." 34426msgstr "" 34427 34428#. (itstool) path: section/p 34429#: C/strings.py.page:66 34430msgid "" 34431"In addition, it is no longer possible to mix Unicode strings with encoded " 34432"strings, because it will result in a <code>TypeError</code>:" 34433msgstr "" 34434 34435#. (itstool) path: section/code 34436#: C/strings.py.page:68 34437#, no-wrap 34438msgid "" 34439"\n" 34440">>> text = \"Fu\\u00dfb\\u00e4lle\"\n" 34441">>> data = b\" sind rund\"\n" 34442">>> text + data\n" 34443"Traceback (most recent call last):\n" 34444" File \"<stdin>\", line 1, in <module>\n" 34445"TypeError: Can't convert 'bytes' object to str implicitly\n" 34446">>> text + data.decode(\"utf-8\")\n" 34447"'Fußbälle sind rund'\n" 34448">>> text.encode(\"utf-8\") + data\n" 34449"b'Fu\\xc3\\x9fb\\xc3\\xa4lle sind rund'" 34450msgstr "" 34451 34452#. (itstool) path: section/title 34453#: C/strings.py.page:83 34454#, fuzzy 34455msgid "Unicode in GTK+" 34456msgstr "GTK+" 34457 34458#. (itstool) path: section/p 34459#: C/strings.py.page:85 34460msgid "" 34461"GTK+ uses UTF-8 encoded strings for all text. This means that if you call a " 34462"method that returns a string you will always obtain an instance of the " 34463"<code>str</code> type. The same applies to methods that expect one or more " 34464"strings as parameter, they must be UTF-8 encoded. However, for convenience " 34465"PyGObject will automatically convert any unicode instance to str if supplied " 34466"as argument:" 34467msgstr "" 34468 34469#. (itstool) path: section/code 34470#: C/strings.py.page:87 34471#, no-wrap 34472msgid "" 34473"\n" 34474">>> from gi.repository import Gtk\n" 34475">>> label = Gtk.Label()\n" 34476">>> unicode_string = u\"Fu\\u00dfb\\u00e4lle\"\n" 34477">>> label.set_text(unicode_string)\n" 34478">>> txt = label.get_text()\n" 34479">>> type(txt)\n" 34480"<type 'str'>" 34481msgstr "" 34482 34483#. (itstool) path: section/p 34484#: C/strings.py.page:96 34485#, fuzzy 34486msgid "Furthermore:" 34487msgstr "" 34488"Além disso, em vez de apenas dizer “em uma questão que seja razoavelmente " 34489"susceptível de levantar preocupações”, qualquer gravação do que é observado " 34490"deve ser presumido como levantar preocupações para as liberdades civis." 34491 34492#. (itstool) path: section/code 34493#: C/strings.py.page:98 34494#, fuzzy, no-wrap 34495msgid "" 34496"\n" 34497">>> txt == unicode_string" 34498msgstr "B<'\\e\"> E<lt>B<texto>E<gt>" 34499 34500#. (itstool) path: section/p 34501#: C/strings.py.page:101 34502msgid "" 34503"would return <code>False</code>, with the warning <code>__main__:1: " 34504"UnicodeWarning: Unicode equal comparison failed to convert both arguments to " 34505"Unicode - interpreting them as being unequal</code> (<code>Gtk.Label." 34506"get_text()</code> will always return a <code>str</code> instance; therefore, " 34507"<code>txt</code> and <code>unicode_string</code> are not equal)." 34508msgstr "" 34509 34510#. (itstool) path: section/p 34511#: C/strings.py.page:103 34512msgid "" 34513"This is especially important if you want to internationalize your program " 34514"using <link href=\"http://docs.python.org/library/gettext.html" 34515"\"><code>gettext</code></link>. You have to make sure that <code>gettext</" 34516"code> will return UTF-8 encoded 8-bit strings for all languages." 34517msgstr "" 34518 34519#. (itstool) path: section/p 34520#: C/strings.py.page:105 34521msgid "" 34522"In general it is recommended to not use <code>unicode</code> objects in GTK+ " 34523"applications at all, and only use UTF-8 encoded <code>str</code> objects " 34524"since GTK+ does not fully integrate with <code>unicode</code> objects." 34525msgstr "" 34526 34527#. (itstool) path: section/p 34528#: C/strings.py.page:107 34529msgid "" 34530"String encoding is more consistent in Python 3.x because PyGObject will " 34531"automatically encode/decode to/from UTF-8 if you pass a string to a method " 34532"or a method returns a string. Strings, or text, will always be represented " 34533"as instances of <code>str</code> only." 34534msgstr "" 34535 34536#. (itstool) path: section/p 34537#: C/strings.py.page:114 34538msgid "" 34539"<link href=\"http://python-gtk-3-tutorial.readthedocs.org/en/latest/unicode." 34540"html\">How To Deal With Strings - The Python GTK+ 3 Tutorial</link>" 34541msgstr "" 34542 34543#. (itstool) path: info/title 34544#: C/switch.c.page:8 34545#, fuzzy 34546msgctxt "text" 34547msgid "Switch (C)" 34548msgstr "Alternar" 34549 34550#. (itstool) path: info/desc 34551#: C/switch.c.page:18 C/switch.py.page:19 C/switch.vala.page:22 34552#, fuzzy 34553msgid "A \"light switch\" style toggle" 34554msgstr "toggle-switch-intl" 34555 34556#. (itstool) path: page/title 34557#: C/switch.c.page:21 C/switch.js.page:21 C/switch.py.page:22 34558#: C/switch.vala.page:25 34559#, fuzzy 34560msgid "Switch" 34561msgstr "Alternar" 34562 34563#. (itstool) path: page/media 34564#. This is a reference to an external file such as an image or video. When 34565#. the file changes, the md5 hash will change to let you know you need to 34566#. update your localized copy. The msgstr is not used at all. Set it to 34567#. whatever you like once you have updated your copy of the file. 34568#: C/switch.c.page:23 C/switch.py.page:23 C/switch.vala.page:26 34569msgctxt "_" 34570msgid "" 34571"external ref='media/switch_off.png' md5='211a2962708800697ad5373dcc86ad6d'" 34572msgstr "" 34573 34574#. (itstool) path: page/media 34575#. This is a reference to an external file such as an image or video. When 34576#. the file changes, the md5 hash will change to let you know you need to 34577#. update your localized copy. The msgstr is not used at all. Set it to 34578#. whatever you like once you have updated your copy of the file. 34579#: C/switch.c.page:24 C/switch.py.page:24 C/switch.vala.page:27 34580msgctxt "_" 34581msgid "" 34582"external ref='media/switch_on.png' md5='95e8769f758c2d95ace0fa8ecf30b29d'" 34583msgstr "" 34584 34585#. (itstool) path: page/p 34586#: C/switch.c.page:25 34587#, fuzzy 34588msgid "This switch toggles the title of the window." 34589msgstr "Alterna o alternador" 34590 34591#. (itstool) path: page/code 34592#: C/switch.c.page:27 34593#, no-wrap 34594msgid "" 34595"\n" 34596"#include <gtk/gtk.h>\n" 34597"\n" 34598"\n" 34599"\n" 34600"/*Signal handler for the \"active\" signal of the Switch*/\n" 34601"static void\n" 34602"activate_cb (GObject *switcher,\n" 34603" GParamSpec *pspec,\n" 34604" gpointer user_data)\n" 34605"{\n" 34606" GtkWindow *window = user_data;\n" 34607"\n" 34608" if (gtk_switch_get_active (GTK_SWITCH (switcher)))\n" 34609" gtk_window_set_title (GTK_WINDOW (window), \"Switch Example\");\n" 34610" else\n" 34611" gtk_window_set_title (GTK_WINDOW (window), \"\");\n" 34612"}\n" 34613"\n" 34614"\n" 34615"\n" 34616"static void\n" 34617"activate (GtkApplication *app,\n" 34618" gpointer user_data)\n" 34619"{\n" 34620" GtkWidget *grid;\n" 34621" GtkWidget *window;\n" 34622" GtkWidget *label;\n" 34623" GtkWidget *switcher;\n" 34624"\n" 34625" /*Create a window with a set title and default size.\n" 34626" Also, set a border width for the amount of space to leave\n" 34627" inside the window*/\n" 34628" window = gtk_application_window_new (app);\n" 34629" gtk_window_set_title (GTK_WINDOW (window), \"Switch Example\");\n" 34630" gtk_window_set_default_size (GTK_WINDOW (window), 300, 100);\n" 34631" gtk_container_set_border_width (GTK_CONTAINER (window), 10);\n" 34632"\n" 34633" /*Create a label*/\n" 34634" label = gtk_label_new (\"Title\");\n" 34635"\n" 34636" /*Create a switch with a default active state*/\n" 34637" switcher = gtk_switch_new ();\n" 34638" gtk_switch_set_active (GTK_SWITCH (switcher), TRUE);\n" 34639"\n" 34640" /*Create a grid and set the column spacing, attach the label and\n" 34641" switch onto the grid and position them accordingly*/\n" 34642" grid = gtk_grid_new();\n" 34643" gtk_grid_set_column_spacing (GTK_GRID (grid), 10);\n" 34644" gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);\n" 34645" gtk_grid_attach (GTK_GRID (grid), switcher, 1, 0, 1, 1);\n" 34646"\n" 34647" /*Connecting the clicked signal to the callback function*/\n" 34648" g_signal_connect (GTK_SWITCH (switcher), \n" 34649" \"notify::active\", \n" 34650" G_CALLBACK (activate_cb), \n" 34651" window);\n" 34652"\n" 34653" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));\n" 34654"\n" 34655" gtk_widget_show_all (window);\n" 34656"}\n" 34657"\n" 34658"\n" 34659"\n" 34660"int\n" 34661"main (int argc, char **argv)\n" 34662"{\n" 34663" GtkApplication *app;\n" 34664" int status;\n" 34665"\n" 34666" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 34667" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 34668" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 34669" g_object_unref (app);\n" 34670"\n" 34671" return status;\n" 34672"}\n" 34673msgstr "" 34674 34675#. (itstool) path: info/title 34676#: C/switch.js.page:8 34677#, fuzzy 34678msgctxt "text" 34679msgid "Switch (JavaScript)" 34680msgstr "_JavaScript" 34681 34682#. (itstool) path: info/desc 34683#: C/switch.js.page:18 34684msgid "A sliding switch that can be flipped on and off" 34685msgstr "" 34686 34687#. (itstool) path: page/media 34688#. This is a reference to an external file such as an image or video. When 34689#. the file changes, the md5 hash will change to let you know you need to 34690#. update your localized copy. The msgstr is not used at all. Set it to 34691#. whatever you like once you have updated your copy of the file. 34692#: C/switch.js.page:22 34693msgctxt "_" 34694msgid "" 34695"external ref='media/switchanimals.png' md5='513ae15dcf68e15eef30b76420b8c714'" 34696msgstr "" 34697"external ref='media/switchanimals.png' md5='513ae15dcf68e15eef30b76420b8c714'" 34698 34699#. (itstool) path: page/p 34700#: C/switch.js.page:23 34701msgid "" 34702"A Switch has two positions, on and off. This example shows how you can use " 34703"multiple switches together to control which <link xref=\"image.js\">Image</" 34704"link> is shown in the window. The pictures used in this example <link href=" 34705"\"https://live.gnome.org/TarynFox?action=AttachFile&do=get&" 34706"target=Animal+Photos.zip\">can be downloaded here</link>." 34707msgstr "" 34708 34709#. (itstool) path: note/p 34710#: C/switch.js.page:24 34711msgid "" 34712"The window will contain a \"broken image\" icon instead of a picture if " 34713"picture files named <file>redfox.png</file>, <file>muteswan.png</file>, " 34714"<file>fruitbat.png</file>, and <file>gentoopenguin.png</file> aren't in the " 34715"same directory. You can change the code and the pictures around as you like, " 34716"but the Creative Commons-licensed photos used in this example were taken " 34717"from the following sources and cropped to 640x425:" 34718msgstr "" 34719 34720#. (itstool) path: item/p 34721#: C/switch.js.page:26 34722msgid "" 34723"<link href=\"http://en.wikipedia.org/wiki/File:Fuzzy_Freddy.jpg\">Red fox " 34724"photo</link> by Rob Lee, licensed <link href=\"http://creativecommons.org/" 34725"licenses/by/2.0/deed.en\">CC-By</link>" 34726msgstr "" 34727 34728#. (itstool) path: item/p 34729#: C/switch.js.page:27 34730msgid "" 34731"<link href=\"http://en.wikipedia.org/wiki/File:Pygoscelis_papua_-" 34732"Nagasaki_Penguin_Aquarium_-swimming_underwater-8a.jpg\">Gentoo penguin " 34733"photo</link> by Ken Funakoshi, licensed <link href=\"http://creativecommons." 34734"org/licenses/by-sa/2.0/deed.en\">CC-By-SA</link>" 34735msgstr "" 34736 34737#. (itstool) path: item/p 34738#: C/switch.js.page:28 34739msgid "" 34740"<link href=\"http://www.flickr.com/photos/shekgraham/127431519/in/" 34741"photostream/\">Fruit bat photo</link> by Shek Graham, licensed <link href=" 34742"\"http://creativecommons.org/licenses/by/2.0/deed.en\">CC-By</link>" 34743msgstr "" 34744 34745#. (itstool) path: item/p 34746#: C/switch.js.page:29 34747msgid "" 34748"<link href=\"http://commons.wikimedia.org/wiki/File:Mute_Swan-" 34749"Mindaugas_Urbonas.jpg\">Mute swan photo</link> by Mindaugas Urbonas, " 34750"licensed <link href=\"http://creativecommons.org/licenses/by-sa/2.5/deed.en" 34751"\">CC-By-SA</link>" 34752msgstr "" 34753 34754#. (itstool) path: note/p 34755#: C/switch.js.page:31 34756msgid "" 34757"Photo credits and licensing information are shown in the application's <link " 34758"xref=\"aboutdialog.js\">AboutDialog</link>. Always remember to credit the " 34759"original artist when using <link href=\"http://creativecommons.org" 34760"\">Creative Commons-licensed works!</link>" 34761msgstr "" 34762 34763#. (itstool) path: section/code 34764#: C/switch.js.page:48 34765#, no-wrap 34766msgid "" 34767"\n" 34768"const SwitchExample = new Lang.Class({\n" 34769" Name: 'Switch Example',\n" 34770"\n" 34771" // Create the application itself\n" 34772" _init: function() {\n" 34773" this.application = new Gtk.Application({\n" 34774" application_id: 'org.example.jsswitch',\n" 34775" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 34776" });\n" 34777"\n" 34778" // Connect 'activate' and 'startup' signals to the callback functions\n" 34779" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 34780" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 34781" },\n" 34782"\n" 34783" // Callback function for 'activate' signal presents window when active\n" 34784" _onActivate: function() {\n" 34785" this._window.present();\n" 34786" },\n" 34787"\n" 34788" // Callback function for 'startup' signal creates the menu and builds the UI\n" 34789" _onStartup: function() {\n" 34790" this._initMenus();\n" 34791" this._buildUI ();\n" 34792" },\n" 34793msgstr "" 34794 34795#. (itstool) path: section/p 34796#: C/switch.js.page:75 34797msgid "" 34798"All the code for this sample goes in the SwitchExample class. The above code " 34799"creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk." 34800"Application.html\">Gtk.Application</link> for our widgets and window to go " 34801"in." 34802msgstr "" 34803 34804#. (itstool) path: section/code 34805#: C/switch.js.page:77 34806#, no-wrap 34807msgid "" 34808"\n" 34809" // Build the application's UI\n" 34810" _buildUI: function() {\n" 34811"\n" 34812" // Create the application window\n" 34813" this._window = new Gtk.ApplicationWindow({\n" 34814" application: this.application,\n" 34815" window_position: Gtk.WindowPosition.CENTER,\n" 34816" border_width: 20,\n" 34817" title: \"Animal Creator\"});\n" 34818msgstr "" 34819 34820#. (itstool) path: section/title 34821#: C/switch.js.page:92 34822#, fuzzy 34823msgid "Creating the switches" 34824msgstr "TROCA" 34825 34826#. (itstool) path: section/code 34827#: C/switch.js.page:93 34828#, no-wrap 34829msgid "" 34830"\n" 34831" // Create the image widget and set its default picture\n" 34832" this._image = new Gtk.Image ({file: \"redfox.png\"});\n" 34833msgstr "" 34834 34835#. (itstool) path: section/p 34836#: C/switch.js.page:98 34837msgid "" 34838"We first create the <link xref=\"image.js\">Image</link> that the switches " 34839"will control. Remember that a file named <file>redfox.png</file> needs to be " 34840"in the same directory as this application." 34841msgstr "" 34842 34843#. (itstool) path: section/code 34844#: C/switch.js.page:100 34845#, no-wrap 34846msgid "" 34847"\n" 34848" // Create a label for the first switch\n" 34849" this._flyLabel = new Gtk.Label ({\n" 34850" label: \"Make it fly\",\n" 34851" margin_right: 30});\n" 34852"\n" 34853" // Create the first switch and set its default position\n" 34854" this._flySwitch = new Gtk.Switch ({active: false});\n" 34855" this._flySwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n" 34856"\n" 34857" // Create a label for the second switch\n" 34858" this._birdLabel = new Gtk.Label ({\n" 34859" label: \"Make it a bird\",\n" 34860" margin_right: 30});\n" 34861"\n" 34862" // Create the second switch\n" 34863" this._birdSwitch = new Gtk.Switch ({active: false});\n" 34864" this._birdSwitch.connect ('notify::active', Lang.bind (this, this._switchFlip));\n" 34865msgstr "" 34866 34867#. (itstool) path: section/p 34868#: C/switch.js.page:120 34869msgid "" 34870"We use a <link xref=\"label.js\">Label</link> to mark each Switch, and give " 34871"them a bit of a margin on the right so that they aren't crammed right next " 34872"to the Switches. After that we create the Switches, and set them to be " 34873"switched off by default." 34874msgstr "" 34875 34876#. (itstool) path: section/p 34877#: C/switch.js.page:121 34878msgid "" 34879"The signal a switch sends out when it's flipped on or off is called notify::" 34880"active. After we create each switch, we connect its notify::active signal to " 34881"a function called _switchFlip. If you have multiple switches that each do " 34882"something different, you might want to connect them to different functions, " 34883"but here they're both used for the same thing: To control what picture's " 34884"displayed by _image." 34885msgstr "" 34886 34887#. (itstool) path: section/code 34888#: C/switch.js.page:123 34889#, no-wrap 34890msgid "" 34891"\n" 34892" // Create a grid for the labels and switches beneath the picture\n" 34893" this._UIGrid = new Gtk.Grid ({\n" 34894" halign: Gtk.Align.CENTER,\n" 34895" valign: Gtk.Align.CENTER,\n" 34896" margin_top: 20});\n" 34897"\n" 34898" // Attach the labels and switches to that grid\n" 34899" this._UIGrid.attach (this._flyLabel, 0, 0, 1, 1);\n" 34900" this._UIGrid.attach (this._flySwitch, 1, 0, 1, 1);\n" 34901" this._UIGrid.attach (this._birdLabel, 0, 1, 1, 1);\n" 34902" this._UIGrid.attach (this._birdSwitch, 1, 1, 1, 1);\n" 34903"\n" 34904" // Create a master grid to put both the UI and the picture into\n" 34905" this._mainGrid = new Gtk.Grid ({\n" 34906" halign: Gtk.Align.CENTER,\n" 34907" valign: Gtk.Align.CENTER });\n" 34908"\n" 34909" // Attach the picture and the UI grid to the master grid\n" 34910" this._mainGrid.attach (this._image, 0, 0, 1, 1);\n" 34911" this._mainGrid.attach (this._UIGrid, 0, 1, 1, 1);\n" 34912msgstr "" 34913 34914#. (itstool) path: section/p 34915#: C/switch.js.page:145 34916msgid "" 34917"We create a <link xref=\"grid.js\">Grid</link> for the Labels and Switches " 34918"first, so that we can organize them in a 2x2 layout with a margin between it " 34919"and the Image. Then we put that Grid into a larger 2x1 Grid that has the " 34920"Image on top, and the Grid with the Labels and Switches on the bottom." 34921msgstr "" 34922 34923#. (itstool) path: section/code 34924#: C/switch.js.page:146 34925#, no-wrap 34926msgid "" 34927"\n" 34928" // Add the master grid to the window\n" 34929" this._window.add (this._mainGrid);\n" 34930"\n" 34931" // Show the window and all child widgets\n" 34932" this._window.show_all();\n" 34933" },\n" 34934msgstr "" 34935 34936#. (itstool) path: section/title 34937#: C/switch.js.page:158 34938msgid "Function which handles the switches being flipped" 34939msgstr "" 34940 34941#. (itstool) path: section/code 34942#: C/switch.js.page:160 34943#, no-wrap 34944msgid "" 34945"\n" 34946" _switchFlip: function() {\n" 34947"\n" 34948" // Change the picture depending on which switches are flipped\n" 34949" if (this._flySwitch.get_active()) {\n" 34950"\n" 34951" if (this._birdSwitch.get_active()) this._image.set_from_file (\"muteswan.png\");\n" 34952"\n" 34953" else this._image.set_from_file (\"fruitbat.png\");\n" 34954" }\n" 34955"\n" 34956" else {\n" 34957"\n" 34958" if (this._birdSwitch.get_active()) this._image.set_from_file (\"gentoopenguin.png\");\n" 34959"\n" 34960" else this._image.set_from_file (\"redfox.png\");\n" 34961"\n" 34962" }\n" 34963"\n" 34964" },\n" 34965msgstr "" 34966 34967#. (itstool) path: section/p 34968#: C/switch.js.page:181 34969msgid "" 34970"Each time a Switch is flipped, this function checks to see which of the two " 34971"Switches are active afterwards, using the Switches' built-in get_active() " 34972"function. It then changes the Image accordingly. You can change the " 34973"filenames around as you like, so long as you have pictures to go with them." 34974msgstr "" 34975 34976#. (itstool) path: section/title 34977#: C/switch.js.page:185 34978#, fuzzy 34979msgid "Creating the AboutDialog" 34980msgstr "sem tabelas, criando …" 34981 34982#. (itstool) path: section/code 34983#: C/switch.js.page:186 34984#, no-wrap 34985msgid "" 34986"\n" 34987" _initMenus: function() {\n" 34988"\n" 34989" // Build the application's menu so we can have an \"About\" button\n" 34990" let menu = new Gio.Menu();\n" 34991" menu.append(\"About\", 'app.about');\n" 34992" menu.append(\"Quit\",'app.quit');\n" 34993" this.application.set_app_menu(menu);\n" 34994"\n" 34995" // Bind the \"About\" button to the _showAbout() function\n" 34996" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n" 34997" aboutAction.connect('activate', Lang.bind(this,\n" 34998" function() {\n" 34999" this._showAbout();\n" 35000" }));\n" 35001" this.application.add_action(aboutAction);\n" 35002"\n" 35003" // Bind the \"Quit\" button to the function that closes the window\n" 35004" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 35005" quitAction.connect('activate', Lang.bind(this,\n" 35006" function() {\n" 35007" this._window.destroy();\n" 35008" }));\n" 35009" this.application.add_action(quitAction);\n" 35010" },\n" 35011msgstr "" 35012 35013#. (itstool) path: section/p 35014#: C/switch.js.page:212 35015msgid "" 35016"The first step is building the <link xref=\"gmenu.js\">GMenu</link> that the " 35017"\"About\" button goes into. This is the menu that appears when you click the " 35018"application's name in the upper-left corner of the screen, next to the " 35019"Activities menu. Our menu only has two options in it: About, and Quit." 35020msgstr "" 35021 35022#. (itstool) path: section/code 35023#: C/switch.js.page:214 35024#, no-wrap 35025msgid "" 35026"\n" 35027" _showAbout: function () {\n" 35028"\n" 35029" // String arrays of the names of the people involved in the project\n" 35030" var artists = ['Rob Lee http://en.wikipedia.org/wiki/File:Fuzzy_Freddy.jpg', 'Ken Funakoshi http://en.wikipedia.org/wiki/File:Pygoscelis_papua_-Nagasaki_Penguin_Aquarium_-swimming_underwater-8a.jpg', 'Shek Graham http://www.flickr.com/photos/shekgraham/127431519/in/photostream/', 'Mindaugas Urbonas http://commons.wikimedia.org/wiki/File:Mute_Swan-Mindaugas_Urbonas.jpg'];\n" 35031" var authors = [\"GNOME Documentation Team\"];\n" 35032" var documenters = [\"GNOME Documentation Team\"];\n" 35033"\n" 35034" // Create the About dialog\n" 35035" let aboutDialog = new Gtk.AboutDialog({\n" 35036" title: \"AboutDialog Example\",\n" 35037" program_name: \"Animal Creator\",\n" 35038" 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" 35039" artists: artists,\n" 35040" authors: authors,\n" 35041" documenters: documenters,\n" 35042" website: \"http://developer.gnome.org\",\n" 35043" website_label: \"GNOME Developer Website\" });\n" 35044"\n" 35045" // Attach the About dialog to the window\n" 35046" aboutDialog.modal = true;\n" 35047" aboutDialog.transient_for = this._window;\n" 35048"\n" 35049" // Show the About dialog\n" 35050" aboutDialog.show();\n" 35051"\n" 35052" // Connect the Close button to the destroy signal for the dialog\n" 35053" aboutDialog.connect('response', function() {\n" 35054" aboutDialog.destroy();\n" 35055" });\n" 35056" }\n" 35057"\n" 35058"});\n" 35059msgstr "" 35060 35061#. (itstool) path: section/p 35062#: C/switch.js.page:248 35063msgid "" 35064"An <link xref=\"aboutdialog.js\">AboutDialog</link> has a lot of different " 35065"things you can set, to credit everyone who worked on the application and " 35066"leave a note to whomever reads it. In this case, the copyright section " 35067"contains our note and credits the original photographers, while the artists " 35068"section shows you a list of the photographers with links to the original " 35069"photos when you click the Credits button. The web URLs put after their names " 35070"in the array turn their names into clickable links in the Credits section." 35071msgstr "" 35072 35073#. (itstool) path: section/code 35074#: C/switch.js.page:250 35075#, fuzzy, no-wrap 35076msgid "" 35077"\n" 35078"// Run the application\n" 35079"let app = new SwitchExample ();\n" 35080"app.application.run (ARGV);\n" 35081msgstr "" 35082"\n" 35083"// Executa o aplicativo\n" 35084"let app = new GettingTheSignal ();\n" 35085"app.application.run (ARGV);\n" 35086 35087#. (itstool) path: section/p 35088#: C/switch.js.page:255 35089msgid "" 35090"Finally, we create a new instance of the finished SwitchExample class, and " 35091"set the application running." 35092msgstr "" 35093 35094#. (itstool) path: section/code 35095#: C/switch.js.page:260 35096#, no-wrap 35097msgid "" 35098"#!/usr/bin/gjs\n" 35099"\n" 35100"imports.gi.versions.Gtk = '3.0';\n" 35101"\n" 35102"const Gio = imports.gi.Gio;\n" 35103"const Gtk = imports.gi.Gtk;\n" 35104"\n" 35105"class SwitchExample {\n" 35106"\n" 35107" // Create the application itself\n" 35108" constructor() {\n" 35109" this.application = new Gtk.Application({\n" 35110" application_id: 'org.example.jsswitch'\n" 35111" });\n" 35112"\n" 35113" // Connect 'activate' and 'startup' signals to the callback functions\n" 35114" this.application.connect('activate', this._onActivate.bind(this));\n" 35115" this.application.connect('startup', this._onStartup.bind(this));\n" 35116" }\n" 35117"\n" 35118" // Callback function for 'activate' signal presents window when active\n" 35119" _onActivate() {\n" 35120" this._window.present();\n" 35121" }\n" 35122"\n" 35123" // Callback function for 'startup' signal creates the menu and builds the UI\n" 35124" _onStartup() {\n" 35125" this._initMenus();\n" 35126" this._buildUI();\n" 35127" }\n" 35128"\n" 35129" // Build the application's UI\n" 35130" _buildUI() {\n" 35131"\n" 35132" // Create the application window\n" 35133" this._window = new Gtk.ApplicationWindow({\n" 35134" application: this.application,\n" 35135" window_position: Gtk.WindowPosition.CENTER,\n" 35136" border_width: 20,\n" 35137" title: \"Animal Creator\"});\n" 35138"\n" 35139" // Create the image widget and set its default picture\n" 35140" this._image = new Gtk.Image ({file: \"redfox.png\"});\n" 35141"\n" 35142" // Create a label for the first switch\n" 35143" this._flyLabel = new Gtk.Label ({\n" 35144" label: \"Make it fly\",\n" 35145" margin_right: 30});\n" 35146"\n" 35147" // Create the first switch and set its default position\n" 35148" this._flySwitch = new Gtk.Switch ({active: false});\n" 35149" this._flySwitch.connect ('notify::active', this._switchFlip.bind(this));\n" 35150"\n" 35151" // Create a label for the second switch\n" 35152" this._birdLabel = new Gtk.Label ({\n" 35153" label: \"Make it a bird\",\n" 35154" margin_right: 30});\n" 35155"\n" 35156" // Create the second switch\n" 35157" this._birdSwitch = new Gtk.Switch ({active: false});\n" 35158" this._birdSwitch.connect ('notify::active', this._switchFlip.bind(this));\n" 35159"\n" 35160" // Create a grid for the labels and switches beneath the picture\n" 35161" this._UIGrid = new Gtk.Grid ({\n" 35162" halign: Gtk.Align.CENTER,\n" 35163" valign: Gtk.Align.CENTER,\n" 35164" margin_top: 20});\n" 35165"\n" 35166" // Attach the labels and switches to that grid\n" 35167" this._UIGrid.attach (this._flyLabel, 0, 0, 1, 1);\n" 35168" this._UIGrid.attach (this._flySwitch, 1, 0, 1, 1);\n" 35169" this._UIGrid.attach (this._birdLabel, 0, 1, 1, 1);\n" 35170" this._UIGrid.attach (this._birdSwitch, 1, 1, 1, 1);\n" 35171"\n" 35172" // Create a master grid to put both the UI and the picture into\n" 35173" this._mainGrid = new Gtk.Grid ({\n" 35174" halign: Gtk.Align.CENTER,\n" 35175" valign: Gtk.Align.CENTER });\n" 35176"\n" 35177" // Attach the picture and the UI grid to the master grid\n" 35178" this._mainGrid.attach (this._image, 0, 0, 1, 1);\n" 35179" this._mainGrid.attach (this._UIGrid, 0, 1, 1, 1);\n" 35180"\n" 35181" // Add the master grid to the window\n" 35182" this._window.add (this._mainGrid);\n" 35183"\n" 35184" // Show the window and all child widgets\n" 35185" this._window.show_all();\n" 35186" }\n" 35187"\n" 35188" _switchFlip() {\n" 35189"\n" 35190" // Change the picture depending on which switches are flipped\n" 35191" if (this._flySwitch.get_active()) {\n" 35192"\n" 35193" if (this._birdSwitch.get_active())\n" 35194" this._image.set_from_file (\"muteswan.png\");\n" 35195" else\n" 35196" this._image.set_from_file (\"fruitbat.png\");\n" 35197" } else {\n" 35198"\n" 35199" if (this._birdSwitch.get_active())\n" 35200" this._image.set_from_file (\"gentoopenguin.png\");\n" 35201" else\n" 35202" this._image.set_from_file (\"redfox.png\");\n" 35203" }\n" 35204" }\n" 35205"\n" 35206" _initMenus() {\n" 35207"\n" 35208" // Build the application's menu so we can have an \"About\" button\n" 35209" let menu = new Gio.Menu();\n" 35210" menu.append(\"About\", 'app.about');\n" 35211" menu.append(\"Quit\",'app.quit');\n" 35212" this.application.set_app_menu(menu);\n" 35213"\n" 35214" // Bind the \"About\" button to the _showAbout() function\n" 35215" let aboutAction = new Gio.SimpleAction ({ name: 'about' });\n" 35216" aboutAction.connect('activate', () => { this._showAbout(); });\n" 35217" this.application.add_action(aboutAction);\n" 35218"\n" 35219" // Bind the \"Quit\" button to the function that closes the window\n" 35220" let quitAction = new Gio.SimpleAction ({ name: 'quit' });\n" 35221" quitAction.connect('activate', () => { this._window.destroy(); });\n" 35222" this.application.add_action(quitAction);\n" 35223" }\n" 35224"\n" 35225" _showAbout() {\n" 35226"\n" 35227" // String arrays of the names of the people involved in the project\n" 35228" 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" 35229" var authors = [\"GNOME Documentation Team\"];\n" 35230" var documenters = [\"GNOME Documentation Team\"];\n" 35231"\n" 35232" // Create the About dialog\n" 35233" let aboutDialog = new Gtk.AboutDialog({\n" 35234" title: \"AboutDialog Example\",\n" 35235" program_name: \"Animal Creator\",\n" 35236" 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" 35237" artists: artists,\n" 35238" authors: authors,\n" 35239" documenters: documenters,\n" 35240" website: \"http://developer.gnome.org\",\n" 35241" website_label: \"GNOME Developer Website\" });\n" 35242"\n" 35243" // Attach the About dialog to the window\n" 35244" aboutDialog.modal = true;\n" 35245" aboutDialog.transient_for = this._window;\n" 35246"\n" 35247" // Show the About dialog\n" 35248" aboutDialog.show();\n" 35249"\n" 35250" // Connect the Close button to the destroy signal for the dialog\n" 35251" aboutDialog.connect('response', function() {\n" 35252" aboutDialog.destroy();\n" 35253" });\n" 35254" }\n" 35255"};\n" 35256"\n" 35257"// Run the application\n" 35258"let app = new SwitchExample ();\n" 35259"app.application.run (ARGV);\n" 35260msgstr "" 35261 35262#. (itstool) path: item/p 35263#: C/switch.js.page:271 35264msgid "" 35265"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Image.html" 35266"\">Gtk.Image</link>" 35267msgstr "" 35268 35269#. (itstool) path: item/p 35270#: C/switch.js.page:273 35271msgid "" 35272"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Switch.html" 35273"\">Gtk.Switch</link>" 35274msgstr "" 35275 35276#. (itstool) path: info/title 35277#: C/switch.py.page:8 35278#, fuzzy 35279msgctxt "text" 35280msgid "Switch (Python)" 35281msgstr "Alternar" 35282 35283#. (itstool) path: page/p 35284#: C/switch.py.page:26 35285msgid "This Switch makes the title appears and disappear." 35286msgstr "" 35287 35288#. (itstool) path: section/code 35289#: C/switch.py.page:33 35290#, no-wrap 35291msgid "" 35292"from gi.repository import Gtk\n" 35293"import sys\n" 35294"\n" 35295"\n" 35296"class MyWindow(Gtk.ApplicationWindow):\n" 35297" # a window\n" 35298"\n" 35299" def __init__(self, app):\n" 35300" Gtk.Window.__init__(self, title=\"Switch Example\", application=app)\n" 35301" self.set_default_size(300, 100)\n" 35302" self.set_border_width(10)\n" 35303"\n" 35304" # a switch\n" 35305" switch = Gtk.Switch()\n" 35306" # turned on by default\n" 35307" switch.set_active(True)\n" 35308" # connect the signal notify::active emitted by the switch\n" 35309" # to the callback function activate_cb\n" 35310" switch.connect(\"notify::active\", self.activate_cb)\n" 35311"\n" 35312" # a label\n" 35313" label = Gtk.Label()\n" 35314" label.set_text(\"Title\")\n" 35315"\n" 35316" # a grid to allocate the widgets\n" 35317" grid = Gtk.Grid()\n" 35318" grid.set_column_spacing(10)\n" 35319" grid.attach(label, 0, 0, 1, 1)\n" 35320" grid.attach(switch, 1, 0, 1, 1)\n" 35321"\n" 35322" # add the grid to the window\n" 35323" self.add(grid)\n" 35324"\n" 35325" # Callback function. Since the signal is notify::active\n" 35326" # we need the argument 'active'\n" 35327" def activate_cb(self, button, active):\n" 35328" # if the button (i.e. the switch) is active, set the title\n" 35329" # of the window to \"Switch Example\"\n" 35330" if button.get_active():\n" 35331" self.set_title(\"Switch Example\")\n" 35332" # else, set it to \"\" (empty string)\n" 35333" else:\n" 35334" self.set_title(\"\")\n" 35335"\n" 35336"\n" 35337"class MyApplication(Gtk.Application):\n" 35338"\n" 35339" def __init__(self):\n" 35340" Gtk.Application.__init__(self)\n" 35341"\n" 35342" def do_activate(self):\n" 35343" win = MyWindow(self)\n" 35344" win.show_all()\n" 35345"\n" 35346" def do_startup(self):\n" 35347" Gtk.Application.do_startup(self)\n" 35348"\n" 35349"app = MyApplication()\n" 35350"exit_status = app.run(sys.argv)\n" 35351"sys.exit(exit_status)\n" 35352msgstr "" 35353 35354#. (itstool) path: section/title 35355#: C/switch.py.page:37 35356#, fuzzy 35357msgid "Useful methods for a Switch widget" 35358msgstr "Métodos úteis" 35359 35360#. (itstool) path: section/p 35361#: C/switch.py.page:38 35362msgid "" 35363"In line 17 the signal <code>\"notify::active\"</code> is connected to the " 35364"callback function <code>activate_cb()</code> using <code><var>widget</var>." 35365"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 35366"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 35367msgstr "" 35368 35369#. (itstool) path: item/p 35370#: C/switch.py.page:45 35371msgid "" 35372"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkSwitch.html" 35373"\">GtkSwitch</link>" 35374msgstr "" 35375 35376#. (itstool) path: info/title 35377#: C/switch.vala.page:8 35378#, fuzzy 35379msgctxt "text" 35380msgid "Switch (Vala)" 35381msgstr "_Vala" 35382 35383#. (itstool) path: page/p 35384#: C/switch.vala.page:29 35385#, fuzzy 35386msgid "This Switch toggles the title." 35387msgstr "Alterna o alternador" 35388 35389#. (itstool) path: page/code 35390#: C/switch.vala.page:31 35391#, no-wrap 35392msgid "" 35393"class MyWindow : Gtk.ApplicationWindow {\n" 35394"\n" 35395"\tinternal MyWindow (MyApplication app) {\n" 35396"\t\tObject (application: app, title: \"Switch Example\");\n" 35397"\n" 35398"\t\tthis.set_default_size (300, 100);\n" 35399"\t\tthis.border_width = 10;\n" 35400"\n" 35401"\t\tvar label = new Gtk.Label (\"Title\");\n" 35402"\t\tvar switcher = new Gtk.Switch ();\n" 35403"\n" 35404"\t\tswitcher.set_active (true);\n" 35405"\n" 35406"\t\tswitcher.notify[\"active\"].connect (switcher_cb);\n" 35407"\n" 35408"\t\tvar grid = new Gtk.Grid ();\n" 35409"\t\tgrid.set_column_spacing (10);\n" 35410"\t\tgrid.attach (label, 0, 0, 1, 1);\n" 35411"\t\tgrid.attach (switcher, 1, 0, 1, 1);\n" 35412"\n" 35413"\t\tthis.add (grid);\n" 35414"\t}\n" 35415"\n" 35416"\tvoid switcher_cb (Object switcher, ParamSpec pspec) {\n" 35417"\t\tif ((switcher as Gtk.Switch).get_active())\n" 35418"\t\t\tthis.set_title (\"Switch Example\");\n" 35419"\t\telse\n" 35420"\t\t\tthis.set_title (\"\");\n" 35421"\t}\n" 35422"}\n" 35423"\n" 35424"class MyApplication : Gtk.Application {\n" 35425"\tprotected override void activate () {\n" 35426"\n" 35427"\t\tvar window = new MyWindow (this);\n" 35428"\t\twindow.show_all (); //show all the things\n" 35429"\t}\n" 35430"\n" 35431"\tinternal MyApplication () {\n" 35432"\t\tObject (application_id: \"org.example.checkbutton\");\n" 35433"\t}\n" 35434"}\n" 35435"\n" 35436"int main (string[] args) {\n" 35437"\treturn new MyApplication ().run (args);\n" 35438"}\n" 35439msgstr "" 35440 35441#. (itstool) path: item/p 35442#: C/switch.vala.page:36 35443msgid "" 35444"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Switch.html\">Gtk.Switch</" 35445"link>" 35446msgstr "" 35447 35448#. (itstool) path: info/title 35449#: C/textview.c.page:8 35450#, fuzzy 35451msgctxt "text" 35452msgid "TextView (C)" 35453msgstr "C" 35454 35455#. (itstool) path: info/desc 35456#: C/textview.c.page:18 C/textview.vala.page:18 35457#, fuzzy 35458msgid "Widget which displays a GtkTextBuffer" 35459msgstr "O componente pai com o qual a janela deveria se alinhar." 35460 35461#. (itstool) path: page/title 35462#: C/textview.c.page:21 C/textview.vala.page:21 35463#, fuzzy 35464msgid "TextView widget" 35465msgstr "Widget:" 35466 35467#. (itstool) path: note/p 35468#: C/textview.c.page:22 C/textview.py.page:33 C/textview.vala.page:22 35469msgid "If we press \"enter\", we have a new line." 35470msgstr "" 35471 35472#. (itstool) path: note/p 35473#: C/textview.c.page:23 C/textview.vala.page:23 35474msgid "" 35475"If we press \"enter\" more times then there are lines in the default sized " 35476"window, then a vertical scrollbar appears." 35477msgstr "" 35478 35479#. (itstool) path: note/p 35480#: C/textview.c.page:24 C/textview.vala.page:24 35481msgid "" 35482"If we write a long sentence, the text will wrap breaking lines between words." 35483msgstr "" 35484 35485#. (itstool) path: note/p 35486#: C/textview.c.page:25 35487msgid "" 35488"If we have a loooooooooooooooooooooooooooooooooooong (that was long) word, " 35489"a* horizontal scrollbar will appear." 35490msgstr "" 35491 35492#. (itstool) path: page/media 35493#. This is a reference to an external file such as an image or video. When 35494#. the file changes, the md5 hash will change to let you know you need to 35495#. update your localized copy. The msgstr is not used at all. Set it to 35496#. whatever you like once you have updated your copy of the file. 35497#: C/textview.c.page:27 C/textview.py.page:39 C/textview.vala.page:27 35498msgctxt "_" 35499msgid "" 35500"external ref='media/textview.png' md5='049e859ed1af2d7c93d8cb5cfd9f7792'" 35501msgstr "" 35502"external ref='media/textview.png' md5='049e859ed1af2d7c93d8cb5cfd9f7792'" 35503 35504#. (itstool) path: page/p 35505#: C/textview.c.page:28 C/textview.vala.page:28 35506#, fuzzy 35507msgid "This is an example of Gtk.TextView" 35508msgstr "Por exemplo:" 35509 35510#. (itstool) path: page/code 35511#: C/textview.c.page:30 35512#, no-wrap 35513msgid "" 35514"\n" 35515"#include <gtk/gtk.h>\n" 35516"\n" 35517"\n" 35518"\n" 35519"static void\n" 35520"activate (GtkApplication *app,\n" 35521" gpointer user_data)\n" 35522"{\n" 35523" /* Declare variables */\n" 35524" GtkWidget *window;\n" 35525" GtkWidget *text_view;\n" 35526" GtkWidget *scrolled_window;\n" 35527"\n" 35528" GtkTextBuffer *buffer;\n" 35529"\n" 35530"\n" 35531" /* Create a window with a title, and a default size */\n" 35532" window = gtk_application_window_new (app);\n" 35533" gtk_window_set_title (GTK_WINDOW (window), \"TextView Example\");\n" 35534" gtk_window_set_default_size (GTK_WINDOW (window), 220, 200);\n" 35535"\n" 35536"\n" 35537" /* The text buffer represents the text being edited */\n" 35538" buffer = gtk_text_buffer_new (NULL);\n" 35539" \n" 35540"\n" 35541" /* Text view is a widget in which can display the text buffer. \n" 35542" * The line wrapping is set to break lines in between words.\n" 35543" */\n" 35544" text_view = gtk_text_view_new_with_buffer (buffer);\n" 35545" gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD); \n" 35546"\n" 35547"\n" 35548" /* Create the scrolled window. Usually NULL is passed for both parameters so \n" 35549" * that it creates the horizontal/vertical adjustments automatically. Setting \n" 35550" * the scrollbar policy to automatic allows the scrollbars to only show up \n" 35551" * when needed. \n" 35552" */\n" 35553" scrolled_window = gtk_scrolled_window_new (NULL, NULL);\n" 35554" gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), \n" 35555" GTK_POLICY_AUTOMATIC, \n" 35556" GTK_POLICY_AUTOMATIC); \n" 35557" /* The function directly below is used to add children to the scrolled window \n" 35558" * with scrolling capabilities (e.g text_view), otherwise, \n" 35559" * gtk_scrolled_window_add_with_viewport() would have been used\n" 35560" */\n" 35561" gtk_container_add (GTK_CONTAINER (scrolled_window), \n" 35562" text_view);\n" 35563" gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 5);\n" 35564" \n" 35565" \n" 35566" gtk_container_add (GTK_CONTAINER (window), scrolled_window);\n" 35567"\n" 35568" gtk_widget_show_all (window);\n" 35569"}\n" 35570"\n" 35571"\n" 35572"\n" 35573"int\n" 35574"main (int argc, char **argv)\n" 35575"{\n" 35576" GtkApplication *app;\n" 35577" int status;\n" 35578"\n" 35579" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 35580" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 35581" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 35582" g_object_unref (app);\n" 35583"\n" 35584" return status;\n" 35585"}\n" 35586msgstr "" 35587 35588#. (itstool) path: item/p 35589#: C/textview.c.page:41 35590#, fuzzy 35591msgid "" 35592"<link href=\"http://developer.gnome.org/gtk3/stable/GtkContainer.html" 35593"\">GtkContainer</link>" 35594msgstr "" 35595"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 35596"link>" 35597 35598#. (itstool) path: info/title 35599#: C/textview.js.page:8 35600#, fuzzy 35601msgctxt "text" 35602msgid "TextView (JavaScript)" 35603msgstr "_JavaScript" 35604 35605#. (itstool) path: info/desc 35606#: C/textview.js.page:22 35607#, fuzzy 35608msgid "A multiline text editor" 35609msgstr "Multilinha" 35610 35611#. (itstool) path: page/title 35612#: C/textview.js.page:25 C/textview.py.page:30 35613#, fuzzy 35614msgid "TextView" 35615msgstr "" 35616"// cria seus próprios ajustes\n" 35617"Gtk::TextView textview;\n" 35618"// usa o ajuste recém-criado para a barra de rolagem assim\n" 35619"Gtk::Scrollbar vscrollbar (textview.get_vadjustment(), Gtk::" 35620"ORIENTATION_VERTICAL);" 35621 35622#. (itstool) path: page/media 35623#. This is a reference to an external file such as an image or video. When 35624#. the file changes, the md5 hash will change to let you know you need to 35625#. update your localized copy. The msgstr is not used at all. Set it to 35626#. whatever you like once you have updated your copy of the file. 35627#: C/textview.js.page:26 35628msgctxt "_" 35629msgid "" 35630"external ref='media/textviewpenguinchat.png' " 35631"md5='0dd6f6aa44aaeab7901bd90162ed4c9a'" 35632msgstr "" 35633"external ref='media/textviewpenguinchat.png' " 35634"md5='0dd6f6aa44aaeab7901bd90162ed4c9a'" 35635 35636#. (itstool) path: page/p 35637#: C/textview.js.page:27 35638msgid "" 35639"A TextView is really (or at least usually) a nested set of three objects." 35640msgstr "" 35641 35642#. (itstool) path: item/p 35643#: C/textview.js.page:29 35644msgid "" 35645"At the bottom there is a <link href=\"http://www.roojs.org/seed/gir-1.2-" 35646"gtk-3.0/gjs/Gtk.TextBuffer.html\">TextBuffer</link>. This holds the text " 35647"itself." 35648msgstr "" 35649 35650#. (itstool) path: item/p 35651#: C/textview.js.page:30 35652msgid "" 35653"In the middle there is the <link href=\"http://www.roojs.org/seed/gir-1.2-" 35654"gtk-3.0/gjs/Gtk.TextView.html\">TextView</link>, which is a widget that lets " 35655"you see and edit the text in the buffer. It automatically resizes itself " 35656"depending on how much text there is." 35657msgstr "" 35658 35659#. (itstool) path: item/p 35660#: C/textview.js.page:31 35661msgid "" 35662"Since the automatic resizing can make a TextView unwieldy, you normally " 35663"place it inside of a ScrolledWindow. Despite the name, it's not an actual " 35664"window in terms of having a title bar and an X button; it's a widget you put " 35665"on the application you're making, which acts like a window onto a more " 35666"manageable chunk of a TextView. If the text in the buffer is too big to fit, " 35667"scrollbars will appear." 35668msgstr "" 35669 35670#. (itstool) path: page/p 35671#: C/textview.js.page:33 35672msgid "" 35673"If you want to change what text is displayed in the TextView, you act on the " 35674"TextBuffer, since it's what actually holds the text. The same goes for if " 35675"you want to see what text someone typed in. This sample application lets you " 35676"talk to a (make-believe) penguin, and checks the TextBuffer to see if you " 35677"typed the word \"fish\" anywhere in it." 35678msgstr "" 35679 35680#. (itstool) path: note/p 35681#: C/textview.js.page:34 35682msgid "" 35683"Real-life penguin populations are declining fast, because climate change is " 35684"melting the ice that they live on and killing the fish that they eat. If " 35685"you'd like to play a (somewhat silly) GNOME game based on this premise, take " 35686"a look at <link href=\"http://pingus.seul.org/\">Pingus</link>." 35687msgstr "" 35688 35689#. (itstool) path: section/code 35690#: C/textview.js.page:50 35691#, no-wrap 35692msgid "" 35693"\n" 35694"const TextViewExample = new Lang.Class ({\n" 35695" Name: 'TextView Example',\n" 35696"\n" 35697" // Create the application itself\n" 35698" _init: function () {\n" 35699" this.application = new Gtk.Application ({\n" 35700" application_id: 'org.example.jstextview' });\n" 35701"\n" 35702" // Connect 'activate' and 'startup' signals to the callback functions\n" 35703" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 35704" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 35705" },\n" 35706"\n" 35707" // Callback function for 'activate' signal presents windows when active\n" 35708" _onActivate: function () {\n" 35709" this._window.present ();\n" 35710" },\n" 35711"\n" 35712" // Callback function for 'startup' signal builds the UI\n" 35713" _onStartup: function () {\n" 35714" this._buildUI ();\n" 35715" },\n" 35716msgstr "" 35717 35718#. (itstool) path: section/p 35719#: C/textview.js.page:74 35720msgid "" 35721"All the code for this sample goes in the TextViewExample class. The above " 35722"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 35723"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 35724"go in." 35725msgstr "" 35726 35727#. (itstool) path: section/code 35728#: C/textview.js.page:75 35729#, no-wrap 35730msgid "" 35731"\n" 35732" // Build the application's UI\n" 35733" _buildUI: function () {\n" 35734"\n" 35735" // Create the application window\n" 35736" this._window = new Gtk.ApplicationWindow ({\n" 35737" application: this.application,\n" 35738" window_position: Gtk.WindowPosition.CENTER,\n" 35739" title: \"Talk to a Penguin\",\n" 35740" default_height: 400,\n" 35741" default_width: 440,\n" 35742" border_width: 20 });\n" 35743msgstr "" 35744 35745#. (itstool) path: section/title 35746#: C/textview.js.page:92 35747#, fuzzy 35748msgid "Creating the TextView" 35749msgstr "Criando um evento" 35750 35751#. (itstool) path: section/code 35752#: C/textview.js.page:93 35753#, no-wrap 35754msgid "" 35755"\n" 35756" // Create a label for the penguin to talk to you\n" 35757" this._penguin = new Gtk.Label ({\n" 35758" height_request: 180,\n" 35759" width_request: 400,\n" 35760" label: \"Squaaaak?\",\n" 35761" wrap: true });\n" 35762msgstr "" 35763 35764#. (itstool) path: section/p 35765#: C/textview.js.page:102 35766msgid "" 35767"Our first step in this example is to create the <link xref=\"label.js" 35768"\">Label</link> that the penguin will use to talk to you. We set the text in " 35769"it to wrap by setting its wrap property to true, but we'll use a different " 35770"method on the TextView itself that allows for more fine-grained control." 35771msgstr "" 35772 35773#. (itstool) path: section/code 35774#: C/textview.js.page:104 35775#, no-wrap 35776msgid "" 35777"\n" 35778" // Create a textview for you to talk to the penguin\n" 35779" this.buffer = new Gtk.TextBuffer();\n" 35780" this._textView = new Gtk.TextView ({\n" 35781" buffer: this.buffer,\n" 35782" editable: true,\n" 35783" wrap_mode: Gtk.WrapMode.WORD });\n" 35784msgstr "" 35785 35786#. (itstool) path: section/p 35787#: C/textview.js.page:113 35788msgid "" 35789"Our first step is to create a TextBuffer to put the words into. After that " 35790"we create the TextView, and tell it to use the TextBuffer we created as its " 35791"buffer. We also set it to be editable, since we want to be able to type new " 35792"things in." 35793msgstr "" 35794 35795#. (itstool) path: section/p 35796#: C/textview.js.page:114 35797msgid "" 35798"The wrap_mode property lets you select from four different <link href=" 35799"\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.WrapMode.html" 35800"\">WrapModes</link>. Gtk.WrapMode.CHAR, for instance, starts wrapping around " 35801"in the middle of a word if you keep typing when it gets to the edge. Most " 35802"people are probably used to Gtk.WrapMode.WORD, which will automatically put " 35803"the word you're typing on the next line if it gets to be too long." 35804msgstr "" 35805 35806#. (itstool) path: section/code 35807#: C/textview.js.page:116 35808#, no-wrap 35809msgid "" 35810"\n" 35811" // Create a \"scrolled window\" to put your textview in so it will scroll\n" 35812" this._scrolled = new Gtk.ScrolledWindow ({\n" 35813" hscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n" 35814" vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n" 35815" shadow_type: Gtk.ShadowType.ETCHED_IN,\n" 35816" height_request: 180,\n" 35817" width_request: 400, });\n" 35818"\n" 35819" // Put the textview into the scrolled window\n" 35820" this._scrolled.add_with_viewport (this._textView);\n" 35821msgstr "" 35822 35823#. (itstool) path: section/p 35824#: C/textview.js.page:128 35825msgid "" 35826"Here we create a ScrolledWindow, and set it to automatically scroll if it " 35827"gets to be too big horizontally or vertically. We also give it a nice-" 35828"looking ETCHED_IN border. After that, we put our TextView inside, and tell " 35829"the ScrolledWindow to give us a viewport onto it." 35830msgstr "" 35831 35832#. (itstool) path: section/code 35833#: C/textview.js.page:134 35834#, no-wrap 35835msgid "" 35836"\n" 35837" // Create a grid to organize them in\n" 35838" this._grid = new Gtk.Grid ({\n" 35839" halign: Gtk.Align.CENTER,\n" 35840" valign: Gtk.Align.CENTER });\n" 35841"\n" 35842" // Put the label and textview in the grid one on top of the other\n" 35843" this._grid.attach (this._penguin, 0, 0, 1, 1);\n" 35844" this._grid.attach (this._scrolled, 0, 1, 1, 1);\n" 35845msgstr "" 35846 35847#. (itstool) path: section/p 35848#: C/textview.js.page:144 35849msgid "" 35850"The first <link xref=\"grid.js\">Grid</link> we create only has the Label " 35851"and the ScrolledWindow inside it." 35852msgstr "" 35853 35854#. (itstool) path: section/code 35855#: C/textview.js.page:146 35856#, no-wrap 35857msgid "" 35858"\n" 35859" // Create a button to send your message to the penguin\n" 35860" this._send = new Gtk.Button ({\n" 35861" halign: Gtk.Align.END,\n" 35862" margin_top: 20,\n" 35863" label: \"Send\" });\n" 35864" this._send.connect ('clicked', Lang.bind (this, this._chat));\n" 35865"\n" 35866" // Create a grid that will have the other grid on top and the button on bottom\n" 35867" this._mainGrid = new Gtk.Grid ({\n" 35868" halign: Gtk.Align.CENTER,\n" 35869" valign: Gtk.Align.CENTER });\n" 35870"\n" 35871" // Add the other grid and the button to the main grid\n" 35872" this._mainGrid.attach (this._grid, 0, 0, 1, 1);\n" 35873" this._mainGrid.attach (this._send, 0, 1, 1, 1);\n" 35874msgstr "" 35875 35876#. (itstool) path: section/p 35877#: C/textview.js.page:163 35878msgid "" 35879"We create a <link xref=\"button.js\">Button</link> to send your message to " 35880"the penguin, and a new Grid that has the other one on top and the Button on " 35881"the bottom. The Button has a margin on top, so that it isn't squished up " 35882"against the ScrolledWindow." 35883msgstr "" 35884 35885#. (itstool) path: section/code 35886#: C/textview.js.page:165 35887#, no-wrap 35888msgid "" 35889"\n" 35890" // Attach the main grid to the window\n" 35891" this._window.add (this._mainGrid);\n" 35892"\n" 35893" // Show the window and all child widgets\n" 35894" this._window.show_all();\n" 35895" },\n" 35896msgstr "" 35897 35898#. (itstool) path: section/p 35899#: C/textview.js.page:174 35900msgid "" 35901"Finally, we attach the main Grid to the window, then we tell the window and " 35902"everything inside it to become visible when the application is run." 35903msgstr "" 35904 35905#. (itstool) path: section/title 35906#: C/textview.js.page:179 35907msgid "Function which handles the penguin's response" 35908msgstr "" 35909 35910#. (itstool) path: section/code 35911#: C/textview.js.page:180 35912#, no-wrap 35913msgid "" 35914"\n" 35915" _chat: function () {\n" 35916"\n" 35917" // Create a random number to determine what the penguin says\n" 35918" this.number = Math.floor ((Math.random() * 3) + 1);\n" 35919"\n" 35920" // Did you actually say anything?\n" 35921" if (this.buffer.text) {\n" 35922"\n" 35923" // Did you mention fish?\n" 35924" if (this.buffer.text.match (/fish/gi)) {\n" 35925"\n" 35926" // Have the penguin squaak about fish\n" 35927" if (this.number == 1)\n" 35928" this._penguin.set_label (\"FISH!\");\n" 35929"\n" 35930" else if (this.number == 2)\n" 35931" this._penguin.set_label (\"Fish fish fish fish. Fish!\");\n" 35932"\n" 35933" else\n" 35934" this._penguin.set_label (\"Fish? Fish fish fish. Fish fish. FISH!\");\n" 35935"\n" 35936" }\n" 35937"\n" 35938" // I guess you didn't mention fish\n" 35939" else {\n" 35940"\n" 35941" // Have the penguin talk about penguinny stuff\n" 35942" if (this.number == 1)\n" 35943" this._penguin.set_label (\"SQUAAK!\");\n" 35944"\n" 35945" else if (this.number == 2)\n" 35946" this._penguin.set_label (\"Ork ork ork ork squaak. Squaak squaak! *waves flippers*\");\n" 35947"\n" 35948" else\n" 35949" this._penguin.set_label (\"Ork ork ork ork ork?\");\n" 35950"\n" 35951" }\n" 35952"\n" 35953" }\n" 35954"\n" 35955" // Clear the buffer\n" 35956" this.buffer.text = \"\";\n" 35957"\n" 35958" // Give focus back to the textview so you don't have to click it again\n" 35959" this._textView.has_focus = true;\n" 35960"\n" 35961" }\n" 35962"\n" 35963"});\n" 35964msgstr "" 35965 35966#. (itstool) path: section/p 35967#: C/textview.js.page:231 35968msgid "" 35969"Here we use some basic JavaScript functions to have the penguins say " 35970"something random. Penguins like fish, though, so if you mention fish we want " 35971"the penguin to respond to that. To do that, we use the JavaScript String " 35972"object's match method on <file>this.buffer.text</file>, which returns the " 35973"contents of our TextBuffer." 35974msgstr "" 35975 35976#. (itstool) path: section/p 35977#: C/textview.js.page:232 35978msgid "" 35979"Since we want to clear out the TextBuffer after each time you click Send, we " 35980"set <file>this.buffer.text</file> to contain an empty string afterwards. " 35981"Then we return focus to our TextView, so that you can keep typing without " 35982"having to click on it beforehand." 35983msgstr "" 35984 35985#. (itstool) path: section/code 35986#: C/textview.js.page:234 35987#, fuzzy, no-wrap 35988msgid "" 35989"\n" 35990"// Run the application\n" 35991"let app = new TextViewExample ();\n" 35992"app.application.run (ARGV);\n" 35993msgstr "" 35994"\n" 35995"// Executa o aplicativo\n" 35996"let app = new GettingTheSignal ();\n" 35997"app.application.run (ARGV);\n" 35998 35999#. (itstool) path: section/p 36000#: C/textview.js.page:239 36001msgid "" 36002"Finally, we create a new instance of the finished TextViewExample class, and " 36003"set the application running." 36004msgstr "" 36005 36006#. (itstool) path: section/code 36007#: C/textview.js.page:244 36008#, no-wrap 36009msgid "" 36010"#!/usr/bin/gjs\n" 36011"\n" 36012"imports.gi.versions.Gtk = '3.0';\n" 36013"const Gtk = imports.gi.Gtk;\n" 36014"\n" 36015"class TextViewExample {\n" 36016"\n" 36017" // Create the application itself\n" 36018" constructor() {\n" 36019" this.application = new Gtk.Application({\n" 36020" application_id: 'org.example.jstextview'\n" 36021" });\n" 36022"\n" 36023" // Connect 'activate' and 'startup' signals to the callback functions\n" 36024" this.application.connect('activate', this._onActivate.bind(this));\n" 36025" this.application.connect('startup', this._onStartup.bind(this));\n" 36026" }\n" 36027"\n" 36028" // Callback function for 'activate' signal presents windows when active\n" 36029" _onActivate() {\n" 36030" this._window.present();\n" 36031" }\n" 36032"\n" 36033" // Callback function for 'startup' signal builds the UI\n" 36034" _onStartup() {\n" 36035" this._buildUI();\n" 36036" }\n" 36037"\n" 36038" // Build the application's UI\n" 36039" _buildUI() {\n" 36040"\n" 36041" // Create the application window\n" 36042" this._window = new Gtk.ApplicationWindow ({\n" 36043" application: this.application,\n" 36044" window_position: Gtk.WindowPosition.CENTER,\n" 36045" title: \"Talk to a Penguin\",\n" 36046" default_height: 400,\n" 36047" default_width: 440,\n" 36048" border_width: 20 });\n" 36049"\n" 36050" // Create a label for the penguin to talk to you\n" 36051" this._penguin = new Gtk.Label ({\n" 36052" height_request: 180,\n" 36053" width_request: 400,\n" 36054" label: \"Squaaaak?\",\n" 36055" wrap: true });\n" 36056"\n" 36057" // Create a textview for you to talk to the penguin\n" 36058" this.buffer = new Gtk.TextBuffer();\n" 36059" this._textView = new Gtk.TextView ({\n" 36060" buffer: this.buffer,\n" 36061" editable: true,\n" 36062" wrap_mode: Gtk.WrapMode.WORD });\n" 36063"\n" 36064" // Create a \"scrolled window\" to put your textview in so it will scroll\n" 36065" this._scrolled = new Gtk.ScrolledWindow ({\n" 36066" hscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n" 36067" vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,\n" 36068" shadow_type: Gtk.ShadowType.ETCHED_IN,\n" 36069" height_request: 180,\n" 36070" width_request: 400, });\n" 36071"\n" 36072" // Put the textview into the scrolled window\n" 36073" this._scrolled.add_with_viewport (this._textView);\n" 36074"\n" 36075" // Create a grid to organize them in\n" 36076" this._grid = new Gtk.Grid ({\n" 36077" halign: Gtk.Align.CENTER,\n" 36078" valign: Gtk.Align.CENTER });\n" 36079"\n" 36080" // Put the label and textview in the grid one on top of the other\n" 36081" this._grid.attach (this._penguin, 0, 0, 1, 1);\n" 36082" this._grid.attach (this._scrolled, 0, 1, 1, 1);\n" 36083"\n" 36084" // Create a button to send your message to the penguin\n" 36085" this._send = new Gtk.Button ({\n" 36086" halign: Gtk.Align.END,\n" 36087" margin_top: 20,\n" 36088" label: \"Send\" });\n" 36089" this._send.connect ('clicked', this._chat.bind(this));\n" 36090"\n" 36091" // Create a grid that will have the other grid on top and the button on bottom\n" 36092" this._mainGrid = new Gtk.Grid ({\n" 36093" halign: Gtk.Align.CENTER,\n" 36094" valign: Gtk.Align.CENTER });\n" 36095"\n" 36096" // Add the other grid and the button to the main grid\n" 36097" this._mainGrid.attach (this._grid, 0, 0, 1, 1);\n" 36098" this._mainGrid.attach (this._send, 0, 1, 1, 1);\n" 36099"\n" 36100" // Attach the main grid to the window\n" 36101" this._window.add (this._mainGrid);\n" 36102"\n" 36103" // Show the window and all child widgets\n" 36104" this._window.show_all();\n" 36105" }\n" 36106"\n" 36107" _chat() {\n" 36108"\n" 36109" // Create a random number to determine what the penguin says\n" 36110" this.number = Math.floor ((Math.random() * 3) + 1);\n" 36111"\n" 36112" // Did you actually say anything?\n" 36113" if (this.buffer.text) {\n" 36114"\n" 36115" // Did you mention fish?\n" 36116" if (this.buffer.text.match (/fish/gi)) {\n" 36117"\n" 36118" // Have the penguin squaak about fish\n" 36119" if (this.number == 1)\n" 36120" this._penguin.set_label (\"FISH!\");\n" 36121"\n" 36122" else if (this.number == 2)\n" 36123" this._penguin.set_label (\"Fish fish fish fish. Fish!\");\n" 36124"\n" 36125" else\n" 36126" this._penguin.set_label (\"Fish? Fish fish fish. Fish fish. FISH!\");\n" 36127"\n" 36128" }\n" 36129"\n" 36130" // I guess you didn't mention fish\n" 36131" else {\n" 36132"\n" 36133" // Have the penguin talk about penguinny stuff\n" 36134" if (this.number == 1)\n" 36135" this._penguin.set_label (\"SQUAAK!\");\n" 36136"\n" 36137" else if (this.number == 2)\n" 36138" this._penguin.set_label (\"Ork ork ork ork squaak. Squaak squaak! *waves flippers*\");\n" 36139"\n" 36140" else\n" 36141" this._penguin.set_label (\"Ork ork ork ork ork?\");\n" 36142"\n" 36143" }\n" 36144"\n" 36145" }\n" 36146"\n" 36147" // Clear the buffer\n" 36148" this.buffer.text = \"\";\n" 36149"\n" 36150" // Give focus back to the textview so you don't have to click it again\n" 36151" this._textView.has_focus = true;\n" 36152" }\n" 36153"};\n" 36154"\n" 36155"// Run the application\n" 36156"let app = new TextViewExample ();\n" 36157"app.application.run (ARGV);\n" 36158msgstr "" 36159 36160#. (itstool) path: item/p 36161#: C/textview.js.page:256 36162msgid "" 36163"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk." 36164"ScrolledWindow.html\">Gtk.ScrolledWindow</link>" 36165msgstr "" 36166 36167#. (itstool) path: item/p 36168#: C/textview.js.page:257 36169msgid "" 36170"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.TextBuffer." 36171"html\">Gtk.TextBuffer</link>" 36172msgstr "" 36173 36174#. (itstool) path: item/p 36175#: C/textview.js.page:258 36176msgid "" 36177"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.TextView.html" 36178"\">Gtk.TextView</link>" 36179msgstr "" 36180 36181#. (itstool) path: info/title 36182#: C/textview.py.page:8 36183#, fuzzy 36184msgctxt "text" 36185msgid "TextView (Python)" 36186msgstr "_Python" 36187 36188#. (itstool) path: info/desc 36189#: C/textview.py.page:27 36190#, fuzzy 36191msgid "Widget that displays a GtkTextBuffer" 36192msgstr "Monitores" 36193 36194#. (itstool) path: note/p 36195#: C/textview.py.page:32 36196#, fuzzy 36197msgid "This is an example of Gtk.TextView." 36198msgstr "Por exemplo:" 36199 36200#. (itstool) path: note/p 36201#: C/textview.py.page:34 36202msgid "" 36203"But we can also have a new line if we write a long sentence (the text will " 36204"wrap breaking lines between words)." 36205msgstr "" 36206 36207#. (itstool) path: note/p 36208#: C/textview.py.page:35 36209#, fuzzy 36210msgid "If we have a loooooooooooooooooooooooooooooooooooong" 36211msgstr "Nós temos um disco válido!\n" 36212 36213#. (itstool) path: note/p 36214#: C/textview.py.page:36 36215#, fuzzy 36216msgid "(that was long)" 36217msgstr "LONG" 36218 36219#. (itstool) path: note/p 36220#: C/textview.py.page:37 36221#, fuzzy 36222msgid "word, an horizontal scrollbar will appear." 36223msgstr "Política da barra de rolagem horizontal" 36224 36225#. (itstool) path: section/code 36226#: C/textview.py.page:46 36227#, no-wrap 36228msgid "" 36229"from gi.repository import Gtk\n" 36230"import sys\n" 36231"\n" 36232"\n" 36233"class MyWindow(Gtk.ApplicationWindow):\n" 36234"\n" 36235" def __init__(self, app):\n" 36236" Gtk.Window.__init__(self, title=\"TextView Example\", application=app)\n" 36237" self.set_default_size(300, 450)\n" 36238"\n" 36239" # a scrollbar for the child widget (that is going to be the textview)\n" 36240" scrolled_window = Gtk.ScrolledWindow()\n" 36241" scrolled_window.set_border_width(5)\n" 36242" # we scroll only if needed\n" 36243" scrolled_window.set_policy(\n" 36244" Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n" 36245"\n" 36246" # a text buffer (stores text)\n" 36247" buffer1 = Gtk.TextBuffer()\n" 36248"\n" 36249" # a textview (displays the buffer)\n" 36250" textview = Gtk.TextView(buffer=buffer1)\n" 36251" # wrap the text, if needed, breaking lines in between words\n" 36252" textview.set_wrap_mode(Gtk.WrapMode.WORD)\n" 36253"\n" 36254" # textview is scrolled\n" 36255" scrolled_window.add(textview)\n" 36256"\n" 36257" self.add(scrolled_window)\n" 36258"\n" 36259"\n" 36260"class MyApplication(Gtk.Application):\n" 36261"\n" 36262" def __init__(self):\n" 36263" Gtk.Application.__init__(self)\n" 36264"\n" 36265" def do_activate(self):\n" 36266" win = MyWindow(self)\n" 36267" win.show_all()\n" 36268"\n" 36269" def do_startup(self):\n" 36270" Gtk.Application.do_startup(self)\n" 36271"\n" 36272"app = MyApplication()\n" 36273"exit_status = app.run(sys.argv)\n" 36274"sys.exit(exit_status)\n" 36275msgstr "" 36276 36277#. (itstool) path: section/title 36278#: C/textview.py.page:50 36279#, fuzzy 36280msgid "Useful methods for a TextView widget" 36281msgstr "Métodos úteis" 36282 36283#. (itstool) path: section/p 36284#: C/textview.py.page:51 36285msgid "" 36286"A <code>Gtk.TextView</code> displays the text stored in a <code>Gtk." 36287"TextBuffer</code>. However, most text manipulation is accomplished with " 36288"iterators, represented by a <code>Gtk.TextIter</code> - a position between " 36289"two characters in the text buffer. Iterators are not valid indefinitely; " 36290"whenever the buffer is modified in a way that affects the contents of the " 36291"buffer, all outstanding iterators become invalid. Because of this, iterators " 36292"can’t be used to preserve positions across buffer modifications. To preserve " 36293"a position, we use a <code>Gtk.TextMark</code>, that can be set visible with " 36294"<code>visible(True)</code>. A text buffer contains two built-in marks; an " 36295"\"insert\" mark (the position of the cursor) and the \"selection_bound\" " 36296"mark." 36297msgstr "" 36298 36299#. (itstool) path: section/p 36300#: C/textview.py.page:52 36301#, fuzzy 36302msgid "Methods for a TextView widget:" 36303msgstr "Widget:" 36304 36305#. (itstool) path: item/p 36306#: C/textview.py.page:54 36307msgid "" 36308"The TextView widget is by default editable. If you prefer otherwise, use " 36309"<code>set_editable(False)</code>. If the buffer has no editable text, it " 36310"might be a good idea to use <code>set_cursor_visible(False)</code> as well." 36311msgstr "" 36312 36313#. (itstool) path: item/p 36314#: C/textview.py.page:55 36315msgid "" 36316"The justification of the text is set with <code>set_justification(Gtk." 36317"Justification.JUSTIFICATION)</code> where <code>JUSTIFICATION</code> is one " 36318"of <code>LEFT, RIGHT, CENTER, FILL</code>." 36319msgstr "" 36320 36321#. (itstool) path: item/p 36322#: C/textview.py.page:56 36323msgid "" 36324"The line wrapping of the text is set with <code>set_wrap_mode(Gtk.WrapMode." 36325"WRAP)</code> where <code>WRAP</code> is one of <code>NONE</code> (the text " 36326"area is made wider), <code>CHAR</code> (break lines anywhere the cursor can " 36327"appear), <code>WORD</code> (break lines between words), <code>WORD_CHAR</" 36328"code> (break lines between words, but if that is not enough between " 36329"characters)." 36330msgstr "" 36331 36332#. (itstool) path: section/p 36333#: C/textview.py.page:58 36334#, fuzzy 36335msgid "Methods for a TextBuffer widget:" 36336msgstr "Widget:" 36337 36338#. (itstool) path: item/p 36339#: C/textview.py.page:60 36340msgid "" 36341"<code>get_insert()</code> returns the <code>Gtk.TextMark</code> that " 36342"represents the cursor, that is the insertion point." 36343msgstr "" 36344 36345#. (itstool) path: item/p 36346#: C/textview.py.page:61 36347msgid "" 36348"<code>get_selection_bound()</code> returns the <code>Gtk.TextMark</code> " 36349"that represents the selection bound." 36350msgstr "" 36351 36352#. (itstool) path: item/p 36353#: C/textview.py.page:62 36354msgid "" 36355"<code>set_text(\"some text\", length)</code> where <code>length</code> is a " 36356"positive integer or <code>-1</code>, sets the content of the buffer as the " 36357"first <code>length</code> characters of the <code>\"some text\"</code> text. " 36358"If <code>length</code> is omitted or <code>-1</code>, the text is inserted " 36359"completely. The content of the buffer, if there is any, is destroyed." 36360msgstr "" 36361 36362#. (itstool) path: item/p 36363#: C/textview.py.page:63 36364msgid "" 36365"<code>insert(iter, \"some text\", length)</code> where <code>iter</code> is " 36366"a text iterator and <code>length</code> is a positive integer or <code>-1</" 36367"code>, inserts in the buffer at <code>iter</code> the first <code>length</" 36368"code> characters of the <code>\"some text\"</code> text. If <code>length</" 36369"code> is omitted or <code>-1</code>, the text is inserted completely." 36370msgstr "" 36371 36372#. (itstool) path: item/p 36373#: C/textview.py.page:64 36374msgid "" 36375"<code>insert_at_cursor(\"some text\", length)</code> does the same as " 36376"<code>insert(iter, \"some text\", length)</code>, with the current cursor " 36377"taken as <code>iter</code>." 36378msgstr "" 36379 36380#. (itstool) path: item/p 36381#: C/textview.py.page:65 36382msgid "" 36383"<code>create_mark(\"mark_name\", iter, left_gravity)</code> where " 36384"<code>iter</code> is a <code>Gtk.TextIter</code> and <code>left_gravity</" 36385"code> is a boolean, creates a <code>Gtk.TextMark</code> at the position of " 36386"<code>iter</code>. If <code>\"mark_name\"</code> is <code>None</code>, the " 36387"mark is anonymous; otherwise, the mark can be retrieved by name using " 36388"<code>get_mark()</code>. If a mark has left gravity, and text is inserted at " 36389"the mark’s current location, the mark will be moved to the left of the newly-" 36390"inserted text. If <code>left_gravity</code> is omitted, it defaults to " 36391"<code>False</code>." 36392msgstr "" 36393 36394#. (itstool) path: item/p 36395#: C/textview.py.page:67 36396msgid "" 36397"To specify that some text in the buffer should have specific formatting, you " 36398"must define a tag to hold that formatting information, and then apply that " 36399"tag to the region of text using <code>create_tag(\"tag name\", property)</" 36400"code> and <code>apply_tag(tag, start_iter, end_iter)</code> as in, for " 36401"instance:" 36402msgstr "" 36403 36404#. (itstool) path: item/code 36405#: C/textview.py.page:68 36406#, no-wrap 36407msgid "" 36408"\n" 36409"tag = textbuffer.create_tag(\"orange_bg\", background=\"orange\")\n" 36410"textbuffer.apply_tag(tag, start_iter, end_iter)" 36411msgstr "" 36412 36413#. (itstool) path: item/p 36414#: C/textview.py.page:71 36415msgid "The following are some of the common styles applied to text:" 36416msgstr "" 36417 36418#. (itstool) path: item/p 36419#: C/textview.py.page:73 36420#, fuzzy 36421msgid "Background colour (\"background\" property)" 36422msgstr "Clique para modificar a cor de fundo do relógio" 36423 36424#. (itstool) path: item/p 36425#: C/textview.py.page:74 36426#, fuzzy 36427msgid "Foreground colour (\"foreground\" property)" 36428msgstr "Clique para modificar a cor do relógio" 36429 36430#. (itstool) path: item/p 36431#: C/textview.py.page:75 36432#, fuzzy 36433msgid "Underline (\"underline\" property)" 36434msgstr "Sublinhado – \\underline" 36435 36436#. (itstool) path: item/p 36437#: C/textview.py.page:76 36438#, fuzzy 36439msgid "Bold (\"weight\" property)" 36440msgstr "<span weight=\"bold\">Objetivo Procurado</span>" 36441 36442#. (itstool) path: item/p 36443#: C/textview.py.page:77 36444#, fuzzy 36445msgid "Italics (\"style\" property)" 36446msgstr "Itálico" 36447 36448#. (itstool) path: item/p 36449#: C/textview.py.page:78 36450#, fuzzy 36451msgid "Strikethrough (\"strikethrough\" property)" 36452msgstr "_Tachar" 36453 36454#. (itstool) path: item/p 36455#: C/textview.py.page:79 36456#, fuzzy 36457msgid "Justification (\"justification\" property)" 36458msgstr "sem justificação" 36459 36460#. (itstool) path: item/p 36461#: C/textview.py.page:80 36462#, fuzzy 36463msgid "Size (\"size\" and \"size-points\" properties)" 36464msgstr "O tamanho do marcador em pontos" 36465 36466#. (itstool) path: item/p 36467#: C/textview.py.page:81 36468msgid "Text wrapping (\"wrap-mode\" property)" 36469msgstr "" 36470 36471#. (itstool) path: item/p 36472#: C/textview.py.page:83 36473msgid "" 36474"You can also delete particular tags later using <code>remove_tag()</code> or " 36475"delete all tags in a given region by calling <code>remove_all_tags()</code>." 36476msgstr "" 36477 36478#. (itstool) path: section/p 36479#: C/textview.py.page:85 36480#, fuzzy 36481msgid "Methods for a TextIter widget" 36482msgstr "Widget:" 36483 36484#. (itstool) path: item/p 36485#: C/textview.py.page:87 36486msgid "" 36487"<code>forward_search(needle, flags, limit)</code> searches forward for " 36488"<code>needle</code>. The search will not continue past the <code>Gtk." 36489"TextIter</code> limit. The <code>flags</code> can be set to one of the " 36490"following, or any combination of it by concatenating them with the bitwise-" 36491"OR operator <code>|</code>: <code>0</code> (the match must be exact); " 36492"<code>Gtk.TextSearchFlags.VISIBLE_ONLY</code> (the match may have invisible " 36493"text interspersed in needle); <code>Gtk.TextSearchFlags.TEXT_ONLY</code> " 36494"(the match may have pixbufs or child widgets mixed inside the matched " 36495"range); <code>Gtk.TextSearchFlags.CASE_INSENSITIVE</code> (the text will be " 36496"matched regardless of what case it is in). The method returns a tuple " 36497"containing a <code>Gtk.TextIter</code> pointing to the start and to the " 36498"first character after the match; if no match is found, <code>None</code> is " 36499"returned." 36500msgstr "" 36501 36502#. (itstool) path: item/p 36503#: C/textview.py.page:88 36504msgid "" 36505"<code>backward_search(needle, flags, limit)</code> does the same as " 36506"<code>forward_search()</code>, but moving backwards." 36507msgstr "" 36508 36509#. (itstool) path: item/p 36510#: C/textview.py.page:96 36511msgid "" 36512"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTextView.html" 36513"\">GtkTextView</link>" 36514msgstr "" 36515 36516#. (itstool) path: item/p 36517#: C/textview.py.page:97 36518msgid "" 36519"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTextBuffer.html" 36520"\">GtkTextBuffer</link>" 36521msgstr "" 36522 36523#. (itstool) path: item/p 36524#: C/textview.py.page:98 36525msgid "" 36526"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTextTag.html" 36527"\">GtkTextTag</link>" 36528msgstr "" 36529 36530#. (itstool) path: info/title 36531#: C/textview.vala.page:8 36532#, fuzzy 36533msgctxt "text" 36534msgid "TextView (Vala)" 36535msgstr "_Vala" 36536 36537#. (itstool) path: note/p 36538#: C/textview.vala.page:25 36539msgid "" 36540"If we have a loooooooooooooooooooooooooooooooooooong word, a horizontal " 36541"scrollbar will appear." 36542msgstr "" 36543 36544#. (itstool) path: page/code 36545#: C/textview.vala.page:30 36546#, no-wrap 36547msgid "" 36548"/* This is the application. */\n" 36549"public class MyApplication : Gtk.Application {\n" 36550"\t/* Override the 'activate' signal of GLib.Application. */\n" 36551"\tprotected override void activate () {\n" 36552"\t\t/* Create the window of this application. */\n" 36553"\t\tnew MyWindow (this).show_all ();\n" 36554"\t}\n" 36555"}\n" 36556"\n" 36557"/* This is the window. */\n" 36558"class MyWindow: Gtk.ApplicationWindow {\n" 36559"\tinternal MyWindow (MyApplication app) {\n" 36560"\t\tObject (application: app, title: \"TextView Example\");\n" 36561"\t\tthis.set_default_size (220, 200);\n" 36562"\n" 36563"\t\tvar buffer = new Gtk.TextBuffer (null); //stores text to be displayed\n" 36564"\t\tvar textview = new Gtk.TextView.with_buffer (buffer); //displays TextBuffer\n" 36565"\t\ttextview.set_wrap_mode (Gtk.WrapMode.WORD); //sets line wrapping\n" 36566"\n" 36567"\t\tvar scrolled_window = new Gtk.ScrolledWindow (null, null);\n" 36568"\t\tscrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC,\n" 36569"\t\t Gtk.PolicyType.AUTOMATIC);\n" 36570"\n" 36571"\t\tscrolled_window.add (textview);\n" 36572"\t\tscrolled_window.set_border_width (5);\n" 36573"\n" 36574"\t\tthis.add (scrolled_window);\n" 36575"\t}\n" 36576"}\n" 36577"/* main creates and runs the application. */\n" 36578"public int main (string[] args) {\n" 36579"\treturn new MyApplication ().run (args);\n" 36580"}\n" 36581msgstr "" 36582 36583#. (itstool) path: item/p 36584#: C/textview.vala.page:35 36585msgid "" 36586"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.TextBuffer.html\">Gtk." 36587"TextBuffer</link>" 36588msgstr "" 36589 36590#. (itstool) path: item/p 36591#: C/textview.vala.page:36 36592msgid "" 36593"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.TextView.html\">Gtk." 36594"TextView</link>" 36595msgstr "" 36596 36597#. (itstool) path: item/p 36598#: C/textview.vala.page:38 36599msgid "" 36600"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.WrapMode.html\">Gtk." 36601"WrapMode</link>" 36602msgstr "" 36603 36604#. (itstool) path: info/title 36605#: C/togglebutton.c.page:8 36606#, fuzzy 36607msgctxt "text" 36608msgid "ToggleButton (C)" 36609msgstr "Botão de alternância" 36610 36611#. (itstool) path: info/desc 36612#: C/togglebutton.c.page:22 C/togglebutton.py.page:19 36613#: C/togglebutton.vala.page:21 36614#, fuzzy 36615msgid "A button which retains state" 36616msgstr "Estado “%s” desconhecido para o botão" 36617 36618#. (itstool) path: page/title 36619#: C/togglebutton.c.page:25 C/togglebutton.js.page:21 C/togglebutton.py.page:22 36620#: C/togglebutton.vala.page:24 36621#, fuzzy 36622msgid "ToggleButton" 36623msgstr "Botão de alternância" 36624 36625#. (itstool) path: page/media 36626#. This is a reference to an external file such as an image or video. When 36627#. the file changes, the md5 hash will change to let you know you need to 36628#. update your localized copy. The msgstr is not used at all. Set it to 36629#. whatever you like once you have updated your copy of the file. 36630#: C/togglebutton.c.page:27 C/togglebutton.js.page:22 C/togglebutton.py.page:23 36631#: C/togglebutton.vala.page:25 36632msgctxt "_" 36633msgid "" 36634"external ref='media/togglebutton.png' md5='791e062613d4f9bd5936390b0aa18448'" 36635msgstr "" 36636"external ref='media/togglebutton.png' md5='791e062613d4f9bd5936390b0aa18448'" 36637 36638#. (itstool) path: page/p 36639#: C/togglebutton.c.page:28 C/togglebutton.py.page:24 36640#: C/togglebutton.vala.page:26 36641msgid "When this ToggleButton is in an active state, the spinner spins." 36642msgstr "" 36643 36644#. (itstool) path: page/code 36645#: C/togglebutton.c.page:30 36646#, no-wrap 36647msgid "" 36648"\n" 36649"#include <gtk/gtk.h>\n" 36650"\n" 36651"\n" 36652"\n" 36653"/*This is the callback function. It is a handler function \n" 36654"which reacts to the signal. In this case, it will cause the \n" 36655"spinner to start and stop according to how many times the user \n" 36656"presses the button.*/\n" 36657"static void\n" 36658"button_toggled_cb (GtkWidget *button,\n" 36659" gpointer user_data)\n" 36660"{\n" 36661" GtkWidget *spinner = user_data;\n" 36662"\n" 36663" if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button)))\n" 36664" gtk_spinner_start (GTK_SPINNER (spinner));\n" 36665" else {\n" 36666" gtk_spinner_stop (GTK_SPINNER (spinner));\n" 36667" }\n" 36668"}\n" 36669"\n" 36670"\n" 36671"\n" 36672"static void\n" 36673"activate (GtkApplication *app,\n" 36674" gpointer user_data)\n" 36675"{\n" 36676" GtkWidget *window;\n" 36677" GtkWidget *button;\n" 36678" GtkWidget *grid;\n" 36679" GtkWidget *spinner;\n" 36680"\n" 36681" /*Create a window with a title, border width and a default size*/\n" 36682" window = gtk_application_window_new (app);\n" 36683" gtk_window_set_title (GTK_WINDOW (window), \"ToggleButton Example\");\n" 36684" gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);\n" 36685" gtk_container_set_border_width(GTK_CONTAINER(window), 30);\n" 36686"\n" 36687" /*Create a togglebutton with a label*/\n" 36688" button = gtk_toggle_button_new_with_label (\"Start/Stop\");\n" 36689"\n" 36690" /*Create a spinner, with extra horizontal and vertical space*/\n" 36691" spinner = gtk_spinner_new ();\n" 36692" gtk_widget_set_hexpand (spinner, TRUE);\n" 36693" gtk_widget_set_vexpand (spinner, TRUE);\n" 36694"\n" 36695" /*Create a grid and set the row spacing, attach the togglebutton \n" 36696" and spinner onto the grid and position them accordingly*/\n" 36697" grid = gtk_grid_new();\n" 36698" gtk_grid_set_row_homogeneous (GTK_GRID (grid), FALSE);\n" 36699" gtk_grid_set_row_spacing (GTK_GRID (grid), 15);\n" 36700" gtk_grid_attach (GTK_GRID (grid), spinner, 0, 0, 1, 1);\n" 36701" gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 1, 1);\n" 36702" \n" 36703" gtk_container_add (GTK_CONTAINER (window), grid);\n" 36704"\n" 36705" /*Connecting the toggled signal to the callback*/\n" 36706" g_signal_connect (GTK_TOGGLE_BUTTON (button), \"toggled\", \n" 36707" G_CALLBACK (button_toggled_cb), spinner);\n" 36708"\n" 36709" gtk_widget_show_all (window);\n" 36710"}\n" 36711"\n" 36712"\n" 36713"\n" 36714"int\n" 36715"main (int argc, char **argv)\n" 36716"{\n" 36717" GtkApplication *app;\n" 36718" int status;\n" 36719"\n" 36720" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 36721" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 36722" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 36723" g_object_unref (app);\n" 36724"\n" 36725" return status;\n" 36726"}\n" 36727msgstr "" 36728 36729#. (itstool) path: item/p 36730#: C/togglebutton.c.page:39 36731#, fuzzy 36732msgid "" 36733"<link href=\"http://developer.gnome.org/gtk3/stable/GtkToggleButton.html" 36734"\">GtkTogglebutton</link>" 36735msgstr "" 36736"<link href=\"https://developer.gnome.org/gtk3/stable/GtkToggleButton.html" 36737"\">GtkToggleButton</link>" 36738 36739#. (itstool) path: info/title 36740#: C/togglebutton.js.page:8 36741#, fuzzy 36742msgctxt "text" 36743msgid "ToggleButton (JavaScript)" 36744msgstr "Botão de alternância" 36745 36746#. (itstool) path: info/desc 36747#: C/togglebutton.js.page:18 36748msgid "Stays pressed until you click it again" 36749msgstr "" 36750 36751#. (itstool) path: page/p 36752#: C/togglebutton.js.page:23 36753msgid "" 36754"A ToggleButton is like a normal <link xref=\"button.js\">Button</link>, " 36755"except that it stays pressed in when you click it. You can use it like an on/" 36756"off switch, to control things like the <link xref=\"spinner.js\">Spinner</" 36757"link> in this example." 36758msgstr "" 36759 36760#. (itstool) path: page/p 36761#: C/togglebutton.js.page:24 36762msgid "" 36763"A ToggleButton's get_active method returns true if it's pressed in, and " 36764"false if it's not. Its set_active method is used if you want to change its " 36765"state without needing to click on it. When it changes state from pressed in " 36766"to popped out and vice-versa, it sends out the \"toggled\" signal, which you " 36767"can connect to a function to do something." 36768msgstr "" 36769 36770#. (itstool) path: section/code 36771#: C/togglebutton.js.page:41 36772#, no-wrap 36773msgid "" 36774"\n" 36775"const ToggleButtonExample = new Lang.Class({\n" 36776" Name: 'ToggleButton Example',\n" 36777"\n" 36778" // Create the application itself\n" 36779" _init: function() {\n" 36780" this.application = new Gtk.Application({\n" 36781" application_id: 'org.example.jstogglebutton',\n" 36782" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 36783" });\n" 36784"\n" 36785" // Connect 'activate' and 'startup' signals to the callback functions\n" 36786" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 36787" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 36788" },\n" 36789"\n" 36790" // Callback function for 'activate' signal presents window when active\n" 36791" _onActivate: function() {\n" 36792" this._window.present();\n" 36793" },\n" 36794"\n" 36795" // Callback function for 'startup' signal builds the UI\n" 36796" _onStartup: function() {\n" 36797" this._buildUI ();\n" 36798" },\n" 36799msgstr "" 36800 36801#. (itstool) path: section/code 36802#: C/togglebutton.js.page:68 36803#, no-wrap 36804msgid "" 36805"\n" 36806" // Build the application's UI\n" 36807" _buildUI: function() {\n" 36808"\n" 36809" // Create the application window\n" 36810" this._window = new Gtk.ApplicationWindow({\n" 36811" application: this.application,\n" 36812" window_position: Gtk.WindowPosition.CENTER,\n" 36813" default_height: 300,\n" 36814" default_width: 300,\n" 36815" border_width: 30,\n" 36816" title: \"ToggleButton Example\"});\n" 36817msgstr "" 36818 36819#. (itstool) path: section/title 36820#: C/togglebutton.js.page:85 36821msgid "Creating the ToggleButton and other widgets" 36822msgstr "" 36823 36824#. (itstool) path: section/code 36825#: C/togglebutton.js.page:86 36826#, no-wrap 36827msgid "" 36828"\n" 36829" // Create the spinner that the button stops and starts\n" 36830" this._spinner = new Gtk.Spinner ({hexpand: true, vexpand: true});\n" 36831msgstr "" 36832 36833#. (itstool) path: section/p 36834#: C/togglebutton.js.page:91 36835msgid "" 36836"We want this <link xref=\"spinner.js\">Spinner</link> to expand vertically " 36837"and horizontally, to take up as much space as possible inside the window." 36838msgstr "" 36839 36840#. (itstool) path: section/code 36841#: C/togglebutton.js.page:93 36842#, no-wrap 36843msgid "" 36844"\n" 36845" // Create the togglebutton that starts and stops the spinner\n" 36846" this._toggleButton = new Gtk.ToggleButton ({label: \"Start/Stop\"});\n" 36847" this._toggleButton.connect ('toggled', Lang.bind (this, this._onToggle));\n" 36848msgstr "" 36849 36850#. (itstool) path: section/p 36851#: C/togglebutton.js.page:99 36852msgid "" 36853"Creating a ToggleButton is a lot like creating a normal <link xref=\"button." 36854"js\">Button</link>. The biggest difference is that you're handling a " 36855"\"toggled\" signal instead of a \"clicked\" signal. This code binds the " 36856"_onToggle function to that signal, so that it's called whenever our " 36857"ToggleButton is toggled." 36858msgstr "" 36859 36860#. (itstool) path: section/code 36861#: C/togglebutton.js.page:101 36862#, no-wrap 36863msgid "" 36864"\n" 36865" // Create a grid and put everything in it\n" 36866" this._grid = new Gtk.Grid ({\n" 36867" row_homogeneous: false,\n" 36868" row_spacing: 15});\n" 36869" this._grid.attach (this._spinner, 0, 0, 1, 1);\n" 36870" this._grid.attach (this._toggleButton, 0, 1, 1, 1);\n" 36871msgstr "" 36872 36873#. (itstool) path: section/p 36874#: C/togglebutton.js.page:109 36875msgid "" 36876"Here we create a simple <link xref=\"grid.js\">Grid</link> to organize " 36877"everything in, then attach the Spinner and ToggleButton to it." 36878msgstr "" 36879 36880#. (itstool) path: section/code 36881#: C/togglebutton.js.page:111 36882#, no-wrap 36883msgid "" 36884"\n" 36885" // Add the grid to the window\n" 36886" this._window.add (this._grid);\n" 36887"\n" 36888" // Show the window and all child widgets\n" 36889" this._window.show_all();\n" 36890" },\n" 36891msgstr "" 36892 36893#. (itstool) path: section/p 36894#: C/togglebutton.js.page:119 36895msgid "" 36896"Now we add the Grid to the Window, and tell the Window to show itself and " 36897"its child widgets when the application is started." 36898msgstr "" 36899 36900#. (itstool) path: section/title 36901#: C/togglebutton.js.page:123 36902msgid "Making something happen when the ToggleButton is toggled" 36903msgstr "" 36904 36905#. (itstool) path: section/code 36906#: C/togglebutton.js.page:125 36907#, no-wrap 36908msgid "" 36909"\n" 36910" _onToggle: function() {\n" 36911"\n" 36912" // Start or stop the spinner\n" 36913" if (this._toggleButton.get_active ())\n" 36914" this._spinner.start ();\n" 36915" else this._spinner.stop ();\n" 36916"\n" 36917" }\n" 36918"\n" 36919"});\n" 36920msgstr "" 36921 36922#. (itstool) path: section/p 36923#: C/togglebutton.js.page:137 36924msgid "" 36925"Whenever someone toggles the button, this function checks what its state is " 36926"afterwards using get_active and starts or stops the spinner accordingly. We " 36927"want it to spin only while the button is pressed in, so if get_active " 36928"returns true we start the spinner. Otherwise, we tell it to stop." 36929msgstr "" 36930 36931#. (itstool) path: section/code 36932#: C/togglebutton.js.page:139 36933#, fuzzy, no-wrap 36934msgid "" 36935"\n" 36936"// Run the application\n" 36937"let app = new ToggleButtonExample ();\n" 36938"app.application.run (ARGV);\n" 36939msgstr "" 36940"\n" 36941"// Executa o aplicativo\n" 36942"let app = new GettingTheSignal ();\n" 36943"app.application.run (ARGV);\n" 36944 36945#. (itstool) path: section/code 36946#: C/togglebutton.js.page:149 36947#, fuzzy, no-wrap 36948#| msgid "" 36949#| "#!/usr/bin/gjs\n" 36950#| "\n" 36951#| "const GLib = imports.gi.GLib;\n" 36952#| "const Gtk = imports.gi.Gtk;\n" 36953#| "const Lang = imports.lang;\n" 36954#| "const Webkit = imports.gi.WebKit;\n" 36955#| "\n" 36956#| "const HelloGNOME = new Lang.Class ({\n" 36957#| " Name: 'Hello GNOME',\n" 36958#| "\n" 36959#| " // Create the application itself\n" 36960#| " _init: function () {\n" 36961#| " this.application = new Gtk.Application ();\n" 36962#| "\n" 36963#| " // Connect 'activate' and 'startup' signals to the callback functions\n" 36964#| " this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 36965#| " this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 36966#| " },\n" 36967#| "\n" 36968#| " // Callback function for 'activate' signal presents windows when active\n" 36969#| " _onActivate: function () {\n" 36970#| " this._window.present ();\n" 36971#| " },\n" 36972#| "\n" 36973#| " // Callback function for 'startup' signal builds the UI\n" 36974#| " _onStartup: function () {\n" 36975#| " this._buildUI ();\n" 36976#| " },\n" 36977#| "\n" 36978#| " // Build the application's UI\n" 36979#| " _buildUI: function () {\n" 36980#| "\n" 36981#| " // Create the application window\n" 36982#| " this._window = new Gtk.ApplicationWindow ({\n" 36983#| " application: this.application,\n" 36984#| " title: \"Welcome to GNOME\",\n" 36985#| " default_height: 200,\n" 36986#| " default_width: 400,\n" 36987#| " window_position: Gtk.WindowPosition.CENTER });\n" 36988#| "\n" 36989#| " // Create a webview to show the web app\n" 36990#| " this._webView = new Webkit.WebView ();\n" 36991#| "\n" 36992#| " // Put the web app into the webview\n" 36993#| " this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 36994#| " \"/hellognome.html\", null));\n" 36995#| "\n" 36996#| " // Put the webview into the window\n" 36997#| " this._window.add (this._webView);\n" 36998#| "\n" 36999#| " // Show the window and all child widgets\n" 37000#| " this._window.show_all();\n" 37001#| " },\n" 37002#| "\n" 37003#| "});\n" 37004#| "\n" 37005#| "// Run the application\n" 37006#| "let app = new HelloGNOME ();\n" 37007#| "app.application.run (ARGV);\n" 37008msgid "" 37009"#!/usr/bin/gjs\n" 37010"\n" 37011"imports.gi.versions.Gtk = '3.0';\n" 37012"\n" 37013"const Gio = imports.gi.Gio;\n" 37014"const Gtk = imports.gi.Gtk;\n" 37015"\n" 37016"class ToggleButtonExample {\n" 37017"\n" 37018" // Create the application itself\n" 37019" constructor() {\n" 37020" this.application = new Gtk.Application({\n" 37021" application_id: 'org.example.jstogglebutton',\n" 37022" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 37023" });\n" 37024"\n" 37025" // Connect 'activate' and 'startup' signals to the callback functions\n" 37026" this.application.connect('activate', this._onActivate.bind(this));\n" 37027" this.application.connect('startup', this._onStartup.bind(this));\n" 37028" }\n" 37029"\n" 37030" // Callback function for 'activate' signal presents window when active\n" 37031" _onActivate() {\n" 37032" this._window.present();\n" 37033" }\n" 37034"\n" 37035" // Callback function for 'startup' signal builds the UI\n" 37036" _onStartup() {\n" 37037" this._buildUI();\n" 37038" }\n" 37039"\n" 37040" // Build the application's UI\n" 37041" _buildUI() {\n" 37042"\n" 37043" // Create the application window\n" 37044" this._window = new Gtk.ApplicationWindow({\n" 37045" application: this.application,\n" 37046" window_position: Gtk.WindowPosition.CENTER,\n" 37047" default_height: 300,\n" 37048" default_width: 300,\n" 37049" border_width: 30,\n" 37050" title: \"ToggleButton Example\"});\n" 37051"\n" 37052" // Create the spinner that the button stops and starts\n" 37053" this._spinner = new Gtk.Spinner ({hexpand: true, vexpand: true});\n" 37054"\n" 37055" // Create the togglebutton that starts and stops the spinner\n" 37056" this._toggleButton = new Gtk.ToggleButton ({label: \"Start/Stop\"});\n" 37057" this._toggleButton.connect ('toggled', this._onToggle.bind(this));\n" 37058"\n" 37059" // Create a grid and put everything in it\n" 37060" this._grid = new Gtk.Grid ({\n" 37061" row_homogeneous: false,\n" 37062" row_spacing: 15});\n" 37063" this._grid.attach (this._spinner, 0, 0, 1, 1);\n" 37064" this._grid.attach (this._toggleButton, 0, 1, 1, 1);\n" 37065"\n" 37066" // Add the grid to the window\n" 37067" this._window.add (this._grid);\n" 37068"\n" 37069" // Show the window and all child widgets\n" 37070" this._window.show_all();\n" 37071" }\n" 37072"\n" 37073" _onToggle() {\n" 37074"\n" 37075" // Start or stop the spinner\n" 37076" if (this._toggleButton.get_active ())\n" 37077" this._spinner.start ();\n" 37078" else this._spinner.stop ();\n" 37079"\n" 37080" }\n" 37081"};\n" 37082"\n" 37083"// Run the application\n" 37084"let app = new ToggleButtonExample ();\n" 37085"app.application.run (ARGV);\n" 37086msgstr "" 37087"#!/usr/bin/gjs\n" 37088"\n" 37089"const GLib = imports.gi.GLib;\n" 37090"const Gtk = imports.gi.Gtk;\n" 37091"const Lang = imports.lang;\n" 37092"const Webkit = imports.gi.WebKit;\n" 37093"\n" 37094"const HelloGNOME = new Lang.Class ({\n" 37095" Name: 'Olá, GNOME',\n" 37096"\n" 37097" // Cria o aplicativo em si\n" 37098" _init: function () {\n" 37099" this.application = new Gtk.Application ();\n" 37100"\n" 37101" // Conecta os sinais 'activate' e 'startup' às funções de chamada\n" 37102" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 37103" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 37104" },\n" 37105"\n" 37106" // Função de chamada para o sinal 'activate' apresenta janelas quando ativa\n" 37107" _onActivate: function () {\n" 37108" this._window.present ();\n" 37109" },\n" 37110"\n" 37111" // Função de chamada para o sinal 'startup' constrói a interface gráfica\n" 37112" _onStartup: function () {\n" 37113" this._buildUI ();\n" 37114" },\n" 37115"\n" 37116" // Constrói a interface gráfica do aplicativo\n" 37117" _buildUI: function () {\n" 37118"\n" 37119" // Cria a janela do aplicativo\n" 37120" this._window = new Gtk.ApplicationWindow ({\n" 37121" application: this.application,\n" 37122" title: \"Bem-vindo ao GNOME\",\n" 37123" default_height: 200,\n" 37124" default_width: 400,\n" 37125" window_position: Gtk.WindowPosition.CENTER });\n" 37126"\n" 37127" // Cria um webview para mostrar o aplicativo web\n" 37128" this._webView = new Webkit.WebView ();\n" 37129"\n" 37130" // Coloca o aplicativo web no webview\n" 37131" this._webView.load_uri (GLib.filename_to_uri (GLib.get_current_dir() +\n" 37132" \"/hellognome.html\", null));\n" 37133"\n" 37134" // Coloca o webview na janela\n" 37135" this._window.add (this._webView);\n" 37136"\n" 37137" // Mostra a janela e todos seus widgets filhos\n" 37138" this._window.show_all();\n" 37139" },\n" 37140"\n" 37141"});\n" 37142"\n" 37143"// Executa o aplicativo\n" 37144"let app = new HelloGNOME ();\n" 37145"app.application.run (ARGV);\n" 37146 37147#. (itstool) path: item/p 37148#: C/togglebutton.js.page:159 37149msgid "" 37150"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.ToggleButton." 37151"html\">Gtk.ToggleButton</link>" 37152msgstr "" 37153 37154#. (itstool) path: info/title 37155#: C/togglebutton.py.page:8 37156#, fuzzy 37157msgctxt "text" 37158msgid "ToggleButton (Python)" 37159msgstr "Botão de alternância" 37160 37161#. (itstool) path: section/code 37162#: C/togglebutton.py.page:31 37163#, no-wrap 37164msgid "" 37165"from gi.repository import Gtk\n" 37166"import sys\n" 37167"\n" 37168"\n" 37169"class MyWindow(Gtk.ApplicationWindow):\n" 37170" # a window\n" 37171"\n" 37172" def __init__(self, app):\n" 37173" Gtk.Window.__init__(\n" 37174" self, title=\"ToggleButton Example\", application=app)\n" 37175" self.set_default_size(300, 300)\n" 37176" self.set_border_width(30)\n" 37177"\n" 37178" # a spinner animation\n" 37179" self.spinner = Gtk.Spinner()\n" 37180" # with extra horizontal space\n" 37181" self.spinner.set_hexpand(True)\n" 37182" # with extra vertical space\n" 37183" self.spinner.set_vexpand(True)\n" 37184"\n" 37185" # a togglebutton\n" 37186" button = Gtk.ToggleButton.new_with_label(\"Start/Stop\")\n" 37187" # connect the signal \"toggled\" emitted by the togglebutton\n" 37188" # when its state is changed to the callback function toggled_cb\n" 37189" button.connect(\"toggled\", self.toggled_cb)\n" 37190"\n" 37191" # a grid to allocate the widgets\n" 37192" grid = Gtk.Grid()\n" 37193" grid.set_row_homogeneous(False)\n" 37194" grid.set_row_spacing(15)\n" 37195" grid.attach(self.spinner, 0, 0, 1, 1)\n" 37196" grid.attach(button, 0, 1, 1, 1)\n" 37197"\n" 37198" # add the grid to the window\n" 37199" self.add(grid)\n" 37200"\n" 37201" # callback function for the signal \"toggled\"\n" 37202" def toggled_cb(self, button):\n" 37203" # if the togglebutton is active, start the spinner\n" 37204" if button.get_active():\n" 37205" self.spinner.start()\n" 37206" # else, stop it\n" 37207" else:\n" 37208" self.spinner.stop()\n" 37209"\n" 37210"\n" 37211"class MyApplication(Gtk.Application):\n" 37212"\n" 37213" def __init__(self):\n" 37214" Gtk.Application.__init__(self)\n" 37215"\n" 37216" def do_activate(self):\n" 37217" win = MyWindow(self)\n" 37218" win.show_all()\n" 37219"\n" 37220" def do_startup(self):\n" 37221" Gtk.Application.do_startup(self)\n" 37222"\n" 37223"app = MyApplication()\n" 37224"exit_status = app.run(sys.argv)\n" 37225"sys.exit(exit_status)\n" 37226msgstr "" 37227 37228#. (itstool) path: section/title 37229#: C/togglebutton.py.page:36 37230#, fuzzy 37231msgid "Useful methods for a ToggleButton widget" 37232msgstr "Métodos úteis" 37233 37234#. (itstool) path: section/p 37235#: C/togglebutton.py.page:37 37236msgid "" 37237"In line 22 the signal <code>\"toggled\"</code> is connected to the callback " 37238"function <code>toggled_cb()</code> using <code><var>widget</var>." 37239"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 37240"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 37241msgstr "" 37242 37243#. (itstool) path: item/p 37244#: C/togglebutton.py.page:45 C/toolbar.py.page:60 C/toolbar_builder.py.page:198 37245#: C/widget_drawing.py.page:38 37246msgid "" 37247"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkWidget.html" 37248"\">GtkWidget</link>" 37249msgstr "" 37250 37251#. (itstool) path: info/title 37252#: C/togglebutton.vala.page:8 37253#, fuzzy 37254msgctxt "text" 37255msgid "ToggleButton (Vala)" 37256msgstr "Botão de alternância" 37257 37258#. (itstool) path: page/code 37259#: C/togglebutton.vala.page:28 37260#, no-wrap 37261msgid "" 37262"public class MyWindow : Gtk.ApplicationWindow {\n" 37263"\n" 37264"\tGtk.Spinner spinner;\n" 37265"\n" 37266"\tinternal MyWindow (MyApplication app) {\n" 37267"\t\tObject (application: app, title: \"ToggleButton Example\");\n" 37268"\n" 37269"\t\tthis.set_default_size (300, 300);\n" 37270"\t\tthis.border_width = 30;\n" 37271"\n" 37272"\t\t/*Spinner*/\n" 37273"\t\tspinner = new Gtk.Spinner ();\n" 37274"\t\tspinner.set_hexpand (true);\n" 37275"\t\tspinner.set_vexpand (true);\n" 37276"\n" 37277"\t\t/*ToggleButton*/\n" 37278"\t\tvar togglebutton = new Gtk.ToggleButton.with_label (\"Start/Stop\");\n" 37279"\t\ttogglebutton.toggled.connect (toggled_cb);\n" 37280"\n" 37281"\t\t/*Grid*/\n" 37282"\t\tvar grid = new Gtk.Grid ();\n" 37283"\t\tgrid.set_row_homogeneous (false);\n" 37284"\t\tgrid.set_row_spacing (15);\n" 37285"\t\tgrid.attach (spinner, 0, 0, 1, 1);\n" 37286"\t\tgrid.attach (togglebutton, 0, 1, 1, 1);\n" 37287"\n" 37288"\t\tthis.add (grid);\n" 37289"\t}\n" 37290"\n" 37291"\tvoid toggled_cb (Gtk.ToggleButton button) {\n" 37292"\t\tif (button.get_active()) {\n" 37293"\t\t\tspinner.start ();\n" 37294"\t\t}\n" 37295"\t\telse {\n" 37296"\t\t\tspinner.stop ();\n" 37297"\t\t}\n" 37298"\t}\n" 37299"}\n" 37300"\n" 37301"public class MyApplication : Gtk.Application {\n" 37302"\n" 37303"\tprotected override void activate () {\n" 37304"\n" 37305"\t\t//Show all the things\n" 37306"\t\tnew MyWindow (this).show_all ();\n" 37307"\t}\n" 37308"\n" 37309"\tinternal MyApplication () {\n" 37310"\t\tObject (application_id: \"org.example.spinner\");\n" 37311"\t}\n" 37312"}\n" 37313"\n" 37314"public int main (string[] args) {\n" 37315"\treturn new MyApplication ().run (args);\n" 37316"}\n" 37317msgstr "" 37318 37319#. (itstool) path: item/p 37320#: C/togglebutton.vala.page:33 37321msgid "" 37322"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ToggleButton.html\">Gtk." 37323"ToggleButton</link>" 37324msgstr "" 37325 37326#. (itstool) path: info/title 37327#: C/toolbar.c.page:8 37328#, fuzzy 37329msgctxt "text" 37330msgid "Toolbar (C)" 37331msgstr "Barra de ferramentas" 37332 37333#. (itstool) path: info/desc 37334#: C/toolbar.c.page:20 C/toolbar.vala.page:19 C/toolbar_builder.vala.page:20 37335#, fuzzy 37336msgid "A bar of buttons" 37337msgstr "Estilo tradicional com barra de localização e botões de navegação" 37338 37339#. (itstool) path: page/title 37340#: C/toolbar.c.page:23 C/toolbar.js.page:21 C/toolbar.py.page:23 37341#: C/toolbar.vala.page:22 37342#, fuzzy 37343msgid "Toolbar" 37344msgstr "Barra de ferramentas" 37345 37346#. (itstool) path: page/media 37347#. This is a reference to an external file such as an image or video. When 37348#. the file changes, the md5 hash will change to let you know you need to 37349#. update your localized copy. The msgstr is not used at all. Set it to 37350#. whatever you like once you have updated your copy of the file. 37351#: C/toolbar.c.page:25 C/toolbar.js.page:22 C/toolbar.py.page:25 37352#: C/toolbar.vala.page:24 C/toolbar_builder.py.page:38 37353#: C/toolbar_builder.vala.page:25 37354msgctxt "_" 37355msgid "external ref='media/toolbar.png' md5='f0350855eedf6343952b72d6d906f738'" 37356msgstr "" 37357"external ref='media/toolbar.png' md5='f0350855eedf6343952b72d6d906f738'" 37358 37359#. (itstool) path: page/p 37360#: C/toolbar.c.page:26 C/toolbar.js.page:23 C/toolbar.vala.page:25 37361msgid "" 37362"Toolbar can contain either text or stock icons. In this sample we use stock " 37363"icons. This example has fullscreen functionality." 37364msgstr "" 37365 37366#. (itstool) path: page/p 37367#: C/toolbar.c.page:27 37368msgid "" 37369"This example uses SimpleActions (window and app). App actions can easily be " 37370"added to the app menu." 37371msgstr "" 37372 37373#. (itstool) path: page/code 37374#: C/toolbar.c.page:29 37375#, no-wrap 37376msgid "" 37377"\n" 37378"#include <gtk/gtk.h>\n" 37379"\n" 37380"/* Declare these two Toolbuttons, as they will be used in both the fullscreen\n" 37381" * action callback as well as the activate function.\n" 37382" */\n" 37383"GtkToolItem *fullscreen_button;\n" 37384"GtkToolItem *leavefullscreen_button;\n" 37385"\n" 37386"\n" 37387"\n" 37388"/* Callback function for the undo action */\n" 37389"static void\n" 37390"undo_callback (GSimpleAction *simple,\n" 37391" GVariant *parameter,\n" 37392" gpointer user_data)\n" 37393"{\n" 37394" g_print (\"You clicked \\\"Undo\\\".\\n\");\n" 37395"}\n" 37396"\n" 37397"\n" 37398"\n" 37399"/* Callback function for the fullscreen action */\n" 37400"static void\n" 37401"fullscreen_callback (GSimpleAction *simple,\n" 37402" GVariant *parameter,\n" 37403" gpointer user_data)\n" 37404"{\n" 37405" GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (user_data));\n" 37406"\n" 37407" GdkWindowState current_state = gdk_window_get_state (window);\n" 37408"\n" 37409" /* If the window is currently in fullscreen mode */\n" 37410" if ( (current_state & GDK_WINDOW_STATE_FULLSCREEN) != 0)\n" 37411" {\n" 37412" /* Minimize the window and change to the fullscreen button */\n" 37413" gdk_window_unfullscreen (window);\n" 37414" gtk_widget_hide (GTK_WIDGET(leavefullscreen_button));\n" 37415" gtk_widget_show (GTK_WIDGET(fullscreen_button));\n" 37416" }\n" 37417" else\n" 37418" {\n" 37419" /* Maximize the window, and change to the unfullscreen button */\n" 37420" gdk_window_fullscreen (window);\n" 37421" gtk_widget_hide (GTK_WIDGET (fullscreen_button));\n" 37422" gtk_widget_show (GTK_WIDGET (leavefullscreen_button));\n" 37423" }\n" 37424"}\n" 37425"\n" 37426"\n" 37427"static void\n" 37428"activate (GtkApplication *app,\n" 37429" gpointer user_data)\n" 37430"{\n" 37431" /* Initialize variables */\n" 37432" GtkWidget *window;\n" 37433" GtkWidget *grid;\n" 37434" GtkWidget *toolbar;\n" 37435"\n" 37436" GtkToolItem *new_button;\n" 37437" GtkToolItem *open_button;\n" 37438" GtkToolItem *undo_button;\n" 37439"\n" 37440" GtkStyleContext *style_context;\n" 37441"\n" 37442" GSimpleAction *undo_action;\n" 37443" GSimpleAction *fullscreen_action;\n" 37444" GSimpleAction *leavefullscreen_action;\n" 37445"\n" 37446" /* Create a window with a title and a default size */\n" 37447" window = gtk_application_window_new (app);\n" 37448" gtk_window_set_title (GTK_WINDOW (window), \"Toolbar Example\");\n" 37449" gtk_window_set_default_size (GTK_WINDOW (window), 400, 200);\n" 37450"\n" 37451" /* Here we begin to create the toolbar */\n" 37452" toolbar = gtk_toolbar_new ();\n" 37453" /* Set the toolbar to be the primary toolbar of the application */\n" 37454" style_context = gtk_widget_get_style_context (toolbar);\n" 37455" gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);\n" 37456"\n" 37457" /* Create a button for the \"new\" action, with a stock image */\n" 37458" new_button = gtk_tool_button_new_from_stock (GTK_STOCK_NEW);\n" 37459" /* Show the \"new\" button's label */\n" 37460" gtk_tool_item_set_is_important (new_button, TRUE);\n" 37461" /* Insert the button in the desired position within the toolbar */\n" 37462" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), new_button, 0);\n" 37463" /* Show the button */\n" 37464" gtk_widget_show (GTK_WIDGET (new_button));\n" 37465" /* Set the action name for the \"new\" action. We use \"app.new\" to\n" 37466" * indicate that the action controls the application.\n" 37467" */\n" 37468" gtk_actionable_set_action_name (GTK_ACTIONABLE (new_button), \"app.new\");\n" 37469"\n" 37470" /* Repeat the same steps for the \"open\" action */\n" 37471" open_button = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);\n" 37472" gtk_tool_item_set_is_important (open_button, TRUE);\n" 37473" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_button, 1);\n" 37474" gtk_widget_show (GTK_WIDGET (open_button));\n" 37475" gtk_actionable_set_action_name (GTK_ACTIONABLE (open_button), \"app.open\");\n" 37476"\n" 37477" /* Repeat the same steps for the \"undo\" action */\n" 37478" undo_button = gtk_tool_button_new_from_stock (GTK_STOCK_UNDO);\n" 37479" gtk_tool_item_set_is_important (undo_button, TRUE);\n" 37480" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), undo_button, 2);\n" 37481" gtk_widget_show (GTK_WIDGET (undo_button));\n" 37482" /* In this case, we use \"win.undo\" to indicate that\n" 37483" * the action controls only the window\n" 37484" */\n" 37485" gtk_actionable_set_action_name (GTK_ACTIONABLE (undo_button), \"win.undo\");\n" 37486"\n" 37487" /* Repeat the same steps for the \"fullscreen\" action */\n" 37488" fullscreen_button = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);\n" 37489" gtk_tool_item_set_is_important (fullscreen_button, TRUE);\n" 37490" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), fullscreen_button, 3);\n" 37491" gtk_widget_show (GTK_WIDGET (fullscreen_button));\n" 37492" gtk_actionable_set_action_name (GTK_ACTIONABLE (fullscreen_button),\n" 37493" \"win.fullscreen\");\n" 37494"\n" 37495" /*Repeat the same steps for the \"leavefullscreen\" action */\n" 37496" leavefullscreen_button = gtk_tool_button_new_from_stock (GTK_STOCK_LEAVE_FULLSCREEN);\n" 37497" gtk_tool_item_set_is_important (leavefullscreen_button, TRUE);\n" 37498" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), leavefullscreen_button, 3);\n" 37499" /* The only difference here is that we don't show the leavefullscreen button,\n" 37500" * as it will later replace the fullscreen button.\n" 37501" */\n" 37502" gtk_actionable_set_action_name (GTK_ACTIONABLE (leavefullscreen_button),\n" 37503" \"win.leavefullscreen\");\n" 37504"\n" 37505" /* Once we've created the bare-bones of the toolbar, we make\n" 37506" * sure it has enough horizontal space.\n" 37507" */\n" 37508" gtk_widget_set_hexpand (toolbar, TRUE);\n" 37509" gtk_widget_show (toolbar);\n" 37510"\n" 37511" /* Attach the toolbar to the grid and add it to the overall window */\n" 37512" grid = gtk_grid_new ();\n" 37513" gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);\n" 37514" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));\n" 37515" gtk_widget_show (GTK_WIDGET (grid));\n" 37516"\n" 37517" /* Use the action names to create the actions that control the window, and\n" 37518" * connect them to the appropriate callbackfunctions.\n" 37519" */\n" 37520" undo_action = g_simple_action_new (\"undo\", NULL);\n" 37521" g_signal_connect (undo_action, \"activate\", G_CALLBACK (undo_callback),\n" 37522" GTK_WINDOW (window));\n" 37523" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (undo_action));\n" 37524"\n" 37525" fullscreen_action = g_simple_action_new (\"fullscreen\", NULL);\n" 37526" g_signal_connect (fullscreen_action, \"activate\", G_CALLBACK (fullscreen_callback),\n" 37527" GTK_WINDOW (window));\n" 37528" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (fullscreen_action));\n" 37529"\n" 37530" leavefullscreen_action = g_simple_action_new (\"leavefullscreen\", NULL);\n" 37531" g_signal_connect (leavefullscreen_action, \"activate\", G_CALLBACK (fullscreen_callback),\n" 37532" GTK_WINDOW (window));\n" 37533" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (leavefullscreen_action));\n" 37534"\n" 37535" gtk_widget_show (window);\n" 37536"}\n" 37537"\n" 37538"\n" 37539"\n" 37540"/* Callback function for the new action */\n" 37541"static void\n" 37542"new_callback (GSimpleAction *simple,\n" 37543" GVariant *parameter,\n" 37544" gpointer user_data)\n" 37545"{\n" 37546" g_print (\"You clicked \\\"New\\\".\\n\");\n" 37547"}\n" 37548"\n" 37549"\n" 37550"\n" 37551"/* Callback function for the open action */\n" 37552"static void\n" 37553"open_callback (GSimpleAction *simple,\n" 37554" GVariant *parameter,\n" 37555" gpointer user_data)\n" 37556"{\n" 37557" g_print (\"You clicked \\\"Open\\\".\\n\");\n" 37558"}\n" 37559"\n" 37560"\n" 37561"\n" 37562"/* In this function, we create the actions in which control the window, and\n" 37563" * connect their signals to the appropriate callback function.\n" 37564" */\n" 37565"static void\n" 37566"startup (GApplication *app,\n" 37567" gpointer user_data)\n" 37568"{\n" 37569" GSimpleAction *new_action;\n" 37570" GSimpleAction *open_action;\n" 37571"\n" 37572" new_action = g_simple_action_new (\"new\", NULL);\n" 37573" g_signal_connect (new_action, \"activate\", G_CALLBACK (new_callback), app);\n" 37574" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));\n" 37575"\n" 37576" open_action = g_simple_action_new (\"open\", NULL);\n" 37577" g_signal_connect (open_action, \"activate\", G_CALLBACK (open_callback), app);\n" 37578" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (open_action));\n" 37579"}\n" 37580"\n" 37581"\n" 37582"\n" 37583"/* Startup function for the application */\n" 37584"int\n" 37585"main (int argc, char **argv)\n" 37586"{\n" 37587" GtkApplication *app;\n" 37588" int status;\n" 37589"\n" 37590" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 37591" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 37592" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 37593" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 37594" g_object_unref (app);\n" 37595"\n" 37596" return status;\n" 37597"}\n" 37598msgstr "" 37599 37600#. (itstool) path: item/p 37601#: C/toolbar.c.page:35 C/tooltip.c.page:39 C/tooltip.py.page:60 37602#, fuzzy 37603msgid "" 37604"<link href=\"http://developer.gnome.org/gtk3/stable/GtkToolbar.html" 37605"\">GtkToolbar</link>" 37606msgstr "" 37607"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 37608"link>" 37609 37610#. (itstool) path: item/p 37611#: C/toolbar.c.page:36 37612#, fuzzy 37613msgid "" 37614"<link href=\"http://developer.gnome.org/gtk3/stable/GtkToolButton.html" 37615"\">GtkToolbutton</link>" 37616msgstr "" 37617"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 37618"link>" 37619 37620#. (itstool) path: info/title 37621#: C/toolbar.js.page:8 37622#, fuzzy 37623msgctxt "text" 37624msgid "Toolbar (JavaScript)" 37625msgstr "_JavaScript" 37626 37627#. (itstool) path: info/desc 37628#: C/toolbar.js.page:18 37629#, fuzzy 37630msgid "A bar of tools" 37631msgstr "" 37632"A partir do menu da janela de imagens, em:<menuchoice><guimenu>Ferramentas</" 37633"guimenu><guisubmenu>Ferramentas de transformação</" 37634"guisubmenu><guimenuitem>Espelhar</guimenuitem></menuchoice>," 37635 37636#. (itstool) path: page/p 37637#: C/toolbar.js.page:24 C/toolbar.vala.page:26 37638msgid "" 37639"This example uses SimpleActions (window and app). App actions can easily be " 37640"added the the app menu." 37641msgstr "" 37642 37643#. (itstool) path: page/code 37644#: C/toolbar.js.page:26 37645#, no-wrap 37646msgid "" 37647"#!/usr/bin/gjs\n" 37648"\n" 37649"imports.gi.versions.Gdk = '3.0';\n" 37650"imports.gi.versions.Gtk = '3.0';\n" 37651"\n" 37652"const Gdk = imports.gi.Gdk;\n" 37653"const Gio = imports.gi.Gio;\n" 37654"const GLib = imports.gi.GLib;\n" 37655"const Gtk = imports.gi.Gtk;\n" 37656"\n" 37657"class Application {\n" 37658"\n" 37659" //create the application\n" 37660" constructor() {\n" 37661" this.application = new Gtk.Application({\n" 37662" application_id: 'org.example.myapp',\n" 37663" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 37664" });\n" 37665"\n" 37666" //connect to 'activate' and 'startup' signals to the callback functions\n" 37667" this.application.connect('activate', this._onActivate.bind(this));\n" 37668" this.application.connect('startup', this._onStartup.bind(this));\n" 37669" }\n" 37670"\n" 37671" //create the UI (in this case it's just the ApplicationWindow\n" 37672" _buildUI() {\n" 37673" this._window = new Gtk.ApplicationWindow({\n" 37674" application: this.application,\n" 37675" window_position: Gtk.WindowPosition.CENTER,\n" 37676" title: \"Toolbar Example\",\n" 37677" default_height: 200,\n" 37678" default_width: 400\n" 37679" });\n" 37680"\n" 37681" this._grid = new Gtk.Grid();\n" 37682" this._window.add(this._grid);\n" 37683" this._grid.show();\n" 37684"\n" 37685" this._createToolbar();\n" 37686" this._toolbar.set_hexpand(true);\n" 37687" this._grid.attach(this._toolbar, 0, 0, 1, 1);\n" 37688"\n" 37689" //show the toolbar and window\n" 37690" this._toolbar.show();\n" 37691" this._window.show();\n" 37692" }\n" 37693"\n" 37694" //callback function for 'activate' signal\n" 37695" _onActivate() {\n" 37696" this._window.present();\n" 37697" }\n" 37698"\n" 37699" //callback function for 'startup' signal\n" 37700" _onStartup() {\n" 37701" this._initMenus();\n" 37702" this._buildUI();\n" 37703" }\n" 37704"\n" 37705" //create the toolbar, its toolbuttons and their actions\n" 37706" _createToolbar() {\n" 37707"\n" 37708" this._toolbar = new Gtk.Toolbar();\n" 37709" this._toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n" 37710"\n" 37711" //create the \"New\" ToolButton and its SimpleAction.\n" 37712" //Using actions allows you to add them to the app menu\n" 37713" //without duplicating code.\n" 37714" let newAction = new Gio.SimpleAction({ name: 'new'});\n" 37715" newAction.connect('activate', () => { this._newCB(); });\n" 37716" this.application.add_action(newAction);//note: this action is added to the app\n" 37717"\n" 37718" this._newButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n" 37719" this._newButton.is_important = true;\n" 37720" this._toolbar.add(this._newButton);\n" 37721" this._newButton.show();\n" 37722" this._newButton.action_name = \"app.new\";\n" 37723"\n" 37724" //create the \"Open\" ToolButton and its SimpleAction\n" 37725" let openAction = new Gio.SimpleAction({ name: 'open'});\n" 37726" openAction.connect('activate', () => { this._openCB(); });\n" 37727" this.application.add_action(openAction);\n" 37728"\n" 37729" this._openButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n" 37730" this._openButton.is_important = true;\n" 37731" this._toolbar.add(this._openButton);\n" 37732" this._openButton.show();\n" 37733" this._openButton.action_name = \"app.open\";\n" 37734"\n" 37735" //create the \"Undo\" ToolButton and its SimpleAction\n" 37736" let undoAction = new Gio.SimpleAction({ name: 'undo'});\n" 37737" undoAction.connect('activate', () => { this._undoCB(); });\n" 37738" this._window.add_action(undoAction);//note this action is added to the window\n" 37739"\n" 37740" this._undoButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n" 37741" this._undoButton.is_important = true;\n" 37742" this._toolbar.add(this._undoButton);\n" 37743" this._undoButton.show();\n" 37744" this._undoButton.action_name = \"win.undo\";\n" 37745"\n" 37746" //create the \"Fullscreen\" ToolButton and its SimpleAction\n" 37747" let fullscreenToggleAction = new Gio.SimpleAction ({ name: 'fullscreenToggle' });\n" 37748" fullscreenToggleAction.connect('activate', () => {\n" 37749" this._fullscreenToggleCB();\n" 37750" });\n" 37751" this._window.add_action(fullscreenToggleAction);\n" 37752"\n" 37753" this._fullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n" 37754" this._fullscreenButton.is_important = true;\n" 37755" this._toolbar.add(this._fullscreenButton);\n" 37756" this._fullscreenButton.show();\n" 37757" this._fullscreenButton.action_name = \"win.fullscreenToggle\";\n" 37758"\n" 37759" //create the \"leaveFullscreen\" ToolButton, and set the action name to \"win.fullscreenToggle\"\n" 37760" this._leaveFullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);\n" 37761" this._leaveFullscreenButton.is_important = true;\n" 37762" this._toolbar.add(this._leaveFullscreenButton);\n" 37763" this._leaveFullscreenButton.action_name = \"win.fullscreenToggle\";\n" 37764" }\n" 37765"\n" 37766" _initMenus() {\n" 37767" let menu = new Gio.Menu();\n" 37768" menu.append(\"New\", 'app.new');\n" 37769" menu.append(\"Open\", 'app.open');\n" 37770" menu.append(\"Quit\", 'app.quit');\n" 37771"\n" 37772" this.application.set_app_menu(menu);\n" 37773"\n" 37774" let quitAction = new Gio.SimpleAction({name: 'quit' });\n" 37775" quitAction.connect('activate', () => { this._window.destroy(); });\n" 37776" this.application.add_action(quitAction);\n" 37777" }\n" 37778"\n" 37779" _newCB() {\n" 37780" print(\"You clicked 'New'.\");\n" 37781" }\n" 37782"\n" 37783" _openCB() {\n" 37784" print(\"You clicked 'Open'.\");\n" 37785" }\n" 37786"\n" 37787" _undoCB() {\n" 37788" print (\"You clicked 'Undo'.\");\n" 37789" }\n" 37790"\n" 37791" _fullscreenToggleCB() {\n" 37792" if ((this._window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ) {\n" 37793" this._window.unfullscreen();\n" 37794" this._leaveFullscreenButton.hide();\n" 37795" this._fullscreenButton.show();\n" 37796" } else {\n" 37797" this._window.fullscreen();\n" 37798" this._fullscreenButton.hide();\n" 37799" this._leaveFullscreenButton.show();\n" 37800" }\n" 37801" }\n" 37802"};\n" 37803"\n" 37804"//run the application\n" 37805"let app = new Application();\n" 37806"app.application.run(ARGV);\n" 37807msgstr "" 37808 37809#. (itstool) path: item/p 37810#: C/toolbar.js.page:31 37811msgid "" 37812"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Window.html" 37813"\">Gtk.Window</link>" 37814msgstr "" 37815 37816#. (itstool) path: item/p 37817#: C/toolbar.js.page:32 37818msgid "" 37819"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.Toolbar.html" 37820"\">Gtk.Toolbar</link>" 37821msgstr "" 37822 37823#. (itstool) path: item/p 37824#: C/toolbar.js.page:33 37825msgid "" 37826"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.ToolButton." 37827"html\">Gtk.ToolButton</link>" 37828msgstr "" 37829 37830#. (itstool) path: item/p 37831#: C/toolbar.js.page:34 37832msgid "" 37833"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.html\">Gtk " 37834"Stock items</link>" 37835msgstr "" 37836 37837#. (itstool) path: item/p 37838#: C/toolbar.js.page:35 37839msgid "" 37840"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gdk.WindowState." 37841"html\">Gdk.WindowState</link>" 37842msgstr "" 37843 37844#. (itstool) path: info/title 37845#: C/toolbar.py.page:8 37846#, fuzzy 37847msgctxt "text" 37848msgid "Toolbar (Python)" 37849msgstr "Barra de ferramentas" 37850 37851#. (itstool) path: info/desc 37852#: C/toolbar.py.page:20 C/toolbar_builder.py.page:33 37853msgid "A bar of buttons and other widgets" 37854msgstr "" 37855 37856#. (itstool) path: page/p 37857#: C/toolbar.py.page:26 37858msgid "An example of toolbar with buttons (from stock icons)." 37859msgstr "" 37860 37861#. (itstool) path: section/code 37862#: C/toolbar.py.page:33 37863#, no-wrap 37864msgid "" 37865"from gi.repository import Gtk\n" 37866"from gi.repository import Gdk\n" 37867"from gi.repository import Gio\n" 37868"import sys\n" 37869"\n" 37870"\n" 37871"class MyWindow(Gtk.ApplicationWindow):\n" 37872"\n" 37873" def __init__(self, app):\n" 37874" Gtk.Window.__init__(self, title=\"Toolbar Example\", application=app)\n" 37875" self.set_default_size(400, 200)\n" 37876"\n" 37877" # a grid to attach the toolbar\n" 37878" grid = Gtk.Grid()\n" 37879"\n" 37880" # a toolbar created in the method create_toolbar (see below)\n" 37881" toolbar = self.create_toolbar()\n" 37882" # with extra horizontal space\n" 37883" toolbar.set_hexpand(True)\n" 37884" # show the toolbar\n" 37885" toolbar.show()\n" 37886"\n" 37887" # attach the toolbar to the grid\n" 37888" grid.attach(toolbar, 0, 0, 1, 1)\n" 37889"\n" 37890" # add the grid to the window\n" 37891" self.add(grid)\n" 37892"\n" 37893" # create the actions that control the window and connect their signal to a\n" 37894" # callback method (see below):\n" 37895"\n" 37896" # undo\n" 37897" undo_action = Gio.SimpleAction.new(\"undo\", None)\n" 37898" undo_action.connect(\"activate\", self.undo_callback)\n" 37899" self.add_action(undo_action)\n" 37900"\n" 37901" # fullscreen\n" 37902" fullscreen_action = Gio.SimpleAction.new(\"fullscreen\", None)\n" 37903" fullscreen_action.connect(\"activate\", self.fullscreen_callback)\n" 37904" self.add_action(fullscreen_action)\n" 37905"\n" 37906" # a method to create the toolbar\n" 37907" def create_toolbar(self):\n" 37908" # a toolbar\n" 37909" toolbar = Gtk.Toolbar()\n" 37910"\n" 37911" # which is the primary toolbar of the application\n" 37912" toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)\n" 37913"\n" 37914" # create a button for the \"new\" action, with a stock image\n" 37915" new_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW)\n" 37916" # label is shown\n" 37917" new_button.set_is_important(True)\n" 37918" # insert the button at position in the toolbar\n" 37919" toolbar.insert(new_button, 0)\n" 37920" # show the button\n" 37921" new_button.show()\n" 37922" # set the name of the action associated with the button.\n" 37923" # The action controls the application (app)\n" 37924" new_button.set_action_name(\"app.new\")\n" 37925"\n" 37926" # button for the \"open\" action\n" 37927" open_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN)\n" 37928" open_button.set_is_important(True)\n" 37929" toolbar.insert(open_button, 1)\n" 37930" open_button.show()\n" 37931" open_button.set_action_name(\"app.open\")\n" 37932"\n" 37933" # button for the \"undo\" action\n" 37934" undo_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO)\n" 37935" undo_button.set_is_important(True)\n" 37936" toolbar.insert(undo_button, 2)\n" 37937" undo_button.show()\n" 37938" undo_button.set_action_name(\"win.undo\")\n" 37939"\n" 37940" # button for the \"fullscreen/leave fullscreen\" action\n" 37941" self.fullscreen_button = Gtk.ToolButton.new_from_stock(\n" 37942" Gtk.STOCK_FULLSCREEN)\n" 37943" self.fullscreen_button.set_is_important(True)\n" 37944" toolbar.insert(self.fullscreen_button, 3)\n" 37945" self.fullscreen_button.set_action_name(\"win.fullscreen\")\n" 37946"\n" 37947" # return the complete toolbar\n" 37948" return toolbar\n" 37949"\n" 37950" # callback method for undo\n" 37951" def undo_callback(self, action, parameter):\n" 37952" print(\"You clicked \\\"Undo\\\".\")\n" 37953"\n" 37954" # callback method for fullscreen / leave fullscreen\n" 37955" def fullscreen_callback(self, action, parameter):\n" 37956" # check if the state is the same as Gdk.WindowState.FULLSCREEN, which\n" 37957" # is a bit flag\n" 37958" is_fullscreen = self.get_window().get_state(\n" 37959" ) & Gdk.WindowState.FULLSCREEN != 0\n" 37960" if not is_fullscreen:\n" 37961" self.fullscreen_button.set_stock_id(Gtk.STOCK_LEAVE_FULLSCREEN)\n" 37962" self.fullscreen()\n" 37963" else:\n" 37964" self.fullscreen_button.set_stock_id(Gtk.STOCK_FULLSCREEN)\n" 37965" self.unfullscreen()\n" 37966"\n" 37967"\n" 37968"class MyApplication(Gtk.Application):\n" 37969"\n" 37970" def __init__(self):\n" 37971" Gtk.Application.__init__(self)\n" 37972"\n" 37973" def do_activate(self):\n" 37974" win = MyWindow(self)\n" 37975" win.show_all()\n" 37976"\n" 37977" def do_startup(self):\n" 37978" Gtk.Application.do_startup(self)\n" 37979"\n" 37980" # create the actions that control the window and connect their signal to a\n" 37981" # callback method (see below):\n" 37982"\n" 37983" # new\n" 37984" new_action = Gio.SimpleAction.new(\"new\", None)\n" 37985" new_action.connect(\"activate\", self.new_callback)\n" 37986" app.add_action(new_action)\n" 37987"\n" 37988" # open\n" 37989" open_action = Gio.SimpleAction.new(\"open\", None)\n" 37990" open_action.connect(\"activate\", self.open_callback)\n" 37991" app.add_action(open_action)\n" 37992"\n" 37993" # callback method for new\n" 37994" def new_callback(self, action, parameter):\n" 37995" print(\"You clicked \\\"New\\\".\")\n" 37996"\n" 37997" # callback method for open\n" 37998" def open_callback(self, action, parameter):\n" 37999" print(\"You clicked \\\"Open\\\".\")\n" 38000"\n" 38001"app = MyApplication()\n" 38002"exit_status = app.run(sys.argv)\n" 38003"sys.exit(exit_status)\n" 38004msgstr "" 38005 38006#. (itstool) path: section/title 38007#: C/toolbar.py.page:37 38008#, fuzzy 38009msgid "Useful methods for a Toolbar widget" 38010msgstr "Barra de ferramentas de widget" 38011 38012#. (itstool) path: section/p 38013#: C/toolbar.py.page:38 38014msgid "" 38015"In line 32 the signal <code>\"activate\"</code> from the action " 38016"<code>undo_action</code> is connected to the callback function " 38017"<code>undo_callback()</code> using <code><var>action</var>." 38018"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 38019"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 38020msgstr "" 38021 38022#. (itstool) path: item/p 38023#: C/toolbar.py.page:41 38024msgid "" 38025"Use <code>insert(tool_item, position)</code> to insert the <code>tool_item</" 38026"code> at <code>position</code>. If <code>position</code> is negative, the " 38027"item is appended at the end of the toolbar." 38028msgstr "" 38029 38030#. (itstool) path: item/p 38031#: C/toolbar.py.page:42 38032msgid "" 38033"<code>get_item_index(tool_item)</code> retrieves the position of " 38034"<code>tool_item</code> on the toolbar." 38035msgstr "" 38036 38037#. (itstool) path: item/p 38038#: C/toolbar.py.page:43 38039msgid "" 38040"<code>get_n_items()</code> returns the number of items on the toolbar; " 38041"<code>get_nth_item(position)</code> returns the item in position " 38042"<code>position</code>." 38043msgstr "" 38044 38045#. (itstool) path: item/p 38046#: C/toolbar.py.page:44 38047msgid "" 38048"If the toolbar does not have room for all the menu items, and " 38049"<code>set_show_arrow(True)</code>, the items that do not have room are shown " 38050"through an overflow menu." 38051msgstr "" 38052 38053#. (itstool) path: item/p 38054#: C/toolbar.py.page:45 38055msgid "" 38056"<code>set_icon_size(icon_size)</code> sets the size of icons in the toolbar; " 38057"<code>icon_size</code> can be one of <code>Gtk.IconSize.INVALID, Gtk." 38058"IconSize.MENU, Gtk.IconSize.SMALL_TOOLBAR, Gtk.IconSize.LARGE_TOOLBAR, Gtk." 38059"IconSize.BUTTON, Gtk.IconSize.DND, Gtk.IconSize.DIALOG</code>. This should " 38060"be used only for special-purpose toolbars, normal application toolbars " 38061"should respect user preferences for the size of icons. " 38062"<code>unset_icon_size()</code> unsets the preferences set with " 38063"<code>set_icon_size(icon_size)</code>, so that user preferences are used to " 38064"determine the icon size." 38065msgstr "" 38066 38067#. (itstool) path: item/p 38068#: C/toolbar.py.page:46 38069msgid "" 38070"<code>set_style(style)</code>, where <code>style</code> is one of <code>Gtk." 38071"ToolbarStyle.ICONS, Gtk.ToolbarStyle.TEXT, Gtk.ToolbarStyle.BOTH, Gtk." 38072"ToolbarStyle.BOTH_HORIZ</code>, sets if the toolbar shows only icons, only " 38073"text, or both (vertically stacked or alongside each other). To let user " 38074"preferences determine the toolbar style, and unset a toolbar style so set, " 38075"use <code>unset_style()</code>." 38076msgstr "" 38077 38078#. (itstool) path: item/p 38079#: C/toolbar.py.page:55 38080msgid "" 38081"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkToolbar.html" 38082"\">GtkToolbar</link>" 38083msgstr "" 38084 38085#. (itstool) path: item/p 38086#: C/toolbar.py.page:56 38087msgid "" 38088"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkToolButton.html" 38089"\">GtkToolButton</link>" 38090msgstr "" 38091 38092#. (itstool) path: item/p 38093#: C/toolbar.py.page:57 38094msgid "" 38095"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkToolItem.html" 38096"\">GtkToolItem</link>" 38097msgstr "" 38098 38099#. (itstool) path: item/p 38100#: C/toolbar.py.page:59 38101msgid "" 38102"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkActionable.html" 38103"\">GtkActionable</link>" 38104msgstr "" 38105 38106#. (itstool) path: item/p 38107#: C/toolbar.py.page:61 C/toolbar_builder.py.page:199 38108msgid "" 38109"<link href=\"http://developer.gnome.org/gdk3/unstable/gdk3-Event-Structures." 38110"html#GdkEventWindowState\">Event Structures</link>" 38111msgstr "" 38112 38113#. (itstool) path: info/title 38114#: C/toolbar.vala.page:8 38115#, fuzzy 38116msgctxt "text" 38117msgid "Toolbar (Vala)" 38118msgstr "_Vala" 38119 38120#. (itstool) path: page/code 38121#: C/toolbar.vala.page:28 38122#, no-wrap 38123msgid "" 38124"/* This is the Window */\n" 38125"class MyWindow : Gtk.ApplicationWindow {\n" 38126"\n" 38127"\t/* Instance variables belonging to the window */\n" 38128"\tGtk.Toolbar toolbar;\n" 38129"\tGtk.ToolButton new_button;\n" 38130"\tGtk.ToolButton open_button;\n" 38131"\tGtk.ToolButton undo_button;\n" 38132"\tGtk.ToolButton fullscreen_button;\n" 38133"\tGtk.ToolButton leave_fullscreen_button;\n" 38134"\n" 38135"\t/* Constructor */\n" 38136"\tinternal MyWindow (MyApplication app) {\n" 38137"\t\tObject (application: app, title: \"Toolbar Example\");\n" 38138"\n" 38139"\t\tthis.set_default_size (400, 200);\n" 38140"\t\tvar grid = new Gtk.Grid ();\n" 38141"\t\tthis.add (grid);\n" 38142"\t\tgrid.show ();\n" 38143"\n" 38144"\t\tcreate_toolbar ();\n" 38145"\t\ttoolbar.set_hexpand (true);\n" 38146"\t\tgrid.attach (toolbar, 0, 0, 1, 1);\n" 38147"\t\ttoolbar.show ();\n" 38148"\n" 38149"\t\t/* create the \"undo\" window action action */\n" 38150"\t\tvar undo_action = new SimpleAction (\"undo\", null);\n" 38151"\t\tundo_action.activate.connect (undo_callback);\n" 38152"\t\tthis.add_action (undo_action);\n" 38153"\n" 38154"\t\t/* create the \"fullscreen\" window action */\n" 38155"\t\tvar fullscreen_action = new SimpleAction (\"fullscreen\", null);\n" 38156"\t\tfullscreen_action.activate.connect (fullscreen_callback);\n" 38157"\t\tthis.add_action (fullscreen_action);\n" 38158"\t}\n" 38159"\n" 38160"\t/* This function creates the toolbar, its ToolButtons,\n" 38161"\t * and assigns the actions names to the ToolButtons.*/\n" 38162"\tvoid create_toolbar () {\n" 38163"\t\ttoolbar = new Gtk.Toolbar ();\n" 38164"\t\ttoolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n" 38165"\n" 38166"\t\tnew_button = new Gtk.ToolButton.from_stock (Gtk.Stock.NEW);\n" 38167"\t\tnew_button.is_important = true; //decides whether to show the label\n" 38168"\t\ttoolbar.add (new_button);\n" 38169"\t\tnew_button.show ();\n" 38170"\t\tnew_button.action_name = \"app.new\";\n" 38171"\n" 38172"\t\topen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.OPEN);\n" 38173"\t\topen_button.is_important = true;\n" 38174"\t\ttoolbar.add (open_button);\n" 38175"\t\topen_button.show ();\n" 38176"\t\topen_button.action_name = \"app.open\";\n" 38177"\n" 38178"\t\tundo_button = new Gtk.ToolButton.from_stock (Gtk.Stock.UNDO);\n" 38179"\t\tundo_button.is_important = true;\n" 38180"\t\ttoolbar.add (undo_button);\n" 38181"\t\tundo_button.show ();\n" 38182"\t\tundo_button.action_name = \"win.undo\";\n" 38183"\n" 38184"\t\tfullscreen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.FULLSCREEN);\n" 38185"\t\tfullscreen_button.is_important = true;\n" 38186"\t\ttoolbar.add (fullscreen_button);\n" 38187"\t\tfullscreen_button.show ();\n" 38188"\t\tfullscreen_button.action_name = \"win.fullscreen\";\n" 38189"\n" 38190"\t\tleave_fullscreen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.LEAVE_FULLSCREEN)\n" 38191";\n" 38192"\t\tleave_fullscreen_button.is_important = true;\n" 38193"\t\ttoolbar.add (leave_fullscreen_button);\n" 38194"\n" 38195"\t\tleave_fullscreen_button.action_name = \"win.fullscreen\";\n" 38196"\t}\n" 38197"\n" 38198"\tvoid undo_callback (SimpleAction simple, Variant? parameter) {\n" 38199"\t\t\tprint (\"You clicked \\\"Undo\\\".\\n\");\n" 38200"\t}\n" 38201"\n" 38202"\tvoid fullscreen_callback (SimpleAction simple, Variant? parameter) {\n" 38203"\t\tif ((this.get_window ().get_state () & Gdk.WindowState.FULLSCREEN) != 0) {\n" 38204"\t\t\tthis.unfullscreen ();\n" 38205"\t\t\tleave_fullscreen_button.hide ();\n" 38206"\t\t\tfullscreen_button.show ();\n" 38207"\t\t}\n" 38208"\t\telse {\n" 38209"\t\t\tthis.fullscreen ();\n" 38210"\t\t\tfullscreen_button.hide ();\n" 38211"\t\t\tleave_fullscreen_button.show ();\n" 38212"\t\t}\n" 38213"\t}\n" 38214"}\n" 38215"\n" 38216"/* This is the application */\n" 38217"class MyApplication : Gtk.Application {\n" 38218"\tprotected override void activate () {\n" 38219"\t\tnew MyWindow (this).show ();\n" 38220"\t}\n" 38221"\n" 38222"\tprotected override void startup () {\n" 38223"\t\tbase.startup ();\n" 38224"\n" 38225"\t\t/* Create the \"new\" action and add it to the app*/\n" 38226"\t\tvar new_action = new SimpleAction (\"new\", null);\n" 38227"\t\tnew_action.activate.connect (new_callback);\n" 38228"\t\tthis.add_action (new_action);\n" 38229"\n" 38230"\t\t/* Create the \"open\" action, and add it to the app */\n" 38231"\t\tvar open_action = new SimpleAction (\"open\", null);\n" 38232"\t\topen_action.activate.connect (open_callback);\n" 38233"\t\tthis.add_action (open_action);\n" 38234"\n" 38235"\t\t/* You could also add the action to the app menu\n" 38236"\t\t * if you wanted to.\n" 38237"\t\t */\n" 38238"\t\t//var menu = new Menu ();\n" 38239"\t\t//menu.append (\"New\", \"app.new\");\n" 38240"\t\t//this.app_menu = menu;\n" 38241"\t}\n" 38242"\n" 38243"\tvoid new_callback (SimpleAction action, Variant? parameter) {\n" 38244"\t\tprint (\"You clicked \\\"New\\\".\\n\");\n" 38245"\t}\n" 38246"\n" 38247"\tvoid open_callback (SimpleAction action, Variant? parameter) {\n" 38248"\t\t\tprint (\"You clicked \\\"Open\\\".\\n\");\n" 38249"\t}\n" 38250"}\n" 38251"\n" 38252"/* The main function creates the application and runs it. */\n" 38253"int main (string[] args) {\n" 38254"\treturn new MyApplication ().run (args);\n" 38255"}\n" 38256msgstr "" 38257 38258#. (itstool) path: item/p 38259#: C/toolbar.vala.page:34 C/toolbar_builder.vala.page:151 38260#: C/tooltip.vala.page:40 38261msgid "" 38262"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Toolbar.html\">Gtk.Toolbar</" 38263"link>" 38264msgstr "" 38265 38266#. (itstool) path: item/p 38267#: C/toolbar.vala.page:35 C/toolbar_builder.vala.page:152 38268msgid "" 38269"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.ToolButton.html\">Gtk." 38270"Toolbutton</link>" 38271msgstr "" 38272 38273#. (itstool) path: item/p 38274#: C/toolbar.vala.page:36 C/toolbar_builder.vala.page:153 38275msgid "" 38276"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Stock.html\">Gtk.Stock</" 38277"link>" 38278msgstr "" 38279 38280#. (itstool) path: info/title 38281#: C/toolbar_builder.py.page:8 38282msgctxt "text" 38283msgid "Toolbar created using Glade (Python)" 38284msgstr "" 38285 38286#. (itstool) path: page/title 38287#: C/toolbar_builder.py.page:36 C/toolbar_builder.vala.page:23 38288#, fuzzy 38289msgid "Toolbar created using Glade" 38290msgstr "Quando você começou a usar Glade?" 38291 38292#. (itstool) path: page/p 38293#: C/toolbar_builder.py.page:39 38294msgid "" 38295"This example is similar to <link xref=\"toolbar.py\"/>, except we use Glade " 38296"to create the toolbar in an XML .ui file." 38297msgstr "" 38298 38299#. (itstool) path: section/title 38300#: C/toolbar_builder.py.page:44 38301#, fuzzy 38302msgid "Creating the toolbar with Glade" 38303msgstr "Barra de ferramentas" 38304 38305#. (itstool) path: section/p 38306#. (itstool) path: page/p 38307#: C/toolbar_builder.py.page:45 C/toolbar_builder.vala.page:28 38308msgid "" 38309"To create the toolbar using the <link href=\"http://glade.gnome.org/\">Glade " 38310"Interface Designer</link>:" 38311msgstr "" 38312 38313#. (itstool) path: item/p 38314#: C/toolbar_builder.py.page:49 C/toolbar_builder.vala.page:32 38315msgid "Open Glade, and save the file as <file>toolbar_builder.ui</file>" 38316msgstr "" 38317 38318#. (itstool) path: p/media 38319#. This is a reference to an external file such as an image or video. When 38320#. the file changes, the md5 hash will change to let you know you need to 38321#. update your localized copy. The msgstr is not used at all. Set it to 38322#. whatever you like once you have updated your copy of the file. 38323#: C/toolbar_builder.py.page:50 C/toolbar_builder.vala.page:33 38324msgctxt "_" 38325msgid "" 38326"external ref='media/glade_ui.png' md5='baea74fe213bc12ea934f64f6977215a'" 38327msgstr "" 38328"external ref='media/glade_ui.png' md5='baea74fe213bc12ea934f64f6977215a'" 38329 38330#. (itstool) path: item/p 38331#: C/toolbar_builder.py.page:50 C/toolbar_builder.vala.page:33 38332msgid "" 38333"<media type=\"image\" src=\"media/glade_ui.png\" width=\"900\"> Screenshot " 38334"of Glade ui </media>" 38335msgstr "" 38336 38337#. (itstool) path: item/p 38338#: C/toolbar_builder.py.page:55 C/toolbar_builder.vala.page:38 38339msgid "" 38340"Under <gui>Containers</gui> on the left hand side, right click on the " 38341"toolbar icon and select <gui>Add widget as toplevel</gui>." 38342msgstr "" 38343 38344#. (itstool) path: p/media 38345#. This is a reference to an external file such as an image or video. When 38346#. the file changes, the md5 hash will change to let you know you need to 38347#. update your localized copy. The msgstr is not used at all. Set it to 38348#. whatever you like once you have updated your copy of the file. 38349#: C/toolbar_builder.py.page:56 C/toolbar_builder.vala.page:39 38350msgctxt "_" 38351msgid "" 38352"external ref='media/glade_select_toolbar.png' " 38353"md5='f7b5b224050b2e387eb04362fc99df00'" 38354msgstr "" 38355 38356#. (itstool) path: item/p 38357#: C/toolbar_builder.py.page:56 C/toolbar_builder.vala.page:39 38358msgid "" 38359"<media type=\"image\" src=\"media/glade_select_toolbar.png\"> Screenshot of " 38360"toolbar icon in Glade ui </media>" 38361msgstr "" 38362 38363#. (itstool) path: item/p 38364#: C/toolbar_builder.py.page:61 C/toolbar_builder.vala.page:44 38365msgid "" 38366"Under the <gui>General</gui> tab on the bottom right, change the <gui>Name</" 38367"gui> to <input>toolbar</input> and <gui>Show Arrow</gui> to <gui>No</gui>." 38368msgstr "" 38369 38370#. (itstool) path: p/media 38371#. This is a reference to an external file such as an image or video. When 38372#. the file changes, the md5 hash will change to let you know you need to 38373#. update your localized copy. The msgstr is not used at all. Set it to 38374#. whatever you like once you have updated your copy of the file. 38375#: C/toolbar_builder.py.page:62 C/toolbar_builder.vala.page:45 38376msgctxt "_" 38377msgid "" 38378"external ref='media/glade_toolbar_general.png' " 38379"md5='e31daba6e8a3e526aca89d5f1622edaa'" 38380msgstr "" 38381 38382#. (itstool) path: item/p 38383#: C/toolbar_builder.py.page:62 C/toolbar_builder.vala.page:45 38384msgid "" 38385"<media type=\"image\" src=\"media/glade_toolbar_general.png\"> Screenshot of " 38386"General tab </media>" 38387msgstr "" 38388 38389#. (itstool) path: item/p 38390#: C/toolbar_builder.py.page:67 C/toolbar_builder.vala.page:50 38391msgid "" 38392"Under the <gui>Common</gui> tab, set <gui>Horizontal Expand</gui> to " 38393"<gui>Yes</gui>." 38394msgstr "" 38395 38396#. (itstool) path: p/media 38397#. This is a reference to an external file such as an image or video. When 38398#. the file changes, the md5 hash will change to let you know you need to 38399#. update your localized copy. The msgstr is not used at all. Set it to 38400#. whatever you like once you have updated your copy of the file. 38401#: C/toolbar_builder.py.page:68 C/toolbar_builder.vala.page:51 38402msgctxt "_" 38403msgid "" 38404"external ref='media/glade_toolbar_common.png' " 38405"md5='d5ec6cc0218ca98e195dbd033feb9ac5'" 38406msgstr "" 38407 38408#. (itstool) path: item/p 38409#: C/toolbar_builder.py.page:68 C/toolbar_builder.vala.page:51 38410msgid "" 38411"<media type=\"image\" src=\"media/glade_toolbar_common.png\"> Screenshot of " 38412"Common tab </media>" 38413msgstr "" 38414 38415#. (itstool) path: item/p 38416#: C/toolbar_builder.py.page:73 C/toolbar_builder.vala.page:56 38417msgid "" 38418"Right click on the toolbar in the top right and select <gui>Edit</gui>. The " 38419"<gui>Tool Bar Editor</gui> window will appear." 38420msgstr "" 38421 38422#. (itstool) path: p/media 38423#. This is a reference to an external file such as an image or video. When 38424#. the file changes, the md5 hash will change to let you know you need to 38425#. update your localized copy. The msgstr is not used at all. Set it to 38426#. whatever you like once you have updated your copy of the file. 38427#: C/toolbar_builder.py.page:74 C/toolbar_builder.vala.page:57 38428msgctxt "_" 38429msgid "" 38430"external ref='media/glade_toolbar_edit.png' " 38431"md5='feb1e2b7040d24a4d030f94cf07c81fd'" 38432msgstr "" 38433 38434#. (itstool) path: item/p 38435#: C/toolbar_builder.py.page:74 C/toolbar_builder.vala.page:57 38436msgid "" 38437"<media type=\"image\" src=\"media/glade_toolbar_edit.png\"> Screenshot of " 38438"where to right click to edit toolbar. </media>" 38439msgstr "" 38440 38441#. (itstool) path: item/p 38442#: C/toolbar_builder.py.page:79 C/toolbar_builder.vala.page:62 38443msgid "" 38444"We want to add 5 ToolButtons: New, Open, Undo, Fullscreen and Leave " 38445"Fullscreen. First, we will add the New ToolButton." 38446msgstr "" 38447 38448#. (itstool) path: item/p 38449#: C/toolbar_builder.py.page:82 C/toolbar_builder.vala.page:65 38450msgid "Under <gui>Hierarchy</gui> tab, click <gui>Add</gui>." 38451msgstr "" 38452 38453#. (itstool) path: item/p 38454#: C/toolbar_builder.py.page:83 C/toolbar_builder.vala.page:66 38455msgid "Change the name of the ToolItem to <input>new_button</input>." 38456msgstr "" 38457 38458#. (itstool) path: item/p 38459#: C/toolbar_builder.py.page:84 C/toolbar_builder.vala.page:67 38460msgid "" 38461"Scroll down and set <gui>Is important</gui> to <gui>Yes</gui>. This will " 38462"cause the label of the ToolButton to be shown, when you view the toolbar." 38463msgstr "" 38464 38465#. (itstool) path: item/p 38466#: C/toolbar_builder.py.page:85 C/toolbar_builder.vala.page:68 38467msgid "Enter the <gui>action name</gui>: <input>app.new</input>." 38468msgstr "" 38469 38470#. (itstool) path: item/p 38471#: C/toolbar_builder.py.page:86 C/toolbar_builder.vala.page:69 38472msgid "Change the <gui>Label</gui> to <input>New</input>." 38473msgstr "" 38474 38475#. (itstool) path: item/p 38476#: C/toolbar_builder.py.page:87 C/toolbar_builder.vala.page:70 38477msgid "" 38478"Select the <gui>New</gui> Stock Id from the drop down menu, or type " 38479"<input>gtk-new</input>." 38480msgstr "" 38481 38482#. (itstool) path: item/p 38483#: C/toolbar_builder.py.page:89 C/toolbar_builder.vala.page:72 38484msgid "" 38485"Repeat the above steps for the remaining ToolButtons, with the following " 38486"properties:" 38487msgstr "" 38488 38489#. (itstool) path: td/p 38490#: C/toolbar_builder.py.page:96 C/toolbar_builder.vala.page:79 38491#, fuzzy 38492msgid "Is important" 38493msgstr "É importante" 38494 38495#. (itstool) path: td/p 38496#: C/toolbar_builder.py.page:97 C/toolbar_builder.vala.page:80 38497#, fuzzy 38498msgid "Action name" 38499msgstr "Nome da ação" 38500 38501#. (itstool) path: td/p 38502#: C/toolbar_builder.py.page:99 C/toolbar_builder.vala.page:82 38503#, fuzzy 38504msgid "Stock Id" 38505msgstr "ID de predefinição" 38506 38507#. (itstool) path: td/p 38508#: C/toolbar_builder.py.page:104 C/toolbar_builder.vala.page:87 38509#, fuzzy 38510msgid "open_button" 38511msgstr "" 38512"As ações de notificação não devem duplicar a ação padrão. Por exemplo, uma " 38513"nova notificação de e-mail não precisa incluir um botão Open, uma vez que a " 38514"ação padrão já deve executar essa ação." 38515 38516#. (itstool) path: td/p 38517#: C/toolbar_builder.py.page:105 C/toolbar_builder.py.page:112 38518#: C/toolbar_builder.py.page:119 C/toolbar_builder.py.page:126 38519#: C/toolbar_builder.vala.page:88 C/toolbar_builder.vala.page:95 38520#: C/toolbar_builder.vala.page:102 C/toolbar_builder.vala.page:109 38521#, fuzzy 38522msgid "Yes" 38523msgstr "Sim" 38524 38525#. (itstool) path: td/p 38526#: C/toolbar_builder.py.page:106 C/toolbar_builder.vala.page:89 38527msgid "app.open" 38528msgstr "" 38529 38530#. (itstool) path: td/p 38531#: C/toolbar_builder.py.page:107 C/toolbar_builder.vala.page:90 38532#, fuzzy 38533msgid "Open" 38534msgstr "Abre" 38535 38536#. (itstool) path: td/p 38537#: C/toolbar_builder.py.page:108 C/toolbar_builder.vala.page:91 38538#, fuzzy 38539msgid "gtk-open" 38540msgstr "GTK+" 38541 38542#. (itstool) path: td/p 38543#: C/toolbar_builder.py.page:111 C/toolbar_builder.vala.page:94 38544#, fuzzy 38545msgid "undo_button" 38546msgstr "" 38547"O arquivo será movido para a lixeira e você terá a opção de <gui>Desfazer</" 38548"gui> a exclusão. O botão <gui>Desfazer</gui> aparecerá por poucos segundos. " 38549"Se você selecionar <gui>Desfazer</gui>, o arquivo será restaurado para sua " 38550"localização original." 38551 38552#. (itstool) path: td/p 38553#: C/toolbar_builder.py.page:113 C/toolbar_builder.vala.page:96 38554msgid "win.undo" 38555msgstr "" 38556 38557#. (itstool) path: td/p 38558#: C/toolbar_builder.py.page:114 C/toolbar_builder.vala.page:97 38559#, fuzzy 38560msgid "Undo" 38561msgstr "Desfazer" 38562 38563#. (itstool) path: td/p 38564#: C/toolbar_builder.py.page:115 C/toolbar_builder.vala.page:98 38565#, fuzzy 38566msgid "gtk-undo" 38567msgstr "GTK+" 38568 38569#. (itstool) path: td/p 38570#: C/toolbar_builder.py.page:118 C/toolbar_builder.vala.page:101 38571#, fuzzy 38572msgid "fullscreen_button" 38573msgstr "" 38574"Para ampliar no modo de tela cheia, vá até " 38575"<menuchoice><shortcut><keycap>F11</keycap></shortcut><guimenu>Ver</" 38576"guimenu><guimenuitem>Tela cheia</guimenuitem></menuchoice>. Você também pode " 38577"usar a tecla <keycap>F</keycap> para alternar o modo de tela cheia. Para " 38578"sair do modo de tela cheia, clique no botão <guibutton>Sair da tela cheia</" 38579"guibutton> ou pressione <keycap>Esc</keycap>, <keycap>F11</keycap> ou " 38580"<keycap>F</keycap>." 38581 38582#. (itstool) path: td/p 38583#: C/toolbar_builder.py.page:120 C/toolbar_builder.py.page:127 38584#: C/toolbar_builder.vala.page:103 C/toolbar_builder.vala.page:110 38585msgid "win.fullscreen" 38586msgstr "" 38587 38588#. (itstool) path: td/p 38589#: C/toolbar_builder.py.page:121 C/toolbar_builder.vala.page:104 38590#, fuzzy 38591msgid "Fullscreen" 38592msgstr "Tela cheia" 38593 38594#. (itstool) path: td/p 38595#: C/toolbar_builder.py.page:122 C/toolbar_builder.vala.page:105 38596#, fuzzy 38597msgid "gtk-fullscreen" 38598msgstr "_Tela cheia" 38599 38600#. (itstool) path: td/p 38601#: C/toolbar_builder.py.page:125 C/toolbar_builder.vala.page:108 38602#, fuzzy 38603msgid "leave_fullscreen_button" 38604msgstr "" 38605"Para ampliar no modo de tela cheia, vá até " 38606"<menuchoice><shortcut><keycap>F11</keycap></shortcut><guimenu>Ver</" 38607"guimenu><guimenuitem>Tela cheia</guimenuitem></menuchoice>. Você também pode " 38608"usar a tecla <keycap>F</keycap> para alternar o modo de tela cheia. Para " 38609"sair do modo de tela cheia, clique no botão <guibutton>Sair da tela cheia</" 38610"guibutton> ou pressione <keycap>Esc</keycap>, <keycap>F11</keycap> ou " 38611"<keycap>F</keycap>." 38612 38613#. (itstool) path: td/p 38614#: C/toolbar_builder.py.page:128 C/toolbar_builder.vala.page:111 38615#, fuzzy 38616msgid "Leave Fullscreen" 38617msgstr "Sair do modo tela cheia" 38618 38619#. (itstool) path: td/p 38620#: C/toolbar_builder.py.page:129 C/toolbar_builder.vala.page:112 38621#, fuzzy 38622msgid "gtk-leave-fullscreen" 38623msgstr "_Sair da tela cheia" 38624 38625#. (itstool) path: item/media 38626#. This is a reference to an external file such as an image or video. When 38627#. the file changes, the md5 hash will change to let you know you need to 38628#. update your localized copy. The msgstr is not used at all. Set it to 38629#. whatever you like once you have updated your copy of the file. 38630#: C/toolbar_builder.py.page:133 C/toolbar_builder.vala.page:116 38631msgctxt "_" 38632msgid "" 38633"external ref='media/glade_toolbar_editor.png' " 38634"md5='8af65241e5ca47d5494a7b36640e6f1c'" 38635msgstr "" 38636 38637#. (itstool) path: item/p 38638#: C/toolbar_builder.py.page:138 C/toolbar_builder.vala.page:121 38639msgid "Close the <gui>Tool Bar Editor</gui>." 38640msgstr "" 38641 38642#. (itstool) path: item/p 38643#: C/toolbar_builder.py.page:141 38644msgid "" 38645"When our program will first start, we do not want the <gui>Leave Fullscreen</" 38646"gui> ToolButton to be visible, since the application will not be in " 38647"fullscreen mode. You can set this in the <gui>Common</gui> tab, by clicking " 38648"the <gui>Visible</gui> property to <gui>No</gui>. The ToolButton will still " 38649"appear in the interface designer, but will behave correctly when the file is " 38650"loaded into your program code. Note that the method <code>show_all()</code> " 38651"would override this setting - so in the code we have to use <code>show()</" 38652"code> separately on all the elements." 38653msgstr "" 38654 38655#. (itstool) path: p/media 38656#. This is a reference to an external file such as an image or video. When 38657#. the file changes, the md5 hash will change to let you know you need to 38658#. update your localized copy. The msgstr is not used at all. Set it to 38659#. whatever you like once you have updated your copy of the file. 38660#: C/toolbar_builder.py.page:142 C/toolbar_builder.vala.page:125 38661msgctxt "_" 38662msgid "" 38663"external ref='media/glade_visible_no.png' " 38664"md5='dc6c025aa825f4d772fbd283d6330026'" 38665msgstr "" 38666 38667#. (itstool) path: item/p 38668#: C/toolbar_builder.py.page:142 C/toolbar_builder.vala.page:125 38669msgid "" 38670"<media type=\"image\" src=\"media/glade_visible_no.png\"> Setting the " 38671"visible property to No </media>" 38672msgstr "" 38673 38674#. (itstool) path: item/p 38675#: C/toolbar_builder.py.page:147 C/toolbar_builder.vala.page:130 38676#, fuzzy 38677msgid "Save your work, and close Glade." 38678msgstr "Salve seu arquivo para trabalhar nele posteriormente." 38679 38680#. (itstool) path: item/p 38681#: C/toolbar_builder.py.page:150 C/toolbar_builder.vala.page:133 38682msgid "" 38683"The XML file created by Glade is shown below. This is the description of the " 38684"toolbar. At the time of this writing, the option to add the class Gtk." 38685"STYLE_CLASS_PRIMARY_TOOLBAR in the Glade Interface did not exist. We can " 38686"manually add this to the XML file. To do this, add the following XML code at " 38687"line 9 of <file>toolbar_builder.ui</file>:" 38688msgstr "" 38689 38690#. (itstool) path: item/code 38691#: C/toolbar_builder.py.page:151 C/toolbar_builder.vala.page:134 38692#, no-wrap 38693msgid "" 38694"\n" 38695" <style>\n" 38696" <class name=\"primary-toolbar\"/>\n" 38697" </style>\n" 38698" " 38699msgstr "" 38700 38701#. (itstool) path: item/p 38702#: C/toolbar_builder.py.page:156 C/toolbar_builder.vala.page:139 38703msgid "" 38704"If you do not add this, the program will still work fine. The resulting " 38705"toolbar will however look slightly different then the screenshot at the top " 38706"of this page." 38707msgstr "" 38708 38709#. (itstool) path: section/code 38710#. (itstool) path: page/code 38711#: C/toolbar_builder.py.page:159 C/toolbar_builder.vala.page:142 38712#, no-wrap 38713msgid "" 38714"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 38715"<interface>\n" 38716" <!-- interface-requires gtk+ 3.0 -->\n" 38717" <object class=\"GtkToolbar\" id=\"toolbar\">\n" 38718" <property name=\"visible\">True</property>\n" 38719" <property name=\"can_focus\">False</property>\n" 38720" <property name=\"hexpand\">True</property>\n" 38721" <property name=\"show_arrow\">False</property>\n" 38722" <child>\n" 38723" <object class=\"GtkToolButton\" id=\"new_button\">\n" 38724" <property name=\"use_action_appearance\">False</property>\n" 38725" <property name=\"visible\">True</property>\n" 38726" <property name=\"can_focus\">False</property>\n" 38727" <property name=\"use_action_appearance\">False</property>\n" 38728" <property name=\"is_important\">True</property>\n" 38729" <property name=\"action_name\">app.new</property>\n" 38730" <property name=\"label\" translatable=\"yes\">New</property>\n" 38731" <property name=\"use_underline\">True</property>\n" 38732" <property name=\"stock_id\">gtk-new</property>\n" 38733" </object>\n" 38734" <packing>\n" 38735" <property name=\"expand\">False</property>\n" 38736" <property name=\"homogeneous\">True</property>\n" 38737" </packing>\n" 38738" </child>\n" 38739" <child>\n" 38740" <object class=\"GtkToolButton\" id=\"open_button\">\n" 38741" <property name=\"use_action_appearance\">False</property>\n" 38742" <property name=\"visible\">True</property>\n" 38743" <property name=\"can_focus\">False</property>\n" 38744" <property name=\"use_action_appearance\">False</property>\n" 38745" <property name=\"is_important\">True</property>\n" 38746" <property name=\"action_name\">app.open</property>\n" 38747" <property name=\"label\" translatable=\"yes\">Open</property>\n" 38748" <property name=\"use_underline\">True</property>\n" 38749" <property name=\"stock_id\">gtk-open</property>\n" 38750" </object>\n" 38751" <packing>\n" 38752" <property name=\"expand\">False</property>\n" 38753" <property name=\"homogeneous\">True</property>\n" 38754" </packing>\n" 38755" </child>\n" 38756" <child>\n" 38757" <object class=\"GtkToolButton\" id=\"undo_button\">\n" 38758" <property name=\"use_action_appearance\">False</property>\n" 38759" <property name=\"visible\">True</property>\n" 38760" <property name=\"can_focus\">False</property>\n" 38761" <property name=\"use_action_appearance\">False</property>\n" 38762" <property name=\"is_important\">True</property>\n" 38763" <property name=\"action_name\">win.undo</property>\n" 38764" <property name=\"label\" translatable=\"yes\">Undo</property>\n" 38765" <property name=\"use_underline\">True</property>\n" 38766" <property name=\"stock_id\">gtk-undo</property>\n" 38767" </object>\n" 38768" <packing>\n" 38769" <property name=\"expand\">False</property>\n" 38770" <property name=\"homogeneous\">True</property>\n" 38771" </packing>\n" 38772" </child>\n" 38773" <child>\n" 38774" <object class=\"GtkToolButton\" id=\"fullscreen_button\">\n" 38775" <property name=\"use_action_appearance\">False</property>\n" 38776" <property name=\"visible\">True</property>\n" 38777" <property name=\"can_focus\">False</property>\n" 38778" <property name=\"use_action_appearance\">False</property>\n" 38779" <property name=\"is_important\">True</property>\n" 38780" <property name=\"action_name\">win.fullscreen</property>\n" 38781" <property name=\"label\" translatable=\"yes\">Fullscreen</property>\n" 38782" <property name=\"use_underline\">True</property>\n" 38783" <property name=\"stock_id\">gtk-fullscreen</property>\n" 38784" </object>\n" 38785" <packing>\n" 38786" <property name=\"expand\">False</property>\n" 38787" <property name=\"homogeneous\">True</property>\n" 38788" </packing>\n" 38789" </child>\n" 38790" <child>\n" 38791" <object class=\"GtkToolButton\" id=\"leave_fullscreen_button\">\n" 38792" <property name=\"use_action_appearance\">False</property>\n" 38793" <property name=\"can_focus\">False</property>\n" 38794" <property name=\"use_action_appearance\">False</property>\n" 38795" <property name=\"is_important\">True</property>\n" 38796" <property name=\"action_name\">win.fullscreen</property>\n" 38797" <property name=\"label\" translatable=\"yes\">Leave Fullscreen</property>\n" 38798" <property name=\"use_underline\">True</property>\n" 38799" <property name=\"stock_id\">gtk-leave-fullscreen</property>\n" 38800" </object>\n" 38801" <packing>\n" 38802" <property name=\"expand\">False</property>\n" 38803" <property name=\"homogeneous\">True</property>\n" 38804" </packing>\n" 38805" </child>\n" 38806" </object>\n" 38807"</interface>\n" 38808msgstr "" 38809 38810#. (itstool) path: section/p 38811#. (itstool) path: page/p 38812#: C/toolbar_builder.py.page:166 C/toolbar_builder.vala.page:144 38813msgid "" 38814"We now create the code below, which adds the toolbar from the file we just " 38815"created." 38816msgstr "" 38817 38818#. (itstool) path: section/code 38819#: C/toolbar_builder.py.page:167 38820#, no-wrap 38821msgid "" 38822"from gi.repository import Gtk\n" 38823"from gi.repository import Gdk\n" 38824"from gi.repository import Gio\n" 38825"import sys\n" 38826"\n" 38827"\n" 38828"class MyWindow(Gtk.ApplicationWindow):\n" 38829"\n" 38830" def __init__(self, app):\n" 38831" Gtk.Window.__init__(self, title=\"Toolbar Example\", application=app)\n" 38832" self.set_default_size(400, 200)\n" 38833"\n" 38834" # a grid to attach the toolbar (see below)\n" 38835" grid = Gtk.Grid()\n" 38836" self.add(grid)\n" 38837" # we have to show the grid (and therefore the toolbar) with show(),\n" 38838" # as show_all() would show also the buttons in the toolbar that we want to\n" 38839" # be hidden (such as the leave_fullscreen button)\n" 38840" grid.show()\n" 38841"\n" 38842" # a builder to add the UI designed with Glade to the grid:\n" 38843" builder = Gtk.Builder()\n" 38844" # get the file (if it is there)\n" 38845" try:\n" 38846" builder.add_from_file(\"toolbar_builder.ui\")\n" 38847" except:\n" 38848" print(\"file not found\")\n" 38849" sys.exit()\n" 38850" # and attach it to the grid\n" 38851" grid.attach(builder.get_object(\"toolbar\"), 0, 0, 1, 1)\n" 38852"\n" 38853" # two buttons that will be used later in a method\n" 38854" self.fullscreen_button = builder.get_object(\"fullscreen_button\")\n" 38855" self.leave_fullscreen_button = builder.get_object(\n" 38856" \"leave_fullscreen_button\")\n" 38857"\n" 38858" # create the actions that control the window, connect their signal to a\n" 38859" # callback method (see below), add the action to the window:\n" 38860"\n" 38861" # undo\n" 38862" undo_action = Gio.SimpleAction.new(\"undo\", None)\n" 38863" undo_action.connect(\"activate\", self.undo_callback)\n" 38864" self.add_action(undo_action)\n" 38865"\n" 38866" # and fullscreen\n" 38867" fullscreen_action = Gio.SimpleAction.new(\"fullscreen\", None)\n" 38868" fullscreen_action.connect(\"activate\", self.fullscreen_callback)\n" 38869" self.add_action(fullscreen_action)\n" 38870"\n" 38871" # callback for undo\n" 38872" def undo_callback(self, action, parameter):\n" 38873" print(\"You clicked \\\"Undo\\\".\")\n" 38874"\n" 38875" # callback for fullscreen\n" 38876" def fullscreen_callback(self, action, parameter):\n" 38877" # check if the state is the same as Gdk.WindowState.FULLSCREEN, which\n" 38878" # is a bit flag\n" 38879" is_fullscreen = self.get_window().get_state(\n" 38880" ) & Gdk.WindowState.FULLSCREEN != 0\n" 38881" if is_fullscreen:\n" 38882" self.unfullscreen()\n" 38883" self.leave_fullscreen_button.hide()\n" 38884" self.fullscreen_button.show()\n" 38885" else:\n" 38886" self.fullscreen()\n" 38887" self.fullscreen_button.hide()\n" 38888" self.leave_fullscreen_button.show()\n" 38889"\n" 38890"\n" 38891"class MyApplication(Gtk.Application):\n" 38892"\n" 38893" def __init__(self):\n" 38894" Gtk.Application.__init__(self)\n" 38895"\n" 38896" def do_activate(self):\n" 38897" win = MyWindow(self)\n" 38898" # show the window - with show() not show_all() because that would show also\n" 38899" # the leave_fullscreen button\n" 38900" win.show()\n" 38901"\n" 38902" def do_startup(self):\n" 38903" Gtk.Application.do_startup(self)\n" 38904"\n" 38905" # actions that control the application: create, connect their signal to a\n" 38906" # callback method (see below), add the action to the application\n" 38907"\n" 38908" # new\n" 38909" new_action = Gio.SimpleAction.new(\"new\", None)\n" 38910" new_action.connect(\"activate\", self.new_callback)\n" 38911" app.add_action(new_action)\n" 38912"\n" 38913" # open\n" 38914" open_action = Gio.SimpleAction.new(\"open\", None)\n" 38915" open_action.connect(\"activate\", self.open_callback)\n" 38916" app.add_action(open_action)\n" 38917"\n" 38918" # callback for new\n" 38919" def new_callback(self, action, parameter):\n" 38920" print(\"You clicked \\\"New\\\".\")\n" 38921"\n" 38922" # callback for open\n" 38923" def open_callback(self, action, parameter):\n" 38924" print(\"You clicked \\\"Open\\\".\")\n" 38925"\n" 38926"app = MyApplication()\n" 38927"exit_status = app.run(sys.argv)\n" 38928"sys.exit(exit_status)\n" 38929msgstr "" 38930 38931#. (itstool) path: section/title 38932#: C/toolbar_builder.py.page:172 38933#, fuzzy 38934msgid "Useful methods for Gtk.Builder" 38935msgstr "Métodos úteis" 38936 38937#. (itstool) path: section/p 38938#: C/toolbar_builder.py.page:173 38939msgid "" 38940"For the useful methods for a Toolbar widget, see <link xref=\"toolbar.py\"/>" 38941msgstr "" 38942 38943#. (itstool) path: section/p 38944#: C/toolbar_builder.py.page:175 38945msgid "Gtk.Builder builds an interface from an XML UI definition." 38946msgstr "" 38947 38948#. (itstool) path: item/p 38949#: C/toolbar_builder.py.page:178 38950msgid "" 38951"<code>add_from_file(filename)</code> loads and parses the given file and " 38952"merges it with the current contents of the Gtk.Builder." 38953msgstr "" 38954 38955#. (itstool) path: item/p 38956#: C/toolbar_builder.py.page:179 38957msgid "" 38958"<code>add_from_string(string)</code> parses the given string and merges it " 38959"with the current contents of the Gtk.Builder." 38960msgstr "" 38961 38962#. (itstool) path: item/p 38963#: C/toolbar_builder.py.page:180 38964msgid "" 38965"<code>add_objects_from_file(filename, object_ids)</code> is the same as " 38966"<code>add_from_file()</code>, but it loads only the objects with the ids " 38967"given in the <code>object_id</code>s list." 38968msgstr "" 38969 38970#. (itstool) path: item/p 38971#: C/toolbar_builder.py.page:181 38972msgid "" 38973"<code>add_objects_from_string(string, object_ids)</code> is the same as " 38974"<code>add_from_string()</code>, but it loads only the objects with the ids " 38975"given in the <code>object_id</code>s list." 38976msgstr "" 38977 38978#. (itstool) path: item/p 38979#: C/toolbar_builder.py.page:182 38980msgid "" 38981"<code>get_object(object_id)</code> retrieves the widget with the id " 38982"<code>object_id</code> from the loaded objects in the builder." 38983msgstr "" 38984 38985#. (itstool) path: item/p 38986#: C/toolbar_builder.py.page:183 38987msgid "<code>get_objects()</code> returns all loaded objects." 38988msgstr "" 38989 38990#. (itstool) path: item/p 38991#: C/toolbar_builder.py.page:184 38992msgid "" 38993"<code>connect_signals(handler_object)</code> connects the signals to the " 38994"methods given in the <code>handler_object</code>. This can be any object " 38995"which contains keys or attributes that are called like the signal handler " 38996"names given in the interface description, e.g. a class or a dict. In line 39 " 38997"the signal <code>\"activate\"</code> from the action <code>undo_action</" 38998"code> is connected to the callback function <code>undo_callback()</code> " 38999"using <code><var>action</var>.connect(<var>signal</var>, <var>callback " 39000"function</var>)</code>. See <link xref=\"signals-callbacks.py\"/> for a more " 39001"detailed explanation." 39002msgstr "" 39003 39004#. (itstool) path: info/title 39005#: C/toolbar_builder.vala.page:8 39006msgctxt "text" 39007msgid "Toolbar created using Glade (Vala)" 39008msgstr "" 39009 39010#. (itstool) path: page/p 39011#: C/toolbar_builder.vala.page:26 39012msgid "" 39013"This example is similar to <link xref=\"toolbar.vala\"/>, except we use " 39014"Glade to create the toolbar in an XML ui file." 39015msgstr "" 39016 39017#. (itstool) path: item/p 39018#: C/toolbar_builder.vala.page:124 39019msgid "" 39020"When our program will first start, we don't want the <gui>Leave Fullscreen</" 39021"gui> ToolButton to be visible, since the application will not be in " 39022"fullscreen mode. You can set this in the <gui>Common</gui> tab, by clicking " 39023"the <gui>Visible</gui> property to <gui>No</gui>. The ToolButton will still " 39024"appear in the interface designer, but will behave correctly when the file is " 39025"loaded into your program code." 39026msgstr "" 39027 39028#. (itstool) path: page/code 39029#: C/toolbar_builder.vala.page:145 39030#, no-wrap 39031msgid "" 39032"/* This is the Window */\n" 39033"class MyWindow : Gtk.ApplicationWindow {\n" 39034"\n" 39035"\t/* Declare these two ToolButtons, as we will get them\n" 39036"\t * from the ui file (see lines 32 and 33), so we can\n" 39037"\t * hide() and show() them as needed.*/\n" 39038"\tGtk.ToolButton fullscreen_button;\n" 39039"\tGtk.ToolButton leave_fullscreen_button;\n" 39040"\n" 39041"\t/* Constructor */\n" 39042"\tinternal MyWindow (MyApplication app) {\n" 39043"\t\tObject (application: app, title: \"Toolbar Example\");\n" 39044"\n" 39045"\t\tthis.set_default_size (400, 200);\n" 39046"\t\tvar grid = new Gtk.Grid ();\n" 39047"\t\tthis.add (grid);\n" 39048"\t\tgrid.show ();\n" 39049"\n" 39050"\t\t/* add the toolbar from the ui file */\n" 39051"\t\tvar builder = new Gtk.Builder ();\n" 39052"\t\ttry {\n" 39053"\t\t\tbuilder.add_from_file (\"toolbar_builder.ui\");\n" 39054"\t\t}\n" 39055"\t\t/* Handle the exception */\n" 39056"\t\tcatch (Error e) {\n" 39057"\t\t\terror (\"Unable to load file: %s\", e.message);\n" 39058"\t\t}\n" 39059"\n" 39060"\t\tgrid.attach (builder.get_object (\"toolbar\") as Gtk.Toolbar, 0, 0, 1, 1);\n" 39061"\n" 39062"\t\t/* get these objects from the ui file so we can toggle between them */\n" 39063"\t\tfullscreen_button = builder.get_object (\"fullscreen_button\") as Gtk.ToolButton;\n" 39064"\t\tleave_fullscreen_button = builder.get_object (\"leave_fullscreen_button\") as Gtk.ToolButton;\n" 39065"\n" 39066"\t\t/* create the \"undo\" window action action */\n" 39067"\t\tvar undo_action = new SimpleAction (\"undo\", null);\n" 39068"\t\tundo_action.activate.connect (undo_callback);\n" 39069"\t\tthis.add_action (undo_action);\n" 39070"\n" 39071"\t\t/* create the \"fullscreen\" window action */\n" 39072"\t\tvar fullscreen_action = new SimpleAction (\"fullscreen\", null);\n" 39073"\t\tfullscreen_action.activate.connect (fullscreen_callback);\n" 39074"\t\tthis.add_action (fullscreen_action);\n" 39075"\t}\n" 39076"\n" 39077"\tvoid undo_callback (SimpleAction simple, Variant? parameter) {\n" 39078"\t\t\tprint (\"You clicked \\\"Undo\\\".\\n\");\n" 39079"\t}\n" 39080"\n" 39081"\tvoid fullscreen_callback (SimpleAction simple, Variant? parameter) {\n" 39082"\t\tif ((this.get_window ().get_state () & Gdk.WindowState.FULLSCREEN) != 0) {\n" 39083"\t\t\tthis.unfullscreen ();\n" 39084"\t\t\tleave_fullscreen_button.hide ();\n" 39085"\t\t\tfullscreen_button.show ();\n" 39086"\t\t}\n" 39087"\t\telse {\n" 39088"\t\t\tthis.fullscreen ();\n" 39089"\t\t\tfullscreen_button.hide ();\n" 39090"\t\t\tleave_fullscreen_button.show ();\n" 39091"\t\t}\n" 39092"\t}\n" 39093"}\n" 39094"\n" 39095"/* This is the application */\n" 39096"class MyApplication : Gtk.Application {\n" 39097"\tprotected override void activate () {\n" 39098"\t\tnew MyWindow (this).show ();\n" 39099"\t}\n" 39100"\n" 39101"\tprotected override void startup () {\n" 39102"\t\tbase.startup ();\n" 39103"\n" 39104"\t\t/* Create the \"new\" action and add it to the app*/\n" 39105"\t\tvar new_action = new SimpleAction (\"new\", null);\n" 39106"\t\tnew_action.activate.connect (new_callback);\n" 39107"\t\tthis.add_action (new_action);\n" 39108"\n" 39109"\t\t/* Create the \"open\" action, and add it to the app */\n" 39110"\t\tvar open_action = new SimpleAction (\"open\", null);\n" 39111"\t\topen_action.activate.connect (open_callback);\n" 39112"\t\tthis.add_action (open_action);\n" 39113"\n" 39114"\t\t/* You could also add the action to the app menu\n" 39115"\t\t * if you wanted to.\n" 39116"\t\t */\n" 39117"\t\t//var menu = new Menu ();\n" 39118"\t\t//menu.append (\"New\", \"app.new\");\n" 39119"\t\t//this.app_menu = menu;\n" 39120"\t}\n" 39121"\n" 39122"\tvoid new_callback (SimpleAction action, Variant? parameter) {\n" 39123"\t\tprint (\"You clicked \\\"New\\\".\\n\");\n" 39124"\t}\n" 39125"\n" 39126"\tvoid open_callback (SimpleAction action, Variant? parameter) {\n" 39127"\t\t\tprint (\"You clicked \\\"Open\\\".\\n\");\n" 39128"\t}\n" 39129"}\n" 39130"\n" 39131"/* The main function creates the application and runs it. */\n" 39132"int main (string[] args) {\n" 39133"\treturn new MyApplication ().run (args);\n" 39134"}\n" 39135msgstr "" 39136 39137#. (itstool) path: info/title 39138#: C/tooltip.c.page:8 39139#, fuzzy 39140msgctxt "text" 39141msgid "Tooltip (C)" 39142msgstr "Dica de ferramenta:" 39143 39144#. (itstool) path: info/desc 39145#: C/tooltip.c.page:19 C/tooltip.js.page:19 C/tooltip.py.page:20 39146#: C/tooltip.vala.page:19 39147#, fuzzy 39148msgid "Add tips to your widgets" 39149msgstr "Dicas para seus próximos jogos" 39150 39151#. (itstool) path: page/title 39152#: C/tooltip.c.page:22 C/tooltip.js.page:22 C/tooltip.py.page:23 39153#: C/tooltip.vala.page:22 39154#, fuzzy 39155msgid "Tooltip" 39156msgstr "Dica de ferramenta:" 39157 39158#. (itstool) path: page/media 39159#. This is a reference to an external file such as an image or video. When 39160#. the file changes, the md5 hash will change to let you know you need to 39161#. update your localized copy. The msgstr is not used at all. Set it to 39162#. whatever you like once you have updated your copy of the file. 39163#: C/tooltip.c.page:23 C/tooltip.js.page:23 C/tooltip.py.page:24 39164#: C/tooltip.vala.page:23 39165msgctxt "_" 39166msgid "external ref='media/tooltip.png' md5='41e35860a51e39cb48c71e57bb8fb1d0'" 39167msgstr "" 39168"external ref='media/tooltip.png' md5='41e35860a51e39cb48c71e57bb8fb1d0'" 39169 39170#. (itstool) path: page/p 39171#: C/tooltip.c.page:24 C/tooltip.js.page:24 C/tooltip.py.page:25 39172#: C/tooltip.vala.page:24 39173#, fuzzy 39174msgid "A toolbar with a tooltip (with an image) for a button." 39175msgstr "Clique no botão de marcação na barra de ferramentas." 39176 39177#. (itstool) path: note/p 39178#: C/tooltip.c.page:26 39179msgid "" 39180"This example builds on the <link xref=\"toolbar.c\">Toolbar</link> example." 39181msgstr "" 39182 39183#. (itstool) path: section/code 39184#: C/tooltip.c.page:31 39185#, no-wrap 39186msgid "" 39187"#include <gtk/gtk.h>\n" 39188"\n" 39189"static gboolean \n" 39190"undo_tooltip_callback (GtkStatusIcon *status_icon,\n" 39191" gint x,\n" 39192" gint y,\n" 39193" gboolean keyboard_mode,\n" 39194" GtkTooltip *tooltip,\n" 39195" gpointer user_data)\n" 39196"{\n" 39197" /* set the text for the tooltip */\n" 39198" gtk_tooltip_set_text (tooltip, \"Undo your last action\");\n" 39199" \n" 39200" /* set an icon fot the tooltip */\n" 39201" gtk_tooltip_set_icon_from_stock(tooltip, \"gtk-undo\", GTK_ICON_SIZE_MENU);\n" 39202"\n" 39203" /* show the tooltip */\n" 39204" return TRUE;\n" 39205"}\n" 39206"\n" 39207"\n" 39208"static void\n" 39209"undo_callback (GSimpleAction *simple,\n" 39210" GVariant *parameter,\n" 39211" gpointer user_data)\n" 39212"{\n" 39213" g_print (\"You clicked \\\"Undo\\\".\\n\");\n" 39214"}\n" 39215"\n" 39216"\n" 39217"static void\n" 39218"activate (GtkApplication *app,\n" 39219" gpointer user_data)\n" 39220"{\n" 39221" GtkWidget *grid;\n" 39222" GtkWidget *window;\n" 39223" GtkWidget *toolbar;\n" 39224"\n" 39225" GtkToolItem *new_button;\n" 39226" GtkToolItem *open_button;\n" 39227" GtkToolItem *undo_button;\n" 39228"\n" 39229" GtkStyleContext *style_context;\n" 39230"\n" 39231" GSimpleAction *undo_action;\n" 39232"\n" 39233" window = gtk_application_window_new (app);\n" 39234" gtk_window_set_title (GTK_WINDOW (window), \"Toolbar with Tooltips Example\");\n" 39235" gtk_window_set_default_size (GTK_WINDOW (window), 400, 200);\n" 39236"\n" 39237" /* Here we begin to create the toolbar */\n" 39238" toolbar = gtk_toolbar_new ();\n" 39239"\n" 39240" /* Set the toolbar to be the primary toolbar of the application */\n" 39241" style_context = gtk_widget_get_style_context (toolbar);\n" 39242" gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);\n" 39243"\n" 39244" /* Create a button for the \"new\" action, with a stock image */\n" 39245" new_button = gtk_tool_button_new_from_stock (GTK_STOCK_NEW);\n" 39246" gtk_tool_item_set_is_important (new_button, TRUE);\n" 39247" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), new_button, 0);\n" 39248" gtk_widget_show (GTK_WIDGET (new_button));\n" 39249"\n" 39250" /* Set the action name for the \"new\" action. We use \"app.new\" to\n" 39251" * indicate that the action controls the application.\n" 39252" */\n" 39253" gtk_actionable_set_action_name (GTK_ACTIONABLE (new_button), \"app.new\");\n" 39254"\n" 39255" /*******************************\n" 39256" * Tooltip for the New ToolItem:\n" 39257" * a tooltip with text\n" 39258" *******************************/\n" 39259" gtk_tool_item_set_tooltip_text (new_button, \"Create a new file\"); \n" 39260"\n" 39261" /* \"Open\" */\n" 39262" open_button = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);\n" 39263" gtk_tool_item_set_is_important (open_button, TRUE);\n" 39264" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_button, 1);\n" 39265" gtk_widget_show (GTK_WIDGET (open_button));\n" 39266" gtk_actionable_set_action_name (GTK_ACTIONABLE (open_button), \"app.open\");\n" 39267"\n" 39268" /*******************************\n" 39269" * Tooltip for the Open ToolItem:\n" 39270" * a tooltip using Pango markup \n" 39271" * language\n" 39272" *******************************/\n" 39273" gtk_tool_item_set_tooltip_text (open_button, \"Open an <i>existing</i> file\");\n" 39274"\n" 39275" /* \"Undo\" */\n" 39276" undo_button = gtk_tool_button_new_from_stock (GTK_STOCK_UNDO);\n" 39277" gtk_tool_item_set_is_important (undo_button, TRUE);\n" 39278" gtk_toolbar_insert (GTK_TOOLBAR (toolbar), undo_button, 2);\n" 39279" gtk_widget_show (GTK_WIDGET (undo_button));\n" 39280"\n" 39281" /* In this case, we use \"win.undo\" to indicate that\n" 39282" * the action controls only the window\n" 39283" */\n" 39284" gtk_actionable_set_action_name (GTK_ACTIONABLE (undo_button), \"win.undo\");\n" 39285"\n" 39286" /*******************************\n" 39287" * Tooltip for the Undo ToolItem:\n" 39288" * a tooltip with an image\n" 39289" *******************************/\n" 39290" gtk_widget_set_has_tooltip (GTK_WIDGET (undo_button), TRUE);\n" 39291"\n" 39292" // Next, we connect the query_tooltip signal\n" 39293" g_signal_connect (undo_button, \"query-tooltip\", G_CALLBACK (undo_tooltip_callback), NULL);\n" 39294"\n" 39295" gtk_widget_set_hexpand (toolbar, TRUE);\n" 39296" gtk_widget_show (toolbar);\n" 39297"\n" 39298" grid = gtk_grid_new ();\n" 39299" gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);\n" 39300" gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));\n" 39301" gtk_widget_show (GTK_WIDGET (grid));\n" 39302"\n" 39303" /* Use the action names to create the actions that control the window, and\n" 39304" * connect them to the appropriate callbackfunctions.\n" 39305" */\n" 39306" undo_action = g_simple_action_new (\"undo\", NULL);\n" 39307" g_signal_connect (undo_action, \"activate\", G_CALLBACK (undo_callback),\n" 39308" GTK_WINDOW (window));\n" 39309" g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (undo_action));\n" 39310"\n" 39311" gtk_widget_show (window);\n" 39312"}\n" 39313"\n" 39314"\n" 39315"/* Callback function for the new action */\n" 39316"static void\n" 39317"new_callback (GSimpleAction *simple,\n" 39318" GVariant *parameter,\n" 39319" gpointer user_data)\n" 39320"{\n" 39321" g_print (\"You clicked \\\"New\\\".\\n\");\n" 39322"}\n" 39323"\n" 39324"\n" 39325"/* Callback function for the open action */\n" 39326"static void\n" 39327"open_callback (GSimpleAction *simple,\n" 39328" GVariant *parameter,\n" 39329" gpointer user_data)\n" 39330"{\n" 39331" g_print (\"You clicked \\\"Open\\\".\\n\");\n" 39332"}\n" 39333"\n" 39334"\n" 39335"/* In this function, we create the actions in which control the window, and\n" 39336" * connect their signals to the appropriate callback function.\n" 39337" */\n" 39338"static void\n" 39339"startup (GApplication *app,\n" 39340" gpointer user_data)\n" 39341"{\n" 39342" GSimpleAction *new_action;\n" 39343" GSimpleAction *open_action;\n" 39344"\n" 39345" new_action = g_simple_action_new (\"new\", NULL);\n" 39346" g_signal_connect (new_action, \"activate\", G_CALLBACK (new_callback), app);\n" 39347" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));\n" 39348"\n" 39349" open_action = g_simple_action_new (\"open\", NULL);\n" 39350" g_signal_connect (open_action, \"activate\", G_CALLBACK (open_callback), app);\n" 39351" g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (open_action));\n" 39352"}\n" 39353"\n" 39354"\n" 39355"\n" 39356"/* Startup function for the application */\n" 39357"int\n" 39358"main (int argc, char **argv)\n" 39359"{\n" 39360" GtkApplication *app;\n" 39361" int status;\n" 39362"\n" 39363" app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);\n" 39364" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 39365" g_signal_connect (app, \"startup\", G_CALLBACK (startup), NULL);\n" 39366" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 39367" g_object_unref (app);\n" 39368"\n" 39369" return status;\n" 39370"}\n" 39371msgstr "" 39372 39373#. (itstool) path: item/p 39374#: C/tooltip.c.page:38 C/tooltip.py.page:59 39375#, fuzzy 39376msgid "" 39377"<link href=\"http://developer.gnome.org/gtk3/stable/GtkTooltip.html" 39378"\">GtkTooltip</link>" 39379msgstr "" 39380"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 39381"link>" 39382 39383#. (itstool) path: item/p 39384#: C/tooltip.c.page:40 C/tooltip.py.page:61 39385#, fuzzy 39386msgid "" 39387"<link href=\"http://developer.gnome.org/gtk3/stable/GtkWidget.html" 39388"\">GtkWidget</link>" 39389msgstr "" 39390"<link href=\"http://developer.gnome.org/gtk3/stable/\">Manual de referência</" 39391"link>" 39392 39393#. (itstool) path: item/p 39394#: C/tooltip.c.page:41 C/tooltip.js.page:40 C/tooltip.py.page:62 39395msgid "" 39396"<link href=\"http://developer.gnome.org/gtk3/stable/gtk3-Stock-Items.html" 39397"\">Stock Items</link>" 39398msgstr "" 39399 39400#. (itstool) path: info/title 39401#: C/tooltip.js.page:8 39402#, fuzzy 39403msgctxt "text" 39404msgid "Tooltip (JavaScript)" 39405msgstr "Dica de ferramenta:" 39406 39407#. (itstool) path: note/p 39408#: C/tooltip.js.page:25 39409msgid "" 39410"This example builds on the <link xref=\"toolbar.js\">Toolbar</link> example." 39411msgstr "" 39412 39413#. (itstool) path: section/code 39414#: C/tooltip.js.page:30 39415#, no-wrap 39416msgid "" 39417"//!/usr/bin/gjs\n" 39418"\n" 39419"imports.gi.versions.Gdk = '3.0';\n" 39420"imports.gi.versions.Gtk = '3.0';\n" 39421"\n" 39422"const Gdk = imports.gi.Gdk;\n" 39423"const GLib = imports.gi.GLib;\n" 39424"const Gio = imports.gi.Gio;\n" 39425"const Gtk = imports.gi.Gtk; \n" 39426"\n" 39427"class TooltipExample {\n" 39428" // Create the application \n" 39429" constructor() {\n" 39430" this.application = new Gtk.Application({\n" 39431" application_id: 'org.example.jstooltip'\n" 39432" });\n" 39433"\n" 39434" // Connect 'activate' and 'startup' signals to the callback functions\n" 39435" this.application.connect('activate', this._onActivate.bind(this));\n" 39436" this.application.connect('startup', this._onStartup.bind(this));\n" 39437" }\n" 39438"\n" 39439" // Callback function for 'activate' signal presents windows when active\n" 39440" _onActivate() {\n" 39441" this.window.present();\n" 39442" }\n" 39443"\n" 39444" // Callback function for 'startup' signal builds the UI\n" 39445" _onStartup() {\n" 39446" this._buildUI();\n" 39447" }\n" 39448"\n" 39449" // Build the application's UI\n" 39450" _buildUI() {\n" 39451"\n" 39452" // Create the application window\n" 39453" this.window = new Gtk.ApplicationWindow({\n" 39454" application: this.application,\n" 39455" window_position: Gtk.WindowPosition.CENTER,\n" 39456" title: \"Toolbar with Tooltips Example\",\n" 39457" default_width: 400,\n" 39458" default_height: 200,\n" 39459" border_width: 10\n" 39460" });\n" 39461"\n" 39462" this.grid = new Gtk.Grid();\n" 39463"\n" 39464" this.toolbar = this._createToolbar();\n" 39465" this.toolbar.set_hexpand(true);\n" 39466" this.toolbar.show();\n" 39467"\n" 39468" this.grid.attach(this.toolbar, 0, 0, 1, 1);\n" 39469"\n" 39470" this.window.add(this.grid);\n" 39471"\n" 39472" this._newAction = new Gio.SimpleAction({ name: \"new\" });\n" 39473" this._newAction.connect(\"activate\", this._newCallback.bind(this));\n" 39474" this.window.add_action(this._newAction);\n" 39475"\n" 39476" this._openAction = new Gio.SimpleAction({ name: \"open\" });\n" 39477" this._openAction.connect(\"activate\", this._openCallback.bind(this));\n" 39478" this.window.add_action(this._openAction);\n" 39479"\n" 39480" this._undoAction = new Gio.SimpleAction({ name: \"undo\" });\n" 39481" this._undoAction.connect(\"activate\", this._undoCallback.bind(this));\n" 39482" this.window.add_action(this._undoAction);\n" 39483"\n" 39484" this._fullScreenAction = new Gio.SimpleAction({ name: \"fullscreenToggle\" });\n" 39485" this._fullScreenAction.connect(\"activate\",\n" 39486" this._fullScreenCallback.bind(this));\n" 39487" this.window.add_action(this._fullScreenAction);\n" 39488"\n" 39489" this.window.show_all();\n" 39490" }\n" 39491"\n" 39492" _createToolbar() {\n" 39493" this.toolbar = new Gtk.Toolbar();\n" 39494" this.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n" 39495"\n" 39496" // button for the \"new\" action\n" 39497" this.newButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW);\n" 39498" // with a tooltip with a given text \n" 39499" this.newButton.set_tooltip_text(\"Create a new file\");\n" 39500" this.newButton.set_is_important(true);\n" 39501" this.toolbar.insert(this.newButton, 0);\n" 39502" this.newButton.show();\n" 39503" this.newButton.set_action_name(\"win.new\");\n" 39504"\n" 39505" // button for the \"open\" action\n" 39506" this.openButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN);\n" 39507" // with a tooltip with a given text in the Pango markup language \n" 39508" this.openButton.set_tooltip_markup(\"Open an <i>existing</i> file\");\n" 39509" this.openButton.set_is_important(true);\n" 39510" this.toolbar.insert(this.openButton, 1);\n" 39511" this.openButton.show();\n" 39512" this.openButton.set_action_name(\"win.open\");\n" 39513"\n" 39514" // button for the \"undo\" action\n" 39515" this.undoButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO);\n" 39516" // with a tooltip with an image\n" 39517" // set true the property \"has-tooltip\" \n" 39518" this.undoButton.set_property(\"has-tooltip\", true);\n" 39519" // connect to the callback function that for the tooltip\n" 39520" // with the signal \"query-tooltip\"\n" 39521" this.undoButton.connect(\"query-tooltip\", this._undoTooltipCallback.bind(this));\n" 39522" this.undoButton.set_is_important(true);\n" 39523" this.toolbar.insert(this.undoButton, 2);\n" 39524" this.undoButton.show();\n" 39525" this.undoButton.set_action_name(\"win.undo\");\n" 39526"\n" 39527" // button for the \"fullscreen/leave fullscreen\" action\n" 39528" this.fullscreenButton = Gtk.ToolButton.new_from_stock(Gtk.STOCK_FULLSCREEN);\n" 39529" this.fullscreenButton.set_is_important(true);\n" 39530" this.toolbar.insert(this.fullscreenButton, 3);\n" 39531" this.fullscreenButton.set_action_name(\"win.fullscreenToggle\");\n" 39532"\n" 39533" return this.toolbar;\n" 39534" }\n" 39535"\n" 39536" _newCallback(action, parameter) {\n" 39537" print(\"You clicked \\\"New\\\".\");\n" 39538" }\n" 39539"\n" 39540" _openCallback(action, parameter) {\n" 39541" print(\"You clicked \\\"Open\\\".\");\n" 39542" }\n" 39543"\n" 39544" // the callback function for the tooltip of the \"undo\" button\n" 39545" _undoTooltipCallback(widget, x, y, keyboard_mode, tooltip) {\n" 39546" // set the text for the tooltip\n" 39547" tooltip.set_text(\"Undo your last action\");\n" 39548" // set an icon fot the tooltip\n" 39549" tooltip.set_icon_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.MENU);\n" 39550" // show the tooltip\n" 39551" return true;\n" 39552" }\n" 39553"\n" 39554" _undoCallback(action, parameter) {\n" 39555" print(\"You clicked \\\"Undo\\\".\");\n" 39556" }\n" 39557"\n" 39558" _fullScreenCallback() {\n" 39559" if ((this.window.get_window().get_state() & Gdk.WindowState.FULLSCREEN) != 0 ){\n" 39560" this.fullscreenButton.set_stock_id(Gtk.STOCK_FULLSCREEN);\n" 39561" this.fullscreenButton.set_tooltip_text(\"Make your window fullscreen\");\n" 39562" this.window.unfullscreen();\n" 39563" } else {\n" 39564" this.fullscreenButton.set_stock_id(Gtk.STOCK_LEAVE_FULLSCREEN);\n" 39565" this.fullscreenButton.set_tooltip_text(\"Leave fullscreen\");\n" 39566" this.window.fullscreen();\n" 39567" }\n" 39568" }\n" 39569"};\n" 39570"\n" 39571"// Run the application\n" 39572"let app = new TooltipExample ();\n" 39573"app.application.run (ARGV);\n" 39574msgstr "" 39575 39576#. (itstool) path: item/p 39577#: C/tooltip.js.page:37 39578msgid "" 39579"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Tooltip.html" 39580"\">GtkTooltip</link>" 39581msgstr "" 39582 39583#. (itstool) path: item/p 39584#: C/tooltip.js.page:38 39585msgid "" 39586"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Toolbar.html" 39587"\">GtkToolbar</link>" 39588msgstr "" 39589 39590#. (itstool) path: item/p 39591#: C/tooltip.js.page:39 39592msgid "" 39593"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Widget.html" 39594"\">GtkWidget</link>" 39595msgstr "" 39596 39597#. (itstool) path: info/title 39598#: C/tooltip.py.page:8 39599#, fuzzy 39600msgctxt "text" 39601msgid "Tooltip (Python)" 39602msgstr "_Python" 39603 39604#. (itstool) path: note/p 39605#: C/tooltip.py.page:26 39606msgid "" 39607"This example builds on the <link xref=\"toolbar.py\">Toolbar</link> example." 39608msgstr "" 39609 39610#. (itstool) path: section/code 39611#: C/tooltip.py.page:32 39612#, no-wrap 39613msgid "" 39614"from gi.repository import Gtk\n" 39615"from gi.repository import Gdk\n" 39616"from gi.repository import Gio\n" 39617"import sys\n" 39618"\n" 39619"\n" 39620"class MyWindow(Gtk.ApplicationWindow):\n" 39621"\n" 39622" def __init__(self, app):\n" 39623" Gtk.Window.__init__(\n" 39624" self, title=\"Toolbar with Tooltips Example\", application=app)\n" 39625" self.set_default_size(400, 200)\n" 39626"\n" 39627" grid = Gtk.Grid()\n" 39628"\n" 39629" toolbar = self.create_toolbar()\n" 39630" toolbar.set_hexpand(True)\n" 39631" toolbar.show()\n" 39632"\n" 39633" grid.attach(toolbar, 0, 0, 1, 1)\n" 39634"\n" 39635" self.add(grid)\n" 39636"\n" 39637" undo_action = Gio.SimpleAction.new(\"undo\", None)\n" 39638" undo_action.connect(\"activate\", self.undo_callback)\n" 39639" self.add_action(undo_action)\n" 39640"\n" 39641" fullscreen_action = Gio.SimpleAction.new(\"fullscreen\", None)\n" 39642" fullscreen_action.connect(\"activate\", self.fullscreen_callback)\n" 39643" self.add_action(fullscreen_action)\n" 39644"\n" 39645" def create_toolbar(self):\n" 39646" toolbar = Gtk.Toolbar()\n" 39647" toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)\n" 39648"\n" 39649" # button for the \"new\" action\n" 39650" new_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW)\n" 39651" # with a tooltip with a given text\n" 39652" new_button.set_tooltip_text(\"Create a new file\")\n" 39653" new_button.set_is_important(True)\n" 39654" toolbar.insert(new_button, 0)\n" 39655" new_button.show()\n" 39656" new_button.set_action_name(\"app.new\")\n" 39657"\n" 39658" # button for the \"open\" action\n" 39659" open_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN)\n" 39660" # with a tooltip with a given text in the Pango markup language\n" 39661" open_button.set_tooltip_markup(\"Open an <i>existing</i> file\")\n" 39662" open_button.set_is_important(True)\n" 39663" toolbar.insert(open_button, 1)\n" 39664" open_button.show()\n" 39665" open_button.set_action_name(\"app.open\")\n" 39666"\n" 39667" # button for the \"undo\" action\n" 39668" undo_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_UNDO)\n" 39669" # with a tooltip with an image\n" 39670" # set True the property \"has-tooltip\"\n" 39671" undo_button.set_property(\"has-tooltip\", True)\n" 39672" # connect to the callback function that for the tooltip\n" 39673" # with the signal \"query-tooltip\"\n" 39674" undo_button.connect(\"query-tooltip\", self.undo_tooltip_callback)\n" 39675" undo_button.set_is_important(True)\n" 39676" toolbar.insert(undo_button, 2)\n" 39677" undo_button.show()\n" 39678" undo_button.set_action_name(\"win.undo\")\n" 39679"\n" 39680" # button for the \"fullscreen/leave fullscreen\" action\n" 39681" self.fullscreen_button = Gtk.ToolButton.new_from_stock(\n" 39682" Gtk.STOCK_FULLSCREEN)\n" 39683" self.fullscreen_button.set_is_important(True)\n" 39684" toolbar.insert(self.fullscreen_button, 3)\n" 39685" self.fullscreen_button.set_action_name(\"win.fullscreen\")\n" 39686"\n" 39687" return toolbar\n" 39688"\n" 39689" # the callback function for the tooltip of the \"undo\" button\n" 39690" def undo_tooltip_callback(self, widget, x, y, keyboard_mode, tooltip):\n" 39691" # set the text for the tooltip\n" 39692" tooltip.set_text(\"Undo your last action\")\n" 39693" # set an icon fot the tooltip\n" 39694" tooltip.set_icon_from_stock(\"gtk-undo\", Gtk.IconSize.MENU)\n" 39695" # show the tooltip\n" 39696" return True\n" 39697"\n" 39698" def undo_callback(self, action, parameter):\n" 39699" print(\"You clicked \\\"Undo\\\".\")\n" 39700"\n" 39701" def fullscreen_callback(self, action, parameter):\n" 39702" is_fullscreen = self.get_window().get_state(\n" 39703" ) & Gdk.WindowState.FULLSCREEN != 0\n" 39704" if not is_fullscreen:\n" 39705" self.fullscreen_button.set_stock_id(Gtk.STOCK_LEAVE_FULLSCREEN)\n" 39706" self.fullscreen()\n" 39707" else:\n" 39708" self.fullscreen_button.set_stock_id(Gtk.STOCK_FULLSCREEN)\n" 39709" self.unfullscreen()\n" 39710"\n" 39711"\n" 39712"class MyApplication(Gtk.Application):\n" 39713"\n" 39714" def __init__(self):\n" 39715" Gtk.Application.__init__(self)\n" 39716"\n" 39717" def do_activate(self):\n" 39718" win = MyWindow(self)\n" 39719" win.show_all()\n" 39720"\n" 39721" def do_startup(self):\n" 39722" Gtk.Application.do_startup(self)\n" 39723"\n" 39724" new_action = Gio.SimpleAction.new(\"new\", None)\n" 39725" new_action.connect(\"activate\", self.new_callback)\n" 39726" app.add_action(new_action)\n" 39727"\n" 39728" open_action = Gio.SimpleAction.new(\"open\", None)\n" 39729" open_action.connect(\"activate\", self.open_callback)\n" 39730" app.add_action(open_action)\n" 39731"\n" 39732" def new_callback(self, action, parameter):\n" 39733" print(\"You clicked \\\"New\\\".\")\n" 39734"\n" 39735" def open_callback(self, action, parameter):\n" 39736" print(\"You clicked \\\"Open\\\".\")\n" 39737"\n" 39738"app = MyApplication()\n" 39739"exit_status = app.run(sys.argv)\n" 39740"sys.exit(exit_status)\n" 39741msgstr "" 39742 39743#. (itstool) path: section/title 39744#: C/tooltip.py.page:36 39745#, fuzzy 39746msgid "Useful methods for a Tooltip widget" 39747msgstr "Se o componente tem dica de ferramenta" 39748 39749#. (itstool) path: section/p 39750#: C/tooltip.py.page:38 39751msgid "" 39752"<code>set_tooltip_text(text)</code> and <code>set_tooltip_markup(text)</" 39753"code> can be used to add a tooltip of plain text (or text in the Pango " 39754"Markup Language) to a widget." 39755msgstr "" 39756 39757#. (itstool) path: section/p 39758#: C/tooltip.py.page:39 39759msgid "For more complex tooltips, for instance for a tooltip with an image:" 39760msgstr "" 39761 39762#. (itstool) path: item/p 39763#: C/tooltip.py.page:41 39764msgid "" 39765"Set the <code>\"has-tooltip\"</code> property of the widget to <code>True</" 39766"code>; this will make GTK+ monitor the widget for motion and related events " 39767"which are needed to determine when and where to show a tooltip." 39768msgstr "" 39769 39770#. (itstool) path: item/p 39771#: C/tooltip.py.page:42 39772msgid "" 39773"Connect to the <code>\"query-tooltip\"</code> signal. This signal will be " 39774"emitted when a tooltip is supposed to be shown. One of the arguments passed " 39775"to the signal handler is a GtkTooltip object. This is the object that we are " 39776"about to display as a tooltip, and can be manipulated in your callback using " 39777"functions like <code>set_icon()</code>. There are functions for setting the " 39778"tooltip's markup (<code>set_markup(text)</code>), setting an image from a " 39779"stock icon (<code>set_icon_from_stock(stock_id, size)</code>), or even " 39780"putting in a custom widget (<code>set_custom(widget)</code>)." 39781msgstr "" 39782 39783#. (itstool) path: item/p 39784#: C/tooltip.py.page:43 39785msgid "" 39786"Return <code>True</code> from your query-tooltip handler. This causes the " 39787"tooltip to be show. If you return <code>False</code>, it will not be shown." 39788msgstr "" 39789 39790#. (itstool) path: section/p 39791#: C/tooltip.py.page:46 39792msgid "" 39793"In the probably rare case where you want to have even more control over the " 39794"tooltip that is about to be shown, you can set your own GtkWindow which will " 39795"be used as tooltip window. This works as follows:" 39796msgstr "" 39797 39798#. (itstool) path: item/p 39799#: C/tooltip.py.page:48 39800msgid "" 39801"Set <code>\"has-tooltip\"</code> and connect to <code>\"query-tooltip\"</" 39802"code> as before." 39803msgstr "" 39804 39805#. (itstool) path: item/p 39806#: C/tooltip.py.page:49 39807msgid "" 39808"Use <code>set_tooltip_window()</code> on the widget to set a GtkWindow " 39809"created by you as tooltip window." 39810msgstr "" 39811 39812#. (itstool) path: item/p 39813#: C/tooltip.py.page:50 39814msgid "" 39815"In the <code>\"query-tooltip\"</code> callback you can access your window " 39816"using <code>get_tooltip_window()</code> and manipulate as you wish. The " 39817"semantics of the return value are exactly as before, return <code>True</" 39818"code> to show the window, <code>False</code> to not show it." 39819msgstr "" 39820 39821#. (itstool) path: info/title 39822#: C/tooltip.vala.page:8 39823#, fuzzy 39824msgctxt "text" 39825msgid "Tooltip (Vala)" 39826msgstr "Dica de ferramenta:" 39827 39828#. (itstool) path: note/p 39829#: C/tooltip.vala.page:25 39830msgid "" 39831"This example builds on the <link xref=\"toolbar.vala\">Toolbar</link> " 39832"example." 39833msgstr "" 39834 39835#. (itstool) path: section/code 39836#: C/tooltip.vala.page:31 39837#, no-wrap 39838msgid "" 39839"/* This is the Window */\n" 39840"class MyWindow : Gtk.ApplicationWindow {\n" 39841"\n" 39842"\t/* Instance variables belonging to the window */\n" 39843"\tGtk.Toolbar toolbar;\n" 39844"\tGtk.ToolButton new_button;\n" 39845"\tGtk.ToolButton open_button;\n" 39846"\tGtk.ToolButton undo_button;\n" 39847"\tGtk.ToolButton fullscreen_button;\n" 39848"\tGtk.ToolButton leave_fullscreen_button;\n" 39849"\n" 39850"\t/* Constructor */\n" 39851"\tinternal MyWindow (MyApplication app) {\n" 39852"\t\tObject (application: app, title: \"Toolbar with Tooltips Example\");\n" 39853"\n" 39854"\t\tthis.set_default_size (400, 200);\n" 39855"\t\tvar grid = new Gtk.Grid ();\n" 39856"\t\tthis.add (grid);\n" 39857"\t\tgrid.show ();\n" 39858"\n" 39859"\t\tcreate_toolbar ();\n" 39860"\t\ttoolbar.set_hexpand (true);\n" 39861"\t\tgrid.attach (toolbar, 0, 0, 1, 1);\n" 39862"\t\ttoolbar.show ();\n" 39863"\n" 39864"\t\t/* create the \"undo\" window action action */\n" 39865"\t\tvar undo_action = new SimpleAction (\"undo\", null);\n" 39866"\t\tundo_action.activate.connect (undo_callback);\n" 39867"\t\tthis.add_action (undo_action);\n" 39868"\n" 39869"\t\t/* create the \"fullscreen\" window action */\n" 39870"\t\tvar fullscreen_action = new SimpleAction (\"fullscreen\", null);\n" 39871"\t\tfullscreen_action.activate.connect (fullscreen_callback);\n" 39872"\t\tthis.add_action (fullscreen_action);\n" 39873"\t}\n" 39874"\n" 39875"\t/* Callback for query_tooltip signal */\n" 39876"\tbool undo_tooltip_callback (int x, int y, bool keyboard_tooltip, Gtk.Tooltip tooltip) {\n" 39877"\n" 39878"\t\t/* set the text for the tooltip */\n" 39879" \ttooltip.set_text (\"Undo your last action\");\n" 39880"\t\t\n" 39881"\t\t/* set an icon fot the tooltip */\n" 39882"\t\ttooltip.set_icon_from_stock(\"gtk-undo\", Gtk.IconSize.MENU);\n" 39883"\n" 39884" \t/* show the tooltip */\n" 39885" \treturn true;\n" 39886"\t}\n" 39887"\n" 39888"\t/* This function creates the toolbar, its ToolButtons,\n" 39889"\t * and assigns the actions names to the ToolButtons.*/\n" 39890"\tvoid create_toolbar () {\n" 39891"\t\ttoolbar = new Gtk.Toolbar ();\n" 39892"\t\ttoolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);\n" 39893"\n" 39894"\t\tnew_button = new Gtk.ToolButton.from_stock (Gtk.Stock.NEW);\n" 39895"\n" 39896"\t\t/* tooltip with text */\n" 39897"\t\tnew_button.set_tooltip_text (\"Create a new file\");\n" 39898"\n" 39899"\t\tnew_button.is_important = true; //decides whether to show the label\n" 39900"\t\ttoolbar.add (new_button);\n" 39901"\t\tnew_button.show ();\n" 39902"\t\tnew_button.action_name = \"app.new\";\n" 39903"\n" 39904"\t\topen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.OPEN);\n" 39905"\n" 39906"\t\t/* a tooltip using Pango markup language */\n" 39907"\t\topen_button.set_tooltip_markup (\"Open an <i>existing</i> file\");\n" 39908"\n" 39909"\t\topen_button.is_important = true;\n" 39910"\t\ttoolbar.add (open_button);\n" 39911"\t\topen_button.show ();\n" 39912"\t\topen_button.action_name = \"app.open\";\n" 39913"\n" 39914"\t\tundo_button = new Gtk.ToolButton.from_stock (Gtk.Stock.UNDO);\n" 39915"\t\n" 39916"\t\t/* For a tooltip to have an image, first we must set_has_tooltip to be 'true' */\t\n" 39917"\t\t(undo_button as Gtk.Widget).set_has_tooltip (true);\n" 39918"\n" 39919"\t\t/* Connect the query_tooltip signal to the callback */\n" 39920"\t\tundo_button.query_tooltip.connect (undo_tooltip_callback);\n" 39921"\t\n" 39922"\t\tundo_button.is_important = true;\n" 39923"\t\ttoolbar.add (undo_button);\n" 39924"\t\tundo_button.show ();\n" 39925"\t\tundo_button.action_name = \"win.undo\";\n" 39926"\n" 39927"\t\tfullscreen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.FULLSCREEN);\n" 39928"\t\tfullscreen_button.is_important = true;\n" 39929"\t\ttoolbar.add (fullscreen_button);\n" 39930"\t\tfullscreen_button.show ();\n" 39931"\t\tfullscreen_button.action_name = \"win.fullscreen\";\n" 39932"\n" 39933"\t\tleave_fullscreen_button = new Gtk.ToolButton.from_stock (Gtk.Stock.LEAVE_FULLSCREEN)\n" 39934";\n" 39935"\t\tleave_fullscreen_button.is_important = true;\n" 39936"\t\ttoolbar.add (leave_fullscreen_button);\n" 39937"\n" 39938"\t\tleave_fullscreen_button.action_name = \"win.fullscreen\";\n" 39939"\t}\n" 39940"\n" 39941"\tvoid undo_callback (SimpleAction simple, Variant? parameter) {\n" 39942"\t\t\tprint (\"You clicked \\\"Undo\\\".\\n\");\n" 39943"\t}\n" 39944"\n" 39945"\tvoid fullscreen_callback (SimpleAction simple, Variant? parameter) {\n" 39946"\t\tif ((this.get_window ().get_state () & Gdk.WindowState.FULLSCREEN) != 0) {\n" 39947"\t\t\tthis.unfullscreen ();\n" 39948"\t\t\tleave_fullscreen_button.hide ();\n" 39949"\t\t\tfullscreen_button.show ();\n" 39950"\t\t}\n" 39951"\t\telse {\n" 39952"\t\t\tthis.fullscreen ();\n" 39953"\t\t\tfullscreen_button.hide ();\n" 39954"\t\t\tleave_fullscreen_button.show ();\n" 39955"\t\t}\n" 39956"\t}\n" 39957"}\n" 39958"\n" 39959"/* This is the application */\n" 39960"class MyApplication : Gtk.Application {\n" 39961"\tprotected override void activate () {\n" 39962"\t\tnew MyWindow (this).show ();\n" 39963"\t}\n" 39964"\n" 39965"\tprotected override void startup () {\n" 39966"\t\tbase.startup ();\n" 39967"\n" 39968"\t\t/* Create the \"new\" action and add it to the app*/\n" 39969"\t\tvar new_action = new SimpleAction (\"new\", null);\n" 39970"\t\tnew_action.activate.connect (new_callback);\n" 39971"\t\tthis.add_action (new_action);\n" 39972"\n" 39973"\t\t/* Create the \"open\" action, and add it to the app */\n" 39974"\t\tvar open_action = new SimpleAction (\"open\", null);\n" 39975"\t\topen_action.activate.connect (open_callback);\n" 39976"\t\tthis.add_action (open_action);\n" 39977"\n" 39978"\t\t/* You could also add the action to the app menu\n" 39979"\t\t * if you wanted to.\n" 39980"\t\t */\n" 39981"\t\t//var menu = new Menu ();\n" 39982"\t\t//menu.append (\"New\", \"app.new\");\n" 39983"\t\t//this.app_menu = menu;\n" 39984"\t}\n" 39985"\n" 39986"\tvoid new_callback (SimpleAction action, Variant? parameter) {\n" 39987"\t\tprint (\"You clicked \\\"New\\\".\\n\");\n" 39988"\t}\n" 39989"\n" 39990"\tvoid open_callback (SimpleAction action, Variant? parameter) {\n" 39991"\t\t\tprint (\"You clicked \\\"Open\\\".\\n\");\n" 39992"\t}\n" 39993"}\n" 39994"\n" 39995"/* The main function creates the application and runs it. */\n" 39996"int main (string[] args) {\n" 39997"\treturn new MyApplication ().run (args);\n" 39998"}\n" 39999msgstr "" 40000 40001#. (itstool) path: item/p 40002#: C/tooltip.vala.page:39 40003msgid "" 40004"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Tooltip.html\">Gtk.Tooltip</" 40005"link>" 40006msgstr "" 40007 40008#. (itstool) path: item/p 40009#: C/tooltip.vala.page:41 40010msgid "" 40011"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Widget.query_tooltip.html" 40012"\">Gtk.Widget.query_tooltip</link>" 40013msgstr "" 40014 40015#. (itstool) path: item/p 40016#: C/tooltip.vala.page:42 40017msgid "" 40018"<link href=\"https://developer.gnome.org/gtk3/3.4/gtk3-Stock-Items.html#GTK-" 40019"STOCK-UNDO:CAPS\">Stock Items</link>" 40020msgstr "" 40021 40022#. (itstool) path: info/title 40023#: C/treeview_advanced_liststore.py.page:8 40024msgctxt "text" 40025msgid "Simple Treeview with ListStore (Python)" 40026msgstr "" 40027 40028#. (itstool) path: info/desc 40029#: C/treeview_advanced_liststore.py.page:19 40030msgid "A TreeView displaying a ListStore (more complex example)" 40031msgstr "" 40032 40033#. (itstool) path: page/title 40034#: C/treeview_advanced_liststore.py.page:22 40035#, fuzzy 40036msgid "More Complex Treeview with ListStore" 40037msgstr "Funções para números complexos, conversão de base, e outras" 40038 40039#. (itstool) path: page/media 40040#. This is a reference to an external file such as an image or video. When 40041#. the file changes, the md5 hash will change to let you know you need to 40042#. update your localized copy. The msgstr is not used at all. Set it to 40043#. whatever you like once you have updated your copy of the file. 40044#: C/treeview_advanced_liststore.py.page:23 40045msgctxt "_" 40046msgid "" 40047"external ref='media/treeview_advanced_liststore.png' " 40048"md5='102b512197fb9aa4ed9a16462f6af911'" 40049msgstr "" 40050 40051#. (itstool) path: page/p 40052#: C/treeview_advanced_liststore.py.page:24 40053#: C/treeview_simple_liststore.py.page:25 40054msgid "" 40055"This TreeView displays a simple ListStore with the selection \"changed\" " 40056"signal connected." 40057msgstr "" 40058 40059#. (itstool) path: section/code 40060#: C/treeview_advanced_liststore.py.page:31 40061#, no-wrap 40062msgid "" 40063"from gi.repository import Gtk\n" 40064"from gi.repository import Pango\n" 40065"import sys\n" 40066"\n" 40067"list_of_dvd = [[\"The Usual Suspects\"],\n" 40068" [\"Gilda\"],\n" 40069" [\"The Godfather\"],\n" 40070" [\"Pulp Fiction\"],\n" 40071" [\"Once Upon a Time in the West\"],\n" 40072" [\"Rear Window\"]]\n" 40073"\n" 40074"\n" 40075"class MyWindow(Gtk.ApplicationWindow):\n" 40076"\n" 40077" def __init__(self, app):\n" 40078" Gtk.Window.__init__(self, title=\"My DVDs\", application=app)\n" 40079" self.set_default_size(250, 100)\n" 40080" self.set_border_width(10)\n" 40081"\n" 40082" # the data are stored in the model\n" 40083" # create a liststore with one column\n" 40084" self.listmodel = Gtk.ListStore(str)\n" 40085" for i in range(len(list_of_dvd)):\n" 40086" self.listmodel.append(list_of_dvd[i])\n" 40087"\n" 40088" # a treeview to see the data stored in the model\n" 40089" view = Gtk.TreeView(model=self.listmodel)\n" 40090"\n" 40091" # cellrenderer for the first column\n" 40092" cell = Gtk.CellRendererText()\n" 40093" # the first column is created\n" 40094" col = Gtk.TreeViewColumn(\"Title\", cell, text=0)\n" 40095" # and it is appended to the treeview\n" 40096" view.append_column(col)\n" 40097"\n" 40098" # when a row of the treeview is selected, it emits a signal\n" 40099" self.selection = view.get_selection()\n" 40100" self.selection.connect(\"changed\", self.on_changed)\n" 40101"\n" 40102" # the label we use to show the selection\n" 40103" self.label = Gtk.Label()\n" 40104" self.label.set_text(\"\")\n" 40105"\n" 40106" # a button to add new titles, connected to a callback function\n" 40107" self.button_add = Gtk.Button(label=\"Add\")\n" 40108" self.button_add.connect(\"clicked\", self.add_cb)\n" 40109"\n" 40110" # an entry to enter titles\n" 40111" self.entry = Gtk.Entry()\n" 40112"\n" 40113" # a button to remove titles, connected to a callback function\n" 40114" self.button_remove = Gtk.Button(label=\"Remove\")\n" 40115" self.button_remove.connect(\"clicked\", self.remove_cb)\n" 40116"\n" 40117" # a button to remove all titles, connected to a callback function\n" 40118" self.button_remove_all = Gtk.Button(label=\"Remove All\")\n" 40119" self.button_remove_all.connect(\"clicked\", self.remove_all_cb)\n" 40120"\n" 40121" # a grid to attach the widgets\n" 40122" grid = Gtk.Grid()\n" 40123" grid.attach(view, 0, 0, 4, 1)\n" 40124" grid.attach(self.label, 0, 1, 4, 1)\n" 40125" grid.attach(self.button_add, 0, 2, 1, 1)\n" 40126" grid.attach_next_to(\n" 40127" self.entry, self.button_add, Gtk.PositionType.RIGHT, 1, 1)\n" 40128" grid.attach_next_to(\n" 40129" self.button_remove, self.entry, Gtk.PositionType.RIGHT, 1, 1)\n" 40130" grid.attach_next_to(\n" 40131" self.button_remove_all, self.button_remove, Gtk.PositionType.RIGHT, 1, 1)\n" 40132"\n" 40133" # add the grid to the window\n" 40134" self.add(grid)\n" 40135"\n" 40136" def on_changed(self, selection):\n" 40137" # get the model and the iterator that points at the data in the model\n" 40138" (model, iter) = selection.get_selected()\n" 40139" # set the label to a new value depending on the selection, if there is\n" 40140" # one\n" 40141" if iter is not None:\n" 40142" self.label.set_text(\"\\n %s\" % (model[iter][0]))\n" 40143" else:\n" 40144" self.label.set_text(\"\")\n" 40145" return True\n" 40146"\n" 40147" # callback function for the \"Add\" button\n" 40148" def add_cb(self, button):\n" 40149" # append to the model the title that is in the entry\n" 40150" title = self.entry.get_text()\n" 40151" self.listmodel.append([title])\n" 40152" # and print a message in the terminal\n" 40153" print(\"%s has been added\" % (title))\n" 40154"\n" 40155" def remove_cb(self, button):\n" 40156" # if there is still an entry in the model\n" 40157" if len(self.listmodel) != 0:\n" 40158" # get the selection\n" 40159" (model, iter) = self.selection.get_selected()\n" 40160" # if there is a selection, print a message in the terminal\n" 40161" # and remove it from the model\n" 40162" if iter is not None:\n" 40163" print(\"%s has been removed\" % (model[iter][0]))\n" 40164" self.listmodel.remove(iter)\n" 40165" # otherwise, ask the user to select something to remove\n" 40166" else:\n" 40167" print(\"Select a title to remove\")\n" 40168" # else, if there are no entries in the model, print \"Empty list\"\n" 40169" # in the terminal\n" 40170" else:\n" 40171" print(\"Empty list\")\n" 40172"\n" 40173" def remove_all_cb(self, button):\n" 40174" # if there is still an entry in the model\n" 40175" if len(self.listmodel) != 0:\n" 40176" # remove all the entries in the model\n" 40177" for i in range(len(self.listmodel)):\n" 40178" iter = self.listmodel.get_iter(0)\n" 40179" self.listmodel.remove(iter)\n" 40180" # print a message in the terminal alerting that the model is empty\n" 40181" print(\"Empty list\")\n" 40182"\n" 40183"\n" 40184"class MyApplication(Gtk.Application):\n" 40185"\n" 40186" def __init__(self):\n" 40187" Gtk.Application.__init__(self)\n" 40188"\n" 40189" def do_activate(self):\n" 40190" win = MyWindow(self)\n" 40191" win.show_all()\n" 40192"\n" 40193" def do_startup(self):\n" 40194" Gtk.Application.do_startup(self)\n" 40195"\n" 40196"app = MyApplication()\n" 40197"exit_status = app.run(sys.argv)\n" 40198"sys.exit(exit_status)\n" 40199msgstr "" 40200 40201#. (itstool) path: section/title 40202#: C/treeview_advanced_liststore.py.page:35 40203#: C/treeview_cellrenderertoggle.py.page:35 40204#: C/treeview_simple_liststore.py.page:36 C/treeview_treestore.py.page:36 40205#, fuzzy 40206msgid "Useful methods for a TreeView widget" 40207msgstr "Widget de visualização em árvore" 40208 40209#. (itstool) path: section/p 40210#: C/treeview_advanced_liststore.py.page:36 40211#: C/treeview_cellrenderertoggle.py.page:36 C/treeview_treestore.py.page:37 40212msgid "" 40213"The TreeView widget is designed around a <em>Model/View/Controller</em> " 40214"design: the <em>Model</em> stores the data; the <em>View</em> gets change " 40215"notifications and displays the content of the model; the <em>Controller</" 40216"em>, finally, changes the state of the model and notifies the view of these " 40217"changes. For more information and for a list of useful methods for TreeModel " 40218"see <link xref=\"model-view-controller.py\"/>." 40219msgstr "" 40220 40221#. (itstool) path: section/p 40222#: C/treeview_advanced_liststore.py.page:37 40223msgid "" 40224"In line 36 the <code>\"changed\"</code> signal is connected to the callback " 40225"function <code>on_changed()</code> using <code><var>widget</var>." 40226"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 40227"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 40228msgstr "" 40229 40230#. (itstool) path: info/title 40231#: C/treeview_cellrenderertoggle.py.page:8 C/treeview_treestore.py.page:8 40232#, fuzzy 40233msgctxt "text" 40234msgid "TreeView with TreeStore (Python)" 40235msgstr "TreeView – TreeStore" 40236 40237#. (itstool) path: info/desc 40238#: C/treeview_cellrenderertoggle.py.page:19 40239msgid "" 40240"A TreeView displaying a TreeStore (more complex example, with " 40241"CellRendererToggle)" 40242msgstr "" 40243 40244#. (itstool) path: page/title 40245#: C/treeview_cellrenderertoggle.py.page:22 40246#, fuzzy 40247msgid "More Complex TreeView with TreeStore" 40248msgstr "TreeView – TreeStore" 40249 40250#. (itstool) path: page/media 40251#. This is a reference to an external file such as an image or video. When 40252#. the file changes, the md5 hash will change to let you know you need to 40253#. update your localized copy. The msgstr is not used at all. Set it to 40254#. whatever you like once you have updated your copy of the file. 40255#: C/treeview_cellrenderertoggle.py.page:23 40256msgctxt "_" 40257msgid "" 40258"external ref='media/treeview_cellrenderertoggle.png' " 40259"md5='ade9b9437f8f83150acf37610dab834d'" 40260msgstr "" 40261 40262#. (itstool) path: page/p 40263#: C/treeview_cellrenderertoggle.py.page:24 40264msgid "" 40265"This TreeView displays a TreeStore with two columns, one of which is " 40266"rendered as a toggle." 40267msgstr "" 40268 40269#. (itstool) path: section/code 40270#: C/treeview_cellrenderertoggle.py.page:31 40271#, no-wrap 40272msgid "" 40273"from gi.repository import Gtk\n" 40274"from gi.repository import Pango\n" 40275"import sys\n" 40276"\n" 40277"books = [[\"Tolstoy, Leo\", [\"War and Peace\", True], [\"Anna Karenina\", False]],\n" 40278" [\"Shakespeare, William\", [\"Hamlet\", False],\n" 40279" [\"Macbeth\", True], [\"Othello\", False]],\n" 40280" [\"Tolkien, J.R.R.\", [\"The Lord of the Rings\", False]]]\n" 40281"\n" 40282"\n" 40283"class MyWindow(Gtk.ApplicationWindow):\n" 40284"\n" 40285" def __init__(self, app):\n" 40286" Gtk.Window.__init__(self, title=\"Library\", application=app)\n" 40287" self.set_default_size(250, 100)\n" 40288" self.set_border_width(10)\n" 40289"\n" 40290" # the data are stored in the model\n" 40291" # create a treestore with two columns\n" 40292" self.store = Gtk.TreeStore(str, bool)\n" 40293" # fill in the model\n" 40294" for i in range(len(books)):\n" 40295" # the iter piter is returned when appending the author in the first column\n" 40296" # and False in the second\n" 40297" piter = self.store.append(None, [books[i][0], False])\n" 40298" # append the books and the associated boolean value as children of\n" 40299" # the author\n" 40300" j = 1\n" 40301" while j < len(books[i]):\n" 40302" self.store.append(piter, books[i][j])\n" 40303" j += 1\n" 40304"\n" 40305" # the treeview shows the model\n" 40306" # create a treeview on the model self.store\n" 40307" view = Gtk.TreeView()\n" 40308" view.set_model(self.store)\n" 40309"\n" 40310" # the cellrenderer for the first column - text\n" 40311" renderer_books = Gtk.CellRendererText()\n" 40312" # the first column is created\n" 40313" column_books = Gtk.TreeViewColumn(\"Books\", renderer_books, text=0)\n" 40314" # and it is appended to the treeview\n" 40315" view.append_column(column_books)\n" 40316"\n" 40317" # the cellrenderer for the second column - boolean rendered as a toggle\n" 40318" renderer_in_out = Gtk.CellRendererToggle()\n" 40319" # the second column is created\n" 40320" column_in_out = Gtk.TreeViewColumn(\"Out?\", renderer_in_out, active=1)\n" 40321" # and it is appended to the treeview\n" 40322" view.append_column(column_in_out)\n" 40323" # connect the cellrenderertoggle with a callback function\n" 40324" renderer_in_out.connect(\"toggled\", self.on_toggled)\n" 40325"\n" 40326" # add the treeview to the window\n" 40327" self.add(view)\n" 40328"\n" 40329" # callback function for the signal emitted by the cellrenderertoggle\n" 40330" def on_toggled(self, widget, path):\n" 40331" # the boolean value of the selected row\n" 40332" current_value = self.store[path][1]\n" 40333" # change the boolean value of the selected row in the model\n" 40334" self.store[path][1] = not current_value\n" 40335" # new current value!\n" 40336" current_value = not current_value\n" 40337" # if length of the path is 1 (that is, if we are selecting an author)\n" 40338" if len(path) == 1:\n" 40339" # get the iter associated with the path\n" 40340" piter = self.store.get_iter(path)\n" 40341" # get the iter associated with its first child\n" 40342" citer = self.store.iter_children(piter)\n" 40343" # while there are children, change the state of their boolean value\n" 40344" # to the value of the author\n" 40345" while citer is not None:\n" 40346" self.store[citer][1] = current_value\n" 40347" citer = self.store.iter_next(citer)\n" 40348" # if the length of the path is not 1 (that is, if we are selecting a\n" 40349" # book)\n" 40350" elif len(path) != 1:\n" 40351" # get the first child of the parent of the book (the first book of\n" 40352" # the author)\n" 40353" citer = self.store.get_iter(path)\n" 40354" piter = self.store.iter_parent(citer)\n" 40355" citer = self.store.iter_children(piter)\n" 40356" # check if all the children are selected\n" 40357" all_selected = True\n" 40358" while citer is not None:\n" 40359" if self.store[citer][1] == False:\n" 40360" all_selected = False\n" 40361" break\n" 40362" citer = self.store.iter_next(citer)\n" 40363" # if they do, the author as well is selected; otherwise it is not\n" 40364" self.store[piter][1] = all_selected\n" 40365"\n" 40366"\n" 40367"class MyApplication(Gtk.Application):\n" 40368"\n" 40369" def __init__(self):\n" 40370" Gtk.Application.__init__(self)\n" 40371"\n" 40372" def do_activate(self):\n" 40373" win = MyWindow(self)\n" 40374" win.show_all()\n" 40375"\n" 40376" def do_startup(self):\n" 40377" Gtk.Application.do_startup(self)\n" 40378"\n" 40379"app = MyApplication()\n" 40380"exit_status = app.run(sys.argv)\n" 40381"sys.exit(exit_status)\n" 40382msgstr "" 40383 40384#. (itstool) path: section/p 40385#: C/treeview_cellrenderertoggle.py.page:37 40386msgid "" 40387"In line 48 the <code>\"toggled\"</code> signal is connected to the callback " 40388"function <code>on_toggled()</code> using <code><var>widget</var>." 40389"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 40390"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 40391msgstr "" 40392 40393#. (itstool) path: item/p 40394#: C/treeview_cellrenderertoggle.py.page:46 C/treeview_treestore.py.page:46 40395msgid "" 40396"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkTreeStore.html" 40397"\">GtkTreeStore</link>" 40398msgstr "" 40399 40400#. (itstool) path: item/p 40401#: C/treeview_cellrenderertoggle.py.page:48 40402msgid "" 40403"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkCellRendererToggle." 40404"html\">GtkCellRendererToggle</link>" 40405msgstr "" 40406 40407#. (itstool) path: info/title 40408#: C/treeview_simple_liststore.js.page:8 40409#, fuzzy 40410msgctxt "text" 40411msgid "TreeView with ListStore (JavaScript)" 40412msgstr "Widget de visualização em árvore" 40413 40414#. (itstool) path: info/desc 40415#: C/treeview_simple_liststore.js.page:21 40416msgid "A widget that shows a separate list of items" 40417msgstr "" 40418 40419#. (itstool) path: page/title 40420#: C/treeview_simple_liststore.js.page:24 40421#, fuzzy 40422msgid "TreeView with ListStore" 40423msgstr "TreeView – TreeStore" 40424 40425#. (itstool) path: page/media 40426#. This is a reference to an external file such as an image or video. When 40427#. the file changes, the md5 hash will change to let you know you need to 40428#. update your localized copy. The msgstr is not used at all. Set it to 40429#. whatever you like once you have updated your copy of the file. 40430#: C/treeview_simple_liststore.js.page:25 40431msgctxt "_" 40432msgid "" 40433"external ref='media/treeview_simple_liststore_penguins.png' " 40434"md5='d750a0b9fddf8e508753cc639839871d'" 40435msgstr "" 40436 40437#. (itstool) path: page/p 40438#: C/treeview_simple_liststore.js.page:26 40439msgid "" 40440"A TreeView is like a window onto the contents of either a ListStore or a " 40441"TreeStore. A ListStore is like a spreadsheet: a \"flat\", two-dimensional " 40442"list of things broken up into rows and columns. A TreeStore, meanwhile, can " 40443"branch out in different directions like a tree can. In this example, we " 40444"create a TreeView that shows the contents of a ListStore with (fictitious) " 40445"names and phone numbers in it, and set it so that the <link xref=\"label.js" 40446"\">Label</link> at the bottom of the window shows more information about " 40447"whichever name you click on." 40448msgstr "" 40449 40450#. (itstool) path: page/p 40451#: C/treeview_simple_liststore.js.page:27 40452msgid "" 40453"The TreeView is not just a single widget, but contains a number of smaller " 40454"ones:" 40455msgstr "" 40456 40457#. (itstool) path: item/p 40458#: C/treeview_simple_liststore.js.page:29 40459msgid "" 40460"TreeViewColumn widgets show each (vertical) column of information from the " 40461"ListStore. Each one has a title which can be shown at the top of the column, " 40462"like in the screenshot." 40463msgstr "" 40464 40465#. (itstool) path: item/p 40466#: C/treeview_simple_liststore.js.page:30 40467msgid "" 40468"CellRenderer widgets are \"packed\" into each TreeViewColumn, and contain " 40469"the instructions for how to display each individual \"cell\", or item from " 40470"the ListStore. There are multiple different types, including the " 40471"CellRendererText used here and the CellRendererPixbuf, which displays a " 40472"picture (\"pixel buffer\")." 40473msgstr "" 40474 40475#. (itstool) path: page/p 40476#: C/treeview_simple_liststore.js.page:32 40477msgid "" 40478"Finally, we're going to use an object called a TreeIter, which isn't a " 40479"widget so much as an invisible cursor which points to a (horizontal) row in " 40480"the ListStore. Whenever you click on a name in the phonebook, for instance, " 40481"we create a TreeIter pointing to the row that's selected, and then use that " 40482"to tell the ListStore which entry we want the Label to show more information " 40483"about." 40484msgstr "" 40485 40486#. (itstool) path: note/p 40487#: C/treeview_simple_liststore.js.page:33 40488msgid "" 40489"The TreeView is probably the most complicated Gtk widget, because of how " 40490"many parts it has and how they all have to work together. Give yourself time " 40491"to learn how it works and experiment with it, or try something easier first " 40492"if you're having trouble." 40493msgstr "" 40494 40495#. (itstool) path: section/code 40496#: C/treeview_simple_liststore.js.page:38 40497#, no-wrap 40498msgid "" 40499"\n" 40500"#!/usr/bin/gjs\n" 40501"\n" 40502"const GObject = imports.gi.GObject;\n" 40503"const Gtk = imports.gi.Gtk;\n" 40504"const Lang = imports.lang;\n" 40505"const Pango = imports.gi.Pango;\n" 40506msgstr "" 40507 40508#. (itstool) path: section/code 40509#: C/treeview_simple_liststore.js.page:51 40510#, no-wrap 40511msgid "" 40512"\n" 40513"const TreeViewExample = new Lang.Class({\n" 40514" Name: 'TreeView Example with Simple ListStore',\n" 40515"\n" 40516" // Create the application itself\n" 40517" _init: function() {\n" 40518" this.application = new Gtk.Application({\n" 40519" application_id: 'org.example.jstreeviewsimpleliststore'\n" 40520" });\n" 40521"\n" 40522" // Connect 'activate' and 'startup' signals to the callback functions\n" 40523" this.application.connect('activate', Lang.bind(this, this._onActivate));\n" 40524" this.application.connect('startup', Lang.bind(this, this._onStartup));\n" 40525" },\n" 40526"\n" 40527" // Callback function for 'activate' signal presents window when active\n" 40528" _onActivate: function() {\n" 40529" this._window.present();\n" 40530" },\n" 40531"\n" 40532" // Callback function for 'startup' signal builds the UI\n" 40533" _onStartup: function() {\n" 40534" this._buildUI ();\n" 40535" },\n" 40536msgstr "" 40537 40538#. (itstool) path: section/p 40539#: C/treeview_simple_liststore.js.page:76 40540msgid "" 40541"All the code for this sample goes in the TreeViewExample class. The above " 40542"code creates a <link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/" 40543"Gtk.Application.html\">Gtk.Application</link> for our widgets and window to " 40544"go in." 40545msgstr "" 40546 40547#. (itstool) path: section/code 40548#: C/treeview_simple_liststore.js.page:77 40549#, no-wrap 40550msgid "" 40551"\n" 40552" // Build the application's UI\n" 40553" _buildUI: function() {\n" 40554"\n" 40555" // Create the application window\n" 40556" this._window = new Gtk.ApplicationWindow({\n" 40557" application: this.application,\n" 40558" window_position: Gtk.WindowPosition.CENTER,\n" 40559" default_height: 250,\n" 40560" default_width: 100,\n" 40561" border_width: 20,\n" 40562" title: \"My Phone Book\"});\n" 40563msgstr "" 40564 40565#. (itstool) path: section/code 40566#: C/treeview_simple_liststore.js.page:95 40567#, no-wrap 40568msgid "" 40569"\n" 40570" // Create the underlying liststore for the phonebook\n" 40571" this._listStore = new Gtk.ListStore ();\n" 40572" this._listStore.set_column_types ([\n" 40573" GObject.TYPE_STRING,\n" 40574" GObject.TYPE_STRING,\n" 40575" GObject.TYPE_STRING,\n" 40576" GObject.TYPE_STRING]);\n" 40577msgstr "" 40578 40579#. (itstool) path: section/p 40580#: C/treeview_simple_liststore.js.page:104 40581msgid "" 40582"We first create the ListStore like we would any widget. Then we call its " 40583"set_column_types method, and pass it an array of GObject data types. (We " 40584"could have put the types all on one line, but here we are breaking them up " 40585"to make it easier to read.)" 40586msgstr "" 40587 40588#. (itstool) path: section/p 40589#: C/treeview_simple_liststore.js.page:105 40590msgid "The GObject data types you can use include:" 40591msgstr "" 40592 40593#. (itstool) path: item/p 40594#: C/treeview_simple_liststore.js.page:110 40595#, fuzzy 40596msgid "<file>gtk.gdk.Pixbuf</file> -- A picture" 40597msgstr "Não foi possível salvar a foto em arquivo" 40598 40599#. (itstool) path: section/p 40600#: C/treeview_simple_liststore.js.page:112 40601msgid "" 40602"In this case, we're making a ListStore of four columns, each one containing " 40603"string values." 40604msgstr "" 40605 40606#. (itstool) path: section/code 40607#: C/treeview_simple_liststore.js.page:115 40608#, no-wrap 40609msgid "" 40610"\n" 40611" // Data to go in the phonebook\n" 40612" this.phonebook =\n" 40613" let phonebook =\n" 40614" [{ name: \"Jurg\", surname: \"Billeter\", phone: \"555-0123\",\n" 40615" description: \"A friendly person.\"},\n" 40616" { name: \"Johannes\", surname: \"Schmid\", phone: \"555-1234\",\n" 40617" description: \"Easy phone number to remember.\"},\n" 40618" { name: \"Julita\", surname: \"Inca\", phone: \"555-2345\",\n" 40619" description: \"Another friendly person.\"},\n" 40620" { name: \"Javier\", surname: \"Jardon\", phone: \"555-3456\",\n" 40621" description: \"Bring fish for his penguins.\"},\n" 40622" { name: \"Jason\", surname: \"Clinton\", phone: \"555-4567\",\n" 40623" description: \"His cake's not a lie.\"},\n" 40624" { name: \"Random J.\", surname: \"Hacker\", phone: \"555-5678\",\n" 40625" description: \"Very random!\"}];\n" 40626msgstr "" 40627 40628#. (itstool) path: section/p 40629#: C/treeview_simple_liststore.js.page:132 40630msgid "" 40631"Here we have the information to go in the ListStore. It's an array of " 40632"objects, each one corresponding to a single entry in our phone book." 40633msgstr "" 40634 40635#. (itstool) path: section/p 40636#: C/treeview_simple_liststore.js.page:133 40637msgid "" 40638"Note that the TreeView in the screenshot doesn't actually show the data from " 40639"the \"description\" properties. Instead, that information's shown in the " 40640"Label beneath it, for whichever row that you click on. That's because the " 40641"TreeView and ListStore are two separate things, and a TreeView can show all " 40642"or part of a ListStore, and display what's in it in different ways. You can " 40643"even have multiple widgets show things from the same ListStore, like the " 40644"Label in our example or even a second TreeView." 40645msgstr "" 40646 40647#. (itstool) path: section/code 40648#: C/treeview_simple_liststore.js.page:135 40649#, no-wrap 40650msgid "" 40651"\n" 40652" for (i = 0; i < phonebook.length; i++ ) {\n" 40653" let contact = phonebook [i];\n" 40654" this._listStore.set (this._listStore.append(), [0, 1, 2, 3],\n" 40655" [contact.name, contact.surname, contact.phone, contact.description]);\n" 40656" }\n" 40657msgstr "" 40658 40659#. (itstool) path: section/p 40660#: C/treeview_simple_liststore.js.page:142 40661msgid "" 40662"This <file>for</file> loop puts the strings from our phonebook into our " 40663"ListStore in order. In order, we pass the ListStore's set method the iter " 40664"that points to the correct row, an array which says which columns we want to " 40665"set, and an array which contains the data we want to put into those columns." 40666msgstr "" 40667 40668#. (itstool) path: section/p 40669#: C/treeview_simple_liststore.js.page:143 40670msgid "" 40671"A ListStore's <file>append</file> method adds a horizontal row onto it (it " 40672"starts out with none), and returns a TreeIter pointing to that row like a " 40673"cursor. So by passing <file>this._listStore.append()</file> to the ListStore " 40674"as a property, we're creating a new row and telling the <file>set</file> " 40675"method which row to set data for at the same time." 40676msgstr "" 40677 40678#. (itstool) path: section/title 40679#: C/treeview_simple_liststore.js.page:148 40680#, fuzzy 40681msgid "Creating the TreeView" 40682msgstr "TreeView – TreeStore" 40683 40684#. (itstool) path: section/code 40685#: C/treeview_simple_liststore.js.page:149 40686#, no-wrap 40687msgid "" 40688"\n" 40689" // Create the treeview\n" 40690" this._treeView = new Gtk.TreeView ({\n" 40691" expand: true,\n" 40692" model: this._listStore });\n" 40693msgstr "" 40694 40695#. (itstool) path: section/p 40696#: C/treeview_simple_liststore.js.page:155 40697msgid "" 40698"Here we create a basic TreeView widget, that expands both horizontally and " 40699"vertically to use as much space as needed. We set it to use the ListStore we " 40700"created as its \"model\", or the thing it'll show us stuff from." 40701msgstr "" 40702 40703#. (itstool) path: section/code 40704#: C/treeview_simple_liststore.js.page:157 40705#, no-wrap 40706msgid "" 40707"\n" 40708" // Create the columns for the address book\n" 40709" let firstName = new Gtk.TreeViewColumn ({ title: \"First Name\" });\n" 40710" let lastName = new Gtk.TreeViewColumn ({ title: \"Last Name\" });\n" 40711" let phone = new Gtk.TreeViewColumn ({ title: \"Phone Number\" });\n" 40712msgstr "" 40713 40714#. (itstool) path: section/p 40715#: C/treeview_simple_liststore.js.page:163 40716msgid "" 40717"Now we create each of the vertical TreeViewColumns we'll see in the " 40718"TreeView. The title for each one goes at the top, as you can see in the " 40719"screenshot." 40720msgstr "" 40721 40722#. (itstool) path: section/code 40723#: C/treeview_simple_liststore.js.page:165 40724#, no-wrap 40725msgid "" 40726"\n" 40727" // Create a cell renderer for when bold text is needed\n" 40728" let bold = new Gtk.CellRendererText ({\n" 40729" weight: Pango.Weight.BOLD });\n" 40730"\n" 40731" // Create a cell renderer for normal text\n" 40732" let normal = new Gtk.CellRendererText ();\n" 40733"\n" 40734" // Pack the cell renderers into the columns\n" 40735" firstName.pack_start (bold, true);\n" 40736" lastName.pack_start (normal, true);\n" 40737" phone.pack_start (normal, true);\n" 40738msgstr "" 40739 40740#. (itstool) path: section/p 40741#: C/treeview_simple_liststore.js.page:178 40742msgid "" 40743"Here we create the CellRenderers that we'll use to display the text from our " 40744"ListStore, and pack them into the TreeViewColumns. Each CellRendererText is " 40745"used for all the entries in that column. Our normal CellRendererText just " 40746"creates plain text, while our bold one uses heavier-weight text. We put it " 40747"into the first name column, and tell the other two to use copies of the " 40748"normal one. The \"true\" used as the second parameter for the " 40749"<file>pack_start</file> method tells it to expand the cells when possible, " 40750"instead of keeping them compact." 40751msgstr "" 40752 40753#. (itstool) path: note/p 40754#: C/treeview_simple_liststore.js.page:179 40755msgid "" 40756"<link href=\"http://www.pygtk.org/docs/pygtk/pango-constants.html\">Here is " 40757"a list</link> of other text properties you can use. In order to use these " 40758"Pango constants, make sure to put the line <file>const Pango = imports.gi." 40759"Pango;</file> at the beginning of your code like we did." 40760msgstr "" 40761 40762#. (itstool) path: section/code 40763#: C/treeview_simple_liststore.js.page:181 40764#, no-wrap 40765msgid "" 40766"\n" 40767" firstName.add_attribute (bold, \"text\", 0);\n" 40768" lastName.add_attribute (normal, \"text\", 1);\n" 40769" phone.add_attribute (normal, \"text\", 2);\n" 40770"\n" 40771" // Insert the columns into the treeview\n" 40772" this._treeView.insert_column (firstName, 0);\n" 40773" this._treeView.insert_column (lastName, 1);\n" 40774" this._treeView.insert_column (phone, 2);\n" 40775msgstr "" 40776 40777#. (itstool) path: section/p 40778#: C/treeview_simple_liststore.js.page:191 40779msgid "" 40780"Now that we've put the CellRenderers into the TreeViewColumns, we use the " 40781"<file>add_attribute</file> method to tell each column to pull in text from " 40782"the model our TreeView is set to use; in this case, the ListStore with the " 40783"phonebook." 40784msgstr "" 40785 40786#. (itstool) path: item/p 40787#: C/treeview_simple_liststore.js.page:193 40788msgid "" 40789"The first parameter is which CellRenderer we're going to use to render what " 40790"we're pulling in." 40791msgstr "" 40792 40793#. (itstool) path: item/p 40794#: C/treeview_simple_liststore.js.page:194 40795msgid "" 40796"The second parameter is what kind of information we're going to pull in. In " 40797"this case, we're letting it know that we're rendering text." 40798msgstr "" 40799 40800#. (itstool) path: item/p 40801#: C/treeview_simple_liststore.js.page:195 40802msgid "" 40803"The third parameter is which of the ListStore's columns we're pulling that " 40804"information in from." 40805msgstr "" 40806 40807#. (itstool) path: section/p 40808#: C/treeview_simple_liststore.js.page:197 40809msgid "" 40810"After we've set that up, we use the TreeView's <file>insert_column</file> " 40811"method to put our TreeViewColumns inside it in order. Our TreeView is now " 40812"complete." 40813msgstr "" 40814 40815#. (itstool) path: note/p 40816#: C/treeview_simple_liststore.js.page:198 40817msgid "" 40818"Normally, you might want to use a loop to initialize your TreeView, but in " 40819"this example we're spelling things out step by step for the sake of making " 40820"it easier to understand." 40821msgstr "" 40822 40823#. (itstool) path: section/title 40824#: C/treeview_simple_liststore.js.page:202 40825#, fuzzy 40826msgid "Building the rest of the UI" 40827msgstr "Descanso" 40828 40829#. (itstool) path: section/code 40830#: C/treeview_simple_liststore.js.page:203 40831#, no-wrap 40832msgid "" 40833"\n" 40834" // Create the label that shows details for the name you select\n" 40835" this._label = new Gtk.Label ({ label: \"\" });\n" 40836"\n" 40837" // Get which item is selected\n" 40838" this.selection = this._treeView.get_selection();\n" 40839"\n" 40840" // When something new is selected, call _on_changed\n" 40841" this.selection.connect ('changed', Lang.bind (this, this._onSelectionChanged));\n" 40842msgstr "" 40843 40844#. (itstool) path: section/p 40845#: C/treeview_simple_liststore.js.page:213 40846msgid "" 40847"The TreeView's <file>get_selection</file> method returns an object called a " 40848"TreeSelection. A TreeSelection is like a TreeIter in that it's basically a " 40849"cursor that points at a particular row, except that the one it points to is " 40850"the one that's visibly highlighted as selected." 40851msgstr "" 40852 40853#. (itstool) path: section/p 40854#: C/treeview_simple_liststore.js.page:214 40855msgid "" 40856"After we get the TreeSelection that goes with our TreeView, we ask it to " 40857"tell us when it changes which row it's pointing to. We do this by connecting " 40858"its <file>changed</file> signal to the _onSelectionChanged function we " 40859"wrote. This function changes the text displayed by the Label we just made." 40860msgstr "" 40861 40862#. (itstool) path: section/code 40863#: C/treeview_simple_liststore.js.page:216 40864#, no-wrap 40865msgid "" 40866"\n" 40867" // Create a grid to organize everything in\n" 40868" this._grid = new Gtk.Grid;\n" 40869"\n" 40870" // Attach the treeview and label to the grid\n" 40871" this._grid.attach (this._treeView, 0, 0, 1, 1);\n" 40872" this._grid.attach (this._label, 0, 1, 1, 1);\n" 40873"\n" 40874" // Add the grid to the window\n" 40875" this._window.add (this._grid);\n" 40876"\n" 40877" // Show the window and all child widgets\n" 40878" this._window.show_all();\n" 40879" },\n" 40880msgstr "" 40881 40882#. (itstool) path: section/p 40883#: C/treeview_simple_liststore.js.page:231 40884msgid "" 40885"After we've gotten that out of the way, we create a <link xref=\"grid.js" 40886"\">Grid</link> to put everything in, then add it to our window and tell the " 40887"window to show itself and its contents." 40888msgstr "" 40889 40890#. (itstool) path: section/title 40891#: C/treeview_simple_liststore.js.page:235 40892msgid "Function which handles a changed selection" 40893msgstr "" 40894 40895#. (itstool) path: section/code 40896#: C/treeview_simple_liststore.js.page:237 40897#, no-wrap 40898msgid "" 40899"\n" 40900" _onSelectionChanged: function () {\n" 40901"\n" 40902" // Grab a treeiter pointing to the current selection\n" 40903" let [ isSelected, model, iter ] = this.selection.get_selected();\n" 40904"\n" 40905" // Set the label to read off the values stored in the current selection\n" 40906" this._label.set_label (\"\\n\" +\n" 40907" this._listStore.get_value (iter, 0) + \" \" +\n" 40908" this._listStore.get_value (iter, 1) + \" \" +\n" 40909" this._listStore.get_value (iter, 2) + \"\\n\" +\n" 40910" this._listStore.get_value (iter, 3));\n" 40911"\n" 40912" }\n" 40913"\n" 40914"});\n" 40915msgstr "" 40916 40917#. (itstool) path: section/p 40918#: C/treeview_simple_liststore.js.page:254 40919msgid "" 40920"The line of code with the let statement is a little convoluted, but it's " 40921"nonetheless the best way to get a TreeIter pointing to the same row as our " 40922"TreeSelection. It has to create a couple of other object references, but " 40923"<file>iter</file> is the only one we need." 40924msgstr "" 40925 40926#. (itstool) path: section/p 40927#: C/treeview_simple_liststore.js.page:255 40928msgid "" 40929"After we've done that, we call the Label's <file>set_label</file> function, " 40930"and use the ListStore's <file>get_value</file> function a handful of times " 40931"to fill in the data we want to put in it. Its parameters are a TreeIter " 40932"pointing to the row we want to get data from, and the column." 40933msgstr "" 40934 40935#. (itstool) path: section/p 40936#: C/treeview_simple_liststore.js.page:256 40937msgid "" 40938"Here, we want to get data from all four columns, including the \"hidden\" " 40939"one that's not part of the TreeView. This way, we can use our Label to show " 40940"strings that are too large to fit in the TreeView, and that we don't need to " 40941"see at a glance." 40942msgstr "" 40943 40944#. (itstool) path: section/code 40945#: C/treeview_simple_liststore.js.page:258 40946#, fuzzy, no-wrap 40947msgid "" 40948"\n" 40949"// Run the application\n" 40950"let app = new TreeViewExample ();\n" 40951"app.application.run (ARGV);\n" 40952msgstr "" 40953"\n" 40954"// Executa o aplicativo\n" 40955"let app = new GettingTheSignal ();\n" 40956"app.application.run (ARGV);\n" 40957 40958#. (itstool) path: section/p 40959#: C/treeview_simple_liststore.js.page:263 40960msgid "" 40961"Finally, we create a new instance of the finished TreeViewExample class, and " 40962"set the application running." 40963msgstr "" 40964 40965#. (itstool) path: section/code 40966#: C/treeview_simple_liststore.js.page:268 40967#, no-wrap 40968msgid "" 40969"#!/usr/bin/gjs\n" 40970"\n" 40971"imports.gi.versions.Gtk = '3.0';\n" 40972"\n" 40973"const GObject = imports.gi.GObject;\n" 40974"const Gtk = imports.gi.Gtk;\n" 40975"const Pango = imports.gi.Pango;\n" 40976"\n" 40977"class TreeViewExample {\n" 40978" // Create the application itself\n" 40979" constructor() {\n" 40980" this.application = new Gtk.Application({\n" 40981" application_id: 'org.example.jstreeviewsimpleliststore'\n" 40982" });\n" 40983"\n" 40984" // Connect 'activate' and 'startup' signals to the callback functions\n" 40985" this.application.connect('activate', this._onActivate.bind(this));\n" 40986" this.application.connect('startup', this._onStartup.bind(this));\n" 40987" }\n" 40988"\n" 40989" // Callback function for 'activate' signal presents window when active\n" 40990" _onActivate() {\n" 40991" this._window.present();\n" 40992" }\n" 40993"\n" 40994" // Callback function for 'startup' signal builds the UI\n" 40995" _onStartup() {\n" 40996" this._buildUI();\n" 40997" }\n" 40998"\n" 40999" // Build the application's UI\n" 41000" _buildUI() {\n" 41001" // Create the application window\n" 41002" this._window = new Gtk.ApplicationWindow({\n" 41003" application: this.application,\n" 41004" window_position: Gtk.WindowPosition.CENTER,\n" 41005" default_height: 250,\n" 41006" default_width: 100,\n" 41007" border_width: 20,\n" 41008" title: \"My Phone Book\"});\n" 41009"\n" 41010" // Create the underlying liststore for the phonebook\n" 41011" this._listStore = new Gtk.ListStore ();\n" 41012" this._listStore.set_column_types ([\n" 41013" GObject.TYPE_STRING,\n" 41014" GObject.TYPE_STRING,\n" 41015" GObject.TYPE_STRING,\n" 41016" GObject.TYPE_STRING]);\n" 41017"\n" 41018" // Data to go in the phonebook\n" 41019" let phonebook =\n" 41020" [{ name: \"Jurg\", surname: \"Billeter\", phone: \"555-0123\",\n" 41021" description: \"A friendly person.\"},\n" 41022" { name: \"Johannes\", surname: \"Schmid\", phone: \"555-1234\",\n" 41023" description: \"Easy phone number to remember.\"},\n" 41024" { name: \"Julita\", surname: \"Inca\", phone: \"555-2345\",\n" 41025" description: \"Another friendly person.\"},\n" 41026" { name: \"Javier\", surname: \"Jardon\", phone: \"555-3456\",\n" 41027" description: \"Bring fish for his penguins.\"},\n" 41028" { name: \"Jason\", surname: \"Clinton\", phone: \"555-4567\",\n" 41029" description: \"His cake's not a lie.\"},\n" 41030" { name: \"Random J.\", surname: \"Hacker\", phone: \"555-5678\",\n" 41031" description: \"Very random!\"}];\n" 41032"\n" 41033" // Put the data in the phonebook\n" 41034" for (let i = 0; i < phonebook.length; i++ ) {\n" 41035" let contact = phonebook [i];\n" 41036" this._listStore.set (this._listStore.append(), [0, 1, 2, 3],\n" 41037" [contact.name, contact.surname, contact.phone, contact.description]);\n" 41038" }\n" 41039"\n" 41040" // Create the treeview\n" 41041" this._treeView = new Gtk.TreeView ({\n" 41042" expand: true,\n" 41043" model: this._listStore });\n" 41044"\n" 41045" // Create the columns for the address book\n" 41046" let firstName = new Gtk.TreeViewColumn ({ title: \"First Name\" });\n" 41047" let lastName = new Gtk.TreeViewColumn ({ title: \"Last Name\" });\n" 41048" let phone = new Gtk.TreeViewColumn ({ title: \"Phone Number\" });\n" 41049"\n" 41050" // Create a cell renderer for when bold text is needed\n" 41051" let bold = new Gtk.CellRendererText ({\n" 41052" weight: Pango.Weight.BOLD });\n" 41053"\n" 41054" // Create a cell renderer for normal text\n" 41055" let normal = new Gtk.CellRendererText ();\n" 41056"\n" 41057" // Pack the cell renderers into the columns\n" 41058" firstName.pack_start (bold, true);\n" 41059" lastName.pack_start (normal, true);\n" 41060" phone.pack_start (normal, true);\n" 41061"\n" 41062" // Set each column to pull text from the TreeView's model\n" 41063" firstName.add_attribute (bold, \"text\", 0);\n" 41064" lastName.add_attribute (normal, \"text\", 1);\n" 41065" phone.add_attribute (normal, \"text\", 2);\n" 41066"\n" 41067" // Insert the columns into the treeview\n" 41068" this._treeView.insert_column (firstName, 0);\n" 41069" this._treeView.insert_column (lastName, 1);\n" 41070" this._treeView.insert_column (phone, 2);\n" 41071"\n" 41072" // Create the label that shows details for the name you select\n" 41073" this._label = new Gtk.Label ({ label: \"\" });\n" 41074"\n" 41075" // Get which item is selected\n" 41076" this.selection = this._treeView.get_selection();\n" 41077"\n" 41078" // When something new is selected, call _on_changed\n" 41079" this.selection.connect ('changed', this._onSelectionChanged.bind(this));\n" 41080"\n" 41081" // Create a grid to organize everything in\n" 41082" this._grid = new Gtk.Grid;\n" 41083"\n" 41084" // Attach the treeview and label to the grid\n" 41085" this._grid.attach (this._treeView, 0, 0, 1, 1);\n" 41086" this._grid.attach (this._label, 0, 1, 1, 1);\n" 41087"\n" 41088" // Add the grid to the window\n" 41089" this._window.add (this._grid);\n" 41090"\n" 41091" // Show the window and all child widgets\n" 41092" this._window.show_all();\n" 41093" }\n" 41094"\n" 41095" _onSelectionChanged() {\n" 41096" // Grab a treeiter pointing to the current selection\n" 41097" let [ isSelected, model, iter ] = this.selection.get_selected();\n" 41098"\n" 41099" // Set the label to read off the values stored in the current selection\n" 41100" this._label.set_label (\"\\n\" +\n" 41101" this._listStore.get_value (iter, 0) + \" \" +\n" 41102" this._listStore.get_value (iter, 1) + \" \" +\n" 41103" this._listStore.get_value (iter, 2) + \"\\n\" +\n" 41104" this._listStore.get_value (iter, 3)\n" 41105" );\n" 41106" }\n" 41107"};\n" 41108"\n" 41109"// Run the application\n" 41110"let app = new TreeViewExample ();\n" 41111"app.application.run (ARGV);\n" 41112msgstr "" 41113 41114#. (itstool) path: item/p 41115#: C/treeview_simple_liststore.js.page:282 41116msgid "" 41117"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.TreeSelection." 41118"html\">Gtk.TreeSelection</link>" 41119msgstr "" 41120 41121#. (itstool) path: item/p 41122#: C/treeview_simple_liststore.js.page:283 41123msgid "" 41124"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk.TreeView.html" 41125"\">Gtk.TreeView</link>" 41126msgstr "" 41127 41128#. (itstool) path: item/p 41129#: C/treeview_simple_liststore.js.page:284 41130msgid "" 41131"<link href=\"http://www.roojs.org/seed/gir-1.2-gtk-3.0/gjs/Gtk." 41132"TreeViewColumn.html\">Gtk.TreeViewColumn</link>" 41133msgstr "" 41134 41135#. (itstool) path: info/title 41136#: C/treeview_simple_liststore.py.page:8 41137msgctxt "text" 41138msgid "Simple TreeView with ListStore (Python)" 41139msgstr "" 41140 41141#. (itstool) path: info/desc 41142#: C/treeview_simple_liststore.py.page:20 41143msgid "A TreeView displaying a ListStore (simpler example)" 41144msgstr "" 41145 41146#. (itstool) path: page/title 41147#: C/treeview_simple_liststore.py.page:23 41148#, fuzzy 41149msgid "Simple TreeView with ListStore" 41150msgstr "TreeView – TreeStore" 41151 41152#. (itstool) path: page/media 41153#. This is a reference to an external file such as an image or video. When 41154#. the file changes, the md5 hash will change to let you know you need to 41155#. update your localized copy. The msgstr is not used at all. Set it to 41156#. whatever you like once you have updated your copy of the file. 41157#: C/treeview_simple_liststore.py.page:24 41158#: C/treeview_simple_liststore.vala.page:24 41159msgctxt "_" 41160msgid "" 41161"external ref='media/treeview_simple_liststore.png' " 41162"md5='2dc501a2b95b094da985d37b66aee90c'" 41163msgstr "" 41164 41165#. (itstool) path: section/code 41166#: C/treeview_simple_liststore.py.page:32 41167#, no-wrap 41168msgid "" 41169"from gi.repository import Gtk\n" 41170"from gi.repository import Pango\n" 41171"import sys\n" 41172"\n" 41173"columns = [\"First Name\",\n" 41174" \"Last Name\",\n" 41175" \"Phone Number\"]\n" 41176"\n" 41177"phonebook = [[\"Jurg\", \"Billeter\", \"555-0123\"],\n" 41178" [\"Johannes\", \"Schmid\", \"555-1234\"],\n" 41179" [\"Julita\", \"Inca\", \"555-2345\"],\n" 41180" [\"Javier\", \"Jardon\", \"555-3456\"],\n" 41181" [\"Jason\", \"Clinton\", \"555-4567\"],\n" 41182" [\"Random J.\", \"Hacker\", \"555-5678\"]]\n" 41183"\n" 41184"\n" 41185"class MyWindow(Gtk.ApplicationWindow):\n" 41186"\n" 41187" def __init__(self, app):\n" 41188" Gtk.Window.__init__(self, title=\"My Phone Book\", application=app)\n" 41189" self.set_default_size(250, 100)\n" 41190" self.set_border_width(10)\n" 41191"\n" 41192" # the data in the model (three strings for each row, one for each\n" 41193" # column)\n" 41194" listmodel = Gtk.ListStore(str, str, str)\n" 41195" # append the values in the model\n" 41196" for i in range(len(phonebook)):\n" 41197" listmodel.append(phonebook[i])\n" 41198"\n" 41199" # a treeview to see the data stored in the model\n" 41200" view = Gtk.TreeView(model=listmodel)\n" 41201" # for each column\n" 41202" for i, column in enumerate(columns):\n" 41203" # cellrenderer to render the text\n" 41204" cell = Gtk.CellRendererText()\n" 41205" # the text in the first column should be in boldface\n" 41206" if i == 0:\n" 41207" cell.props.weight_set = True\n" 41208" cell.props.weight = Pango.Weight.BOLD\n" 41209" # the column is created\n" 41210" col = Gtk.TreeViewColumn(column, cell, text=i)\n" 41211" # and it is appended to the treeview\n" 41212" view.append_column(col)\n" 41213"\n" 41214" # when a row is selected, it emits a signal\n" 41215" view.get_selection().connect(\"changed\", self.on_changed)\n" 41216"\n" 41217" # the label we use to show the selection\n" 41218" self.label = Gtk.Label()\n" 41219" self.label.set_text(\"\")\n" 41220"\n" 41221" # a grid to attach the widgets\n" 41222" grid = Gtk.Grid()\n" 41223" grid.attach(view, 0, 0, 1, 1)\n" 41224" grid.attach(self.label, 0, 1, 1, 1)\n" 41225"\n" 41226" # attach the grid to the window\n" 41227" self.add(grid)\n" 41228"\n" 41229" def on_changed(self, selection):\n" 41230" # get the model and the iterator that points at the data in the model\n" 41231" (model, iter) = selection.get_selected()\n" 41232" # set the label to a new value depending on the selection\n" 41233" self.label.set_text(\"\\n %s %s %s\" %\n" 41234" (model[iter][0], model[iter][1], model[iter][2]))\n" 41235" return True\n" 41236"\n" 41237"\n" 41238"class MyApplication(Gtk.Application):\n" 41239"\n" 41240" def __init__(self):\n" 41241" Gtk.Application.__init__(self)\n" 41242"\n" 41243" def do_activate(self):\n" 41244" win = MyWindow(self)\n" 41245" win.show_all()\n" 41246"\n" 41247" def do_startup(self):\n" 41248" Gtk.Application.do_startup(self)\n" 41249"\n" 41250"app = MyApplication()\n" 41251"exit_status = app.run(sys.argv)\n" 41252"sys.exit(exit_status)\n" 41253msgstr "" 41254 41255#. (itstool) path: section/p 41256#: C/treeview_simple_liststore.py.page:37 41257msgid "" 41258"The TreeView widget is designed around a <em>Model/View/Controller</em> " 41259"design: the <em>Model</em> stores the data; the <em>View</em> gets change " 41260"notifications and displays the content of the model; the <em>Controller</" 41261"em>, finally, changes the state of the model and notifies the view of these " 41262"changes. For more information, and for a list of useful methods for " 41263"TreeModel, see <link xref=\"model-view-controller.py\"/>." 41264msgstr "" 41265 41266#. (itstool) path: section/p 41267#: C/treeview_simple_liststore.py.page:38 41268msgid "" 41269"In line 44 the <code>\"changed\"</code> signal is connected to the callback " 41270"function <code>on_changed()</code> using <code><var>widget</var>." 41271"connect(<var>signal</var>, <var>callback function</var>)</code>. See <link " 41272"xref=\"signals-callbacks.py\"/> for a more detailed explanation." 41273msgstr "" 41274 41275#. (itstool) path: item/p 41276#: C/treeview_simple_liststore.py.page:51 41277msgid "" 41278"<link href=\"http://developer.gnome.org/pango/stable/pango-Fonts.html" 41279"\">Fonts</link>" 41280msgstr "" 41281 41282#. (itstool) path: info/title 41283#: C/treeview_simple_liststore.vala.page:8 41284msgctxt "text" 41285msgid "Simple Treeview with ListStore (Vala)" 41286msgstr "" 41287 41288#. (itstool) path: info/desc 41289#: C/treeview_simple_liststore.vala.page:20 41290msgid "A widget can display any TreeModel implementation (lists and trees)" 41291msgstr "" 41292 41293#. (itstool) path: page/title 41294#: C/treeview_simple_liststore.vala.page:23 41295#, fuzzy 41296msgid "Simple Treeview with ListStore" 41297msgstr "TreeView – TreeStore" 41298 41299#. (itstool) path: page/p 41300#: C/treeview_simple_liststore.vala.page:25 41301msgid "" 41302"This TreeView displays a simple ListStore with the Selection \"changed\" " 41303"signal connected." 41304msgstr "" 41305 41306#. (itstool) path: page/code 41307#: C/treeview_simple_liststore.vala.page:27 41308#, no-wrap 41309msgid "" 41310"public class PhoneBookEntry {\n" 41311"\tpublic string firstname;\n" 41312"\tpublic string lastname;\n" 41313"\tpublic string phone;\n" 41314"\n" 41315"\tpublic PhoneBookEntry (string f, string l, string p) {\n" 41316"\t\tthis.firstname = f;\n" 41317"\t\tthis.lastname = l;\n" 41318"\t\tthis.phone = p;\n" 41319"\t}\n" 41320"}\n" 41321"\n" 41322"class TreeViewSimpleListStore : Gtk.ApplicationWindow {\n" 41323"\n" 41324"\tGtk.Label label;\n" 41325"\n" 41326"\tPhoneBookEntry[] phonebook = {\n" 41327"\t\tnew PhoneBookEntry (\"Jurg\", \"Billeter\", \"555-0123\"),\n" 41328"\t\tnew PhoneBookEntry (\"Johannes\", \"Schmid\", \"555-1234\"),\n" 41329"\t\tnew PhoneBookEntry (\"Julita\", \"Inca\", \"555-2345\"),\n" 41330"\t\tnew PhoneBookEntry (\"Javier\", \"Jardon\", \"555-3456\"),\n" 41331"\t\tnew PhoneBookEntry (\"Jason\", \"Clinton\", \"555-4567\"),\n" 41332"\t\tnew PhoneBookEntry (\"Random J.\", \"Hacker\", \"555-5678\")\n" 41333"\t};\n" 41334"\n" 41335"\tenum Column {\n" 41336"\t\tFIRSTNAME,\n" 41337"\t\tLASTNAME,\n" 41338"\t\tPHONE\n" 41339"\t}\n" 41340"\n" 41341"\tinternal TreeViewSimpleListStore (MyApplication app) {\n" 41342"\t\tObject (application: app, title: \"My Phone Book\");\n" 41343"\n" 41344"\t\tthis.set_default_size (250, 100);\n" 41345"\t\tthis.border_width = 10;\n" 41346"\n" 41347"\t\tvar view = new Gtk.TreeView ();\n" 41348"\t\tthis.setup_treeview (view);\n" 41349"\t\tview.expand = true;\n" 41350"\n" 41351"\t\tlabel = new Gtk.Label (\"\");\n" 41352"\n" 41353"\t\tvar grid = new Gtk.Grid ();\n" 41354"\n" 41355"\t\tgrid.attach (view, 0, 0, 1, 1);\n" 41356"\t\tgrid.attach (label, 0, 1, 1, 1);\n" 41357"\t\tthis.add (grid);\n" 41358"\n" 41359"\t\tvar selection = view.get_selection ();\n" 41360"\t\tselection.changed.connect (this.on_changed);\n" 41361"\t}\n" 41362"\n" 41363"\tvoid setup_treeview (Gtk.TreeView view) {\n" 41364"\t\tvar listmodel = new Gtk.ListStore (3, typeof (string),\n" 41365" typeof (string),\n" 41366" typeof (string));\n" 41367"\t\tview.set_model (listmodel);\n" 41368"\n" 41369"\t\tvar cell = new Gtk.CellRendererText ();\n" 41370"\n" 41371"\t\t/* 'weight' refers to font boldness.\n" 41372"\t\t * 400 is normal.\n" 41373"\t\t * 700 is bold.\n" 41374"\t\t */\n" 41375"\t\tcell.set (\"weight_set\", true);\n" 41376"\t\tcell.set (\"weight\", 700);\n" 41377"\n" 41378"\t\t/*columns*/\n" 41379"\t\tview.insert_column_with_attributes (-1, \"First Name\",\n" 41380" cell, \"text\",\n" 41381" Column.FIRSTNAME);\n" 41382"\n" 41383"\t\tview.insert_column_with_attributes (-1, \"Last Name\",\n" 41384" new Gtk.CellRendererText (),\n" 41385" \"text\", Column.LASTNAME);\n" 41386"\n" 41387"\t\tview.insert_column_with_attributes (-1, \"Phone Number\",\n" 41388" new Gtk.CellRendererText (),\n" 41389" \"text\", Column.PHONE);\n" 41390"\n" 41391"\t\t/* Insert the phonebook into the ListStore */\n" 41392"\t\tGtk.TreeIter iter;\n" 41393"\t\tfor (int i = 0; i < phonebook.length; i++) {\n" 41394"\t\t\tlistmodel.append (out iter);\n" 41395"\t\t\tlistmodel.set (iter, Column.FIRSTNAME,\n" 41396" phonebook[i].firstname,\n" 41397" Column.LASTNAME, phonebook[i].lastname,\n" 41398" Column.PHONE, phonebook[i].phone);\n" 41399"\t\t}\n" 41400"\t}\n" 41401"\n" 41402"\tvoid on_changed (Gtk.TreeSelection selection) {\n" 41403"\t\tGtk.TreeModel model;\n" 41404"\t\tGtk.TreeIter iter;\n" 41405"\t\tstring name;\n" 41406"\t\tstring lastname;\n" 41407"\t\tstring phone;\n" 41408"\n" 41409"\t\tif (selection.get_selected (out model, out iter)) {\n" 41410"\t\t\tmodel.get (iter,\n" 41411" Column.FIRSTNAME, out name,\n" 41412" Column.LASTNAME, out lastname,\n" 41413" Column.PHONE, out phone);\n" 41414"\n" 41415"\t\t\tlabel.set_text (\"\\n\" + name + \" \" + lastname + \" \" + phone);\n" 41416"\t\t}\n" 41417"\t}\n" 41418"}\n" 41419"\n" 41420"class MyApplication : Gtk.Application {\n" 41421"\tprotected override void activate () {\n" 41422"\n" 41423"\t\t/* Create new Window and show all the things. */\n" 41424"\t\tnew TreeViewSimpleListStore (this).show_all ();\n" 41425"\t}\n" 41426"\n" 41427"\tinternal MyApplication () {\n" 41428"\t\tObject (application_id: \"example.liststore.simple.treeview\");\n" 41429"\t}\n" 41430"}\n" 41431"\n" 41432"int main (string[] args) {\n" 41433"\treturn new MyApplication ().run (args);\n" 41434"}\n" 41435msgstr "" 41436 41437#. (itstool) path: item/p 41438#: C/treeview_simple_liststore.vala.page:32 41439msgid "" 41440"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.TreeView.html\">Gtk." 41441"TreeView</link>" 41442msgstr "" 41443 41444#. (itstool) path: item/p 41445#: C/treeview_simple_liststore.vala.page:34 41446msgid "" 41447"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.TreeSelection.html\">Gtk." 41448"TreeSelection</link>" 41449msgstr "" 41450 41451#. (itstool) path: info/desc 41452#: C/treeview_treestore.py.page:20 41453msgid "A TreeView displaying a TreeStore (simpler example)" 41454msgstr "" 41455 41456#. (itstool) path: page/title 41457#: C/treeview_treestore.py.page:23 41458#, fuzzy 41459msgid "Simpler TreeView with TreeStore" 41460msgstr "TreeView – TreeStore" 41461 41462#. (itstool) path: page/media 41463#. This is a reference to an external file such as an image or video. When 41464#. the file changes, the md5 hash will change to let you know you need to 41465#. update your localized copy. The msgstr is not used at all. Set it to 41466#. whatever you like once you have updated your copy of the file. 41467#: C/treeview_treestore.py.page:24 41468msgctxt "_" 41469msgid "" 41470"external ref='media/treeview_treestore.png' " 41471"md5='5ca87bc4acd55c527b3fb5fd46779d85'" 41472msgstr "" 41473 41474#. (itstool) path: page/p 41475#: C/treeview_treestore.py.page:25 41476#, fuzzy 41477msgid "This TreeView displays a TreeStore." 41478msgstr "TreeView – TreeStore" 41479 41480#. (itstool) path: section/code 41481#: C/treeview_treestore.py.page:32 41482#, no-wrap 41483msgid "" 41484"from gi.repository import Gtk\n" 41485"from gi.repository import Pango\n" 41486"import sys\n" 41487"\n" 41488"books = [[\"Tolstoy, Leo\", \"War and Peace\", \"Anna Karenina\"],\n" 41489" [\"Shakespeare, William\", \"Hamlet\", \"Macbeth\", \"Othello\"],\n" 41490" [\"Tolkien, J.R.R.\", \"The Lord of the Rings\"]]\n" 41491"\n" 41492"\n" 41493"class MyWindow(Gtk.ApplicationWindow):\n" 41494"\n" 41495" def __init__(self, app):\n" 41496" Gtk.Window.__init__(self, title=\"Library\", application=app)\n" 41497" self.set_default_size(250, 100)\n" 41498" self.set_border_width(10)\n" 41499"\n" 41500" # the data are stored in the model\n" 41501" # create a treestore with one column\n" 41502" store = Gtk.TreeStore(str)\n" 41503" for i in range(len(books)):\n" 41504" # the iter piter is returned when appending the author\n" 41505" piter = store.append(None, [books[i][0]])\n" 41506" # append the books as children of the author\n" 41507" j = 1\n" 41508" while j < len(books[i]):\n" 41509" store.append(piter, [books[i][j]])\n" 41510" j += 1\n" 41511"\n" 41512" # the treeview shows the model\n" 41513" # create a treeview on the model store\n" 41514" view = Gtk.TreeView()\n" 41515" view.set_model(store)\n" 41516"\n" 41517" # the cellrenderer for the column - text\n" 41518" renderer_books = Gtk.CellRendererText()\n" 41519" # the column is created\n" 41520" column_books = Gtk.TreeViewColumn(\n" 41521" \"Books by Author\", renderer_books, text=0)\n" 41522" # and it is appended to the treeview\n" 41523" view.append_column(column_books)\n" 41524"\n" 41525" # the books are sortable by author\n" 41526" column_books.set_sort_column_id(0)\n" 41527"\n" 41528" # add the treeview to the window\n" 41529" self.add(view)\n" 41530"\n" 41531"\n" 41532"class MyApplication(Gtk.Application):\n" 41533"\n" 41534" def __init__(self):\n" 41535" Gtk.Application.__init__(self)\n" 41536"\n" 41537" def do_activate(self):\n" 41538" win = MyWindow(self)\n" 41539" win.show_all()\n" 41540"\n" 41541" def do_startup(self):\n" 41542" Gtk.Application.do_startup(self)\n" 41543"\n" 41544"app = MyApplication()\n" 41545"exit_status = app.run(sys.argv)\n" 41546"sys.exit(exit_status)\n" 41547msgstr "" 41548 41549#. (itstool) path: info/title 41550#: C/tutorial.py.page:9 41551#, fuzzy 41552msgctxt "text" 41553msgid "Tutorial for beginners (Python)" 41554msgstr "Para iniciantes" 41555 41556#. (itstool) path: info/desc 41557#: C/tutorial.py.page:13 41558msgid "" 41559"A tutorial for beginners who want to learn how to program GUIs using GTK+ in " 41560"Python." 41561msgstr "" 41562 41563#. (itstool) path: credit/years 41564#: C/tutorial.py.page:22 41565#, fuzzy 41566msgid "2012 2013" 41567msgstr "2012, 2013" 41568 41569#. (itstool) path: credit/name 41570#: C/tutorial.py.page:25 41571#, fuzzy 41572msgid "Jim Campbell" 41573msgstr "Jim Campbell" 41574 41575#. (itstool) path: synopsis/p 41576#: C/tutorial.py.page:34 41577msgid "" 41578"By following these tutorials you will learn the basics of GUI programming " 41579"using GTK+ in Python." 41580msgstr "" 41581 41582#. (itstool) path: synopsis/p 41583#: C/tutorial.py.page:36 41584msgid "" 41585"If you have never programmed before, or are not familiar with the concepts " 41586"of object oriented programming, you may need to learn a few basics first. " 41587"The book <link href=\"http://learnpythonthehardway.org/book/\">Learn Python " 41588"the Hard Way</link> or <link href=\"http://docs.python.org/tutorial/index." 41589"html\">The Python Tutorial</link> may be a better place for you to start. " 41590"You may also be interested in <link href=\"http://python-gtk-3-tutorial." 41591"readthedocs.org/en/latest/index.html\">The Python GTK+ 3 Tutorial</link>. " 41592"Once you master the basics, be sure to come back and check out these " 41593"tutorials." 41594msgstr "" 41595 41596#. (itstool) path: section/title 41597#: C/tutorial.py.page:42 41598#, fuzzy 41599msgid "To run the code samples" 41600msgstr "Amostras de códigos e tutoriais" 41601 41602#. (itstool) path: section/p 41603#: C/tutorial.py.page:44 41604#, fuzzy 41605msgid "To run the code samples in the tutorial:" 41606msgstr "Amostras de códigos e tutoriais" 41607 41608#. (itstool) path: item/p 41609#: C/tutorial.py.page:46 41610msgid "" 41611"Type or copy and paste the code into a file, and save the file with a name " 41612"like <var>filename</var>.py" 41613msgstr "" 41614 41615#. (itstool) path: item/p 41616#: C/tutorial.py.page:47 41617#, fuzzy 41618msgid "To execute the code, type in the terminal:" 41619msgstr "Código SQL a executar:" 41620 41621#. (itstool) path: item/screen 41622#: C/tutorial.py.page:48 41623#, fuzzy, no-wrap 41624msgid "python <var>filename</var>.py" 41625msgstr "<cmd>--filename</cmd>=<var>arquivo</var>" 41626 41627#. (itstool) path: section/p 41628#: C/tutorial.py.page:51 41629msgid "" 41630"After executing the code, you will either see the widget on your screen, or " 41631"(if you have mistyped some of the code) you will see an error message that " 41632"will help you identify the problem." 41633msgstr "" 41634 41635#. (itstool) path: section/title 41636#: C/tutorial.py.page:55 41637msgid "A path through the widgets (with some theory)" 41638msgstr "" 41639 41640#. (itstool) path: section/p 41641#: C/tutorial.py.page:56 41642msgid "" 41643"The tutorial will walk you through increasingly complex examples and " 41644"programming theory, but you can also feel free to just go directly to the " 41645"tutorial that is most helpful to you." 41646msgstr "" 41647 41648#. (itstool) path: steps/title 41649#: C/tutorial.py.page:58 41650#, fuzzy 41651msgid "Tutorial" 41652msgstr "Tutorial" 41653 41654#. (itstool) path: steps/title 41655#: C/tutorial.py.page:60 41656#, fuzzy 41657msgid "Basic windows" 41658msgstr "_Janelas" 41659 41660#. (itstool) path: steps/title 41661#: C/tutorial.py.page:65 41662#, fuzzy 41663msgid "Images and labels" 41664msgstr "" 41665"Aprenda como posicionar componentes de interface de usuário, como Images e " 41666"Labels." 41667 41668#. (itstool) path: steps/title 41669#: C/tutorial.py.page:71 41670#, fuzzy 41671msgid "Introduction to properties" 41672msgstr "&Introdução" 41673 41674#. (itstool) path: steps/title 41675#: C/tutorial.py.page:75 41676#, fuzzy 41677msgid "Grid, separator and scrolling" 41678msgstr "_Grade:" 41679 41680#. (itstool) path: steps/title 41681#: C/tutorial.py.page:82 41682#, fuzzy 41683msgid "Signals, callbacks and buttons" 41684msgstr "_Sinais" 41685 41686#. (itstool) path: steps/title 41687#: C/tutorial.py.page:96 41688#, fuzzy 41689msgid "Other display widgets" 41690msgstr "Widgets disponíveis" 41691 41692#. (itstool) path: steps/title 41693#: C/tutorial.py.page:102 41694#, fuzzy 41695msgid "Entry widgets" 41696msgstr "" 41697"Campos de entrada permite o usuário digitar texto. Você pode alterar o " 41698"conteúdo com o método <methodname>set_text()</methodname>, e ler o conteúdo " 41699"atual com o método <methodname>get_text()</methodname>." 41700 41701#. (itstool) path: steps/title 41702#: C/tutorial.py.page:108 41703#, fuzzy 41704msgid "A widget to write and display text" 41705msgstr "O texto impresso antes do controle" 41706 41707#. (itstool) path: steps/title 41708#: C/tutorial.py.page:112 41709#, fuzzy 41710msgid "Dialogs" 41711msgstr "diálogos" 41712 41713#. (itstool) path: steps/title 41714#: C/tutorial.py.page:118 41715msgid "Menus, Toolbars and Tooltips (also: using Glade and GtkBuilder)" 41716msgstr "" 41717 41718#. (itstool) path: steps/title 41719#: C/tutorial.py.page:133 41720msgid "TreeViews and ComboBoxes (using the M/V/C design)" 41721msgstr "" 41722 41723#. (itstool) path: steps/title 41724#: C/tutorial.py.page:143 41725#, fuzzy 41726msgid "Custom widget" 41727msgstr "Widget personalizado" 41728 41729#. (itstool) path: info/title 41730#: C/vala.page:7 41731msgctxt "link" 41732msgid "Vala" 41733msgstr "Vala" 41734 41735#. (itstool) path: page/title 41736#: C/vala.page:21 41737#, fuzzy 41738msgid "Tutorials, code samples and platform demos in Vala" 41739msgstr "" 41740"Tutoriais, amostras de código e demonstrações da plataforma em JavaScript" 41741 41742#. (itstool) path: section/title 41743#: C/vala.page:26 41744#, fuzzy 41745msgid "Code samples and tutorial" 41746msgstr "Amostras de códigos e tutoriais" 41747 41748#. (itstool) path: info/title 41749#: C/weatherApp.js.page:7 41750#, fuzzy 41751msgctxt "text" 41752msgid "Weather application (JavaScript)" 41753msgstr "Um aplicativo de meteorologia" 41754 41755#. (itstool) path: info/desc 41756#: C/weatherApp.js.page:22 41757msgid "" 41758"How to plan an application that uses asynchronous calls. Asynchronous calls " 41759"will be presented through a weather application." 41760msgstr "" 41761 41762#. (itstool) path: page/title 41763#: C/weatherApp.js.page:27 41764#, fuzzy 41765msgid "Weather application" 41766msgstr "Um aplicativo de meteorologia" 41767 41768#. (itstool) path: synopsis/p 41769#: C/weatherApp.js.page:29 41770msgid "" 41771"In this guide well construct a weather application using asynchronous calls. " 41772"Weather information in this example is fetched from geonames.org and the " 41773"application is using the <link href=\"http://en.wikipedia.org/wiki/" 41774"List_of_airports_by_ICAO_code:_E\">ICAO codes </link> to place your weather " 41775"request. To write and run all the code examples yourself, you need an editor " 41776"to write code in, Terminal and GNOME 3 or higher installed into your " 41777"computer. In this guide we we'll go through the following parts:" 41778msgstr "" 41779 41780#. (itstool) path: item/p 41781#: C/weatherApp.js.page:32 41782msgid "<link xref=\"#planningUi\">Planning the graphical user interface</link>" 41783msgstr "" 41784 41785#. (itstool) path: item/p 41786#: C/weatherApp.js.page:33 41787msgid "<link xref=\"#asynchronous\">Asynchronous calls</link>" 41788msgstr "" 41789 41790#. (itstool) path: item/p 41791#: C/weatherApp.js.page:34 41792msgid "<link xref=\"#main\">The main program file</link>" 41793msgstr "" 41794 41795#. (itstool) path: item/p 41796#: C/weatherApp.js.page:35 41797msgid "<link xref=\"#main\">Local library GeoNames</link>" 41798msgstr "" 41799 41800#. (itstool) path: item/p 41801#: C/weatherApp.js.page:36 41802msgid "<link xref=\"#main\">Autotools and Icons</link>" 41803msgstr "" 41804 41805#. (itstool) path: page/media 41806#. This is a reference to an external file such as an image or video. When 41807#. the file changes, the md5 hash will change to let you know you need to 41808#. update your localized copy. The msgstr is not used at all. Set it to 41809#. whatever you like once you have updated your copy of the file. 41810#: C/weatherApp.js.page:41 41811msgctxt "_" 41812msgid "" 41813"external ref='media/weatherAppJs.png' md5='1fe859ac4854273d72ea8fc9203639b2'" 41814msgstr "" 41815"external ref='media/weatherAppJs.png' md5='1fe859ac4854273d72ea8fc9203639b2'" 41816 41817#. (itstool) path: section/title 41818#: C/weatherApp.js.page:44 41819#, fuzzy 41820msgid "Planning the graphical user interface" 41821msgstr "Com a interface gráfica" 41822 41823#. (itstool) path: section/p 41824#: C/weatherApp.js.page:45 41825msgid "" 41826"Structuring an application for GNOME 3 means you will be using <link href=" 41827"\"http://developer.gnome.org/platform-overview/stable/gtk\">GTK+</link>. The " 41828"most important thing is to remember that the main window will only accept " 41829"one widget. You must plan your structure accordingly (this example is using " 41830"Gtk.Grid). A useful method is to draw out the main window and place every " 41831"widget needed inside that box. By looking at an image of your future " 41832"application it is easier to tell what are the relations between widgets. For " 41833"example Gtk.Grid places your widgets in relation to other widgets, so after " 41834"the first widget is in place, placing widgets can be done in relation to any " 41835"widget on the grid." 41836msgstr "" 41837 41838#. (itstool) path: section/title 41839#: C/weatherApp.js.page:48 41840#, fuzzy 41841msgid "Asynchronous calls" 41842msgstr "Assíncrono" 41843 41844#. (itstool) path: section/p 41845#: C/weatherApp.js.page:49 41846msgid "" 41847"With many programming languages, all operations are run synchronously - you " 41848"tell the program to do something, and it will wait until that action " 41849"completes before proceeding. This is however bad for graphical user " 41850"interfaces, as then the whole application will be frozen while the program " 41851"waits for the operation. Going asynchronous (async) helps here. With async " 41852"calls, your UI won't be blocked with any requests. Async calls make your " 41853"application more flexible and better equipped to handle situations when " 41854"calls take more time than expected or for some reason get jammed. Async " 41855"calls can be used for example file system I/O and for slower calculations in " 41856"the background." 41857msgstr "" 41858 41859#. (itstool) path: section/p 41860#: C/weatherApp.js.page:52 41861msgid "" 41862"In this example we have to get data from geonames.org. While we do that we " 41863"want the rest of our program to continue. If we wouldn't get any information " 41864"from geonames.org for the lack of internet connection and this would be a " 41865"synchronous application we would never get to the point where our " 41866"main_quit() is processed correctly and the application would have to killed " 41867"from Terminal." 41868msgstr "" 41869 41870#. (itstool) path: section/title 41871#: C/weatherApp.js.page:55 41872#, fuzzy 41873msgid "The different parts of the program" 41874msgstr "Executa um programa com configurações de privilégios diferentes.\n" 41875 41876#. (itstool) path: page/title 41877#: C/weatherAppMain.js.page:19 41878#, fuzzy 41879msgid "The main program file" 41880msgstr "arquivo de configuração principal" 41881 41882#. (itstool) path: synopsis/p 41883#: C/weatherAppMain.js.page:21 41884msgid "" 41885"In this part of the guide well construct the main program file of the " 41886"weather application. To write and run all the code examples yourself, you " 41887"need an editor to write code in, Terminal and GNOME 3 or higher installed " 41888"into your computer. In this part we we'll go through the following parts:" 41889msgstr "" 41890 41891#. (itstool) path: item/p 41892#: C/weatherAppMain.js.page:26 41893msgid "" 41894"<link xref=\"#widgets\">Adding a grid and all the necessary widgets to it</" 41895"link>" 41896msgstr "" 41897 41898#. (itstool) path: item/p 41899#: C/weatherAppMain.js.page:27 41900msgid "" 41901"<link xref=\"#asynccall\">Requesting the weather information asynchronously</" 41902"link>" 41903msgstr "" 41904 41905#. (itstool) path: item/p 41906#: C/weatherAppMain.js.page:28 41907msgid "" 41908"<link xref=\"#connectingbuttons\">Connecting signals to button and entry</" 41909"link>." 41910msgstr "" 41911 41912#. (itstool) path: item/p 41913#: C/weatherAppMain.js.page:29 41914#, fuzzy 41915msgid "<link xref=\"#weatherapp.js\">weatherapp.js</link>" 41916msgstr "<link xref=\"preferences\">Preferências</link>" 41917 41918#. (itstool) path: section/p 41919#: C/weatherAppMain.js.page:36 41920msgid "" 41921"This line tells how to run the script. It needs to be the first line of the " 41922"code and it needs to be executable. To get the execution rights go to " 41923"Terminal and run in right folder: chmod +x scriptname. Or you can use the " 41924"graphical filemanager. Just go to the right folder where your code is, right " 41925"click you code file, choose properties, click the permissions tab and check " 41926"the box for allow executing file as a program" 41927msgstr "" 41928 41929#. (itstool) path: section/code 41930#: C/weatherAppMain.js.page:42 41931#, no-wrap 41932msgid "" 41933"\n" 41934"var Gtk = imports.gi.Gtk;\n" 41935"const WeatherService = imports.geonames;" 41936msgstr "" 41937 41938#. (itstool) path: section/p 41939#: C/weatherAppMain.js.page:45 41940msgid "" 41941"In order to have a working program we need to import a GObject Introspection " 41942"-library to our use. For working UI, we need Gtk. Gtk is imported in the " 41943"beginning so we have it in our use everywhere. We also import our own local " 41944"JavaScript library geonames to our use here." 41945msgstr "" 41946 41947#. (itstool) path: section/code 41948#: C/weatherAppMain.js.page:50 41949#, no-wrap 41950msgid "" 41951"\n" 41952"// Initialize the gtk\n" 41953"Gtk.init(null, 0);\n" 41954"//create your window, name it and connect the x to quit function. Remember that window is a taken word\n" 41955"var weatherwindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n" 41956"weatherwindow.title = \"Todays weather\";\n" 41957"//Window only accepts one widget and a title. Further structure with Gtk.boxes of similar\n" 41958"weatherwindow.connect(\"destroy\", function(){Gtk.main_quit()});\n" 41959"\n" 41960"weatherwindow.show_all();\n" 41961"//and run it\n" 41962"Gtk.main();" 41963msgstr "" 41964 41965#. (itstool) path: section/title 41966#: C/weatherAppMain.js.page:64 41967msgid "Adding a grid and all the necessary widgets to it" 41968msgstr "" 41969 41970#. (itstool) path: section/code 41971#: C/weatherAppMain.js.page:65 41972#, no-wrap 41973msgid "" 41974"\n" 41975"var grid = new Gtk.Grid();\n" 41976"weatherwindow.add(grid);\n" 41977"\n" 41978"//We initialize the icon here, but deside the file later in geonames.js.\n" 41979"var weatherIcon = new Gtk.Image();\n" 41980"\n" 41981"//Set some labels to your window\n" 41982"var label1 = new Gtk.Label({label: \"\"});\n" 41983"var label2 = new Gtk.Label({label: \"Looking in the sky...\"});\n" 41984"var label3 = new Gtk.Label({label: \"\"});\n" 41985"\n" 41986"var entry = new Gtk.Entry();\n" 41987"entry.set_width_chars(4);\n" 41988"entry.set_max_length(4);\n" 41989"var label4 = new Gtk.Label({label: \"Enter ICAO station for weather: \"});\n" 41990"var button1 = new Gtk.Button({label: \"search!\"});\n" 41991"\n" 41992"grid.attach(label4, 2, 1, 1, 1);\n" 41993"grid.attach_next_to(label1,label4,3,1,1);\n" 41994"grid.attach_next_to(label2,label1,3,1,1);\n" 41995"grid.attach_next_to(label3,label2,3,1,1);\n" 41996"grid.attach_next_to(entry,label4,1,1,1);\n" 41997"grid.attach_next_to(button1,entry,1,1,1);\n" 41998"grid.attach_next_to(weatherIcon,label2,1,1,1)\n" 41999msgstr "" 42000 42001#. (itstool) path: section/p 42002#: C/weatherAppMain.js.page:91 42003msgid "" 42004"In this section we create the grid we are going to use for positioning the " 42005"widgets. All the buttons, labels and entries are initialized and placed on " 42006"the grid. As seen from the placing of the different widgets, they don't need " 42007"to be related only to one widget. At this point some of the labels don't " 42008"have any content. The content for those widgets is applied later. If you run " 42009"the application at this stage, you have the UI ready, but the widgets are " 42010"not connected to anything. For this we need to first build the weather " 42011"searching local library, and then get the information we need " 42012"asynchronously. When we have our local library ready we can connect it to " 42013"the necessary widgets." 42014msgstr "" 42015 42016#. (itstool) path: section/title 42017#: C/weatherAppMain.js.page:95 42018#, fuzzy 42019msgid "Requesting the weather information asynchronously" 42020msgstr "Atualizando Informações Meteorológicas" 42021 42022#. (itstool) path: section/code 42023#: C/weatherAppMain.js.page:96 42024#, no-wrap 42025msgid "" 42026"\n" 42027"function getWeatherForStation() {\n" 42028" var station = entry.get_text();\n" 42029"\n" 42030" var GeoNames = new WeatherService.GeoNames(station); //\"EFHF\";\n" 42031"\n" 42032" GeoNames.getWeather(function(error, weather) {\n" 42033" //this here works bit like signals. This code will be run when we have weather.\n" 42034" if (error) {\n" 42035" label2.set_text(\"Suggested ICAO station does not exist Try EFHF\");\n" 42036" return; }\n" 42037" weatherIcon.file = GeoNames.getIcon(weather);\n" 42038"\n" 42039" label1.set_text(\"Temperature is \" + weather.weatherObservation.temperature + \" degrees.\");\n" 42040" if (weather.weatherObservation.weatherCondition !== \"n/a\"){\n" 42041" label2.set_text(\"Looks like there is \" + weather.weatherObservation.weatherCondition + \" in the sky.\");\n" 42042" }\n" 42043" else {\n" 42044" label2.set_text(\"Looks like there is \" + weather.weatherObservation.clouds + \" in the sky.\");\n" 42045" }\n" 42046" label3.set_text(\"Windspeed is \" + weather.weatherObservation.windSpeed + \" m/s\")\n" 42047" // ...\n" 42048" });\n" 42049"}\n" 42050msgstr "" 42051 42052#. (itstool) path: section/p 42053#: C/weatherAppMain.js.page:121 42054msgid "" 42055"This function is dedicated for calling for the weather information and " 42056"updating labels and icons accordingly. In the beginning of the function we " 42057"get the user input for the search. So here for the first time we use our own " 42058"library and assign it to variable GeoNames. While assigning WeatherService " 42059"we give it the station. The firs thing we do with GeoNames is to request " 42060"weather. Everything after GeoNames.getWeather(function(error, weather) " 42061"happens only if we either get an error message or weather information. If " 42062"either doesn't come, the rest of the program works as normal, so main_Quit " 42063"works." 42064msgstr "" 42065 42066#. (itstool) path: section/title 42067#: C/weatherAppMain.js.page:125 42068#, fuzzy 42069msgid "Connecting signals to button and entry." 42070msgstr "Po_sicionar pesquisa junto ao botão do painel" 42071 42072#. (itstool) path: section/code 42073#: C/weatherAppMain.js.page:126 42074#, no-wrap 42075msgid "" 42076"\n" 42077"entry.connect(\"key_press_event\", function(widget, event) {\n" 42078" if (entry.get_text().length === 4) {\n" 42079" // Enough is enough\n" 42080" getWeatherForStation();\n" 42081" }\n" 42082" return false;\n" 42083"});\n" 42084"\n" 42085"button1.connect(\"clicked\", function(){\n" 42086" getWeatherForStation();\n" 42087"});" 42088msgstr "" 42089 42090#. (itstool) path: section/p 42091#: C/weatherAppMain.js.page:138 42092msgid "" 42093"And finally we have the connections that make the whole application run as " 42094"it should. We connect both the entry and the button to do the same thing, " 42095"getting the weather. So it doesn't matter weather you press enter of click " 42096"the search button." 42097msgstr "" 42098 42099#. (itstool) path: section/title 42100#: C/weatherAppMain.js.page:142 42101msgid "Weatherapp.js" 42102msgstr "" 42103 42104#. (itstool) path: section/p 42105#: C/weatherAppMain.js.page:143 42106#, fuzzy 42107msgid "Weatherapp.js file looks like this:" 42108msgstr "Ei, isso se parece com Adonthell!" 42109 42110#. (itstool) path: section/code 42111#: C/weatherAppMain.js.page:144 42112#, no-wrap 42113msgid "" 42114"\n" 42115"#!/usr/bin/gjs\n" 42116"//The previous line is a hash bang tells how to run the script.\n" 42117"// Note that the script has to be executable (run in terminal in the right folder: chmod +x scriptname)\n" 42118"\n" 42119"var Gtk = imports.gi.Gtk;\n" 42120"\n" 42121"const WeatherService = imports.geonames;\n" 42122"//Bring your own library from same folder (as set in GJS_PATH). If using autotools .desktop will take care of this\n" 42123"\n" 42124"// Initialize the gtk\n" 42125"Gtk.init(null, 0);\n" 42126"//create your window, name it and connect the x to quit function. Remember that window is a taken word\n" 42127"var weatherwindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n" 42128"weatherwindow.title = \"Todays weather\";\n" 42129"//Window only accepts one widget and a title. Further structure with Gtk.boxes of similar\n" 42130"weatherwindow.connect(\"destroy\", function(){Gtk.main_quit()});\n" 42131"//We initialize the icon here, but deside the file later in geonames.js.\n" 42132"\n" 42133"var weatherIcon = new Gtk.Image();\n" 42134"\n" 42135"//Set some labels to your window\n" 42136"var label1 = new Gtk.Label({label: \"\"});\n" 42137"var label2 = new Gtk.Label({label: \"Looking in the sky...\"});\n" 42138"var label3 = new Gtk.Label({label: \"\"});\n" 42139"\n" 42140"var grid = new Gtk.Grid();\n" 42141"weatherwindow.add(grid);\n" 42142"\n" 42143"var entry = new Gtk.Entry();\n" 42144"entry.set_width_chars(4);\n" 42145"entry.set_max_length(4);\n" 42146"var label4 = new Gtk.Label({label: \"Enter ICAO station for weather: \"});\n" 42147"var button1 = new Gtk.Button({label: \"search!\"});\n" 42148"\n" 42149"//some weather\n" 42150"\n" 42151"entry.connect(\"key_press_event\", function(widget, event) {\n" 42152" // FIXME: Get weather on enter (key 13)\n" 42153" if (entry.get_text().length === 4) {\n" 42154" // Enough is enough\n" 42155" getWeatherForStation();\n" 42156" }\n" 42157" return false;\n" 42158"});\n" 42159"\n" 42160"button1.connect(\"clicked\", function(){\n" 42161" getWeatherForStation();\n" 42162"});\n" 42163"\n" 42164"function getWeatherForStation() {\n" 42165" var station = entry.get_text();\n" 42166"\n" 42167" var GeoNames = new WeatherService.GeoNames(station); //\"EFHF\";\n" 42168"\n" 42169" GeoNames.getWeather(function(error, weather) {\n" 42170" //this here works bit like signals. This code will be run when we have weather.\n" 42171" if (error) {\n" 42172" label2.set_text(\"Suggested ICAO station does not exist Try EFHF\");\n" 42173" return; }\n" 42174" weatherIcon.file = GeoNames.getIcon(weather);\n" 42175"\n" 42176" label1.set_text(\"Temperature is \" + weather.weatherObservation.temperature + \" degrees.\");\n" 42177" if (weather.weatherObservation.weatherCondition !== \"n/a\"){\n" 42178" label2.set_text(\"Looks like there is \" + weather.weatherObservation.weatherCondition + \" in the sky.\");\n" 42179" }\n" 42180" else {\n" 42181" label2.set_text(\"Looks like there is \" + weather.weatherObservation.clouds + \" in the sky.\");\n" 42182" }\n" 42183" label3.set_text(\"Windspeed is \" + weather.weatherObservation.windSpeed + \" m/s\")\n" 42184" // ...\n" 42185" });\n" 42186"}\n" 42187"\n" 42188"grid.attach(label4, 2, 1, 1, 1);\n" 42189"grid.attach_next_to(label1,label4,3,1,1);\n" 42190"grid.attach_next_to(label2,label1,3,1,1);\n" 42191"grid.attach_next_to(label3,label2,3,1,1);\n" 42192"grid.attach_next_to(entry,label4,1,1,1);\n" 42193"grid.attach_next_to(button1,entry,1,1,1);\n" 42194"grid.attach_next_to(weatherIcon,label2,1,1,1)\n" 42195"weatherwindow.show_all();\n" 42196"//and run it\n" 42197"Gtk.main();\n" 42198msgstr "" 42199 42200#. (itstool) path: section/p 42201#: C/weatherAppMain.js.page:229 42202msgid "Running until you have all the autotools files ready. :" 42203msgstr "" 42204 42205#. (itstool) path: section/screen 42206#: C/weatherAppMain.js.page:231 42207#, no-wrap 42208msgid " <output style=\"prompt\">$ </output><input> GJS_PATH=`pwd` gjs weatherapp.js</input>" 42209msgstr "" 42210 42211#. (itstool) path: section/p 42212#: C/weatherAppMain.js.page:232 42213msgid "" 42214"Use this command on terminal while developing your modules. When calling " 42215"your program in this manner it knows where to find your custom JSlibraries, " 42216"in this case geonames.js." 42217msgstr "" 42218 42219#. (itstool) path: page/title 42220#: C/weatherAutotools.js.page:19 42221#, fuzzy 42222msgid "Autotools and Icons" 42223msgstr "autotools" 42224 42225#. (itstool) path: synopsis/p 42226#: C/weatherAutotools.js.page:21 42227msgid "" 42228"In this part of the guide well construct the autotools and custom icons " 42229"needed for weather application to be a seamless part of your desktop. To " 42230"write and run all the code examples yourself, you need an editor to write " 42231"code in, Terminal and GNOME 3 or higher installed into your computer. In " 42232"this guide we we'll go through the following parts:" 42233msgstr "" 42234 42235#. (itstool) path: item/p 42236#: C/weatherAutotools.js.page:24 42237msgid "<link xref=\"#autotools\"> Autotools</link>" 42238msgstr "" 42239 42240#. (itstool) path: item/p 42241#: C/weatherAutotools.js.page:25 42242msgid "<link xref=\"#icons\">Custom icons for your application</link>" 42243msgstr "" 42244 42245#. (itstool) path: section/title 42246#: C/weatherAutotools.js.page:32 42247#, fuzzy 42248msgid "Autotools and necessary files" 42249msgstr "autotools" 42250 42251#. (itstool) path: section/p 42252#: C/weatherAutotools.js.page:33 42253msgid "" 42254"Having more than one file in your folder makes using autotools a bit tricky. " 42255"You need the .desktop file, autogen.sh, Makefile.am, configure.ac and as a " 42256"new file: myapp.sh.in file. Hacking the autotools file is a complicated " 42257"field. More information can be found in many different sources, <link href=" 42258"\"http://en.wikipedia.org/wiki/GNU_build_system\">the wikipedia article</" 42259"link> provides a good overview on the subject." 42260msgstr "" 42261 42262#. (itstool) path: item/p 42263#. (itstool) path: section/p 42264#: C/weatherAutotools.js.page:36 C/weatherAutotools.js.page:42 42265msgid "weatherapp.desktop" 42266msgstr "" 42267 42268#. (itstool) path: item/p 42269#. (itstool) path: section/p 42270#: C/weatherAutotools.js.page:37 C/weatherAutotools.js.page:57 42271msgid "weatherapp.sh.in" 42272msgstr "" 42273 42274#. (itstool) path: section/code 42275#: C/weatherAutotools.js.page:43 42276#, no-wrap 42277msgid "" 42278"\n" 42279"[Desktop Entry]\n" 42280"Version=1.0\n" 42281"Encoding=UTF-8\n" 42282"Name=Weather app\n" 42283"Comment=Weather showing application\n" 42284"Exec=weatherapp.sh\n" 42285"Icon=application-default-icon\n" 42286"Terminal=false\n" 42287"Type=Application\n" 42288"StartupNotify=true\n" 42289"Categories=GNOME;GTK;Utility;" 42290msgstr "" 42291 42292#. (itstool) path: section/p 42293#: C/weatherAutotools.js.page:55 42294msgid "" 42295"The thing to notice in this file is that the Exec line will make this ." 42296"desktop file work only after running all the other makefiles. Weatherapp.sh " 42297"is a small shell script created with the weatherapp.sh.in." 42298msgstr "" 42299 42300#. (itstool) path: section/code 42301#: C/weatherAutotools.js.page:58 42302#, no-wrap 42303msgid "" 42304"\n" 42305"#!/bin/sh\n" 42306"export GJS_PATH=@bindir@\n" 42307"gjs @bindir@/weatherapp.js" 42308msgstr "" 42309 42310#. (itstool) path: section/p 42311#: C/weatherAutotools.js.page:62 42312msgid "" 42313"This file is a template to the file Makefile will do to be run from .desktop." 42314msgstr "" 42315 42316#. (itstool) path: section/code 42317#: C/weatherAutotools.js.page:65 42318#, no-wrap 42319msgid "" 42320"\n" 42321"# The actual runnable program is set to the SCRIPTS primitive. Prefix bin_ tells where to copy this\n" 42322"bin_SCRIPTS = weatherapp.js geonames.js weatherapp.sh\n" 42323"# List of files to be distributed\n" 42324"EXTRA_DIST= \\\n" 42325" $(bin_SCRIPTS) \\\n" 42326" $(private_icons)\t\\\n" 42327"\t $(NULL)\n" 42328"\n" 42329"CLEANFILES =\n" 42330"\n" 42331"# The desktop files\n" 42332"desktopdir = $(datadir)/applications\n" 42333"desktop_DATA =weatherapp.desktop\n" 42334"\n" 42335"# convenience command for doing Makefile variable substitutions in non-Makefile\n" 42336"# files (scripts, service files, etc.)\n" 42337"do_subst = sed -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \\\n" 42338" -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \\\n" 42339" -e 's|@localedir[@]|$(localedir)|g' \\\n" 42340" -e 's|@bindir[@]|$(bindir)|g' \\\n" 42341" -e 's|@libexecdir[@]|$(libexecdir)|g' \\\n" 42342"\t -e 's|@pkglibdir[@]|$(pkglibdir)|g' \\\n" 42343"\t -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \\\n" 42344"\t -e 's|@have_libnotify[@]|$(HAVE_LIBNOTIFY)|g' \\\n" 42345"\t -e 's|@have_libsoup[@]|$(HAVE_LIBSOUP)|g' \\\n" 42346"\t -e 's|@have_cheese[@]|$(HAVE_CHEESE)|g'\n" 42347"\n" 42348"weatherapp.sh: weatherapp.sh.in\n" 42349"\t$(AM_V_GEN) $(do_subst) $< > $@\n" 42350"\tchmod +x $@\n" 42351"\n" 42352"CLEANFILES += weatherapp.sh\n" 42353"EXTRA_DIST += weatherapp.sh.in\n" 42354"\n" 42355"#the application icon\n" 42356"appicondir=$(datadir)/icons/hicolor/scalable/apps\n" 42357"appicon_DATA=weather-icon.svg\n" 42358"\n" 42359"#icons in the application\n" 42360"NULL =\n" 42361"\n" 42362"private_icons = \\\n" 42363"\tweather-clear.svg \\\n" 42364" weather-few-clouds.svg \\\n" 42365" weather-fog.svg \\\n" 42366" weather-icon.svg \\\n" 42367" weather-overcast.svg \\\n" 42368" weather-showers.svg \\\n" 42369" weather-showers-scattered.svg \\\n" 42370" weather-snow.svg \\\n" 42371" $(NULL)\n" 42372"\n" 42373"install-icons:\n" 42374"\tfor icon in $(private_icons); do \\\n" 42375"\t\tmkdir -p $(DESTDIR)$(pkgdatadir)/icons/; \\\n" 42376"\t\t$(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)$(pkgdatadir)/icons/; \\\n" 42377"\tdone\n" 42378"\n" 42379"install-data-local: install-icons" 42380msgstr "" 42381 42382#. (itstool) path: section/p 42383#: C/weatherAutotools.js.page:125 42384msgid "" 42385"This needs a bit more explaining. Compared to the HelloWorld Makefile.am " 42386"this has changed quite a bit. Lets go through all the new blocks:" 42387msgstr "" 42388 42389#. (itstool) path: section/p 42390#: C/weatherAutotools.js.page:126 42391msgid "" 42392"bin_scripts are the files that are needed to run your application. In thin " 42393"case they are the first two files are the program itself and the third is " 42394"the script that launches the application." 42395msgstr "" 42396 42397#. (itstool) path: section/p 42398#: C/weatherAutotools.js.page:127 42399msgid "EXTRA_DIST are the files that are to be distributed" 42400msgstr "" 42401 42402#. (itstool) path: section/p 42403#: C/weatherAutotools.js.page:128 42404msgid "do_subst block is bits and pieces that need to be where they are" 42405msgstr "" 42406 42407#. (itstool) path: section/p 42408#: C/weatherAutotools.js.page:129 42409msgid "" 42410"after the comment #icons in the application there are all the icons that are " 42411"used by the program. For them to be useful you need to install the icons in " 42412"correct places and that is done by the install-icons: bit" 42413msgstr "" 42414 42415#. (itstool) path: section/code 42416#: C/weatherAutotools.js.page:132 42417#, no-wrap 42418msgid "" 42419"\n" 42420"dnl This file is processed by autoconf to create a configure script\n" 42421"AC_INIT([Weather App], 1.0)\n" 42422"AM_INIT_AUTOMAKE([1.10 no-define foreign])\n" 42423"AC_CONFIG_FILES(Makefile)\n" 42424"AC_OUTPUT" 42425msgstr "" 42426 42427#. (itstool) path: section/code 42428#: C/weatherAutotools.js.page:139 42429#, no-wrap 42430msgid "" 42431"\n" 42432"#!/bin/sh\n" 42433"# This will run autoconf, automake, etc. for us\n" 42434"autoreconf --force --install" 42435msgstr "" 42436 42437#. (itstool) path: section/title 42438#: C/weatherAutotools.js.page:145 42439#, fuzzy 42440msgid "Custom icons for your application" 42441msgstr "Ícones simbólicos personalizados" 42442 42443#. (itstool) path: section/p 42444#: C/weatherAutotools.js.page:146 42445msgid "" 42446"When thinking about custom icons a good rule of thumb is: do you expect to " 42447"see that icon used elsewhere or is it private to your app? If the first (e." 42448"g. the icons in the desktop file that are shown by the shell) then you need /" 42449"usr/share/hicolor, otherwise (e.g. the weather icons of your app) /usr/share/" 42450"$application/bla/bla" 42451msgstr "" 42452 42453#. (itstool) path: section/p 42454#: C/weatherAutotools.js.page:147 42455msgid "" 42456"Using autotools you have to make some changes to your .desktop and Makefile." 42457"am files. In the desktop file you change the Icon's name Icon=weather-icon. " 42458"In the Makefile.am file you add these two lines to the end of your " 42459"application #the application icon" 42460msgstr "" 42461 42462#. (itstool) path: section/p 42463#: C/weatherAutotools.js.page:148 42464msgid "appicondir=$(datadir)/icons/hicolor/scalable/apps" 42465msgstr "" 42466 42467#. (itstool) path: section/p 42468#: C/weatherAutotools.js.page:149 42469#, fuzzy 42470msgid "appicon_DATA=weather-icon.svg" 42471msgstr "Não foi possível recuperar dados do tempo" 42472 42473#. (itstool) path: page/title 42474#: C/weatherGeonames.js.page:19 42475#, fuzzy 42476msgid "Local library geoNames" 42477msgstr "GeoNames" 42478 42479#. (itstool) path: synopsis/p 42480#: C/weatherGeonames.js.page:21 42481msgid "" 42482"In this part of the guide we'll construct the local library geoNames using " 42483"asynchronous calls. Weather information in this example is fetched from " 42484"geonames.org and the application is using the <link href=\"http://en." 42485"wikipedia.org/wiki/List_of_airports_by_ICAO_code:_E\">ICAO codes </link> to " 42486"place your weather request. To write and run all the code examples yourself, " 42487"you need an editor to write code in, Terminal and GNOME 3 or higher " 42488"installed into your computer. In this guide we'll go through the following " 42489"parts:" 42490msgstr "" 42491 42492#. (itstool) path: item/p 42493#: C/weatherGeonames.js.page:24 42494msgid "" 42495"<link xref=\"#geonamesimports\">Local library for getting the weather</link>" 42496msgstr "" 42497 42498#. (itstool) path: item/p 42499#: C/weatherGeonames.js.page:25 42500msgid "<link xref=\"#geonamesfunction\">Creating function geoNames</link>" 42501msgstr "" 42502 42503#. (itstool) path: item/p 42504#: C/weatherGeonames.js.page:26 42505msgid "<link xref=\"#geonamesmethods\">Methods for geoNames</link>" 42506msgstr "" 42507 42508#. (itstool) path: item/p 42509#: C/weatherGeonames.js.page:27 42510#, fuzzy 42511msgid "<link xref=\"#geonames.js\">geonames.js </link>" 42512msgstr "<link xref=\"preferences\">Preferências</link>" 42513 42514#. (itstool) path: section/title 42515#: C/weatherGeonames.js.page:32 42516#, fuzzy 42517msgid "Local library for getting the weather" 42518msgstr "" 42519"Um aplicativo de painel para monitorar condições meteorológicas locais." 42520 42521#. (itstool) path: section/p 42522#: C/weatherGeonames.js.page:33 42523msgid "For this we need a new file that will be our local library." 42524msgstr "" 42525 42526#. (itstool) path: section/code 42527#: C/weatherGeonames.js.page:34 42528#, no-wrap 42529msgid "" 42530"\n" 42531"const Soup = imports.gi.Soup;\n" 42532"const _httpSession = new Soup.SessionAsync();\n" 42533"Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());\n" 42534msgstr "" 42535 42536#. (itstool) path: section/p 42537#: C/weatherGeonames.js.page:39 42538msgid "" 42539"In the first lines we'll import and initialize the libraries we need to use " 42540"in this local library. Soup handles all the requests we have to make with " 42541"http." 42542msgstr "" 42543 42544#. (itstool) path: section/title 42545#: C/weatherGeonames.js.page:43 42546#, fuzzy 42547msgid "Creating function GeoNames" 42548msgstr "GeoNames" 42549 42550#. (itstool) path: section/code 42551#: C/weatherGeonames.js.page:44 42552#, no-wrap 42553msgid "" 42554"\n" 42555"function GeoNames(station) {\n" 42556" this.station = station;\n" 42557"}\n" 42558"\n" 42559"GeoNames.prototype = {\n" 42560"\n" 42561"}\n" 42562msgstr "" 42563 42564#. (itstool) path: section/p 42565#: C/weatherGeonames.js.page:53 42566msgid "" 42567"Here we create the function GeoNames that will handle getting weather for " 42568"us. JavaScript allows us to create functions that have little inside at " 42569"first and later expand them. This will be done inside the GeoNames.prototype " 42570"curly braces{}" 42571msgstr "" 42572 42573#. (itstool) path: section/title 42574#: C/weatherGeonames.js.page:57 42575#, fuzzy 42576msgid "Methods for GeoNames" 42577msgstr "GeoNames" 42578 42579#. (itstool) path: section/code 42580#: C/weatherGeonames.js.page:58 42581#, no-wrap 42582msgid "" 42583"\n" 42584"getWeather: function(callback) {\n" 42585" var request = Soup.Message.new('GET', 'http://api.geonames.org/weatherIcaoJSON?ICAO=' + this.station + '&username=demo');\n" 42586" _httpSession.queue_message(request, function(_httpSession, message) {\n" 42587" if (message.status_code !== 200) {\n" 42588" callback(message.status_code, null);\n" 42589" return;\n" 42590" }\n" 42591" var weatherJSON = request.response_body.data;\n" 42592" var weather = JSON.parse(weatherJSON);\n" 42593" callback(null, weather);\n" 42594" });\n" 42595"},\n" 42596"\n" 42597"getIcon: function(weather){\n" 42598" switch (weather.weatherObservation.weatherCondition){\n" 42599" case \"drizzle\":\n" 42600" case \"light showers rain\":\n" 42601" case \"light rain\":\n" 42602" return \"weather-showers-scattered.svg\";\n" 42603" case \"rain\":\n" 42604" return \"weather-showers.svg\";\n" 42605" case \"light snow\":\n" 42606" case \"snow grains\":\n" 42607" return \"weather-snow.svg\";\n" 42608" }\n" 42609" switch (weather.weatherObservation.clouds){\n" 42610" case \"few clouds\":\n" 42611" case \"scattered clouds\":\n" 42612" return \"weather-few-clouds.svg\";\n" 42613" case \"clear sky\":\n" 42614" return \"weather-clear.svg\"\n" 42615" case \"broken clouds\":\n" 42616" case \"overcast\":\n" 42617" return \"weather-overcast.svg\";\n" 42618" }\n" 42619" return \"weather-fog.svg\";\n" 42620"}\n" 42621msgstr "" 42622 42623#. (itstool) path: section/p 42624#: C/weatherGeonames.js.page:97 42625msgid "" 42626"The first method for GeoNames is getWeather and the second getIcon. In " 42627"getWeather we make a http request with soup, handle errors and then parse " 42628"the information from the request to form we can use it. In getIcon we simply " 42629"compare the results we got from getWeather to the switch we have in order to " 42630"get the icon matching current weather. Now that we have our local library " 42631"ready, it's time to make use of it." 42632msgstr "" 42633 42634#. (itstool) path: section/title 42635#: C/weatherGeonames.js.page:102 42636msgid "geonames.js" 42637msgstr "" 42638 42639#. (itstool) path: section/p 42640#: C/weatherGeonames.js.page:103 42641msgid "" 42642"Here is the entire code for our local library. The main program file calls " 42643"this asynchronously." 42644msgstr "" 42645 42646#. (itstool) path: section/code 42647#: C/weatherGeonames.js.page:104 42648#, no-wrap 42649msgid "" 42650"\n" 42651"const Soup = imports.gi.Soup;\n" 42652"const _httpSession = new Soup.SessionAsync();\n" 42653"Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());\n" 42654"\n" 42655"function GeoNames(station) {\n" 42656" this.station = station;\n" 42657"}\n" 42658"\n" 42659"GeoNames.prototype = {\n" 42660" getWeather: function(callback) {\n" 42661" var request = Soup.Message.new('GET', 'http://api.geonames.org/weatherIcaoJSON?ICAO=' + this.station + '&username=demo');\n" 42662" _httpSession.queue_message(request, function(_httpSession, message) {\n" 42663" if (message.status_code !== 200) {\n" 42664" callback(message.status_code, null);\n" 42665" return;\n" 42666" }\n" 42667" var weatherJSON = request.response_body.data;\n" 42668" var weather = JSON.parse(weatherJSON);\n" 42669" callback(null, weather);\n" 42670" });\n" 42671" },\n" 42672"\n" 42673" getIcon: function(weather){\n" 42674" switch (weather.weatherObservation.weatherCondition){\n" 42675" case \"drizzle\":\n" 42676" case \"light showers rain\":\n" 42677" case \"light rain\":\n" 42678" return \"weather-showers-scattered.svg\";\n" 42679" case \"rain\":\n" 42680" return \"weather-showers.svg\";\n" 42681" case \"light snow\":\n" 42682" case \"snow grains\":\n" 42683" return \"weather-snow.svg\";\n" 42684" }\n" 42685" switch (weather.weatherObservation.clouds){\n" 42686" case \"few clouds\":\n" 42687" case \"scattered clouds\":\n" 42688" return \"weather-few-clouds.svg\";\n" 42689" case \"clear sky\":\n" 42690" return \"weather-clear.svg\"\n" 42691" case \"broken clouds\":\n" 42692" case \"overcast\":\n" 42693" return \"weather-overcast.svg\";\n" 42694" }\n" 42695" return \"weather-fog.svg\";\n" 42696" }\n" 42697"}\n" 42698"} " 42699msgstr "" 42700 42701#. (itstool) path: info/title 42702#: C/widget_drawing.py.page:8 42703#, fuzzy 42704msgctxt "text" 42705msgid "Widget (Python)" 42706msgstr "Widget:" 42707 42708#. (itstool) path: info/desc 42709#: C/widget_drawing.py.page:18 42710msgid "A widget that uses the Cairo library to draw" 42711msgstr "" 42712 42713#. (itstool) path: page/title 42714#: C/widget_drawing.py.page:21 42715#, fuzzy 42716msgid "Widget" 42717msgstr "WIDGET" 42718 42719#. (itstool) path: page/media 42720#. This is a reference to an external file such as an image or video. When 42721#. the file changes, the md5 hash will change to let you know you need to 42722#. update your localized copy. The msgstr is not used at all. Set it to 42723#. whatever you like once you have updated your copy of the file. 42724#: C/widget_drawing.py.page:22 42725msgctxt "_" 42726msgid "" 42727"external ref='media/widget_drawing.png' " 42728"md5='d00abd8cb9e158018c57fd75b81dfe58'" 42729msgstr "" 42730 42731#. (itstool) path: page/p 42732#: C/widget_drawing.py.page:23 42733#, fuzzy 42734msgid "Enter an angle, visualize it." 42735msgstr "Visualizar" 42736 42737#. (itstool) path: section/code 42738#: C/widget_drawing.py.page:30 42739#, no-wrap 42740msgid "" 42741"from gi.repository import Gtk\n" 42742"from gi.repository import cairo\n" 42743"import sys\n" 42744"import math\n" 42745"\n" 42746"\n" 42747"class MyWindow(Gtk.ApplicationWindow):\n" 42748"\n" 42749" def __init__(self, app):\n" 42750" Gtk.Window.__init__(self, title=\"Choose an angle\", application=app)\n" 42751" self.set_default_size(400, 400)\n" 42752" self.set_border_width(10)\n" 42753"\n" 42754" # a default angle\n" 42755" self.angle = 360\n" 42756"\n" 42757" grid = Gtk.Grid()\n" 42758"\n" 42759" # a spinbutton that takes the value of an angle\n" 42760" ad = Gtk.Adjustment(360, 0, 360, 1, 0, 0)\n" 42761" self.spin = Gtk.SpinButton(adjustment=ad, climb_rate=1, digits=0)\n" 42762" self.spin.connect(\"value-changed\", self.get_angle)\n" 42763"\n" 42764" # a drawing area for drawing whatever we want\n" 42765" self.darea = Gtk.DrawingArea()\n" 42766" # that we describe in the method draw(), connected to the signal \"draw\"\n" 42767" self.darea.connect(\"draw\", self.draw)\n" 42768" # we have to request a minimum size of the drawing area, or it will\n" 42769" # disappear\n" 42770" self.darea.set_size_request(300, 300)\n" 42771"\n" 42772" grid.attach(self.spin, 0, 0, 1, 1)\n" 42773" grid.attach(self.darea, 0, 1, 1, 1)\n" 42774"\n" 42775" self.add(grid)\n" 42776"\n" 42777" # whenever we get a new angle in the spinbutton\n" 42778" def get_angle(self, event):\n" 42779" self.angle = self.spin.get_value_as_int()\n" 42780" # redraw what is in the drawing area\n" 42781" self.darea.queue_draw()\n" 42782"\n" 42783" def draw(self, darea, cr):\n" 42784" # a 10-pixels-wide line\n" 42785" cr.set_line_width(10)\n" 42786" # red\n" 42787" cr.set_source_rgba(0.5, 0.0, 0.0, 1.0)\n" 42788"\n" 42789" # get the width and height of the drawing area\n" 42790" w = self.darea.get_allocated_width()\n" 42791" h = self.darea.get_allocated_height()\n" 42792"\n" 42793" # move to the center of the drawing area\n" 42794" # (translate from the top left corner to w/2, h/2)\n" 42795" cr.translate(w / 2, h / 2)\n" 42796" # draw a line to (55, 0)\n" 42797" cr.line_to(55, 0)\n" 42798" # and get back to (0, 0)\n" 42799" cr.line_to(0, 0)\n" 42800" # draw an arc centered in the origin, 50 pixels wide, from the angle 0\n" 42801" # (in radians) to the angle given by the spinbutton (in degrees)\n" 42802" cr.arc(0, 0, 50, 0, self.angle * (math.pi / 180))\n" 42803" # draw a line back to the origin\n" 42804" cr.line_to(0, 0)\n" 42805" # drawing the path, and keeping the path for future use\n" 42806" cr.stroke_preserve()\n" 42807"\n" 42808" # set a colour\n" 42809" cr.set_source_rgba(0.0, 0.5, 0.5, 1.0)\n" 42810" # and use it to fill the path (that we had kept)\n" 42811" cr.fill()\n" 42812"\n" 42813"\n" 42814"class MyApplication(Gtk.Application):\n" 42815"\n" 42816" def __init__(self):\n" 42817" Gtk.Application.__init__(self)\n" 42818"\n" 42819" def do_activate(self):\n" 42820" win = MyWindow(self)\n" 42821" win.show_all()\n" 42822"\n" 42823" def do_startup(self):\n" 42824" Gtk.Application.do_startup(self)\n" 42825"\n" 42826"app = MyApplication()\n" 42827"exit_status = app.run(sys.argv)\n" 42828"sys.exit(exit_status)\n" 42829msgstr "" 42830 42831#. (itstool) path: item/p 42832#: C/widget_drawing.py.page:39 42833#, fuzzy 42834#| msgid "" 42835#| "<link href=\"http://live.gnome.org/DeveloperTools/Installation\">Others</" 42836#| "link>" 42837msgid "" 42838"<link href=\"http://developer.gnome.org/gtk3/unstable/GtkDrawingArea.html" 42839"\">GtkDrawingArea</link>" 42840msgstr "" 42841"<link href=\"http://live.gnome.org/DeveloperTools/Installation\">Outras</" 42842"link>" 42843 42844#. (itstool) path: item/p 42845#: C/widget_drawing.py.page:40 42846msgid "" 42847"<link href=\"http://www.tortall.net/mu/wiki/CairoTutorial\">The Cairo " 42848"Tutorial for Python Programmers</link>" 42849msgstr "" 42850 42851#. (itstool) path: info/title 42852#: C/window.c.page:8 42853#, fuzzy 42854msgctxt "text" 42855msgid "Window (C)" 42856msgstr "_Fechar janela" 42857 42858#. (itstool) path: info/desc 42859#: C/window.c.page:18 C/window.py.page:25 C/window.vala.page:18 42860msgid "A toplevel window which can contain other widgets" 42861msgstr "" 42862 42863#. (itstool) path: page/title 42864#: C/window.c.page:21 C/window.js.page:21 C/window.py.page:28 42865#: C/window.vala.page:21 42866#, fuzzy 42867msgid "Window" 42868msgstr "Janela" 42869 42870#. (itstool) path: page/p 42871#: C/window.c.page:24 42872msgid "" 42873"A minimal GtkApplication. Use <link xref=\"GtkApplicationWindow.c" 42874"\">Application Window</link> if you need GMenu support." 42875msgstr "" 42876 42877#. (itstool) path: page/code 42878#: C/window.c.page:28 42879#, no-wrap 42880msgid "" 42881"\n" 42882"#include <gtk/gtk.h>\n" 42883"\n" 42884"static void\n" 42885"activate (GtkApplication *app,\n" 42886" gpointer user_data)\n" 42887"{\n" 42888" GtkWidget *window;\n" 42889"\n" 42890" window = gtk_window_new (GTK_WINDOW_TOPLEVEL);\n" 42891"\n" 42892" gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));\n" 42893" gtk_window_set_title (GTK_WINDOW (window), \"Hello GNOME\");\n" 42894"\n" 42895" gtk_widget_show_all (GTK_WIDGET (window));\n" 42896"}\n" 42897"\n" 42898"int\n" 42899"main (int argc, char **argv)\n" 42900"{\n" 42901" GtkApplication *app;\n" 42902" int status;\n" 42903"\n" 42904" app = gtk_application_new (\"org.gtk.example\",G_APPLICATION_FLAGS_NONE);\n" 42905" g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);\n" 42906" status = g_application_run (G_APPLICATION (app), argc, argv);\n" 42907" g_object_unref (app);\n" 42908" return status;\n" 42909"}\n" 42910msgstr "" 42911 42912#. (itstool) path: info/title 42913#: C/window.js.page:8 42914#, fuzzy 42915msgctxt "text" 42916msgid "Window (JavaScript)" 42917msgstr "_JavaScript" 42918 42919#. (itstool) path: info/desc 42920#: C/window.js.page:18 42921msgid "A basic window which can contain other widgets" 42922msgstr "" 42923 42924#. (itstool) path: td/p 42925#: C/window.js.page:26 42926#, fuzzy 42927msgid "A minimal GtkApplication" 42928msgstr "GtkApplication" 42929 42930#. (itstool) path: td/p 42931#: C/window.js.page:29 42932msgid "" 42933"Use <link xref=\"GtkApplicationWindow.js\">ApplicationWindow</link> if you " 42934"need GMenu support." 42935msgstr "" 42936 42937#. (itstool) path: page/code 42938#: C/window.js.page:33 42939#, no-wrap 42940msgid "" 42941"\n" 42942"#!/usr/bin/gjs\n" 42943"\n" 42944"imports.gi.versions.Gtk = '3.0';\n" 42945"\n" 42946"const Gio = imports.gi.Gio;\n" 42947"const GLib = imports.gi.GLib;\n" 42948"const Gtk = imports.gi.Gtk;\n" 42949"\n" 42950"class Application {\n" 42951" //create the application\n" 42952" constructor() {\n" 42953" this.application = new Gtk.Application({\n" 42954" application_id: 'org.example.myapp',\n" 42955" flags: Gio.ApplicationFlags.FLAGS_NONE\n" 42956" });\n" 42957"\n" 42958" this.application.connect('activate', this._onActivate.bind(this));\n" 42959" }\n" 42960"\n" 42961" //callback function for 'activate' signal\n" 42962" _onActivate() {\n" 42963" let myWindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});\n" 42964" myWindow.title = \"Welcome to GNOME\";\n" 42965"\n" 42966" /* Here are a few ways we can customize our window.\n" 42967" Try uncommenting them or changing their values! */\n" 42968" //myWindow.set_default_size (400,200);\n" 42969" //myWindow.set_has_resize_grip (false);\n" 42970" //myWindow.set_opacity (0.5);\n" 42971" //myWindow.maximize ();\n" 42972"\n" 42973" //show the window and all child widgets (none in this case)\n" 42974" myWindow.show_all();\n" 42975" this.application.add_window(myWindow);\n" 42976" }\n" 42977"};\n" 42978"\n" 42979"//run the application\n" 42980"let app = new Application ();\n" 42981"app.application.run (ARGV);\n" 42982msgstr "" 42983 42984#. (itstool) path: page/p 42985#: C/window.js.page:35 42986#, fuzzy 42987msgid "In this example we used the following:" 42988msgstr "A seguir estão os exemplos que nós apresentamos:" 42989 42990#. (itstool) path: item/p 42991#: C/window.js.page:40 42992msgid "" 42993"<link href=\"http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/Gtk.Window.html" 42994"\">Gtk.Window</link>" 42995msgstr "" 42996 42997#. (itstool) path: info/title 42998#: C/window.py.page:8 42999#, fuzzy 43000msgctxt "text" 43001msgid "Window (Python)" 43002msgstr "_Python" 43003 43004#. (itstool) path: td/p 43005#: C/window.py.page:34 43006#, fuzzy 43007msgid "A minimal GTK+ Application: a window with a title." 43008msgstr "" 43009"Mostrar o título do aplicativo e ícone de fechar\n" 43010"para as janelas ativas" 43011 43012#. (itstool) path: td/p 43013#: C/window.py.page:37 43014msgid "" 43015"Use <link xref=\"GtkApplicationWindow.py\"/> if you need <link xref=\"gmenu." 43016"py\"/> support." 43017msgstr "" 43018 43019#. (itstool) path: section/code 43020#: C/window.py.page:47 43021#, no-wrap 43022msgid "" 43023"from gi.repository import Gtk\n" 43024"import sys\n" 43025"\n" 43026"\n" 43027"class MyApplication(Gtk.Application):\n" 43028"\n" 43029" def do_activate(self):\n" 43030" # create a Gtk Window belonging to the application itself\n" 43031" window = Gtk.Window(application=self)\n" 43032" # set the title\n" 43033" window.set_title(\"Welcome to GNOME\")\n" 43034" # show the window\n" 43035" window.show_all()\n" 43036"\n" 43037"# create and run the application, exit with the value returned by\n" 43038"# running the program\n" 43039"app = MyApplication()\n" 43040"exit_status = app.run(sys.argv)\n" 43041"sys.exit(exit_status)\n" 43042msgstr "" 43043 43044#. (itstool) path: section/title 43045#: C/window.py.page:52 43046#, fuzzy 43047msgid "Useful methods for a Window widget" 43048msgstr "Métodos úteis" 43049 43050#. (itstool) path: info/title 43051#: C/window.vala.page:8 43052#, fuzzy 43053msgctxt "text" 43054msgid "Window (Vala)" 43055msgstr "_Vala" 43056 43057#. (itstool) path: td/p 43058#: C/window.vala.page:26 43059msgid "The simplest Gtk.Application" 43060msgstr "" 43061 43062#. (itstool) path: td/p 43063#: C/window.vala.page:29 43064msgid "" 43065"Use <link xref=\"GtkApplicationWindow.vala\">Application Window</link> if " 43066"you need GMenu support." 43067msgstr "" 43068 43069#. (itstool) path: page/code 43070#: C/window.vala.page:33 43071#, no-wrap 43072msgid "" 43073"/* This is the application. */\n" 43074"public class Application : Gtk.Application {\n" 43075"\n" 43076"\t/* Constructor */\n" 43077"\tpublic Application () {\n" 43078"\t\tObject (application_id: \"org.example.window\");\n" 43079"\t}\n" 43080"\n" 43081"\t/* Override the 'activate' signal of GLib.Application,\n" 43082"\t * which is inherited by Gtk.Application. */\n" 43083"\tpublic override void activate () {\n" 43084"\n" 43085"\t\tvar window = new Gtk.Window ();\n" 43086"\t\twindow.title = \"Welcome to GNOME\";\n" 43087"\n" 43088"\t\t/* The following 3 lines are included here to introduce\n" 43089"\t\t * you to ways you can adjust the toplevel window to suit\n" 43090"\t\t * your needs. Uncomment them to see what they do.\n" 43091"\t\t */\n" 43092"\n" 43093"\t\t//window.border_width = 10;\n" 43094"\t\t//window.set_default_size (350, 70);\n" 43095"\t\t//window.window_position = Gtk.WindowPosition.CENTER;\n" 43096"\n" 43097"\t\t/* Add the window to this application. */\n" 43098"\t\tthis.add_window (window);\n" 43099"\n" 43100"\t\t/* Show the window. */\n" 43101"\t\twindow.show ();\n" 43102"\t}\n" 43103"}\n" 43104"\n" 43105"/* The main function creates the application and runs it.*/\n" 43106"int main (string[] args) {\n" 43107"\tvar app = new Application ();\n" 43108"\treturn app.run (args);\n" 43109"}\n" 43110msgstr "" 43111 43112#. (itstool) path: item/p 43113#: C/window.vala.page:39 43114msgid "" 43115"The widget <link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Window.html" 43116"\">Gtk.Window</link>" 43117msgstr "" 43118 43119#. (itstool) path: item/p 43120#: C/window.vala.page:41 43121msgid "" 43122"The enum <link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.WindowPosition.html" 43123"\">Gtk.WindowPosition</link>" 43124msgstr "" 43125 43126#. (itstool) path: item/p 43127#: C/window.vala.page:43 43128msgid "" 43129"The method <link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Window." 43130"set_default_size.html\">set_default_size</link>" 43131msgstr "" 43132 43133#. (itstool) path: item/p 43134#: C/window.vala.page:45 43135msgid "" 43136"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Container.border_width.html" 43137"\">border_width</link>" 43138msgstr "" 43139 43140#. (itstool) path: item/p 43141#: C/window.vala.page:47 43142msgid "" 43143"<link href=\"http://www.valadoc.org/gtk+-3.0/Gtk.Window.window_position.html" 43144"\">window_position</link>" 43145msgstr "" 43146 43147#. (itstool) path: credit/name 43148#: C/custom-gsource.c.page:11 43149#, fuzzy 43150msgid "Philip Withnall" 43151msgstr "Philip Withnall" 43152 43153#. (itstool) path: credit/years 43154#: C/custom-gsource.c.page:13 43155#, fuzzy 43156msgid "2015" 43157msgstr "2015" 43158 43159#. (itstool) path: info/desc 43160#: C/custom-gsource.c.page:18 43161msgid "Tutorial for writing a custom <code>GSource</code> implementation" 43162msgstr "" 43163 43164#. (itstool) path: page/title 43165#: C/custom-gsource.c.page:23 43166#, fuzzy 43167msgid "Custom GSources" 43168msgstr "(Personalizar…)" 43169 43170#. (itstool) path: synopsis/title 43171#: C/custom-gsource.c.page:26 43172#, fuzzy 43173msgid "Summary" 43174msgstr "Resumo" 43175 43176#. (itstool) path: synopsis/p 43177#: C/custom-gsource.c.page:28 43178msgid "" 43179"This article is a tutorial on creating a custom <code>GSource</code>. For " 43180"the reference documentation, see the <link href=\"https://developer.gnome." 43181"org/glib/stable/glib-The-Main-Event-Loop.html#GSource\">GLib API reference</" 43182"link>." 43183msgstr "" 43184 43185#. (itstool) path: section/title 43186#: C/custom-gsource.c.page:37 43187#, fuzzy 43188msgid "What is <code>GSource</code>?" 43189msgstr "O que é <code>GMainLoop</code>?" 43190 43191#. (itstool) path: section/p 43192#: C/custom-gsource.c.page:39 43193msgid "" 43194"A <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-" 43195"Loop.html#GSource\"><code>GSource</code></link> is an expected event with an " 43196"associated callback function which will be invoked when that event is " 43197"received. An event could be a timeout or data being received on a socket, " 43198"for example." 43199msgstr "" 43200 43201#. (itstool) path: section/p 43202#: C/custom-gsource.c.page:46 43203msgid "" 43204"GLib contains various types of <code>GSource</code>, but also allows " 43205"applications to define their own, allowing custom events to be integrated " 43206"into the main loop." 43207msgstr "" 43208 43209#. (itstool) path: section/p 43210#: C/custom-gsource.c.page:52 43211msgid "" 43212"The structure of a <code>GSource</code> and its virtual functions are " 43213"documented in detail in the <link href=\"https://developer.gnome.org/glib/" 43214"stable/glib-The-Main-Event-Loop.html#GSourceFuncs\">GLib API reference</" 43215"link>." 43216msgstr "" 43217 43218#. (itstool) path: section/title 43219#: C/custom-gsource.c.page:61 43220#, fuzzy 43221msgid "A Message Queue Source" 43222msgstr "criação de fila de mensagem falhou" 43223 43224#. (itstool) path: section/p 43225#: C/custom-gsource.c.page:63 43226msgid "" 43227"As a running example, a message queue source will be used which dispatches " 43228"its callback whenever a message is enqueued to a queue internal to the " 43229"source (potentially from another thread)." 43230msgstr "" 43231 43232#. (itstool) path: section/p 43233#: C/custom-gsource.c.page:69 43234msgid "" 43235"This type of source is useful for efficiently transferring large numbers of " 43236"messages between main contexts. The alternative is transferring each message " 43237"as a separate idle <code>GSource</code> using <code>g_source_attach()</" 43238"code>. For large numbers of messages, this means a lot of allocations and " 43239"frees of <code>GSource</code>s." 43240msgstr "" 43241 43242#. (itstool) path: section/title 43243#: C/custom-gsource.c.page:78 43244#, fuzzy 43245msgid "Structure" 43246msgstr "Estrutura" 43247 43248#. (itstool) path: section/p 43249#: C/custom-gsource.c.page:80 43250msgid "" 43251"Firstly, a structure for the source needs to be declared. This must contain " 43252"a <code>GSource</code> as its parent, followed by the private fields for the " 43253"source: the queue and a function to call to free each message once finished " 43254"with." 43255msgstr "" 43256 43257#. (itstool) path: section/code 43258#: C/custom-gsource.c.page:86 43259#, no-wrap 43260msgid "" 43261"\n" 43262"typedef struct {\n" 43263" GSource parent;\n" 43264" GAsyncQueue *queue; /* owned */\n" 43265" GDestroyNotify destroy_message;\n" 43266"} MessageQueueSource;" 43267msgstr "" 43268 43269#. (itstool) path: section/title 43270#: C/custom-gsource.c.page:95 43271#, fuzzy 43272msgid "Prepare Function" 43273msgstr "Preparar um email" 43274 43275#. (itstool) path: section/p 43276#: C/custom-gsource.c.page:97 43277msgid "" 43278"Next, the prepare function for the source must be defined. This determines " 43279"whether the source is ready to be dispatched. As this source is using an in-" 43280"memory queue, this can be determined by checking the queue’s length: if " 43281"there are elements in the queue, the source can be dispatched to handle them." 43282msgstr "" 43283 43284#. (itstool) path: section/code 43285#: C/custom-gsource.c.page:104 43286#, no-wrap 43287msgid "" 43288"\n" 43289"return (g_async_queue_length (message_queue_source->queue) > 0);" 43290msgstr "" 43291 43292#. (itstool) path: section/title 43293#: C/custom-gsource.c.page:109 43294#, fuzzy 43295msgid "Check Function" 43296msgstr "" 43297"O item foi renumerado porque o lançador não informou nenhuma função de " 43298"verificação." 43299 43300#. (itstool) path: section/p 43301#: C/custom-gsource.c.page:111 43302msgid "" 43303"As this source has no file descriptors, the prepare and check functions " 43304"essentially have the same job, so a check function is not needed. Setting " 43305"the field to <code>NULL</code> in <code>GSourceFuncs</code> bypasses the " 43306"check function for this source type." 43307msgstr "" 43308 43309#. (itstool) path: section/title 43310#: C/custom-gsource.c.page:120 43311#, fuzzy 43312msgid "Dispatch Function" 43313msgstr "Fun@,{c}@~{a}o" 43314 43315#. (itstool) path: section/p 43316#: C/custom-gsource.c.page:122 43317msgid "" 43318"For this source, the dispatch function is where the complexity lies. It " 43319"needs to dequeue a message from the queue, then pass that message to the " 43320"<code>GSource</code>’s callback function. No messages may be queued: even " 43321"through the prepare function returned true, another source wrapping the same " 43322"queue may have been dispatched in the mean time and taken the final message " 43323"from the queue. Further, if no callback has been set for the <code>GSource</" 43324"code> (which is allowed), the message must be destroyed and silently dropped." 43325msgstr "" 43326 43327#. (itstool) path: section/p 43328#: C/custom-gsource.c.page:133 43329msgid "" 43330"If both a message and callback are set, the callback can be invoked on the " 43331"message and its return value propagated as the return value of the dispatch " 43332"function. This is <code>FALSE</code> to destroy the <code>GSource</code> and " 43333"<code>TRUE</code> to keep it alive, just as for <code>GSourceFunc</code> — " 43334"these semantics are the same for all dispatch function implementations." 43335msgstr "" 43336 43337#. (itstool) path: section/code 43338#: C/custom-gsource.c.page:141 43339#, no-wrap 43340msgid "" 43341"\n" 43342"/* Pop a message off the queue. */\n" 43343"message = g_async_queue_try_pop (message_queue_source->queue);\n" 43344"\n" 43345"/* If there was no message, bail. */\n" 43346"if (message == NULL)\n" 43347" {\n" 43348" /* Keep the source around to handle the next message. */\n" 43349" return TRUE;\n" 43350" }\n" 43351"\n" 43352"/* @func may be %NULL if no callback was specified.\n" 43353" * If so, drop the message. */\n" 43354"if (func == NULL)\n" 43355" {\n" 43356" if (message_queue_source->destroy_message != NULL)\n" 43357" {\n" 43358" message_queue_source->destroy_message (message);\n" 43359" }\n" 43360"\n" 43361" /* Keep the source around to consume the next message. */\n" 43362" return TRUE;\n" 43363" }\n" 43364"\n" 43365"return func (message, user_data);" 43366msgstr "" 43367 43368#. (itstool) path: section/title 43369#: C/custom-gsource.c.page:169 43370#, fuzzy 43371msgid "Callback Functions" 43372msgstr "chamada" 43373 43374#. (itstool) path: section/p 43375#: C/custom-gsource.c.page:171 43376msgid "" 43377"The callback from a <code>GSource</code> does not have to have type " 43378"<code>GSourceFunc</code>. It can be whatever function type is called in the " 43379"source’s dispatch function, as long as that type is sufficiently documented." 43380msgstr "" 43381 43382#. (itstool) path: section/p 43383#: C/custom-gsource.c.page:178 43384msgid "" 43385"Normally, <code>g_source_set_callback()</code> is used to set the callback " 43386"function for a source instance. With its <code>GDestroyNotify</code>, a " 43387"strong reference can be held to keep an object alive while the source is " 43388"still alive:" 43389msgstr "" 43390 43391#. (itstool) path: section/code 43392#: C/custom-gsource.c.page:184 43393#, no-wrap 43394msgid "" 43395"\n" 43396"g_source_set_callback (source, callback_func,\n" 43397" g_object_ref (object_to_strong_ref),\n" 43398" (GDestroyNotify) g_object_unref);" 43399msgstr "" 43400 43401#. (itstool) path: section/p 43402#: C/custom-gsource.c.page:189 43403msgid "" 43404"However, <code>GSource</code> has a layer of indirection for retrieving this " 43405"callback, exposed as <code>g_source_set_callback_indirect()</code>. This " 43406"allows GObject to set a <code>GClosure</code> as the callback for a source, " 43407"which allows for sources which are automatically destroyed when an object is " 43408"finalized — a <em>weak</em> reference, in contrast to the <em>strong</em> " 43409"reference above:" 43410msgstr "" 43411 43412#. (itstool) path: section/code 43413#: C/custom-gsource.c.page:197 43414#, no-wrap 43415msgid "" 43416"\n" 43417"g_source_set_closure (source,\n" 43418" g_cclosure_new_object (callback_func,\n" 43419" object_to_weak_ref));" 43420msgstr "" 43421 43422#. (itstool) path: section/p 43423#: C/custom-gsource.c.page:202 43424msgid "" 43425"It also allows for a generic, closure-based ‘dummy’ callback, which can be " 43426"used when a source needs to exist but no action needs to be performed in its " 43427"callback:" 43428msgstr "" 43429 43430#. (itstool) path: section/code 43431#: C/custom-gsource.c.page:207 43432#, no-wrap 43433msgid "" 43434"\n" 43435"g_source_set_dummy_callback (source);" 43436msgstr "" 43437 43438#. (itstool) path: section/title 43439#: C/custom-gsource.c.page:212 43440#, fuzzy 43441msgid "Constructor" 43442msgstr "Adiciona um construtor padrão." 43443 43444#. (itstool) path: section/p 43445#: C/custom-gsource.c.page:214 43446msgid "" 43447"Finally, the <code>GSourceFuncs</code> definition of the <code>GSource</" 43448"code> can be written, alongside a construction function. It is typical " 43449"practice to expose new source types simply as <code>GSource</code>s, not as " 43450"the subtype structure; so the constructor returns a <code>GSource*</code>." 43451msgstr "" 43452 43453#. (itstool) path: section/p 43454#: C/custom-gsource.c.page:222 43455msgid "" 43456"The example constructor here also demonstrates use of a child source to " 43457"support cancellation conveniently. If the <code>GCancellable</code> is " 43458"cancelled, the application’s callback will be dispatched and can check for " 43459"cancellation. (The application code will need to make a pointer to the " 43460"<code>GCancellable</code> available to its callback, as a field of the " 43461"callback’s user data set in <code>g_source_set_callback()</code>)." 43462msgstr "" 43463 43464#. (itstool) path: section/code 43465#: C/custom-gsource.c.page:230 43466#, no-wrap 43467msgid "" 43468"\n" 43469"GSource *\n" 43470"message_queue_source_new (GAsyncQueue *queue,\n" 43471" GDestroyNotify destroy_message,\n" 43472" GCancellable *cancellable)\n" 43473"{\n" 43474" GSource *source; /* alias of @message_queue_source */\n" 43475" MessageQueueSource *message_queue_source; /* alias of @source */\n" 43476"\n" 43477" g_return_val_if_fail (queue != NULL, NULL);\n" 43478" g_return_val_if_fail (cancellable == NULL ||\n" 43479" G_IS_CANCELLABLE (cancellable), NULL);\n" 43480"\n" 43481" source = g_source_new (&message_queue_source_funcs,\n" 43482" sizeof (MessageQueueSource));\n" 43483" message_queue_source = (MessageQueueSource *) source;\n" 43484"\n" 43485" /* The caller can overwrite this name with something more useful later. */\n" 43486" g_source_set_name (source, \"MessageQueueSource\");\n" 43487"\n" 43488" message_queue_source->queue = g_async_queue_ref (queue);\n" 43489" message_queue_source->destroy_message = destroy_message;\n" 43490"\n" 43491" /* Add a cancellable source. */\n" 43492" if (cancellable != NULL)\n" 43493" {\n" 43494" GSource *cancellable_source;\n" 43495"\n" 43496" cancellable_source = g_cancellable_source_new (cancellable);\n" 43497" g_source_set_dummy_callback (cancellable_source);\n" 43498" g_source_add_child_source (source, cancellable_source);\n" 43499" g_source_unref (cancellable_source);\n" 43500" }\n" 43501"\n" 43502" return source;\n" 43503"}" 43504msgstr "" 43505 43506#. (itstool) path: section/title 43507#: C/custom-gsource.c.page:270 43508#, fuzzy 43509#| msgid "Complete code sample" 43510msgid "Complete Example" 43511msgstr "Incompleto" 43512 43513#. (itstool) path: listing/title 43514#: C/custom-gsource.c.page:273 43515#, fuzzy 43516#| msgid "Complete code sample" 43517msgid "Complete Example Code" 43518msgstr "Amostra de código completo" 43519 43520#. (itstool) path: listing/code 43521#: C/custom-gsource.c.page:275 43522#, no-wrap 43523msgid "" 43524"/**\n" 43525" * MessageQueueSource:\n" 43526" *\n" 43527" * This is a #GSource which wraps a #GAsyncQueue and is dispatched whenever a\n" 43528" * message can be pulled off the queue. Messages can be enqueued from any\n" 43529" * thread.\n" 43530" *\n" 43531" * The callbacks dispatched by a #MessageQueueSource have type\n" 43532" * #MessageQueueSourceFunc.\n" 43533" *\n" 43534" * #MessageQueueSource supports adding a #GCancellable child source which will\n" 43535" * additionally dispatch if a provided #GCancellable is cancelled.\n" 43536" */\n" 43537"typedef struct {\n" 43538" GSource parent;\n" 43539" GAsyncQueue *queue; /* owned */\n" 43540" GDestroyNotify destroy_message;\n" 43541"} MessageQueueSource;\n" 43542"\n" 43543"/**\n" 43544" * MessageQueueSourceFunc:\n" 43545" * @message: (transfer full) (nullable): message pulled off the queue\n" 43546" * @user_data: user data provided to g_source_set_callback()\n" 43547" *\n" 43548" * Callback function type for #MessageQueueSource.\n" 43549" */\n" 43550"typedef gboolean (*MessageQueueSourceFunc) (gpointer message,\n" 43551" gpointer user_data);\n" 43552"\n" 43553"static gboolean\n" 43554"message_queue_source_prepare (GSource *source,\n" 43555" gint *timeout_)\n" 43556"{\n" 43557" MessageQueueSource *message_queue_source = (MessageQueueSource *) source;\n" 43558"\n" 43559" return (g_async_queue_length (message_queue_source->queue) > 0);\n" 43560"}\n" 43561"\n" 43562"static gboolean\n" 43563"message_queue_source_dispatch (GSource *source,\n" 43564" GSourceFunc callback,\n" 43565" gpointer user_data)\n" 43566"{\n" 43567" MessageQueueSource *message_queue_source = (MessageQueueSource *) source;\n" 43568" gpointer message;\n" 43569" MessageQueueSourceFunc func = (MessageQueueSourceFunc) callback;\n" 43570"\n" 43571" /* Pop a message off the queue. */\n" 43572" message = g_async_queue_try_pop (message_queue_source->queue);\n" 43573"\n" 43574" /* If there was no message, bail. */\n" 43575" if (message == NULL)\n" 43576" {\n" 43577" /* Keep the source around to handle the next message. */\n" 43578" return TRUE;\n" 43579" }\n" 43580"\n" 43581" /* @func may be %NULL if no callback was specified.\n" 43582" * If so, drop the message. */\n" 43583" if (func == NULL)\n" 43584" {\n" 43585" if (message_queue_source->destroy_message != NULL)\n" 43586" {\n" 43587" message_queue_source->destroy_message (message);\n" 43588" }\n" 43589"\n" 43590" /* Keep the source around to consume the next message. */\n" 43591" return TRUE;\n" 43592" }\n" 43593"\n" 43594" return func (message, user_data);\n" 43595"}\n" 43596"\n" 43597"static void\n" 43598"message_queue_source_finalize (GSource *source)\n" 43599"{\n" 43600" MessageQueueSource *message_queue_source = (MessageQueueSource *) source;\n" 43601"\n" 43602" g_async_queue_unref (message_queue_source->queue);\n" 43603"}\n" 43604"\n" 43605"static gboolean\n" 43606"message_queue_source_closure_callback (gpointer message,\n" 43607" gpointer user_data)\n" 43608"{\n" 43609" GClosure *closure = user_data;\n" 43610" GValue param_value = G_VALUE_INIT;\n" 43611" GValue result_value = G_VALUE_INIT;\n" 43612" gboolean retval;\n" 43613"\n" 43614" /* The invoked function is responsible for freeing @message. */\n" 43615" g_value_init (&result_value, G_TYPE_BOOLEAN);\n" 43616" g_value_init (&param_value, G_TYPE_POINTER);\n" 43617" g_value_set_pointer (&param_value, message);\n" 43618"\n" 43619" g_closure_invoke (closure, &result_value, 1, &param_value, NULL);\n" 43620" retval = g_value_get_boolean (&result_value);\n" 43621"\n" 43622" g_value_unset (&param_value);\n" 43623" g_value_unset (&result_value);\n" 43624"\n" 43625" return retval;\n" 43626"}\n" 43627"\n" 43628"static GSourceFuncs message_queue_source_funcs =\n" 43629" {\n" 43630" message_queue_source_prepare,\n" 43631" NULL, /* check */\n" 43632" message_queue_source_dispatch,\n" 43633" message_queue_source_finalize,\n" 43634" (GSourceFunc) message_queue_source_closure_callback,\n" 43635" NULL,\n" 43636" };\n" 43637"\n" 43638"/**\n" 43639" * message_queue_source_new:\n" 43640" * @queue: the queue to check\n" 43641" * @destroy_message: (nullable): function to free a message, or %NULL\n" 43642" * @cancellable: (nullable): a #GCancellable, or %NULL\n" 43643" *\n" 43644" * Create a new #MessageQueueSource, a type of #GSource which dispatches for\n" 43645" * each message queued to it.\n" 43646" *\n" 43647" * If a callback function of type #MessageQueueSourceFunc is connected to the\n" 43648" * returned #GSource using g_source_set_callback(), it will be invoked for each\n" 43649" * message, with the message passed as its first argument. It is responsible for\n" 43650" * freeing the message. If no callback is set, messages are automatically freed\n" 43651" * as they are queued.\n" 43652" *\n" 43653" * Returns: (transfer full): a new #MessageQueueSource\n" 43654" */\n" 43655"GSource *\n" 43656"message_queue_source_new (GAsyncQueue *queue,\n" 43657" GDestroyNotify destroy_message,\n" 43658" GCancellable *cancellable)\n" 43659"{\n" 43660" GSource *source; /* alias of @message_queue_source */\n" 43661" MessageQueueSource *message_queue_source; /* alias of @source */\n" 43662"\n" 43663" g_return_val_if_fail (queue != NULL, NULL);\n" 43664" g_return_val_if_fail (cancellable == NULL ||\n" 43665" G_IS_CANCELLABLE (cancellable), NULL);\n" 43666"\n" 43667" source = g_source_new (&message_queue_source_funcs,\n" 43668" sizeof (MessageQueueSource));\n" 43669" message_queue_source = (MessageQueueSource *) source;\n" 43670"\n" 43671" /* The caller can overwrite this name with something more useful later. */\n" 43672" g_source_set_name (source, \"MessageQueueSource\");\n" 43673"\n" 43674" message_queue_source->queue = g_async_queue_ref (queue);\n" 43675" message_queue_source->destroy_message = destroy_message;\n" 43676"\n" 43677" /* Add a cancellable source. */\n" 43678" if (cancellable != NULL)\n" 43679" {\n" 43680" GSource *cancellable_source;\n" 43681"\n" 43682" cancellable_source = g_cancellable_source_new (cancellable);\n" 43683" g_source_set_dummy_callback (cancellable_source);\n" 43684" g_source_add_child_source (source, cancellable_source);\n" 43685" g_source_unref (cancellable_source);\n" 43686" }\n" 43687"\n" 43688" return source;\n" 43689"}\n" 43690msgstr "" 43691 43692#. (itstool) path: section/title 43693#: C/custom-gsource.c.page:282 43694#, fuzzy 43695msgid "Further Examples" 43696msgstr "Nenhuma outra ocorrência" 43697 43698#. (itstool) path: section/p 43699#: C/custom-gsource.c.page:284 43700msgid "" 43701"Sources can be more complex than the example given above. In <link href=" 43702"\"http://nice.freedesktop.org/\">libnice</link>, a custom <code>GSource</" 43703"code> is needed to poll a set of sockets which changes dynamically. The " 43704"implementation is given as <code>ComponentSource</code> in <link href=" 43705"\"http://cgit.freedesktop.org/libnice/libnice/tree/agent/component." 43706"c#n941\">component.c</link> and demonstrates a more complex use of the " 43707"prepare function." 43708msgstr "" 43709 43710#. (itstool) path: section/p 43711#: C/custom-gsource.c.page:293 43712msgid "" 43713"Another example is a custom source to interface GnuTLS with GLib in its " 43714"<code>GTlsConnection</code> implementation. <link href=\"https://git.gnome." 43715"org/browse/glib-networking/tree/tls/gnutls/gtlsconnection-gnutls." 43716"c#n871\"><code>GTlsConnectionGnutlsSource</code></link> synchronizes the " 43717"main thread and a TLS worker thread which performs the blocking TLS " 43718"operations." 43719msgstr "" 43720 43721#~ msgid "How to set up your development environment" 43722#~ msgstr "Como configurar o ambiente de desenvolvimento" 43723 43724#~ msgid "Get Involved" 43725#~ msgstr "Contribua" 43726 43727#~ msgid "" 43728#~ "\n" 43729#~ "const WelcomeToTheGrid = new Lang.Class({\n" 43730#~ " Name: 'Welcome to the Grid',\n" 43731#~ "\n" 43732#~ " // Create the application itself\n" 43733#~ " _init: function() {\n" 43734#~ " this.application = new Gtk.Application();\n" 43735#~ "\n" 43736#~ " // Connect 'activate' and 'startup' signals to the callback " 43737#~ "functions\n" 43738#~ " this.application.connect('activate', Lang.bind(this, this." 43739#~ "_onActivate));\n" 43740#~ " this.application.connect('startup', Lang.bind(this, this." 43741#~ "_onStartup));\n" 43742#~ " },\n" 43743#~ "\n" 43744#~ " // Callback function for 'activate' signal presents windows when " 43745#~ "active\n" 43746#~ " _onActivate: function() {\n" 43747#~ " this._window.present();\n" 43748#~ " },\n" 43749#~ "\n" 43750#~ " // Callback function for 'startup' signal builds the UI\n" 43751#~ " _onStartup: function() {\n" 43752#~ " this._buildUI ();\n" 43753#~ " },\n" 43754#~ msgstr "" 43755#~ "\n" 43756#~ "const WelcomeToTheGrid = new Lang.Class({\n" 43757#~ " Name: 'Bem-vindo à Grid',\n" 43758#~ "\n" 43759#~ " // Cria o aplicativo em si\n" 43760#~ " _init: function() {\n" 43761#~ " this.application = new Gtk.Application();\n" 43762#~ "\n" 43763#~ " // Conecta os sinais 'activate' e 'startup' para as funções de " 43764#~ "chamada\n" 43765#~ " this.application.connect('activate', Lang.bind(this, this." 43766#~ "_onActivate));\n" 43767#~ " this.application.connect('startup', Lang.bind(this, this." 43768#~ "_onStartup));\n" 43769#~ " },\n" 43770#~ "\n" 43771#~ " // Função de chamada para o sinal 'activate' apresenta janelas quando " 43772#~ "ativa\n" 43773#~ " _onActivate: function() {\n" 43774#~ " this._window.present();\n" 43775#~ " },\n" 43776#~ "\n" 43777#~ " // Função de chamada para sinal 'startup' constrói a interface " 43778#~ "gráfica\n" 43779#~ " _onStartup: function() {\n" 43780#~ " this._buildUI ();\n" 43781#~ " },\n" 43782 43783#~ msgid "Help make <app>GNOME Developer Tutorials</app> better" 43784#~ msgstr "" 43785#~ "Ajudando a melhorar os <app>tutoriais de desenvolvimento do GNOME</app>" 43786 43787#~ msgid "Report a bug or suggest an improvement" 43788#~ msgstr "Relatando um erro ou sugerindo uma melhora" 43789 43790#~ msgid "" 43791#~ "<app>GNOME Developer Tutorials</app> are maintained by a volunteer " 43792#~ "community. You are welcome to participate. If you notice a problem you " 43793#~ "can file a <em>bug report</em>. To file a bug, go to <link href=\"https://" 43794#~ "bugzilla.gnome.org/\"/>." 43795#~ msgstr "" 43796#~ "Os <app>tutoriais de desenvolvimento do GNOME</app> são mantidos por uma " 43797#~ "comunidade voluntária. Você está convidado para participar. Se você " 43798#~ "identificar um problema, você pode preencher um <em>relatório de erro</" 43799#~ "em>. Para isso, acesse o <link href=\"https://bugzilla.gnome.org/\"/>." 43800 43801#~ msgid "" 43802#~ "This is a bug tracking system where users and developers can file details " 43803#~ "about bugs, crashes and request enhancements." 43804#~ msgstr "" 43805#~ "Esse é um sistema de rastreamento de erros, no qual usuários e " 43806#~ "desenvolvedores podem informar detalhes sobre erros, travamentos e " 43807#~ "requisitar melhoras." 43808 43809# Bugzilla não está traduzido e, portanto, mantive "New Account" em inglês 43810#~ msgid "" 43811#~ "To participate you need an account which will give you the ability to " 43812#~ "gain access, file bugs, and make comments. Also, you need to register so " 43813#~ "you can receive updates by e-mail about the status of your bug. If you " 43814#~ "don't already have an account, just click on the <gui>New Account</gui> " 43815#~ "link to create one." 43816#~ msgstr "" 43817#~ "Para participar, você precisa de uma conta que vai dar a você a " 43818#~ "habilidade de acessar, preencher relatórios de erros e fazer comentários. " 43819#~ "Além disso, você vai vai precisar registrar de forma que você possa " 43820#~ "receber atualizações por e-mail sobre o estado de seus relatórios de " 43821#~ "erros. Se você ainda não tiver uma conta, basta clicar no link <gui>New " 43822#~ "Account</gui> para criar uma." 43823 43824#~ msgid "" 43825#~ "Once you have an account, log in, click on <guiseq><gui>File a Bug</" 43826#~ "gui><gui>All</gui><gui>gnome-devel-docs</gui></guiseq>. Before reporting " 43827#~ "a bug, please read the <link href=\"https://bugzilla.gnome.org/page.cgi?" 43828#~ "id=bug-writing.html\">bug writing guidelines</link>, and please <link " 43829#~ "href=\"https://bugzilla.gnome.org/browse.cgi?product=gnome-games" 43830#~ "\">browse</link> for the bug to see if it already exists." 43831#~ msgstr "" 43832#~ "Assim que você tiver uma conta, inicie a sessão, clique em " 43833#~ "<guiseq><gui>File a Bug</gui><gui>All</gui><gui>gnome-devel-docs</gui></" 43834#~ "guiseq>. Antes de relatar um erro, por favor leia as <link href=\"https://" 43835#~ "bugzilla.gnome.org/page.cgi?id=bug-writing.html\">diretrizes para relatar " 43836#~ "de erros</link> e, por favor, <link href=\"https://bugzilla.gnome.org/" 43837#~ "browse.cgi?product=gnome-games\">pesquisem</link> o erro para ver se um " 43838#~ "relatório de erro já existe." 43839 43840#~ msgid "" 43841#~ "To file your bug, choose the component <gui>platform-demos</gui> in the " 43842#~ "<gui>Component</gui> menu." 43843#~ msgstr "" 43844#~ "Para relatar seu erro, escolha o componente <gui>platform-demos</gui> no " 43845#~ "menu <gui>Component</gui>." 43846 43847#~ msgid "" 43848#~ "If you are requesting a new feature, choose <gui>enhancement</gui> in the " 43849#~ "<gui>Severity</gui> menu. Fill in the Summary and Description sections " 43850#~ "and click <gui>Commit</gui>." 43851#~ msgstr "" 43852#~ "Se você está requisitando uma nova funcionalidade, escolha " 43853#~ "<gui>enhancement</gui> no menu de <gui>Severity</gui>. Preencha as seções " 43854#~ "Summary e Description e clique em <gui>Commit</gui>." 43855 43856#~ msgid "" 43857#~ "Your report will be given an ID number, and its status will be updated as " 43858#~ "it is being dealt with. Thanks for helping make <app>GNOME Developer " 43859#~ "Tutorials</app> better!" 43860#~ msgstr "" 43861#~ "Seu relatório vai receber um número de ID e seu estado será atualizado " 43862#~ "como sendo lidado. Obrigado por ajudar na melhoria dos <app>tutoriais de " 43863#~ "desenvolvimento do GNOME</app>!" 43864 43865#~ msgid "Help develop" 43866#~ msgstr "Ajudando a desenvolver" 43867 43868#~ msgid "" 43869#~ "The <app>GNOME Developer Tutorials</app> are developed and maintained by " 43870#~ "a volunteer community. You are welcome to participate." 43871#~ msgstr "" 43872#~ "Os <app>tutoriais de desenvolvimento do GNOME</app> são desenvolvidos e " 43873#~ "mantido por uma comunidade voluntária. Você está convidado para " 43874#~ "participar." 43875 43876#~ msgid "" 43877#~ "If you would like to <link href=\"https://live.gnome.org/" 43878#~ "DocumentationProject/Tasks/DeveloperDocs\">help develop <app>GNOME " 43879#~ "Developer Tutorials</app></link>, you can get in touch with the " 43880#~ "developers using <link href=\"https://cbe005.chat.mibbit.com/?url=irc%3A" 43881#~ "%2F%2Firc.gnome.org%2Fdocs\">irc</link>, or via our <link href=\"http://" 43882#~ "mail.gnome.org/mailman/listinfo/gnome-doc-devel-list\">mailing list</" 43883#~ "link>." 43884#~ msgstr "" 43885#~ "Se você gostaria de <link href=\"https://live.gnome.org/" 43886#~ "DocumentationProject/Tasks/DeveloperDocs\">ajudar a desenvolver os " 43887#~ "<app>tutoriais de desenvolvimento do GNOME</app></link>, você pode entrar " 43888#~ "em contato com os desenvolvedores usando o <link href=\"https://cbe005." 43889#~ "chat.mibbit.com/?url=irc%3A%2F%2Firc.gnome.org%2Fdocs\">irc</link> ou via " 43890#~ "nossa <link href=\"http://mail.gnome.org/mailman/listinfo/gnome-doc-devel-" 43891#~ "list\">lista de discussão</link>." 43892 43893#~ msgctxt "link" 43894#~ msgid "Install GNOME development tools" 43895#~ msgstr "Instalando ferramentas de desenvolvimento do GNOME" 43896 43897#~ msgid "Getting ready for GNOME development" 43898#~ msgstr "Se preparando para desenvolvimento do GNOME" 43899 43900#~ msgid "Install the required tools" 43901#~ msgstr "Instalando as ferramentas necessárias" 43902 43903#~ msgid "" 43904#~ "Before you can start coding you will have to install the required tools " 43905#~ "for GNOME development on your computer. This shouldn't take you more than " 43906#~ "ten minutes." 43907#~ msgstr "" 43908#~ "Antes que você possa começar a codificação, você terá que instalar as " 43909#~ "ferramentas necessárias para o desenvolvimento do GNOME no seu " 43910#~ "computador. Isso não deveria levar mais de dez minutos." 43911 43912#~ msgid "Automatic installation" 43913#~ msgstr "Instalação automática" 43914 43915#~ msgid "" 43916#~ "On an up-to-date distribution you should be able to simply install the " 43917#~ "required packages by clicking on <link href=\"media/gnome-devtools.catalog" 43918#~ "\">Install now</link>." 43919#~ msgstr "" 43920#~ "Em uma distribuição atualizada você deveria poder simplesmente instalar " 43921#~ "os pacotes necessários clicando em <link href=\"media/gnome-devtools." 43922#~ "catalog\">Instalar agora</link>." 43923 43924#~ msgid "Manual installation" 43925#~ msgstr "Instalação manual" 43926 43927#~ msgid "" 43928#~ "If you prefer manual installation you can find the instructions for the " 43929#~ "various distributions in the <link href=\"http://live.gnome.org/" 43930#~ "DeveloperTools/Installation\">GNOME wiki</link>. Click on the image to go " 43931#~ "directly to the installation page for your distribution:" 43932#~ msgstr "" 43933#~ "Se você preferir instalação manual, você pode encontrar as instruções " 43934#~ "para várias distribuições no <link href=\"http://live.gnome.org/" 43935#~ "DeveloperTools/Installation\">wiki do GNOME</link>. Clique na imagem para " 43936#~ "ir diretamente para a página de instalação de sua distribuição:" 43937 43938#~ msgid "" 43939#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/Ubuntu\"> " 43940#~ "<media type=\"image\" mime=\"image/png\" src=\"media/ubuntu.png\">Ubuntu</" 43941#~ "media> </link>" 43942#~ msgstr "" 43943#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/Ubuntu\"> " 43944#~ "<media type=\"image\" mime=\"image/png\" src=\"media/ubuntu.png\">Ubuntu</" 43945#~ "media> </link>" 43946 43947#~ msgid "" 43948#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/Fedora\"> " 43949#~ "<media type=\"image\" mime=\"image/png\" src=\"media/fedora.png\">Fedora</" 43950#~ "media> </link>" 43951#~ msgstr "" 43952#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/Fedora\"> " 43953#~ "<media type=\"image\" mime=\"image/png\" src=\"media/fedora.png\">Fedora</" 43954#~ "media> </link>" 43955 43956#~ msgid "" 43957#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/OpenSuSE" 43958#~ "\"> <media type=\"image\" mime=\"image/png\" src=\"media/opensuse.png" 43959#~ "\">OpenSuSE</media> </link>" 43960#~ msgstr "" 43961#~ "<link href=\"http://live.gnome.org/DeveloperTools/Installation/OpenSuSE" 43962#~ "\"> <media type=\"image\" mime=\"image/png\" src=\"media/opensuse.png" 43963#~ "\">OpenSuSE</media> </link>" 43964 43965#~ msgid "Required versions" 43966#~ msgstr "Versões necessárias" 43967 43968#~ msgid "" 43969#~ "The guides assume that you have at least the following versions of the " 43970#~ "tools installed:" 43971#~ msgstr "" 43972#~ "Os guias presumem que você tem instaladas pelo menos as seguintes versões " 43973#~ "das ferramentas instaladas:" 43974 43975#~ msgid "Anjuta - 3.0" 43976#~ msgstr "Anjuta - 3.0" 43977 43978#~ msgid "Devhelp - 3.0" 43979#~ msgstr "Devhelp - 3.0" 43980 43981#~ msgid "Glade - 3.10" 43982#~ msgstr "Glade - 3.10" 43983 43984#~ msgid "" 43985#~ "Of course, any newer version will also work. Now, we wish you a lot of " 43986#~ "fun with the <link xref=\"index\">Demos</link>." 43987#~ msgstr "" 43988#~ "É claro, qualquer versão mais nova também vai funcionar. Agora, nós " 43989#~ "desejamos a você muita diversão com as <link xref=\"index" 43990#~ "\">Demonstrações</link>." 43991 43992#~ msgid "" 43993#~ "\n" 43994#~ "const HelloGNOME = new Lang.Class ({\n" 43995#~ " Name: 'Hello GNOME',\n" 43996#~ msgstr "" 43997#~ "\n" 43998#~ "const HelloGNOME = new Lang.Class ({\n" 43999#~ " Name: 'Olá, GNOME',\n" 44000 44001#~ msgid "Help translate" 44002#~ msgstr "Ajudando a traduzir" 44003 44004#~ msgid "" 44005#~ "The <app>Tutorial Demos</app> are being translated by a world-wide " 44006#~ "volunteer community. You are welcome to participate." 44007#~ msgstr "" 44008#~ "Os <app>tutoriais demonstrativos</app> estão sendo traduzidos por uma " 44009#~ "comunidade voluntária por todo o mundo. Você está convidado para " 44010#~ "participar." 44011 44012#~ msgid "" 44013#~ "There are <link href=\"http://l10n.gnome.org/module/gnome-devel-docs/" 44014#~ "\">many languages</link> for which translations are still needed." 44015#~ msgstr "" 44016#~ "Há <link href=\"http://l10n.gnome.org/module/gnome-devel-docs/\">muitos " 44017#~ "idiomas</link> para os quais traduções ainda são necessárias." 44018 44019#~ msgid "" 44020#~ "To start translating you will need to <link href=\"http://l10n.gnome.org" 44021#~ "\">create an account</link> and join the <link href=\"http://l10n.gnome." 44022#~ "org/teams/\">translation team</link> for your language. This will give " 44023#~ "you the ability to upload new translations." 44024#~ msgstr "" 44025#~ "Para começar a traduzir, você precisará <link href=\"http://l10n.gnome.org" 44026#~ "\">criar uma conta</link> e participar da <link href=\"http://l10n.gnome." 44027#~ "org/teams/\">equipe de tradução</link> do seu idioma. Isso vai dar a você " 44028#~ "a habilidade de enviar novas traduções." 44029 44030#~ msgid "" 44031#~ "You can chat with GNOME translators using <link href=\"https://cbe003." 44032#~ "chat.mibbit.com/?url=irc%3A%2F%2Firc.gnome.org%2Fi18n\">irc</link>. " 44033#~ "People on the channel are located worldwide, so you may not get an " 44034#~ "immediate response as a result of timezone differences." 44035#~ msgstr "" 44036#~ "Você pode conversar com os tradutores do GNOME usando o <link href=" 44037#~ "\"https://cbe003.chat.mibbit.com/?url=irc%3A%2F%2Firc.gnome.org%2Fi18n" 44038#~ "\">irc</link>. As pessoas no canal estão localizadas por todo o mundo, de " 44039#~ "forma que você pode não obter uma resposta imediata como um resultado de " 44040#~ "diferenças de fuso horário." 44041 44042#~ msgid "" 44043#~ "Alternatively, you can contact the Internationalization Team using their " 44044#~ "<link href=\"http://mail.gnome.org/mailman/listinfo/gnome-i18n\">mailing " 44045#~ "list</link>." 44046#~ msgstr "" 44047#~ "Alternativamente, você pode contatar a equipe de internacionalização " 44048#~ "usando a <link href=\"http://mail.gnome.org/mailman/listinfo/gnome-i18n" 44049#~ "\">lista de discussão</link>." 44050