anjuta r4486 - in trunk: . plugins/symbol-db



Author: mcora
Date: Fri Dec 26 13:52:31 2008
New Revision: 4486
URL: http://svn.gnome.org/viewvc/anjuta?rev=4486&view=rev

Log:
	* plugins/symbol-db/plugin.c (on_project_element_added),
	(do_import_project_sources_after_abort),
	(do_import_project_sources), (do_check_offline_files_changed):
	* plugins/symbol-db/symbol-db-engine-core.c
	(on_scan_update_files_symbols_end),
	(symbol_db_engine_update_files_symbols):
	* plugins/symbol-db/symbol-db-view-locals.c
	(symbol_db_view_locals_update_list):
	added some checks that fix some local-view updating problems.

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/symbol-db-engine-core.c
   trunk/plugins/symbol-db/symbol-db-view-locals.c

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Fri Dec 26 13:52:31 2008
@@ -866,9 +866,12 @@
 
 	/* use a custom function to add the files to db */
 	real_added = do_add_new_files (sdb_plugin, files_array, TASK_ELEMENT_ADDED);
-	if (real_added < 0) 
+	if (real_added <= 0) 
 	{
 		sdb_plugin->is_adding_element = FALSE;
+		symbol_db_view_locals_recv_signals_from_engine (																
+			SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+				 sdb_plugin->sdbe_project, TRUE);		
 	}
 	
 	g_ptr_array_foreach (files_array, (GFunc)g_free, NULL);
@@ -1195,6 +1198,13 @@
 
 	real_added = do_add_new_files (sdb_plugin, sources_array, 
 								   TASK_IMPORT_PROJECT_AFTER_ABORT);
+	if (real_added <= 0)
+	{
+		sdb_plugin->is_project_importing = FALSE;
+		symbol_db_view_locals_recv_signals_from_engine (																
+			SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+				 sdb_plugin->sdbe_project, TRUE);
+	}
 	sdb_plugin->files_count_project += real_added;	
 }
 
@@ -1260,16 +1270,24 @@
 		g_ptr_array_add (sources_array, local_filename);
 		g_object_unref (gfile);
 	}
-	
-	real_added = do_add_new_files (sdb_plugin, sources_array, TASK_IMPORT_PROJECT);
-	sdb_plugin->files_count_project += real_added;
-			
+
 	/* connect to receive signals on single file scan complete. We'll
 	 * update a status bar notifying the user about the status
 	 */
 	g_signal_connect (G_OBJECT (sdb_plugin->sdbe_project), "single-file-scan-end",
 		  G_CALLBACK (on_project_single_file_scan_end), plugin);
 	
+	real_added = do_add_new_files (sdb_plugin, sources_array, TASK_IMPORT_PROJECT);
+	if (real_added <= 0)
+	{
+		symbol_db_view_locals_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+								 sdb_plugin->sdbe_project, TRUE);
+		sdb_plugin->is_project_importing = FALSE;		
+	}
+	sdb_plugin->files_count_project += real_added;			
+
+	
 	/* free the ptr array */
 	g_ptr_array_foreach (sources_array, (GFunc)g_free, NULL);
 	g_ptr_array_free (sources_array, TRUE);
@@ -1458,7 +1476,12 @@
 					 real_added);
 		
 		if (real_added <= 0)
+		{
 			sdb_plugin->is_offline_scanning = FALSE;
+			symbol_db_view_locals_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+								 sdb_plugin->sdbe_project, TRUE);			
+		}
 	}
 	
 	g_object_unref (it);

Modified: trunk/plugins/symbol-db/symbol-db-engine-core.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-core.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-core.c	Fri Dec 26 13:52:31 2008
@@ -5111,7 +5111,7 @@
 		
 		if (strstr (node, priv->project_directory) == NULL) 
 		{
-			g_warning ("on_scan_update_files_symbols_end  node %s is shorter than "
+			g_warning ("node %s is shorter than "
 					   "prj_directory %s",
 					   node, priv->project_directory);
 			continue;
@@ -5311,17 +5311,55 @@
 	UpdateFileSymbolsData *update_data;
 	gboolean ret_code;
 	gint ret_id;
+	gint i;
+	GPtrArray * ready_files;
 	
 	priv = dbe->priv;
 
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
 	g_return_val_if_fail (project != NULL, FALSE);
 
+	ready_files = g_ptr_array_new ();
+	
+	/* check if the files exist in db before passing them to the scan procedure */
+	for (i = 0; i < files_path->len; i++) 
+	{
+		gchar *curr_abs_file;
+		
+		curr_abs_file = g_ptr_array_index (files_path, i);
+		/* check if the file exists in db. We will not scan buffers for files
+		 * which aren't already in db
+		 */
+		if (symbol_db_engine_file_exists (dbe, curr_abs_file) == FALSE)
+		{
+			DEBUG_PRINT ("will not update file symbols claiming to be %s because not in db",
+						 curr_abs_file);
+			
+			g_free (curr_abs_file);
+			continue;
+		}
+		
+		/* ok the file exists in db. Add it to ready_files */
+		g_ptr_array_add (ready_files, curr_abs_file);
+	}
+	
+	/* free just the array but not its values */
+	g_ptr_array_free (files_path, FALSE);
+	
+	/* if no file has been added to the array then bail out here */
+	if (ready_files->len <= 0)
+	{
+		g_ptr_array_free (ready_files, TRUE);
+		DEBUG_PRINT ("not enough files to update");
+		return -1;
+	}
+	
 	update_data = g_new0 (UpdateFileSymbolsData, 1);
 	
 	update_data->update_prj_analyse_time = update_prj_analyse_time;
-	update_data->files_path = files_path;
+	update_data->files_path = ready_files;
 	update_data->project = g_strdup (project);
+
 	
 	/* data will be freed when callback will be called. The signal will be
 	 * disconnected too, don't worry about disconneting it by hand.
@@ -5329,7 +5367,7 @@
 	g_signal_connect (G_OBJECT (dbe), "scan-end",
 					  G_CALLBACK (on_scan_update_files_symbols_end), update_data);
 	
-	ret_code = sdb_engine_scan_files_1 (dbe, files_path, NULL, TRUE);
+	ret_code = sdb_engine_scan_files_1 (dbe, ready_files, NULL, TRUE);
 	if (ret_code == TRUE)
 		ret_id = sdb_engine_get_unique_scan_id (dbe);
 	else

Modified: trunk/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.c	Fri Dec 26 13:52:31 2008
@@ -1306,6 +1306,7 @@
 	if (priv->recv_signals == FALSE && force_update == FALSE)
 	{		
 		gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), NULL);
+		DEBUG_PRINT ("recv signals is false");
 		return;
 	}
 	
@@ -1373,8 +1374,7 @@
 		symbol_db_engine_get_file_db_path (dbe, filepath);
 	if (priv->current_db_file == NULL) 
 	{
-		/*DEBUG_PRINT ("%s", "symbol_db_view_locals_update_list (): "
-					 "Warning: priv->current_db_file is NULL");*/
+		DEBUG_PRINT ("Warning: priv->current_db_file is NULL");
 		return;
 	}
 	priv->current_local_file_path = g_strdup (filepath);



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