[grilo-plugins/wip/jfelder/tracker3-delete-events: 2/2] tracker3: Handle delete events better
- From: Victor Toso <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/jfelder/tracker3-delete-events: 2/2] tracker3: Handle delete events better
- Date: Thu, 14 Jan 2021 09:41:27 +0000 (UTC)
commit 0ef8d306fbab740287cfb9360355305f03b93ac9
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 12 17:40:40 2020 +0100
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.
src/tracker3/grl-tracker-source-notif.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker3/grl-tracker-source-notif.c b/src/tracker3/grl-tracker-source-notif.c
index 1b8e526d..95aaf96d 100644
--- a/src/tracker3/grl-tracker-source-notif.c
+++ b/src/tracker3/grl-tracker-source-notif.c
@@ -122,7 +122,8 @@ handle_changes (GrlTrackerSourceNotify *self,
if (tracker_notifier_event_get_event_type (event) != tracker_type)
continue;
- if (grl_media_get_url (media) == NULL)
+ if (tracker_type != TRACKER_NOTIFIER_EVENT_DELETE &&
+ grl_media_get_url (media) == NULL)
continue;
g_ptr_array_add (change_list, g_object_ref (media));
@@ -166,8 +167,16 @@ resolve_medias (GrlTrackerChangeBatch *batch)
GrlTrackerSourceNotify *self = batch->notify;
GrlMedia *media = NULL;
- if (batch->cur_media < batch->medias->len)
- media = g_ptr_array_index (batch->medias, batch->cur_media);
+ 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);
+ break;
+ }
+
+ batch->cur_media++;
+ }
if (media) {
grl_source_resolve (self->source,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]