[tracker/ontology-cope-for-master: 428/433] libtracker-data: Don't reset the is_new flags too early



commit 32dec9f90e5e503c70a73b808175b8dd19980ec3
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Mar 22 11:44:15 2010 +0100

    libtracker-data: Don't reset the is_new flags too early

 src/libtracker-data/tracker-data-manager.c |   23 +++++++++++++++++++++--
 src/libtracker-data/tracker-data-manager.h |    1 +
 src/libtracker-data/tracker-data-update.c  |    3 ++-
 3 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 9a9ce67..dc12536 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1346,6 +1346,25 @@ create_decomposed_transient_metadata_tables (TrackerDBInterface *iface)
 	}
 }
 
+void 
+tracker_data_ontology_import_finished (void)
+{
+	TrackerClass **classes;
+	TrackerProperty **properties;
+	gint i, n_props, n_classes;
+
+	classes = tracker_ontologies_get_classes (&n_classes);
+	properties = tracker_ontologies_get_properties (&n_props);
+
+	for (i = 0; i < n_classes; i++) {
+		tracker_class_set_is_new (classes[i], FALSE);
+	}
+
+	for (i = 0; i < n_props; i++) {
+		tracker_property_set_is_new (properties[i], FALSE);
+	}
+}
+
 void
 tracker_data_ontology_import_into_db (gboolean is_new)
 {
@@ -1372,7 +1391,6 @@ tracker_data_ontology_import_into_db (gboolean is_new)
 			insert_uri_in_resource_table (iface, tracker_class_get_uri (classes[i]),
 			                              tracker_class_get_id (classes[i]));
 		}
-		tracker_class_set_is_new (classes[i], FALSE);
 	}
 
 	/* insert properties into rdfs:Resource table and set all properties to not new */
@@ -1381,7 +1399,6 @@ tracker_data_ontology_import_into_db (gboolean is_new)
 			insert_uri_in_resource_table (iface, tracker_property_get_uri (properties[i]),
 			                              tracker_property_get_id (properties[i]));
 		}
-		tracker_property_set_is_new (properties[i], FALSE);
 	}
 }
 
@@ -1705,6 +1722,8 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 			g_list_free (to_reload);
 		}
 
+		tracker_data_ontology_import_finished ();
+
 		tracker_db_journal_commit_db_transaction ();
 		tracker_data_commit_db_transaction ();
 
diff --git a/src/libtracker-data/tracker-data-manager.h b/src/libtracker-data/tracker-data-manager.h
index 7b89b4f..83d5212 100644
--- a/src/libtracker-data/tracker-data-manager.h
+++ b/src/libtracker-data/tracker-data-manager.h
@@ -62,6 +62,7 @@ void     tracker_data_ontology_process_statement  (const gchar           *graph,
                                                    gboolean               is_uri,
                                                    gboolean               is_new,
                                                    gboolean               ignore_nao_last_modified);
+void    tracker_data_ontology_import_finished     (void);
 
 G_END_DECLS
 
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 7a7be49..d5f9566 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2316,6 +2316,8 @@ ontology_transaction_end (GList *ontology_queue)
 			tracker_db_statement_execute (stmt, NULL);
 		}
 	}
+
+	tracker_data_ontology_import_finished ();
 }
 
 static GList*
@@ -2632,7 +2634,6 @@ tracker_data_replay_journal (GHashTable *classes,
 		}
 	}
 
-
 	if (journal_error) {
 		gsize size;
 



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