summaryrefslogtreecommitdiff
path: root/src/nautilus-batch-rename-utilities.c
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-05-02 16:46:28 +0200
committerSam Thursfield <sam@afuera.me.uk>2020-08-29 16:23:33 +0200
commit32e3fb5d0ee706cca557dc3540e43a5d988c3b92 (patch)
tree651a511c2ca8d58f12b01521e2578e21ecf67329 /src/nautilus-batch-rename-utilities.c
parent8e140fa69c9a8f304a148e7e967a69ff2d9fda17 (diff)
downloadnautilus-32e3fb5d0ee706cca557dc3540e43a5d988c3b92.tar.gz
Port to Tracker 3
Mostly the port is straightforward, we connect to tracker-miner-fs explicitly over D-Bus instead of the centralized tracker-store daemon we connected to previously. The search-engine-tracker test is now isolated from the user's real Tracker index using the `tracker-sandbox` script provided by Tracker, and it lets tracker-miner-fs index the test file rather than trying to synthesize the expected database contents. There are more changes in nautilus-tag-manager.c. Until now, starred file information was stored in the tracker-miner-fs database. This has some downsides, firstly the data is deleted if someone runs `tracker reset --hard`, secondly it isn't possible to do this from inside a Flatpak sandbox with Tracker 3.0. because the This commit changes the NautilusTagManager to set up a private database inside XDG_DATA_HOME/nautilus/tags. This stores the starred file information. The database is managed with Tracker, which allows us to continue using the rename-tracking that tracker-miner-fs provides. The same limitations apply as before that only files in indexed locations can be starred.
Diffstat (limited to 'src/nautilus-batch-rename-utilities.c')
-rw-r--r--src/nautilus-batch-rename-utilities.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c
index fcc0a32e9..b6cea25fa 100644
--- a/src/nautilus-batch-rename-utilities.c
+++ b/src/nautilus-batch-rename-utilities.c
@@ -63,6 +63,8 @@ enum
ALBUM_NAME_INDEX,
} QueryMetadata;
+#define TRACKER_MINER_FS_BUSNAME "org.freedesktop.Tracker3.Miner.Files"
+
static void on_cursor_callback (GObject *object,
GAsyncResult *result,
gpointer user_data);
@@ -1056,21 +1058,21 @@ check_metadata_for_selection (NautilusBatchRenameDialog *dialog,
query = g_string_new ("SELECT "
"nfo:fileName(?file) "
- "nie:contentCreated(?file) "
- "year(nie:contentCreated(?file)) "
- "month(nie:contentCreated(?file)) "
- "day(nie:contentCreated(?file)) "
- "hours(nie:contentCreated(?file)) "
- "minutes(nie:contentCreated(?file)) "
- "seconds(nie:contentCreated(?file)) "
- "nfo:model(nfo:equipment(?file)) "
- "nmm:season(?file) "
- "nmm:episodeNumber(?file) "
- "nmm:trackNumber(?file) "
- "nmm:artistName(nmm:performer(?file)) "
- "nie:title(?file) "
- "nmm:albumTitle(nmm:musicAlbum(?file)) "
- "WHERE { ?file a nfo:FileDataObject. ?file nie:url ?url. ");
+ "nie:contentCreated(?content) "
+ "year(nie:contentCreated(?content)) "
+ "month(nie:contentCreated(?content)) "
+ "day(nie:contentCreated(?content)) "
+ "hours(nie:contentCreated(?content)) "
+ "minutes(nie:contentCreated(?content)) "
+ "seconds(nie:contentCreated(?content)) "
+ "nfo:model(nfo:equipment(?content)) "
+ "nmm:seasonNumber(?content) "
+ "nmm:episodeNumber(?content) "
+ "nmm:trackNumber(?content) "
+ "nmm:artistName(nmm:performer(?content)) "
+ "nie:title(?content) "
+ "nie:title(nmm:musicAlbum(?content)) "
+ "WHERE { ?file a nfo:FileDataObject. ?file nie:url ?url. ?content nie:isStoredAs ?file. ");
parent_uri = nautilus_file_get_parent_uri (NAUTILUS_FILE (selection->data));
@@ -1115,9 +1117,9 @@ check_metadata_for_selection (NautilusBatchRenameDialog *dialog,
selection_metadata = g_list_reverse (selection_metadata);
- g_string_append (query, "} ORDER BY ASC(nie:contentCreated(?file))");
+ g_string_append (query, "} ORDER BY ASC(nie:contentCreated(?content))");
- connection = tracker_sparql_connection_get (NULL, &error);
+ connection = tracker_sparql_connection_bus_new (TRACKER_MINER_FS_BUSNAME, NULL, NULL, &error);
if (!connection)
{
if (error)