[discident-glib] ean: Return an error when EAN lookup fails (async)
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [discident-glib] ean: Return an error when EAN lookup fails (async)
- Date: Sat, 27 Apr 2013 17:59:06 +0000 (UTC)
commit 6adfa381b3d8b661d5c3eb1ee6689f74330dbfa5
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 3 00:06:45 2013 +0200
ean: Return an error when EAN lookup fails (async)
This was error out properly for sync, but not for async.
discident-glib/discident-ean-glib.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/discident-glib/discident-ean-glib.c b/discident-glib/discident-ean-glib.c
index 0bb39bf..f590067 100644
--- a/discident-glib/discident-ean-glib.c
+++ b/discident-glib/discident-ean-glib.c
@@ -377,6 +377,7 @@ static void
got_body_query (SoupMessage *msg,
QueryData *data)
{
+ const char *barcode;
char *response;
char *title = NULL;
char *img_url = NULL;
@@ -404,6 +405,17 @@ got_body_query (SoupMessage *msg,
}
g_free (response);
+ barcode = g_object_get_data (G_OBJECT (data->simple), "barcode");
+ if (g_strcmp0 (title, barcode) == 0) {
+ g_simple_async_result_set_error (data->simple,
+ DISCIDENT_ERROR,
+ DISCIDENT_ERROR_EMPTY_RESPONSE,
+ "No response for requested barcode");
+ g_free (title);
+ g_free (img_url);
+ goto out;
+ }
+
g_object_set_data_full (G_OBJECT (data->simple), "image-url", img_url, g_free);
g_simple_async_result_set_op_res_gpointer (data->simple, title, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]