[libsocialweb: 3/7] photobucket: Support upload progress.
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsocialweb: 3/7] photobucket: Support upload progress.
- Date: Wed, 13 Apr 2011 17:09:30 +0000 (UTC)
commit 017e7632f8d2c58ae6780bbcabb60da2ac9cde20
Author: Eitan Isaacson <eitan isaacson collabora co uk>
Date: Tue Apr 5 19:01:54 2011 -0700
photobucket: Support upload progress.
services/photobucket/photobucket.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/services/photobucket/photobucket.c b/services/photobucket/photobucket.c
index 113491a..458aa59 100644
--- a/services/photobucket/photobucket.c
+++ b/services/photobucket/photobucket.c
@@ -342,7 +342,7 @@ _upload_file (SwServicePhotobucket *self,
MediaType upload_type,
const gchar *filename,
GHashTable *extra_fields,
- RestProxyCallAsyncCallback upload_cb,
+ RestProxyCallUploadCallback upload_cb,
GError **error)
{
SwServicePhotobucketPrivate *priv = self->priv;
@@ -412,11 +412,11 @@ _upload_file (SwServicePhotobucket *self,
SW_DEBUG (PHOTOBUCKET, "Uploading %s", basename);
- rest_proxy_call_async (call,
- upload_cb,
- G_OBJECT (self),
- GINT_TO_POINTER (opid),
- NULL);
+ rest_proxy_call_upload (call,
+ upload_cb,
+ G_OBJECT (self),
+ GINT_TO_POINTER (opid),
+ NULL);
OUT:
g_free (basename);
@@ -796,6 +796,8 @@ collections_iface_init (gpointer g_iface,
static void
_upload_photo_cb (RestProxyCall *call,
+ gsize total,
+ gsize uploaded,
const GError *error,
GObject *weak_object,
gpointer user_data)
@@ -807,7 +809,8 @@ _upload_photo_cb (RestProxyCall *call,
sw_photo_upload_iface_emit_photo_upload_progress (self, opid, -1,
error->message);
} else {
- sw_photo_upload_iface_emit_photo_upload_progress (self, opid, 100, "");
+ gint percent = (gdouble) uploaded / (gdouble) total * 100;
+ sw_photo_upload_iface_emit_photo_upload_progress (self, opid, percent, "");
}
}
@@ -821,7 +824,7 @@ _photobucket_upload_photo (SwPhotoUploadIface *self,
gint opid;
opid = _upload_file (SW_SERVICE_PHOTOBUCKET (self), PHOTO, filename,
- fields, (RestProxyCallAsyncCallback) _upload_photo_cb,
+ fields, (RestProxyCallUploadCallback) _upload_photo_cb,
&error);
if (error) {
@@ -848,6 +851,8 @@ photo_upload_iface_init (gpointer g_iface,
static void
_upload_video_cb (RestProxyCall *call,
+ gsize total,
+ gsize uploaded,
const GError *error,
GObject *weak_object,
gpointer user_data)
@@ -859,7 +864,8 @@ _upload_video_cb (RestProxyCall *call,
sw_video_upload_iface_emit_video_upload_progress (self, opid, -1,
error->message);
} else {
- sw_video_upload_iface_emit_video_upload_progress (self, opid, 100, "");
+ gint percent = (gdouble) uploaded / (gdouble) total * 100;
+ sw_video_upload_iface_emit_video_upload_progress (self, opid, percent, "");
}
}
@@ -873,7 +879,7 @@ _photobucket_upload_video (SwVideoUploadIface *self,
gint opid;
opid = _upload_file (SW_SERVICE_PHOTOBUCKET (self), VIDEO, filename, fields,
- (RestProxyCallAsyncCallback) _upload_video_cb, &error);
+ (RestProxyCallUploadCallback) _upload_video_cb, &error);
if (error) {
dbus_g_method_return_error (context, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]