summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-05-21 23:53:10 +0200
committerJean Felder <jean.felder@gmail.com>2020-08-21 15:05:10 +0000
commit9555ebeaf0385b533b91393eaea12b7ab1fa1b26 (patch)
tree18e47be2e7d187a685f7bbff512afe469b915647
parent8681090a6d27837fb8f9ba5894d4a5af6d8a8ad0 (diff)
downloadgrilo-plugins-9555ebeaf0385b533b91393eaea12b7ab1fa1b26.tar.gz
tracker3: Drop row accounting from GrlTrackerOp
Rely on the limit as set in the query. This accounting is a best effort anyway, as asking for 100 elements is not guaranteed to return 100 elements.
-rw-r--r--src/tracker3/grl-tracker-request-queue.h2
-rw-r--r--src/tracker3/grl-tracker-source-api.c32
2 files changed, 11 insertions, 23 deletions
diff --git a/src/tracker3/grl-tracker-request-queue.h b/src/tracker3/grl-tracker-request-queue.h
index a5c81e1..20dcc8f 100644
--- a/src/tracker3/grl-tracker-request-queue.h
+++ b/src/tracker3/grl-tracker-request-queue.h
@@ -51,8 +51,6 @@ typedef struct {
guint operation_id;
guint skip;
- guint count;
- guint current;
GrlTypeFilter type_filter;
} GrlTrackerOp;
diff --git a/src/tracker3/grl-tracker-source-api.c b/src/tracker3/grl-tracker-source-api.c
index af7f5d7..e22e910 100644
--- a/src/tracker3/grl-tracker-source-api.c
+++ b/src/tracker3/grl-tracker-source-api.c
@@ -365,12 +365,10 @@ get_sparql_type_filter (GrlOperationOptions *options,
} else { \
GRL_ODEBUG ("\tend of parsing id=%u :)", spec->operation_id); \
\
- /* Only emit this last one if more result than expected */ \
- if (os->count > 1) \
- spec->callback (spec->source, \
- spec->operation_id, \
- NULL, 0, \
- spec->user_data, NULL); \
+ spec->callback (spec->source, \
+ spec->operation_id, \
+ NULL, 0, \
+ spec->user_data, NULL); \
} \
\
grl_tracker_queue_done (grl_tracker_queue, os); \
@@ -381,8 +379,8 @@ get_sparql_type_filter (GrlOperationOptions *options,
0, \
NULL); \
\
- GRL_ODEBUG ("\tParsing line %i of type %s", \
- os->current, sparql_type); \
+ GRL_ODEBUG ("\tParsing line of type %s", \
+ sparql_type); \
\
media = grl_tracker_build_grilo_media (sparql_type, os->type_filter);\
\
@@ -398,19 +396,15 @@ get_sparql_type_filter (GrlOperationOptions *options,
spec->callback (spec->source, \
spec->operation_id, \
media, \
- --os->count, \
+ GRL_SOURCE_REMAINING_UNKNOWN, \
spec->user_data, \
NULL); \
} \
\
- /* Schedule the next line to parse */ \
- os->current++; \
- if (os->count < 1) \
- grl_tracker_queue_done (grl_tracker_queue, os); \
- else \
- tracker_sparql_cursor_next_async (os->cursor, os->cancel, \
- (GAsyncReadyCallback) tracker_##name##_result_cb, \
- (gpointer) os); \
+ /* Schedule the next row to parse */ \
+ tracker_sparql_cursor_next_async (os->cursor, os->cancel, \
+ (GAsyncReadyCallback) tracker_##name##_result_cb, \
+ (gpointer) os); \
} \
\
static void \
@@ -447,7 +441,6 @@ get_sparql_type_filter (GrlOperationOptions *options,
} \
\
/* Start parsing results */ \
- os->current = 0; \
tracker_sparql_cursor_next_async (os->cursor, NULL, \
(GAsyncReadyCallback) tracker_##name##_result_cb, \
(gpointer) os); \
@@ -802,7 +795,6 @@ grl_tracker_source_query (GrlSource *source,
os->keys = qs->keys;
os->skip = skip;
- os->count = count;
os->type_filter = grl_operation_options_get_type_filter (qs->options);
os->data = qs;
/* os->cb.sr = qs->callback; */
@@ -978,7 +970,6 @@ grl_tracker_source_search (GrlSource *source, GrlSourceSearchSpec *ss)
ss);
os->keys = ss->keys;
os->skip = skip;
- os->count = count;
os->type_filter = grl_operation_options_get_type_filter (ss->options);
grl_tracker_queue_push (grl_tracker_queue, os);
@@ -1150,7 +1141,6 @@ grl_tracker_source_browse_category (GrlSource *source,
bs);
os->keys = bs->keys;
os->skip = skip;
- os->count = count;
os->type_filter = grl_operation_options_get_type_filter (bs->options);
grl_tracker_queue_push (grl_tracker_queue, os);