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



Author: mcora
Date: Sat Dec 13 15:49:26 2008
New Revision: 4442
URL: http://svn.gnome.org/viewvc/anjuta?rev=4442&view=rev

Log:
	* plugins/symbol-db/plugin.c (gtree_compare_func),
	(on_editor_buffer_symbols_update_timeout),
	(on_project_element_added), (do_check_offline_files_changed),
	(on_scan_end_manager), (symbol_db_activate):
	* plugins/symbol-db/plugin.h:
	* plugins/symbol-db/symbol-db-engine.c
	(sdb_engine_get_dyn_query_node_by_id),
	(sdb_engine_insert_dyn_query_node_by_id),
	(sdb_engine_populate_db_by_tags), (sdb_engine_ctags_output_thread),
	(sdb_engine_scan_files_1), (sdb_engine_init):
	* plugins/symbol-db/symbol-db-prefs.c (symbol_db_prefs_new):
	code cleaning and converted (gpointer) to GINT_TO_POINTER to avoid x64 problems.
	Implemented last scan-end task on plugin.c.

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/plugin.h
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-prefs.c

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Sat Dec 13 15:49:26 2008
@@ -88,7 +88,7 @@
 static gint
 gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
 {
-	return (gint)a - (gint)b;
+	return GPOINTER_TO_INT (a) - GPOINTER_TO_INT (b);
 }
 
 static void
@@ -213,7 +213,7 @@
 	g_ptr_array_add (text_buffers, current_buffer);	
 
 	buffer_sizes = g_ptr_array_new ();
-	g_ptr_array_add (buffer_sizes, (gpointer)buffer_size);	
+	g_ptr_array_add (buffer_sizes, GINT_TO_POINTER (buffer_size));
 
 	
 	gint proc_id = symbol_db_engine_update_buffer_symbols (sdb_plugin->sdbe_project,
@@ -864,6 +864,7 @@
 {
 	GFile *gfile = NULL;		
 	gchar *filename;
+	gint real_added;
 	GPtrArray *files_array;			
 		
 	g_return_if_fail (sdb_plugin->project_root_uri != NULL);
@@ -875,10 +876,18 @@
 	files_array = g_ptr_array_new ();
 	g_ptr_array_add (files_array, filename);
 	
-	/* TODO: manage signals freezing */
-	/* use a custom function to add the files to db */
-	do_add_new_files (sdb_plugin, files_array, TASK_ELEMENT_ADDED);
+	symbol_db_view_locals_recv_signals_from_engine (																
+		SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+				 sdb_plugin->sdbe_project, FALSE);
+	sdb_plugin->is_adding_element = TRUE;
 
+	/* 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) 
+	{
+		sdb_plugin->is_adding_element = FALSE;
+	}
+	
 	g_ptr_array_foreach (files_array, (GFunc)g_free, NULL);
 	g_ptr_array_free (files_array, TRUE);
 	
@@ -1386,7 +1395,7 @@
 			continue;
 		}
 
-		g_hash_table_insert (prj_elements_hash, filename, (gpointer)1);		
+		g_hash_table_insert (prj_elements_hash, filename, GINT_TO_POINTER (1));		
 		g_object_unref (gfile);
 	}	
 	
@@ -1444,7 +1453,7 @@
 		 */
 		for (i = 0; i < g_hash_table_size (prj_elements_hash); i++)
 		{
-			DEBUG_PRINT ("ARRAY ADD %s", g_list_nth_data (keys, 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));
 		}		
 	}
@@ -1717,7 +1726,8 @@
 			break;
 			
 		case TASK_ELEMENT_ADDED:
-			DEBUG_PRINT ("TODO: TASK_ELEMENT_ADDED");
+			DEBUG_PRINT ("received TASK_ELEMENT_ADDED");
+			symbol_db->is_adding_element = FALSE;
 			break;
 			
 		case TASK_OFFLINE_CHANGES:
@@ -1740,14 +1750,7 @@
 	
 	/* ok, we're done. Remove the proc_id from the GTree coz we won't use it anymore */
 	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 ("symbol_db->is_offline_scanning == %d && "
-		"symbol_db->is_project_importing == %d && "
-		"symbol_db->is_project_updating == %d", 
-				symbol_db->is_offline_scanning,
-				symbol_db->is_project_importing,
-				symbol_db->is_project_updating);
+		g_warning ("Cannot remove proc_id from GTree");
 	
 	/**
  	 * perform some checks on some booleans. If they're all successfully passed
@@ -1755,7 +1758,8 @@
  	 */
 	if (symbol_db->is_offline_scanning == FALSE && 
 		symbol_db->is_project_importing == FALSE &&
-		symbol_db->is_project_updating == FALSE)
+		symbol_db->is_project_updating == FALSE &&
+		symbol_db->is_adding_element == FALSE)
 	{
 		symbol_db_view_locals_recv_signals_from_engine (
 			SYMBOL_DB_VIEW_LOCALS (symbol_db->dbv_view_tree_locals), 
@@ -1812,6 +1816,7 @@
 	symbol_db->is_offline_scanning = FALSE;
 	symbol_db->is_project_importing = FALSE;
 	symbol_db->is_project_updating = FALSE;
+	symbol_db->is_adding_element = FALSE;	
 	
 	DEBUG_PRINT ("SymbolDBPlugin: Initializing engines with %s", ctags_path);
 	/* create SymbolDBEngine(s) */

Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h	(original)
+++ trunk/plugins/symbol-db/plugin.h	Sat Dec 13 15:49:26 2008
@@ -123,6 +123,7 @@
 	gboolean is_project_importing;		/* refreshes or resumes after abort */
 	gboolean is_project_updating;		/* makes up to date symbols of the project's files */
 	gboolean is_offline_scanning;		/* detects offline changes to makefile.am */
+	gboolean is_adding_element;			/* we're adding an element */
 };
 
 struct _SymbolDBPluginClass {

Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c	Sat Dec 13 15:49:26 2008
@@ -667,19 +667,19 @@
 	if (node->has_gtree_child == FALSE) 
 	{
 		/* use only sym_info as key, ignore other_parameters */
-		return g_tree_lookup (node->sym_extra_info_gtree, (gpointer)sym_info);
+		return g_tree_lookup (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info));
 	}
 	else {
 		GTree *child_gtree;
 		DynChildQueryNode *result;
 		
-		child_gtree = g_tree_lookup (node->sym_extra_info_gtree, (gpointer)sym_info);
+		child_gtree = g_tree_lookup (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info));
 		if (child_gtree == NULL) 
 		{			
 			return NULL;
 		}
 		
-		result = g_tree_lookup (child_gtree, (gpointer)other_parameters);		
+		result = g_tree_lookup (child_gtree, GINT_TO_POINTER (other_parameters));
 		return result;
 	}
 }
@@ -765,7 +765,7 @@
 		dyn_node->query_str = g_strdup (sql);
 				
 		/* insert it into gtree, thanks */
-		g_tree_insert (node->sym_extra_info_gtree, (gpointer)sym_info, dyn_node);
+		g_tree_insert (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info), dyn_node);
 		
 		/* return it */
 		return dyn_node;
@@ -802,9 +802,9 @@
 					 other_parameters, sym_info, dyn_node);
 */		
 		/* insert the dyn_node into child_gtree, then child_gtree into main_gtree */
-		g_tree_insert (child_gtree, (gpointer)other_parameters, dyn_node);
+		g_tree_insert (child_gtree, GINT_TO_POINTER (other_parameters), dyn_node);
 		
-		g_tree_insert (node->sym_extra_info_gtree, (gpointer)sym_info, child_gtree);
+		g_tree_insert (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info), child_gtree);
 		
 		/* return it */
 		return dyn_node;		
@@ -1387,7 +1387,7 @@
 				 tags_total_DEBUG, elapsed_DEBUG / tags_total_DEBUG);
 
 	/* notify listeners that another file has been scanned */
-	g_async_queue_push (priv->signals_queue, (gpointer)(SINGLE_FILE_SCAN_END +1));
+	g_async_queue_push (priv->signals_queue, GINT_TO_POINTER (SINGLE_FILE_SCAN_END +1));
 	
 	/* we've done with tag_file but we don't need to tagsClose (tag_file); */
 }
@@ -1407,8 +1407,8 @@
 	dbe = output->user_data;
 	chars = chars_ptr = output->chars;	
 	
-	g_return_val_if_fail (dbe != NULL, (gpointer)-1);	
-	g_return_val_if_fail (chars_ptr != NULL, (gpointer)-1);
+	g_return_val_if_fail (dbe != NULL, GINT_TO_POINTER (-1));	
+	g_return_val_if_fail (chars_ptr != NULL, GINT_TO_POINTER (-1));
 
 	priv = dbe->priv;
 
@@ -1522,8 +1522,8 @@
 							g_async_queue_try_pop (priv->updated_scope_symbols_id))) > 0)
 					{
 						g_async_queue_lock (priv->signals_queue);
-						g_async_queue_push_unlocked (priv->signals_queue, (gpointer)
-													 (SYMBOL_SCOPE_UPDATED + 1));
+						g_async_queue_push_unlocked (priv->signals_queue, GINT_TO_POINTER (
+													 SYMBOL_SCOPE_UPDATED + 1));
 						g_async_queue_push_unlocked (priv->signals_queue, 
 													GINT_TO_POINTER(tmp_updated));
 						g_async_queue_unlock (priv->signals_queue);
@@ -1909,12 +1909,12 @@
 			if (i + 1 >= files_list->len) 
 			{
 				/* yes */
-				g_async_queue_push (priv->scan_queue, (gpointer) DO_UPDATE_SYMS_AND_EXIT);
+				g_async_queue_push (priv->scan_queue, GINT_TO_POINTER (DO_UPDATE_SYMS_AND_EXIT));
 			}
 			else 
 			{
 				/* no */
-				g_async_queue_push (priv->scan_queue, (gpointer) DO_UPDATE_SYMS);
+				g_async_queue_push (priv->scan_queue, GINT_TO_POINTER (DO_UPDATE_SYMS));
 			}
 		}
 		else 
@@ -1922,11 +1922,11 @@
 			if (i + 1 >= files_list->len) 
 			{
 				/* yes */
-				g_async_queue_push (priv->scan_queue, (gpointer) DONT_UPDATE_SYMS_AND_EXIT);
+				g_async_queue_push (priv->scan_queue, GINT_TO_POINTER (DONT_UPDATE_SYMS_AND_EXIT));
 			}
 			else {
 				/* no */
-				g_async_queue_push (priv->scan_queue, (gpointer) DONT_UPDATE_SYMS);
+				g_async_queue_push (priv->scan_queue, GINT_TO_POINTER (DONT_UPDATE_SYMS));
 			}
 		}
 
@@ -1943,7 +1943,7 @@
 			/* else add a DONT_FAKE_UPDATE_SYMS marker, just to notify that this 
 			 * is not a fake file scan 
 			 */
-			g_async_queue_push (priv->scan_queue, (gpointer) DONT_FAKE_UPDATE_SYMS);
+			g_async_queue_push (priv->scan_queue, GINT_TO_POINTER (DONT_FAKE_UPDATE_SYMS));
 		}
 	}
 
@@ -1969,64 +1969,64 @@
 
 	/* please if you change some value below here remember to change also on */
 	g_hash_table_insert (h, g_strdup("class"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_CLASS);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_CLASS));
 
 	g_hash_table_insert (h, g_strdup("enum"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_ENUM);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_ENUM));
 
 	g_hash_table_insert (h, g_strdup("enumerator"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_ENUMERATOR);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_ENUMERATOR));
 
 	g_hash_table_insert (h, g_strdup("field"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_FIELD);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_FIELD));
 
 	g_hash_table_insert (h, g_strdup("function"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_FUNCTION);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_FUNCTION));
 
 	g_hash_table_insert (h, g_strdup("interface"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_INTERFACE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_INTERFACE));
 
 	g_hash_table_insert (h, g_strdup("member"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_MEMBER);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_MEMBER));
 
 	g_hash_table_insert (h, g_strdup("method"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_METHOD);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_METHOD));
 
 	g_hash_table_insert (h, g_strdup("namespace"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_NAMESPACE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_NAMESPACE));
 
 	g_hash_table_insert (h, g_strdup("package"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_PACKAGE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_PACKAGE));
 
 	g_hash_table_insert (h, g_strdup("prototype"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_PROTOTYPE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_PROTOTYPE));
 				
 	g_hash_table_insert (h, g_strdup("struct"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_STRUCT);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_STRUCT));
 				
 	g_hash_table_insert (h, g_strdup("typedef"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_TYPEDEF);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_TYPEDEF));
 				
 	g_hash_table_insert (h, g_strdup("union"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_UNION);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_UNION));
 				
 	g_hash_table_insert (h, g_strdup("variable"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_VARIABLE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_VARIABLE));
 
 	g_hash_table_insert (h, g_strdup("externvar"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_EXTERNVAR);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_EXTERNVAR));
 
 	g_hash_table_insert (h, g_strdup("macro"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_MACRO);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_MACRO));
 
 	g_hash_table_insert (h, g_strdup("macro_with_arg"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG));
 
 	g_hash_table_insert (h, g_strdup("file"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_FILE);
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_FILE));
 
 	g_hash_table_insert (h, g_strdup("other"), 
-				(gpointer)IANJUTA_SYMBOL_TYPE_OTHER);	
+				GINT_TO_POINTER (IANJUTA_SYMBOL_TYPE_OTHER));
 	
 	
 	/* create the hash table that will store shared memory files strings used for 

Modified: trunk/plugins/symbol-db/symbol-db-prefs.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-prefs.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-prefs.c	Sat Dec 13 15:49:26 2008
@@ -672,7 +672,7 @@
 	while (item != NULL)
 	{
 		g_hash_table_insert (priv->enabled_packages_hash, (gpointer)g_strdup (item->data), 
-							 (gpointer)TRUE);
+							 GINT_TO_POINTER (TRUE));
 		item = item->next;
 	}	
 	



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