From b24819a5f0feb30bb92cefe8ec63746078383a3c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 22 Mar 2009 14:25:03 +0000 Subject: Fixed problems with the progress callback for entry parsing, ensuring the total_results is the number of results which will actually be retrieved, rather than the number of results available for the search altogether; also ensuring that the callback's called with an equal priority to the ready callback. --- gdata/gdata-feed.c | 11 ++++++++--- gdata/gdata-query.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'gdata') diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c index 50482de8..b0a61383 100644 --- a/gdata/gdata-feed.c +++ b/gdata/gdata-feed.c @@ -307,14 +307,19 @@ _gdata_feed_new_from_xml (const gchar *xml, gint length, GDataEntryParserFunc pa /* Call the progress callback in the main thread */ if (progress_callback != NULL) { - ProgressCallbackData *data = g_slice_new (ProgressCallbackData); + ProgressCallbackData *data; + + /* Build the data for the callback */ + data = g_slice_new (ProgressCallbackData); data->progress_callback = progress_callback; data->progress_user_data = progress_user_data; data->entry = g_object_ref (entry); data->entry_i = entry_i; - data->total_results = total_results; + data->total_results = MIN (items_per_page, total_results); - g_idle_add ((GSourceFunc) progress_callback_idle, data); + /* Send the callback; use G_PRIORITY_DEFAULT rather than G_PRIORITY_DEFAULT_IDLE + * to contend with the priorities used by the callback functions in GAsyncResult */ + g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) progress_callback_idle, data, NULL); } entry_i++; diff --git a/gdata/gdata-query.c b/gdata/gdata-query.c index 6d655e56..af1ff8c5 100644 --- a/gdata/gdata-query.c +++ b/gdata/gdata-query.c @@ -337,9 +337,9 @@ gdata_query_get_query_uri (GDataQuery *self, const gchar *feed_uri) /* Check to see if we're paginating first */ if (priv->use_next_uri == TRUE) - return priv->next_uri; + return g_strdup (priv->next_uri); if (priv->use_previous_uri == TRUE) - return priv->previous_uri; + return g_strdup (priv->previous_uri); /* Check to see if any parameters have been set */ if ((priv->parameter_mask & GDATA_QUERY_PARAM_ALL) == 0) -- cgit v1.2.1