[telepathy-doc/master] actually implement InitialOffsetDefined

Davyd Madeley davyd at madeley.id.au
Wed Apr 8 01:35:56 PDT 2009


---
 docs/examples/glib_salut_ft/gnio-sender.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/docs/examples/glib_salut_ft/gnio-sender.c b/docs/examples/glib_salut_ft/gnio-sender.c
index 53d2a33..3ccc8b7 100644
--- a/docs/examples/glib_salut_ft/gnio-sender.c
+++ b/docs/examples/glib_salut_ft/gnio-sender.c
@@ -133,6 +133,11 @@ file_transfer_state_changed_cb (TpChannel	*channel,
 				g_file_read (ftstate->file, NULL, &error));
 		handle_error (error);
 
+		g_seekable_seek (G_SEEKABLE (ftstate->input),
+				ftstate->offset, G_SEEK_SET, NULL,
+				&error);
+		handle_error (error);
+
 		/* splice the input stream into the output stream and GIO
 		 * takes care of the rest */
 		g_output_stream_splice_async (output, ftstate->input,
@@ -156,6 +161,18 @@ file_transfer_state_changed_cb (TpChannel	*channel,
 }
 
 static void
+initial_offset_defined_cb (TpChannel	*channel,
+			   guint64	 offset,
+			   gpointer	 user_data,
+			   GObject	*weak_obj)
+{
+	struct ft_state *ftstate = (struct ft_state *) user_data;
+
+	g_print (" > initial_offset_defined_cb (%llu)\n", offset);
+	ftstate->offset = offset;
+}
+
+static void
 file_transfer_channel_ready (TpChannel		*channel,
                              const GError	*in_error,
 			     gpointer		 user_data)
@@ -203,6 +220,11 @@ file_transfer_channel_ready (TpChannel		*channel,
 		ftstate->client = G_SOCKET_CLIENT (g_unix_client_new ());
 	}
 
+	tp_cli_channel_type_file_transfer_connect_to_initial_offset_defined (
+			channel, initial_offset_defined_cb,
+			ftstate, NULL, NULL, &error);
+	handle_error (error);
+
 	tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed (
 			channel, file_transfer_state_changed_cb,
 			ftstate, NULL, NULL, &error);
-- 
1.5.6.5



More information about the telepathy-commits mailing list