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



Author: mcora
Date: Tue Dec 23 17:55:59 2008
New Revision: 4480
URL: http://svn.gnome.org/viewvc/anjuta?rev=4480&view=rev

Log:
	* plugins/symbol-db/plugin.c (do_add_new_files),
	(do_import_system_src_after_abort), (on_scan_end_manager):
	* plugins/symbol-db/symbol-db-engine-core.c
	(symbol_db_engine_update_project_symbols),
	(symbol_db_engine_update_buffer_symbols):
	Don't let buffer-updating files which are not in current project.

	* plugins/symbol-db/symbol-db-engine-core.h:
	* plugins/symbol-db/symbol-db-engine-iterator-node.c
	(symbol_db_engine_iterator_node_get_symbol_extra_string):
	* plugins/symbol-db/symbol-db-engine-iterator-node.h:
	* plugins/symbol-db/symbol-db-engine-iterator.h:
	* plugins/symbol-db/symbol-db-engine-priv.h:
	* plugins/symbol-db/symbol-db-engine.h:
	some minor headers fixes. 

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/symbol-db-engine-core.c
   trunk/plugins/symbol-db/symbol-db-engine-core.h
   trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
   trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h
   trunk/plugins/symbol-db/symbol-db-engine-iterator.h
   trunk/plugins/symbol-db/symbol-db-engine-priv.h
   trunk/plugins/symbol-db/symbol-db-engine-queries.h
   trunk/plugins/symbol-db/symbol-db-engine.h

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Tue Dec 23 17:55:59 2008
@@ -804,9 +804,6 @@
 			continue;
 		}					
 
-		DEBUG_PRINT ("wh0a, adding to scan local_filename %s (%s)", local_filename,
-					 lang);
-		
 		/* ok, we've just tested that the local_filename does exist.
 		 * We can safely add it to the array.
 		 */
@@ -1111,6 +1108,7 @@
 		if (local_filename == NULL)
 			continue;
 		
+		DEBUG_PRINT ("local_filename %s", local_filename);
 		gfile = g_file_new_for_path (local_filename);
 		if (gfile == NULL)
 			continue;
@@ -1738,6 +1736,11 @@
 	if (g_tree_remove (symbol_db->proc_id_tree,  GINT_TO_POINTER (process_id)) == FALSE)
 		g_warning ("Cannot remove proc_id from GTree");
 	
+	DEBUG_PRINT ("is_offline_scanning  %d, is_project_importing %d, is_project_updating %d, "
+				 "is_adding_element %d", symbol_db->is_offline_scanning,
+				 symbol_db->is_project_importing, symbol_db->is_project_updating,
+				 symbol_db->is_adding_element);
+				 
 	/**
  	 * perform some checks on some booleans. If they're all successfully passed
  	 * then activate the display of local view

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	Tue Dec 23 17:55:59 2008
@@ -5409,7 +5409,6 @@
 	if (!GDA_IS_DATA_MODEL (data_model) ||
 		(num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model))) <= 0)
 	{
-		DEBUG_PRINT ("no rows");
 		if (data_model != NULL)
 			g_object_unref (data_model);
 		data_model = NULL;
@@ -5652,33 +5651,38 @@
 	/* obtain a GPtrArray with real_files on database */
 	for (i=0; i < real_files_list->len; i++) 
 	{
-		gchar *relative_path = symbol_db_engine_get_file_db_path (dbe, 
-									g_ptr_array_index (real_files_list, i));
-		if (relative_path == NULL)
-		{
-			g_warning ("symbol_db_engine_update_buffer_symbols  (): "
-					   "relative_path is NULL");
-			return FALSE;
-		}
-		g_ptr_array_add (real_files_on_db, relative_path);
-	}	
-	
-	/* create a temporary file for each buffer */
-	for (i=0; i < real_files_list->len; i++) 
-	{
+		gchar *relative_path;
+		const gchar *curr_abs_file;
 		FILE *buffer_mem_file;
 		const gchar *temp_buffer;
 		gint buffer_mem_fd;
 		gint temp_size;
 		gchar *shared_temp_file;
 		gchar *base_filename;
-		const gchar *curr_real_file;
-				
-		curr_real_file = g_ptr_array_index (real_files_list, i);
 		
+		curr_abs_file = g_ptr_array_index (real_files_list, 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 scan buffer claiming to be %s because not in db",
+						 curr_abs_file);
+			continue;
+		}		
+		
+		relative_path = symbol_db_engine_get_file_db_path (dbe, curr_abs_file);
+		if (relative_path == NULL)
+		{
+			g_warning ("symbol_db_engine_update_buffer_symbols  (): "
+					   "relative_path is NULL");
+			continue;
+		}
+		g_ptr_array_add (real_files_on_db, relative_path);
+
 		/* it's ok to have just the base filename to create the
 		 * target buffer one */
-		base_filename = g_filename_display_basename (curr_real_file);
+		base_filename = g_filename_display_basename (relative_path);
 		
 		shared_temp_file = g_strdup_printf ("/anjuta-%d-%ld-%s", getpid (),
 						 time (NULL), base_filename);
@@ -5689,7 +5693,7 @@
 		{
 			g_warning ("Error while trying to open a shared memory file. Be"
 					   "sure to have "SHARED_MEMORY_PREFIX" mounted with tmpfs");
-			return FALSE;
+			return -1;
 		}
 	
 		buffer_mem_file = fdopen (buffer_mem_fd, "w+b");
@@ -5721,18 +5725,25 @@
 			g_free (shared_temp_file);
 		}
 	}
+
+	/* in case we didn't have any good buffer to scan...*/
+	ret_id = -1;
 	
-	/* data will be freed when callback will be called. The signal will be
-	 * disconnected too, don't worry about disconnecting it by hand.
-	 */
-	g_signal_connect (G_OBJECT (dbe), "scan-end",
-					  G_CALLBACK (on_scan_update_buffer_end), real_files_list);
-	
-	ret_code = sdb_engine_scan_files_1 (dbe, temp_files, real_files_on_db, TRUE);
-	if (ret_code == TRUE)
-		ret_id = sdb_engine_get_unique_scan_id (dbe);
-	else
-		ret_id = -1;
+	/* it may happens that no buffer is correctly set up */
+	if (real_files_on_db->len > 0)
+	{
+		/* data will be freed when callback will be called. The signal will be
+	 	* disconnected too, don't worry about disconnecting it by hand.
+	 	*/
+		g_signal_connect (G_OBJECT (dbe), "scan-end",
+						  G_CALLBACK (on_scan_update_buffer_end), real_files_list);
+	
+		ret_code = sdb_engine_scan_files_1 (dbe, temp_files, real_files_on_db, TRUE);
+		if (ret_code == TRUE)
+			ret_id = sdb_engine_get_unique_scan_id (dbe);
+		else
+			ret_id = -1;
+	}
 	
 	/* let's free the temp_files array */
 	for (i=0; i < temp_files->len; i++)

Modified: trunk/plugins/symbol-db/symbol-db-engine-core.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-core.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-core.h	Tue Dec 23 17:55:59 2008
@@ -63,22 +63,8 @@
 	SymbolDBEnginePriv *priv;
 };
 
-/* WARNING: these must match the ones on libanjuta.idl [AnjutaSymbol::Field] */
-typedef enum {
-	SYMINFO_SIMPLE = 1,
-	SYMINFO_FILE_PATH = 2,
-	SYMINFO_IMPLEMENTATION = 4,
-	SYMINFO_ACCESS = 8,
-	SYMINFO_KIND = 16,
-	SYMINFO_TYPE = 32,
-	SYMINFO_TYPE_NAME = 64,
-	SYMINFO_LANGUAGE = 128,
-	SYMINFO_FILE_IGNORE = 256,
-	SYMINFO_FILE_INCLUDE = 512,
-	SYMINFO_PROJECT_NAME = 1024,
-	SYMINFO_WORKSPACE_NAME = 2048
-	
-} SymExtraInfo;
+
+
 
 GType sdb_engine_get_type (void) G_GNUC_CONST;
 

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c	Tue Dec 23 17:55:59 2008
@@ -197,7 +197,7 @@
 
 const gchar*
 symbol_db_engine_iterator_node_get_symbol_extra_string (SymbolDBEngineIteratorNode *dbin,
-												   gint sym_info)
+												   SymExtraInfo sym_info)
 {
 	SymbolDBEngineIteratorNodePriv *priv;
 	const GValue *value = NULL;

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h	Tue Dec 23 17:55:59 2008
@@ -28,6 +28,8 @@
 #include <glib-object.h>
 #include <libgda/libgda.h>
 
+#include "symbol-db-engine-priv.h"
+
 G_BEGIN_DECLS
 
 #define SYMBOL_TYPE_DB_ENGINE_ITERATOR_NODE             (sdb_engine_iterator_node_get_type ())
@@ -76,7 +78,7 @@
  */
 const gchar*
 symbol_db_engine_iterator_node_get_symbol_extra_string (SymbolDBEngineIteratorNode *dbin,
-												   gint sym_info);
+												   SymExtraInfo sym_info);
 
 void
 symbol_db_engine_iterator_node_set_data (SymbolDBEngineIteratorNode *dbin,

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator.h	Tue Dec 23 17:55:59 2008
@@ -42,6 +42,8 @@
 typedef struct _SymbolDBEngineIterator SymbolDBEngineIterator;
 typedef struct _SymbolDBEngineIteratorPriv SymbolDBEngineIteratorPriv;
 
+
+
 struct _SymbolDBEngineIteratorClass
 {
 	SymbolDBEngineIteratorNodeClass parent_class;

Modified: trunk/plugins/symbol-db/symbol-db-engine-priv.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-priv.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-priv.h	Tue Dec 23 17:55:59 2008
@@ -220,6 +220,24 @@
 } DynChildQueryNode;
 
 
+/* WARNING: these must match the ones on libanjuta.idl [AnjutaSymbol::Field] */
+typedef enum {
+	SYMINFO_SIMPLE = 1,
+	SYMINFO_FILE_PATH = 2,
+	SYMINFO_IMPLEMENTATION = 4,
+	SYMINFO_ACCESS = 8,
+	SYMINFO_KIND = 16,
+	SYMINFO_TYPE = 32,
+	SYMINFO_TYPE_NAME = 64,
+	SYMINFO_LANGUAGE = 128,
+	SYMINFO_FILE_IGNORE = 256,
+	SYMINFO_FILE_INCLUDE = 512,
+	SYMINFO_PROJECT_NAME = 1024,
+	SYMINFO_WORKSPACE_NAME = 2048
+	
+} SymExtraInfo;
+
+
 /* the SymbolDBEngine Private structure */
 struct _SymbolDBEnginePriv
 {

Modified: trunk/plugins/symbol-db/symbol-db-engine-queries.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-queries.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-queries.h	Tue Dec 23 17:55:59 2008
@@ -99,7 +99,7 @@
 SymbolDBEngineIterator *
 symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, 
 									const gchar* full_local_file_path, gulong line, 
-									 SymExtraInfo sym_info);
+									SymExtraInfo sym_info);
 
 
 /**

Modified: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h	Tue Dec 23 17:55:59 2008
@@ -30,9 +30,12 @@
  */
 
 #include "symbol-db-engine-core.h"
+#include "symbol-db-engine-iterator-node.h"
+#include "symbol-db-engine-iterator.h"
+
 #include "symbol-db-engine-queries.h"
 #include "symbol-db-engine-utils.h"
-#include "symbol-db-engine-iterator.h"
-#include "symbol-db-engine-iterator-node.h"
+
+
 
 #endif



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