[grilo-plugins/fremantle: 21/27] Changed read_url_async in youtube to use utils
- From: Xabier Rodriguez Calvar <xrcalvar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/fremantle: 21/27] Changed read_url_async in youtube to use utils
- Date: Mon, 19 Apr 2010 16:50:22 +0000 (UTC)
commit c303504d95fb00d8fbfc4b44484250a648d63f60
Author: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Mon Apr 19 16:51:28 2010 +0200
Changed read_url_async in youtube to use utils
src/youtube/grl-youtube.c | 25 ++++++-------------------
1 files changed, 6 insertions(+), 19 deletions(-)
---
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index b88f6a6..08d7f34 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <stdlib.h>
+#include "util/gnomevfs.h"
#include "grl-youtube.h"
/* --------- Logging -------- */
@@ -372,23 +373,13 @@ get_video_url (const gchar *id)
}
static void
-read_done_cb (GObject *source_object,
- GAsyncResult *res,
+read_done_cb (gchar *content,
gpointer user_data)
{
AsyncReadCb *arc = (AsyncReadCb *) user_data;
- GError *vfs_error = NULL;
- gchar *content = NULL;
- g_file_load_contents_finish (G_FILE (source_object),
- res,
- &content,
- NULL,
- NULL,
- &vfs_error);
- g_object_unref (source_object);
- if (vfs_error) {
- g_warning ("Failed to open '%s': %s", arc->url, vfs_error->message);
+ if (!content) {
+ g_warning ("Failed to open '%s'", arc->url);
} else {
arc->callback (content, arc->user_data);
}
@@ -401,20 +392,16 @@ read_url_async (const gchar *url,
AsyncReadCbFunc callback,
gpointer user_data)
{
- GVfs *vfs;
- GFile *uri;
AsyncReadCb *arc;
- vfs = g_vfs_get_default ();
-
g_debug ("Opening async '%s'", url);
arc = g_new0 (AsyncReadCb, 1);
arc->url = g_strdup (url);
arc->callback = callback;
arc->user_data = user_data;
- uri = g_vfs_get_file_for_uri (vfs, url);
- g_file_load_contents_async (uri, NULL, read_done_cb, arc);
+
+ grl_plugins_gnome_vfs_read_url_async (url, read_done_cb, arc);
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]