[telepathy-doc/master] Add a section on splicing for FT

Davyd Madeley davyd at madeley.id.au
Wed Jul 22 23:07:11 PDT 2009


---
 docs/book/C/filetransfer.xml              |   20 ++++++++++++++++++++
 docs/examples/glib_salut_ft/gnio-sender.c |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/docs/book/C/filetransfer.xml b/docs/book/C/filetransfer.xml
index 4a86bea..8e6c4a0 100644
--- a/docs/book/C/filetransfer.xml
+++ b/docs/book/C/filetransfer.xml
@@ -388,6 +388,26 @@
     If you wish to cancel your own file transfer, simply
     <methodname>Close</methodname> the channel.
    </para>
+
+   <sect3 id="sect.filetransfer.sending.open.gio">
+    <title>Using GIO</title>
+
+    <para>
+     With GLib's GIO, you can splice transfer between the disk and the
+     network, which makes implementing file transfer very simple.
+     <xref linkend="ex.filetransfer.sending.open.gio"/> shows an example of
+     doing this.
+    </para>
+
+    <example id="ex.filetransfer.sending.open.gio"
+             file="glib_salut_ft/gnio-sender.c">
+     <title>Splicing a file stream into a network socket with GIO</title>
+    </example>
+
+    <para>
+     A similar implementation can be used to receive files.
+    </para>
+   </sect3>
   </sect2>
  </sect1>
 
diff --git a/docs/examples/glib_salut_ft/gnio-sender.c b/docs/examples/glib_salut_ft/gnio-sender.c
index e7b8d57..9751616 100644
--- a/docs/examples/glib_salut_ft/gnio-sender.c
+++ b/docs/examples/glib_salut_ft/gnio-sender.c
@@ -115,6 +115,7 @@ file_transfer_state_changed_cb (TpChannel	*channel,
 
 	if (state == TP_FILE_TRANSFER_STATE_OPEN)
 	{
+		/* begin ex.filetransfer.sending.open.gio */
 		ftstate->connection = g_socket_client_connect (
 				ftstate->client,
 				G_SOCKET_CONNECTABLE (ftstate->address),
@@ -140,6 +141,7 @@ file_transfer_state_changed_cb (TpChannel	*channel,
 				G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
 				0, NULL,
 				splice_done_cb, ftstate);
+		/* end ex.filetransfer.sending.open.gio */
 	}
 	else if (state == TP_FILE_TRANSFER_STATE_COMPLETED ||
 		 state == TP_FILE_TRANSFER_STATE_CANCELLED)
-- 
1.5.6.5



More information about the telepathy-commits mailing list