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



Author: mcora
Date: Sat Jan 31 01:30:11 2009
New Revision: 4649
URL: http://svn.gnome.org/viewvc/anjuta?rev=4649&view=rev

Log:
	* plugins/symbol-db/plugin.c (on_system_scan_package_start),
	(on_system_scan_package_end), (on_system_single_file_scan_end),
	(do_check_offline_files_changed), (on_project_root_removed):
	* plugins/symbol-db/symbol-db-engine-core.c
	(symbol_db_engine_add_new_files):
	* plugins/symbol-db/symbol-db-system.c
	(prepare_files_to_be_scanned), (sdb_system_do_scan_package_1),
	(sdb_system_do_scan_next_package), (sdb_system_do_engine_scan),
	(on_pkg_config_exit), (symbol_db_system_parse_aborted_package):
	partially fixed #566209 â "generate inhertances..." 
	progress bar doesn't disappear
	Improved global package scanning. Now the queue of scannable packages 
	shouldn't block anymore.

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

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Sat Jan 31 01:30:11 2009
@@ -1107,9 +1107,9 @@
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (user_data);
 
 	sdb_plugin->files_count_system_done = 0;
-	sdb_plugin->files_count_system = num_files;	
+	sdb_plugin->files_count_system += num_files;	
 	
-	DEBUG_PRINT ("on_system_scan_package_start  () [%s]", package);
+	DEBUG_PRINT ("********************* START [%s] with n %d files ", package, num_files);
 	
 	/* show the global bar */
 	gtk_widget_show (sdb_plugin->progress_bar_system);
@@ -1125,7 +1125,7 @@
 	SymbolDBPlugin *sdb_plugin;
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (user_data);
 	
-	DEBUG_PRINT ("on_system_scan_package_end () [%s]", package);
+	DEBUG_PRINT ("******************** END () [%s]", package);
 	
 	/* hide the progress bar */
 	gtk_widget_hide (sdb_plugin->progress_bar_system);
@@ -1145,17 +1145,19 @@
 	plugin = ANJUTA_PLUGIN (data);
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 
-	DEBUG_PRINT ("%s", "on_system_single_file_scan_end ()");
-	
 	sdb_plugin->files_count_system_done++;	
 	if (sdb_plugin->files_count_system_done >= sdb_plugin->files_count_system)
+	{
 		message = g_strdup_printf (_("%s: Generating inheritances..."), 
 								   sdb_plugin->current_scanned_package);
+	}
 	else
+	{
 		message = g_strdup_printf (_("%s: %d files scanned out of %d"), 
 							sdb_plugin->current_scanned_package,
 							sdb_plugin->files_count_system_done, 
 							sdb_plugin->files_count_system);
+	}
 
 	if (sdb_plugin->files_count_system > 0)
 	{
@@ -1200,7 +1202,7 @@
 	gtk_widget_show (sdb_plugin->progress_bar_project);
 	g_free (message);
 }
- 
+
 static void
 clear_project_progress_bar (SymbolDBEngine *dbe, gpointer data)
 {
@@ -1582,14 +1584,16 @@
 			g_strcmp0 (filename, "") == 0)
 		{
 			g_object_unref (gfile);
-			DEBUG_PRINT ("hey, filename (uri %s) is NULL", uri);
+			/* FIXME here */
+			/*DEBUG_PRINT ("hey, filename (uri %s) is NULL", uri);*/
 			continue;
 		}
 		
 		/* test its existence */
 		if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE) 
 		{
-			DEBUG_PRINT ("hey, filename %s (uri %s) does NOT exist", filename, uri);
+			/* FIXME here */
+			/*DEBUG_PRINT ("hey, filename %s (uri %s) does NOT exist", filename, uri);*/
 			g_object_unref (gfile);
 			continue;
 		}
@@ -1913,9 +1917,6 @@
 	DEBUG_PRINT ("%s", "project_root_removed ()");
 	/* Disconnect events from project manager */
 	
-	/* FIXME: There should be a way to ensure that this project manager
-	 * is indeed the one that has opened the project_uri
-	 */
 	pm = anjuta_shell_get_interface (ANJUTA_PLUGIN (sdb_plugin)->shell,
 									 IAnjutaProjectManager, NULL);
 	g_signal_handlers_disconnect_by_func (G_OBJECT (pm),
@@ -1938,6 +1939,19 @@
 	/* and the globals one */
 	symbol_db_engine_close_db (sdb_plugin->sdbe_globals);
 
+	/* stop any opened scanning process */
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (sdb_plugin->progress_bar_system), "");
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (sdb_plugin->progress_bar_project), "");
+	gtk_widget_hide (sdb_plugin->progress_bar_system);
+	gtk_widget_hide (sdb_plugin->progress_bar_project);
+	
+	sdb_plugin->files_count_system_done = 0;
+	sdb_plugin->files_count_system = 0;
+	
+	sdb_plugin->files_count_project_done = 0;
+	sdb_plugin->files_count_project = 0;
+	
+	
 	g_free (sdb_plugin->project_root_uri);
 	g_free (sdb_plugin->project_root_dir);
 	g_free (sdb_plugin->project_opened);

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	Sat Jan 31 01:30:11 2009
@@ -206,6 +206,9 @@
 static void 
 sdb_engine_second_pass_do (SymbolDBEngine * dbe);
 
+void
+sdb_engine_dyn_child_query_node_destroy (gpointer data);
+
 static gint
 sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
 						   int file_defined_id, gboolean sym_update);
@@ -3422,7 +3425,7 @@
 					   "Error processing file %s, db_directory %s, project_name %s, "
 					   "project_directory %s", node_file, 
 					   priv->db_directory, project_name, priv->project_directory);
-			return FALSE;
+			return -1;
 		}
 		
 		/* note: we don't use g_strdup () here because we'll free the filtered_files_path

Modified: trunk/plugins/symbol-db/symbol-db-system.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-system.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-system.c	Sat Jan 31 01:30:11 2009
@@ -381,12 +381,13 @@
 	priv = sdbs->priv;	
 	node = cflags;	
 	
-	do {
+	do 
+	{
 		GList *files_tmp_list = NULL;
 		GFile *file;
 		
 		
-		file = g_file_new_for_path ((char *)node->data);
+		file = g_file_new_for_path ((gchar *)node->data);
 		
 		/* files_tmp_list needs to be freed */
 		sdb_system_files_visit_dir (&files_tmp_list, file);
@@ -435,19 +436,57 @@
 	} while ((node = node->next) != NULL);
 }
 
+static inline void 
+sdb_system_do_scan_package_1 (SymbolDBSystem *sdbs,							
+							SingleScanData *ss_data)
+{
+	SymbolDBSystemPriv *priv;
+	gchar *exe_string;
+	priv = sdbs->priv;
+	
+	DEBUG_PRINT ("SCANNING %s", 
+				 ss_data->package_name);
+	exe_string = g_strdup_printf ("pkg-config --cflags %s", 
+								  ss_data->package_name);
+	
+	g_signal_connect (G_OBJECT (priv->single_package_scan_launcher), 
+					  "child-exited", G_CALLBACK (on_pkg_config_exit), ss_data);	
+	
+	anjuta_launcher_execute (priv->single_package_scan_launcher,
+							 	exe_string, on_pkg_config_output, 
+							 	ss_data);	
+	g_free (exe_string);	
+}
+
+/**
+ * Scan the next package in queue, if exists.
+ */
+static void
+sdb_system_do_scan_next_package (SymbolDBSystem *sdbs)
+{
+	SymbolDBSystemPriv *priv;
+	priv = sdbs->priv;
+	
+	if (g_queue_get_length (priv->sscan_queue) > 0)
+	{
+		/* get the next one without storing it into queue */
+		SingleScanData *ss_data = g_queue_peek_head (priv->sscan_queue);
+		
+		/* enjoy */
+		sdb_system_do_scan_package_1 (sdbs, ss_data);
+	}
+}
+
 static inline void
 sdb_system_do_engine_scan (SymbolDBSystem *sdbs, EngineScanData *es_data)
 {
 	SymbolDBSystemPriv *priv;
 	GPtrArray *files_to_scan_array; 
 	GPtrArray *languages_array;
+	gint proc_id;
 	
 	priv = sdbs->priv;
 
-	/* will be disconnected automatically when callback is called. */
-	g_signal_connect (G_OBJECT (priv->sdbe_globals), "scan-end",
- 			G_CALLBACK (on_engine_package_scan_end), es_data);
-
 	if (es_data->special_abort_scan == FALSE)
 	{
 		files_to_scan_array = g_ptr_array_new ();
@@ -456,7 +495,7 @@
 		/* the above arrays will be populated with this function */
 		prepare_files_to_be_scanned (sdbs, es_data->cflags, files_to_scan_array,
 								 languages_array);
-
+		
 		symbol_db_engine_add_new_project (priv->sdbe_globals, NULL,
 								  		es_data->package_name);
 	}
@@ -464,29 +503,36 @@
 	{
 		files_to_scan_array = es_data->files_to_scan_array;
 		languages_array = es_data->languages_array;
-	}		
-							
+	}
 	
-	/* notify the listeners about our intention of adding new files
-	 * to the db 
-	 */
-	g_signal_emit (sdbs, signals[SCAN_PACKAGE_START], 0, 
-				   files_to_scan_array->len,
-				   es_data->package_name); 
 			
 	/* note the FALSE as last parameter: we don't want
 	 * to re-scan an already present file. There's the possibility
 	 * infact to have more references of the same files in different
 	 * packages
 	 */
-	symbol_db_engine_add_new_files (priv->sdbe_globals,
+	proc_id = symbol_db_engine_add_new_files (priv->sdbe_globals,
 							es_data->special_abort_scan == FALSE ? 
 									es_data->package_name : NULL, 
 							files_to_scan_array,
 							languages_array,
 							es_data->special_abort_scan == FALSE ? 
 									FALSE : TRUE);
-		
+
+	if (proc_id > 0)
+	{
+		/* will be disconnected automatically when callback is called. */
+		g_signal_connect (G_OBJECT (priv->sdbe_globals), "scan-end",
+ 				G_CALLBACK (on_engine_package_scan_end), es_data);
+	
+		/* notify the listeners about our intention of adding new files
+	 	* to the db 
+	 	*/
+		g_signal_emit (sdbs, signals[SCAN_PACKAGE_START], 0, 
+					   files_to_scan_array->len,
+					   es_data->package_name); 
+	}
+	
 	/* hey, destroy_engine_scan_data () will take care of destroying these for us,
 	 * in case we're on a special_abort_scan
 	 */
@@ -498,6 +544,18 @@
 		g_ptr_array_foreach (languages_array, (GFunc)g_free, NULL);
 		g_ptr_array_free (languages_array, TRUE);	
 	}
+	/* if no scan has started destroy the engine data here */
+	else if (proc_id <= 0) 			
+	{
+		destroy_engine_scan_data (es_data);
+		es_data = NULL;
+	
+		/* having not connected the signal to on_engine_package_scan_end () it's
+		 * likely that the queue won't be processed more. So here it is the call
+		 * to unlock it
+		 */
+		sdb_system_do_scan_next_package (sdbs);
+	}	
 }
 
 static void
@@ -533,47 +591,6 @@
 	}
 }
 
-static inline void 
-sdb_system_do_scan_package_1 (SymbolDBSystem *sdbs,							
-							SingleScanData *ss_data)
-{
-	SymbolDBSystemPriv *priv;
-	gchar *exe_string;
-	priv = sdbs->priv;
-	
-	DEBUG_PRINT ("sdb_system_do_scan_package_1 SCANNING %s", 
-				 ss_data->package_name);
-	exe_string = g_strdup_printf ("pkg-config --cflags %s", 
-								  ss_data->package_name);
-	
-	g_signal_connect (G_OBJECT (priv->single_package_scan_launcher), 
-					  "child-exited", G_CALLBACK (on_pkg_config_exit), ss_data);	
-	
-	anjuta_launcher_execute (priv->single_package_scan_launcher,
-							 	exe_string, on_pkg_config_output, 
-							 	ss_data);	
-	g_free (exe_string);	
-}
-
-/**
- * Scan the next package in queue, if exists.
- */
-static void
-sdb_system_do_scan_next_package (SymbolDBSystem *sdbs)
-{
-	SymbolDBSystemPriv *priv;
-	priv = sdbs->priv;
-	
-	if (g_queue_get_length (priv->sscan_queue) > 0)
-	{
-		/* get the next one without storing it into queue */
-		SingleScanData *ss_data = g_queue_peek_head (priv->sscan_queue);
-		
-		/* enjoy */
-		sdb_system_do_scan_package_1 (sdbs, ss_data);
-	}
-}
-
 /**
  * Scan a new package storing it in queue either for later retrieval or
  * for signaling the 'busy status'.
@@ -650,13 +667,18 @@
 			/* just push the tail waiting for a later processing [i.e. after
 			 * a scan-end received 
 			 */
-			DEBUG_PRINT ("pushing on engine queue %s", es_data->package_name);
+			DEBUG_PRINT ("pushing on engine queue [length %d] %s", 
+						 g_queue_get_length (priv->engine_queue),
+						 es_data->package_name);
 			g_queue_push_tail (priv->engine_queue, es_data);
 		}
 		else
 		{
 			/* push the tail to signal a 'working engine' */
-			DEBUG_PRINT ("scanning with engine queue %s", es_data->package_name);
+			DEBUG_PRINT ("scanning with engine queue [length %d] %s", 
+						 g_queue_get_length (priv->engine_queue),
+						 es_data->package_name);
+			
 			g_queue_push_tail (priv->engine_queue, es_data);
 			
 			sdb_system_do_engine_scan (sdbs, es_data);
@@ -766,6 +788,8 @@
 	es_data->languages_array = languages_array;
 		
 		
+	DEBUG_PRINT ("SYSTEM ABORT PARSING.....");
+	
 	/* is the engine queue already full && working? */
 	if (g_queue_get_length (priv->engine_queue) > 0) 
 	{



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