[gnome-devel-docs] Updated Spanish translation
- From: Daniel Mustieles García <dmustieles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Updated Spanish translation
- Date: Tue, 21 Jan 2020 11:56:28 +0000 (UTC)
commit 9f1c06f4efad7578775c877dccdf0fcbe95172c0
Author: Daniel Mustieles <daniel mustieles gmail com>
Date: Tue Jan 21 12:56:32 2020 +0100
Updated Spanish translation
programming-guidelines/es/es.po | 1350 ++++++++++++++++++++++++++++++++-------
1 file changed, 1113 insertions(+), 237 deletions(-)
---
diff --git a/programming-guidelines/es/es.po b/programming-guidelines/es/es.po
index bd9e9837..58130ff3 100644
--- a/programming-guidelines/es/es.po
+++ b/programming-guidelines/es/es.po
@@ -2,28 +2,28 @@
# Copyright (C) 2016 gnome-devel-docs's COPYRIGHT HOLDER
# This file is distributed under the same license as the gnome-devel-docs package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-# Daniel Mustieles <daniel mustieles gmail com>, 2016.
+# Daniel Mustieles <daniel mustieles gmail com>, 2016-2020.
#
msgid ""
msgstr ""
"Project-Id-Version: gnome-devel-docs master\n"
-"POT-Creation-Date: 2019-09-18 18:28+0000\n"
-"PO-Revision-Date: 2016-03-17 10:08+0100\n"
+"POT-Creation-Date: 2019-12-31 08:53+0000\n"
+"PO-Revision-Date: 2020-01-21 12:55+0100\n"
"Last-Translator: Daniel Mustieles <daniel mustieles gmail com>\n"
-"Language-Team: Español; Castellano <gnome-es-list gnome org>\n"
-"Language: es\n"
+"Language-Team: Spanish - Spain <gnome-es-list gnome org>\n"
+"Language: es_ES\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: Gtranslator 2.91.6\n"
+"X-Generator: Gtranslator 3.34.0\n"
"X-Poedit-SourceCharset: UTF-8\n"
#. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2
msgctxt "_"
msgid "translator-credits"
msgstr ""
-"Daniel Mustieles <daniel mustieles gmail com>, 2016\n"
+"Daniel Mustieles <daniel mustieles gmail com>, 2016-2020\n"
"Javier Mazorra <mazi debian gmail com>, 2016"
#. (itstool) path: credit/name
@@ -418,8 +418,8 @@ msgstr ""
"eliminan funciones). El número de versión secundaria se incrementa cuando se "
"hacen cambios incompatibles hacia delante (piro ejemplo, cuando se añade una "
"API pública nueva). El número de la micro versión se incrementa cuando se "
-"hacen cambios en el código sin modificar la API. Consulte la sección <link xref="
-"\"versioning\"/> para más información."
+"hacen cambios en el código sin modificar la API. Consulte la sección <link "
+"xref=\"versioning\"/> para más información."
#. (itstool) path: section/p
#: C/api-stability.page:162
@@ -475,7 +475,6 @@ msgstr ""
#. (itstool) path: item/p
#: C/api-stability.page:189
-#, fuzzy
#| msgid ""
#| "<link href=\"http://en.wikipedia.org/wiki/Application_binary_interface"
#| "\">Wikipedia page on ABIs</link>"
@@ -483,7 +482,7 @@ msgid ""
"<link href=\"https://en.wikipedia.org/wiki/Application_binary_interface"
"\">Wikipedia page on ABIs</link>"
msgstr ""
-"<link href=\"http://en.wikipedia.org/wiki/Application_binary_interface"
+"<link href=\"https://en.wikipedia.org/wiki/Application_binary_interface"
"\">Página de la Wikipedia sobre ABI</link>"
#. (itstool) path: item/p
@@ -502,10 +501,9 @@ msgstr ""
#. (itstool) path: page/title
#: C/async-programming.page:23
-#, fuzzy
#| msgid "Asynchronous I/O"
msgid "Asynchronous Programming"
-msgstr "E/S asíncrona"
+msgstr "Programación asíncrona"
#. (itstool) path: item/p
#: C/async-programming.page:29
@@ -565,7 +563,7 @@ msgstr ""
#. (itstool) path: section/title
#: C/async-programming.page:68
msgid "Concepts"
-msgstr ""
+msgstr "Conceptos"
#. (itstool) path: section/p
#: C/async-programming.page:70
@@ -603,7 +601,7 @@ msgstr ""
#. (itstool) path: item/code
#: C/async-programming.page:98
-#, fuzzy, no-wrap
+#, no-wrap
#| msgid ""
#| "\n"
#| "void\n"
@@ -624,19 +622,15 @@ msgid ""
" gpointer user_data)"
msgstr ""
"\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"
+"foo_file_load_data_async (FooFile *self,\n"
+" …,\n"
+" GCancellable *cancellable,\n"
+" GAsyncReadyCallback callback,\n"
+" gpointer user_data)"
#. (itstool) path: item/code
#: C/async-programming.page:106
-#, fuzzy, no-wrap
+#, no-wrap
#| msgid ""
#| "\n"
#| "return_type function_name (type argument,\n"
@@ -650,9 +644,10 @@ msgid ""
" GError **error)"
msgstr ""
"\n"
-"return_type function_name (type argument,\n"
-" type argument,\n"
-" type argument);"
+"foo_file_load_data_finish (FooFile *self,\n"
+" GAsyncResult *result,\n"
+" …,\n"
+" GError **error)"
#. (itstool) path: section/p
#: C/async-programming.page:114
@@ -705,11 +700,15 @@ msgid ""
"on a class instance interact with finalization of that instance. There are "
"two approaches:"
msgstr ""
+"Al escribir operaciones asíncronas, es común escribirlas como métodos de una "
+"clase. En este caso, es importante definir cómo las operaciones en curso en "
+"una instancia de clase interactúan con la finalización de esa instancia. Hay "
+"dos enfoques:"
#. (itstool) path: item/title
#: C/async-programming.page:157
msgid "Strong"
-msgstr ""
+msgstr "Fuerte"
#. (itstool) path: item/p
#: C/async-programming.page:158
@@ -720,11 +719,16 @@ msgid ""
"to force cancellation of the operation and allow that instance to be "
"finalized."
msgstr ""
+"La operación en curso mantiene una referencia a la instancia de clase, "
+"forzándola a permanecer viva mientras dure la operación. La clase debe "
+"proporcionar algún tipo de método de «cierre» o «cancelación» que otras "
+"clases puedan utilizar para forzar la cancelación de la operación y permitir "
+"que se finalice esa instancia."
#. (itstool) path: item/title
#: C/async-programming.page:168
msgid "Weak"
-msgstr ""
+msgstr "Débil"
#. (itstool) path: item/p
#: C/async-programming.page:169
@@ -789,6 +793,8 @@ msgid ""
"This example demonstrates copying a file from one location in the file "
"system to another. The key principles demonstrated here are:"
msgstr ""
+"Este ejemplo muestra cómo copiar un archivo de una ubicación en el sistema "
+"de archivos a otra. Los principios clave demostrados aquí son:"
#. (itstool) path: item/p
#: C/async-programming.page:224
@@ -934,6 +940,110 @@ msgid ""
" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
"}"
msgstr ""
+"\n"
+"static void\n"
+"copy_finish_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"\n"
+"static void\n"
+"copy_button_clicked_cb (GtkButton *button\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *source = NULL, *destination = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (user_data));\n"
+"\n"
+" /* Operation already in progress? */\n"
+" if (priv->copy_cancellable != NULL)\n"
+" {\n"
+" g_debug (\"Copy already in progress.\");\n"
+" return;\n"
+" }\n"
+"\n"
+" /* Build source and destination file paths. */\n"
+" source = g_file_new_for_path (/* some path generated from UI */);\n"
+" destination = g_file_new_for_path (/* some other path generated from UI */);\n"
+"\n"
+" /* Set up a cancellable. */\n"
+" priv->copy_cancellable = g_cancellable_new ();\n"
+"\n"
+" g_file_copy_async (source, destination, G_FILE_COPY_NONE, G_PRIORITY_DEFAULT,\n"
+" priv->copy_cancellable, NULL, NULL,\n"
+" copy_finish_cb, user_data);\n"
+"\n"
+" g_object_unref (destination);\n"
+" g_object_unref (source);\n"
+"\n"
+" /* Update UI to show copy is in progress. */\n"
+" …\n"
+"}\n"
+"\n"
+"static void\n"
+"copy_finish_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *source; /* unowned */\n"
+" GError *error = NULL;\n"
+"\n"
+" source = G_FILE (source_object);\n"
+" priv = my_object_get_instance_private (MY_OBJECT (user_data));\n"
+"\n"
+" /* Handle completion of the operation. */\n"
+" g_file_copy_finish (source, result, &error);\n"
+"\n"
+" if (error != NULL &&\n"
+" !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" /* Should update the UI to signal failure.\n"
+" * Ignore failure due to cancellation. */\n"
+" g_warning (\"Failed to copy file: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_error (&error);\n"
+"\n"
+" /* Clear the cancellable to signify the operation has finished. */\n"
+" g_clear_object (&priv->copy_cancellable);\n"
+"\n"
+" /* Update UI to show copy as complete. */\n"
+" …\n"
+"}\n"
+"\n"
+"static void\n"
+"cancel_button_clicked_cb (GtkButton *button,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *source = NULL, *destination = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (user_data));\n"
+"\n"
+" /* Operation in progress? No-op if @copy_cancellable is %NULL. */\n"
+" g_cancellable_cancel (priv->copy_cancellable);\n"
+"}\n"
+"\n"
+"static void\n"
+"my_object_dispose (GObject *obj)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (obj));\n"
+"\n"
+" /* Cancel any ongoing copy operation.\n"
+" *\n"
+" * This ensures that if #MyObject is disposed part-way through a copy, the\n"
+" * callback doesn’t get invoked with an invalid #MyObject pointer. */\n"
+" g_cancellable_cancel (priv->copy_cancellable);\n"
+"\n"
+" /* Do other dispose calls here. */\n"
+" …\n"
+"\n"
+" /* Chain up. */\n"
+" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
+"}"
#. (itstool) path: example/p
#: C/async-programming.page:361
@@ -987,6 +1097,40 @@ msgid ""
" …\n"
"}"
msgstr ""
+"\n"
+"static void\n"
+"copy_button_clicked_cb (GtkButton *button\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *source = NULL, *destination = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (user_data));\n"
+"\n"
+" /* Build source and destination file paths. */\n"
+" source = g_file_new_for_path (/* some path generated from UI */);\n"
+" destination = g_file_new_for_path (/* some other path generated from UI */);\n"
+"\n"
+" g_file_copy (source, destination, G_FILE_COPY_NONE,\n"
+" NULL /* cancellable */, NULL, NULL,\n"
+" &error);\n"
+"\n"
+" g_object_unref (destination);\n"
+" g_object_unref (source);\n"
+"\n"
+" /* Handle completion of the operation. */\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Should update the UI to signal failure.\n"
+" * Ignore failure due to cancellation. */\n"
+" g_warning (\"Failed to copy file: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_error (&error);\n"
+"\n"
+" /* Update UI to show copy as complete. */\n"
+" …\n"
+"}"
#. (itstool) path: section/title
#: C/async-programming.page:411
@@ -999,6 +1143,8 @@ msgid ""
"A common situation is to run multiple asynchronous operations in series, "
"when each operation depends on the previous one completing."
msgstr ""
+"Una situación común es ejecutar múltiples operaciones asincrónicas en serie, "
+"cuando cada operación depende de que se complete la anterior."
#. (itstool) path: example/p
#: C/async-programming.page:419
@@ -1290,240 +1436,888 @@ msgid ""
" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
"}"
msgstr ""
-
-#. (itstool) path: section/title
-#: C/async-programming.page:697
-msgid "Operations in Parallel"
-msgstr ""
-
-#. (itstool) path: section/p
-#: C/async-programming.page:699
-msgid ""
-"Another common situation is to run multiple asynchronous operations in "
-"parallel, considering the overall operation complete when all its "
-"constituents are complete."
-msgstr ""
-
-#. (itstool) path: example/p
-#: C/async-programming.page:706
-msgid "In this example, the application deletes multiple files in parallel."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:714
-msgid ""
-"The number of pending asynchronous operations (ones which have started but "
-"not yet finished) is tracked as <code>n_deletions_pending</code>. The "
-"<code>delete_files_cb()</code> callback only considers the entire operation "
-"complete once this reaches zero."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:721
-msgid ""
-"<code>n_deletions_to_start</code> tracks deletion operations being started, "
-"in case <link href=\"https://developer.gnome.org/gio/stable/GFile.html#g-"
-"file-delete-async\"><code>g_file_delete_async()</code></link> manages to use "
-"a fast path and complete synchronously (without blocking)."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:728
-msgid ""
-"As in <link xref=\"#single-call\"/>, all pending deletions are cancelled if "
-"the owning <code>MyObject</code> instance is disposed, to prevent callbacks "
-"being called later with an invalid <code>MyObject</code> pointer."
-msgstr ""
-
-#. (itstool) path: example/code
-#: C/async-programming.page:736
-#, no-wrap
-msgid ""
"\n"
"static void\n"
-"delete_files_cb (GObject *source_object,\n"
-" GAsyncResult *result,\n"
-" gpointer user_data);\n"
+"connect_to_server_cb1 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"static void\n"
+"connect_to_server_cb2 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"static void\n"
+"connect_to_server_cb3 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"\n"
+"static void\n"
+"connect_to_server (MyObject *self)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *address_file = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" if (priv->connect_cancellable != NULL)\n"
+" {\n"
+" /* Already connecting. */\n"
+" return;\n"
+" }\n"
+"\n"
+" /* Set up a cancellable. */\n"
+" priv->connect_cancellable = g_cancellable_new ();\n"
+"\n"
+" /* Read the socket address. */\n"
+" address_file = build_address_file ();\n"
+" g_file_load_contents_async (address_file, priv->connect_cancellable,\n"
+" connect_to_server_cb1, self);\n"
+" g_object_unref (address_file);\n"
+"}\n"
+"\n"
+"static void\n"
+"connect_to_server_cb1 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GFile *address_file; /* unowned */\n"
+" gchar *address = NULL; /* owned */\n"
+" gsize address_size = 0;\n"
+" GInetAddress *inet_address = NULL; /* owned */\n"
+" GInetSocketAddress *inet_socket_address = NULL; /* owned */\n"
+" guint16 port = 123;\n"
+" GSocketClient *socket_client = NULL; /* owned */\n"
+" GError *error = NULL;\n"
+"\n"
+" address_file = G_FILE (source_object);\n"
+" self = MY_OBJECT (user_data);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish loading the address. */\n"
+" g_file_load_contents_finish (address_file, result, &address,\n"
+" &address_size, NULL, &error);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" goto done;\n"
+" }\n"
+"\n"
+" /* Parse the address. */\n"
+" inet_address = g_inet_address_new_from_string (address);\n"
+"\n"
+" if (inet_address == NULL)\n"
+" {\n"
+" /* Error. */\n"
+" g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,\n"
+" \"Invalid address ‘%s’.\", address);\n"
+" goto done;\n"
+" }\n"
+"\n"
+" inet_socket_address = g_inet_socket_address_new (inet_address, port);\n"
+"\n"
+" /* Connect to the given address. */\n"
+" socket_client = g_socket_client_new ();\n"
+"\n"
+" g_socket_client_connect_async (socket_client,\n"
+" G_SOCKET_CONNECTABLE (inet_socket_address),\n"
+" priv->connect_cancellable,\n"
+" connect_to_server_cb2,\n"
+" self);\n"
+"\n"
+"done:\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Stop the operation. */\n"
+" if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" g_warning (\"Failed to load server address: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_object (&priv->connect_cancellable);\n"
+" g_error_free (error);\n"
+" }\n"
+"\n"
+" g_free (address);\n"
+" g_clear_object (&inet_address);\n"
+" g_clear_object (&inet_socket_address);\n"
+" g_clear_object (&socket_client);\n"
+"}\n"
+"\n"
+"static void\n"
+"connect_to_server_cb2 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GSocketClient *socket_client; /* unowned */\n"
+" GSocketConnection *connection = NULL; /* owned */\n"
+" GInputStream *input_stream; /* unowned */\n"
+" GError *error = NULL;\n"
+"\n"
+" socket_client = G_SOCKET_CLIENT (source_object);\n"
+" self = MY_OBJECT (user_data);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish connecting to the socket. */\n"
+" connection = g_socket_client_connect_finish (socket_client, result,\n"
+" &error);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" goto done;\n"
+" }\n"
+"\n"
+" /* Store a reference to the connection so it is kept open while we read from\n"
+" * it: #GInputStream does not keep a reference to a #GIOStream which contains\n"
+" * it. */\n"
+" priv->connection = g_object_ref (connection);\n"
+"\n"
+" /* Read a message from the connection. This uses a single buffer stored in\n"
+" * #MyObject, meaning that only one connect_to_server() operation can run at\n"
+" * any time. The buffer could instead be allocated dynamically if this is a\n"
+" * problem. */\n"
+" input_stream = g_io_stream_get_input_stream (G_IO_STREAM (connection));\n"
+"\n"
+" g_input_stream_read_async (input_stream,\n"
+" priv->message_buffer,\n"
+" sizeof (priv->message_buffer),\n"
+" G_PRIORITY_DEFAULT, priv->connect_cancellable,\n"
+" connect_to_server_cb3, self);\n"
+"\n"
+"done:\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Stop the operation. */\n"
+" if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" g_warning (\"Failed to connect to server: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_object (&priv->connect_cancellable);\n"
+" g_clear_object (&priv->connection);\n"
+" g_error_free (error);\n"
+" }\n"
+"\n"
+" g_clear_object (&connection);\n"
+"}\n"
+"\n"
+"static void\n"
+"connect_to_server_cb3 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GInputStream *input_stream; /* unowned */\n"
+" gssize len = 0;\n"
+" GError *error = NULL;\n"
+"\n"
+" input_stream = G_INPUT_STREAM (source_object);\n"
+" self = MY_OBJECT (user_data);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish reading from the socket. */\n"
+" len = g_input_stream_read_finish (input_stream, result, &error);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" goto done;\n"
+" }\n"
+"\n"
+" /* Handle the message. */\n"
+" g_assert_cmpint (len, >=, 0);\n"
+" g_assert_cmpuint ((gsize) len, <=, sizeof (priv->message_buffer));\n"
+"\n"
+" handle_received_message (self, priv->message_buffer, len, &error);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" goto done;\n"
+" }\n"
+"\n"
+"done:\n"
+" /* Unconditionally mark the operation as finished.\n"
+" *\n"
+" * The streams should automatically close as this\n"
+" * last reference is dropped. */\n"
+" g_clear_object (&priv->connect_cancellable);\n"
+" g_clear_object (&priv->connection);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Warn about the error. */\n"
+" if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" g_warning (\"Failed to read from the server: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_error_free (error);\n"
+" }\n"
+"}\n"
+"\n"
+"static void\n"
+"my_object_dispose (GObject *obj)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (obj));\n"
+"\n"
+" /* Cancel any ongoing connection operations.\n"
+" *\n"
+" * This ensures that if #MyObject is disposed part-way through the\n"
+" * connect_to_server() sequence of operations, the sequence gets cancelled and\n"
+" * doesn’t continue with an invalid #MyObject pointer. */\n"
+" g_cancellable_cancel (priv->connect_cancellable);\n"
+"\n"
+" /* Do other dispose calls here. */\n"
+" …\n"
+"\n"
+" /* Chain up. */\n"
+" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
+"}"
+
+#. (itstool) path: section/title
+#: C/async-programming.page:697
+msgid "Operations in Parallel"
+msgstr "Operaciones en paralelo"
+
+#. (itstool) path: section/p
+#: C/async-programming.page:699
+msgid ""
+"Another common situation is to run multiple asynchronous operations in "
+"parallel, considering the overall operation complete when all its "
+"constituents are complete."
+msgstr ""
+"Otra situación común es ejecutar múltiples operaciones asincrónicas en "
+"paralelo, considerando que la operación general se completa cuando todos sus "
+"componentes están completos."
+
+#. (itstool) path: example/p
+#: C/async-programming.page:706
+msgid "In this example, the application deletes multiple files in parallel."
+msgstr "En este ejemplo, la aplicación elimina varios archivos en paralelo."
+
+#. (itstool) path: item/p
+#: C/async-programming.page:714
+msgid ""
+"The number of pending asynchronous operations (ones which have started but "
+"not yet finished) is tracked as <code>n_deletions_pending</code>. The "
+"<code>delete_files_cb()</code> callback only considers the entire operation "
+"complete once this reaches zero."
+msgstr ""
+
+#. (itstool) path: item/p
+#: C/async-programming.page:721
+msgid ""
+"<code>n_deletions_to_start</code> tracks deletion operations being started, "
+"in case <link href=\"https://developer.gnome.org/gio/stable/GFile.html#g-"
+"file-delete-async\"><code>g_file_delete_async()</code></link> manages to use "
+"a fast path and complete synchronously (without blocking)."
+msgstr ""
+
+#. (itstool) path: item/p
+#: C/async-programming.page:728
+msgid ""
+"As in <link xref=\"#single-call\"/>, all pending deletions are cancelled if "
+"the owning <code>MyObject</code> instance is disposed, to prevent callbacks "
+"being called later with an invalid <code>MyObject</code> pointer."
+msgstr ""
+
+#. (itstool) path: example/code
+#: C/async-programming.page:736
+#, no-wrap
+msgid ""
+"\n"
+"static void\n"
+"delete_files_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"\n"
+"static void\n"
+"delete_files (MyObject *self,\n"
+" GPtrArray/*<owned GFile*>>*/ *files)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *address_file = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Set up a cancellable if no operation is ongoing already. */\n"
+" if (priv->delete_cancellable == NULL)\n"
+" {\n"
+" priv->delete_cancellable = g_cancellable_new ();\n"
+" priv->n_deletions_pending = 0;\n"
+" priv->n_deletions_total = 0;\n"
+" }\n"
+"\n"
+" /* Update internal state, and temporarily set @n_deletions_to_start. This is\n"
+" * used in delete_files_cb() to avoid indicating the overall operation has\n"
+" * completed while deletions are still being started. This can happen if\n"
+" * g_file_delete_async() completes synchronously, for example if there’s a\n"
+" * non-blocking fast path for the given file system. */\n"
+" priv->n_deletions_pending += files->len;\n"
+" priv->n_deletions_total += files->len;\n"
+" priv->n_deletions_to_start = files->len;\n"
+"\n"
+" /* Update the UI to indicate the files are being deleted. */\n"
+" update_ui_to_show_progress (self,\n"
+" priv->n_deletions_pending,\n"
+" priv->n_deletions_total);\n"
+"\n"
+" /* Start all the deletion operations in parallel. They share the same\n"
+" * #GCancellable. */\n"
+" for (i = 0; i < files->len; i++)\n"
+" {\n"
+" GFile *file = files->pdata[i];\n"
+"\n"
+" priv->n_deletions_to_start--;\n"
+" g_file_delete_async (file, G_PRIORITY_DEFAULT, priv->delete_cancellable,\n"
+" delete_files_cb, self);\n"
+" }\n"
+"}\n"
+"\n"
+"static void\n"
+"delete_files_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GFile *file; /* unowned */\n"
+" GError *error = NULL;\n"
+"\n"
+" file = G_FILE (source_object);\n"
+" self = MY_OBJECT (user_data);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish deleting the file. */\n"
+" g_file_delete_finish (file, result, &error);\n"
+"\n"
+" if (error != NULL &&\n"
+" !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" g_warning (\"Error deleting file: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_error (&error);\n"
+"\n"
+" /* Update the internal state. */\n"
+" g_assert_cmpuint (priv->n_deletions_pending, >, 0);\n"
+" priv->n_deletions_pending--;\n"
+"\n"
+" /* Update the UI to show progress. */\n"
+" update_ui_to_show_progress (self,\n"
+" priv->n_deletions_pending,\n"
+" priv->n_deletions_total);\n"
+"\n"
+" /* If all deletions have completed, and no more are being started,\n"
+" * update the UI to show completion. */\n"
+" if (priv->n_deletions_pending == 0 && priv->n_deletions_to_start == 0)\n"
+" {\n"
+" update_ui_to_show_completion (self);\n"
+"\n"
+" /* Clear the operation state. */\n"
+" g_clear_object (&priv->delete_cancellable);\n"
+" priv->n_deletions_total = 0;\n"
+" }\n"
+"}\n"
+"\n"
+"static void\n"
+"my_object_dispose (GObject *obj)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (obj));\n"
+"\n"
+" /* Cancel any ongoing deletion operations.\n"
+" *\n"
+" * This ensures that if #MyObject is disposed part-way through the\n"
+" * delete_files() set of operations, the set gets cancelled and\n"
+" * doesn’t continue with an invalid #MyObject pointer. */\n"
+" g_cancellable_cancel (priv->delete_cancellable);\n"
+"\n"
+" /* Do other dispose calls here. */\n"
+" …\n"
+"\n"
+" /* Chain up. */\n"
+" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
+"}"
+msgstr ""
+"\n"
+"static void\n"
+"delete_files_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"\n"
+"static void\n"
+"delete_files (MyObject *self,\n"
+" GPtrArray/*<owned GFile*>>*/ *files)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GFile *address_file = NULL; /* owned */\n"
+"\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Set up a cancellable if no operation is ongoing already. */\n"
+" if (priv->delete_cancellable == NULL)\n"
+" {\n"
+" priv->delete_cancellable = g_cancellable_new ();\n"
+" priv->n_deletions_pending = 0;\n"
+" priv->n_deletions_total = 0;\n"
+" }\n"
+"\n"
+" /* Update internal state, and temporarily set @n_deletions_to_start. This is\n"
+" * used in delete_files_cb() to avoid indicating the overall operation has\n"
+" * completed while deletions are still being started. This can happen if\n"
+" * g_file_delete_async() completes synchronously, for example if there’s a\n"
+" * non-blocking fast path for the given file system. */\n"
+" priv->n_deletions_pending += files->len;\n"
+" priv->n_deletions_total += files->len;\n"
+" priv->n_deletions_to_start = files->len;\n"
+"\n"
+" /* Update the UI to indicate the files are being deleted. */\n"
+" update_ui_to_show_progress (self,\n"
+" priv->n_deletions_pending,\n"
+" priv->n_deletions_total);\n"
+"\n"
+" /* Start all the deletion operations in parallel. They share the same\n"
+" * #GCancellable. */\n"
+" for (i = 0; i < files->len; i++)\n"
+" {\n"
+" GFile *file = files->pdata[i];\n"
+"\n"
+" priv->n_deletions_to_start--;\n"
+" g_file_delete_async (file, G_PRIORITY_DEFAULT, priv->delete_cancellable,\n"
+" delete_files_cb, self);\n"
+" }\n"
+"}\n"
+"\n"
+"static void\n"
+"delete_files_cb (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GFile *file; /* unowned */\n"
+" GError *error = NULL;\n"
+"\n"
+" file = G_FILE (source_object);\n"
+" self = MY_OBJECT (user_data);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish deleting the file. */\n"
+" g_file_delete_finish (file, result, &error);\n"
+"\n"
+" if (error != NULL &&\n"
+" !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" {\n"
+" g_warning (\"Error deleting file: %s\", error->message);\n"
+" }\n"
+"\n"
+" g_clear_error (&error);\n"
+"\n"
+" /* Update the internal state. */\n"
+" g_assert_cmpuint (priv->n_deletions_pending, >, 0);\n"
+" priv->n_deletions_pending--;\n"
+"\n"
+" /* Update the UI to show progress. */\n"
+" update_ui_to_show_progress (self,\n"
+" priv->n_deletions_pending,\n"
+" priv->n_deletions_total);\n"
+"\n"
+" /* If all deletions have completed, and no more are being started,\n"
+" * update the UI to show completion. */\n"
+" if (priv->n_deletions_pending == 0 && priv->n_deletions_to_start == 0)\n"
+" {\n"
+" update_ui_to_show_completion (self);\n"
+"\n"
+" /* Clear the operation state. */\n"
+" g_clear_object (&priv->delete_cancellable);\n"
+" priv->n_deletions_total = 0;\n"
+" }\n"
+"}\n"
+"\n"
+"static void\n"
+"my_object_dispose (GObject *obj)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+"\n"
+" priv = my_object_get_instance_private (MY_OBJECT (obj));\n"
+"\n"
+" /* Cancel any ongoing deletion operations.\n"
+" *\n"
+" * This ensures that if #MyObject is disposed part-way through the\n"
+" * delete_files() set of operations, the set gets cancelled and\n"
+" * doesn’t continue with an invalid #MyObject pointer. */\n"
+" g_cancellable_cancel (priv->delete_cancellable);\n"
+"\n"
+" /* Do other dispose calls here. */\n"
+" …\n"
+"\n"
+" /* Chain up. */\n"
+" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
+"}"
+
+#. (itstool) path: section/title
+#: C/async-programming.page:855
+#, fuzzy
+#| msgid "<code>GTask</code>"
+msgid "Wrapping with <code>GTask</code>"
+msgstr "<code>GTask</code>"
+
+#. (itstool) path: section/p
+#: C/async-programming.page:857
+msgid ""
+"Often when an asynchronous operation (or set of operations) becomes more "
+"complex, it needs associated state. This is typically stored in a custom "
+"structure — but defining a new structure to store the standard callback, "
+"user data and cancellable tuple is laborious. <link href=\"https://developer."
+"gnome.org/gio/stable/GTask.html\"><code>GTask</code></link> eases this by "
+"providing a standardized way to wrap all three, plus extra custom ‘task "
+"data’."
+msgstr ""
+
+#. (itstool) path: section/p
+#: C/async-programming.page:867
+msgid ""
+"The use of a <code>GTask</code> can replace the use of a <link href="
+"\"https://developer.gnome.org/gio/stable/GCancellable.html"
+"\"><code>GCancellable</code></link> for indicating whether an operation is "
+"ongoing."
+msgstr ""
+
+#. (itstool) path: example/p
+#: C/async-programming.page:874
+msgid ""
+"This example is functionally the same as <link xref=\"#series\"/>, but "
+"refactored to use a <code>GTask</code> to wrap the sequence of operations."
+msgstr ""
+
+#. (itstool) path: item/p
+#: C/async-programming.page:884
+msgid ""
+"State which was in <code>MyObjectPrivate</code> in <link xref=\"#series\"/> "
+"is now in the <code>ConnectToServerData</code> closure, which is set as the "
+"‘task data’ of the <code>GTask</code> representing the overall operation. "
+"This means it’s automatically freed after the operation returns."
+msgstr ""
+
+#. (itstool) path: item/p
+#: C/async-programming.page:891
+msgid ""
+"Furthermore, this means that manipulations of <code>MyObjectPrivate</code> "
+"state are limited to the start and end of the sequence of operations, so "
+"reusing the task in different situations becomes easier — for example, it is "
+"now a lot easier to support running multiple such tasks in parallel."
+msgstr ""
+
+#. (itstool) path: item/p
+#: C/async-programming.page:898
+msgid ""
+"As the <code>GTask</code> holds a reference to <code>MyObject</code>, it is "
+"impossible for the object to be disposed while the sequence of operations is "
+"ongoing, so the <code>my_object_dispose()</code> code has been removed. "
+"Instead, a <code>my_object_close()</code> method exists to allow any pending "
+"operations can be cancelled so <code>MyObject</code> can be disposed when "
+"desired."
+msgstr ""
+
+#. (itstool) path: example/code
+#: C/async-programming.page:909
+#, no-wrap
+msgid ""
+"\n"
+"static void\n"
+"connect_to_server_cb1 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"static void\n"
+"connect_to_server_cb2 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"static void\n"
+"connect_to_server_cb3 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data);\n"
+"\n"
+"typedef struct {\n"
+" GSocketConnection *connection; /* nullable; owned */\n"
+" guint8 message_buffer[128];\n"
+"} ConnectToServerData;\n"
+"\n"
+"static void\n"
+"connect_to_server_data_free (ConnectToServerData *data)\n"
+"{\n"
+" g_clear_object (&data->connection);\n"
+"}\n"
+"\n"
+"void\n"
+"my_object_connect_to_server_async (MyObject *self,\n"
+" GCancellable *cancellable,\n"
+" GAsyncReadyCallback callback,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
+" GTask *task = NULL; /* owned */\n"
+" ConnectToServerData *data = NULL; /* owned */\n"
+" GFile *address_file = NULL; /* owned */\n"
+"\n"
+" g_return_if_fail (MY_IS_OBJECT (self));\n"
+" g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));\n"
+"\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" if (priv->connect_task != NULL)\n"
+" {\n"
+" g_task_report_new_error (self, callback, user_data, NULL,\n"
+" G_IO_ERROR, G_IO_ERROR_PENDING,\n"
+" \"Already connecting to the server.\");\n"
+" return;\n"
+" }\n"
+"\n"
+" /* Set up a cancellable. */\n"
+" if (cancellable != NULL)\n"
+" {\n"
+" g_object_ref (cancellable);\n"
+" }\n"
+" else\n"
+" {\n"
+" cancellable = g_cancellable_new ();\n"
+" }\n"
+"\n"
+" /* Set up the task. */\n"
+" task = g_task_new (self, cancellable, callback, user_data);\n"
+" g_task_set_check_cancellable (task, FALSE);\n"
+"\n"
+" data = g_malloc0 (sizeof (ConnectToServerData));\n"
+" g_task_set_task_data (task, data,\n"
+" (GDestroyNotify) connect_to_server_data_free);\n"
+"\n"
+" g_object_unref (cancellable);\n"
+"\n"
+" priv->connect_task = g_object_ref (task);\n"
+"\n"
+" /* Read the socket address. */\n"
+" address_file = build_address_file ();\n"
+" g_file_load_contents_async (address_file, g_task_get_cancellable (task),\n"
+" connect_to_server_cb1, g_object_ref (task));\n"
+" g_object_unref (address_file);\n"
+"\n"
+" g_clear_object (&task);\n"
+"}\n"
+"\n"
+"static void\n"
+"connect_to_server_cb1 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
+"{\n"
+" MyObject *self;\n"
+" MyObjectPrivate *priv;\n"
+" GTask *task = NULL; /* owned */\n"
+" GFile *address_file; /* unowned */\n"
+" gchar *address = NULL; /* owned */\n"
+" gsize address_size = 0;\n"
+" GInetAddress *inet_address = NULL; /* owned */\n"
+" GInetSocketAddress *inet_socket_address = NULL; /* owned */\n"
+" guint16 port = 123;\n"
+" GSocketClient *socket_client = NULL; /* owned */\n"
+" GError *error = NULL;\n"
+"\n"
+" address_file = G_FILE (source_object);\n"
+" task = G_TASK (user_data);\n"
+" self = g_task_get_source_object (task);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" /* Finish loading the address. */\n"
+" g_file_load_contents_finish (address_file, result, &address,\n"
+" &address_size, NULL, &error);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" goto done;\n"
+" }\n"
+"\n"
+" /* Parse the address. */\n"
+" inet_address = g_inet_address_new_from_string (address);\n"
+"\n"
+" if (inet_address == NULL)\n"
+" {\n"
+" /* Error. */\n"
+" g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,\n"
+" \"Invalid address ‘%s’.\", address);\n"
+" goto done;\n"
+" }\n"
+"\n"
+" inet_socket_address = g_inet_socket_address_new (inet_address, port);\n"
+"\n"
+" /* Connect to the given address. */\n"
+" socket_client = g_socket_client_new ();\n"
+"\n"
+" g_socket_client_connect_async (socket_client,\n"
+" G_SOCKET_CONNECTABLE (inet_socket_address),\n"
+" g_task_get_cancellable (task),\n"
+" connect_to_server_cb2,\n"
+" g_object_ref (task));\n"
+"\n"
+"done:\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Stop the operation and propagate the error. */\n"
+" g_clear_object (&priv->connect_task);\n"
+" g_task_return_error (task, error);\n"
+" }\n"
+"\n"
+" g_free (address);\n"
+" g_clear_object (&inet_address);\n"
+" g_clear_object (&inet_socket_address);\n"
+" g_clear_object (&socket_client);\n"
+" g_clear_object (&task);\n"
+"}\n"
"\n"
"static void\n"
-"delete_files (MyObject *self,\n"
-" GPtrArray/*<owned GFile*>>*/ *files)\n"
+"connect_to_server_cb2 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
"{\n"
+" MyObject *self;\n"
" MyObjectPrivate *priv;\n"
-" GFile *address_file = NULL; /* owned */\n"
+" GTask *task = NULL; /* owned */\n"
+" ConnectToServerData *data; /* unowned */\n"
+" GSocketClient *socket_client; /* unowned */\n"
+" GSocketConnection *connection = NULL; /* owned */\n"
+" GInputStream *input_stream; /* unowned */\n"
+" GError *error = NULL;\n"
"\n"
+" socket_client = G_SOCKET_CLIENT (source_object);\n"
+" task = G_TASK (user_data);\n"
+" data = g_task_get_task_data (task);\n"
+" self = g_task_get_source_object (task);\n"
" priv = my_object_get_instance_private (self);\n"
"\n"
-" /* Set up a cancellable if no operation is ongoing already. */\n"
-" if (priv->delete_cancellable == NULL)\n"
+" /* Finish connecting to the socket. */\n"
+" connection = g_socket_client_connect_finish (socket_client, result,\n"
+" &error);\n"
+"\n"
+" if (error != NULL)\n"
" {\n"
-" priv->delete_cancellable = g_cancellable_new ();\n"
-" priv->n_deletions_pending = 0;\n"
-" priv->n_deletions_total = 0;\n"
+" goto done;\n"
" }\n"
"\n"
-" /* Update internal state, and temporarily set @n_deletions_to_start. This is\n"
-" * used in delete_files_cb() to avoid indicating the overall operation has\n"
-" * completed while deletions are still being started. This can happen if\n"
-" * g_file_delete_async() completes synchronously, for example if there’s a\n"
-" * non-blocking fast path for the given file system. */\n"
-" priv->n_deletions_pending += files->len;\n"
-" priv->n_deletions_total += files->len;\n"
-" priv->n_deletions_to_start = files->len;\n"
+" /* Store a reference to the connection so it is kept open while we read from\n"
+" * it: #GInputStream does not keep a reference to a #GIOStream which contains\n"
+" * it. */\n"
+" data->connection = g_object_ref (connection);\n"
"\n"
-" /* Update the UI to indicate the files are being deleted. */\n"
-" update_ui_to_show_progress (self,\n"
-" priv->n_deletions_pending,\n"
-" priv->n_deletions_total);\n"
+" /* Read a message from the connection. As the buffer is allocated as part of\n"
+" * the per-task @data, multiple tasks can run concurrently. */\n"
+" input_stream = g_io_stream_get_input_stream (G_IO_STREAM (connection));\n"
"\n"
-" /* Start all the deletion operations in parallel. They share the same\n"
-" * #GCancellable. */\n"
-" for (i = 0; i < files->len; i++)\n"
-" {\n"
-" GFile *file = files->pdata[i];\n"
+" g_input_stream_read_async (input_stream,\n"
+" data->message_buffer,\n"
+" sizeof (data->message_buffer),\n"
+" G_PRIORITY_DEFAULT, g_task_get_cancellable (task),\n"
+" connect_to_server_cb3, g_object_ref (task));\n"
"\n"
-" priv->n_deletions_to_start--;\n"
-" g_file_delete_async (file, G_PRIORITY_DEFAULT, priv->delete_cancellable,\n"
-" delete_files_cb, self);\n"
+"done:\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Stop the operation and propagate the error. */\n"
+" g_clear_object (&priv->connect_task);\n"
+" g_task_return_error (task, error);\n"
" }\n"
+"\n"
+" g_clear_object (&connection);\n"
+" g_clear_object (&task);\n"
"}\n"
"\n"
"static void\n"
-"delete_files_cb (GObject *source_object,\n"
-" GAsyncResult *result,\n"
-" gpointer user_data)\n"
+"connect_to_server_cb3 (GObject *source_object,\n"
+" GAsyncResult *result,\n"
+" gpointer user_data)\n"
"{\n"
" MyObject *self;\n"
" MyObjectPrivate *priv;\n"
-" GFile *file; /* unowned */\n"
+" GTask *task = NULL; /* owned */\n"
+" ConnectToServerData *data; /* unowned */\n"
+" GInputStream *input_stream; /* unowned */\n"
+" gssize len = 0;\n"
" GError *error = NULL;\n"
"\n"
-" file = G_FILE (source_object);\n"
-" self = MY_OBJECT (user_data);\n"
+" input_stream = G_INPUT_STREAM (source_object);\n"
+" task = G_TASK (user_data);\n"
+" data = g_task_get_task_data (task);\n"
+" self = g_task_get_source_object (task);\n"
" priv = my_object_get_instance_private (self);\n"
"\n"
-" /* Finish deleting the file. */\n"
-" g_file_delete_finish (file, result, &error);\n"
+" /* Finish reading from the socket. */\n"
+" len = g_input_stream_read_finish (input_stream, result, &error);\n"
"\n"
-" if (error != NULL &&\n"
-" !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))\n"
+" if (error != NULL)\n"
" {\n"
-" g_warning (\"Error deleting file: %s\", error->message);\n"
+" goto done;\n"
" }\n"
"\n"
-" g_clear_error (&error);\n"
-"\n"
-" /* Update the internal state. */\n"
-" g_assert_cmpuint (priv->n_deletions_pending, >, 0);\n"
-" priv->n_deletions_pending--;\n"
+" /* Handle the message. */\n"
+" g_assert_cmpint (len, >=, 0);\n"
+" g_assert_cmpuint ((gsize) len, <=, sizeof (data->message_buffer));\n"
"\n"
-" /* Update the UI to show progress. */\n"
-" update_ui_to_show_progress (self,\n"
-" priv->n_deletions_pending,\n"
-" priv->n_deletions_total);\n"
+" handle_received_message (self, data->message_buffer, len, &error);\n"
"\n"
-" /* If all deletions have completed, and no more are being started,\n"
-" * update the UI to show completion. */\n"
-" if (priv->n_deletions_pending == 0 && priv->n_deletions_to_start == 0)\n"
+" if (error != NULL)\n"
" {\n"
-" update_ui_to_show_completion (self);\n"
+" goto done;\n"
+" }\n"
"\n"
-" /* Clear the operation state. */\n"
-" g_clear_object (&priv->delete_cancellable);\n"
-" priv->n_deletions_total = 0;\n"
+" /* Success! */\n"
+" g_task_return_boolean (task, TRUE);\n"
+"\n"
+"done:\n"
+" /* Unconditionally mark the operation as finished.\n"
+" *\n"
+" * The streams should automatically close as this\n"
+" * last reference is dropped. */\n"
+" g_clear_object (&priv->connect_task);\n"
+"\n"
+" if (error != NULL)\n"
+" {\n"
+" /* Stop the operation and propagate the error. */\n"
+" g_task_return_error (task, error);\n"
" }\n"
+"\n"
+" g_clear_object (&task);\n"
"}\n"
"\n"
-"static void\n"
-"my_object_dispose (GObject *obj)\n"
+"void\n"
+"my_object_connect_to_server_finish (MyObject *self,\n"
+" GAsyncResult *result,\n"
+" GError **error)\n"
"{\n"
-" MyObjectPrivate *priv;\n"
+" g_return_if_fail (MY_IS_OBJECT (self));\n"
+" g_return_if_fail (g_task_is_valid (result, self));\n"
+" g_return_if_fail (error == NULL || *error == NULL);\n"
"\n"
-" priv = my_object_get_instance_private (MY_OBJECT (obj));\n"
+" g_task_propagate_boolean (G_TASK (result), error);\n"
+"}\n"
"\n"
-" /* Cancel any ongoing deletion operations.\n"
-" *\n"
-" * This ensures that if #MyObject is disposed part-way through the\n"
-" * delete_files() set of operations, the set gets cancelled and\n"
-" * doesn’t continue with an invalid #MyObject pointer. */\n"
-" g_cancellable_cancel (priv->delete_cancellable);\n"
+"void\n"
+"my_object_close (MyObject *self)\n"
+"{\n"
+" MyObjectPrivate *priv;\n"
"\n"
-" /* Do other dispose calls here. */\n"
-" …\n"
+" g_return_if_fail (MY_IS_OBJECT (self));\n"
"\n"
-" /* Chain up. */\n"
-" G_OBJECT_CLASS (my_object_parent_class)->dispose (obj);\n"
+" priv = my_object_get_instance_private (self);\n"
+"\n"
+" if (priv->connect_task != NULL)\n"
+" {\n"
+" GCancellable *cancellable = g_task_get_cancellable (priv->connect_task);\n"
+" g_cancellable_cancel (cancellable);\n"
+" }\n"
"}"
msgstr ""
-
-#. (itstool) path: section/title
-#: C/async-programming.page:855
-#, fuzzy
-#| msgid "<code>GTask</code>"
-msgid "Wrapping with <code>GTask</code>"
-msgstr "<code>GTask</code>"
-
-#. (itstool) path: section/p
-#: C/async-programming.page:857
-msgid ""
-"Often when an asynchronous operation (or set of operations) becomes more "
-"complex, it needs associated state. This is typically stored in a custom "
-"structure — but defining a new structure to store the standard callback, "
-"user data and cancellable tuple is laborious. <link href=\"https://developer."
-"gnome.org/gio/stable/GTask.html\"><code>GTask</code></link> eases this by "
-"providing a standardized way to wrap all three, plus extra custom ‘task "
-"data’."
-msgstr ""
-
-#. (itstool) path: section/p
-#: C/async-programming.page:867
-msgid ""
-"The use of a <code>GTask</code> can replace the use of a <link href="
-"\"https://developer.gnome.org/gio/stable/GCancellable.html"
-"\"><code>GCancellable</code></link> for indicating whether an operation is "
-"ongoing."
-msgstr ""
-
-#. (itstool) path: example/p
-#: C/async-programming.page:874
-msgid ""
-"This example is functionally the same as <link xref=\"#series\"/>, but "
-"refactored to use a <code>GTask</code> to wrap the sequence of operations."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:884
-msgid ""
-"State which was in <code>MyObjectPrivate</code> in <link xref=\"#series\"/> "
-"is now in the <code>ConnectToServerData</code> closure, which is set as the "
-"‘task data’ of the <code>GTask</code> representing the overall operation. "
-"This means it’s automatically freed after the operation returns."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:891
-msgid ""
-"Furthermore, this means that manipulations of <code>MyObjectPrivate</code> "
-"state are limited to the start and end of the sequence of operations, so "
-"reusing the task in different situations becomes easier — for example, it is "
-"now a lot easier to support running multiple such tasks in parallel."
-msgstr ""
-
-#. (itstool) path: item/p
-#: C/async-programming.page:898
-msgid ""
-"As the <code>GTask</code> holds a reference to <code>MyObject</code>, it is "
-"impossible for the object to be disposed while the sequence of operations is "
-"ongoing, so the <code>my_object_dispose()</code> code has been removed. "
-"Instead, a <code>my_object_close()</code> method exists to allow any pending "
-"operations can be cancelled so <code>MyObject</code> can be disposed when "
-"desired."
-msgstr ""
-
-#. (itstool) path: example/code
-#: C/async-programming.page:909
-#, no-wrap
-msgid ""
"\n"
"static void\n"
"connect_to_server_cb1 (GObject *source_object,\n"
@@ -1812,7 +2606,6 @@ msgid ""
" g_cancellable_cancel (cancellable);\n"
" }\n"
"}"
-msgstr ""
#. (itstool) path: credit/name
#: C/c-coding-style.page:15 C/documentation.page:21
@@ -2826,6 +3619,9 @@ 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 los espacios en blanco finales en cualquier línea, preferiblemente "
+"como un parche o confirmación por separado. Nunca use líneas vacías al "
+"principio o al final de un archivo."
#. (itstool) path: section/p
#: C/c-coding-style.page:564
@@ -3139,6 +3935,8 @@ msgid ""
"The only major rule for headers is that the function definitions should be "
"vertically aligned in three columns:"
msgstr ""
+"La única regla principal para los encabezados es que las definiciones de "
+"funciones deben alinearse verticalmente en tres columnas:"
#. (itstool) path: section/code
#: C/c-coding-style.page:725
@@ -3368,6 +4166,8 @@ msgid ""
"For final types, private data can be stored in the object struct, which "
"should be defined in the C file:"
msgstr ""
+"Para los tipos finales, los datos privados se pueden almacenar en la "
+"estructura del objeto, que se debe definir en el archivo C:"
#. (itstool) path: section/code
#: C/c-coding-style.page:843
@@ -3447,6 +4247,8 @@ msgstr ""
#: C/c-coding-style.page:882
msgid "Interface types should always have the dummy typedef for cast purposes:"
msgstr ""
+"Los tipos de interfaz siempre deben tener el tipo de definición ficticio "
+"para propósitos de conversión:"
#. (itstool) path: section/code
#: C/c-coding-style.page:887
@@ -3551,7 +4353,8 @@ msgstr ""
#: C/c-coding-style.page:944
msgid "See <link xref=\"memory-management\"/> for more details."
msgstr ""
-"Consulte la sección <link xref=\"memory-management\"/> para obtener más detalles."
+"Consulte la sección <link xref=\"memory-management\"/> para obtener más "
+"detalles."
#. (itstool) path: section/title
#: C/c-coding-style.page:950
@@ -3622,7 +4425,7 @@ msgstr ""
#. (itstool) path: license/p
#: C/cc-by-sa-3-0.xml:3
msgid "This work is licensed under a <_:link-1/>."
-msgstr ""
+msgstr "Este trabajo está licenciado bajo la <_:link-1/>."
#. (itstool) path: license/p
#: C/cc-by-sa-3-0.xml:6
@@ -3686,6 +4489,14 @@ msgid ""
"is configuration data. If it contains user created content, it is not "
"configuration data, and should not be stored in GSettings."
msgstr ""
+"Los datos de configuración deben almacenarse en <link href=\"https://"
+"developer.gnome.org/gio/stable/GSettings.html\"> GSettings </link>. Como "
+"regla general, si algunos datos deben ser persistentes y afectan el "
+"comportamiento de una aplicación, son datos de configuración. Si podría "
+"estar sujeto a políticas impuestas por el administrador del sistema (como la "
+"configuración de proxy o de bloqueo), son datos de configuración. Si "
+"contiene contenido creado por el usuario, no son datos de configuración y no "
+"deben almacenarse en GSettings."
#. (itstool) path: section/p
#: C/databases.page:60
@@ -3820,8 +4631,8 @@ msgid ""
"in the gtk-doc build. (<link xref=\"#dbus-api\"/>)"
msgstr ""
"Use <cmd>gdbus-codegen</cmd> para generar la documentación de la API de D-"
-"Bus que incluir en la construcción de gtk-doc. (Consulte la sección <link xref="
-"\"#dbus-api\"/>)"
+"Bus que incluir en la construcción de gtk-doc. (Consulte la sección <link "
+"xref=\"#dbus-api\"/>)"
#. (itstool) path: item/p
#: C/documentation.page:51
@@ -3950,6 +4761,8 @@ 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 ""
+"Es importante aclarar la licencia utilizada para las referencias API, "
+"especialmente si contienen ejemplos de código que podrían copiarse."
#. (itstool) path: section/p
#: C/documentation.page:155
@@ -4748,6 +5561,10 @@ msgid ""
"(correct) GList implementation, but better cache locality and lower memory "
"consumption, so will perform better for large numbers of elements:"
msgstr ""
+"La implementación de lo anterior con un GPtrArray tiene la misma complejidad "
+"que la primera implementación GList (correcta), pero mejor localidad de "
+"caché y menor consumo de memoria, por lo que funcionará mejor para un gran "
+"número de elementos:"
#. (itstool) path: section/code
#: C/glist.page:89
@@ -4817,6 +5634,15 @@ msgid ""
"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 ""
+"Este artículo contiene varias pautas y sugerencias para los programadores "
+"que trabajan en y con la pila de GNOME. Esto está destinado a que los "
+"programadores conozcan los procesos de desarrollo, las convenciones y las "
+"filosofías detrás de las aplicaciones de GNOME y la pila de bibliotecas que "
+"las respaldan. Al conocer «cómo se hacen las cosas» en el ecosistema de "
+"GNOME, se espera que los programadores encuentren el uso de las API de GNOME "
+"y el desarrollo de nuevas aplicaciones más fáciles y más naturales, y "
+"produzcan código que sea legible y mantenible durante un largo período de "
+"tiempo por un equipo diverso de programadores.e copiado alrededor."
#. (itstool) path: page/p
#: C/index.page:50
@@ -4831,6 +5657,10 @@ msgid ""
"practices, and that will be accepted by the community. This will also lead "
"to code that is a pleasure to work on."
msgstr ""
+"Para darle buenas sugerencias sobre cómo escribir código para GNOME o usar "
+"las tecnologías de GNOME. Esto lo ayudará a escribir código que sea "
+"consistente con las mejores prácticas, y que será aceptado por la comunidad. "
+"Esto también conducirá a un código en el que es un placer trabajar."
#. (itstool) path: item/p
#: C/index.page:65
@@ -4839,6 +5669,9 @@ msgid ""
"GNOME project sustainable, even when people’s contributions increase or "
"decrease."
msgstr ""
+"Para transmitir el conocimiento que hemos obtenido a lo largo de los años "
+"sobre cómo mantener el proyecto GNOME sostenible, incluso cuando las "
+"contribuciones de las personas aumentan o disminuyen."
#. (itstool) path: info/title
#: C/index.page:75
@@ -4924,8 +5757,8 @@ msgid ""
"Enable introspection for all libraries. (<link xref=\"#using-introspection\"/"
">)"
msgstr ""
-"Active la introspección para todas las bibliotecas. (Consulte la sección <link xref="
-"\"#using-introspection\"/>)"
+"Active la introspección para todas las bibliotecas. (Consulte la sección "
+"<link xref=\"#using-introspection\"/>)"
#. (itstool) path: item/p
#: C/introspection.page:50
@@ -5068,6 +5901,7 @@ msgstr ""
#: C/logging.page:18
msgid "Logging debug and information output from libraries and programs"
msgstr ""
+"Registro de depuración y salida de información de bibliotecas y programas"
#. (itstool) path: page/title
#: C/logging.page:23
@@ -5086,6 +5920,15 @@ msgid ""
"Using different logging mechanisms and formats in different projects is not "
"the right approach."
msgstr ""
+"El registro de la depuración y la salida informativa de bibliotecas y "
+"programas es un problema abierto, y existen varios métodos para convertir "
+"múltiples flujos de salida de registro en los flujos stdout y stderr "
+"habituales. A continuación se presentan algunas sugerencias sobre cómo "
+"implementar el registro. Sin embargo, lo más importante es garantizar que el "
+"registro sea coherente, de modo que se pueda acceder a los datos de registro "
+"y buscarlos con un mínimo de esfuerzo, ya que para eso se utilizan. El uso "
+"de diferentes mecanismos y formatos de registro en diferentes proyectos no "
+"es el enfoque correcto."
#. (itstool) path: item/p
#: C/logging.page:40
@@ -5320,6 +6163,10 @@ msgid ""
"propagate through library code and be handled in a log handler at the top "
"level of an application."
msgstr ""
+"Del mismo modo, no configure controladores de registro en el código de la "
+"biblioteca. Los mensajes de registro deben propagarse a través del código de "
+"la biblioteca y manejarse en un controlador de registro en el nivel superior "
+"de una aplicación."
#. (itstool) path: section/title
#: C/logging.page:189
@@ -5579,6 +6426,10 @@ msgid ""
"do the bulk of the work: preparing source lists, waiting for events, and "
"dispatching callbacks. A main loop simply iterates a context."
msgstr ""
+"Es importante no confundir los contextos principales con los bucles "
+"principales. Los contextos principales hacen la mayor parte del trabajo: "
+"preparar listas de fuentes, esperar eventos y enviar devoluciones de "
+"llamadas. Un bucle principal simplemente itera un contexto."
#. (itstool) path: section/title
#: C/main-contexts.page:186
@@ -5863,6 +6714,10 @@ msgid ""
"are invoked in the main thread, typically resulting in work being brought "
"back from a worker thread into the main thread."
msgstr ""
+"El uso implícito del contexto principal global predeterminado significa que "
+"las funciones de devolución de llamada se invocan en el hilo principal, lo "
+"que generalmente hace que el trabajo sea devuelto desde un hilo de trabajo "
+"al hilo principal."
#. (itstool) path: td/p
#: C/main-contexts.page:356
@@ -6179,6 +7034,8 @@ msgid ""
"The example below demonstrates the underlying principles, but there are "
"convenience methods explained below which simplify things."
msgstr ""
+"El siguiente ejemplo demuestra los principios subyacentes, pero hay métodos "
+"de conveniencia explicados a continuación que simplifican las cosas."
#. (itstool) path: example/code
#: C/main-contexts.page:593
@@ -6590,6 +7447,12 @@ msgid ""
"rather than debugging race conditions which can easily result from a "
"function being called in the wrong thread."
msgstr ""
+"Si se coloca en la parte superior de cada función, cualquier falla de "
+"aserción resaltará un caso en el que se llamó a una función desde el hilo "
+"equivocado. Es mucho más fácil escribir estas afirmaciones cuando se "
+"desarrolla inicialmente el código, en lugar de depurar las condiciones de "
+"carrera que pueden resultar fácilmente de una función que se llama en el "
+"hilo incorrecto."
#. (itstool) path: section/p
#: C/main-contexts.page:839
@@ -7625,7 +8488,7 @@ msgstr ""
#. (itstool) path: example/p
#: C/memory-management.page:618
msgid "Floating references allow the following code to be simplified:"
-msgstr ""
+msgstr "Las referencias flotantes permiten simplificar el siguiente código:"
#. (itstool) path: example/code
#: C/memory-management.page:621
@@ -8462,6 +9325,10 @@ msgid ""
"the same time is hard to organize and demoralizing, as most API breaks do "
"not bring large new features which would motivate porting."
msgstr ""
+"Esto es imposible de mantener, y pedir que todos los proyectos se "
+"transfieran a una nueva API al mismo tiempo es difícil de organizar y "
+"desmoralizante, ya que la mayoría de las interrupciones de la API no ofrecen "
+"nuevas características grandes que motivaren la transferencia."
#. (itstool) path: section/p
#: C/parallel-installability.page:123
@@ -8749,6 +9616,8 @@ msgid ""
"There’s some temptation to keep one of the header files outside of any "
"subdirectory:"
msgstr ""
+"Existe la tentación de mantener uno de los archivos de encabezado fuera de "
+"cualquier subdirectorio:"
#. (itstool) path: item/p
#: C/parallel-installability.page:285
@@ -8840,6 +9709,8 @@ msgstr "Bibliotecas"
#: C/parallel-installability.page:334
msgid "Library object files should have a versioned name. For example:"
msgstr ""
+"Los archivos de objetos de la biblioteca deben tener un nombre versionado. "
+"Por ejemplo:"
#. (itstool) path: section/p
#: C/parallel-installability.page:342
@@ -8847,6 +9718,9 @@ 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 ""
+"Esto permite que las aplicaciones obtengan exactamente lo que desean en el "
+"momento de la compilación y garantiza que las versiones 4 y 5 no tengan "
+"archivos en común."
#. (itstool) path: section/p
#: C/parallel-installability.page:347
@@ -8854,6 +9728,8 @@ msgid ""
"Versioned libraries can be built and installed from automake using the "
"following code:"
msgstr ""
+"Las bibliotecas versionadas se pueden construir e instalar desde automake "
+"usando el siguiente código:"
#. (itstool) path: listing/title
#: C/parallel-installability.page:352
@@ -9757,6 +10633,9 @@ 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 ""
+"Prácticamente, esto significa tener todas las advertencias del compilador y "
+"otras herramientas habilitadas y configuradas para fallar el proceso de "
+"compilación con un error si se emiten."
#. (itstool) path: item/p
#: C/tooling.page:48
@@ -10049,7 +10928,6 @@ msgstr "Añada <code>AX_VALGRIND_CHECK</code> a <file>configure.ac</file>."
#. (itstool) path: item/p
#: C/tooling.page:233
-#, fuzzy
#| msgid ""
#| "Add <code>@VALGRIND_CHECK_RULES</code> to the top-level <file>Makefile."
#| "am</file>."
@@ -10057,8 +10935,8 @@ msgid ""
"Add <code>@VALGRIND_CHECK_RULES@</code> to the <file>Makefile.am</file> in "
"each directory which contains unit tests."
msgstr ""
-"Añada <code>@VALGRIND_CHECK_RULES</code> al nivel superior de <file>Makefile."
-"am</file>."
+"Añada <code>@VALGRIND_CHECK_RULES</code> al archivo <file>Makefile.am</file> "
+"en cada carpeta que contenga pruebas unitarias."
#. (itstool) path: section/p
#: C/tooling.page:239
@@ -10952,7 +11830,6 @@ msgstr ""
#. (itstool) path: item/p
#: C/unit-testing.page:286
-#, fuzzy
#| msgid ""
#| "<link href=\"http://en.wikipedia.org/wiki/Dependency_injection"
#| "\">Dependency injection</link>"
@@ -10960,7 +11837,7 @@ msgid ""
"<link href=\"https://en.wikipedia.org/wiki/Dependency_injection\">Dependency "
"injection</link>"
msgstr ""
-"<link href=\"http://en.wikipedia.org/wiki/Dependency_injection\">Inyección "
+"<link href=\"https://en.wikipedia.org/wiki/Dependency_injection\">Inyección "
"de dependencias</link>"
#. (itstool) path: item/p
@@ -11008,8 +11885,8 @@ msgid ""
"reports or specifications. (<link xref=\"#guidelines-for-making-commits\"/>)"
msgstr ""
"Incluya un razonamiento completo en los mensajes de commit, así como enlaces "
-"a los informes de error o a la especificaciones. (Consulte la sección <link xref="
-"\"#guidelines-for-making-commits\"/>)"
+"a los informes de error o a la especificaciones. (Consulte la sección <link "
+"xref=\"#guidelines-for-making-commits\"/>)"
#. (itstool) path: item/p
#: C/version-control.page:43
@@ -11837,7 +12714,6 @@ msgstr ""
#. (itstool) path: item/p
#: C/writing-good-code.page:137
-#, fuzzy
#| msgid ""
#| "<link href=\"http://en.wikipedia.org/wiki/Design_Patterns\"> Design "
#| "Patterns: Elements of Reusable Object-Oriented Software </link>, by Erich "
@@ -11847,7 +12723,7 @@ msgid ""
"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 "
+"<link href=\"https://en.wikipedia.org/wiki/Design_Patterns\"> Design "
"Patterns: Elements of Reusable Object-Oriented Software </link>, por Erich "
"Gamma, Richard Helm, Ralph Johnson y John Vlissides."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]