[gnome-photos/wip/rishi/unbreak-delete] query-builder: Unbreak deletion of items from the Tracker database




commit 34f7d0784a70cf812f9ef118677792df87964aec
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Mar 14 12:14:38 2021 +0100

    query-builder: Unbreak deletion of items from the Tracker database
    
    Fallout from bd087d67f938c29776842afbc3b7bc745d2ca9a2
    
    https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/175

 src/photos-query-builder.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index c7249ba6..f2b56b8b 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -318,12 +318,31 @@ photos_query_builder_count_query (PhotosSearchContextState *state, gint flags)
 PhotosQuery *
 photos_query_builder_delete_resource_query (PhotosSearchContextState *state, const gchar *resource)
 {
+  GApplication *app;
   PhotosQuery *query;
+  const gchar *miner_files_name;
   g_autofree gchar *sparql = NULL;
 
-  sparql = g_strdup_printf ("DELETE { <%s> a rdfs:Resource }", resource);
-  query = photos_query_new (state, sparql);
+  app = g_application_get_default ();
+  miner_files_name = photos_application_get_miner_files_name (PHOTOS_APPLICATION (app));
 
+  sparql = g_strdup_printf ("DELETE DATA {"
+                            "  GRAPH tracker:Pictures {"
+                            "    <%s> a rdfs:Resource"
+                            "  }"
+                            "}"
+                            "DELETE DATA {"
+                            "  SERVICE <dbus:%s> {"
+                            "    GRAPH tracker:Pictures {"
+                            "      <%s> a rdfs:Resource"
+                            "    }"
+                            "  }"
+                            "}",
+                            resource,
+                            miner_files_name,
+                            resource);
+
+  query = photos_query_new (state, sparql);
   return query;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]