Commit b0e3c26b authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Jean Felder
Browse files

tracker3: Handle delete events better

These produce unnecessary busywork as resolving a deleted resource will
not return any data, and also are mistakenly silenced away since they
will end up without a URL.

Only the media ID is reliable at that moment, so go with it.
parent c041395e
Pipeline #260220 passed with stage
in 5 minutes and 58 seconds
......@@ -122,7 +122,8 @@ handle_changes (GrlTrackerSourceNotify *self,
if (tracker_notifier_event_get_event_type (event) != tracker_type)
if (grl_media_get_url (media) == NULL)
if (tracker_type != TRACKER_NOTIFIER_EVENT_DELETE &&
grl_media_get_url (media) == NULL)
g_ptr_array_add (change_list, g_object_ref (media));
......@@ -166,8 +167,17 @@ resolve_medias (GrlTrackerChangeBatch *batch)
GrlTrackerSourceNotify *self = batch->notify;
GrlMedia *media = NULL;
if (batch->cur_media < batch->medias->len)
while (batch->cur_media < batch->medias->len) {
TrackerNotifierEvent *event = g_ptr_array_index (batch->events, batch->cur_media);
/* Resolving a deleted resource will come up empty */
if (tracker_notifier_event_get_event_type (event) == TRACKER_NOTIFIER_EVENT_DELETE) {
media = g_ptr_array_index (batch->medias, batch->cur_media);
if (media) {
grl_source_resolve (self->source,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment