Blob Blame History Raw
# Brazilian Portuguese translation for gnome-devel-docs.
# Copyright (C) 2017 gnome-devel-docs's COPYRIGHT HOLDER
# This file is distributed under the same license as the gnome-devel-docs package.
# Rafael Fontenelle <rafaelff@gnome.org>, 2017.
msgid ""
msgstr ""
"Project-Id-Version: gnome-devel-docs master\n"
"POT-Creation-Date: 2017-03-21 01:53+0000\n"
"PO-Revision-Date: 2017-03-22 18:22-0200\n"
"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Virtaal 1.0.0-beta1\n"
"X-Project-Style: gnome\n"

#. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2
msgctxt "_"
msgid "translator-credits"
msgstr "Rafael Fontenelle <rafaelff@gnome.org>, 2017"

#. (itstool) path: credit/name
#: C/additional-materials.page:10 C/c-coding-style.page:10
#: C/documentation.page:11 C/index.page:8 C/writing-good-code.page:10
msgid "Federico Mena-Quintero"
msgstr "Federico Mena-Quintero"

#. (itstool) path: credit/years
#: C/additional-materials.page:12 C/c-coding-style.page:12
#: C/documentation.page:13 C/index.page:10 C/writing-good-code.page:12
msgid "2013"
msgstr "2013"

#. (itstool) path: info/desc
#: C/additional-materials.page:17
msgid "Other style guides and books about organizing free software projects"
msgstr ""
"Outros guias de estilo e livros sobre organização de projetos de software "
"livre"

#. (itstool) path: page/title
#: C/additional-materials.page:21
msgid "Additional Materials"
msgstr "Materiais adicionais"

#. (itstool) path: page/p
#: C/additional-materials.page:23
msgid ""
"Here we give you links to other materials that you may want to read. These "
"will teach you a lot about how to work on large distributed teams of free "
"software developers, and about good programming style in general."
msgstr ""
"Aqui nós fornecemos links para outros materiais que você pode querer ler. "
"Eles o ensinarão muito sobre como trabalhar em equipes grandes e "
"distribuídas de desenvolvedores de software livre, e sobre bom estilo de "
"programação em geral."

#. (itstool) path: item/p
#: C/additional-materials.page:32
msgid ""
"<link href=\"http://producingoss.com/\">Producing Open Source Software</"
"link>, by Karl Fogel. This is a truly excellent book of good practices that "
"free software projects should follow. This is about <em>social aspects</em> "
"of the project: how to treat contributors, how to organize and moderate "
"communication, how to deal with non-profit foundations. If you ask yourself "
"at any time, \"how should I deal with $human_situation in the project?\", "
"this book may provide the answer."
msgstr ""
"<link href=\"http://producingoss.com/\">Producing Open Source Software</"
"link> (Produzindo Software de Código Aberto), por Karl Fogel. Esse é "
"realmente um excelente livro para boas práticas que projetos de software "
"livre devem seguir. Trata sobre <em>aspectos sociais</em> do projeto: como "
"tratar contribuidores, como organizar e moderar comunicação, como lidar com "
"fundações sem fins lucrativos. Se você em algum momento se perguntar “como "
"eu deveria lidar com $situação_humana no projeto?”, este livro pode lhe "
"fornecer a resposta."

#. (itstool) path: item/p
#: C/additional-materials.page:46
msgid ""
"<link href=\"http://www.gnu.org/prep/standards/\">GNU Coding Standards</"
"link>. This is an old document, but it still has lots of excellent advice. "
"It talks about C coding style, issues when dealing with plug-in systems, "
"common option names for command-line programs, conventions for Makefiles, "
"and some very GNU-ish details like using Texinfo for documentation."
msgstr ""
"<link href=\"http://www.gnu.org/prep/standards/\">GNU Coding Standards</"
"link> (Padrões de codificação GNU). Esse é um documento antigo, mas ele "
"ainda possui muitos excelentes conselhos. Ele fala sobre estilo de "
"codificação C, questões ao lidar com sistemas de plug-in, nomes comuns de "
"opções para programas de linha de comando, convenções para Makefiles e "
"alguns detalhes bem relacionados só GNU, como o uso de Texinfo para "
"documentação"

#. (itstool) path: item/p
#: C/additional-materials.page:57
msgid ""
"<link href=\"https://www.kernel.org/doc/Documentation/process/coding-style."
"rst\"> Linux Kernel Coding Style</link>. Explains the rationale for \"big "
"indentation\", brace placement, concise but unambiguous naming, and "
"centralized exit of functions."
msgstr ""
"<link href=\"https://www.kernel.org/doc/Documentation/process/coding-style."
"rst\"> Linux Kernel Coding Style</link> (Estilo de Codificação do Kernel "
"Linux). Explica a fundamentação para o “recuo grande”, posicionamento de "
"chaves, nomenclatura concisa sem ser ambígua e saída centralizada de funções."

#. (itstool) path: credit/name
#: C/api-stability.page:10 C/databases.page:11 C/documentation.page:16
#: C/file-system.page:11 C/gerror.page:11 C/glist.page:11 C/index.page:21
#: C/introspection.page:10 C/logging.page:11 C/main-contexts.page:11
#: C/memory-management.page:10 C/namespacing.page:10
#: C/parallel-installability.page:18 C/preconditions.page:11
#: C/threading.page:11 C/tooling.page:10 C/unit-testing.page:10
#: C/version-control.page:10 C/versioning.page:10
msgid "Philip Withnall"
msgstr "Philip Withnall"

#. (itstool) path: credit/years
#: C/api-stability.page:12 C/databases.page:13 C/documentation.page:18
#: C/file-system.page:13 C/gerror.page:13 C/glist.page:13 C/index.page:23
#: C/introspection.page:12 C/logging.page:13 C/memory-management.page:12
#: C/parallel-installability.page:20 C/preconditions.page:13
#: C/threading.page:13 C/tooling.page:12 C/unit-testing.page:12
#: C/version-control.page:12 C/versioning.page:12
msgid "2015"
msgstr "2015"

#. (itstool) path: info/desc
#: C/api-stability.page:17
msgid "Backwards compatibility in APIs"
msgstr "Compatibilidade reversa nas APIs"

#. (itstool) path: page/title
#: C/api-stability.page:20
msgid "API stability"
msgstr "Estabilidade de API"

#. (itstool) path: synopsis/title
#: C/api-stability.page:23 C/databases.page:24 C/documentation.page:32
#: C/file-system.page:24 C/introspection.page:23 C/logging.page:26
#: C/main-contexts.page:27 C/memory-management.page:65 C/namespacing.page:25
#: C/parallel-installability.page:33 C/threading.page:24 C/tooling.page:45
#: C/unit-testing.page:23 C/version-control.page:23 C/versioning.page:23
msgid "Summary"
msgstr "Resumo"

#. (itstool) path: item/p
#: C/api-stability.page:26
msgid ""
"Define API stability guarantees for your project. (<link xref=\"#stability\"/"
">)"
msgstr ""
"Defina garantias de estabilidade de API para seu projeto. (<link xref="
"\"#stability\"/>)"

#. (itstool) path: item/p
#: C/api-stability.page:30
msgid ""
"Ensure version numbers are changed as appropriate when API changes. (<link "
"xref=\"#versioning\"/>)"
msgstr ""
"Certifique-se de que números de versão sejam alterados conforme apropriado "
"quando a API é alterada. (<link xref=\"#versioning\"/>)"

#. (itstool) path: section/title
#: C/api-stability.page:38
msgid "API and ABI"
msgstr "API e ABI"

#. (itstool) path: section/p
#: C/api-stability.page:40
msgid ""
"At a high level, an API – <em>Application Programming Interface</em> – is "
"the boundary between two components when developing against them. It is "
"closely related to an ABI – <em>Application Binary Interface</em> – which is "
"the boundary at runtime. It defines the possible ways in which other "
"components can interact with a component. More concretely, this normally "
"means the C headers of a library form its API, and compiled library symbols "
"its ABI. The difference between an API and ABI is given by compilation of "
"the code: there are certain things in a C header, such as <code>#define</"
"code>s, which can cause a library’s API to change without changing its ABI. "
"But these differences are mostly academic, and for all practical purposes, "
"API and ABI can be treated interchangeably."
msgstr ""
"Em um nível alto, uma API – <em>Application Programming Interface</em> ou "
"interface de programação de aplicação – é o limite entre dois componentes "
"quando se está desenvolvendo para eles. Ela está intimamente relacionada a "
"uma ABI – <em>Application Binary Interface</em> ou interface binária de "
"aplicação – que é o limite em tempo real. Ela define as formas possíveis nas "
"quais outros componentes podem interagir com um componente. Mais "
"concretamente, ela normalmente significa que os cabeçalhos C de uma "
"biblioteca formam sua API, e biblioteca compilada simboliza sua ABI. A "
"diferença entre uma API e uma ABI é dada pela compilação do código: há "
"certas coisas em um cabeçalho C, tal como <code>#define</code>s, que podem "
"fazer com que uma API da biblioteca seja alterada sem alterar sua ABI. Mas "
"essas diferenças são em sua maioria acadêmicas e, para todos os propósitos "
"práticos, API e ABI podem ser tratados de forma intercambiável."

#. (itstool) path: section/p
#: C/api-stability.page:54
msgid ""
"Examples of API-incompatible changes to a C function would be to add a new "
"parameter, change the function’s return type, or remove a parameter."
msgstr ""
"Exemplos de alterações incompatíveis com API para uma função C seria "
"adicionar um novo parâmetro, alterar o tipo de retorno da função ou remover "
"um parâmetro."

#. (itstool) path: section/p
#: C/api-stability.page:59
msgid ""
"However, many other parts of a project can form an API. If a daemon exposes "
"itself on D-Bus, the interfaces exported there form an API. Similarly, if a "
"C API is exposed in higher level languages by use of GIR, the GIR file forms "
"another API — if it changes, any higher level code using it must also change."
msgstr ""
"Porém, muitas outras partes de um projeto podem formar uma API. Se um daemon "
"se expõe no D-Bus, as interfaces exportadas lá formam uma API. Similarmente, "
"se uma API C é exposta em linguagens de alto nível pelo uso de GIR, o "
"arquivo GIR forma uma outra API — se ela é alterada, qualquer código de alto "
"nível usando-a também é alterado."

#. (itstool) path: section/p
#: C/api-stability.page:67
msgid ""
"Other examples of more unusual APIs are configuration file locations and "
"formats, and GSettings schemas. Any changes to these could require code "
"using your library to change."
msgstr ""
"Outros exemplos de APIs mais incomuns são locais e formatos de arquivos de "
"configuração, e esquemas de GSettings. Quaisquer alterações nestes poderia "
"exigir que o código usando sua biblioteca seja alterado."

#. (itstool) path: section/title
#: C/api-stability.page:75
msgid "Stability"
msgstr "Estabilidade"

#. (itstool) path: section/p
#: C/api-stability.page:77
msgid ""
"API stability refers to some level of guarantee from a project that its API "
"will only change in defined ways in the future, or will not change at all. "
"Generally, an API is considered ‘stable’ if it commits to backwards-"
"compatibility (defined below); but APIs could also commit to being unstable "
"or even forwards-compatible. The purpose of API stability guarantees is to "
"allow people to use your project from their own code without worrying about "
"constantly updating their code to keep up with API changes. Typical API "
"stability guarantees mean that code which is compiled against one version of "
"a library will run without problems against all future versions of that "
"library with the same major version number — or similarly that code which "
"runs against a daemon will continue to run against all future versions of "
"that daemon with the same major version number."
msgstr ""
"Estabilidade da API se refere a algum nível de garantia de um projeto que "
"sua API será alterada apenas em formas definidas no futuro, ou jamais será "
"alterada. Geralmente, um API é considerada ‘estável’ se ela se compromete em "
"manter compatibilidade com versões anteriores (definido abaixo); mas APIs "
"pode também se comprometer em ser instáveis ou até mesmo compatíveis com "
"versões posteriores. O propósito das garantias de estabilidade de API é "
"permitir que as pessoas usem seu projeto para seus próprios código se "
"preocupar em atualizar constantemente seu código para se manter em dia com "
"as alterações da API. Garantias comuns de estabilidade de API significa que "
"o código que é compilado com uma versão de uma biblioteca vai funcionar sem "
"problemas contra todas versões futuras daquela biblioteca com o mesmo número "
"de versão maior — ou similarmente àquele código que funciona com um daemon "
"vai continuar a funcionar em todas as versões futuras daquele daemon com o "
"mesmo número de versão maior."

#. (itstool) path: section/p
#: C/api-stability.page:93
msgid ""
"It is possible to apply different levels of API stability to components "
"within a project. For example, the core functions in a library could be "
"stable, and hence their API left unchanged in future; while the newer, less "
"core functions could be left unstable and allowed to change wildly until the "
"right design is found, at which point they could be marked as stable."
msgstr ""
"É possível aplicar diferentes níveis de estabilidade de API a componentes "
"dentro de um projeto. Por exemplo, as funções centrais em uma biblioteca "
"poderiam ser estáveis e, consequentemente, sua API mantida inalterada no "
"futuro; enquanto as funções mais novas e menos centrais serem mantidas "
"instáveis e poderem ser alteradas descontroladamente até que o design certo "
"seja encontrado, ponto no qual elas poderiam ser marcadas como estáveis."

#. (itstool) path: section/p
#: C/api-stability.page:102
msgid "Several types of stability commonly considered:"
msgstr "Vários tipos de estabilidade comumente considerados:"

#. (itstool) path: item/title
#: C/api-stability.page:107
msgid "Unstable"
msgstr "Instável (unstable)"

#. (itstool) path: item/p
#: C/api-stability.page:108
msgid "The API could change or be removed in future."
msgstr "A API poderia alterar ou ser removida no futuro."

#. (itstool) path: item/title
#: C/api-stability.page:111
msgid "Backwards compatible"
msgstr "Compatibilidade com versões anteriores"

#. (itstool) path: item/p
#: C/api-stability.page:112
msgid ""
"Only changes which permit code compiled against the unmodified API to "
"continue running against the modified API are allowed (for example, "
"functions cannot be removed)."
msgstr ""
"Apenas alterações que permitem código compilado com a API não modificada "
"para continuar funcionando com a API modificada são permitidos (por exemplo, "
"funções não podem ser removidas)."

#. (itstool) path: item/title
#: C/api-stability.page:119
msgid "Forwards compatible"
msgstr "Compatibilidade com versões posteriores"

#. (itstool) path: item/p
#: C/api-stability.page:120
msgid ""
"Only changes which permit code compiled against the modified API to run "
"against the unmodified API are allowed (for example, functions cannot be "
"added)."
msgstr ""
"Apenas alterações que permitem código compilado com a API modificada para "
"funcionar com a API modificada são permitidos (por exemplo, funções não "
"podem ser adicionadas)."

#. (itstool) path: item/title
#: C/api-stability.page:127
msgid "Totally stable"
msgstr "Totalmente estável"

#. (itstool) path: item/p
#: C/api-stability.page:128
msgid "No changes are allowed to the API, only to the implementation."
msgstr "Nenhuma alteração é permitida à API, apenas para a implementação."

#. (itstool) path: section/p
#: C/api-stability.page:132
msgid ""
"Typically, projects commit to backwards-compatibility when they say an API "
"is ‘stable’. Very few projects commit to total stability because it would "
"prevent almost all further development of the project."
msgstr ""
"Geralmente, projetos se comprometem com compatibilidade reversa quando eles "
"dizem que uma API é ‘estável’. Muito poucos projetos se comprometem à total "
"estabilidade por impediria quase que todos os desenvolvimentos posteriores "
"do projeto."

#. (itstool) path: section/title
#. (itstool) path: page/title
#: C/api-stability.page:140 C/versioning.page:20
msgid "Versioning"
msgstr "Versionamento"

#. (itstool) path: section/p
#: C/api-stability.page:142
msgid ""
"API stability guarantees are strongly linked to project versioning; both "
"package versioning and libtool versioning. Libtool versioning exists "
"entirely for the purpose of tracking ABI stability, and is explained in "
"detail on the <link href=\"https://autotools.io/libtool/version.html"
"\">Autotools Mythbuster</link> or <link xref=\"versioning\"/>."
msgstr ""
"Garantias de estabilidade de API estão fortemente vinculadas a versionamento "
"do projeto; tanto versionamento de pacote e versionamento do libtool. "
"Versionamento do libtool existe totalmente para o propósito de rastrear a "
"estabilidade da ABI e é explicado em detalhes em <link href=\"https://"
"autotools.io/libtool/version.html\">Autotools Mythbuster</link> (Caçador de "
"mitos de autotools) ou <link xref=\"versioning\"/>."

#. (itstool) path: section/p
#: C/api-stability.page:151
msgid ""
"Package versioning (<em>major.minor.micro</em>) is strongly linked to API "
"stability: typically, the major version number is incremented when backwards-"
"incompatible changes are made (for example, when functions are renamed, "
"parameters are changed, or functions are removed). The minor version number "
"is incremented when forwards-incompatible changes are made (for example, "
"when new public API is added). The micro version number is incremented when "
"code changes are made without modifying API. See <link xref=\"versioning\"/> "
"for more information."
msgstr ""
"Versionamento de pacote (<em>maior.menor.micro</em>) está fortemente "
"vinculado à estabilidade da API: geralmente, o número da versão maior é "
"incrementado quando alterações incompatíveis com versões anteriores são "
"feitas (por exemplo, quando funções são renomeadas, parâmetros são "
"alterados, ou funções são removidas). O número da versão menor é "
"incrementada quando alterações incompatíveis com versões posteriores são "
"feitas (por exemplo, quando uma nova API pública é adicionada). O número da "
"versão micro é incrementada quando as alterações no código são feitas sem "
"modificar a API. Veja <link xref=\"versioning\"/> para mais informações."

#. (itstool) path: section/p
#: C/api-stability.page:162
msgid ""
"API versioning is just as important for D-Bus APIs and GSettings schemas (if "
"they are likely to change) as for C APIs. See the <link href=\"http://dbus."
"freedesktop.org/doc/dbus-api-design.html#api-versioning\">documentation on D-"
"Bus API versioning</link> for details."
msgstr ""
"Versionamento de API é tão importante para APIs de D-Bus e esquemas de "
"GSettings (se eles são suscetíveis de alterações) quanto é para APIs C. Veja "
"a <link href=\"http://dbus.freedesktop.org/doc/dbus-api-design.html#api-"
"versioning\">documentação sobre versionamento de API de D-Bus</link> para "
"detalhes."

#. (itstool) path: section/p
#: C/api-stability.page:169
msgid ""
"For GIR APIs, their stability typically follows the C API stability, as they "
"are generated from the C API. One complexity is that their stability "
"additionally depends on the version of gobject-introspection used in "
"generating the GIR, but recent versions have not changed much so this is not "
"a major concern."
msgstr ""
"Para APIs GIR, sua estabilidade geralmente segue a estabilidade da API C, "
"como elas são geradas a partir da API C. Uma complexidade é que sua "
"estabilidade depende adicionalmente na versão do gobject-introspection usada "
"na geração do GIR, mas versões recentes não foram muito alteradas, de forma "
"que isso não é uma grande preocupação."

#. (itstool) path: section/title
#: C/api-stability.page:179 C/unit-testing.page:272 C/version-control.page:161
msgid "External Links"
msgstr "Links externos"

#. (itstool) path: section/p
#: C/api-stability.page:181
msgid "The topic of API stability is covered in the following articles:"
msgstr ""
"O tópico de estabilidade de API é coberto nos seguintes artigos (em inglês):"

#. (itstool) path: item/p
#: C/api-stability.page:185
msgid ""
"<link href=\"http://en.wikipedia.org/wiki/Application_programming_interface"
"\">Wikipedia page on APIs</link>"
msgstr ""
"<link href=\"http://en.wikipedia.org/wiki/Application_programming_interface"
"\">Página do Wikipédia sobre APIs</link>"

#. (itstool) path: item/p
#: C/api-stability.page:189
msgid ""
"<link href=\"http://en.wikipedia.org/wiki/Application_binary_interface"
"\">Wikipedia page on ABIs</link>"
msgstr ""
"<link href=\"http://en.wikipedia.org/wiki/Application_binary_interface"
"\">Página do Wikipédia sobre ABIs</link>"

#. (itstool) path: item/p
#: C/api-stability.page:193
msgid ""
"<link href=\"http://dbus.freedesktop.org/doc/dbus-api-design.html#api-"
"versioning\">D-Bus API versioning documentation</link>"
msgstr ""
"<link href=\"http://dbus.freedesktop.org/doc/dbus-api-design.html#api-"
"versioning\">Documentação de versionamento de API D-Bus</link>"

#. (itstool) path: credit/name
#: C/c-coding-style.page:15 C/documentation.page:21
msgid "The GTK+ Team"
msgstr "A equipe do GTK+"

#. (itstool) path: info/desc
#: C/c-coding-style.page:20
msgid "Our guidelines for C code in GNOME"
msgstr "Nossas diretrizes para código C no GNOME"

#. (itstool) path: page/title
#: C/c-coding-style.page:23
msgid "C Coding Style"
msgstr "Estilo de codificação C"

#. (itstool) path: page/p
#: C/c-coding-style.page:25
msgid ""
"This document presents the preferred coding style for C programs in GNOME. "
"While coding style is very much a matter of taste, in GNOME we favor a "
"coding style that promotes consistency, readability, and maintainability."
msgstr ""
"Esse documento apresenta o estilo de codificação preferido para programas C "
"no GNOME. Enquanto o estilo de codificação é muito uma questão de gosto, no "
"GNOME somos a favor de um estilo de codificação que promove consistência, "
"legibilidade e manutenção."

#. (itstool) path: page/p
#: C/c-coding-style.page:32
msgid ""
"We present examples of good coding style as well as examples of bad style "
"that is not acceptable in GNOME. Please try to submit patches that conform "
"to GNOME’s coding style; this indicates that you have done your homework to "
"respect the project’s goal of long-term maintainability. Patches with "
"GNOME’s coding style will also be easier to review!"
msgstr ""
"Nós apresentamos exemplos de bom estilo de codificação, bem como exemplos de "
"estilo ruim que não é aceitável no GNOME. Por favor, tente enviar patches "
"que estejam em conformidade com o estilo de codificação do GNOME; isso "
"indica que você fez seu dever de casa para respeitar o objetivo do projeto "
"de manutenção a longo prazo. Patches com o estilo de codificação do GNOME "
"também serão mais fáceis de revisar!"

#. (itstool) path: note/p
#: C/c-coding-style.page:42
msgid ""
"This document is for C code. For other languages, check the <link xref="
"\"index\">main page</link> of the GNOME Programming Guidelines."
msgstr ""
"Esse documento é para código C. Para outras linguagens, veja a <link xref="
"\"index\">página principal</link> das Diretrizes de programação do GNOME."

#. (itstool) path: page/p
#: C/c-coding-style.page:49
msgid ""
"These guidelines are heavily inspired by GTK’s CODING-STYLE document, the "
"Linux Kernel’s CodingStyle, and the GNU Coding Standards. These are slight "
"variations of each other, with particular modifications for each project’s "
"particular needs and culture, and GNOME’s version is no different."
msgstr ""
"Essas diretrizes são fortemente inspiradas no documento “CODING-STYLE” do "
"GTK, no “CodingStyle” do Kernel Linux e no “GNU Coding Standards”. Essas são "
"pequenas variações entre si, com modificações particulares para cada "
"culturas e necessidades em particular do projeto, e a versão do GNOME não é "
"diferente."

#. (itstool) path: section/title
#: C/c-coding-style.page:58
msgid "The Single Most Important Rule"
msgstr "A regra mais importante"

#. (itstool) path: section/p
#: C/c-coding-style.page:60
msgid ""
"The single most important rule when writing code is this: <em>check the "
"surrounding code and try to imitate it</em>."
msgstr ""
"A regra mais importante quando se está escrevendo código é essa: <em>veja o "
"código ao redor e tente imitá-lo</em>."

#. (itstool) path: section/p
#: C/c-coding-style.page:65
msgid ""
"As a maintainer it is dismaying to receive a patch that is obviously in a "
"different coding style to the surrounding code. This is disrespectful, like "
"someone tromping into a spotlessly-clean house with muddy shoes."
msgstr ""
"Como um mantenedor, é assustador receber um patch que obviamente está em um "
"estilo de codificação diferente do código ao redor. Isso é desrespeitoso, "
"como alguém pisando em uma casa impecavelmente limpa com sapatos cheios de "
"lama."

#. (itstool) path: section/p
#: C/c-coding-style.page:72
msgid ""
"So, whatever this document recommends, if there is already written code and "
"you are patching it, keep its current style consistent even if it is not "
"your favorite style."
msgstr ""
"Então, independente do que este documenta recomenda, se há código escrito e "
"você está fazendo um patch para ele, mantenha a consistência do seu estilo "
"atual ainda que não seja seu estilo favorito."

#. (itstool) path: section/title
#: C/c-coding-style.page:80
msgid "Line Width"
msgstr "Largura da linha"

#. (itstool) path: section/p
#: C/c-coding-style.page:82
msgid ""
"Try to use lines of code between 80 and 120 characters long. This amount of "
"text is easy to fit in most monitors with a decent font size. Lines longer "
"than that become hard to read, and they mean that you should probably "
"restructure your code. If you have too many levels of indentation, it means "
"that you should fix your code anyway."
msgstr ""
"Tente usar linhas de códigos entre 80 e 120 caracteres. Essa quantidade de "
"texto é fácil de ajustar na maioria dos monitores com um tamanho de fonte "
"decente. Linhas maiores que isso se tornam difíceis de ler, e isso pode "
"significar que você provavelmente deveria restruturar seu código. Se você "
"tiver um número grande de níveis de recuo, isso significa que você "
"provavelmente deveria corrigir seu código de qualquer maneira."

#. (itstool) path: section/title
#: C/c-coding-style.page:93
msgid "Indentation"
msgstr "Recuo"

#. (itstool) path: section/p
#: C/c-coding-style.page:95
msgid ""
"In general there are two preferred indentation styles for code in GNOME."
msgstr "Em geral, há dois estilos de recuo preferidos para código no GNOME."

#. (itstool) path: item/p
#: C/c-coding-style.page:102
msgid ""
"Linux Kernel style. Tabs with a length of 8 characters are used for the "
"indentation, with K&amp;R brace placement:"
msgstr ""
"Estilo do Kernel Linux. Tabulações com um comprimento de 8 caracteres são "
"usados para recuo, com colocação de chaves de K&amp;R:"

#. (itstool) path: item/code
#: C/c-coding-style.page:107
#, no-wrap
msgid ""
"\n"
"for (i = 0; i &lt; num_elements; i++) {\n"
"\tfoo[i] = foo[i] + 42;\n"
"\n"
"\tif (foo[i] &lt; 35) {\n"
"\t\tprintf (\"Foo!\");\n"
"\t\tfoo[i]--;\n"
"\t} else {\n"
"\t\tprintf (\"Bar!\");\n"
"\t\tfoo[i]++;\n"
"\t}\n"
"}"
msgstr ""
"\n"
"for (i = 0; i &lt; num_elements; i++) {\n"
"\tfoo[i] = foo[i] + 42;\n"
"\n"
"\tif (foo[i] &lt; 35) {\n"
"\t\tprintf (\"Foo!\");\n"
"\t\tfoo[i]--;\n"
"\t} else {\n"
"\t\tprintf (\"Bar!\");\n"
"\t\tfoo[i]++;\n"
"\t}\n"
"}"

#. (itstool) path: item/p
#: C/c-coding-style.page:122
msgid ""
"GNU style. Each new level is indented by 2 spaces, braces go on a line by "
"themselves, and they are indented as well."
msgstr ""
"Estilo GNU. Cada novo nível possui recuo de 2 espaços, aspas vai em uma "
"linha própria e elas também possuem recuo."

#. (itstool) path: item/code
#: C/c-coding-style.page:128
#, no-wrap
msgid ""
"\n"
"for (i = 0; i &lt; num_elements; i++)\n"
"  {\n"
"    foo[i] = foo[i] + 42;\n"
"\n"
"    if (foo[i] &lt; 35)\n"
"      {\n"
"        printf (\"Foo!\");\n"
"        foo[i]--;\n"
"      }\n"
"    else\n"
"      {\n"
"        printf (\"Bar!\");\n"
"        foo[i]++;\n"
"      }\n"
"  }"
msgstr ""
"\n"
"for (i = 0; i &lt; num_elements; i++)\n"
"  {\n"
"    foo[i] = foo[i] + 42;\n"
"\n"
"    if (foo[i] &lt; 35)\n"
"      {\n"
"        printf (\"Foo!\");\n"
"        foo[i]--;\n"
"      }\n"
"    else\n"
"      {\n"
"        printf (\"Bar!\");\n"
"        foo[i]++;\n"
"      }\n"
"  }"

#. (itstool) path: section/p
#: C/c-coding-style.page:148
msgid ""
"Both styles have their pros and cons. The most important things is to <em>be "
"consistent</em> with the surrounding code. For example, the GTK+ library, "
"which is GNOME’s widget toolkit, is written with the GNU style. Nautilus, "
"GNOME’s file manager, is written in Linux kernel style. Both styles are "
"perfectly readable and consistent when you get used to them."
msgstr ""
"Ambos estilos têm suas vantagens e desvantagens. O mais importante é <em>ser "
"consistente</em> com o código ao redor. Por exemplo, a biblioteca GTK+, que "
"é uma caixa de ferramentas de widgets do GNOME, é escrito com o estilo GNU. "
"Nautilus, o gerenciador de arquivos do GNOME, é escrito no estilo Kernel "
"Linux. Ambos estilos são perfeitamente legíveis e consistentes quando você "
"se acostuma com eles."

#. (itstool) path: section/p
#: C/c-coding-style.page:157
msgid ""
"Your first feeling when having to study or work on a piece of code that "
"doesn’t have your preferred indentation style may be, how shall we put it, "
"gut-wrenching. You should resist your inclination to reindent everything, or "
"to use an inconsistent style for your patch. Remember the first rule: <em>be "
"consistent</em> and respectful of that code’s customs, and your patches will "
"have a much higher chance of being accepted without a lot of arguing about "
"the right indentation style."
msgstr ""
"Seu primeiro sentimento ao ter que estudar ou trabalhar em um pedaço de "
"código que não seja seu preferido em estilo de recuo pode ser, como vamos "
"colocá-lo, desconfortável. Você deve resistir sua inclinação em ajustar o "
"recuo de tudo, ou usar um estilo inconsistente para seu patch. Lembre-se da "
"primeira regra: <em>ser consistente</em> e respeitoso com os costumes do "
"código, e seus patches terão uma chance muito mais alta de serem aceitos sem "
"muita argumentação sobre o estilo de recuo correto."

#. (itstool) path: section/title
#: C/c-coding-style.page:170
msgid "Tab Characters"
msgstr "Caracteres de tabulações"

#. (itstool) path: section/p
#: C/c-coding-style.page:172
msgid ""
"<em>Do not ever change the size of tabs in your editor</em>; leave them as 8 "
"spaces. Changing the size of tabs means that code that you didn’t write "
"yourself will be perpetually misaligned."
msgstr ""
"<em>Não altere o tamanho dos tabs em seu editor</em>; deixe-os como 8 "
"espaços. Alterar o tamanho dos tabs naquele código que você não escreveu "
"estará perpetuamente desalinhada."

#. (itstool) path: section/p
#: C/c-coding-style.page:178
msgid ""
"Instead, set the <em>indentation size</em> as appropriate for the code you "
"are editing. When writing in something other than Linux kernel style, you "
"may even want to tell your editor to automatically convert all tabs to 8 "
"spaces, so that there is no ambiguity about the intended amount of space."
msgstr ""
"Em vez disso, defina o <em>tamanho do recuo</em> conforme apropriado para o "
"código que você está editando. Quando se está escrevendo em algo diferente "
"do estilo Kernel Linux, você pode está querer dizer ao seu editor para "
"converter todas os tabs para 8 espaços, de forma que não haja ambiguidade "
"sobre a quantidade de espaços."

#. (itstool) path: section/title
#: C/c-coding-style.page:188
msgid "Braces"
msgstr "Chaves"

#. (itstool) path: section/p
#: C/c-coding-style.page:190
msgid "Curly braces should not be used for single statement blocks:"
msgstr "Chaves não devem ser usadas para blocos de instrução singular:"

#. (itstool) path: section/code
#: C/c-coding-style.page:194
#, no-wrap
msgid ""
"\n"
"/* valid */\n"
"if (condition)\n"
"\tsingle_statement ();\n"
"else\n"
"\tanother_single_statement (arg1);"
msgstr ""
"\n"
"/* válido */\n"
"if (condição)\n"
"\tsingle_statement ();\n"
"else\n"
"\tanother_single_statement (arg1);"

#. (itstool) path: section/p
#: C/c-coding-style.page:201
msgid "The “no block for single statements” rule has only four exceptions:"
msgstr ""
"A regra de “nenhum bloco para instruções singulares” possui apenas quatro "
"exceções:"

#. (itstool) path: item/p
#: C/c-coding-style.page:208
msgid ""
"In GNU style, if either side of an if-else statement has braces, both sides "
"should, to match up indentation:"
msgstr ""
"No estilo GNU, se qualquer um dos lados de uma instrução if-else possui "
"chaves, ambos lados deveriam ter, para corresponder o recuo:"

#. (itstool) path: item/code
#: C/c-coding-style.page:213
#, no-wrap
msgid ""
"\n"
"/* valid GNU style */\n"
"if (condition)\n"
"  {\n"
"    foo ();\n"
"    bar ();\n"
"  }\n"
"else\n"
"  {\n"
"    baz ();\n"
"  }"
msgstr ""
"\n"
"/* estilo GNU válido */\n"
"if (condição)\n"
"  {\n"
"    foo ();\n"
"    bar ();\n"
"  }\n"
"else\n"
"  {\n"
"    baz ();\n"
"  }"

#. (itstool) path: item/code
#: C/c-coding-style.page:225
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if (condition)\n"
"  {\n"
"    foo ();\n"
"    bar ();\n"
"  }\n"
"else\n"
"  baz ();"
msgstr ""
"\n"
"/* inválido */\n"
"if (condição)\n"
"  {\n"
"    foo ();\n"
"    bar ();\n"
"  }\n"
"else\n"
"  baz ();"

#. (itstool) path: item/p
#: C/c-coding-style.page:237
msgid ""
"If the single statement covers multiple lines, e.g. for functions with many "
"arguments, and it is followed by <code>else</code> or <code>else if</code>:"
msgstr ""
"Se a instrução singular cobre múltiplas linhas (ex.: para funções com muitos "
"argumentos) e é seguido por <code>else</code> ou <code>eles if</code>:"

#. (itstool) path: item/code
#: C/c-coding-style.page:243
#, no-wrap
msgid ""
"\n"
"/* valid Linux kernel style */\n"
"if (condition) {\n"
"\ta_single_statement_with_many_arguments (some_lengthy_argument,\n"
"\t\t\t\t\t\tanother_lengthy_argument,\n"
"\t\t\t\t\t\tand_another_one,\n"
"\t\t\t\t\t\tplus_one);\n"
"} else\n"
"\tanother_single_statement (arg1, arg2);\n"
"\n"
"/* valid GNU style */\n"
"if (condition)\n"
"  {\n"
"    a_single_statement_with_many_arguments (some_lengthy_argument,\n"
"                                            another_lengthy_argument,\n"
"                                            and_another_one,\n"
"                                            plus_one);\n"
"  }\n"
"else\n"
"  {\n"
"    another_single_statement (arg1, arg2);\n"
"  }"
msgstr ""
"\n"
"/* estilo Kernel Linux válido */\n"
"if (condição) {\n"
"\tuma_instrução_singular_com_muitos_args (algum_argumento_comprido,\n"
"\t\t\t\t\t\toutro_argumento_comprido,\n"
"\t\t\t\t\t\te_mais_um_outro,\n"
"\t\t\t\t\t\tmais_um);\n"
"} else\n"
"\toutro_arg_singular (arg1, arg2);\n"
"\n"
"/* estilo GNU válido */\n"
"if (condição)\n"
"  {\n"
"    uma_instrução_singular_com_muitos_args (algum_argumento_comprido,\n"
"                                            outro_argumento_comprido,\n"
"                                            e_mais_um_outro,\n"
"                                            mais_um);\n"
"  }\n"
"else\n"
"  {\n"
"    outro_arg_singular (arg1, arg2);\n"
"  }"

#. (itstool) path: item/p
#: C/c-coding-style.page:268
msgid "If the condition is composed of many lines:"
msgstr "Se a condição for composta de muitas linhas:"

#. (itstool) path: item/code
#: C/c-coding-style.page:272
#, no-wrap
msgid ""
"\n"
"/* valid Linux kernel style */\n"
"if (condition1 ||\n"
"    (condition2 &amp;&amp; condition3) ||\n"
"    condition4 ||\n"
"    (condition5 &amp;&amp; (condition6 || condition7))) {\n"
"\ta_single_statement ();\n"
"}\n"
"\n"
"/* valid GNU style */\n"
"if (condition1 ||\n"
"    (condition2 &amp;&amp; condition3) ||\n"
"    condition4 ||\n"
"    (condition5 &amp;&amp; (condition6 || condition7)))\n"
"  {\n"
"    a_single_statement ();\n"
"  }"
msgstr ""
"\n"
"/* estilo Kernel Linux válido */\n"
"if (condição1 ||\n"
"    (condição2 &amp;&amp; condição3) ||\n"
"    condição4 ||\n"
"    (condição5 &amp;&amp; (condição6 || condição7))) {\n"
"\tuma_instrução_singular ();\n"
"}\n"
"\n"
"/* estilo GNU válido */\n"
"if (condição1 ||\n"
"    (condição2 &amp;&amp; condição3) ||\n"
"    condição4 ||\n"
"    (condição5 &amp;&amp; (condição6 || condição7)))\n"
"  {\n"
"    uma_instrução_singular ();\n"
"  }"

#. (itstool) path: item/p
#: C/c-coding-style.page:290
msgid ""
"Note that such long conditions are usually hard to understand. A good "
"practice is to set the condition to a boolean variable, with a good name for "
"that variable. Another way is to move the long condition to a function."
msgstr ""
"Note que tais condições longas são geralmente difíceis de entender. Uma boa "
"prática é definir essa condição para uma variável booleana, com um bom nome "
"para aquela variável. Uma outra forma é mover a condição longa para uma "
"função."

#. (itstool) path: item/p
#: C/c-coding-style.page:299
msgid ""
"Nested <code>if</code>s, in which case the block should be placed on the "
"outermost <code>if</code>:"
msgstr ""
"<code>if</code>s aninhados, caso em que o bloco deve ser colocado <code>if</"
"code> mais extremo:"

#. (itstool) path: item/code
#: C/c-coding-style.page:304
#, no-wrap
msgid ""
"\n"
"/* valid Linux kernel style */\n"
"if (condition) {\n"
"\tif (another_condition)\n"
"\t\tsingle_statement ();\n"
"\telse\n"
"\t\tanother_single_statement ();\n"
"}\n"
"\n"
"/* valid GNU style */\n"
"if (condition)\n"
"  {\n"
"    if (another_condition)\n"
"      single_statement ();\n"
"    else\n"
"      another_single_statement ();\n"
"  }"
msgstr ""
"\n"
"/* estilo Kernel Linux válido */\n"
"if (condição) {\n"
"\tif (outra_condição)\n"
"\t\tinstrução_singular ();\n"
"\telse\n"
"\t\toutra_instrução_singular ();\n"
"}\n"
"\n"
"/* estilo GNU válido */\n"
"if (condição)\n"
"  {\n"
"    if (outra_condição)\n"
"      instrução_singular ();\n"
"    else\n"
"      outra_instrução_singular ();\n"
"  }"

#. (itstool) path: item/code
#: C/c-coding-style.page:322
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if (condition)\n"
"\tif (another_condition)\n"
"\t\tsingle_statement ();\n"
"\telse if (yet_another_condition)\n"
"\t\tanother_single_statement ();"
msgstr ""
"\n"
"/* inválido */\n"
"if (condição)\n"
"\tif (outra_condição)\n"
"\t\tinstrução_singular ();\n"
"\telse if (mais_uma_condição)\n"
"\t\toutra_instrução_singular ();"

#. (itstool) path: section/p
#: C/c-coding-style.page:332
msgid ""
"In general, new blocks should be placed on a new indentation level, like "
"this:"
msgstr ""
"Em geral, novos blocos devem ser colocados em um novo nível de recuo, como "
"este:"

#. (itstool) path: section/code
#: C/c-coding-style.page:337
#, no-wrap
msgid ""
"\n"
"int retval = 0;\n"
"\n"
"statement_1 ();\n"
"statement_2 ();\n"
"\n"
"{\n"
"\tint var1 = 42;\n"
"\tgboolean res = FALSE;\n"
"\n"
"\tres = statement_3 (var1);\n"
"\n"
"\tretval = res ? -1 : 1;\n"
"}"
msgstr ""
"\n"
"int retval = 0;\n"
"\n"
"instrucao_1 ();\n"
"instrucao_2 ();\n"
"\n"
"{\n"
"\tint var1 = 42;\n"
"\tgboolean res = FALSE;\n"
"\n"
"\tres = instrucao_3 (var1);\n"
"\n"
"\tretval = res ? -1 : 1;\n"
"}"

#. (itstool) path: section/p
#: C/c-coding-style.page:352
msgid ""
"While curly braces for function definitions should rest on a new line they "
"should not add an indentation level:"
msgstr ""
"Enquanto chaves para definições de função devem ficar em uma nova linha, "
"elas não devem adicionar um novo nível de recuo:"

#. (itstool) path: section/code
#: C/c-coding-style.page:357
#, no-wrap
msgid ""
"\n"
"/* valid Linux kernel style*/\n"
"static void\n"
"my_function (int argument)\n"
"{\n"
"\tdo_my_things ();\n"
"}\n"
"\n"
"/* valid GNU style*/\n"
"static void\n"
"my_function (int argument)\n"
"{\n"
"  do_my_things ();\n"
"}"
msgstr ""
"\n"
"/* estilo Kernel Linux válido */\n"
"static void\n"
"minha_funcao (int argumento)\n"
"{\n"
"\tfaz_minhas_coisas ();\n"
"}\n"
"\n"
"/* estilo GNU válido */\n"
"static void\n"
"minha_funcao (int argumento)\n"
"{\n"
"  faz_minhas_coisas ();\n"
"}"

#. (itstool) path: section/code
#: C/c-coding-style.page:372
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"static void\n"
"my_function (int argument) {\n"
"\tdo_my_things ();\n"
"}\n"
"\n"
"/* invalid */\n"
"static void\n"
"my_function (int argument)\n"
"  {\n"
"    do_my_things ();\n"
"  }"
msgstr ""
"\n"
"/* inválido */\n"
"static void\n"
"minha_funcao (int argumento) {\n"
"\tfaz_minhas_coisas ();\n"
"}\n"
"\n"
"/* inválido */\n"
"static void\n"
"minha_funcao (int argumento)\n"
"  {\n"
"    faz_minhas_coisas ();\n"
"  }"

#. (itstool) path: section/title
#: C/c-coding-style.page:388
msgid "Conditions"
msgstr "Condições"

#. (itstool) path: section/p
#: C/c-coding-style.page:390
msgid ""
"Do not check boolean values for equality. By using implicit comparisons, the "
"resulting code can be read more like conversational English. Another "
"rationale is that a ‘true’ value may not be necessarily equal to whatever "
"the <code>TRUE</code> macro uses. For example:"
msgstr ""
"Não verifique valores booleanos por igualdade. Ao usar comparações "
"implícitas, o código resultante pode ser mais parecido com o inglês "
"conversacional. Um outro fundamento é que um valor ‘verdadeiro’ não "
"necessariamente será igual a macro <code>TRUE</code> usada. Por exemplo:"

#. (itstool) path: section/code
#: C/c-coding-style.page:397
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if (found == TRUE)\n"
"\tdo_foo ();\n"
"\n"
"/* invalid */\n"
"if (found == FALSE)\n"
"\tdo_bar ();"
msgstr ""
"\n"
"/* inválido */\n"
"if (localizado == TRUE)\n"
"\tfazer_foo ();\n"
"\n"
"/* inválido */\n"
"if (localizado == FALSE)\n"
"\tfazer_bar ();"

#. (itstool) path: section/code
#: C/c-coding-style.page:406
#, no-wrap
msgid ""
"\n"
"/* valid */\n"
"if (found)\n"
"\tdo_foo ();\n"
"\n"
"/* valid */\n"
"if (!found)\n"
"\tdo_bar ();"
msgstr ""
"\n"
"/* válido */\n"
"if (localizado)\n"
"\tfazer_foo ();\n"
"\n"
"/* válido */\n"
"if (!localizado)\n"
"\tfazer_bar ();"

#. (itstool) path: section/p
#: C/c-coding-style.page:415
msgid ""
"The C language uses the value 0 for many purposes. As a numeric value, the "
"end of a string, a null pointer and the <code>FALSE</code> boolean. To make "
"the code clearer, you should write code that highlights the specific way 0 "
"is used. So when reading a comparison, it is possible to know the variable "
"type. For boolean variables, an implicit comparison is appropriate because "
"it’s already a logical expression. Other variable types are not logical "
"expressions by themselves, so an explicit comparison is better:"
msgstr ""
"A linguagem C usa o valor 0 para muitos propósitos. Como um valor numérico, "
"o fim de uma string, um ponteiro nulo e o booleano <code>FALSE</code>. Para "
"tornar o código mais limpo, você deveria escrever código que realça a forma "
"específica que 0 é usado. Então, ao ler uma comparação, é possível saber o "
"tipo de variável.  Para variáveis booleanas, uma comparação implícita é "
"apropriado porque já é uma expressão lógica. Outros tipos de variáveis que "
"não são expressões lógicas por si só, então uma comparação explícita é "
"melhor:"

#. (itstool) path: section/code
#: C/c-coding-style.page:426
#, no-wrap
msgid ""
"\n"
"/* valid */\n"
"if (some_pointer == NULL)\n"
"\tdo_blah ();\n"
"\n"
"/* valid */\n"
"if (number == 0)\n"
"\tdo_foo ();\n"
"\n"
"/* valid */\n"
"if (str != NULL &amp;&amp; *str != '\\0')\n"
"\tdo_bar ();"
msgstr ""
"\n"
"/* válido */\n"
"if (algum_ponteiro == NULL)\n"
"\tfazer_blá ();\n"
"\n"
"/* válido */\n"
"if (número == 0)\n"
"\tfazer_foo ();\n"
"\n"
"/* válido */\n"
"if (str != NULL &amp;&amp; *str != '\\0')\n"
"\tfazer_bar ();"

#. (itstool) path: section/code
#: C/c-coding-style.page:439
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if (!some_pointer)\n"
"\tdo_blah ();\n"
"\n"
"/* invalid */\n"
"if (!number)\n"
"\tdo_foo ();\n"
"\n"
"/* invalid */\n"
"if (str &amp;&amp; *str)\n"
"\tdo_bar ();"
msgstr ""
"\n"
"/* inválido */\n"
"if (!algum_ponteiro)\n"
"\tfazer_blá ();\n"
"\n"
"/* inválido */\n"
"if (!número)\n"
"\tfazer_foo ();\n"
"\n"
"/* inválido */\n"
"if (str &amp;&amp; *str)\n"
"\tfazer_bar ();"

#. (itstool) path: section/title
#: C/c-coding-style.page:454
msgid "Functions"
msgstr "Funções"

#. (itstool) path: section/p
#: C/c-coding-style.page:456
msgid ""
"Functions should be declared by placing the returned value on a separate "
"line from the function name:"
msgstr ""
"Funções devem ser declaradas colocando o valor de retorno em uma linha "
"separada do nome da função:"

#. (itstool) path: section/code
#: C/c-coding-style.page:461
#, no-wrap
msgid ""
"\n"
"void\n"
"my_function (void)\n"
"{\n"
"  …\n"
"}"
msgstr ""
"\n"
"void\n"
"minha_funcao (void)\n"
"{\n"
"  …\n"
"}"

#. (itstool) path: section/p
#: C/c-coding-style.page:468
msgid ""
"The argument list must be broken into a new line for each argument, with the "
"argument names right aligned, taking into account pointers:"
msgstr ""
"A lista de argumentos deve estar quebrada em nova linha para cada argumento, "
"com os nomes dos argumentos alinhados à direita, levando em consideração os "
"ponteiros:"

#. (itstool) path: section/code
#: C/c-coding-style.page:474
#, no-wrap
msgid ""
"\n"
"void\n"
"my_function (some_type_t      type,\n"
"             another_type_t  *a_pointer,\n"
"             double_ptr_t   **double_pointer,\n"
"             final_type_t     another_type)\n"
"{\n"
"  …\n"
"}"
msgstr ""
"\n"
"void\n"
"minha_funcao (algum_tipo_t    tipo,\n"
"              outro_tipo_t   *um_ponteiro,\n"
"              double_ptr_t  **ponteiro_duplo,\n"
"              tipo_final_t    outro_tipo)\n"
"{\n"
"  …\n"
"}"

#. (itstool) path: section/p
#: C/c-coding-style.page:484
msgid ""
"If you use Emacs, you can use <code>M-x align</code> to do this kind of "
"alignment automatically. Just put the point and mark around the function’s "
"prototype, and invoke that command."
msgstr ""
"Se você usa Emacs, você pode usar <code>M-x align</code> para fazer esse "
"tipo de alinhamento automaticamente. Basca colocar o ponteiro e marcar em "
"volta do protótipo da função e invocar aquele comando."

#. (itstool) path: section/p
#: C/c-coding-style.page:490
msgid ""
"The alignment also holds when invoking a function without breaking the line "
"length limit:"
msgstr ""
"O alinhamento também se mantém ao invocar uma função sem quebrar o limite de "
"comprimento da linha:"

#. (itstool) path: section/code
#: C/c-coding-style.page:495
#, no-wrap
msgid ""
"\n"
"align_function_arguments (first_argument,\n"
"                          second_argument,\n"
"                          third_argument);"
msgstr ""
"\n"
"alinha_args_de_funcoes (primeiro_argumento,\n"
"                        segundo_argumento,\n"
"                        terceiro_argumento);"

#. (itstool) path: section/title
#: C/c-coding-style.page:502
msgid "Whitespace"
msgstr "Espaço em branco"

#. (itstool) path: section/p
#: C/c-coding-style.page:504
msgid "Always put a space before an opening parenthesis but never after:"
msgstr "Sempre coloque espaço antes de abrir parênteses, mas nunca após:"

# "switch", assim como "if", é uma instrução de programação; não traduzir -- Rafael
#. (itstool) path: section/code
#: C/c-coding-style.page:508
#, no-wrap
msgid ""
"\n"
"/* valid */\n"
"if (condition)\n"
"\tdo_my_things ();\n"
"\n"
"/* valid */\n"
"switch (condition) {\n"
"}"
msgstr ""
"\n"
"/* válido */\n"
"if (condição)\n"
"\tfaz_minhas_coisas ();\n"
"\n"
"/* válido */\n"
"switch (condição) {\n"
"}"

#. (itstool) path: section/code
#: C/c-coding-style.page:517
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if(condition)\n"
"\tdo_my_things();\n"
"\n"
"/* invalid */\n"
"if ( condition )\n"
"\tdo_my_things ( );"
msgstr ""
"\n"
"/* inválido */\n"
"if(condição)\n"
"\tfaz_minhas_coisas();\n"
"\n"
"/* inválido */\n"
"if ( condição )\n"
"\tfaz_minhas_coisas ( );"

#. (itstool) path: section/p
#: C/c-coding-style.page:526
msgid ""
"When declaring a structure type use newlines to separate logical sections of "
"the structure:"
msgstr ""
"Ao declarar um tipo de estrutura, use novas linhas para separar seções "
"lógicas da estrutura:"

#. (itstool) path: section/code
#: C/c-coding-style.page:531
#, no-wrap
msgid ""
"\n"
"struct _GtkWrapBoxPrivate\n"
"{\n"
"\tGtkOrientation        orientation;\n"
"\tGtkWrapAllocationMode mode;\n"
"\n"
"\tGtkWrapBoxSpreading   horizontal_spreading;\n"
"\tGtkWrapBoxSpreading   vertical_spreading;\n"
"\n"
"\tguint16               vertical_spacing;\n"
"\tguint16               horizontal_spacing;\n"
"\n"
"\tguint16               minimum_line_children;\n"
"\tguint16               natural_line_children;\n"
"\n"
"\tGList                *children;\n"
"};"
msgstr ""
"\n"
"struct _GtkWrapBoxPrivate\n"
"{\n"
"\tGtkOrientation        orientation;\n"
"\tGtkWrapAllocationMode mode;\n"
"\n"
"\tGtkWrapBoxSpreading   horizontal_spreading;\n"
"\tGtkWrapBoxSpreading   vertical_spreading;\n"
"\n"
"\tguint16               vertical_spacing;\n"
"\tguint16               horizontal_spacing;\n"
"\n"
"\tguint16               minimum_line_children;\n"
"\tguint16               natural_line_children;\n"
"\n"
"\tGList                *children;\n"
"};"

#. (itstool) path: section/p
#: C/c-coding-style.page:549
msgid ""
"Do not eliminate whitespace and newlines just because something would fit on "
"a single line:"
msgstr ""
"Não elimine espaços em branco e novas linhas apenas por que alguma coisa "
"caberia em uma única linha:"

#. (itstool) path: section/code
#: C/c-coding-style.page:554
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"if (condition) foo (); else bar ();"
msgstr ""
"\n"
"/* inválido */\n"
"if (condição) foo (); else bar ();"

#. (itstool) path: section/p
#: C/c-coding-style.page:558
msgid ""
"Do eliminate trailing whitespace on any line, preferably as a separate patch "
"or commit. Never use empty lines at the beginning or at the end of a file."
msgstr ""
"Elimine espaços em branco de qualquer linha, preferivelmente como um patch "
"ou commit separado. Nunca use linhas vazias no começo ou no fim de um "
"arquivo."

#. (itstool) path: section/p
#: C/c-coding-style.page:564
msgid ""
"This is a little Emacs function that you can use to clean up lines with "
"trailing whitespace:"
msgstr ""
"Essa é uma pequena função de Emacs que você pode usar para limpar linhas "
"terminando com espaço em branco:"

# Quase toda essa mensagem é código; traduzir apenas texto de 'message' -- Rafael
#. (itstool) path: section/code
#: C/c-coding-style.page:569
#, no-wrap
msgid ""
"\n"
"(defun clean-line-ends ()\n"
"  (interactive)\n"
"  (if (not buffer-read-only)\n"
"      (save-excursion\n"
"\t(goto-char (point-min))\n"
"\t(let ((count 0))\n"
"\t  (while (re-search-forward \"[ \t]+$\" nil t)\n"
"\t    (setq count (+ count 1))\n"
"\t    (replace-match \"\" t t))\n"
"\t  (message \"Cleaned %d lines\" count)))))"
msgstr ""
"\n"
"(defun clean-line-ends ()\n"
"  (interactive)\n"
"  (if (not buffer-read-only)\n"
"      (save-excursion\n"
"\t(goto-char (point-min))\n"
"\t(let ((count 0))\n"
"\t  (while (re-search-forward \"[ \t]+$\" nil t)\n"
"\t    (setq count (+ count 1))\n"
"\t    (replace-match \"\" t t))\n"
"\t  (message \"Limpadas %d linhas\" count)))))"

#. (itstool) path: section/title
#: C/c-coding-style.page:583
msgid "The <code>switch</code> Statement"
msgstr "A instrução <code>switch</code>"

# tag <code> adicionada intencionalmente; case não deve ser traduzida -- Rafael
#. (itstool) path: section/p
#: C/c-coding-style.page:585
msgid ""
"A <code>switch</code> should open a block on a new indentation level, and "
"each <code>case</code> should start on the same indentation level as the "
"curly braces, with the case block on a new indentation level:"
msgstr ""
"Um <code>switch</code> deve abrir um bloco em um novo nível de recuo, e cada "
"<code>case</code> deve iniciar no mesmo nível de recuo que as chaves, com o "
"bloco de <code>case</code> em um novo nível de recuo:"

#. (itstool) path: section/code
#: C/c-coding-style.page:592
#, no-wrap
msgid ""
"\n"
"/* valid Linux kernel style */\n"
"switch (condition) {\n"
"case FOO:\n"
"\tdo_foo ();\n"
"\tbreak;\n"
"\n"
"case BAR:\n"
"\tdo_bar ();\n"
"\tbreak;\n"
"}\n"
"\n"
"/* valid GNU style */\n"
"switch (condition)\n"
"  {\n"
"  case FOO:\n"
"    do_foo ();\n"
"    break;\n"
"\n"
"  case BAR:\n"
"    do_bar ();\n"
"    break;\n"
"  }"
msgstr ""
"\n"
"/* estilo Kernel Linux válido */\n"
"switch (condição) {\n"
"case FOO:\n"
"\tfazer_foo ();\n"
"\tbreak;\n"
"\n"
"case BAR:\n"
"\tfazer_bar ();\n"
"\tbreak;\n"
"}\n"
"\n"
"/* estilo GNU válido */\n"
"switch (condição)\n"
"  {\n"
"  case FOO:\n"
"    fazer_foo ();\n"
"    break;\n"
"\n"
"  case BAR:\n"
"    fazer_bar ();\n"
"    break;\n"
"  }"

#. (itstool) path: section/code
#: C/c-coding-style.page:616
#, no-wrap
msgid ""
"\n"
"/* invalid */\n"
"switch (condition) {\n"
"  case FOO: do_foo (); break;\n"
"  case BAR: do_bar (); break;\n"
"}\n"
"\n"
"/* invalid */\n"
"switch (condition)\n"
"  {\n"
"  case FOO: do_foo ();\n"
"    break;\n"
"  case BAR: do_bar ();\n"
"    break;\n"
"  }\n"
"\n"
"/* invalid */\n"
"switch (condition)\n"
"  {\n"
"    case FOO:\n"
"    do_foo ();\n"
"    break;\n"
"    case BAR:\n"
"    do_bar ();\n"
"    break;\n"
"  }"
msgstr ""
"\n"
"/* inválido */\n"
"switch (condição) {\n"
"  case FOO: fazer_foo (); break;\n"
"  case BAR: fazer_bar (); break;\n"
"}\n"
"\n"
"/* inválido */\n"
"switch (condição)\n"
"  {\n"
"  case FOO: fazer_foo ();\n"
"    break;\n"
"  case BAR: fazer_bar ();\n"
"    break;\n"
"  }\n"
"\n"
"/* inválido */\n"
"switch (condição)\n"
"  {\n"
"    case FOO:\n"
"    fazer_foo ();\n"
"    break;\n"
"    case BAR:\n"
"    fazer_bar ();\n"
"    break;\n"
"  }"

#. (itstool) path: section/p
#: C/c-coding-style.page:643
msgid ""
"It is preferable, though not mandatory, to separate the various cases with a "
"newline:"
msgstr ""
"É preferível, apesar de não ser obrigatório, separar os vários cases com uma "
"nova linha:"

#. (itstool) path: section/code
#: C/c-coding-style.page:648
#, no-wrap
msgid ""
"\n"
"switch (condition) {\n"
"case FOO:\n"
"\tdo_foo ();\n"
"\tbreak;\n"
"\n"
"case BAR:\n"
"\tdo_bar ();\n"
"\tbreak;\n"
"\n"
"default:\n"
"\tdo_default ();\n"
"}"
msgstr ""
"\n"
"switch (condição) {\n"
"case FOO:\n"
"\tfazer_foo ();\n"
"\tbreak;\n"
"\n"
"case BAR:\n"
"\tfazer_foo ();\n"
"\tbreak;\n"
"\n"
"default:\n"
"\tfazer_padrão ();\n"
"}"

#. (itstool) path: section/p
#: C/c-coding-style.page:662
msgid ""
"The <code>break</code> statement for the <code>default</code> case is not "
"mandatory."
msgstr ""
"A instrução <code>break</code> para o caso <code>default</code> não é "
"obrigatório."

#. (itstool) path: section/p
#: C/c-coding-style.page:667
msgid ""
"If switching over an enumerated type, a <code>case</code> statement must "
"exist for every member of the enumerated type. For members you do not want "
"to handle, alias their <code>case</code> statements to <code>default</code>:"
msgstr ""
"Se alternando sobre um tipo enumerado, uma instrução <code>case</code> deve "
"existir para cada novo membro do tipo enumerado. Para membros que você não "
"deseja tratar, apelide suas instruções <code>case</code> para <code>default</"
"code>:"

#. (itstool) path: section/code
#: C/c-coding-style.page:674
#, no-wrap
msgid ""
"\n"
"switch (enumerated_condition) {\n"
"case HANDLED_1:\n"
"\tdo_foo ();\n"
"\tbreak;\n"
"\n"
"case HANDLED_2:\n"
"\tdo_bar ();\n"
"\tbreak;\n"
"\n"
"case IGNORED_1:\n"
"case IGNORED_2:\n"
"default:\n"
"\tdo_default ();\n"
"}"
msgstr ""
"\n"
"switch (condição_enumerada) {\n"
"case TRATADA_1:\n"
"\tfazer_foo ();\n"
"\tbreak;\n"
"\n"
"case TRATADA_2:\n"
"\tfazer_bar ();\n"
"\tbreak;\n"
"\n"
"case IGNORADA_1:\n"
"case IGNORADA_2:\n"
"default:\n"
"\tfazer_padrão ();\n"
"}"

#. (itstool) path: section/p
#: C/c-coding-style.page:690
msgid ""
"If most members of the enumerated type should not be handled, consider using "
"an <code>if</code> statement instead of a <code>switch</code>."
msgstr ""
"Se a maioria dos membros do tipo enumerado não deve ser tratada, considere "
"usar uma instrução <code>if</code> em vez de um <code>switch</code>."

#. (itstool) path: section/p
#: C/c-coding-style.page:695
msgid ""
"If a <code>case</code> block needs to declare new variables, the same rules "
"as the inner blocks apply (see above); the <code>break</code> statement "
"should be placed outside of the inner block:"
msgstr ""
"Se um bloco <code>case</code> precisa declarar novas variáveis, as mesmas "
"regras que os blocos internos se aplicam (veja acima); a instrução "
"<code>break</code> deve ser colocada fora do bloco interno:"

#. (itstool) path: section/code
#: C/c-coding-style.page:701
#, no-wrap
msgid ""
"\n"
"/* valid GNU style */\n"
"switch (condition)\n"
"  {\n"
"  case FOO:\n"
"    {\n"
"      int foo;\n"
"\n"
"      foo = do_foo ();\n"
"    }\n"
"    break;\n"
"\n"
"  …\n"
"  }"
msgstr ""
"\n"
"/* estilo GNU válido */\n"
"switch (condição)\n"
"  {\n"
"  case FOO:\n"
"    {\n"
"      int foo;\n"
"\n"
"      foo = fazer_foo ();\n"
"    }\n"
"    break;\n"
"\n"
"  …\n"
"  }"

#. (itstool) path: section/title
#: C/c-coding-style.page:718
msgid "Header Files"
msgstr "Arquivos de cabeçalho"

#. (itstool) path: section/p
#: C/c-coding-style.page:720
msgid ""
"The only major rule for headers is that the function definitions should be "
"vertically aligned in three columns:"
msgstr ""
"A única regra importante para cabeçalhos é que as definições de funções "
"devem estar alinhados verticalmente em três colunas:"

#. (itstool) path: section/code
#: C/c-coding-style.page:725
#, no-wrap
msgid ""
"\n"
"return_type          function_name           (type   argument,\n"
"                                              type   argument,\n"
"                                              type   argument);"
msgstr ""
"\n"
"tipo_retorno          nome_funcao            (tipo   argumento,\n"
"                                              tipo   argumento,\n"
"                                              tipo   argumento);"

#. (itstool) path: section/p
#: C/c-coding-style.page:730
msgid ""
"The maximum width of each column is given by the longest element in the "
"column:"
msgstr ""
"A largura máxima de cada coluna é dada pelo elemento mais longo na coluna:"

#. (itstool) path: section/code
#: C/c-coding-style.page:735
#, no-wrap
msgid ""
"\n"
"void         gtk_type_set_property (GtkType      *type,\n"
"                                    const gchar  *value,\n"
"                                    GError      **error);\n"
"const gchar *gtk_type_get_property (GtkType      *type);"
msgstr ""
"\n"
"void         gtk_type_set_property (GtkType      *type,\n"
"                                    const gchar  *value,\n"
"                                    GError      **error);\n"
"const gchar *gtk_type_get_property (GtkType      *type);"

#. (itstool) path: section/p
#: C/c-coding-style.page:741
msgid "It is also possible to align the columns to the next tab:"
msgstr "Também é possível alinhar as colunas à próxima tabulação:"

#. (itstool) path: section/code
#: C/c-coding-style.page:745
#, no-wrap
msgid ""
"\n"
"void          gtk_type_set_prop           (GtkType *type,\n"
"                                           gfloat   value);\n"
"gfloat        gtk_type_get_prop           (GtkType *type);\n"
"gint          gtk_type_update_foobar      (GtkType *type);"
msgstr ""
"\n"
"void          gtk_type_set_prop           (GtkType *type,\n"
"                                           gfloat   value);\n"
"gfloat        gtk_type_get_prop           (GtkType *type);\n"
"gint          gtk_type_update_foobar      (GtkType *type);"

#. (itstool) path: section/p
#: C/c-coding-style.page:751
msgid ""
"As before, you can use <code>M-x align</code> in Emacs to do this "
"automatically."
msgstr ""
"Como anteriormente, você pode usar <code>M-x align</code> no Emacs para "
"fazer isso automaticamente."

#. (itstool) path: section/p
#: C/c-coding-style.page:756
msgid ""
"If you are creating a public library, try to export a single public header "
"file that in turn includes all the smaller header files into it. This is so "
"that public headers are never included directly; rather a single include is "
"used in applications. For example, GTK+ uses the following in its header "
"files that should not be included directly by applications:"
msgstr ""
"Se você está criando uma biblioteca pública, tente exportar um único arquivo "
"de cabeçalho público que, por sua vez, inclua todos os arquivos de "
"cabeçalhos menores nele. Isto é para que cabeçalhos públicos nunca seja "
"incluídos diretamente; em vez disso, uma única inclusão é usada nos "
"aplicativos. Por exemplo, GTK+ usa o seguinte em seus arquivos de cabeçalhos "
"que não devem ser incluídos diretamente por aplicativos:"

#. (itstool) path: section/code
#: C/c-coding-style.page:766
#, no-wrap
msgid ""
"\n"
"#if !defined (__GTK_H_INSIDE__) &amp;&amp; !defined (GTK_COMPILATION)\n"
"#error \"Only &lt;gtk/gtk.h&gt; can be included directly.\"\n"
"#endif"
msgstr ""
"\n"
"#if !defined (__GTK_H_INSIDE__) &amp;&amp; !defined (GTK_COMPILATION)\n"
"#error \"Only &lt;gtk/gtk.h&gt; can be included directly.\"\n"
"#endif"

#. (itstool) path: section/p
#: C/c-coding-style.page:771
msgid ""
"For libraries, all headers should have inclusion guards (for internal usage) "
"and C++ guards. These provide the <code>extern \"C\"</code> magic that C++ "
"requires to include plain C headers:"
msgstr ""
"Para bibliotecas, todos cabeçalhos devem ter proteções de inclusão (para uso "
"interno) e proteções de C++ ou, em inglês, <em>#include guards</em> e <em>C+"
"+ guards</em>. Estas fornece a mágica <code>extern \"C\"</code> que C++ "
"requer para incluir cabeçalhos de C simples:"

#. (itstool) path: section/code
#: C/c-coding-style.page:777
#, no-wrap
msgid ""
"\n"
"#ifndef MYLIB_FOO_H_\n"
"#define MYLIB_FOO_H_\n"
"\n"
"#include &lt;gtk/gtk.h&gt;\n"
"\n"
"G_BEGIN_DECLS\n"
"\n"
"…\n"
"\n"
"G_END_DECLS\n"
"\n"
"#endif /* MYLIB_FOO_H_ */"
msgstr ""
"\n"
"#ifndef MYLIB_FOO_H_\n"
"#define MYLIB_FOO_H_\n"
"\n"
"#include &lt;gtk/gtk.h&gt;\n"
"\n"
"G_BEGIN_DECLS\n"
"\n"
"…\n"
"\n"
"G_END_DECLS\n"
"\n"
"#endif /* MYLIB_FOO_H_ */"

#. (itstool) path: section/title
#: C/c-coding-style.page:793
msgid "GObject Classes"
msgstr "Classes de GObject"

#. (itstool) path: section/p
#: C/c-coding-style.page:795
msgid ""
"GObject class definitions and implementations require some additional coding "
"style notices, and should always be <link xref=\"namespacing#gobject"
"\">correctly namespaced</link>."
msgstr ""
"Definições e implementações de classe GObject exigem algumas notas "
"adicionais de estilo de codificação, e devem sempre estar sob <link xref="
"\"namespacing#gobject\">espaço de nome correto</link>."

#. (itstool) path: section/p
#: C/c-coding-style.page:801
msgid "Typedef declarations should be placed at the beginning of the file:"
msgstr ""
"Declarações <code>Typedef</code> devem ser colocadas no começo do arquivo:"

#. (itstool) path: section/code
#: C/c-coding-style.page:805
#, no-wrap
msgid ""
"\n"
"typedef struct _GtkBoxedStruct       GtkBoxedStruct;\n"
"typedef struct _GtkMoreBoxedStruct   GtkMoreBoxedStruct;"
msgstr ""
"\n"
"typedef struct _GtkBoxedStruct       GtkBoxedStruct;\n"
"typedef struct _GtkMoreBoxedStruct   GtkMoreBoxedStruct;"

#. (itstool) path: section/p
#: C/c-coding-style.page:809
msgid "This includes enumeration types:"
msgstr "Isso inclui tipos de enumeração:"

#. (itstool) path: section/code
#: C/c-coding-style.page:813
#, no-wrap
msgid ""
"\n"
"typedef enum\n"
"{\n"
"  GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT,\n"
"  GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH\n"
"} GtkSizeRequestMode;"
msgstr ""
"\n"
"typedef enum\n"
"{\n"
"  GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT,\n"
"  GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH\n"
"} GtkSizeRequestMode;"

#. (itstool) path: section/p
#: C/c-coding-style.page:820
msgid "And callback types:"
msgstr "A tipos de retorno de chamada (<em>callback</em>):"

#. (itstool) path: section/code
#: C/c-coding-style.page:824
#, no-wrap
msgid ""
"\n"
"typedef void (* GtkCallback) (GtkWidget *widget,\n"
"                              gpointer   user_data);"
msgstr ""
"\n"
"typedef void (* GtkCallback) (GtkWidget *widget,\n"
"                              gpointer   user_data);"

#. (itstool) path: section/p
#: C/c-coding-style.page:828
msgid ""
"Instance structures should be declared using <code>G_DECLARE_FINAL_TYPE</"
"code> or <code>G_DECLARE_DERIVABLE_TYPE</code>:"
msgstr ""
"Estruturas de instâncias devem ser declaradas usando "
"<code>G_DECLARE_FINAL_TYPE</code> ou <code>G_DECLARE_DERIVABLE_TYPE</code>:"

#. (itstool) path: section/code
#: C/c-coding-style.page:834
#, no-wrap
msgid ""
"\n"
"#define GTK_TYPE_FOO (gtk_foo_get_type ())\n"
"G_DECLARE_FINAL_TYPE (GtkFoo, gtk_foo, GTK, FOO, GtkWidget)"
msgstr ""
"\n"
"#define GTK_TYPE_FOO (gtk_foo_get_type ())\n"
"G_DECLARE_FINAL_TYPE (GtkFoo, gtk_foo, GTK, FOO, GtkWidget)"

#. (itstool) path: section/p
#: C/c-coding-style.page:838
msgid ""
"For final types, private data can be stored in the object struct, which "
"should be defined in the C file:"
msgstr ""
"Para tipos finais, dados privados podem ser armazenados em um objeto "
"<code>struct</code>, o qual deve ser definido no arquivo C:"

#. (itstool) path: section/code
#: C/c-coding-style.page:843
#, no-wrap
msgid ""
"\n"
"struct _GtkFoo\n"
"{\n"
"  GObject   parent_instance;\n"
"\n"
"  guint     private_data;\n"
"  gpointer  more_private_data;\n"
"};"
msgstr ""
"\n"
"struct _GtkFoo\n"
"{\n"
"  GObject   instancia_pai;\n"
"\n"
"  guint     dados_privados;\n"
"  gpointer  mais_dados_privados;\n"
"};"

#. (itstool) path: section/p
#: C/c-coding-style.page:852
msgid ""
"For derivable types, private data must be stored in a private struct in the "
"C file, configured using <code>G_DEFINE_TYPE_WITH_PRIVATE()</code> and "
"accessed using a <code>_get_instance_private()</code> function:"
msgstr ""
"Para tipos deriváveis, dados privados devem estar armazenados em um struct "
"privado no arquivo C, configurado usando <code>G_DEFINE_TYPE_WITH_PRIVATE()</"
"code> e acessado usando uma função <code>_get_instance_private()</code>:"

#. (itstool) path: section/code
#: C/c-coding-style.page:858
#, no-wrap
msgid ""
"\n"
"#define GTK_TYPE_FOO gtk_foo_get_type ()\n"
"G_DECLARE_DERIVABLE_TYPE (GtkFoo, gtk_foo, GTK, FOO, GtkWidget)\n"
"\n"
"struct _GtkFooClass\n"
"{\n"
"  GtkWidgetClass parent_class;\n"
"\n"
"  void (* handle_frob)  (GtkFrobber *frobber,\n"
"                         guint       n_frobs);\n"
"\n"
"  gpointer padding[12];\n"
"};"
msgstr ""
"\n"
"#define GTK_TYPE_FOO gtk_foo_get_type ()\n"
"G_DECLARE_DERIVABLE_TYPE (GtkFoo, gtk_foo, GTK, FOO, GtkWidget)\n"
"\n"
"struct _GtkFooClass\n"
"{\n"
"  GtkWidgetClass parent_class;\n"
"\n"
"  void (* handle_frob)  (GtkFrobber *frobber,\n"
"                         guint       n_frobs);\n"
"\n"
"  gpointer padding[12];\n"
"};"

#. (itstool) path: section/p
#: C/c-coding-style.page:872
msgid ""
"Always use the <code>G_DEFINE_TYPE()</code>, "
"<code>G_DEFINE_TYPE_WITH_PRIVATE()</code>, and "
"<code>G_DEFINE_TYPE_WITH_CODE()</code> macros, or their abstract variants "
"<code>G_DEFINE_ABSTRACT_TYPE()</code>, "
"<code>G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE()</code>, and "
"<code>G_DEFINE_ABSTRACT_TYPE_WITH_CODE()</code>; also, use the similar "
"macros for defining interfaces and boxed types."
msgstr ""
"Sempre use as macros <code>G_DEFINE_TYPE()</code>, "
"<code>G_DEFINE_TYPE_WITH_PRIVATE()</code> e <code>G_DEFINE_TYPE_WITH_CODE()</"
"code> ou suas variantes abstratas <code>G_DEFINE_ABSTRACT_TYPE()</code>, "
"<code>G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE()</code> e "
"<code>G_DEFINE_ABSTRACT_TYPE_WITH_CODE()</code>; também, use as macros "
"similares para definir interfaces e tipos “boxed”."

#. (itstool) path: section/p
#: C/c-coding-style.page:882
msgid "Interface types should always have the dummy typedef for cast purposes:"
msgstr ""
"Tipos de interfaces devem sempre ter um typedef dummy visando as chamadas:"

#. (itstool) path: section/code
#: C/c-coding-style.page:887
#, no-wrap
msgid ""
"\n"
"typedef struct _GtkFooable          GtkFooable;"
msgstr ""
"\n"
"typedef struct _GtkFooable          GtkFooable;"

#. (itstool) path: section/p
#: C/c-coding-style.page:890
msgid ""
"The interface structure should have ‘Interface’ postfixed to the dummy "
"typedef:"
msgstr ""
"A estrutura da interface deve ter ‘Interface’ pós-fixado ao typedef dummy:"

#. (itstool) path: section/code
#: C/c-coding-style.page:895
#, no-wrap
msgid ""
"\n"
"typedef struct _GtkFooableInterface     GtkFooableInterface;"
msgstr ""
"\n"
"typedef struct _GtkFooableInterface     GtkFooableInterface;"

#. (itstool) path: section/p
#: C/c-coding-style.page:898
msgid "Interfaces must have the following macros:"
msgstr "Interfaces devem ter as seguintes macros:"

#. (itstool) path: td/p
#: C/c-coding-style.page:905
msgid "Macro"
msgstr "Macro"

#. (itstool) path: td/p
#: C/c-coding-style.page:906
msgid "Expands to"
msgstr "Expande para"

#. (itstool) path: td/p
#: C/c-coding-style.page:911
msgid "<code>GTK_TYPE_<var>iface_name</var></code>"
msgstr "<code>GTK_TYPE_<var>iface_name</var></code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:912
msgid "<code><var>iface_name</var>_get_type</code>"
msgstr "<code><var>iface_name</var>_get_type</code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:915
msgid "<code>GTK_<var>iface_name</var></code>"
msgstr "<code>GTK_<var>iface_name</var></code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:916
msgid "<code>G_TYPE_CHECK_INSTANCE_CAST</code>"
msgstr "<code>G_TYPE_CHECK_INSTANCE_CAST</code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:919
msgid "<code>GTK_IS_<var>iface_name</var></code>"
msgstr "<code>GTK_IS_<var>iface_name</var></code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:920
msgid "<code>G_TYPE_CHECK_INSTANCE_TYPE</code>"
msgstr "<code>G_TYPE_CHECK_INSTANCE_TYPE</code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:923
msgid "<code>GTK_<var>iface_name</var>_GET_IFACE</code>"
msgstr "<code>GTK_<var>iface_name</var>_GET_IFACE</code>"

#. (itstool) path: td/p
#: C/c-coding-style.page:924
msgid "<code>G_TYPE_INSTANCE_GET_INTERFACE</code>"
msgstr "<code>G_TYPE_INSTANCE_GET_INTERFACE</code>"

#. (itstool) path: section/title
#: C/c-coding-style.page:932
msgid "Memory Allocation"
msgstr "Alocação de memória"

#. (itstool) path: section/p
#: C/c-coding-style.page:934
msgid "When dynamically allocating data on the heap use <code>g_new()</code>."
msgstr ""
"Quando se estiver alocando dados em uma pilha, use <code>g_new()</code>."

#. (itstool) path: section/p
#: C/c-coding-style.page:938
msgid ""
"Public structure types should always be returned after being zero-ed, either "
"explicitly for each member, or by using <code>g_new0()</code>."
msgstr ""
"Tipos de estrutura pública devem sempre ser retornados após serem zerados, "
"seja explicitamente para cada membro, seja usando <code>g_new0()</code>."

#. (itstool) path: section/p
#: C/c-coding-style.page:944
msgid "See <link xref=\"memory-management\"/> for more details."
msgstr "Veja <link xref=\"memory-management\"/> para mais detalhes."

#. (itstool) path: section/title
#: C/c-coding-style.page:950
msgid "Macros"
msgstr "Macros"

#. (itstool) path: section/p
#: C/c-coding-style.page:952
msgid ""
"Try to avoid private macros unless strictly necessary. Remember to "
"<code>#undef</code> them at the end of a block or a series of functions "
"needing them."
msgstr ""
"Tente evitar macros privadas, a menos que seja estritamente necessário. "
"Lembre-se de usar <code>#undef</code> nelas no final de um bloco ou uma "
"série de funções que precisem delas."

#. (itstool) path: section/p
#: C/c-coding-style.page:958
msgid "Inline functions are usually preferable to private macros."
msgstr "Funções em linha são geralmente preferíveis a macros privadas."

#. (itstool) path: section/p
#: C/c-coding-style.page:962
msgid "Public macros should not be used unless they evaluate to a constant."
msgstr ""
"Macros públicas não devem ser usadas a menos que elas sejam avaliadas para "
"uma constante."

#. (itstool) path: section/title
#: C/c-coding-style.page:969
msgid "Public API"
msgstr "API pública"

#. (itstool) path: section/p
#: C/c-coding-style.page:971
msgid ""
"Avoid exporting variables as public API, since this is cumbersome on some "
"platforms. It is always preferable to add getters and setters instead. Also, "
"beware global variables in general."
msgstr ""
"Evite exportar variáveis como API pública, já que isso pode ser pesado "
"demais para algumas plataformas. Em vez disso, é sempre preferível adicionar "
"“gets” e “sets”. Também, cuidado com variáveis globais em geral."

#. (itstool) path: section/title
#: C/c-coding-style.page:980
msgid "Private API"
msgstr "API privada"

#. (itstool) path: section/p
#: C/c-coding-style.page:982
msgid ""
"Non-exported functions that are needed in more than one source file should "
"be prefixed with an underscore (‘_’), and declared in a private header file. "
"For example, <code>_mylib_internal_foo()</code>."
msgstr ""
"Funções não exportadas que são necessárias em mais de um arquivo fonte devem "
"ser prefixadas com um sublinhado (‘_’) e declarados em um arquivo de "
"cabeçalho privado. Por exemplo, <code>_minhalib_foo_interno()</code>."

#. (itstool) path: section/p
#: C/c-coding-style.page:988
msgid "Underscore-prefixed functions are never exported."
msgstr "Funções prefixadas com sublinhado nunca são exportadas."

#. (itstool) path: section/p
#: C/c-coding-style.page:992
msgid ""
"Non-exported functions that are only needed in one source file should be "
"declared static."
msgstr ""
"Funções não exportadas que são necessárias apenas em um arquivo fonte devem "
"ser declaradas com estáticas."

#. (itstool) path: p/link
#: C/cc-by-sa-3-0.xml:4
msgid "Creative Commons Attribution-Share Alike 3.0 United States License"
msgstr ""
"Licença Creative Commons Atribuição-Compartilhada Igual 3.0, dos Estados "
"Unidos"

#. (itstool) path: license/p
#: C/cc-by-sa-3-0.xml:3
msgid "This work is licensed under a <_:link-1/>."
msgstr "Este trabalho está licenciado sob uma <_:link-1/>."

#. (itstool) path: license/p
#: C/cc-by-sa-3-0.xml:6
msgid ""
"As a special exception, the copyright holders give you permission to copy, "
"modify, and distribute the example code contained in this document under the "
"terms of your choosing, without restriction."
msgstr ""
"Como uma exceção especial, os detentores do copyright dão a você permissão "
"para copiar, modificar e distribuir o código exemplo contido nesta "
"documentação sob os termos de sua escolha, sem restrição."

#. (itstool) path: info/desc
#: C/databases.page:18
msgid "Simple persistent object stores"
msgstr "Armazenamentos simples de objetos persistentes"

#. (itstool) path: page/title
#: C/databases.page:21
msgid "Databases"
msgstr "Bancos de dados"

#. (itstool) path: item/p
#: C/databases.page:27
msgid ""
"Use databases for appropriate use cases: not configuration data (use "
"GSettings). (<link xref=\"#when-to-use-databases\"/>)"
msgstr ""
"Use bancos de dados para casos de uso apropriados: não para dados de "
"configuração (use GSettings). (<link xref=\"#when-to-use-databases\"/>)"

#. (itstool) path: item/p
#: C/databases.page:31
msgid ""
"Choose between GOM and GVDB based on whether indexing is required. (<link "
"xref=\"#when-to-use-databases\"/>)"
msgstr ""
"Escolha entre GOM e GVDB com base em se indexação é necessária. (<link xref="
"\"#when-to-use-databases\"/>)"

#. (itstool) path: item/p
#: C/databases.page:35
msgid ""
"Consider your vacuuming policy before committing to using GOM. (<link xref="
"\"#when-to-use-databases\"/>)"
msgstr ""
"Considere sua política de <em>vacuuming</em> antes de usar GOM. (<link xref="
"\"#when-to-use-databases\"/>)"

#. (itstool) path: item/p
#: C/databases.page:39
msgid ""
"Avoid SQL injection vulnerabilities by using prepared statements. (<link "
"xref=\"#sql-injection\"/>)"
msgstr ""
"Evite vulnerabilidades de injeção SQL usando as instruções preparadas. "
"(<link xref=\"#sql-injection\"/>)"

#. (itstool) path: section/title
#: C/databases.page:47
msgid "When to Use Databases"
msgstr "Quando usar bancos de dados"

#. (itstool) path: section/p
#: C/databases.page:49
msgid ""
"Configuration data should be stored in <link href=\"https://developer.gnome."
"org/gio/stable/GSettings.html\">GSettings</link>. As a rule of thumb, if "
"some data needs to be persistent and affects how an application behaves, it "
"is configuration data. If it could potentially be subject to policies "
"imposed by the system administrator (such as proxy or lockdown settings), it "
"is configuration data. If it contains user created content, it is not "
"configuration data, and should not be stored in GSettings."
msgstr ""
"Dados de configuração devem ser armazenados em <link href=\"https://"
"developer.gnome.org/gio/stable/GSettings.html\">GSettings</link>. Como uma "
"regra de ouro, se alguns dados precisam ser persistentes e afetam como um "
"aplicativo se comporta, eles são dados de configuração. Se eles estão "
"potencialmente sujeitos a políticas impostas pelo administrador do sistema "
"(tal como configurações de proxy e bloqueio), são dados de configuração. Se "
"eles contêm conteúdo criado por usuários, não são dados de configuração e "
"não devem ser armazenados em GSettings."

#. (itstool) path: section/p
#: C/databases.page:60
msgid ""
"For such situations where user data is highly structured, storing it in a "
"database is sensible. There are two main databases suggested for use within "
"GNOME: GOM and GVDB. GOM is a wrapper around SQLite, and hence implements "
"indexing of fields and SQL-style queries. GVDB is a much simpler object "
"store, supporting fast serialization of a dictionary of objects to disk."
msgstr ""
"Para tais situações nas quais dados de usuário estejam altamente "
"estruturado, armazená-los em um banco de dados é sensível. Há dois bancos de "
"dados principais sugeridos para usar com GNOME: GOM e GVDB. GOM é um "
"interfaceador do SQLite e, portanto, implementa indexação de campos e "
"consultas no tipo SQL. GVDB é um armazenamento de objeto muito mais simples, "
"oferecendo suporte a serialização rápida de um dicionário de objetos para "
"disco."

#. (itstool) path: section/p
#: C/databases.page:69
msgid ""
"GOM should be used if you need advanced features, especially indexing. GVDB "
"should be used otherwise."
msgstr ""
"GOM deve ser usado se você precisa de recursos avançados, especialmente "
"indexação. Do contrário, GVDB deve ser usado."

#. (itstool) path: section/p
#: C/databases.page:74
msgid ""
"Before deciding to use GOM (and hence SQLite), you must consider a vacuuming "
"policy for the database, and whether your use case will interact well with "
"SQLite’s vacuuming system. Vacuuming is effectively SQLite’s term for "
"defragmenting the database — if a database is not vacuumed appropriately, "
"performance will degrade and the database size will increase indefinitely. "
"Read <link href=\"http://blogs.gnome.org/jnelson/2015/01/06/sqlite-vacuum-"
"and-auto_vacuum/\">this article</link> on vacuuming for more information; "
"please consider it before choosing to use GOM."
msgstr ""
"Antes de decidir por usar o GOM (e, portanto, SQLite), você deveria "
"considerar uma política de <em>vacuuming</em> para o banco de dados e se seu "
"caso de uso vai interagir bem com o sistema de vácuo do SQLite. "
"<em>Vaccuming</em> é, efetivamente, o termo para desfragmentação do banco de "
"dados — se um banco de dados não for adequadamente aspirado, o desempenho "
"será degradado e seu tamanho vai aumentar indefinidamente. Leia <link href="
"\"http://blogs.gnome.org/jnelson/2015/01/06/sqlite-vacuum-and-auto_vacuum/"
"\">este artigo</link> sobre <em>vacuuming</em> para mais informações; "
"considere-o antes de escolher usar GOM."

#. (itstool) path: section/p
#: C/databases.page:86
msgid ""
"GNOME has another database library: GNOME Data Access (GDA). This is "
"targeted at abstracting access to various types of relational database, for "
"use in a database utility program or office program, for example. It is not "
"suitable for storing <link href=\"https://developer.gnome.org/gio/stable/"
"GSettings.html\">user settings</link>."
msgstr ""
"GNOME possui uma outra biblioteca de banco de dados: GNOME Data Access "
"(GDA). Ela visa abstrair o acesso a vários tipos de banco de dados "
"relacionais, para uso em um programa utilitário de banco de dados ou "
"programa de escritório, por exemplo. Ela não é adequado para armazenar <link "
"href=\"https://developer.gnome.org/gio/stable/GSettings.html\">configurações "
"de usuários</link>."

#. (itstool) path: section/title
#: C/databases.page:97
msgid "Using GOM"
msgstr "Usando o GOM"

#. (itstool) path: section/p
#: C/databases.page:99
msgid ""
"Providing a GOM tutorial is beyond the scope of this document, but a <link "
"href=\"https://developer.gnome.org/gom/\">reference manual is available</"
"link>."
msgstr ""
"Fornecer um tutorial do GOM vai além do escopo deste documento, mas um <link "
"href=\"https://developer.gnome.org/gom/\">manual de referência está "
"disponível</link>."

#. (itstool) path: section/title
#: C/databases.page:113
msgid "SQL Injection"
msgstr "Injeção de SQL"

# Desconheço tradução para o termo técnico "prepared statement" e "value binding" --Rafael
# Utilizada a URL do Wikipédia em português para Injeção de SQL --Rafael
#. (itstool) path: section/p
#: C/databases.page:115
msgid ""
"GOM does allow access to the lower level SQLite query APIs. When using them, "
"queries <em style=\"strong\">must</em> be constructed using SQLite’s <link "
"href=\"https://www.sqlite.org/c3ref/stmt.html\">prepared statement</link> "
"and <link href=\"https://www.sqlite.org/c3ref/bind_blob.html\">value "
"binding</link> API, rather than by constructing SQL strings then passing "
"them to SQLite to parse. Constructing strings makes <link href=\"http://en."
"wikipedia.org/wiki/SQL_injection\">SQL injection</link> vulnerabilities very "
"likely, which can give attackers access to arbitrary user data from the "
"database."
msgstr ""
"GOM não permite acesso às APIs de consulta de baixo de nível do SQLite. Ao "
"usá-las, as consultas <em style=\"strong\">devem</em> ser construídas usando "
"a API de <link href=\"https://www.sqlite.org/c3ref/stmt.html\">prepared "
"statement</link> (instrução preparada) e <link href=\"https://www.sqlite.org/"
"c3ref/bind_blob.html\">value binding</link> (associação de valor) do SQLite, "
"em vez de construir strings SQL e, então, passá-las para o SQLite "
"interpretar. Construir strings possibilita as vulnerabilidades da <link href="
"\"https://pt.wikipedia.org/wiki/Inje%C3%A7%C3%A3o_de_SQL\">injeção de SQL</"
"link>, o que pode fornecer acesso aos atacantes a dados de usuários a partir "
"do banco de dados."

#. (itstool) path: section/title
#: C/databases.page:131
msgid "Using GVDB"
msgstr "Usando o GVDB"

#. (itstool) path: section/p
#: C/databases.page:133
msgid ""
"GVDB has a simple API which mirrors a conventional hash table. Presently, "
"GVDB is only available as a copy-and-paste library; fetch the most recent "
"copy of the code from <link href=\"https://git.gnome.org/browse/gvdb\">GVDB "
"git</link> and copy it into your project. It is licenced under LGPLv2.1+."
msgstr ""
"GVDB possui uma API simples que espelha a tabela de hash convencional. "
"Atualmente, GVDB está disponível apenas como uma biblioteca de "
"copiar-e-colar; obtenha a cópia mais recente do código de <link href=\""
"https://git.gnome.org/browse/gvdb\">GVDB git</link> e copie-o para seu "
"projeto. Ele está licenciado sob LGPLv2.1+."

#. (itstool) path: section/p
#: C/databases.page:141
msgid "A full GVDB tutorial is beyond the scope of this document."
msgstr "Um tutorial completo do GVDB vai além do escopo deste documento."

#. (itstool) path: info/desc
#: C/documentation.page:26
msgid "Adding documentation to libraries and APIs"
msgstr "Adicionando documentação a bibliotecas e APIs"

#. (itstool) path: page/title
#. (itstool) path: section/title
#: C/documentation.page:29 C/memory-management.page:473
msgid "Documentation"
msgstr "Documentação"

#. (itstool) path: item/p
#: C/documentation.page:35
msgid ""
"Use gtk-doc with up-to-date settings for API documentation. (<link xref="
"\"#gtk-doc\"/>)"
msgstr ""
"Use gtk_doc com configurações atualizadas para documentação de API. (<link "
"xref=\"#gtk-doc\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:39
msgid ""
"Use XML entities for including external symbols into the documentation. "
"(<link xref=\"#build-system\"/>)"
msgstr ""
"Use entidades XML para inclusão de símbolos externos à documentação. (<link "
"xref=\"#build-system\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:43
msgid ""
"Use a consistent, standard, table of contents for all API documentation to "
"maintain familiarity. (<link xref=\"#standard-layout\"/>)"
msgstr ""
"Use uma tabela de conteúdos consistente e padrão para toda documentação de "
"API para manter a familiaridade. (<link xref=\"#standard-layout\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:47
msgid ""
"Use <cmd>gdbus-codegen</cmd> to generate D-Bus API documentation to include "
"in the gtk-doc build. (<link xref=\"#dbus-api\"/>)"
msgstr ""
"Use <cmd>gdbus-codegen</cmd> para gerar documentação de API do D-Bus para "
"incluir na compilação de gtk-doc. (<link xref=\"#dbus-api\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:51
msgid ""
"Add introspection annotations to all API documentation. (<link xref="
"\"#introspection-annotations\"/>)"
msgstr ""
"Adicione anotações de introspecção a toda documentação de API. (<link xref="
"\"#introspection-annotations\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:55
msgid ""
"Add <code>Since</code> lines to all API documentation. (<link xref=\"#symbol-"
"versioning\"/>)"
msgstr ""
"Adicione linhas <code>Since</code> para toda documentação de API. (<link "
"xref=\"#symbol-versioning\"/>)"

#. (itstool) path: item/p
#: C/documentation.page:59
msgid "Enable gtk-doc tests. (<link xref=\"#keeping-up-to-date\"/>)"
msgstr "Habilite testes de gtk-doc. (<link xref=\"#keeping-up-to-date\"/>)"

#. (itstool) path: section/title
#: C/documentation.page:66
msgid "gtk-doc"
msgstr "gtk-doc"

#. (itstool) path: section/p
#: C/documentation.page:68
msgid ""
"The preferred documentation system for GNOME libraries is <link href="
"\"http://www.gtk.org/gtk-doc/\">gtk-doc</link>, which extracts inline "
"comments from the code to let you build a <link href=\"http://docbook.org/"
"\">DocBook</link> document and collection of HTML pages. These can then be "
"read in <link href=\"https://wiki.gnome.org/Apps/Devhelp\">Devhelp</link>. A "
"lot of GNOME’s infrastructure is built to handle with documentation written "
"using gtk-doc."
msgstr ""
"O sistema de documentação preferido para bibliotecas do GNOME é o <link href="
"\"http://www.gtk.org/gtk-doc/\">gtk-doc</link>, o qual extrai comentários em "
"linha do código e permite que você compile um documento <link href=\"http://"
"docbook.org/\">DocBook</link> e coleção de páginas HTML. Esses podem ser "
"lidos em <link href=\"https://wiki.gnome.org/Apps/Devhelp\">Devhelp</link>. "
"Muito da infraestrutura do GNOME é construído para lidar com documentação "
"escrita usando gtk-doc."

#. (itstool) path: section/title
#: C/documentation.page:81
msgid "Build System"
msgstr "Sistema de compilação"

#. (itstool) path: section/p
#: C/documentation.page:83
msgid ""
"To integrate gtk-doc into a project’s build system, follow the <link href="
"\"https://developer.gnome.org/gtk-doc-manual/stable/settingup.html.en\"> "
"instructions in the gtk-doc manual</link>. Note that while the "
"<file>sections.txt</file> file is automatically generated the first time gtk-"
"doc is run, it is not generated subsequently, and should be kept up to date "
"manually. It should also be <link href=\"https://developer.gnome.org/gtk-doc-"
"manual/stable/settingup_vcs.html.en\"> in version control</link>."
msgstr ""
"Para integrar gtk-doc a um sistema de compilação do projeto, siga as <link "
"href=\"https://developer.gnome.org/gtk-doc-manual/stable/settingup.html.en"
"\"> instruções no manual do gtk-doc</link>. Note que enquanto o arquivo "
"<file>sections.txt</file> é gerado automaticamente na primeira vez que o gtk-"
"doc é executado, ele não é gerado subsequentemente, e deve ser mantido "
"atualizado. Ele também deve estar <link href=\"https://developer.gnome.org/"
"gtk-doc-manual/stable/settingup_vcs.html.en\"> no controle de versão</link>."

#. (itstool) path: section/p
#: C/documentation.page:94
msgid ""
"gtk-doc’s <code>no-tmpl</code> flavour should be used, and XML mode should "
"be used instead of SGML. (tmpl mode and SGML are both outdated and slower "
"than XML.)"
msgstr ""
"A opção <code>--flavour no-tmpl</code> do gtk-doc deve ser usada, e o modo "
"XML deve ser usado no lugar do SGML. (modo tmpl e SGML estão ambos "
"desatualizados e são mais lentos que XML.)"

#. (itstool) path: section/p
#: C/documentation.page:106
msgid ""
"If the package version is needed to be substituted into the documentation, "
"create a file named <file>docs/version.xml.in</file>, containing:"
msgstr ""
"Se a versão do pacote for necessária para ser substituída na documentação, "
"crie um arquivo chamado <file>docs/version.xml.in</file>, contendo:"

#. (itstool) path: section/code
#: C/documentation.page:110
#, no-wrap
msgid "@PACKAGE_VERSION@"
msgstr "@PACKAGE_VERSION@"

#. (itstool) path: section/p
#: C/documentation.page:111
msgid ""
"Add it to <code>AC_CONFIG_FILES</code> in <file>configure.ac</file>, then "
"include it into the main documentation file (<file>*-docs.xml</file>) using: "
"<code>&lt;!ENTITY version SYSTEM \"version.xml\"&gt;</code> in the "
"<code>DOCTYPE</code> at the top of the document. The package version can "
"then be used inline as <code>&amp;version;</code>."
msgstr ""
"Adicione-o a <code>AC_CONFIG_FILES</code> no <file>configure.ac</file>, "
"então inclua-o ao arquivo central da documentação (<file>*-docs.xml</file>) "
"usando: <code>&lt;!ENTITY version SYSTEM \"version.xml\"&gt;</code> no "
"<code>DOCTYPE</code> sobre o documento. A versão do pacote pode ser usada em "
"linha como <code>&amp;version;</code>."

#. (itstool) path: section/title
#: C/documentation.page:121
msgid "Standard Layout"
msgstr "Layout padrão"

#. (itstool) path: section/p
#: C/documentation.page:123
msgid ""
"Using a standard layout for the table of contents, sections, appendices, "
"etc. means the same <file><var>project-name</var>-docs.xml</file> template "
"can be reused with few changes between projects. It also means the "
"documentation layout is similar across all projects, making it more familiar "
"to developers."
msgstr ""
"Usar um layout padrão para a tabela de conteúdos, seções, apêndices etc. "
"significa que o mesmo modelo de <file><var>nome-do-projeto</var>-docs.xml</"
"file> pode ser reusado com algumas alterações entre projetos. Ele também "
"significa que o layout da documentação é similar por todos os projetos, "
"fazendo dele mais familiar para os desenvolvedores."

#. (itstool) path: section/p
#: C/documentation.page:131
msgid "The following layout is suggested:"
msgstr "O layout a seguir é sugerido:"

#. (itstool) path: listing/title
#: C/documentation.page:135
msgid "<file><var>project-name</var>-docs.xml</file>"
msgstr "<file><var>nome-do-projeto</var>-docs.xml</file>"

#. (itstool) path: listing/desc
#: C/documentation.page:136
msgid "A template top-level gtk-doc file for a project"
msgstr "Um arquivo de modelo de nível superior do gtk-doc para um projeto"

#. (itstool) path: section/title
#: C/documentation.page:142
msgid "Licensing"
msgstr "Licenciamento"

#. (itstool) path: section/p
#: C/documentation.page:150
msgid ""
"It is important to make the license used for API references clear, "
"especially if they contain code examples which could be copied around."
msgstr ""
"É importante tornar a licença usada para referências de API bem clara, "
"especialmente se elas contiverem exemplos de código que poderia ser copiado."

#. (itstool) path: section/p
#: C/documentation.page:155
msgid ""
"Typically, projects use the same license for their API reference as for the "
"project’s code itself, to avoid confusion. Some other projects use CC-BY-SA "
"3.0 for all their reference documentation. The choice is yours."
msgstr ""
"Geralmente, projetos usam a mesma licença para sua referência de API que "
"para o código do projeto em si, para evitar confusão. Alguns projetos usam "
"CC-BY-SA 3.0 para toda documentação de referência. A escolha é sua."

#. (itstool) path: section/p
#: C/documentation.page:161
msgid ""
"As shown in the <link xref=\"#standard-layout\">Standard Layout</link> you "
"should include a <file>license.xml</file> in the top-level gtk-doc DocBook "
"file which gives the full text of your documentation license."
msgstr ""
"Como mostrado no <link xref=\"#standard-layout\">Layout padrão</link>, você "
"deve incluir um <file>license.xml</file> no arquivo DocBook de nível "
"superior do gtk-doc, o qual fornece o texto completo para sua licença de "
"documentação."

#. (itstool) path: section/title
#: C/documentation.page:169
msgid "Public APIs"
msgstr "API pública"

#. (itstool) path: section/p
#: C/documentation.page:171
msgid ""
"All public APIs must have gtk-doc comments. For functions, these should be "
"placed in the source file, directly above the function."
msgstr ""
"Todas APIs públicas devem ter comentários de gtk-doc. Para funções, essas "
"devem ser colocadas no arquivo fonte, diretamente sobre a função."

#. (itstool) path: section/code
#: C/documentation.page:176
#, no-wrap
msgid ""
"/**\n"
" * gtk_get_flow:\n"
" * @widget: a #GtkWidget\n"
" *\n"
" * Gets the flow of a widget.\n"
" *\n"
" * Note that flows may be laminar or turbulent...\n"
" *\n"
" * Returns: (transfer none): the flow of @widget\n"
" */\n"
"GtkFlow *\n"
"gtk_get_flow (GtkWidget *widget)\n"
"{\n"
"\n"
"  ...\n"
"\n"
"}"
msgstr ""
"/**\n"
" * gtk_get_flow:\n"
" * @widget: a #GtkWidget\n"
" *\n"
" * Gets the flow of a widget.\n"
" *\n"
" * Note that flows may be laminar or turbulent...\n"
" *\n"
" * Returns: (transfer none): the flow of @widget\n"
" */\n"
"GtkFlow *\n"
"gtk_get_flow (GtkWidget *widget)\n"
"{\n"
"\n"
"  ...\n"
"\n"
"}"

#. (itstool) path: section/p
#: C/documentation.page:194
msgid ""
"Documentation comments for macros, function types, class structs, etc. "
"should be placed next to the definitions, typically in header files."
msgstr ""
"Comentários de documentação para macros, tipos de função, structs de classe, "
"etc. devem ser colocados próximo às definições, geralmente em arquivos de "
"cabeçalhos."

#. (itstool) path: section/p
#: C/documentation.page:200
msgid ""
"Section introductions should be placed in the source file they describe, "
"after the license header:"
msgstr ""
"Introduções de seção devem ser colocadas no arquivo fonte que elas "
"descrevem, após o cabeçalho de licença:"

#. (itstool) path: section/code
#: C/documentation.page:205
#, no-wrap
msgid ""
"/**\n"
" * SECTION:gtksizerequest\n"
" * @Short_Description: Height-for-width geometry management\n"
" * @Title: GtkSizeRequest\n"
" *\n"
" * The GtkSizeRequest interface is GTK+'s height-for-width (and\n"
" * width-for-height) geometry management system.\n"
" * ...\n"
" */"
msgstr ""
"/**\n"
" * SECTION:gtksizerequest\n"
" * @Short_Description: Height-for-width geometry management\n"
" * @Title: GtkSizeRequest\n"
" *\n"
" * The GtkSizeRequest interface is GTK+'s height-for-width (and\n"
" * width-for-height) geometry management system.\n"
" * ...\n"
" */"

#. (itstool) path: section/p
#: C/documentation.page:215
msgid ""
"Keep in mind that in order to include a function, macro, function type, or "
"struct type, it needs to be listed in your documentation’s <file>modulename-"
"sections.txt</file> file."
msgstr ""
"Tenha em mente que para incluir uma função, macro, tipo de função ou tipo de "
"struct, ele precisa ser listado no arquivo de <file>nomemodulo-sections.txt</"
"file> da documentação."

#. (itstool) path: section/p
#: C/documentation.page:221
msgid ""
"To properly document a new class, it needs to be given its own section in "
"<file>modulename-sections.txt</file>, needs to be included in your toplevel "
"<file>modulename-docs.sgml</file>, and the <code>get_type()</code> function "
"for your class needs to be listed in your <file>modulename.types</file>."
msgstr ""
"Para documentação adequadamente uma nova classe, ele precisa ser dado em sua "
"própria seção no <file>nomemodulo-sections.txt</file> e a função "
"<code>get_type()</code> para sua classe precisa ser listada em seu "
"<file>nomemodulo.types</file>."

#. (itstool) path: section/title
#: C/documentation.page:231
msgid "Introspection Annotations"
msgstr "Anotações de introspecção"

#. (itstool) path: section/p
#: C/documentation.page:233
msgid ""
"Each gtk-doc comment should have appropriate <link href=\"https://wiki.gnome."
"org/Projects/GObjectIntrospection/Annotations\"> GObject introspection "
"annotations</link>. These are useful for two reasons:"
msgstr ""
"Cada comentário gtk-doc deve ter as <link href=\"https://wiki.gnome.org/"
"Projects/GObjectIntrospection/Annotations\">anotações de introspeção de "
"GObject</link> adequada. Essa são úteis por dois motivos:"

#. (itstool) path: item/p
#: C/documentation.page:240
msgid ""
"They add important information about parameter types, nullability and memory "
"management to the C API documentation generated by gtk-doc."
msgstr ""
"Elas adicionam informações importantes sobre tipos de parâmetros, "
"anulabilidade e gerenciamento de memória para a documentação de API C gerada "
"pelo gtk-doc."

#. (itstool) path: item/p
#: C/documentation.page:244
msgid ""
"They allow public APIs to be automatically bound in other languages, such as "
"Python or JavaScript."
msgstr ""
"Elas permitem que APIs públicas sejam automaticamente vinculadas a outras "
"linguagens, tais como Python ou JavaScript."

#. (itstool) path: section/p
#: C/documentation.page:250
msgid ""
"Introspection annotations add information to APIs (functions, function "
"parameters, function return values, structures, GObject properties, GObject "
"signals) which is otherwise not present in the machine readable C API and "
"only exists in the form of human readable documentation or convention. They "
"are very important."
msgstr ""
"Anotações de introspecção adicionam informações às APIs (funções, parâmetros "
"de função, valor de retorno de função, estruturas, propriedades de GObject, "
"sinais de GObject) nas quais, do contrário, não está presente na API C "
"legível por máquina e existe apenas na forma de documentação legível por "
"humano ou convenção. Elas são muito importantes."

#. (itstool) path: section/p
#: C/documentation.page:258
msgid ""
"In gtk-doc comments, annotations should be preferred over human-readable "
"equivalents. For example, when documenting a function parameter which may be "
"<code>NULL</code>, use the <code>(nullable)</code> annotation rather than "
"some text:"
msgstr ""
"Em comentários de gtk-doc, anotações devem ser preferidos a equivalentes "
"legíveis por humanos, Por exemplo, ao documentar o parâmetro de uma função "
"que pode ser <code>NULL</code>, use a anotação <code>(nullable)</code> e, "
"vez de algum texto:"

#. (itstool) path: section/code
#: C/documentation.page:264
#, no-wrap
msgid ""
"/**\n"
" * my_function:\n"
" * @parameter: (nullable): some parameter which affects something\n"
" *\n"
" * Body of the function documentation.\n"
" */"
msgstr ""
"/**\n"
" * my_function:\n"
" * @parameter: (nullable): some parameter which affects something\n"
" *\n"
" * Body of the function documentation.\n"
" */"

#. (itstool) path: section/p
#: C/documentation.page:271
msgid "Instead of:"
msgstr "Em vez de:"

#. (itstool) path: section/code
#: C/documentation.page:274
#, no-wrap
msgid ""
"/**\n"
" * my_bad_function:\n"
" * @parameter: some parameter which affects something, or %NULL to ignore\n"
" *\n"
" * Bad body of the function documentation.\n"
" */"
msgstr ""
"/**\n"
" * my_bad_function:\n"
" * @parameter: some parameter which affects something, or %NULL to ignore\n"
" *\n"
" * Bad body of the function documentation.\n"
" */"

#. (itstool) path: section/p
#: C/documentation.page:281
msgid ""
"For more information on introspection, see the <link xref=\"introspection"
"\">introspection guidelines</link>."
msgstr ""
"Para mais informação sobre introspecção, veja as <link xref=\"introspection"
"\">diretrizes de introspecção</link>."

#. (itstool) path: section/title
#: C/documentation.page:288
msgid "Symbol Versioning"
msgstr "Versionamento de símbolo"

#. (itstool) path: section/p
#: C/documentation.page:290
msgid ""
"Whenever a symbol is added to the public API, it should have a documentation "
"comment added. This comment should always contain a <code>Since</code> line "
"with the package version number of the release which will first contain the "
"new API. This should be the number currently in <file>configure.ac</file> if "
"<link xref=\"versioning#release-process\">post-release version incrementing</"
"link> is being used."
msgstr ""
"Quando um símbolo é adicionado à API pública, ele deve ter um comentário de "
"documentação adicionado. Esse comentário deve sempre conter uma linha "
"<code>Since</code> com o número da versão de pacote do lançamento que "
"primeiro conterá a nova API. Isso deve ser o número que está no "
"<file>configure.in</file> se<link xref=\"versioning#release-process"
"\">incrementação de versão pós-lançamento</link> estiver sendo usado."

#. (itstool) path: section/p
#. (itstool) path: example/p
#: C/documentation.page:300 C/memory-management.page:494 C/threading.page:79
msgid "For example:"
msgstr "Por exemplo:"

#. (itstool) path: section/code
#: C/documentation.page:303
#, no-wrap
msgid ""
"/**\n"
" * my_function:\n"
" * @param: some parameter\n"
" *\n"
" * Body of the function documentation.\n"
" *\n"
" * Since: 0.5.0\n"
" */"
msgstr ""
"/**\n"
" * my_function:\n"
" * @param: some parameter\n"
" *\n"
" * Body of the function documentation.\n"
" *\n"
" * Since: 0.5.0\n"
" */"

#. (itstool) path: section/p
#: C/documentation.page:312
msgid ""
"gtk-doc uses this information to generate indexes of the APIs added in each "
"release. These should be added to the main <file>*-docs.xml</file> as an "
"appendix:"
msgstr ""
"gtk-doc usa essa informação para gerar índices das APIs adicionadas em cada "
"lançamento. Essas devem ser adicionadas ao <file>*-docs.xml</file> principal "
"como um apêndice:"

#. (itstool) path: section/code
#: C/documentation.page:317
#, no-wrap
msgid ""
"&lt;part&gt;\n"
"\t&lt;title&gt;Appendices&lt;/title&gt;\n"
"\t&lt;index id=\"api-index-full\"&gt;\n"
"\t\t&lt;title&gt;API Index&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-full.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;index id=\"api-index-deprecated\"&gt;\n"
"\t\t&lt;title&gt;Index of deprecated symbols&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-deprecated.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;index role=\"0.1.0\"&gt;\n"
"\t\t&lt;title&gt;Index of new symbols in 0.1.0&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-0.1.0.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;!-- More versions here. --&gt;\n"
"\t&lt;xi:include href=\"xml/annotation-glossary.xml\"&gt;&lt;xi:fallback /&gt;&lt;/xi:include&gt;\n"
"&lt;/part&gt;"
msgstr ""
"&lt;part&gt;\n"
"\t&lt;title&gt;Appendices&lt;/title&gt;\n"
"\t&lt;index id=\"api-index-full\"&gt;\n"
"\t\t&lt;title&gt;API Index&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-full.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;index id=\"api-index-deprecated\"&gt;\n"
"\t\t&lt;title&gt;Index of deprecated symbols&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-deprecated.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;index role=\"0.1.0\"&gt;\n"
"\t\t&lt;title&gt;Index of new symbols in 0.1.0&lt;/title&gt;\n"
"\t\t&lt;xi:include href=\"xml/api-index-0.1.0.xml\"&gt;&lt;xi:fallback/&gt;&lt;/xi:include&gt;\n"
"\t&lt;/index&gt;\n"
"\t&lt;!-- More versions here. --&gt;\n"
"\t&lt;xi:include href=\"xml/annotation-glossary.xml\"&gt;&lt;xi:fallback /&gt;&lt;/xi:include&gt;\n"
"&lt;/part&gt;"

#. (itstool) path: section/title
#: C/documentation.page:337
msgid "D-Bus APIs"
msgstr "APIs de D-Bus"

#. (itstool) path: section/p
#: C/documentation.page:339
msgid ""
"D-Bus interface descriptions contain documentation comments, and these can "
"be extracted from the XML using <cmd>gdbus-codegen</cmd>, and turned into "
"DocBook files to be included by gtk-doc."
msgstr ""
"Descrições de interface D-Bus contêm comentários de documentação, e podem "
"ser extraídas do XML usando <cmd>gdbus-codegen</cmd> e transformadas em "
"arquivos DocBook para serem incluídas pelo gtk-doc."

#. (itstool) path: section/p
#: C/documentation.page:352
msgid ""
"The DocBook files can be included in the main <file>*-docs.xml</file> file "
"using:"
msgstr ""
"Os arquivos DocBook podem ser incluídos no arquivo <file>*-docs.xml</file> "
"principal usando:"

#. (itstool) path: section/code
#: C/documentation.page:356
#, no-wrap
msgid ""
"&lt;chapter&gt;\n"
"  &lt;title&gt;C Interfaces&lt;/title&gt;\n"
"  &lt;partintro&gt;\n"
"    &lt;para&gt;C wrappers for the D-Bus interfaces.&lt;/para&gt;\n"
"  &lt;/partintro&gt;\n"
"\n"
"  &lt;xi:include href=\"xml/SomeDBusService.xml\"/&gt;\n"
"  &lt;xi:include href=\"xml/SomeOtherService.xml\"/&gt;\n"
"&lt;/chapter&gt;"
msgstr ""
"&lt;chapter&gt;\n"
"  &lt;title&gt;C Interfaces&lt;/title&gt;\n"
"  &lt;partintro&gt;\n"
"    &lt;para&gt;C wrappers for the D-Bus interfaces.&lt;/para&gt;\n"
"  &lt;/partintro&gt;\n"
"\n"
"  &lt;xi:include href=\"xml/SomeDBusService.xml\"/&gt;\n"
"  &lt;xi:include href=\"xml/SomeOtherService.xml\"/&gt;\n"
"&lt;/chapter&gt;"

#. (itstool) path: section/p
#: C/documentation.page:366
msgid ""
"The generated XML files must be included in the <code>content_files</code> "
"variable in your gtk-doc <file>Makefile.am</file>, otherwise the build will "
"fail. (This is to fix situations where the <code>builddir</code> does not "
"equal the <code>srcdir</code>.)"
msgstr ""
"Os arquivos XML gerados devem ser incluídos na variável <code>content_files</"
"code> em seu <file>Makefile.am</file> de gtk-doc, do contrário a compilação "
"vai falhar. (Isso é para corrigir situações nas quais <code>builddir</code> "
"não é igual a <code>srcdir</code>.)"

#. (itstool) path: section/title
#: C/documentation.page:375
msgid "Keeping Documentation Up to Date"
msgstr "Mantendo a documentação atualizada"

#. (itstool) path: section/p
#: C/documentation.page:377
msgid ""
"gtk-doc comes with support for checking the documentation with some basic "
"tests. These check that all version indexes are included in the main <file>*-"
"docs.xml</file> file and that all symbols are documented, amongst other "
"things."
msgstr ""
"gtk-doc vem com suporte a verificação da documentação com alguns testes "
"básicos. Essas verificações que toda versão indexa são incluídas ao arquivo "
"<file>*-docs.xml</file> principal e que todos símbolos são documentados, "
"além de outras coisas."

#. (itstool) path: section/p
#: C/documentation.page:384
msgid ""
"These tests should always be enabled, by adding the following to your gtk-"
"doc <file>Makefile.am</file>:"
msgstr ""
"Esses testes devem sempre estar habilitados, adicionando o seguinte para seu "
"<file>Makefile.am</file> de gtk-doc:"

#. (itstool) path: section/code
#: C/documentation.page:388
#, no-wrap
msgid "TESTS = $(GTKDOC_CHECK)"
msgstr "TESTS = $(GTKDOC_CHECK)"

#. (itstool) path: section/p
#: C/documentation.page:390
msgid "They will then be run as part of <cmd>make check</cmd>."
msgstr "Eles serão, então, executados como parte do <cmd>make check</cmd>."

#. (itstool) path: info/desc
#: C/file-system.page:18
msgid "Accessing the file system"
msgstr "Acessando o sistema de arquivos"

#. (itstool) path: page/title
#: C/file-system.page:21
msgid "File System Access"
msgstr "Acesso ao sistema de arquivos"

#. (itstool) path: synopsis/p
#: C/file-system.page:26
msgid ""
"There are a few anti-patterns to consider when accessing the file system. "
"This article assumes knowledge of the standard <link href=\"https://"
"developer.gnome.org/gio/stable/GFile.html\"><code>GFile</code></link>, <link "
"href=\"https://developer.gnome.org/gio/stable/GInputStream.html"
"\"><code>GInputStream</code></link> and <link href=\"https://developer.gnome."
"org/gio/stable/GOutputStream.html\"><code>GOutputStream</code></link> APIs."
msgstr ""
"Há alguns antipadrões a serem considerados ao acessar o sistema de arquivos. "
"Esse artigo presume conhecimento das APIs <link href=\"https://developer."
"gnome.org/gio/stable/GFile.html\"><code>GFile</code></link>, <link href="
"\"https://developer.gnome.org/gio/stable/GInputStream.html"
"\"><code>GInputStream</code></link> e <link href=\"https://developer.gnome."
"org/gio/stable/GOutputStream.html\"><code>GOutputStream</code></link> "
"padrões."

#. (itstool) path: item/p
#: C/file-system.page:37
msgid ""
"Use asynchronous I/O for file access. (<link xref=\"#asynchronous-io\"/>)"
msgstr ""
"Use E/S assíncrona para acesso de arquivo. (<link xref=\"#asynchronous-io\"/"
">)"

#. (itstool) path: item/p
#: C/file-system.page:41
msgid ""
"Always use appropriate functions to construct file names and paths. (<link "
"xref=\"#file-path-construction\"/>)"
msgstr ""
"Sempre use funções adequadas para construir nomes e caminhos de arquivos . "
"(<link xref=\"#file-path-construction\"/>)"

#. (itstool) path: item/p
#: C/file-system.page:45
msgid ""
"Validate file paths are in the expected directories before using them. "
"(<link xref=\"#path-validation-and-sandboxing\"/>)"
msgstr ""
"Valide caminhos de arquivos que estão em diretórios esperados antes de usá-"
"los. (<link xref=\"#path-validation-and-sandboxing\"/>)"

#. (itstool) path: item/p
#: C/file-system.page:49
msgid ""
"Use mandatory access control profiles to enforce constraints on file access. "
"(<link xref=\"#path-validation-and-sandboxing\"/>)"
msgstr ""
"Use perfis obrigatórios de controle de acesso para reforçar restrições de "
"acesso de arquivos. (<link xref=\"#path-validation-and-sandboxing\"/>)"

#. (itstool) path: section/title
#: C/file-system.page:58
msgid "Asynchronous I/O"
msgstr "E/S assíncrona"

#. (itstool) path: section/p
#: C/file-system.page:60
msgid ""
"Almost all I/O should be performed asynchronously. That is, without blocking "
"the <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html\">GLib main context</link>. This can be achieved by always using "
"the <code>*_async()</code> and <code>*_finish()</code> variants of each I/O "
"function."
msgstr ""
"Quase toda E/S deve ser feita assincronamente, ou seja, sem bloqueio do "
"<link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html\">contexto principal do GLib</link>. Isso pode ser alcançado por "
"sempre usar as variantes <code>*_async()</code> e <code>*_finish()</code> de "
"cada função de E/S."

#. (itstool) path: example/p
#: C/file-system.page:70
msgid ""
"For example, <link href=\"https://developer.gnome.org/gio/stable/"
"GInputStream.html#g-input-stream-read-async"
"\"><code>g_input_stream_read_async()</code></link> rather than <link href="
"\"https://developer.gnome.org/gio/stable/GInputStream.html#g-input-stream-"
"read\"><code>g_input_stream_read()</code></link>."
msgstr ""
"Por exemplo, <link href=\"https://developer.gnome.org/gio/stable/"
"GInputStream.html#g-input-stream-read-async"
"\"><code>g_input_stream_read_async()</code></link> em vez de <link href="
"\"https://developer.gnome.org/gio/stable/GInputStream.html#g-input-stream-"
"read\"><code>g_input_stream_read()</code></link>."

#. (itstool) path: section/p
#: C/file-system.page:78
msgid ""
"Synchronous I/O blocks the main loop, which means that other events, such as "
"user input, incoming networking packets, timeouts and idle callbacks, are "
"not handled until the blocking function returns."
msgstr ""
"E/S síncrona bloqueia o loop principal, o que significa que outros eventos, "
"tal como entrada de usuário, chegada de pacotes de rede, expiração de tempo "
"limite e retorno de chamada ocioso, não são tratados até que a função "
"bloqueadora retorne."

#. (itstool) path: section/p
#: C/file-system.page:84
msgid ""
"Synchronous I/O is acceptable in certain circumstances where the overheads "
"of scheduling an asynchronous operation exceed the costs of local "
"synchronous I/O on Linux. For example, making a small read from a local "
"file, or from a virtual file system such as <file>/proc</file>. For such "
"reads, the low level functions <code>g_open()</code>, <code>read()</code> "
"and <code>g_close()</code> should be used rather than GIO."
msgstr ""
"E/S síncrona é aceitável em certas circunstâncias nas quais a sobrecarga de "
"agendar uma operação assíncrona excede o custo de E/S síncrona local no "
"Linux. Por exemplo, fazer uma leitura pequena de um arquivo local, ou de um "
"sistema de arquivos virtual tal como <file>/proc</file>. Para tais leituras, "
"as funções de baixo nível <code>g_open()</code>, <code>read()</code> e "
"<code>g_close()</code> devem ser usadas, em vez do GIO."

#. (itstool) path: section/p
#: C/file-system.page:93
msgid ""
"Files in the user’s home directory do <em>not</em> count as local, as they "
"could be on a networked file system."
msgstr ""
"Arquivos no diretório pessoal do usuário <em>não</em> contam como locais, "
"pois eles podem estar em um sistema de arquivos de rede."

#. (itstool) path: section/p
#: C/file-system.page:98
msgid ""
"Note that the alternative – running synchronous I/O in a separate thread – "
"is highly discouraged; see the <link xref=\"threading#when-to-use-threading"
"\">threading guidelines</link> for more information."
msgstr ""
"Note que a alternativa – executar E/S síncrona em uma thread separada – é "
"altamente desencorajada; veja as <link xref=\"threading#when-to-use-threading"
"\">diretrizes de thread</link> para mais informações."

#. (itstool) path: section/title
#: C/file-system.page:107
msgid "File Path Construction"
msgstr "Construção de caminho de arquivo"

#. (itstool) path: section/p
#: C/file-system.page:109
msgid ""
"File names and paths are not normal strings: on some systems, they can use a "
"character encoding other than UTF-8, while normal strings in GLib are "
"guaranteed to always use UTF-8. For this reason, special functions should be "
"used to build and handle file names and paths. (Modern Linux systems almost "
"universally use UTF-8 for filename encoding, so this is not an issue in "
"practice, but the file path functions should still be used for compatibility "
"with systems such as Windows, which use UTF-16 filenames.)"
msgstr ""
"Nomes e caminhos de arquivos não são strings normais: em alguns sistemas, "
"eles podem usar uma codificação de caracteres diferente de UTF-8, enquanto "
"strings normais no GLib têm a garantia de sempre usar UTF-8. Por este "
"motivo, funções especiais devem ser usadas para compilar e tratar nomes e "
"caminhos de arquivos. (Sistemas Linux modernos quase que universalmente usam "
"UTF-8 para codificação de nome de arquivo, então isso não é um problema na "
"prática, mas as funções de caminho de arquivo ainda devem ser usadas para "
"compatibilidade com sistemas como o Windows, que usam nomes de arquivos "
"UTF-16.)"

#. (itstool) path: example/p
#: C/file-system.page:120
msgid ""
"For example, file paths should be built using <link href=\"https://developer."
"gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-build-"
"filename\"><code>g_build_filename()</code></link> rather than <link href="
"\"https://developer.gnome.org/glib/stable/glib-String-Utility-Functions."
"html#g-strconcat\"><code>g_strconcat()</code></link>."
msgstr ""
"Por exemplo, caminhos de arquivos devem ser construídos usando <link href="
"\"https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-"
"Functions.html#g-build-filename\"><code>g_build_filename()</code></link> em "
"vez de <link href=\"https://developer.gnome.org/glib/stable/glib-String-"
"Utility-Functions.html#g-strconcat\"><code>g_strconcat()</code></link>."

#. (itstool) path: section/p
#: C/file-system.page:128
msgid ""
"Doing so makes it clearer what the code is meant to do, and also eliminates "
"duplicate directory separators, so the returned path is canonical (though "
"not necessarily absolute)."
msgstr ""
"Fazer isso deixa mais claro qual é a intenção do código e também elimina "
"separadores duplicados de diretórios, de forma que o caminho retornado é "
"canonical (apesar de não necessariamente absoluto)."

#. (itstool) path: example/p
#: C/file-system.page:135
msgid ""
"As another example, paths should be disassembled using <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-"
"path-get-basename\"><code>g_path_get_basename()</code></link> and <link href="
"\"https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-"
"Functions.html#g-path-get-dirname\"><code>g_path_get_dirname()</code></link> "
"rather than <link href=\"https://developer.gnome.org/glib/stable/glib-String-"
"Utility-Functions.html#g-strrstr\"><code>g_strrstr()</code></link> and other "
"manual searching functions."
msgstr ""
"Como um outro exemplo, caminhos devem ser desmembrados usando <link href="
"\"https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-"
"Functions.html#g-path-get-basename\"><code>g_path_get_basename()</code></"
"link> e <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Miscellaneous-Utility-Functions.html#g-path-get-dirname"
"\"><code>g_path_get_dirname()</code></link> em vez de <link href=\"https://"
"developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strrstr"
"\"><code>g_strrstr()</code></link> e outras funções manuais de pesquisa."

#. (itstool) path: section/title
#: C/file-system.page:148
msgid "Path Validation and Sandboxing"
msgstr "Validação de caminho e <em>sandboxing</em>"

#. (itstool) path: section/p
#: C/file-system.page:150
msgid ""
"If a filename or path comes from external input, such as a web page or user "
"input, it should be validated to ensure that putting it into a file path "
"will not produce an arbitrary path. For example if a filename is constructed "
"from the constant string <file>~/</file> plus some user input, if the user "
"inputs <file>../../etc/passwd</file>, they can (potentially) gain access to "
"sensitive account information, depending on which user the program is "
"running as, and what it does with data loaded from the constructed path."
msgstr ""
"Se um nome ou caminho de arquivo vem com uma entrada externa, tal como uma "
"página web ou entrada de usuário, ele deve ser validado para garantir que "
"colocá-lo em um caminho de arquivo não produzirá um caminho arbitrário. Por "
"exemplo, se um nome de arquivo é construído a partir de uma string constante "
"<file>~/</file> junto com alguma entrada de usuário, se o usuário insere "
"<file>./../etc/passwd</file>, eles podem (potencialmente) ganhar acesso a "
"informação sensível de contas, dependendo de com qual usuário o programa "
"está sendo executado e o que ele faz com os dados carregados a partir do "
"caminho construído."

#. (itstool) path: section/p
#: C/file-system.page:161
msgid ""
"This can be avoided by validating constructed paths before using them, using "
"<link href=\"https://developer.gnome.org/gio/stable/GFile.html#g-file-"
"resolve-relative-path\"><code>g_file_resolve_relative_path()</code></link> "
"to convert any relative paths to absolute ones, and then validating that the "
"path is beneath a given root sandboxing directory appropriate for the "
"operation. For example, if code downloads a file, it could validate that all "
"paths are beneath <file>~/Downloads</file>, using <link href=\"https://"
"developer.gnome.org/gio/stable/GFile.html#g-file-has-parent"
"\"><code>g_file_has_parent()</code></link>."
msgstr ""
"Isso pode ser evitado por meio de uma validação dos caminhos construídos "
"antes de usá-los usando <link href=\"https://developer.gnome.org/gio/stable/"
"GFile.html#g-file-resolve-relative-path"
"\"><code>g_file_resolve_relative_path()</code></link> para converter "
"quaisquer caminhos relativos para absolutos e, então, validar se aqueles "
"caminhos estão dentro de um diretório raiz de <em>sandbox</em> apropriado "
"para a operação. Por exemplo, se um código baixa um arquivo, ele poderia "
"validar se aqueles caminhos estejam dentro de <file>~/Downloads</file>, "
"usando <link href=\"https://developer.gnome.org/gio/stable/GFile.html#g-file-"
"has-parent\"><code>g_file_has_parent()</code></link>."

#. (itstool) path: section/p
#: C/file-system.page:172
msgid ""
"As a second line of defence, all projects which access the file system "
"should consider providing a mandatory access control profile, using a system "
"such as <link href=\"http://apparmor.net/\">AppArmor</link> or <link href="
"\"http://selinuxproject.org/\">SELinux</link>, which limits the directories "
"and files they can read from and write to."
msgstr ""
"Como uma segunda linha de defesa, todos os projetos que acessam o sistema de "
"arquivos devem considerar fornecer um perfil obrigatório de controle de "
"acesso, usando um sistema tal como <link href=\"http://apparmor.net/"
"\">AppArmor</link> ou <link href=\"http://selinuxproject.org/\">SELinux</"
"link> que limita os diretórios e arquivos nos quais eles podem ler de ou "
"escrever em."

#. (itstool) path: info/desc
#: C/gerror.page:18
msgid "Runtime error handling and reporting"
msgstr "Tratamento e relatório de erro em tempo de execução"

#. (itstool) path: page/title
#: C/gerror.page:21
msgid "GError"
msgstr "GError"

#. (itstool) path: section/title
#: C/gerror.page:24
msgid "GError Usage"
msgstr "Uso do GError"

#. (itstool) path: section/p
#: C/gerror.page:26
msgid ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-Error-Reporting."
"html\"><code>GError</code></link> is the standard error reporting mechanism "
"for GLib-using code, and can be thought of as a C implementation of an <link "
"href=\"http://en.wikipedia.org/wiki/Exception_handling\">exception</link>."
msgstr ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-Error-Reporting."
"html\"><code>GError</code></link> é o mecanismo padrão de relatório de erro "
"para códigos usando GLib e pode ser pensado como uma implementação C de uma <"
"link href=\"http://en.wikipedia.org/wiki/Exception_handling\">exceção</link>."

#. (itstool) path: section/p
#: C/gerror.page:33
msgid ""
"Any kind of runtime failure (anything which is not a <link xref="
"\"preconditions\">programmer error</link>) must be handled by including a "
"<code>GError**</code> parameter in the function, and setting a useful and "
"relevant GError describing the failure, before returning from the function. "
"Programmer errors must not be handled using GError: use assertions, pre-"
"conditions or post-conditions instead."
msgstr ""
"Qualquer tipo de falha em tempo de execução (qualquer coisa que não seja um <"
"link xref=\"preconditions\">erro de programação</link>) deve ser tratado com "
"a inclusão de um parâmetro <code>GError**</code> na função e definição de um "
"GError útil e relevante que descreva a falha, antes de retornar a função. Os "
"erros de programação não devem ser tratados usando GError: use asserções, "
"pré-condições ou pós-condições."

#. (itstool) path: section/p
#: C/gerror.page:42
msgid ""
"GError should be used in preference to a simple return code, as it can "
"convey more information, and is also supported by all GLib tools. For "
"example, <link xref=\"introspection\">introspecting an API</link> will "
"automatically detect all GError parameters so that they can be converted to "
"exceptions in other languages."
msgstr ""
"O GError deve ser usado como preferência a um código de retorno simples, "
"pois ele pode transmitir mais informações e também tem suporte em todas as "
"ferramentas em GLib. Por exemplo, <link xref=\"introspection\">introspecção "
"de uma API</link> detectará automaticamente todos os parâmetros de GError de "
"forma que eles possam ser convertidos para exceções em outros idiomas."

#. (itstool) path: section/p
#: C/gerror.page:50
msgid ""
"Printing warnings to the console must not be done in library code: use a "
"GError, and the calling code can propagate it further upwards, decide to "
"handle it, or decide to print it to the console. Ideally, the only code "
"which prints to the console will be top-level application code, and not "
"library code."
msgstr ""
"A impressão de avisos para o console não deve ser feita no código da "
"biblioteca: use um GError e o código de chamada pode propagá-lo mais para "
"cima, decidir tratá-lo ou decidir imprimi-lo para o console. Idealmente, o "
"único código que imprime para o console será um código de aplicativo topo de "
"nível, e não um código de biblioteca."

#. (itstool) path: section/p
#: C/gerror.page:58
msgid ""
"Any function call which can take a <code>GError**</code>, <em>should</em> "
"take such a parameter, and the returned GError should be handled "
"appropriately. There are very few situations where ignoring a potential "
"error by passing <code>NULL</code> to a <code>GError**</code> parameter is "
"acceptable."
msgstr ""
"Qualquer chamada de função que possa levar um <code>GError**</code>, "
"<em>deve</em> levar tal parâmetro e o GError retornado deve ser tratado "
"apropriadamente. Há muito poucas situações nas quais ignorar um erro em "
"potencial passando <code>NULL</code> para um parâmetro <code>GError**</code> "
"é aceitável."

#. (itstool) path: section/p
#: C/gerror.page:66
msgid ""
"The GLib API documentation contains a <link href=\"https://developer.gnome."
"org/glib/stable/glib-Error-Reporting.html#glib-Error-Reporting.description"
"\">full tutorial for using GError</link>."
msgstr ""
"A documentação de API do GLib contém um <link href=\""
"https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#glib-Error-"
"Reporting.description\">tutorial completo sobre o uso de GError</link>."

#. (itstool) path: info/desc
#: C/glist.page:18
msgid "Linked lists and container types"
msgstr "Listas vinculadas e tipos contêineres"

#. (itstool) path: page/title
#: C/glist.page:21
msgid "GList"
msgstr "GList"

#. (itstool) path: section/title
#: C/glist.page:24
msgid "GList Usage"
msgstr "Uso do GList"

#. (itstool) path: section/p
#: C/glist.page:26
msgid ""
"GLib provides several container types for sets of data: <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Doubly-Linked-Lists.html\"><code>GList</"
"code></link>, <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Singly-Linked-Lists.html\"><code>GSList</code></link>, <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Pointer-Arrays.html\"><code>GPtrArray</"
"code></link> and <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Arrays.html\"><code>GArray</code></link>."
msgstr ""
"GLib fornece vários tipos contêineres para conjuntos de dados: <link href=\""
"https://developer.gnome.org/glib/stable/glib-Doubly-Linked-Lists.html\""
"><code>GList</code></link>, <link href=\""
"https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html\""
"><code>GSList</code></link>, <link href=\""
"https://developer.gnome.org/glib/stable/glib-Pointer-Arrays.html\""
"><code>GPtrArray</code></link> e <link href=\""
"https://developer.gnome.org/glib/stable/glib-Arrays.html\""
"><code>GArray</code></link>."

#. (itstool) path: section/p
#: C/glist.page:34
msgid ""
"It has been common practice in the past to use GList in all situations where "
"a sequence or set of data needs to be stored. This is inadvisable — in most "
"situations, a GPtrArray should be used instead. It has lower memory overhead "
"(a third to a half of an equivalent list), better cache locality, and the "
"same or lower algorithmic complexity for all common operations. The only "
"typical situation where a GList may be more appropriate is when dealing with "
"ordered data, which requires expensive insertions at arbitrary indexes in "
"the array."
msgstr ""
"Foi uma prática comum no passado usar GList e, todas situações nas quais uma "
"sequência ou conjunto de dados precisa ser armazenada(o). Isso não é "
"recomendável — na maioria das situações, um GPtrArray deve ser usado. Ele "
"faz menor uso de memória (um terço a metade de uma lista equivalente), "
"melhora localidade de cache e a mesma ou menor complexidade algorítmica para "
"todas as operações comuns. A única situação típica na qual um GList pode ser "
"mais apropriado é ao lidar com dados ordenados, que requer inserções "
"custosas em índices arbitrários no vetor."

#. (itstool) path: section/p
#: C/glist.page:45
msgid ""
"If linked lists are used, be careful to keep the complexity of operations on "
"them low, using standard CS complexity analysis. Any operation which uses "
"<link href=\"https://developer.gnome.org/glib/2.30/glib-Doubly-Linked-Lists."
"html#g-list-nth\"><code>g_list_nth()</code></link> or <link href=\"https://"
"developer.gnome.org/glib/2.30/glib-Doubly-Linked-Lists.html#g-list-nth-data"
"\"><code>g_list_nth_data()</code></link> is almost certainly wrong. For "
"example, iteration over a GList should be implemented using the linking "
"pointers, rather than a incrementing index:"
msgstr ""
"Se listas vinculadas forem usadas, tenha o cuidado de manter baixa a "
"complexidade das operações nelas, usando análise padrão de complexidade CS. "
"Qualquer operação que usa <link href=\"https://developer.gnome.org/glib/2.30"
"/glib-Doubly-Linked-Lists.html#g-list-nth\"><code>g_list_nth()</code></link> "
"ou <link href=\"https://developer.gnome.org/glib/2.30/glib-Doubly-Linked-"
"Lists.html#g-list-nth-data\"><code>g_list_nth_data()</code></link> está "
"quase certamente errada. Por exemplo, interação por um GList deve ser "
"implementada usando os ponteiros vinculantes, em vez de um índice "
"incremental:"

#. (itstool) path: section/code
#: C/glist.page:54
#, no-wrap
msgid ""
"GList *some_list, *l;\n"
"\n"
"for (l = some_list; l != NULL; l = l-&gt;next)\n"
"  {\n"
"    gpointer element_data = l-&gt;data;\n"
"\n"
"    /* Do something with @element_data. */\n"
"  }"
msgstr ""
"GList *some_list, *l;\n"
"\n"
"for (l = some_list; l != NULL; l = l-&gt;next)\n"
"  {\n"
"    gpointer element_data = l-&gt;data;\n"
"\n"
"    /* Faz alguma coisa com @element_data. */\n"
"  }"

#. (itstool) path: section/p
#: C/glist.page:63
msgid ""
"Using an incrementing index instead results in a quadratic decrease in "
"performance (<em>O(N^2)</em> rather than <em>O(N)</em>):"
msgstr ""
"Usar um índice incremental pode resultar em um decréscimo quadrático no "
"desempenho (<em>O(N^2)</em> em vez de <em>O(N)</em>):"

#. (itstool) path: section/code
#: C/glist.page:67
#, no-wrap
msgid ""
"GList *some_list;\n"
"guint i;\n"
"\n"
"/* This code is inefficient and should not be used in production. */\n"
"for (i = 0; i &lt; g_list_length (some_list); i++)\n"
"  {\n"
"    gpointer element_data = g_list_nth_data (some_list, i);\n"
"\n"
"    /* Do something with @element_data. */\n"
"  }"
msgstr ""
"GList *some_list;\n"
"guint i;\n"
"\n"
"/* Esse código é ineficiente e não deve ser usado em produção. */\n"
"for (i = 0; i &lt; g_list_length (some_list); i++)\n"
"  {\n"
"    gpointer element_data = g_list_nth_data (some_list, i);\n"
"\n"
"    /* Faz alguma coisa com @element_data. */\n"
"  }"

#. (itstool) path: section/p
#: C/glist.page:78
msgid ""
"The performance penalty comes from <code>g_list_length()</code> and "
"<code>g_list_nth_data()</code> which both traverse the list (<em>O(N)</em>) "
"to perform their operations."
msgstr ""
"A penalidade no desempenho vem de <code>g_list_length()</code> e de "
"<code>g_list_nth_data()</code>, os quais percorrem a lista (<em>O(N)</em>) "
"para realizar suas operações."

#. (itstool) path: section/p
#: C/glist.page:84
msgid ""
"Implementing the above with a GPtrArray has the same complexity as the first "
"(correct) GList implementation, but better cache locality and lower memory "
"consumption, so will perform better for large numbers of elements:"
msgstr ""
"Implementar o código acima com um GPtrArray tem a mesma complexidade que a "
"primeira (correta) implementação de GList, mas com melhor localidade de "
"cache e menor consumo de memória, de forma a executar melhor para grandes "
"números de elementos:"

#. (itstool) path: section/code
#: C/glist.page:89
#, no-wrap
msgid ""
"GPtrArray *some_array;\n"
"guint i;\n"
"\n"
"for (i = 0; i &lt; some_array-&gt;len; i++)\n"
"  {\n"
"    gpointer element_data = some_array-&gt;pdata[i];\n"
"\n"
"    /* Do something with @element_data. */\n"
"  }"
msgstr ""
"GPtrArray *some_array;\n"
"guint i;\n"
"\n"
"for (i = 0; i &lt; some_array-&gt;len; i++)\n"
"  {\n"
"    gpointer element_data = some_array-&gt;pdata[i];\n"
"\n"
"    /* Faz alguma coisa com @element_data. */\n"
"  }"

#. (itstool) path: credit/name
#: C/index.page:13 C/writing-good-code.page:15
msgid "Miguel de Icaza"
msgstr "Miguel de Icaza"

#. (itstool) path: credit/name
#: C/index.page:17 C/writing-good-code.page:19
msgid "Morten Welinder"
msgstr "Morten Welinder"

#. (itstool) path: credit/name
#: C/index.page:26
msgid "GNOME Foundation"
msgstr "A Fundação GNOME"

#. (itstool) path: credit/page
#: C/index.page:27
msgid "http://foundation.gnome.org/"
msgstr "http://foundation.gnome.org/"

#. (itstool) path: info/desc
#. (itstool) path: page/title
#: C/index.page:32 C/index.page:37
msgid "GNOME Programming Guidelines"
msgstr "Diretrizes de programação do GNOME"

#. (itstool) path: info/title
#: C/index.page:34
msgctxt "link:trail"
msgid "Programming Guidelines"
msgstr "Diretrizes de programação"

#. (itstool) path: page/p
#: C/index.page:39
msgid ""
"This article contains several guidelines and suggestions for programmers "
"working in and with the GNOME stack. This is intended for programmers to "
"know about the development processes, conventions and philosophies behind "
"GNOME applications and the stack of libraries supporting them. By knowing "
"“the way things are done” in the GNOME ecosystem, it is hoped that "
"programmers will find use of GNOME APIs and development of new applications "
"easier and more natural, and will produce code which is legible and "
"maintainable over a long period of time by a diverse team of programmers."
msgstr ""
"Esse artigo contém várias diretrizes e sugestões para programadores que "
"estejam trabalhando em e com recursos do GNOME. Ele é direcionado para "
"programadores saberem sobre os processos de desenvolvimento, convenções e "
"filosofias por trás dos aplicativos do GNOME e a pilha de bibliotecas por "
"trás destes. Sabendo “a forma como as coisas são feitas” no ecossistema do "
"GNOME, espera-se que programadores encontrem uso nas APIs do GNOME e um "
"desenvolvimento de novos aplicativos mais fácil e mais natural, e produzirão "
"código que seja legível e sustentável por um longo período de tempo por uma "
"equipe diversa de programadores."

#. (itstool) path: page/p
#: C/index.page:50
msgid "This guide has a two-fold purpose:"
msgstr "Esse guia tem um propósito duplo:"

#. (itstool) path: item/p
#: C/index.page:56
msgid ""
"To give you good suggestions on how to write code for GNOME or using GNOME "
"technologies. This will help you write code that is consistent with best "
"practices, and that will be accepted by the community. This will also lead "
"to code that is a pleasure to work on."
msgstr ""
"Fornecer boas sugestões sobre como escrever código para GNOME e usar "
"tecnologias do GNOME. Isso lhe ajudará a escrever código que é consistente "
"com as melhores práticas, e que serão aceitas pela comunidade. Isso também "
"levará a um código no qual seja agradável de trabalhar."

#. (itstool) path: item/p
#: C/index.page:65
msgid ""
"To transmit the knowledge we have gotten over the years on how to keep the "
"GNOME project sustainable, even when people’s contributions increase or "
"decrease."
msgstr ""
"Transmitir o conhecimento que nós obtivemos pelos anos sobre como manter o "
"projeto GNOME sustentável, mesmo quando as contribuições das pessoas "
"aumentaram ou diminuírem."

#. (itstool) path: info/title
#: C/index.page:75
msgctxt "link:trail"
msgid "General Guidelines"
msgstr "Diretrizes gerais"

#. (itstool) path: section/title
#: C/index.page:77
msgid "General Guidelines"
msgstr "Diretrizes gerais"

#. (itstool) path: info/title
#: C/index.page:83
msgctxt "link:trail"
msgid "Maintainer Guidelines"
msgstr "Diretrizes de manutenção"

#. (itstool) path: section/title
#: C/index.page:85
msgid "Maintainer Guidelines"
msgstr "Diretrizes de manutenção"

#. (itstool) path: info/title
#: C/index.page:91
msgctxt "link:trail"
msgid "Specific How-Tos"
msgstr "“Como fazer” específicos"

#. (itstool) path: section/title
#: C/index.page:93
msgid "Specific How-Tos"
msgstr "“Como fazer” específicos"

#. (itstool) path: info/title
#: C/index.page:99
msgctxt "link:trail"
msgid "References"
msgstr "Referências"

#. (itstool) path: section/title
#: C/index.page:101
msgid "References"
msgstr "Referências"

#. (itstool) path: info/desc
#: C/introspection.page:17
msgid "GObject Introspection support in library code"
msgstr "Suporte a GObject Introspection em código de biblioteca"

#. (itstool) path: page/title
#: C/introspection.page:20
msgid "Introspection"
msgstr "Introspection"

#. (itstool) path: synopsis/p
#: C/introspection.page:25
msgid ""
"<link href=\"https://wiki.gnome.org/Projects/GObjectIntrospection\"> GObject "
"introspection</link> (abbreviated ‘GIR’) is a system which extracts APIs "
"from C code and produces binary type libraries which can be used by non-C "
"language bindings, and other tools, to <link href=\"http://en.wikipedia.org/"
"wiki/Type_introspection\">introspect</link> or <link href=\"http://en."
"wikipedia.org/wiki/Language_binding\">wrap</link> the original C libraries. "
"It uses a system of annotations in documentation comments in the C code to "
"expose extra information about the APIs which is not machine readable from "
"the code itself."
msgstr ""
"<link href=\"https://wiki.gnome.org/Projects/GObjectIntrospection\"> GObject "
"introspection</link> (abreviado para ‘GIR’) é um sistema que extrai APIs de "
"código C e produz bibliotecas de tipo binário que podem ser usadas por "
"ligações de linguagem não C, e outras ferramentas, para <link href=\"http://"
"en.wikipedia.org/wiki/Type_introspection\">examinar</link> ou <link href="
"\"http://en.wikipedia.org/wiki/Language_binding\">interfacear</link> as "
"bibliotecas C originais. Ele usa um sistema de anotações em comentários de "
"documentação no código C para expor informações extras sobre as APIs que não "
"sejam legíveis por máquina a partir do próprio código."

#. (itstool) path: synopsis/p
#: C/introspection.page:37
msgid ""
"It should be enabled for all public APIs: so all libraries. It cannot be "
"enabled for programs, since they expose no APIs. However, it is still "
"recommended to <link xref=\"documentation#introspection-annotations\">add "
"introspection annotations to documentation comments</link> in program code, "
"as they clarify the documentation."
msgstr ""

#. (itstool) path: item/p
#: C/introspection.page:46
msgid ""
"Enable introspection for all libraries. (<link xref=\"#using-introspection\"/"
">)"
msgstr ""

#. (itstool) path: item/p
#: C/introspection.page:50
msgid ""
"Pay attention to warnings from <cmd>g-ir-scanner</cmd> and "
"<code>introspectable=\"0\"</code> attributes in GIR files. (<link xref="
"\"#using-introspection\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/introspection.page:55
msgid ""
"Add introspection annotations to all documentation comments. (<link xref="
"\"#using-introspection\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/introspection.page:59
msgid ""
"Design APIs to be introspectable from the start. (<link xref=\"#api-design\"/"
">)"
msgstr ""

#. (itstool) path: section/title
#: C/introspection.page:67
msgid "Using Introspection"
msgstr "Usando a introspecção"

#. (itstool) path: section/p
#: C/introspection.page:69
msgid ""
"The first step for using introspection is to add it to the build system, "
"following the instructions <link href=\"https://wiki.gnome.org/Projects/"
"GObjectIntrospection/AutotoolsIntegration#Method_1_-_Recommended_-"
"_most_portable\">here</link>, following method 1. This should be done early "
"in the life of a project, as introspectability affects <link xref=\"#api-"
"design\">API design</link>."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:77
msgid ""
"This should result in a <file>.gir</file> and <file>.typelib</file> file "
"being generated for the project. The <file>.gir</file> file is human "
"readable, and can be inspected manually to see if the API has been "
"introspected correctly (although the GIR compilation process will print "
"error messages and warnings for any missing annotations or other problems). "
"APIs with <code>introspectable=\"0\"</code> will not be exposed to language "
"bindings as they are missing annotations or are otherwise not representable "
"in the GIR file."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:88
msgid ""
"The next step is to <link xref=\"documentation#introspection-annotations"
"\">add annotations to the documentation comments for every piece of public "
"API</link>. If a particular piece of API should not be exposed in the GIR "
"file, use the <code>(skip)</code> annotation. Documentation on the available "
"annotations is <link href=\"https://wiki.gnome.org/Projects/"
"GObjectIntrospection/Annotations\">here</link>."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:98
msgid ""
"If annotating the code for a program, a good approach is to split the bulk "
"of the code out into an internal, private convenience library. An internal "
"API reference manual can be built from its documentation comments (see <link "
"xref=\"documentation\"/>). The library is then not installed, but is linked "
"in to the program which is itself installed. This approach for generating "
"internal API documentation is especially useful for large projects where the "
"internal code may be large and hard to navigate."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:108
msgid ""
"Annotations do not have to be added exhaustively: GIR has a set of default "
"annotations which it applies based on various conventions (see <link xref="
"\"#api-design\"/>). For example, a <code>const gchar*</code> parameter does "
"not need an explicit <code>(transfer none)</code> annotation, because the "
"<code>const</code> modifier implies this already. Learning the defaults for "
"annotations is a matter of practice."
msgstr ""

#. (itstool) path: section/title
#: C/introspection.page:119
msgid "API Design"
msgstr "Design de API"

#. (itstool) path: section/p
#: C/introspection.page:121
msgid ""
"In order to be introspectable without too many annotations, APIs must follow "
"certain conventions, such as the <link href=\"https://developer.gnome.org/"
"gobject/stable/gtype-conventions.html\">standard GObject naming conventions</"
"link>, and the <link href=\"https://wiki.gnome.org/Projects/"
"GObjectIntrospection/WritingBindingableAPIs\">conventions for bindable APIs</"
"link>. This is necessary because of the flexibility of C: code can be "
"written to behave in any way imaginable, but higher level languages don’t "
"allow this kind of freedom. So in order for a C API to be representable in a "
"higher level language, it has to conform to the behaviors supported by that "
"language."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:134
msgid ""
"For example, GIR expects that if a function can fail, it will have a "
"<code>GError**</code> parameter, which will always be its final parameter. "
"The GIR scanner detects this and automatically converts that parameter to an "
"exception attribute on the method in the GIR file. It cannot do this if the "
"<code>GError*</code> is returned directly, or is not the final function "
"parameter, for example."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:143
msgid ""
"Therefore, APIs must be designed to be introspectable, and the GIR file "
"should be checked as the APIs are being written. If the GIR doesn’t match "
"what you expect for a new API, the API may need extra annotations, or even "
"for its C declaration to be changed (as in the case of <link href=\"https://"
"wiki.gnome.org/Projects/GObjectIntrospection/WritingBindingableAPIs#va_list"
"\"><code>va_list</code></link>)."
msgstr ""

#. (itstool) path: section/p
#: C/introspection.page:151
msgid ""
"<cmd>g-ir-scanner</cmd> emits warnings when it encounters code it does not "
"understand. By passing <cmd>--warn-error</cmd> as well as <cmd>--warn-all</"
"cmd> in <code>INTROSPECTION_SCANNER_ARGS</code> in <file>Makefile.am</file>, "
"compilation will fail when unintrospectable APIs are encountered. This will "
"ensure all new APIs are introspectable, and is highly recommended."
msgstr ""

#. (itstool) path: info/desc
#: C/logging.page:18
msgid "Logging debug and information output from libraries and programs"
msgstr ""
"Registrando saída de depuração e de informação de bibliotecas e programas"

#. (itstool) path: page/title
#: C/logging.page:23
msgid "Logging"
msgstr "Logging"

#. (itstool) path: synopsis/p
#: C/logging.page:28
msgid ""
"Logging debug and informational output from libraries and programs is an "
"open problem, and there are various methods for converting multiple streams "
"of log output into the customary stdout and stderr streams. Below are some "
"suggestions for how to implement logging. However, the most important thing "
"is to ensure that logging is consistent, so that log data can be accessed "
"and searched with a minimum of effort, since that’s what it’s used for. "
"Using different logging mechanisms and formats in different projects is not "
"the right approach."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:40
msgid ""
"Use the GLib logging framework instead of logging directly to stderr and "
"stdout. (<link xref=\"#glib-logging-framework\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:44
msgid ""
"If systemd can be a dependency of the project, consider logging directly to "
"the journal. (<link xref=\"#journald-integration\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:48
msgid ""
"Do not implement log rotation and deletion; leave that to system services. "
"(<link xref=\"#log-rotation\"/>)"
msgstr ""

#. (itstool) path: section/title
#: C/logging.page:56
msgid "GLib Logging Framework"
msgstr "Framework de registro de Glib"

#. (itstool) path: section/p
#: C/logging.page:58
msgid ""
"GLib provides <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Message-Logging.html\">a logging framework</link> based around the <link "
"href=\"https://developer.gnome.org/glib/stable/glib-Message-Logging.html#g-"
"log\"><code>g_log()</code></link> function, with convenience wrappers <link "
"href=\"https://developer.gnome.org/glib/stable/glib-Message-Logging.html#g-"
"debug\"><code>g_debug()</code></link>, <link href=\"https://developer.gnome."
"org/glib/stable/glib-Message-Logging.html#g-message\"><code>g_message()</"
"code></link>, <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Message-Logging.html#g-warning\"><code>g_warning()</code></link> and <link "
"href=\"https://developer.gnome.org/glib/stable/glib-Message-Logging.html#g-"
"error\"><code>g_error()</code></link>. The GLib logging framework has a few "
"useful features:"
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:72
msgid ""
"Programmatic redirection of log messages using <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Message-Logging.html#g-log-set-handler"
"\"><code>g_log_set_handler()</code></link>."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:76
msgid "Multiple logging domains, which can be processed separately."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:79
msgid ""
"Multiple log levels, which can be processed separately. For example, this "
"allows debug messages to be turned on and off at runtime."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:83
msgid "Support for automatically aborting a program on ‘fatal’ messages."
msgstr ""

#. (itstool) path: section/p
#: C/logging.page:88
msgid ""
"These should be used in preference to functions like <code>printf()</code>, "
"<link href=\"https://developer.gnome.org/glib/stable/glib-Warnings-and-"
"Assertions.html#g-print\"><code>g_print()</code></link> and <link href="
"\"https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions."
"html#g-printerr\"><code>g_printerr()</code></link>, due to their enhanced "
"flexibility. The logging functions allow log processing to be done in code, "
"rather than by external shell scripting, which simplifies everything."
msgstr ""

#. (itstool) path: section/p
#: C/logging.page:99
msgid ""
"A key reason to use the logging framework is that it is used in GLib and "
"other related libraries already; by using it, all log messages are then "
"going through the same system and can be processed similarly."
msgstr ""

#. (itstool) path: section/p
#: C/logging.page:105
msgid ""
"To use the GLib logging framework, define <link href=\"https://developer."
"gnome.org/glib/stable/glib-Message-Logging.html#G-LOG-DOMAIN:CAPS"
"\"><code>G_LOG_DOMAIN</code></link> for the project so it’s unique from all "
"other projects. Call <code>g_debug(\"Message\")</code> to log a debug "
"message."
msgstr ""

#. (itstool) path: section/p
#: C/logging.page:112
msgid ""
"If the default GLib log handlers are not sufficient, for example if log "
"messages need to be in a custom format or <link xref=\"#journald-integration"
"\">journald integration</link> is needed, set up a log handler with the "
"following code:"
msgstr ""

#. (itstool) path: section/code
#: C/logging.page:118
#, no-wrap
msgid ""
"\n"
"static const gchar *\n"
"log_level_to_string (GLogLevelFlags level)\n"
"{\n"
"  switch (level)\n"
"    {\n"
"      case G_LOG_LEVEL_ERROR: return \"ERROR\";\n"
"      case G_LOG_LEVEL_CRITICAL: return \"CRITICAL\";\n"
"      case G_LOG_LEVEL_WARNING: return \"WARNING\";\n"
"      case G_LOG_LEVEL_MESSAGE: return \"MESSAGE\";\n"
"      case G_LOG_LEVEL_INFO: return \"INFO\";\n"
"      case G_LOG_LEVEL_DEBUG: return \"DEBUG\";\n"
"      default: return \"UNKNOWN\";\n"
"    }\n"
"}\n"
"\n"
"static void\n"
"log_handler_cb (const gchar    *log_domain,\n"
"                GLogLevelFlags  log_level,\n"
"                const gchar    *message,\n"
"                gpointer        user_data)\n"
"{\n"
"  const gchar *log_level_str;\n"
"\n"
"  /* Ignore debug messages if disabled. */\n"
"  if (!debug_enabled &amp;&amp; (log_level &amp; G_LOG_LEVEL_DEBUG))\n"
"    {\n"
"      return;\n"
"    }\n"
"\n"
"  log_level_str = log_level_to_string (log_level &amp; G_LOG_LEVEL_MASK);\n"
"\n"
"  /* Use g_printerr() for warnings and g_print() otherwise. */\n"
"  if (flags &lt;= G_LOG_LEVEL_WARNING)\n"
"    {\n"
"      g_printerr (\"%s: %s: %s\\n\", log_domain, log_level_str, message);\n"
"    }\n"
"  else\n"
"    {\n"
"      g_print (\"%s: %s: %s\\n\", log_domain, log_level_str, message);\n"
"    }\n"
"}\n"
"\n"
"g_log_set_handler (\"log-domain\",\n"
"                   G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,\n"
"                   log_handler_cb, NULL);"
msgstr ""

#. (itstool) path: section/title
#: C/logging.page:166
msgid "Exceptions"
msgstr "Exceções"

#. (itstool) path: item/p
#: C/logging.page:169
msgid ""
"Do not use <code>g_message()</code> in normal code to print output. Printing "
"output should be done at the top level of an application, using "
"<code>g_print()</code>, and should be quite rare; i.e. only done in command "
"line applications."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:175
msgid ""
"Do not use <code>g_warning()</code> in library code. Use <link xref=\"gerror"
"\"><code>GError</code>s</link> instead."
msgstr ""

#. (itstool) path: item/p
#: C/logging.page:179
msgid ""
"Similarly, do not set up log handlers in library code. Log messages should "
"propagate through library code and be handled in a log handler at the top "
"level of an application."
msgstr ""

#. (itstool) path: section/title
#: C/logging.page:189
msgid "journald Integration"
msgstr "Integração com journald"

#. (itstool) path: section/p
#: C/logging.page:191
msgid ""
"Compared to conventional syslog-style logs, journald supports storage of "
"structured logging data, which can make post-hoc analysis of logs much "
"easier. If it’s possible to add <code>systemd-journal</code> as a dependency "
"to a project, the project’s log handling function could be extended to use "
"<link href=\"http://0pointer.de/public/systemd-man/sd_journal_send.html"
"\"><code>sd_journal_print()</code> and <code>sd_journal_send()</code></link> "
"instead of <code>g_print()</code> and <code>g_printerr()</code>."
msgstr ""

#. (itstool) path: section/p
#: C/logging.page:202
msgid ""
"For more information, see this <link href=\"http://0pointer.de/blog/projects/"
"journal-submit.html\">article on logging to the journal</link>."
msgstr ""

#. (itstool) path: section/title
#: C/logging.page:210
msgid "Log Rotation"
msgstr "Rotação de registro"

#. (itstool) path: section/p
#: C/logging.page:212
msgid ""
"Log file rotation is one feature which is out of scope of the GLib logging "
"system. It should be handled by the normal system logging mechanisms, such "
"as <cmd>logrotate</cmd> or <cmd>systemd-journald</cmd>."
msgstr ""

#. (itstool) path: credit/years
#: C/main-contexts.page:13
msgid "2014–2015"
msgstr "2014–2015"

#. (itstool) path: info/desc
#: C/main-contexts.page:18
msgid ""
"GLib main contexts, invoking functions in other threads, and the event loop"
msgstr ""
"Contextos centrais de GLib, invocando funções em outras threads e loop de "
"eventos"

#. (itstool) path: page/title
#: C/main-contexts.page:24
msgid "GLib Main Contexts"
msgstr "Contextos centrais de GLib"

#. (itstool) path: item/p
#: C/main-contexts.page:30
msgid ""
"Use <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html#g-main-context-invoke-full\"><code>g_main_context_invoke_full()</"
"code></link> to invoke functions in other threads, assuming every thread has "
"a thread default main context which runs throughout the lifetime of that "
"thread (<link xref=\"#g-main-context-invoke-full\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:37
msgid ""
"Use <link href=\"https://developer.gnome.org/gio/stable/GTask.html"
"\"><code>GTask</code></link> to run a function in the background without "
"caring about the specific thread used (<link xref=\"#gtask\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:43
msgid ""
"Liberally use assertions to check which context executes each function, and "
"add these assertions when first writing the code (<link xref=\"#checking-"
"threading\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:48
msgid ""
"Explicitly document contexts a function is expected to be called in, a "
"callback will be invoked in, or a signal will be emitted in (<link xref="
"\"#using-gmaincontext-in-a-library\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:53
msgid ""
"Beware of <code>g_idle_add()</code> and similar functions which implicitly "
"use the global-default main context (<link xref=\"#implicit-use-of-the-"
"global-default-main-context\"/>)"
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:62
msgid "What is <code>GMainContext</code>?"
msgstr "O que é <code>GMainContext</code>?"

#. (itstool) path: section/p
#: C/main-contexts.page:64
msgid ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html#GMainContext\"><code>GMainContext</code></link> is a generalized "
"implementation of an <link href=\"http://en.wikipedia.org/wiki/Event_loop"
"\">event loop</link>, useful for implementing polled file I/O or event-based "
"widget systems (such as GTK+). It is at the core of almost every GLib "
"application. To understand <code>GMainContext</code> requires understanding "
"<link href=\"man:poll(2)\">poll()</link> and polled I/O."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:74
msgid ""
"A <code>GMainContext</code> has a set of <link href=\"https://developer."
"gnome.org/glib/stable/glib-The-Main-Event-Loop.html#GSource\"><code>GSource</"
"code></link>s which are ‘attached’ to it, each of which can be thought of as "
"an expected event with an associated callback function which will be invoked "
"when that event is received; or equivalently as a set of file descriptors "
"(FDs) to check. An event could be a timeout or data being received on a "
"socket, for example. One iteration of the event loop will:"
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:84
msgid ""
"Prepare sources, determining if any of them are ready to dispatch "
"immediately."
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:88
msgid ""
"Poll the sources, blocking the current thread until an event is received for "
"one of the sources."
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:92
msgid "Check which of the sources received an event (several could have)."
msgstr ""

#. (itstool) path: item/p
#: C/main-contexts.page:95
msgid "Dispatch callbacks from those sources."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:100
msgid ""
"This is <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-"
"Event-Loop.html#mainloop-states\">explained very well</link> in the <link "
"href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop."
"html#GSourceFuncs\">GLib documentation</link>."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:108
msgid ""
"At its core, <code>GMainContext</code> is just a <code>poll()</code> loop, "
"with the preparation, check and dispatch stages of the loop corresponding to "
"the normal preamble and postamble in a typical <code>poll()</code> loop "
"implementation, such as listing 1 from <link href=\"http://www.linux-mag.com/"
"id/357/\">this article</link>. Typically, some complexity is needed in non-"
"trivial <code>poll()</code>-using applications to track the lists of FDs "
"which are being polled. Additionally, <code>GMainContext</code> adds a lot "
"of useful functionality which vanilla <code>poll()</code> doesn’t support. "
"Most importantly, it adds thread safety."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:121
msgid ""
"<code>GMainContext</code> is completely thread safe, meaning that a "
"<code>GSource</code> can be created in one thread and attached to a "
"<code>GMainContext</code> running in another thread. (See also: <link xref="
"\"threading\"/>.) A typical use for this might be to allow worker threads to "
"control which sockets are being listened to by a <code>GMainContext</code> "
"in a central I/O thread. Each <code>GMainContext</code> is ‘acquired’ by a "
"thread for each iteration it’s put through. Other threads cannot iterate a "
"<code>GMainContext</code> without acquiring it, which guarantees that a "
"<code>GSource</code> and its FDs will only be polled by one thread at once "
"(since each <code>GSource</code> is attached to at most one "
"<code>GMainContext</code>). A <code>GMainContext</code> can be swapped "
"between threads across iterations, but this is expensive."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:137
msgid ""
"<code>GMainContext</code> is used instead of <code>poll()</code> mostly for "
"convenience, as it transparently handles dynamically managing the array of "
"FDs to pass to <code>poll()</code>, especially when operating over multiple "
"threads. This is done by encapsulating FDs in <code>GSource</code>s, which "
"decide whether those FDs should be passed to the <code>poll()</code> call on "
"each ‘prepare’ stage of the main context iteration."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:149
msgid "What is <code>GMainLoop</code>?"
msgstr "O que é <code>GMainLoop</code>?"

#. (itstool) path: section/p
#: C/main-contexts.page:151
msgid ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html#GMainLoop\"><code>GMainLoop</code></link> is essentially the "
"following few lines of code, once reference counting and locking have been "
"removed (from <link href=\"https://developer.gnome.org/glib/stable/glib-The-"
"Main-Event-Loop.html#g-main-loop-run\"><code>g_main_loop_run()</code></"
"link>):"
msgstr ""

#. (itstool) path: section/code
#: C/main-contexts.page:157
#, no-wrap
msgid ""
"loop-&gt;is_running = TRUE;\n"
"while (loop-&gt;is_running)\n"
"  {\n"
"    g_main_context_iteration (context, TRUE);\n"
"  }"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:163
msgid ""
"Plus a fourth line in <link href=\"https://developer.gnome.org/glib/stable/"
"glib-The-Main-Event-Loop.html#g-main-loop-quit\"><code>g_main_loop_quit()</"
"code></link> which sets <code>loop-&gt;is_running = FALSE</code> and which "
"will cause the loop to terminate once the current main context iteration "
"ends."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:170
msgid ""
"Hence, <code>GMainLoop</code> is a convenient, thread-safe way of running a "
"<code>GMainContext</code> to process events until a desired exit condition "
"is met, at which point <code>g_main_loop_quit()</code> should be called. "
"Typically, in a UI program, this will be the user clicking ‘exit’. In a "
"socket handling program, this might be the final socket closing."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:178
msgid ""
"It is important not to confuse main contexts with main loops. Main contexts "
"do the bulk of the work: preparing source lists, waiting for events, and "
"dispatching callbacks. A main loop simply iterates a context."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:186
msgid "Default Contexts"
msgstr "Contextos padrões"

#. (itstool) path: section/p
#: C/main-contexts.page:188
msgid ""
"One of the important features of <code>GMainContext</code> is its support "
"for ‘default’ contexts. There are two levels of default context: the thread-"
"default, and the global-default. The global-default (accessed using "
"<code>g_main_context_default()</code>) is run by GTK+ when <code>gtk_main()</"
"code> is called. It’s also used for timeouts (<code>g_timeout_add()</code>) "
"and idle callbacks (<code>g_idle_add()</code>) — these won’t be dispatched "
"unless the default context is running! (See: <link xref=\"#implicit-use-of-"
"the-global-default-main-context\"/>.)"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:200
msgid ""
"Thread-default contexts are a later addition to GLib (since version 2.22), "
"and are generally used for I/O operations which need to run and dispatch "
"callbacks in a thread. By calling "
"<code>g_main_context_push_thread_default()</code> before starting an I/O "
"operation, the thread-default context is set and the I/O operation can add "
"its sources to that context. The context can then be run in a new main loop "
"in an I/O thread, causing the callbacks to be dispatched on that thread’s "
"stack rather than on the stack of the thread running the global-default main "
"context. This allows I/O operations to be run entirely in a separate thread "
"without explicitly passing a specific <code>GMainContext</code> pointer "
"around everywhere."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:214
msgid ""
"Conversely, by starting a long-running operation with a specific thread-"
"default context set, the calling code can guarantee that the operation’s "
"callbacks will be emitted in that context, even if the operation itself runs "
"in a worker thread. This is the principle behind <link href=\"https://"
"developer.gnome.org/gio/stable/GTask.html\"><code>GTask</code></link>: when "
"a new <code>GTask</code> is created, it stores a reference to the current "
"thread-default context, and dispatches its completion callback in that "
"context, even if the task itself is run using <link href=\"https://developer."
"gnome.org/gio/stable/GTask.html#g-task-run-in-thread"
"\"><code>g_task_run_in_thread()</code></link>."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:227
msgid ""
"For example, the code below will run a <code>GTask</code> which performs two "
"writes in parallel from a thread. The callbacks for the writes will be "
"dispatched in the worker thread, whereas the callback from the task as a "
"whole will be dispatched in the <code>interesting_context</code>."
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:234
#, no-wrap
msgid ""
"\n"
"typedef struct {\n"
"  GMainLoop *main_loop;\n"
"  guint n_remaining;\n"
"} WriteData;\n"
"\n"
"/* This is always called in the same thread as thread_cb() because\n"
" * it’s always dispatched in the @worker_context. */\n"
"static void\n"
"write_cb (GObject      *source_object,\n"
"          GAsyncResult *result,\n"
"          gpointer      user_data)\n"
"{\n"
"  WriteData *data = user_data;\n"
"  GOutputStream *stream = G_OUTPUT_STREAM (source_object);\n"
"  GError *error = NULL;\n"
"  gssize len;\n"
"\n"
"  /* Finish the write. */\n"
"  len = g_output_stream_write_finish (stream, result, &amp;error);\n"
"  if (error != NULL)\n"
"    {\n"
"      g_error (\"Error: %s\", error-&gt;message);\n"
"      g_error_free (error);\n"
"    }\n"
"\n"
"  /* Check whether all parallel operations have finished. */\n"
"  write_data-&gt;n_remaining--;\n"
"\n"
"  if (write_data-&gt;n_remaining == 0)\n"
"    {\n"
"      g_main_loop_quit (write_data-&gt;main_loop);\n"
"    }\n"
"}\n"
"\n"
"/* This is called in a new thread. */\n"
"static void\n"
"thread_cb (GTask        *task,\n"
"           gpointer      source_object,\n"
"           gpointer      task_data,\n"
"           GCancellable *cancellable)\n"
"{\n"
"  /* These streams come from somewhere else in the program: */\n"
"  GOutputStream *output_stream1, *output_stream;\n"
"  GMainContext *worker_context;\n"
"  GBytes *data;\n"
"  const guint8 *buf;\n"
"  gsize len;\n"
"\n"
"  /* Set up a worker context for the writes’ callbacks. */\n"
"  worker_context = g_main_context_new ();\n"
"  g_main_context_push_thread_default (worker_context);\n"
"\n"
"  /* Set up the writes. */\n"
"  write_data.n_remaining = 2;\n"
"  write_data.main_loop = g_main_loop_new (worker_context, FALSE);\n"
"\n"
"  data = g_task_get_task_data (task);\n"
"  buf = g_bytes_get_data (data, &amp;len);\n"
"\n"
"  g_output_stream_write_async (output_stream1, buf, len,\n"
"                               G_PRIORITY_DEFAULT, NULL, write_cb,\n"
"                               &amp;write_data);\n"
"  g_output_stream_write_async (output_stream2, buf, len,\n"
"                               G_PRIORITY_DEFAULT, NULL, write_cb,\n"
"                               &amp;write_data);\n"
"\n"
"  /* Run the main loop until both writes have finished. */\n"
"  g_main_loop_run (write_data.main_loop);\n"
"  g_task_return_boolean (task, TRUE);  /* ignore errors */\n"
"\n"
"  g_main_loop_unref (write_data.main_loop);\n"
"\n"
"  g_main_context_pop_thread_default (worker_context);\n"
"  g_main_context_unref (worker_context);\n"
"}\n"
"\n"
"/* This can be called from any thread. Its @callback will always be\n"
" * dispatched in the thread which currently owns\n"
" * @interesting_context. */\n"
"void\n"
"parallel_writes_async (GBytes              *data,\n"
"                       GMainContext        *interesting_context,\n"
"                       GCancellable        *cancellable,\n"
"                       GAsyncReadyCallback  callback,\n"
"                       gpointer             user_data)\n"
"{\n"
"  GTask *task;\n"
"\n"
"  g_main_context_push_thread_default (interesting_context);\n"
"\n"
"  task = g_task_new (NULL, cancellable, callback, user_data);\n"
"  g_task_set_task_data (task, data,\n"
"                        (GDestroyNotify) g_bytes_unref);\n"
"  g_task_run_in_thread (task, thread_cb);\n"
"  g_object_unref (task);\n"
"\n"
"  g_main_context_pop_thread_default (interesting_context);\n"
"}"
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:336
msgid "Implicit Use of the Global-Default Main Context"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:338
msgid ""
"Several functions implicitly add sources to the global-default main context. "
"They should <em>not</em> be used in threaded code. Instead, use "
"<code>g_source_attach()</code> with the <code>GSource</code> created by the "
"replacement function from the table below."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:345
msgid ""
"Implicit use of the global-default main context means the callback functions "
"are invoked in the main thread, typically resulting in work being brought "
"back from a worker thread into the main thread."
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:356
msgid "Do not use"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:357
msgid "Use instead"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:362
msgid "<code>g_timeout_add()</code>"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:363
msgid "<code>g_timeout_source_new()</code>"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:366
msgid "<code>g_idle_add()</code>"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:367
msgid "<code>g_idle_source_new()</code>"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:370
msgid "<code>g_child_watch_add()</code>"
msgstr ""

#. (itstool) path: td/p
#: C/main-contexts.page:371
msgid "<code>g_child_watch_source_new()</code>"
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:377
msgid ""
"So to delay some computation in a worker thread, use the following code:"
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:381
#, no-wrap
msgid ""
"\n"
"static guint\n"
"schedule_computation (guint delay_seconds)\n"
"{\n"
"  GSource *source = NULL;\n"
"  GMainContext *context;\n"
"  guint id;\n"
"\n"
"  /* Get the calling context. */\n"
"  context = g_main_context_get_thread_default ();\n"
"\n"
"  source = g_timeout_source_new_seconds (delay_seconds);\n"
"  g_source_set_callback (source, do_computation, NULL, NULL);\n"
"  id = g_source_attach (source, context);\n"
"  g_source_unref (source);\n"
"\n"
"  /* The ID can be used with the same @context to\n"
"   * cancel the scheduled computation if needed. */\n"
"  return id;\n"
"}\n"
"\n"
"static void\n"
"do_computation (gpointer user_data)\n"
"{\n"
"  /* … */\n"
"}"
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:412
msgid "Using <code>GMainContext</code> in a Library"
msgstr "Usando <code>GMainContext</code> em uma biblioteca"

#. (itstool) path: section/p
#: C/main-contexts.page:414
msgid ""
"At a high level, library code must not make changes to main contexts which "
"could affect the execution of an application using the library, for example "
"by changing when the application’s <code>GSource</code>s are dispatched. "
"There are various best practices which can be followed to aid this."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:422
msgid ""
"Never iterate a context created outside the library, including the global-"
"default or thread-default contexts. Otherwise, <code>GSource</code>s created "
"in the application may be dispatched when the application is not expecting "
"it, causing <link href=\"http://en.wikipedia.org/wiki/Reentrancy_%28computing"
"%29\">re-entrancy problems</link> for the application code."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:431
msgid ""
"Always remove <code>GSource</code>s from a main context before dropping the "
"library’s last reference to the context, especially if it may have been "
"exposed to the application (for example, as a thread-default). Otherwise the "
"application may keep a reference to the main context and continue iterating "
"it after the library has returned, potentially causing unexpected source "
"dispatches in the library. This is equivalent to not assuming that dropping "
"the library’s last reference to a main context will finalize that context."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:442
msgid ""
"If the library is designed to be used from multiple threads, or in a context-"
"aware fashion, always document which context each callback will be "
"dispatched in. For example, “callbacks will always be dispatched in the "
"context which is the thread-default at the time of the object’s "
"construction”. Developers using the library’s API need to know this "
"information."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:451
msgid ""
"Use <code>g_main_context_invoke()</code> to ensure callbacks are dispatched "
"in the right context. It’s much easier than manually using "
"<code>g_idle_source_new()</code> to transfer work between contexts. (See: "
"<link xref=\"#ensuring-functions-are-called-in-the-right-context\"/>.)"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:458
msgid ""
"Libraries should never use <code>g_main_context_default()</code> (or, "
"equivalently, pass <code>NULL</code> to a <code>GMainContext</code>-typed "
"parameter). Always store and explicitly use a specific <code>GMainContext</"
"code>, even if it often points to some default context. This makes the code "
"easier to split out into threads in future, if needed, without causing hard-"
"to-debug problems caused by callbacks being invoked in the wrong context."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:468
msgid ""
"Always write things asynchronously internally (using <link xref=\"#gtask"
"\"><code>GTask</code></link> where appropriate), and keep synchronous "
"wrappers at the very top level of an API, where they can be implemented by "
"calling <code>g_main_context_iteration()</code> on a specific "
"<code>GMainContext</code>. Again, this makes future refactoring easier. This "
"is demonstrated in the above example: the thread uses "
"<code>g_output_stream_write_async()</code> rather than "
"<code>g_output_stream_write()</code>."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:479
msgid ""
"Always match pushes and pops of the thread-default main context: "
"<code>g_main_context_push_thread_default()</code> and "
"<code>g_main_context_pop_thread_default()</code>."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:487
msgid "Ensuring Functions are Called in the Right Context"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:489
msgid ""
"The ‘right context’ is the thread-default main context of the <em>thread the "
"function should be executing in</em>. This assumes the typical case that "
"every thread has a <em>single</em> main context running in a main loop. A "
"main context effectively provides a work or <link href=\"http://en.wikipedia."
"org/wiki/Message_queue\">message queue</link> for the thread — something "
"which the thread can periodically check to determine if there is work "
"pending from another thread. Putting a message on this queue – invoking a "
"function in another main context – will result in it eventually being "
"dispatched in that thread."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:503
msgid ""
"For example, if an application does a long and CPU-intensive computation it "
"should schedule this in a background thread so that UI updates in the main "
"thread are not blocked. The results of the computation, however, might need "
"to be displayed in the UI, so some UI update function must be called in the "
"main thread once the computation’s complete."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:511
msgid ""
"Furthermore, if the computation function can be limited to a single thread, "
"it becomes easy to eliminate the need for locking a lot of the data it "
"accesses. This assumes that other threads are implemented similarly and "
"hence most data is only accessed by a single thread, with threads "
"communicating by <link href=\"http://en.wikipedia.org/wiki/Message_passing"
"\">message passing</link>. This allows each thread to update its data at its "
"leisure, which significantly simplifies locking."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:523
msgid ""
"For some functions, there might be no reason to care which context they’re "
"executed in, perhaps because they’re asynchronous and hence do not block the "
"context. However, it is still advisable to be explicit about which context "
"is used, since those functions may emit signals or invoke callbacks, and for "
"reasons of thread safety it’s necessary to know which threads those signal "
"handlers or callbacks are going to be invoked in."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:533
msgid ""
"For example, the progress callback in <link href=\"https://developer.gnome."
"org/gio/stable/GFile.html#g-file-copy-async\"><code>g_file_copy_async()</"
"code></link> is documented as being called in the thread-default main "
"context at the time of the initial call."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:542
msgid "Principles of Invocation"
msgstr "Princípios da invocação"

#. (itstool) path: section/p
#: C/main-contexts.page:544
msgid ""
"The core principle of invoking a function in a specific context is simple, "
"and is walked through below to explain the concepts. In practice the <link "
"xref=\"#g-main-context-invoke-full\">convenience method, "
"<code>g_main_context_invoke_full()</code></link> should be used instead."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:551
msgid ""
"A <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-"
"Loop.html#GSource\"><code>GSource</code></link> has to be added to the "
"target <code>GMainContext</code>, which will invoke the function when it’s "
"dispatched. This <code>GSource</code> should almost always be an idle source "
"created with <link href=\"https://developer.gnome.org/glib/stable/glib-The-"
"Main-Event-Loop.html#g-idle-source-new\"><code>g_idle_source_new()</code></"
"link>, but this doesn’t have to be the case. It could be a timeout source so "
"that the function is executed after a delay, for example."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:562
msgid ""
"The <code>GSource</code> will be <link xref=\"#what-is-gmaincontext"
"\">dispatched as soon as it’s ready</link>, calling the function on the "
"thread’s stack. In the case of an idle source, this will be as soon as all "
"sources at a higher priority have been dispatched — this can be tweaked "
"using the idle source’s priority parameter with <link href=\"https://"
"developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-source-set-"
"priority\"><code>g_source_set_priority()</code></link>. The source will "
"typically then be destroyed so the function is only executed once (though "
"again, this doesn’t have to be the case)."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:574
msgid ""
"Data can be passed between threads as the <code>user_data</code> passed to "
"the <code>GSource</code>’s callback. This is set on the source using <link "
"href=\"https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop."
"html#g-source-set-callback\"><code>g_source_set_callback()</code></link>, "
"along with the callback function to invoke. Only a single pointer is "
"provided, so if multiple data fields need passing, they must be wrapped in "
"an allocated structure."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:584
msgid ""
"The example below demonstrates the underlying principles, but there are "
"convenience methods explained below which simplify things."
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:589
#, no-wrap
msgid ""
"\n"
"/* Main function for the background thread, thread1. */\n"
"static gpointer\n"
"thread1_main (gpointer user_data)\n"
"{\n"
"  GMainContext *thread1_main_context = user_data;\n"
"  GMainLoop *main_loop;\n"
"\n"
"  /* Set up the thread’s context and run it forever. */\n"
"  g_main_context_push_thread_default (thread1_main_context);\n"
"\n"
"  main_loop = g_main_loop_new (thread1_main_context, FALSE);\n"
"  g_main_loop_run (main_loop);\n"
"  g_main_loop_unref (main_loop);\n"
"\n"
"  g_main_context_pop_thread_default (thread1_main_context);\n"
"  g_main_context_unref (thread1_main_context);\n"
"\n"
"  return NULL;\n"
"}\n"
"\n"
"/* A data closure structure to carry multiple variables between\n"
" * threads. */\n"
"typedef struct {\n"
"  gchar   *some_string;  /* owned */\n"
"  guint    some_int;\n"
"  GObject *some_object;  /* owned */\n"
"} MyFuncData;\n"
"\n"
"static void\n"
"my_func_data_free (MyFuncData *data)\n"
"{\n"
"  g_free (data-&gt;some_string);\n"
"  g_clear_object (&amp;data-&gt;some_object);\n"
"  g_free (data);\n"
"}\n"
"\n"
"static void\n"
"my_func (const gchar *some_string,\n"
"         guint        some_int,\n"
"         GObject     *some_object)\n"
"{\n"
"  /* Do something long and CPU intensive! */\n"
"}\n"
"\n"
"/* Convert an idle callback into a call to my_func(). */\n"
"static gboolean\n"
"my_func_idle (gpointer user_data)\n"
"{\n"
"  MyFuncData *data = user_data;\n"
"\n"
"  my_func (data-&gt;some_string, data-&gt;some_int, data-&gt;some_object);\n"
"\n"
"  return G_SOURCE_REMOVE;\n"
"}\n"
"\n"
"/* Function to be called in the main thread to schedule a call to\n"
" * my_func() in thread1, passing the given parameters along. */\n"
"static void\n"
"invoke_my_func (GMainContext *thread1_main_context,\n"
"                const gchar  *some_string,\n"
"                guint         some_int,\n"
"                GObject      *some_object)\n"
"{\n"
"  GSource *idle_source;\n"
"  MyFuncData *data;\n"
"\n"
"  /* Create a data closure to pass all the desired variables\n"
"   * between threads. */\n"
"  data = g_new0 (MyFuncData, 1);\n"
"  data-&gt;some_string = g_strdup (some_string);\n"
"  data-&gt;some_int = some_int;\n"
"  data-&gt;some_object = g_object_ref (some_object);\n"
"\n"
"  /* Create a new idle source, set my_func() as the callback with\n"
"   * some data to be passed between threads, bump up the priority\n"
"   * and schedule it by attaching it to thread1’s context. */\n"
"  idle_source = g_idle_source_new ();\n"
"  g_source_set_callback (idle_source, my_func_idle, data,\n"
"                         (GDestroyNotify) my_func_data_free);\n"
"  g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);\n"
"  g_source_attach (idle_source, thread1_main_context);\n"
"  g_source_unref (idle_source);\n"
"}\n"
"\n"
"/* Main function for the main thread. */\n"
"static void\n"
"main (void)\n"
"{\n"
"  GThread *thread1;\n"
"  GMainContext *thread1_main_context;\n"
"\n"
"  /* Spawn a background thread and pass it a reference to its\n"
"   * GMainContext. Retain a reference for use in this thread\n"
"   * too. */\n"
"  thread1_main_context = g_main_context_new ();\n"
"  g_thread_new (\"thread1\", thread1_main,\n"
"                g_main_context_ref (thread1_main_context));\n"
"\n"
"  /* Maybe set up your UI here, for example. */\n"
"\n"
"  /* Invoke my_func() in the other thread. */\n"
"  invoke_my_func (thread1_main_context,\n"
"                  \"some data which needs passing between threads\",\n"
"                  123456, some_object);\n"
"\n"
"  /* Continue doing other work. */\n"
"}"
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:698
msgid ""
"This invocation is <em style=\"strong\">uni-directional</em>: it calls "
"<code>my_func()</code> in <code>thread1</code>, but there’s no way to return "
"a value to the main thread. To do that, the same principle needs to be used "
"again, invoking a callback function in the main thread. It’s a "
"straightforward extension which isn’t covered here."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:706
msgid ""
"To maintain thread safety, data which is potentially accessed by multiple "
"threads must make those accesses mutually exclusive using a <link href="
"\"http://en.wikipedia.org/wiki/Mutual_exclusion\">mutex</link>. Data "
"potentially accessed by multiple threads: <code>thread1_main_context</code>, "
"passed in the fork call to <code>thread1_main</code>; and <code>some_object</"
"code>, a reference to which is passed in the data closure. Critically, GLib "
"guarantees that <code>GMainContext</code> is thread safe, so sharing "
"<code>thread1_main_context</code> between threads is safe. The example "
"assumes that other code accessing <code>some_object</code> is thread safe."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:720
msgid ""
"Note that <code>some_string</code> and <code>some_int</code> cannot be "
"accessed from both threads, because <em>copies</em> of them are passed to "
"<code>thread1</code>, rather than the originals. This is a standard "
"technique for making cross-thread calls thread safe without requiring "
"locking. It also avoids the problem of synchronizing freeing "
"<code>some_string</code>."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:729
msgid ""
"Similarly, a reference to <code>some_object</code> is transferred to "
"<code>thread1</code>, which works around the issue of synchronizing "
"destruction of the object (see <link xref=\"memory-management\"/>)."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:735
msgid ""
"<code>g_idle_source_new()</code> is used rather than the simpler "
"<code>g_idle_add()</code> so the <code>GMainContext</code> to attach to can "
"be specified."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:744
msgid "Convenience Method: <code>g_main_context_invoke_full()</code>"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:748
msgid ""
"This is simplified greatly by the convenience method, <link href=\"https://"
"developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-main-context-"
"invoke-full\"><code>g_main_context_invoke_full()</code></link>. It invokes a "
"callback so that the specified <code>GMainContext</code> is owned during the "
"invocation. Owning a main context is almost always equivalent to running it, "
"and hence the function is invoked in the thread for which the specified "
"context is the thread-default."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:757
msgid ""
"<code>g_main_context_invoke()</code> can be used instead if the user data "
"does not need to be freed by a <code>GDestroyNotify</code> callback after "
"the invocation returns."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:764
msgid ""
"Modifying the earlier example, the <code>invoke_my_func()</code> function "
"can be replaced by the following:"
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:769
#, no-wrap
msgid ""
"\n"
"static void\n"
"invoke_my_func (GMainContext *thread1_main_context,\n"
"                const gchar  *some_string,\n"
"                guint         some_int,\n"
"                GObject      *some_object)\n"
"{\n"
"  MyFuncData *data;\n"
"\n"
"  /* Create a data closure to pass all the desired variables\n"
"   * between threads. */\n"
"  data = g_new0 (MyFuncData, 1);\n"
"  data-&gt;some_string = g_strdup (some_string);\n"
"  data-&gt;some_int = some_int;\n"
"  data-&gt;some_object = g_object_ref (some_object);\n"
"\n"
"  /* Invoke the function. */\n"
"  g_main_context_invoke_full (thread1_main_context,\n"
"                              G_PRIORITY_DEFAULT, my_func_idle,\n"
"                              data,\n"
"                              (GDestroyNotify) my_func_data_free);\n"
"}"
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:792
msgid ""
"Consider what happens if <code>invoke_my_func()</code> were called from "
"<code>thread1</code>, rather than from the main thread. With the original "
"implementation, the idle source would be added to <code>thread1</code>’s "
"context and dispatched on the context’s next iteration (assuming no pending "
"dispatches with higher priorities). With the improved implementation, "
"<code>g_main_context_invoke_full()</code> will notice that the specified "
"context is already owned by the thread (or ownership can be acquired by it), "
"and will call <code>my_func_idle()</code> directly, rather than attaching a "
"source to the context and delaying the invocation to the next context "
"iteration."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:806
msgid ""
"This subtle behavior difference doesn’t matter in most cases, but is worth "
"bearing in mind since it can affect blocking behavior "
"(<code>invoke_my_func()</code> would go from taking negligible time, to "
"taking the same amount of time as <code>my_func()</code> before returning)."
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:818
msgid "Checking Threading"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:820
msgid ""
"It is useful to document which thread each function should be called in, in "
"the form of an assertion:"
msgstr ""

#. (itstool) path: section/code
#: C/main-contexts.page:824
#, no-wrap
msgid ""
"\n"
"g_assert (g_main_context_is_owner (expected_main_context));"
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:827
msgid ""
"If that’s put at the top of each function, any assertion failure will "
"highlight a case where a function has been called from the wrong thread. It "
"is much easier to write these assertions when initially developing code, "
"rather than debuging race conditions which can easily result from a function "
"being called in the wrong thread."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:835
msgid ""
"This technique can also be applied to signal emissions and callbacks, "
"improving type safety as well as asserting the right context is used. Note "
"that signal emission via <link href=\"https://developer.gnome.org/gobject/"
"stable/gobject-Signals.html#g-signal-emit\"><code>g_signal_emit()</code></"
"link> is synchronous, and doesn’t involve a main context at all."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:844
msgid "For example, instead of using the following when emitting a signal:"
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:847
#, no-wrap
msgid ""
"\n"
"guint param1;  /* arbitrary example parameters */\n"
"gchar *param2;\n"
"guint retval = 0;\n"
"\n"
"g_signal_emit_by_name (my_object, \"some-signal\",\n"
"                       param1, param2, &amp;retval);"
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:855
msgid "The following can be used:"
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:858
#, no-wrap
msgid ""
"\n"
"static guint\n"
"emit_some_signal (GObject     *my_object,\n"
"                  guint        param1,\n"
"                  const gchar *param2)\n"
"{\n"
"  guint retval = 0;\n"
"\n"
"  g_assert (g_main_context_is_owner (expected_main_context));\n"
"\n"
"  g_signal_emit_by_name (my_object, \"some-signal\",\n"
"                         param1, param2, &amp;retval);\n"
"\n"
"  return retval;\n"
"}"
msgstr ""

#. (itstool) path: section/title
#: C/main-contexts.page:877
msgid "<code>GTask</code>"
msgstr "<code>GTask</code>"

#. (itstool) path: section/p
#: C/main-contexts.page:879
msgid ""
"<link href=\"https://developer.gnome.org/gio/stable/GTask.html"
"\"><code>GTask</code></link> provides a slightly different approach to "
"invoking functions in other threads, which is more suited to the case where "
"a function should be executed in <em>some</em> background thread, but not a "
"specific one."
msgstr ""

#. (itstool) path: section/p
#: C/main-contexts.page:886
msgid ""
"<code>GTask</code> takes a data closure and a function to execute, and "
"provides ways to return the result from this function. It handles everything "
"necessary to run that function in an arbitrary thread belonging to some "
"thread pool internal to GLib."
msgstr ""

#. (itstool) path: example/p
#: C/main-contexts.page:894
msgid ""
"By combining <link xref=\"#g-main-context-invoke-full"
"\"><code>g_main_context_invoke_full()</code></link> and <code>GTask</code>, "
"it is possible to run a task in a specific context and effortlessly return "
"its result to the current context:"
msgstr ""

#. (itstool) path: example/code
#: C/main-contexts.page:900
#, no-wrap
msgid ""
"\n"
"/* This will be invoked in thread1. */\n"
"static gboolean\n"
"my_func_idle (gpointer user_data)\n"
"{\n"
"  GTask *task = G_TASK (user_data);\n"
"  MyFuncData *data;\n"
"  gboolean retval;\n"
"\n"
"  /* Call my_func() and propagate its returned boolean to\n"
"   * the main thread. */\n"
"  data = g_task_get_task_data (task);\n"
"  retval = my_func (data-&gt;some_string, data-&gt;some_int,\n"
"                    data-&gt;some_object);\n"
"  g_task_return_boolean (task, retval);\n"
"\n"
"  return G_SOURCE_REMOVE;\n"
"}\n"
"\n"
"/* Whichever thread this is invoked in, the @callback will be\n"
" * invoked in, once my_func() has finished and returned a result. */\n"
"static void\n"
"invoke_my_func_with_result (GMainContext        *thread1_main_context,\n"
"                            const gchar         *some_string,\n"
"                            guint                some_int,\n"
"                            GObject             *some_object,\n"
"                            GAsyncReadyCallback  callback,\n"
"                            gpointer             user_data)\n"
"{\n"
"  MyFuncData *data;\n"
"\n"
"  /* Create a data closure to pass all the desired variables\n"
"   * between threads. */\n"
"  data = g_new0 (MyFuncData, 1);\n"
"  data-&gt;some_string = g_strdup (some_string);\n"
"  data-&gt;some_int = some_int;\n"
"  data-&gt;some_object = g_object_ref (some_object);\n"
"\n"
"  /* Create a GTask to handle returning the result to the current\n"
"   * thread-default main context. */\n"
"  task = g_task_new (NULL, NULL, callback, user_data);\n"
"  g_task_set_task_data (task, data,\n"
"                        (GDestroyNotify) my_func_data_free);\n"
"\n"
"  /* Invoke the function. */\n"
"  g_main_context_invoke_full (thread1_main_context,\n"
"                              G_PRIORITY_DEFAULT, my_func_idle,\n"
"                              task,\n"
"                              (GDestroyNotify) g_object_unref);\n"
"}"
msgstr ""

#. (itstool) path: info/desc
#: C/memory-management.page:17
msgid "Managing memory allocation and deallocation in C"
msgstr "Gerindo alocação e desalocação de memória no C"

#. (itstool) path: page/title
#: C/memory-management.page:20
msgid "Memory Management"
msgstr "Gerenciamento de memória"

#. (itstool) path: page/p
#: C/memory-management.page:50
msgid ""
"The GNOME stack is predominantly written in C, so dynamically allocated "
"memory has to be managed manually. Through use of GLib convenience APIs, "
"memory management can be trivial, but programmers always need to keep memory "
"in mind when writing code."
msgstr ""

#. (itstool) path: page/p
#: C/memory-management.page:57
msgid ""
"It is assumed that the reader is familiar with the idea of heap allocation "
"of memory using <code>malloc()</code> and <code>free()</code>, and knows of "
"the paired GLib equivalents, <code>g_malloc()</code> and <code>g_free()</"
"code>."
msgstr ""

#. (itstool) path: synopsis/p
#: C/memory-management.page:67
msgid "There are three situations to avoid, in order of descending importance:"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:72
msgid "Using memory after freeing it (use-after-free)."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:73
msgid "Using memory before allocating it."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:74
msgid "Not freeing memory after allocating it (leaking)."
msgstr ""

#. (itstool) path: synopsis/p
#: C/memory-management.page:77
msgid "Key principles, in no particular order:"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:82
msgid ""
"Determine and document whether each variable is owned or unowned. They must "
"never change from one to the other at runtime. (<link xref=\"#principles\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:87
msgid ""
"Determine and document the ownership transfers at function boundaries. "
"(<link xref=\"#principles\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:91
msgid ""
"Ensure that each assignment, function call and function return respects the "
"relevant ownership transfers. (<link xref=\"#assignments\"/>, <link xref="
"\"#function-calls\"/>, <link xref=\"#function-returns\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:96
msgid ""
"Use reference counting rather than explicit finalization where possible. "
"(<link xref=\"#reference-counting\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:100
msgid ""
"Use GLib convenience functions like <link xref=\"#g-clear-object"
"\"><code>g_clear_object()</code></link> where possible. (<link xref="
"\"#convenience-functions\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:105
msgid ""
"Do not split memory management across code paths. (<link xref=\"#principles"
"\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:109
msgid ""
"Use the single-path cleanup pattern for large or complex functions. (<link "
"xref=\"#single-path-cleanup\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:113
msgid ""
"Leaks should be checked for using Valgrind or the address sanitizer. (<link "
"xref=\"#verification\"/>)"
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:121
msgid "Principles of Memory Management"
msgstr "Princípios do gerenciamento de memória"

#. (itstool) path: section/p
#: C/memory-management.page:123
msgid ""
"The normal approach to memory management is for the programmer to keep track "
"of which variables point to allocated memory, and to manually free them when "
"they are no longer needed. This is correct, but can be clarified by "
"introducing the concept of <em>ownership</em>, which is the piece of code "
"(such as a function, struct or object) which is responsible for freeing a "
"piece of allocated memory (an <em>allocation</em>). Each allocation has "
"exactly one owner; this owner may change as the program runs, by "
"<em>transferring</em> ownership to another piece of code. Each variable is "
"<em>owned</em> or <em>unowned</em>, according to whether the scope "
"containing it is always its owner. Each function parameter and return type "
"either transfers ownership of the values passed to it, or it doesn’t. If "
"code which owns some memory doesn’t deallocate that memory, that’s a memory "
"leak. If code which doesn’t own some memory frees it, that’s a double-free. "
"Both are bad."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:140
msgid ""
"By statically calculating which variables are owned, memory management "
"becomes a simple task of unconditionally freeing the owned variables before "
"they leave their scope, and <em>not</em> freeing the unowned variables (see "
"<link xref=\"#single-path-cleanup\"/>). The key question to answer for all "
"memory is: which code has ownership of this memory?"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:149
msgid ""
"There is an important restriction here: variables must <em style=\"strong"
"\">never</em> change from owned to unowned (or vice-versa) at runtime. This "
"restriction is key to simplifying memory management."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:155
msgid "For example, consider the functions:"
msgstr "Por exemplo, considere as funções:"

#. (itstool) path: section/code
#: C/memory-management.page:159
#, no-wrap
msgid ""
"gchar *generate_string (const gchar *template);\n"
"void print_string (const gchar *str);"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:162
msgid ""
"The following code has been annotated to note where the ownership transfers "
"happen:"
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:167
#, no-wrap
msgid ""
"gchar *my_str = NULL;  /* owned */\n"
"const gchar *template;  /* unowned */\n"
"GValue value = G_VALUE_INIT;  /* owned */\n"
"g_value_init (&amp;value, G_TYPE_STRING);\n"
"\n"
"/* Transfers ownership of a string from the function to the variable. */\n"
"template = \"XXXXXX\";\n"
"my_str = generate_string (template);\n"
"\n"
"/* No ownership transfer. */\n"
"print_string (my_str);\n"
"\n"
"/* Transfer ownership. We no longer have to free @my_str. */\n"
"g_value_take_string (&amp;value, my_str);\n"
"\n"
"/* We still have ownership of @value, so free it before it goes out of scope. */\n"
"g_value_unset (&amp;value);"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:185
msgid ""
"There are a few points here: Firstly, the ‘owned’ comments by the variable "
"declarations denote that those variables are owned by the local scope, and "
"hence need to be freed before they go out of scope. The alternative is "
"‘unowned’, which means the local scope does <em>not</em> have ownership, and "
"<em>must not</em> free the variables before going out of scope. Similarly, "
"ownership <em>must not</em> be transferred to them on assignment."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:195
msgid ""
"Secondly, the variable type modifiers reflect whether they transfer "
"ownership: because <code>my_str</code> is owned by the local scope, it has "
"type <code>gchar</code>, whereas <code>template</code> is <code>const</code> "
"to denote it is unowned. Similarly, the <code>template</code> parameter of "
"<code>generate_string()</code> and the <code>str</code> parameter of "
"<code>print_string()</code> are <code>const</code> because no ownership is "
"transferred when those functions are called. As ownership <em>is</em> "
"transferred for the string parameter of <code>g_value_take_string()</code>, "
"we can expect its type to be <code>gchar</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:208
msgid ""
"(Note that this is not the case for <link href=\"https://developer.gnome.org/"
"gobject/stable/gobject-The-Base-Object-Type.html\"> <code>GObject</code></"
"link>s and subclasses, which can never be <code>const</code>. It is only the "
"case for strings and simple <code>struct</code>s.)"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:216
msgid ""
"Finally, a few libraries use a function naming convention to indicate "
"ownership transfer, for example using ‘take’ in a function name to indicate "
"full transfer of parameters, as with <code>g_value_take_string()</code>. "
"Note that different libraries use different conventions, as shown below:"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:229
#, fuzzy
msgid "Function name"
msgstr "the \"$name\" function requires exactly one argument"

#. (itstool) path: td/p
#: C/memory-management.page:230
#, fuzzy
msgid "Convention 1 (standard)"
msgstr "Prefixos não coincidem no uso da convenção TO."

#. (itstool) path: td/p
#: C/memory-management.page:231
#, fuzzy
msgid "Convention 2 (alternate)"
msgstr "Alternativo:"

#. (itstool) path: td/p
#: C/memory-management.page:232
msgid "Convention 3 (<cmd>gdbus-codegen</cmd>)"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:237
#, fuzzy
msgid "get"
msgstr "Obter tíquete"

#. (itstool) path: td/p
#: C/memory-management.page:238 C/memory-management.page:254
#: C/memory-management.page:259 C/memory-management.page:260
#: C/memory-management.page:261
#, fuzzy
msgid "No transfer"
msgstr "Transferir chamada"

#. (itstool) path: td/p
#: C/memory-management.page:239
#, fuzzy
msgid "Any transfer"
msgstr "_Cancelar a transferência"

#. (itstool) path: td/p
#: C/memory-management.page:240 C/memory-management.page:245
#: C/memory-management.page:266 C/memory-management.page:273
#: C/memory-management.page:274 C/memory-management.page:275
#, fuzzy
msgid "Full transfer"
msgstr "Completo"

#. (itstool) path: td/p
#: C/memory-management.page:244
#, fuzzy
msgid "dup"
msgstr "D_uplicar Linha / Seleção"

#. (itstool) path: td/p
#: C/memory-management.page:246 C/memory-management.page:247
#: C/memory-management.page:252 C/memory-management.page:253
#: C/memory-management.page:267 C/memory-management.page:268
msgid "Unused"
msgstr "Não utilizado"

#. (itstool) path: td/p
#: C/memory-management.page:251
#, fuzzy
msgid "peek"
msgstr "ERRO INTERNO: Erro na pilha de entrada em peek_input ()"

#. (itstool) path: td/p
#: C/memory-management.page:258
#, fuzzy
msgid "set"
msgstr "set"

#. (itstool) path: td/p
#: C/memory-management.page:265
#, fuzzy
msgid "take"
msgstr "Pegar foco"

#. (itstool) path: td/p
#: C/memory-management.page:272
#, fuzzy
msgid "steal"
msgstr ""
"Este não parece ser o <b>%s</b> real. Atacantes podem estar tentando roubar "
"ou alterar informações indo para ou vindo deste site (por exemplo, mensagens "
"privadas, informações de cartões de crédito ou senhas)."

#. (itstool) path: section/p
#: C/memory-management.page:280
msgid ""
"Ideally, all functions have a <code>(transfer)</code> <link xref="
"\"introspection\">introspection annotation</link> for all relevant "
"parameters and the return value. Failing that, here is a set of guidelines "
"to use to determine whether ownership of a return value is transferred:"
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:288
msgid ""
"If the type has an introspection <code>(transfer)</code> annotation, look at "
"that."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:292
msgid "Otherwise, if the type is <code>const</code>, there is no transfer."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:295
msgid ""
"Otherwise, if the function documentation explicitly specifies the return "
"value must be freed, there is full or container transfer."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:299
msgid ""
"Otherwise, if the function is named ‘dup’, ‘take’ or ‘steal’, there is full "
"or container transfer."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:303
msgid "Otherwise, if the function is named ‘peek’, there is no transfer."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:306
msgid ""
"Otherwise, you need to look at the function’s code to determine whether it "
"intends ownership to be transferred. Then file a bug against the "
"documentation for that function, and ask for an introspection annotation to "
"be added."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:314
msgid ""
"Given this ownership and transfer infrastructure, the correct approach to "
"memory allocation can be mechanically determined for each situation. In each "
"case, the <code>copy()</code> function must be appropriate to the data type, "
"for example <code>g_strdup()</code> for strings, or <code>g_object_ref()</"
"code> for GObjects."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:322
msgid ""
"When thinking about ownership transfer, <code>malloc()</code>/<code>free()</"
"code> and reference counting are equivalent: in the former case, a newly "
"allocated piece of heap memory is transferred; in the latter, a newly "
"incremented reference. See <link xref=\"#reference-counting\"/>."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:331
#, fuzzy
msgid "Assignments"
msgstr "Porque a FSF recebe o copyright de seus colaboradores"

#. (itstool) path: td/p
#: C/memory-management.page:338
#, fuzzy
msgid "Assignment from/to"
msgstr "Operadores de atribuição"

#. (itstool) path: td/p
#: C/memory-management.page:339
#, fuzzy
msgid "Owned destination"
msgstr "Propriedade do usuário"

#. (itstool) path: td/p
#: C/memory-management.page:340
#, fuzzy
msgid "Unowned destination"
msgstr "_Destino:"

#. (itstool) path: td/p
#: C/memory-management.page:346 C/memory-management.page:394
#: C/memory-management.page:441
#, fuzzy
msgid "Owned source"
msgstr "Propriedade do usuário"

#. (itstool) path: td/p
#: C/memory-management.page:348
#, fuzzy
msgid "Copy or move the source to the destination."
msgstr "Selecionar destino da movimentação"

#. (itstool) path: td/code
#: C/memory-management.page:351
#, no-wrap
msgid "owned_dest = copy (owned_src)"
msgstr ""

#. (itstool) path: td/code
#: C/memory-management.page:352
#, no-wrap
msgid "owned_dest = owned_src; owned_src = NULL"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:355
msgid ""
"Pure assignment, assuming the unowned variable is not used after the owned "
"one is freed."
msgstr ""

#. (itstool) path: td/code
#: C/memory-management.page:359
#, fuzzy, no-wrap
msgid "unowned_dest = owned_src"
msgstr ""
"Uso: sln fonte destino|arquivo\n"
"\n"

#. (itstool) path: td/p
#: C/memory-management.page:364 C/memory-management.page:411
#: C/memory-management.page:457
#, fuzzy
msgid "Unowned source"
msgstr "Não existe a fonte"

#. (itstool) path: td/p
#: C/memory-management.page:366
#, fuzzy
msgid "Copy the source to the destination."
msgstr "Caminhos Fonte/Destino:"

#. (itstool) path: td/code
#: C/memory-management.page:367
#, no-wrap
msgid "owned_dest = copy (unowned_src)"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:370
#, fuzzy
msgid "Pure assignment."
msgstr "supressão de atribuição"

#. (itstool) path: td/code
#: C/memory-management.page:371
#, fuzzy, no-wrap
msgid "unowned_dest = unowned_src"
msgstr ""
"Uso: sln fonte destino|arquivo\n"
"\n"

#. (itstool) path: section/title
#: C/memory-management.page:379
#, fuzzy
msgid "Function Calls"
msgstr ""
"Melhorias ao PyGObject no 3.20 incluem suporte estendido a <code>GError</"
"code> e melhorias de desempenho para chamadas e encerramentos de funções. A "
"<link href=\"https://lazka.github.io/pgi-docs/\">referência de API do "
"PyGObject</link> também foi melhorada no 3.20:"

#. (itstool) path: td/p
#: C/memory-management.page:386
#, fuzzy
msgid "Call from/to"
msgstr "Recebendo chamada de vídeo de %s"

#. (itstool) path: td/p
#: C/memory-management.page:387
#, fuzzy
msgid "Transfer full parameter"
msgstr "Completo"

#. (itstool) path: td/p
#: C/memory-management.page:388
#, fuzzy
msgid "Transfer none parameter"
msgstr "    (nenhum)"

#. (itstool) path: td/p
#: C/memory-management.page:396
#, fuzzy
msgid "Copy or move the source for the parameter."
msgstr "Copiar parâmetro"

#. (itstool) path: td/code
#: C/memory-management.page:399
#, no-wrap
msgid "function_call (copy (owned_src))"
msgstr ""

#. (itstool) path: td/code
#: C/memory-management.page:400
#, no-wrap
msgid "function_call (owned_src); owned_src = NULL"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:403 C/memory-management.page:417
#, fuzzy
msgid "Pure parameter passing."
msgstr "Parâmetros: "

#. (itstool) path: td/code
#: C/memory-management.page:406
#, fuzzy, no-wrap
msgid "function_call (owned_src)"
msgstr "Chamar uma função:"

#. (itstool) path: td/p
#: C/memory-management.page:413
#, fuzzy
msgid "Copy the source for the parameter."
msgstr "Copiar parâmetro"

#. (itstool) path: td/code
#: C/memory-management.page:414
#, no-wrap
msgid "function_call (copy (unowned_src))"
msgstr ""

#. (itstool) path: td/code
#: C/memory-management.page:418
#, fuzzy, no-wrap
msgid "function_call (unowned_src)"
msgstr ""
"\n"
"\t# Pilha de Chamadas de Função:\n"
"\n"

#. (itstool) path: section/title
#: C/memory-management.page:426
#, fuzzy
msgid "Function Returns"
msgstr ""
"Esta função retorna a função densidade de probabilidade da distribuição Beta."

#. (itstool) path: td/p
#: C/memory-management.page:433
#, fuzzy
msgid "Return from/to"
msgstr "ASN.1 resposta ruim da gmtime"

#. (itstool) path: td/p
#: C/memory-management.page:434
#, fuzzy
msgid "Transfer full return"
msgstr "Enter"

#. (itstool) path: td/p
#: C/memory-management.page:435
#, fuzzy
msgid "Transfer none return"
msgstr "    (nenhum)"

#. (itstool) path: td/p
#: C/memory-management.page:443
#, fuzzy
msgid "Pure variable return."
msgstr "Definir uma variável para retornar valor."

#. (itstool) path: td/code
#: C/memory-management.page:446
#, fuzzy, no-wrap
msgid "return owned_src"
msgstr "Propriedade do _grupo"

#. (itstool) path: td/p
#: C/memory-management.page:449
msgid ""
"Invalid. The source needs to be freed, so the return value would use freed "
"memory — a use-after-free error."
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:459
#, fuzzy
msgid "Copy the source for the return."
msgstr "copying change source files"

#. (itstool) path: td/code
#: C/memory-management.page:460
#, no-wrap
msgid "return copy (unowned_src)"
msgstr ""

#. (itstool) path: td/p
#: C/memory-management.page:463
#, fuzzy
msgid "Pure variable passing."
msgstr "Passando opções na linha de comando"

#. (itstool) path: td/code
#: C/memory-management.page:464
#, fuzzy, no-wrap
msgid "return unowned_src"
msgstr ""
"Uso: sln fonte destino|arquivo\n"
"\n"

#. (itstool) path: section/p
#: C/memory-management.page:475
msgid ""
"Documenting the ownership transfer for each function parameter and return, "
"and the ownership for each variable, is important. While they may be clear "
"when writing the code, they are not clear a few months later; and may never "
"be clear to users of an API. They should always be documented."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:482
msgid ""
"The best way to document ownership transfer is to use the <link href="
"\"https://wiki.gnome.org/Projects/GObjectIntrospection/"
"Annotations#Memory_and_lifecycle_management\"> <code>(transfer)</code></"
"link> annotation introduced by <link xref=\"introspection\">gobject-"
"introspection</link>. Include this in the API documentation comment for each "
"function parameter and return type. If a function is not public API, write a "
"documentation comment for it anyway and include the <code>(transfer)</code> "
"annotations. By doing so, the introspection tools can also read the "
"annotations and use them to correctly introspect the API."
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:497
#, no-wrap
msgid ""
"/**\n"
" * g_value_take_string:\n"
" * @value: (transfer none): an initialized #GValue\n"
" * @str: (transfer full): string to set it to\n"
" *\n"
" * Function documentation goes here.\n"
" */\n"
"\n"
"/**\n"
" * generate_string:\n"
" * @template: (transfer none): a template to follow when generating the string\n"
" *\n"
" * Function documentation goes here.\n"
" *\n"
" * Returns: (transfer full): a newly generated string\n"
" */"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:514
msgid ""
"Ownership for variables can be documented using inline comments. These are "
"non-standard, and not read by any tools, but can form a convention if used "
"consistently."
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:519
#, no-wrap
msgid ""
"GObject *some_owned_object = NULL;  /* owned */\n"
"GObject *some_unowned_object;  /* unowned */"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:522
msgid ""
"The documentation for <link xref=\"#container-types\"/> is similarly only a "
"convention; it includes the type of the contained elements too:"
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:526
#, no-wrap
msgid ""
"GPtrArray/*&lt;owned gchar*&gt;*/ *some_unowned_string_array;  /* unowned */\n"
"GPtrArray/*&lt;owned gchar*&gt;*/ *some_owned_string_array = NULL;  /* owned */\n"
"GPtrArray/*&lt;unowned GObject*&gt;*/ *some_owned_object_array = NULL;  /* owned */"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:530
msgid ""
"Note also that owned variables should always be initialized so that freeing "
"them is more convenient. See <link xref=\"#convenience-functions\"/>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:536
msgid ""
"Also note that some types, for example basic C types like strings, can have "
"the <code>const</code> modifier added if they are unowned, to take advantage "
"of compiler warnings resulting from assigning those variables to owned "
"variables (which must <em>not</em> use the <code>const</code> modifier). If "
"so, the <code>/* unowned */</code> comment may be omitted."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:546
msgid "Reference Counting"
msgstr "Contagem de referência"

#. (itstool) path: section/p
#: C/memory-management.page:548
msgid ""
"As well as conventional <code>malloc()</code>/<code>free()</code>-style "
"types, GLib has various reference counted types — <link href=\"https://"
"developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html\"> "
"<code>GObject</code></link> being a prime example."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:555
msgid ""
"The concepts of ownership and transfer apply just as well to reference "
"counted types as they do to allocated types. A scope <em>owns</em> a "
"reference counted type if it holds a strong reference to the instance (for "
"example by calling <link href=\"https://developer.gnome.org/gobject/stable/"
"gobject-The-Base-Object-Type.html#g-object-ref\"> <code>g_object_ref()</"
"code></link>). An instance can be ‘copied’ by calling <code>g_object_ref()</"
"code> again. Ownership can be freed with <link href=\"https://developer."
"gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-unref\"> "
"<code>g_object_unref()</code></link> — even though this may not actually "
"finalize the instance, it frees the current scope’s ownership of that "
"instance."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:569
msgid ""
"See <link xref=\"#g-clear-object\"/> for a convenient way of handling "
"GObject references."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:574
msgid ""
"There are other reference counted types in GLib, such as <link href="
"\"https://developer.gnome.org/glib/stable/glib-Hash-Tables.html\"> "
"<code>GHashTable</code></link> (using <link href=\"https://developer.gnome."
"org/glib/stable/glib-Hash-Tables.html#g-hash-table-ref\"> "
"<code>g_hash_table_ref()</code></link> and <link href=\"https://developer."
"gnome.org/glib/stable/glib-Hash-Tables.html#g-hash-table-unref\"> "
"<code>g_hash_table_unref()</code></link>), or <link href=\"https://developer."
"gnome.org/glib/stable/glib-GVariant.html\"> <code>GVariant</code></link> "
"(<link href=\"https://developer.gnome.org/glib/stable/glib-GVariant.html#g-"
"variant-ref\"> <code>g_variant_ref()</code></link>, <link href=\"https://"
"developer.gnome.org/glib/stable/glib-GVariant.html#g-variant-unref\"> "
"<code>g_variant_unref()</code></link>). Some types, like <code>GHashTable</"
"code>, support both reference counting and explicit finalization. Reference "
"counting should always be used in preference, because it allows instances to "
"be easily shared between multiple scopes (each holding their own reference) "
"without having to allocate multiple copies of the instance. This saves "
"memory."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:596
msgid "Floating References"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:598
msgid ""
"Classes which are derived from <link href=\"https://developer.gnome.org/"
"gobject/stable/gobject-The-Base-Object-Type.html#GInitiallyUnowned"
"\"><code>GInitiallyUnowned</code></link>, as opposed to <link href=\"https://"
"developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#GObject-"
"struct\"><code>GObject</code></link> have an initial reference which is "
"<em>floating</em>, meaning that no code owns the reference. As soon as <link "
"href=\"https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-"
"Type.html#g-object-ref-sink\"><code>g_object_ref_sink()</code></link> is "
"called on the object, the floating reference is converted to a strong "
"reference, and the calling code assumes ownership of the object."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:610
msgid ""
"Floating references are a convenience for use in C in APIs, such as GTK+, "
"where large numbers of objects must be created and organized into a "
"hierarchy. In these cases, calling <code>g_object_unref()</code> to drop all "
"the strong references would result in a lot of code."
msgstr ""

#. (itstool) path: example/p
#: C/memory-management.page:618
msgid "Floating references allow the following code to be simplified:"
msgstr ""

#. (itstool) path: example/code
#: C/memory-management.page:621
#, no-wrap
msgid ""
"GtkWidget *new_widget;\n"
"\n"
"new_widget = gtk_some_widget_new ();\n"
"gtk_container_add (some_container, new_widget);\n"
"g_object_unref (new_widget);"
msgstr ""

#. (itstool) path: example/p
#: C/memory-management.page:627
msgid ""
"Instead, the following code can be used, with the <code>GtkContainer</code> "
"assuming ownership of the floating reference:"
msgstr ""

#. (itstool) path: example/code
#: C/memory-management.page:632
#, no-wrap
msgid ""
"\n"
"gtk_container_add (some_container, gtk_some_widget_new ());"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:636
msgid ""
"Floating references are only used by a few APIs — in particular, "
"<code>GtkWidget</code> and all its subclasses. You must learn which APIs "
"support it, and which APIs consume floating references, and only use them "
"together."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:643
msgid ""
"Note that <code>g_object_ref_sink()</code> is equivalent to "
"<code>g_object_ref()</code> when called on a non-floating reference, making "
"<code>gtk_container_add()</code> no different from any other function in "
"such cases."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:650
msgid ""
"See the <link href=\"https://developer.gnome.org/gobject/stable/gobject-The-"
"Base-Object-Type.html#floating-ref\">GObject manual</link> for more "
"information on floating references."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:658
msgid "Convenience Functions"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:660
msgid ""
"GLib provides various convenience functions for memory management, "
"especially for GObjects. Three will be covered here, but others exist — "
"check the GLib API documentation for more. They typically follow similar "
"naming schemas to these three (using ‘_full’ suffixes, or the verb ‘clear’ "
"in the function name)."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:669
msgid "<code>g_clear_object()</code>"
msgstr "<code>g_clear_object()</code>"

#. (itstool) path: section/p
#: C/memory-management.page:671
msgid ""
"<link href=\"https://developer.gnome.org/gobject/stable/gobject-The-Base-"
"Object-Type.html#g-clear-object\"> <code>g_clear_object()</code></link> is a "
"version of <link href=\"https://developer.gnome.org/gobject/stable/gobject-"
"The-Base-Object-Type.html#g-object-unref\"> <code>g_object_unref()</code></"
"link> which unrefs a GObject and then clears the pointer to it to "
"<code>NULL</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:679
msgid ""
"This makes it easier to implement code that guarantees a GObject pointer is "
"always either <code>NULL</code>, or has ownership of a GObject (but which "
"never points to a GObject it no longer owns)."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:685
msgid ""
"By initialising all owned GObject pointers to <code>NULL</code>, freeing "
"them at the end of the scope is as simple as calling <code>g_clear_object()</"
"code> without any checks, as discussed in <link xref=\"#single-path-cleanup"
"\"/>:"
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:691
#, no-wrap
msgid ""
"void\n"
"my_function (void)\n"
"{\n"
"  GObject *some_object = NULL;  /* owned */\n"
"\n"
"  if (rand ())\n"
"    {\n"
"      some_object = create_new_object ();\n"
"      /* do something with the object */\n"
"    }\n"
"\n"
"  g_clear_object (&amp;some_object);\n"
"}"
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:707
msgid "<code>g_list_free_full()</code>"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:709
msgid ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-Doubly-Linked-"
"Lists.html#g-list-free-full\"> <code>g_list_free_full()</code></link> frees "
"all the elements in a linked list, <em>and all their data</em>. It is much "
"more convenient than iterating through the list to free all the elements’ "
"data, then calling <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Doubly-Linked-Lists.html#g-list-free\"> <code>g_list_free()</code></link> to "
"free the <code>GList</code> elements themselves."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:721
msgid "<code>g_hash_table_new_full()</code>"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:723
msgid ""
"<link href=\"https://developer.gnome.org/glib/stable/glib-Hash-Tables.html#g-"
"hash-table-new-full\"> <code>g_hash_table_new_full()</code></link> is a "
"newer version of <link href=\"https://developer.gnome.org/glib/stable/glib-"
"Hash-Tables.html#g-hash-table-new\"> <code>g_hash_table_new()</code></link> "
"which allows setting functions to destroy each key and value in the hash "
"table when they are removed. These functions are then automatically called "
"for all keys and values when the hash table is destroyed, or when an entry "
"is removed using <code>g_hash_table_remove()</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:734
msgid ""
"Essentially, it simplifies memory management of keys and values to the "
"question of whether they are present in the hash table. See <link xref="
"\"#container-types\"/> for a discussion on ownership of elements within "
"container types."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:741
msgid ""
"A similar function exists for <code>GPtrArray</code>: <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Pointer-Arrays.html#g-ptr-array-new-"
"with-free-func\"> <code>g_ptr_array_new_with_free_func()</code></link>."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:750
#, fuzzy
msgid "Container Types"
msgstr "O contêiner não existe"

#. (itstool) path: section/p
#: C/memory-management.page:752
msgid ""
"When using container types, such as <code>GPtrArray</code> or <code>GList</"
"code>, an additional level of ownership is introduced: as well as the "
"ownership of the container instance, each element in the container is either "
"owned or unowned too. By nesting containers, multiple levels of ownership "
"must be tracked. Ownership of owned elements belongs to the container; "
"ownership of the container belongs to the scope it’s in (which may be "
"another container)."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:762
msgid ""
"A key principle for simplifying this is to ensure that all elements in a "
"container have the same ownership: they are either all owned, or all "
"unowned. This happens automatically if the normal <link xref=\"#convenience-"
"functions\"/> are used for types like <code>GPtrArray</code> and "
"<code>GHashTable</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:770
msgid ""
"If elements in a container are <em>owned</em>, adding them to the container "
"is essentially an ownership transfer. For example, for an array of strings, "
"if the elements are owned, the definition of <code>g_ptr_array_add()</code> "
"is effectively:"
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:776
#, no-wrap
msgid ""
"/**\n"
" * g_ptr_array_add:\n"
" * @array: a #GPtrArray\n"
" * @str: (transfer full): string to add\n"
" */\n"
"void\n"
"g_ptr_array_add (GPtrArray *array,\n"
"                 gchar     *str);"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:785
msgid ""
"So, for example, constant (unowned) strings must be added to the array using "
"<code>g_ptr_array_add (array, g_strdup (\"constant string\"))</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:790
msgid "Whereas if the elements are unowned, the definition is effectively:"
msgstr ""

#. (itstool) path: section/code
#: C/memory-management.page:793
#, no-wrap
msgid ""
"/**\n"
" * g_ptr_array_add:\n"
" * @array: a #GPtrArray\n"
" * @str: (transfer none): string to add\n"
" */\n"
"void\n"
"g_ptr_array_add (GPtrArray   *array,\n"
"                 const gchar *str);"
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:802
msgid ""
"Here, constant strings can be added without copying them: "
"<code>g_ptr_array_add (array, \"constant string\")</code>."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:807
msgid ""
"See <link xref=\"#documentation\"/> for examples of comments to add to "
"variable definitions to annotate them with the element type and ownership."
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:814
#, fuzzy
msgid "Single-Path Cleanup"
msgstr "Limpeza concluída"

#. (itstool) path: section/p
#: C/memory-management.page:816
msgid ""
"A useful design pattern for more complex functions is to have a single "
"control path which cleans up (frees) allocations and returns to the caller. "
"This vastly simplifies tracking of allocations, as it’s no longer necessary "
"to mentally work out which allocations have been freed on each code path — "
"all code paths end at the same point, so perform all the frees then. The "
"benefits of this approach rapidly become greater for larger functions with "
"more owned local variables; it may not make sense to apply the pattern to "
"smaller functions."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:827
#, fuzzy
msgid "This approach has two requirements:"
msgstr "Um vetor tem dois propósitos principais:"

#. (itstool) path: item/p
#: C/memory-management.page:831
msgid ""
"The function returns from a single point, and uses <code>goto</code> to "
"reach that point from other paths."
msgstr ""

#. (itstool) path: item/p
#: C/memory-management.page:835
msgid ""
"All owned variables are set to <code>NULL</code> when initialized or when "
"ownership is transferred away from them."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:841
msgid ""
"The example below is for a small function (for brevity), but should "
"illustrate the principles for application of the pattern to larger functions:"
msgstr ""

#. (itstool) path: listing/title
#: C/memory-management.page:848
#, fuzzy
msgid "Single-Path Cleanup Example"
msgstr "Exemplo de caminho: "

#. (itstool) path: listing/desc
#: C/memory-management.page:849
msgid "Example of implementing single-path cleanup for a simple function"
msgstr ""

#. (itstool) path: listing/code
#: C/memory-management.page:852
#, no-wrap
msgid ""
"GObject *\n"
"some_function (GError **error)\n"
"{\n"
"  gchar *some_str = NULL;  /* owned */\n"
"  GObject *temp_object = NULL;  /* owned */\n"
"  const gchar *temp_str;\n"
"  GObject *my_object = NULL;  /* owned */\n"
"  GError *child_error = NULL;  /* owned */\n"
"\n"
"  temp_object = generate_object ();\n"
"  temp_str = \"example string\";\n"
"\n"
"  if (rand ())\n"
"    {\n"
"      some_str = g_strconcat (temp_str, temp_str, NULL);\n"
"    }\n"
"  else\n"
"    {\n"
"      some_operation_which_might_fail (&amp;child_error);\n"
"\n"
"      if (child_error != NULL)\n"
"        {\n"
"          goto done;\n"
"        }\n"
"\n"
"      my_object = generate_wrapped_object (temp_object);\n"
"    }\n"
"\n"
"done:\n"
"  /* Here, @some_str is either NULL or a string to be freed, so can be passed to\n"
"   * g_free() unconditionally.\n"
"   *\n"
"   * Similarly, @temp_object is either NULL or an object to be unreffed, so can\n"
"   * be passed to g_clear_object() unconditionally. */\n"
"  g_free (some_str);\n"
"  g_clear_object (&amp;temp_object);\n"
"\n"
"  /* The pattern can also be used to ensure that the function always returns\n"
"   * either an error or a return value (but never both). */\n"
"  if (child_error != NULL)\n"
"    {\n"
"      g_propagate_error (error, child_error);\n"
"      g_clear_object (&amp;my_object);\n"
"    }\n"
"\n"
"  return my_object;\n"
"}"
msgstr ""

#. (itstool) path: section/title
#: C/memory-management.page:903
#, fuzzy
msgid "Verification"
msgstr "Digite o código de verificação:"

#. (itstool) path: section/p
#: C/memory-management.page:905
msgid ""
"Memory leaks can be checked for in two ways: static analysis, and runtime "
"leak checking."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:910
msgid ""
"Static analysis with tools like <link xref=\"tooling#coverity\">Coverity</"
"link>, the <link xref=\"tooling#clang-static-analyzer\">Clang static "
"analyzer</link> or <link xref=\"tooling#tartan\">Tartan</link> can catch "
"some leaks, but require knowledge of the ownership transfer of every "
"function called in the code. Domain-specific static analyzers like Tartan "
"(which knows about GLib memory allocation and transfer) can perform better "
"here, but Tartan is quite a young project and still misses things (a low "
"true positive rate). It is recommended that code be put through a static "
"analyzer, but the primary tool for detecting leaks should be runtime leak "
"checking."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:924
msgid ""
"Runtime leak checking is done using <link xref=\"tooling#valgrind"
"\">Valgrind</link>, using its <link xref=\"tooling#memcheck\">memcheck</"
"link> tool. Any leak it detects as ‘definitely losing memory’ should be "
"fixed. Many of the leaks which ‘potentially’ lose memory are not real leaks, "
"and should be added to the suppression file."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:933
msgid ""
"If compiling with a recent version of Clang or GCC, the <link xref="
"\"tooling#address-sanitizer\">address sanitizer</link> can be enabled "
"instead, and it will detect memory leaks and overflow problems at runtime, "
"but without the difficulty of running Valgrind in the right environment. "
"Note, however, that it is still a young tool, so may fail in some cases."
msgstr ""

#. (itstool) path: section/p
#: C/memory-management.page:942
msgid ""
"See <link xref=\"tooling#valgrind\"/> for more information on using Valgrind."
msgstr ""

#. (itstool) path: credit/years
#: C/namespacing.page:12
#, fuzzy
msgid "2015, 2016"
msgstr "2015, 2016"

#. (itstool) path: info/desc
#: C/namespacing.page:17
msgid "Avoiding symbol conflicts between libraries by namespacing all APIs"
msgstr ""
"Evite conflitos de símbolos entre bibliotecas atribuindo espaço de nomes a "
"todas APIs"

#. (itstool) path: page/title
#: C/namespacing.page:22
msgid "Namespacing"
msgstr "Espaço de nomes"

#. (itstool) path: synopsis/p
#: C/namespacing.page:27
msgid ""
"If a library is namespaced correctly, it can define types and methods in its "
"API which have the same names as those in another library, and a program can "
"use both without conflicts. This is achieved by prefixing all types and "
"method names with a namespace unique to the library."
msgstr ""

#. (itstool) path: section/title
#: C/namespacing.page:36
msgid "GObject APIs"
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:38
msgid ""
"Consistent and complete namespacing of symbols (functions and types) and "
"files is important for two key reasons:"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:43
msgid ""
"Establishing a convention which means developers have to learn fewer symbol "
"names to use the library — they can guess them reliably instead."
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:47
msgid ""
"Ensuring symbols from two projects do not conflict if included in the same "
"file."
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:53
msgid ""
"The second point is important — imagine what would happen if every project "
"exported a function called <code>create_object()</code>. The headers "
"defining them could not be included in the same file, and even if that were "
"overcome, the programmer would not know which project each function comes "
"from. Namespacing eliminates these problems by using a unique, consistent "
"prefix for every symbol and filename in a project, grouping symbols into "
"their projects and separating them from others."
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:63
msgid ""
"The conventions below should be used for namespacing all symbols. They are "
"<link href=\"https://developer.gnome.org/gobject/stable/gtype-conventions."
"html\"> used in all GLib-based projects</link>, so should be familiar to a "
"lot of developers:"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:70
msgid "Functions should use <code>lower_case_with_underscores</code>."
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:73
msgid ""
"Structures, types and objects should use <code>CamelCaseWithoutUnderscores</"
"code>."
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:77
msgid ""
"Macros and constants should use <code>UPPER_CASE_WITH_UNDERSCORES</code>."
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:81
msgid ""
"All symbols should be prefixed with a short (2–4 characters) version of the "
"namespace. This is shortened purely for ease of typing, but should still be "
"unique."
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:86
msgid "All methods of a class should also be prefixed with the class name."
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:91
msgid ""
"Additionally, public headers should be included from a subdirectory, "
"effectively namespacing the header files. For example, instead of "
"<code>#include &lt;abc.h&gt;</code>, a project should allow its users to use "
"<code>#include &lt;namespace/abc.h&gt;</code>."
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:98
msgid ""
"Some projects namespace their headers within this subdirectory — for "
"example, <code>#include &lt;namespace/ns-abc.h&gt;</code> instead of "
"<code>#include &lt;namespace/abc.h&gt;</code>. This is redundant, but "
"harmless."
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:105
msgid ""
"For example, for a project called ‘Walbottle’, the short namespace ‘Wbl’ "
"would be chosen. If it has a ‘schema’ class and a ‘writer’ class, it would "
"install headers:"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:111
msgid ""
"<file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/"
"schema.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:114
msgid ""
"<file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/"
"writer.h</file>"
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:119
msgid ""
"(The use of <var>$API_MAJOR</var> above is for <link xref=\"parallel-"
"installability\">parallel installability</link>.)"
msgstr ""

#. (itstool) path: section/p
#: C/namespacing.page:124
msgid ""
"For the schema class, the following symbols would be exported (amongst "
"others), following GObject conventions:"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:129
#, fuzzy
msgid "<code>WblSchema</code> structure"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/namespacing.page:130
#, fuzzy
msgid "<code>WblSchemaClass</code> structure"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/namespacing.page:131
msgid "<code>WBL_TYPE_SCHEMA</code> macro"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:132
#, fuzzy
msgid "<code>WBL_IS_SCHEMA</code> macro"
msgstr "Esta macro gera o código de inicialização para a interface."

#. (itstool) path: item/p
#: C/namespacing.page:133
msgid "<code>wbl_schema_get_type</code> function"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:134
msgid "<code>wbl_schema_new</code> function"
msgstr ""

#. (itstool) path: item/p
#: C/namespacing.page:135
msgid "<code>wbl_schema_load_from_data</code> function"
msgstr ""

#. (itstool) path: credit/name
#: C/parallel-installability.page:10
msgid "Havoc Pennington"
msgstr "Havoc Pennington"

#. (itstool) path: credit/years
#: C/parallel-installability.page:12
msgid "2002"
msgstr "2002"

#. (itstool) path: info/desc
#: C/parallel-installability.page:25
msgid "Writing libraries to be future proof through parallel installation"
msgstr ""
"Escrevendo bibliotecas para serem a prova de futuro por meio de instalação "
"paralela"

#. (itstool) path: page/title
#: C/parallel-installability.page:30
msgid "Parallel Installability"
msgstr "Instabilidade paralela"

#. (itstool) path: synopsis/p
#: C/parallel-installability.page:35
msgid ""
"If two packages can be parallel installed, then they have no filenames in "
"common, and people developing against the package always compile against the "
"version they expected. This applies to daemons, utility programs and "
"configuration files as it does to header files and library binaries."
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:43
msgid ""
"Ensure all versions of a library are parallel installable. (<link xref="
"\"#justification\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:47
msgid "Version all files installed by a library. (<link xref=\"#solution\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:51
msgid ""
"Keep package version numbers separate from soname or libtool version "
"numbers. Be clear which part of the package version number changes with the "
"API. (<link xref=\"#version-numbers\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:57
msgid ""
"Install C header files to <file><var>$(includedir)</var>/lib<var>library</"
"var>-<var>version</var>/<var>library</var>/</file>. (<link xref=\"#header-"
"files\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:62
msgid ""
"Install library binaries to <file><var>$(libdir)</var>/lib<var>library</var>-"
"<var>version</var>.so.<var>soname</var></file>. (<link xref=\"#libraries\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:67
msgid ""
"Install pkg-config files to <file><var>$(libdir)</var>/pkgconfig/"
"<var>library</var>-<var>version</var>.pc</file>. (<link xref=\"#pkg-config\"/"
">)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:72
msgid ""
"Make configuration files forwards and backwards compatible, or install them "
"to <file><var>$(sysconfdir)</var>/<var>library</var>-<var>version</var>/</"
"file>. (<link xref=\"#configuration-files\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:78
msgid ""
"Set <code>GETTEXT_PACKAGE</code> to <code><var>library</var>-<var>version</"
"var></code>. (<link xref=\"#gettext\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:83
msgid ""
"Include a version number in all D-Bus interface names, service names and "
"object paths. For example: <code>org.domain.<var>Library</var><var>Version</"
"var>.<var>Interface</var></code>, <code>org.domain.<var>Library</"
"var><var>Version</var></code> and <code>/org/domain/<var>Library</"
"var><var>Version</var>/</code>. (<link xref=\"#dbus\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:91
msgid ""
"Install daemon binaries to <file><var>$(libexecdir)</var>/<var>library</var>-"
"daemon-<var>version</var></file>. (<link xref=\"#programs\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:96
msgid ""
"Install utility binaries to <file><var>$(bindir)</var>/<var>library</var>-"
"utility-<var>version</var></file> and install symbolic links to <file><var>"
"$(bindir)</var>/<var>library</var>-utility</file>. (<link xref=\"#programs\"/"
">)"
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:106
msgid "Justification"
msgstr "Justificação"

#. (itstool) path: section/p
#: C/parallel-installability.page:108
msgid ""
"All public libraries should be designed to be parallel installed to ease API "
"breaks later in the life of the library. If a library is used by multiple "
"projects, and wants to break API, either all of the projects must be ported "
"to the new API in parallel, or some of them will no longer be installable at "
"the same time as the others, due to depending on conflicting versions of "
"this library."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:117
msgid ""
"This is unmaintainable, and asking all the projects to port to a new API at "
"the same time is hard to organize and demoralizing, as most API breaks do "
"not bring large new features which would motivate porting."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:123
msgid ""
"The solution is to ensure that all libraries are parallel installable, "
"allowing the old and new versions of the API to be installed and compiled "
"against at the same time, without conflicts. Building in support for this "
"kind of parallel installation is much easier to do at the start of a project "
"than it is to do retroactively."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:131
msgid ""
"This eliminates the ‘chicken and egg’ problem of porting a collection of "
"applications from one version of a library to the next, and makes breaking "
"API a lot simpler for library maintainers, which can allow for more rapid "
"iteration and development of new features if they desire."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:138
msgid ""
"The alternative, and equally valid, solution is for the library to never "
"break API — the approach taken by <code>libc</code>."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:145
#, fuzzy
msgid "Solution"
msgstr "Solução:"

#. (itstool) path: section/p
#: C/parallel-installability.page:147
msgid ""
"The solution to the problem is essentially to rename the library, and in "
"most cases the nicest way to do so is to include the version number in the "
"path of every file it installs. This means multiple versions of the library "
"can be installed at the same time."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:154
msgid ""
"For example, say that library <code>Foo</code> traditionally installs these "
"files:"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:159 C/parallel-installability.page:284
#, fuzzy
msgid "<file>/usr/include/foo.h</file>"
msgstr "Incluir um arquivo - \\input"

#. (itstool) path: item/p
#: C/parallel-installability.page:160
msgid "<file>/usr/include/foo-utils.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:161
msgid "<file>/usr/lib/libfoo.so</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:162
msgid "<file>/usr/lib/pkgconfig/foo.pc</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:163
msgid "<file>/usr/share/doc/foo/foo-manual.txt</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:164
msgid "<file>/usr/bin/foo-utility</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:167
msgid ""
"You might modify <code>Foo</code> version 4 to install these files instead:"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:172 C/parallel-installability.page:261
msgid "<file>/usr/include/foo-4/foo/foo.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:173
msgid "<file>/usr/include/foo-4/foo/utils.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:174 C/parallel-installability.page:338
msgid "<file>/usr/lib/libfoo-4.so</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:175 C/parallel-installability.page:397
msgid "<file>/usr/lib/pkgconfig/foo-4.pc</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:176
msgid "<file>/usr/share/doc/foo-4/foo-manual.txt</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:177
msgid "<file>/usr/bin/foo-utility-4</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:180
msgid "It could then be parallel installed with version 5:"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:184 C/parallel-installability.page:262
msgid "<file>/usr/include/foo-5/foo/foo.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:185
msgid "<file>/usr/include/foo-5/foo/utils.h</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:186 C/parallel-installability.page:339
msgid "<file>/usr/lib/libfoo-5.so</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:187 C/parallel-installability.page:398
msgid "<file>/usr/lib/pkgconfig/foo-5.pc</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:188
msgid "<file>/usr/share/doc/foo-5/foo-manual.txt</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:189
msgid "<file>/usr/bin/foo-utility-5</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:192
msgid ""
"This is easily supported using <link href=\"http://www.freedesktop.org/wiki/"
"Software/pkg-config/\"> <cmd>pkg-config</cmd></link>: <file>foo-4.pc</file> "
"would add <file>/usr/include/foo-4</file> to the include path and "
"<file>libfoo-4.so</file> to the list of libraries to link; <file>foo-5.pc</"
"file> would add <file>/usr/include/foo-5</file> and <file>libfoo-5.so</file>."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:204
#, fuzzy
msgid "Version Numbers"
msgstr ""
"      --sort=PALAVRA          ordena conforme PALAVRA:\n"
"                                general-numeric -g (numérico geral),\n"
"                                human-numeric -h (numérico humano),\n"
"                                month -M (mês), numeric -n (numérico),\n"
"                                random -R (aleatório), version -V (versão)\n"
"  -V, --version-sort          ordem natural de números (de versão) com "
"texto\n"
"\n"

#. (itstool) path: section/p
#: C/parallel-installability.page:206
msgid ""
"The version number that goes in filenames is an <em>ABI/API</em> version. It "
"should not be the full version number of your package — just the part which "
"signifies an API break. If using the standard <code><var>major</var>."
"<var>minor</var>.<var>micro</var></code> scheme for project versioning, the "
"API version is typically the major version number."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:214
msgid ""
"Minor releases (typically where API is added but <em>not</em> changed or "
"removed) and micro releases (typically bug fixes) do not affect <link xref="
"\"api-stability\">API backwards compatibility</link> so do not require "
"moving all the files."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:221
msgid ""
"The examples in the following sections assume that the API version and "
"soname are exported from <file>configure.ac</file> using the following code:"
msgstr ""

#. (itstool) path: listing/title
#: C/parallel-installability.page:227
#, fuzzy
msgid "API Versioning in Autoconf"
msgstr "Versionamento"

#. (itstool) path: listing/desc
#: C/parallel-installability.page:228
msgid ""
"Code to export the API version and soname from <file>configure.ac</file>"
msgstr ""

#. (itstool) path: listing/code
#: C/parallel-installability.page:231
#, no-wrap
msgid ""
"# Before making a release, the <var>LIBRARY</var>_LT_VERSION string should be modified.\n"
"# The string is of the form c:r:a. Follow these instructions sequentially:\n"
"#\n"
"#  1. If the library source code has changed at all since the last update,\n"
"#     then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).\n"
"#  2. If any interfaces have been added, removed, or changed since the last update,\n"
"#     increment current, and set revision to 0.\n"
"#  3. If any interfaces have been added since the last public release,\n"
"#     then increment age.\n"
"#  4. If any interfaces have been removed or changed since the last public release,\n"
"#     then set age to 0.\n"
"AC_SUBST([<var>LIBRARY</var>_LT_VERSION],[1:0:0])\n"
"\n"
"AC_SUBST([<var>LIBRARY</var>_API_VERSION],[4])"
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:249
#, fuzzy
msgid "C Header Files"
msgstr "Permuta entre o arquivo cabeçalho e o fonte"

#. (itstool) path: section/p
#: C/parallel-installability.page:251
msgid ""
"Header files should always be installed in a versioned subdirectory that "
"requires an <cmd>-I</cmd> flag to the C compiler. For example, if my header "
"is <file>foo.h</file>, and applications do this:"
msgstr ""

#. (itstool) path: section/code
#: C/parallel-installability.page:256
#, fuzzy, no-wrap
msgid "#include &lt;foo/foo.h&gt;"
msgstr "#include &lt;gtkmm.h&gt;"

#. (itstool) path: section/p
#: C/parallel-installability.page:257
#, fuzzy
msgid "then I should install these files:"
msgstr "então Eu deveria instalar esses arquivos:"

#. (itstool) path: section/p
#: C/parallel-installability.page:265
msgid ""
"Applications should pass the flag <cmd>-I/usr/include/foo-4</cmd> or <cmd>-I/"
"usr/include/foo-5</cmd> to the C compiler. Again, this is facilitated by "
"using <cmd>pkg-config</cmd>."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:271
msgid ""
"Note the extra <file>foo/</file> subdirectory. This namespaces the <code "
"mime=\"text/x-csrc\">#include</code> to avoid file naming collisions with "
"other libraries. For example, if two different libraries install headers "
"called <file>utils.h</file>, which one gets included when you use <code mime="
"\"text/x-csrc\">#include &lt;utils.h&gt;</code>?"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:279
msgid ""
"There’s some temptation to keep one of the header files outside of any "
"subdirectory:"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:285
msgid "<file>/usr/include/foo-5/foo.h</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:288
msgid ""
"The problem there is that users are always accidentally getting the wrong "
"header, since <cmd>-I/usr/include</cmd> seems to find its way onto compile "
"command lines with some regularity. If you must do this, at least add a "
"check to the library that detects applications using the wrong header file "
"when the library is initialized."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:296
msgid ""
"Versioned header files can be installed from automake using the following "
"code:"
msgstr ""

#. (itstool) path: listing/title
#: C/parallel-installability.page:301
#, fuzzy
msgid "Header Files in Automake"
msgstr "Arquivos de cabeçalho"

#. (itstool) path: listing/desc
#: C/parallel-installability.page:302
msgid "Code to install versioned header files from <file>Makefile.am</file>"
msgstr ""

#. (itstool) path: listing/code
#: C/parallel-installability.page:305
#, no-wrap
msgid ""
"<var>library</var>includedir = $(includedir)/lib<var>library</var>-@<var>LIBRARY</var>_API_VERSION@/<var>library</var>\n"
"<var>library</var>_headers = \\\n"
"\tlib<var>library</var>/example1.h \\\n"
"\tlib<var>library</var>/example2.h \\\n"
"\t$(NULL)\n"
"\n"
"# The following headers are private, and shouldn't be installed:\n"
"private_headers = \\\n"
"\tlib<var>library</var>/example-private.h \\\n"
"\t$(NULL)\n"
"# The main header simply #includes all other public headers:\n"
"main_header = lib<var>library</var>/<var>library</var>.h\n"
"public_headers = \\\n"
"\t$(main_header) \\\n"
"\t$(<var>library</var>_headers) \\\n"
"\t$(NULL)\n"
"\n"
"<var>library</var>include_HEADERS = $(public_headers)"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:325
msgid ""
"As well as correct versioning, all APIs in installed headers should be <link "
"xref=\"namespacing\">namespaced correctly</link>."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:332
msgid "Libraries"
msgstr "Bibliotecas"

#. (itstool) path: section/p
#: C/parallel-installability.page:334
msgid "Library object files should have a versioned name. For example:"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:342
msgid ""
"This allows applications to get exactly the one they want at compile time, "
"and ensures that versions 4 and 5 have no files in common."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:347
msgid ""
"Versioned libraries can be built and installed from automake using the "
"following code:"
msgstr ""

#. (itstool) path: listing/title
#: C/parallel-installability.page:352
#, fuzzy
msgid "Libraries in Automake"
msgstr "Automake"

#. (itstool) path: listing/desc
#: C/parallel-installability.page:353
msgid ""
"Code to build and install versioned libraries from <file>Makefile.am</file>"
msgstr ""

#. (itstool) path: listing/code
#: C/parallel-installability.page:357
#, no-wrap
msgid ""
"lib_LTLIBRARIES = lib<var>library</var>/lib<var>library</var>-@<var>LIBRARY</var>_API_VERSION@.la\n"
"\n"
"lib<var>library</var>_lib<var>library</var>_@<var>LIBRARY</var>_API_VERSION@_la_SOURCES = \\\n"
"\t$(private_headers) \\\n"
"\t$(<var>library</var>_sources) \\\n"
"\t$(NULL)\n"
"lib<var>library</var>_lib<var>library</var>_@<var>LIBRARY</var>_API_VERSION@_la_CPPFLAGS = …\n"
"lib<var>library</var>_lib<var>library</var>_@<var>LIBRARY</var>_API_VERSION@_la_CFLAGS = …\n"
"lib<var>library</var>_lib<var>library</var>_@<var>LIBRARY</var>_API_VERSION@_la_LIBADD = …\n"
"lib<var>library</var>_lib<var>library</var>_@<var>LIBRARY</var>_API_VERSION@_la_LDFLAGS = \\\n"
"\t-version-info $(<var>LIBRARY</var>_LT_VERSION) \\\n"
"\t$(AM_LDFLAGS) \\\n"
"\t$(NULL)"
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:373
#, fuzzy
msgid "Library sonames"
msgstr "Biblioteca"

#. (itstool) path: section/p
#: C/parallel-installability.page:375
msgid ""
"Library sonames (also known as libtool version numbers) only address the "
"problem of runtime linking previously-compiled applications. They don’t "
"address the issue of compiling applications that require a previous version, "
"and they don’t address anything other than libraries."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:382
msgid ""
"For this reason, sonames should be used, but <em>in addition</em> to "
"versioned names for libraries. The two solutions address different problems."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:391
msgid "pkg-config Files"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:393
msgid "pkg-config files should have a versioned name. For example:"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:401
msgid ""
"Since each pkg-config file contains versioned information about the library "
"name and include paths, any project which depends on the library should be "
"able to switch from one version to another simply by changing their pkg-"
"config check from <file>foo-4</file> to <file>foo-5</file> (and doing any "
"necessary API porting)."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:409
msgid ""
"Versioned pkg-config files can be installed from autoconf and automake using "
"the following code:"
msgstr ""

#. (itstool) path: listing/title
#: C/parallel-installability.page:414
msgid "pkg-config Files in Autoconf and Automake"
msgstr ""

#. (itstool) path: listing/desc
#: C/parallel-installability.page:415
msgid ""
"Code to install versioned pkg-config files from <file>configure.ac</file> "
"and <file>Makefile.am</file>"
msgstr ""

#. (itstool) path: listing/code
#: C/parallel-installability.page:420
#, no-wrap
msgid ""
"AC_CONFIG_FILES([\n"
"lib<var>library</var>/<var>library</var>-$<var>LIBRARY</var>_API_VERSION.pc:lib<var>library</var>/<var>library</var>.pc.in\n"
"],[],\n"
"[<var>LIBRARY</var>_API_VERSION='$<var>LIBRARY</var>_API_VERSION'])"
msgstr ""

#. (itstool) path: listing/code
#: C/parallel-installability.page:425
#, no-wrap
msgid ""
"# Note that the template file is called <var>library</var>.pc.in, but generates a\n"
"# versioned .pc file using some magic in AC_CONFIG_FILES.\n"
"pkgconfigdir = $(libdir)/pkgconfig\n"
"pkgconfig_DATA = lib<var>library</var>/<var>library</var>-$(<var>LIBRARY</var>_API_VERSION).pc\n"
"\n"
"DISTCLEANFILES += $(pkgconfig_DATA)\n"
"EXTRA_DIST += lib<var>library</var>/<var>library</var>.pc.in"
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:436
#, fuzzy
msgid "Configuration Files"
msgstr "Removendo arquivos de configuração…"

#. (itstool) path: section/p
#: C/parallel-installability.page:438
msgid ""
"From a user standpoint, the best approach to configuration files is to keep "
"the format both <link xref=\"api-stability\">forward and backward "
"compatible</link> (both library versions understand exactly the same "
"configuration file syntax and semantics). Then the same configuration file "
"can be used for all versions of the library, and no versioning is needed on "
"the configuration file itself."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:448
msgid ""
"If you can’t do that, the configuration files should simply be renamed, and "
"users will have to configure each version of the library separately."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:455
#, fuzzy
msgid "Gettext Translations"
msgstr "Sem traduções"

#. (itstool) path: section/p
#: C/parallel-installability.page:457
msgid ""
"If you use gettext for translations in combination with autoconf and "
"automake, normally things are set up to install the translations to <file>/"
"usr/share/locale/<var>lang</var>/LC_MESSAGES/<var>package</var></file>. "
"You’ll need to change <var>package</var>. The convention used in GNOME is to "
"put this in <file>configure.ac</file>:"
msgstr ""

#. (itstool) path: section/code
#: C/parallel-installability.page:465
#, no-wrap
msgid ""
"GETTEXT_PACKAGE=foo-4\n"
"AC_SUBST([GETTEXT_PACKAGE])\n"
"AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],[\"$GETTEXT_PACKAGE\"])"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:469
msgid ""
"Then use <code>GETTEXT_PACKAGE</code> as the package name to pass to <code "
"mime=\"text/x-csrc\">bindtextdomain()</code>, <code mime=\"text/x-csrc"
"\">textdomain()</code>, and <code mime=\"text/x-csrc\">dgettext()</code>."
msgstr ""

#. (itstool) path: section/title
#: C/parallel-installability.page:482
#, fuzzy
msgid "D-Bus Interfaces"
msgstr ""
"Fornece interfaces de D-Bus para consultar e manipular\n"
"informações de conta de usuário."

#. (itstool) path: section/p
#: C/parallel-installability.page:484
msgid ""
"A D-Bus interface is another form of API, similar to a C API except that "
"resolution of the version is done at runtime rather than compile time. "
"Versioning D-Bus interfaces is otherwise no different to C APIs: version "
"numbers must be included in interface names, service names and object paths."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:492
msgid ""
"For example, for a service <code>org.example.Foo</code> exposing interfaces "
"<code>A</code> and <code>B</code> on objects <code>Controller</code> and "
"<code>Client</code>, versions 4 and 5 of the D-Bus API would look like this:"
msgstr ""

#. (itstool) path: list/title
#: C/parallel-installability.page:499
#, fuzzy
msgid "Service Names"
msgstr "Nomes:"

#. (itstool) path: item/p
#: C/parallel-installability.page:500
#, fuzzy
msgid "<code>org.example.Foo4</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:501
#, fuzzy
msgid "<code>org.example.Foo5</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: list/title
#: C/parallel-installability.page:504
#, fuzzy
msgid "Interface Names"
msgstr "Os nomes de interface do dispositivo e a conexão não correspondem."

#. (itstool) path: item/p
#: C/parallel-installability.page:505
#, fuzzy
msgid "<code>org.example.Foo4.InterfaceA</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:506
#, fuzzy
msgid "<code>org.example.Foo4.InterfaceB</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:507
#, fuzzy
msgid "<code>org.example.Foo5.InterfaceA</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:508
#, fuzzy
msgid "<code>org.example.Foo5.InterfaceB</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: list/title
#: C/parallel-installability.page:511
#, fuzzy
msgid "Object Paths"
msgstr ""
"Uma matriz de caminho de objeto pode conter qualquer número de caminhos de "
"objeto (incluindo nenhum: \"[]\").\n"
"\n"
"Se você não está interagindo com D-Bus, então não há motivo para fazer uso "
"deste tipo."

#. (itstool) path: item/p
#: C/parallel-installability.page:512
#, fuzzy
msgid "<code>/org/example/Foo4/Controller</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:513
#, fuzzy
msgid "<code>/org/example/Foo4/Client</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:514
#, fuzzy
msgid "<code>/org/example/Foo5/Controller</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: item/p
#: C/parallel-installability.page:515
#, fuzzy
msgid "<code>/org/example/Foo5/Client</code>"
msgstr "O código {code} é inválido."

#. (itstool) path: section/title
#: C/parallel-installability.page:527
#, fuzzy
msgid "Programs, Daemons and Utilities"
msgstr "_Utilidades"

#. (itstool) path: section/p
#: C/parallel-installability.page:529
msgid ""
"Desktop applications generally do not need to be versioned, as they are not "
"depended on by any other modules. Daemons and utility programs, however, "
"interact with other parts of the system and hence need versioning."
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:536
#, fuzzy
msgid "Given a daemon and utility program:"
msgstr "Nenhum nome de programa dado\\n"

#. (itstool) path: item/p
#: C/parallel-installability.page:540
msgid "<file>/usr/libexec/foo-daemon</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:541
msgid "<file>/usr/bin/foo-lookup-utility</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:543
#, fuzzy
msgid "these should be versioned as:"
msgstr "Sem controle de _versão"

#. (itstool) path: item/p
#: C/parallel-installability.page:547
msgid "<file>/usr/libexec/foo-daemon-4</file>"
msgstr ""

#. (itstool) path: item/p
#: C/parallel-installability.page:548
msgid "<file>/usr/bin/foo-lookup-utility-4</file>"
msgstr ""

#. (itstool) path: section/p
#: C/parallel-installability.page:551
msgid ""
"You may want to install a symbolic link from <file>/usr/bin/foo-lookup-"
"utility</file> to the recommended versioned copy of the utility, to make it "
"more convenient for users to use."
msgstr ""

#. (itstool) path: info/desc
#: C/preconditions.page:18
msgid "Contract programming with checks on function input and output"
msgstr "Contrate programação com verificações em função de entrada e saída"

#. (itstool) path: page/title
#. (itstool) path: section/title
#: C/preconditions.page:21 C/preconditions.page:24
msgid "Pre- and Post-Conditions"
msgstr "Pré e pós-condições"

#. (itstool) path: section/p
#: C/preconditions.page:26
msgid ""
"An important part of secure coding is ensuring that incorrect data does not "
"propagate far through code — the further some malicious input can propagate, "
"the more code it sees, and the greater potential there is for an exploit to "
"be possible."
msgstr ""

#. (itstool) path: section/p
#: C/preconditions.page:33
msgid ""
"A standard way of preventing the propagation of invalid data is to check all "
"inputs to, and outputs from, all publicly visible functions in a library or "
"module. There are two levels of checking:"
msgstr ""

#. (itstool) path: item/title
#: C/preconditions.page:40
msgid "Assertions"
msgstr "Asserções"

#. (itstool) path: item/p
#: C/preconditions.page:41
msgid "Check for programmer errors and abort the program on failure."
msgstr ""

#. (itstool) path: item/title
#: C/preconditions.page:46
msgid "Validation"
msgstr "Validação"

#. (itstool) path: item/p
#: C/preconditions.page:47
msgid "Check for invalid input and return an error gracefully on failure."
msgstr ""

#. (itstool) path: section/p
#: C/preconditions.page:53
msgid ""
"Validation is a complex topic, and is handled using <link xref=\"gerror"
"\">GErrors</link>. The remainder of this section discusses pre- and post-"
"condition assertions, which are purely for catching programmer errors. A "
"programmer error is where a function is called in a way which is documented "
"as disallowed. For example, if <code>NULL</code> is passed to a parameter "
"which is documented as requiring a non-<code>NULL</code> value to be passed; "
"or if a negative value is passed to a function which requires a positive "
"value. Programmer errors can happen on output too — for example, returning "
"<code>NULL</code> when it is not documented to, or not setting a GError "
"output when it fails."
msgstr ""

#. (itstool) path: section/p
#: C/preconditions.page:67
msgid ""
"Adding pre- and post-condition assertions to code is as much about ensuring "
"the behavior of each function is correctly and completely documented as it "
"is about adding the assertions themselves. All assertions should be "
"documented, preferably by using the relevant <link xref=\"introspection"
"\">introspection annotations</link>, such as <code>(nullable)</code>."
msgstr ""

#. (itstool) path: section/p
#: C/preconditions.page:76
msgid ""
"Pre- and post-condition assertions are implemented using <link href="
"\"https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions."
"html#g-return-if-fail\"><code>g_return_if_fail()</code></link> and <link "
"href=\"https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions."
"html#g-return-val-if-fail\"><code>g_return_val_if_fail()</code></link>."
msgstr ""

#. (itstool) path: section/p
#: C/preconditions.page:83
msgid ""
"The pre-conditions should check each parameter at the start of the function, "
"before any other code is executed (even retrieving the private data "
"structure from a GObject, for example, since the GObject pointer could be "
"<code>NULL</code>). The post-conditions should check the return value and "
"any output parameters at the end of the function — this requires a single "
"<code>return</code> statement and use of <code>goto</code> to merge other "
"control paths into it. See <link xref=\"memory-management#single-path-cleanup"
"\"/> for an example."
msgstr ""

#. (itstool) path: info/desc
#: C/threading.page:18
msgid "Moving computation out of the main thread into worker threads"
msgstr "Movendo computação da thread principal para threads de trabalho"

#. (itstool) path: page/title
#: C/threading.page:21
msgid "Threading"
msgstr "Threading"

#. (itstool) path: item/p
#: C/threading.page:27
msgid ""
"Do not use threads if at all possible. (<link xref=\"#when-to-use-threading"
"\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:31
msgid ""
"If threads have to be used, use <code>GTask</code> or <code>GThreadPool</"
"code> and isolate the threaded code as much as possible. (<link xref="
"\"#using-threading\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:37
msgid ""
"Use <code>g_thread_join()</code> to avoid leaking thread resources if using "
"<code>GThread</code> manually. (<link xref=\"#using-threading\"/>)"
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:42
msgid ""
"Be careful about the <code>GMainContext</code> which code is executed in if "
"using threads. Executing code in the wrong context can cause race "
"conditions, or block the main loop. (<link xref=\"#using-threading\"/>)"
msgstr ""

#. (itstool) path: section/title
#: C/threading.page:52
#, fuzzy
msgid "When to Use Threading"
msgstr "Usar encadeamento de mensagens"

#. (itstool) path: section/p
#: C/threading.page:54
msgid ""
"When writing projects using GLib, the default approach should be to <em "
"style=\"strong\">never use threads</em>. Instead, make proper use of the "
"<link xref=\"main-contexts\">GLib main context</link> which, through the use "
"of asynchronous operations, allows most blocking I/O operations to continue "
"in the background while the main context continues to process other events. "
"Analysis, review and debugging of threaded code becomes very hard, very "
"quickly."
msgstr ""

#. (itstool) path: section/p
#: C/threading.page:64
msgid ""
"Threading should only be necessary when using an external library which has "
"blocking functions which need to be called from GLib code. If the library "
"provides a non-blocking alternative, or one which integrates with a <link "
"href=\"http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html"
"\"><code>poll()</code></link> loop, that should be used in preference. If "
"the blocking function really must be used, a thin wrapper should be written "
"for it to convert it to the normal <link href=\"https://developer.gnome.org/"
"gio/stable/GAsyncResult.html\"><code>GAsyncResult</code> style</link> of "
"GLib asynchronous function, running the blocking operation in a worker "
"thread."
msgstr ""

#. (itstool) path: example/code
#: C/threading.page:82
#, no-wrap
msgid ""
"\n"
"int\n"
"some_blocking_function (void *param1,\n"
"                        void *param2);\n"
msgstr ""

#. (itstool) path: example/p
#: C/threading.page:87
#, fuzzy
msgid "Should be wrapped as:"
msgstr ""
"Essa opção define se linhas de texto longas demais devem ser quebradas."

#. (itstool) path: example/code
#: C/threading.page:90
#, no-wrap
msgid ""
"\n"
"void\n"
"some_blocking_function_async (void                 *param1,\n"
"                              void                 *param2,\n"
"                              GCancellable         *cancellable,\n"
"                              GAsyncReadyCallback   callback,\n"
"                              gpointer              user_data);\n"
"int\n"
"some_blocking_function_finish (GAsyncResult        *result,\n"
"                               GError             **error);\n"
msgstr ""

#. (itstool) path: example/p
#: C/threading.page:102
#, fuzzy
msgid "With an implementation something like:"
msgstr "Isso faz com que ela se pareça com algo como isso:"

#. (itstool) path: example/code
#: C/threading.page:105
#, no-wrap
msgid ""
"/* Closure for the call’s parameters. */\n"
"typedef struct {\n"
"  void *param1;\n"
"  void *param2;\n"
"} SomeBlockingFunctionData;\n"
"\n"
"static void\n"
"some_blocking_function_data_free (SomeBlockingFunctionData *data)\n"
"{\n"
"  free_param (data-&gt;param1);\n"
"  free_param (data-&gt;param2);\n"
"\n"
"  g_free (data);\n"
"}\n"
"\n"
"static void\n"
"some_blocking_function_thread_cb (GTask         *task,\n"
"                                  gpointer       source_object,\n"
"                                  gpointer       task_data,\n"
"                                  GCancellable  *cancellable)\n"
"{\n"
"  SomeBlockingFunctionData *data = task_data;\n"
"  int retval;\n"
"\n"
"  /* Handle cancellation. */\n"
"  if (g_task_return_error_if_cancelled (task))\n"
"    {\n"
"      return;\n"
"    }\n"
"\n"
"  /* Run the blocking function. */\n"
"  retval = some_blocking_function (data-&gt;param1, data-&gt;param2);\n"
"  g_task_return_int (task, retval);\n"
"}\n"
"\n"
"void\n"
"some_blocking_function_async (void                 *param1,\n"
"                              void                 *param2,\n"
"                              GCancellable         *cancellable,\n"
"                              GAsyncReadyCallback   callback,\n"
"                              gpointer              user_data)\n"
"{\n"
"  GTask *task = NULL;  /* owned */\n"
"  SomeBlockingFunctionData *data = NULL;  /* owned */\n"
"\n"
"  g_return_if_fail (validate_param (param1));\n"
"  g_return_if_fail (validate_param (param2));\n"
"  g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));\n"
"\n"
"  task = g_task_new (NULL, cancellable, callback, user_data);\n"
"  g_task_set_source_tag (task, some_blocking_function_async);\n"
"\n"
"  /* Cancellation should be handled manually using mechanisms specific to\n"
"   * some_blocking_function(). */\n"
"  g_task_set_return_on_cancel (task, FALSE);\n"
"\n"
"  /* Set up a closure containing the call’s parameters. Copy them to avoid\n"
"   * locking issues between the calling thread and the worker thread. */\n"
"  data = g_new0 (SomeBlockingFunctionData, 1);\n"
"  data-&gt;param1 = copy_param (param1);\n"
"  data-&gt;param2 = copy_param (param2);\n"
"\n"
"  g_task_set_task_data (task, data, some_blocking_function_data_free);\n"
"\n"
"  /* Run the task in a worker thread and return immediately while that continues\n"
"   * in the background. When it’s done it will call @callback in the current\n"
"   * thread default main context. */\n"
"  g_task_run_in_thread (task, some_blocking_function_thread_cb);\n"
"\n"
"  g_object_unref (task);\n"
"}\n"
"\n"
"int\n"
"some_blocking_function_finish (GAsyncResult  *result,\n"
"                               GError       **error)\n"
"{\n"
"  g_return_val_if_fail (g_task_is_valid (result,\n"
"                                         some_blocking_function_async), -1);\n"
"  g_return_val_if_fail (error == NULL || *error == NULL, -1);\n"
"\n"
"  return g_task_propagate_int (G_TASK (result), error);\n"
"}"
msgstr ""

#. (itstool) path: example/p
#: C/threading.page:187
msgid ""
"See the <link href=\"https://developer.gnome.org/gio/stable/GAsyncResult.html"
"\"><code>GAsyncResult</code> documentation</link> for more details. A simple "
"way to implement the worker thread is to use <link href=\"https://developer."
"gnome.org/gio/stable/GTask.html\"><code>GTask</code></link> and <link href="
"\"https://developer.gnome.org/gio/stable/GTask.html#g-task-run-in-thread"
"\"><code>g_task_run_in_thread()</code></link>. (See also: <link xref=\"main-"
"contexts#gtask\"/>.)"
msgstr ""

#. (itstool) path: section/title
#: C/threading.page:200
#, fuzzy
msgid "Using Threading"
msgstr "Encadeamento _JWZ"

#. (itstool) path: section/p
#: C/threading.page:202
msgid ""
"If <code>GTask</code> is not suitable for writing the worker thread, a more "
"low-level approach must be used. This should be considered very carefully, "
"as it is very easy to get threading code wrong in ways which will "
"unpredictably cause bugs at runtime, cause deadlocks, or consume too many "
"resources and terminate the program."
msgstr ""

#. (itstool) path: section/p
#: C/threading.page:210
msgid ""
"A full manual on writing threaded code is beyond the scope of this document, "
"but here are a number of guidelines to follow which should reduce the "
"potential for bugs in threading code. The overriding principle is to reduce "
"the amount of code and data which can be affected by threading — for "
"example, reducing the number of threads, the complexity of worker thread "
"implementation, and the amount of data shared between threads."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:222
msgid ""
"Use <link href=\"https://developer.gnome.org/glib/stable/glib-Thread-Pools."
"html\"><code>GThreadPool</code></link> instead of manually creating <link "
"href=\"https://developer.gnome.org/glib/stable/glib-Threads.html"
"\"><code>GThread</code>s</link> if possible. <code>GThreadPool</code> "
"supports a work queue, limits on the number of spawned threads, and "
"automatically joins finished threads so they are not leaked."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:232
msgid ""
"If it is not possible to use a <code>GThreadPool</code> (which is rarely the "
"case):"
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:239
msgid ""
"Use <link href=\"https://developer.gnome.org/glib/stable/glib-Threads.html#g-"
"thread-try-new\"><code>g_thread_try_new()</code></link> to spawn threads, "
"instead of <link href=\"https://developer.gnome.org/glib/stable/glib-Threads."
"html#g-thread-new\"><code>g_thread_new()</code></link>, so errors due to the "
"system running out of threads can be handled gracefully rather than "
"unconditionally aborting the program."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:248
msgid ""
"Explicitly join threads using <link href=\"https://developer.gnome.org/glib/"
"stable/glib-Threads.html#g-thread-join\"><code>g_thread_join()</code></link> "
"to avoid leaking the thread resources."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:257
msgid ""
"Use message passing to transfer data between threads, rather than manual "
"locking with mutexes. <code>GThreadPool</code> explicitly supports this with "
"<link href=\"https://developer.gnome.org/glib/stable/glib-Thread-Pools."
"html#g-thread-pool-push\"><code>g_thread_pool_push()</code></link>."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:265
#, fuzzy
msgid "If mutexes must be used:"
msgstr "--select deve ser usado com ao menos uma URI."

#. (itstool) path: item/p
#: C/threading.page:271
msgid ""
"Isolate threading code as much as possible, keeping mutexes private within "
"classes, and tightly bound to very specific class members."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:278
msgid ""
"All mutexes should be clearly commented beside their declaration, indicating "
"which other structures or variables they protect access to. Similarly, those "
"variables should be commented saying that they should <em>only</em> be "
"accessed with that mutex held."
msgstr ""

#. (itstool) path: item/p
#: C/threading.page:288
msgid ""
"Be careful about interactions between main contexts and threads. For "
"example, <link href=\"https://developer.gnome.org/glib/stable/glib-The-Main-"
"Event-Loop.html#g-timeout-add-seconds\"><code>g_timeout_add_seconds()</"
"code></link> adds a timeout <em>to be executed in the global default main "
"context</em>, which is being run in the main thread, <em>not necessarily</"
"em> the current thread. Getting this wrong can mean that work intended for a "
"worker thread accidentally ends up being executed in the main thread anyway. "
"(See also: <link xref=\"main-contexts#default-contexts\"/>.)"
msgstr ""

#. (itstool) path: section/title
#: C/threading.page:304
msgid "Debugging"
msgstr "Depuração"

#. (itstool) path: section/p
#: C/threading.page:306
msgid ""
"Debugging threading issues is tricky, both because they are hard to "
"reproduce, and because they are hard to reason about. This is one of the big "
"reasons for avoiding using threads in the first place."
msgstr ""

#. (itstool) path: section/p
#: C/threading.page:312
msgid ""
"However, if a threading issue does arise, <link xref=\"tooling#helgrind-and-"
"drd\">Valgrind’s drd and helgrind tools are useful</link>."
msgstr ""

#. (itstool) path: info/desc
#: C/tooling.page:17
msgid "Using the right tool for various tasks"
msgstr "Usando a ferramenta certa para várias tarefas"

#. (itstool) path: page/title
#: C/tooling.page:20
msgid "Tooling"
msgstr "Ferramentas"

#. (itstool) path: page/p
#: C/tooling.page:22
msgid ""
"Development tools are much more than just a text editor and a compiler. "
"Correct use of the right tools can drastically ease debugging and tracking "
"down of complex problems with memory allocation and system calls, amongst "
"other things. Some of the most commonly used tools are described below; "
"other tools exist for more specialized use cases, and should be used when "
"appropriate."
msgstr ""
"Ferramentas de desenvolvimento são muito mais do que um editor de texto e um "
"compilador. O uso correto das ferramentas certas pode facilitar "
"drasticamente a depuração e o rastreamento de problemas complexos com "
"alocação de memória e chamadas de sistema; além de outras coisas. Algumas "
"das ferramentas mais comumente usadas são descritas abaixo; outras "
"ferramentas existem para casos de uso mais especializados e devem ser usados "
"quando apropriado."

#. (itstool) path: page/p
#: C/tooling.page:31
msgid ""
"An overarching principle to use when developing is to always have as many "
"debugging options enabled as possible, rather than keeping them disabled "
"until near release time. By constantly testing code with all available debug "
"tooling, bugs can be caught early on, before they become ingrained in code "
"and thus harder to remove."
msgstr ""
"Um princípio geral a se usar quando se está desenvolvendo é sempre ter "
"tantas opções de depuração habilitadas quanto possível, em vez de mantê-las "
"desabilitadas até próximo da data de lançamento. Ao testar o código "
"constantemente com todas as ferramentas de depuração disponível, erros podem "
"ser encontrados desde cedo, antes que eles façam parte do código e, "
"portanto, mais seja difícil de removê-los."

#. (itstool) path: page/p
#: C/tooling.page:39
msgid ""
"Practically, this means having all compiler and other tool warnings enabled "
"and set to fail the build process with an error if they are emitted."
msgstr ""
"Na prática, isso significa ter todos os avisos, do compilador e de outras "
"ferramentas, habilitados e definidos para falhar no processo de compilação "
"com um erro se forem emitidos."

#. (itstool) path: item/p
#: C/tooling.page:48
msgid ""
"Compile frequently with a second compiler. (<link xref=\"#gcc-and-clang\"/>)"
msgstr ""
"Compile com frequência com um segundo compilador. (<link xref=\"#gcc-and-"
"clang\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:52
msgid ""
"Enable a large selection of compiler warnings and make them fatal. (<link "
"xref=\"#gcc-and-clang\"/>)"
msgstr ""
"Habilite uma seleção grande de avisos de compilador e faça-os falhar. (<link "
"xref=\"#gcc-and-clang\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:56
msgid "Use GDB to debug and step through code. (<link xref=\"#gdb\"/>)"
msgstr "Use GDB para depurar e passear pelo código. (<link xref=\"#gdb\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:59
msgid ""
"Use Valgrind to analyze memory usage, memory errors, cache and CPU "
"performance and threading errors. (<link xref=\"#valgrind\"/>)"
msgstr ""
"Use Valgrind para analisar o uso de memória, erros de memória, cache e "
"desempenho da CPU e erros em threads. (<link xref=\"#valgrind\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:63
msgid ""
"Use gcov and lcov to analyze unit test coverage. (<link xref=\"#gcov-and-lcov"
"\"/>)"
msgstr ""
"Use gcov e lcov para analisar a cobertura de teste de unidade. (<link xref="
"\"#gcov-and-lcov\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:67
msgid ""
"Use compiler sanitizers to analyze memory, thread and undefined behavior "
"problems. (<link xref=\"#sanitizers\"/>)"
msgstr ""
"Use sanitizadores de compilador para analisar problemas de memória, thread e "
"comportamentos indefinidos. (<link xref=\"#sanitizers\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:71
msgid ""
"Submit to Coverity as a cronjob and eliminate static analysis errors as they "
"appear. (<link xref=\"#coverity\"/>)"
msgstr ""
"Envie para Coverity como um cronjob e elimine erros de análise estática na "
"medida em que eles aparecem. (<link xref=\"#coverity\"/>)"

#. (itstool) path: item/p
#: C/tooling.page:75
msgid ""
"Use Clang static analyzer and Tartan regularly to eliminate statically "
"analysable errors locally. (<link xref=\"#clang-static-analyzer\"/>)"
msgstr ""
"Use o analisador estático do Clang e o Tartan regularmente para eliminar "
"localmente erros analisáveis estaticamente"

#. (itstool) path: section/title
#: C/tooling.page:83
msgid "GCC and Clang"
msgstr "GCC e Clang"

#. (itstool) path: section/p
#: C/tooling.page:85
msgid ""
"<link href=\"https://gcc.gnu.org/onlinedocs/gcc/\">GCC</link> is the "
"standard C compiler for Linux. An alternative exists in the form of <link "
"href=\"http://clang.llvm.org/docs/UsersManual.html\">Clang</link>, with "
"comparable functionality. Choose one (probably GCC) to use as a main "
"compiler, but occasionally use the other to compile the code, as the two "
"detect slightly different sets of errors and warnings in code. Clang also "
"comes with a static analyzer tool which can be used to detect errors in code "
"without compiling or running it; see <link xref=\"#clang-static-analyzer\"/>."
msgstr ""
"<link href=\"https://gcc.gnu.org/onlinedocs/gcc/\">GCC</link> é o compilador "
"C padrão para Linux. Existe uma alternativa na forma de <link href=\"http://"
"clang.llvm.org/docs/UsersManual.html\">Clang</link>, com funcionalidade "
"comparável. Escolha um (provavelmente GCC) para usar como compilador "
"principal, mas ocasionalmente use o outro para compilar o código, já que os "
"dois detectam um conjunto um pouco diferente de erros e avisos no código. "
"Clang também vem com uma ferramenta de análise estática que pode ser usada "
"para detectar erros no código sem precisar compilá-lo e executá-lo; veja "
"<link xref=\"#clang-static-analyzer\"/>."

#. (itstool) path: section/p
#: C/tooling.page:97
msgid ""
"Both compilers should be used with as many warning flags enabled as "
"possible. Although compiler warnings do occasionally provide false "
"positives, most warnings legitimately point to problems in the code, and "
"hence should be fixed rather than ignored. A development policy of enabling "
"all warning flags and also specifying the <code>-Werror</code> flag (which "
"makes all warnings fatal to compilation) promotes fixing warnings as soon as "
"they are introduced. This helps code quality. The alternative of ignoring "
"warnings leads to long debugging sessions to track down bugs caused by "
"issues which would have been flagged up by the warnings. Similarly, ignoring "
"warnings until the end of the development cycle, then spending a block of "
"time enabling and fixing them all wastes time."
msgstr ""
"Ambos compiladores devem ser usados com tantos sinalizadores de avisos "
"habilitados quanto possível. Apesar de avisos de compilador de vez em quando "
"fornecerem falsos positivos, a maioria dos avisos legitimamente aponta para "
"problemas no código e, portanto, devem ser corrigidos em vez de ignorados. "
"Uma política de desenvolvimento de habilitar todos sinalizadores de avisos e "
"também especificar o sinalizador <code>-Werror</code> (que torna todos os "
"avisos em fatais para compilação) promove correção de avisos assim que forem "
"introduzidos. Isso ajuda na qualidade do código. A alternativa de ignorar "
"avisos leva a longas sessões de depuração para rastrear erros causados por "
"problemas que teriam sido levantados pelos avisos. Similarmente, ignorar "
"avisos até o fim do ciclo de desenvolvimento para, em um momento posterior, "
"gastar um pedaço de tempo habilitando e corrigindo todos eles é uma perda de "
"tempo."

#. (itstool) path: section/p
#: C/tooling.page:112
msgid ""
"Both GCC and Clang support a wide range of compiler flags, only some of "
"which are related to modern, multi-purpose code (for example, others are "
"outdated or architecture-specific). Finding a reasonable set of flags to "
"enable can be tricky, and hence the <link href=\"http://www.gnu.org/software/"
"autoconf-archive/ax_compiler_flags.html\"> <code>AX_COMPILER_FLAGS</code></"
"link> macro exists."
msgstr ""
"Ambos GCC e Clang oferecem suporte a um amplo alcance de sinalizadores de "
"compilador, estando apenas alguns relacionados a um código moderno e "
"multipropósito (por exemplo, outros estão desatualizados e são para alguma "
"arquitetura específica). Encontrar um conjunto razoável de sinalizadores "
"para habilitar pode ser complicado e por isto que a macro <link href="
"\"http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html\"> "
"<code>AX_COMPILER_FLAGS</code></link> existe."

#. (itstool) path: section/p
#: C/tooling.page:121
msgid ""
"<code>AX_COMPILER_FLAGS</code> enables a consistent set of compiler "
"warnings, and also tests that the compiler supports each flag before "
"enabling it. This accounts for differences in the set of flags supported by "
"GCC and Clang. To use it, add <code>AX_COMPILER_FLAGS</code> to "
"<file>configure.ac</file>. If you are using in-tree copies of autoconf-"
"archive macros, copy <link href=\"http://git.savannah.gnu.org/gitweb/?"
"p=autoconf-archive.git;a=blob_plain;f=m4/ax_compiler_flags.m4\"> "
"<file>ax_compiler_flags.m4</file></link> to the <file>m4/</file> directory "
"of your project. Note that it depends on the following autoconf-archive "
"macros which are GPL-licenced so potentially cannot be copied in-tree. They "
"may have to remain in autoconf-archive, with that as a build time dependency "
"of the project:"
msgstr ""
"<code>AX_COMPILER_FLAGS</code> permite um conjunto consistente de avisos de "
"compilador e também testa se o computador oferece suporte a cada sinalizador "
"antes de habilitá-lo. Isso conta para diferenças no conjunto de "
"sinalizadores aos quais GCC e Clang oferecem suporte. Para usá-lo, adicione "
"<code>AX_COMPILER_FLAGS</code> ao <file>configure.ac</file>. Se você está "
"usando cópias de macros autoconf-archive na árvore do projeto, copie <link "
"href=\"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;"
"a=blob_plain;f=m4/ax_compiler_flags.m4\"> <file>ax_compiler_flags.m4</file></"
"link> para o diretório <file>m4/</file> deste. Note que ele depende das "
"macros de autoconf-archive a seguir, as quais são licenciadas sob GPL e, "
"portanto, potencialmente não podem ser copiadas para a árvore. Elas podem "
"permanecer no autoconf-archive, com este como uma dependência de tempo de "
"compilação do projeto:"

#. (itstool) path: item/p
#: C/tooling.page:136
msgid "<code>ax_append_compile_flags.m4</code>"
msgstr "<code>ax_append_compile_flags.m4</code>"

#. (itstool) path: item/p
#: C/tooling.page:137
msgid "<code>ax_append_flag.m4</code>"
msgstr "<code>ax_append_flag.m4</code>"

#. (itstool) path: item/p
#: C/tooling.page:138
msgid "<code>ax_check_compile_flag.m4</code>"
msgstr "<code>ax_check_compile_flag.m4</code>"

#. (itstool) path: item/p
#: C/tooling.page:139
msgid "<code>ax_require_defined.m4</code>"
msgstr "<code>ax_require_defined.m4</code>"

#. (itstool) path: section/p
#: C/tooling.page:142
msgid ""
"<code>AX_COMPILER_FLAGS</code> supports disabling <code>-Werror</code> for "
"release builds, so that releases may always be built against newer compilers "
"which have introduced more warnings. Set its third parameter to ‘yes’ for "
"release builds (and only release builds) to enable this functionality. "
"Development and CI builds should always have <code>-Werror</code> enabled."
msgstr ""
"<code>AX_COMPILER_FLAGS</code> oferece suporte a desabilitar <code>-Werror</"
"code> para compilações de lançamento, de forma que lançamentos sempre seja "
"possível compilar com novos compiladores que podem ter introduzido mais "
"avisos. Defina seu terceiro parâmetro para “yes” para compilações de "
"lançamento (e apenas compilações de lançamento) para habilitar essa "
"funcionalidade. Compilações de desenvolvimento e de integração contínua (em "
"inglês “continuous integration” ou, abreviado, “CI”) deve sempre ter <code>-"
"Werror</code> habilitado."

#. (itstool) path: section/p
#: C/tooling.page:151
msgid ""
"Release builds can be detected using the <link href=\"http://www.gnu.org/"
"software/autoconf-archive/ax_is_release.html\"><code>AX_IS_RELEASE</code></"
"link> macro, the result of which can be passed directly to "
"<code>AX_COMPILER_FLAGS</code>:"
msgstr ""
"Compilações de lançamento podem ser detectadas usando a macro <link href="
"\"http://www.gnu.org/software/autoconf-archive/ax_is_release.html"
"\"><code>AX_IS_RELEASE</code></link>, podendo o seu resultado ser passado "
"diretamente para <code>AX_COMPILER_FLAGS</code>:"

#. (itstool) path: section/code
#: C/tooling.page:157
#, no-wrap
msgid ""
"AX_IS_RELEASE([git])\n"
"AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS],[$ax_is_release])"
msgstr ""
"AX_IS_RELEASE([git])\n"
"AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS],[$ax_is_release])"

#. (itstool) path: section/p
#: C/tooling.page:160
msgid ""
"The choice of release stability policy (the first argument to "
"<code>AX_IS_RELEASE</code>) should be made per project, taking the project’s "
"<link xref=\"versioning\">versioning stability</link> into account."
msgstr ""
"A escolha de política de estabilidade de lançamento (o primeiro argumento "
"para <code>AX_IS_RELEASE</code>) deve ser feita por projeto, levando em "
"consideração a <link xref=\"versioning\">estabilidade de versionamento</"
"link> do projeto."

#. (itstool) path: section/title
#: C/tooling.page:169
msgid "GDB"
msgstr "GDB"

#. (itstool) path: section/p
#: C/tooling.page:171
msgid ""
"GDB is the standard debugger for C on Linux. Its most common uses are for "
"debugging crashes, and for stepping through code as it executes. A full "
"tutorial for using GDB is given <link href=\"https://sourceware.org/gdb/"
"current/onlinedocs/gdb/\"> here</link>."
msgstr ""
"GDB é o depurador padrão para C no Linux. Seu uso mais comum é para depurar "
"travamentos, e para analisar o código enquanto ele é executado. Um tutorial "
"completo para usar GDB é fornecido <link href=\"https://sourceware.org/gdb/"
"current/onlinedocs/gdb/\"> aqui</link>."

#. (itstool) path: section/p
#: C/tooling.page:179
msgid ""
"To run GDB on a program from within the source tree, use: <cmd>libtool exec "
"gdb --args <var>./program-name</var> <var>--some --arguments --here</var></"
"cmd>"
msgstr ""
"Para executar GDB em um programa dentro da árvore fonte, use <cmd>libtool "
"exec gdb --args <var>./nome-do-programa</var> <var>--alguns --argumentos --"
"aqui</var></cmd>"

#. (itstool) path: section/p
#: C/tooling.page:184
msgid ""
"This is necessary due to libtool wrapping each compiled binary in the source "
"tree in a shell script which sets up some libtool variables. It is not "
"necessary for debugging installed executables."
msgstr ""
"Isso é necessário porque o libtool interfaceia cada binário compilado na "
"árvore fonte em um script shell que define algumas variáveis libtool. Não é "
"necessário para depurar executáveis instalados."

#. (itstool) path: section/p
#: C/tooling.page:190
msgid ""
"GDB has many advanced features which can be combined to essentially create "
"small debugging scripts, triggered by different breakpoints in code. "
"Sometimes this is a useful approach (for example, for <link href=\"https://"
"tecnocode.co.uk/2010/07/12/reference-count-debugging-with-gdb/\"> reference "
"count debugging</link>), but sometimes simply using <link href=\"https://"
"developer.gnome.org/glib/stable/glib-Message-Logging.html#g-debug\"> "
"<code>g_debug()</code></link> to output a debug message is simpler."
msgstr ""
"GDB possui muitos recursos avançados que podem ser combinados para "
"essencialmente criar pequenos scripts de depuração, ativados por diferentes "
"pontos de interrupção no código. Algumas vezes, essa é uma abordagem útil "
"(para <link href=\"https://tecnocode.co.uk/2010/07/12/reference-count-"
"debugging-with-gdb/\">depuração de contagem de referência</link>), mas "
"outras vezes simplesmente usar <link href=\"https://developer.gnome.org/glib/"
"stable/glib-Message-Logging.html#g-debug\"> <code>g_debug()</code></link> "
"para emitir uma mensagem de depuração é mais simples."

#. (itstool) path: section/title
#: C/tooling.page:202
msgid "Valgrind"
msgstr "Valgrind"

#. (itstool) path: section/p
#: C/tooling.page:204
msgid ""
"Valgrind is a suite of tools for instrumenting and profiling programs. Its "
"most famous tool is <link xref=\"#memcheck\">memcheck</link>, but it has "
"several other powerful and useful tools too. They are covered separately in "
"the sections below."
msgstr ""
"Valgrind é uma suíte de ferramentas para instrumentar e perfilar programas. "
"Sua ferramenta mais famosa é o <link xref=\"#memcheck\">memcheck</link>, mas "
"há, no Valgrind, também várias outras ferramentas poderosas e úteis. Elas "
"são cobertas separadamente nas seções a seguir."

#. (itstool) path: section/p
#: C/tooling.page:211
msgid ""
"A useful way of running Valgrind is to run a program’s unit test suite under "
"Valgrind, setting Valgrind to return a status code indicating the number of "
"errors it encountered. When run as part of <cmd>make check</cmd>, this will "
"cause the checks to succeed if Valgrind finds no problems, and fail "
"otherwise. However, running <cmd>make check</cmd> under Valgrind is not "
"trivial to do on the command line. A macro, <link href=\"http://www.gnu.org/"
"software/autoconf-archive/ax_valgrind_check.html\"> <code>AX_VALGRIND_CHECK</"
"code></link> can be used which adds a new <cmd>make check-valgrind</cmd> "
"target to automate this. To use it:"
msgstr ""
"Uma forma útil de executar Valgrind é executar uma suíte de teste de unidade "
"do programa sob Valgrind, configurando-o para retornar um código de status "
"indicando o número de erros que ele encontrou. Quando executado como parte "
"de <cmd>make check</cmd>, isso fará com que as verificações tenham sucesso "
"se Valgrind encontrar nenhum problema; do contrário, falhará. Porém, "
"executar <cmd>make check</cmd> sob Valgrind não é algo trivial de se fazer "
"na linha de comando. Uma macro, <link href=\"http://www.gnu.org/software/"
"autoconf-archive/ax_valgrind_check.html\"> <code>AX_VALGRIND_CHECK</code></"
"link> pode ser usada para adicionar um novo alvo <cmd>make check-valgrind</"
"cmd> para automatizar isso. Para usá-lo:"

#. (itstool) path: item/p
#: C/tooling.page:224
msgid ""
"Copy <link href=\"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;"
"a=blob_plain;f=m4/ax_valgrind_check.m4\"> <file>ax_valgrind_check.m4</file></"
"link> to the <file>m4/</file> directory of your project."
msgstr ""
"Copie <link href=\"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive."
"git;a=blob_plain;f=m4/ax_valgrind_check.m4\"> <file>ax_valgrind_check.m4</"
"file></link> para o diretório <file>m4/</file> de seu projeto."

#. (itstool) path: item/p
#: C/tooling.page:230
msgid "Add <code>AX_VALGRIND_CHECK</code> to <file>configure.ac</file>."
msgstr ""
"Adicione <code>AX_VALGRIND_CHECK</code> para <file>configure.ac</file>."

#. (itstool) path: item/p
#: C/tooling.page:233
msgid ""
"Add <code>@VALGRIND_CHECK_RULES@</code> to the <file>Makefile.am</file> in "
"each directory which contains unit tests."
msgstr ""
"Adicione <code>@VALGRIND_CHECK_RULES@</code> para o <file>Makefile.am</file> "
"em cada diretório que contém testes de unidade."

#. (itstool) path: section/p
#: C/tooling.page:239
msgid ""
"When <cmd>make check-valgrind</cmd> is run, it will save its results in "
"<file>test-suite-*.log</file>, one log file per tool. Note that you will "
"need to run it from the directory containing the unit tests."
msgstr ""
"Quando <cmd>make check-valgrind</cmd> é executado, ele salva seus resultados "
"em <file>test-suite-*.log</file>, um arquivo de registro por ferramenta. "
"Note que você precisará executá-lo a partir de um diretório contendo os "
"testes de unidade."

#. (itstool) path: section/p
#: C/tooling.page:251
msgid ""
"Valgrind has a way to suppress false positives, by using <link href=\"http://"
"valgrind.org/docs/manual/manual-core.html#manual-core.suppress\"> "
"suppression files</link>. These list patterns which may match error stack "
"traces. If a stack trace from an error matches part of a suppression entry, "
"it is not reported. For various reasons, GLib currently causes a number of "
"false positives in <link xref=\"#memcheck\">memcheck</link> and <link xref="
"\"#helgrind-and-drd\">helgrind and drd</link> which must be suppressed by "
"default for Valgrind to be useful. For this reason, every project should use "
"a standard GLib suppression file as well as a project specific one."
msgstr ""
"Valgrind possui uma forma de suprimir falsos positivos, usando <link href="
"\"http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress"
"\">arquivos de supressão</link>. Estes listam padrões que pode corresponder "
"a rastros de pilhas de erros. Se um rastro de pilha de um erro corresponde a "
"parte de uma entrada de supressão, ele não é relatado. Por vários motivos, "
"GLib atualmente causa vários falsos positivos no <link xref=\"#memcheck"
"\">memcheck</link> e <link xref=\"#helgrind-and-drd\">helgrind e drd</link>, "
"o que deve ser suprimido por padrão para Valgrind ser útil. Por este motivo, "
"todo projeto deve usar um arquivo de supressão padrão de GLib, bem como um "
"específico do projeto."

#. (itstool) path: section/p
#: C/tooling.page:264
msgid ""
"Suppression files are supported by the <code>AX_VALGRIND_CHECK</code> macro:"
msgstr ""
"Há suporte a arquivos de supressão na macro <code>AX_VALGRIND_CHECK</code>:"

#. (itstool) path: section/code
#: C/tooling.page:268
#, no-wrap
msgid ""
"@VALGRIND_CHECK_RULES@\n"
"VALGRIND_SUPPRESSIONS_FILES = my-project.supp glib.supp\n"
"EXTRA_DIST = $(VALGRIND_SUPPRESSIONS_FILES)"
msgstr ""
"@VALGRIND_CHECK_RULES@\n"
"VALGRIND_SUPPRESSIONS_FILES = meu-projeto.supp glib.supp\n"
"EXTRA_DIST = $(VALGRIND_SUPPRESSIONS_FILES)"

#. (itstool) path: section/title
#: C/tooling.page:273
msgid "memcheck"
msgstr "memcheck"

#. (itstool) path: section/p
#: C/tooling.page:275
msgid ""
"memcheck is a memory usage and allocation analyzer. It detects problems with "
"memory accesses and modifications of the heap (allocations and frees). It is "
"a highly robust and mature tool, and its output can be entirely trusted. If "
"it says there is ‘definitely’ a memory leak, there is definitely a memory "
"leak which should be fixed. If it says there is ‘potentially’ a memory leak, "
"there may be a leak to be fixed, or it may be memory allocated at "
"initialization time and used throughout the life of the program without "
"needing to be freed."
msgstr ""
"O memcheck é um analisador de uso e alocação de memória. Ele detecta "
"problemas com acessos e modificações de memória da heap (alocações e "
"liberações). É uma ferramenta altamente robusta e madura, e sua saída pode "
"ser totalmente confiada. Se ele diz que “definitely” é um vazamento de "
"memória, definitivamente há um vazamento de memória que deve ser corrigido. "
"Se ele diz que “potentially” é um vazamento de memória, pode haver um "
"vazamento a ser corrigido, ou pode ser uma memória alocada em tempo de "
"inicialização e usada ao longo da vida do programa sem precisar ser liberada."

#. (itstool) path: section/p
#: C/tooling.page:286
msgid "To run memcheck manually on an installed program, use:"
msgstr "Para executar memcheck manualmente em um programa instalado, use:"

#. (itstool) path: section/p
#: C/tooling.page:289
msgid ""
"<cmd>valgrind --tool=memcheck --leak-check=full <var>my-program-name</var></"
"cmd>"
msgstr ""
"<cmd>valgrind --tool=memcheck --leak-check=full <var>nome-do-meu-programa</"
"var></cmd>"

#. (itstool) path: section/p
#: C/tooling.page:293
msgid ""
"Or, if running your program from the source directory, use the following to "
"avoid running leak checking on the libtool helper scripts:"
msgstr ""
"Ou, se está executando seu programa a partir do diretório fonte, use o "
"seguinte para evitar a execução de verificação de vazamento em scripts "
"auxiliares do libtool:"

#. (itstool) path: section/p
#: C/tooling.page:297
msgid ""
"<cmd>libtool exec valgrind --tool=memcheck --leak-check=full <var>./my-"
"program-name</var></cmd>"
msgstr ""
"<cmd>libtool exec valgrind --tool=memcheck --leak-check=full <var>./nome-do-"
"meu-programa</var></cmd>"

#. (itstool) path: section/p
#: C/tooling.page:301
msgid ""
"Valgrind lists each memory problem it detects, along with a short backtrace "
"(if you’ve compiled your program with debug symbols), allowing the cause of "
"the memory error to be pinpointed and fixed."
msgstr ""
"Valgrind lista cada problema de memória que ele detecta, junto com um rastro "
"curto (se você compilou seu programa com símbolos de depuração), permitindo "
"que a causa do erro de memória seja apontada e corrigida."

#. (itstool) path: section/p
#: C/tooling.page:307
msgid ""
"A full tutorial on using memcheck is <link href=\"http://valgrind.org/docs/"
"manual/mc-manual.html\">here</link>."
msgstr ""
"Um tutorial completo sobre uso do memcheck está <link href=\"http://valgrind."
"org/docs/manual/mc-manual.html\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:314
msgid "cachegrind and KCacheGrind"
msgstr "cachegrind e KCacheGrind"

#. (itstool) path: section/p
#: C/tooling.page:316
msgid ""
"cachegrind is a cache performance profiler which can also measure "
"instruction execution, and hence is very useful for profiling general "
"performance of a program. <link href=\"http://kcachegrind.sourceforge.net/"
"html/Home.html\"> KCacheGrind</link> is a useful UI for it which allows "
"visualization and exploration of the profiling data, and the two tools "
"should rarely be used separately."
msgstr ""
"cachegrind é um perfilador de desempenho do cache que também pode medir a "
"execução de uma instrução e, portanto, é muito útil para perfilar desempenho "
"em geral de um programa. <link href=\"http://kcachegrind.sourceforge.net/"
"html/Home.html\"> KCacheGrind</link> é uma interface gráfica útil para isso "
"que permite visualização e exploração de dados de perfil, e as ferramentas "
"raramente devem ser usados separadamente."

#. (itstool) path: section/p
#: C/tooling.page:326
msgid ""
"cachegrind works by simulating the processor’s memory hierarchy, so there "
"are situations where it is <link href=\"http://valgrind.org/docs/manual/cg-"
"manual.html#cg-manual.annopts.accuracy\"> not perfectly accurate</link>. "
"However, its results are always representative enough to be very useful in "
"debugging performance hotspots."
msgstr ""
"cachegrind funciona simulando a hierarquia de memória do processador, de "
"forma que há situações em que <link href=\"http://valgrind.org/docs/manual/"
"cg-manual.html#cg-manual.annopts.accuracy\">não é perfeitamente acurado</"
"link>. Porém, seu resultado é sempre suficientemente representativo para ser "
"muito útil em depurar pontos de desempenho."

#. (itstool) path: section/p
#: C/tooling.page:335
msgid ""
"A full tutorial on using cachegrind is <link href=\"http://valgrind.org/docs/"
"manual/cg-manual.html\">here</link>."
msgstr ""
"Um tutorial completo sobre uso do cachegrind está <link href=\"http://"
"valgrind.org/docs/manual/cg-manual.html\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:342
msgid "helgrind and drd"
msgstr "helgrind e drd"

#. (itstool) path: section/p
#: C/tooling.page:344
msgid ""
"helgrind and drd are threading error detectors, checking for race conditions "
"in memory accesses, and abuses of the <link href=\"http://pubs.opengroup.org/"
"onlinepubs/9699919799/basedefs/pthread.h.html\"> POSIX pthreads API</link>. "
"They are similar tools, but are implemented using different techniques, so "
"both should be used."
msgstr ""
"helgrind e drd são detectores de erro em threads, verificações de condições "
"de corrida em acessos de memória e abusos do <link href=\"http://pubs."
"opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html\">API pthredas "
"do POSIX</link>. Elas são ferramentas similares, mas são implementadas "
"usando técnicas diferentes, de forma que ambas deveriam ser usadas."

#. (itstool) path: section/p
#: C/tooling.page:352
msgid ""
"The kinds of errors detected by helgrind and drd are: data accessed from "
"multiple threads without consistent locking, changes in lock acquisition "
"order, freeing a mutex while it is locked, locking a locked mutex, unlocking "
"an unlocked mutex, and several other errors. Each error, when detected, is "
"printed to the console in a little report, with a separate report giving the "
"allocation or spawning details of the mutexes or threads involved so that "
"their definitions can be found."
msgstr ""
"Os tipos de erros detectados pelo helgrind e drd são: dados acessados por "
"múltiplas threads sem travamento consistente, alterações na ordem de "
"aquisição de trava, liberação um mutex enquanto ele está travado, travamento "
"de um mutex travado, destravamento de um mutex destravado e vários outros "
"erros. Cada erro, quando detectado, é emitido para o console em um pequeno "
"relatório, com um relatório separado fornecendo os detalhes de alocação ou "
"criação de mutexes ou threads envolvidos, de forma que suas definições podem "
"ser localizadas."

#. (itstool) path: section/p
#: C/tooling.page:362
msgid ""
"helgrind and drd can produce more false positives than memcheck or "
"cachegrind, so their output should be studied a little more carefully. "
"However, threading problems are notoriously elusive even to experienced "
"programmers, so helgrind and drd errors should not be dismissed lightly."
msgstr ""
"helgrind e drd podem produzir mais falsos positivos que memcheck ou "
"cachegrind, de forma que suas saídas podem ser estudadas com um pouco de "
"cuidado. Porém, problemas em threads são notoriamente elusivos mesmo para "
"programadores mais experientes, de forma que erros de helgrind e drd não "
"devem ser desconsiderados."

#. (itstool) path: section/p
#: C/tooling.page:369
msgid ""
"Full tutorials on using helgrind and drd are <link href=\"http://valgrind."
"org/docs/manual/hg-manual.html\">here</link> and <link href=\"http://"
"valgrind.org/docs/manual/drd-manual.html\"> here</link>."
msgstr ""
"Tutorias completos sobre usar helgrind e drd estão <link href=\"http://"
"valgrind.org/docs/manual/hg-manual.html\">aqui</link> e <link href=\"http://"
"valgrind.org/docs/manual/drd-manual.html\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:378
msgid "sgcheck"
msgstr "sgcheck"

#. (itstool) path: section/p
#: C/tooling.page:380
msgid ""
"sgcheck is an array bounds checker, which detects accesses to arrays which "
"have overstepped the length of the array. However, it is a very young tool, "
"still marked as experimental, and hence may produce more false positives "
"than other tools."
msgstr ""
"sgcheck é um verificador de limites de vetor que detecta acessos a vetores "
"que podem ter ultrapassados o tamanho do vetor. Porém, é uma ferramenta "
"muito jovem, ainda marcada como experimental e, portanto, pode produzir "
"muitos mais falsos positivos que outras ferramentas."

#. (itstool) path: section/p
#: C/tooling.page:387
msgid ""
"As it is experimental, sgcheck must be run by passing <cmd>--tool=exp-"
"sgcheck</cmd> to Valgrind, rather than <cmd>--tool=sgcheck</cmd>."
msgstr ""
"Por ser experimental, sgcheck deve ser executado passando <cmd>--tool=exp-"
"sgcheck</cmd> para o Valgrind, em vez de <cmd>--tool=sgcheck</cmd>."

#. (itstool) path: section/p
#: C/tooling.page:393
msgid ""
"A full tutorial on using sgcheck is <link href=\"http://valgrind.org/docs/"
"manual/sg-manual.html\">here</link>."
msgstr ""
"Um tutorial completo sobre uso do sgcheck está <link href=\"http://valgrind."
"org/docs/manual/sg-manual.html\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:401
msgid "gcov and lcov"
msgstr "gcov e lcov"

#. (itstool) path: section/p
#: C/tooling.page:403
msgid ""
"<link href=\"https://gcc.gnu.org/onlinedocs/gcc/Gcov.html\">gcov</link> is a "
"profiling tool built into GCC, which instruments code by adding extra "
"instructions at compile time. When the program is run, this code generates "
"<file>.gcda</file> and <file>.gcno</file> profiling output files. These "
"files can be analyzed by the <cmd>lcov</cmd> tool, which generates visual "
"reports of code coverage at runtime, highlighting lines of code in the "
"project which are run more than others."
msgstr ""
"<link href=\"https://gcc.gnu.org/onlinedocs/gcc/Gcov.html\">gcov</link> é "
"uma ferramenta de perfilamento construída em GCC que instrumenta código "
"adicionando instruções extras em tempo de compilação. Quando o programa é "
"executado, esse código gera os arquivos de saída de perfilamento <file>."
"gcda</file> e <file>.gcno</file>. Esses arquivos podem ser analisados pela "
"ferramenta <cmd>lcov</cmd>, que gera relatórios visuais de cobertura de "
"código em tempo de execução, linhas destacadas de código no projeto que "
"executa mais do que outros."

#. (itstool) path: section/p
#: C/tooling.page:413
msgid ""
"A critical use for this code coverage data collection is when running the "
"unit tests: if the amount of code covered (for example, which particular "
"lines were run) by the unit tests is known, it can be used to guide further "
"expansion of the unit tests. By regularly checking the code coverage "
"attained by the unit tests, and expanding them towards 100%, you can be sure "
"that the entire project is being tested. Often it is the case that a unit "
"test exercises most of the code, but not a particular control flow path, "
"which then harbours residual bugs."
msgstr ""
"Um uso crítico para essa coleção de dados de cobertura de código é quando se "
"está executando testes de unidade: se a quantidade de código coberto (por "
"exemplo, quais linhas em particular foram executadas) pelos testes de "
"unidade é conhecida, ela pode ser usado para guiar expansões posteriores de "
"testes de unidade. Ao verificar regularmente a cobertura de código atingido "
"pelos testes de unidade e expandindo-os para 100%, você pode se certificar "
"de que todo o projeto está sendo testado. Frequentemente é o caso de que um "
"teste de unidade exercita a maioria do código, mas não um caminho de fluxo "
"de controle em particular, o qual acaba por abrigar erros residuais."

#. (itstool) path: section/p
#: C/tooling.page:424
msgid ""
"lcov supports <link href=\"http://en.wikipedia.org/wiki/"
"Code_coverage#Basic_coverage_criteria\"> branch coverage measurement</link>, "
"so is not suitable for demonstrating coverage of safety critical code. It is "
"perfectly suitable for non-safety critical code."
msgstr ""
"lcov oferece suporte a <link href=\"http://en.wikipedia.org/wiki/"
"Code_coverage#Basic_coverage_criteria\">medida de cobertura de ramo</link>, "
"de forma que é seja adequado para demonstrar cobertura de código crítico de "
"segurança. É perfeitamente adequado para código crítico que não seja de "
"segurança."

#. (itstool) path: section/p
#: C/tooling.page:432
msgid ""
"As code coverage has to be enabled at both compile time and run time, a "
"macro is provided to make things simpler. The <link href=\"http://www.gnu."
"org/software/autoconf-archive/ax_code_coverage.html\"> "
"<code>AX_CODE_COVERAGE</code></link> macro adds a <cmd>make check-code-"
"coverage</cmd> target to the build system, which runs the unit tests with "
"code coverage enabled, and generates a report using <cmd>lcov</cmd>."
msgstr ""
"Como a cobertura de código tem que estar habilitada em ambos tempo de "
"compilação de execução, uma macro é fornecida para simplificar as coisas. A "
"macro <link href=\"http://www.gnu.org/software/autoconf-archive/"
"ax_code_coverage.html\"> <code>AX_CODE_COVERAGE</code></link> adiciona um "
"alvo de <cmd>make check-code-coverage</cmd> ao sistema de compilação, o qual "
"executa os testes de unidade com cobertura de código habilitada e gera um "
"relatório usando <cmd>lcov</cmd>."

#. (itstool) path: section/p
#: C/tooling.page:442
msgid "To add <code>AX_CODE_COVERAGE</code> support to a project:"
msgstr "Para adicionar suporte ao <code>AX_CODE_COVERAGE</code> a um projeto:"

#. (itstool) path: item/p
#: C/tooling.page:446
msgid ""
"Copy <link href=\"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;"
"a=blob_plain;f=m4/ax_code_coverage.m4\"> <file>ax_code_coverage.m4</file></"
"link> to the <file>m4/</file> directory of your project."
msgstr ""
"Copie <link href=\"http://git.savannah.gnu.org/gitweb/?p=autoconf-archive."
"git;a=blob_plain;f=m4/ax_code_coverage.m4\"> <file>ax_code_coverage.m4</"
"file></link> para o diretório <file>m4/</file> de seu projeto."

#. (itstool) path: item/p
#: C/tooling.page:452
msgid "Add <code>AX_CODE_COVERAGE</code> to <file>configure.ac</file>."
msgstr "Adicione <code>AX_CODE_COVERAGE</code> para <file>configure.ac</file>."

#. (itstool) path: item/p
#: C/tooling.page:455
msgid ""
"Add <code>@CODE_COVERAGE_RULES</code> to the top-level <file>Makefile.am</"
"file>."
msgstr ""
"Adicione <code>@CODE_COVERAGE_RULES</code> ao <file>Makefile.am</file> de "
"topo de nível."

#. (itstool) path: item/p
#: C/tooling.page:459
msgid ""
"Add <code>$(CODE_COVERAGE_CFLAGS)</code> to the automake <code><var>*</"
"var>_CFLAGS</code> variable for each target you want coverage for, for "
"example for all libraries but no unit test code. Do the same for <code>"
"$(CODE_COVERAGE_LDFLAGS)</code> and <code><var>*</var>_LDFLAGS</code>."
msgstr ""
"Adicione <code>$(CODE_COVERAGE_CFLAGS)</code> às variáveis <code><var>*</"
"var>_CFLAGS</code> do automake para cada alvo ao qual você deseja cobertura, "
"por exemplo para todas bibliotecas com nenhum código de teste de unidade. "
"Faça o mesmo para <code>$(CODE_COVERAGE_LDFLAGS)</code> e <code><var>*</"
"var>_LDFLAGS</code>."

#. (itstool) path: section/p
#: C/tooling.page:468
msgid ""
"Documentation on using gcov and lcov is <link href=\"http://ltp.sourceforge."
"net/coverage/lcov.php\">here</link>."
msgstr ""
"A documentação sobre o uso de gcov e lcov está <link href=\"http://ltp."
"sourceforge.net/coverage/lcov.php\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:475
msgid "Address, Thread and Undefined Behavior Sanitizers"
msgstr "Sanitizadores de endereço, thread e comportamentos indefinidos"

#. (itstool) path: section/p
#: C/tooling.page:477
msgid ""
"GCC and Clang both support several sanitizers: sets of extra code and checks "
"which can be optionally compiled in to an application and used to flag "
"various incorrect behaviors at runtime. They are powerful tools, but have to "
"be enabled specially, recompiling your application to enable and disable "
"them. They cannot be enabled at the same time as each other, or used at the "
"same time as <link xref=\"#valgrind\">Valgrind</link>. They are still young, "
"so have little integration with other tooling."
msgstr ""
"GCC e Clang oferecem suporte a vários sanitizadores: conjuntos de código "
"extra e verificações que opcionalmente podem ser compilados nele para um "
"aplicativo e usado para sinalizar vários comportamentos incorretos em tempo "
"de execução. Elas são ferramentas poderosas, mas em especial têm que estar "
"habilitadas, recompilando seu aplicativo para habilitá-los e desabilitá-los. "
"Eles não podem estar habilitados ao mesmo tempo que um ao outro, ou usado ao "
"mesmo tempo que <link xref=\"#valgrind\">Valgrind</link>. Eles ainda estão "
"jovens, então possuem pouca integração com outras ferramentarias."

#. (itstool) path: section/p
#: C/tooling.page:487
msgid ""
"All sanitizers are available for both GCC and Clang, accepting the same set "
"of compiler options."
msgstr ""
"Todos os sanitizadores estão disponíveis para GCC e Clang, aceitando o mesmo "
"conjunto de opções de compilador."

#. (itstool) path: section/title
#: C/tooling.page:500
msgid "Address Sanitizer"
msgstr "Sanitizador de endereço"

#. (itstool) path: section/p
#: C/tooling.page:502
msgid ""
"The <link href=\"https://code.google.com/p/address-sanitizer/\">address "
"sanitizer</link> (‘asan’) detects use-after-free and buffer overflow bugs in "
"C and C++ programs. A full tutorial on using asan is <link href=\"http://"
"clang.llvm.org/docs/AddressSanitizer.html#usage\">available for Clang</link> "
"— the same instructions should work for GCC."
msgstr ""
"Também conhecido como “<link href=\"https://code.google.com/p/address-"
"sanitizer/\">address sanitizer</link>” (“asan”), ele detecta erros de uso-"
"após-liberação e estouro de buffer em programas C e C++. Um tutorial "
"completo sobre o uso de asan está <link href=\"http://clang.llvm.org/docs/"
"AddressSanitizer.html#usage\">disponível para Clang</link> — as mesmas "
"instruções devem funcionar para GCC."

#. (itstool) path: section/title
#: C/tooling.page:512
msgid "Thread Sanitizer"
msgstr "Sanitizador de thread"

#. (itstool) path: section/p
#: C/tooling.page:514
msgid ""
"The <link href=\"https://code.google.com/p/thread-sanitizer/\">thread "
"sanitizer</link> (‘tsan’) detects data races on memory locations, plus a "
"variety of invalid uses of POSIX threading APIs. A full tutorial on using "
"tsan is <link href=\"http://clang.llvm.org/docs/ThreadSanitizer.html#usage"
"\">available for Clang</link> — the same instructions should work for GCC."
msgstr ""
"Também chamado de “<link href=\"https://code.google.com/p/thread-sanitizer/"
"\">thread sanitizer</link>” (“tsan”), ele detecta corridas de dados em "
"localizações de memória, além de uma variedade de usos inválidos de APIs de "
"thread do POSIX. Um tutorial completo sobre o uso de tsan está <link href="
"\"http://clang.llvm.org/docs/ThreadSanitizer.html#usage\">disponível para "
"Clang</link> — as mesmas instruções devem funcionar para GCC."

#. (itstool) path: section/title
#: C/tooling.page:525
msgid "Undefined Behavior Sanitizer"
msgstr "Sanitizador de comportamento indefinido"

#. (itstool) path: section/p
#: C/tooling.page:527
msgid ""
"The undefined behavior sanitizer (‘ubsan’) is a collection of smaller "
"instrumentations which detect various potentially undefined behaviors in C "
"programs. A set of instructions for enabling ubsan is <link href=\"http://"
"clang.llvm.org/docs/UsersManual.html#controlling-code-generation\">available "
"for Clang</link> — the same instructions should work for GCC."
msgstr ""
"Também chamado de “undefined behavior sanitizer” (“ubsan”), ele é uma "
"coleção de instrumentações menores que detectam vários comportamentos "
"indefinidos em potencial em programas C. Um conjunto de instruções para "
"habilitar ubsan está <link href=\"http://clang.llvm.org/docs/UsersManual."
"html#controlling-code-generation\">disponível para Clang</link> — as mesmas "
"instruções devem funcionar para o GCC."

#. (itstool) path: section/title
#: C/tooling.page:538
msgid "Coverity"
msgstr "Coverity"

#. (itstool) path: section/p
#: C/tooling.page:540
msgid ""
"<link href=\"http://scan.coverity.com/\">Coverity</link> is one of the most "
"popular and biggest commercial static analyzer tools available. However, it "
"is available to use free for Open Source projects, and any project is "
"encouraged to <link href=\"https://scan.coverity.com/users/sign_up\">sign "
"up</link>. <link href=\"https://scan.coverity.com/faq#how-get-project-"
"included-in-scan\"> Analysis is performed</link> by running some analysis "
"tools locally, then uploading the source code and results as a tarball to "
"Coverity’s site. The results are then visible online to members of the "
"project, as annotations on the project’s source code (similarly to how lcov "
"presents its results)."
msgstr ""
"<link href=\"http://scan.coverity.com/\">Coverity</link> é uma das maiores e "
"mais populares ferramentas comerciais de análise estática disponível. Porém, "
"está disponível para uso para projetos de código aberto e qualquer projeto é "
"encorajado a <link href=\"https://scan.coverity.com/users/sign_up\">se "
"inscrever</link>. A <link href=\"https://scan.coverity.com/faq#how-get-"
"project-included-in-scan\"> análise é realizada</link> executando algumas "
"ferramentas de análise localmente e, então, enviando o código-fonte e "
"resultados como um tarball para o site do Coverity. Os resultados ficam, "
"então, visíveis online para todos os membros do projeto, como anotações do "
"código-fonte do projeto (similarmente a como lconv apresenta seus "
"resultados)."

#. (itstool) path: section/p
#: C/tooling.page:553
msgid ""
"As Coverity cannot be run entirely locally, it cannot be integrated properly "
"into the build system. However, scripts do exist to automatically scan a "
"project and upload the tarball to Coverity regularly. The recommended "
"approach is to run these scripts regularly on a server (typically as a "
"cronjob), using a clean checkout of the project’s git repository. Coverity "
"automatically e-mails project members about new static analysis problems it "
"finds, so the same approach as for <link xref=\"#gcc-and-clang\">compiler "
"warnings</link> can be taken: eliminate all the static analysis warnings, "
"then eliminate new ones as they are detected."
msgstr ""
"Como o Coverity não pode ser executado inteiramente localmente, ele não pode "
"ser integrado apropriadamente no sistema de compilação. Porém, scripts "
"existem para varrer automaticamente um projeto e enviar o tarball "
"periodicamente para Coverity. A abordagem recomendada é executar esses "
"scripts periodicamente em um servidor (geralmente como um cronjob), usando "
"um checkout limpo do repositório git do projeto. Coverity automaticamente "
"envia e-mail para membros do projeto sobre novos problemas na análise "
"estática que forem encontrados, de forma que a mesma abordagem que os <link "
"xref=\"#gcc-and-clang\">avisos de compilador</link> possam ser levados: "
"elmitar todos os avisos de análise estática "

#. (itstool) path: section/p
#: C/tooling.page:566
msgid ""
"Coverity is good, but it is not perfect, and it does produce a number of "
"false positives. These should be marked as ignored in the online interface."
msgstr ""
"Coverity é bom, mas não é perfeito e produz um número de falsos positivos. "
"Esses devem ser marcados como ignorados na interface online."

#. (itstool) path: section/title
#: C/tooling.page:574
msgid "Clang Static Analyzer"
msgstr "Analisador estático do Clang"

#. (itstool) path: section/p
#: C/tooling.page:576
msgid ""
"One tool which can be used to perform static analysis locally is the <link "
"href=\"http://clang-analyzer.llvm.org/\">Clang static analyzer</link>, which "
"is a tool co-developed with the <link xref=\"#gcc-and-clang\">Clang "
"compiler</link>. It detects a variety of problems in C code which compilers "
"cannot, and which would otherwise only be detectable at run time (using unit "
"tests)."
msgstr ""
"Uma ferramenta que pode ser usada para realizar análise estática localmente "
"é o <link href=\"http://clang-analyzer.llvm.org/\">analisador estático do "
"Clang</link>, que é uma ferramenta co-desenvolvida com o <link xref=\"#gcc-"
"and-clang\">compilador Clang</link>. Ele detecta uma variedade de problemas "
"no código C que compiladores não conseguem, e que, do contrário, seria "
"detectável apenas em tempo de execução (usando testes de unidade)."

#. (itstool) path: section/p
#: C/tooling.page:585
msgid ""
"Clang produces some false positives, and there is no easy way to ignore "
"them. The recommended thing to do is to <link href=\"http://clang-analyzer."
"llvm.org/faq.html#suppress_issue\">file a bug report against the static "
"analyzer</link>, so that the false positive can be fixed in future."
msgstr ""
"Clang produz alguns falsos positivos e não há uma forma fácil de ignorá-los. "
"O recomendado é <link href=\"http://clang-analyzer.llvm.org/faq."
"html#suppress_issue\">preencher um relatório de erro para o analisador "
"estático</link>, de forma que o falso positivo possa ser corrigido no futuro."

#. (itstool) path: section/p
#: C/tooling.page:593
msgid ""
"A full tutorial on using Clang is <link href=\"http://clang-analyzer.llvm."
"org/scan-build.html\">here</link>."
msgstr ""
"Um tutorial completo sobre o uso Clang está <link href=\"http://clang-"
"analyzer.llvm.org/scan-build.html\">aqui</link>."

#. (itstool) path: section/title
#: C/tooling.page:599
msgid "Tartan"
msgstr "Tartan"

#. (itstool) path: section/p
#: C/tooling.page:601
msgid ""
"However, for all the power of the Clang static analyzer, it cannot detect "
"problems with specific libraries, such as GLib. This is a problem if a "
"project uses GLib exclusively, and rarely uses POSIX APIs (which Clang does "
"understand). There is a plugin available for the Clang static analyzer, "
"called <link href=\"http://people.collabora.com/~pwith/tartan/\">Tartan</"
"link>, which extends Clang to support checks against some of the common GLib "
"APIs."
msgstr ""
"Porém, apesar de todos os poderes do analisador estático do Clang, ele não "
"pode detectar problemas com bibliotecas específicas, como o GLib. Isso é um "
"problema, se um projeto usa exclusivamente o GLib, e raramente usa APIs do "
"POSIX (o qual Clang entende). Há um plug-in disponível para o analisador "
"estático do Clang, chamado <link href=\"http://people.collabora.com/~pwith/"
"tartan/\">Tartan</link>, que estende o Clang de forma a oferecer suporte a "
"verificações de algumas das APIs comuns do GLib."

#. (itstool) path: section/p
#: C/tooling.page:612
msgid ""
"Tartan is still young software, and will produce false positives and may "
"crash when run on some code. However, it can find legitimate bugs quite "
"quickly, and is worth running over a code base frequently to detect new "
"errors in the use of GLib in the code. Please <link href=\"http://people."
"collabora.com/~pwith/tartan/#troubleshooting\"> report any problems with "
"Tartan</link>."
msgstr ""
"Tartan ainda é um software jovem, então ele produzirá falsos positivos e "
"pode travar quando executado em algum código. Porém, ele pode localizar "
"erros legítimos bem rapidamente, e compensa executar frequentemente sobre um "
"código base para detectar novos erros no uso do GLib no código. Por favor, "
"<link href=\"http://people.collabora.com/~pwith/tartan/#troubleshooting\"> "
"relate quaisquer problemas com Tartan</link>."

#. (itstool) path: section/p
#: C/tooling.page:621
msgid ""
"A full tutorial on enabling Tartan for use with the Clang static analyzer is "
"<link href=\"http://people.collabora.com/~pwith/tartan/#usage-standalone\"> "
"here</link>. If set up correctly, the output from Tartan will be mixed "
"together with the normal static analyzer output."
msgstr ""
"Um tutorial completo sobre habilitar Tartan para uso com o analisador "
"estático do Clang está <link href=\"http://people.collabora.com/~pwith/"
"tartan/#usage-standalone\"> aqui</link>. Se configurado corretamente, a "
"saída do Tartan será misturada com a saída normal do analisador estático."

#. (itstool) path: info/desc
#: C/unit-testing.page:17
msgid "Designing software to be tested and writing unit tests for it"
msgstr ""
"Projete software para ser testado e escreva testes de unidades para ele"

#. (itstool) path: page/title
#: C/unit-testing.page:20
msgid "Unit Testing"
msgstr "Teste de unidade"

#. (itstool) path: synopsis/p
#: C/unit-testing.page:25
msgid ""
"Unit testing should be the primary method of testing the bulk of code "
"written, because a unit test can be written once and run many times — manual "
"tests have to be planned once and then manually run each time."
msgstr ""
"Teste de unidade deve ser o método principal para testar o conjunto de "
"código escrito porque um teste de unidade pode ser escrito uma vez e "
"executado muitas outras — testes manuais têm que ser planejados uma vez e, "
"então, executado manualmente cada vez."

#. (itstool) path: synopsis/p
#: C/unit-testing.page:31
msgid ""
"Development of unit tests starts with the architecture and API design of the "
"code to be tested: code should be designed to be easily testable, or will "
"potentially be very difficult to test."
msgstr ""
"O desenvolvimento de testes de unidade se inicia com o design de API e "
"arquitetura do código a ser testado: o código deve ser projetado para ser "
"facilmente testável, do contrário provavelmente ele será muito difícil de "
"testar."

#. (itstool) path: item/p
#: C/unit-testing.page:38
msgid ""
"Write unit tests to be as small as possible, but no smaller. (<link xref="
"\"#writing-unit-tests\"/>)"
msgstr ""
"Escreva testes de unidade para serem tão pequenos quanto possível, mas não "
"menores. (<link xref=\"#writing-unit-tests\"/>)"

#. (itstool) path: item/p
#: C/unit-testing.page:42
msgid ""
"Use code coverage tools to write tests to get high code coverage. (<link "
"xref=\"#writing-unit-tests\"/>)"
msgstr ""
"Use ferramentas de cobertura de código para escrever testes para obter alta "
"cobertura de código. (<link xref=\"#writing-unit-tests\"/>)"

#. (itstool) path: item/p
#: C/unit-testing.page:46
msgid ""
"Run all unit tests under Valgrind to check for leaks and other problems. "
"(<link xref=\"#leak-checking\"/>)"
msgstr ""
"Execute todos os testes de unidade sob Valgrind para verificar ocorrências "
"vazamentos e outros problemas. (<link xref=\"#leak-checking\"/>)"

#. (itstool) path: item/p
#: C/unit-testing.page:50
msgid ""
"Use appropriate tools to automatically generate unit tests where possible. "
"(<link xref=\"#test-generation\"/>)"
msgstr ""
"Use as ferramentas apropriadas para automaticamente gerar testes de unidade "
"onde for possível. (<link xref=\"#test-generation\"/>)"

#. (itstool) path: item/p
#: C/unit-testing.page:54
msgid ""
"Design code to be testable from the beginning. (<link xref=\"#writing-"
"testable-code\"/>)"
msgstr ""
"Projete o código para ser testável desde o início. (<link xref=\"#writing-"
"testable-code\"/>)"

#. (itstool) path: section/title
#: C/unit-testing.page:62
msgid "Writing Unit Tests"
msgstr "Escrevendo testes de unidade"

#. (itstool) path: section/p
#: C/unit-testing.page:64
msgid ""
"Unit tests should be written in conjunction with looking at <link xref="
"\"tooling#gcov-and-lcov\">code coverage information gained from running the "
"tests</link>. This typically means writing an initial set of unit tests, "
"running them to get coverage data, then reworking and expanding them to "
"increase the code coverage levels. Coverage should be increased first by "
"ensuring all functions are covered (at least in part), and then by ensuring "
"all lines of code are covered. By covering functions first, API problems "
"which will prevent effective testing can be found quickly. These typically "
"manifest as internal functions which cannot easily be called from unit "
"tests. Overall, coverage levels of over 90% should be aimed for; don’t just "
"test cases covered by project requirements, test everything."
msgstr ""
"Testes de unidade devem ser escritos em conjunto com a análise das <link "
"xref=\"tooling#gcov-and-lcov\">informações de cobertura de código obtidas "
"por executar os testes</link>. Geralmente isso significa escrever um "
"conjunto inicial de testes de unidade, executando-os para obter dados de "
"cobertura e, então, retrabalhar e expandi-los para aumentar os níveis de "
"cobertura de código. A cobertura deve primeiro ser aumentada se certificando "
"de que todas as funções estejam cobertas (pelo menos em parte) e, então, se "
"certificando de que todas as linhas de código estejam cobertas. Ao cobrir as "
"funções primeiro, problemas de API que vão evitar testes efetivos serão "
"localizados rapidamente. Essas geralmente se manifestam como funções "
"internas que não podem ser facilmente chamadas a partir de testes de "
"unidade. Em geral, deve-se ter como meta os níveis de cobertura em cerca de "
"90%; não teste apenas os casos cobertos pelos requerimentos do projeto, "
"teste tudo."

#. (itstool) path: section/p
#: C/unit-testing.page:79
msgid ""
"Like <link xref=\"version-control\">git commits</link>, each unit test "
"should be ‘as small as possible, but no smaller’, testing a single specific "
"API or behavior. Each test case must be able to be run individually, without "
"depending on state from other test cases. This is important to allow "
"debugging of a single failing test, without having to step through all the "
"other test code as well. It also means that a single test failure can easily "
"be traced back to a specific API, rather than a generic ‘unit tests failed "
"somewhere’ message."
msgstr ""
"Assim como <link xref=\"version-control\">git commits</link>, os testes de "
"unidade devem ser “tão pequenos quanto possível, mas não menores”, testando "
"especificamente uma única API ou um único comportamento. Cada caso de teste "
"deve ser capaz de executar individualmente, sem depender do estado de outros "
"casos de teste. Isso é importante para permitir depuração de falha em um "
"teste, sem ter que também passar por todos os outros códigos de teste. Isso "
"significa que a falha de um teste pode ser facilmente rastreada a uma API "
"específica, em vez de uma mensagem genérica “testes de unidade falharam em "
"algum lugar”."

#. (itstool) path: section/p
#: C/unit-testing.page:90
msgid ""
"GLib has support for unit testing with its <link href=\"https://developer."
"gnome.org/glib/stable/glib-Testing.html\">GTest framework</link>, allowing "
"tests to be arranged in groups and hierarchies. This means that groups of "
"related tests can be run together for enhanced debugging too, by running the "
"test binary with the <cmd>-p</cmd> argument: <cmd>./test-suite-name -p /path/"
"to/test/group</cmd>."
msgstr ""
"O GLib oferece suporte a testes de unidade com seu <link href=\""
"https://developer.gnome.org/glib/stable/glib-Testing.html\">framework "
"GTest</link>, permitindo que os testes sejam organizados em grupos e "
"hierarquias. Isso significa que os grupos de testes relacionados podem ser "
"executados juntos para melhorar a depuração também, executando o binário de "
"teste com o argumento <cmd>-p</cmd>: <cmd>./test-suite-nome -p "
"/caminho/para/grupo/de/teste</cmd>."

#. (itstool) path: section/title
#: C/unit-testing.page:101
msgid "Installed Tests"
msgstr "Testes instalados"

#. (itstool) path: section/p
#: C/unit-testing.page:103
msgid ""
"All unit tests should be installed system-wide, following the <link href="
"\"https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests\">installed-"
"tests standard</link>."
msgstr ""
"Todos os testes de unidade devem ser instalados para todo o sistema, "
"seguindo o <link href=\"https://wiki.gnome.org/Initiatives/GnomeGoals/"
"InstalledTests\">padrão de testes instalados</link>."

#. (itstool) path: section/p
#: C/unit-testing.page:109
msgid ""
"By installing the unit tests, continuous integration (CI) is made easier, "
"since tests for one project can be re-run after changes to other projects in "
"the CI environment, thus testing the interfaces between modules. That is "
"useful for a highly-coupled set of projects like GNOME."
msgstr ""
"Ao instalar os testes de unidade, integração contínua (CI) é facilitada, já "
"que os testes para um projeto podem ser reexecutados após alterações em "
"outros projetos no ambiente de CI, de forma a testar as interfaces entre "
"módulos. Isso é útil para um conjunto altamente encaixado de projetos como o "
"GNOME."

#. (itstool) path: section/p
#: C/unit-testing.page:116
msgid ""
"To add support for installed-tests, add the following to <file>configure.ac</"
"file>:"
msgstr ""
"Para adicionar suporte para testes instalados, adicione o seguinte ao "
"<file>configure.ac</file>:"

#. (itstool) path: section/code
#: C/unit-testing.page:120
#, no-wrap
msgid ""
"# Installed tests\n"
"AC_ARG_ENABLE([modular_tests],\n"
"              AS_HELP_STRING([--disable-modular-tests],\n"
"                             [Disable build of test programs (default: no)]),,\n"
"              [enable_modular_tests=yes])\n"
"AC_ARG_ENABLE([installed_tests],\n"
"              AS_HELP_STRING([--enable-installed-tests],\n"
"                             [Install test programs (default: no)]),,\n"
"              [enable_installed_tests=no])\n"
"AM_CONDITIONAL([BUILD_MODULAR_TESTS],\n"
"               [test \"$enable_modular_tests\" = \"yes\" ||\n"
"                test \"$enable_installed_tests\" = \"yes\"])\n"
"AM_CONDITIONAL([BUILDOPT_INSTALL_TESTS],[test \"$enable_installed_tests\" = \"yes\"])"
msgstr ""
"# Testes instalados\n"
"AC_ARG_ENABLE([modular_tests],\n"
"              AS_HELP_STRING([--disable-modular-tests],\n"
"                             [Disable build of test programs (default: "
"no)]),,\n"
"              [enable_modular_tests=yes])\n"
"AC_ARG_ENABLE([installed_tests],\n"
"              AS_HELP_STRING([--enable-installed-tests],\n"
"                             [Install test programs (default: no)]),,\n"
"              [enable_installed_tests=no])\n"
"AM_CONDITIONAL([BUILD_MODULAR_TESTS],\n"
"               [test \"$enable_modular_tests\" = \"yes\" ||\n"
"                test \"$enable_installed_tests\" = \"yes\"])\n"
"AM_CONDITIONAL([BUILDOPT_INSTALL_TESTS],[test \"$enable_installed_tests\" = "
"\"yes\"])"

#. (itstool) path: section/p
#: C/unit-testing.page:134
msgid "Then in <file>tests/Makefile.am</file>:"
msgstr "Então, em <file>tests/Makefile.am</file>:"

#. (itstool) path: section/code
#: C/unit-testing.page:137
#, no-wrap
msgid ""
"insttestdir = $(libexecdir)/installed-tests/[project]\n"
"\n"
"all_test_programs = \\\n"
"\ttest-program1 \\\n"
"\ttest-program2 \\\n"
"\ttest-program3 \\\n"
"\t$(NULL)\n"
"if BUILD_MODULAR_TESTS\n"
"TESTS = $(all_test_programs)\n"
"noinst_PROGRAMS = $(TESTS)\n"
"endif\n"
"\n"
"if BUILDOPT_INSTALL_TESTS\n"
"insttest_PROGRAMS = $(all_test_programs)\n"
"\n"
"testmetadir = $(datadir)/installed-tests/[project]\n"
"testmeta_DATA = $(all_test_programs:=.test)\n"
"\n"
"testdatadir = $(insttestdir)\n"
"testdata_DATA = $(test_files)\n"
"\n"
"testdata_SCRIPTS = $(test_script_files)\n"
"endif\n"
"\n"
"EXTRA_DIST = $(test_files)\n"
"\n"
"%.test: % Makefile\n"
"\t$(AM_V_GEN) (echo '[Test]' &gt; $@.tmp; \\\n"
"\techo 'Type=session' &gt;&gt; $@.tmp; \\\n"
"\techo 'Exec=$(insttestdir)/$&lt;' &gt;&gt; $@.tmp; \\\n"
"\tmv $@.tmp $@)"
msgstr ""
"insttestdir = $(libexecdir)/installed-tests/[project]\n"
"\n"
"all_test_programs = \\\n"
"\ttest-program1 \\\n"
"\ttest-program2 \\\n"
"\ttest-program3 \\\n"
"\t$(NULL)\n"
"if BUILD_MODULAR_TESTS\n"
"TESTS = $(all_test_programs)\n"
"noinst_PROGRAMS = $(TESTS)\n"
"endif\n"
"\n"
"if BUILDOPT_INSTALL_TESTS\n"
"insttest_PROGRAMS = $(all_test_programs)\n"
"\n"
"testmetadir = $(datadir)/installed-tests/[project]\n"
"testmeta_DATA = $(all_test_programs:=.test)\n"
"\n"
"testdatadir = $(insttestdir)\n"
"testdata_DATA = $(test_files)\n"
"\n"
"testdata_SCRIPTS = $(test_script_files)\n"
"endif\n"
"\n"
"EXTRA_DIST = $(test_files)\n"
"\n"
"%.test: % Makefile\n"
"\t$(AM_V_GEN) (echo '[Test]' &gt; $@.tmp; \\\n"
"\techo 'Type=session' &gt;&gt; $@.tmp; \\\n"
"\techo 'Exec=$(insttestdir)/$&lt;' &gt;&gt; $@.tmp; \\\n"
"\tmv $@.tmp $@)"

#. (itstool) path: section/title
#: C/unit-testing.page:171
msgid "Leak Checking"
msgstr "Verificação de vazamento"

#. (itstool) path: section/p
#: C/unit-testing.page:173
msgid ""
"Once unit tests with high code coverage have been written, they can be run "
"under various dynamic analysis tools, such as <link xref=\"tooling#valgrind"
"\">Valgrind</link> to check for leaks, threading errors, allocation "
"problems, etc. across the entire code base. The higher the code coverage of "
"the unit tests, the more confidence the Valgrind results can be treated "
"with. See <link xref=\"tooling\"/> for more information, including build "
"system integration instructions."
msgstr ""
"Assim que os testes de unidade com alta cobertura de código forem escritos, "
"eles podem ser executados sob várias ferramentas de análise dinâmica, tal "
"como <link xref=\"tooling#valgrind\">Valgrind</link> para verificar por "
"vazamentos, erros de threading, problemas de alocação, etc. por toda a base "
"de código. Quanto maior a cobertura de código dos testes unitários, mais "
"confiança haverá nos resultados do Valgrind. Veja <link xref=\"tooling\"/> "
"para mais informações, incluindo instruções sobre integração de sistema de "
"compilação."

#. (itstool) path: section/p
#: C/unit-testing.page:183
msgid ""
"Critically, this means that unit tests should not leak memory or other "
"resources themselves, and similarly should not have any threading problems. "
"Any such problems would effectively be false positives in the analysis of "
"the actual project code. (False positives which need to be fixed by fixing "
"the unit tests.)"
msgstr ""
"Mais importante de tudo é que isso significa que os testes de unidade não "
"devem eles mesmos resultar em vazamento de memória ou de outros recursos e, "
"de forma similar, não devem ter qualquer problemas de threading. Qualquer um "
"desses problemas seria efetivamente um falso positivo na análise do código "
"projeto. (Falsos positivos que precisam ser resolvidos corrigindo os testes "
"de unidade.)"

#. (itstool) path: section/title
#: C/unit-testing.page:193
msgid "Test Generation"
msgstr "Geração de testes"

#. (itstool) path: section/p
#: C/unit-testing.page:195
msgid ""
"Certain types of code are quite repetitive, and require a lot of unit tests "
"to gain good coverage; but are appropriate for <link href=\"http://en."
"wikipedia.org/wiki/Test_data_generation\">test data generation</link>, where "
"a tool is used to automatically generate test vectors for the code. This can "
"drastically reduce the time needed for writing unit tests, for code in these "
"specific domains."
msgstr ""
"Certos tipos de códigos são bem repetitivos e exigem muitos testes de "
"unidade para obter uma boa cobertura de código; mas são apropriados para <"
"link href=\"http://en.wikipedia.org/wiki/Test_data_generation\">geração de "
"dados de teste</link>, na qual uma ferramenta é usada para automaticamente "
"gerar vetores de teste para o código. Isso pode reduzir drasticamente o "
"tempo necessário para escrever testes de unidade, para código nesses domínio "
"em específico."

#. (itstool) path: section/title
#: C/unit-testing.page:205
msgid "JSON"
msgstr "JSON"

#. (itstool) path: section/p
#: C/unit-testing.page:207
msgid ""
"One example of a domain amenable to test data generation is parsing, where "
"the data to be parsed is required to follow a strict schema — this is the "
"case for XML and JSON documents. For JSON, a tool such as <link href="
"\"http://people.collabora.com/~pwith/walbottle/\">Walbottle</link> can be "
"used to generate test vectors for all types of valid and invalid input "
"according to the schema."
msgstr ""
"Um exemplo de um domínio acessível para geração de dados de teste é análise, "
"na qual exige-se que os dados a serem analisados sigam um esquema estrito — "
"esse é o caso para documentos XML e JSON. Para JSON, uma ferramenta como <"
"link href=\"http://people.collabora.com/~pwith/walbottle/\">Walbottle</link> "
"pode ser usado para gerar vetores de teste para todos tipos de entrada "
"válida e inválida de acordo com o esquema."

#. (itstool) path: section/p
#: C/unit-testing.page:216
msgid ""
"Every type of JSON document should have a <link href=\"http://json-schema."
"org/\">JSON Schema</link> defined for it, which can then be passed to "
"Walbottle to generate test vectors:"
msgstr ""
"Todo tipo de documento JSON deve ter um <link href=\"http://json-schema.org/"
"\">JSON Schema</link> definido para ele, que pode então ser passado para "
"Walbottle para gerar vetores de teste:"

#. (itstool) path: section/code
#: C/unit-testing.page:221
#, no-wrap
msgid ""
"\n"
"json-schema-generate --valid-only schema.json\n"
"json-schema-generate --invalid-only schema.json"
msgstr ""
"\n"
"json-schema-generate --valid-only schema.json\n"
"json-schema-generate --invalid-only schema.json"

#. (itstool) path: section/p
#: C/unit-testing.page:225
msgid ""
"These test vectors can then be passed to the code under test in its unit "
"tests. The JSON instances generated by <cmd>--valid-only</cmd> should be "
"accepted; those from <cmd>--invalid-only</cmd> should be rejected."
msgstr ""
"Esses vetores de teste podem, então, ser passados para o código sob teste em "
"seus testes de unidade. As instâncias JSON geradas por <cmd>--valid-"
"only</cmd> deve ser aceita; aqueles de <cmd>--invalid-only</cmd> deve ser "
"rejeitado."

#. (itstool) path: section/title
#: C/unit-testing.page:234
msgid "Writing Testable Code"
msgstr "Escrevendo código testável"

#. (itstool) path: section/p
#: C/unit-testing.page:236
msgid ""
"Code should be written with testability in mind from the design stage, as it "
"affects API design and architecture in fundamental ways. A few key "
"principles:"
msgstr ""
"O código deve ser escrito com testabilidade em mente desde o estágio de "
"design, já que isso afeta o design de API e arquitetura em formas "
"fundamentais. Alguns princípios chaves:"

#. (itstool) path: item/p
#: C/unit-testing.page:242
msgid ""
"Do not use global state. Singleton objects are usually a bad idea as they "
"can’t be instantiated separately or controlled in the unit tests."
msgstr ""
"Não use um estado global. Objetos “sigleton” são geralmente uma má ideia, "
"pois eles não podem ser instanciados separadamente ou controlados nos testes "
"de unidade."

#. (itstool) path: item/p
#: C/unit-testing.page:246
msgid ""
"Separate out use of external state, such as databases, networking, or the "
"file system. The unit tests can then replace the accesses to external state "
"with mocked objects. A common approach to this is to use dependency "
"injection to pass a file system wrapper object to the code under test. For "
"example, a class should not load a global database (from a fixed location in "
"the file system) because the unit tests would then potentially overwrite the "
"running system’s copy of the database, and could never be executed in "
"parallel. They should be passed an object which provides an interface to the "
"database: in a production system, this would be a thin wrapper around the "
"database API; for testing, it would be a mock object which checks the "
"requests given to it and returns hard-coded responses for various tests."
msgstr ""
"Separe o uso de estado externo, tal como banco de dados, conectividade ou "
"sistema de arquivos. Os testes de unidade podem, então, substituir os "
"acessos a estado externo com objetos simulados (mock). Uma abordagem comum a "
"isso é usar injeção de dependência para passar um objeto interfaceador de "
"sistema de arquivos para o código sob teste. Por exemplo, uma classe não "
"deve carregar um banco de dados global (de uma localização fixa no sistema "
"de arquivos) porque os testes de unidade poderiam acabar sobrescrevendo a "
"cópia do sistema em execução do banco de dados, e nunca poderia ser "
"executado em paralelo. A eles deve ser passado um objeto que fornece uma "
"interface para o banco de dados: em um sistema de produção, isso seria um "
"interfaceador magro em volta da API de banco de dados; para teste, seria um "
"objeto simulado que verifica as requisições fornecidas a ele e retorna "
"respostas codificadas para vários testes."

#. (itstool) path: item/p
#: C/unit-testing.page:260
msgid "Expose utility functions where they might be generally useful."
msgstr "Exponha funções utilitárias onde geralmente elas podem ser úteis."

#. (itstool) path: item/p
#: C/unit-testing.page:263
msgid ""
"Split projects up into collections of small, private libraries which are "
"then linked together with a minimal amount of glue code into the overall "
"executable. Each can be tested separately."
msgstr ""
"Divida projetos em coleções de bibliotecas pequenas e privadas, que são "
"então vinculadas com uma quantidade mínima de código colante no executável "
"global."

#. (itstool) path: section/p
#: C/unit-testing.page:274
msgid "The topic of software testability is covered in the following articles:"
msgstr ""
"O tópico de estabilidade de API é coberto nos seguintes artigos (em inglês):"

#. (itstool) path: item/p
#: C/unit-testing.page:278
msgid ""
"<link href=\"http://msdn.microsoft.com/en-us/magazine/dd263069.aspx\">Design "
"for testability</link>"
msgstr ""
"<link href=\"http://msdn.microsoft.com/en-us/magazine/dd263069.aspx\">Design "
"por testabilidade</link>"

#. (itstool) path: item/p
#: C/unit-testing.page:282
msgid ""
"<link href=\"http://en.wikipedia.org/wiki/Software_testability\">Software "
"testability</link>"
msgstr ""
"<link href=\"http://en.wikipedia.org/wiki/Software_testability\">"
"testabilidade de software</link>"

#. (itstool) path: item/p
#: C/unit-testing.page:286
msgid ""
"<link href=\"http://en.wikipedia.org/wiki/Dependency_injection\">Dependency "
"injection</link>"
msgstr ""
"<link href=\"http://en.wikipedia.org/wiki/Dependency_injection\">Injeção de "
"dependência</link>"

#. (itstool) path: item/p
#: C/unit-testing.page:290
msgid ""
"<link href=\"http://c2.com/cgi/wiki?SoftwareDesignForTesting\">Software "
"design for testing</link>"
msgstr ""
"<link href=\"http://c2.com/cgi/wiki?SoftwareDesignForTesting\">Design de "
"software para teste</link>"

#. (itstool) path: info/desc
#: C/version-control.page:17
msgid "Source code version control with git"
msgstr "Controle de versão de código-fonte com git"

#. (itstool) path: page/title
#: C/version-control.page:20
msgid "Version Control"
msgstr "Controle de versão"

#. (itstool) path: synopsis/p
#: C/version-control.page:25
msgid ""
"git is used for version control for all GNOME projects. This page assumes "
"good working knowledge of git; some introductory material is available <link "
"href=\"https://www.atlassian.com/git/tutorials/\">here</link>, and a <link "
"href=\"https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf"
"\">git cheatsheet is here</link>."
msgstr ""
"git é usado para controle de versão para todos os projetos do GNOME. Essa "
"página presume que tenha um bom conhecimento em trabalhar com git; algum "
"material introdutório está disponível <link href=\""
"https://www.atlassian.com/git/tutorials/\">aqui</link> e um <link href=\""
"https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf\">folha "
"de dica está aqui</link>."

#. (itstool) path: item/p
#: C/version-control.page:34
msgid ""
"Make atomic, revertable commits. (<link xref=\"#guidelines-for-making-commits"
"\"/>)"
msgstr ""
"Faça commits atômicos e reversíveis. (<link xref=\"#guidelines-for-making-"
"commits\"/>)"

#. (itstool) path: item/p
#: C/version-control.page:38
msgid ""
"Include full reasoning in commit messages, plus links to relevant bug "
"reports or specifications. (<link xref=\"#guidelines-for-making-commits\"/>)"
msgstr ""
"Inclua toda a fundamentação nas mensagens de commit, junto com links para "
"especificações e relatórios de erros relevantes. (<link xref=\"#guidelines-"
"for-making-commits\"/>)"

#. (itstool) path: item/p
#: C/version-control.page:43
msgid ""
"Keep large changes, such as renames, in separate commits. (<link xref="
"\"#guidelines-for-making-commits\"/>)"
msgstr ""
"Mantenha alterações grandes, como renomeações, em commits separados. (<link "
"xref=\"#guidelines-for-making-commits\"/>)"

#. (itstool) path: item/p
#: C/version-control.page:47
msgid ""
"Merge changes from feature branches by rebasing. (<link xref=\"#use-of-git\"/"
">)"
msgstr ""
"Mescle alterações de ramos de recursos por meio de rebase. (<link xref"
"=\"#use-of-git\"/>)"

#. (itstool) path: section/title
#: C/version-control.page:55
msgid "Use of Git"
msgstr "Uso do Git"

#. (itstool) path: section/p
#: C/version-control.page:57
msgid "Most GNOME repositories follow these rules:"
msgstr "A maioria dos repositórios do GNOME seguem essas regras:"

#. (itstool) path: item/p
#: C/version-control.page:61
msgid ""
"No forced pushes. Except for branches with the <code>wip/</code> prefix "
"(work-in-progress), the commits’ history must not be modified, as "
"contributors rely on it."
msgstr ""
"Nenhum push forçado. Exceto para ramos com o prefixo <code>wip/</code> ("
"trabalho em progress), o histórico de commits não deve ser modificado, pois "
"contribuidores dependem dele."

#. (itstool) path: item/p
#: C/version-control.page:66
msgid ""
"Rebase commits rather than merging, to have a linear history (which is "
"easier to follow)."
msgstr ""
"Faça rebase nos commits em vez de merge, para ter um histórico linear (que é "
"mais fácil de seguir)."

#. (itstool) path: item/p
#: C/version-control.page:70
msgid ""
"Work on feature branches on GNOME git in <code>wip/</code> branches, then "
"rebase on master and fast-forward merge the changes. It is a good practice "
"to also add your nickname to the branch name, as <code>wip/nickname/feature</"
"code>."
msgstr ""
"Trabalhe em ramos de recursos no git do GNOME em ramos <code>wip/</code> e "
"então aplique rebase no master e merge em fast-foward nas alterações. Também "
"é uma boa prática adicionar seu apelido ao nome do ramo, como "
"<code>wip/apelido/recurso</code>."

#. (itstool) path: item/p
#: C/version-control.page:76
msgid ""
"Hide <link href=\"https://sethrobertson.github.io/GitBestPractices/#sausage"
"\">sausage making</link> by squashing commits before merging."
msgstr ""
"Oculte “<link href=\"https://sethrobertson.github.io/GitBestPractices/#"
"sausage\">fazimento de salsicha</link>” (do inglês, “sausage making”) "
"compactando commits antes de mesclá-los."

#. (itstool) path: section/title
#: C/version-control.page:84
msgid "Guidelines for Making Commits"
msgstr "Diretrizes para fazer commits"

#. (itstool) path: section/p
#: C/version-control.page:86
msgid ""
"Commits should be as small as possible, but no smaller. Each commit should "
"address a single issue, containing only changes related to that issue. The "
"message for each commit should describe the issue, explain what causes it, "
"and explain how it has been fixed if it is not obvious. If the commit is "
"associated with a bug report, the full URI for the bug report should be put "
"on a line by itself at the bottom of the commit message. Similarly, the ID "
"for the git commit (from <cmd>git log --oneline</cmd>) should be copied into "
"the bug report once the commit has been pushed, so it is easy to find one "
"from the other."
msgstr ""
"Commits devem ser tão pequenos quanto possível, mas não menores. Cada commit "
"deve resolver um único problema, contendo apenas alterações relacionadas "
"àquele problema. A mensagem para cada commit deve descrever o problema, "
"explicar o que o causa e explicar como ele foi corrigido, se isso não foi "
"óbvio. Se o commit está associado com um relatório de erro, a URI completa "
"para o relatório de erro deve ser colocado em uma linha dedicada na parte "
"inferior da mensagem de commit. Similarmente, o ID para o commit do git (do "
"<cmd>git log --oneline</cmd>) deve ser compiado para o relatório de erro uma "
"vez que o commit tenha sido enviado, com push, de forma que seja fácil "
"localizar um por meio do outro."

#. (itstool) path: section/p
#: C/version-control.page:98
msgid ""
"The changes in each commit should be easy to read. For example, they should "
"not unnecessarily change whitespace or indentation. Large, mechanical "
"changes, such as renaming a file or function, should be put in separate "
"commits from modifications to code inside that file or function, so that the "
"latter changes do not get buried and lost in the former."
msgstr ""
"As alterações em cada commit devem ser fáceis de ler. Por exemplo, eles não "
"devem desnecessariamente alterar espaços em branco e recuo. Alterações "
"grandes e mecânicas, tal como renomear um arquivo ou função, devem ser "
"colocadas em commits separados das modificações do código dentro daquele "
"arquivo ou função, de forma que as alterações posteriores não sejam "
"enterradas ou perdidas na anterior."

#. (itstool) path: section/p
#: C/version-control.page:106
msgid "The following principles give the reasoning for all the advice above:"
msgstr "Os princípios a seguir fundamentam todos os conselhos acima:"

#. (itstool) path: item/p
#: C/version-control.page:110
msgid ""
"Each commit should take the repository from one working state to another, "
"otherwise <link href=\"http://git-scm.com/book/en/v2/Git-Tools-Debugging-"
"with-Git#Binary-Search\">bisection</link> is impossible."
msgstr ""
"Cada commit deve levar o repositório a partir de um estado de trabalho para "
"outro, do contrário <link href=\"http://git-scm.com/book/en/v2/Git-Tools-"
"Debugging-with-Git#Binary-Search\">bissecção</link> é impossível."

#. (itstool) path: item/p
#: C/version-control.page:116
msgid ""
"Each commit should be individually revertable. If it later turns out that "
"the commit was a bad idea, <cmd>git revert <var>commit ID</var></cmd> should "
"take the repository from a working state to another working state."
msgstr ""
"Cada commit deve ser individualmente reversível. Se posteriormente o commit "
"acabar sendo uma ideia ruim, <cmd>git revert <var>ID do commit</var></cmd> "
"deve levar o repositório de um estado de trabalho para outro."

#. (itstool) path: item/p
#: C/version-control.page:122
msgid ""
"The reasoning for each commit, and its relationship to external resources "
"like specifications and bug reports, should be clear, to the extent that "
"commits written by one developer a year in the past should still be "
"understandable by a second developer without having to trace through the "
"changes and work out what they do."
msgstr ""
"A fundamentação de cada commit, e sua relação com recursos externos como "
"especificações e relatórios de erro, deve estar clara de forma que aqueles "
"commits escritos por um desenvolvedor no passado devem ainda ser entendíveis "
"por um segundo desenvolvedor sem ter que seguir todo rastro de alterações e "
"descobrir o que eles fazem."

#. (itstool) path: item/p
#: C/version-control.page:129
msgid ""
"Each commit should be written once, and designed to be read many times, by "
"many reviewers and future programmers."
msgstr ""
"Cada commit deve ser escrito uma vez e projetado para ser lido muitas vezes, "
"por muitos revisores e futuros programadores."

#. (itstool) path: section/title
#: C/version-control.page:137
msgid "Merging Procedure"
msgstr "Procedimento de mesclagem"

#. (itstool) path: section/p
#: C/version-control.page:139
msgid ""
"To merge a feature branch named <code>my-branch</code> into master, use the "
"following commands:"
msgstr ""
"Para mesclar um ramo de recursos chamado <code>meu-ramo</code> no master, "
"use os seguintes comandos:"

#. (itstool) path: section/code
#: C/version-control.page:143
#, no-wrap
msgid ""
"\n"
"git checkout master\n"
"git pull\n"
"\n"
"git checkout wip/<var>my-branch</var>\n"
"git rebase --interactive master\n"
"# Ensure the rebase is successful; test the changes\n"
"\n"
"git checkout master\n"
"git merge wip/<var>my-branch</var>\n"
"git push\n"
"\n"
"# wip/<var>my-branch</var> can now be deleted\n"
"git push origin :wip/<var>my-branch</var>\n"
"git branch -D wip/<var>my-branch</var>"
msgstr ""
"\n"
"git checkout master\n"
"git pull\n"
"\n"
"git checkout wip/<var>meu-ramo</var>\n"
"git rebase --interactive master\n"
"# Certifique-se que o rebase funcione com sucesso; teste as alterações\n"
"\n"
"git checkout master\n"
"git merge wip/<var>meu-ramo</var>\n"
"git push\n"
"\n"
"# wip/<var>meu-ramo</var> agora pode ser excluído\n"
"git push origin :wip/<var>meu-ramo</var>\n"
"git branch -D wip/<var>meu-ramo</var>"

#. (itstool) path: item/p
#: C/version-control.page:164
msgid ""
"<link href=\"https://sethrobertson.github.io/GitBestPractices/\">Git best "
"practices</link>"
msgstr ""
"<link href=\"https://sethrobertson.github.io/GitBestPractices/\">Melhores "
"práticas com git</link>"

#. (itstool) path: item/p
#: C/version-control.page:167
msgid ""
"<link href=\"https://help.github.com/categories/using-git/\">Git FAQ</link>"
msgstr ""
"<link href=\"https://help.github.com/categories/using-git/\">Perguntas "
"frequentes do git</link>"

#. (itstool) path: item/p
#: C/version-control.page:170
msgid ""
"<link href=\"https://www.atlassian.com/git/tutorials/\">Atlassian git "
"tutorial</link>"
msgstr ""
"<link href=\"https://www.atlassian.com/git/tutorials/\">Tutorial de git do "
"Atlassian</link>"

#. (itstool) path: item/p
#: C/version-control.page:173
msgid ""
"<link href=\"http://git-scm.com/docs/gittutorial\">Official git tutorial</"
"link>"
msgstr ""
"<link href=\"http://git-scm.com/docs/gittutorial\">Tutorial oficial do "
"git</link>"

#. (itstool) path: item/p
#: C/version-control.page:176
msgid "<link href=\"https://try.github.io/\">Interactive git tutorial</link>"
msgstr "<link href=\"https://try.github.io/\">Tutorial interativo de git</link>"

#. (itstool) path: item/p
#: C/version-control.page:179
msgid ""
"<link href=\"http://www.git-tower.com/learn/\">git-tower tutorial</link>"
msgstr ""
"<link href=\"http://www.git-tower.com/learn/\">Tutorial git-tower</link>"

#. (itstool) path: info/desc
#: C/versioning.page:17
msgid "Versioning and releasing libraries and applications"
msgstr "Versionamento e lançamento de bibliotecas e aplicativos"

#. (itstool) path: synopsis/p
#: C/versioning.page:25
msgid ""
"Module versioning differs for libraries and applications: libraries need a "
"libtool version specified in addition to their package version. Applications "
"just have a package version."
msgstr ""
"O versionamento é diferente para módulos de bibliotecas e aplicativos: as "
"bibliotecas precisam de uma versão de libtool especificada junto com a "
"versão de seu pacote. Por sua vez, aplicativos só possuem uma versão de "
"pacote."

#. (itstool) path: item/p
#: C/versioning.page:32
msgid ""
"Libraries and applications have a package version of the form <em>major."
"minor.micro</em>. (<link xref=\"#package-versioning\"/>)"
msgstr ""
"Bibliotecas e aplicativos possuem uma versão de pacote na forma de "
"<em>maior.menor.micro</em>. (<link xref=\"#package-versioning\"/>)"

#. (itstool) path: item/p
#: C/versioning.page:36
msgid ""
"Libraries additionally have a libtool version of the form <em>current:"
"revision:age</em>. (<link xref=\"#libtool-versioning\"/>)"
msgstr ""
"Adicionalmente, bibliotecas possuem uma versão de libtool na forma de "
"<em>atual:revisão:idade</em>. (<link xref=\"#libtool-versioning\"/>)"

#. (itstool) path: item/p
#: C/versioning.page:40
msgid ""
"Version numbers should be updated for each release (using release and post-"
"release increments). (<link xref=\"#release-process\"/>)"
msgstr ""
"Os números de versão devem ser atualizados a cada lançamento (usando "
"incrementos de lançamento e pós-lançamento). (<link xref=\"#release-process\""
"/>)"

#. (itstool) path: item/p
#: C/versioning.page:44
msgid ""
"Package versions should be incremented for feature changes or additions. "
"(<link xref=\"#package-versioning\"/>)"
msgstr ""
"As versões de pacotes devem ser incrementados por alterações ou adições de "
"recursos. (<link xref=\"#package-versioning\"/>)"

#. (itstool) path: item/p
#: C/versioning.page:48
msgid ""
"Libtool versions should be updated for API changes or additions. (<link xref="
"\"#libtool-versioning\"/>)"
msgstr ""
"As versões de libtool devem ser atualizadas por alterações ou adições de "
"API. (<link xref=\"#libtool-versioning\"/>)"

#. (itstool) path: item/p
#: C/versioning.page:52
msgid ""
"Even/odd <em>minor</em> package versions can be used respectively for stable/"
"unstable releases. (<link xref=\"#stable-unstable-versions\"/>)"
msgstr ""
"Versões <em>menores</em> pares/ímpares de pacotes podem ser usadas "
"respectivamente para lançamentos estáveis/instáveis. (<link xref=\"#stable-"
"unstable-versions\"/>)"

#. (itstool) path: section/title
#: C/versioning.page:60
msgid "Package Versioning"
msgstr "Versionamento de pacote"

#. (itstool) path: section/p
#: C/versioning.page:62
msgid ""
"Both libraries and applications have a package version of the form <em>major."
"minor.micro</em>."
msgstr ""
"Bibliotecas e aplicativos possuem uma versão de pacote na forma de "
"<em>maior.menor.micro</em>."

#. (itstool) path: section/p
#: C/versioning.page:67
msgid ""
"The package version number is that passed to <code>AC_INIT()</code>, and the "
"one which is typically known as the project’s version number. For example, "
"the Debian package for a library will use the library’s package version "
"(though may also include the major version number in the package name to "
"allow for <link xref=\"parallel-installability\">parallel installability</"
"link>). Package versions are updated by the following rules:"
msgstr ""
"O número de versão de pacote é aquele passado para <code>AC_INIT()</code> e "
"que geralmente é conhecido como número de versão do projeto. Por exemplo, o "
"pacote Debian para uma biblioteca vai usar a versão de pacote da biblioteca ("
"apesar de também poder incluir o número de versão maior no nome de pacote "
"para permitir <link xref=\"parallel-installability\">instalabilidade "
"paralela</link>). Versões de pacotes são atualizadas pelas seguintes regras:"

#. (itstool) path: item/p
#: C/versioning.page:77
msgid ""
"If breaking <link xref=\"api-stability\">API compatibility</link> in a "
"library, or making a large change to an application which affects everything "
"(such as a UI redesign), increment major and set minor and micro to 0."
msgstr ""
"Se for quebrar a <link xref=\"api-stability\">compatibilidade de API</link> "
"em uma biblioteca, ou fazer uma alterações a um aplicativo que afeta tudo ("
"tal como um redesenho da interface gráfica), incremente a versão maior e "
"defina a menor e micro para 0."

#. (itstool) path: item/p
#: C/versioning.page:83
msgid ""
"Otherwise, if changing or adding a feature, or adding any API, increment "
"minor and set micro to 0."
msgstr ""
"Do contrário, se for alterar ou adicionar um recurso, ou adicionar qualquer "
"API, incremente a versão menor e defina micro para 0."

#. (itstool) path: item/p
#: C/versioning.page:87
msgid ""
"Otherwise (if making a release containing only bug fixes and translation "
"updates), increment micro."
msgstr ""
"Do contrário (se for fazer um lançamento contendo apenas correções de erros "
"e atualizações de tradução), incremente a versão micro."

#. (itstool) path: section/p
#: C/versioning.page:93
msgid ""
"Note that the minor version number should be updated if any API is added."
msgstr ""
"Note que o número da versão menor deve ser atualizada se qualquer API for "
"adicionada."

#. (itstool) path: section/title
#: C/versioning.page:99
msgid "Libtool Versioning"
msgstr "Versionamento de libtool"

#. (itstool) path: section/p
#: C/versioning.page:101
msgid ""
"Libraries have two version numbers: a libtool version which tracks ABI "
"backwards compatibility (see <link xref=\"api-stability\"/>), and a package "
"version which tracks feature changes. These are normally incremented in "
"synchronization, but should be kept separate because ABI backwards "
"compatibility is not necessarily related to feature changes or bug fixes. "
"Furthermore, the two version numbers have different semantics, and cannot be "
"automatically generated from each other."
msgstr ""
"Bibliotecas possuem dois números de versão: uma versão de libtool que "
"rastreia a compatibilidade reversa com ABI (veja <link xref=\"api-stability\""
"/>) e uma versão de pacote que rastreia alterações de recursos. Esses são "
"normalmente incrementados em sincronização, mas devem ser mantidos separados "
"por causa de compatibilidade reversa com ABI não está necessariamente "
"relacionada a alterações de recursos ou correções de erros. Além do mais, os "
"dois números de versões possuem semânticas diferentes e não podem ser "
"gerados automaticamente para cada um."

#. (itstool) path: section/p
#: C/versioning.page:112
msgid ""
"A good overview of libtool versioning, and the differences from package "
"versioning, is given in the <link href=\"https://autotools.io/libtool/"
"version.html\">Autotools Mythbuster</link>; another is in the <link href="
"\"http://www.gnu.org/s/libtool/manual/html_node/Updating-version-info.html"
"\">libtool manual</link>."
msgstr ""
"Uma boa visão geral do versionamento de libtool, e as diferenças para "
"versionamento de pacote, é fornecida no <link href=\""
"https://autotools.io/libtool/version.html\">Autotools MythBuster</link>; "
"outro está no <link href=\"http://www.gnu.org/s/libtool/manual/html_node"
"/Updating-version-info.html\">manual do libtool</link>."

#. (itstool) path: section/p
#: C/versioning.page:121
msgid ""
"To update the libtool version, follow the algorithm given in the comments "
"below. This is a typical <file>configure.ac</file> snippet for setting up "
"libtool versioning:"
msgstr ""
"Para atualizar a versão do libtool, siga o algoritmo fornecido nos comentários "
"abaixo. Esse é tipicamente um bloco de código do <file>configure.ac</file> "
"para configurar versionamento de libtool:"

#. (itstool) path: section/code
#: C/versioning.page:127
#, no-wrap
msgid ""
"\n"
"# Before making a release, the LT_VERSION string should be modified. The\n"
"# string is of the form c:r:a. Follow these instructions sequentially:\n"
"#   1. If the library source code has changed at all since the last update, then\n"
"#      increment revision (‘c:r:a’ becomes ‘c:r+1:a’).\n"
"#   2. If any interfaces have been added, removed, or changed since the last\n"
"#      update, increment current, and set revision to 0.\n"
"#   3. If any interfaces have been added since the last public release, then\n"
"#      increment age.\n"
"#   4. If any interfaces have been removed or changed since the last public\n"
"#      release, then set age to 0.\n"
"AC_SUBST([LT_VERSION],[0:0:0])"
msgstr ""
"\n"
"# Before making a release, the LT_VERSION string should be modified. The\n"
"# string is of the form c:r:a. Follow these instructions sequentially:\n"
"#   1. If the library source code has changed at all since the last update, "
"then\n"
"#      increment revision (‘c:r:a’ becomes ‘c:r+1:a’).\n"
"#   2. If any interfaces have been added, removed, or changed since the "
"last\n"
"#      update, increment current, and set revision to 0.\n"
"#   3. If any interfaces have been added since the last public release, "
"then\n"
"#      increment age.\n"
"#   4. If any interfaces have been removed or changed since the last public\n"
"#      release, then set age to 0.\n"
"AC_SUBST([LT_VERSION],[0:0:0])"

#. (itstool) path: section/p
#: C/versioning.page:140
msgid ""
"The following snippet can be used in a <file>Makefile.am</file> to pass that "
"version info to libtool:"
msgstr ""
"O bloco de código a seguir pode ser usado em um <file>Makefile.am</file> "
"para passar aquela informação de versão para o libtool:"

#. (itstool) path: section/code
#: C/versioning.page:144
#, no-wrap
msgid "my_library_la_LDFLAGS = -version-info $(LT_VERSION)"
msgstr "minha_biblioteca_la_LDFLAGS = -version-info $(LT_VERSION)"

#. (itstool) path: section/title
#: C/versioning.page:148
msgid "Stable and Unstable Package Versions"
msgstr "Versões estáveis e instáveis de pacote"

#. (itstool) path: section/p
#: C/versioning.page:150
msgid ""
"Most GNOME modules follow a convention for stable and unstable releases. The "
"minor version is even for stable releases and is odd for unstable releases. "
"For example, the 3.20.* versions are stable, but the 3.19.* versions are "
"unstable. The 3.19.* versions can be seen as alpha and beta releases of the "
"3.20 version."
msgstr ""
"A maioria dos módulos do GNOME seguem uma convenção para lançamentos "
"estáveis e instáveis. A versão menor é par para lançamentos estáveis e é "
"ímpar para lançamentos instáveis. Por exemplo, as versões 3.20.* são "
"estáveis, mas as versões 3.19.* são instáveis. As versões 3.19.* podem ser "
"vistas como lançamentos alfa e beta da versão 3.20."

#. (itstool) path: section/p
#: C/versioning.page:158
msgid ""
"A new micro <em>stable</em> version (e.g. 3.20.0 → 3.20.1) doesn’t add new "
"features, only translation updates and bug fixes. On the other hand, "
"<em>unstable</em> micro releases (e.g. 3.19.1 → 3.19.2) can add API, or "
"change or remove API which was added in a previous micro release in that "
"minor series."
msgstr ""
"Uma nova versão micro <em>estável</em> (ex.: 3.20.0 → 3.20.1) não adiciona "
"novos recursos, apenas atualizações de tradução e correções de erro. Por "
"outro lado, lançamentos micro <em>instáveis</em> (ex.: 3.19.1 → 3.19.2) "
"podem adicionar API, ou alterar ou remover API que foi adicionada em um "
"lançamento micro anterior naquela séries menores."

#. (itstool) path: section/p
#: C/versioning.page:166
msgid "The libtool version should be updated only for stable package versions."
msgstr ""
"A versão libtool deve ser atualizada apenas para versões de pacote estável."

#. (itstool) path: section/title
#: C/versioning.page:172
msgid "Release Process"
msgstr "Processo de lançamento"

#. (itstool) path: section/p
#: C/versioning.page:174
msgid ""
"The standard process for making a release of a module increments the libtool "
"version (if the module is a library) at the time of release, then increments "
"the package version number immediately afterwards (this is called a post-"
"release increment)."
msgstr ""
"O processo padrão para fazer um lançamento de um módulo incrementa a versão "
"de libtool (se o módulo é uma biblioteca) em tempo de lançamento e, "
"imediatamente após, incrementa o número de versão do pacote (isso é chamado "
"de “incremento pós-lançamento” ou, em inglês, “post-release increment”)"

#. (itstool) path: section/p
#: C/versioning.page:181
msgid ""
"Updating the libtool versions at the time of release means that they are "
"only incremented once for all ABI changes in a release. The use of post-"
"release increment for package versions means the package version number is "
"not outdated (still equal to the previous release) during the development "
"cycle."
msgstr ""
"Atualizar as versões de libtool em tempo de lançamento significa que eles "
"são incrementados apenas uma vez para todas as alterações de ABI em um "
"lançamento. O uso de incremento pós-lançamento para versões de pacotes "
"significa que o número de versão de pacote não está desatualizado (ainda "
"igual ao lançamento anterior) durante o ciclo de desenvolvimento."

#. (itstool) path: section/p
#: C/versioning.page:189
msgid ""
"The release process (based on the <link href=\"https://wiki.gnome.org/"
"MaintainersCorner/Releasing\">GNOME release process</link>):"
msgstr ""
"O processo de lançamento (baseado no <link href=\""
"https://wiki.gnome.org/MaintainersCorner/Releasing\">processo de lançamento "
"do GNOME</link>):"

#. (itstool) path: item/p
#: C/versioning.page:195
msgid "Make sure code is up to date: <cmd>git pull</cmd>"
msgstr "Certifique-se de que o código esteja atualizado: <cmd>git pull</cmd>"

#. (itstool) path: item/p
#: C/versioning.page:199
msgid "Make sure you have no local changes: <cmd>git status</cmd>"
msgstr ""
"Certifique-se de que você tenha nenhuma alteração local: <cmd>git status</cmd>"

#. (itstool) path: item/p
#: C/versioning.page:202
msgid ""
"If the release is for a stable package version, increment the libtool "
"version number in <file>configure.ac</file> (if it exists)"
msgstr ""
"Se o lançamento é para uma versão de pacote estável, incremente o número de "
"versão de libtool no <file>configure.ac</file> (se ele existir)"

#. (itstool) path: item/p
#: C/versioning.page:206
msgid "Add an entry to the <file>NEWS</file> file"
msgstr "Adicione uma entrada ao arquivo <file>NEWS</file>"

#. (itstool) path: item/p
#: C/versioning.page:210
msgid ""
"Run <cmd>./autogen.sh &amp;&amp; make &amp;&amp; make install &amp;&amp; "
"make distcheck</cmd> and ensure it succeeds"
msgstr ""
"Execute <cmd>./autogen.sh &amp;&amp; make &amp;&amp; make install &amp;&amp; "
"make distcheck</cmd> e certifique-se de que foi concluído com sucesso"

#. (itstool) path: item/p
#: C/versioning.page:216
msgid ""
"Fix any issues which come up, commit those changes, and restart at step 3"
msgstr ""
"Corrija quaisquer problemas que aparecerem, faça o commit das alterações "
"e reinicie no passo 3"

#. (itstool) path: item/p
#: C/versioning.page:222
msgid ""
"If <cmd>make distcheck</cmd> finishes with “[archive] is ready for "
"distribution”, run <cmd>git commit -a -m \"Release version x.y.z\"</cmd> "
"(where ‘x.y.z’ is the package version number)"
msgstr ""
"Se <cmd>make distcheck</cmd> finalizar com “[archive] is ready for "
"distribution”, execute <cmd>git commit -a -m \"Release version x.y.z\"</cmd> "
"(sendo “x.y.z” o número da versão do pacote)"

#. (itstool) path: item/p
#: C/versioning.page:228 C/versioning.page:263
msgid "Run <cmd>git push</cmd>"
msgstr "Execute <cmd>git push</cmd>"

#. (itstool) path: item/p
#: C/versioning.page:232
msgid ""
"If that fails due to other commits having been pushed in the meantime, run "
"<cmd>git pull</cmd> to merge your commit on the branch followed by a second "
"<cmd>git push</cmd>. This is an exception to the GNOME guideline to have a "
"linear Git history (<link xref=\"version-control#use-of-git\"/>). If you "
"prefer to have a linear history, you need to restart at step 1."
msgstr ""
"Se isso falhar em razão de outros commits terem sido enviados (push) neste "
"meio tempo, execute <cmd>git pull</cmd> para mesclar seu commit no ramo "
"seguido por um segundo <cmd>git push</cmd>. Isso é uma exceção às diretrizes "
"do GNOME de ter um histórico de git linear (<link xref=\"version-control#use-"
"of-git\"/>). Se você prefere ter um histórico linear, você precisa reiniciar "
"o passo 1."

#. (itstool) path: item/p
#: C/versioning.page:242
msgid ""
"Tag the release: <cmd>git tag -s x.y.z</cmd> (where ‘x.y.z’ is the package "
"version number)"
msgstr ""
"Crie uma tag de lançamento: <cmd>git tag -s x.y.z</cmd> (sendo “x.y.z” o "
"número de versão do pacote)"

#. (itstool) path: item/p
#: C/versioning.page:246
msgid ""
"Run <cmd>git push origin x.y.z</cmd> (where ‘x.y.z’ is the package version "
"number)"
msgstr ""
"Execute <cmd>git push origin x.y.z</cmd> (sendo “x.y.z” o número de versão "
"do pacote)"

#. (itstool) path: section/p
#: C/versioning.page:252
msgid ""
"The release is now complete, and the post-release version increment can be "
"done:"
msgstr ""
"O lançamento agora está completo e o incremento de versão pós-lançamento "
"pode ser feita:"

#. (itstool) path: item/p
#: C/versioning.page:257
msgid "Increment the package version number in <file>configure.ac</file>"
msgstr "Incremente o número de versão de pacote no <file>configure.ac</file>"

#. (itstool) path: item/p
#: C/versioning.page:260
msgid "Run <cmd>git commit -a -m \"Post-release version increment\"</cmd>"
msgstr "Execute <cmd>git commit -a -m \"Post-release version increment\"</cmd>"

#. (itstool) path: section/p
#: C/versioning.page:268
msgid ""
"The package archive generated by <cmd>make distcheck</cmd> can now be "
"uploaded to download.gnome.org or distributed in other ways."
msgstr ""
"O arquivo de pacote gerado por <cmd>make distcheck</cmd> agora pode ser "
"enviado para download.gnome.org ou distribuído em outras formas."

#. (itstool) path: info/desc
#: C/writing-good-code.page:25
msgid "Good, readable code keeps the project maintainable"
msgstr "Código bom e legível mantém o projeto manutenível"

#. (itstool) path: page/title
#: C/writing-good-code.page:28
msgid "The Importance of Writing Good Code"
msgstr "A importância de um código bem escrito"

#. (itstool) path: page/p
#: C/writing-good-code.page:30
msgid ""
"GNOME is a very ambitious free software project, and it is composed of many "
"software packages that are more or less independent of each other. A lot of "
"the work in GNOME is done by volunteers: although there are many people "
"working on GNOME full-time or part-time for here, volunteers still make up a "
"large percentage of our contributors. Programmers may come and go at any "
"time and they will be able to dedicate different amounts of time to the "
"GNOME project. People’s “real world” responsibilities may change, and this "
"will be reflected in the amount of time that they can devote to GNOME."
msgstr ""
"GNOME é um projeto de software livre muito ambicioso e é composto por muitos "
"pacotes de software que são mais ou menos independentes entre si. Muito do "
"trabalho no GNOME é feito por voluntários: apesar de haver muitas pessoas "
"trabalhando no GNOME em tempo integral ou parcial, voluntários ainda fazem "
"uma grande porcentagem de nossas contribuições. Programadores podem ir e vir "
"todo o tempo e eles serão capazes de dedicar diferentes parcelas de tempo "
"para o projeto do GNOME. As responsabilidades do “mundo real” das pessoas "
"podem alterar e isso refletirá na quantidade de tempo que eles devotam ao "
"GNOME."

#. (itstool) path: page/p
#: C/writing-good-code.page:43
msgid ""
"Software development takes long amounts of time and painstaking effort. This "
"is why most part-time volunteers cannot start big projects by themselves; it "
"is much easier and more rewarding to contribute to existing projects, as "
"this yields results that are immediately visible and usable."
msgstr ""
"Desenvolvimento de software leva grandes quantidades de tempo e esforços "
"penosos. É por isso que a maioria dos voluntários em tempo parcial não "
"conseguem iniciar grandes projetos por si próprio; é muito mais fácil e "
"recompensador contribuir para projetos existentes, pois isso traz resultados "
"que são imediatamente visíveis e usáveis."

#. (itstool) path: page/p
#: C/writing-good-code.page:51
msgid ""
"Thus, we conclude that it is very important for existing projects to make it "
"as easy as possible for people to contribute to them. One way of doing this "
"is by making sure that programs are easy to read, understand, modify, and "
"maintain."
msgstr ""
"Portanto, nós concluímos que é muito importante para os projetos existentes "
"torná-los o mais simples possível para que pessoas contribuam para eles. Uma "
"forma de fazer isso é se certificar de que programas são fáceis de ler, "
"entender, modificar e manter."

#. (itstool) path: page/p
#: C/writing-good-code.page:58
msgid ""
"Messy code is hard to read, and people may lose interest if they cannot "
"decipher what the code tries to do. Also, it is important that programmers "
"be able to understand the code quickly so that they can start contributing "
"with bug fixes and enhancements in a short amount of time. Source code is a "
"form of <em>communication</em>, and it is more for people than for "
"computers. Just as someone would not like to read a novel with spelling "
"errors, bad grammar, and sloppy punctuation, programmers should strive to "
"write good code that is easy to understand and modify by others."
msgstr ""
"Um código bagunçado é difícil de ler e as pessoas podem perder o interesse "
"se elas não puderem decifrar o que o código tenta fazer. Ademais, é "
"importante que os programadores sejam capazes de entender o código "
"rapidamente de forma que eles possam começar a contribuir com correções de "
"erro e aprimoramentos em uma pequena quantidade de tempo. Código-fonte é uma "
"forma de <em>comunicação</em> e é mais para pessoas que para computadores. "
"Assim como alguém não gostaria de ler uma novela com erros de escrita, "
"gramática ruim e pontuação desleixada, programadores devem se esforçar para "
"escrever um bom código que seja fácil de ser entendido e modificado por "
"outros."

#. (itstool) path: page/p
#: C/writing-good-code.page:71
msgid "The following are some important qualities of good code:"
msgstr "A seguir estão algumas qualidades importantes de um bom código:"

#. (itstool) path: item/title
#: C/writing-good-code.page:77
msgid "Cleanliness"
msgstr "Limpeza"

#. (itstool) path: item/p
#: C/writing-good-code.page:78
msgid ""
"Clean code is easy to read with minimum effort. This lets people start to "
"understand it easily. This includes the coding style itself (brace "
"placement, indentation, variable names), and the actual control flow of the "
"code."
msgstr ""
"Um código limpo é fácil de ler com esforço mínimo. Isso permite que pessoas "
"comecem a entendê-lo facilmente. Isso inclui o estilo de codificação em si "
"(colocação de chaves, recuo, nomes de variáveis) e o fluxo de controle do "
"código."

#. (itstool) path: item/title
#: C/writing-good-code.page:87
msgid "Consistency"
msgstr "Consistência"

#. (itstool) path: item/p
#: C/writing-good-code.page:88
msgid ""
"Consistent code makes it easy for people to understand how a program works. "
"When reading consistent code, one subconsciously forms a number of "
"assumptions and expectations about how the code works, so it is easier and "
"safer to make modifications to it. Code that <em>looks</em> the same in two "
"places should <em>work</em> the same, too."
msgstr ""
"Um código consistente facilita o entendimento de como um programa funciona. "
"Ao ler um código consistente, forma-se subconscientemente um número de "
"presunções e expectativas sobre como o código funciona, então é mais fácil e "
"seguro fazer modificações nele. Um código que <em>se parece</em> o mesmo em "
"dois locais deve <em>funcionar</em> da mesma forma, também."

#. (itstool) path: item/title
#: C/writing-good-code.page:99
msgid "Extensibility"
msgstr "Extensibilidade"

#. (itstool) path: item/p
#: C/writing-good-code.page:100
msgid ""
"General-purpose code is easier to reuse and modify than very specific code "
"with lots of hardcoded assumptions. When someone wants to add a new feature "
"to a program, it will obviously be easier to do so if the code was designed "
"to be extensible from the beginning. Code that was not written this way may "
"lead people into having to implement ugly hacks to add features."
msgstr ""
"Um código com propósito geral é mais fácil de reusar e modificar do que um "
"código muito específico com diversas presunções codificadas. Quando alguém "
"deseja adicionar um novo recurso a um programa, obviamente será mais fácil "
"fazer isso se o código foi projetado para ser extensível desde o começo. Um "
"código que não foi escrito dessa forma pode levar pessoas a ter que "
"implementar hacks feios e adicionar recursos."

#. (itstool) path: item/title
#: C/writing-good-code.page:112
msgid "Correctness"
msgstr "Corretismo"

#. (itstool) path: item/p
#: C/writing-good-code.page:113
msgid ""
"Finally, code that is designed to be correct lets people spend less time "
"worrying about bugs, and more time enhancing the features of a program. "
"Users also appreciate correct code, since nobody likes software that "
"crashes. Code that is written for correctness and safety (i.e. code that "
"explicitly tries to ensure that the program remains in a consistent state) "
"prevents many kinds of silly bugs."
msgstr ""
"Finalmente, um código que é projetado para ser correto permite que as "
"pessoas gastem menos tempo se preocupando com erros, e mais tempo melhorando "
"os recursos de um programa. Usuários também apreciam um código correto, já "
"que ninguém gosta de software que trava. Código que é escrito prezando pelo "
"corretismo e segurança (i.e. código que explicitamente tenta se certificar "
"de que o programa permaneça em um estado de consistência) evita muitos tipos "
"de erros bobos."

#. (itstool) path: section/title
#: C/writing-good-code.page:126
msgid "Book References"
msgstr "Referências literárias"

#. (itstool) path: item/p
#: C/writing-good-code.page:129
msgid ""
"<link href=\"http://www.cc2e.com\">Code Complete</link>, by Steve McConnell."
msgstr ""
"<link href=\"http://www.cc2e.com\">Code Complete</link>, por Steve McConnell."

#. (itstool) path: item/p
#: C/writing-good-code.page:132
msgid ""
"<link href=\"http://martinfowler.com/books/refactoring.html\"> Refactoring: "
"Improving the Design of Existing Code </link>, by Martin Fowler."
msgstr ""
"<link href=\"http://martinfowler.com/books/refactoring.html\"> Refactoring: "
"Improving the Design of Existing Code </link>, por Martin Fowler."

#. (itstool) path: item/p
#: C/writing-good-code.page:137
msgid ""
"<link href=\"http://en.wikipedia.org/wiki/Design_Patterns\"> Design "
"Patterns: Elements of Reusable Object-Oriented Software </link>, by Erich "
"Gamma, Richard Helm, Ralph Johnson and John Vlissides."
msgstr ""
"<link href=\"http://en.wikipedia.org/wiki/Design_Patterns\"> Design "
"Patterns: Elements of Reusable Object-Oriented Software </link>, por Erich "
"Gamma, Richard Helm, Ralph Johnson e John Vlissides."

#. (itstool) path: item/p
#: C/writing-good-code.page:142
msgid ""
"<link href=\"http://astore.amazon.com/gnomestore-20/detail/020163385X\"> "
"Object-Oriented Design Heuristics </link>, by Arthur Riel."
msgstr ""
"<link href=\"http://astore.amazon.com/gnomestore-20/detail/020163385X\"> "
"Object-Oriented Design Heuristics </link>, por Arthur Riel."