[tracker/checkpoint: 4/17] libtracker-data: Create ontologies.gvdb on startup if necessary



commit ca56c5adce75a98e93835e27daee6bc302a444ec
Author: JÃrg Billeter <j bitron ch>
Date:   Mon Jun 27 12:23:31 2011 +0200

    libtracker-data: Create ontologies.gvdb on startup if necessary

 src/libtracker-data/tracker-data-manager.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index b5a5e64..a317193 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -3424,7 +3424,8 @@ tracker_data_manager_reload (TrackerBusyCallback   busy_callback,
 }
 
 static void
-write_ontologies_gvdb (GError **error)
+write_ontologies_gvdb (gboolean   overwrite,
+                       GError   **error)
 {
 	gchar *filename;
 
@@ -3433,7 +3434,9 @@ write_ontologies_gvdb (GError **error)
 	                             "ontologies.gvdb",
 	                             NULL);
 
-	tracker_ontologies_write_gvdb (filename, error);
+	if (overwrite || !g_file_test (filename, G_FILE_TEST_EXISTS)) {
+		tracker_ontologies_write_gvdb (filename, error);
+	}
 
 	g_free (filename);
 }
@@ -3713,7 +3716,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 			return FALSE;
 		}
 
-		write_ontologies_gvdb (NULL);
+		write_ontologies_gvdb (TRUE /* overwrite */, NULL);
 
 		g_list_foreach (sorted, (GFunc) g_free, NULL);
 		g_list_free (sorted);
@@ -3740,6 +3743,8 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 				return FALSE;
 			}
 
+			write_ontologies_gvdb (FALSE /* overwrite */, NULL);
+
 			/* Skipped in the read-only case as it can't work with direct access and
 			   it reduces initialization time */
 			clean_decomposed_transient_metadata (iface);
@@ -4123,7 +4128,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 
 			tracker_data_ontology_process_changes_post_import (seen_classes, seen_properties);
 
-			write_ontologies_gvdb (NULL);
+			write_ontologies_gvdb (TRUE /* overwrite */, NULL);
 		}
 
 		tracker_data_ontology_free_seen (seen_classes);



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