[gnome-documents/wip/skydrive: 25/28] lib: use an async method to create the SkyDrivedownload stream



commit 664981e9d9c593b65a3a2aaa8379b0dcd0eff1ba
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jun 1 21:35:27 2012 +0200

    lib: use an async method to create the SkyDrivedownload stream
    
    Fixes: https://bugzilla.gnome.org/666535

 src/lib/gd-pdf-loader.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/lib/gd-pdf-loader.c b/src/lib/gd-pdf-loader.c
index 26c08ce..877d271 100644
--- a/src/lib/gd-pdf-loader.c
+++ b/src/lib/gd-pdf-loader.c
@@ -380,16 +380,15 @@ pdf_load_job_gdata_refresh_cache (PdfLoadJob *job)
 }
 
 static void
-pdf_load_job_zpj_refresh_cache (PdfLoadJob *job)
+zpj_download_stream_ready (GObject *source,
+                       GAsyncResult *res,
+                       gpointer user_data)
 {
-  GInputStream *stream;
   GError *error = NULL;
   GFile *pdf_file;
+  PdfLoadJob *job = (PdfLoadJob *) user_data;
 
-  job->stream = zpj_skydrive_download_file_to_stream (job->zpj_service,
-                                                      ZPJ_SKYDRIVE_FILE (job->zpj_entry),
-                                                      job->cancellable, &error);
-
+  job->stream = zpj_skydrive_download_file_to_stream_finish (ZPJ_SKYDRIVE (source), res, &error);
   if (error != NULL) {
     pdf_load_job_complete_error (job, error);
     return;
@@ -407,6 +406,19 @@ pdf_load_job_zpj_refresh_cache (PdfLoadJob *job)
 }
 
 static void
+pdf_load_job_zpj_refresh_cache (PdfLoadJob *job)
+{
+  GInputStream *stream;
+  GError *error = NULL;
+
+  zpj_skydrive_download_file_to_stream_async (job->zpj_service,
+                                              ZPJ_SKYDRIVE_FILE (job->zpj_entry),
+                                              job->cancellable,
+                                              zpj_download_stream_ready,
+                                              job);
+}
+
+static void
 gdata_cache_query_info_ready_cb (GObject *source,
                                  GAsyncResult *res,
                                  gpointer user_data)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]