[anjuta] symbol-db: Do not rescan project everytime it starts



commit ded32265c0db13f334d6418f97cd294046c0c9b4
Author: Naba Kumar <naba gnome org>
Date:   Fri Jun 18 19:39:29 2010 +0300

    symbol-db: Do not rescan project everytime it starts

 plugins/symbol-db/plugin.c                |   19 +++++++++++++------
 plugins/symbol-db/symbol-db-engine-core.c |    4 ++--
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 0c0eddf..1a4e661 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1354,8 +1354,8 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 	/* fill an hash table with all the items of the list just taken. 
 	 * We won't g_strdup () the elements because they'll be freed later
 	 */
-	prj_elements_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
-											  NULL);
+	prj_elements_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+	                                           NULL, g_free);
 	
 	for (i = 0; i <  g_list_length (prj_elements_list); i++)
 	{	
@@ -1382,7 +1382,11 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 			continue;
 		}
 
-		g_hash_table_insert (prj_elements_hash, filename, GINT_TO_POINTER (1));		
+		g_hash_table_insert (prj_elements_hash,
+		                     (gpointer) symbol_db_util_get_file_db_path
+		                 	   (sdb_plugin->sdbe_project,
+			                     filename),
+		                     filename);
 		g_object_unref (gfile);
 	}	
 	
@@ -1405,13 +1409,14 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 			const gchar * file = g_value_get_string (val);
 			
 			if (file && g_hash_table_remove (prj_elements_hash, file) == FALSE)
-				g_ptr_array_add (remove_array, (gpointer) file);
+				g_ptr_array_add (remove_array, g_strdup (file));
 			
 		} while (gda_data_model_iter_move_next (it));
 		
 		symbol_db_engine_remove_files (sdb_plugin->sdbe_project,
 									   sdb_plugin->project_opened,
-									   remove_array);		
+									   remove_array);
+		g_ptr_array_foreach (remove_array, (GFunc) g_free, NULL);
 		g_ptr_array_free (remove_array, TRUE);		
 	}
 
@@ -1431,7 +1436,9 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 		for (i = 0; i < g_hash_table_size (prj_elements_hash); i++)
 		{
 			/*DEBUG_PRINT ("ARRAY ADD %s", (gchar*)g_list_nth_data (keys, i));*/
-			g_ptr_array_add (to_add_files, g_list_nth_data (keys, i));
+			g_ptr_array_add (to_add_files,
+			                 g_hash_table_lookup (prj_elements_hash,
+			                                      g_list_nth_data (keys, i)));
 		}		
 	}
 
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index aa44813..cb0a3b8 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -6896,7 +6896,7 @@ symbol_db_engine_remove_file (SymbolDBEngine * dbe, const gchar *project,
 	
 	SDB_LOCK(priv);
 
-	if (strlen (rel_file)) 
+	if (strlen (rel_file) <= 0)
 	{
 		g_warning ("wrong file to delete.");
 		SDB_UNLOCK(priv);
@@ -7139,7 +7139,7 @@ symbol_db_engine_update_buffer_symbols (SymbolDBEngine * dbe, const gchar *proje
 GdaDataModel*
 symbol_db_engine_get_files_for_project (SymbolDBEngine *dbe)
 {
-	return sdb_engine_execute_select_sql (dbe, "SELECT file.file_path FROME file");
+	return sdb_engine_execute_select_sql (dbe, "SELECT file.file_path FROM file");
 }
 
 /* ~~~ Thread note: this function locks the mutex ~~~ */ 



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